@dropins/storefront-checkout 2.0.1 → 2.1.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fragments.d.ts +4 -1
- package/api/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/{errors → api/getCompanyCredit}/index.d.ts +1 -1
- package/api/getNegotiableQuote/getNegotiableQuote.d.ts +22 -0
- package/api/getNegotiableQuote/graphql/getNegotiableQuote.graphql.d.ts +18 -0
- package/api/getNegotiableQuote/graphql/index.d.ts +18 -0
- package/{signals → api/getNegotiableQuote}/index.d.ts +2 -2
- package/api/getStoreConfig/getStoreConfig.d.ts +1 -0
- package/api/graphql/CartAddressFragment.graphql.d.ts +2 -2
- package/api/graphql/NegotiableQuoteAddressFragment.graphql.d.ts +19 -0
- package/api/graphql/NegotiableQuoteFragment.graphql.d.ts +18 -0
- package/api/graphql/{CartPaymentMethodFragment.graphql.d.ts → PaymentMethodFragment.graphql.d.ts} +2 -2
- package/api/graphql/ShippingMethodFragment.graphql.d.ts +19 -0
- package/api/index.d.ts +2 -2
- package/api/initialize/initialize.d.ts +21 -3
- package/api/initialize/listeners.d.ts +3 -17
- package/api/initializeCheckout/initializeCheckout.d.ts +2 -2
- package/api/setBillingAddress/graphql/index.d.ts +19 -0
- package/api/{setPaymentMethod/graphql/setPaymentMethod.graphql.d.ts → setBillingAddress/graphql/setBillingAddressOnCartMutation.graphql.d.ts} +2 -2
- package/api/setBillingAddress/graphql/setBillingAddressOnQuoteMutation.graphql.d.ts +18 -0
- package/api/setBillingAddress/setBillingAddress.d.ts +2 -2
- package/api/setPaymentMethod/graphql/index.d.ts +19 -0
- package/api/{setBillingAddress/graphql/setBillingAddress.graphql.d.ts → setPaymentMethod/graphql/setPaymentMethodOnCart.graphql.d.ts} +2 -2
- package/api/setPaymentMethod/graphql/setPaymentMethodOnQuote.graphql.d.ts +18 -0
- package/api/setPaymentMethod/setPaymentMethod.d.ts +2 -2
- package/api/setShippingAddress/graphql/index.d.ts +21 -0
- package/api/setShippingAddress/graphql/{setShippingAddressAndUseAsBilling.graphql.d.ts → setShippingAddressOnCartAndUseAsBillingMutation.graphql.d.ts} +2 -2
- package/api/setShippingAddress/graphql/{setShippingAddress.graphql.d.ts → setShippingAddressOnCartMutation.graphql.d.ts} +2 -2
- package/api/setShippingAddress/graphql/setShippingAddressOnQuote.graphql.d.ts +18 -0
- package/api/setShippingAddress/graphql/setShippingAddressOnQuoteAndUseAsBillingMutation.graphql.d.ts +18 -0
- package/api/setShippingAddress/setShippingAddress.d.ts +1 -1
- package/api/setShippingMethods/graphql/index.d.ts +19 -0
- package/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.d.ts +1 -1
- package/api/setShippingMethods/graphql/setShippingMethodsOnQuote.graphql.d.ts +18 -0
- package/api/setShippingMethods/index.d.ts +1 -0
- package/api/setShippingMethods/setShippingMethods.d.ts +3 -17
- package/api/synchronizeCheckout/synchronizeCheckout.d.ts +2 -2
- package/api.js +2 -66
- package/api.js.map +1 -1
- package/chunks/ConditionalWrapper.js +1 -1
- package/chunks/ConditionalWrapper.js.map +1 -1
- package/chunks/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/checkout.js.map +1 -1
- package/chunks/classifiers.js +4 -0
- package/chunks/classifiers.js.map +1 -0
- package/chunks/dom.js.map +1 -1
- package/chunks/events.js +4 -0
- package/chunks/events.js.map +1 -0
- package/chunks/events2.js +4 -0
- package/chunks/events2.js.map +1 -0
- package/chunks/fetch-graphql.js +14 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/getCompanyCredit.js +15 -0
- package/chunks/getCompanyCredit.js.map +1 -0
- package/chunks/guards.js +4 -0
- package/chunks/guards.js.map +1 -0
- package/chunks/render.js +10 -0
- package/chunks/render.js.map +1 -0
- package/chunks/setBillingAddress.js +25 -5
- package/chunks/setBillingAddress.js.map +1 -1
- package/chunks/setGuestEmailOnCart.js +3 -3
- package/chunks/setGuestEmailOnCart.js.map +1 -1
- package/chunks/setPaymentMethod.js +21 -6
- package/chunks/setPaymentMethod.js.map +1 -1
- package/chunks/setShippingAddress.js +109 -0
- package/chunks/setShippingAddress.js.map +1 -0
- package/chunks/setShippingMethods.js +19 -4
- package/chunks/setShippingMethods.js.map +1 -1
- package/chunks/synchronizeCheckout.js +13 -5
- package/chunks/synchronizeCheckout.js.map +1 -1
- package/chunks/transform-shipping-estimate.js +4 -0
- package/chunks/transform-shipping-estimate.js.map +1 -0
- package/chunks/transform-shipping-methods.js +4 -0
- package/chunks/transform-shipping-methods.js.map +1 -0
- package/chunks/values.js +1 -1
- package/chunks/values.js.map +1 -1
- package/components/AddressValidation/AddressValidation.d.ts +14 -0
- package/components/AddressValidation/index.d.ts +19 -0
- package/components/PaymentMethods/PaymentMethods.d.ts +1 -1
- package/components/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/ShippingMethods/ShippingMethods.d.ts +1 -1
- package/components/index.d.ts +4 -1
- package/containers/AddressValidation/AddressValidation.d.ts +12 -0
- package/containers/AddressValidation/index.d.ts +19 -0
- package/containers/AddressValidation.d.ts +3 -0
- package/containers/AddressValidation.js +4 -0
- package/containers/AddressValidation.js.map +1 -0
- package/containers/BillToShippingAddress.js +1 -1
- package/containers/BillToShippingAddress.js.map +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/EstimateShipping.js.map +1 -1
- package/containers/LoginForm/LoginForm.d.ts +1 -1
- package/containers/LoginForm.js +1 -1
- package/containers/LoginForm.js.map +1 -1
- package/containers/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 +9 -8
- 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/PlaceOrder.d.ts +2 -1
- 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/ShippingMethods.d.ts +2 -2
- package/containers/ShippingMethods.js +1 -1
- package/containers/ShippingMethods.js.map +1 -1
- package/containers/TermsAndConditions.js +1 -1
- package/containers/TermsAndConditions.js.map +1 -1
- package/containers/index.d.ts +3 -0
- package/data/models/address.d.ts +11 -6
- package/data/models/api.d.ts +23 -10
- package/data/models/cart.d.ts +7 -7
- package/data/models/checkout.d.ts +14 -0
- package/data/models/company-credit.d.ts +7 -0
- package/data/models/country.d.ts +1 -1
- package/data/models/index.d.ts +3 -1
- package/data/models/{price.d.ts → money.d.ts} +2 -2
- package/data/models/payment-method.d.ts +2 -0
- package/data/models/quote.d.ts +16 -0
- package/data/models/shipping-estimate.d.ts +4 -4
- package/data/models/shipping-method.d.ts +4 -4
- package/data/models/values.d.ts +1 -1
- package/data/transforms/index.d.ts +9 -1
- package/data/transforms/transform-api.d.ts +12 -0
- package/data/transforms/{transform-address.d.ts → transform-cart-address.d.ts} +41 -43
- package/data/transforms/transform-cart.d.ts +1 -1
- package/data/transforms/transform-company-credit.d.ts +7 -0
- package/data/transforms/transform-country.d.ts +8 -0
- package/data/transforms/transform-custom-attributes.d.ts +5 -0
- package/data/transforms/transform-negotiable-quote.d.ts +7 -0
- package/data/transforms/transform-payment-methods.d.ts +1 -1
- package/data/transforms/transform-quote-address.d.ts +90 -0
- package/data/transforms/transform-region.d.ts +8 -0
- package/fragments.js +180 -70
- package/fragments.js.map +1 -1
- package/i18n/en_US.json.d.ts +26 -0
- package/lib/enqueueRequest.d.ts +2 -2
- package/lib/errors/classifiers.d.ts +38 -0
- package/lib/errors/customErrors.d.ts +42 -0
- package/lib/errors/index.d.ts +20 -0
- package/lib/errors/mapErrorToCode.d.ts +4 -0
- package/lib/events.d.ts +3 -2
- package/lib/guards.d.ts +18 -0
- package/lib/index.d.ts +2 -2
- package/lib/state.d.ts +5 -3
- package/lib/utils/api.d.ts +16 -0
- package/lib/utils/events.d.ts +10 -0
- package/lib/utils/forms.d.ts +5 -0
- package/lib/utils/fragments.d.ts +19 -0
- package/lib/utils/index.d.ts +24 -0
- package/lib/utils/meta.d.ts +19 -0
- package/lib/utils/transformers.d.ts +6 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +4 -0
- package/lib/utils.js.map +1 -0
- package/package.json +1 -1
- package/render.js +4 -4
- package/render.js.map +1 -1
- package/tests/constants.d.ts +1 -0
- package/tests/fixtures/fragments/cart.d.ts +47 -42
- package/tests/fixtures/fragments/shipping-address.d.ts +2 -1
- package/tests/fixtures/helpers/session-storage.d.ts +68 -0
- package/tests/fixtures/index.d.ts +1 -0
- package/tests/fixtures/models/index.d.ts +1 -1
- package/tests/fixtures/models/quote.d.ts +9 -0
- package/tests/fixtures/queries/get-company-credit.d.ts +14 -0
- package/tests/fixtures/queries/index.d.ts +1 -0
- package/types/api.d.ts +6 -0
- package/types/{TitleProps.d.ts → components.d.ts} +2 -1
- package/types/guards.d.ts +5 -0
- package/types/index.d.ts +22 -0
- package/types/storefront.d.ts +165 -0
- package/types/utils.d.ts +19 -0
- package/chunks/ServerErrorSignal.js +0 -4
- package/chunks/ServerErrorSignal.js.map +0 -1
- package/chunks/errors.js +0 -14
- package/chunks/errors.js.map +0 -1
- package/errors/errors.d.ts +0 -30
- package/lib/network-error.d.ts +0 -22
- package/signals/ServerErrorSignal.d.ts +0 -18
- package/types/ComponentTypes.d.ts +0 -18
- /package/lib/{dom.d.ts → utils/dom.d.ts} +0 -0
package/api.js
CHANGED
|
@@ -1,32 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
4
|
-
mutation estimateShippingMethods(
|
|
5
|
-
$cartId: String!
|
|
6
|
-
$address: EstimateAddressInput!
|
|
7
|
-
) {
|
|
8
|
-
estimateShippingMethods(input: { cart_id: $cartId, address: $address }) {
|
|
9
|
-
carrier_title
|
|
10
|
-
carrier_code
|
|
11
|
-
method_title
|
|
12
|
-
method_code
|
|
13
|
-
available
|
|
14
|
-
amount {
|
|
15
|
-
currency
|
|
16
|
-
value
|
|
17
|
-
}
|
|
18
|
-
price_excl_tax {
|
|
19
|
-
currency
|
|
20
|
-
value
|
|
21
|
-
}
|
|
22
|
-
price_incl_tax {
|
|
23
|
-
currency
|
|
24
|
-
value
|
|
25
|
-
}
|
|
26
|
-
error_message
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
`,D=t=>t?t.filter(e=>!!e).map(e=>({id:e.agreement_id,name:e.name,mode:w[e.mode],text:e.checkbox_text,content:{value:e.content,html:e.is_html,height:e.content_height??null}})):[],W=async t=>{var m,l,_,u;const e=h.cartId,a=((m=t==null?void 0:t.criteria)==null?void 0:m.country_code)??((l=h.config)==null?void 0:l.defaultCountry);if(!e)throw new E;if(!a)throw new U;const{region_id:s,region_name:p,zip:n}=(t==null?void 0:t.criteria)??{},i=s||p?{region_id:typeof s=="string"?parseInt(s,10):s,region_code:p}:void 0,d={country_code:a,...n&&{postcode:n},...i&&{region:{...i.region_id&&{region_id:i.region_id},...i.region_code&&{region_code:i.region_code}}}},c={country_id:a,region:(_=d.region)==null?void 0:_.region_code,region_id:(u=d.region)==null?void 0:u.region_id,postcode:n},y=S(c);return g({options:{variables:{cartId:e,address:d}},path:"estimateShippingMethods",query:k,queueName:M.ShippingEstimate,transformer:v,type:"mutation"}).then(r=>{const O=r.length>0,x=S(c);let A=null;if(O){const o=I("selectedShippingMethod"),G=r.find(f=>f.code===(o==null?void 0:o.code)&&f.carrier.code===(o==null?void 0:o.carrier.code));A=F(G??r[0])}return C.emit("shipping/estimate",{address:x,availableShippingMethods:r,shippingMethod:A,success:!0}),r}).catch(r=>{throw C.emit("shipping/estimate",{address:y,shippingMethod:null,availableShippingMethods:[],success:!1}),r})},H=`
|
|
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=`
|
|
30
4
|
query GET_CHECKOUT_AGREEMENTS {
|
|
31
5
|
checkoutAgreements {
|
|
32
6
|
agreement_id
|
|
@@ -38,43 +12,5 @@ import{t as v,a as N,b as $}from"./chunks/synchronizeCheckout.js";import{d as se
|
|
|
38
12
|
name
|
|
39
13
|
}
|
|
40
14
|
}
|
|
41
|
-
`,
|
|
42
|
-
mutation setShippingAddress(
|
|
43
|
-
$cartId: String!
|
|
44
|
-
$shippingAddressInput: ShippingAddressInput!
|
|
45
|
-
) {
|
|
46
|
-
setShippingAddressesOnCart(
|
|
47
|
-
input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }
|
|
48
|
-
) {
|
|
49
|
-
cart {
|
|
50
|
-
...CHECKOUT_DATA_FRAGMENT
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
${T}
|
|
56
|
-
`,B=`
|
|
57
|
-
mutation SET_SHIPPING_ADDRESS_ON_CART_AND_USE_AS_BILLING_MUTATION(
|
|
58
|
-
$cartId: String!
|
|
59
|
-
$shippingAddressInput: ShippingAddressInput!
|
|
60
|
-
) {
|
|
61
|
-
setShippingAddressesOnCart(
|
|
62
|
-
input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }
|
|
63
|
-
) {
|
|
64
|
-
cart {
|
|
65
|
-
id
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
setBillingAddressOnCart(
|
|
70
|
-
input: { cart_id: $cartId, billing_address: { same_as_shipping: true } }
|
|
71
|
-
) {
|
|
72
|
-
cart {
|
|
73
|
-
...CHECKOUT_DATA_FRAGMENT
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
${T}
|
|
79
|
-
`,Z=async({address:t,customerAddressId:e,pickupLocationCode:a})=>{const s=h.cartId;if(!s)throw new E;const p=()=>{if(e)return{customer_address_id:e};if(a)return{pickup_location_code:a};if(!t)throw new b;return{address:N(t)}},n=I("isBillToShipping"),i=n?B:R,d=n?"setBillingAddressOnCart.cart":"setShippingAddressesOnCart.cart",c={cartId:s,shippingAddressInput:p()};return await g({type:"mutation",query:i,options:{variables:c},path:d,queueName:M.CartUpdate,transformer:$})};export{ce as DEFAULT_COUNTRY,he as FetchError,ge as InvalidArgument,me as MissingBillingAddress,E as MissingCart,U as MissingCountry,le as MissingEmail,_e as MissingPaymentMethod,b as MissingShippinghAddress,ue as STORE_CONFIG_DEFAULTS,Ae as UnexpectedError,se as authenticateCustomer,ie as config,W as estimateShippingMethods,fe as fetchGraphQl,re as getCart,X as getCheckoutAgreements,Se as getConfig,ve as getCustomer,Ce as getStoreConfig,Ee as getStoreConfigCache,ae as initialize,ne as initializeCheckout,Ne as isEmailAvailable,Me as removeFetchGraphQlHeader,oe as resetCheckout,be as setBillingAddress,Ie as setEndpoint,Te as setFetchGraphQlHeader,ye as setFetchGraphQlHeaders,$e as setGuestEmailOnCart,we as setPaymentMethod,Z as setShippingAddress,xe as setShippingMethodsOnCart,de as synchronizeCheckout};
|
|
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};
|
|
80
16
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-checkout/src/api/estimateShippingMethods/graphql/estimateShippingMethods.graphql.ts","/@dropins/storefront-checkout/src/data/transforms/transform-checkout-agreements.ts","/@dropins/storefront-checkout/src/api/estimateShippingMethods/estimateShippingMethods.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/graphql/getCheckoutAgreements.graphql.ts","/@dropins/storefront-checkout/src/api/getCheckoutAgreements/getCheckoutAgreements.ts","/@dropins/storefront-checkout/src/api/setShippingAddress/graphql/setShippingAddress.graphql.ts","/@dropins/storefront-checkout/src/api/setShippingAddress/graphql/setShippingAddressAndUseAsBilling.graphql.ts","/@dropins/storefront-checkout/src/api/setShippingAddress/setShippingAddress.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const estimateShippingMethodsMutation = /* GraphQL */ `\n mutation estimateShippingMethods(\n $cartId: String!\n $address: EstimateAddressInput!\n ) {\n estimateShippingMethods(input: { cart_id: $cartId, address: $address }) {\n carrier_title\n carrier_code\n method_title\n method_code\n available\n amount {\n currency\n value\n }\n price_excl_tax {\n currency\n value\n }\n price_incl_tax {\n currency\n value\n }\n error_message\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n AgreementMode,\n CheckoutAgreement as CheckoutAgreementModel,\n} from '@/checkout/data/models';\nimport { Get_Checkout_AgreementsQuery } from '@/checkout/__generated__/types';\n\ntype CheckoutAgreements = Get_Checkout_AgreementsQuery['checkoutAgreements'];\ntype FilteredAgreement = NonNullable<NonNullable<CheckoutAgreements>[0]>;\n\nexport const transformCheckoutAgreements = (\n data: CheckoutAgreements\n): CheckoutAgreementModel[] => {\n if (!data) return [];\n\n return data\n .filter((agreement): agreement is FilteredAgreement => !!agreement)\n .map((agreement) => ({\n id: agreement.agreement_id,\n name: agreement.name,\n mode: AgreementMode[agreement.mode],\n text: agreement.checkbox_text,\n content: {\n value: agreement.content,\n html: agreement.is_html,\n height: agreement.content_height ?? null,\n },\n }));\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { MissingCart, MissingCountry } from '@/checkout/api';\nimport { estimateShippingMethodsMutation } from '@/checkout/api/estimateShippingMethods/graphql';\nimport { ShippingMethod } from '@/checkout/data/models';\nimport {\n transformShippingEstimatePartialAddress,\n transformShippingEstimateShippingMethod,\n transformShippingMethods,\n} from '@/checkout/data/transforms';\nimport { dispatchApiCall, getValue, QueueName, state } from '@/checkout/lib';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport interface ShippingEstimationCriteria {\n country_code: string;\n region_name?: string;\n region_id?: string | number;\n zip?: string;\n}\n\nexport type EstimateShippingInput = {\n criteria: ShippingEstimationCriteria;\n};\n\nexport const estimateShippingMethods = async (\n input?: EstimateShippingInput\n): Promise<ShippingMethod[] | undefined> => {\n const cartId = state.cartId;\n const countryCode =\n input?.criteria?.country_code ?? state.config?.defaultCountry;\n\n if (!cartId) throw new MissingCart();\n if (!countryCode) throw new MissingCountry();\n\n const { region_id, region_name, zip } = input?.criteria ?? {};\n\n // Process region information\n const region =\n region_id || region_name\n ? {\n region_id:\n typeof region_id === 'string' ? parseInt(region_id, 10) : region_id,\n region_code: region_name,\n }\n : undefined;\n\n // Build address for API call\n const address = {\n country_code: countryCode,\n ...(zip && { postcode: zip }),\n ...(region && {\n region: {\n ...(region.region_id && { region_id: region.region_id }),\n ...(region.region_code && { region_code: region.region_code }),\n },\n }),\n };\n\n // Create address data for transformation\n const estimateShippingAddressData = {\n country_id: countryCode,\n region: address.region?.region_code,\n region_id: address.region?.region_id,\n postcode: zip,\n };\n\n const partialAddress = transformShippingEstimatePartialAddress(\n estimateShippingAddressData\n );\n\n return dispatchApiCall({\n options: { variables: { cartId, address } },\n path: 'estimateShippingMethods',\n query: estimateShippingMethodsMutation,\n queueName: QueueName.ShippingEstimate,\n transformer: transformShippingMethods,\n type: 'mutation',\n })\n .then((estimation) => {\n const hasAvailableOptions = estimation.length > 0;\n const partialAddress = transformShippingEstimatePartialAddress(\n estimateShippingAddressData\n );\n\n let shippingMethod = null;\n\n if (hasAvailableOptions) {\n const userSelection = getValue('selectedShippingMethod');\n\n const selection = estimation.find(\n (method) =>\n method.code === userSelection?.code &&\n method.carrier.code === userSelection?.carrier.code\n );\n\n shippingMethod = transformShippingEstimateShippingMethod(\n selection ?? estimation[0]\n );\n }\n\n events.emit('shipping/estimate', {\n address: partialAddress,\n availableShippingMethods: estimation,\n shippingMethod,\n success: true,\n });\n\n return estimation;\n })\n .catch((error) => {\n events.emit('shipping/estimate', {\n address: partialAddress,\n shippingMethod: null,\n availableShippingMethods: [],\n success: false,\n });\n\n throw error;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CHECKOUT_AGREEMENTS = /* GraphQL */ `\n query GET_CHECKOUT_AGREEMENTS {\n checkoutAgreements {\n agreement_id\n checkbox_text\n content\n content_height\n is_html\n mode\n name\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CheckoutAgreement } from '@/checkout/data/models';\nimport { transformCheckoutAgreements } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib';\nimport { GET_CHECKOUT_AGREEMENTS } from './graphql/getCheckoutAgreements.graphql';\n\nexport const getCheckoutAgreements = async (): Promise<CheckoutAgreement[]> => {\n return await dispatchApiCall({\n defaultValueOnFail: [],\n options: { method: 'GET', cache: 'no-cache' },\n path: 'checkoutAgreements',\n query: GET_CHECKOUT_AGREEMENTS,\n transformer: transformCheckoutAgreements,\n type: 'query',\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setShippingAddressMutation = /* GraphQL */ `\n mutation setShippingAddress(\n $cartId: String!\n $shippingAddressInput: ShippingAddressInput!\n ) {\n setShippingAddressesOnCart(\n input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }\n ) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { CHECKOUT_DATA_FRAGMENT } from '@/checkout/api/graphql/CheckoutDataFragment.graphql';\n\nexport const setShippingAddressAndUseAsBillingMutation = /* GraphQL */ `\n mutation SET_SHIPPING_ADDRESS_ON_CART_AND_USE_AS_BILLING_MUTATION(\n $cartId: String!\n $shippingAddressInput: ShippingAddressInput!\n ) {\n setShippingAddressesOnCart(\n input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }\n ) {\n cart {\n id\n }\n }\n\n setBillingAddressOnCart(\n input: { cart_id: $cartId, billing_address: { same_as_shipping: true } }\n ) {\n cart {\n ...CHECKOUT_DATA_FRAGMENT\n }\n }\n }\n\n ${CHECKOUT_DATA_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { setShippingAddressMutation } from '@/checkout/api/setShippingAddress/graphql/setShippingAddress.graphql';\nimport { ShippingAddressInput as ShippingAddressInputModel } from '@/checkout/data/models';\nimport { transformCart } from '@/checkout/data/transforms';\nimport { transformCartAddressModelToInput } from '@/checkout/data/transforms/transform-address';\nimport { MissingCart, MissingShippinghAddress } from '@/checkout/errors';\nimport { dispatchApiCall, getValue, QueueName, state } from '@/checkout/lib';\nimport { ShippingAddressInput } from '@/checkout/__generated__/types';\nimport { setShippingAddressAndUseAsBillingMutation } from './graphql/setShippingAddressAndUseAsBilling.graphql';\n\nexport const setShippingAddress = async ({\n address,\n customerAddressId,\n pickupLocationCode,\n}: ShippingAddressInputModel) => {\n const cartId = state.cartId;\n\n if (!cartId) throw new MissingCart();\n\n const shippingAddressInput = (): ShippingAddressInput => {\n if (customerAddressId) {\n return { customer_address_id: customerAddressId };\n }\n if (pickupLocationCode) {\n return { pickup_location_code: pickupLocationCode };\n }\n if (!address) {\n throw new MissingShippinghAddress();\n }\n return { address: transformCartAddressModelToInput(address) };\n };\n\n const isBillToShipping = getValue('isBillToShipping');\n\n const query = isBillToShipping\n ? setShippingAddressAndUseAsBillingMutation\n : setShippingAddressMutation;\n\n const path = isBillToShipping\n ? 'setBillingAddressOnCart.cart'\n : 'setShippingAddressesOnCart.cart';\n\n const variables = {\n cartId,\n shippingAddressInput: shippingAddressInput(),\n };\n\n return await dispatchApiCall({\n type: 'mutation',\n query,\n options: { variables },\n path,\n queueName: QueueName.CartUpdate,\n transformer: transformCart,\n });\n};\n"],"names":["estimateShippingMethodsMutation","transformCheckoutAgreements","data","agreement","AgreementMode","estimateShippingMethods","input","cartId","state","countryCode","_a","_b","MissingCart","MissingCountry","region_id","region_name","zip","region","address","estimateShippingAddressData","_c","_d","partialAddress","transformShippingEstimatePartialAddress","dispatchApiCall","QueueName","transformShippingMethods","estimation","hasAvailableOptions","shippingMethod","userSelection","getValue","selection","method","transformShippingEstimateShippingMethod","events","error","GET_CHECKOUT_AGREEMENTS","getCheckoutAgreements","setShippingAddressMutation","CHECKOUT_DATA_FRAGMENT","setShippingAddressAndUseAsBillingMutation","setShippingAddress","customerAddressId","pickupLocationCode","shippingAddressInput","MissingShippinghAddress","transformCartAddressModelToInput","isBillToShipping","query","path","variables","transformCart"],"mappings":"88BAiBa,MAAAA,EAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECShDC,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,ECURE,EAA0B,MACrCC,GAC0C,aAC1C,MAAMC,EAASC,EAAM,OACfC,IACJC,EAAAJ,GAAA,YAAAA,EAAO,WAAP,YAAAI,EAAiB,iBAAgBC,EAAAH,EAAM,SAAN,YAAAG,EAAc,gBAEjD,GAAI,CAACJ,EAAc,MAAA,IAAIK,EACvB,GAAI,CAACH,EAAmB,MAAA,IAAII,EAE5B,KAAM,CAAE,UAAAC,EAAW,YAAAC,EAAa,IAAAC,IAAQV,GAAA,YAAAA,EAAO,WAAY,CAAC,EAGtDW,EACJH,GAAaC,EACT,CACE,UACE,OAAOD,GAAc,SAAW,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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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{jsxs as a,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";function l(r,t){return function(e){const{initialized:i=!0,visible:n=!0,...s}=e;return a("div",{className:"conditional-wrapper",children:[n&&!i&&o(t,{}),n&&i&&o(r,{...s})]})}}export{l as W};
|
|
4
4
|
//# sourceMappingURL=ConditionalWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionalWrapper.js","sources":["/@dropins/storefront-checkout/src/
|
|
1
|
+
{"version":3,"file":"ConditionalWrapper.js","sources":["/@dropins/storefront-checkout/src/components/ConditionalWrapper/ConditionalWrapper.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\n\nexport interface ConditionalProps {\n initialized?: boolean;\n visible?: boolean;\n}\n\nexport function WithConditionals<P extends object>(\n Component: FunctionComponent<P>,\n Skeleton: FunctionComponent\n): FunctionComponent<P & ConditionalProps> {\n return function ConditionalWrapper(props: P & ConditionalProps) {\n const { initialized = true, visible = true, ...componentProps } = props;\n\n return (\n <div className=\"conditional-wrapper\">\n {visible && !initialized && <Skeleton />}\n {visible && initialized && <Component {...(componentProps as P)} />}\n </div>\n );\n };\n}\n"],"names":["WithConditionals","Component","Skeleton","props","initialized","visible","componentProps","jsxs","jsx"],"mappings":"qEAwBgB,SAAAA,EACdC,EACAC,EACyC,CAClC,OAAA,SAA4BC,EAA6B,CAC9D,KAAM,CAAE,YAAAC,EAAc,GAAM,QAAAC,EAAU,GAAM,GAAGC,GAAmBH,EAGhE,OAAAI,EAAC,MAAI,CAAA,UAAU,sBACZ,SAAA,CAAWF,GAAA,CAACD,GAAeI,EAACN,EAAS,CAAA,CAAA,EACrCG,GAAWD,GAAgBI,EAAAP,EAAA,CAAW,GAAIK,CAAsB,CAAA,CAAA,EACnE,CAEJ,CACF"}
|
|
@@ -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":"slBAoBO,MAAMA,EAA8C,IAEvDC,EAACC,EAAS,CAAA,cAAY,8BACpB,SAAA,CAAAC,EAACC,EAAY,CAAA,UAAW,GAAM,KAAK,SAAS,EAC3CD,EAAAC,EAAA,CAAY,UAAW,GAAM,KAAK,QAAS,CAAA,CAAA,EAC9C,ECcEC,EAAsE,CAAC,CAC3E,UAAAC,EACA,gBAAAC,EAAkB,GAClB,wBAAAC,EACA,sBAAAC,EACA,c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qC,EAAU,IAAM,CACd,MAAMC,EAAaC,EAAO,GACxB,YACAT,EACA,CAAE,MAAO,EAAK,CAChB,EAEA,MAAO,IAAM,CACXQ,GAAA,MAAAA,EAAY,KACd,CAAA,EACC,CAACR,CAAc,CAAC,EAEnBO,EAAU,IAAM,CACTT,GAEYY,EAAA,EACd,KAAMC,GAAW,CAChBhB,EAAiBgB,CAAM,CAAA,CACxB,EACA,MAAOC,GAAU,CACR,QAAA,MAAM,kCAAmCA,CAAK,EACtDjB,EAAiB,IAAI,CAAA,CACtB,EACA,QAAQ,IAAM,CACbF,EAAiB,EAAI,CAAA,CACtB,CAAA,EACF,CAACK,CAAe,CAAC,EAGlBlC,EAAC,MAAK,CAAA,GAAGS,EACP,SAAAT,EAACE,EAAA,CACC,WAAAM,EACA,cAAAD,EACA,YAAaqB,EACb,gBAAAxB,EACA,sBAAuBsC,EACvB,wBAAyBH,CAAA,CAAA,EAE7B,CAEJ"}
|
|
@@ -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"}
|
package/chunks/checkout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.js","sources":["/@dropins/storefront-checkout/src/data/models/checkout.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport enum AgreementMode {\n MANUAL = 'manual',\n AUTO = 'auto',\n}\n\ntype AgreementContent = {\n value: string;\n html: boolean;\n height: string | null;\n};\n\nexport interface CheckoutAgreement {\n content: AgreementContent;\n id: number;\n mode: AgreementMode;\n name: string;\n text: string;\n}\n"],"names":["AgreementMode"],"mappings":"AAiBY,IAAAA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"checkout.js","sources":["/@dropins/storefront-checkout/src/data/models/checkout.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport enum AgreementMode {\n MANUAL = 'manual',\n AUTO = 'auto',\n}\n\ntype AgreementContent = {\n value: string;\n html: boolean;\n height: string | null;\n};\n\nexport interface CheckoutAgreement {\n content: AgreementContent;\n id: number;\n mode: AgreementMode;\n name: string;\n text: string;\n}\n\nexport interface CheckoutError {\n /**\n * The primary, user-friendly error message. This should be safe to display\n * directly in the UI.\n * @example \"Your card was declined.\"\n */\n message: string;\n\n /**\n * An optional, unique error code for programmatic handling. This allows the\n * ServerError component to show specific icons, links, or actions.\n * @example \"payment_intent_declined\"\n */\n code?: string;\n}\n"],"names":["AgreementMode"],"mappings":"AAiBY,IAAAA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OAFGA,IAAAA,GAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,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/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sources":["/@dropins/storefront-checkout/src/lib/dom.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport function scrollToElement(element: HTMLElement) {\n element.focus();\n\n // If element is not focusable, scroll manually\n if (document.activeElement !== element) {\n element.scrollIntoView({ behavior: 'smooth' });\n }\n}\n"],"names":["scrollToElement","element"],"mappings":"AAiBO,SAASA,EAAgBC,EAAsB,CACpDA,EAAQ,MAAM,EAGV,SAAS,gBAAkBA,GAC7BA,EAAQ,eAAe,CAAE,SAAU,QAAA,CAAU,CAEjD"}
|
|
1
|
+
{"version":3,"file":"dom.js","sources":["/@dropins/storefront-checkout/src/lib/utils/dom.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport function scrollToElement(element: HTMLElement) {\n element.focus();\n\n // If element is not focusable, scroll manually\n if (document.activeElement !== element) {\n element.scrollIntoView({ behavior: 'smooth' });\n }\n}\n"],"names":["scrollToElement","element"],"mappings":"AAiBO,SAASA,EAAgBC,EAAsB,CACpDA,EAAQ,MAAM,EAGV,SAAS,gBAAkBA,GAC7BA,EAAQ,eAAe,CAAE,SAAU,QAAA,CAAU,CAEjD"}
|
package/chunks/events.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{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
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{events as n}from"@dropins/tools/event-bus.js";function u(){return n.lastPayload("checkout/initialized")??null}function i(){return n.lastPayload("checkout/updated")??null}function a(){return i()??u()}function s(){var e;const t=a();return!!((e=t==null?void 0:t.shippingAddresses)!=null&&e.length)}function l(){const t=a();return(t==null?void 0:t.email)??null}export{i as a,l as b,a as g,s as h};
|
|
4
|
+
//# sourceMappingURL=events2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import"@dropins/tools/lib.js";import{events as y}from"@dropins/tools/event-bus.js";import{signal as D,computed as m}from"@dropins/tools/signals.js";import{FetchGraphQL as S}from"@dropins/tools/fetch-graphql.js";const U={authenticated:!1,cartId:null,config:null,initialized:!1,quoteId:null},G=new Proxy(U,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}});var u=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(u||{}),w=(e=>(e.Updates="updates",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(w||{});const d=new Map,g=new Map,c=D(new Set),I=new Map;I.set("updates",e=>{y.emit("checkout/updated",e)});async function A(e){g.set(e,!0);const t=d.get(e);let s;for(;t.length>0;){const i=t.shift();try{const n=await i.requestFn();i.resolve(n),s=n}catch(n){i.reject(n)}}g.set(e,!1);const r=new Set(c.value);r.delete(e),c.value=r;const o=I.get(e);o&&s&&o(s)}function q(e,t="default"){d.has(t)||d.set(t,[]);const s=d.get(t),r=new Promise((i,n)=>{s.push({requestFn:e,resolve:i,reject:n})}),o=new Set(c.value);return o.add(t),c.value=o,g.get(t)||A(t),r}const V=m(()=>c.value.has("updates")),B=m(()=>c.value.has("shippingEstimate")),X=["sender_email","recipient_email"];function v(e){return e.filter(t=>!t.path||!X.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}class T extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class E extends Error{constructor(t){super(t),this.name="InvalidInput"}}class a extends E{constructor(t){super(`${t} is required.`)}}class $ extends a{constructor(){super("Cart ID")}}class z extends E{constructor(){super("Either Cart ID or Quote ID is required.")}}class Y extends Error{constructor(){super("User is not authenticated")}}class J extends a{constructor(){super("Negotiable Quote ID")}}class K extends a{constructor(){super("Email")}}class W extends a{constructor(){super("Payment method code")}}class Z extends a{constructor(){super("Shipping address")}}class ee extends a{constructor(){super("Shipping method")}}class te extends a{constructor(){super("Billing address")}}class se extends a{constructor(){super("Country Code")}}function L(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}async function M(e){const{defaultValueOnFail:t,options:s,path:r,query:o,queueName:i,transformer:n,type:p}=e;try{const l=async()=>{const{data:N,errors:_}=await P(o,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...s});if(_){const C=v(_);if(C.length>0)throw new T(C)}let h=L(N,r);if(h===void 0)throw new Error(`No data found at path: ${r}`);return n?n(h):h};return p==="mutation"?await q(l,i):await l()}catch(l){if(t!==void 0)return t;throw l}}const x=`
|
|
4
|
+
query getStoreConfig {
|
|
5
|
+
storeConfig {
|
|
6
|
+
default_country
|
|
7
|
+
is_checkout_agreements_enabled
|
|
8
|
+
is_guest_checkout_enabled
|
|
9
|
+
is_one_page_checkout_enabled
|
|
10
|
+
shopping_cart_display_shipping
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping: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
|
+
//# sourceMappingURL=fetch-graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-graphql.js","sources":["/@dropins/storefront-checkout/src/lib/state.ts","/@dropins/storefront-checkout/src/data/models/store-config.ts","/@dropins/storefront-checkout/src/lib/enqueueRequest.ts","/@dropins/storefront-checkout/src/lib/filterControlledErrors.ts","/@dropins/storefront-checkout/src/lib/errors/customErrors.ts","/@dropins/storefront-checkout/src/lib/dispatchApiCall.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-checkout/src/data/transforms/transform-store-config.ts","/@dropins/storefront-checkout/src/api/fetch-graphql/fetch-graphql.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfig } from '@/checkout/data/models';\n\ntype State = {\n authenticated: boolean;\n cartId?: string | null;\n config: StoreConfig | null;\n initialized: boolean;\n quoteId?: string | null;\n};\n\nconst _state: State = (() => ({\n authenticated: false,\n cartId: null,\n config: null,\n initialized: false,\n quoteId: null,\n}))();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n // @ts-ignore\n target[key] = value;\n return true;\n },\n get(target, key) {\n return target[key as keyof State];\n },\n});\n\nexport function isQuoteCheckout(): boolean {\n return state.quoteId !== null;\n}\n\nexport function isCartCheckout(): boolean {\n return state.cartId !== null;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport enum TaxDisplay {\n EXCLUDING_TAX = 'EXCLUDING_TAX',\n INCLUDING_EXCLUDING_TAX = 'INCLUDING_AND_EXCLUDING_TAX',\n INCLUDING_TAX = 'INCLUDING_TAX',\n}\n\nexport interface StoreConfig {\n defaultCountry: string;\n agreementsEnabled: boolean;\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay;\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Cart, NegotiableQuote } from '@/checkout/data/models';\nimport {\n computed,\n ReadonlySignal,\n signal,\n} from '@adobe-commerce/elsie/lib/signals';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QueueName {\n Updates = 'updates',\n Default = 'default',\n ShippingEstimate = 'shippingEstimate',\n}\n\ntype Request<T> = () => Promise<T>;\ntype QueueCompletedHandler<T> = (result: T) => void;\n\ninterface QueuedRequest<T> {\n requestFn: Request<T>;\n resolve: (value: T) => void;\n reject: (error: any) => void;\n}\n\nconst queues = new Map<QueueName, QueuedRequest<any>[]>();\nconst processing = new Map<QueueName, boolean>();\nconst pendingRequests = signal<Set<QueueName>>(new Set());\nconst onQueueCompleted = new Map<QueueName, QueueCompletedHandler<any>>();\n\nonQueueCompleted.set(\n QueueName.Updates,\n (latestResult: Cart | NegotiableQuote) => {\n events.emit('checkout/updated', latestResult);\n }\n);\n\nasync function processQueue(type: QueueName): Promise<void> {\n processing.set(type, true);\n\n const queue = queues.get(type)!;\n let latestSuccessResult: any;\n\n while (queue.length > 0) {\n const request = queue.shift()!;\n\n try {\n const result = await request.requestFn();\n request.resolve(result);\n latestSuccessResult = result;\n } catch (error) {\n request.reject(error);\n }\n }\n\n processing.set(type, false);\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.delete(type);\n pendingRequests.value = pendingSet;\n\n const handler = onQueueCompleted.get(type);\n\n if (handler && latestSuccessResult) {\n handler(latestSuccessResult);\n }\n}\n\nexport function enqueueRequest<T>(\n requestFn: Request<T>,\n name: QueueName = QueueName.Default\n): Promise<T> {\n if (!queues.has(name)) {\n queues.set(name, []);\n }\n\n const queue = queues.get(name)!;\n\n const promise = new Promise<T>((resolve, reject) => {\n queue.push({ requestFn, resolve, reject });\n });\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.add(name);\n pendingRequests.value = pendingSet;\n\n if (!processing.get(name)) {\n processQueue(name);\n }\n\n return promise;\n}\n\nexport const hasPendingUpdates: ReadonlySignal<boolean> = computed(() => {\n return pendingRequests.value.has(QueueName.Updates);\n});\n\nexport const hasPendingShippingEstimate: ReadonlySignal<boolean> = computed(\n () => {\n return pendingRequests.value.has(QueueName.ShippingEstimate);\n }\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\ntype ErrorPath = (string | number)[];\n\nexport type ErrorWithPath = FetchQueryError[number] & {\n path?: ErrorPath;\n};\n\nconst controlledErrorProps: string[] = ['sender_email', 'recipient_email'];\n\n/**\n * Filters out errors with known paths from a list of errors generated by a GraphQL query.\n *\n * Known issue: The query does not differentiate between physical and virtual gift cards, leading\n * to errors for physical ones as they don't have 'sender_email' and 'recipient_email' properties.\n *\n * @param {ErrorWithPath[]} errors - Array of errors to be filtered.\n * @return {ErrorWithPath[]} Uncontrolled (unexpected) errors not matching predefined paths.\n */\n\nexport function filterControlledErrors(errors: ErrorWithPath[]) {\n return errors.filter(\n (error) =>\n !error.path ||\n !controlledErrorProps.some((controlledErrorProp) => {\n return error.path?.at(-1) === controlledErrorProp;\n })\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\nexport class FetchError extends Error {\n constructor(reasons: FetchQueryError) {\n super(reasons.map((e: any) => e.message).join(' '));\n this.name = 'FetchError';\n }\n}\n\nexport class InvalidInput extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidInput';\n }\n}\n\nexport class MissingArgument extends InvalidInput {\n constructor(argumentName: string) {\n super(`${argumentName} is required.`);\n }\n}\n\nexport class MissingCart extends MissingArgument {\n constructor() {\n super('Cart ID');\n }\n}\n\nexport class MissingCartAndQuote extends InvalidInput {\n constructor() {\n super('Either Cart ID or Quote ID is required.');\n }\n}\n\nexport class Unauthenticated extends Error {\n constructor() {\n super('User is not authenticated');\n }\n}\n\nexport class MissingNegotiableQuoteId extends MissingArgument {\n constructor() {\n super('Negotiable Quote ID');\n }\n}\n\nexport class MissingEmail extends MissingArgument {\n constructor() {\n super('Email');\n }\n}\n\nexport class MissingPaymentMethod extends MissingArgument {\n constructor() {\n super('Payment method code');\n }\n}\n\nexport class MissingShippingAddress extends MissingArgument {\n constructor() {\n super('Shipping address');\n }\n}\n\nexport class MissingShippingMethod extends MissingArgument {\n constructor() {\n super('Shipping method');\n }\n}\n\nexport class MissingBillingAddress extends MissingArgument {\n constructor() {\n super('Billing address');\n }\n}\n\nexport class MissingCountry extends MissingArgument {\n constructor() {\n super('Country Code');\n }\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl, FetchOptions, FetchQueryError } from '@/checkout/api';\nimport { enqueueRequest, QueueName } from '@/checkout/lib/enqueueRequest';\nimport { filterControlledErrors } from '@/checkout/lib/filterControlledErrors';\nimport { FetchError } from '@/checkout/lib/errors';\n\ntype DispatchApiCallParams<T> = {\n defaultValueOnFail?: T;\n options?: FetchOptions;\n path: string;\n query: string;\n queueName?: QueueName;\n transformer?: (data: any) => T;\n type: 'query' | 'mutation';\n};\n\nexport function getValueAtPath(obj: any, path: string) {\n return path\n .split('.')\n .reduce(\n (acc, part) => (acc && acc[part] !== undefined ? acc[part] : undefined),\n obj\n );\n}\n\nasync function dispatchApiCall<T>(\n params: DispatchApiCallParams<T>\n): Promise<T> {\n const {\n defaultValueOnFail,\n options,\n path,\n query,\n queueName,\n transformer,\n type,\n } = params;\n\n try {\n const processApiCall = async () => {\n const { data, errors } = await fetchGraphQl<T>(query, {\n method: type === 'query' ? 'GET' : 'POST',\n cache: type === 'query' ? 'no-cache' : undefined,\n ...options,\n });\n\n if (errors) {\n const uncontrolledErrors = filterControlledErrors(errors);\n\n if (uncontrolledErrors.length > 0) {\n throw new FetchError(uncontrolledErrors as FetchQueryError);\n }\n }\n\n let result = getValueAtPath(data, path);\n\n if (result === undefined) {\n throw new Error(`No data found at path: ${path}`);\n }\n\n return transformer ? transformer(result) : result;\n };\n\n // Execute the API call, either directly or through the queue\n const result =\n type === 'mutation'\n ? await enqueueRequest<T>(processApiCall, queueName)\n : await processApiCall();\n\n return result;\n } catch (error: any) {\n if (defaultValueOnFail !== undefined) return defaultValueOnFail;\n throw error;\n }\n}\n\nexport { dispatchApiCall };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getStoreConfigQuery = /* GraphQL */ `\n query getStoreConfig {\n storeConfig {\n default_country\n is_checkout_agreements_enabled\n is_guest_checkout_enabled\n is_one_page_checkout_enabled\n shopping_cart_display_shipping\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfig, TaxDisplay } from '@/checkout/data/models';\nimport { transformStoreConfig } from '@/checkout/data/transforms';\nimport { dispatchApiCall, state } from '@/checkout/lib';\nimport { getStoreConfigQuery } from './graphql/getStoreConfig.graphql';\n\nexport const DEFAULT_COUNTRY = 'US';\n\nexport const STORE_CONFIG_DEFAULTS: StoreConfig = {\n defaultCountry: DEFAULT_COUNTRY,\n agreementsEnabled: true,\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay.EXCLUDING_TAX,\n },\n};\n\nexport const getStoreConfig = async () => {\n return await dispatchApiCall({\n defaultValueOnFail: STORE_CONFIG_DEFAULTS,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'storeConfig',\n query: getStoreConfigQuery,\n transformer: transformStoreConfig,\n type: 'query',\n });\n};\n\nexport const getStoreConfigCache = () => state.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GetStoreConfigQuery } from '@/checkout/__generated__/types';\nimport { STORE_CONFIG_DEFAULTS } from '@/checkout/api/getStoreConfig';\nimport { StoreConfig, TaxDisplay } from '@/checkout/data/models';\n\nexport function transformTaxDisplay(data: number | null | undefined) {\n switch (data) {\n case 1:\n return TaxDisplay.EXCLUDING_TAX;\n case 2:\n return TaxDisplay.INCLUDING_TAX;\n case 3:\n return TaxDisplay.INCLUDING_EXCLUDING_TAX;\n default:\n return TaxDisplay.EXCLUDING_TAX;\n }\n}\n\nexport function transformStoreConfig(\n data: GetStoreConfigQuery['storeConfig']\n): StoreConfig {\n if (!data) return STORE_CONFIG_DEFAULTS;\n\n const {\n default_country,\n is_checkout_agreements_enabled,\n shopping_cart_display_shipping,\n } = data;\n\n return {\n defaultCountry: default_country || STORE_CONFIG_DEFAULTS.defaultCountry,\n agreementsEnabled: is_checkout_agreements_enabled,\n shoppingCartDisplaySetting: {\n shipping: transformTaxDisplay(shopping_cart_display_shipping),\n },\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n\nexport type {\n FetchOptions,\n FetchQueryError,\n} from '@adobe-commerce/fetch-graphql';\n"],"names":["_state","state","target","key","value","TaxDisplay","QueueName","queues","processing","pendingRequests","signal","onQueueCompleted","latestResult","events","processQueue","type","queue","latestSuccessResult","request","result","error","pendingSet","handler","enqueueRequest","requestFn","name","promise","resolve","reject","hasPendingUpdates","computed","hasPendingShippingEstimate","controlledErrorProps","filterControlledErrors","errors","controlledErrorProp","_a","FetchError","reasons","e","InvalidInput","message","MissingArgument","argumentName","MissingCart","MissingCartAndQuote","Unauthenticated","MissingNegotiableQuoteId","MissingEmail","MissingPaymentMethod","MissingShippingAddress","MissingShippingMethod","MissingBillingAddress","MissingCountry","getValueAtPath","obj","path","acc","part","dispatchApiCall","params","defaultValueOnFail","options","query","queueName","transformer","processApiCall","data","fetchGraphQl","uncontrolledErrors","getStoreConfigQuery","DEFAULT_COUNTRY","STORE_CONFIG_DEFAULTS","getStoreConfig","transformStoreConfig","getStoreConfigCache","transformTaxDisplay","default_country","is_checkout_agreements_enabled","shopping_cart_display_shipping","setEndpoint","setFet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,GACA,uBAAAC,GACA,aAAAf,EACA,UAAAgB,EACF,EAAI,IAAIC,EAAa,EAAE,WAAW"}
|
|
@@ -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
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
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
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sources":["/@dropins/storefront-checkout/src/data/transforms/transform-api.ts","/@dropins/storefront-checkout/src/lib/guards.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n AddressInput as AddressInputModel,\n BillingAddressInput as BillingAddressInputModel,\n PaymentMethodInput as PaymentMethodInputModel,\n ShippingAddressInput as ShippingAddressInputModel,\n ShippingMethodInput as ShippingMethodInputModel,\n} from '@/checkout/data/models/api';\n\nimport {\n BillingAddressInput,\n NegotiableQuoteBillingAddressInput,\n NegotiableQuotePaymentMethodInput,\n NegotiableQuoteShippingAddressInput,\n PaymentMethodInput,\n ShippingAddressInput,\n ShippingMethodInput,\n} from '@/checkout/__generated__/types';\n\nexport function transformPaymentMethodInputModelToCartInput({\n code,\n ...additionalData\n}: PaymentMethodInputModel): PaymentMethodInput {\n return {\n code,\n ...additionalData,\n };\n}\n\nexport function transformPaymentMethodInputModelToQuoteInput({\n code,\n ...additionalData\n}: PaymentMethodInputModel): NegotiableQuotePaymentMethodInput {\n return {\n code,\n ...additionalData,\n };\n}\n\nexport const transformShippingMethodInput = (\n input: ShippingMethodInputModel | ShippingMethodInput\n): ShippingMethodInput => {\n if ('carrier_code' in input && 'method_code' in input) {\n return input as ShippingMethodInput;\n }\n\n // Transform from model format to GraphQL format\n const modelInput = input as ShippingMethodInputModel;\n\n const { carrierCode, methodCode, ...additionalData } = modelInput;\n\n return {\n carrier_code: carrierCode,\n method_code: methodCode,\n ...additionalData,\n };\n};\n\nexport function transformShippingMethodsInputModel(\n input: Array<ShippingMethodInputModel | ShippingMethodInput>\n): Array<ShippingMethodInput> {\n return input.map(transformShippingMethodInput);\n}\n\nfunction transformAddressInputModel(address: AddressInputModel) {\n return {\n fax: address.fax,\n middlename: address.middleName,\n prefix: address.prefix,\n suffix: address.suffix,\n vat_id: address.vatId,\n city: address.city,\n custom_attributes:\n address.customAttributes?.map((attribute: any) => ({\n attribute_code: attribute.code,\n value: attribute.value,\n })) || [],\n company: address.company,\n country_code: address.countryCode,\n firstname: address.firstName,\n lastname: address.lastName,\n postcode: address.postcode,\n region: address.region,\n region_id: address.regionId,\n save_in_address_book: address.saveInAddressBook,\n street: address.street,\n telephone: address.telephone,\n };\n}\n\nexport function transformShippingAddressInputModelToCartInput(\n input: ShippingAddressInputModel\n): ShippingAddressInput {\n const { customerAddressId, pickupLocationCode, address } = input;\n\n const result: ShippingAddressInput = {};\n\n if (customerAddressId) {\n return { customer_address_id: customerAddressId };\n }\n\n if (pickupLocationCode) {\n result.pickup_location_code = pickupLocationCode;\n }\n\n if (!pickupLocationCode && address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n\nexport function transformShippingAddressInputModelToQuoteInput(\n input: ShippingAddressInputModel\n): NegotiableQuoteShippingAddressInput {\n const { customerAddressUid, address } = input;\n\n const result: NegotiableQuoteShippingAddressInput = {};\n\n if (customerAddressUid) {\n return { customer_address_uid: customerAddressUid };\n }\n\n if (address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n\nexport function transformBillingAddressInputModelToCartInput(\n input: BillingAddressInputModel\n): BillingAddressInput {\n const {\n customerAddressId,\n sameAsShipping = false,\n useForShipping = false,\n address,\n } = input;\n\n let result: BillingAddressInput = {\n use_for_shipping: useForShipping,\n same_as_shipping: sameAsShipping,\n };\n\n if (!sameAsShipping && customerAddressId) {\n result.customer_address_id = customerAddressId;\n return result;\n }\n\n if (!sameAsShipping && address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n\nexport function transformBillingAddressInputModelToQuoteInput(\n input: BillingAddressInputModel\n): NegotiableQuoteBillingAddressInput {\n const {\n customerAddressUid,\n sameAsShipping = false,\n useForShipping = false,\n address,\n } = input;\n\n let result: NegotiableQuoteBillingAddressInput = {\n use_for_shipping: useForShipping,\n same_as_shipping: sameAsShipping,\n };\n\n if (!sameAsShipping && customerAddressUid) {\n result.customer_address_uid = customerAddressUid;\n return result;\n }\n\n if (!sameAsShipping && address) {\n result.address = transformAddressInputModel(address);\n }\n\n return result;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { MissingCartAndQuote } from '@/checkout/lib/errors';\nimport { state } from '@/checkout/lib/state';\n\nexport const ensureHasCartOrQuoteId = () => {\n const { cartId, quoteId } = state;\n if (!cartId && !quoteId) throw new MissingCartAndQuote();\n};\n"],"names":["transformPaymentMethodInputModelToCartInput","code","additionalData","transformPaymentMethodInputModelToQuoteInput","transformShippingMethodInput","input","modelInput","carrierCode","methodCode","transformShippingMethodsInputModel","transformAddressInputModel","address","_a","attribute","transformShippingAddressInputModelToCartInput","customerAddressId","pickupLocationCode","result","transformShippingAddressInputModelToQuoteInput","customerAddressUid","transformBillingAddressInputModelToCartInput","sameAsShipping","useForShipping","transformBillingAddressInputModelToQuoteInput","ensureHasCartOrQuoteId","cartId","quoteId","state","MissingCartAndQuote"],"mappings":"8CAmCO,SAASA,EAA4C,CAC1D,KAAAC,EACA,GAAGC,CACL,EAAgD,CACvC,MAAA,CACL,KAAAD,EACA,GAAGC,CACL,CACF,CAEO,SAASC,EAA6C,CAC3D,KAAAF,EACA,GAAGC,CACL,EAA+D,CACtD,MAAA,CACL,KAAAD,EACA,GAAGC,CACL,CACF,CAEa,MAAAE,EACXC,GACwB,CACpB,GAAA,iBAAkBA,GAAS,gBAAiBA,EACvC,OAAAA,EAIT,MAAMC,EAAaD,EAEb,CAAE,YAAAE,EAAa,WAAAC,EAAY,GAAGN,CAAmB,EAAAI,EAEhD,MAAA,CACL,aAAcC,EACd,YAAaC,EACb,GAAGN,CACL,CACF,EAEO,SAASO,EACdJ,EAC4B,CACrB,OAAAA,EAAM,IAAID,CAA4B,CAC/C,CAEA,SAASM,EAA2BC,EAA4B,OACvD,MAAA,CACL,IAAKA,EAAQ,IACb,WAAYA,EAAQ,WACpB,OAAQA,EAAQ,OAChB,OAAQA,EAAQ,OAChB,OAAQA,EAAQ,MAChB,KAAMA,EAAQ,KACd,oBACEC,EAAAD,EAAQ,mBAAR,YAAAC,EAA0B,IAAKC,IAAoB,CACjD,eAAgBA,EAAU,KAC1B,MAAOA,EAAU,KACnB,MAAO,CAAC,EACV,QAASF,EAAQ,QACjB,aAAcA,EAAQ,YACtB,UAAWA,EAAQ,UACn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,CACpC,KAAA,CAAE,OAAAC,EAAQ,QAAAC,CAAA,EAAYC,EAC5B,GAAI,CAACF,GAAU,CAACC,EAAS,MAAM,IAAIE,CACrC"}
|
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":"8cAEA,IAAIA,EAAoB,SAA2BC,EAAO,CACzD,OAAOC,EAAgBD,CAAK,GACxB,CAACE,EAAUF,CAAK,CACrB,EAEA,SAASC,EAAgBD,EAAO,CAC/B,MAAO,CAAC,CAACA,GAAS,OAAOA,GAAU,QACpC,CAEA,SAASE,EAAUF,EAAO,CACzB,IAAIG,EAAc,OAAO,UAAU,SAAS,KAAKH,CAAK,EAEtD,OAAOG,IAAgB,mBACnBA,IAAgB,iBAChBC,EAAeJ,CAAK,CACzB,CAGA,IAAIK,EAAe,OAAO,QAAW,YAAc,OAAO,IACtDC,EAAqBD,EAAe,OAAO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