From 49540f0af70620ba839a71aa9b01655a2fed056f Mon Sep 17 00:00:00 2001 From: Alex Toff Date: Thu, 12 Jan 2023 18:38:01 +0000 Subject: [PATCH] feat: Nuxt 3 & Vue 3 (#296) --- .babelrc | 16 - .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 3 +- .env.example | 2 +- .eslintignore | 5 +- .eslintrc.js | 43 +- .github/workflows/ci.yml | 25 +- .gitignore | 108 +- .prettierrc | 6 + .vscode/settings.json | 11 +- README.md | 3 +- apollo.config.js | 11 - app.config.ts | 4 + app.vue | 15 + assets/styles/_datepicker.scss | 2 + assets/styles/app.scss | 3 +- babel.config.json | 18 - classes/Booking.js | 6 +- classes/BookingStage.js | 2 +- classes/Errors.js | 17 +- classes/Ticket.js | 4 +- classes/TicketsMatrix.js | 19 +- codegen.ts | 21 +- commitlint.config.js | 3 - components/admin/AdminPage.vue | 9 +- components/admin/AdminSidebar.vue | 5 +- .../admin/permissions/PermissionsAssigner.vue | 31 +- components/auth/AuthBox.vue | 394 + components/auth/AuthPageTemplate.vue | 6 +- components/auth/UserAuthBox.vue | 351 - components/booking/BookingNavigation.vue | 19 +- components/booking/ConcessionType.vue | 19 +- components/booking/GroupTicketButton.vue | 9 +- components/booking/SeatGroup.vue | 25 +- components/booking/SelectedTicketsTable.vue | 12 +- components/booking/Ticket.vue | 33 +- components/booking/TicketOptions.vue | 17 +- components/booking/editor/TicketsEditor.vue | 24 +- .../booking/overview/BookingPriceOverview.vue | 16 +- .../overview/BookingSummaryOverview.vue | 12 +- .../booking/overview/PaymentOverview.vue | 20 +- .../booking/overview/PerformanceOverview.vue | 25 +- .../booking/overview/TicketsOverview.vue | 12 +- components/booking/overview/UserOverview.vue | 22 +- components/booking/overview/VenueOverview.vue | 22 +- components/box-office/BookingDetailsRow.vue | 38 +- components/box-office/BookingRow.vue | 11 +- components/box-office/BoxOfficeNavigation.vue | 24 +- components/box-office/CameraCheckIn.vue | 37 +- ...raScanner.vue => CameraScanner.client.vue} | 16 +- components/box-office/CheckInNotification.vue | 29 +- components/box-office/HardwareScanner.vue | 17 +- .../box-office/HardwareScannerCheckIn.vue | 33 +- .../box-office/InvalidCodeNotification.vue | 6 +- components/box-office/Overview.vue | 51 +- components/layout/DropdownItem.vue | 13 +- components/layout/DropdownNavItem.vue | 12 +- .../layout/LayoutErrorPageInner.vue | 55 +- .../{FooterBar.vue => LayoutFooterBar.vue} | 16 +- .../layout/{NavBar.vue => LayoutNavBar.vue} | 80 +- .../performance/PerformanceOverview.vue | 20 +- .../performance/PerformanceStatusBadge.vue | 14 +- .../TimeGroupedPerformanceSelector.vue | 11 +- .../performance/editor/ConcessionType.vue | 31 +- .../performance/editor/PerformanceEditor.vue | 372 +- components/performance/editor/PriceMatrix.vue | 51 +- components/performance/editor/SeatGroup.vue | 13 +- components/production/ProductionBanner.vue | 137 +- .../production/ProductionCastCredits.vue | 14 +- .../production/ProductionFeaturedImage.vue | 8 +- components/production/ProductionOverview.vue | 16 +- .../production/ProductionPerformances.vue | 12 +- .../production/ProductionPosterImage.vue | 8 +- .../production/ProductionStatusBadge.vue | 77 +- components/production/ProductionTile.vue | 12 +- components/production/RoleGroup.vue | 6 +- .../ContentWarningDisplay.vue | 19 +- .../ContentWarningsDisplay.vue | 6 +- .../production/editor/ProductionEditor.vue | 256 +- .../HaveTicketsReadyScreen.vue | 2 +- .../publicity-screens/PleaseWaitScreen.vue | 8 +- .../publicity-screens/SoldOutScreen.vue | 6 +- .../publicity-screens/WelcomeScreen.vue | 8 +- components/society/SocietyTile.vue | 8 +- components/square/SquarePayment.vue | 109 +- components/ui/Alert.vue | 20 +- components/ui/AllErrorsDisplay.vue | 6 +- components/ui/ClickableLink.vue | 5 +- components/ui/Clock.vue | 9 +- components/ui/ErrorHelper.vue | 8 +- components/ui/Form/RequiredStar.vue | 2 +- components/ui/FormLabel.vue | 14 +- .../ui/Formatters/TimeRemainingCountdown.vue | 17 +- components/ui/InfiniteScroll.vue | 54 +- .../ui/{Inputs => Input}/BooleanInput.vue | 7 +- components/ui/Input/CurrencyInput.vue | 32 + .../ui/{Inputs => Input}/EditorButton.vue | 15 +- .../ui/{Inputs => Input}/ImageInput.vue | 35 +- .../ui/{Inputs => Input}/PercentageInput.vue | 26 +- .../ui/{Inputs => Input}/RichTextInput.vue | 49 +- .../ui/{Inputs => Input}/TicketScanner.vue | 23 +- components/ui/Input/UiInputSelect.vue | 53 + .../{TextInput.vue => Input/UiInputText.vue} | 39 +- components/ui/Input/UiInputTextArea.vue | 22 + components/ui/Input/UiInputToggle.vue | 26 + components/ui/Inputs/CurrencyInput.vue | 40 - components/ui/LoadingContainer.vue | 14 +- components/ui/MenuTile.vue | 17 +- components/ui/Modal.vue | 5 +- components/ui/Nav/SidebarGroup.vue | 6 +- components/ui/Nav/SidebarItem.vue | 25 +- components/ui/PaginationBar.vue | 37 +- components/ui/ProgressBar.vue | 8 +- components/ui/SortIcon.vue | 23 +- components/ui/Tables/PaginatedTable.vue | 25 +- components/ui/Tables/SafeTable.vue | 6 +- components/ui/Tables/TableHeadItem.vue | 6 +- components/ui/Tables/TableRow.vue | 11 +- components/ui/{Badge.vue => UiBadge.vue} | 0 .../ui/{Breadcrumbs.vue => UiBreadcrumbs.vue} | 25 +- components/ui/{Card.vue => UiCard.vue} | 6 +- .../ui/{Carousel.vue => UiCarousel.vue} | 36 +- .../{IconListItem.vue => UiIconListItem.vue} | 6 +- .../ui/{LoadingIcon.vue => UiLoadingIcon.vue} | 6 +- components/ui/UiMap.client.vue | 21 + ...{NonFieldError.vue => UiNonFieldError.vue} | 6 +- .../ui/{StaButton.vue => UiStaButton.vue} | 21 +- .../{TipTapOutput.vue => UiTipTapOutput.vue} | 10 +- components/user/BookingsTable.vue | 12 +- components/user/ChangeEmail.vue | 27 +- components/user/ChangePassword.vue | 28 +- components/user/UserDetails.vue | 43 +- composables/createSafeError.ts | 12 + composables/defineBreadcrumbs.ts | 26 + composables/runSafeMutation.ts | 3 + composables/useDefaultApolloClient.ts | 4 + config.js | 44 - config.public.ts | 35 + cypress.config.ts | 17 + cypress.json | 6 - enums/BaseEnum.js | 20 - enums/BaseEnum.ts | 25 + ...iscCostTypeEnum.js => MiscCostTypeEnum.ts} | 2 +- ...ableStatusEnum.js => PayableStatusEnum.ts} | 2 +- ...nStatusEnum.js => ProductionStatusEnum.ts} | 2 +- ...Enum.js => TransactionProviderNameEnum.ts} | 2 +- ...StatusEnum.js => TransactionStatusEnum.ts} | 2 +- ...tionTypeEnum.js => TransactionTypeEnum.ts} | 2 +- error.vue | 12 + errors/ValidationError.js | 11 - errors/ValidationError.ts | 13 + .../admin/production/SetProductionStatus.gql | 6 +- .../mutations/auth/ActiveAccountMutation.gql | 16 + graphql/mutations/auth/LoginMutation.gql | 21 + .../mutations/auth/RefreshTokenMutation.gql | 6 + .../mutations/auth/RegisterUserMutation.gql | 28 + .../auth/RequestPasswordResetMutation.gql | 16 + .../auth/ResendActivationMutation.gql | 16 + .../mutations/auth/ResetPasswordMutation.gql | 24 + graphql/queries/SocietyDetail.gql | 2 +- .../admin/bookings/AdminBookingLookup.gql | 14 +- .../admin/productions/AdminBookingDetail.gql | 2 +- .../productions/AdminProductionLookup.gql | 2 +- graphql/queries/auth/LoadUserDetails.gql | 6 + graphql/queries/user/CompleteBookings.gql | 1 + graphql/queries/venue/VenuePageDetails.gql | 14 + jest.config.js | 27 - jsconfig.json | 13 - layouts/admin.vue | 13 +- layouts/default.vue | 58 +- ...blicityScreen.vue => publicity-screen.vue} | 2 +- middleware/admin.js | 16 - middleware/admin.ts | 8 + middleware/authed.js | 14 - middleware/authed.ts | 11 + middleware/can-boxoffice.js | 11 - middleware/can-boxoffice.ts | 8 + middleware/not-authed.js | 13 - middleware/not-authed.ts | 8 + netlify.toml | 8 - nuxt.config.js | 184 - nuxt.config.ts | 124 + package.json | 194 +- pages/README.md | 6 - pages/administration.vue | 20 +- pages/administration/finance-reports.vue | 60 +- pages/administration/index.vue | 20 +- .../bookings/[bookingReference]}/index.vue | 64 +- .../create/[performanceId]}/index.vue | 63 +- .../bookings/create/index.vue | 49 +- .../bookings/index.vue | 76 +- .../productions/[productionSlug]/edit.vue | 85 + .../index.vue | 155 +- .../performances/[performanceId]}/edit.vue | 68 +- .../performances/[performanceId]}/index.vue | 86 +- .../performances/create.vue | 79 +- .../[productionSlug]/permissions.vue | 134 + .../productions/_productionSlug/edit.vue | 98 - .../_productionSlug/permissions.vue | 130 - pages/administration/productions/create.vue | 58 +- pages/administration/productions/index.vue | 178 +- pages/administration/tools/ticket-lookup.vue | 54 +- ..._performanceId.vue => [performanceId].vue} | 34 +- .../bookings.vue | 80 +- pages/box-office/[performanceId]/collect.vue | 52 + pages/box-office/[performanceId]/index.vue | 46 + .../sell.vue | 82 +- .../sell/complete.vue | 39 +- .../sell/index.vue | 46 +- .../sell/pay.vue | 81 +- pages/box-office/_performanceId/collect.vue | 50 - pages/box-office/_performanceId/index.vue | 47 - pages/box-office/config.vue | 37 +- pages/box-office/index.vue | 61 +- pages/index.vue | 156 +- pages/login/activate/[token]/index.vue | 54 + pages/login/activate/_token/index.vue | 55 - pages/login/forgot/[token]/index.vue | 79 + pages/login/forgot/_token/index.vue | 80 - pages/login/forgot/index.vue | 158 +- pages/login/index.vue | 28 +- pages/privacy.vue | 29 +- pages/production/{_slug => [slug]}/book.vue | 147 +- .../{_slug => [slug]}/book/-bookingStages.js | 16 +- .../book/[performanceId]}/index.vue | 11 +- .../book/[performanceId]}/overview.vue | 29 +- .../book/[performanceId]}/pay.vue | 80 +- .../book/[performanceId]}/tickets.vue | 49 +- .../book/[performanceId]}/warnings.vue | 45 +- .../{_slug => [slug]}/book/index.vue | 25 +- pages/production/{_slug => [slug]}/index.vue | 100 +- pages/productions.vue | 17 +- .../{_venueSlugs => [venueSlugs]}/index.vue | 36 +- pages/signup.vue | 30 +- pages/societies.vue | 18 +- pages/society/{_slug => [slug]}/index.vue | 46 +- pages/terms.vue | 9 +- .../{_reference => [reference]}/index.vue | 63 +- .../{_reference => [reference]}/tickets.vue | 24 +- .../_token => email-verify/[token]}/index.vue | 62 +- pages/user/email-verify/_token/index.vue | 69 - pages/user/index.vue | 54 +- pages/venue/[slug]/index.vue | 127 + pages/venue/_slug/index.vue | 170 - plugins/auth-helpers.js | 13 - plugins/auth.client.ts | 20 + plugins/font-awesome.ts | 17 + plugins/font-awesome/fontawesome.config.ts | 124 + plugins/fontawesome.config.js | 62 - plugins/google-analytics.ts | 14 + plugins/gtag.js | 8 - plugins/initial-auth.js | 17 - plugins/sentry.ts | 16 + plugins/vue-apollo-options.ts | 14 + plugins/vue-apollo.config.js | 62 - plugins/vue-filters.ts | 35 - plugins/vue-tailwind.js | 60 - ...le-developer-merchantid-domain-association | 0 {assets => public}/audio/beep_negative.mp3 | Bin {assets => public}/audio/beep_positive.mp3 | Bin {assets => public}/audio/beep_single.mp3 | Bin {static => public}/favicon.ico | Bin {static => public}/icon.png | Bin services/authService.js | 366 - services/imageUploadService.js | 16 - services/imageUploadService.ts | 18 + services/index.js | 3 - static/README.md | 11 - store/README.md | 10 - store/auth.js | 48 - store/auth.ts | 404 + store/box-office.js | 58 - store/box-office.ts | 72 + store/index.js | 9 - store/nav.ts | 12 + stylelint.config.js | 22 - tailwind.config.js => tailwind.config.ts | 51 +- tests/e2e/plugins/index.js | 24 - .../{createBooking.js => createBooking.cy.js} | 0 .../specs/{production.js => production.cy.js} | 0 tests/e2e/support/index.js | 19 - tests/unit/classes/Booking.spec.js | 41 +- tests/unit/classes/BookingStage.spec.js | 25 +- tests/unit/classes/Errors.spec.js | 31 +- tests/unit/classes/Ticket.spec.js | 35 +- tests/unit/classes/TicketsMatrix.spec.js | 9 +- tests/unit/components/AuthBox.spec.js | 415 +- .../booking/BookingNavigation.spec.js | 53 +- .../components/booking/ConcessionType.spec.js | 34 +- .../booking/GroupTicketButton.spec.js | 26 +- .../unit/components/booking/SeatGroup.spec.js | 83 +- .../booking/SelectedTicketsTable.spec.js | 19 +- tests/unit/components/booking/Ticket.spec.js | 28 +- .../components/booking/TicketOptions.spec.js | 39 +- .../overview/BookingPriceOverview.spec.js | 28 +- .../booking/overview/BookingSummary.spec.js | 33 +- .../booking/overview/PaymentOverview.spec.js | 21 +- .../overview/PerformanceOverview.spec.js | 24 +- .../booking/overview/TicketOverview.spec.js | 17 +- .../booking/overview/UserOverview.spec.js | 41 +- .../booking/overview/VenueOverview.spec.js | 50 +- .../unit/components/layout/FooterBar.spec.js | 25 +- tests/unit/components/layout/NavBar.spec.js | 78 +- .../production/PerformanceOverview.spec.js | 44 +- .../production/ProductionBanner.spec.js | 131 +- .../production/ProductionCastCredits.spec.js | 60 +- .../production/ProductionOverview.spec.js | 69 +- .../production/ProductionPerformances.spec.js | 72 +- .../production/ProductionTile.spec.js | 42 +- .../components/society/SocietyTile.spec.js | 38 +- tests/unit/components/square/SquarePayment.js | 63 - .../components/square/SquarePayment.spec.js | 42 + tests/unit/components/ui/Breadcrumbs.spec.js | 45 +- tests/unit/components/ui/Carousel.spec.js | 90 +- .../unit/components/ui/InfiniteScroll.spec.js | 129 +- .../unit/components/ui/PaginationBar.spec.js | 14 +- tests/unit/components/ui/TextInput.spec.js | 33 +- .../unit/components/user/ChangeEmail.spec.js | 39 +- .../components/user/ChangePassword.spec.js | 64 +- .../unit/components/user/UserDetails.spec.js | 55 +- tests/unit/helpers.js | 159 - tests/unit/pages/Home.spec.js | 96 +- tests/unit/pages/PublicityScreen.spec.js | 134 +- tests/unit/pages/auth/ActivateAccount.spec.js | 107 +- tests/unit/pages/auth/ForgotPassword.spec.js | 221 +- tests/unit/pages/auth/Login.spec.js | 43 +- tests/unit/pages/auth/Signup.spec.js | 36 +- tests/unit/pages/booking/Book.spec.js | 314 +- .../unit/pages/booking/BookingStages.spec.js | 36 +- .../stages/AudienceWarningsStage.spec.js | 29 +- .../booking/stages/OverviewStage.spec.js | 26 +- .../pages/booking/stages/PaymentStage.spec.js | 135 +- .../stages/PickPerformanceStage.spec.js | 45 +- .../stages/TicketSelectionStage.spec.js | 56 +- .../unit/pages/production/Production.spec.js | 31 +- .../production/UpcomingProductions.spec.js | 98 +- .../unit/pages/societies/AllSocieties.spec.js | 100 +- tests/unit/pages/societies/Society.spec.js | 121 +- .../pages/user/EmailChangeActivate.spec.js | 125 - tests/unit/pages/user/EmailVerify.spec.js | 120 +- tests/unit/pages/user/MyAccount.spec.js | 35 +- tests/unit/pages/user/ViewBooking.spec.js | 77 +- tests/unit/pages/venues/Venue.spec.js | 151 +- tests/unit/setup.ts | 22 - tests/unit/{ => support}/fixtures/Address.js | 0 tests/unit/{ => support}/fixtures/Booking.js | 0 .../unit/{ => support}/fixtures/CastMember.js | 0 .../{ => support}/fixtures/ConcessionType.js | 0 .../fixtures/ConcessionTypeBookingType.js | 0 .../unit/{ => support}/fixtures/CrewMember.js | 0 tests/unit/{ => support}/fixtures/CrewRole.js | 0 tests/unit/{ => support}/fixtures/Discount.js | 0 .../fixtures/DiscountRequirement.js | 0 tests/unit/{ => support}/fixtures/MiscCost.js | 0 tests/unit/{ => support}/fixtures/Payment.js | 0 .../{ => support}/fixtures/Performance.js | 0 .../fixtures/PerformanceSeatGroup.js | 0 .../{ => support}/fixtures/PriceBreakdown.js | 0 .../fixtures/PriceBreakdownTicket.js | 0 .../unit/{ => support}/fixtures/Production.js | 0 .../fixtures/ProductionTeamMember.js | 0 .../unit/{ => support}/fixtures/SeatGroup.js | 0 tests/unit/{ => support}/fixtures/Society.js | 0 tests/unit/{ => support}/fixtures/Ticket.js | 0 tests/unit/{ => support}/fixtures/User.js | 0 tests/unit/{ => support}/fixtures/Venue.js | 0 .../fixtures/instances/FakeErrors.js | 0 .../fixtures/instances/FullBooking.js | 12 +- .../fixtures/support/GenericApolloResponse.js | 0 .../fixtures/support/GenericError.js | 0 .../fixtures/support/GenericErrorsResponse.js | 0 .../support/GenericMutationResponse.js | 0 .../fixtures/support/GenericNodeConnection.js | 0 .../fixtures/support/GenericNodeEdge.js | 0 tests/unit/support/helpers.ts | 23 + tests/unit/support/helpers/api.ts | 6 + tests/unit/support/helpers/mount.ts | 247 + tests/unit/support/setup.ts | 24 + tests/unit/support/stubs.js | 5 + tests/unit/support/stubs/square-web-sdk.ts | 34 + tests/unit/test.spec.example.js | 9 +- tsconfig.json | 24 +- utils.js | 222 - utils/alerts.ts | 42 + utils/analytics.ts | 31 + utils/api.ts | 102 + utils/datetime.ts | 89 + utils/lang.js | 6 - utils/lang.ts | 34 + utils/misc.js | 26 + utils/performance.js | 11 - utils/performance.ts | 14 + utils/production.ts | 5 + vitest.config.ts | 52 + vue-shim.d.ts | 4 - yarn.lock | 16275 ++++------------ 396 files changed, 12152 insertions(+), 20408 deletions(-) delete mode 100644 .babelrc create mode 100644 .prettierrc delete mode 100644 apollo.config.js create mode 100644 app.config.ts create mode 100644 app.vue create mode 100644 assets/styles/_datepicker.scss delete mode 100644 babel.config.json delete mode 100644 commitlint.config.js create mode 100644 components/auth/AuthBox.vue delete mode 100644 components/auth/UserAuthBox.vue rename components/box-office/{CameraScanner.vue => CameraScanner.client.vue} (93%) rename layouts/error.vue => components/layout/LayoutErrorPageInner.vue (57%) rename components/layout/{FooterBar.vue => LayoutFooterBar.vue} (89%) rename components/layout/{NavBar.vue => LayoutNavBar.vue} (79%) rename components/ui/{Inputs => Input}/BooleanInput.vue (87%) create mode 100644 components/ui/Input/CurrencyInput.vue rename components/ui/{Inputs => Input}/EditorButton.vue (81%) rename components/ui/{Inputs => Input}/ImageInput.vue (93%) rename components/ui/{Inputs => Input}/PercentageInput.vue (60%) rename components/ui/{Inputs => Input}/RichTextInput.vue (74%) rename components/ui/{Inputs => Input}/TicketScanner.vue (84%) create mode 100644 components/ui/Input/UiInputSelect.vue rename components/ui/{TextInput.vue => Input/UiInputText.vue} (75%) create mode 100644 components/ui/Input/UiInputTextArea.vue create mode 100644 components/ui/Input/UiInputToggle.vue delete mode 100644 components/ui/Inputs/CurrencyInput.vue rename components/ui/{Badge.vue => UiBadge.vue} (100%) rename components/ui/{Breadcrumbs.vue => UiBreadcrumbs.vue} (84%) rename components/ui/{Card.vue => UiCard.vue} (95%) rename components/ui/{Carousel.vue => UiCarousel.vue} (92%) rename components/ui/{IconListItem.vue => UiIconListItem.vue} (91%) rename components/ui/{LoadingIcon.vue => UiLoadingIcon.vue} (85%) create mode 100644 components/ui/UiMap.client.vue rename components/ui/{NonFieldError.vue => UiNonFieldError.vue} (92%) rename components/ui/{StaButton.vue => UiStaButton.vue} (83%) rename components/ui/{TipTapOutput.vue => UiTipTapOutput.vue} (64%) create mode 100644 composables/createSafeError.ts create mode 100644 composables/defineBreadcrumbs.ts create mode 100644 composables/runSafeMutation.ts create mode 100644 composables/useDefaultApolloClient.ts delete mode 100644 config.js create mode 100644 config.public.ts create mode 100644 cypress.config.ts delete mode 100644 cypress.json delete mode 100644 enums/BaseEnum.js create mode 100644 enums/BaseEnum.ts rename enums/{MiscCostTypeEnum.js => MiscCostTypeEnum.ts} (74%) rename enums/{PayableStatusEnum.js => PayableStatusEnum.ts} (89%) rename enums/{ProductionStatusEnum.js => ProductionStatusEnum.ts} (89%) rename enums/{TransactionProviderNameEnum.js => TransactionProviderNameEnum.ts} (87%) rename enums/{TransactionStatusEnum.js => TransactionStatusEnum.ts} (87%) rename enums/{TransactionTypeEnum.js => TransactionTypeEnum.ts} (84%) create mode 100644 error.vue delete mode 100644 errors/ValidationError.js create mode 100644 errors/ValidationError.ts create mode 100644 graphql/mutations/auth/ActiveAccountMutation.gql create mode 100644 graphql/mutations/auth/LoginMutation.gql create mode 100644 graphql/mutations/auth/RefreshTokenMutation.gql create mode 100644 graphql/mutations/auth/RegisterUserMutation.gql create mode 100644 graphql/mutations/auth/RequestPasswordResetMutation.gql create mode 100644 graphql/mutations/auth/ResendActivationMutation.gql create mode 100644 graphql/mutations/auth/ResetPasswordMutation.gql create mode 100644 graphql/queries/auth/LoadUserDetails.gql create mode 100644 graphql/queries/venue/VenuePageDetails.gql delete mode 100644 jest.config.js delete mode 100644 jsconfig.json rename layouts/{publicityScreen.vue => publicity-screen.vue} (85%) delete mode 100644 middleware/admin.js create mode 100644 middleware/admin.ts delete mode 100644 middleware/authed.js create mode 100644 middleware/authed.ts delete mode 100644 middleware/can-boxoffice.js create mode 100644 middleware/can-boxoffice.ts delete mode 100644 middleware/not-authed.js create mode 100644 middleware/not-authed.ts delete mode 100644 netlify.toml delete mode 100644 nuxt.config.js create mode 100644 nuxt.config.ts delete mode 100644 pages/README.md rename pages/administration/productions/{_productionSlug/bookings/_bookingReference => [productionSlug]/bookings/[bookingReference]}/index.vue (69%) rename pages/administration/productions/{_productionSlug/bookings/create/_performanceId => [productionSlug]/bookings/create/[performanceId]}/index.vue (77%) rename pages/administration/productions/{_productionSlug => [productionSlug]}/bookings/create/index.vue (70%) rename pages/administration/productions/{_productionSlug => [productionSlug]}/bookings/index.vue (74%) create mode 100644 pages/administration/productions/[productionSlug]/edit.vue rename pages/administration/productions/{_productionSlug => [productionSlug]}/index.vue (80%) rename pages/administration/productions/{_productionSlug/performances/_performanceId => [productionSlug]/performances/[performanceId]}/edit.vue (58%) rename pages/administration/productions/{_productionSlug/performances/_performanceId => [productionSlug]/performances/[performanceId]}/index.vue (84%) rename pages/administration/productions/{_productionSlug => [productionSlug]}/performances/create.vue (50%) create mode 100644 pages/administration/productions/[productionSlug]/permissions.vue delete mode 100644 pages/administration/productions/_productionSlug/edit.vue delete mode 100644 pages/administration/productions/_productionSlug/permissions.vue rename pages/box-office/{_performanceId.vue => [performanceId].vue} (58%) rename pages/box-office/{_performanceId => [performanceId]}/bookings.vue (81%) create mode 100644 pages/box-office/[performanceId]/collect.vue create mode 100644 pages/box-office/[performanceId]/index.vue rename pages/box-office/{_performanceId => [performanceId]}/sell.vue (63%) rename pages/box-office/{_performanceId => [performanceId]}/sell/complete.vue (84%) rename pages/box-office/{_performanceId => [performanceId]}/sell/index.vue (81%) rename pages/box-office/{_performanceId => [performanceId]}/sell/pay.vue (87%) delete mode 100644 pages/box-office/_performanceId/collect.vue delete mode 100644 pages/box-office/_performanceId/index.vue create mode 100644 pages/login/activate/[token]/index.vue delete mode 100644 pages/login/activate/_token/index.vue create mode 100644 pages/login/forgot/[token]/index.vue delete mode 100644 pages/login/forgot/_token/index.vue rename pages/production/{_slug => [slug]}/book.vue (75%) rename pages/production/{_slug => [slug]}/book/-bookingStages.js (76%) rename pages/production/{_slug/book/_performanceId => [slug]/book/[performanceId]}/index.vue (72%) rename pages/production/{_slug/book/_performanceId => [slug]/book/[performanceId]}/overview.vue (78%) rename pages/production/{_slug/book/_performanceId => [slug]/book/[performanceId]}/pay.vue (74%) rename pages/production/{_slug/book/_performanceId => [slug]/book/[performanceId]}/tickets.vue (77%) rename pages/production/{_slug/book/_performanceId => [slug]/book/[performanceId]}/warnings.vue (77%) rename pages/production/{_slug => [slug]}/book/index.vue (71%) rename pages/production/{_slug => [slug]}/index.vue (65%) rename pages/publicity-screen/{_venueSlugs => [venueSlugs]}/index.vue (95%) rename pages/society/{_slug => [slug]}/index.vue (83%) rename pages/user/booking/{_reference => [reference]}/index.vue (78%) rename pages/user/booking/{_reference => [reference]}/tickets.vue (76%) rename pages/user/{email-change/_token => email-verify/[token]}/index.vue (72%) delete mode 100644 pages/user/email-verify/_token/index.vue create mode 100644 pages/venue/[slug]/index.vue delete mode 100644 pages/venue/_slug/index.vue delete mode 100644 plugins/auth-helpers.js create mode 100644 plugins/auth.client.ts create mode 100644 plugins/font-awesome.ts create mode 100644 plugins/font-awesome/fontawesome.config.ts delete mode 100644 plugins/fontawesome.config.js create mode 100644 plugins/google-analytics.ts delete mode 100644 plugins/gtag.js delete mode 100644 plugins/initial-auth.js create mode 100644 plugins/sentry.ts create mode 100644 plugins/vue-apollo-options.ts delete mode 100644 plugins/vue-apollo.config.js delete mode 100644 plugins/vue-filters.ts delete mode 100644 plugins/vue-tailwind.js rename {static => public}/.well-known/apple-developer-merchantid-domain-association (100%) rename {assets => public}/audio/beep_negative.mp3 (100%) rename {assets => public}/audio/beep_positive.mp3 (100%) rename {assets => public}/audio/beep_single.mp3 (100%) rename {static => public}/favicon.ico (100%) mode change 100755 => 100644 rename {static => public}/icon.png (100%) delete mode 100644 services/authService.js delete mode 100644 services/imageUploadService.js create mode 100644 services/imageUploadService.ts delete mode 100644 services/index.js delete mode 100644 static/README.md delete mode 100644 store/README.md delete mode 100644 store/auth.js create mode 100644 store/auth.ts delete mode 100644 store/box-office.js create mode 100644 store/box-office.ts delete mode 100644 store/index.js create mode 100644 store/nav.ts delete mode 100644 stylelint.config.js rename tailwind.config.js => tailwind.config.ts (63%) delete mode 100644 tests/e2e/plugins/index.js rename tests/e2e/specs/createBooking/{createBooking.js => createBooking.cy.js} (100%) rename tests/e2e/specs/{production.js => production.cy.js} (100%) delete mode 100644 tests/unit/components/square/SquarePayment.js create mode 100644 tests/unit/components/square/SquarePayment.spec.js delete mode 100644 tests/unit/helpers.js delete mode 100644 tests/unit/pages/user/EmailChangeActivate.spec.js delete mode 100644 tests/unit/setup.ts rename tests/unit/{ => support}/fixtures/Address.js (100%) rename tests/unit/{ => support}/fixtures/Booking.js (100%) rename tests/unit/{ => support}/fixtures/CastMember.js (100%) rename tests/unit/{ => support}/fixtures/ConcessionType.js (100%) rename tests/unit/{ => support}/fixtures/ConcessionTypeBookingType.js (100%) rename tests/unit/{ => support}/fixtures/CrewMember.js (100%) rename tests/unit/{ => support}/fixtures/CrewRole.js (100%) rename tests/unit/{ => support}/fixtures/Discount.js (100%) rename tests/unit/{ => support}/fixtures/DiscountRequirement.js (100%) rename tests/unit/{ => support}/fixtures/MiscCost.js (100%) rename tests/unit/{ => support}/fixtures/Payment.js (100%) rename tests/unit/{ => support}/fixtures/Performance.js (100%) rename tests/unit/{ => support}/fixtures/PerformanceSeatGroup.js (100%) rename tests/unit/{ => support}/fixtures/PriceBreakdown.js (100%) rename tests/unit/{ => support}/fixtures/PriceBreakdownTicket.js (100%) rename tests/unit/{ => support}/fixtures/Production.js (100%) rename tests/unit/{ => support}/fixtures/ProductionTeamMember.js (100%) rename tests/unit/{ => support}/fixtures/SeatGroup.js (100%) rename tests/unit/{ => support}/fixtures/Society.js (100%) rename tests/unit/{ => support}/fixtures/Ticket.js (100%) rename tests/unit/{ => support}/fixtures/User.js (100%) rename tests/unit/{ => support}/fixtures/Venue.js (100%) rename tests/unit/{ => support}/fixtures/instances/FakeErrors.js (100%) rename tests/unit/{ => support}/fixtures/instances/FullBooking.js (84%) rename tests/unit/{ => support}/fixtures/support/GenericApolloResponse.js (100%) rename tests/unit/{ => support}/fixtures/support/GenericError.js (100%) rename tests/unit/{ => support}/fixtures/support/GenericErrorsResponse.js (100%) rename tests/unit/{ => support}/fixtures/support/GenericMutationResponse.js (100%) rename tests/unit/{ => support}/fixtures/support/GenericNodeConnection.js (100%) rename tests/unit/{ => support}/fixtures/support/GenericNodeEdge.js (100%) create mode 100644 tests/unit/support/helpers.ts create mode 100644 tests/unit/support/helpers/api.ts create mode 100644 tests/unit/support/helpers/mount.ts create mode 100644 tests/unit/support/setup.ts create mode 100644 tests/unit/support/stubs.js create mode 100644 tests/unit/support/stubs/square-web-sdk.ts delete mode 100644 utils.js create mode 100644 utils/alerts.ts create mode 100644 utils/analytics.ts create mode 100644 utils/api.ts create mode 100644 utils/datetime.ts delete mode 100644 utils/lang.js create mode 100644 utils/lang.ts create mode 100644 utils/misc.js delete mode 100644 utils/performance.js create mode 100644 utils/performance.ts create mode 100644 utils/production.ts create mode 100644 vitest.config.ts delete mode 100644 vue-shim.d.ts diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 84c2e570..00000000 --- a/.babelrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "env": { - "test": { - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "node": "current" - } - } - ] - ] - } - } -} diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index c7ac32ce..6283e693 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,7 +1,7 @@ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.0/containers/javascript-node/.devcontainer/base.Dockerfile # [Choice] Node.js version: 14, 12, 10 -ARG VARIANT="14-buster" +ARG VARIANT="18-buster" FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} # [Optional] Uncomment this section to install additional OS packages. diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8c9163ec..1e7e6927 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,8 @@ "gruntfuggly.todo-tree", "eamodio.gitlens", "Vue.vscode-typescript-vue-plugin", - "Vue.volar" + "Vue.volar", + "csstools.postcss" ], "initializeCommand": "cp -n .devcontainer/.env.example .devcontainer/.env && docker-compose -f .devcontainer/docker-compose.yml pull uobtheatre-api", // Use 'forwardPorts' to make a list of ports inside the container available locally. diff --git a/.env.example b/.env.example index fbde3803..77b432f2 100644 --- a/.env.example +++ b/.env.example @@ -3,4 +3,4 @@ SQUARE_APP_ID= SQUARE_LOC_ID= # API Base URL -# API_BASE= +# API_BASE=http://localhost:8000 diff --git a/.eslintignore b/.eslintignore index 3ce1b28c..a70b5b16 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,2 @@ -graphql/codegen/operations.ts -.nuxt -static/sw.js \ No newline at end of file +graphql/codegen +tests/unit/test.spec.example.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index d55d69c5..68905862 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,42 +1,17 @@ module.exports = { root: true, - env: { - node: true, + parser: 'vue-eslint-parser', + parserOptions: { + parser: '@typescript-eslint/parser' }, - ignorePatterns: ['tests/unit/test.spec.example.js'], - plugins: ['prettier', '@typescript-eslint'], + plugins: ['unused-imports', 'prettier'], extends: [ - '@nuxtjs', - '@nuxtjs/eslint-config-typescript', - 'prettier', - 'plugin:prettier/recommended', + 'plugin:vue/vue3-recommended', 'plugin:nuxt/recommended', + 'prettier' ], rules: { - 'import/no-named-as-default': 'off', - 'prettier/prettier': ['error', { singleQuote: true }], - }, - settings: { - 'import/resolved': { - node: { - extensions: ['.ts', '.tsx', '.js', '.jsx'], - }, - }, - }, - overrides: [ - { - files: ['*.test.js', '*.spec.js'], - rules: { - 'no-unused-expressions': 'off', - }, - }, - { - files: ['*.graphql'], - parser: '@graphql-eslint/eslint-plugin', - plugins: ['@graphql-eslint'], - rules: { - '@graphql-eslint/known-type-names': 'error', - }, - }, - ], + 'unused-imports/no-unused-imports': 'error', + 'vue/multi-word-component-names': 0 + } }; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 68d52090..acaf6978 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,14 +17,14 @@ jobs: strategy: matrix: os: [ubuntu-latest] - node: [14] + node: [18] steps: - name: Checkout ๐Ÿ›Ž uses: actions/checkout@master - name: Setup node env ๐Ÿ— - uses: actions/setup-node@v2.3.0 + uses: actions/setup-node@v3.6.0 with: node-version: ${{ matrix.node }} check-latest: true @@ -34,7 +34,7 @@ jobs: run: echo "::set-output name=dir::$(yarn cache dir)" - name: Cache node_modules ๐Ÿ“ฆ - uses: actions/cache@v2.1.6 + uses: actions/cache@v3.2.3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -45,8 +45,11 @@ jobs: - name: Install dependencies ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป run: yarn + - name: Load GraphQL Codegen ๐Ÿ•ธ + run: GQL_SCHEMA=https://raw.githubusercontent.com/BristolSTA/uobtheatre-api/dev/schema.graphql yarn codegen + - name: Run linter ๐Ÿ‘€ - run: yarn lint + run: yarn lint:tsc && yarn lint:js - name: Load GraphQL ๐Ÿ•ธ run: API_BASE=https://staging.api.uobtheatre.com yarn codegen @@ -59,16 +62,16 @@ jobs: strategy: matrix: - node-version: [14.x] + node-version: [18.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@master - name: Copy Testing Env โœ‰ run: cp .env.test .env - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2.3.0 + uses: actions/setup-node@v3.6.0 with: node-version: ${{ matrix.node-version }} @@ -77,7 +80,7 @@ jobs: run: echo "::set-output name=dir::$(yarn cache dir)" - name: Cache node_modules ๐Ÿ“ฆ - uses: actions/cache@v2.1.6 + uses: actions/cache@v3.2.3 id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} @@ -89,7 +92,7 @@ jobs: name: Install Yarn Dependencies ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป - name: Authenticate with GitHub Container Registry ๐Ÿ”’ - uses: docker/login-action@v1 + uses: docker/login-action@v2.1.0 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -108,8 +111,8 @@ jobs: run: API_BASE=http://localhost:9000 yarn codegen - name: Run End-to-End Tests ๐Ÿงช - uses: cypress-io/github-action@v2 + uses: cypress-io/github-action@v5 + timeout-minutes: 5 with: start: yarn pretest:e2e:ci wait-on: 'http://localhost:3000' - headless: true diff --git a/.gitignore b/.gitignore index 8243caf4..510ad9a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,100 +1,28 @@ -# Created by .ignore support plugin (hsz.mobi) -### Node template -# Logs -/logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Cypress files -tests/e2e/videos -tests/e2e/screenshots - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - -# parcel-bundler cache (https://parceljs.org/) +# Yarn Stuff +node_modules .cache -# next.js build output -.next +# Docker Stuff +.docker -# nuxt.js build output +# Nuxt Stuff .nuxt - -# Nuxt generate +.nitro +.output +.env dist -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless - -# IDE / Editor -.idea - -# Service worker -sw.* +# Vitest Generated Files +coverage -# macOS -.DS_Store +# Eslint +.eslintcache -# Vim swap files -*.swp +# General log files +*.log* -# Docker stuff -.docker +# Codegen Generated Files +graphql/codegen/operations.ts -# GQL Codegen -graphql/codegen \ No newline at end of file +# Cypress files +cypress \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..fc98bd37 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": true, + "trailingComma": "none", + "singleQuote": true, + "printWidth": 80 +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 1938bac3..2af58ab9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,14 +9,5 @@ "path-intellisense.mappings": { "@": "${workspaceRoot}" }, - "vetur.grammar.customBlocks": { - "router": "js" - }, - "vetur.validation.template": false, - "vetur.validation.script": false, - "vetur.validation.style": false, - "vetur.format.enable": false, - "[javascript]": { - "editor.defaultFormatter": "vscode.typescript-language-features" - } + "eslint.format.enable": true } diff --git a/README.md b/README.md index 4acee130..2639b3a9 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,8 @@ You can run `yarn lint [--fix]` to lint and fix files. > By default, you won't be able to test out payments via Square until you add the **sandbox** Square access token to the env file at `.devcontainer/.env` and rebuild the docker container (F1 > Rebuild Container). You will need to get these details from the webmaster. ## Hints and Tips -* If you use the supplied Dev Containers, the API is automatically put up with the dev container on port 9000. In this way, you can access the [GraphQLi interface](localhost:9000/graphql/) and the [Django admin panel](localhost:9000/admin/). This project is setup to automatically expect the API to be running at `localhost:9000`. If it is not (or you want to use a different instance), add `API_BASE={API_URL}` into your `.env` file. - +- If you use the supplied Dev Containers, the API is automatically put up with the dev container on port 9000. In this way, you can access the [GraphQLi interface](localhost:9000/graphql/) and the [Django admin panel](localhost:9000/admin/). This project is setup to automatically expect the API to be running at `localhost:9000`. If it is not (or you want to use a different instance), add `API_BASE={API_URL}` into your `.env` file. ## Compiling and Deploying ๐Ÿ”จ diff --git a/apollo.config.js b/apollo.config.js deleted file mode 100644 index 9d30e4d5..00000000 --- a/apollo.config.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - client: { - includes: ['src/**/*.{js,jsx,ts,tsx,vue,gql}'], - service: { - name: 'uobtheatre-api', - url: 'http://uobtheatre-api:8000/graphql/', - // optional disable SSL validation check - skipSSLValidation: true, - }, - }, -}; diff --git a/app.config.ts b/app.config.ts new file mode 100644 index 00000000..b942f61d --- /dev/null +++ b/app.config.ts @@ -0,0 +1,4 @@ +export default defineAppConfig({ + name: 'UOB Theatre', + supportEmail: 'support@uobtheatre.com' +}); diff --git a/app.vue b/app.vue new file mode 100644 index 00000000..3c241252 --- /dev/null +++ b/app.vue @@ -0,0 +1,15 @@ + + + diff --git a/assets/styles/_datepicker.scss b/assets/styles/_datepicker.scss new file mode 100644 index 00000000..76552466 --- /dev/null +++ b/assets/styles/_datepicker.scss @@ -0,0 +1,2 @@ +$dp__input_padding: 8px 12px; +@import '@vuepic/vue-datepicker/src/VueDatePicker/style/main.scss'; diff --git a/assets/styles/app.scss b/assets/styles/app.scss index a1ceeb68..c47f11da 100644 --- a/assets/styles/app.scss +++ b/assets/styles/app.scss @@ -1,6 +1,7 @@ -@import './tiptap'; +@import './_tiptap'; @import './_swal'; @import './_table'; +@import './_datepicker'; @import './_misc'; @import '@fortawesome/fontawesome-svg-core/styles.css'; diff --git a/babel.config.json b/babel.config.json deleted file mode 100644 index ded792f4..00000000 --- a/babel.config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "edge": "17", - "firefox": "60", - "chrome": "67", - "safari": "11.1" - }, - "useBuiltIns": "usage", - "corejs": "3.6.5" - } - ], - "@babel/preset-typescript" - ] -} diff --git a/classes/Booking.js b/classes/Booking.js index f3262437..15f178d3 100644 --- a/classes/Booking.js +++ b/classes/Booking.js @@ -85,7 +85,7 @@ export default class Booking { return { tickets: this.tickets.map((ticket) => { return ticket.apiData; - }), + }) }; } @@ -341,7 +341,7 @@ export default class Booking { concessionType: concessionTypeEdge.concessionType, seatGroup, ticketPrice: concessionTypeEdge.price, - totalPrice: concessionTypeEdge.price * groupedTickets.length, + totalPrice: concessionTypeEdge.price * groupedTickets.length }; }) .value(); @@ -356,7 +356,7 @@ export default class Booking { } return this.priceBreakdown.miscCosts.map((miscCost) => { return Object.assign(miscCost, { - valuePounds: (miscCost.value / 100).toFixed(2), + valuePounds: (miscCost.value / 100).toFixed(2) }); }); } diff --git a/classes/BookingStage.js b/classes/BookingStage.js index 3e15650e..9c6b858c 100644 --- a/classes/BookingStage.js +++ b/classes/BookingStage.js @@ -17,7 +17,7 @@ export default class { routeName, shouldBeUsed = null, eligable = null, - requiresPerformance = true, + requiresPerformance = true }) { this.name = name; this.routeName = routeName; diff --git a/classes/Errors.js b/classes/Errors.js index 527936d4..d372ed73 100644 --- a/classes/Errors.js +++ b/classes/Errors.js @@ -18,13 +18,24 @@ export default class { return new this(errors); } + static createFromMessage(message, field = null, code = null) { + return new this([ + { + __typename: field ? 'FieldError' : 'NonFieldError', + message, + field, + code + } + ]); + } + /** * Resets errors object */ reset() { this.errors = { field_errors: [], - non_field_errors: [], + non_field_errors: [] }; } @@ -119,7 +130,7 @@ export default class { }), non_field_errors: errors.filter((error) => { return error.__typename === 'NonFieldError' || !error.__typename; - }), + }) }; } @@ -134,7 +145,7 @@ export default class { const error = { message, code, - field, + field }; if (error.field) { this.errors.field_errors.push(error); diff --git a/classes/Ticket.js b/classes/Ticket.js index 0582c187..50178e5d 100644 --- a/classes/Ticket.js +++ b/classes/Ticket.js @@ -33,7 +33,7 @@ export default class { const result = JSON.parse(atob(rawQRCode)); return { bookingReference: result[0], - ticketId: result[1], + ticketId: result[1] }; } @@ -85,7 +85,7 @@ export default class { get apiData() { const ticketData = { seatGroupId: this.seatGroup.id, - concessionTypeId: this.concessionType.id, + concessionTypeId: this.concessionType.id }; if (this.id) { ticketData.id = this.id; diff --git a/classes/TicketsMatrix.js b/classes/TicketsMatrix.js index c24a7053..97853b8d 100644 --- a/classes/TicketsMatrix.js +++ b/classes/TicketsMatrix.js @@ -1,6 +1,8 @@ export default class { constructor(rawPerformance) { - this.raw_ticket_options = rawPerformance.ticketOptions; + this.raw_ticket_options = JSON.parse( + JSON.stringify(rawPerformance.ticketOptions) + ); this._performanceCapacityRemaining = rawPerformance.capacityRemaining; this.raw_discounts = rawPerformance.discounts; } @@ -45,16 +47,23 @@ export default class { * @param {number} seatGroupId Seat group ID to decrease capacity by 1 */ decrementSeatGroupCapacity(seatGroupId) { - this.ticketOptions.find((option) => option.seatGroup.id === seatGroupId) - .capacityRemaining--; + const index = this.ticketOptions.findIndex( + (option) => option.seatGroup.id === seatGroupId + ); + this.raw_ticket_options[index].capacityRemaining = + this.raw_ticket_options[index].capacityRemaining - 1; } /** * @param {number} seatGroupId Seat group ID to increase capacity by 1 */ incrementSeatGroupCapacity(seatGroupId) { - this.ticketOptions.find((option) => option.seatGroup.id === seatGroupId) - .capacityRemaining++; + const index = this.ticketOptions.findIndex( + (option) => option.seatGroup.id === seatGroupId + ); + + this.raw_ticket_options[index].capacityRemaining = + this.raw_ticket_options[index].capacityRemaining + 1; } /** diff --git a/codegen.ts b/codegen.ts index f0513390..d31a1686 100644 --- a/codegen.ts +++ b/codegen.ts @@ -1,22 +1,19 @@ import { CodegenConfig } from '@graphql-codegen/cli'; -import configFn from './config.js'; +import publicConfig from './config.public'; require('dotenv').config(); -const configData = configFn(); - const config: CodegenConfig = { overwrite: true, - schema: configData.api.graphql_endpoint_internal, - documents: './graphql/**/*.gql', + schema: process.env.GQL_SCHEMA ?? publicConfig().api.graphqlEndpointInternal, + documents: './graphql/**/*.(gql|graphql)', generates: { './graphql/codegen/operations.ts': { - plugins: [ - 'typescript', - 'typescript-operations', - 'typescript-vue-apollo-smart-ops', - ], - }, - }, + plugins: ['typescript', 'typescript-operations', 'typescript-vue-apollo'], + config: { + vueCompositionApiImportFrom: 'vue' + } + } + } }; export default config; diff --git a/commitlint.config.js b/commitlint.config.js deleted file mode 100644 index 84dcb122..00000000 --- a/commitlint.config.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - extends: ['@commitlint/config-conventional'], -}; diff --git a/components/admin/AdminPage.vue b/components/admin/AdminPage.vue index 45ace9cf..26a50ebf 100644 --- a/components/admin/AdminPage.vue +++ b/components/admin/AdminPage.vue @@ -1,5 +1,8 @@ diff --git a/components/auth/AuthBox.vue b/components/auth/AuthBox.vue new file mode 100644 index 00000000..05e27cdf --- /dev/null +++ b/components/auth/AuthBox.vue @@ -0,0 +1,394 @@ + + + diff --git a/components/auth/AuthPageTemplate.vue b/components/auth/AuthPageTemplate.vue index 37495e4a..f5ad3544 100644 --- a/components/auth/AuthPageTemplate.vue +++ b/components/auth/AuthPageTemplate.vue @@ -1,4 +1,4 @@ -