@duffel/components 3.1.3--prototype.4 → 3.1.3--prototype.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{react-dist/custom-elements.js → custom-elements.js} +2 -2
- package/{react-dist/custom-elements.js.map → custom-elements.js.map} +1 -1
- package/{react-dist/index.js → index.js} +2 -2
- package/{react-dist/index.js.map → index.js.map} +1 -1
- package/package.json +3 -3
- package/scripts/generate-fixture.d.ts +3 -0
- package/scripts/setup-suggestion-data.d.ts +28 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/.circleci/config.yml +0 -67
- package/.eslintrc.js +0 -47
- package/.github/CODEOWNERS +0 -4
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- package/.github/renovate.json +0 -12
- package/.nvmrc +0 -1
- package/.prettierignore +0 -6
- package/.storybook/main.ts +0 -33
- package/.storybook/preview.tsx +0 -28
- package/.tool-versions +0 -1
- package/.vscode/extensions.json +0 -7
- package/.vscode/settings.json +0 -10
- package/.yarn/releases/yarn-4.0.1.cjs +0 -893
- package/.yarn/sdks/eslint/bin/eslint.js +0 -20
- package/.yarn/sdks/eslint/lib/api.js +0 -20
- package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -20
- package/.yarn/sdks/eslint/package.json +0 -14
- package/.yarn/sdks/integrations.yml +0 -5
- package/.yarn/sdks/prettier/bin-prettier.js +0 -20
- package/.yarn/sdks/prettier/index.js +0 -20
- package/.yarn/sdks/prettier/package.json +0 -7
- package/.yarn/sdks/typescript/bin/tsc +0 -20
- package/.yarn/sdks/typescript/bin/tsserver +0 -20
- package/.yarn/sdks/typescript/lib/tsc.js +0 -20
- package/.yarn/sdks/typescript/lib/tsserver.js +0 -225
- package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -225
- package/.yarn/sdks/typescript/lib/typescript.js +0 -20
- package/.yarn/sdks/typescript/package.json +0 -10
- package/.yarnrc.yml +0 -3
- package/CONTRIBUTING.md +0 -83
- package/README.md +0 -68
- package/__mocks__/styleMock.js +0 -6
- package/babel.config.js +0 -20
- package/commitlint.config.js +0 -4
- package/config/esbuild.base.config.js +0 -18
- package/config/esbuild.cdn.config.js +0 -51
- package/config/esbuild.dev.config.js +0 -46
- package/config/esbuild.react.config.js +0 -42
- package/data/airports.csv +0 -9084
- package/data/cities.csv +0 -256
- package/jest.config.ts +0 -14
- package/scripts/build-and-publish.sh +0 -42
- package/scripts/generate-fixture.ts +0 -200
- package/scripts/setup-suggestion-data.ts +0 -100
- package/scripts/upload-to-cdn.sh +0 -34
- package/scripts.tsconfig.json +0 -11
- package/src/components/DuffelAncillaries/Card.tsx +0 -126
- package/src/components/DuffelAncillaries/Counter.tsx +0 -40
- package/src/components/DuffelAncillaries/DuffelAncillaries.tsx +0 -350
- package/src/components/DuffelAncillaries/DuffelAncillariesCustomElement.tsx +0 -124
- package/src/components/DuffelAncillaries/bags/BaggageSelectionCard.tsx +0 -101
- package/src/components/DuffelAncillaries/bags/BaggageSelectionController.tsx +0 -88
- package/src/components/DuffelAncillaries/bags/BaggageSelectionModal.tsx +0 -81
- package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBody.tsx +0 -60
- package/src/components/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.tsx +0 -122
- package/src/components/DuffelAncillaries/bags/BaggageSelectionModalFooter.tsx +0 -88
- package/src/components/DuffelAncillaries/bags/BaggageSelectionModalHeader.tsx +0 -82
- package/src/components/DuffelAncillaries/bags/IncludedBaggageBanner.tsx +0 -51
- package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.tsx +0 -90
- package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.tsx +0 -63
- package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.tsx +0 -56
- package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.tsx +0 -11
- package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.tsx +0 -74
- package/src/components/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.tsx +0 -9
- package/src/components/DuffelAncillaries/seats/Amenity.tsx +0 -21
- package/src/components/DuffelAncillaries/seats/DeckSelect.tsx +0 -27
- package/src/components/DuffelAncillaries/seats/Element.tsx +0 -52
- package/src/components/DuffelAncillaries/seats/EmptyElement.tsx +0 -5
- package/src/components/DuffelAncillaries/seats/ExitElement.tsx +0 -17
- package/src/components/DuffelAncillaries/seats/Legend.tsx +0 -60
- package/src/components/DuffelAncillaries/seats/Row.tsx +0 -47
- package/src/components/DuffelAncillaries/seats/RowSection.tsx +0 -78
- package/src/components/DuffelAncillaries/seats/SeatElement.tsx +0 -120
- package/src/components/DuffelAncillaries/seats/SeatInfo.tsx +0 -32
- package/src/components/DuffelAncillaries/seats/SeatMap.tsx +0 -85
- package/src/components/DuffelAncillaries/seats/SeatMapUnavailable.tsx +0 -21
- package/src/components/DuffelAncillaries/seats/SeatSelectionCard.tsx +0 -103
- package/src/components/DuffelAncillaries/seats/SeatSelectionModal.tsx +0 -142
- package/src/components/DuffelAncillaries/seats/SeatSelectionModalBody.tsx +0 -13
- package/src/components/DuffelAncillaries/seats/SeatSelectionModalFooter.tsx +0 -89
- package/src/components/DuffelAncillaries/seats/SeatSelectionModalHeader.tsx +0 -97
- package/src/components/DuffelAncillaries/seats/SeatUnavailable.tsx +0 -14
- package/src/components/DuffelPayments/DuffelPayments.tsx +0 -224
- package/src/components/DuffelPayments/DuffelPaymentsCustomElement.tsx +0 -130
- package/src/components/PlacesLookup/PlacesLookup.tsx +0 -122
- package/src/components/shared/AnimatedLoaderEllipsis.tsx +0 -5
- package/src/components/shared/Button.tsx +0 -63
- package/src/components/shared/ErrorBoundary.tsx +0 -54
- package/src/components/shared/FetchOfferErrorState.tsx +0 -35
- package/src/components/shared/Icon.tsx +0 -151
- package/src/components/shared/IconButton.tsx +0 -42
- package/src/components/shared/Modal.tsx +0 -40
- package/src/components/shared/NonIdealState.tsx +0 -28
- package/src/components/shared/Stamp.tsx +0 -29
- package/src/components/shared/Tabs.tsx +0 -36
- package/src/custom-elements.ts +0 -13
- package/src/examples/client-side/README.md +0 -30
- package/src/examples/client-side/index.html +0 -57
- package/src/examples/full-stack/README.md +0 -34
- package/src/examples/full-stack/index.html +0 -48
- package/src/examples/full-stack/server.mjs +0 -158
- package/src/examples/just-typescript/.yarn/install-state.gz +0 -0
- package/src/examples/just-typescript/README.md +0 -37
- package/src/examples/just-typescript/package.json +0 -16
- package/src/examples/just-typescript/src/index.html +0 -23
- package/src/examples/just-typescript/src/index.ts +0 -36
- package/src/examples/just-typescript/yarn.lock +0 -467
- package/src/examples/next/README.md +0 -28
- package/src/examples/next/next-env.d.ts +0 -5
- package/src/examples/next/next.config.js +0 -4
- package/src/examples/next/package.json +0 -24
- package/src/examples/next/src/app/DuffelComponents.tsx +0 -40
- package/src/examples/next/src/app/layout.tsx +0 -18
- package/src/examples/next/src/app/page.tsx +0 -9
- package/src/examples/next/tsconfig.json +0 -27
- package/src/examples/next/yarn.lock +0 -257
- package/src/examples/payments-custom-element/README.md +0 -17
- package/src/examples/payments-custom-element/index.html +0 -43
- package/src/examples/payments-just-typescript/README.md +0 -37
- package/src/examples/payments-just-typescript/package.json +0 -16
- package/src/examples/payments-just-typescript/src/index.html +0 -23
- package/src/examples/payments-just-typescript/src/index.ts +0 -18
- package/src/examples/payments-just-typescript/yarn.lock +0 -154
- package/src/examples/react-app/README.md +0 -37
- package/src/examples/react-app/package.json +0 -20
- package/src/examples/react-app/src/index.html +0 -19
- package/src/examples/react-app/src/index.tsx +0 -48
- package/src/examples/react-app/yarn.lock +0 -219
- package/src/fixtures/offers/off_0000AUde3KwTztSRK1cznH.json +0 -497
- package/src/fixtures/offers/off_0000AVx4lUFFKW8PsPeQeQ.json +0 -307
- package/src/fixtures/offers/off_1.json +0 -488
- package/src/fixtures/passengers/mock_passengers.ts +0 -26
- package/src/fixtures/seat-maps/off_0000AUde3KwTztSRK1cznH.json +0 -6852
- package/src/fixtures/seat-maps/off_0000AVx4lUFFKW8PsPeQeQ.json +0 -1
- package/src/fixtures/seat-maps/off_1.json +0 -6852
- package/src/index.ts +0 -7
- package/src/lib/captureErrorInSentry.ts +0 -42
- package/src/lib/compileCreateOrderPayload.ts +0 -63
- package/src/lib/createPriceFormatters.ts +0 -73
- package/src/lib/fetchFromDuffelAPI.ts +0 -54
- package/src/lib/fetchFromFixtures.ts +0 -18
- package/src/lib/formatAvailableServices.ts +0 -91
- package/src/lib/formatDate.ts +0 -20
- package/src/lib/formatSeatMaps.ts +0 -81
- package/src/lib/getBaggageServiceDescription.ts +0 -39
- package/src/lib/getCabinsForSegmentAndDeck.ts +0 -4
- package/src/lib/getCurrencyForSeatMaps.ts +0 -22
- package/src/lib/getCurrencyForServices.ts +0 -24
- package/src/lib/getFirstSeatElementMatchingCriteria.ts +0 -22
- package/src/lib/getPassengerBySegmentList.ts +0 -10
- package/src/lib/getPassengerInitials.ts +0 -6
- package/src/lib/getPassengerMapById.ts +0 -17
- package/src/lib/getPassengerName.ts +0 -41
- package/src/lib/getRowNumber.ts +0 -16
- package/src/lib/getSegmentList.ts +0 -7
- package/src/lib/getServicePriceMapById.ts +0 -20
- package/src/lib/getSymbols.ts +0 -22
- package/src/lib/getTotalAmountForServices.ts +0 -72
- package/src/lib/getTotalQuantity.ts +0 -5
- package/src/lib/hasHighLuminance.ts +0 -9
- package/src/lib/hasService.ts +0 -24
- package/src/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.ts +0 -35
- package/src/lib/hasWings.ts +0 -8
- package/src/lib/isBaggageService.ts +0 -8
- package/src/lib/isCancelForAnyReasonService.ts +0 -9
- package/src/lib/isFixtureOfferId.ts +0 -4
- package/src/lib/isPayloadComplete.ts +0 -11
- package/src/lib/isSeatElement.ts +0 -10
- package/src/lib/logging.ts +0 -120
- package/src/lib/moneyStringFormatter.ts +0 -34
- package/src/lib/offerIsExpired.ts +0 -5
- package/src/lib/retrieveOffer.ts +0 -56
- package/src/lib/retrieveOfferFromDuffelAPI.ts +0 -13
- package/src/lib/retrieveSeatMaps.ts +0 -55
- package/src/lib/retrieveSeatMapsFromDuffelAPI.ts +0 -13
- package/src/lib/setBodyScrollability.ts +0 -7
- package/src/lib/validateProps.ts +0 -37
- package/src/lib/withPlural.ts +0 -8
- package/src/stories/BaggageSelectionModalHeader.stories.tsx +0 -21
- package/src/stories/Button.stories.tsx +0 -91
- package/src/stories/DuffelAncillaries.stories.tsx +0 -166
- package/src/stories/DuffelPayments.stories.tsx +0 -34
- package/src/stories/Icon.stories.tsx +0 -35
- package/src/stories/IconButton.stories.tsx +0 -25
- package/src/stories/PlacesLookup.stories.tsx +0 -22
- package/src/styles/colors.css +0 -22
- package/src/styles/components/Amenity.css +0 -23
- package/src/styles/components/BaggageDisplay.css +0 -25
- package/src/styles/components/Button.css +0 -169
- package/src/styles/components/Card.css +0 -52
- package/src/styles/components/CfarSelectionModal.css +0 -34
- package/src/styles/components/Counter.css +0 -18
- package/src/styles/components/DuffelPayments.css +0 -42
- package/src/styles/components/IconButton.css +0 -63
- package/src/styles/components/Legend.css +0 -62
- package/src/styles/components/Loader.css +0 -37
- package/src/styles/components/LoadingState.css +0 -87
- package/src/styles/components/Modal.css +0 -84
- package/src/styles/components/PassengerSelect.css +0 -99
- package/src/styles/components/PassengersLayout.css +0 -90
- package/src/styles/components/PlacesLookup.css +0 -36
- package/src/styles/components/Row.css +0 -70
- package/src/styles/components/Seat.css +0 -59
- package/src/styles/components/SeatInfo.css +0 -61
- package/src/styles/components/SeatMap.css +0 -24
- package/src/styles/components/SeatSelect.css +0 -92
- package/src/styles/components/Segment.css +0 -17
- package/src/styles/components/SelectionSegment.css +0 -10
- package/src/styles/components/Summary.css +0 -70
- package/src/styles/components/Tabs.css +0 -52
- package/src/styles/flex.css +0 -5
- package/src/styles/font-families.css +0 -47
- package/src/styles/global.css +0 -52
- package/src/styles/margin.css +0 -3
- package/src/styles/spacing.css +0 -18
- package/src/styles/transitions.css +0 -3
- package/src/styles/typography.css +0 -13
- package/src/tests/components/DuffelAncillaries.test.tsx +0 -342
- package/src/tests/lib/createPriceFormatters.test.tsx +0 -152
- package/src/tests/lib/formatAvailableServices.test.tsx +0 -79
- package/src/tests/lib/formatSeatMaps.test.tsx +0 -49
- package/src/tests/lib/getCurrencyForServices.test.tsx +0 -44
- package/src/tests/lib/hasServiceOfSameMetadataTypeAlreadyBeenSelected.test.ts +0 -86
- package/src/tests/lib/logging.test.tsx +0 -32
- package/src/tests/lib/moneyStringFormatter.test.tsx +0 -12
- package/src/tests/lib/validateProps.test.tsx +0 -57
- package/src/types/Aircraft.ts +0 -16
- package/src/types/Airline.ts +0 -16
- package/src/types/Airport.ts +0 -54
- package/src/types/City.ts +0 -21
- package/src/types/CreateOrderPayload.ts +0 -99
- package/src/types/CurrencyConversion.ts +0 -10
- package/src/types/DuffelAncillariesProps.ts +0 -108
- package/src/types/Offer.ts +0 -851
- package/src/types/Order.ts +0 -6
- package/src/types/Place.ts +0 -6
- package/src/types/SeatMap.ts +0 -231
- package/src/types/index.ts +0 -11
- package/tsconfig.json +0 -58
- /package/{react-dist/components → components}/DuffelAncillaries/Card.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/Counter.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/DuffelAncillaries.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionCard.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionController.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModal.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalBody.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalBodyPassenger.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalFooter.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/BaggageSelectionModalHeader.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/bags/IncludedBaggageBanner.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionCard.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModal.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBody.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalBodyListItem.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalFooter.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/cancel_for_any_reason/CfarSelectionModalHeader.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/Amenity.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/DeckSelect.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/Element.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/EmptyElement.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/ExitElement.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/Legend.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/Row.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/RowSection.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatElement.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatInfo.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatMap.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatMapUnavailable.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionCard.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModal.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModalBody.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModalFooter.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatSelectionModalHeader.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelAncillaries/seats/SeatUnavailable.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelPayments/DuffelPayments.d.ts +0 -0
- /package/{react-dist/components → components}/DuffelPayments/DuffelPaymentsCustomElement.d.ts +0 -0
- /package/{react-dist/components → components}/PlacesLookup/PlacesLookup.d.ts +0 -0
- /package/{react-dist/components → components}/shared/AnimatedLoaderEllipsis.d.ts +0 -0
- /package/{react-dist/components → components}/shared/Button.d.ts +0 -0
- /package/{react-dist/components → components}/shared/ErrorBoundary.d.ts +0 -0
- /package/{react-dist/components → components}/shared/FetchOfferErrorState.d.ts +0 -0
- /package/{react-dist/components → components}/shared/Icon.d.ts +0 -0
- /package/{react-dist/components → components}/shared/IconButton.d.ts +0 -0
- /package/{react-dist/components → components}/shared/Modal.d.ts +0 -0
- /package/{react-dist/components → components}/shared/NonIdealState.d.ts +0 -0
- /package/{react-dist/components → components}/shared/Stamp.d.ts +0 -0
- /package/{react-dist/components → components}/shared/Tabs.d.ts +0 -0
- /package/{react-dist/custom-elements.d.ts → custom-elements.d.ts} +0 -0
- /package/{react-dist/index.d.ts → index.d.ts} +0 -0
- /package/{react-dist/lib → lib}/captureErrorInSentry.d.ts +0 -0
- /package/{react-dist/lib → lib}/compileCreateOrderPayload.d.ts +0 -0
- /package/{react-dist/lib → lib}/createPriceFormatters.d.ts +0 -0
- /package/{react-dist/lib → lib}/fetchFromDuffelAPI.d.ts +0 -0
- /package/{react-dist/lib → lib}/fetchFromFixtures.d.ts +0 -0
- /package/{react-dist/lib → lib}/formatAvailableServices.d.ts +0 -0
- /package/{react-dist/lib → lib}/formatDate.d.ts +0 -0
- /package/{react-dist/lib → lib}/formatSeatMaps.d.ts +0 -0
- /package/{react-dist/lib → lib}/getBaggageServiceDescription.d.ts +0 -0
- /package/{react-dist/lib → lib}/getCabinsForSegmentAndDeck.d.ts +0 -0
- /package/{react-dist/lib → lib}/getCurrencyForSeatMaps.d.ts +0 -0
- /package/{react-dist/lib → lib}/getCurrencyForServices.d.ts +0 -0
- /package/{react-dist/lib → lib}/getFirstSeatElementMatchingCriteria.d.ts +0 -0
- /package/{react-dist/lib → lib}/getPassengerBySegmentList.d.ts +0 -0
- /package/{react-dist/lib → lib}/getPassengerInitials.d.ts +0 -0
- /package/{react-dist/lib → lib}/getPassengerMapById.d.ts +0 -0
- /package/{react-dist/lib → lib}/getPassengerName.d.ts +0 -0
- /package/{react-dist/lib → lib}/getRowNumber.d.ts +0 -0
- /package/{react-dist/lib → lib}/getSegmentList.d.ts +0 -0
- /package/{react-dist/lib → lib}/getServicePriceMapById.d.ts +0 -0
- /package/{react-dist/lib → lib}/getSymbols.d.ts +0 -0
- /package/{react-dist/lib → lib}/getTotalAmountForServices.d.ts +0 -0
- /package/{react-dist/lib → lib}/getTotalQuantity.d.ts +0 -0
- /package/{react-dist/lib → lib}/hasHighLuminance.d.ts +0 -0
- /package/{react-dist/lib → lib}/hasService.d.ts +0 -0
- /package/{react-dist/lib → lib}/hasServiceOfSameMetadataTypeAlreadyBeenSelected.d.ts +0 -0
- /package/{react-dist/lib → lib}/hasWings.d.ts +0 -0
- /package/{react-dist/lib → lib}/isBaggageService.d.ts +0 -0
- /package/{react-dist/lib → lib}/isCancelForAnyReasonService.d.ts +0 -0
- /package/{react-dist/lib → lib}/isFixtureOfferId.d.ts +0 -0
- /package/{react-dist/lib → lib}/isPayloadComplete.d.ts +0 -0
- /package/{react-dist/lib → lib}/isSeatElement.d.ts +0 -0
- /package/{react-dist/lib → lib}/logging.d.ts +0 -0
- /package/{react-dist/lib → lib}/moneyStringFormatter.d.ts +0 -0
- /package/{react-dist/lib → lib}/offerIsExpired.d.ts +0 -0
- /package/{react-dist/lib → lib}/retrieveOffer.d.ts +0 -0
- /package/{react-dist/lib → lib}/retrieveOfferFromDuffelAPI.d.ts +0 -0
- /package/{react-dist/lib → lib}/retrieveSeatMaps.d.ts +0 -0
- /package/{react-dist/lib → lib}/retrieveSeatMapsFromDuffelAPI.d.ts +0 -0
- /package/{react-dist/lib → lib}/setBodyScrollability.d.ts +0 -0
- /package/{react-dist/lib → lib}/validateProps.d.ts +0 -0
- /package/{react-dist/lib → lib}/withPlural.d.ts +0 -0
- /package/{react-dist/types → types}/Aircraft.d.ts +0 -0
- /package/{react-dist/types → types}/Airline.d.ts +0 -0
- /package/{react-dist/types → types}/Airport.d.ts +0 -0
- /package/{react-dist/types → types}/City.d.ts +0 -0
- /package/{react-dist/types → types}/CreateOrderPayload.d.ts +0 -0
- /package/{react-dist/types → types}/CurrencyConversion.d.ts +0 -0
- /package/{react-dist/types → types}/DuffelAncillariesProps.d.ts +0 -0
- /package/{react-dist/types → types}/Offer.d.ts +0 -0
- /package/{react-dist/types → types}/Order.d.ts +0 -0
- /package/{react-dist/types → types}/Place.d.ts +0 -0
- /package/{react-dist/types → types}/SeatMap.d.ts +0 -0
- /package/{react-dist/types → types}/index.d.ts +0 -0
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import dotenv from "dotenv";
|
|
2
|
-
import { readFileSync } from "fs";
|
|
3
|
-
import http from "http";
|
|
4
|
-
|
|
5
|
-
/* https://nodejs.org/api/cli.html#node_tls_reject_unauthorizedvalue */
|
|
6
|
-
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
|
|
7
|
-
|
|
8
|
-
dotenv.config({ path: ".env.local" });
|
|
9
|
-
|
|
10
|
-
if (process.env.DUFFEL_API_URL === undefined) {
|
|
11
|
-
throw new Error("process.env.DUFFEL_API_URL is required but missing");
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (process.env.DUFFEL_API_TOKEN === undefined) {
|
|
15
|
-
throw new Error("process.env.DUFFEL_API_TOKEN is required but missing");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const makeMockDateInTheFuture = (daysAhead) => {
|
|
19
|
-
const now = new Date(Date.now());
|
|
20
|
-
now.setDate(now.getDate() + daysAhead);
|
|
21
|
-
return now;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const duffelHeaders = {
|
|
25
|
-
"Duffel-Version": "v1",
|
|
26
|
-
"Accept-Encoding": "gzip",
|
|
27
|
-
Accept: "application/json",
|
|
28
|
-
"Content-Type": "application/json",
|
|
29
|
-
Authorization: `Bearer ${process.env.DUFFEL_API_TOKEN}`,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
let searchRoundTripOnDuffelResultCache = null;
|
|
33
|
-
const searchRoundTripOnDuffel = async (origin, destination) => {
|
|
34
|
-
if (searchRoundTripOnDuffelResultCache !== null) {
|
|
35
|
-
return searchRoundTripOnDuffelResultCache;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const payload = {
|
|
39
|
-
data: {
|
|
40
|
-
slices: [
|
|
41
|
-
{
|
|
42
|
-
origin,
|
|
43
|
-
destination,
|
|
44
|
-
departure_date: makeMockDateInTheFuture(7)
|
|
45
|
-
.toISOString()
|
|
46
|
-
.split("T")[0],
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
origin: destination,
|
|
50
|
-
destination: origin,
|
|
51
|
-
departure_date: makeMockDateInTheFuture(14)
|
|
52
|
-
.toISOString()
|
|
53
|
-
.split("T")[0],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
passengers: [{ type: "adult" }],
|
|
57
|
-
requested_sources: ["duffel_airways"],
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const { data: offerRequest } = await (
|
|
62
|
-
await fetch(
|
|
63
|
-
process.env.DUFFEL_API_URL + "/air/offer_requests?return_offers=true",
|
|
64
|
-
{
|
|
65
|
-
method: "POST",
|
|
66
|
-
body: JSON.stringify(payload),
|
|
67
|
-
headers: duffelHeaders,
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
).json();
|
|
71
|
-
|
|
72
|
-
searchRoundTripOnDuffelResultCache = offerRequest;
|
|
73
|
-
return searchRoundTripOnDuffelResultCache;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const createOrderOnDuffel = async (request, response) => {
|
|
77
|
-
const createOrderOnDuffelResponse = await fetch(
|
|
78
|
-
process.env.DUFFEL_API_URL + "/air/orders",
|
|
79
|
-
{
|
|
80
|
-
method: "POST",
|
|
81
|
-
headers: duffelHeaders,
|
|
82
|
-
body: request,
|
|
83
|
-
duplex: "half",
|
|
84
|
-
}
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
response.writeHead(createOrderOnDuffelResponse.status, {
|
|
88
|
-
"Content-type": "application/json",
|
|
89
|
-
});
|
|
90
|
-
response.write(await createOrderOnDuffelResponse.text());
|
|
91
|
-
response.end();
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const ROUTES = {
|
|
95
|
-
"/": async function index(request, response) {
|
|
96
|
-
const offerRequest = await searchRoundTripOnDuffel("JFK", "MIA");
|
|
97
|
-
const offer = offerRequest.offers[0];
|
|
98
|
-
|
|
99
|
-
if (!offer) {
|
|
100
|
-
response.writeHead(404);
|
|
101
|
-
response.end(http.STATUS_CODES[404]);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const passengers = [
|
|
106
|
-
{
|
|
107
|
-
id: offer.passengers[0].id,
|
|
108
|
-
given_name: "Mae",
|
|
109
|
-
family_name: "Jemison",
|
|
110
|
-
gender: "F",
|
|
111
|
-
title: "dr",
|
|
112
|
-
born_on: "1956-10-17",
|
|
113
|
-
email: "m.jemison@nasa.gov",
|
|
114
|
-
phone_number: "+16177562626",
|
|
115
|
-
},
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
const template = readFileSync("src/examples/full-stack/index.html", {
|
|
119
|
-
encoding: "utf-8",
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
const withOfferId = template.replace("__OFFER_ID__", offer.id);
|
|
123
|
-
const withclientKey = withOfferId.replace(
|
|
124
|
-
"__CLIENT_KEY__",
|
|
125
|
-
offerRequest.client_key
|
|
126
|
-
);
|
|
127
|
-
const withPassengers = withclientKey.replace(
|
|
128
|
-
`"__PASSENGERS__"`,
|
|
129
|
-
`${JSON.stringify(passengers)}`
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
response.writeHead(200);
|
|
133
|
-
response.end(withPassengers);
|
|
134
|
-
},
|
|
135
|
-
"/book": async function book(request, response) {
|
|
136
|
-
if (request.method != "POST") {
|
|
137
|
-
response.writeHead(404);
|
|
138
|
-
response.end(http.STATUS_CODES[404]);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
await createOrderOnDuffel(request, response);
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
http
|
|
147
|
-
.createServer(function (request, response) {
|
|
148
|
-
if (request.url in ROUTES) {
|
|
149
|
-
return ROUTES[request.url](request, response);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
response.writeHead(404);
|
|
153
|
-
response.end(http.STATUS_CODES[404]);
|
|
154
|
-
})
|
|
155
|
-
.listen(6262);
|
|
156
|
-
|
|
157
|
-
// eslint-disable-next-line
|
|
158
|
-
console.log(`\n🐄 Serving example on http://localhost:6262`);
|
|
Binary file
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# duffel-components typescript example
|
|
2
|
-
|
|
3
|
-
## TL;DR
|
|
4
|
-
|
|
5
|
-
Start on the root of the `duffel-components` repository:
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
# build duffel-components for react env:
|
|
9
|
-
yarn react-build
|
|
10
|
-
|
|
11
|
-
# change directory to example folder
|
|
12
|
-
cd src/examples/just-typescript
|
|
13
|
-
|
|
14
|
-
# cleanup last install and build
|
|
15
|
-
rm -rf node_modules && rm -rf dist
|
|
16
|
-
|
|
17
|
-
# install new version
|
|
18
|
-
yarn
|
|
19
|
-
|
|
20
|
-
# build and watch example
|
|
21
|
-
yarn build
|
|
22
|
-
|
|
23
|
-
# open example
|
|
24
|
-
open src/index.html -a "Safari"
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Build duffel-components
|
|
28
|
-
|
|
29
|
-
First, navigate to the root folder of the duffel-components repository and run `yarn react-build` to build the package. It should output a react-dist folder on the root. This folder is the one we reference on `src/examples/just-typescript/package.json` dependencies under `duffel-components`
|
|
30
|
-
|
|
31
|
-
## Install dependencies
|
|
32
|
-
|
|
33
|
-
Once the package is built, you can cd into this directory and run `yarn` to install all dependencies. If there are changes to `react-dist` since your last install, you'll need to `rm -rf node_modules`, otherwise the updates build will not be installed.
|
|
34
|
-
|
|
35
|
-
## Run example
|
|
36
|
-
|
|
37
|
-
Finally, run `yarn dev` to build `src/examples/just-typescript/src/index.tsx`. This will produce `src/examples/just-typescript/dist` folder that is referenced by `src/examples/just-typescript/src/index.html`. You can then open `src/examples/just-typescript/src/index.html` on your browser to see the example up and running.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "just-typescript",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"build": "esbuild src/index.ts --bundle --outfile=dist/index.js"
|
|
7
|
-
},
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"@duffel/components": "3.1.3--prototype.3",
|
|
10
|
-
"@types/node": "20.2.5",
|
|
11
|
-
"typescript": "5.0.4"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"esbuild": "^0.17.19"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<link
|
|
7
|
-
rel="icon"
|
|
8
|
-
type="image/png"
|
|
9
|
-
sizes="96x96"
|
|
10
|
-
href="https://duffel.com/images/favicon/favicon-96x96.png"
|
|
11
|
-
/>
|
|
12
|
-
|
|
13
|
-
<script src="../dist/index.js" defer></script>
|
|
14
|
-
<title>ancillaries component just typescript example</title>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<h1 style="margin-bottom: 2rem">
|
|
18
|
-
Duffel ancillaries component just typescript example
|
|
19
|
-
</h1>
|
|
20
|
-
|
|
21
|
-
<duffel-ancillaries></duffel-ancillaries>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
onDuffelAncillariesPayloadReady,
|
|
3
|
-
renderDuffelAncillariesCustomElement,
|
|
4
|
-
} from "@duffel/components/custom-elements";
|
|
5
|
-
|
|
6
|
-
window.onload = () => {
|
|
7
|
-
renderDuffelAncillariesCustomElement({
|
|
8
|
-
offer_id: "fixture_off_1",
|
|
9
|
-
services: ["bags", "seats", "cancel_for_any_reason"],
|
|
10
|
-
passengers: [
|
|
11
|
-
{
|
|
12
|
-
id: "pas_0000AUde3KY1SptM6ABSfT",
|
|
13
|
-
given_name: "Mae",
|
|
14
|
-
family_name: "Jemison",
|
|
15
|
-
gender: "F",
|
|
16
|
-
title: "dr",
|
|
17
|
-
born_on: "1956-10-17",
|
|
18
|
-
email: "m.jemison@nasa.gov",
|
|
19
|
-
phone_number: "+16177562626",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "pas_0000AUde3KY1SptM6ABSfU",
|
|
23
|
-
given_name: "Dorothy",
|
|
24
|
-
family_name: "Green",
|
|
25
|
-
gender: "F",
|
|
26
|
-
title: "dr",
|
|
27
|
-
born_on: "1942-10-17",
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
});
|
|
31
|
-
onDuffelAncillariesPayloadReady((data, metadata) => {
|
|
32
|
-
/* eslint-disable */
|
|
33
|
-
console.table(data);
|
|
34
|
-
console.table(metadata);
|
|
35
|
-
});
|
|
36
|
-
};
|