@dropins/storefront-checkout 2.0.1 → 2.1.0-beta2
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/{lib/network-error.d.ts → api/getNegotiableQuote/getNegotiableQuote.d.ts} +7 -7
- package/{signals/ServerErrorSignal.d.ts → api/getNegotiableQuote/graphql/getNegotiableQuote.graphql.d.ts} +3 -3
- package/{errors → api/getNegotiableQuote/graphql}/index.d.ts +2 -2
- package/{signals → api/getNegotiableQuote}/index.d.ts +2 -2
- package/api/graphql/CartAddressFragment.graphql.d.ts +1 -1
- 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 +5 -1
- package/api/setNegotiableQuoteBillingAddress/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuoteBillingAddress/graphql/setNegotiableQuoteBillingAddress.graphql.d.ts +18 -0
- package/api/setNegotiableQuoteBillingAddress/index.d.ts +18 -0
- package/api/setNegotiableQuoteBillingAddress/setNegotiableQuoteBillingAddress.d.ts +6 -0
- package/api/setNegotiableQuotePaymentMethod/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuotePaymentMethod/graphql/setNegotiableQuotePaymentMethod.graphql.d.ts +18 -0
- package/api/setNegotiableQuotePaymentMethod/index.d.ts +18 -0
- package/api/setNegotiableQuotePaymentMethod/setNegotiableQuotePaymentMethod.d.ts +6 -0
- package/api/setNegotiableQuoteShippingAddress/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingAddress/graphql/setNegotiableQuoteShippingAddress.graphql.d.ts +18 -0
- package/api/setNegotiableQuoteShippingAddress/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingAddress/setNegotiableQuoteShippingAddress.d.ts +6 -0
- package/api/setNegotiableQuoteShippingMethods/graphql/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingMethods/graphql/setNegotiableQuoteShippingMethods.graphql.d.ts +18 -0
- package/api/setNegotiableQuoteShippingMethods/index.d.ts +18 -0
- package/api/setNegotiableQuoteShippingMethods/setNegotiableQuoteShippingMethods.d.ts +18 -0
- package/api.js +78 -7
- package/api.js.map +1 -1
- package/chunks/checkout.js.map +1 -1
- package/chunks/fetch-graphql.js +14 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/setBillingAddress.js +2 -2
- package/chunks/setBillingAddress.js.map +1 -1
- package/chunks/setGuestEmailOnCart.js +4 -4
- package/chunks/setGuestEmailOnCart.js.map +1 -1
- package/chunks/setPaymentMethod.js +2 -2
- package/chunks/setPaymentMethod.js.map +1 -1
- package/chunks/setShippingMethods.js +3 -3
- package/chunks/setShippingMethods.js.map +1 -1
- package/chunks/synchronizeCheckout.js +3 -3
- package/chunks/synchronizeCheckout.js.map +1 -1
- 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.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.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.js +1 -1
- package/containers/ShippingMethods.js.map +1 -1
- package/containers/TermsAndConditions.js +1 -1
- package/containers/TermsAndConditions.js.map +1 -1
- package/data/models/address.d.ts +5 -8
- package/data/models/api.d.ts +3 -3
- package/data/models/cart.d.ts +14 -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 +15 -0
- package/data/models/shipping-estimate.d.ts +4 -4
- package/data/models/shipping-method.d.ts +4 -4
- package/data/transforms/index.d.ts +6 -1
- package/data/transforms/{transform-address.d.ts → transform-cart-address.d.ts} +12 -13
- package/data/transforms/transform-cart.d.ts +1 -1
- package/data/transforms/transform-country.d.ts +8 -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 +75 -0
- package/data/transforms/transform-region.d.ts +8 -0
- package/fragments.js +126 -43
- package/fragments.js.map +1 -1
- package/lib/enqueueRequest.d.ts +1 -0
- package/lib/errors/classifiers.d.ts +36 -0
- package/lib/errors/customErrors.d.ts +39 -0
- package/lib/errors/index.d.ts +20 -0
- package/lib/errors/mapErrorToCode.d.ts +4 -0
- package/lib/index.d.ts +1 -1
- package/lib/state.d.ts +1 -0
- package/package.json +1 -1
- package/render.js +1 -1
- package/render.js.map +1 -1
- package/tests/constants.d.ts +1 -0
- package/tests/fixtures/fragments/cart.d.ts +1 -2
- 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/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":"88BAiBa,MAAAA,EAAgD;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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAsBnED,CAAsB;AAAA,ECfbE,EAAqB,MAAO,CACvC,QAAAxB,EACA,kBAAAyB,EACA,mBAAAC,CACF,IAAiC,CAC/B,MAAMrC,EAASC,EAAM,OAErB,GAAI,CAACD,EAAc,MAAA,IAAIK,EAEvB,MAAMiC,EAAuB,IAA4B,CACvD,GAAIF,EACK,MAAA,CAAE,oBAAqBA,CAAkB,EAElD,GAAIC,EACK,MAAA,CAAE,qBAAsBA,CAAmB,EAEpD,GAAI,CAAC1B,EACH,MAAM,IAAI4B,EAEZ,MAAO,CAAE,QAASC,EAAiC7B,CAAO,CAAE,CAC9D,EAEM8B,EAAmBjB,EAAS,kBAAkB,EAE9CkB,EAAQD,EACVP,EACAF,EAEEW,EAAOF,EACT,+BACA,kCAEEG,EAAY,CAChB,OAAA5C,EACA,qBAAsBsC,EAAqB,CAC7C,EAEA,OAAO,MAAMrB,EAAgB,CAC3B,KAAM,WACN,MAAAyB,EACA,QAAS,CAAE,UAAAE,CAAU,EACrB,KAAAD,EACA,UAAWzB,EAAU,WACrB,YAAa2B,CAAA,CACd,CACH"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-checkout/src/api/estimateShippingMethods/graphql/estimateShippingMethods.graphql.ts","/@dropins/storefront-checkout/src/data/transforms/transform-quote-address.ts","/@dropins/storefront-checkout/src/data/transforms/transform-checkout-agreements.ts","/@dropins/storefront-checkout/src/data/transforms/transform-negotiable-quote.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/getNegotiableQuote/graphql/getNegotiableQuote.graphql.ts","/@dropins/storefront-checkout/src/api/getNegotiableQuote/getNegotiableQuote.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuoteBillingAddress/graphql/setNegotiableQuoteBillingAddress.graphql.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuoteBillingAddress/setNegotiableQuoteBillingAddress.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuotePaymentMethod/graphql/setNegotiableQuotePaymentMethod.graphql.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuotePaymentMethod/setNegotiableQuotePaymentMethod.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuoteShippingAddress/graphql/setNegotiableQuoteShippingAddress.graphql.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuoteShippingAddress/setNegotiableQuoteShippingAddress.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuoteShippingMethods/graphql/setNegotiableQuoteShippingMethods.graphql.ts","/@dropins/storefront-checkout/src/api/setNegotiableQuoteShippingMethods/setNegotiableQuoteShippingMethods.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 Address as AddressModel,\n ShippingAddress as ShippingAddressModel,\n} from '@/checkout/data/models';\n\nimport {\n transformAddressCountry,\n transformAddressRegion,\n transformSelectedShippingMethod,\n transformShippingMethods,\n} from '@/checkout/data/transforms';\nimport { GetNegotiableQuoteQuery } from '@/checkout/__generated__/types';\n\ntype QuoteShippingAddresses = NonNullable<\n GetNegotiableQuoteQuery['negotiableQuote']\n>['shipping_addresses'];\ntype QuoteShippingAddress = QuoteShippingAddresses[0];\ntype NonNullableShippingAddress = NonNullable<QuoteShippingAddress>;\n\ntype QuoteBillingAddress = NonNullable<\n GetNegotiableQuoteQuery['negotiableQuote']\n>['billing_address'];\ntype NonNullableBillingAddress = NonNullable<QuoteBillingAddress>;\n\nconst transformAddress = (\n data: NonNullableShippingAddress | NonNullableBillingAddress\n): AddressModel => {\n const street = data.street.filter(Boolean) as string[];\n\n return {\n city: data.city,\n company: data.company || undefined,\n country: transformAddressCountry(data.country),\n firstName: data.firstname,\n lastName: data.lastname,\n postCode: data.postcode || undefined,\n region: transformAddressRegion(data.region),\n street,\n telephone: data.telephone || undefined,\n };\n};\n\nconst transformQuoteBillingAddress = (\n data: QuoteBillingAddress\n): AddressModel | undefined => {\n if (!data) return;\n return transformAddress(data);\n};\n\nconst transformQuoteShippingAddress = (\n data: QuoteShippingAddresses\n): ShippingAddressModel[] => {\n return data\n .filter((address) => !!address)\n .map((address) => {\n const {\n available_shipping_methods,\n selected_shipping_method,\n ...baseData\n } = address as NonNullableShippingAddress;\n\n return {\n ...transformAddress(baseData as NonNullableShippingAddress),\n availableShippingMethods: transformShippingMethods(\n available_shipping_methods\n ),\n selectedShippingMethod: transformSelectedShippingMethod(\n selected_shipping_method\n ),\n };\n });\n};\n\nexport {\n QuoteBillingAddress,\n QuoteShippingAddress,\n transformQuoteBillingAddress,\n transformQuoteShippingAddress,\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 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 { NegotiableQuote as NegotiableQuoteModel } from '@/checkout/data/models/';\nimport { GetNegotiableQuoteQuery } from '@/checkout/__generated__/types';\n\nimport {\n transformAvailablePaymentMethods,\n transformQuoteBillingAddress,\n transformQuoteShippingAddress,\n transformSelectedPaymentMethod,\n} from '@/checkout/data/transforms';\n\ntype NegotiableQuote = GetNegotiableQuoteQuery['negotiableQuote'];\n\nexport const transformNegotiableQuote = (\n data: NegotiableQuote | undefined\n): NegotiableQuoteModel | null => {\n if (!data) return null;\n\n return {\n availablePaymentMethods: transformAvailablePaymentMethods(\n data.available_payment_methods\n ),\n billingAddress: transformQuoteBillingAddress(data.billing_address),\n email: data.email ?? '',\n isVirtual: data.is_virtual,\n name: data.name,\n selectedPaymentMethod: transformSelectedPaymentMethod(\n data.selected_payment_method\n ),\n shippingAddresses: transformQuoteShippingAddress(data.shipping_addresses),\n status: data.status,\n uid: data.uid,\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/lib/errors';\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 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 getNegotiableQuoteQuery = /* GraphQL */ `\n query getNegotiableQuote($quoteId: ID!) {\n negotiableQuote(uid: $quoteId) {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n\n ${NEGOTIABLE_QUOTE_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 { getNegotiableQuoteQuery } from '@/checkout/api/getNegotiableQuote/graphql';\nimport { transformNegotiableQuote as transformer } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport {\n MissingNegotiableQuoteId,\n Unauthenticated,\n} from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\n\ntype GetNegotiableQuoteInput = {\n uid?: string;\n};\n\nexport const getNegotiableQuote = async (\n input: GetNegotiableQuoteInput = {}\n) => {\n const quoteId = input.uid ?? state.quoteId;\n const isGuest = state.authenticated === false;\n\n if (isGuest) throw new Unauthenticated();\n if (!quoteId) throw new MissingNegotiableQuoteId();\n\n const variables = { quoteId: quoteId || '' };\n\n return await dispatchApiCall({\n type: 'query',\n query: getNegotiableQuoteQuery,\n options: { method: 'GET', cache: 'no-cache', variables },\n path: 'negotiableQuote',\n transformer,\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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const setNegotiableQuoteBillingAddressMutation = /* GraphQL */ `\n mutation setNegotiableQuoteBillingAddress(\n $quoteId: ID!\n $billingAddressInput: NegotiableQuoteBillingAddressInput!\n ) {\n setNegotiableQuoteBillingAddress(\n input: { quote_uid: $quoteId, billing_address: $billingAddressInput }\n ) {\n quote {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n }\n\n ${NEGOTIABLE_QUOTE_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 { setNegotiableQuoteBillingAddressMutation } from '@/checkout/api/setNegotiableQuoteBillingAddress/graphql';\nimport { transformNegotiableQuote as transformer } from '@/checkout/data/transforms';\nimport { dispatchApiCall, QueueName, state } from '@/checkout/lib';\nimport {\n MissingArgument,\n MissingNegotiableQuoteId,\n} from '@/checkout/lib/errors';\nimport { SetNegotiableQuoteBillingAddressInput } from '@/checkout/__generated__/types';\n\ntype NegotiableQuoteBillingAddressInput =\n SetNegotiableQuoteBillingAddressInput['billing_address'];\n\nexport const setNegotiableQuoteBillingAddress = async (\n billingAddressInput: NegotiableQuoteBillingAddressInput\n) => {\n const quoteId = state.quoteId;\n\n if (!quoteId) throw new MissingNegotiableQuoteId();\n\n const { customer_address_uid, address } = billingAddressInput;\n\n if (!customer_address_uid && !address) {\n throw new MissingArgument('Negotiable quote billing address');\n }\n\n const variables = { quoteId, billingAddressInput };\n\n return await dispatchApiCall({\n type: 'mutation',\n query: setNegotiableQuoteBillingAddressMutation,\n options: { variables },\n path: 'setNegotiableQuoteBillingAddress.quote',\n queueName: QueueName.QuoteUpdates,\n transformer,\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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const setNegotiableQuotePaymentMethodMutation = /* GraphQL */ `\n mutation setNegotiableQuotePaymentMethod(\n $quoteId: ID!\n $paymentMethodInput: NegotiableQuotePaymentMethodInput!\n ) {\n setNegotiableQuotePaymentMethod(\n input: { quote_uid: $quoteId, payment_method: $paymentMethodInput }\n ) {\n quote {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n }\n\n ${NEGOTIABLE_QUOTE_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 { setNegotiableQuotePaymentMethodMutation } from '@/checkout/api/setNegotiableQuotePaymentMethod/graphql';\nimport { transformNegotiableQuote as transformer } from '@/checkout/data/transforms';\nimport { dispatchApiCall, QueueName, state } from '@/checkout/lib';\nimport { MissingNegotiableQuoteId } from '@/checkout/lib/errors';\nimport { SetNegotiableQuotePaymentMethodInput } from '@/checkout/__generated__/types';\n\ntype PaymentMethodInput =\n SetNegotiableQuotePaymentMethodInput['payment_method'];\n\nexport const setNegotiableQuotePaymentMethod = async (\n paymentMethodInput: PaymentMethodInput\n) => {\n const quoteId = state.quoteId;\n\n if (!quoteId) throw new MissingNegotiableQuoteId();\n\n return await dispatchApiCall({\n type: 'mutation',\n query: setNegotiableQuotePaymentMethodMutation,\n queueName: QueueName.QuoteUpdates,\n options: { variables: { quoteId, paymentMethodInput } },\n path: 'setNegotiableQuotePaymentMethod.quote',\n transformer,\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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const setNegotiableQuoteShippingAddressMutation = /* GraphQL */ `\n mutation setNegotiableQuoteShippingAddress(\n $quoteId: ID!\n $shippingAddressInput: NegotiableQuoteShippingAddressInput!\n ) {\n setNegotiableQuoteShippingAddress(\n input: {\n quote_uid: $quoteId\n shipping_addresses: [$shippingAddressInput]\n }\n ) {\n quote {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n }\n\n ${NEGOTIABLE_QUOTE_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 { setNegotiableQuoteShippingAddressMutation } from '@/checkout/api/setNegotiableQuoteShippingAddress/graphql';\nimport { transformNegotiableQuote as transformer } from '@/checkout/data/transforms';\nimport { dispatchApiCall, QueueName, state } from '@/checkout/lib';\nimport {\n MissingNegotiableQuoteId,\n MissingShippingAddress,\n} from '@/checkout/lib/errors';\nimport { SetNegotiableQuoteShippingAddressInput } from '@/checkout/__generated__/types';\n\ntype NegotiableQuoteShippingAddressInput =\n SetNegotiableQuoteShippingAddressInput['shipping_addresses'];\n\nexport const setNegotiableQuoteShippingAddress = async (\n shippingAddressInput: NegotiableQuoteShippingAddressInput\n) => {\n const quoteId = state.quoteId;\n if (!quoteId) throw new MissingNegotiableQuoteId();\n\n if (!shippingAddressInput || shippingAddressInput.length === 0) {\n throw new MissingShippingAddress();\n }\n\n const addressInput = Array.isArray(shippingAddressInput)\n ? shippingAddressInput[0]\n : shippingAddressInput;\n\n if (!addressInput) throw new MissingShippingAddress();\n\n const { customer_address_uid, address } = addressInput;\n\n if (!customer_address_uid && !address) {\n throw new MissingShippingAddress();\n }\n\n const variables = {\n quoteId,\n shippingAddressInput,\n };\n\n return await dispatchApiCall({\n type: 'mutation',\n query: setNegotiableQuoteShippingAddressMutation,\n options: { variables },\n path: 'setNegotiableQuoteShippingAddress.quote',\n queueName: QueueName.QuoteUpdates,\n transformer,\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 { NEGOTIABLE_QUOTE_FRAGMENT } from '@/checkout/api/graphql/NegotiableQuoteFragment.graphql';\n\nexport const setNegotiableQuoteShippingMethodsMutation = /* GraphQL */ `\n mutation setNegotiableQuoteShippingMethods(\n $quoteId: ID!\n $shippingMethodsInput: [ShippingMethodInput]!\n ) {\n setNegotiableQuoteShippingMethods(\n input: { quote_uid: $quoteId, shipping_methods: $shippingMethodsInput }\n ) {\n quote {\n ...NEGOTIABLE_QUOTE_FRAGMENT\n }\n }\n }\n\n ${NEGOTIABLE_QUOTE_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 { setNegotiableQuoteShippingMethodsMutation } from '@/checkout/api/setNegotiableQuoteShippingMethods/graphql';\nimport { transformNegotiableQuote as transformer } from '@/checkout/data/transforms';\nimport { dispatchApiCall, QueueName, state } from '@/checkout/lib';\nimport {\n MissingNegotiableQuoteId,\n MissingShippingMethod,\n} from '@/checkout/lib/errors';\nimport { SetNegotiableQuoteShippingMethodsInput } from '@/checkout/__generated__/types';\n\ntype ShippingMethodInput =\n SetNegotiableQuoteShippingMethodsInput['shipping_methods'];\n\nexport const setNegotiableQuoteShippingMethods = async (\n shippingMethodsInput: ShippingMethodInput\n) => {\n const quoteId = state.quoteId;\n\n if (!quoteId) throw new MissingNegotiableQuoteId();\n\n if (!shippingMethodsInput || shippingMethodsInput.length === 0) {\n throw new MissingShippingMethod();\n }\n\n return await dispatchApiCall({\n type: 'mutation',\n query: setNegotiableQuoteShippingMethodsMutation,\n queueName: QueueName.QuoteUpdates,\n options: { variables: { quoteId, shippingMethodsInput } },\n path: 'setNegotiableQuoteShippingMethods.quote',\n transformer,\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 { transformCartAddressInput } from '@/checkout/data/transforms/transform-cart-address';\nimport { dispatchApiCall, getValue, QueueName, state } from '@/checkout/lib';\nimport { MissingCart, MissingShippingAddress } from '@/checkout/lib/errors';\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 MissingShippingAddress();\n }\n return { address: transformCartAddressInput(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","transformAddress","data","street","transformAddressCountry","transformAddressRegion","transformQuoteBillingAddress","transformQuoteShippingAddress","address","available_shipping_methods","selected_shipping_method","baseData","transformShippingMethods","transformSelectedShippingMethod","transformCheckoutAgreements","agreement","AgreementMode","transformNegotiableQuote","transformAvailablePaymentMethods","transformSelectedPaymentMethod","estimateShippingMethods","input","cartId","state","countryCode","_a","_b","MissingCart","MissingCountry","region_id","region_name","zip","region","estimateShippingAddressData","_c","_d","partialAddress","transformShippingEstimatePartialAddress","dispatchApiCall","QueueName","estimation","hasAvailableOptions","shippingMethod","userSelection","getValue","selection","method","transformShippingEstimateShippingMethod","events","error","GET_CHECKOUT_AGREEMENTS","getCheckoutAgreements","getNegotiableQuoteQuery","NEGOTIABLE_QUOTE_FRAGMENT","getNegotiableQuote","quoteId","Unauthenticated","MissingNegotiableQuoteId","transformer","setNegotiableQuoteBillingAddressMutation","setNegotiableQuoteBillingAddress","billingAddressInput","customer_address_uid","MissingArgument","setNegotiableQuotePaymentMethodMutation","setNegotiableQuotePaymentMethod","paymentMethodInput","setNegotiableQuoteShippingAddressMutation","setNegotiableQuoteShippingAddress","shippingAddressInput","MissingShippingAddress","addressInput","setNegotiableQuoteShippingMethodsMutation","setNegotiableQuoteShippingMethods","shippingMethodsInput","MissingShippingMethod","setShippingAddressMutation","CHECKOUT_DATA_FRAGMENT","setShippingAddressAndUseAsBillingMutation","setShippingAddress","customerAddressId","pickupLocationCode","transformCartAddressInput","isBillToShipping","query","path","variables","transformCart"],"mappings":"0gCAiBa,MAAAA,EAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECwBvDC,EACJC,GACiB,CACjB,MAAMC,EAASD,EAAK,OAAO,OAAO,OAAO,EAElC,MAAA,CACL,KAAMA,EAAK,KACX,QAASA,EAAK,SAAW,OACzB,QAASE,EAAwBF,EAAK,OAAO,EAC7C,UAAWA,EAAK,UAChB,SAAUA,EAAK,SACf,SAAUA,EAAK,UAAY,OAC3B,OAAQG,EAAuBH,EAAK,MAAM,EAC1C,OAAAC,EACA,UAAWD,EAAK,WAAa,MAC/B,CACF,EAEMI,EACJJ,GAC6B,CAC7B,GAAKA,EACL,OAAOD,EAAiBC,CAAI,CAC9B,EAEMK,EACJL,GAEOA,EACJ,OAAQM,GAAY,CAAC,CAACA,CAAO,EAC7B,IAAKA,GAAY,CACV,KAAA,CACJ,2BAAAC,EACA,yBAAAC,EACA,GAAGC,CAAA,EACDH,EAEG,MAAA,CACL,GAAGP,EAAiBU,CAAsC,EAC1D,yBAA0BC,EACxBH,CACF,EACA,uBAAwBI,EACtBH,CAAA,CAEJ,CAAA,CACD,EC7DQI,EACXZ,GAEKA,EAEEA,EACJ,OAAQa,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,ECARE,EACXf,GAEKA,EAEE,CACL,wBAAyBg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wE,EACA,mBAAAC,CACF,IAAiC,CAC/B,MAAM3D,EAASC,EAAM,OAErB,GAAI,CAACD,EAAc,MAAA,IAAIK,EAEvB,MAAM0C,EAAuB,IAA4B,CACvD,GAAIW,EACK,MAAA,CAAE,oBAAqBA,CAAkB,EAElD,GAAIC,EACK,MAAA,CAAE,qBAAsBA,CAAmB,EAEpD,GAAI,CAACzE,EACH,MAAM,IAAI8D,EAEZ,MAAO,CAAE,QAASY,EAA0B1E,CAAO,CAAE,CACvD,EAEM2E,EAAmBvC,EAAS,kBAAkB,EAE9CwC,EAAQD,EACVL,GACAF,GAEES,EAAOF,EACT,+BACA,kCAEEG,EAAY,CAChB,OAAAhE,EACA,qBAAsB+C,EAAqB,CAC7C,EAEA,OAAO,MAAM/B,EAAgB,CAC3B,KAAM,WACN,MAAA8C,EACA,QAAS,CAAE,UAAAE,CAAU,EACrB,KAAAD,EACA,UAAW9C,EAAU,WACrB,YAAagD,CAAA,CACd,CACH"}
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import"@dropins/tools/lib.js";import{events as U}from"@dropins/tools/event-bus.js";import{signal as y,computed as m}from"@dropins/tools/signals.js";import{FetchGraphQL as N}from"@dropins/tools/fetch-graphql.js";const S={authenticated:!1,cartId:null,initialized:!1,config:null},D=new Proxy(S,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}}),V=()=>D.config;class G extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class w extends Error{constructor(t){super(t),this.name="InvalidInput"}}class a extends w{constructor(t){super(`${t} is required.`)}}class B extends a{constructor(){super("Cart ID")}}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 c=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(c||{}),A=(e=>(e.CartUpdate="cartUpdate",e.QuoteUpdates="quoteUpdates",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(A||{});const d=new Map,g=new Map,u=y(new Set),E=new Map;E.set("cartUpdate",e=>{U.emit("checkout/updated",e)});async function X(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(u.value);r.delete(e),u.value=r;const o=E.get(e);o&&s&&o(s)}function q(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(u.value);return o.add(t),u.value=o,g.get(t)||X(t),r}const te=m(()=>u.value.has("cartUpdate")),se=m(()=>u.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:I,errors:_}=await Q(o,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...s});if(_){const C=T(_);if(C.length>0)throw new G(C)}let h=L(I,r);if(h===void 0)throw new Error(`No data found at path: ${r}`);return n?n(h):h};return p==="mutation"?await q(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:c.EXCLUDING_TAX}},re=async()=>await M({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:P,type:"query"});function b(e){switch(e){case 1:return c.EXCLUDING_TAX;case 2:return c.INCLUDING_TAX;case 3:return c.INCLUDING_EXCLUDING_TAX;default:return c.EXCLUDING_TAX}}function P(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:b(r)}}}const{setEndpoint:ne,setFetchGraphQlHeader:ae,removeFetchGraphQlHeader:oe,setFetchGraphQlHeaders:ie,fetchGraphQl:Q,getConfig:ce}=new N().getMethods();export{F as D,w as I,B as M,A as Q,f as S,c as T,$ as U,se as a,ee as b,z as c,M as d,a as e,K as f,W as g,te as h,V as i,ne as j,ae as k,ie as l,Q as m,ce as n,re as o,J as p,Y as q,oe as r,D 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 quoteId?: string | null;\n initialized: boolean;\n config: StoreConfig | null;\n};\n\nconst _state: State = (() => ({\n authenticated: false,\n cartId: null,\n initialized: false,\n config: 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 const getStoreConfigCache = () => state.config;\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 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 } 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 CartUpdate = 'cartUpdate',\n QuoteUpdates = 'quoteUpdates',\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(QueueName.CartUpdate, (latestResult: Cart) => {\n events.emit('checkout/updated', latestResult);\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 hasPendingCartUpdates: ReadonlySignal<boolean> = computed(() => {\n return pendingRequests.value.has(QueueName.CartUpdate);\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 } 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","/********************************************************************\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","getStoreConfigCache","FetchError","reasons","e","InvalidInput","message","MissingArgument","argumentName","MissingCart","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","hasPendingCartUpdates","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","transformTaxDisplay","default_country","is_checkout_agreements_enabled","shopping_cart_display_shipping","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL"],"mappings":"mNA2BA,MAAMA,EAAwB,CAC5B,cAAe,GACf,OAAQ,KACR,YAAa,GACb,OAAQ,IACV,EAGaC,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAIE,EAAQC,EAAKC,EAAO,CAEtB,OAAAF,EAAOC,CAAG,EAAIC,EACP,EACT,EACA,IAAIF,EAAQC,EAAK,CACf,OAAOD,EAAOC,CAAkB,CAAA,CAEpC,CAAC,EAEYE,EAAsB,IAAMJ,EAAM,OC3BxC,MAAMK,UAAmB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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECKpCC,EAAkB,KAElBC,EAAqC,CAChD,eAAgBD,EAChB,kBAAmB,GACnB,2BAA4B,CAC1B,SAAUjD,EAAW,aAAA,CAEzB,EAEamD,GAAiB,SACrB,MAAMd,EAAgB,CAC3B,mBAAoBa,EACpB,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,cACN,MAAOF,EACP,YAAaI,EACb,KAAM,OAAA,CACP,ECnBI,SAASC,EAAoBR,EAAiC,CACnE,OAAQA,EAAM,CACZ,IAAK,GACH,OAAO7C,EAAW,cACpB,IAAK,GACH,OAAOA,EAAW,cACpB,IAAK,GACH,OAAOA,EAAW,wBACpB,QACE,OAAOA,EAAW,aAAA,CAExB,CAEO,SAASoD,EACdP,EACa,CACT,GAAA,CAACA,EAAa,OAAAK,EAEZ,KAAA,CACJ,gBAAAI,EACA,+BAAAC,EACA,+BAAAC,CAAA,EACEX,EAEG,MAAA,CACL,eAAgBS,GAAmBJ,EAAsB,eACzD,kBAAmBK,EACnB,2BAA4B,CAC1B,SAAUF,EAAoBG,CAA8B,CAAA,CAEhE,CACF,CCjCa,KAAA,CACX,YAAAC,GACA,sBAAAC,GACA,yBAAAC,GACA,uBAAAC,GACA,aAAAd,EACA,UAAAe,EACF,EAAI,IAAIC,EAAa,EAAE,WAAW"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{g as d,h as l}from"./synchronizeCheckout.js";import{s as o,M as p,t as u,d as _,Q as f}from"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const g=`
|
|
4
4
|
mutation setBillingAddress($input: SetBillingAddressOnCartInput!) {
|
|
5
5
|
setBillingAddressOnCart(input: $input) {
|
|
6
6
|
cart {
|
|
@@ -10,5 +10,5 @@ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{a as d,b as l}fr
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
${e}
|
|
13
|
-
`,M=async({address:a,customerAddressId:
|
|
13
|
+
`,M=async({address:a,customerAddressId:t,sameAsShipping:s=!1,useForShipping:n=!1})=>{const r=o.cartId;if(!r)throw new p;const i={cart_id:r,billing_address:{same_as_shipping:s,use_for_shipping:n}};if(!s&&t&&(i.billing_address.customer_address_id=t),!s&&!t){if(!a)throw new u;i.billing_address.address=d(a)}return await _({options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",query:g,queueName:f.CartUpdate,transformer:l,type:"mutation"})};export{M as s};
|
|
14
14
|
//# 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 setBillingAddressMutation = /* GraphQL */ `\n mutation setBillingAddress($input: SetBillingAddressOnCartInput!) {\n setBillingAddressOnCart(input: $input) {\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 { setBillingAddressMutation } from '@/checkout/api/setBillingAddress/graphql/setBillingAddress.graphql';\nimport { BillingAddressInput } from '@/checkout/data/models';\nimport {\n transformCart,\n
|
|
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 setBillingAddressMutation = /* GraphQL */ `\n mutation setBillingAddress($input: SetBillingAddressOnCartInput!) {\n setBillingAddressOnCart(input: $input) {\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 { setBillingAddressMutation } from '@/checkout/api/setBillingAddress/graphql/setBillingAddress.graphql';\nimport { BillingAddressInput } from '@/checkout/data/models';\nimport {\n transformCart,\n transformCartAddressInput,\n} from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { MissingBillingAddress, MissingCart } from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\nimport { SetBillingAddressOnCartInput } from '@/checkout/__generated__/types';\n\nexport const setBillingAddress = async ({\n address,\n customerAddressId,\n sameAsShipping = false,\n useForShipping = false,\n}: BillingAddressInput) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n const input: SetBillingAddressOnCartInput = {\n cart_id: cartId,\n billing_address: {\n same_as_shipping: sameAsShipping,\n use_for_shipping: useForShipping,\n },\n };\n\n if (!sameAsShipping && customerAddressId) {\n input.billing_address.customer_address_id = customerAddressId;\n }\n\n if (!sameAsShipping && !customerAddressId) {\n if (!address) throw new MissingBillingAddress();\n input.billing_address.address = transformCartAddressInput(address);\n }\n\n return await dispatchApiCall({\n options: { variables: { input } },\n path: 'setBillingAddressOnCart.cart',\n query: setBillingAddressMutation,\n queueName: QueueName.CartUpdate,\n transformer: transformCart,\n type: 'mutation',\n });\n};\n"],"names":["setBillingAddressMutation","CHECKOUT_DATA_FRAGMENT","setBillingAddress","address","customerAddressId","sameAsShipping","useForShipping","cartId","state","MissingCart","input","MissingBillingAddress","transformCartAddressInput","dispatchApiCall","QueueName","transformCart"],"mappings":"kPAmBa,MAAAA,EAA0C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASnDC,CAAsB;AAAA,ECCbC,EAAoB,MAAO,CACtC,QAAAC,EACA,kBAAAC,EACA,eAAAC,EAAiB,GACjB,eAAAC,EAAiB,EACnB,IAA2B,CACzB,MAAMC,EAASC,EAAM,OAErB,GAAI,CAACD,EAAc,MAAA,IAAIE,EAEvB,MAAMC,EAAsC,CAC1C,QAASH,EACT,gBAAiB,CACf,iBAAkBF,EAClB,iBAAkBC,CAAA,CAEtB,EAMI,GAJA,CAACD,GAAkBD,IACrBM,EAAM,gBAAgB,oBAAsBN,GAG1C,CAACC,GAAkB,CAACD,EAAmB,CACzC,GAAI,CAACD,EAAe,MAAA,IAAIQ,EAClBD,EAAA,gBAAgB,QAAUE,EAA0BT,CAAO,CAAA,CAGnE,OAAO,MAAMU,EAAgB,CAC3B,QAAS,CAAE,UAAW,CAAE,MAAAH,EAAQ,EAChC,KAAM,+BACN,MAAOV,EACP,UAAWc,EAAU,WACrB,YAAaC,EACb,KAAM,UAAA,CACP,CACH"}
|
|
@@ -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,q as l,M as u,Q as c}from"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import{merge as E}from"@dropins/tools/lib.js";import{c as f,h as p}from"./synchronizeCheckout.js";const C=t=>{var i,e,s;if(!t)return null;const a={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(a,(s=(e=(i=f.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:e.transformer)==null?void 0:s.call(e,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
|
|
4
4
|
query getCustomer {
|
|
5
5
|
customer {
|
|
6
6
|
...CUSTOMER_FRAGMENT
|
|
@@ -8,13 +8,13 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
${o}
|
|
11
|
-
`,v=async()=>m.authenticated?await r({options:{method:"GET",cache:"no-cache"},path:"customer",query:A,transformer:C,type:"query"}):null,
|
|
11
|
+
`,v=async()=>m.authenticated?await r({options:{method:"GET",cache:"no-cache"},path:"customer",query:A,transformer:C,type:"query"}):null,h=`
|
|
12
12
|
query isEmailAvailable($email: String!) {
|
|
13
13
|
isEmailAvailable(email: $email) {
|
|
14
14
|
is_email_available
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
`,q=async t=>{if(!t)throw new l;return await r({options:{method:"GET",cache:"no-cache",variables:{email:t}},path:"isEmailAvailable",query:
|
|
17
|
+
`,q=async t=>{if(!t)throw new l;return await r({options:{method:"GET",cache:"no-cache",variables:{email:t}},path:"isEmailAvailable",query:h,transformer:y,type:"query"})},g=`
|
|
18
18
|
mutation setGuestEmail($cartId: String!, $email: String!) {
|
|
19
19
|
setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
|
|
20
20
|
cart {
|
|
@@ -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 a=m.cartId;if(!a)throw new u;return await r({options:{variables:{cartId:a,email:t}},path:"setGuestEmailOnCart.cart",query:
|
|
27
|
+
`,N=async t=>{const a=m.cartId;if(!a)throw new u;return await r({options:{variables:{cartId:a,email:t}},path:"setGuestEmailOnCart.cart",query:g,queueName:c.CartUpdate,transformer:p,type:"mutation"})};export{v 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.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":"yRAwBA,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,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{h as r}from"./synchronizeCheckout.js";import{s as o,M as n,p as s,d as m,Q as i}from"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const d=`
|
|
4
4
|
mutation setPaymentMethod(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$paymentMethod: PaymentMethodInput!
|
|
@@ -15,5 +15,5 @@ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./sy
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
${e}
|
|
18
|
-
`,u=async t=>{const a=
|
|
18
|
+
`,u=async t=>{const a=o.cartId;if(!a)throw new n;if(!t)throw new s;return await m({options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",query:d,queueName:i.CartUpdate,transformer:r,type:"mutation"})};export{u as s};
|
|
19
19
|
//# 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 setPaymentMethodMutation = /* GraphQL */ `\n mutation setPaymentMethod(\n $cartId: String!\n $paymentMethod: PaymentMethodInput!\n ) {\n setPaymentMethodOnCart(\n input: { cart_id: $cartId, payment_method: $paymentMethod }\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 { setPaymentMethodMutation } from '@/checkout/api/setPaymentMethod/graphql/setPaymentMethod.graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport {
|
|
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 setPaymentMethodMutation = /* GraphQL */ `\n mutation setPaymentMethod(\n $cartId: String!\n $paymentMethod: PaymentMethodInput!\n ) {\n setPaymentMethodOnCart(\n input: { cart_id: $cartId, payment_method: $paymentMethod }\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 { setPaymentMethodMutation } from '@/checkout/api/setPaymentMethod/graphql/setPaymentMethod.graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { MissingCart, MissingPaymentMethod } from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\nimport { SetPaymentMethodOnCartInput } from '@/checkout/__generated__/types';\n\nexport const setPaymentMethod = async (\n paymentMethod: SetPaymentMethodOnCartInput['payment_method']\n) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n if (!paymentMethod) throw new MissingPaymentMethod();\n\n return await dispatchApiCall({\n options: { variables: { cartId, paymentMethod } },\n path: 'setPaymentMethodOnCart.cart',\n query: setPaymentMethodMutation,\n queueName: QueueName.CartUpdate,\n transformer: transformCart,\n type: 'mutation',\n });\n};\n"],"names":["setPaymentMethodMutation","CHECKOUT_DATA_FRAGMENT","setPaymentMethod","paymentMethod","cartId","state","MissingCart","MissingPaymentMethod","dispatchApiCall","QueueName","transformCart"],"mappings":"2OAmBa,MAAAA,EAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAclDC,CAAsB;AAAA,ECRbC,EAAmB,MAC9BC,GACG,CACH,MAAMC,EAASC,EAAM,OAErB,GAAI,CAACD,EAAc,MAAA,IAAIE,EACvB,GAAI,CAACH,EAAqB,MAAA,IAAII,EAE9B,OAAO,MAAMC,EAAgB,CAC3B,QAAS,CAAE,UAAW,CAAE,OAAAJ,EAAQ,cAAAD,EAAgB,EAChD,KAAM,8BACN,MAAOH,EACP,UAAWS,EAAU,WACrB,YAAaC,EACb,KAAM,UAAA,CACP,CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as r}from"../fragments.js";import{h as i}from"./synchronizeCheckout.js";import{s as n,M as e,d as s,Q as p}from"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const g=t=>({countryCode:t.country_id,postCode:t.postcode||"",...t.region_id?{regionId:Number(t.region_id)}:{...t.region?{region:t.region}:{}}}),C=t=>({carrierCode:t.carrier.code||"",methodCode:t.code||"",amount:t.amount,amountExclTax:t.amountExclTax,amountInclTax:t.amountInclTax}),a=`
|
|
4
4
|
mutation setShippingMethods(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$shippingMethods: [ShippingMethodInput]!
|
|
@@ -14,6 +14,6 @@ import{s as r,M as i,d as n,Q as e}from"./errors.js";import{b as s}from"./synchr
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
${
|
|
18
|
-
`,M=async t=>{const o=
|
|
17
|
+
${r}
|
|
18
|
+
`,M=async t=>{const o=n.cartId;if(!o)throw new e;return await s({type:"mutation",query:a,queueName:p.CartUpdate,options:{variables:{cartId:o,shippingMethods:t}},path:"setShippingMethodsOnCart.cart",transformer:i})};export{g as a,M as s,C as t};
|
|
19
19
|
//# sourceMappingURL=setShippingMethods.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setShippingMethods.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-shipping-estimate.ts","/@dropins/storefront-checkout/src/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.ts","/@dropins/storefront-checkout/src/api/setShippingMethods/setShippingMethods.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 {\n PartialShippingAddress,\n ShippingEstimateShippingMethod,\n ShippingMethod,\n} from '@/checkout/data/models';\n\ntype TransformShippingEstimatePartialAddressInput = {\n country_id: string;\n postcode?: string;\n region_id?: number;\n region?: string;\n};\n\nexport const transformShippingEstimatePartialAddress = (\n data: TransformShippingEstimatePartialAddressInput\n): PartialShippingAddress => {\n return {\n countryCode: data.country_id,\n postCode: data.postcode || '',\n ...(data.region_id\n ? { regionId: Number(data.region_id) }\n : { ...(data.region ? { region: data.region } : {}) }),\n };\n};\n\nexport const transformShippingEstimateShippingMethod = (\n data: ShippingMethod\n): ShippingEstimateShippingMethod => {\n return {\n carrierCode: data.carrier.code || '',\n methodCode: data.code || '',\n amount: data.amount,\n amountExclTax: data.amountExclTax,\n amountInclTax: data.amountInclTax,\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 setShippingMethodsMutation = /* GraphQL */ `\n mutation setShippingMethods(\n $cartId: String!\n $shippingMethods: [ShippingMethodInput]!\n ) {\n setShippingMethodsOnCart(\n input: { cart_id: $cartId, shipping_methods: $shippingMethods }\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 {
|
|
1
|
+
{"version":3,"file":"setShippingMethods.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-shipping-estimate.ts","/@dropins/storefront-checkout/src/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.ts","/@dropins/storefront-checkout/src/api/setShippingMethods/setShippingMethods.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 {\n PartialShippingAddress,\n ShippingEstimateShippingMethod,\n ShippingMethod,\n} from '@/checkout/data/models';\n\ntype TransformShippingEstimatePartialAddressInput = {\n country_id: string;\n postcode?: string;\n region_id?: number;\n region?: string;\n};\n\nexport const transformShippingEstimatePartialAddress = (\n data: TransformShippingEstimatePartialAddressInput\n): PartialShippingAddress => {\n return {\n countryCode: data.country_id,\n postCode: data.postcode || '',\n ...(data.region_id\n ? { regionId: Number(data.region_id) }\n : { ...(data.region ? { region: data.region } : {}) }),\n };\n};\n\nexport const transformShippingEstimateShippingMethod = (\n data: ShippingMethod\n): ShippingEstimateShippingMethod => {\n return {\n carrierCode: data.carrier.code || '',\n methodCode: data.code || '',\n amount: data.amount,\n amountExclTax: data.amountExclTax,\n amountInclTax: data.amountInclTax,\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 setShippingMethodsMutation = /* GraphQL */ `\n mutation setShippingMethods(\n $cartId: String!\n $shippingMethods: [ShippingMethodInput]!\n ) {\n setShippingMethodsOnCart(\n input: { cart_id: $cartId, shipping_methods: $shippingMethods }\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 { setShippingMethodsMutation } from '@/checkout/api/setShippingMethods/graphql/setShippingMethodsOnCart.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';\nimport { SetShippingMethodsOnCartInput } from '@/checkout/__generated__/types';\n\ntype ShippingMethodsOnCart = SetShippingMethodsOnCartInput['shipping_methods'];\n\nexport const setShippingMethodsOnCart = async (\n shippingMethods: ShippingMethodsOnCart\n) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n return await dispatchApiCall({\n type: 'mutation',\n query: setShippingMethodsMutation,\n queueName: QueueName.CartUpdate,\n options: { variables: { cartId, shippingMethods } },\n path: 'setShippingMethodsOnCart.cart',\n transformer: transformCart,\n });\n};\n"],"names":["transformShippingEstimatePartialAddress","data","transformShippingEstimateShippingMethod","setShippingMethodsMutation","CHECKOUT_DATA_FRAGMENT","setShippingMethodsOnCart","shippingMethods","cartId","state","MissingCart","dispatchApiCall","QueueName","transformCart"],"mappings":"oOA8Ba,MAAAA,EACXC,IAEO,CACL,YAAaA,EAAK,WAClB,SAAUA,EAAK,UAAY,GAC3B,GAAIA,EAAK,UACL,CAAE,SAAU,OAAOA,EAAK,SAAS,CAAE,EACnC,CAAE,GAAIA,EAAK,OAAS,CAAE,OAAQA,EAAK,MAAO,EAAI,CAAI,CAAA,CACxD,GAGWC,EACXD,IAEO,CACL,YAAaA,EAAK,QAAQ,MAAQ,GAClC,WAAYA,EAAK,MAAQ,GACzB,OAAQA,EAAK,OACb,cAAeA,EAAK,cACpB,cAAeA,EAAK,aACtB,GChCWE,EAA2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAcpDC,CAAsB;AAAA,ECNbC,EAA2B,MACtCC,GACG,CACH,MAAMC,EAASC,EAAM,OAErB,GAAI,CAACD,EAAc,MAAA,IAAIE,EAEvB,OAAO,MAAMC,EAAgB,CAC3B,KAAM,WACN,MAAOP,EACP,UAAWQ,EAAU,WACrB,QAAS,CAAE,UAAW,CAAE,OAAAJ,EAAQ,gBAAAD,EAAkB,EAClD,KAAM,gCACN,YAAaM,CAAA,CACd,CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as
|
|
3
|
+
import{s as n,M as g,d as y,o as d}from"./fetch-graphql.js";import{merge as v,Initializer as C}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as c}from"../fragments.js";const x=async(e=!1)=>{n.authenticated=e},A=e=>{if(e)return{code:e.code,title:e.title}},b=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:i,title:r}=t;return{code:i,title:r}})},I=e=>e?"code"in e&&"value"in e:!1,M=e=>e.filter(I).map(t=>{const{code:i,value:r}=t;return{code:i,value:r}}),l=e=>{const t=e.street.filter(Boolean);return{id:(e==null?void 0:e.id)||void 0,city:e.city,company:e.company||void 0,country:N(e.country),customAttributes:M(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:z(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0,prefix:e.prefix||void 0,suffix:e.suffix||void 0,middleName:e.middlename||void 0,fax:e.fax||void 0}},T=e=>{if(e)return l(e)},S=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:i,selected_shipping_method:r,same_as_billing:s,...h}=t;return{...l(h),availableShippingMethods:$(i),selectedShippingMethod:P(r),sameAsBilling:s}}),U=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId,prefix:e.prefix,suffix:e.suffix,middlename:e.middleName,fax:e.fax}),k=e=>{var i,r,s;if(!e)return;const t={availablePaymentMethods:b(e.available_payment_methods),billingAddress:T(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:A(e.selected_payment_method),shippingAddresses:S(e.shipping_addresses),isGuest:!n.authenticated};return v(t,(s=(r=(i=G.getConfig().models)==null?void 0:i.CartModel)==null?void 0:r.transformer)==null?void 0:s.call(r,e))},N=e=>({code:(e==null?void 0:e.code)??"",label:(e==null?void 0:e.label)??""}),z=e=>{if(!(!(e!=null&&e.code)||!(e!=null&&e.label)))return{code:e.code,name:e.label,id:e.region_id??void 0}},E=(e,t)=>e.amount.value-t.amount.value,w=e=>e==null,u=e=>!(!e||!e.method_code||!e.method_title||w(e.amount.value)||!e.amount.currency),m=e=>({amount:{value:e.amount.value,currency:e.amount.currency},title:e.method_title,code:e.method_code,carrier:{code:e.carrier_code,title:e.carrier_title},value:`${e.carrier_code} - ${e.method_code}`,...e.price_excl_tax&&{amountExclTax:{value:e.price_excl_tax.value,currency:e.price_excl_tax.currency}},...e.price_incl_tax&&{amountInclTax:{value:e.price_incl_tax.value,currency:e.price_incl_tax.currency}}}),P=e=>{if(u(e))return m(e)},$=e=>e?e.filter(u).map(t=>m(t)).sort(E):[],q=`
|
|
4
4
|
query getCart($cartId: String!) {
|
|
5
5
|
cart(cart_id: $cartId) {
|
|
6
6
|
...CHECKOUT_DATA_FRAGMENT
|
|
@@ -8,7 +8,7 @@ import{s as r,M as h,d as g,l as y}from"./errors.js";import{merge as v,Initializ
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
${c}
|
|
11
|
-
`,
|
|
11
|
+
`,B=`
|
|
12
12
|
query getCustomerCart {
|
|
13
13
|
cart: customerCart {
|
|
14
14
|
...CHECKOUT_DATA_FRAGMENT
|
|
@@ -16,5 +16,5 @@ import{s as r,M as h,d as g,l as y}from"./errors.js";import{merge as v,Initializ
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
${c}
|
|
19
|
-
`,
|
|
19
|
+
`,a=async()=>{const e=n.cartId,t=n.authenticated===!1,i=t?q:B,r=t?{cartId:e}:{};if(t&&!e)throw new g;return await y({type:"query",query:i,options:{method:"POST",cache:"no-cache",variables:r},path:"cart",transformer:k})},D=()=>[o.on("authenticated",x,{eager:!0}),o.on("cart/initialized",p,{eager:!0}),o.on("cart/reset",O),o.on("cart/updated",_)],f=new C({init:async e=>{const t={...e};f.config.setConfig(t)},listeners:D}),G=f.config,p=async e=>{if(n.initialized)return _(e);n.config||(n.config=await d());const t=e?e.id:null;n.cartId=t;const i=t?await a():null;n.initialized=!0,o.emit("checkout/initialized",i||null)},O=()=>{n.cartId=null,o.emit("checkout/updated",null)},_=async e=>{if(!n.initialized)return p(e);const t=e?e.id:null;n.cartId=t;const i=t?await a():null;o.emit("checkout/updated",i||null)};export{$ as a,z as b,G as c,N as d,A as e,b as f,U as g,k as h,x as i,a as j,f as k,p as l,O as r,_ as s,P as t};
|
|
20
20
|
//# sourceMappingURL=synchronizeCheckout.js.map
|