@dropins/storefront-checkout 2.1.0-beta3 → 2.2.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/getCompanyCredit/getCompanyCredit.d.ts +4 -0
- package/api/getCompanyCredit/graphql/getCompanyCredit.graphql.d.ts +18 -0
- package/api/getCompanyCredit/graphql/index.d.ts +18 -0
- package/api/getCompanyCredit/index.d.ts +18 -0
- package/api/graphql/PaymentMethodFragment.graphql.d.ts +1 -1
- package/api/index.d.ts +1 -0
- package/api/initialize/initialize.d.ts +6 -2
- package/api.js +2 -2
- package/api.js.map +1 -1
- package/chunks/PaymentOnAccount2.js +4 -0
- package/chunks/PaymentOnAccount2.js.map +1 -0
- package/chunks/PurchaseOrder.js +4 -0
- package/chunks/PurchaseOrder.js.map +1 -0
- package/chunks/classifiers.js +4 -0
- package/chunks/classifiers.js.map +1 -0
- package/chunks/events.js +1 -1
- package/chunks/events.js.map +1 -1
- package/chunks/events2.js +1 -1
- package/chunks/events2.js.map +1 -1
- package/chunks/fetch-graphql.js +1 -1
- package/chunks/getCompanyCredit.js +15 -0
- package/chunks/getCompanyCredit.js.map +1 -0
- package/chunks/guards.js +1 -1
- package/chunks/render.js +10 -0
- package/chunks/render.js.map +1 -0
- package/chunks/setBillingAddress.js +1 -1
- package/chunks/setGuestEmailOnCart.js +1 -1
- package/chunks/setGuestEmailOnCart.js.map +1 -1
- package/chunks/setShippingAddress.js +1 -1
- package/chunks/setShippingMethods.js +2 -2
- package/chunks/synchronizeCheckout.js +6 -6
- package/chunks/synchronizeCheckout.js.map +1 -1
- package/components/PaymentOnAccount/PaymentOnAccount.d.ts +17 -0
- package/components/PaymentOnAccount/PaymentOnAccountSkeleton.d.ts +4 -0
- package/components/PaymentOnAccount/index.d.ts +20 -0
- package/components/PurchaseOrder/PurchaseOrder.d.ts +10 -0
- package/components/PurchaseOrder/index.d.ts +19 -0
- package/components/index.d.ts +3 -1
- package/containers/AddressValidation.js +1 -1
- package/containers/AddressValidation.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/MergedCartBanner.js +1 -1
- package/containers/MergedCartBanner.js.map +1 -1
- package/containers/OutOfStock.js +1 -1
- package/containers/OutOfStock.js.map +1 -1
- package/containers/PaymentMethods/PaymentMethods.d.ts +8 -6
- package/containers/PaymentMethods/handlers.d.ts +11 -0
- package/containers/PaymentMethods.js +1 -1
- package/containers/PaymentMethods.js.map +1 -1
- package/containers/PaymentOnAccount/PaymentOnAccount.d.ts +10 -0
- package/containers/PaymentOnAccount/index.d.ts +11 -0
- package/containers/PaymentOnAccount.d.ts +3 -0
- package/containers/PaymentOnAccount.js +4 -0
- package/containers/PaymentOnAccount.js.map +1 -0
- package/containers/PlaceOrder.js +1 -1
- package/containers/PlaceOrder.js.map +1 -1
- package/containers/PurchaseOrder/PurchaseOrder.d.ts +10 -0
- package/containers/PurchaseOrder/index.d.ts +19 -0
- package/containers/PurchaseOrder.d.ts +3 -0
- package/containers/PurchaseOrder.js +4 -0
- package/containers/PurchaseOrder.js.map +1 -0
- package/containers/ServerError/ServerError.d.ts +2 -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/containers/index.d.ts +2 -0
- package/data/models/company-credit.d.ts +7 -0
- package/data/models/index.d.ts +1 -0
- package/data/models/payment-method.d.ts +2 -0
- package/data/transforms/index.d.ts +1 -0
- package/data/transforms/transform-cart-address.d.ts +2 -0
- package/data/transforms/transform-company-credit.d.ts +7 -0
- package/data/transforms/transform-quote-address.d.ts +2 -0
- package/fragments.js +8 -7
- package/fragments.js.map +1 -1
- package/i18n/en_US.json.d.ts +20 -0
- package/lib/errors/classifiers.d.ts +3 -1
- package/lib/utils.js +1 -1
- package/lib/utils.js.map +1 -1
- package/package.json +1 -1
- package/render.js +5 -5
- package/render.js.map +1 -1
- package/tests/fixtures/fragments/cart.d.ts +4 -0
- package/tests/fixtures/helpers/session-storage.d.ts +68 -0
- package/tests/fixtures/index.d.ts +1 -0
- package/tests/fixtures/queries/get-company-credit.d.ts +14 -0
- package/tests/fixtures/queries/index.d.ts +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const getCompanyCreditQuery = "\n query getCompanyCredit {\n company {\n credit {\n available_credit {\n value\n currency\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=getCompanyCredit.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './getCompanyCredit.graphql';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './getCompanyCredit';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export declare const AVAILABLE_PAYMENT_METHOD_FRAGMENT = "\n fragment AVAILABLE_PAYMENT_METHOD_FRAGMENT on AvailablePaymentMethod {\n code\n title\n }\n";
|
|
18
|
-
export declare const SELECTED_PAYMENT_METHOD_FRAGMENT = "\n fragment SELECTED_PAYMENT_METHOD_FRAGMENT on SelectedPaymentMethod {\n code\n title\n }\n";
|
|
18
|
+
export declare const SELECTED_PAYMENT_METHOD_FRAGMENT = "\n fragment SELECTED_PAYMENT_METHOD_FRAGMENT on SelectedPaymentMethod {\n code\n title\n purchase_order_number\n }\n";
|
|
19
19
|
//# sourceMappingURL=PaymentMethodFragment.graphql.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from './estimateShippingMethods';
|
|
|
19
19
|
export * from './fetch-graphql';
|
|
20
20
|
export * from './getCart';
|
|
21
21
|
export * from './getCheckoutAgreements';
|
|
22
|
+
export * from './getCompanyCredit';
|
|
22
23
|
export * from './getCustomer';
|
|
23
24
|
export * from './getNegotiableQuote';
|
|
24
25
|
export * from './getStoreConfig';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cart as CartModel, Customer as CustomerModel, ShippingMethod } from '../../data/models';
|
|
2
2
|
import { Filter, Selector } from '../../types/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { definition } from '@dropins/tools/types/elsie/src/i18n';
|
|
4
4
|
import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
|
|
5
5
|
|
|
6
6
|
export type ConfigProps = {
|
|
@@ -17,7 +17,11 @@ export type ConfigProps = {
|
|
|
17
17
|
routeLogin?: () => string | void;
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
langDefinitions?:
|
|
20
|
+
langDefinitions?: typeof definition & {
|
|
21
|
+
default: {
|
|
22
|
+
Checkout: any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
21
25
|
models?: {
|
|
22
26
|
CartModel?: Model<CartModel>;
|
|
23
27
|
CustomerModel?: Model<CustomerModel>;
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{a as A,c as
|
|
3
|
+
import{a as A,c as G,g as S,b as T,i as k,d as y,r as O,s as F}from"./chunks/synchronizeCheckout.js";import{e as b,s as H}from"./chunks/setShippingAddress.js";import{d as o}from"./chunks/fetch-graphql.js";import{D as Q,S as U,f as R,g as q,e as v,i as z,r as D,a as K,b as L,c as w}from"./chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{A as s}from"./chunks/checkout.js";import{g as I}from"./chunks/getCompanyCredit.js";import{g as V,i as Y,s as j}from"./chunks/setGuestEmailOnCart.js";import{s as W}from"./chunks/setBillingAddress.js";import{s as Z}from"./chunks/setPaymentMethod.js";import{s as ee,s as te}from"./chunks/setShippingMethods.js";import"./fragments.js";import"./chunks/transform-shipping-methods.js";import"./chunks/classifiers.js";import"./chunks/transform-shipping-estimate.js";import"./chunks/values.js";import"./chunks/guards.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const r=t=>t?t.filter(e=>!!e).map(e=>({id:e.agreement_id,name:e.name,mode:s[e.mode],text:e.checkbox_text,content:{value:e.content,html:e.is_html,height:e.content_height??null}})):[],a=`
|
|
4
4
|
query GET_CHECKOUT_AGREEMENTS {
|
|
5
5
|
checkoutAgreements {
|
|
6
6
|
agreement_id
|
|
@@ -12,5 +12,5 @@ import{a as A,c as x,g as G,b as S,i as T,d as k,r as O,s as y}from"./chunks/syn
|
|
|
12
12
|
name
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
`,
|
|
15
|
+
`,E=async()=>await o({defaultValueOnFail:[],options:{method:"GET",cache:"no-cache"},path:"checkoutAgreements",query:a,transformer:r,type:"query"});export{Q as DEFAULT_COUNTRY,U as STORE_CONFIG_DEFAULTS,A as authenticateCustomer,G as config,b as estimateShippingMethods,R as fetchGraphQl,S as getCart,E as getCheckoutAgreements,I as getCompanyCredit,q as getConfig,V as getCustomer,T as getNegotiableQuote,v as getStoreConfig,z as getStoreConfigCache,k as initialize,y as initializeCheckout,Y as isEmailAvailable,D as removeFetchGraphQlHeader,O as resetCheckout,W as setBillingAddress,K as setEndpoint,L as setFetchGraphQlHeader,w as setFetchGraphQlHeaders,j as setGuestEmailOnCart,Z as setPaymentMethod,H as setShippingAddress,ee as setShippingMethods,te as setShippingMethodsOnCart,F as synchronizeCheckout};
|
|
16
16
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-checkout-agreements.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/graphql/getCheckoutAgreements.graphql.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/getCheckoutAgreements.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n AgreementMode,\n CheckoutAgreement as CheckoutAgreementModel,\n} from '@/checkout/data/models';\nimport { Get_Checkout_AgreementsQuery } from '@/checkout/__generated__/types';\n\ntype CheckoutAgreements = Get_Checkout_AgreementsQuery['checkoutAgreements'];\ntype FilteredAgreement = NonNullable<NonNullable<CheckoutAgreements>[0]>;\n\nexport const transformCheckoutAgreements = (\n data: CheckoutAgreements\n): CheckoutAgreementModel[] => {\n if (!data) return [];\n\n return data\n .filter((agreement): agreement is FilteredAgreement => !!agreement)\n .map((agreement) => ({\n id: agreement.agreement_id,\n name: agreement.name,\n mode: AgreementMode[agreement.mode],\n text: agreement.checkbox_text,\n content: {\n value: agreement.content,\n html: agreement.is_html,\n height: agreement.content_height ?? null,\n },\n }));\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CHECKOUT_AGREEMENTS = /* GraphQL */ `\n query GET_CHECKOUT_AGREEMENTS {\n checkoutAgreements {\n agreement_id\n checkbox_text\n content\n content_height\n is_html\n mode\n name\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CheckoutAgreement } from '@/checkout/data/models';\nimport { transformCheckoutAgreements } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib';\nimport { GET_CHECKOUT_AGREEMENTS } from './graphql/getCheckoutAgreements.graphql';\n\nexport const getCheckoutAgreements = async (): Promise<CheckoutAgreement[]> => {\n return await dispatchApiCall({\n defaultValueOnFail: [],\n options: { method: 'GET', cache: 'no-cache' },\n path: 'checkoutAgreements',\n query: GET_CHECKOUT_AGREEMENTS,\n transformer: transformCheckoutAgreements,\n type: 'query',\n });\n};\n"],"names":["transformCheckoutAgreements","data","agreement","AgreementMode","GET_CHECKOUT_AGREEMENTS","getCheckoutAgreements","dispatchApiCall"],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-checkout-agreements.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/graphql/getCheckoutAgreements.graphql.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/getCheckoutAgreements.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n AgreementMode,\n CheckoutAgreement as CheckoutAgreementModel,\n} from '@/checkout/data/models';\nimport { Get_Checkout_AgreementsQuery } from '@/checkout/__generated__/types';\n\ntype CheckoutAgreements = Get_Checkout_AgreementsQuery['checkoutAgreements'];\ntype FilteredAgreement = NonNullable<NonNullable<CheckoutAgreements>[0]>;\n\nexport const transformCheckoutAgreements = (\n data: CheckoutAgreements\n): CheckoutAgreementModel[] => {\n if (!data) return [];\n\n return data\n .filter((agreement): agreement is FilteredAgreement => !!agreement)\n .map((agreement) => ({\n id: agreement.agreement_id,\n name: agreement.name,\n mode: AgreementMode[agreement.mode],\n text: agreement.checkbox_text,\n content: {\n value: agreement.content,\n html: agreement.is_html,\n height: agreement.content_height ?? null,\n },\n }));\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CHECKOUT_AGREEMENTS = /* GraphQL */ `\n query GET_CHECKOUT_AGREEMENTS {\n checkoutAgreements {\n agreement_id\n checkbox_text\n content\n content_height\n is_html\n mode\n name\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CheckoutAgreement } from '@/checkout/data/models';\nimport { transformCheckoutAgreements } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib';\nimport { GET_CHECKOUT_AGREEMENTS } from './graphql/getCheckoutAgreements.graphql';\n\nexport const getCheckoutAgreements = async (): Promise<CheckoutAgreement[]> => {\n return await dispatchApiCall({\n defaultValueOnFail: [],\n options: { method: 'GET', cache: 'no-cache' },\n path: 'checkoutAgreements',\n query: GET_CHECKOUT_AGREEMENTS,\n transformer: transformCheckoutAgreements,\n type: 'query',\n });\n};\n"],"names":["transformCheckoutAgreements","data","agreement","AgreementMode","GET_CHECKOUT_AGREEMENTS","getCheckoutAgreements","dispatchApiCall"],"mappings":"68BA0Ba,MAAAA,EACXC,GAEKA,EAEEA,EACJ,OAAQC,GAA8C,CAAC,CAACA,CAAS,EACjE,IAAKA,IAAe,CACnB,GAAIA,EAAU,aACd,KAAMA,EAAU,KAChB,KAAMC,EAAcD,EAAU,IAAI,EAClC,KAAMA,EAAU,cAChB,QAAS,CACP,MAAOA,EAAU,QACjB,KAAMA,EAAU,QAChB,OAAQA,EAAU,gBAAkB,IAAA,CACtC,EACA,EAdc,CAAC,ECZRE,EAAwC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECKxCC,EAAwB,SAC5B,MAAMC,EAAgB,CAC3B,mBAAoB,CAAC,EACrB,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,qBACN,MAAOF,EACP,YAAaJ,EACb,KAAM,OAAA,CACP"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsxs as A,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{useState as m,useCallback as g,useEffect as N}from"@dropins/tools/preact-compat.js";import{Skeleton as O,SkeletonRow as _,Price as E,Field as W,Input as z,InLineAlert as I}from"@dropins/tools/components.js";import{classes as S}from"@dropins/tools/lib.js";/* empty css */import{W as T}from"./ConditionalWrapper.js";import{useText as V,Text as w}from"@dropins/tools/i18n.js";import{s as H}from"./fetch-graphql.js";import{events as j}from"@dropins/tools/event-bus.js";import{g as F}from"./getCompanyCredit.js";const p=()=>A(O,{"data-testid":"payment-on-account-skeleton",children:[n(_,{fullWidth:!0,size:"medium"}),n(_,{fullWidth:!0,size:"medium"})]}),M=({className:d,referenceNumber:r="",onReferenceNumberChange:u,onReferenceNumberBlur:h,companyCredit:e=null,cartAmount:o=null,...f})=>{var i;const c=(()=>{if(!(e!=null&&e.availableCredit)||!o)return null;const k=e.availableCredit.value,t=o.value-k;return t<=0?null:{value:t,currency:e.availableCredit.currency}})(),v=((i=e==null?void 0:e.availableCredit)==null?void 0:i.value)||0,x=(c==null?void 0:c.value)||0,a=V({referenceNumberLabel:"Checkout.PaymentOnAccount.referenceNumberLabel",referenceNumberPlaceholder:"Checkout.PaymentOnAccount.referenceNumberPlaceholder",referenceNumberHint:"Checkout.PaymentOnAccount.referenceNumberHint",availableCreditLabel:"Checkout.PaymentOnAccount.availableCreditLabel",exceedLimitError:"Checkout.PaymentOnAccount.exceedLimitError",exceedLimitWarning:c?n(w,{fields:{creditLimit:v,exceededAmount:x},id:"Checkout.PaymentOnAccount.exceedLimitWarning"}):""}),s=e&&o&&c;return n("div",{className:"checkout-payment-on-account","data-testid":"checkout-payment-on-account",children:A("form",{...f,noValidate:!0,className:S(["checkout-payment-on-account__form",d]),"data-testid":"checkout-payment-on-account-form",name:"checkout-payment-on-account__form",children:[e&&e.availableCredit&&A("div",{className:"checkout-payment-on-account__credit","data-testid":"checkout-payment-on-account-credit",children:[n("span",{className:"checkout-payment-on-account__credit-label",children:a.availableCreditLabel}),n("span",{className:"checkout-payment-on-account__credit-amount",children:n(E,{amount:e==null?void 0:e.availableCredit.value,currency:e==null?void 0:e.availableCredit.currency})})]}),n(W,{hint:a.referenceNumberHint,children:n(z,{"aria-label":a.referenceNumberLabel,floatingLabel:a.referenceNumberLabel,id:"reference-number",name:"reference-number",placeholder:a.referenceNumberPlaceholder,type:"text",value:r,onBlur:h,onChange:u})}),s&&n("div",{className:"checkout-payment-on-account__exceed-message","data-testid":"checkout-payment-on-account-exceed-message",children:n(I,{heading:e!=null&&e.exceedLimit?a.exceedLimitWarning:a.exceedLimitError,type:e!=null&&e.exceedLimit?"warning":"error",variant:"primary"})})]})})},$=T(M,p),Z=({initialReferenceNumber:d="",onReferenceNumberChange:r,onReferenceNumberBlur:u,...h})=>{const[e,o]=m(!1),[f,b]=m(null),[c,v]=m(null),[x,a]=m(d),s=H.authenticated,i=g(t=>{var l;const L=((l=t==null?void 0:t.total)==null?void 0:l.includingTax)||null;v(L)},[]),k=g(t=>{const l=t.target.value;a(l),r==null||r(l)},[r]),P=g(t=>{const l=t.target.value;u==null||u(l)},[u]);return N(()=>{const t=j.on("cart/data",i,{eager:!0});return()=>{t==null||t.off()}},[i]),N(()=>{s&&F().then(t=>{b(t)}).catch(t=>{console.error("Failed to fetch company credit:",t),b(null)}).finally(()=>{o(!0)})},[s]),n("div",{...h,children:n($,{cartAmount:c,companyCredit:f,initialized:e,referenceNumber:x,onReferenceNumberBlur:P,onReferenceNumberChange:k})})};export{Z as P};
|
|
4
|
+
//# sourceMappingURL=PaymentOnAccount2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentOnAccount2.js","sources":["/@dropins/storefront-checkout/src/components/PaymentOnAccount/PaymentOnAccountSkeleton.tsx","/@dropins/storefront-checkout/src/components/PaymentOnAccount/PaymentOnAccount.tsx","/@dropins/storefront-checkout/src/containers/PaymentOnAccount/PaymentOnAccount.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\n\nexport const PaymentOnAccountSkeleton: FunctionComponent = () => {\n return (\n <Skeleton data-testid=\"payment-on-account-skeleton\">\n <SkeletonRow fullWidth={true} size=\"medium\" />\n <SkeletonRow fullWidth={true} size=\"medium\" />\n </Skeleton>\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 { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Field, Input, Price, InLineAlert } from '@adobe-commerce/elsie/components';\nimport { useText, Text } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Money } from '@/checkout/data/models';\nimport '@/checkout/components/PaymentOnAccount/PaymentOnAccount.css';\nimport { WithConditionals } from '@/checkout/components/ConditionalWrapper/ConditionalWrapper';\nimport { PaymentOnAccountSkeleton } from '@/checkout/components/PaymentOnAccount/PaymentOnAccountSkeleton';\nexport type CompanyCredit = {\n availableCredit: Money;\n exceedLimit?: boolean;\n};\n\nexport interface PaymentOnAccountProps extends HTMLAttributes<HTMLFormElement> {\n referenceNumber?: string;\n onReferenceNumberChange?: (event: Event) => void;\n onReferenceNumberBlur?: (event: Event) => void;\n companyCredit?: CompanyCredit | null;\n cartAmount?: Money | null;\n}\n\nconst PaymentOnAccountComponent: FunctionComponent<PaymentOnAccountProps> = ({\n className,\n referenceNumber = '',\n onReferenceNumberChange,\n onReferenceNumberBlur,\n companyCredit = null,\n cartAmount = null,\n ...props\n}) => {\n const calculateExceededAmount = (): Money | null => {\n if (!companyCredit?.availableCredit || !cartAmount) return null;\n\n const availableValue = companyCredit.availableCredit.value;\n const cartValue = cartAmount.value;\n const exceededValue = cartValue - availableValue;\n\n if (exceededValue <= 0) return null;\n\n return {\n value: exceededValue,\n currency: companyCredit.availableCredit.currency\n };\n };\n\n const exceededAmount = calculateExceededAmount();\n\n // TODO: format credit limit and exceeded amount with price component format\n const creditLimitText = companyCredit?.availableCredit?.value || 0;\n const exceededAmountText = exceededAmount?.value || 0;\n\n const translations = useText({\n referenceNumberLabel: 'Checkout.PaymentOnAccount.referenceNumberLabel',\n referenceNumberPlaceholder: 'Checkout.PaymentOnAccount.referenceNumberPlaceholder',\n referenceNumberHint: 'Checkout.PaymentOnAccount.referenceNumberHint',\n availableCreditLabel: 'Checkout.PaymentOnAccount.availableCreditLabel',\n exceedLimitError: 'Checkout.PaymentOnAccount.exceedLimitError',\n exceedLimitWarning: (exceededAmount ? (\n // @ts-ignore - Type compatibility issue between preact versions\n <Text\n fields={{\n creditLimit: creditLimitText,\n exceededAmount: exceededAmountText\n }}\n id=\"Checkout.PaymentOnAccount.exceedLimitWarning\"\n />\n ) : '') as any,\n });\n\n const shouldShowExceedMessage = companyCredit && cartAmount && exceededAmount;\n return (\n <div className=\"checkout-payment-on-account\" data-testid=\"checkout-payment-on-account\">\n <form\n {...props}\n noValidate\n className={classes(['checkout-payment-on-account__form', className])}\n data-testid=\"checkout-payment-on-account-form\"\n name=\"checkout-payment-on-account__form\"\n >\n {companyCredit && companyCredit.availableCredit && (\n <div\n className=\"checkout-payment-on-account__credit\"\n data-testid=\"checkout-payment-on-account-credit\"\n >\n <span className=\"checkout-payment-on-account__credit-label\">\n {translations.availableCreditLabel}\n </span>\n <span className=\"checkout-payment-on-account__credit-amount\">\n <Price\n amount={companyCredit?.availableCredit.value}\n currency={companyCredit?.availableCredit.currency}\n />\n </span>\n </div>\n )}\n\n <Field hint={translations.referenceNumberHint}>\n <Input\n aria-label={translations.referenceNumberLabel}\n floatingLabel={translations.referenceNumberLabel}\n id=\"reference-number\"\n name=\"reference-number\"\n placeholder={translations.referenceNumberPlaceholder}\n type=\"text\"\n value={referenceNumber}\n onBlur={onReferenceNumberBlur}\n onChange={onReferenceNumberChange}\n />\n </Field>\n\n {shouldShowExceedMessage && (\n <div\n className=\"checkout-payment-on-account__exceed-message\"\n data-testid=\"checkout-payment-on-account-exceed-message\"\n >\n <InLineAlert\n heading={\n companyCredit?.exceedLimit ? (\n translations.exceedLimitWarning\n ) : (\n translations.exceedLimitError\n )\n }\n type={companyCredit?.exceedLimit ? 'warning' : 'error'}\n variant=\"primary\"\n />\n </div>\n )}\n </form>\n </div>\n );\n};\n\nexport const PaymentOnAccount = WithConditionals(\n PaymentOnAccountComponent,\n PaymentOnAccountSkeleton\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 { HTMLAttributes, useCallback, useEffect, useState } from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { PaymentOnAccount as PaymentOnAccountComponent } from '@/checkout/components/PaymentOnAccount';\nimport { Money, CompanyCredit, Cart } from '@/checkout/data/models';\nimport { getCompanyCredit } from '@/checkout/api';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/checkout/lib';\n\nexport interface PaymentOnAccountProps extends HTMLAttributes<HTMLDivElement> {\n initialReferenceNumber?: string;\n onReferenceNumberChange?: (referenceNumber: string) => void;\n onReferenceNumberBlur?: (referenceNumber: string) => void;\n}\n\nexport const PaymentOnAccount: Container<PaymentOnAccountProps> = ({\n initialReferenceNumber = '',\n onReferenceNumberChange,\n onReferenceNumberBlur,\n ...props\n}) => {\n const [isInitialized, setIsInitialized] = useState(false);\n const [companyCredit, setCompanyCredit] = useState<CompanyCredit | null>(null);\n const [cartAmount, setCartAmount] = useState<Money | null>(null);\n const [referenceNumber, setReferenceNumber] = useState<string>(initialReferenceNumber);\n\n const isAuthenticated = state.authenticated;\n\n const handleCartData = useCallback((data: Cart | null | { total?: { includingTax?: Money } }) => {\n // Handle both Cart model and event data structure\n const cartAmount = (data as any)?.total?.includingTax || null;\n setCartAmount(cartAmount);\n }, []);\n\n const handleReferenceNumberChange = useCallback((event: Event) => {\n const target = event.target as HTMLInputElement;\n const value = target.value;\n setReferenceNumber(value);\n onReferenceNumberChange?.(value);\n }, [onReferenceNumberChange]);\n\n const handleReferenceNumberBlur = useCallback((event: Event) => {\n const target = event.target as HTMLInputElement;\n const value = target.value;\n onReferenceNumberBlur?.(value);\n }, [onReferenceNumberBlur]);\n\n useEffect(() => {\n const onCartData = events.on(\n 'cart/data',\n handleCartData,\n { eager: true }\n );\n\n return () => {\n onCartData?.off();\n };\n }, [handleCartData]);\n\n useEffect(() => {\n if (!isAuthenticated) return;\n\n getCompanyCredit()\n .then((credit) => {\n setCompanyCredit(credit);\n })\n .catch((error) => {\n console.error('Failed to fetch company credit:', error);\n setCompanyCredit(null);\n })\n .finally(() => {\n setIsInitialized(true);\n });\n }, [isAuthenticated]);\n\n return (\n <div {...props}>\n <PaymentOnAccountComponent\n cartAmount={cartAmount}\n companyCredit={companyCredit}\n initialized={isInitialized}\n referenceNumber={referenceNumber}\n onReferenceNumberBlur={handleReferenceNumberBlur}\n onReferenceNumberChange={handleReferenceNumberChange}\n />\n </div>\n );\n};\n"],"names":["PaymentOnAccountSkeleton","jsxs","Skeleton","jsx","SkeletonRow","PaymentOnAccountComponent","className","referenceNumber","onReferenceNumberChange","onReferenceNumberBlur","companyCredit","cartAmount","props","exceededAmount","availableValue","exceededValue","creditLimitText","_a","exceededAmountText","translations","useText","Text","shouldShowExceedMessage","classes","Price","Field","Input","InLineAlert","PaymentOnAccount","WithConditionals","initialReferenceNumber","isInitialized","setIsInitialized","useState","setCompanyCredit","setCartAmount","setReferenceNumber","isAuthenticated","state","handleCartData","useCallback","data","handleReferenceNumberChange","event","value","handleReferenceNumberBlur","useEffect","onCartData","events","getCompanyCredit","credit","error"],"mappings":"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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import"./TermsAndConditions.js";import{classes as h}from"@dropins/tools/lib.js";import{Field as p,Input as f}from"@dropins/tools/components.js";/* empty css */import"./fetch-graphql.js";import"@dropins/tools/event-bus.js";import{useState as b,useCallback as i}from"@dropins/tools/preact-compat.js";/* empty css *//* empty css */import{useText as k}from"@dropins/tools/i18n.js";/* empty css */import"@dropins/tools/preact-hooks.js";const P=({className:o,referenceNumber:e="",onReferenceNumberChange:r,onReferenceNumberBlur:s,...u})=>{const t=k({referenceNumberLabel:"Checkout.PurchaseOrder.referenceNumberLabel",referenceNumberPlaceholder:"Checkout.PurchaseOrder.referenceNumberPlaceholder",referenceNumberHint:"Checkout.PurchaseOrder.referenceNumberHint"});return c("div",{className:"checkout-purchase-order","data-testid":"checkout-purchase-order",children:c("form",{...u,noValidate:!0,className:h(["checkout-purchase-order__form",o]),"data-testid":"checkout-purchase-order-form",name:"checkout-purchase-order__form",children:c(p,{hint:t.referenceNumberHint||void 0,children:c(f,{floatingLabel:t.referenceNumberLabel,id:"reference-number",name:"reference-number",placeholder:t.referenceNumberPlaceholder,type:"text",value:e,onBlur:s,onChange:r})})})})},S=({initialReferenceNumber:o="",onReferenceNumberChange:e,onReferenceNumberBlur:r,...s})=>{const[u,t]=b(o),l=i(m=>{const a=m.target.value;t(a),e==null||e(a)},[e]),n=i(m=>{const a=m.target.value;r==null||r(a)},[r]);return c(P,{...s,referenceNumber:u,onReferenceNumberBlur:n,onReferenceNumberChange:l})};export{S as P};
|
|
4
|
+
//# sourceMappingURL=PurchaseOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PurchaseOrder.js","sources":["/@dropins/storefront-checkout/src/components/PurchaseOrder/PurchaseOrder.tsx","/@dropins/storefront-checkout/src/containers/PurchaseOrder/PurchaseOrder.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport '@/checkout/components/PurchaseOrder/PurchaseOrder.css';\nimport { Field, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\n\nexport interface PurchaseOrderProps extends HTMLAttributes<HTMLFormElement> {\n referenceNumber?: string;\n onReferenceNumberChange?: (event: Event) => void;\n onReferenceNumberBlur?: (event: Event) => void;\n}\n\nexport const PurchaseOrder: FunctionComponent<PurchaseOrderProps> = ({\n className,\n referenceNumber = '',\n onReferenceNumberChange,\n onReferenceNumberBlur,\n ...props\n}) => {\n const translations = useText({\n referenceNumberLabel: 'Checkout.PurchaseOrder.referenceNumberLabel',\n referenceNumberPlaceholder:\n 'Checkout.PurchaseOrder.referenceNumberPlaceholder',\n referenceNumberHint: 'Checkout.PurchaseOrder.referenceNumberHint',\n });\n\n return (\n <div\n className=\"checkout-purchase-order\"\n data-testid=\"checkout-purchase-order\"\n >\n <form\n {...props}\n noValidate\n className={classes(['checkout-purchase-order__form', className])}\n data-testid=\"checkout-purchase-order-form\"\n name=\"checkout-purchase-order__form\"\n >\n <Field hint={translations.referenceNumberHint || undefined}>\n <Input\n floatingLabel={translations.referenceNumberLabel}\n id=\"reference-number\"\n name=\"reference-number\"\n placeholder={translations.referenceNumberPlaceholder}\n type=\"text\"\n value={referenceNumber}\n onBlur={onReferenceNumberBlur}\n onChange={onReferenceNumberChange}\n />\n </Field>\n </form>\n </div>\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 { PurchaseOrder as PurchaseOrderComponent } from '@/checkout/components';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { HTMLAttributes, useCallback, useState } from 'preact/compat';\n\nexport interface PurchaseOrderProps extends HTMLAttributes<HTMLFormElement> {\n initialReferenceNumber?: string;\n onReferenceNumberChange?: (referenceNumber: string) => void;\n onReferenceNumberBlur?: (referenceNumber: string) => void;\n}\n\nexport const PurchaseOrder: Container<PurchaseOrderProps> = ({\n initialReferenceNumber = '',\n onReferenceNumberChange,\n onReferenceNumberBlur,\n ...props\n}) => {\n const [referenceNumber, setReferenceNumber] = useState<string>(\n initialReferenceNumber\n );\n\n const handleReferenceNumberChange = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const value = target.value;\n setReferenceNumber(value);\n onReferenceNumberChange?.(value);\n },\n [onReferenceNumberChange]\n );\n\n const handleReferenceNumberBlur = useCallback(\n (event: Event) => {\n const target = event.target as HTMLInputElement;\n const value = target.value;\n onReferenceNumberBlur?.(value);\n },\n [onReferenceNumberBlur]\n );\n\n return (\n <PurchaseOrderComponent\n {...props}\n referenceNumber={referenceNumber}\n onReferenceNumberBlur={handleReferenceNumberBlur}\n onReferenceNumberChange={handleReferenceNumberChange}\n />\n );\n};\n"],"names":["PurchaseOrder","className","referenceNumber","onReferenceNumberChange","onReferenceNumberBlur","props","translations","useText","jsx","classes","Field","Input","initialReferenceNumber","setReferenceNumber","useState","handleReferenceNumberChange","useCallback","event","value","handleReferenceNumberBlur","PurchaseOrderComponent"],"mappings":"oiBA8BO,MAAMA,EAAuD,CAAC,CACnE,UAAAC,EACA,gBAAAC,EAAkB,GAClB,wBAAAC,EACA,sBAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAeC,EAAQ,CAC3B,qBAAsB,8CACtB,2BACE,oDACF,oBAAqB,4CAAA,CACtB,EAGC,OAAAC,EAAC,MAAA,CACC,UAAU,0BACV,cAAY,0BAEZ,SAAAA,EAAC,OAAA,CACE,GAAGH,EACJ,WAAU,GACV,UAAWI,EAAQ,CAAC,gCAAiCR,CAAS,CAAC,EAC/D,cAAY,+BACZ,KAAK,gCAEL,SAACO,EAAAE,EAAA,CAAM,KAAMJ,EAAa,qBAAuB,OAC/C,SAAAE,EAACG,EAAA,CACC,cAAeL,EAAa,qBAC5B,GAAG,mBACH,KAAK,mBACL,YAAaA,EAAa,2BAC1B,KAAK,OACL,MAAOJ,EACP,OAAQE,EACR,SAAUD,CAAA,CAAA,CAEd,CAAA,CAAA,CAAA,CACF,CACF,CAEJ,EC5CaH,EAA+C,CAAC,CAC3D,uBAAAY,EAAyB,GACzB,wBAAAT,EACA,sBAAAC,EACA,GAAGC,CACL,IAAM,CACE,KAAA,CAACH,EAAiBW,CAAkB,EAAIC,EAC5CF,CACF,EAEMG,EAA8BC,EACjCC,GAAiB,CAEhB,MAAMC,EADSD,EAAM,OACA,MACrBJ,EAAmBK,CAAK,EACxBf,GAAA,MAAAA,EAA0Be,EAC5B,EACA,CAACf,CAAuB,CAC1B,EAEMgB,EAA4BH,EAC/BC,GAAiB,CAEhB,MAAMC,EADSD,EAAM,OACA,MACrBb,GAAA,MAAAA,EAAwBc,EAC1B,EACA,CAACd,CAAqB,CACxB,EAGE,OAAAI,EAACY,EAAA,CACE,GAAGf,EACJ,gBAAAH,EACA,sBAAuBiB,EACvB,wBAAyBJ,CAAA,CAC3B,CAEJ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{I as E,U as N}from"./fetch-graphql.js";var I=(R=>(R.INVALID_INPUT="INVALID_INPUT",R.SERVER_ERROR="SERVER_ERROR",R.UNAUTHENTICATED="UNAUTHENTICATED",R.UNKNOWN_ERROR="UNKNOWN_ERROR",R.QUOTE_DATA_ERROR="QUOTE_DATA_ERROR",R.QUOTE_PERMISSION_DENIED="QUOTE_PERMISSION_DENIED",R))(I||{});const t=["PlaceOrderError"],a=[{code:"INVALID_INPUT",matches:R=>R instanceof E},{code:"UNAUTHENTICATED",matches:R=>R instanceof N},{code:"SERVER_ERROR",matches:R=>!R||typeof R!="object"||!("name"in R)?!1:t.includes(R.name)}];export{I as E,a as c};
|
|
4
|
+
//# sourceMappingURL=classifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifiers.js","sources":["/@dropins/storefront-checkout/src/lib/errors/classifiers.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { InvalidInput, Unauthenticated } from './customErrors';\n\nexport type ErrorCode = string;\n\nexport enum ErrorCodes {\n INVALID_INPUT = 'INVALID_INPUT',\n SERVER_ERROR = 'SERVER_ERROR',\n UNAUTHENTICATED = 'UNAUTHENTICATED',\n UNKNOWN_ERROR = 'UNKNOWN_ERROR',\n QUOTE_DATA_ERROR = 'QUOTE_DATA_ERROR',\n QUOTE_PERMISSION_DENIED = 'QUOTE_PERMISSION_DENIED',\n}\n\nconst KNOWN_SERVER_ERRORS = ['PlaceOrderError'];\n\nexport interface ErrorClassifier {\n /**\n * The specific code to return if this classifier matches.\n */\n code: ErrorCode;\n /**\n * A function that returns `true` if it recognizes the error.\n * It must safely handle `unknown` inputs.\n */\n matches: (error: unknown) => boolean;\n}\n\n// Array of all known error classifiers.\n// The order is important! The first one to match will be used.\nexport const classifiers: ErrorClassifier[] = [\n {\n code: ErrorCodes.INVALID_INPUT,\n matches: (error: unknown): boolean => {\n return error instanceof InvalidInput;\n },\n },\n {\n code: ErrorCodes.UNAUTHENTICATED,\n matches: (error: unknown): boolean => {\n return error instanceof Unauthenticated;\n },\n },\n {\n code: ErrorCodes.SERVER_ERROR,\n matches: (error: unknown): boolean => {\n if (!error || typeof error !== 'object' || !('name' in error)) {\n return false;\n }\n\n return KNOWN_SERVER_ERRORS.includes((error as { name: string }).name);\n },\n },\n];\n"],"names":["ErrorCodes","KNOWN_SERVER_ERRORS","classifiers","error","InvalidInput","Unauthenticated"],"mappings":"8CAqBY,IAAAA,GAAAA,IACVA,EAAA,cAAgB,gBAChBA,EAAA,aAAe,eACfA,EAAA,gBAAkB,kBAClBA,EAAA,cAAgB,gBAChBA,EAAA,iBAAmB,mBACnBA,EAAA,wBAA0B,0BANhBA,IAAAA,GAAA,CAAA,CAAA,EASZ,MAAMC,EAAsB,CAAC,iBAAiB,EAgBjCC,EAAiC,CAC5C,CACE,KAAM,gBACN,QAAUC,GACDA,aAAiBC,CAE5B,EACA,CACE,KAAM,kBACN,QAAUD,GACDA,aAAiBE,CAE5B,EACA,CACE,KAAM,eACN,QAAUF,GACJ,CAACA,GAAS,OAAOA,GAAU,UAAY,EAAE,SAAUA,GAC9C,GAGFF,EAAoB,SAAUE,EAA2B,IAAI,CACtE,CAEJ"}
|
package/chunks/events.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{g as s}from"./events2.js";function u(n){if(n===void 0){const r=s();return!!(r!=null&&r.isVirtual)}return!!(n!=null&&n.isVirtual)}function o(n){return!n||n.isEmpty}function l(n){var i;if(!n)return null;const r=n.shippingAddresses||[];return r.length===0?null:(i=r[0])==null?void 0:i.selectedShippingMethod}function p(n,r="shipping"){var e;return n?(r==="shipping"?(e=n.shippingAddresses)==null?void 0:e[0]:n.billingAddress)??null:null}function g(n){if(!n)return null;const{selectedPaymentMethod:r}=n;return!r||!(r!=null&&r.code)?null:n.selectedPaymentMethod}export{o as a,p as b,g as c,l as g,u as i};
|
|
4
4
|
//# sourceMappingURL=events.js.map
|
package/chunks/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sources":["/@dropins/storefront-checkout/src/lib/events.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Cart
|
|
1
|
+
{"version":3,"file":"events.js","sources":["/@dropins/storefront-checkout/src/lib/utils/events.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Cart } from '@/checkout/data/models/cart';\nimport { getCheckoutData } from '@/checkout/lib/events';\n\ntype CartData = Cart | null;\n\nexport function isVirtualCart(data?: CartData) {\n if (data === undefined) {\n const latestData = getCheckoutData();\n return Boolean(latestData?.isVirtual);\n }\n return Boolean(data?.isVirtual);\n}\n\nexport function isEmptyCart(data: CartData) {\n return !data || data.isEmpty;\n}\n\nexport function getCartShippingMethod(data: CartData) {\n if (!data) return null;\n const shippingAddresses = data.shippingAddresses || [];\n if (shippingAddresses.length === 0) return null;\n return shippingAddresses[0]?.selectedShippingMethod;\n}\n\nexport function getCartAddress(\n data: CartData,\n type: 'shipping' | 'billing' = 'shipping'\n): Record<string, any> | null {\n if (!data) return null;\n\n const address =\n type === 'shipping' ? data.shippingAddresses?.[0] : data.billingAddress;\n\n return address ?? null;\n}\n\nexport function getCartPaymentMethod(data: CartData) {\n if (!data) return null;\n const { selectedPaymentMethod } = data;\n if (!selectedPaymentMethod || !selectedPaymentMethod?.code) return null;\n\n return data.selectedPaymentMethod;\n}\n"],"names":["isVirtualCart","data","latestData","getCheckoutData","isEmptyCart","getCartShippingMethod","shippingAddresses","_a","getCartAddress","type","getCartPaymentMethod","selectedPaymentMethod"],"mappings":"iCAsBO,SAASA,EAAcC,EAAiB,CAC7C,GAAIA,IAAS,OAAW,CACtB,MAAMC,EAAaC,EAAgB,EAC5B,MAAA,GAAQD,GAAA,MAAAA,EAAY,UAAS,CAE/B,MAAA,GAAQD,GAAA,MAAAA,EAAM,UACvB,CAEO,SAASG,EAAYH,EAAgB,CACnC,MAAA,CAACA,GAAQA,EAAK,OACvB,CAEO,SAASI,EAAsBJ,EAAgB,OAChD,GAAA,CAACA,EAAa,OAAA,KACZ,MAAAK,EAAoBL,EAAK,mBAAqB,CAAC,EACjD,OAAAK,EAAkB,SAAW,EAAU,MACpCC,EAAAD,EAAkB,CAAC,IAAnB,YAAAC,EAAsB,sBAC/B,CAEgB,SAAAC,EACdP,EACAQ,EAA+B,WACH,OACxB,OAACR,GAGHQ,IAAS,YAAaF,EAAAN,EAAK,oBAAL,YAAAM,EAAyB,GAAKN,EAAK,iBAEzC,KALA,IAMpB,CAEO,SAASS,EAAqBT,EAAgB,CAC/C,GAAA,CAACA,EAAa,OAAA,KACZ,KAAA,CAAE,sBAAAU,GAA0BV,EAClC,MAAI,CAACU,GAAyB,EAACA,GAAA,MAAAA,EAAuB,MAAa,KAE5DV,EAAK,qBACd"}
|
package/chunks/events2.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{events as n}from"@dropins/tools/event-bus.js";function u(){return n.lastPayload("checkout/initialized")??null}function i(){return n.lastPayload("checkout/updated")??null}function a(){return i()??u()}function s(){var e;const t=a();return!!((e=t==null?void 0:t.shippingAddresses)!=null&&e.length)}function l(){const t=a();return(t==null?void 0:t.email)??null}export{i as a,l as b,a as g,s as h};
|
|
4
4
|
//# sourceMappingURL=events2.js.map
|
package/chunks/events2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events2.js","sources":["/@dropins/storefront-checkout/src/lib/
|
|
1
|
+
{"version":3,"file":"events2.js","sources":["/@dropins/storefront-checkout/src/lib/events.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport { events } from '@adobe-commerce/event-bus';\n\ntype DataModel = Cart | NegotiableQuote;\n\nexport function getInitialCheckoutData(): DataModel | null {\n return events.lastPayload('checkout/initialized') ?? null;\n}\n\nexport function getLatestCheckoutUpdate(): DataModel | null {\n return events.lastPayload('checkout/updated') ?? null;\n}\n\nexport function getCheckoutData(): DataModel | null {\nreturn getLatestCheckoutUpdate() ?? getInitialCheckoutData();\n}\n\nexport function hasShippingAddress(): boolean {\n const cart = getCheckoutData();\n return !!cart?.shippingAddresses?.length;\n}\n\nexport function getCartEmail(): string | null {\n const cart = getCheckoutData();\n return cart?.email ?? null;\n}\n"],"names":["getInitialCheckoutData","events","getLatestCheckoutUpdate","getCheckoutData","hasShippingAddress","cart","_a","getCartEmail"],"mappings":"qDAsBO,SAASA,GAA2C,CAClD,OAAAC,EAAO,YAAY,sBAAsB,GAAK,IACvD,CAEO,SAASC,GAA4C,CACnD,OAAAD,EAAO,YAAY,kBAAkB,GAAK,IACnD,CAEO,SAASE,GAAoC,CAC7C,OAAAD,KAA6BF,EAAuB,CAC3D,CAEO,SAASI,GAA8B,OAC5C,MAAMC,EAAOF,EAAgB,EACtB,MAAA,CAAC,GAACG,EAAAD,GAAA,YAAAA,EAAM,oBAAN,MAAAC,EAAyB,OACpC,CAEO,SAASC,GAA8B,CAC5C,MAAMF,EAAOF,EAAgB,EAC7B,OAAOE,GAAA,YAAAA,EAAM,QAAS,IACxB"}
|
package/chunks/fetch-graphql.js
CHANGED
|
@@ -10,5 +10,5 @@ import"@dropins/tools/lib.js";import{events as y}from"@dropins/tools/event-bus.j
|
|
|
10
10
|
shopping_cart_display_shipping
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping:u.EXCLUDING_TAX}},re=async()=>await M({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:b,type:"query"}),ne=()=>G.config;function Q(e){switch(e){case 1:return u.EXCLUDING_TAX;case 2:return u.INCLUDING_TAX;case 3:return u.INCLUDING_EXCLUDING_TAX;default:return u.EXCLUDING_TAX}}function b(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:s,shopping_cart_display_shipping:r}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:s,shoppingCartDisplaySetting:{shipping:Q(r)}}}const{setEndpoint:ae,setFetchGraphQlHeader:oe,removeFetchGraphQlHeader:ie,setFetchGraphQlHeaders:ue,fetchGraphQl:P,getConfig:ce}=new S().getMethods();export{F as D,E as I,
|
|
13
|
+
`,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping:u.EXCLUDING_TAX}},re=async()=>await M({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:b,type:"query"}),ne=()=>G.config;function Q(e){switch(e){case 1:return u.EXCLUDING_TAX;case 2:return u.INCLUDING_TAX;case 3:return u.INCLUDING_EXCLUDING_TAX;default:return u.EXCLUDING_TAX}}function b(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:s,shopping_cart_display_shipping:r}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:s,shoppingCartDisplaySetting:{shipping:Q(r)}}}const{setEndpoint:ae,setFetchGraphQlHeader:oe,removeFetchGraphQlHeader:ie,setFetchGraphQlHeaders:ue,fetchGraphQl:P,getConfig:ce}=new S().getMethods();export{F as D,E as I,z as M,w as Q,f as S,u as T,Y as U,ae as a,oe as b,ue as c,M as d,re as e,P as f,ce as g,V as h,ne as i,ee as j,W as k,te as l,B as m,$ as n,se as o,Z as p,K as q,ie as r,G as s,J as t};
|
|
14
14
|
//# sourceMappingURL=fetch-graphql.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{d as r}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const i=e=>!e||!(e!=null&&e.available_credit)||e.available_credit.value==null||!e.available_credit.currency?null:{availableCredit:{value:e.available_credit.value,currency:e.available_credit.currency},exceedLimit:(e==null?void 0:e.exceed_limit)||!1},l=`
|
|
4
|
+
query getCompanyCredit {
|
|
5
|
+
company {
|
|
6
|
+
credit {
|
|
7
|
+
available_credit {
|
|
8
|
+
value
|
|
9
|
+
currency
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`,u=async()=>await r({type:"query",query:l,options:{method:"GET",cache:"no-cache"},path:"company.credit",transformer:i,defaultValueOnFail:null});export{u as g};
|
|
15
|
+
//# sourceMappingURL=getCompanyCredit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCompanyCredit.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-company-credit.ts","/@dropins/storefront-checkout/src/api/getCompanyCredit/graphql/getCompanyCredit.graphql.ts","/@dropins/storefront-checkout/src/api/getCompanyCredit/getCompanyCredit.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CompanyCredit as CompanyCreditModel } from '@/checkout/data/models';\nimport { CompanyCredit as CompanyCreditType } from '@/checkout/__generated__/types';\n\ntype OptionalCompanyCredit = CompanyCreditType | null | undefined;\n\nconst transformCompanyCredit = (data: OptionalCompanyCredit): CompanyCreditModel | null => {\n if (!data || !data?.available_credit || data.available_credit.value == null || !data.available_credit.currency) return null;\n\n const model = {\n availableCredit: {\n value: data.available_credit.value,\n currency: data.available_credit.currency,\n },\n exceedLimit: data?.exceed_limit || false,\n };\n\n return model;\n};\n\nexport { transformCompanyCredit };\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\nexport const getCompanyCreditQuery = /* GraphQL */ `\n query getCompanyCredit {\n company {\n credit {\n available_credit {\n value\n currency\n }\n }\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 { getCompanyCreditQuery } from '@/checkout/api/getCompanyCredit/graphql/getCompanyCredit.graphql';\nimport { CompanyCredit } from '@/checkout/data/models';\nimport { transformCompanyCredit } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\n\nexport const getCompanyCredit = async (): Promise<CompanyCredit | null> => {\n return await dispatchApiCall({\n type: 'query',\n query: getCompanyCreditQuery,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'company.credit',\n transformer: transformCompanyCredit,\n defaultValueOnFail: null,\n });\n};\n"],"names":["transformCompanyCredit","data","getCompanyCreditQuery","getCompanyCredit","dispatchApiCall"],"mappings":"yGAsBA,MAAMA,EAA0BC,GAC1B,CAACA,GAAQ,EAACA,GAAA,MAAAA,EAAM,mBAAoBA,EAAK,iBAAiB,OAAS,MAAQ,CAACA,EAAK,iBAAiB,SAAiB,KAEzG,CACZ,gBAAiB,CACf,MAAOA,EAAK,iBAAiB,MAC7B,SAAUA,EAAK,iBAAiB,QAClC,EACA,aAAaA,GAAA,YAAAA,EAAM,eAAgB,EACrC,ECdWC,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECKtCC,EAAmB,SACvB,MAAMC,EAAgB,CAC3B,KAAM,QACN,MAAOF,EACP,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,iBACN,YAAaF,EACb,mBAAoB,IAAA,CACrB"}
|
package/chunks/guards.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as u,
|
|
3
|
+
import{s as u,M as a}from"./fetch-graphql.js";function p({code:t,...e}){return{code:t,...e}}function f({code:t,...e}){return{code:t,...e}}const d=t=>{if("carrier_code"in t&&"method_code"in t)return t;const e=t,{carrierCode:o,methodCode:r,...n}=e;return{carrier_code:o,method_code:r,...n}};function m(t){return t.map(d)}function i(t){var e;return{fax:t.fax,middlename:t.middleName,prefix:t.prefix,suffix:t.suffix,vat_id:t.vatId,city:t.city,custom_attributes:((e=t.customAttributes)==null?void 0:e.map(o=>({attribute_code:o.code,value:o.value})))||[],company:t.company,country_code:t.countryCode,firstname:t.firstName,lastname:t.lastName,postcode:t.postcode,region:t.region,region_id:t.regionId,save_in_address_book:t.saveInAddressBook,street:t.street,telephone:t.telephone}}function l(t){const{customerAddressId:e,pickupLocationCode:o,address:r}=t,n={};return e?{customer_address_id:e}:(o&&(n.pickup_location_code=o),!o&&r&&(n.address=i(r)),n)}function _(t){const{customerAddressUid:e,address:o}=t,r={};return e?{customer_address_uid:e}:(o&&(r.address=i(o)),r)}function I(t){const{customerAddressId:e,sameAsShipping:o=!1,useForShipping:r=!1,address:n}=t;let s={use_for_shipping:r,same_as_shipping:o};return!o&&e?(s.customer_address_id=e,s):(!o&&n&&(s.address=i(n)),s)}function h(t){const{customerAddressUid:e,sameAsShipping:o=!1,useForShipping:r=!1,address:n}=t;let s={use_for_shipping:r,same_as_shipping:o};return!o&&e?(s.customer_address_uid=e,s):(!o&&n&&(s.address=i(n)),s)}const g=()=>{const{cartId:t,quoteId:e}=u;if(!t&&!e)throw new a};export{p as a,f as b,I as c,h as d,g as e,l as f,_ as g,m as t};
|
|
4
4
|
//# sourceMappingURL=guards.js.map
|
package/chunks/render.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
(function(n,o){try{if(typeof document<"u"){const t=document.createElement("style"),r=o.styleId;for(const e in o.attributes)t.setAttribute(e,o.attributes[e]);t.setAttribute("data-dropin",r),t.appendChild(document.createTextNode(n));const a=document.querySelector('style[data-dropin="sdk"]');if(a)a.after(t);else{const e=document.querySelector('link[rel="stylesheet"], style');e?e.before(t):document.head.append(t)}}}catch(t){console.error("dropin-styles (injectCodeFunction)",t)}})(`.checkout__banner{margin-bottom:var(--spacing-xbig)}
|
|
4
|
+
.checkout-shipping-methods__title,.checkout-shipping-methods__title h3{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-shipping-methods__content{position:relative;display:block}.checkout-shipping-methods__method{margin-bottom:var(--spacing-medium);width:fit-content;cursor:pointer;font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-shipping-methods__method:last-child{margin-bottom:0}.dropin-radio-button__label .dropin-price{color:var(--color-neutral-800);font-weight:400}.checkout-shipping-methods__options--busy{opacity:.4;pointer-events:none}.checkout-shipping-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout-shipping-methods__options--toggleButton{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-shipping-methods__options--toggleButton .dropin-toggle-button__content{justify-content:start;display:grid;grid-template-columns:1fr min-content}.checkout-shipping-methods__options--toggleButton .checkout-shipping-methods__method{margin-bottom:0;width:auto}.checkout-shipping-methods__error{margin-top:var(--spacing-medium)}
|
|
5
|
+
.checkout-place-order{display:grid;padding-bottom:var(--spacing-big)}.checkout-place-order__button{align-self:flex-end;justify-self:flex-end}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-place-order{background-color:var(--color-neutral-200);padding:var(--spacing-medium) var(--spacing-medium) var(--spacing-big) var(--spacing-medium)}.checkout-place-order__button{align-self:center;justify-self:stretch}}
|
|
6
|
+
.checkout-payment-on-account{margin-bottom:var(--spacing-medium)}.checkout-payment-on-account__form{width:100%}.checkout-payment-on-account__credit{display:flex;justify-content:space-between;align-items:center;padding:var(--spacing-small);margin-bottom:var(--spacing-medium);background-color:var(--color-neutral-100);border:1px solid var(--color-neutral-300);border-radius:4px;font-size:14px;line-height:1.4}.checkout-payment-on-account__credit-label{font-weight:500;color:var(--color-neutral-700)}.checkout-payment-on-account__credit-amount{font-weight:600;color:var(--color-success-600)}.checkout-payment-on-account__exceed-message{margin-top:var(--spacing-medium);margin-bottom:var(--spacing-medium)}.checkout-payment-on-account .dropin-field{margin-bottom:0}
|
|
7
|
+
.checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}.checkout-bill-to-shipping-address__error{margin-top:var(--spacing-medium)}
|
|
8
|
+
.checkout-address-validation{display:grid;gap:var(--spacing-medium)}.checkout-address-validation__options--busy{opacity:.4;pointer-events:none}.checkout-address-validation__title{margin-bottom:var(--spacing-small)}.checkout-address-validation__subtitle{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-address-validation__options{display:grid;gap:var(--spacing-xbig);grid-template-columns:1fr 1fr}.checkout-address-validation__option{margin:0}.checkout-address-validation__option-title{margin-bottom:var(--spacing-xsmall)}.checkout-estimate-shipping{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-xxsmall);align-items:center;color:var(--color-neutral-800)}.checkout-estimate-shipping__label,.checkout-estimate-shipping__price{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-estimate-shipping__label--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-estimate-shipping__price--muted{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}.checkout-estimate-shipping__price{text-align:right}.checkout-estimate-shipping__label--bold,.checkout-estimate-shipping__price--bold{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.checkout-estimate-shipping__caption{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-neutral-700)}.cart-order-summary__shipping .dropin-skeleton{grid-template-columns:1fr}.checkout-login-form__heading{display:grid;grid-template-columns:1fr max-content;grid-auto-rows:max-content;margin:0 0 var(--spacing-medium) 0;align-items:center}.checkout-login-form__heading:empty{display:none}.checkout-login-form__content{grid-auto-rows:max-content}.checkout-login-form__content .dropin-field__hint a{font-weight:400}.checkout-login-form__customer-details{display:grid;grid-auto-flow:row;gap:var(--spacing-xxsmall)}.checkout-login-form__customer-name{font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.checkout-login-form__customer-email{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);color:var(--color-neutral-700)}.checkout-login-form__title,.checkout-login-form__title h2{grid-column-start:1;color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0}.checkout-login-form__heading-label,.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:2;color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);justify-self:flex-end}.checkout-login-form__heading-label a,a.checkout-login-form__link{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin-left:var(--spacing-xxsmall)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-login-form__heading{grid-template-columns:1fr;grid-template-rows:1fr}.checkout-login-form__heading-label{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:var(--spacing-medium)}}.checkout-out-of-stock.dropin-card{border-color:var(--color-warning-500)}.checkout-out-of-stock .dropin-card__content{gap:var(--spacing-small);padding:var(--spacing-small)}.checkout-out-of-stock__title{color:var(--color-neutral-900);font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing);margin:0;display:flex;gap:var(--spacing-xxsmall);align-items:center;justify-content:left;text-align:center}.checkout-out-of-stock__message{color:var(--color-neutral-800);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin:0}.checkout-out-of-stock__items{display:grid;grid-template-columns:repeat(5,100px);grid-gap:var(--spacing-small);list-style:none;padding:0;margin:0}.checkout-out-of-stock__item img{width:100%;height:auto}.checkout-out-of-stock__actions{display:flex;gap:var(--spacing-small);justify-content:flex-end}a.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing)}.checkout-out-of-stock__action{color:var(--color-brand-500);font:var(--type-details-caption-1-font);letter-spacing:var(--type-details-caption-1-letter-spacing);background:none;border:none;padding:0;cursor:pointer}.checkout-out-of-stock__action:hover{--textColor: var(--color-brand-700);text-decoration:solid underline var(--textColor);text-underline-offset:6px}@media only screen and (width >= 320px) and (width <= 768px){.checkout-out-of-stock__items{grid-template-columns:repeat(3,100px)}}.checkout-payment-methods__title,.checkout-payment-methods__title h2{color:var(--color-neutral-800);font:var(--type-headline-2-default-font);letter-spacing:var(--type-headline-2-default-letter-spacing);margin:0 0 var(--spacing-medium) 0}.checkout-payment-methods__wrapper{position:relative;display:grid}.checkout-payment-methods__wrapper--busy{opacity:.4;pointer-events:none}.checkout-payment-methods__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.checkout-payment-methods__content{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin-top:var(--spacing-xbig)}.checkout-payment-methods__content>div[data-slot=PaymentMethodSlot]:not(:empty){margin-top:var(--spacing-medium)}.checkout-payment-methods--full-width{grid-template-columns:1fr}.checkout-payment-methods__spinner{margin:0 auto;position:absolute;z-index:999;left:0;right:0;top:calc(50% - (var(--size) / 2));bottom:0}.checkout__content [data-slot=PaymentMethods]:empty{display:none}.checkout-payment-methods__error{margin-top:var(--spacing-medium)}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}.checkout-purchase-order{margin-bottom:var(--spacing-medium)}.checkout-purchase-order__form{width:100%}.checkout-purchase-order .dropin-field{margin-bottom:0}.checkout-server-error{position:relative;text-align:center}.checkout-server-error__icon .error-icon{color:var(--color-alert-500)}.checkout-server-error a{font:var(--type-body-2-strong-font);letter-spacing:var(--type-body-2-strong-letter-spacing)}.checkout-terms-and-conditions{display:grid}.checkout-terms-and-conditions__error{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);color:var(--color-alert-800);text-align:left;margin-top:var(--spacing-xsmall)}.checkout-terms-and-conditions__error:empty{display:none}`,{styleId:"checkout"});
|
|
9
|
+
import{jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{Render as f}from"@dropins/tools/lib.js";import"./fetch-graphql.js";import{events as y}from"@dropins/tools/event-bus.js";import{c as g}from"./synchronizeCheckout.js";import{UIProvider as b}from"@dropins/tools/components.js";import{useState as h,useEffect as p}from"@dropins/tools/preact-hooks.js";function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O=function(r){return E(r)&&!S(r)};function E(e){return!!e&&typeof e=="object"}function S(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||A(e)}var v=typeof Symbol=="function"&&Symbol.for,P=v?Symbol.for("react.element"):60103;function A(e){return e.$$typeof===P}function j(e){return Array.isArray(e)?[]:{}}function o(e,r){return r.clone!==!1&&r.isMergeableObject(e)?i(j(e),e,r):e}function M(e,r,t){return e.concat(r).map(function(a){return o(a,t)})}function x(e,r){if(!r.customMerge)return i;var t=r.customMerge(e);return typeof t=="function"?t:i}function T(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(r){return Object.propertyIsEnumerable.call(e,r)}):[]}function l(e){return Object.keys(e).concat(T(e))}function m(e,r){try{return r in e}catch{return!1}}function I(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function C(e,r,t){var a={};return t.isMergeableObject(e)&&l(e).forEach(function(n){a[n]=o(e[n],t)}),l(r).forEach(function(n){I(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?a[n]=x(n,t)(e[n],r[n],t):a[n]=o(r[n],t))}),a}function i(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||M,t.isMergeableObject=t.isMergeableObject||O,t.cloneUnlessOtherwiseSpecified=o;var a=Array.isArray(r),n=Array.isArray(e),s=a===n;return s?a?t.arrayMerge(e,r,t):C(e,r,t):o(r,t)}i.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(a,n){return i(a,n,t)},{})};var L=i,N=L;const D=w(N),W={AddressValidation:{title:"Verify your address",subtitle:"To ensure accurate delivery, we suggest the changes highlighted below. Please choose which address you would like to use. If neither option is correct, edit your address.",suggestedAddress:"Suggested Address",originalAddress:"Original Address"},BillToShippingAddress:{cartSyncError:"We were unable to save your changes. Please try again later.",title:"Bill to shipping address"},EmptyCart:{button:"Start shopping",title:"Your cart is empty"},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withoutTaxes:"Excluding taxes",withTaxes:"Including taxes"},LoginForm:{account:"Already have an account?",ariaLabel:"Email",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",forFasterCheckout:"for a faster checkout.",signInButton:"Sign in"},floatingLabel:"Email *",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",cartSyncError:"We were unable to save your changes. Please try again later.",placeholder:"Enter your email address",signIn:"Sign In",signOut:"Sign Out",switch:"Do you want to switch account?",title:"Contact details"},MergedCartBanner:{items:{many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal.",one:"1 item from a previous session was added to your cart. Please review your new subtotal."}},OutOfStock:{actions:{removeOutOfStock:"Remove out of stock items",reviewCart:"Review cart"},alert:"Out of stock!",lowInventory:{many:"Only {{count}} left!",one:"Last item!"},message:"The following items are out of stock:",title:"Your cart contains items that are out of stock"},PaymentMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"No payment methods available",title:"Payment"},PaymentOnAccount:{referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number",referenceNumberHint:"",availableCreditLabel:"Available Credit",exceedLimitWarning:"The credit limit is {{creditLimit}}. It will be exceeded by {{exceededAmount}} with this order.",exceedLimitWarningPrefix:"The credit limit is",exceedLimitWarningMiddle:". It will be exceeded by",exceedLimitWarningSuffix:"with this order.",exceedLimitError:"Payment On Account cannot be used for this order because your order amount exceeds your credit amount."},PurchaseOrder:{referenceNumberLabel:"Custom Reference Number",referenceNumberPlaceholder:"Enter custom reference number",referenceNumberHint:""},PlaceOrder:{button:"Place Order"},ServerError:{button:"Try again",contactSupport:"If you continue to have issues, please contact support.",title:"We were unable to process your order",unexpected:"An unexpected error occurred while processing your order. Please try again later."},Quote:{permissionDenied:"You do not have permission to checkout with this quote.",dataError:"We were unable to retrieve the quote data. Please try again later."},ShippingMethods:{cartSyncError:"We were unable to save your changes. Please try again later.",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct.",title:"Shipping options"},Summary:{Edit:"Edit"},TermsAndConditions:{error:"Please accept the Terms and Conditions to continue.",label:"I have read, understand, and accept our <a href='https://www.adobe.com/legal/terms.html' target='_blank'>Terms of Use, Terms of Sales, Privacy Policy, and Return Policy</a>."},title:"Checkout"},R={Checkout:W},_={default:R},k=({children:e})=>{var s;const[r,t]=h(),a=(s=g.getConfig())==null?void 0:s.langDefinitions;p(()=>{const c=y.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{c==null||c.off()}},[r]);const n=D(_,a??{});return d(b,{lang:r,langDefinitions:n,children:e})},q=new f(d(k,{}));export{k as P,q as r};
|
|
10
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sources":["../../node_modules/deepmerge/dist/cjs.js","/@dropins/storefront-checkout/src/render/Provider.tsx","/@dropins/storefront-checkout/src/render/render.tsx"],"sourcesContent":["'use strict';\n\nvar isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction getMergeFunction(key, options) {\n\tif (!options.customMerge) {\n\t\treturn deepmerge\n\t}\n\tvar customMerge = options.customMerge(key);\n\treturn typeof customMerge === 'function' ? customMerge : deepmerge\n}\n\nfunction getEnumerableOwnPropertySymbols(target) {\n\treturn Object.getOwnPropertySymbols\n\t\t? Object.getOwnPropertySymbols(target).filter(function(symbol) {\n\t\t\treturn Object.propertyIsEnumerable.call(target, symbol)\n\t\t})\n\t\t: []\n}\n\nfunction getKeys(target) {\n\treturn Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))\n}\n\nfunction propertyIsOnObject(object, property) {\n\ttry {\n\t\treturn property in object\n\t} catch(_) {\n\t\treturn false\n\t}\n}\n\n// Protects from prototype poisoning and unexpected merging up the prototype chain.\nfunction propertyIsUnsafe(target, key) {\n\treturn propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,\n\t\t&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,\n\t\t\t&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tgetKeys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tgetKeys(source).forEach(function(key) {\n\t\tif (propertyIsUnsafe(target, key)) {\n\t\t\treturn\n\t\t}\n\n\t\tif (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {\n\t\t\tdestination[key] = getMergeFunction(key, options)(target[key], source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\t// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()\n\t// implementations can use it. The caller may not replace it.\n\toptions.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nmodule.exports = deepmerge_1;\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 { config } from '@/checkout/api';\nimport { UIProvider } from '@adobe-commerce/elsie/components';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { deepmerge } from '@adobe-commerce/elsie/lib/deepmerge';\nimport { events } from '@adobe-commerce/event-bus';\nimport { FunctionComponent } from 'preact';\nimport { useEffect, useState } from 'preact/hooks';\n\nimport en_US from '../i18n/en_US.json';\n\n// Langs\nconst langDefinitions = {\n default: en_US,\n};\n\ninterface IntlProviderProps {\n children?: any;\n}\n\nexport const Provider: FunctionComponent<IntlProviderProps> = ({\n children,\n}) => {\n const [locale, setLang] = useState<Lang>();\n\n const userLangDefinitions = config.getConfig()?.langDefinitions;\n\n useEffect(() => {\n const localeEvent = events.on(\n 'locale',\n (payload) => {\n if (payload !== locale) setLang(payload as Lang);\n },\n { eager: true }\n );\n return () => {\n localeEvent?.off();\n };\n }, [locale]);\n\n // Merge language definitions with user language definitions\n const definitions = deepmerge(langDefinitions, userLangDefinitions ?? {});\n\n return (\n <UIProvider lang={locale} langDefinitions={definitions}>\n {children}\n </UIProvider>\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 { Render } from '@adobe-commerce/elsie/lib';\nimport { Provider } from './Provider';\nexport { Provider };\nexport const render = new Render(<Provider />);\n"],"names":["isMergeableObject","value","isNonNullObject","isSpecial","stringValue","isReactElement","canUseSymbol","REACT_ELEMENT_TYPE","emptyTarget","val","cloneUnlessOtherwiseSpecified","options","deepmerge","defaultArrayMerge","target","source","element","getMergeFunction","key","customMerge","getEnumerableOwnPropertySymbols","symbol","getKeys","propertyIsOnObject","object","property","propertyIsUnsafe","mergeObject","destination","sourceIsArray","targetIsArray","sourceAndTargetTypesMatch","array","prev","next","deepmerge_1","cjs","langDefinitions","en_US","Provider","children","locale","setLang","useState","userLangDefinitions","_a","config","useEffect","localeEvent","events","payload","definitions","UIProvider","render","Render","jsx"],"mappings":"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","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as A,NEGOTIABLE_QUOTE_FRAGMENT as I}from"../fragments.js";import{e as g,
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as A,NEGOTIABLE_QUOTE_FRAGMENT as I}from"../fragments.js";import{e as g,c as p,d as c}from"./guards.js";import{t as B,e as m}from"./synchronizeCheckout.js";import{s as r,d as f,Q as C,I as o,l as a}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const Q=`
|
|
4
4
|
mutation setBillingAddress(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$billingAddress: BillingAddressInput!
|
|
@@ -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,l,
|
|
3
|
+
import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m,d as r,q as l,n as u,Q as c}from"./fetch-graphql.js";import{merge as E}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{c as f,t as p}from"./synchronizeCheckout.js";const C=t=>{var i,a,s;if(!t)return null;const e={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(e,(s=(a=(i=f.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:a.transformer)==null?void 0:s.call(a,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
|
|
4
4
|
query getCustomer {
|
|
5
5
|
customer {
|
|
6
6
|
...CUSTOMER_FRAGMENT
|
|
@@ -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 { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { MissingEmail } from '@/checkout/lib/errors';\n\nexport const isEmailAvailable = async (\n email: string\n): Promise<EmailAvailability> => {\n if (!email) throw new MissingEmail();\n\n return await dispatchApiCall({\n options: { method: 'GET', cache: 'no-cache', variables: { email } },\n path: 'isEmailAvailable',\n query: isEmailAvailableQuery,\n transformer: transformEmailAvailability,\n type: 'query',\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setGuestEmailMutation = /* GraphQL */ `\n mutation setGuestEmail($cartId: String!, $email: String!) {\n setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { setGuestEmailMutation } from '@/checkout/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { MissingCart } from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\n\nexport const setGuestEmailOnCart = async (email: string) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n return await dispatchApiCall({\n options: { variables: { cartId, email } },\n path: 'setGuestEmailOnCart.cart',\n query: setGuestEmailMutation,\n queueName: QueueName.Updates,\n transformer: transformCart,\n type: 'mutation',\n });\n};\n"],"names":["transformCustomer","data","model","merge","_c","_b","_a","config","transformEmailAvailability","getCustomerQuery","CUSTOMER_FRAGMENT","getCustomer","state","dispatchApiCall","isEmailAvailableQuery","isEmailAvailable","email","MissingEmail","setGuestEmailMutation","CHECKOUT_DATA_FRAGMENT","setGuestEmailOnCart","cartId","MissingCart","QueueName","transformCart"],"mappings":"oRAwBA,MAAMA,EAAqBC,GAAyC,WAC9D,GAAA,CAACA,EAAa,OAAA,KAElB,MAAMC,EAAQ,CACZ,UAAWD,EAAK,WAAa,GAC7B,SAAUA,EAAK,UAAY,GAC3B,MAAOA,EAAK,OAAS,EACvB,EAGO,OAAAE,EACLD,GACAE,GAAAC,GAAAC,EAAAC,EAAO,UAAU,EAAE,SAAnB,YAAAD,EAA2B,gBAA3B,YAAAD,EAA0C,cAA1C,YAAAD,EAAA,KAAAC,EAAwDJ,EAC1D,CACF,EClBMO,EACJP,GAEO,GAAQA,GAAA,MAAAA,EAAM,oBCJVQ,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAO1CC,CAAiB;AAAA,ECHRC,EAAc,SACpBC,EAAM,cAEJ,MAAMC,EAAgB,CAC3B,QAAS,CAAE,OAAQ,MAAO,MAAO,UAAW,EAC5C,KAAM,WACN,MAAOJ,EACP,YAAaT,EACb,KAAM,OAAA,CACP,EARgC,KCPtBc,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMtCC,EAAmB,MAC9BC,GAC+B,CAC/B,GAAI,CAACA,EAAa,MAAA,IAAIC,EAEtB,OAAO,MAAMJ,EAAgB,CAC3B,QAAS,CAAE,OAAQ,MAAO,MAAO,WAAY,UAAW,CAAE,MAAAG,EAAQ,EAClE,KAAM,mBACN,MAAOF,EACP,YAAaN,EACb,KAAM,OAAA,CACP,CACH,EChBaU,EAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAS/CC,CAAsB;AAAA,ECJbC,EAAsB,MAAOJ,GAAkB,CAC1D,MAAMK,EAAST,EAAM,OAErB,GAAI,CAACS,EAAc,MAAA,IAAIC,EAEvB,OAAO,MAAMT,EAAgB,CAC3B,QAAS,CAAE,UAAW,CAAE,OAAAQ,EAAQ,MAAAL,EAAQ,EACxC,KAAM,2BACN,MAAOE,EACP,UAAWK,EAAU,QACrB,YAAaC,EACb,KAAM,UAAA,CACP,CACH"}
|
|
1
|
+
{"version":3,"file":"setGuestEmailOnCart.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-customer.ts","/@dropins/storefront-checkout/src/data/transforms/transform-email-availability.ts","/@dropins/storefront-checkout/src/api/getCustomer/graphql/getCustomer.graphql.ts","/@dropins/storefront-checkout/src/api/getCustomer/getCustomer.ts","/@dropins/storefront-checkout/src/api/isEmailAvailable/graphql/isEmailAvailable.graphql.ts","/@dropins/storefront-checkout/src/api/isEmailAvailable/isEmailAvailable.ts","/@dropins/storefront-checkout/src/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql.ts","/@dropins/storefront-checkout/src/api/setGuestEmailOnCart/setGuestEmailOnCart.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { config } from '@/checkout/api';\nimport { Customer as CustomerModel } from '@/checkout/data/models';\nimport { GetCustomerQuery } from '@/checkout/__generated__/types';\nimport { merge } from '@adobe-commerce/elsie/lib';\n\ntype Customer = GetCustomerQuery['customer'];\n\nconst transformCustomer = (data: Customer): CustomerModel | null => {\n if (!data) return null;\n\n const model = {\n firstName: data.firstname || '',\n lastName: data.lastname || '',\n email: data.email || '',\n };\n\n // Extend the model merging custom transformer, if provided\n return merge(\n model, // default transformer\n config.getConfig().models?.CustomerModel?.transformer?.(data) // custom transformer\n );\n};\n\nexport { Customer, transformCustomer };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { IsEmailAvailableQuery } from '@/checkout/__generated__/types';\nimport { EmailAvailability } from '@/checkout/data/models';\n\nconst transformEmailAvailability = (\n data: IsEmailAvailableQuery['isEmailAvailable']\n): EmailAvailability => {\n return Boolean(data?.is_email_available);\n};\n\nexport { transformEmailAvailability };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CUSTOMER_FRAGMENT } from '@/checkout/api/graphql/CustomerFragment.graphql';\n\nexport const getCustomerQuery = /* GraphQL */ `\n query getCustomer {\n customer {\n ...CUSTOMER_FRAGMENT\n }\n }\n\n ${CUSTOMER_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getCustomerQuery } from '@/checkout/api/getCustomer/graphql/getCustomer.graphql';\nimport { Customer } from '@/checkout/data/models';\nimport { transformCustomer } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { state } from '@/checkout/lib/state';\n\nexport const getCustomer = async (): Promise<Customer | null> => {\n if (!state.authenticated) return null;\n\n return await dispatchApiCall({\n options: { method: 'GET', cache: 'no-cache' },\n path: 'customer',\n query: getCustomerQuery,\n transformer: transformCustomer,\n type: 'query',\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const isEmailAvailableQuery = /* GraphQL */ `\n query isEmailAvailable($email: String!) {\n isEmailAvailable(email: $email) {\n is_email_available\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { isEmailAvailableQuery } from '@/checkout/api/isEmailAvailable/graphql/isEmailAvailable.graphql';\nimport { EmailAvailability } from '@/checkout/data/models/email-availability';\nimport { transformEmailAvailability } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { MissingEmail } from '@/checkout/lib/errors';\n\nexport const isEmailAvailable = async (\n email: string\n): Promise<EmailAvailability> => {\n if (!email) throw new MissingEmail();\n\n return await dispatchApiCall({\n options: { method: 'GET', cache: 'no-cache', variables: { email } },\n path: 'isEmailAvailable',\n query: isEmailAvailableQuery,\n transformer: transformEmailAvailability,\n type: 'query',\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setGuestEmailMutation = /* GraphQL */ `\n mutation setGuestEmail($cartId: String!, $email: String!) {\n setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { setGuestEmailMutation } from '@/checkout/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib/dispatchApiCall';\nimport { QueueName } from '@/checkout/lib/enqueueRequest';\nimport { MissingCart } from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\n\nexport const setGuestEmailOnCart = async (email: string) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n return await dispatchApiCall({\n options: { variables: { cartId, email } },\n path: 'setGuestEmailOnCart.cart',\n query: setGuestEmailMutation,\n queueName: QueueName.Updates,\n transformer: transformCart,\n type: 'mutation',\n });\n};\n"],"names":["transformCustomer","data","model","merge","_c","_b","_a","config","transformEmailAvailability","getCustomerQuery","CUSTOMER_FRAGMENT","getCustomer","state","dispatchApiCall","isEmailAvailableQuery","isEmailAvailable","email","MissingEmail","setGuestEmailMutation","CHECKOUT_DATA_FRAGMENT","setGuestEmailOnCart","cartId","MissingCart","QueueName","transformCart"],"mappings":"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,QACrB,YAAaC,EACb,KAAM,UAAA,CACP,CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as o,
|
|
3
|
+
import{s as o,n as G,o as D,d as q,Q as E,I as l,p as Q}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import{t as F,a as O}from"./transform-shipping-estimate.js";import{a as R}from"./transform-shipping-methods.js";import{events as $}from"@dropins/tools/event-bus.js";import{g as N}from"./values.js";import{c as w,t as x,e as H}from"./synchronizeCheckout.js";import{e as V,f as K,g as L}from"./guards.js";import{CHECKOUT_DATA_FRAGMENT as y,NEGOTIABLE_QUOTE_FRAGMENT as B}from"../fragments.js";const k=`
|
|
4
4
|
mutation estimateShippingMethods(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$address: EstimateAddressInput!
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as r,NEGOTIABLE_QUOTE_FRAGMENT as h}from"../fragments.js";import{e as d,t as u}from"./guards.js";import{t as
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as r,NEGOTIABLE_QUOTE_FRAGMENT as h}from"../fragments.js";import{e as d,t as u}from"./guards.js";import{t as g,e as M}from"./synchronizeCheckout.js";import{s as e,j as m,d as c,Q as I}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";const S=`
|
|
4
4
|
mutation setShippingMethodsOnCart(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$shippingMethods: [ShippingMethodInput]!
|
|
@@ -30,5 +30,5 @@ import{CHECKOUT_DATA_FRAGMENT as r,NEGOTIABLE_QUOTE_FRAGMENT as h}from"../fragme
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
${h}
|
|
33
|
-
`,o=(t,s,i,n,p)=>async a=>await c({type:"mutation",query:i,queueName:I.Updates,options:{variables:{[s]:t,shippingMethods:u(a)}},path:p,transformer:n}),C=t=>{if(!Array.isArray(t)||t.length===0)throw new m},Q=async t=>(d(),C(t),await(!!e.cartId?o(e.cartId,"cartId",S,
|
|
33
|
+
`,o=(t,s,i,n,p)=>async a=>await c({type:"mutation",query:i,queueName:I.Updates,options:{variables:{[s]:t,shippingMethods:u(a)}},path:p,transformer:n}),C=t=>{if(!Array.isArray(t)||t.length===0)throw new m},Q=async t=>(d(),C(t),await(!!e.cartId?o(e.cartId,"cartId",S,g,"setShippingMethodsOnCart.cart"):o(e.quoteId,"quoteId",A,M,"setNegotiableQuoteShippingMethods.quote"))(t));export{Q as s};
|
|
34
34
|
//# sourceMappingURL=setShippingMethods.js.map
|