@dropins/storefront-checkout 1.0.0 → 1.2.0
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/initialize/initialize.d.ts +1 -2
- package/{containers/ShippingMethods/hooks/useShippingEstimateEventEmitter.d.ts → api/setShippingAddress/graphql/setShippingAddressAndUseAsBilling.graphql.d.ts} +2 -3
- package/api/setShippingAddress/setShippingAddress.d.ts +2 -2
- package/api.js +35 -7
- package/chunks/OrderError.js +1 -1
- package/chunks/classes.js +1 -1
- package/chunks/errors.js +1 -1
- package/chunks/setBillingAddress.js +3 -3
- package/chunks/setGuestEmailOnCart.js +4 -4
- package/chunks/setPaymentMethod.js +3 -3
- package/chunks/setShippingMethods.js +4 -4
- package/chunks/store-config.js +1 -1
- package/chunks/synchronizeCheckout.js +3 -3
- package/chunks/transform-store-config.js +3 -3
- package/chunks/withConditionalRendering.js +2 -2
- package/components/PaymentMethods/PaymentMethods.d.ts +5 -1
- package/components/PaymentMethods/index.d.ts +15 -15
- package/components/ServerError/ServerError.d.ts +2 -1
- package/containers/BillToShippingAddress.js +2 -2
- package/containers/ErrorBanner.js +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/LoginForm.js +2 -2
- package/containers/MergedCartBanner.js +2 -2
- package/containers/OutOfStock.js +1 -1
- package/containers/PaymentMethods/PaymentMethods.d.ts +25 -9
- package/containers/PaymentMethods/index.d.ts +15 -15
- package/containers/PaymentMethods.js +2 -2
- package/containers/PlaceOrder/PlaceOrder.d.ts +12 -5
- package/containers/PlaceOrder.js +2 -2
- package/containers/ServerError/ServerError.d.ts +1 -0
- package/containers/ServerError.js +2 -2
- package/containers/ShippingMethods/utils/emitShippingEstimateEvent.d.ts +4 -0
- package/containers/ShippingMethods.js +2 -2
- package/data/transforms/transform-shipping-estimate.d.ts +8 -1
- package/fragments.js +1 -1
- package/msw/fixtures/fragments/shipping-address.d.ts +1 -0
- package/msw/fixtures/queries/index.d.ts +0 -2
- package/package.json +1 -1
- package/render.js +3 -3
- package/utils/index.d.ts +1 -0
- package/utils/scrollToElement/index.d.ts +2 -0
- package/utils/scrollToElement/scrollToElement.d.ts +2 -0
- package/chunks/ServerErrorSignal.js +0 -3
- package/containers/PaymentMethods/defaultHandlers.d.ts +0 -4
- package/msw/fixtures/queries/get-customer-cart-stock-status.d.ts +0 -4
- package/msw/fixtures/queries/get-stock-status.d.ts +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cart as CartModel, Customer as CustomerModel
|
|
1
|
+
import { Cart as CartModel, Customer as CustomerModel } from '../../data/models';
|
|
2
2
|
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
3
|
import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
|
|
4
4
|
|
|
@@ -7,7 +7,6 @@ export type ConfigProps = {
|
|
|
7
7
|
models?: {
|
|
8
8
|
CartModel?: Model<CartModel>;
|
|
9
9
|
CustomerModel?: Model<CustomerModel>;
|
|
10
|
-
OrderModel?: Model<OrderModel>;
|
|
11
10
|
};
|
|
12
11
|
};
|
|
13
12
|
export declare const initialize: Initializer<ConfigProps>;
|
|
@@ -14,6 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
declare
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=useShippingEstimateEventEmitter.d.ts.map
|
|
17
|
+
export declare const setShippingAddressAndUseAsBillingMutation: string;
|
|
18
|
+
//# sourceMappingURL=setShippingAddressAndUseAsBilling.graphql.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShippingAddressInput } from '../../data/models';
|
|
1
|
+
import { ShippingAddressInput as ShippingAddressInputModel } from '../../data/models';
|
|
2
2
|
|
|
3
|
-
export declare const setShippingAddress: ({ address, customerAddressId, pickupLocationCode, }:
|
|
3
|
+
export declare const setShippingAddress: ({ address, customerAddressId, pickupLocationCode, }: ShippingAddressInputModel) => Promise<import('../../data/models').Cart | null | undefined>;
|
|
4
4
|
//# sourceMappingURL=setShippingAddress.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{d as
|
|
3
|
+
import{d as l,t as M,a as T,b as E}from"./chunks/synchronizeCheckout.js";import{e as Y,c as J,g as V,f as W,i as X,h as Z,r as tt,s as st}from"./chunks/synchronizeCheckout.js";import{M as A,a as y,b as O}from"./chunks/errors.js";import{F as it,I as rt,e as at,c as nt,d as ot,U as pt}from"./chunks/errors.js";import{s as d}from"./chunks/store-config.js";import{g as ct}from"./chunks/store-config.js";import{s as $,i as _}from"./chunks/transform-store-config.js";import{D as ht,S as mt,j as ut,k as _t,l as lt,r as At,f as St,g as ft,h as Ct}from"./chunks/transform-store-config.js";import"@dropins/tools/lib.js";import{a as v,t as N}from"./chunks/setShippingMethods.js";import{s as Mt}from"./chunks/setShippingMethods.js";import{events as x}from"@dropins/tools/event-bus.js";import{i as Et,s as yt}from"./chunks/setGuestEmailOnCart.js";import{s as $t}from"./chunks/setBillingAddress.js";import{s as Nt}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as S}from"./fragments.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const U=`
|
|
4
4
|
mutation estimateShippingMethods(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$address: EstimateAddressInput!
|
|
@@ -26,14 +26,42 @@ import{d as p,t as f,a as _,b as m}from"./chunks/synchronizeCheckout.js";import{
|
|
|
26
26
|
error_message
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`,
|
|
30
|
-
mutation
|
|
31
|
-
|
|
29
|
+
`,q=async r=>{var h,m,u;const s=d.cartId,{criteria:a}=r||{},{country_code:n,region_id:t,region_name:e,zip:o}=a||{},p=n||((h=d.config)==null?void 0:h.defaultCountry);if(!s)throw new A;if(!p)throw new y;const c=typeof t=="string"?parseInt(t,10):t,g=t||e?{...c&&{region_id:c},...e&&{region_code:e}}:void 0,i={country_code:p,...o&&{postcode:o},...g&&{region:g}},f={country_id:i.country_code,region:(m=i.region)==null?void 0:m.region_code,region_id:(u=i.region)==null?void 0:u.region_id,postcode:i.postcode},C=await l({type:"mutation",query:U,options:{variables:{cartId:s,address:i}},path:"estimateShippingMethods",signalType:"estimateShippingMethods",transformer:M});return setTimeout(()=>{const I={address:v(f),shippingMethod:N($.value)};x.emit("shipping/estimate",I)},0),C},D=`
|
|
30
|
+
mutation SET_SHIPPING_ADDRESS_ON_CART_MUTATION(
|
|
31
|
+
$cartId: String!
|
|
32
|
+
$shippingAddressInput: ShippingAddressInput!
|
|
33
|
+
) {
|
|
34
|
+
setShippingAddressesOnCart(
|
|
35
|
+
input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }
|
|
36
|
+
) {
|
|
37
|
+
cart {
|
|
38
|
+
...CHECKOUT_DATA_FRAGMENT
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${S}
|
|
44
|
+
`,G=`
|
|
45
|
+
mutation SET_SHIPPING_ADDRESS_ON_CART_AND_USE_AS_BILLING_MUTATION(
|
|
46
|
+
$cartId: String!
|
|
47
|
+
$shippingAddressInput: ShippingAddressInput!
|
|
48
|
+
) {
|
|
49
|
+
setShippingAddressesOnCart(
|
|
50
|
+
input: { cart_id: $cartId, shipping_addresses: [$shippingAddressInput] }
|
|
51
|
+
) {
|
|
52
|
+
cart {
|
|
53
|
+
id
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
setBillingAddressOnCart(
|
|
58
|
+
input: { cart_id: $cartId, billing_address: { same_as_shipping: true } }
|
|
59
|
+
) {
|
|
32
60
|
cart {
|
|
33
61
|
...CHECKOUT_DATA_FRAGMENT
|
|
34
62
|
}
|
|
35
63
|
}
|
|
36
64
|
}
|
|
37
65
|
|
|
38
|
-
${
|
|
39
|
-
`,
|
|
66
|
+
${S}
|
|
67
|
+
`,K=async({address:r,customerAddressId:s,pickupLocationCode:a})=>{const n=d.cartId;if(!n)throw new A;const t=()=>{if(s)return{customer_address_id:s};if(a)return{pickup_location_code:a};if(!r)throw new O;return{address:T(r)}},e=_.value?G:D,o=_.value?"setBillingAddressOnCart.cart":"setShippingAddressesOnCart.cart",p={cartId:n,shippingAddressInput:t()};return await l({type:"mutation",query:e,options:{variables:p},path:o,queueName:"cartUpdate",signalType:"cart",transformer:E})};export{ht as DEFAULT_COUNTRY,it as FetchError,rt as InvalidArgument,at as MissingBillingAddress,A as MissingCart,y as MissingCountry,nt as MissingEmail,ot as MissingPaymentMethod,O as MissingShippinghAddress,mt as STORE_CONFIG_DEFAULTS,pt as UnexpectedError,Y as authenticateCustomer,J as config,q as estimateShippingMethods,ut as fetchGraphQl,V as getCart,_t as getConfig,W as getCustomer,lt as getStoreConfig,ct as getStoreConfigCache,X as initialize,Z as initializeCheckout,Et as isEmailAvailable,At as removeFetchGraphQlHeader,tt as resetCheckout,$t as setBillingAddress,St as setEndpoint,ft as setFetchGraphQlHeader,Ct as setFetchGraphQlHeaders,yt as setGuestEmailOnCart,Nt as setPaymentMethod,K as setShippingAddress,Mt as setShippingMethodsOnCart,st as synchronizeCheckout};
|
package/chunks/OrderError.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import*as e from"@dropins/tools/preact-compat.js";const t=r=>e.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},e.createElement("g",{clipPath:"url(#clip0_4797_15331)"},e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.25 20.91L1.5 17.55V6.51996L10.25 9.92996V20.91Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.24023 4.64001L14.9902 8.06001V11.42",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19 13.31L15.5 19.37H22.5L19 13.31Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{className:"error-icon",vectorEffect:"non-scaling-stroke",d:"M19.0202 17.11H18.9802L18.9502 15.56H19.0502L19.0202 17.11ZM18.9602 18.29V18.06H19.0502V18.29H18.9602Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19 12.16V6.51996L10.25 9.92996V20.91L14.27 19.37L14.4 19.32",stroke:"currentColor",strokeLinejoin:"round"}),e.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.51999L10.25 3.04999L19 6.51999L10.25 9.92999L1.5 6.51999Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),e.createElement("defs",null,e.createElement("clipPath",{id:"clip0_4797_15331"},e.createElement("rect",{width:22,height:18.86,fill:"white",transform:"translate(1 2.54999)"}))));export{t as S};
|
package/chunks/classes.js
CHANGED
package/chunks/errors.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
class n extends Error{constructor(e){super(e.map(t=>t.message).join(" ")),this.name="FetchError"}}class r extends Error{constructor(e){super(e),this.name="InvalidArgument"}}class i extends Error{constructor(e){super(e),this.name="UnexpectedError"}}class a extends r{constructor(){super("Cart ID is required")}}class c extends r{constructor(){super("Email is required")}}class o extends r{constructor(){super("Payment method code is required")}}class d extends r{constructor(){super("Shipping address is required")}}class u extends r{constructor(){super("Billing address is required")}}class l extends r{constructor(){super("Country Code is required")}}export{n as F,r as I,a as M,i as U,l as a,d as b,c,o as d,u as e};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{M as e,e as o}from"./errors.js";import{CHECKOUT_DATA_FRAGMENT as d}from"../fragments.js";import{a as l,d as p,b as u}from"./synchronizeCheckout.js";import{s as
|
|
3
|
+
import{M as e,e as o}from"./errors.js";import{CHECKOUT_DATA_FRAGMENT as d}from"../fragments.js";import{a as l,d as p,b as u}from"./synchronizeCheckout.js";import{s as c}from"./store-config.js";import"./transform-store-config.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const m=`
|
|
4
4
|
mutation setBillingAddress($input: SetBillingAddressOnCartInput!) {
|
|
5
5
|
setBillingAddressOnCart(input: $input) {
|
|
6
6
|
cart {
|
|
@@ -10,4 +10,4 @@ import{M as e,e as o}from"./errors.js";import{CHECKOUT_DATA_FRAGMENT as d}from".
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
${d}
|
|
13
|
-
`,
|
|
13
|
+
`,h=async({address:i,customerAddressId:t,sameAsShipping:s=!1,useForShipping:n=!1})=>{const r=c.cartId;if(!r)throw new e;const a={cart_id:r,billing_address:{same_as_shipping:s,use_for_shipping:n}};if(!s&&t&&(a.billing_address.customer_address_id=t),!s&&!t){if(!i)throw new o;a.billing_address.address=l(i)}return await p({options:{variables:{input:a}},path:"setBillingAddressOnCart.cart",query:m,queueName:"cartUpdate",signalType:"cart",transformer:u,type:"mutation"})};export{h as s};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as r}from"./store-config.js";import{
|
|
3
|
+
import{s as r}from"./store-config.js";import{j as e}from"./transform-store-config.js";import{c as s,M as l}from"./errors.js";import{j as o,d as m,b as n}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as c}from"../fragments.js";const u=a=>!!(a!=null&&a.is_email_available),p=`
|
|
4
4
|
query isEmailAvailable($email: String!) {
|
|
5
5
|
isEmailAvailable(email: $email) {
|
|
6
6
|
is_email_available
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
-
`,E=a=>{if(!(!a||a.length===0))throw Error(a.map(t=>t.message).join(" "))},
|
|
9
|
+
`,E=a=>{if(!(!a||a.length===0))throw Error(a.map(t=>t.message).join(" "))},_=async a=>{if(!a)throw new s;const{data:t,errors:i}=await e(p,{method:"GET",cache:"no-cache",variables:{email:a}}).catch(o);return i&&E(i),u(t.isEmailAvailable)},h=`
|
|
10
10
|
mutation setGuestEmail($cartId: String!, $email: String!) {
|
|
11
11
|
setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
|
|
12
12
|
cart {
|
|
@@ -16,4 +16,4 @@ import{s as r}from"./store-config.js";import{h as e}from"./transform-store-confi
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
${c}
|
|
19
|
-
`,
|
|
19
|
+
`,g=async a=>{const t=r.cartId;if(!t)throw new l;return await m({options:{variables:{cartId:t,email:a}},path:"setGuestEmailOnCart.cart",query:h,queueName:"cartUpdate",signalType:"cart",transformer:n,type:"mutation"})};export{_ as i,g as s};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{M as e,d as r}from"./errors.js";import{CHECKOUT_DATA_FRAGMENT as o}from"../fragments.js";import{d as n,b as s}from"./synchronizeCheckout.js";import{s as m}from"./store-config.js";import"./transform-store-config.js";import"
|
|
3
|
+
import{M as e,d as r}from"./errors.js";import{CHECKOUT_DATA_FRAGMENT as o}from"../fragments.js";import{d as n,b as s}from"./synchronizeCheckout.js";import{s as m}from"./store-config.js";import"./transform-store-config.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const i=`
|
|
4
4
|
mutation setPaymentMethod(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$paymentMethod: PaymentMethodInput!
|
|
@@ -15,4 +15,4 @@ import{M as e,d as r}from"./errors.js";import{CHECKOUT_DATA_FRAGMENT as o}from".
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
${o}
|
|
18
|
-
`,
|
|
18
|
+
`,f=async t=>{const a=m.cartId;if(!a)throw new e;if(!t)throw new r;return await n({options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",query:i,queueName:"cartUpdate",signalType:"cart",transformer:s,type:"mutation"})};export{f as s};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as
|
|
3
|
+
import{s as r}from"./store-config.js";import"./transform-store-config.js";import{M as i}from"./errors.js";import{d as n,b as e}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as s}from"../fragments.js";const M=t=>({countryCode:t.country_id,postCode:t.postcode||"",...t.region_id?{regionId:Number(t.region_id)}:{...t.region?{region:t.region}:{}}}),T=t=>({carrierCode:t.carrier.code||"",methodCode:t.code||"",amount:t.amount,amountExclTax:t.amountExclTax,amountInclTax:t.amountInclTax}),a=`
|
|
4
4
|
mutation setShippingMethods(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$shippingMethods: [ShippingMethodInput]!
|
|
@@ -14,5 +14,5 @@ import{s as i}from"./store-config.js";import"./transform-store-config.js";import
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
${
|
|
18
|
-
`,
|
|
17
|
+
${s}
|
|
18
|
+
`,S=async t=>{const o=r.cartId;if(!o)throw new i;return await n({type:"mutation",query:a,queueName:"cartUpdate",options:{variables:{cartId:o,shippingMethods:t}},path:"setShippingMethodsOnCart.cart",signalType:"cart",transformer:e})};export{M as a,S as s,T as t};
|
package/chunks/store-config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
const I={authenticated:!1,cartId:null,initialized:!1,config:null},N=new Proxy(I,{set(t,e,n){return t[e]=n,!0},get(t,e){return t[e]}}),s=()=>N.config;var r=(t=>(t.EXCLUDING_TAX="EXCLUDING_TAX",t.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",t.INCLUDING_TAX="INCLUDING_TAX",t))(r||{});export{r as T,s as g,N as s};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as i}from"./store-config.js";import{
|
|
3
|
+
import{s as i}from"./store-config.js";import{d as C,j as y,c as m,e as R,l as z}from"./transform-store-config.js";import{events as c}from"@dropins/tools/event-bus.js";import{merge as A,Initializer as G}from"@dropins/tools/lib.js";import{CHECKOUT_DATA_FRAGMENT as b,CUSTOMER_FRAGMENT as O}from"../fragments.js";import{F as $,M as U}from"./errors.js";const D=async(e=!1)=>{i.authenticated=e,e?await me():C.value={pending:!1,data:null}},x={cartUpdate:{requests:[]},default:{requests:[]}};function F(e,t="default"){const r=x[t];return new Promise((n,o)=>{r.requests.push(e);const a=()=>{r.requests[0]===e?e().then(n).catch(o).finally(()=>{var l;r.requests.shift(),r.requests.length===0?(l=r.onComplete)==null||l.call(r):a()}):setTimeout(a,100)};a()})}function Q(e,t){const r=x[e];r.onComplete=t}const V=["sender_email","recipient_email"];function B(e){return e.filter(t=>!t.path||!V.some(r=>{var n;return((n=t.path)==null?void 0:n.at(-1))===r}))}const v=e=>{throw e instanceof DOMException&&e.name==="AbortError"||c.emit("error",{source:"checkout",type:"network",error:e}),e},H={cart:m,customer:C,estimateShippingMethods:R};function K(e,t){return t.split(".").reduce((r,n)=>r&&r[n]!==void 0?r[n]:void 0,e)}const _={cart:null,customer:null,estimateShippingMethods:null};async function E(e){const{defaultValueOnFail:t,options:r,path:n,query:o,queueName:a,signalType:l,transformer:p,type:P}=e,s=H[l],d=Symbol();_[l]=d,s.value={...s.value,pending:!0};try{const{data:f,errors:h}=await(P==="mutation"?F(()=>y(o,r).catch(v),a):y(o,{method:"GET",cache:"no-cache",...r}).catch(v));if(h){const g=B(h);if(g.length>0)throw new $(g)}let u=K(f,n);if(u===void 0)throw new Error(`No data found at path: ${n}`);return p&&(u=p(u)),s.value={...s.value,data:u},setTimeout(()=>{s.value={...s.value,pending:_[l]===d?!1:s.value.pending}},0),u}catch(f){if(t)return s.value={pending:!1,data:t},t;if(f.name==="AbortError")return;throw s.value={...s.value,pending:!1},f}}const j=e=>e==null,L=(e,t)=>e.amount.value-t.amount.value,M=e=>!(!e||!e.method_code||!e.method_title||j(e.amount.value)||!e.amount.currency),T=e=>({amount:{value:e.amount.value,currency:e.amount.currency},title:e.method_title,code:e.method_code,carrier:{code:e.carrier_code,title:e.carrier_title},value:`${e.carrier_code} - ${e.method_code}`,...e.price_excl_tax&&{amountExclTax:{value:e.price_excl_tax.value,currency:e.price_excl_tax.currency}},...e.price_incl_tax&&{amountInclTax:{value:e.price_incl_tax.value,currency:e.price_incl_tax.currency}}}),J=e=>{if(M(e))return T(e)},W=e=>{if(e)return e.filter(M).map(t=>T(t)).sort(L)},X=e=>e?!!e.code&&!!e.label:!1,Y=e=>{if(!X(e))return;const{code:t,label:r,region_id:n}=e;return n?{code:t,name:r,id:n}:{code:t,name:r}},Z=e=>{const{code:t,label:r}=e;return{value:t,label:r}},ee=e=>e?"code"in e&&"value"in e:!1,te=e=>e.filter(ee).map(t=>{const{code:r,value:n}=t;return{code:r,value:n}}),S=e=>{const t=e.street.filter(Boolean);return{id:(e==null?void 0:e.id)||void 0,city:e.city,company:e.company||void 0,country:Z(e.country),customAttributes:te(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:Y(e.region),street:t,telephone:e.telephone||void 0,vatId:e.vat_id||void 0,prefix:e.prefix||void 0,suffix:e.suffix||void 0,middleName:e.middlename||void 0,fax:e.fax||void 0}},re=e=>{if(e)return S(e)},ne=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:r,selected_shipping_method:n,same_as_billing:o,...a}=t;return{...S(a),availableShippingMethods:W(r),selectedShippingMethod:J(n),sameAsBilling:o}}),Ce=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId,prefix:e.prefix,suffix:e.suffix,middlename:e.middleName,fax:e.fax}),ie=e=>{if(e)return{code:e.code,title:e.title}},oe=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:r,title:n}=t;return{code:r,title:n}})},se=e=>{var r,n,o;if(!e)return;const t={availablePaymentMethods:oe(e.available_payment_methods),billingAddress:re(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:ie(e.selected_payment_method),shippingAddresses:ne(e.shipping_addresses),isGuest:!i.authenticated};return A(t,(o=(n=(r=N.getConfig().models)==null?void 0:r.CartModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},ce=e=>{var r,n,o;if(!e)return;const t={firstName:e.firstname||"",lastName:e.lastname||"",email:e.email||""};return A(t,(o=(n=(r=N.getConfig().models)==null?void 0:r.CustomerModel)==null?void 0:n.transformer)==null?void 0:o.call(n,e))},ae=`
|
|
4
4
|
query getCart($cartId: String!) {
|
|
5
5
|
cart(cart_id: $cartId) {
|
|
6
6
|
...CHECKOUT_DATA_FRAGMENT
|
|
@@ -24,4 +24,4 @@ import{s as i}from"./store-config.js";import{b as C,h as y,c as m,e as R,k as z}
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
${O}
|
|
27
|
-
`,me=async()=>{if(i.authenticated)return await E({type:"query",query:ue,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:ce})},fe=()=>[c.on("authenticated",D,{eager:!0}),c.on("cart/initialized",I,{eager:!0}),c.on("cart/reset",pe),c.on("cart/updated",k)],q=new G({init:async e=>{const t=e||{};q.config.setConfig(t)},listeners:fe}),N=q.config;Q("cartUpdate",()=>{c.emit("checkout/updated",m.value.data)});const I=async e=>{if(i.initialized)return k(e);i.config||(i.config=await z());const t=e?e.id:null;i.cartId=t;const r=t?await w():null;m.value={pending:!1,data:r},i.initialized=!0,c.emit("checkout/initialized",r||null)},pe=()=>{i.cartId=null,m.value={pending:!1,data:null},c.emit("checkout/updated",null)},k=async e=>{if(!i.initialized)return I(e);const t=e?e.id:null;i.cartId=t;const r=t?await w():null;m.value={pending:!1,data:r},c.emit("checkout/updated",r||null)};export{
|
|
27
|
+
`,me=async()=>{if(i.authenticated)return await E({type:"query",query:ue,options:{method:"POST",cache:"no-cache"},path:"customer",signalType:"customer",transformer:ce})},fe=()=>[c.on("authenticated",D,{eager:!0}),c.on("cart/initialized",I,{eager:!0}),c.on("cart/reset",pe),c.on("cart/updated",k)],q=new G({init:async e=>{const t=e||{};q.config.setConfig(t)},listeners:fe}),N=q.config;Q("cartUpdate",()=>{c.emit("checkout/updated",m.value.data)});const I=async e=>{if(i.initialized)return k(e);i.config||(i.config=await z());const t=e?e.id:null;i.cartId=t;const r=t?await w():null;m.value={pending:!1,data:r},i.initialized=!0,c.emit("checkout/initialized",r||null)},pe=()=>{i.cartId=null,m.value={pending:!1,data:null},c.emit("checkout/updated",null)},k=async e=>{if(!i.initialized)return I(e);const t=e?e.id:null;i.cartId=t;const r=t?await w():null;m.value={pending:!1,data:r},c.emit("checkout/updated",r||null)};export{Ce as a,se as b,N as c,E as d,D as e,me as f,w as g,I as h,q as i,v as j,pe as r,k as s,W as t};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{T as a}from"./store-config.js";import{signal as t,effect as c}from"@dropins/tools/signals.js";import"
|
|
3
|
+
import{T as a}from"./store-config.js";import{signal as t,effect as c}from"@dropins/tools/signals.js";import"@dropins/tools/event-bus.js";import{FetchGraphQL as l}from"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const p=t(!0),g=t({pending:!1,data:void 0});c(()=>{var e;(e=g.value.data)!=null&&e.isVirtual&&(p.value=!1)});const y=t({pending:!1,data:void 0}),T=t({pending:!1,data:void 0}),D=t(),b=t(void 0),k=t(),u=`
|
|
4
4
|
query getStoreConfig {
|
|
5
5
|
storeConfig {
|
|
6
6
|
default_country
|
|
@@ -9,4 +9,4 @@ import{T as a}from"./store-config.js";import{signal as t,effect as c}from"@dropi
|
|
|
9
9
|
shopping_cart_display_shipping
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
-
`,{setEndpoint:N,setFetchGraphQlHeader:U,removeFetchGraphQlHeader:I,setFetchGraphQlHeaders:L,fetchGraphQl:h,getConfig:X}=new l().getMethods(),d="US",n={defaultCountry:d,isGuestCheckoutEnabled:!1,isOnePageCheckoutEnabled:!1,shoppingCartDisplaySetting:{shipping:a.EXCLUDING_TAX}},v=async()=>h(
|
|
12
|
+
`,{setEndpoint:N,setFetchGraphQlHeader:U,removeFetchGraphQlHeader:I,setFetchGraphQlHeaders:L,fetchGraphQl:h,getConfig:X}=new l().getMethods(),d="US",n={defaultCountry:d,isGuestCheckoutEnabled:!1,isOnePageCheckoutEnabled:!1,shoppingCartDisplaySetting:{shipping:a.EXCLUDING_TAX}},v=async()=>h(u,{method:"GET",cache:"no-cache"}).then(({errors:e,data:s})=>e?n:_(s.storeConfig));function f(e){switch(e){case 1:return a.EXCLUDING_TAX;case 2:return a.INCLUDING_TAX;case 3:return a.INCLUDING_EXCLUDING_TAX;default:return a.EXCLUDING_TAX}}function _(e){if(!e)return n;const{default_country:s,is_guest_checkout_enabled:i,is_one_page_checkout_enabled:o,shopping_cart_display_shipping:r}=e;return{defaultCountry:s||n.defaultCountry,isGuestCheckoutEnabled:i||n.isGuestCheckoutEnabled,isOnePageCheckoutEnabled:o||n.isOnePageCheckoutEnabled,shoppingCartDisplaySetting:{shipping:f(r)}}}export{d as D,n as S,k as a,D as b,g as c,y as d,T as e,N as f,U as g,L as h,p as i,h as j,X as k,v as l,I as r,b as s};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{c as
|
|
3
|
+
import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{c as p}from"./transform-store-config.js";import"./store-config.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";function u(i){return i.displayName||i.name||"Component"}const g=i=>{const o=u(i),a=({hideOnEmptyCart:s=!0,hideOnVirtualCart:r=!1,...e})=>{const t=p.value.data,l=t!==void 0&&(t===null||t.isEmpty),m=!!(t!=null&&t.isVirtual),c=s&&l||r&&m,d=`conditional-${o.toLowerCase()}`;return n("div",{className:d,children:!c&&n(i,{...e})})};return a.displayName=`Conditional(${o})`,a};export{g as w};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { PaymentMethod } from '../../data/models/payment-method';
|
|
2
2
|
import { FunctionComponent, VNode } from 'preact';
|
|
3
3
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
|
+
import { PaymentMethodConfig } from '../../containers';
|
|
4
5
|
|
|
6
|
+
interface ExtendedPaymentMethod extends PaymentMethodConfig, PaymentMethod {
|
|
7
|
+
}
|
|
5
8
|
export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading'> {
|
|
6
9
|
initializing?: boolean;
|
|
7
10
|
loading?: boolean;
|
|
8
11
|
onChange?: (value: string) => void;
|
|
9
|
-
options?:
|
|
12
|
+
options?: ExtendedPaymentMethod[];
|
|
10
13
|
paymentMethodContent?: VNode;
|
|
11
14
|
selection?: string;
|
|
12
15
|
}
|
|
13
16
|
export declare const PaymentMethods: FunctionComponent<PaymentMethodsProps>;
|
|
17
|
+
export {};
|
|
14
18
|
//# sourceMappingURL=PaymentMethods.d.ts.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/********************************************************************
|
|
2
|
-
* ADOBE CONFIDENTIAL
|
|
3
|
-
* __________________
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2024 Adobe
|
|
6
|
-
* All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* NOTICE: All information contained herein is, and remains
|
|
9
|
-
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
-
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
-
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
-
* property laws, including trade secret and copyright laws.
|
|
13
|
-
* Dissemination of this information or reproduction of this material
|
|
14
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
-
* from Adobe.
|
|
16
|
-
*******************************************************************/
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
17
|
export * from './PaymentMethods';
|
|
18
18
|
export * from './PaymentMethodsSkeleton';
|
|
19
19
|
export { PaymentMethods as default } from './PaymentMethods';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { FunctionComponent } from 'preact';
|
|
1
|
+
import { FunctionComponent, RefObject } from 'preact';
|
|
2
2
|
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
4
|
export interface ServerErrorProps extends Omit<HTMLAttributes<HTMLDivElement>, 'icon'> {
|
|
5
|
+
errorMessageRef?: RefObject<HTMLParagraphElement>;
|
|
5
6
|
errorMessage: string;
|
|
6
7
|
contactSupport?: string;
|
|
7
8
|
onClick?: (e: any) => void;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/store-config.js";import{i as d,c as u}from"../chunks/transform-store-config.js";import"
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/store-config.js";import{i as d,c as u}from"../chunks/transform-store-config.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{s as S}from"../chunks/setBillingAddress.js";/* empty css */import{Checkbox as b,Skeleton as f,SkeletonRow as A}from"@dropins/tools/components.js";import{c as B}from"../chunks/classes.js";import{useText as x}from"@dropins/tools/i18n.js";import{w as T}from"../chunks/withConditionalRendering.js";import{useState as v,useEffect as _}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/errors.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const w=({className:i,checked:e,loading:r,disabled:n,onChange:s})=>{const c=x({title:"Checkout.BillToShippingAddress.title"});return r?t(y,{}):t("div",{className:"checkout-bill-to-shipping-address",children:t(b,{checked:e,className:B(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:n,label:c.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:s})})},y=()=>t(f,{className:"bill-to-shipping-address__skeleton",children:t(A,{variant:"row",size:"small"})}),k=({onChange:i})=>{var g;const[e,r]=v(!0),n=d.value,s=u.value.data,c=u.value.pending,p=!!s,m=!!(s==null?void 0:s.billingAddress),l=(g=s==null?void 0:s.shippingAddresses)==null?void 0:g[0],h=l==null?void 0:l.sameAsBilling;return _(()=>{if(!e||!p)return;r(!1);const o=h??!m;d.value=o,i==null||i(o)},[p,m,h,e,i]),t(w,{checked:n,disabled:c,loading:e,onChange:async o=>{const a=o.target.checked;d.value=a,i==null||i(a),!e&&l&&a&&await S({sameAsShipping:!0}).catch(console.error)}})};k.displayName="BillToShippingAddressContainer";const U=T(k);export{U as BillToShippingAddress,U as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as m,Icon as f}from"@dropins/tools/components.js";import{events as u}from"@dropins/tools/event-bus.js";import*as i from"@dropins/tools/preact-compat.js";import{useState as g,useEffect as p}from"@dropins/tools/preact-compat.js";import{useText as h}from"@dropins/tools/i18n.js";const v=o=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},i.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),B=({initialData:o,...l})=>{const[c,s]=g(!1),t=h({message:"Checkout.ErrorBanner.genericMessage"});p(()=>{const r=u.on("error",e=>{(e==null?void 0:e.source)==="checkout"&&(e==null?void 0:e.type)==="network"&&s(!0)});return()=>{r==null||r.off()}},[]);const a=()=>{s(!1)};return c?n(m,{...l,className:"checkout__banner","data-testid":"error-banner",icon:n(f,{source:v}),message:n("span",{children:t.message}),"aria-label":t.message,onDismiss:a,variant:"warning"}):null};export{B as ErrorBanner,B as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as k,Fragment as y,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as v,SkeletonRow as M,Price as x}from"@dropins/tools/components.js";/* empty css */import{VComponent as A,classes as I}from"@dropins/tools/lib.js";import{Text as l,useText as w}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{s as z,T as C}from"../chunks/store-config.js";import{events as g}from"@dropins/tools/event-bus.js";import{useState as B,useEffect as f}from"@dropins/tools/preact-hooks.js";const G=({estimated:e=!1,price:a,priceExclTax:d,taxExcluded:o=!1,taxIncluded:p=!1})=>k(y,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(l,{id:"Checkout.EstimateShipping.estimated"}):t(l,{id:"Checkout.EstimateShipping.label"})}),t(A,{node:a,className:"checkout-estimate-shipping__price"}),p&&t("span",{"data-testid":"shipping-tax-included",className:I(["checkout-estimate-shipping__caption"]),children:t(l,{id:"Checkout.EstimateShipping.withTaxes"})}),o&&k("span",{"data-testid":"shipping-tax-included-excluded",className:I(["checkout-estimate-shipping__caption"]),children:[d," ",t(l,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),L=()=>t(v,{"data-testid":"estimate-shipping-skeleton",children:t(M,{size:"xsmall"})}),O=()=>{const[e,a]=B(),d=e!==void 0,o=(e==null?void 0:e.amount.value)===0,p=z.config,T=p==null?void 0:p.shoppingCartDisplaySetting.shipping,_=T===C.INCLUDING_EXCLUDING_TAX,E=T===C.INCLUDING_TAX,S=w({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});f(()=>{const i=g.on("shipping/estimate",n=>{const s=n.shippingMethod,{amount:c,amountExclTax:r,amountInclTax:m}=s;a({estimated:!0,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),f(()=>{const i=g.on("checkout/initialized",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;a({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),f(()=>{const i=g.on("checkout/updated",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;a({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]);const D=()=>o?t("span",{"data-testId":"free-shipping",children:S.freeShipping}):E&&(e!=null&&e.amountInclTax)?t(x,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(x,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),N=()=>e!=null&&e.amountExclTax?t(x,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:S.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:d?t(G,{estimated:e.estimated,price:D(),taxExcluded:_&&!o,taxIncluded:E&&!o,priceExclTax:N()}):t(L,{})})};export{O as EstimateShipping,O as default};
|
package/containers/LoginForm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e,jsxs as s,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{s as H}from"../chunks/store-config.js";import{c as R,
|
|
3
|
+
import{jsx as e,jsxs as s,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{s as H}from"../chunks/store-config.js";import{c as R,d as V}from"../chunks/transform-store-config.js";import"@dropins/tools/event-bus.js";import{classes as j}from"@dropins/tools/lib.js";import{i as q,s as D}from"../chunks/setGuestEmailOnCart.js";import{Field as W,Input as G,Skeleton as U,SkeletonRow as x}from"@dropins/tools/components.js";/* empty css *//* empty css */import{useText as b,Text as _}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{w as J}from"../chunks/withConditionalRendering.js";import{useState as v,useRef as K,useEffect as C}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/errors.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const O=({value:t,error:i,hint:g,onChange:h,onBlur:o,onInvalid:u})=>{const m=b({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return e(W,{size:"medium",error:i,hint:g,children:e(G,{"aria-label":m.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:m.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",onBlur:o,onChange:h,onInvalid:u,placeholder:m.LoginFormPlaceholder,required:!0,type:"email",value:t})})},Q=({onClick:t})=>s("div",{className:"checkout-login-form__sign-in",children:[e(_,{id:"Checkout.LoginForm.account"}),e("a",{"data-testid":"sign-in-link",className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signIn"})})]}),X=({className:t,customerDetails:i,email:g,error:h,hint:o,loading:u=!1,name:m,onEmailBlur:f,onEmailChange:k,onEmailInvalid:E,onSignInClick:a,onSignOutClick:F,...L})=>{const l=b({Title:"Checkout.LoginForm.title"});return u?e(Y,{}):s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[e("h2",{className:"checkout-login-form__title",children:l.Title}),i?e(Z,{onClick:d=>{d.preventDefault(),F==null||F()}}):e(Q,{onClick:d=>{d.preventDefault(),a==null||a(g)}})]}),i?s("div",{className:"checkout-login-form__customer-details",children:[e("div",{className:"checkout-login-form__customer-name",children:`${i.firstName} ${i.lastName}`}),e("div",{className:"checkout-login-form__customer-email",children:i.email})]}):e("div",{className:"checkout-login-form__content",children:s("form",{...L,className:j(["dropin-login-form__form",t]),name:m,noValidate:!0,children:[e("button",{type:"submit",disabled:!0,style:"display: none","aria-hidden":"true"}),e(O,{value:g,error:h,hint:o,onChange:k,onBlur:f,onInvalid:E})]})})]})},Y=()=>s(U,{"data-testid":"login-form-skeleton",children:[e(x,{variant:"heading",fullWidth:!0}),e(x,{size:"medium",fullWidth:!0})]}),Z=({onClick:t})=>s("p",{className:"checkout-login-form__sign-out",children:[e(_,{id:"Checkout.LoginForm.switch"}),e("a",{className:"checkout-login-form__link",href:"#",target:"_blank",rel:"noreferrer",onClick:t,children:e(_,{id:"Checkout.LoginForm.signOut"})})]}),S={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},N=t=>S.EMAIL.test(t),ee=1e3,y=({onSignInClick:t,onSignOutClick:i,initialData:g,...h})=>{const[o,u]=v(""),[m,f]=v(""),[k,E]=v(!0),[a,F]=v(!0),L=K(""),l=R.value.data,d=(l==null?void 0:l.email)||"",p=V.value.data,c=b({LoginFormInvalidEmailError:"Checkout.LoginForm.invalidEmailError",LoginFormMissingEmailError:"Checkout.LoginForm.missingEmailError",LoginFormEmailExistsAlreadyHaveAccount:"Checkout.LoginForm.emailExists.alreadyHaveAccount",LoginFormEmailExistsSignInButton:"Checkout.LoginForm.emailExists.signInButton",LoginFormEmailExistsForFasterCheckout:"Checkout.LoginForm.emailExists.forFasterCheckout"}),A=r=>r.valid?"":r.valueMissing?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,B=r=>N(r)?"":r===""?c.LoginFormMissingEmailError:c.LoginFormInvalidEmailError,M=r=>{const n=r.target;u(n.value),f(""),E(!0)},T=r=>{const n=r.target;f(B(n.value))},z=r=>{const n=r.target;f(A(n.validity))};C(()=>{!a||!l||(F(!1),u(l.email||""))},[l,a]),C(()=>{if(a||H.authenticated)return;const r=setTimeout(()=>{!N(o)||o===L.current||(L.current=o,q(o).then(n=>{E(n),d!==o&&D(o).catch(console.error)}).catch(n=>{console.error(n),E(!0)}))},ee);return()=>{r&&clearTimeout(r)}},[d,o,a]);const I=k?"":s(w,{children:[c.LoginFormEmailExistsAlreadyHaveAccount," ",e("a",{href:"#",onClick:r=>{r.preventDefault(),t==null||t(o)},children:c.LoginFormEmailExistsSignInButton})," ",c.LoginFormEmailExistsForFasterCheckout]}),$=r=>{t==null||t(N(r)?r:"")},P=p?{firstName:p.firstName,lastName:p.lastName,email:p.email}:void 0;return e(X,{...h,customerDetails:P,email:o,error:m,hint:I,loading:a,onEmailBlur:T,onEmailChange:M,onEmailInvalid:z,onSignInClick:$,onSignOutClick:i})};y.displayName="LoginFormContainer";const _e=J(y);export{_e as LoginForm,_e as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as u}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as B}from"@dropins/tools/event-bus.js";import*as l from"@dropins/tools/preact-compat.js";import{useState as I,useEffect as M}from"@dropins/tools/preact-compat.js";import{w as v}from"../chunks/withConditionalRendering.js";import{useText as w,Text as x}from"@dropins/tools/i18n.js";import"../chunks/transform-store-config.js";import"../chunks/store-config.js";import"@dropins/tools/signals.js";import"
|
|
3
|
+
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as u}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as B}from"@dropins/tools/event-bus.js";import*as l from"@dropins/tools/preact-compat.js";import{useState as I,useEffect as M}from"@dropins/tools/preact-compat.js";import{w as v}from"../chunks/withConditionalRendering.js";import{useText as w,Text as x}from"@dropins/tools/i18n.js";import"../chunks/transform-store-config.js";import"../chunks/store-config.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/lib.js";const H=t=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 12C0 5.37931 5.37931 0 12 0C18.6207 0 24 5.37931 24 12C24 18.6207 18.6207 24 12 24C5.37931 24 0 18.6207 0 12ZM11.8885 5.06101C11.1405 5.06101 10.5357 5.66579 10.5357 6.4138V6.57295C10.5835 7.27321 11.1882 7.81433 11.8885 7.76658H12.0795C12.7797 7.70292 13.289 7.09815 13.2413 6.4138C13.2413 5.66579 12.6365 5.06101 11.8885 5.06101ZM13.1935 16.8223H14.1007C14.2599 16.8223 14.4031 16.9655 14.4031 17.1247V17.7294C14.4031 17.9045 14.2599 18.0318 14.1007 18.0318H9.8832C9.70813 18.0318 9.58081 17.8886 9.58081 17.7294V17.1247C9.58081 16.9496 9.72405 16.8223 9.8832 16.8223H10.7904V10.7905H9.8832C9.70813 10.7905 9.58081 10.6472 9.58081 10.4881V9.88329C9.58081 9.70823 9.72405 9.58091 9.8832 9.58091H12.5888C12.923 9.58091 13.1935 9.85146 13.1935 10.1857V16.8223Z",fill:"currentColor"})),C=({className:t,initialData:V,...c})=>{const[r,a]=I(0),s=w({mergedCartBannerItems:e(x,{id:"Checkout.MergedCartBanner.items",fields:{count:r},plural:r})});M(()=>{const n=B.on("cart/merged",o=>{var m;const i=(m=o==null?void 0:o.oldCartItems)==null?void 0:m.reduce((f,p)=>f+p.quantity,0);i>0&&a(i)});return()=>{n==null||n.off()}},[]);const d=()=>{a(0)};return r?e(g,{...c,"aria-label":s.mergedCartBannerItems,className:h(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(u,{source:H}),message:e("span",{children:s.mergedCartBannerItems}),onDismiss:d,variant:"neutral"}):null};C.displayName="MergedCartBannerContainer";const q=v(C);export{q as MergedCartBanner,q as default};
|
package/containers/OutOfStock.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as n,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Card as k,Icon as l,Image as h}from"@dropins/tools/components.js";/* empty css */import{classes as O}from"@dropins/tools/lib.js";import{S as d}from"../chunks/OrderError.js";import{useText as p}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{events as S}from"@dropins/tools/event-bus.js";import{useState as v,useCallback as _,useEffect as g}from"@dropins/tools/preact-compat.js";const N=({className:i,items:r,onRemoveOutOfStock:o,routeCart:a,...m})=>{const s=p({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(k,{className:O(["checkout-out-of-stock",i]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n("h4",{className:"checkout-out-of-stock__title",children:[e(l,{source:d,size:"16",stroke:"1"}),s.title]}),e("p",{className:"checkout-out-of-stock__message",children:s.message}),e("ol",{className:"checkout-out-of-stock__items",children:r.map(u=>e("li",{"data-testid":"out-of-stock-item",className:"checkout-out-of-stock__item",children:e(h,{loading:"eager",src:u.image.src,alt:u.image.alt,width:"100",height:"100",params:{width:100}})},u.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[a&&e("a",{"data-testid":"review-cart",className:"checkout-out-of-stock__action",href:a,children:s.reviewCart}),o&&e("button",{className:"checkout-out-of-stock__action","data-testid":"remove-out-of-stock",type:"button",onClick:o,children:s.removeOutOfStock})]})]})},T=({onCartProductsUpdate:i,routeCart:r})=>{const[o,a]=v([]),m=t=>t.outOfStock||t.insufficientQuantity,s=_(()=>{if(!i)return;const t=o.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));i(t)},[o,i]);if(g(()=>{const t=S.on("cart/data",c=>{const f=(c==null?void 0:c.items)||[];a(f.filter(m))},{eager:!0});return()=>{t==null||t.off()}},[]),o.length===0)return null;const u=!o.some(t=>t.insufficientQuantity);return e(N,{items:o,onRemoveOutOfStock:u?s:void 0,routeCart:r==null?void 0:r()})};export{T as OutOfStock,T as default};
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface PaymentMethodRenderCtx {
|
|
5
|
+
cartId: string;
|
|
5
6
|
replaceHTML: (domElement: HTMLElement) => void;
|
|
6
7
|
}
|
|
7
|
-
export interface
|
|
8
|
-
|
|
8
|
+
export interface PaymentMethodConfig {
|
|
9
|
+
displayLabel?: boolean;
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
icon?: string;
|
|
12
|
+
setOnChange?: boolean;
|
|
13
|
+
render?: SlotProps<PaymentMethodRenderCtx>;
|
|
9
14
|
}
|
|
10
|
-
export interface
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
export interface PaymentMethodsSlot {
|
|
16
|
+
[code: string]: PaymentMethodConfig;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated This property is deprecated and will be removed in future versions.
|
|
20
|
+
*/
|
|
21
|
+
export interface PaymentMethodsHandlerSlot {
|
|
22
|
+
[code: string]: PaymentMethodConfig['render'];
|
|
13
23
|
}
|
|
14
24
|
export interface PaymentMethodsProps extends HTMLAttributes<HTMLDivElement> {
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated This property is deprecated and will be removed in future versions.
|
|
27
|
+
*/
|
|
15
28
|
setOnChange?: {
|
|
16
29
|
[key: string]: boolean;
|
|
17
|
-
}
|
|
30
|
+
};
|
|
18
31
|
slots?: {
|
|
19
|
-
|
|
20
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated This property is deprecated and will be removed in future versions, use Methods instead.
|
|
34
|
+
*/
|
|
35
|
+
Handlers?: PaymentMethodsHandlerSlot;
|
|
36
|
+
Methods?: PaymentMethodsSlot;
|
|
21
37
|
};
|
|
22
38
|
}
|
|
23
39
|
export declare const PaymentMethods: {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/********************************************************************
|
|
2
|
-
* ADOBE CONFIDENTIAL
|
|
3
|
-
* __________________
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2024 Adobe
|
|
6
|
-
* All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* NOTICE: All information contained herein is, and remains
|
|
9
|
-
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
-
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
-
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
-
* property laws, including trade secret and copyright laws.
|
|
13
|
-
* Dissemination of this information or reproduction of this material
|
|
14
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
-
* from Adobe.
|
|
16
|
-
*******************************************************************/
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
17
|
export * from './PaymentMethods';
|
|
18
18
|
export { PaymentMethods as default } from './PaymentMethods';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as n,jsxs as
|
|
3
|
+
import{jsx as n,jsxs as w}from"@dropins/tools/preact-jsx-runtime.js";import{s as z}from"../chunks/store-config.js";import{c as M,b as m}from"../chunks/transform-store-config.js";import"@dropins/tools/event-bus.js";import{classes as P,Slot as I}from"@dropins/tools/lib.js";import{s as R}from"../chunks/setPaymentMethod.js";/* empty css */import{IllustratedMessage as B,Icon as N,ProgressSpinner as U,ToggleButton as Z,Skeleton as D,SkeletonRow as f}from"@dropins/tools/components.js";import*as y from"@dropins/tools/preact-compat.js";import{useState as $,useEffect as L,useCallback as q}from"@dropins/tools/preact-compat.js";import{useText as F}from"@dropins/tools/i18n.js";import{w as G}from"../chunks/withConditionalRendering.js";import{useRef as J}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/errors.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const K=e=>y.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),y.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Q=({code:e,loading:c,selected:s,onChange:r,title:a,icon:o})=>n(Z,{className:"checkout-payment-methods__method",label:a,name:"payment-method",value:e,selected:s,onChange:r,busy:c,icon:o?n(N,{source:o}):void 0}),X=({className:e,paymentMethodContent:c,loading:s=!1,initializing:r=!1,onChange:a=()=>{},options:o,selection:v})=>{const u=F({Title:"Checkout.PaymentMethods.title",EmptyState:"Checkout.PaymentMethods.emptyState"});return r?n(Y,{}):w("div",{className:P(["checkout-payment-methods",e]),children:[n("h2",{className:"checkout-payment-methods__title",children:u.Title}),!s&&o.length===0&&n(B,{icon:n(N,{source:K}),message:n("p",{children:u.EmptyState})}),w("div",{className:P(["checkout-payment-methods__wrapper",["checkout-payment-methods__wrapper--loading",s]]),children:[s&&n(U,{className:"checkout-payment-methods__spinner"}),n("div",{className:P(["checkout-payment-methods__methods",["checkout-payment-methods--full-width",o.length%2!==0]]),children:o==null?void 0:o.map(d=>n(Q,{code:d.code,onChange:a,selected:d.code===v,title:d.displayLabel??!0?d.title:"",icon:d.icon},d.code))}),c&&n("div",{className:"checkout-payment-methods__content",children:c})]})]})},Y=()=>w(D,{"data-testid":"payment-methods-skeleton",children:[n(f,{variant:"heading",size:"medium"}),n(f,{variant:"empty",size:"medium"}),n(f,{size:"xlarge",fullWidth:!0}),n(f,{size:"xlarge",fullWidth:!0})]}),ee=(e,c)=>{const s=J(e);return c(s.current,e)||(s.current=e),s.current},O=({slots:e,setOnChange:c={}})=>{var b,_,H,E,x;const[s]=$(c),r=e==null?void 0:e.Methods;L(()=>{e!=null&&e.Handlers&&console.warn("The `slots.Handlers` prop is deprecated and will be removed in future versions. Use the `Methods` object instead."),c&&console.warn("The `setOnChange` prop is deprecated and will be removed in future versions. Use the `Methods` object instead.")},[]);const a=M.value.data,o=!!M.value.data,v=M.value.pending,u=(a==null?void 0:a.isVirtual)??!1,d=(b=a==null?void 0:a.shippingAddresses)==null?void 0:b[0],V=(a==null?void 0:a.availablePaymentMethods)||[],p=(_=a==null?void 0:a.selectedPaymentMethod)==null?void 0:_.code,S=u?!0:!!d,l=ee(V.filter(t=>{var i;return((i=r==null?void 0:r[t.code])==null?void 0:i.enabled)!==!1}),(t,i)=>t.length!==i.length?!1:t.every((h,C)=>h.code===i[C].code)),g=q(t=>{var i;m.value=t,!(!t||!S)&&t!==p&&(s[t]===!1||((i=r==null?void 0:r[t])==null?void 0:i.setOnChange)===!1||R({code:t}).catch(console.error))},[S,r,p,s]);L(()=>{if(!o||!!!(l!=null&&l.length))return;const i=l[0].code,h=p||m.value,C=h?l.some(W=>W.code===h):!1;g(C?h:i)},[l,o,g,p]);const j=t=>{g(t)},k=m.value?((E=(H=e==null?void 0:e.Methods)==null?void 0:H[m.value])==null?void 0:E.render)||((x=e==null?void 0:e.Handlers)==null?void 0:x[m.value]):null,A=k?n(I,{name:"PaymentMethodContent",slot:k,context:{cartId:z.cartId||"",replaceHTML(t){this.replaceWith(t)}}},k):void 0,T=l.map(t=>{const i=(r==null?void 0:r[t.code])||{};return{...t,...i}});return n(X,{initializing:o===!1,loading:o&&v,onChange:j,options:T,paymentMethodContent:A,selection:m.value})};O.displayName="PaymentMethodsContainer";const ge=G(O);export{ge as PaymentMethods,ge as default};
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
1
2
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
3
|
|
|
3
|
-
export interface
|
|
4
|
-
|
|
5
|
-
handleValidation?: () => boolean;
|
|
6
|
-
handlePlaceOrder: (ctx: PlaceOrderContext) => Promise<void>;
|
|
4
|
+
export interface ContentSlotContext {
|
|
5
|
+
code: string;
|
|
7
6
|
}
|
|
8
|
-
export interface
|
|
7
|
+
export interface HandlePlaceOrderContext {
|
|
9
8
|
code: string;
|
|
10
9
|
cartId: string;
|
|
11
10
|
}
|
|
11
|
+
export interface PlaceOrderProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
handleValidation?: () => boolean;
|
|
14
|
+
handlePlaceOrder: (ctx: HandlePlaceOrderContext) => Promise<void>;
|
|
15
|
+
slots?: {
|
|
16
|
+
Content?: SlotProps<ContentSlotContext>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
12
19
|
export declare const PlaceOrder: {
|
|
13
20
|
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & PlaceOrderProps): import("preact/compat").JSX.Element;
|
|
14
21
|
displayName: string;
|
package/containers/PlaceOrder.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Button as
|
|
3
|
+
import{jsx as a}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Button as E}from"@dropins/tools/components.js";import{classes as S,Slot as g}from"@dropins/tools/lib.js";import{w as y}from"../chunks/withConditionalRendering.js";import{s as P}from"../chunks/store-config.js";import{c as b,a as U,b as u}from"../chunks/transform-store-config.js";import{U as I}from"../chunks/errors.js";import{events as w}from"@dropins/tools/event-bus.js";import{useState as N,useCallback as d,useEffect as T}from"@dropins/tools/preact-compat.js";import{useText as z,Text as D}from"@dropins/tools/i18n.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const H=t=>t instanceof TypeError||t instanceof I,_=({children:t,className:o,disabled:c=!1,onClick:r})=>a("div",{className:S(["checkout-place-order",o]),children:a(E,{className:"checkout-place-order__button","data-testid":"place-order-button",disabled:c,onClick:r,size:"medium",type:"submit",variant:"primary",children:t},"placeOrder")}),l=({disabled:t=!1,handleValidation:o,handlePlaceOrder:c,slots:r,...p})=>{const[f,C]=N(!1),{data:O,pending:k}=b.value,h=!!O,s=z({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),i=d(e=>{U.value=H(e)?s.CheckoutUnexpectedError:e.message},[s]),x=d(async()=>{try{if(!(o?o():!0))return;await c({cartId:P.cartId||"",code:u.value||""})}catch(e){i(e)}},[o,c,i]);return T(()=>{const e=w.on("cart/initialized",n=>{const v=(n==null?void 0:n.items)||[];C(v.some(m=>m.outOfStock||m.insufficientQuantity))},{eager:!0});return()=>{e==null||e.off()}},[]),a(_,{...p,onClick:x,disabled:t||!h||k||f,children:r!=null&&r.Content?a(g,{name:"Content",slot:r.Content,context:{code:u.value||""}}):a(D,{id:"Checkout.PlaceOrder.button"})})};l.displayName="PlaceOrderContainer";const W=y(l);export{W as PlaceOrder,W as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as s,jsxs as n}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{IllustratedMessage as l,Icon as p,Button as f}from"@dropins/tools/components.js";/* empty css */import{classes as a}from"@dropins/tools/lib.js";/* empty css *//* empty css */import{S as h}from"../chunks/OrderError.js";import{useText as d}from"@dropins/tools/i18n.js";/* empty css */import{a as u}from"../chunks/transform-store-config.js";import"../chunks/store-config.js";import"@dropins/tools/event-bus.js";import{useRef as v,useEffect as m}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";function g(e){e.scrollIntoView({behavior:"smooth"}),e.focus()}const k=({className:e,contactSupport:t,errorMessage:i,onClick:c,errorMessageRef:r})=>{const o=d({Title:"Checkout.ServerError.title",Message:"Checkout.ServerError.message",ContactSupport:"Checkout.ServerError.contactSupport",Button:"Checkout.ServerError.button"});return s(l,{"aria-describedby":"checkout-server-error__message","aria-invalid":"true","aria-live":"polite",className:a(["checkout-server-error",e]),"data-testid":"checkout-server-error",heading:i??o.Title,message:n("p",{"data-testid":"checkout-server-error-message",ref:r,id:a(["checkout-server-error__message"]),children:[o.Message,s("br",{}),s("span",{children:t??o.ContactSupport})]}),icon:s(p,{className:a(["checkout-server-error__icon"]),source:h}),action:s(f,{className:a(["checkout-server-error__button"]),onClick:c,children:o.Button})})},z=({onRetry:e,onServerError:t,autoScroll:i=!1})=>{const c=v(null),r=u.value,o=async()=>{e==null||e(),u.value=void 0};return m(()=>{r&&(t==null||t(r))},[r,t]),m(()=>{!i||!r||!c.current||g(c.current)},[r,i]),r?s(k,{errorMessageRef:c,errorMessage:r,onClick:o}):null};export{z as ServerError,z as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as n,jsxs as
|
|
3
|
+
import{jsx as n,jsxs as g,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/store-config.js";import{c as S,e as w,s as C}from"../chunks/transform-store-config.js";import{events as H}from"@dropins/tools/event-bus.js";import{classes as E,Slot as z}from"@dropins/tools/lib.js";import{t as R,s as T}from"../chunks/setShippingMethods.js";/* empty css */import{IllustratedMessage as O,Icon as P,ProgressSpinner as B,RadioButton as D,Price as I,Skeleton as V,SkeletonRow as f}from"@dropins/tools/components.js";import*as r from"@dropins/tools/preact-compat.js";import{useCallback as Z,useMemo as q,useEffect as F}from"@dropins/tools/preact-compat.js";import{useText as $}from"@dropins/tools/i18n.js";import{w as A}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/errors.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const G=e=>r.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.47266 4.90002H15.1851V10.9645H21.2495L23 12.715V17.6124H20.073",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76151 16.7898C9.76151 18.0525 8.72845 19.076 7.46582 19.076C6.20318 19.076 5.17969 18.0429 5.17969 16.7803C5.17969 15.5176 6.20318 14.4941 7.46582 14.4941C8.72845 14.4941 9.75195 15.5176 9.76151 16.7803C9.76151 16.7803 9.76151 16.7803 9.76151 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8726 16.7898C19.8726 18.062 18.8491 19.0855 17.5769 19.0855C16.3047 19.0855 15.2812 18.062 15.2812 16.7898C15.2812 15.5176 16.3047 14.4941 17.5769 14.4941C18.8491 14.4941 19.8726 15.5176 19.8726 16.7898Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),J=({className:e,isLoading:t=!1,onSelectionChange:s=()=>{},options:d,selection:u,...h})=>{const i=$({Title:"Checkout.ShippingMethods.title",EmptyState:"Checkout.ShippingMethods.emptyState"});return d===void 0?n(K,{}):g("div",{...h,className:E(["checkout-shipping-methods",e]),children:[n("h3",{className:"checkout-shipping-methods__title",children:i.Title}),!t&&d.length===0&&n(O,{icon:n(P,{source:G}),message:n("p",{children:i.EmptyState})}),g("div",{className:E(["checkout-shipping-methods__content"]),children:[t&&n(B,{className:"checkout-shipping-methods__spinner"}),n("div",{className:E(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:d.map(o=>n(D,{"data-testid":"shipping-method-radiobutton","aria-busy":t,id:o.value,name:"shipping-method",className:"checkout-shipping-methods__method",label:g(b,{children:[n(I,{amount:o.amount.value,currency:o.amount.currency})," ",n("span",{children:o.carrier.title})]}),description:o.title,value:o.value,checked:(u==null?void 0:u.value)===o.value,onChange:()=>s(o)},o.value))})]})]})},K=()=>g(V,{"data-testid":"shipping-methods-skeleton",children:[n(f,{variant:"heading",size:"small"}),n(f,{variant:"empty",size:"small"}),n(f,{size:"medium",fullWidth:!0}),n(f,{size:"medium",fullWidth:!0})]}),L=(e,t)=>e.code===t.code&&e.carrier.code===t.carrier.code;function Q(e){const t=H.lastPayload("shipping/estimate");if(!(t!=null&&t.address))return;const s={address:t.address,shippingMethod:R(e)};H.emit("shipping/estimate",s)}function U({preSelectedMethod:e,onShippingMethodSelect:t}){const s=S.value.data,d=S.value.pending,u=w.value.data,h=w.value.pending,i=C.value,o=s==null?void 0:s.shippingAddresses,a=o==null?void 0:o[0],v=!!a,N=a==null?void 0:a.availableShippingMethods,m=a==null?void 0:a.selectedShippingMethod,l=N||u,_=Z(c=>{if(!v)return;const k={method_code:c.code,carrier_code:c.carrier.code};T([k]).catch(j=>{console.error("Setting shipping methods on cart failed:",j)})},[v]),x=c=>{C.value=c,t==null||t(c),v||Q(c)},p=q(()=>{if(!(l!=null&&l.length))return;const c=l[0],k=i||m;return k?l.some(M=>L(M,k))?k:c:l.find(W=>W.carrier.code===(e==null?void 0:e.carrierCode)&&W.code===(e==null?void 0:e.methodCode))||c},[i,m,l,e]);return F(()=>{p&&((!i||!L(p,i))&&(C.value=p,t==null||t(p)),(!m||!L(p,m))&&_(p))},[p,i,m,_,t]),{isLoading:d||h,options:l,selection:p,onSelectionChange:x}}const y=({preSelectedMethod:e,shippingMethodsSlot:t,onShippingMethodSelect:s,initialData:d,...u})=>{const{isLoading:h,options:i,selection:o,onSelectionChange:a}=U({preSelectedMethod:e,onShippingMethodSelect:s});return g(b,{children:[n(J,{...u,isLoading:h,onSelectionChange:a,options:i,selection:o}),!h&&t&&n(z,{name:"ShippingMethods",slot:t})]})};y.displayName="ShippingMethodsContainer";const mt=A(y);export{mt as ShippingMethods,mt as default};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { ShippingEstimatePartialAddress, ShippingEstimateShippingMethod, ShippingMethod } from '../models';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type TransformShippingEstimatePartialAddressInput = {
|
|
4
|
+
country_id: string;
|
|
5
|
+
postcode?: string;
|
|
6
|
+
region_id?: number;
|
|
7
|
+
region?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const transformShippingEstimatePartialAddress: (data: TransformShippingEstimatePartialAddressInput) => ShippingEstimatePartialAddress;
|
|
4
10
|
export declare const transformShippingEstimateShippingMethod: (data: ShippingMethod) => ShippingEstimateShippingMethod;
|
|
11
|
+
export {};
|
|
5
12
|
//# sourceMappingURL=transform-shipping-estimate.d.ts.map
|
package/fragments.js
CHANGED
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export * from './get-cart';
|
|
18
18
|
export * from './get-store-config';
|
|
19
|
-
export * from './get-stock-status';
|
|
20
19
|
export * from './is-email-available';
|
|
21
20
|
export * from './get-customer';
|
|
22
|
-
export * from './get-customer-cart-stock-status';
|
|
23
21
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-checkout", "version": "1.
|
|
1
|
+
{"name": "@dropins/storefront-checkout", "version": "1.2.0", "@dropins/tools": "~0.40.0", "license": "SEE LICENSE IN LICENSE.md"}
|
package/render.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
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-xlarge)}
|
|
4
4
|
.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}.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{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 0 var(--spacing-medium) 0}.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;margin-top:var(--spacing-xxsmall)}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:repeat(1,1fr [col-start]);grid-template-rows:1fr}.checkout-login-form__sign-in,.checkout-login-form__sign-out{grid-column-start:1;align-self:flex-start;justify-self:flex-start;margin-top:0;margin-bottom: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-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)}
|
|
5
5
|
.checkout-shipping-methods__title{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--loading{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}
|
|
6
6
|
.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}}
|
|
7
|
-
.checkout-payment-methods__title{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__methods{display:grid;grid-template-columns:1fr 1fr;gap:var(--spacing-medium)}.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-
|
|
7
|
+
.checkout-payment-methods__title{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--loading{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}@media only screen and (min-width: 320px) and (max-width: 768px){.checkout-payment-methods__methods{grid-template-columns:1fr}}
|
|
8
8
|
.checkout-bill-to-shipping-address label{font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);gap:0}`,{styleId:"checkout"});
|
|
9
|
-
import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import"./chunks/store-config.js";import"./chunks/transform-store-config.js";import
|
|
9
|
+
import{jsx as f}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import"./chunks/store-config.js";import"./chunks/transform-store-config.js";import{events as p}from"@dropins/tools/event-bus.js";import{c as g}from"./chunks/synchronizeCheckout.js";import{UIProvider as y}from"@dropins/tools/components.js";import{useState as b,useEffect as h}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"./fragments.js";import"./chunks/errors.js";function O(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S=function(r){return E(r)&&!w(r)};function E(e){return!!e&&typeof e=="object"}function w(e){var r=Object.prototype.toString.call(e);return r==="[object RegExp]"||r==="[object Date]"||M(e)}var v=typeof Symbol=="function"&&Symbol.for,j=v?Symbol.for("react.element"):60103;function M(e){return e.$$typeof===j}function A(e){return Array.isArray(e)?[]:{}}function i(e,r){return r.clone!==!1&&r.isMergeableObject(e)?a(A(e),e,r):e}function P(e,r,t){return e.concat(r).map(function(o){return i(o,t)})}function I(e,r){if(!r.customMerge)return a;var t=r.customMerge(e);return typeof t=="function"?t:a}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 C(e,r){return m(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))}function x(e,r,t){var o={};return t.isMergeableObject(e)&&l(e).forEach(function(n){o[n]=i(e[n],t)}),l(r).forEach(function(n){C(e,n)||(m(e,n)&&t.isMergeableObject(r[n])?o[n]=I(n,t)(e[n],r[n],t):o[n]=i(r[n],t))}),o}function a(e,r,t){t=t||{},t.arrayMerge=t.arrayMerge||P,t.isMergeableObject=t.isMergeableObject||S,t.cloneUnlessOtherwiseSpecified=i;var o=Array.isArray(r),n=Array.isArray(e),c=o===n;return c?o?t.arrayMerge(e,r,t):x(e,r,t):i(r,t)}a.all=function(r,t){if(!Array.isArray(r))throw new Error("first argument should be an array");return r.reduce(function(o,n){return a(o,n,t)},{})};var D=a,B=D;const L=O(B),_={title:"Checkout",LoginForm:{title:"Contact details",account:"Already have an account?",ariaLabel:"Email",invalidEmailError:"Please enter a valid email address.",missingEmailError:"Enter an email address.",emailExists:{alreadyHaveAccount:"It looks like you already have an account.",signInButton:"Sign in",forFasterCheckout:"for a faster checkout."},floatingLabel:"Email *",placeholder:"Enter your email address",signIn:"Sign In",switch:"Do you want to switch account?",signOut:"Sign Out"},ShippingMethods:{title:"Shipping options",emptyState:"This order can't be shipped to the address provided. Please review the address details you entered and make sure they're correct."},BillToShippingAddress:{title:"Bill to shipping address"},PaymentMethods:{title:"Payment",emptyState:"No payment methods available"},OutOfStock:{title:"Your cart contains items that are out of stock",message:"The following items are out of stock:",actions:{reviewCart:"Review cart",removeOutOfStock:"Remove out of stock items"},lowInventory:{one:"Last item!",many:"Only {{count}} left!"},alert:"Out of stock!"},PlaceOrder:{button:"Place Order"},ServerError:{title:"We were unable to process your order",contactSupport:"If you continue to have issues, please contact support.",unexpected:"An unexpected error occurred while processing your order. Please try again later.",button:"Try again"},EmptyCart:{title:"Your cart is empty",button:"Start shopping"},ErrorBanner:{genericMessage:"Server error detected. Please check your connection and try again."},MergedCartBanner:{items:{one:"1 item from a previous session was added to your cart. Please review your new subtotal.",many:"{{count}} items from a previous session were added to your cart. Please review your new subtotal."}},EstimateShipping:{estimated:"Estimated Shipping",freeShipping:"Free",label:"Shipping",taxToBeDetermined:"TBD",withTaxes:"Including taxes",withoutTaxes:"Excluding taxes"}},R={Checkout:_},U={default:R},k=({children:e})=>{var c;const[r,t]=b(),o=(c=g.getConfig())==null?void 0:c.langDefinitions;h(()=>{const s=p.on("locale",u=>{u!==r&&t(u)},{eager:!0});return()=>{s==null||s.off()}},[r]);const n=L(U,o??{});return f(y,{lang:r,langDefinitions:n,children:e})},Q=new d(f(k,{}));export{k as Provider,Q as render};
|
package/utils/index.d.ts
CHANGED