@dropins/storefront-checkout 2.0.1 → 2.1.0-alpha1
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/api/fragments.d.ts +4 -1
- package/api/getNegotiableQuote/getNegotiableQuote.d.ts +22 -0
- package/api/getNegotiableQuote/graphql/getNegotiableQuote.graphql.d.ts +18 -0
- package/{errors → api/getNegotiableQuote/graphql}/index.d.ts +2 -2
- package/{signals → api/getNegotiableQuote}/index.d.ts +2 -2
- package/api/getStoreConfig/getStoreConfig.d.ts +1 -0
- package/api/graphql/CartAddressFragment.graphql.d.ts +2 -2
- package/api/graphql/NegotiableQuoteAddressFragment.graphql.d.ts +19 -0
- package/api/graphql/NegotiableQuoteFragment.graphql.d.ts +18 -0
- package/api/graphql/{CartPaymentMethodFragment.graphql.d.ts → PaymentMethodFragment.graphql.d.ts} +1 -1
- package/api/graphql/ShippingMethodFragment.graphql.d.ts +19 -0
- package/api/index.d.ts +1 -2
- package/api/initialize/initialize.d.ts +3 -0
- package/api/initializeCheckout/initializeCheckout.d.ts +2 -2
- package/api/setBillingAddress/graphql/index.d.ts +19 -0
- package/api/{setPaymentMethod/graphql/setPaymentMethod.graphql.d.ts → setBillingAddress/graphql/setBillingAddressOnCartMutation.graphql.d.ts} +2 -2
- package/api/setBillingAddress/graphql/setBillingAddressOnQuoteMutation.graphql.d.ts +18 -0
- package/api/setBillingAddress/setBillingAddress.d.ts +2 -2
- package/api/setPaymentMethod/graphql/index.d.ts +19 -0
- package/api/{setBillingAddress/graphql/setBillingAddress.graphql.d.ts → setPaymentMethod/graphql/setPaymentMethodOnCart.graphql.d.ts} +2 -2
- package/api/setPaymentMethod/graphql/setPaymentMethodOnQuote.graphql.d.ts +18 -0
- package/api/setPaymentMethod/setPaymentMethod.d.ts +2 -2
- package/api/setShippingAddress/graphql/index.d.ts +21 -0
- package/api/setShippingAddress/graphql/{setShippingAddressAndUseAsBilling.graphql.d.ts → setShippingAddressOnCartAndUseAsBillingMutation.graphql.d.ts} +2 -2
- package/api/setShippingAddress/graphql/{setShippingAddress.graphql.d.ts → setShippingAddressOnCartMutation.graphql.d.ts} +2 -2
- package/api/setShippingAddress/graphql/setShippingAddressOnQuote.graphql.d.ts +18 -0
- package/api/setShippingAddress/graphql/setShippingAddressOnQuoteAndUseAsBillingMutation.graphql.d.ts +18 -0
- package/api/setShippingAddress/setShippingAddress.d.ts +1 -1
- package/api/setShippingMethods/graphql/index.d.ts +19 -0
- package/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.d.ts +1 -1
- package/api/setShippingMethods/graphql/setShippingMethodsOnQuote.graphql.d.ts +18 -0
- package/api/setShippingMethods/index.d.ts +1 -0
- package/api/setShippingMethods/setShippingMethods.d.ts +3 -17
- package/api/synchronizeCheckout/synchronizeCheckout.d.ts +2 -2
- package/api.js +2 -66
- package/api.js.map +1 -1
- package/chunks/ConditionalWrapper.js +1 -1
- package/chunks/ConditionalWrapper.js.map +1 -1
- package/chunks/checkout.js.map +1 -1
- package/chunks/dom.js.map +1 -1
- package/chunks/events.js +4 -0
- package/chunks/events.js.map +1 -0
- package/chunks/events2.js +4 -0
- package/chunks/events2.js.map +1 -0
- package/chunks/fetch-graphql.js +14 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/guards.js +4 -0
- package/chunks/guards.js.map +1 -0
- package/chunks/setBillingAddress.js +25 -5
- package/chunks/setBillingAddress.js.map +1 -1
- package/chunks/setGuestEmailOnCart.js +3 -3
- package/chunks/setGuestEmailOnCart.js.map +1 -1
- package/chunks/setPaymentMethod.js +21 -6
- package/chunks/setPaymentMethod.js.map +1 -1
- package/chunks/setShippingAddress.js +109 -0
- package/chunks/setShippingAddress.js.map +1 -0
- package/chunks/setShippingMethods.js +19 -4
- package/chunks/setShippingMethods.js.map +1 -1
- package/chunks/synchronizeCheckout.js +11 -3
- package/chunks/synchronizeCheckout.js.map +1 -1
- package/chunks/transform-shipping-estimate.js +4 -0
- package/chunks/transform-shipping-estimate.js.map +1 -0
- package/chunks/transform-shipping-methods.js +4 -0
- package/chunks/transform-shipping-methods.js.map +1 -0
- package/chunks/values.js +1 -1
- package/chunks/values.js.map +1 -1
- package/components/AddressValidation/AddressValidation.d.ts +14 -0
- package/components/AddressValidation/index.d.ts +19 -0
- package/components/PaymentMethods/PaymentMethods.d.ts +1 -1
- package/components/ShippingMethods/ShippingMethods.d.ts +1 -1
- package/components/index.d.ts +1 -0
- package/containers/AddressValidation/AddressValidation.d.ts +12 -0
- package/containers/AddressValidation/index.d.ts +19 -0
- package/containers/AddressValidation.d.ts +3 -0
- package/containers/AddressValidation.js +4 -0
- package/containers/AddressValidation.js.map +1 -0
- package/containers/BillToShippingAddress.js +1 -1
- package/containers/BillToShippingAddress.js.map +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/EstimateShipping.js.map +1 -1
- package/containers/LoginForm/LoginForm.d.ts +1 -1
- package/containers/LoginForm.js +1 -1
- package/containers/LoginForm.js.map +1 -1
- package/containers/OutOfStock.js +1 -1
- package/containers/OutOfStock.js.map +1 -1
- package/containers/PaymentMethods/PaymentMethods.d.ts +1 -2
- package/containers/PaymentMethods.js +1 -1
- package/containers/PaymentMethods.js.map +1 -1
- package/containers/PlaceOrder.js +1 -1
- package/containers/PlaceOrder.js.map +1 -1
- package/containers/ServerError.js +1 -1
- package/containers/ServerError.js.map +1 -1
- package/containers/ShippingMethods/ShippingMethods.d.ts +1 -2
- package/containers/ShippingMethods.js +1 -1
- package/containers/ShippingMethods.js.map +1 -1
- package/containers/TermsAndConditions.js +1 -1
- package/containers/TermsAndConditions.js.map +1 -1
- package/containers/index.d.ts +1 -0
- package/data/models/address.d.ts +11 -6
- package/data/models/api.d.ts +23 -10
- package/data/models/cart.d.ts +7 -7
- package/data/models/checkout.d.ts +14 -0
- package/data/models/country.d.ts +1 -1
- package/data/models/index.d.ts +2 -1
- package/data/models/{price.d.ts → money.d.ts} +2 -2
- package/data/models/quote.d.ts +16 -0
- package/data/models/shipping-estimate.d.ts +4 -4
- package/data/models/shipping-method.d.ts +4 -4
- package/data/models/values.d.ts +1 -1
- package/data/transforms/index.d.ts +8 -1
- package/data/transforms/transform-api.d.ts +12 -0
- package/data/transforms/{transform-address.d.ts → transform-cart-address.d.ts} +39 -43
- package/data/transforms/transform-cart.d.ts +1 -1
- package/data/transforms/transform-country.d.ts +8 -0
- package/data/transforms/transform-custom-attributes.d.ts +5 -0
- package/data/transforms/transform-negotiable-quote.d.ts +7 -0
- package/data/transforms/transform-payment-methods.d.ts +1 -1
- package/data/transforms/transform-quote-address.d.ts +88 -0
- package/data/transforms/transform-region.d.ts +8 -0
- package/fragments.js +180 -71
- package/fragments.js.map +1 -1
- package/i18n/en_US.json.d.ts +6 -0
- package/lib/enqueueRequest.d.ts +2 -2
- package/lib/errors/classifiers.d.ts +36 -0
- package/lib/errors/customErrors.d.ts +42 -0
- package/lib/errors/index.d.ts +20 -0
- package/lib/errors/mapErrorToCode.d.ts +4 -0
- package/lib/events.d.ts +3 -2
- package/lib/guards.d.ts +18 -0
- package/lib/index.d.ts +2 -2
- package/lib/state.d.ts +5 -3
- package/lib/utils/api.d.ts +16 -0
- package/lib/utils/events.d.ts +10 -0
- package/lib/utils/forms.d.ts +5 -0
- package/lib/utils/fragments.d.ts +19 -0
- package/lib/utils/index.d.ts +24 -0
- package/lib/utils/meta.d.ts +19 -0
- package/lib/utils/transformers.d.ts +6 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +4 -0
- package/lib/utils.js.map +1 -0
- package/package.json +1 -1
- package/render.js +3 -3
- package/render.js.map +1 -1
- package/tests/constants.d.ts +1 -0
- package/tests/fixtures/fragments/cart.d.ts +43 -42
- package/tests/fixtures/fragments/shipping-address.d.ts +2 -1
- package/tests/fixtures/models/index.d.ts +1 -1
- package/tests/fixtures/models/quote.d.ts +9 -0
- package/types/api.d.ts +6 -0
- package/types/{TitleProps.d.ts → components.d.ts} +2 -1
- package/types/guards.d.ts +5 -0
- package/types/index.d.ts +21 -0
- package/types/storefront.d.ts +165 -0
- package/chunks/ServerErrorSignal.js +0 -4
- package/chunks/ServerErrorSignal.js.map +0 -1
- package/chunks/errors.js +0 -14
- package/chunks/errors.js.map +0 -1
- package/errors/errors.d.ts +0 -30
- package/lib/network-error.d.ts +0 -22
- package/signals/ServerErrorSignal.d.ts +0 -18
- package/types/ComponentTypes.d.ts +0 -18
- /package/lib/{dom.d.ts → utils/dom.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TermsAndConditions.js","sources":["/@dropins/storefront-checkout/src/components/Markup/Markup.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditionsSkeleton.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditions.tsx","/@dropins/storefront-checkout/src/containers/TermsAndConditions/TermsAndConditions.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport DOMPurify from 'dompurify';\nimport { FunctionComponent } from 'preact';\n\ninterface MarkupProps {\n html: string;\n}\n\nexport const Markup: FunctionComponent<MarkupProps> = ({ html }) => {\n const sanitizedHtml = DOMPurify.sanitize(html, { ADD_ATTR: ['target'] });\n if (sanitizedHtml === '') return null;\n // eslint-disable-next-line react/no-danger\n return <span dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const TermsAndConditionsSkeleton: FunctionComponent = () => {\n return (\n <Skeleton\n className=\"checkout-terms-and-conditions-skeleton\"\n data-testid=\"checkout-terms-and-conditions-skeleton\"\n >\n <SkeletonRow fullWidth={true} size=\"small\" variant=\"row\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WithConditionals } from '@/checkout/components';\nimport '@/checkout/components/TermsAndConditions/TermsAndConditions.css';\nimport { TermsAndConditionsSkeleton } from '@/checkout/components/TermsAndConditions/TermsAndConditionsSkeleton';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface TermsAndConditionsProps\n extends HTMLAttributes<HTMLFormElement> {\n agreements?: VNode;\n error?: string;\n}\n\nconst TermsAndConditionsComponent: FunctionComponent<\n TermsAndConditionsProps\n> = ({ className, agreements, error, ...props }) => {\n return (\n <div\n className=\"checkout-terms-and-conditions\"\n data-testid=\"checkout-terms-and-conditions\"\n >\n <form\n {...props}\n noValidate\n className={classes(['checkout-terms-and-conditions__form', className])}\n data-testid=\"checkout-terms-and-conditions-form\"\n name=\"checkout-terms-and-conditions__form\"\n >\n {agreements && (\n <VComponent\n className={classes(['checkout-terms-and-conditions__agreements'])}\n data-testid=\"checkout-terms-and-conditions-agreements\"\n node={agreements}\n />\n )}\n\n {error && (\n <div\n className=\"checkout-terms-and-conditions__error\"\n data-testid=\"checkout-terms-and-conditions-error\"\n >\n {error}\n </div>\n )}\n </form>\n </div>\n );\n};\n\nexport const TermsAndConditions = WithConditionals(\n TermsAndConditionsComponent,\n TermsAndConditionsSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Markup } from '@/checkout/components';\nimport { TermsAndConditions as TermsAndConditionsComponent } from '@/checkout/components/TermsAndConditions';\nimport { AgreementMode } from '@/checkout/data/models';\nimport { getLatestCheckoutUpdate, state } from '@/checkout/lib';\nimport { Checkbox } from '@adobe-commerce/elsie/components';\nimport { MarkupText, useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Container,\n Slot,\n SlotMethod,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useEffect, useState } from 'preact/hooks';\n\nexport interface TermsAndConditionsProps {\n active?: boolean;\n slots?: {\n Agreements?: SlotProps<{\n appendAgreement: SlotMethod<{\n name: string;\n mode: AgreementMode;\n translationId?: string;\n text?: string;\n }>;\n }>;\n };\n}\n\nexport const TermsAndConditions: Container<TermsAndConditionsProps> = ({\n active = true,\n slots,\n ...props\n}) => {\n const [isInitialized, setIsInitialized] = useState(false);\n const [error, setError] = useState<string>('');\n\n const { errorMessage } = useText({\n errorMessage: 'Checkout.TermsAndConditions.error',\n });\n\n const disabledViaConfig = state.config?.agreementsEnabled === false;\n\n const handleChange = () => {\n setError('');\n };\n\n const handleInvalid = () => {\n setError(errorMessage);\n };\n\n useEffect(() => {\n if (!active || disabledViaConfig) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n () => {\n setIsInitialized(true);\n },\n { eager: true }\n );\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, disabledViaConfig]);\n\n return (\n <TermsAndConditionsComponent\n {...props}\n agreements={\n <Slot\n context={{\n appendAgreement(callback) {\n this._registerMethod((...attrs) => {\n const _agreement = callback(...attrs);\n\n if (!_agreement) return;\n\n const { mode, name, text, translationId } = _agreement;\n\n if (!text && !translationId) {\n console.warn(\n `The agreement ${name} is misconfigured. Please provide a text or a translationId.`\n );\n return;\n }\n\n const label = text ? (\n <Markup html={text} />\n ) : (\n <MarkupText id={translationId!} />\n );\n\n const agreement = (\n <Checkbox\n checked={mode === AgreementMode.AUTO}\n label={label}\n name={name}\n required={true}\n onChange={handleChange}\n onInvalid={handleInvalid}\n />\n );\n\n this._setProps((prev: any) => ({\n children: [...(prev.children || []), agreement],\n }));\n });\n },\n }}\n name=\"Agreements\"\n slot={slots?.Agreements}\n />\n }\n error={error}\n initialized={isInitialized}\n visible={active && !disabledViaConfig}\n />\n );\n};\n"],"names":["Markup","html","sanitizedHtml","DOMPurify","TermsAndConditionsSkeleton","jsx","Skeleton","SkeletonRow","TermsAndConditionsComponent","className","agreements","error","props","jsxs","classes","VComponent","TermsAndConditions","WithConditionals","active","slots","isInitialized","setIsInitialized","useState","setError","errorMessage","useText","disabledViaConfig","_a","state","handleChange","handleInvalid","useEffect","getLatestCheckoutUpdate","onCheckoutInit","events","Slot","callback","attrs","_agreement","mode","name","text","translationId","label","MarkupText","agreement","Checkbox","AgreementMode","prev"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"TermsAndConditions.js","sources":["/@dropins/storefront-checkout/src/components/Markup/Markup.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditionsSkeleton.tsx","/@dropins/storefront-checkout/src/components/TermsAndConditions/TermsAndConditions.tsx","/@dropins/storefront-checkout/src/containers/TermsAndConditions/TermsAndConditions.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport DOMPurify from 'dompurify';\nimport { FunctionComponent } from 'preact';\n\ninterface MarkupProps {\n html: string;\n}\n\nexport const Markup: FunctionComponent<MarkupProps> = ({ html }) => {\n const sanitizedHtml = DOMPurify.sanitize(html, { ADD_ATTR: ['target'] });\n if (sanitizedHtml === '') return null;\n // eslint-disable-next-line react/no-danger\n return <span dangerouslySetInnerHTML={{ __html: sanitizedHtml }} />;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { FunctionComponent } from 'preact';\n\nexport const TermsAndConditionsSkeleton: FunctionComponent = () => {\n return (\n <Skeleton\n className=\"checkout-terms-and-conditions-skeleton\"\n data-testid=\"checkout-terms-and-conditions-skeleton\"\n >\n <SkeletonRow fullWidth={true} size=\"small\" variant=\"row\" />\n </Skeleton>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { WithConditionals } from '@/checkout/components';\nimport '@/checkout/components/TermsAndConditions/TermsAndConditions.css';\nimport { TermsAndConditionsSkeleton } from '@/checkout/components/TermsAndConditions/TermsAndConditionsSkeleton';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent, VNode } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface TermsAndConditionsProps\n extends HTMLAttributes<HTMLFormElement> {\n agreements?: VNode;\n error?: string;\n}\n\nconst TermsAndConditionsComponent: FunctionComponent<\n TermsAndConditionsProps\n> = ({ className, agreements, error, ...props }) => {\n return (\n <div\n className=\"checkout-terms-and-conditions\"\n data-testid=\"checkout-terms-and-conditions\"\n >\n <form\n {...props}\n noValidate\n className={classes(['checkout-terms-and-conditions__form', className])}\n data-testid=\"checkout-terms-and-conditions-form\"\n name=\"checkout-terms-and-conditions__form\"\n >\n {agreements && (\n <VComponent\n className={classes(['checkout-terms-and-conditions__agreements'])}\n data-testid=\"checkout-terms-and-conditions-agreements\"\n node={agreements}\n />\n )}\n\n {error && (\n <div\n className=\"checkout-terms-and-conditions__error\"\n data-testid=\"checkout-terms-and-conditions-error\"\n >\n {error}\n </div>\n )}\n </form>\n </div>\n );\n};\n\nexport const TermsAndConditions = WithConditionals(\n TermsAndConditionsComponent,\n TermsAndConditionsSkeleton\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Markup } from '@/checkout/components';\nimport { TermsAndConditions as TermsAndConditionsComponent } from '@/checkout/components/TermsAndConditions';\nimport { AgreementMode } from '@/checkout/data/models';\nimport { getLatestCheckoutUpdate, state } from '@/checkout/lib';\nimport { Checkbox } from '@adobe-commerce/elsie/components';\nimport { MarkupText, useText } from '@adobe-commerce/elsie/i18n';\nimport {\n Container,\n Slot,\n SlotMethod,\n SlotProps,\n} from '@adobe-commerce/elsie/lib';\nimport { events } from '@adobe-commerce/event-bus';\nimport { useEffect, useState } from 'preact/hooks';\n\nexport interface TermsAndConditionsProps {\n active?: boolean;\n slots?: {\n Agreements?: SlotProps<{\n appendAgreement: SlotMethod<{\n name: string;\n mode: AgreementMode;\n translationId?: string;\n text?: string;\n }>;\n }>;\n };\n}\n\nexport const TermsAndConditions: Container<TermsAndConditionsProps> = ({\n active = true,\n slots,\n ...props\n}) => {\n const [isInitialized, setIsInitialized] = useState(false);\n const [error, setError] = useState<string>('');\n\n const { errorMessage } = useText({\n errorMessage: 'Checkout.TermsAndConditions.error',\n });\n\n const disabledViaConfig = state.config?.agreementsEnabled === false;\n\n const handleChange = () => {\n setError('');\n };\n\n const handleInvalid = () => {\n setError(errorMessage);\n };\n\n useEffect(() => {\n if (!active || disabledViaConfig) return;\n\n const pastUpdate = getLatestCheckoutUpdate();\n\n if (pastUpdate) {\n setIsInitialized(true);\n return;\n }\n\n const onCheckoutInit = events.on(\n 'checkout/initialized',\n () => {\n setIsInitialized(true);\n },\n { eager: true }\n );\n return () => {\n onCheckoutInit?.off();\n };\n }, [active, disabledViaConfig]);\n\n return (\n <TermsAndConditionsComponent\n {...props}\n agreements={\n <Slot\n context={{\n appendAgreement(callback) {\n this._registerMethod((...attrs) => {\n const _agreement = callback(...attrs);\n\n if (!_agreement) return;\n\n const { mode, name, text, translationId } = _agreement;\n\n if (!text && !translationId) {\n console.warn(\n `The agreement ${name} is misconfigured. Please provide a text or a translationId.`\n );\n return;\n }\n\n const label = text ? (\n <Markup html={text} />\n ) : (\n <MarkupText id={translationId!} />\n );\n\n const agreement = (\n <Checkbox\n checked={mode === AgreementMode.AUTO}\n label={label}\n name={name}\n required={true}\n onChange={handleChange}\n onInvalid={handleInvalid}\n />\n );\n\n this._setProps((prev: any) => ({\n children: [...(prev.children || []), agreement],\n }));\n });\n },\n }}\n name=\"Agreements\"\n slot={slots?.Agreements}\n />\n }\n error={error}\n initialized={isInitialized}\n visible={active && !disabledViaConfig}\n />\n );\n};\n"],"names":["Markup","html","sanitizedHtml","DOMPurify","TermsAndConditionsSkeleton","jsx","Skeleton","SkeletonRow","TermsAndConditionsComponent","className","agreements","error","props","jsxs","classes","VComponent","TermsAndConditions","WithConditionals","active","slots","isInitialized","setIsInitialized","useState","setError","errorMessage","useText","disabledViaConfig","_a","state","handleChange","handleInvalid","useEffect","getLatestCheckoutUpdate","onCheckoutInit","events","Slot","callback","attrs","_agreement","mode","name","text","translationId","label","MarkupText","agreement","Checkbox","AgreementMode","prev"],"mappings":"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"}
|
package/containers/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
+
export * from './AddressValidation';
|
|
17
18
|
export * from './BillToShippingAddress';
|
|
18
19
|
export * from './EstimateShipping';
|
|
19
20
|
export * from './LoginForm';
|
package/data/models/address.d.ts
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Country, CustomAttribute, Region, ShippingMethod } from '.';
|
|
2
2
|
|
|
3
3
|
export interface Address {
|
|
4
|
-
id?: number;
|
|
5
4
|
city: string;
|
|
6
5
|
company?: string;
|
|
7
6
|
country: Country;
|
|
8
7
|
customAttributes: CustomAttribute[];
|
|
8
|
+
fax?: string;
|
|
9
9
|
firstName: string;
|
|
10
|
+
id?: number;
|
|
10
11
|
lastName: string;
|
|
12
|
+
middleName?: string;
|
|
11
13
|
postCode?: string;
|
|
14
|
+
prefix?: string;
|
|
12
15
|
region?: Region;
|
|
13
16
|
street: string[];
|
|
17
|
+
suffix?: string;
|
|
14
18
|
telephone?: string;
|
|
19
|
+
uid: string;
|
|
15
20
|
vatId?: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
}
|
|
22
|
+
export interface ShippingAddress extends Address {
|
|
23
|
+
availableShippingMethods?: ShippingMethod[];
|
|
24
|
+
selectedShippingMethod?: ShippingMethod;
|
|
20
25
|
}
|
|
21
26
|
//# sourceMappingURL=address.d.ts.map
|
package/data/models/api.d.ts
CHANGED
|
@@ -1,33 +1,46 @@
|
|
|
1
|
-
import { CustomAttribute } from '
|
|
1
|
+
import { CustomAttribute } from '.';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface ExtensibleInput {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export interface AddressInput {
|
|
4
7
|
city: string;
|
|
5
8
|
company?: string;
|
|
6
9
|
countryCode: string;
|
|
7
|
-
customAttributes
|
|
10
|
+
customAttributes?: CustomAttribute[];
|
|
11
|
+
fax?: string;
|
|
8
12
|
firstName: string;
|
|
9
13
|
lastName: string;
|
|
14
|
+
middleName?: string;
|
|
10
15
|
postcode?: string;
|
|
16
|
+
prefix?: string;
|
|
11
17
|
region?: string;
|
|
12
18
|
regionId?: number;
|
|
13
19
|
saveInAddressBook?: boolean;
|
|
14
20
|
street: string[];
|
|
21
|
+
suffix?: string;
|
|
15
22
|
telephone?: string;
|
|
16
23
|
vatId?: string;
|
|
17
|
-
prefix?: string;
|
|
18
|
-
suffix?: string;
|
|
19
|
-
middleName?: string;
|
|
20
|
-
fax?: string;
|
|
21
24
|
}
|
|
22
|
-
export interface ShippingAddressInput {
|
|
23
|
-
address?:
|
|
25
|
+
export interface ShippingAddressInput extends ExtensibleInput {
|
|
26
|
+
address?: AddressInput;
|
|
24
27
|
customerAddressId?: number;
|
|
28
|
+
customerAddressUid?: string;
|
|
25
29
|
pickupLocationCode?: string;
|
|
26
30
|
}
|
|
27
31
|
export interface BillingAddressInput {
|
|
28
|
-
address?:
|
|
32
|
+
address?: AddressInput;
|
|
29
33
|
customerAddressId?: number;
|
|
34
|
+
customerAddressUid?: string;
|
|
30
35
|
sameAsShipping?: boolean;
|
|
31
36
|
useForShipping?: boolean;
|
|
32
37
|
}
|
|
38
|
+
export interface PaymentMethodInput extends ExtensibleInput {
|
|
39
|
+
code: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ShippingMethodInput extends ExtensibleInput {
|
|
42
|
+
carrierCode: string;
|
|
43
|
+
methodCode: string;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
33
46
|
//# sourceMappingURL=api.d.ts.map
|
package/data/models/cart.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Address, PaymentMethod,
|
|
1
|
+
import { Address, PaymentMethod, ShippingAddress } from '.';
|
|
2
2
|
|
|
3
|
-
export interface
|
|
4
|
-
availableShippingMethods?: ShippingMethod[];
|
|
5
|
-
selectedShippingMethod?: ShippingMethod;
|
|
6
|
-
sameAsBilling?: boolean;
|
|
3
|
+
export interface CartAddress extends Address {
|
|
7
4
|
}
|
|
5
|
+
export type CartShippingAddress = CartAddress & ShippingAddress & {
|
|
6
|
+
sameAsBilling?: boolean;
|
|
7
|
+
};
|
|
8
8
|
export interface Cart {
|
|
9
9
|
availablePaymentMethods?: PaymentMethod[];
|
|
10
|
-
billingAddress?:
|
|
10
|
+
billingAddress?: CartAddress;
|
|
11
11
|
email?: string;
|
|
12
12
|
id: string;
|
|
13
13
|
isEmpty: boolean;
|
|
14
14
|
isGuest: boolean;
|
|
15
15
|
isVirtual: boolean;
|
|
16
16
|
selectedPaymentMethod?: PaymentMethod;
|
|
17
|
-
shippingAddresses
|
|
17
|
+
shippingAddresses: CartShippingAddress[];
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=cart.d.ts.map
|
|
@@ -30,5 +30,19 @@ export interface CheckoutAgreement {
|
|
|
30
30
|
name: string;
|
|
31
31
|
text: string;
|
|
32
32
|
}
|
|
33
|
+
export interface CheckoutError {
|
|
34
|
+
/**
|
|
35
|
+
* The primary, user-friendly error message. This should be safe to display
|
|
36
|
+
* directly in the UI.
|
|
37
|
+
* @example "Your card was declined."
|
|
38
|
+
*/
|
|
39
|
+
message: string;
|
|
40
|
+
/**
|
|
41
|
+
* An optional, unique error code for programmatic handling. This allows the
|
|
42
|
+
* ServerError component to show specific icons, links, or actions.
|
|
43
|
+
* @example "payment_intent_declined"
|
|
44
|
+
*/
|
|
45
|
+
code?: string;
|
|
46
|
+
}
|
|
33
47
|
export {};
|
|
34
48
|
//# sourceMappingURL=checkout.d.ts.map
|
package/data/models/country.d.ts
CHANGED
package/data/models/index.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export * from './country';
|
|
|
22
22
|
export * from './custom-attribute';
|
|
23
23
|
export * from './customer';
|
|
24
24
|
export * from './email-availability';
|
|
25
|
+
export * from './money';
|
|
25
26
|
export * from './payment-method';
|
|
26
|
-
export * from './
|
|
27
|
+
export * from './quote';
|
|
27
28
|
export * from './region';
|
|
28
29
|
export * from './shipping-estimate';
|
|
29
30
|
export * from './shipping-method';
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export type
|
|
17
|
+
export type Money = {
|
|
18
18
|
value: number;
|
|
19
19
|
currency: string;
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=money.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Address, PaymentMethod, ShippingAddress } from '.';
|
|
2
|
+
import { NegotiableQuoteStatus } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
export interface NegotiableQuote {
|
|
5
|
+
availablePaymentMethods?: PaymentMethod[];
|
|
6
|
+
billingAddress?: Address;
|
|
7
|
+
email?: string;
|
|
8
|
+
isEmpty: boolean;
|
|
9
|
+
isVirtual: boolean;
|
|
10
|
+
name: string;
|
|
11
|
+
selectedPaymentMethod?: PaymentMethod;
|
|
12
|
+
shippingAddresses: ShippingAddress[];
|
|
13
|
+
status: NegotiableQuoteStatus;
|
|
14
|
+
uid: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Money, ShippingMethod } from '.';
|
|
2
2
|
|
|
3
3
|
export interface PartialShippingAddress {
|
|
4
4
|
countryCode: string;
|
|
@@ -8,11 +8,11 @@ export interface PartialShippingAddress {
|
|
|
8
8
|
regionId?: number;
|
|
9
9
|
}
|
|
10
10
|
export interface ShippingEstimateShippingMethod {
|
|
11
|
-
amount:
|
|
11
|
+
amount: Money;
|
|
12
12
|
carrierCode: string;
|
|
13
13
|
methodCode: string;
|
|
14
|
-
amountExclTax?:
|
|
15
|
-
amountInclTax?:
|
|
14
|
+
amountExclTax?: Money;
|
|
15
|
+
amountInclTax?: Money;
|
|
16
16
|
}
|
|
17
17
|
export interface ShippingEstimate {
|
|
18
18
|
address: PartialShippingAddress;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Money } from './money';
|
|
2
2
|
|
|
3
3
|
type Carrier = {
|
|
4
4
|
code: string;
|
|
5
5
|
title: string;
|
|
6
6
|
};
|
|
7
7
|
export type ShippingMethod = {
|
|
8
|
-
amount:
|
|
8
|
+
amount: Money;
|
|
9
9
|
carrier: Carrier;
|
|
10
10
|
code: string;
|
|
11
11
|
title: string;
|
|
12
12
|
value: string;
|
|
13
|
-
amountExclTax?:
|
|
14
|
-
amountInclTax?:
|
|
13
|
+
amountExclTax?: Money;
|
|
14
|
+
amountInclTax?: Money;
|
|
15
15
|
};
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=shipping-method.d.ts.map
|
package/data/models/values.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { PaymentMethod, ShippingMethod } from '.';
|
|
|
2
2
|
|
|
3
3
|
export interface ValuesModel {
|
|
4
4
|
email: string;
|
|
5
|
-
isBillToShipping: boolean;
|
|
5
|
+
isBillToShipping: boolean | undefined;
|
|
6
6
|
selectedPaymentMethod: PaymentMethod | null;
|
|
7
7
|
selectedShippingMethod: ShippingMethod | null;
|
|
8
8
|
}
|
|
@@ -14,11 +14,18 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export * from './transform-
|
|
17
|
+
export * from './transform-api';
|
|
18
|
+
export * from './transform-custom-attributes';
|
|
18
19
|
export * from './transform-cart';
|
|
20
|
+
export * from './transform-cart-address';
|
|
21
|
+
export * from './transform-quote-address';
|
|
19
22
|
export * from './transform-checkout-agreements';
|
|
23
|
+
export * from './transform-country';
|
|
20
24
|
export * from './transform-customer';
|
|
21
25
|
export * from './transform-email-availability';
|
|
26
|
+
export * from './transform-negotiable-quote';
|
|
27
|
+
export * from './transform-payment-methods';
|
|
28
|
+
export * from './transform-region';
|
|
22
29
|
export * from './transform-shipping-estimate';
|
|
23
30
|
export * from './transform-shipping-methods';
|
|
24
31
|
export * from './transform-store-config';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BillingAddressInput as BillingAddressInputModel, PaymentMethodInput as PaymentMethodInputModel, ShippingAddressInput as ShippingAddressInputModel, ShippingMethodInput as ShippingMethodInputModel } from '../models/api';
|
|
2
|
+
import { BillingAddressInput, NegotiableQuoteBillingAddressInput, NegotiableQuotePaymentMethodInput, NegotiableQuoteShippingAddressInput, PaymentMethodInput, ShippingAddressInput, ShippingMethodInput } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
export declare function transformPaymentMethodInputModelToCartInput({ code, ...additionalData }: PaymentMethodInputModel): PaymentMethodInput;
|
|
5
|
+
export declare function transformPaymentMethodInputModelToQuoteInput({ code, ...additionalData }: PaymentMethodInputModel): NegotiableQuotePaymentMethodInput;
|
|
6
|
+
export declare const transformShippingMethodInput: (input: ShippingMethodInputModel | ShippingMethodInput) => ShippingMethodInput;
|
|
7
|
+
export declare function transformShippingMethodsInputModel(input: Array<ShippingMethodInputModel | ShippingMethodInput>): Array<ShippingMethodInput>;
|
|
8
|
+
export declare function transformShippingAddressInputModelToCartInput(input: ShippingAddressInputModel): ShippingAddressInput;
|
|
9
|
+
export declare function transformShippingAddressInputModelToQuoteInput(input: ShippingAddressInputModel): NegotiableQuoteShippingAddressInput;
|
|
10
|
+
export declare function transformBillingAddressInputModelToCartInput(input: BillingAddressInputModel): BillingAddressInput;
|
|
11
|
+
export declare function transformBillingAddressInputModelToQuoteInput(input: BillingAddressInputModel): NegotiableQuoteBillingAddressInput;
|
|
12
|
+
//# sourceMappingURL=transform-api.d.ts.map
|
|
@@ -1,51 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { AddressInput as AddressInputModel, CartAddress as CartAddressModel, CartShippingAddress as CartShippingAddressModel } from '../models';
|
|
2
|
+
import { GetCartQuery } from '../../__generated__/types';
|
|
3
3
|
|
|
4
4
|
type ShippingAddresses = NonNullable<GetCartQuery['cart']>['shipping_addresses'];
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type CustomAttributes = NonNullableShippingAddress['custom_attributes'] | NonNullableBillingAddress['custom_attributes'];
|
|
10
|
-
export declare const transformCustomAttributes: (data: CustomAttributes) => CustomAttributeModel[];
|
|
11
|
-
declare const transformBillingAddress: (data: BillingAddress) => AddressModel | undefined;
|
|
12
|
-
declare const transformShippingAddresses: (data: ({
|
|
5
|
+
type CartShippingAddress = ShippingAddresses[0];
|
|
6
|
+
type CartBillingAddress = NonNullable<GetCartQuery['cart']>['billing_address'];
|
|
7
|
+
declare const transformCartBillingAddress: (data: CartBillingAddress) => CartAddressModel | undefined;
|
|
8
|
+
declare const transformCartShippingAddress: (data: ({
|
|
13
9
|
__typename?: "ShippingCartAddress" | undefined;
|
|
14
|
-
|
|
10
|
+
city: string;
|
|
11
|
+
company?: string | null | undefined;
|
|
12
|
+
fax?: string | null | undefined;
|
|
15
13
|
firstname: string;
|
|
14
|
+
id?: number | null | undefined;
|
|
16
15
|
lastname: string;
|
|
17
|
-
|
|
18
|
-
street: (string | null)[];
|
|
19
|
-
city: string;
|
|
16
|
+
middlename?: string | null | undefined;
|
|
20
17
|
postcode?: string | null | undefined;
|
|
21
|
-
vat_id?: string | null | undefined;
|
|
22
|
-
telephone?: string | null | undefined;
|
|
23
|
-
same_as_billing: boolean;
|
|
24
18
|
prefix?: string | null | undefined;
|
|
19
|
+
same_as_billing: boolean;
|
|
20
|
+
street: (string | null)[];
|
|
25
21
|
suffix?: string | null | undefined;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
__typename?: "CartAddressRegion" | undefined;
|
|
30
|
-
region_id?: number | null | undefined;
|
|
31
|
-
code?: string | null | undefined;
|
|
32
|
-
label?: string | null | undefined;
|
|
33
|
-
} | null | undefined;
|
|
34
|
-
country: {
|
|
35
|
-
__typename?: "CartAddressCountry" | undefined;
|
|
36
|
-
code: string;
|
|
37
|
-
label: string;
|
|
38
|
-
};
|
|
39
|
-
custom_attributes: ({
|
|
40
|
-
__typename?: "AttributeSelectedOptions" | undefined;
|
|
41
|
-
} | {
|
|
42
|
-
__typename?: "AttributeValue" | undefined;
|
|
43
|
-
code: string;
|
|
44
|
-
value: string;
|
|
45
|
-
} | null)[];
|
|
22
|
+
telephone?: string | null | undefined;
|
|
23
|
+
uid: string;
|
|
24
|
+
vat_id?: string | null | undefined;
|
|
46
25
|
available_shipping_methods?: ({
|
|
47
26
|
__typename?: "AvailableShippingMethod" | undefined;
|
|
48
|
-
available: boolean;
|
|
49
27
|
carrier_code: string;
|
|
50
28
|
carrier_title: string;
|
|
51
29
|
error_message?: string | null | undefined;
|
|
@@ -67,6 +45,24 @@ declare const transformShippingAddresses: (data: ({
|
|
|
67
45
|
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
68
46
|
};
|
|
69
47
|
} | null)[] | null | undefined;
|
|
48
|
+
country: {
|
|
49
|
+
__typename?: "CartAddressCountry" | undefined;
|
|
50
|
+
code: string;
|
|
51
|
+
label: string;
|
|
52
|
+
};
|
|
53
|
+
custom_attributes: ({
|
|
54
|
+
__typename?: "AttributeSelectedOptions" | undefined;
|
|
55
|
+
} | {
|
|
56
|
+
__typename?: "AttributeValue" | undefined;
|
|
57
|
+
code: string;
|
|
58
|
+
value: string;
|
|
59
|
+
} | null)[];
|
|
60
|
+
region?: {
|
|
61
|
+
__typename?: "CartAddressRegion" | undefined;
|
|
62
|
+
region_id?: number | null | undefined;
|
|
63
|
+
code?: string | null | undefined;
|
|
64
|
+
label?: string | null | undefined;
|
|
65
|
+
} | null | undefined;
|
|
70
66
|
selected_shipping_method?: {
|
|
71
67
|
__typename?: "SelectedShippingMethod" | undefined;
|
|
72
68
|
carrier_code: string;
|
|
@@ -75,8 +71,8 @@ declare const transformShippingAddresses: (data: ({
|
|
|
75
71
|
method_title: string;
|
|
76
72
|
amount: {
|
|
77
73
|
__typename?: "Money" | undefined;
|
|
78
|
-
value?: number | null | undefined;
|
|
79
74
|
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
75
|
+
value?: number | null | undefined;
|
|
80
76
|
};
|
|
81
77
|
price_excl_tax: {
|
|
82
78
|
__typename?: "Money" | undefined;
|
|
@@ -89,7 +85,7 @@ declare const transformShippingAddresses: (data: ({
|
|
|
89
85
|
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
90
86
|
};
|
|
91
87
|
} | null | undefined;
|
|
92
|
-
} | null)[]) =>
|
|
93
|
-
declare const
|
|
94
|
-
export {
|
|
95
|
-
//# sourceMappingURL=transform-address.d.ts.map
|
|
88
|
+
} | null)[]) => CartShippingAddressModel[];
|
|
89
|
+
declare const transformAddressToCartAddressInput: <T extends CartAddressModel>(address?: T | null | undefined) => AddressInputModel | undefined;
|
|
90
|
+
export { CartBillingAddress, CartShippingAddress, transformAddressToCartAddressInput, transformCartBillingAddress, transformCartShippingAddress, };
|
|
91
|
+
//# sourceMappingURL=transform-cart-address.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GetCartQuery } from '../../__generated__/types';
|
|
2
1
|
import { Cart as CartModel } from '../models';
|
|
2
|
+
import { GetCartQuery } from '../../__generated__/types';
|
|
3
3
|
|
|
4
4
|
type Cart = GetCartQuery['cart'];
|
|
5
5
|
declare const transformCart: (data: Cart) => CartModel | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CartAddressCountry, NegotiableQuoteAddressCountry } from '../../__generated__/types';
|
|
2
|
+
import { Country as CountryModel } from '../models';
|
|
3
|
+
|
|
4
|
+
type AddressCountry = CartAddressCountry | NegotiableQuoteAddressCountry;
|
|
5
|
+
type OptionalAddressCountry = AddressCountry | undefined | null;
|
|
6
|
+
export declare const transformAddressCountry: (data: OptionalAddressCountry) => CountryModel;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=transform-country.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomAttribute as CustomAttributeModel } from '../models/custom-attribute';
|
|
2
|
+
import { AttributeValue } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
export declare const transformCustomAttributes: (data: Array<AttributeValue | any | null> | null | undefined) => CustomAttributeModel[];
|
|
5
|
+
//# sourceMappingURL=transform-custom-attributes.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NegotiableQuote as NegotiableQuoteModel } from '../models';
|
|
2
|
+
import { GetNegotiableQuoteQuery } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
type NegotiableQuote = GetNegotiableQuoteQuery['negotiableQuote'];
|
|
5
|
+
export declare const transformNegotiableQuote: (data: NegotiableQuote | undefined) => NegotiableQuoteModel | null;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=transform-negotiable-quote.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GetCartQuery } from '../../__generated__/types';
|
|
2
1
|
import { PaymentMethod } from '../models/payment-method';
|
|
2
|
+
import { GetCartQuery } from '../../__generated__/types';
|
|
3
3
|
|
|
4
4
|
type SelectedPaymentMethod = NonNullable<GetCartQuery['cart']>['selected_payment_method'];
|
|
5
5
|
type AvailablePaymentMethods = NonNullable<GetCartQuery['cart']>['available_payment_methods'];
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Address as AddressModel, ShippingAddress as ShippingAddressModel } from '../models';
|
|
2
|
+
import { GetNegotiableQuoteQuery } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
type QuoteShippingAddresses = NonNullable<GetNegotiableQuoteQuery['negotiableQuote']>['shipping_addresses'];
|
|
5
|
+
type QuoteShippingAddress = QuoteShippingAddresses[0];
|
|
6
|
+
type QuoteBillingAddress = NonNullable<GetNegotiableQuoteQuery['negotiableQuote']>['billing_address'];
|
|
7
|
+
declare const transformQuoteBillingAddress: (data: QuoteBillingAddress) => AddressModel | undefined;
|
|
8
|
+
declare const transformQuoteShippingAddress: (data: ({
|
|
9
|
+
__typename?: "NegotiableQuoteShippingAddress" | undefined;
|
|
10
|
+
city: string;
|
|
11
|
+
company?: string | null | undefined;
|
|
12
|
+
fax?: string | null | undefined;
|
|
13
|
+
firstname: string;
|
|
14
|
+
lastname: string;
|
|
15
|
+
middlename?: string | null | undefined;
|
|
16
|
+
postcode?: string | null | undefined;
|
|
17
|
+
prefix?: string | null | undefined;
|
|
18
|
+
street: (string | null)[];
|
|
19
|
+
suffix?: string | null | undefined;
|
|
20
|
+
telephone?: string | null | undefined;
|
|
21
|
+
uid: string;
|
|
22
|
+
vat_id?: string | null | undefined;
|
|
23
|
+
available_shipping_methods?: ({
|
|
24
|
+
__typename?: "AvailableShippingMethod" | undefined;
|
|
25
|
+
carrier_code: string;
|
|
26
|
+
carrier_title: string;
|
|
27
|
+
error_message?: string | null | undefined;
|
|
28
|
+
method_code?: string | null | undefined;
|
|
29
|
+
method_title?: string | null | undefined;
|
|
30
|
+
amount: {
|
|
31
|
+
__typename?: "Money" | undefined;
|
|
32
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
33
|
+
value?: number | null | undefined;
|
|
34
|
+
};
|
|
35
|
+
price_excl_tax: {
|
|
36
|
+
__typename?: "Money" | undefined;
|
|
37
|
+
value?: number | null | undefined;
|
|
38
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
39
|
+
};
|
|
40
|
+
price_incl_tax: {
|
|
41
|
+
__typename?: "Money" | undefined;
|
|
42
|
+
value?: number | null | undefined;
|
|
43
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
44
|
+
};
|
|
45
|
+
} | null)[] | null | undefined;
|
|
46
|
+
country: {
|
|
47
|
+
__typename?: "NegotiableQuoteAddressCountry" | undefined;
|
|
48
|
+
code: string;
|
|
49
|
+
label: string;
|
|
50
|
+
};
|
|
51
|
+
custom_attributes?: ({
|
|
52
|
+
__typename?: "AttributeSelectedOptions" | undefined;
|
|
53
|
+
} | {
|
|
54
|
+
__typename?: "AttributeValue" | undefined;
|
|
55
|
+
code: string;
|
|
56
|
+
value: string;
|
|
57
|
+
} | null)[] | null | undefined;
|
|
58
|
+
region?: {
|
|
59
|
+
__typename?: "NegotiableQuoteAddressRegion" | undefined;
|
|
60
|
+
region_id?: number | null | undefined;
|
|
61
|
+
code?: string | null | undefined;
|
|
62
|
+
label?: string | null | undefined;
|
|
63
|
+
} | null | undefined;
|
|
64
|
+
selected_shipping_method?: {
|
|
65
|
+
__typename?: "SelectedShippingMethod" | undefined;
|
|
66
|
+
carrier_code: string;
|
|
67
|
+
carrier_title: string;
|
|
68
|
+
method_code: string;
|
|
69
|
+
method_title: string;
|
|
70
|
+
amount: {
|
|
71
|
+
__typename?: "Money" | undefined;
|
|
72
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
73
|
+
value?: number | null | undefined;
|
|
74
|
+
};
|
|
75
|
+
price_excl_tax: {
|
|
76
|
+
__typename?: "Money" | undefined;
|
|
77
|
+
value?: number | null | undefined;
|
|
78
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
79
|
+
};
|
|
80
|
+
price_incl_tax: {
|
|
81
|
+
__typename?: "Money" | undefined;
|
|
82
|
+
value?: number | null | undefined;
|
|
83
|
+
currency?: import('../../__generated__/types').CurrencyEnum | null | undefined;
|
|
84
|
+
};
|
|
85
|
+
} | null | undefined;
|
|
86
|
+
} | null)[]) => ShippingAddressModel[];
|
|
87
|
+
export { QuoteBillingAddress, QuoteShippingAddress, transformQuoteBillingAddress, transformQuoteShippingAddress, };
|
|
88
|
+
//# sourceMappingURL=transform-quote-address.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Region as RegionModel } from '../models';
|
|
2
|
+
import { CartAddressRegion, NegotiableQuoteAddressRegion } from '../../__generated__/types';
|
|
3
|
+
|
|
4
|
+
type AddressRegion = CartAddressRegion | NegotiableQuoteAddressRegion;
|
|
5
|
+
type OptionalAddressRegion = AddressRegion | undefined | null;
|
|
6
|
+
export declare const transformAddressRegion: (data: OptionalAddressRegion) => RegionModel | undefined;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=transform-region.d.ts.map
|