@dropins/storefront-checkout 2.0.1-beta1 → 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
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-checkout/src/api/estimateShippingMethods/graphql/estimateShippingMethods.graphql.ts","/@dropins/storefront-checkout/src/data/transforms/transform-checkout-agreements.ts","/@dropins/storefront-checkout/src/api/estimateShippingMethods/estimateShippingMethods.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/graphql/getCheckoutAgreements.graphql.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/getCheckoutAgreements.ts","/@dropins/storefront-checkout/src/api/setShippingAddress/graphql/setShippingAddress.graphql.ts","/@dropins/storefront-checkout/src/api/setShippingAddress/graphql/setShippingAddressAndUseAsBilling.graphql.ts","/@dropins/storefront-checkout/src/api/setShippingAddress/setShippingAddress.ts"],"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\nexport const estimateShippingMethodsMutation = /* GraphQL */ `\n mutation estimateShippingMethods(\n $cartId: String!\n $address: EstimateAddressInput!\n ) {\n estimateShippingMethods(input: { cart_id: $cartId, address: $address }) {\n carrier_title\n carrier_code\n method_title\n method_code\n available\n amount {\n currency\n value\n }\n price_excl_tax {\n currency\n value\n }\n price_incl_tax {\n currency\n value\n }\n error_message\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 {\n AgreementMode,\n CheckoutAgreement as CheckoutAgreementModel,\n} from '@/checkout/data/models';\nimport { Get_Checkout_AgreementsQuery } from '@/checkout/__generated__/types';\n\ntype CheckoutAgreements = Get_Checkout_AgreementsQuery['checkoutAgreements'];\ntype FilteredAgreement = NonNullable<NonNullable<CheckoutAgreements>[0]>;\n\nexport const transformCheckoutAgreements = (\n data: CheckoutAgreements\n): CheckoutAgreementModel[] => {\n if (!data) return [];\n\n return data\n .filter((agreement): agreement is FilteredAgreement => !!agreement)\n .map((agreement) => ({\n id: agreement.agreement_id,\n name: agreement.name,\n mode: AgreementMode[agreement.mode],\n text: agreement.checkbox_text,\n content: {\n value: agreement.content,\n html: agreement.is_html,\n height: agreement.content_height ?? null,\n },\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 { MissingCart, MissingCountry } from '@/checkout/api';\nimport { estimateShippingMethodsMutation } from '@/checkout/api/estimateShippingMethods/graphql';\nimport { ShippingMethod } from '@/checkout/data/models';\nimport {\n transformShippingEstimatePartialAddress,\n transformShippingEstimateShippingMethod,\n transformShippingMethods,\n} from '@/checkout/data/transforms';\nimport { dispatchApiCall, getValue, QueueName, state } from '@/checkout/lib';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ShippingEstimationCriteria {\n country_code: string;\n region_name?: string;\n region_id?: string | number;\n zip?: string;\n}\n\nexport type EstimateShippingInput = {\n criteria: ShippingEstimationCriteria;\n};\n\nexport const estimateShippingMethods = async (\n input?: EstimateShippingInput\n): Promise<ShippingMethod[] | undefined> => {\n const cartId = state.cartId;\n const countryCode =\n input?.criteria?.country_code ?? state.config?.defaultCountry;\n\n if (!cartId) throw new MissingCart();\n if (!countryCode) throw new MissingCountry();\n\n const { region_id, region_name, zip } = input?.criteria ?? {};\n\n // Process region information\n const region =\n region_id || region_name\n ? {\n region_id:\n typeof region_id === 'string' ? parseInt(region_id, 10) : region_id,\n region_code: region_name,\n }\n : undefined;\n\n // Build address for API call\n const address = {\n country_code: countryCode,\n ...(zip && { postcode: zip }),\n ...(region && {\n region: {\n ...(region.region_id && { region_id: region.region_id }),\n ...(region.region_code && { region_code: region.region_code }),\n },\n }),\n };\n\n // Create address data for transformation\n const estimateShippingAddressData = {\n country_id: countryCode,\n region: address.region?.region_code,\n region_id: address.region?.region_id,\n postcode: zip,\n };\n\n const partialAddress = transformShippingEstimatePartialAddress(\n estimateShippingAddressData\n );\n\n return dispatchApiCall({\n options: { variables: { cartId, address } },\n path: 'estimateShippingMethods',\n query: estimateShippingMethodsMutation,\n queueName: QueueName.ShippingEstimate,\n transformer: transformShippingMethods,\n type: 'mutation',\n })\n .then((estimation) => {\n const hasAvailableOptions = estimation.length > 0;\n const partialAddress = transformShippingEstimatePartialAddress(\n estimateShippingAddressData\n );\n\n let shippingMethod = null;\n\n if (hasAvailableOptions) {\n const userSelection = getValue('selectedShippingMethod');\n\n const selection = estimation.find(\n (method) =>\n method.code === userSelection?.code &&\n method.carrier.code === userSelection?.carrier.code\n );\n\n shippingMethod = transformShippingEstimateShippingMethod(\n selection ?? estimation[0]\n );\n }\n\n events.emit('shipping/estimate', {\n address: partialAddress,\n availableShippingMethods: estimation,\n shippingMethod,\n success: true,\n });\n\n return estimation;\n })\n .catch((error) => {\n events.emit('shipping/estimate', {\n address: partialAddress,\n shippingMethod: null,\n availableShippingMethods: [],\n success: false,\n });\n\n throw error;\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\nexport const GET_CHECKOUT_AGREEMENTS = /* GraphQL */ `\n query GET_CHECKOUT_AGREEMENTS {\n checkoutAgreements {\n agreement_id\n checkbox_text\n content\n content_height\n is_html\n mode\n name\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { CheckoutAgreement } from '@/checkout/data/models';\nimport { transformCheckoutAgreements } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib';\nimport { GET_CHECKOUT_AGREEMENTS } from './graphql/getCheckoutAgreements.graphql';\n\nexport const getCheckoutAgreements = async (): Promise<CheckoutAgreement[]> => {\n return await dispatchApiCall({\n defaultValueOnFail: [],\n options: { method: 'GET', cache: 'no-cache' },\n path: 'checkoutAgreements',\n query: GET_CHECKOUT_AGREEMENTS,\n transformer: transformCheckoutAgreements,\n type: 'query',\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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setShippingAddressMutation = /* GraphQL */ `\n mutation setShippingAddress(\n $cartId: String!\n $shippingAddressInput: ShippingAddressInput!\n ) {\n setShippingAddressesOnCart(\n input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }\n ) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setShippingAddressAndUseAsBillingMutation = /* GraphQL */ `\n mutation SET_SHIPPING_ADDRESS_ON_CART_AND_USE_AS_BILLING_MUTATION(\n $cartId: String!\n $shippingAddressInput: ShippingAddressInput!\n ) {\n setShippingAddressesOnCart(\n input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }\n ) {\n cart {\n id\n }\n }\n\n setBillingAddressOnCart(\n input: { cart_id: $cartId, billing_address: { same_as_shipping: true } }\n ) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\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 { setShippingAddressMutation } from '@/checkout/api/setShippingAddress/graphql/setShippingAddress.graphql';\nimport { ShippingAddressInput as ShippingAddressInputModel } from '@/checkout/data/models';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { transformCartAddressModelToInput } from '@/checkout/data/transforms/transform-address';\nimport { MissingCart, MissingShippinghAddress } from '@/checkout/errors';\nimport { dispatchApiCall, getValue, QueueName, state } from '@/checkout/lib';\nimport { ShippingAddressInput } from '@/checkout/__generated__/types';\nimport { setShippingAddressAndUseAsBillingMutation } from './graphql/setShippingAddressAndUseAsBilling.graphql';\n\nexport const setShippingAddress = async ({\n address,\n customerAddressId,\n pickupLocationCode,\n}: ShippingAddressInputModel) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n const shippingAddressInput = (): ShippingAddressInput => {\n if (customerAddressId) {\n return { customer_address_id: customerAddressId };\n }\n if (pickupLocationCode) {\n return { pickup_location_code: pickupLocationCode };\n }\n if (!address) {\n throw new MissingShippinghAddress();\n }\n return { address: transformCartAddressModelToInput(address) };\n };\n\n const isBillToShipping = getValue('isBillToShipping');\n\n const query = isBillToShipping\n ? setShippingAddressAndUseAsBillingMutation\n : setShippingAddressMutation;\n\n const path = isBillToShipping\n ? 'setBillingAddressOnCart.cart'\n : 'setShippingAddressesOnCart.cart';\n\n const variables = {\n cartId,\n shippingAddressInput: shippingAddressInput(),\n };\n\n return await dispatchApiCall({\n type: 'mutation',\n query,\n options: { variables },\n path,\n queueName: QueueName.CartUpdate,\n transformer: transformCart,\n });\n};\n"],"names":["estimateShippingMethodsMutation","transformCheckoutAgreements","data","agreement","AgreementMode","estimateShippingMethods","input","cartId","state","countryCode","_a","_b","MissingCart","MissingCountry","region_id","region_name","zip","region","address","estimateShippingAddressData","_c","_d","partialAddress","transformShippingEstimatePartialAddress","dispatchApiCall","QueueName","transformShippingMethods","estimation","hasAvailableOptions","shippingMethod","userSelection","getValue","selection","method","transformShippingEstimateShippingMethod","events","error","GET_CHECKOUT_AGREEMENTS","getCheckoutAgreements","setShippingAddressMutation","CHECKOUT_DATA_FRAGMENT","setShippingAddressAndUseAsBillingMutation","setShippingAddress","customerAddressId","pickupLocationCode","shippingAddressInput","MissingShippinghAddress","transformCartAddressModelToInput","isBillToShipping","query","path","variables","transformCart"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-checkout-agreements.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/graphql/getCheckoutAgreements.graphql.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/getCheckoutAgreements.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 {\n AgreementMode,\n CheckoutAgreement as CheckoutAgreementModel,\n} from '@/checkout/data/models';\nimport { Get_Checkout_AgreementsQuery } from '@/checkout/__generated__/types';\n\ntype CheckoutAgreements = Get_Checkout_AgreementsQuery['checkoutAgreements'];\ntype FilteredAgreement = NonNullable<NonNullable<CheckoutAgreements>[0]>;\n\nexport const transformCheckoutAgreements = (\n data: CheckoutAgreements\n): CheckoutAgreementModel[] => {\n if (!data) return [];\n\n return data\n .filter((agreement): agreement is FilteredAgreement => !!agreement)\n .map((agreement) => ({\n id: agreement.agreement_id,\n name: agreement.name,\n mode: AgreementMode[agreement.mode],\n text: agreement.checkbox_text,\n content: {\n value: agreement.content,\n html: agreement.is_html,\n height: agreement.content_height ?? null,\n },\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\nexport const GET_CHECKOUT_AGREEMENTS = /* GraphQL */ `\n query GET_CHECKOUT_AGREEMENTS {\n checkoutAgreements {\n agreement_id\n checkbox_text\n content\n content_height\n is_html\n mode\n name\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { CheckoutAgreement } from '@/checkout/data/models';\nimport { transformCheckoutAgreements } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib';\nimport { GET_CHECKOUT_AGREEMENTS } from './graphql/getCheckoutAgreements.graphql';\n\nexport const getCheckoutAgreements = async (): Promise<CheckoutAgreement[]> => {\n return await dispatchApiCall({\n defaultValueOnFail: [],\n options: { method: 'GET', cache: 'no-cache' },\n path: 'checkoutAgreements',\n query: GET_CHECKOUT_AGREEMENTS,\n transformer: transformCheckoutAgreements,\n type: 'query',\n });\n};\n"],"names":["transformCheckoutAgreements","data","agreement","AgreementMode","GET_CHECKOUT_AGREEMENTS","getCheckoutAgreements","dispatchApiCall"],"mappings":"03BA0Ba,MAAAA,EACXC,GAEKA,EAEEA,EACJ,OAAQC,GAA8C,CAAC,CAACA,CAAS,EACjE,IAAKA,IAAe,CACnB,GAAIA,EAAU,aACd,KAAMA,EAAU,KAChB,KAAMC,EAAcD,EAAU,IAAI,EAClC,KAAMA,EAAU,cAChB,QAAS,CACP,MAAOA,EAAU,QACjB,KAAMA,EAAU,QAChB,OAAQA,EAAU,gBAAkB,IAAA,CACtC,EACA,EAdc,CAAC,ECZRE,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECKxCC,EAAwB,SAC5B,MAAMC,EAAgB,CAC3B,mBAAoB,CAAC,EACrB,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,qBACN,MAAOF,EACP,YAAaJ,EACb,KAAM,OAAA,CACP"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{jsxs as a,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";function l(r,t){return function(e){const{initialized:i=!0,visible:n=!0,...s}=e;return a("div",{className:"conditional-wrapper",children:[n&&!i&&o(t,{}),n&&i&&o(r,{...s})]})}}export{l as W};
|
|
4
4
|
//# sourceMappingURL=ConditionalWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionalWrapper.js","sources":["/@dropins/storefront-checkout/src/
|
|
1
|
+
{"version":3,"file":"ConditionalWrapper.js","sources":["/@dropins/storefront-checkout/src/components/ConditionalWrapper/ConditionalWrapper.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { FunctionComponent } from 'preact';\n\nexport interface ConditionalProps {\n initialized?: boolean;\n visible?: boolean;\n}\n\nexport function WithConditionals<P extends object>(\n Component: FunctionComponent<P>,\n Skeleton: FunctionComponent\n): FunctionComponent<P & ConditionalProps> {\n return function ConditionalWrapper(props: P & ConditionalProps) {\n const { initialized = true, visible = true, ...componentProps } = props;\n\n return (\n <div className=\"conditional-wrapper\">\n {visible && !initialized && <Skeleton />}\n {visible && initialized && <Component {...(componentProps as P)} />}\n </div>\n );\n };\n}\n"],"names":["WithConditionals","Component","Skeleton","props","initialized","visible","componentProps","jsxs","jsx"],"mappings":"qEAwBgB,SAAAA,EACdC,EACAC,EACyC,CAClC,OAAA,SAA4BC,EAA6B,CAC9D,KAAM,CAAE,YAAAC,EAAc,GAAM,QAAAC,EAAU,GAAM,GAAGC,GAAmBH,EAGhE,OAAAI,EAAC,MAAI,CAAA,UAAU,sBACZ,SAAA,CAAWF,GAAA,CAACD,GAAeI,EAACN,EAAS,CAAA,CAAA,EACrCG,GAAWD,GAAgBI,EAAAP,EAAA,CAAW,GAAIK,CAAsB,CAAA,CAAA,EACnE,CAEJ,CACF"}
|
package/chunks/checkout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.js","sources":["/@dropins/storefront-checkout/src/data/models/checkout.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport enum AgreementMode {\n MANUAL = 'manual',\n AUTO = 'auto',\n}\n\ntype AgreementContent = {\n value: string;\n html: boolean;\n height: string | null;\n};\n\nexport interface CheckoutAgreement {\n content: AgreementContent;\n id: number;\n mode: AgreementMode;\n name: string;\n text: string;\n}\n"],"names":["AgreementMode"],"mappings":"AAiBY,IAAAA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"checkout.js","sources":["/@dropins/storefront-checkout/src/data/models/checkout.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport enum AgreementMode {\n MANUAL = 'manual',\n AUTO = 'auto',\n}\n\ntype AgreementContent = {\n value: string;\n html: boolean;\n height: string | null;\n};\n\nexport interface CheckoutAgreement {\n content: AgreementContent;\n id: number;\n mode: AgreementMode;\n name: string;\n text: string;\n}\n\nexport interface CheckoutError {\n /**\n * The primary, user-friendly error message. This should be safe to display\n * directly in the UI.\n * @example \"Your card was declined.\"\n */\n message: string;\n\n /**\n * An optional, unique error code for programmatic handling. This allows the\n * ServerError component to show specific icons, links, or actions.\n * @example \"payment_intent_declined\"\n */\n code?: string;\n}\n"],"names":["AgreementMode"],"mappings":"AAiBY,IAAAA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA"}
|
package/chunks/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sources":["/@dropins/storefront-checkout/src/lib/dom.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport function scrollToElement(element: HTMLElement) {\n element.focus();\n\n // If element is not focusable, scroll manually\n if (document.activeElement !== element) {\n element.scrollIntoView({ behavior: 'smooth' });\n }\n}\n"],"names":["scrollToElement","element"],"mappings":"AAiBO,SAASA,EAAgBC,EAAsB,CACpDA,EAAQ,MAAM,EAGV,SAAS,gBAAkBA,GAC7BA,EAAQ,eAAe,CAAE,SAAU,QAAA,CAAU,CAEjD"}
|
|
1
|
+
{"version":3,"file":"dom.js","sources":["/@dropins/storefront-checkout/src/lib/utils/dom.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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\nexport function scrollToElement(element: HTMLElement) {\n element.focus();\n\n // If element is not focusable, scroll manually\n if (document.activeElement !== element) {\n element.scrollIntoView({ behavior: 'smooth' });\n }\n}\n"],"names":["scrollToElement","element"],"mappings":"AAiBO,SAASA,EAAgBC,EAAsB,CACpDA,EAAQ,MAAM,EAGV,SAAS,gBAAkBA,GAC7BA,EAAQ,eAAe,CAAE,SAAU,QAAA,CAAU,CAEjD"}
|
package/chunks/events.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{events as n}from"@dropins/tools/event-bus.js";function u(){return n.lastPayload("checkout/initialized")??null}function i(){return n.lastPayload("checkout/updated")??null}function a(){return i()??u()}function s(){var e;const t=a();return!!((e=t==null?void 0:t.shippingAddresses)!=null&&e.length)}function l(){const t=a();return(t==null?void 0:t.email)??null}export{l as a,a as b,i as g,s as h};
|
|
4
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sources":["/@dropins/storefront-checkout/src/lib/events.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport { events } from '@adobe-commerce/event-bus';\n\ntype DataModel = Cart | NegotiableQuote;\n\nexport function getInitialCheckoutData(): DataModel | null {\n return events.lastPayload('checkout/initialized') ?? null;\n}\n\nexport function getLatestCheckoutUpdate(): DataModel | null {\n return events.lastPayload('checkout/updated') ?? null;\n}\n\nexport function getCheckoutData(): DataModel | null {\nreturn getLatestCheckoutUpdate() ?? getInitialCheckoutData();\n}\n\nexport function hasShippingAddress(): boolean {\n const cart = getCheckoutData();\n return !!cart?.shippingAddresses?.length;\n}\n\nexport function getCartEmail(): string | null {\n const cart = getCheckoutData();\n return cart?.email ?? null;\n}\n"],"names":["getInitialCheckoutData","events","getLatestCheckoutUpdate","getCheckoutData","hasShippingAddress","cart","_a","getCartEmail"],"mappings":"qDAsBO,SAASA,GAA2C,CAClD,OAAAC,EAAO,YAAY,sBAAsB,GAAK,IACvD,CAEO,SAASC,GAA4C,CACnD,OAAAD,EAAO,YAAY,kBAAkB,GAAK,IACnD,CAEO,SAASE,GAAoC,CAC7C,OAAAD,KAA6BF,EAAuB,CAC3D,CAEO,SAASI,GAA8B,OAC5C,MAAMC,EAAOF,EAAgB,EACtB,MAAA,CAAC,GAACG,EAAAD,GAAA,YAAAA,EAAM,oBAAN,MAAAC,EAAyB,OACpC,CAEO,SAASC,GAA8B,CAC5C,MAAMF,EAAOF,EAAgB,EAC7B,OAAOE,GAAA,YAAAA,EAAM,QAAS,IACxB"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{b as s}from"./events.js";function u(n){if(n===void 0){const r=s();return!!(r!=null&&r.isVirtual)}return!!(n!=null&&n.isVirtual)}function o(n){return!n||n.isEmpty}function l(n){var i;if(!n)return null;const r=n.shippingAddresses||[];return r.length===0?null:(i=r[0])==null?void 0:i.selectedShippingMethod}function p(n,r="shipping"){var e;return n?(r==="shipping"?(e=n.shippingAddresses)==null?void 0:e[0]:n.billingAddress)??null:null}function g(n){if(!n)return null;const{selectedPaymentMethod:r}=n;return!r||!(r!=null&&r.code)?null:n.selectedPaymentMethod}export{o as a,p as b,g as c,l as g,u as i};
|
|
4
|
+
//# sourceMappingURL=events2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events2.js","sources":["/@dropins/storefront-checkout/src/lib/utils/events.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { Cart } from '@/checkout/data/models/cart';\nimport { getCheckoutData } from '@/checkout/lib/events';\n\ntype CartData = Cart | null;\n\nexport function isVirtualCart(data?: CartData) {\n if (data === undefined) {\n const latestData = getCheckoutData();\n return Boolean(latestData?.isVirtual);\n }\n return Boolean(data?.isVirtual);\n}\n\nexport function isEmptyCart(data: CartData) {\n return !data || data.isEmpty;\n}\n\nexport function getCartShippingMethod(data: CartData) {\n if (!data) return null;\n const shippingAddresses = data.shippingAddresses || [];\n if (shippingAddresses.length === 0) return null;\n return shippingAddresses[0]?.selectedShippingMethod;\n}\n\nexport function getCartAddress(\n data: CartData,\n type: 'shipping' | 'billing' = 'shipping'\n): Record<string, any> | null {\n if (!data) return null;\n\n const address =\n type === 'shipping' ? data.shippingAddresses?.[0] : data.billingAddress;\n\n return address ?? null;\n}\n\nexport function getCartPaymentMethod(data: CartData) {\n if (!data) return null;\n const { selectedPaymentMethod } = data;\n if (!selectedPaymentMethod || !selectedPaymentMethod?.code) return null;\n\n return data.selectedPaymentMethod;\n}\n"],"names":["isVirtualCart","data","latestData","getCheckoutData","isEmptyCart","getCartShippingMethod","shippingAddresses","_a","getCartAddress","type","getCartPaymentMethod","selectedPaymentMethod"],"mappings":"gCAsBO,SAASA,EAAcC,EAAiB,CAC7C,GAAIA,IAAS,OAAW,CACtB,MAAMC,EAAaC,EAAgB,EAC5B,MAAA,GAAQD,GAAA,MAAAA,EAAY,UAAS,CAE/B,MAAA,GAAQD,GAAA,MAAAA,EAAM,UACvB,CAEO,SAASG,EAAYH,EAAgB,CACnC,MAAA,CAACA,GAAQA,EAAK,OACvB,CAEO,SAASI,EAAsBJ,EAAgB,OAChD,GAAA,CAACA,EAAa,OAAA,KACZ,MAAAK,EAAoBL,EAAK,mBAAqB,CAAC,EACjD,OAAAK,EAAkB,SAAW,EAAU,MACpCC,EAAAD,EAAkB,CAAC,IAAnB,YAAAC,EAAsB,sBAC/B,CAEgB,SAAAC,EACdP,EACAQ,EAA+B,WACH,OACxB,OAACR,GAGHQ,IAAS,YAAaF,EAAAN,EAAK,oBAAL,YAAAM,EAAyB,GAAKN,EAAK,iBAEzC,KALA,IAMpB,CAEO,SAASS,EAAqBT,EAAgB,CAC/C,GAAA,CAACA,EAAa,OAAA,KACZ,KAAA,CAAE,sBAAAU,GAA0BV,EAClC,MAAI,CAACU,GAAyB,EAACA,GAAA,MAAAA,EAAuB,MAAa,KAE5DV,EAAK,qBACd"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import"@dropins/tools/lib.js";import{events as y}from"@dropins/tools/event-bus.js";import{signal as D,computed as m}from"@dropins/tools/signals.js";import{FetchGraphQL as S}from"@dropins/tools/fetch-graphql.js";const U={authenticated:!1,cartId:null,config:null,initialized:!1,quoteId:null},G=new Proxy(U,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}});class w extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class I extends Error{constructor(t){super(t),this.name="InvalidInput"}}class a extends I{constructor(t){super(`${t} is required.`)}}class V extends a{constructor(){super("Cart ID")}}class B extends I{constructor(){super("Either Cart ID or Quote ID is required.")}}class $ extends Error{constructor(){super("User is not authenticated")}}class z extends a{constructor(){super("Negotiable Quote ID")}}class Y extends a{constructor(){super("Email")}}class J extends a{constructor(){super("Payment method code")}}class K extends a{constructor(){super("Shipping address")}}class W extends a{constructor(){super("Shipping method")}}class Z extends a{constructor(){super("Billing address")}}class ee extends a{constructor(){super("Country Code")}}var u=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(u||{}),A=(e=>(e.Updates="updates",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(A||{});const d=new Map,g=new Map,c=D(new Set),E=new Map;E.set("updates",e=>{y.emit("checkout/updated",e)});async function q(e){g.set(e,!0);const t=d.get(e);let s;for(;t.length>0;){const i=t.shift();try{const n=await i.requestFn();i.resolve(n),s=n}catch(n){i.reject(n)}}g.set(e,!1);const r=new Set(c.value);r.delete(e),c.value=r;const o=E.get(e);o&&s&&o(s)}function X(e,t="default"){d.has(t)||d.set(t,[]);const s=d.get(t),r=new Promise((i,n)=>{s.push({requestFn:e,resolve:i,reject:n})}),o=new Set(c.value);return o.add(t),c.value=o,g.get(t)||q(t),r}const te=m(()=>c.value.has("updates")),se=m(()=>c.value.has("shippingEstimate")),v=["sender_email","recipient_email"];function T(e){return e.filter(t=>!t.path||!v.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}function L(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}async function M(e){const{defaultValueOnFail:t,options:s,path:r,query:o,queueName:i,transformer:n,type:p}=e;try{const l=async()=>{const{data:N,errors:_}=await P(o,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...s});if(_){const C=T(_);if(C.length>0)throw new w(C)}let h=L(N,r);if(h===void 0)throw new Error(`No data found at path: ${r}`);return n?n(h):h};return p==="mutation"?await X(l,i):await l()}catch(l){if(t!==void 0)return t;throw l}}const x=`
|
|
4
|
+
query getStoreConfig {
|
|
5
|
+
storeConfig {
|
|
6
|
+
default_country
|
|
7
|
+
is_checkout_agreements_enabled
|
|
8
|
+
is_guest_checkout_enabled
|
|
9
|
+
is_one_page_checkout_enabled
|
|
10
|
+
shopping_cart_display_shipping
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping:u.EXCLUDING_TAX}},re=async()=>await M({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:b,type:"query"}),ne=()=>G.config;function Q(e){switch(e){case 1:return u.EXCLUDING_TAX;case 2:return u.INCLUDING_TAX;case 3:return u.INCLUDING_EXCLUDING_TAX;default:return u.EXCLUDING_TAX}}function b(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:s,shopping_cart_display_shipping:r}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:s,shoppingCartDisplaySetting:{shipping:Q(r)}}}const{setEndpoint:ae,setFetchGraphQlHeader:oe,removeFetchGraphQlHeader:ie,setFetchGraphQlHeaders:ue,fetchGraphQl:P,getConfig:ce}=new S().getMethods();export{F as D,I,W as M,A as Q,f as S,u as T,$ as U,se as a,ae as b,oe as c,M as d,ue as e,P as f,ce as g,te as h,re as i,ne as j,J as k,Y as l,V as m,ee as n,K as o,Z as p,B as q,ie as r,G as s,z as t};
|
|
14
|
+
//# sourceMappingURL=fetch-graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-graphql.js","sources":["/@dropins/storefront-checkout/src/lib/state.ts","/@dropins/storefront-checkout/src/lib/errors/customErrors.ts","/@dropins/storefront-checkout/src/data/models/store-config.ts","/@dropins/storefront-checkout/src/lib/enqueueRequest.ts","/@dropins/storefront-checkout/src/lib/filterControlledErrors.ts","/@dropins/storefront-checkout/src/lib/dispatchApiCall.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-checkout/src/data/transforms/transform-store-config.ts","/@dropins/storefront-checkout/src/api/fetch-graphql/fetch-graphql.ts"],"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 { StoreConfig } from '@/checkout/data/models';\n\ntype State = {\n authenticated: boolean;\n cartId?: string | null;\n config: StoreConfig | null;\n initialized: boolean;\n quoteId?: string | null;\n};\n\nconst _state: State = (() => ({\n authenticated: false,\n cartId: null,\n config: null,\n initialized: false,\n quoteId: null,\n}))();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n // @ts-ignore\n target[key] = value;\n return true;\n },\n get(target, key) {\n return target[key as keyof State];\n },\n});\n\nexport function isQuoteCheckout(): boolean {\n return state.quoteId !== null;\n}\n\nexport function isCartCheckout(): boolean {\n return state.cartId !== null;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\nexport class FetchError extends Error {\n constructor(reasons: FetchQueryError) {\n super(reasons.map((e: any) => e.message).join(' '));\n this.name = 'FetchError';\n }\n}\n\nexport class InvalidInput extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidInput';\n }\n}\n\nexport class MissingArgument extends InvalidInput {\n constructor(argumentName: string) {\n super(`${argumentName} is required.`);\n }\n}\n\nexport class MissingCart extends MissingArgument {\n constructor() {\n super('Cart ID');\n }\n}\n\nexport class MissingCartAndQuote extends InvalidInput {\n constructor() {\n super('Either Cart ID or Quote ID is required.');\n }\n}\n\nexport class Unauthenticated extends Error {\n constructor() {\n super('User is not authenticated');\n }\n}\n\nexport class MissingNegotiableQuoteId extends MissingArgument {\n constructor() {\n super('Negotiable Quote ID');\n }\n}\n\nexport class MissingEmail extends MissingArgument {\n constructor() {\n super('Email');\n }\n}\n\nexport class MissingPaymentMethod extends MissingArgument {\n constructor() {\n super('Payment method code');\n }\n}\n\nexport class MissingShippingAddress extends MissingArgument {\n constructor() {\n super('Shipping address');\n }\n}\n\nexport class MissingShippingMethod extends MissingArgument {\n constructor() {\n super('Shipping method');\n }\n}\n\nexport class MissingBillingAddress extends MissingArgument {\n constructor() {\n super('Billing address');\n }\n}\n\nexport class MissingCountry extends MissingArgument {\n constructor() {\n super('Country Code');\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\nexport enum TaxDisplay {\n EXCLUDING_TAX = 'EXCLUDING_TAX',\n INCLUDING_EXCLUDING_TAX = 'INCLUDING_AND_EXCLUDING_TAX',\n INCLUDING_TAX = 'INCLUDING_TAX',\n}\n\nexport interface StoreConfig {\n defaultCountry: string;\n agreementsEnabled: boolean;\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay;\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 { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n computed,\n ReadonlySignal,\n signal,\n} from '@adobe-commerce/elsie/lib/signals';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QueueName {\n Updates = 'updates',\n Default = 'default',\n ShippingEstimate = 'shippingEstimate',\n}\n\ntype Request<T> = () => Promise<T>;\ntype QueueCompletedHandler<T> = (result: T) => void;\n\ninterface QueuedRequest<T> {\n requestFn: Request<T>;\n resolve: (value: T) => void;\n reject: (error: any) => void;\n}\n\nconst queues = new Map<QueueName, QueuedRequest<any>[]>();\nconst processing = new Map<QueueName, boolean>();\nconst pendingRequests = signal<Set<QueueName>>(new Set());\nconst onQueueCompleted = new Map<QueueName, QueueCompletedHandler<any>>();\n\nonQueueCompleted.set(\n QueueName.Updates,\n (latestResult: Cart | NegotiableQuote) => {\n events.emit('checkout/updated', latestResult);\n }\n);\n\nasync function processQueue(type: QueueName): Promise<void> {\n processing.set(type, true);\n\n const queue = queues.get(type)!;\n let latestSuccessResult: any;\n\n while (queue.length > 0) {\n const request = queue.shift()!;\n\n try {\n const result = await request.requestFn();\n request.resolve(result);\n latestSuccessResult = result;\n } catch (error) {\n request.reject(error);\n }\n }\n\n processing.set(type, false);\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.delete(type);\n pendingRequests.value = pendingSet;\n\n const handler = onQueueCompleted.get(type);\n\n if (handler && latestSuccessResult) {\n handler(latestSuccessResult);\n }\n}\n\nexport function enqueueRequest<T>(\n requestFn: Request<T>,\n name: QueueName = QueueName.Default\n): Promise<T> {\n if (!queues.has(name)) {\n queues.set(name, []);\n }\n\n const queue = queues.get(name)!;\n\n const promise = new Promise<T>((resolve, reject) => {\n queue.push({ requestFn, resolve, reject });\n });\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.add(name);\n pendingRequests.value = pendingSet;\n\n if (!processing.get(name)) {\n processQueue(name);\n }\n\n return promise;\n}\n\nexport const hasPendingUpdates: ReadonlySignal<boolean> = computed(() => {\n return pendingRequests.value.has(QueueName.Updates);\n});\n\nexport const hasPendingShippingEstimate: ReadonlySignal<boolean> = computed(\n () => {\n return pendingRequests.value.has(QueueName.ShippingEstimate);\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 { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\ntype ErrorPath = (string | number)[];\n\nexport type ErrorWithPath = FetchQueryError[number] & {\n path?: ErrorPath;\n};\n\nconst controlledErrorProps: string[] = ['sender_email', 'recipient_email'];\n\n/**\n * Filters out errors with known paths from a list of errors generated by a GraphQL query.\n *\n * Known issue: The query does not differentiate between physical and virtual gift cards, leading\n * to errors for physical ones as they don't have 'sender_email' and 'recipient_email' properties.\n *\n * @param {ErrorWithPath[]} errors - Array of errors to be filtered.\n * @return {ErrorWithPath[]} Uncontrolled (unexpected) errors not matching predefined paths.\n */\n\nexport function filterControlledErrors(errors: ErrorWithPath[]) {\n return errors.filter(\n (error) =>\n !error.path ||\n !controlledErrorProps.some((controlledErrorProp) => {\n return error.path?.at(-1) === controlledErrorProp;\n })\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 { fetchGraphQl, FetchOptions, FetchQueryError } from '@/checkout/api';\nimport { enqueueRequest, QueueName } from '@/checkout/lib/enqueueRequest';\nimport { filterControlledErrors } from '@/checkout/lib/filterControlledErrors';\nimport { FetchError } from '@/checkout/lib/errors';\n\ntype DispatchApiCallParams<T> = {\n defaultValueOnFail?: T;\n options?: FetchOptions;\n path: string;\n query: string;\n queueName?: QueueName;\n transformer?: (data: any) => T;\n type: 'query' | 'mutation';\n};\n\nexport function getValueAtPath(obj: any, path: string) {\n return path\n .split('.')\n .reduce(\n (acc, part) => (acc && acc[part] !== undefined ? acc[part] : undefined),\n obj\n );\n}\n\nasync function dispatchApiCall<T>(\n params: DispatchApiCallParams<T>\n): Promise<T> {\n const {\n defaultValueOnFail,\n options,\n path,\n query,\n queueName,\n transformer,\n type,\n } = params;\n\n try {\n const processApiCall = async () => {\n const { data, errors } = await fetchGraphQl<T>(query, {\n method: type === 'query' ? 'GET' : 'POST',\n cache: type === 'query' ? 'no-cache' : undefined,\n ...options,\n });\n\n if (errors) {\n const uncontrolledErrors = filterControlledErrors(errors);\n\n if (uncontrolledErrors.length > 0) {\n throw new FetchError(uncontrolledErrors as FetchQueryError);\n }\n }\n\n let result = getValueAtPath(data, path);\n\n if (result === undefined) {\n throw new Error(`No data found at path: ${path}`);\n }\n\n return transformer ? transformer(result) : result;\n };\n\n // Execute the API call, either directly or through the queue\n const result =\n type === 'mutation'\n ? await enqueueRequest<T>(processApiCall, queueName)\n : await processApiCall();\n\n return result;\n } catch (error: any) {\n if (defaultValueOnFail !== undefined) return defaultValueOnFail;\n throw error;\n }\n}\n\nexport { dispatchApiCall };\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\nexport const getStoreConfigQuery = /* GraphQL */ `\n query getStoreConfig {\n storeConfig {\n default_country\n is_checkout_agreements_enabled\n is_guest_checkout_enabled\n is_one_page_checkout_enabled\n shopping_cart_display_shipping\n }\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 { StoreConfig, TaxDisplay } from '@/checkout/data/models';\nimport { transformStoreConfig } from '@/checkout/data/transforms';\nimport { dispatchApiCall, state } from '@/checkout/lib';\nimport { getStoreConfigQuery } from './graphql/getStoreConfig.graphql';\n\nexport const DEFAULT_COUNTRY = 'US';\n\nexport const STORE_CONFIG_DEFAULTS: StoreConfig = {\n defaultCountry: DEFAULT_COUNTRY,\n agreementsEnabled: true,\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay.EXCLUDING_TAX,\n },\n};\n\nexport const getStoreConfig = async () => {\n return await dispatchApiCall({\n defaultValueOnFail: STORE_CONFIG_DEFAULTS,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'storeConfig',\n query: getStoreConfigQuery,\n transformer: transformStoreConfig,\n type: 'query',\n });\n};\n\nexport const getStoreConfigCache = () => state.config;\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 { GetStoreConfigQuery } from '@/checkout/__generated__/types';\nimport { STORE_CONFIG_DEFAULTS } from '@/checkout/api/getStoreConfig';\nimport { StoreConfig, TaxDisplay } from '@/checkout/data/models';\n\nexport function transformTaxDisplay(data: number | null | undefined) {\n switch (data) {\n case 1:\n return TaxDisplay.EXCLUDING_TAX;\n case 2:\n return TaxDisplay.INCLUDING_TAX;\n case 3:\n return TaxDisplay.INCLUDING_EXCLUDING_TAX;\n default:\n return TaxDisplay.EXCLUDING_TAX;\n }\n}\n\nexport function transformStoreConfig(\n data: GetStoreConfigQuery['storeConfig']\n): StoreConfig {\n if (!data) return STORE_CONFIG_DEFAULTS;\n\n const {\n default_country,\n is_checkout_agreements_enabled,\n shopping_cart_display_shipping,\n } = data;\n\n return {\n defaultCountry: default_country || STORE_CONFIG_DEFAULTS.defaultCountry,\n agreementsEnabled: is_checkout_agreements_enabled,\n shoppingCartDisplaySetting: {\n shipping: transformTaxDisplay(shopping_cart_display_shipping),\n },\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 { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n\nexport type {\n FetchOptions,\n FetchQueryError,\n} from '@adobe-commerce/fetch-graphql';\n"],"names":["_state","state","target","key","value","FetchError","reasons","e","InvalidInput","message","MissingArgument","argumentName","MissingCart","MissingCartAndQuote","Unauthenticated","MissingNegotiableQuoteId","MissingEmail","MissingPaymentMethod","MissingShippingAddress","MissingShippingMethod","MissingBillingAddress","MissingCountry","TaxDisplay","QueueName","queues","processing","pendingRequests","signal","onQueueCompleted","latestResult","events","processQueue","type","queue","latestSuccessResult","request","result","error","pendingSet","handler","enqueueRequest","requestFn","name","promise","resolve","reject","hasPendingUpdates","computed","hasPendingShippingEstimate","controlledErrorProps","filterControlledErrors","errors","controlledErrorProp","_a","getValueAtPath","obj","path","acc","part","dispatchApiCall","params","defaultValueOnFail","options","query","queueName","transformer","processApiCall","data","fetchGraphQl","uncontrolledErrors","getStoreConfigQuery","DEFAULT_COUNTRY","STORE_CONFIG_DEFAULTS","getStoreConfig","transformStoreConfig","getStoreConfigCache","transformTaxDisplay","default_country","is_checkout_agreements_enabled","shopping_cart_display_shipping","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL"],"mappings":"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"}
|
package/chunks/guards.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{s as u,q as a}from"./fetch-graphql.js";function p({code:t,...e}){return{code:t,...e}}function f({code:t,...e}){return{code:t,...e}}const d=t=>{if("carrier_code"in t&&"method_code"in t)return t;const e=t,{carrierCode:o,methodCode:r,...n}=e;return{carrier_code:o,method_code:r,...n}};function m(t){return t.map(d)}function i(t){var e;return{fax:t.fax,middlename:t.middleName,prefix:t.prefix,suffix:t.suffix,vat_id:t.vatId,city:t.city,custom_attributes:((e=t.customAttributes)==null?void 0:e.map(o=>({attribute_code:o.code,value:o.value})))||[],company:t.company,country_code:t.countryCode,firstname:t.firstName,lastname:t.lastName,postcode:t.postcode,region:t.region,region_id:t.regionId,save_in_address_book:t.saveInAddressBook,street:t.street,telephone:t.telephone}}function l(t){const{customerAddressId:e,pickupLocationCode:o,address:r}=t,n={};return e?{customer_address_id:e}:(o&&(n.pickup_location_code=o),!o&&r&&(n.address=i(r)),n)}function _(t){const{customerAddressUid:e,address:o}=t,r={};return e?{customer_address_uid:e}:(o&&(r.address=i(o)),r)}function I(t){const{customerAddressId:e,sameAsShipping:o=!1,useForShipping:r=!1,address:n}=t;let s={use_for_shipping:r,same_as_shipping:o};return!o&&e?(s.customer_address_id=e,s):(!o&&n&&(s.address=i(n)),s)}function h(t){const{customerAddressUid:e,sameAsShipping:o=!1,useForShipping:r=!1,address:n}=t;let s={use_for_shipping:r,same_as_shipping:o};return!o&&e?(s.customer_address_uid=e,s):(!o&&n&&(s.address=i(n)),s)}const g=()=>{const{cartId:t,quoteId:e}=u;if(!t&&!e)throw new a};export{p as a,f as b,l as c,_ as d,g as e,I as f,h as g,m as t};
|
|
4
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-api.ts","/@dropins/storefront-checkout/src/lib/guards.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 {\n AddressInput as AddressInputModel,\n BillingAddressInput as BillingAddressInputModel,\n PaymentMethodInput as PaymentMethodInputModel,\n ShippingAddressInput as ShippingAddressInputModel,\n ShippingMethodInput as ShippingMethodInputModel,\n} from '@/checkout/data/models/api';\n\nimport {\n BillingAddressInput,\n NegotiableQuoteBillingAddressInput,\n NegotiableQuotePaymentMethodInput,\n NegotiableQuoteShippingAddressInput,\n PaymentMethodInput,\n ShippingAddressInput,\n ShippingMethodInput,\n} from '@/checkout/__generated__/types';\n\nexport function transformPaymentMethodInputModelToCartInput({\n code,\n ...additionalData\n}: PaymentMethodInputModel): PaymentMethodInput {\n return {\n code,\n ...additionalData,\n };\n}\n\nexport function transformPaymentMethodInputModelToQuoteInput({\n code,\n ...additionalData\n}: PaymentMethodInputModel): NegotiableQuotePaymentMethodInput {\n return {\n code,\n ...additionalData,\n };\n}\n\nexport const transformShippingMethodInput = (\n input: ShippingMethodInputModel | ShippingMethodInput\n): ShippingMethodInput => {\n if ('carrier_code' in input && 'method_code' in input) {\n return input as ShippingMethodInput;\n }\n\n // Transform from model format to GraphQL format\n const modelInput = input as ShippingMethodInputModel;\n\n const { carrierCode, methodCode, ...additionalData } = modelInput;\n\n return {\n carrier_code: carrierCode,\n method_code: methodCode,\n ...additionalData,\n };\n};\n\nexport function transformShippingMethodsInputModel(\n input: Array<ShippingMethodInputModel | ShippingMethodInput>\n): Array<ShippingMethodInput> {\n return input.map(transformShippingMethodInput);\n}\n\nfunction transformAddressInputModel(address: AddressInputModel) {\n return {\n fax: address.fax,\n middlename: address.middleName,\n prefix: address.prefix,\n suffix: address.suffix,\n vat_id: address.vatId,\n city: address.city,\n custom_attributes:\n address.customAttributes?.map((attribute: any) => ({\n attribute_code: attribute.code,\n value: attribute.value,\n })) || [],\n company: address.company,\n country_code: address.countryCode,\n firstname: address.firstName,\n lastname: address.lastName,\n postcode: address.postcode,\n region: address.region,\n region_id: address.regionId,\n save_in_address_book: address.saveInAddressBook,\n street: address.street,\n telephone: address.telephone,\n };\n}\n\nexport function transformShippingAddressInputModelToCartInput(\n input: ShippingAddressInputModel\n): ShippingAddressInput {\n const { customerAddressId, pickupLocationCode, address } = input;\n\n const result: ShippingAddressInput = {};\n\n if (customerAddressId) {\n return { customer_address_id: customerAddressId };\n }\n\n if (pickupLocationCode) {\n result.pickup_location_code = pickupLocationCode;\n }\n\n if (!pickupLocationCode && address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n\nexport function transformShippingAddressInputModelToQuoteInput(\n input: ShippingAddressInputModel\n): NegotiableQuoteShippingAddressInput {\n const { customerAddressUid, address } = input;\n\n const result: NegotiableQuoteShippingAddressInput = {};\n\n if (customerAddressUid) {\n return { customer_address_uid: customerAddressUid };\n }\n\n if (address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n\nexport function transformBillingAddressInputModelToCartInput(\n input: BillingAddressInputModel\n): BillingAddressInput {\n const {\n customerAddressId,\n sameAsShipping = false,\n useForShipping = false,\n address,\n } = input;\n\n let result: BillingAddressInput = {\n use_for_shipping: useForShipping,\n same_as_shipping: sameAsShipping,\n };\n\n if (!sameAsShipping && customerAddressId) {\n result.customer_address_id = customerAddressId;\n return result;\n }\n\n if (!sameAsShipping && address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n\nexport function transformBillingAddressInputModelToQuoteInput(\n input: BillingAddressInputModel\n): NegotiableQuoteBillingAddressInput {\n const {\n customerAddressUid,\n sameAsShipping = false,\n useForShipping = false,\n address,\n } = input;\n\n let result: NegotiableQuoteBillingAddressInput = {\n use_for_shipping: useForShipping,\n same_as_shipping: sameAsShipping,\n };\n\n if (!sameAsShipping && customerAddressUid) {\n result.customer_address_uid = customerAddressUid;\n return result;\n }\n\n if (!sameAsShipping && address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { MissingCartAndQuote } from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\n\nexport const ensureHasCartOrQuoteId = () => {\n const { cartId, quoteId } = state;\n if (!cartId && !quoteId) throw new MissingCartAndQuote();\n};\n"],"names":["transformPaymentMethodInputModelToCartInput","code","additionalData","transformPaymentMethodInputModelToQuoteInput","transformShippingMethodInput","input","modelInput","carrierCode","methodCode","transformShippingMethodsInputModel","transformAddressInputModel","address","_a","attribute","transformShippingAddressInputModelToCartInput","customerAddressId","pickupLocationCode","result","transformShippingAddressInputModelToQuoteInput","customerAddressUid","transformBillingAddressInputModelToCartInput","sameAsShipping","useForShipping","transformBillingAddressInputModelToQuoteInput","ensureHasCartOrQuoteId","cartId","quoteId","state","MissingCartAndQuote"],"mappings":"8CAmCO,SAASA,EAA4C,CAC1D,KAAAC,EACA,GAAGC,CACL,EAAgD,CACvC,MAAA,CACL,KAAAD,EACA,GAAGC,CACL,CACF,CAEO,SAASC,EAA6C,CAC3D,KAAAF,EACA,GAAGC,CACL,EAA+D,CACtD,MAAA,CACL,KAAAD,EACA,GAAGC,CACL,CACF,CAEa,MAAAE,EACXC,GACwB,CACpB,GAAA,iBAAkBA,GAAS,gBAAiBA,EACvC,OAAAA,EAIT,MAAMC,EAAaD,EAEb,CAAE,YAAAE,EAAa,WAAAC,EAAY,GAAGN,CAAmB,EAAAI,EAEhD,MAAA,CACL,aAAcC,EACd,YAAaC,EACb,GAAGN,CACL,CACF,EAEO,SAASO,EACdJ,EAC4B,CACrB,OAAAA,EAAM,IAAID,CAA4B,CAC/C,CAEA,SAASM,EAA2BC,EAA4B,OACvD,MAAA,CACL,IAAKA,EAAQ,IACb,WAAYA,EAAQ,WACpB,OAAQA,EAAQ,OAChB,OAAQA,EAAQ,OAChB,OAAQA,EAAQ,MAChB,KAAMA,EAAQ,KACd,oBACEC,EAAAD,EAAQ,mBAAR,YAAAC,EAA0B,IAAKC,IAAoB,CACjD,eAAgBA,EAAU,KAC1B,MAAOA,EAAU,KACnB,MAAO,CAAC,EACV,QAASF,EAAQ,QACjB,aAAcA,EAAQ,YACtB,UAAWA,EAAQ,UACnB,SAAUA,EAAQ,SAClB,SAAUA,EAAQ,SAClB,OAAQA,EAAQ,OAChB,UAAWA,EAAQ,SACnB,qBAAsBA,EAAQ,kBAC9B,OAAQA,EAAQ,OAChB,UAAWA,EAAQ,SACrB,CACF,CAEO,SAASG,EACdT,EACsB,CACtB,KAAM,CAAE,kBAAAU,EAAmB,mBAAAC,EAAoB,QAAAL,CAAY,EAAAN,EAErDY,EAA+B,CAAC,EAEtC,OAAIF,EACK,CAAE,oBAAqBA,CAAkB,GAG9CC,IACFC,EAAO,qBAAuBD,GAG5B,CAACA,GAAsBL,IAClBM,EAAA,QAAUP,EAA2BC,CAAO,GAG9CM,EACT,CAEO,SAASC,EACdb,EACqC,CAC/B,KAAA,CAAE,mBAAAc,EAAoB,QAAAR,CAAA,EAAYN,EAElCY,EAA8C,CAAC,EAErD,OAAIE,EACK,CAAE,qBAAsBA,CAAmB,GAGhDR,IACKM,EAAA,QAAUP,EAA2BC,CAAO,GAG9CM,EACT,CAEO,SAASG,EACdf,EACqB,CACf,KAAA,CACJ,kBAAAU,EACA,eAAAM,EAAiB,GACjB,eAAAC,EAAiB,GACjB,QAAAX,CAAA,EACEN,EAEJ,IAAIY,EAA8B,CAChC,iBAAkBK,EAClB,iBAAkBD,CACpB,EAEI,MAAA,CAACA,GAAkBN,GACrBE,EAAO,oBAAsBF,EACtBE,IAGL,CAACI,GAAkBV,IACdM,EAAA,QAAUP,EAA2BC,CAAO,GAG9CM,EACT,CAEO,SAASM,EACdlB,EACoC,CAC9B,KAAA,CACJ,mBAAAc,EACA,eAAAE,EAAiB,GACjB,eAAAC,EAAiB,GACjB,QAAAX,CAAA,EACEN,EAEJ,IAAIY,EAA6C,CAC/C,iBAAkBK,EAClB,iBAAkBD,CACpB,EAEI,MAAA,CAACA,GAAkBF,GACrBF,EAAO,qBAAuBE,EACvBF,IAGL,CAACI,GAAkBV,IACdM,EAAA,QAAUP,EAA2BC,CAAO,GAG9CM,EACT,CClLO,MAAMO,EAAyB,IAAM,CACpC,KAAA,CAAE,OAAAC,EAAQ,QAAAC,CAAA,EAAYC,EAC5B,GAAI,CAACF,GAAU,CAACC,EAAS,MAAM,IAAIE,CACrC"}
|
|
@@ -1,14 +1,34 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as
|
|
4
|
-
mutation setBillingAddress(
|
|
5
|
-
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as A,NEGOTIABLE_QUOTE_FRAGMENT as I}from"../fragments.js";import{e as g,f as p,g as c}from"./guards.js";import{t as B,e as m}from"./synchronizeCheckout.js";import{s as r,d as f,Q as C,I as o,p as a}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const Q=`
|
|
4
|
+
mutation setBillingAddress(
|
|
5
|
+
$cartId: String!
|
|
6
|
+
$billingAddress: BillingAddressInput!
|
|
7
|
+
) {
|
|
8
|
+
setBillingAddressOnCart(
|
|
9
|
+
input: { cart_id: $cartId, billing_address: $billingAddress }
|
|
10
|
+
) {
|
|
6
11
|
cart {
|
|
7
12
|
...CHECKOUT_DATA_FRAGMENT
|
|
8
13
|
}
|
|
9
14
|
}
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
${
|
|
13
|
-
`,
|
|
17
|
+
${A}
|
|
18
|
+
`,T=`
|
|
19
|
+
mutation setBillingAddressOnQuote(
|
|
20
|
+
$quoteId: ID!
|
|
21
|
+
$billingAddress: NegotiableQuoteBillingAddressInput!
|
|
22
|
+
) {
|
|
23
|
+
setNegotiableQuoteBillingAddress(
|
|
24
|
+
input: { quote_uid: $quoteId, billing_address: $billingAddress }
|
|
25
|
+
) {
|
|
26
|
+
quote {
|
|
27
|
+
...NEGOTIABLE_QUOTE_FRAGMENT
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
${I}
|
|
33
|
+
`,n=(t,s,e,i,d,l)=>async u=>await f({type:"mutation",query:e,options:{variables:{[s]:t,billingAddress:d(u)}},path:l,queueName:C.Updates,transformer:i}),b=({address:t,customerAddressId:s,customerAddressUid:e,sameAsShipping:i=!1})=>{if(!s&&e)throw new o("customerAddressUid is not supported");if(!i&&!s&&!t)throw new a},E=({address:t,customerAddressId:s,customerAddressUid:e,sameAsShipping:i=!1})=>{if(!e&&s)throw new o("customerAddressId is not supported");if(!i&&!e&&!t)throw new a},N=t=>{const s=!!r.cartId,e=!!r.quoteId;s?b(t):e&&E(t)},G=async t=>(g(),N(t),await(!!r.cartId?n(r.cartId,"cartId",Q,B,p,"setBillingAddressOnCart.cart"):n(r.quoteId,"quoteId",T,m,c,"setNegotiableQuoteBillingAddress.quote"))(t));export{G as s};
|
|
14
34
|
//# sourceMappingURL=setBillingAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setBillingAddress.js","sources":["/@dropins/storefront-checkout/src/api/setBillingAddress/graphql/setBillingAddress.graphql.ts","/@dropins/storefront-checkout/src/api/setBillingAddress/setBillingAddress.ts"],"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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const
|
|
1
|
+
{"version":3,"file":"setBillingAddress.js","sources":["/@dropins/storefront-checkout/src/api/setBillingAddress/graphql/setBillingAddressOnCartMutation.graphql.ts","/@dropins/storefront-checkout/src/api/setBillingAddress/graphql/setBillingAddressOnQuoteMutation.graphql.ts","/@dropins/storefront-checkout/src/api/setBillingAddress/setBillingAddress.ts"],"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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setBillingAddressOnCartMutation = /* GraphQL */ `\n mutation setBillingAddress(\n $cartId: String!\n $billingAddress: BillingAddressInput!\n ) {\n setBillingAddressOnCart(\n input: { cart_id: $cartId, billing_address: $billingAddress }\n ) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const setBillingAddressOnQuoteMutation = /* GraphQL */ `\n mutation setBillingAddressOnQuote(\n $quoteId: ID!\n $billingAddress: NegotiableQuoteBillingAddressInput!\n ) {\n setNegotiableQuoteBillingAddress(\n input: { quote_uid: $quoteId, billing_address: $billingAddress }\n ) {\n quote {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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 {\n setBillingAddressOnCartMutation,\n setBillingAddressOnQuoteMutation,\n} from '@/checkout/api/setBillingAddress/graphql';\nimport { BillingAddressInput as BillingAddressInputModel } from '@/checkout/data/models';\nimport {\n transformBillingAddressInputModelToCartInput,\n transformBillingAddressInputModelToQuoteInput,\n transformCart,\n transformNegotiableQuote,\n} from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { InvalidInput, MissingBillingAddress } from '@/checkout/lib/errors';\nimport { ensureHasCartOrQuoteId } from '@/checkout/lib/guards';\nimport { state } from '@/checkout/lib/state';\n\nconst createBillingAddressSetter = <TTransformedInput, TTransformedOutput>(\n entityId: string,\n entityKey: string,\n mutation: string,\n transformer: (data: any) => TTransformedOutput,\n transformInput: (input: BillingAddressInputModel) => TTransformedInput,\n path: string\n) => {\n return async (\n input: BillingAddressInputModel\n ): Promise<TTransformedOutput> => {\n return await dispatchApiCall({\n type: 'mutation',\n query: mutation,\n options: {\n variables: {\n [entityKey]: entityId,\n billingAddress: transformInput(input),\n },\n },\n path,\n queueName: QueueName.Updates,\n transformer,\n });\n };\n};\n\nconst ensureIsValidCartInput = ({\n address,\n customerAddressId,\n customerAddressUid,\n sameAsShipping = false,\n}: BillingAddressInputModel) => {\n if (!customerAddressId && customerAddressUid) {\n throw new InvalidInput('customerAddressUid is not supported');\n }\n\n if (!sameAsShipping && !customerAddressId && !address) {\n throw new MissingBillingAddress();\n }\n};\n\nconst ensureIsValidQuoteInput = ({\n address,\n customerAddressId,\n customerAddressUid,\n sameAsShipping = false,\n}: BillingAddressInputModel) => {\n if (!customerAddressUid && customerAddressId) {\n throw new InvalidInput('customerAddressId is not supported');\n }\n\n if (!sameAsShipping && !customerAddressUid && !address) {\n throw new MissingBillingAddress();\n }\n};\n\nconst ensureIsValidInput = (input: BillingAddressInputModel) => {\n const isCart = Boolean(state.cartId);\n const isQuote = Boolean(state.quoteId);\n\n if (isCart) {\n ensureIsValidCartInput(input);\n } else if (isQuote) {\n ensureIsValidQuoteInput(input);\n }\n};\n\nexport const setBillingAddress = async (input: BillingAddressInputModel) => {\n ensureHasCartOrQuoteId();\n ensureIsValidInput(input);\n\n const isCart = Boolean(state.cartId);\n\n const setter = isCart\n ? createBillingAddressSetter(\n state.cartId!,\n 'cartId',\n setBillingAddressOnCartMutation,\n transformCart,\n transformBillingAddressInputModelToCartInput,\n 'setBillingAddressOnCart.cart'\n )\n : createBillingAddressSetter(\n state.quoteId!,\n 'quoteId',\n setBillingAddressOnQuoteMutation,\n transformNegotiableQuote,\n transformBillingAddressInputModelToQuoteInput,\n 'setNegotiableQuoteBillingAddress.quote'\n );\n\n return await setter(input);\n};\n"],"names":["setBillingAddressOnCartMutation","CHECKOUT_DATA_FRAGMENT","setBillingAddressOnQuoteMutation","NEGOTIABLE_QUOTE_FRAGMENT","createBillingAddressSetter","entityId","entityKey","mutation","transformer","transformInput","path","input","dispatchApiCall","QueueName","ensureIsValidCartInput","address","customerAddressId","customerAddressUid","sameAsShipping","InvalidInput","MissingBillingAddress","ensureIsValidQuoteInput","ensureIsValidInput","isCart","state","isQuote","setBillingAddress","ensureHasCartOrQuoteId","transformCart","transformBillingAddressInputModelToCartInput","transformNegotiableQuote","transformBillingAddressInputModelToQuoteInput"],"mappings":"+TAmBa,MAAAA,EAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAczDC,CAAsB;AAAA,ECdbC,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAc1DC,CAAyB;AAAA,ECCvBC,EAA6B,CACjCC,EACAC,EACAC,EACAC,EACAC,EACAC,IAEO,MACLC,GAEO,MAAMC,EAAgB,CAC3B,KAAM,WACN,MAAOL,EACP,QAAS,CACP,UAAW,CACT,CAACD,CAAS,EAAGD,EACb,eAAgBI,EAAeE,CAAK,CAAA,CAExC,EACA,KAAAD,EACA,UAAWG,EAAU,QACrB,YAAAL,CAAA,CACD,EAICM,EAAyB,CAAC,CAC9B,QAAAC,EACA,kBAAAC,EACA,mBAAAC,EACA,eAAAC,EAAiB,EACnB,IAAgC,CAC1B,GAAA,CAACF,GAAqBC,EAClB,MAAA,IAAIE,EAAa,qCAAqC,EAG9D,GAAI,CAACD,GAAkB,CAACF,GAAqB,CAACD,EAC5C,MAAM,IAAIK,CAEd,EAEMC,EAA0B,CAAC,CAC/B,QAAAN,EACA,kBAAAC,EACA,mBAAAC,EACA,eAAAC,EAAiB,EACnB,IAAgC,CAC1B,GAAA,CAACD,GAAsBD,EACnB,MAAA,IAAIG,EAAa,oCAAoC,EAG7D,GAAI,CAACD,GAAkB,CAACD,GAAsB,CAACF,EAC7C,MAAM,IAAIK,CAEd,EAEME,EAAsBX,GAAoC,CACxD,MAAAY,EAAS,EAAQC,EAAM,OACvBC,EAAU,EAAQD,EAAM,QAE1BD,EACFT,EAAuBH,CAAK,EACnBc,GACTJ,EAAwBV,CAAK,CAEjC,EAEae,EAAoB,MAAOf,IACfgB,EAAA,EACvBL,EAAmBX,CAAK,EAsBjB,MApBQ,EAAQa,EAAM,OAGzBpB,EACEoB,EAAM,OACN,SACAxB,EACA4B,EACAC,EACA,8BAAA,EAEFzB,EACEoB,EAAM,QACN,UACAtB,EACA4B,EACAC,EACA,wCACF,GAEgBpB,CAAK"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m,d as r,
|
|
3
|
+
import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m,d as r,l,m as u,Q as c}from"./fetch-graphql.js";import{merge as E}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{c as f,t as p}from"./synchronizeCheckout.js";const C=t=>{var i,a,s;if(!t)return null;const e={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(e,(s=(a=(i=f.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:a.transformer)==null?void 0:s.call(a,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
|
|
4
4
|
query getCustomer {
|
|
5
5
|
customer {
|
|
6
6
|
...CUSTOMER_FRAGMENT
|
|
@@ -8,7 +8,7 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
${o}
|
|
11
|
-
`,
|
|
11
|
+
`,M=async()=>m.authenticated?await r({options:{method:"GET",cache:"no-cache"},path:"customer",query:A,transformer:C,type:"query"}):null,g=`
|
|
12
12
|
query isEmailAvailable($email: String!) {
|
|
13
13
|
isEmailAvailable(email: $email) {
|
|
14
14
|
is_email_available
|
|
@@ -24,5 +24,5 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
${n}
|
|
27
|
-
`,N=async t=>{const
|
|
27
|
+
`,N=async t=>{const e=m.cartId;if(!e)throw new u;return await r({options:{variables:{cartId:e,email:t}},path:"setGuestEmailOnCart.cart",query:h,queueName:c.Updates,transformer:p,type:"mutation"})};export{M as g,q as i,N as s};
|
|
28
28
|
//# sourceMappingURL=setGuestEmailOnCart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setGuestEmailOnCart.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-customer.ts","/@dropins/storefront-checkout/src/data/transforms/transform-email-availability.ts","/@dropins/storefront-checkout/src/api/getCustomer/graphql/getCustomer.graphql.ts","/@dropins/storefront-checkout/src/api/getCustomer/getCustomer.ts","/@dropins/storefront-checkout/src/api/isEmailAvailable/graphql/isEmailAvailable.graphql.ts","/@dropins/storefront-checkout/src/api/isEmailAvailable/isEmailAvailable.ts","/@dropins/storefront-checkout/src/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql.ts","/@dropins/storefront-checkout/src/api/setGuestEmailOnCart/setGuestEmailOnCart.ts"],"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 { config } from '@/checkout/api';\nimport { Customer as CustomerModel } from '@/checkout/data/models';\nimport { GetCustomerQuery } from '@/checkout/__generated__/types';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\ntype Customer = GetCustomerQuery['customer'];\n\nconst transformCustomer = (data: Customer): CustomerModel | null => {\n if (!data) return null;\n\n const model = {\n firstName: data.firstname || '',\n lastName: data.lastname || '',\n email: data.email || '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(data) // custom transformer\n );\n};\n\nexport { Customer, transformCustomer };\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 { IsEmailAvailableQuery } from '@/checkout/__generated__/types';\nimport { EmailAvailability } from '@/checkout/data/models';\n\nconst transformEmailAvailability = (\n data: IsEmailAvailableQuery['isEmailAvailable']\n): EmailAvailability => {\n return Boolean(data?.is_email_available);\n};\n\nexport { transformEmailAvailability };\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 { CUSTOMER_FRAGMENT } from '@/checkout/api/graphql/CustomerFragment.graphql';\n\nexport const getCustomerQuery = /* GraphQL */ `\n query getCustomer {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\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 { getCustomerQuery } from '@/checkout/api/getCustomer/graphql/getCustomer.graphql';\nimport { Customer } from '@/checkout/data/models';\nimport { transformCustomer } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { state } from '@/checkout/lib/state';\n\nexport const getCustomer = async (): Promise<Customer | null> => {\n if (!state.authenticated) return null;\n\n return await dispatchApiCall({\n options: { method: 'GET', cache: 'no-cache' },\n path: 'customer',\n query: getCustomerQuery,\n transformer: transformCustomer,\n type: 'query',\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\nexport const isEmailAvailableQuery = /* GraphQL */ `\n query isEmailAvailable($email: String!) {\n isEmailAvailable(email: $email) {\n is_email_available\n }\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 { isEmailAvailableQuery } from '@/checkout/api/isEmailAvailable/graphql/isEmailAvailable.graphql';\nimport { EmailAvailability } from '@/checkout/data/models/email-availability';\nimport { transformEmailAvailability } from '@/checkout/data/transforms';\nimport { MissingEmail } from '@/checkout/errors';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\n\nexport const isEmailAvailable = async (\n email: string\n): Promise<EmailAvailability> => {\n if (!email) throw new MissingEmail();\n\n return await dispatchApiCall({\n options: { method: 'GET', cache: 'no-cache', variables: { email } },\n path: 'isEmailAvailable',\n query: isEmailAvailableQuery,\n transformer: transformEmailAvailability,\n type: 'query',\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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setGuestEmailMutation = /* GraphQL */ `\n mutation setGuestEmail($cartId: String!, $email: String!) {\n setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\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 { setGuestEmailMutation } from '@/checkout/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { MissingCart } from '@/checkout/errors';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { state } from '@/checkout/lib/state';\n\nexport const setGuestEmailOnCart = async (email: string) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n return await dispatchApiCall({\n options: { variables: { cartId, email } },\n path: 'setGuestEmailOnCart.cart',\n query: setGuestEmailMutation,\n queueName: QueueName.CartUpdate,\n transformer: transformCart,\n type: 'mutation',\n });\n};\n"],"names":["transformCustomer","data","model","merge","_c","_b","_a","config","transformEmailAvailability","getCustomerQuery","CUSTOMER_FRAGMENT","getCustomer","state","dispatchApiCall","isEmailAvailableQuery","isEmailAvailable","email","MissingEmail","setGuestEmailMutation","CHECKOUT_DATA_FRAGMENT","setGuestEmailOnCart","cartId","MissingCart","QueueName","transformCart"],"mappings":"kRAwBA,MAAMA,EAAqBC,GAAyC,WAC9D,GAAA,CAACA,EAAa,OAAA,KAElB,MAAMC,EAAQ,CACZ,UAAWD,EAAK,WAAa,GAC7B,SAAUA,EAAK,UAAY,GAC3B,MAAOA,EAAK,OAAS,EACvB,EAGO,OAAAE,EACLD,GACAE,GAAAC,GAAAC,EAAAC,EAAO,UAAU,EAAE,SAAnB,YAAAD,EAA2B,gBAA3B,YAAAD,EAA0C,cAA1C,YAAAD,EAAA,KAAAC,EAAwDJ,EAC1D,CACF,EClBMO,EACJP,GAEO,GAAQA,GAAA,MAAAA,EAAM,oBCJVQ,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO1CC,CAAiB;AAAA,ECHRC,EAAc,SACpBC,EAAM,cAEJ,MAAMC,EAAgB,CAC3B,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,WACN,MAAOJ,EACP,YAAaT,EACb,KAAM,OAAA,CACP,EARgC,KCPtBc,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMtCC,EAAmB,MAC9BC,GAC+B,CAC/B,GAAI,CAACA,EAAa,MAAA,IAAIC,EAEtB,OAAO,MAAMJ,EAAgB,CAC3B,QAAS,CAAE,OAAQ,MAAO,MAAO,WAAY,UAAW,CAAE,MAAAG,EAAQ,EAClE,KAAM,mBACN,MAAOF,EACP,YAAaN,EACb,KAAM,OAAA,CACP,CACH,EChBaU,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAS/CC,CAAsB;AAAA,ECJbC,EAAsB,MAAOJ,GAAkB,CAC1D,MAAMK,EAAST,EAAM,OAErB,GAAI,CAACS,EAAc,MAAA,IAAIC,EAEvB,OAAO,MAAMT,EAAgB,CAC3B,QAAS,CAAE,UAAW,CAAE,OAAAQ,EAAQ,MAAAL,EAAQ,EACxC,KAAM,2BACN,MAAOE,EACP,UAAWK,EAAU,WACrB,YAAaC,EACb,KAAM,UAAA,CACP,CACH"}
|
|
1
|
+
{"version":3,"file":"setGuestEmailOnCart.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-customer.ts","/@dropins/storefront-checkout/src/data/transforms/transform-email-availability.ts","/@dropins/storefront-checkout/src/api/getCustomer/graphql/getCustomer.graphql.ts","/@dropins/storefront-checkout/src/api/getCustomer/getCustomer.ts","/@dropins/storefront-checkout/src/api/isEmailAvailable/graphql/isEmailAvailable.graphql.ts","/@dropins/storefront-checkout/src/api/isEmailAvailable/isEmailAvailable.ts","/@dropins/storefront-checkout/src/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql.ts","/@dropins/storefront-checkout/src/api/setGuestEmailOnCart/setGuestEmailOnCart.ts"],"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 { config } from '@/checkout/api';\nimport { Customer as CustomerModel } from '@/checkout/data/models';\nimport { GetCustomerQuery } from '@/checkout/__generated__/types';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\ntype Customer = GetCustomerQuery['customer'];\n\nconst transformCustomer = (data: Customer): CustomerModel | null => {\n if (!data) return null;\n\n const model = {\n firstName: data.firstname || '',\n lastName: data.lastname || '',\n email: data.email || '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(data) // custom transformer\n );\n};\n\nexport { Customer, transformCustomer };\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 { IsEmailAvailableQuery } from '@/checkout/__generated__/types';\nimport { EmailAvailability } from '@/checkout/data/models';\n\nconst transformEmailAvailability = (\n data: IsEmailAvailableQuery['isEmailAvailable']\n): EmailAvailability => {\n return Boolean(data?.is_email_available);\n};\n\nexport { transformEmailAvailability };\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 { CUSTOMER_FRAGMENT } from '@/checkout/api/graphql/CustomerFragment.graphql';\n\nexport const getCustomerQuery = /* GraphQL */ `\n query getCustomer {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\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 { getCustomerQuery } from '@/checkout/api/getCustomer/graphql/getCustomer.graphql';\nimport { Customer } from '@/checkout/data/models';\nimport { transformCustomer } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { state } from '@/checkout/lib/state';\n\nexport const getCustomer = async (): Promise<Customer | null> => {\n if (!state.authenticated) return null;\n\n return await dispatchApiCall({\n options: { method: 'GET', cache: 'no-cache' },\n path: 'customer',\n query: getCustomerQuery,\n transformer: transformCustomer,\n type: 'query',\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\nexport const isEmailAvailableQuery = /* GraphQL */ `\n query isEmailAvailable($email: String!) {\n isEmailAvailable(email: $email) {\n is_email_available\n }\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 { isEmailAvailableQuery } from '@/checkout/api/isEmailAvailable/graphql/isEmailAvailable.graphql';\nimport { EmailAvailability } from '@/checkout/data/models/email-availability';\nimport { transformEmailAvailability } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { MissingEmail } from '@/checkout/lib/errors';\n\nexport const isEmailAvailable = async (\n email: string\n): Promise<EmailAvailability> => {\n if (!email) throw new MissingEmail();\n\n return await dispatchApiCall({\n options: { method: 'GET', cache: 'no-cache', variables: { email } },\n path: 'isEmailAvailable',\n query: isEmailAvailableQuery,\n transformer: transformEmailAvailability,\n type: 'query',\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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setGuestEmailMutation = /* GraphQL */ `\n mutation setGuestEmail($cartId: String!, $email: String!) {\n setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\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 { setGuestEmailMutation } from '@/checkout/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { MissingCart } from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\n\nexport const setGuestEmailOnCart = async (email: string) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n return await dispatchApiCall({\n options: { variables: { cartId, email } },\n path: 'setGuestEmailOnCart.cart',\n query: setGuestEmailMutation,\n queueName: QueueName.Updates,\n transformer: transformCart,\n type: 'mutation',\n });\n};\n"],"names":["transformCustomer","data","model","merge","_c","_b","_a","config","transformEmailAvailability","getCustomerQuery","CUSTOMER_FRAGMENT","getCustomer","state","dispatchApiCall","isEmailAvailableQuery","isEmailAvailable","email","MissingEmail","setGuestEmailMutation","CHECKOUT_DATA_FRAGMENT","setGuestEmailOnCart","cartId","MissingCart","QueueName","transformCart"],"mappings":"oRAwBA,MAAMA,EAAqBC,GAAyC,WAC9D,GAAA,CAACA,EAAa,OAAA,KAElB,MAAMC,EAAQ,CACZ,UAAWD,EAAK,WAAa,GAC7B,SAAUA,EAAK,UAAY,GAC3B,MAAOA,EAAK,OAAS,EACvB,EAGO,OAAAE,EACLD,GACAE,GAAAC,GAAAC,EAAAC,EAAO,UAAU,EAAE,SAAnB,YAAAD,EAA2B,gBAA3B,YAAAD,EAA0C,cAA1C,YAAAD,EAAA,KAAAC,EAAwDJ,EAC1D,CACF,EClBMO,EACJP,GAEO,GAAQA,GAAA,MAAAA,EAAM,oBCJVQ,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO1CC,CAAiB;AAAA,ECHRC,EAAc,SACpBC,EAAM,cAEJ,MAAMC,EAAgB,CAC3B,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,WACN,MAAOJ,EACP,YAAaT,EACb,KAAM,OAAA,CACP,EARgC,KCPtBc,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMtCC,EAAmB,MAC9BC,GAC+B,CAC/B,GAAI,CAACA,EAAa,MAAA,IAAIC,EAEtB,OAAO,MAAMJ,EAAgB,CAC3B,QAAS,CAAE,OAAQ,MAAO,MAAO,WAAY,UAAW,CAAE,MAAAG,EAAQ,EAClE,KAAM,mBACN,MAAOF,EACP,YAAaN,EACb,KAAM,OAAA,CACP,CACH,EChBaU,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAS/CC,CAAsB;AAAA,ECJbC,EAAsB,MAAOJ,GAAkB,CAC1D,MAAMK,EAAST,EAAM,OAErB,GAAI,CAACS,EAAc,MAAA,IAAIC,EAEvB,OAAO,MAAMT,EAAgB,CAC3B,QAAS,CAAE,UAAW,CAAE,OAAAQ,EAAQ,MAAAL,EAAQ,EACxC,KAAM,2BACN,MAAOE,EACP,UAAWK,EAAU,QACrB,YAAaC,EACb,KAAM,UAAA,CACP,CACH"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as
|
|
4
|
-
mutation
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as d,NEGOTIABLE_QUOTE_FRAGMENT as i}from"../fragments.js";import{e as p,a as M,b as y}from"./guards.js";import{t as c,e as h}from"./synchronizeCheckout.js";import{s as e,k as I,d as P,Q as C}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const T=`
|
|
4
|
+
mutation setPaymentMethodOnCart(
|
|
5
5
|
$cartId: String!
|
|
6
|
-
$
|
|
6
|
+
$input: PaymentMethodInput!
|
|
7
7
|
) {
|
|
8
8
|
setPaymentMethodOnCart(
|
|
9
|
-
input: { cart_id: $cartId, payment_method: $
|
|
9
|
+
input: { cart_id: $cartId, payment_method: $input }
|
|
10
10
|
) {
|
|
11
11
|
cart {
|
|
12
12
|
...CHECKOUT_DATA_FRAGMENT
|
|
@@ -14,6 +14,21 @@ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./sy
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
${
|
|
18
|
-
`,
|
|
17
|
+
${d}
|
|
18
|
+
`,O=`
|
|
19
|
+
mutation setPaymentMethodOnQuote(
|
|
20
|
+
$quoteId: ID!
|
|
21
|
+
$input: NegotiableQuotePaymentMethodInput!
|
|
22
|
+
) {
|
|
23
|
+
setNegotiableQuotePaymentMethod(
|
|
24
|
+
input: { quote_uid: $quoteId, payment_method: $input }
|
|
25
|
+
) {
|
|
26
|
+
quote {
|
|
27
|
+
...NEGOTIABLE_QUOTE_FRAGMENT
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
${i}
|
|
33
|
+
`,n=(t,a,o,r,s,u)=>async m=>await P({type:"mutation",query:o,options:{variables:{[a]:t,input:s(m)}},path:u,queueName:C.Updates,transformer:r}),E=t=>{if(!t.code)throw new I},f=async t=>(p(),E(t),await(!!e.cartId?n(e.cartId,"cartId",T,c,M,"setPaymentMethodOnCart.cart"):n(e.quoteId,"quoteId",O,h,y,"setNegotiableQuotePaymentMethod.quote"))(t));export{f as s};
|
|
19
34
|
//# sourceMappingURL=setPaymentMethod.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setPaymentMethod.js","sources":["/@dropins/storefront-checkout/src/api/setPaymentMethod/graphql/setPaymentMethod.graphql.ts","/@dropins/storefront-checkout/src/api/setPaymentMethod/setPaymentMethod.ts"],"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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const
|
|
1
|
+
{"version":3,"file":"setPaymentMethod.js","sources":["/@dropins/storefront-checkout/src/api/setPaymentMethod/graphql/setPaymentMethodOnCart.graphql.ts","/@dropins/storefront-checkout/src/api/setPaymentMethod/graphql/setPaymentMethodOnQuote.graphql.ts","/@dropins/storefront-checkout/src/api/setPaymentMethod/setPaymentMethod.ts"],"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 { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setPaymentMethodOnCartMutation = /* GraphQL */ `\n mutation setPaymentMethodOnCart(\n $cartId: String!\n $input: PaymentMethodInput!\n ) {\n setPaymentMethodOnCart(\n input: { cart_id: $cartId, payment_method: $input }\n ) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const setPaymentMethodOnQuoteMutation = /* GraphQL */ `\n mutation setPaymentMethodOnQuote(\n $quoteId: ID!\n $input: NegotiableQuotePaymentMethodInput!\n ) {\n setNegotiableQuotePaymentMethod(\n input: { quote_uid: $quoteId, payment_method: $input }\n ) {\n quote {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n }\n\n ${NEGOTIABLE_QUOTE_FRAGMENT}\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 {\n setPaymentMethodOnCartMutation,\n setPaymentMethodOnQuoteMutation,\n} from '@/checkout/api/setPaymentMethod/graphql';\nimport { PaymentMethodInput as PaymentMethodInputModel } from '@/checkout/data/models';\nimport {\n transformCart,\n transformNegotiableQuote,\n transformPaymentMethodInputModelToCartInput,\n transformPaymentMethodInputModelToQuoteInput,\n} from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { MissingPaymentMethod } from '@/checkout/lib/errors/customErrors';\nimport { ensureHasCartOrQuoteId } from '@/checkout/lib/guards';\nimport { state } from '@/checkout/lib/state';\n\nconst createPaymentMethodSetter = <TTransformedInput, TTransformedOutput>(\n entityId: string,\n entityKey: string,\n mutation: string,\n transformer: (data: any) => TTransformedOutput,\n transformInput: (input: PaymentMethodInputModel) => TTransformedInput,\n path: string\n) => {\n return async (\n input: PaymentMethodInputModel\n ): Promise<TTransformedOutput> => {\n return await dispatchApiCall({\n type: 'mutation',\n query: mutation,\n options: {\n variables: {\n [entityKey]: entityId,\n input: transformInput(input),\n },\n },\n path,\n queueName: QueueName.Updates,\n transformer,\n });\n };\n};\n\nconst ensureHasPaymentMethodCode = (input: PaymentMethodInputModel) => {\n if (!input.code) {\n throw new MissingPaymentMethod();\n }\n};\n\nexport const setPaymentMethod = async (input: PaymentMethodInputModel) => {\n ensureHasCartOrQuoteId();\n ensureHasPaymentMethodCode(input);\n\n const isCart = Boolean(state.cartId);\n\n const setter = isCart\n ? createPaymentMethodSetter(\n state.cartId!,\n 'cartId',\n setPaymentMethodOnCartMutation,\n transformCart,\n transformPaymentMethodInputModelToCartInput,\n 'setPaymentMethodOnCart.cart'\n )\n : createPaymentMethodSetter(\n state.quoteId!,\n 'quoteId',\n setPaymentMethodOnQuoteMutation,\n transformNegotiableQuote,\n transformPaymentMethodInputModelToQuoteInput,\n 'setNegotiableQuotePaymentMethod.quote'\n );\n\n return await setter(input);\n};\n"],"names":["setPaymentMethodOnCartMutation","CHECKOUT_DATA_FRAGMENT","setPaymentMethodOnQuoteMutation","NEGOTIABLE_QUOTE_FRAGMENT","createPaymentMethodSetter","entityId","entityKey","mutation","transformer","transformInput","path","input","dispatchApiCall","QueueName","ensureHasPaymentMethodCode","MissingPaymentMethod","setPaymentMethod","ensureHasCartOrQuoteId","state","transformCart","transformPaymentMethodInputModelToCartInput","transformNegotiableQuote","transformPaymentMethodInputModelToQuoteInput"],"mappings":"wTAmBa,MAAAA,EAA+C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcxDC,CAAsB;AAAA,ECdbC,EAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAczDC,CAAyB;AAAA,ECCvBC,EAA4B,CAChCC,EACAC,EACAC,EACAC,EACAC,EACAC,IAEO,MACLC,GAEO,MAAMC,EAAgB,CAC3B,KAAM,WACN,MAAOL,EACP,QAAS,CACP,UAAW,CACT,CAACD,CAAS,EAAGD,EACb,MAAOI,EAAeE,CAAK,CAAA,CAE/B,EACA,KAAAD,EACA,UAAWG,EAAU,QACrB,YAAAL,CAAA,CACD,EAICM,EAA8BH,GAAmC,CACjE,GAAA,CAACA,EAAM,KACT,MAAM,IAAII,CAEd,EAEaC,EAAmB,MAAOL,IACdM,EAAA,EACvBH,EAA2BH,CAAK,EAsBzB,MApBQ,EAAQO,EAAM,OAGzBd,EACEc,EAAM,OACN,SACAlB,EACAmB,EACAC,EACA,6BAAA,EAEFhB,EACEc,EAAM,QACN,UACAhB,EACAmB,EACAC,EACA,uCACF,GAEgBX,CAAK"}
|