@dropins/storefront-checkout 1.4.0-beta2 → 2.0.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fragments.d.ts +2 -0
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +1 -1
- package/api/{subscribeEmailToNewsletter/graphql/subscribeEmailToNewsletter.graphql.d.ts → graphql/CartPaymentMethodFragment.graphql.d.ts} +4 -3
- package/api/index.d.ts +0 -1
- package/api/initialize/initialize.d.ts +3 -3
- package/api.js +7 -13
- package/chunks/ConditionalWrapper.js +1 -1
- package/chunks/errors.js +13 -0
- package/chunks/setBillingAddress.js +2 -2
- package/chunks/setGuestEmailOnCart.js +4 -4
- package/chunks/setPaymentMethod.js +2 -2
- package/chunks/setShippingMethods.js +2 -2
- package/chunks/synchronizeCheckout.js +2 -2
- package/chunks/values.js +3 -0
- package/components/ConditionalWrapper/ConditionalWrapper.d.ts +2 -2
- package/components/PaymentMethods/PaymentMethods.d.ts +2 -2
- package/components/ShippingMethods/ShippingMethods.d.ts +2 -2
- package/components/index.d.ts +0 -1
- package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +3 -1
- package/containers/BillToShippingAddress.js +1 -1
- package/containers/EstimateShipping/EstimateShipping.d.ts +5 -2
- package/containers/EstimateShipping.js +1 -1
- package/containers/LoginForm/LoginForm.d.ts +3 -1
- package/containers/LoginForm.js +1 -1
- package/containers/MergedCartBanner/MergedCartBanner.d.ts +6 -3
- package/containers/MergedCartBanner.js +1 -1
- package/containers/OutOfStock/OutOfStock.d.ts +2 -1
- package/containers/OutOfStock.js +1 -1
- package/containers/PaymentMethods/PaymentMethods.d.ts +4 -18
- package/containers/PaymentMethods.js +1 -1
- package/containers/PlaceOrder/PlaceOrder.d.ts +2 -3
- package/containers/PlaceOrder.js +1 -1
- package/containers/ServerError/ServerError.d.ts +2 -1
- package/containers/ServerError.js +1 -1
- package/containers/ShippingMethods/ShippingMethods.d.ts +6 -7
- package/containers/ShippingMethods.js +1 -1
- package/containers/TermsAndConditions/TermsAndConditions.d.ts +2 -1
- package/containers/TermsAndConditions.js +1 -1
- package/containers/index.d.ts +0 -1
- package/data/models/index.d.ts +1 -1
- package/data/models/shipping-estimate.d.ts +4 -0
- package/data/models/store-config.d.ts +0 -1
- package/data/models/values.d.ts +9 -0
- package/data/transforms/transform-cart.d.ts +1 -1
- package/data/transforms/transform-shipping-methods.d.ts +1 -1
- package/fragments.js +16 -6
- package/i18n/en_US.json.d.ts +0 -3
- package/lib/enqueueRequest.d.ts +1 -1
- package/lib/events.d.ts +8 -0
- package/lib/index.d.ts +3 -0
- package/lib/preact.d.ts +1 -1
- package/lib/values.d.ts +17 -0
- package/package.json +1 -1
- package/render/render.d.ts +1 -1
- package/render.js +3 -4
- package/signals/ShippingEstimateSignal.d.ts +1 -1
- package/signals/index.d.ts +0 -4
- package/{api/getCart/fixtures.d.ts → tests/fixtures/cart.d.ts} +2 -2
- package/{api/getCustomer/fixtures.d.ts → tests/fixtures/customer.d.ts} +1 -1
- package/tests/fixtures/payments.d.ts +8 -0
- package/{api/estimateShippingMethods/fixtures.d.ts → tests/fixtures/shipping.d.ts} +1 -1
- package/tests/integration/utils/setup.d.ts +1 -1
- package/types/TitleProps.d.ts +1 -1
- package/__generated__/types.d.ts +0 -12644
- package/api/subscribeEmailToNewsletter/index.d.ts +0 -18
- package/api/subscribeEmailToNewsletter/subscribeEmailToNewsletter.d.ts +0 -4
- package/chunks/IsBillToShippingSignal.js +0 -14
- package/chunks/SelectedPaymentMethodSignal.js +0 -3
- package/chunks/SelectedShippingMethodSignal.js +0 -3
- package/chunks/subscription-email-statuses.js +0 -3
- package/components/Newsletter/Newsletter.d.ts +0 -7
- package/components/Newsletter/NewsletterSkeleton.d.ts +0 -4
- package/components/Newsletter/index.d.ts +0 -20
- package/containers/Newsletter/Newsletter.d.ts +0 -9
- package/containers/Newsletter/index.d.ts +0 -19
- package/containers/Newsletter.d.ts +0 -3
- package/containers/Newsletter.js +0 -3
- package/data/models/subscription-email-statuses.d.ts +0 -24
- package/signals/IsBillToShippingSignal.d.ts +0 -18
- package/signals/IsSubscribedToNewsletterSignal.d.ts +0 -18
- package/signals/SelectedPaymentMethodSignal.d.ts +0 -18
- package/signals/SelectedShippingMethodSignal.d.ts +0 -4
package/api/fragments.d.ts
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
+
export { BILLING_CART_ADDRESS_FRAGMENT, SHIPPING_CART_ADDRESS_FRAGMENT, } from './graphql/CartAddressFragment.graphql';
|
|
18
|
+
export { AVAILABLE_PAYMENT_METHOD_FRAGMENT, SELECTED_PAYMENT_METHOD_FRAGMENT, } from './graphql/CartPaymentMethodFragment.graphql';
|
|
17
19
|
export { CHECKOUT_DATA_FRAGMENT } from './graphql/CheckoutDataFragment.graphql';
|
|
18
20
|
export { CUSTOMER_FRAGMENT } from './graphql/CustomerFragment.graphql';
|
|
19
21
|
//# sourceMappingURL=fragments.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const getStoreConfigQuery = "\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
|
|
17
|
+
export declare const getStoreConfigQuery = "\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";
|
|
18
18
|
//# sourceMappingURL=getStoreConfig.graphql.d.ts.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ADOBE CONFIDENTIAL
|
|
3
3
|
* __________________
|
|
4
4
|
*
|
|
5
|
-
* Copyright
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
6
|
* All Rights Reserved.
|
|
7
7
|
*
|
|
8
8
|
* NOTICE: All information contained herein is, and remains
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const
|
|
18
|
-
|
|
17
|
+
export declare const AVAILABLE_PAYMENT_METHOD_FRAGMENT = "\n fragment AVAILABLE_PAYMENT_METHOD_FRAGMENT on AvailablePaymentMethod {\n code\n title\n }\n";
|
|
18
|
+
export declare const SELECTED_PAYMENT_METHOD_FRAGMENT = "\n fragment SELECTED_PAYMENT_METHOD_FRAGMENT on SelectedPaymentMethod {\n code\n title\n }\n";
|
|
19
|
+
//# sourceMappingURL=CartPaymentMethodFragment.graphql.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -30,7 +30,6 @@ export * from './setGuestEmailOnCart';
|
|
|
30
30
|
export * from './setPaymentMethod';
|
|
31
31
|
export * from './setShippingAddress';
|
|
32
32
|
export * from './setShippingMethods';
|
|
33
|
-
export * from './subscribeEmailToNewsletter';
|
|
34
33
|
export * from './synchronizeCheckout';
|
|
35
34
|
export * from '../errors';
|
|
36
35
|
export { getStoreConfigCache } from '../lib/state';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cart as CartModel, Customer as CustomerModel } from '../../data/models';
|
|
2
|
-
import { Lang } from '
|
|
3
|
-
import { Initializer, Model } from '
|
|
2
|
+
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
|
+
import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
|
|
4
4
|
|
|
5
5
|
export type ConfigProps = {
|
|
6
6
|
langDefinitions?: Lang;
|
|
@@ -10,5 +10,5 @@ export type ConfigProps = {
|
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
12
|
export declare const initialize: Initializer<ConfigProps>;
|
|
13
|
-
export declare const config: import('
|
|
13
|
+
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
|
14
14
|
//# sourceMappingURL=initialize.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{t as
|
|
3
|
+
import{t as S,a as f,b as E}from"./chunks/synchronizeCheckout.js";import{d as j,c as Y,g as J,i as W,e as X,r as Z,s as tt}from"./chunks/synchronizeCheckout.js";import{s as p,M as l,c as I,d as c,Q as A,a as M,e as T}from"./chunks/errors.js";import{D as st,F as it,I as rt,p as at,n as nt,o as ot,S as dt,U as pt,k as ct,l as gt,m as ht,g as mt,r as _t,f as ut,i as lt,j as At}from"./chunks/errors.js";import"@dropins/tools/lib.js";import{a as y}from"./chunks/setShippingMethods.js";import{s as St}from"./chunks/setShippingMethods.js";import"@dropins/tools/event-bus.js";import{A as O}from"./chunks/checkout.js";import{g as Et,i as It,s as Mt}from"./chunks/setGuestEmailOnCart.js";import{s as yt}from"./chunks/setBillingAddress.js";import{s as xt}from"./chunks/setPaymentMethod.js";import{CHECKOUT_DATA_FRAGMENT as C}from"./fragments.js";import{g as x}from"./chunks/values.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const G=`
|
|
4
4
|
mutation estimateShippingMethods(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$address: EstimateAddressInput!
|
|
@@ -26,7 +26,7 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
|
|
|
26
26
|
error_message
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`,
|
|
29
|
+
`,N=e=>e?e.filter(t=>!!t).map(t=>({id:t.agreement_id,name:t.name,mode:O[t.mode],text:t.checkbox_text,content:{value:t.content,html:t.is_html,height:t.content_height??null}})):[],K=async e=>{var h,m,_,u;const t=p.cartId,r=((h=e==null?void 0:e.criteria)==null?void 0:h.country_code)??((m=p.config)==null?void 0:m.defaultCountry);if(!t)throw new l;if(!r)throw new I;const{region_id:s,region_name:o,zip:a}=(e==null?void 0:e.criteria)??{},i=s||o?{region_id:typeof s=="string"?parseInt(s,10):s,region_code:o}:void 0,n={country_code:r,...a&&{postcode:a},...i&&{region:{...i.region_id&&{region_id:i.region_id},...i.region_code&&{region_code:i.region_code}}}},d={country_id:r,region:(_=n.region)==null?void 0:_.region_code,region_id:(u=n.region)==null?void 0:u.region_id,postcode:a},g=await c({options:{variables:{cartId:t,address:n}},path:"estimateShippingMethods",query:G,queueName:A.ShippingEstimate,transformer:S,type:"mutation"});return M.value={address:y(d),options:g},g},$=`
|
|
30
30
|
query GET_CHECKOUT_AGREEMENTS {
|
|
31
31
|
checkoutAgreements {
|
|
32
32
|
agreement_id
|
|
@@ -38,8 +38,8 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
|
|
|
38
38
|
name
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
`,
|
|
42
|
-
mutation
|
|
41
|
+
`,P=async()=>await c({defaultValueOnFail:[],options:{method:"GET",cache:"no-cache"},path:"checkoutAgreements",query:$,transformer:N,type:"query"}),U=`
|
|
42
|
+
mutation setShippingAddress(
|
|
43
43
|
$cartId: String!
|
|
44
44
|
$shippingAddressInput: ShippingAddressInput!
|
|
45
45
|
) {
|
|
@@ -52,7 +52,7 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
${
|
|
55
|
+
${C}
|
|
56
56
|
`,v=`
|
|
57
57
|
mutation SET_SHIPPING_ADDRESS_ON_CART_AND_USE_AS_BILLING_MUTATION(
|
|
58
58
|
$cartId: String!
|
|
@@ -75,11 +75,5 @@ import{t as E,a as f,b as C}from"./chunks/synchronizeCheckout.js";import{d as X,
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
${
|
|
79
|
-
`,
|
|
80
|
-
mutation subscribeEmailToNewsletter($email: String!) {
|
|
81
|
-
subscribeEmailToNewsletter(email: $email) {
|
|
82
|
-
status
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
`,Y=async t=>{if(!t)throw new O;return await d({defaultValueOnFail:T.Error,options:{variables:{email:t}},path:"subscribeEmailToNewsletter.status",query:F,type:"mutation"})};export{pt as DEFAULT_COUNTRY,gt as FetchError,mt as InvalidArgument,ht as MissingBillingAddress,_ as MissingCart,M as MissingCountry,O as MissingEmail,ut as MissingPaymentMethod,b as MissingShippinghAddress,lt as STORE_CONFIG_DEFAULTS,_t as UnexpectedError,X as authenticateCustomer,Z as config,L as estimateShippingMethods,At as fetchGraphQl,tt as getCart,V as getCheckoutAgreements,St as getConfig,yt as getCustomer,Et as getStoreConfig,nt as getStoreConfigCache,et as initialize,st as initializeCheckout,Nt as isEmailAvailable,ft as removeFetchGraphQlHeader,it as resetCheckout,wt as setBillingAddress,Ct as setEndpoint,Tt as setFetchGraphQlHeader,It as setFetchGraphQlHeaders,bt as setGuestEmailOnCart,Gt as setPaymentMethod,j as setShippingAddress,dt as setShippingMethodsOnCart,Y as subscribeEmailToNewsletter,rt as synchronizeCheckout};
|
|
78
|
+
${C}
|
|
79
|
+
`,z=async({address:e,customerAddressId:t,pickupLocationCode:r})=>{const s=p.cartId;if(!s)throw new l;const o=()=>{if(t)return{customer_address_id:t};if(r)return{pickup_location_code:r};if(!e)throw new T;return{address:f(e)}},a=x("isBillToShipping"),i=a?v:U,n=a?"setBillingAddressOnCart.cart":"setShippingAddressesOnCart.cart",d={cartId:s,shippingAddressInput:o()};return await c({type:"mutation",query:i,options:{variables:d},path:n,queueName:A.CartUpdate,transformer:E})};export{st as DEFAULT_COUNTRY,it as FetchError,rt as InvalidArgument,at as MissingBillingAddress,l as MissingCart,I as MissingCountry,nt as MissingEmail,ot as MissingPaymentMethod,T as MissingShippinghAddress,dt as STORE_CONFIG_DEFAULTS,pt as UnexpectedError,j as authenticateCustomer,Y as config,K as estimateShippingMethods,ct as fetchGraphQl,J as getCart,P as getCheckoutAgreements,gt as getConfig,Et as getCustomer,ht as getStoreConfig,mt as getStoreConfigCache,W as initialize,X as initializeCheckout,It as isEmailAvailable,_t as removeFetchGraphQlHeader,Z as resetCheckout,yt as setBillingAddress,ut as setEndpoint,lt as setFetchGraphQlHeader,At as setFetchGraphQlHeaders,Mt as setGuestEmailOnCart,xt as setPaymentMethod,z as setShippingAddress,St as setShippingMethodsOnCart,tt as synchronizeCheckout};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as
|
|
3
|
+
import{events as s}from"@dropins/tools/event-bus.js";import{jsxs as c,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";function i(){return s.lastPayload("checkout/initialized")??null}function e(){return s.lastPayload("checkout/updated")??null}function f(){var n;const t=e()??i();return!!((n=t==null?void 0:t.shippingAddresses)!=null&&n.length)}function m(){const t=e()??i();return!!(t!=null&&t.isVirtual)}function g(){const t=e()??i();return(t==null?void 0:t.email)??null}function C(t,n){return function(u){const{initialized:o=!0,visible:a=!0,...l}=u;return c("div",{className:"conditional-wrapper",children:[a&&!o&&r(n,{}),a&&o&&r(t,{...l})]})}}export{C as W,g as a,e as g,f as h,m as i};
|
package/chunks/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import"@dropins/tools/lib.js";import{events as C}from"@dropins/tools/event-bus.js";import{signal as E,computed as I}from"@dropins/tools/signals.js";import{FetchGraphQL as w}from"@dropins/tools/fetch-graphql.js";const A={authenticated:!1,cartId:null,initialized:!1,config:null},N=new Proxy(A,{set(e,t,s){return e[t]=s,!0},get(e,t){return e[t]}}),V=()=>N.config;var i=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(i||{}),S=(e=>(e.CartUpdate="cartUpdate",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(S||{});const d=new Map,g=new Map,c=E(new Set),U=new Map;U.set("cartUpdate",e=>{C.emit("checkout/updated",e)});async function D(e){g.set(e,!0);const t=d.get(e);let s;for(;t.length>0;){const o=t.shift();try{const n=await o.requestFn();o.resolve(n),s=n}catch(n){o.reject(n)}}g.set(e,!1);const r=new Set(c.value);r.delete(e),c.value=r;const a=U.get(e);a&&s&&a(s)}function G(e,t="default"){d.has(t)||d.set(t,[]);const s=d.get(t),r=new Promise((o,n)=>{s.push({requestFn:e,resolve:o,reject:n})}),a=new Set(c.value);return a.add(t),c.value=a,g.get(t)||D(t),r}const B=I(()=>c.value.has("cartUpdate")),z=I(()=>c.value.has("shippingEstimate")),q=["sender_email","recipient_email"];function X(e){return e.filter(t=>!t.path||!q.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}const v=e=>{throw e instanceof DOMException&&e.name==="AbortError"||C.emit("error",{source:"checkout",type:"network",error:e}),e};function T(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}async function L(e){const{defaultValueOnFail:t,options:s,path:r,query:a,queueName:o,transformer:n,type:p}=e;try{const l=async()=>{const{data:y,errors:_}=await k(a,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...s}).catch(v);if(_){const m=X(_);if(m.length>0)throw new P(m)}let h=T(y,r);if(h===void 0)throw new Error(`No data found at path: ${r}`);return n?n(h):h};return p==="mutation"?await G(l,o):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:i.EXCLUDING_TAX}},Y=async()=>await L({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:b,type:"query"});function M(e){switch(e){case 1:return i.EXCLUDING_TAX;case 2:return i.INCLUDING_TAX;case 3:return i.INCLUDING_EXCLUDING_TAX;default:return i.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:M(r)}}}const $=E(),{setEndpoint:J,setFetchGraphQlHeader:K,removeFetchGraphQlHeader:W,setFetchGraphQlHeaders:Z,fetchGraphQl:k,getConfig:ee}=new w().getMethods();class P extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class u extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class te extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class se extends u{constructor(){super("Cart ID is required")}}class re extends u{constructor(){super("Email is required")}}class ne extends u{constructor(){super("Payment method code is required")}}class ae extends u{constructor(){super("Shipping address is required")}}class oe extends u{constructor(){super("Billing address is required")}}class ie extends u{constructor(){super("Country Code is required")}}export{F as D,P as F,u as I,se as M,S as Q,f as S,i as T,te as U,$ as a,z as b,ie as c,L as d,ae as e,J as f,V as g,B as h,K as i,Z as j,k,ee as l,Y as m,re as n,ne as o,oe as p,W as r,N as s};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{a as
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{a as d,b as l}from"./synchronizeCheckout.js";import{s as o,M as p,p as u,d as _,Q as f}from"./errors.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{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{a as o,b as d}fr
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
${e}
|
|
13
|
-
`,
|
|
13
|
+
`,M=async({address:a,customerAddressId:s,sameAsShipping:t=!1,useForShipping:n=!1})=>{const r=o.cartId;if(!r)throw new p;const i={cart_id:r,billing_address:{same_as_shipping:t,use_for_shipping:n}};if(!t&&s&&(i.billing_address.customer_address_id=s),!t&&!s){if(!a)throw new u;i.billing_address.address=d(a)}return await _({options:{variables:{input:i}},path:"setBillingAddressOnCart.cart",query:m,queueName:f.CartUpdate,transformer:l,type:"mutation"})};export{M as s};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m
|
|
3
|
+
import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";import{s as m,d as r,n as l,M as u,Q as c}from"./errors.js";import"@dropins/tools/event-bus.js";import{merge as E}from"@dropins/tools/lib.js";import{c as f,b as p}from"./synchronizeCheckout.js";const C=t=>{var i,e,s;if(!t)return null;const a={firstName:t.firstname||"",lastName:t.lastname||"",email:t.email||""};return E(a,(s=(e=(i=f.getConfig().models)==null?void 0:i.CustomerModel)==null?void 0:e.transformer)==null?void 0:s.call(e,t))},y=t=>!!(t!=null&&t.is_email_available),A=`
|
|
4
4
|
query getCustomer {
|
|
5
5
|
customer {
|
|
6
6
|
...CUSTOMER_FRAGMENT
|
|
@@ -8,13 +8,13 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
${o}
|
|
11
|
-
`,
|
|
11
|
+
`,v=async()=>m.authenticated?await r({options:{method:"GET",cache:"no-cache"},path:"customer",query:A,transformer:C,type:"query"}):null,g=`
|
|
12
12
|
query isEmailAvailable($email: String!) {
|
|
13
13
|
isEmailAvailable(email: $email) {
|
|
14
14
|
is_email_available
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
`,
|
|
17
|
+
`,q=async t=>{if(!t)throw new l;return await r({options:{method:"GET",cache:"no-cache",variables:{email:t}},path:"isEmailAvailable",query:g,transformer:y,type:"query"})},h=`
|
|
18
18
|
mutation setGuestEmail($cartId: String!, $email: String!) {
|
|
19
19
|
setGuestEmailOnCart(input: { cart_id: $cartId, email: $email }) {
|
|
20
20
|
cart {
|
|
@@ -24,4 +24,4 @@ import{CUSTOMER_FRAGMENT as o,CHECKOUT_DATA_FRAGMENT as n}from"../fragments.js";
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
${n}
|
|
27
|
-
|
|
27
|
+
`,N=async t=>{const a=m.cartId;if(!a)throw new u;return await r({options:{variables:{cartId:a,email:t}},path:"setGuestEmailOnCart.cart",query:h,queueName:c.CartUpdate,transformer:p,type:"mutation"})};export{v as g,q as i,N as s};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./synchronizeCheckout.js";import{s as o
|
|
3
|
+
import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./synchronizeCheckout.js";import{s as o,M as n,o as s,d as m,Q as i}from"./errors.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";const d=`
|
|
4
4
|
mutation setPaymentMethod(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$paymentMethod: PaymentMethodInput!
|
|
@@ -15,4 +15,4 @@ import{CHECKOUT_DATA_FRAGMENT as e}from"../fragments.js";import{b as r}from"./sy
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
${e}
|
|
18
|
-
`,
|
|
18
|
+
`,u=async t=>{const a=o.cartId;if(!a)throw new n;if(!t)throw new s;return await m({options:{variables:{cartId:a,paymentMethod:t}},path:"setPaymentMethodOnCart.cart",query:d,queueName:i.CartUpdate,transformer:r,type:"mutation"})};export{u as s};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as r}from"./
|
|
3
|
+
import{s as r,M as i,d as n,Q as e}from"./errors.js";import{b as s}from"./synchronizeCheckout.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as p}from"../fragments.js";const g=t=>({countryCode:t.country_id,postCode:t.postcode||"",...t.region_id?{regionId:Number(t.region_id)}:{...t.region?{region:t.region}:{}}}),C=t=>({carrierCode:t.carrier.code||"",methodCode:t.code||"",amount:t.amount,amountExclTax:t.amountExclTax,amountInclTax:t.amountInclTax}),a=`
|
|
4
4
|
mutation setShippingMethods(
|
|
5
5
|
$cartId: String!
|
|
6
6
|
$shippingMethods: [ShippingMethodInput]!
|
|
@@ -15,4 +15,4 @@ import{s as r}from"./subscription-email-statuses.js";import{b as i}from"./synchr
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
${p}
|
|
18
|
-
`,
|
|
18
|
+
`,M=async t=>{const o=r.cartId;if(!o)throw new i;return await n({type:"mutation",query:a,queueName:e.CartUpdate,options:{variables:{cartId:o,shippingMethods:t}},path:"setShippingMethodsOnCart.cart",transformer:s})};export{g as a,M as s,C as t};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{s as
|
|
3
|
+
import{s as r,M as h,d as g,m as y}from"./errors.js";import{merge as v,Initializer as C}from"@dropins/tools/lib.js";import{events as o}from"@dropins/tools/event-bus.js";import{CHECKOUT_DATA_FRAGMENT as c}from"../fragments.js";const A=async(e=!1)=>{r.authenticated=e},x=(e,t)=>e.amount.value-t.amount.value,b=e=>e==null,l=e=>!(!e||!e.method_code||!e.method_title||b(e.amount.value)||!e.amount.currency),u=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}}}),I=e=>{if(l(e))return u(e)},M=e=>e?e.filter(l).map(t=>u(t)).sort(x):[],T=e=>e?!!e.code&&!!e.label:!1,S=e=>{if(!T(e))return;const{code:t,label:i,region_id:n}=e;return n?{code:t,name:i,id:n}:{code:t,name:i}},N=e=>{const{code:t,label:i}=e;return{value:t,label:i}},k=e=>e?"code"in e&&"value"in e:!1,z=e=>e.filter(k).map(t=>{const{code:i,value:n}=t;return{code:i,value:n}}),a=e=>{const t=e.street.filter(Boolean);return{id:(e==null?void 0:e.id)||void 0,city:e.city,company:e.company||void 0,country:N(e.country),customAttributes:z(e.custom_attributes),firstName:e.firstname,lastName:e.lastname,postCode:e.postcode||void 0,region:S(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}},E=e=>{if(e)return a(e)},w=e=>e.filter(t=>!!t).map(t=>{const{available_shipping_methods:i,selected_shipping_method:n,same_as_billing:s,..._}=t;return{...a(_),availableShippingMethods:M(i),selectedShippingMethod:I(n),sameAsBilling:s}}),U=e=>({city:e.city,company:e.company,country_code:e.countryCode,custom_attributes:e.customAttributes.map(t=>({attribute_code:t.code,value:t.value})),firstname:e.firstName,lastname:e.lastName,postcode:e.postcode,region:e.region,region_id:e.regionId,save_in_address_book:e.saveInAddressBook??!0,street:e.street,telephone:e.telephone,vat_id:e.vatId,prefix:e.prefix,suffix:e.suffix,middlename:e.middleName,fax:e.fax}),P=e=>{if(e)return{code:e.code,title:e.title}},$=e=>{if(e)return e.filter(t=>!!t).map(t=>{const{code:i,title:n}=t;return{code:i,title:n}})},q=e=>{var i,n,s;if(!e)return;const t={availablePaymentMethods:$(e.available_payment_methods),billingAddress:E(e.billing_address),email:e.email??void 0,id:e.id,isEmpty:e.total_quantity===0,isVirtual:e.is_virtual,selectedPaymentMethod:P(e.selected_payment_method),shippingAddresses:w(e.shipping_addresses),isGuest:!r.authenticated};return v(t,(s=(n=(i=R.getConfig().models)==null?void 0:i.CartModel)==null?void 0:n.transformer)==null?void 0:s.call(n,e))},B=`
|
|
4
4
|
query getCart($cartId: String!) {
|
|
5
5
|
cart(cart_id: $cartId) {
|
|
6
6
|
...CHECKOUT_DATA_FRAGMENT
|
|
@@ -16,4 +16,4 @@ import{s as n}from"./subscription-email-statuses.js";import{merge as h,Initializ
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
${c}
|
|
19
|
-
`,m=async()=>{const e=
|
|
19
|
+
`,m=async()=>{const e=r.cartId,t=r.authenticated===!1,i=t?B:D,n=t?{cartId:e}:{};if(t&&!e)throw new h;return await g({type:"query",query:i,options:{method:"POST",cache:"no-cache",variables:n},path:"cart",transformer:q})},G=()=>[o.on("authenticated",A,{eager:!0}),o.on("cart/initialized",p,{eager:!0}),o.on("cart/reset",O),o.on("cart/updated",d)],f=new C({init:async e=>{const t={...e};f.config.setConfig(t)},listeners:G}),R=f.config,p=async e=>{if(r.initialized)return d(e);r.config||(r.config=await y());const t=e?e.id:null;r.cartId=t;const i=t?await m():null;r.initialized=!0,o.emit("checkout/initialized",i||null)},O=()=>{r.cartId=null,o.emit("checkout/updated",null)},d=async e=>{if(!r.initialized)return p(e);const t=e?e.id:null;r.cartId=t;const i=t?await m():null;o.emit("checkout/updated",i||null)};export{U as a,q as b,R as c,A as d,p as e,m as g,f as i,O as r,d as s,M as t};
|
package/chunks/values.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{events as l}from"@dropins/tools/event-bus.js";const a={email:"",isBillToShipping:!0,selectedPaymentMethod:null,selectedShippingMethod:null};function s(e){const n={...l.lastPayload("checkout/values")??a,...e};l.emit("checkout/values",n)}function u(e){const t=l.lastPayload("checkout/values");return t&&e in t?t[e]:null}export{u as g,s as n};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FunctionComponent } from 'preact';
|
|
2
2
|
|
|
3
3
|
export interface ConditionalProps {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
initialized?: boolean;
|
|
5
|
+
visible?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare function WithConditionals<P extends object>(Component: FunctionComponent<P>, Skeleton: FunctionComponent): FunctionComponent<P & ConditionalProps>;
|
|
8
8
|
//# sourceMappingURL=ConditionalWrapper.d.ts.map
|
|
@@ -8,10 +8,10 @@ interface ExtendedPaymentMethod extends PaymentMethodConfig, PaymentMethod {
|
|
|
8
8
|
}
|
|
9
9
|
export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading' | 'title'> {
|
|
10
10
|
isLoading?: boolean;
|
|
11
|
-
onChange?: (value:
|
|
11
|
+
onChange?: (value: PaymentMethod) => void;
|
|
12
12
|
options?: ExtendedPaymentMethod[];
|
|
13
13
|
paymentMethodContent?: VNode;
|
|
14
|
-
selection
|
|
14
|
+
selection: PaymentMethod | null;
|
|
15
15
|
title?: VNode;
|
|
16
16
|
UIComponentType?: UIComponentType;
|
|
17
17
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ShippingMethod } from '../../data/models';
|
|
2
|
+
import { UIComponentType } from '../../types/ComponentTypes';
|
|
2
3
|
import { FunctionComponent, VNode } from 'preact';
|
|
3
4
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
|
-
import { UIComponentType } from '../../types/ComponentTypes';
|
|
5
5
|
|
|
6
6
|
export interface ShippingMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
7
7
|
onSelectionChange?: (method: ShippingMethod) => void;
|
|
8
8
|
isLoading?: boolean;
|
|
9
9
|
options: ShippingMethod[];
|
|
10
|
-
selection
|
|
10
|
+
selection: ShippingMethod | null;
|
|
11
11
|
title?: VNode;
|
|
12
12
|
UIComponentType?: UIComponentType;
|
|
13
13
|
}
|
package/components/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export * from './ConditionalWrapper/index';
|
|
|
19
19
|
export * from './EstimateShipping';
|
|
20
20
|
export * from './LoginForm';
|
|
21
21
|
export * from './Markup';
|
|
22
|
-
export * from './Newsletter';
|
|
23
22
|
export * from './OutOfStock';
|
|
24
23
|
export * from './PaymentMethods';
|
|
25
24
|
export * from './PlaceOrder';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Container } from '
|
|
1
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
|
|
3
3
|
export interface BillToShippingAddressProps {
|
|
4
4
|
onChange?: (checked: boolean) => void;
|
|
5
|
+
active?: boolean;
|
|
6
|
+
autoSync?: boolean;
|
|
5
7
|
}
|
|
6
8
|
export declare const BillToShippingAddress: Container<BillToShippingAddressProps>;
|
|
7
9
|
//# sourceMappingURL=BillToShippingAddress.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as p}from"@dropins/tools/preact-jsx-runtime.js";import{h as x}from"../chunks/errors.js";import"@dropins/tools/lib.js";import{events as f}from"@dropins/tools/event-bus.js";import{W as _,h as z,g as I}from"../chunks/ConditionalWrapper.js";import{n as h}from"../chunks/values.js";import{s as V}from"../chunks/setBillingAddress.js";/* empty css */import{Skeleton as E,SkeletonRow as N,Checkbox as U}from"@dropins/tools/components.js";import{c as w}from"../chunks/classes.js";import{useText as y}from"@dropins/tools/i18n.js";import{useState as m,useRef as D,useCallback as g,useEffect as k}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const P=()=>p(E,{className:"bill-to-shipping-address__skeleton","data-testid":"bill-to-shipping-skeleton",children:p(N,{size:"small",variant:"row"})}),R=({className:s,checked:e,disabled:r,onChange:c})=>{const l=y({title:"Checkout.BillToShippingAddress.title"});return p("div",{className:"checkout-bill-to-shipping-address",children:p(U,{checked:e,className:w(["checkout-bill-to-shipping-address__checkbox",s]),"data-testid":"bill-to-shipping-checkbox",disabled:r,label:l.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:c})})},W=_(R,P);function j(s){var l;const e=(l=s.shippingAddresses)==null?void 0:l[0],r=!!s.billingAddress;return(e==null?void 0:e.sameAsBilling)??!r}const ii=({onChange:s,active:e=!0,autoSync:r=!0})=>{const[c,l]=m(!1),[B,S]=m(!1),[b,a]=m(!0),d=D(!1),A=x.value,T=g(i=>{const t=i.target.checked;a(t),s==null||s(t),h({isBillToShipping:t}),r&&t&&z()&&V({sameAsShipping:!0}).catch(console.error)},[r,s]),n=g(i=>{const o=!i||(i==null?void 0:i.isEmpty),t=!!(i!=null&&i.isVirtual);if(o||t){S(t),a(!1),h({isBillToShipping:!1}),d.current=!1;return}if(!d.current){const u=j(i);a(u),d.current=!0,s==null||s(u),h({isBillToShipping:u})}},[s]);return k(()=>{if(!e)return;const i=I();if(i){l(!0),n(i);return}const o=f.on("checkout/initialized",t=>{l(!0),n(t)},{eager:!0});return()=>{o==null||o.off()}},[e,n]),k(()=>{if(!e)return;const i=f.on("checkout/updated",n,{eager:!1});return()=>{i==null||i.off()}},[e,n]),p(W,{checked:b,disabled:A,initialized:c,visible:e&&!B,onChange:T})};export{ii as BillToShippingAddress,ii as default};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface EstimateShippingProps {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const EstimateShipping: Container<EstimateShippingProps>;
|
|
4
7
|
//# sourceMappingURL=EstimateShipping.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as
|
|
3
|
+
import{jsx as i,jsxs as k}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as B,SkeletonRow as U,Price as h}from"@dropins/tools/components.js";import{W as z,g as G}from"../chunks/ConditionalWrapper.js";import"../chunks/TermsAndConditions.js";import{VComponent as C,classes as I}from"@dropins/tools/lib.js";import{useText as _}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{s as P,T as D}from"../chunks/errors.js";import{events as d}from"@dropins/tools/event-bus.js";import{useState as V,useCallback as b,useEffect as x}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const X=()=>i(B,{"data-testid":"estimate-shipping-skeleton",children:i(U,{size:"xsmall"})}),j=({label:n,price:t,priceExclTax:a,taxExcluded:o=!1,taxIncluded:c=!1})=>{const l=_({withTaxes:"Checkout.EstimateShipping.withTaxes",withoutTaxes:"Checkout.EstimateShipping.withoutTaxes"});return k("div",{className:"checkout-estimate-shipping","data-testid":"estimate-shipping",children:[i(C,{className:"checkout-estimate-shipping__label",node:n}),i(C,{className:"checkout-estimate-shipping__price",node:t}),c&&i("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included",children:l.withTaxes}),o&&k("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included-excluded",children:[a," ",l.withoutTaxes]})]})},v=z(j,X),nt=({active:n=!0})=>{var T;const[t,a]=V(),o=(t==null?void 0:t.amount.value)===0,c=(T=P.config)==null?void 0:T.shoppingCartDisplaySetting.shipping,l=c===D.INCLUDING_EXCLUDING_TAX,g=c===D.INCLUDING_TAX,u=_({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined",label:"Checkout.EstimateShipping.label",estimated:"Checkout.EstimateShipping.estimated"}),r=b(e=>{var S;const s=!e||e.isEmpty,p=!!(e!=null&&e.isVirtual);if(s||p){a(null);return}const m=(S=e.shippingAddresses)==null?void 0:S[0];if(!m)return;const E=m==null?void 0:m.selectedShippingMethod;if(!E){a(null);return}const{amount:w,amountExclTax:L,amountInclTax:M}=E;a({estimated:!1,amount:w,amountExclTax:L,amountInclTax:M})},[]),f=b(e=>{let s=null;if(e.shippingMethod){const p=e.shippingMethod;s={estimated:!0,amount:p.amount,amountExclTax:p.amountExclTax,amountInclTax:p.amountInclTax}}a(s)},[]);x(()=>{if(!n)return;const e=d.on("shipping/estimate",f,{eager:!0});return()=>{e==null||e.off()}},[n,f]),x(()=>{if(!n)return;const e=G();if(e){r(e);return}const s=d.on("checkout/initialized",r,{eager:!0});return()=>{s==null||s.off()}},[n,r]),x(()=>{if(!n)return;const e=d.on("checkout/updated",r,{eager:!1});return()=>{e==null||e.off()}},[n,r]);const y=()=>o?i("span",{"data-testId":"free-shipping",children:u.freeShipping}):g&&(t!=null&&t.amountInclTax)?i(h,{amount:t.amountInclTax.value,currency:t.amountInclTax.currency,"data-testid":"shipping"}):i(h,{amount:t==null?void 0:t.amount.value,currency:t==null?void 0:t.amount.currency,"data-testid":"shipping"}),N=()=>t!=null&&t.amountExclTax?i(h,{amount:t.amountExclTax.value,currency:t.amountExclTax.currency,"data-testid":"shipping-excluding-tax"}):i("span",{children:u.taxToBeDetermined});return i(v,{initialized:t!==void 0,label:(()=>{const e=t!=null&&t.estimated?u.estimated:u.label;return i("span",{"data-testid":"estimate-shipping-label",children:e})})(),price:y(),priceExclTax:N(),taxExcluded:l&&!o,taxIncluded:g&&!o,visible:n&&t!==null})};export{nt as EstimateShipping,nt as default};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { TitleProps } from '../../types/TitleProps';
|
|
2
|
-
import { Container, SlotProps } from '
|
|
2
|
+
import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
3
3
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
4
|
|
|
5
5
|
export interface LoginFormProps extends HTMLAttributes<HTMLFormElement>, TitleProps {
|
|
6
6
|
displayHeadingContent?: boolean;
|
|
7
|
+
active?: boolean;
|
|
7
8
|
onSignInClick?: (email: string) => void;
|
|
8
9
|
onSignOutClick?: () => void;
|
|
10
|
+
autoSync?: boolean;
|
|
9
11
|
slots?: {
|
|
10
12
|
Heading?: SlotProps<{
|
|
11
13
|
authenticated: boolean;
|
package/containers/LoginForm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as r,jsxs as d,Fragment as Y}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/errors.js";import{VComponent as W,classes as Z,Slot as P}from"@dropins/tools/lib.js";import{events as H}from"@dropins/tools/event-bus.js";import{W as ee,a as te,g as re}from"../chunks/ConditionalWrapper.js";import{n as z,g as j}from"../chunks/values.js";import{i as ie,s as oe,g as ne}from"../chunks/setGuestEmailOnCart.js";import{Field as ae,Input as le,Skeleton as se,SkeletonRow as q}from"@dropins/tools/components.js";import{useText as I}from"@dropins/tools/i18n.js";/* empty css */import"../chunks/TermsAndConditions.js";/* empty css *//* empty css *//* empty css */import{useState as f,useRef as ce,useCallback as g,useEffect as T,useMemo as x}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const me={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},V=a=>me.EMAIL.test(a),ue=({value:a,error:n,hint:c,onChange:u,onBlur:m,onInvalid:s})=>{const l=I({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return r(ae,{error:n,hint:c,children:r(le,{"aria-label":l.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:l.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",placeholder:l.LoginFormPlaceholder,required:!0,type:"email",value:a,onBlur:m,onChange:u,onInvalid:s})})},de=({onClick:a})=>{const n=I({account:"Checkout.LoginForm.account",signIn:"Checkout.LoginForm.signIn"});return d("div",{className:"checkout-login-form__sign-in",children:[n.account,r("a",{className:"checkout-login-form__link","data-testid":"sign-in-link",href:"#",rel:"noreferrer",target:"_blank",onClick:c=>{c.preventDefault(),a(c)},children:n.signIn})]})},he=()=>d(se,{"data-testid":"login-form-skeleton",children:[r(q,{fullWidth:!0,variant:"heading"}),r(q,{fullWidth:!0,size:"medium"})]}),ge=({className:a,customer:n,email:c,error:u,headingContent:m,hint:s,name:l,onEmailBlur:k,onEmailChange:N,onEmailInvalid:A,title:L,...y})=>d("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[d("div",{className:"checkout-login-form__heading",children:[L&&r(W,{className:"checkout-login-form__title",node:L}),m&&r(W,{className:"checkout-login-form__heading-label",node:m})]}),n?d("div",{className:"checkout-login-form__customer-details",children:[r("div",{className:"checkout-login-form__customer-name",children:`${n.firstName} ${n.lastName}`}),r("div",{className:"checkout-login-form__customer-email",children:n.email})]}):r("div",{className:"checkout-login-form__content",children:d("form",{...y,noValidate:!0,className:Z(["dropin-login-form__form",a]),name:l,children:[r("button",{disabled:!0,"aria-hidden":"true",style:"display: none",type:"submit"}),r(ue,{error:u,hint:s,value:c,onBlur:k,onChange:N,onInvalid:A})]})})]}),fe=ee(ge,he),Ee=({onClick:a})=>{const n=I({switch:"Checkout.LoginForm.switch",signOut:"Checkout.LoginForm.signOut"});return d("p",{className:"checkout-login-form__sign-out",children:[n.switch,r("a",{className:"checkout-login-form__link",href:"#",rel:"noreferrer",target:"_blank",onClick:c=>{c.preventDefault(),a==null||a(c)},children:n.signOut})]})},ke=1e3,De=({displayHeadingContent:a=!0,displayTitle:n=!0,initialData:c,onSignInClick:u,onSignOutClick:m,slots:s,active:l=!0,autoSync:k=!0,...N})=>{const[A,L]=f(null),[y,$]=f(""),[O,p]=f(""),[M,R]=f(!1),[B,v]=f(!0),[U,D]=f(!1),h=ce(null),o=I({AlreadyHaveAccountHint:"Checkout.LoginForm.emailExists.alreadyHaveAccount",FasterCheckoutHint:"Checkout.LoginForm.emailExists.forFasterCheckout",InvalidEmailError:"Checkout.LoginForm.invalidEmailError",MissingEmailError:"Checkout.LoginForm.missingEmailError",SignInLabel:"Checkout.LoginForm.emailExists.signInButton",Title:"Checkout.LoginForm.title"}),F=g(e=>{!V(e)||e===te()||(ie(e).then(t=>{v(t)}).catch(t=>{console.error(t),v(!0)}),k&&oe(e).catch(t=>{console.error("Error setting guest email on cart:",t)}))},[k]),G=g(e=>{const i=e.target.value;$(i),v(!0),p(""),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{F(i),z({email:i}),h.current=null},ke)},[F]),S=g(e=>{const t=e.target,i=t.value.trim(),b=V(i);let C="";i===""?C=o.MissingEmailError:b||(C=o.InvalidEmailError),p(C),t.setCustomValidity(C),b&&h.current&&(clearTimeout(h.current),h.current=null,F(i),z({email:i}))},[o.InvalidEmailError,o.MissingEmailError,F]),J=g(e=>{const b=e.target.validity.valueMissing?o.MissingEmailError:o.InvalidEmailError;p(b)},[o.MissingEmailError,o.InvalidEmailError]),_=g(()=>{const e=j("email")??"",t=V(e);u==null||u(t?e:"")},[u]),w=g(()=>{m==null||m()},[m]),E=g(e=>{const t=j("email")??"",i=(e==null?void 0:e.email)??"";i!==t&&($(i),p(""),v(!0),z({email:i}))},[]);T(()=>{if(!l)return;const e=H.on("authenticated",t=>{R(t),ne().then(i=>{L(i)}).catch(console.error)},{eager:!0});return()=>{e==null||e.off()}},[l]),T(()=>{if(!l)return;const e=re();if(e){D(!0),E(e);return}const t=H.on("checkout/initialized",i=>{D(!0),E(i)},{eager:!0});return()=>{t==null||t.off()}},[l,E]),T(()=>{if(!l)return;const e=H.on("checkout/updated",E,{eager:!1});return()=>{e==null||e.off()}},[l,E]);const K=x(()=>{if(n)return r(P,{name:"checkout-login-form-title",slot:s==null?void 0:s.Title,children:r("h2",{children:o.Title})})},[n,s,o.Title]),Q=x(()=>{if(a)return r(P,{context:{authenticated:M},name:"checkout-login-form-heading-label",slot:s==null?void 0:s.Heading,children:M?r(Ee,{onClick:w}):r(de,{onClick:_})})},[a,M,s,_,w]),X=x(()=>B?"":d(Y,{children:[o.AlreadyHaveAccountHint," ",r("a",{href:"#",onClick:_,children:o.SignInLabel})," ",o.FasterCheckoutHint]}),[B,o.AlreadyHaveAccountHint,o.SignInLabel,o.FasterCheckoutHint,_]);return r(fe,{...N,customer:A,email:y,error:O,headingContent:Q,hint:X,initialized:U,title:K,visible:l,onEmailBlur:S,onEmailChange:G,onEmailInvalid:J})};export{De as LoginForm,De as default};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { AlertBannerProps } from '
|
|
2
|
-
import { Container } from '
|
|
1
|
+
import { AlertBannerProps } from '@dropins/tools/types/elsie/src/components';
|
|
2
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib/types';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export interface MergedCartBannerProps extends AlertBannerProps {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const MergedCartBanner: Container<MergedCartBannerProps>;
|
|
5
8
|
//# sourceMappingURL=MergedCartBanner.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as p}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as I}from"@dropins/tools/event-bus.js";import{useState as B,useCallback as M,useEffect as v}from"@dropins/tools/preact-hooks.js";import*as c from"@dropins/tools/preact-compat.js";import{useText as w,Text as x}from"@dropins/tools/i18n.js";const H=r=>c.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},c.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"})),D=({className:r,initialData:V,active:n=!0,...C})=>{const[s,o]=B(0),a=w({mergedCartBannerItems:t(x,{fields:{count:s},id:"Checkout.MergedCartBanner.items",plural:s})}),u=()=>{o(0)},l=M(e=>{var i;const m=(i=e==null?void 0:e.oldCartItems)==null?void 0:i.reduce((d,f)=>d+f.quantity,0);m>0&&o(m)},[]);return v(()=>{if(!n)return;const e=I.on("cart/merged",l,{eager:!0});return()=>{e==null||e.off()}},[n,l]),!n||!s?null:t(g,{...C,"aria-label":a.mergedCartBannerItems,className:h(["checkout__banner",r]),"data-testid":"merged-cart-banner",icon:t(p,{source:H}),message:t("span",{children:a.mergedCartBannerItems}),variant:"neutral",onDismiss:u})};export{D as MergedCartBanner,D as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Container } from '
|
|
1
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
4
|
export type UpdateProductsFromCart = Array<{
|
|
@@ -8,6 +8,7 @@ export type UpdateProductsFromCart = Array<{
|
|
|
8
8
|
export interface OutOfStockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'icon'> {
|
|
9
9
|
onCartProductsUpdate?: (items: UpdateProductsFromCart) => void;
|
|
10
10
|
routeCart?: () => string;
|
|
11
|
+
active?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare const OutOfStock: Container<OutOfStockProps>;
|
|
13
14
|
//# sourceMappingURL=OutOfStock.d.ts.map
|
package/containers/OutOfStock.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as
|
|
3
|
+
import{jsxs as n,jsx as o}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Card as l,Icon as h,Image as O}from"@dropins/tools/components.js";import"../chunks/TermsAndConditions.js";import{classes as d}from"@dropins/tools/lib.js";import{S as p}from"../chunks/OrderError.js";import{useText as S}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{events as _}from"@dropins/tools/event-bus.js";import{useState as g,useCallback as v,useEffect as N}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";const w=({className:r,items:u,onRemoveOutOfStock:s,routeCart:t,...m})=>{const i=S({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(l,{className:d(["checkout-out-of-stock",r]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n("h4",{className:"checkout-out-of-stock__title",children:[o(h,{size:"16",source:p,stroke:"1"}),i.title]}),o("p",{className:"checkout-out-of-stock__message",children:i.message}),o("ol",{className:"checkout-out-of-stock__items",children:u.map(a=>o("li",{className:"checkout-out-of-stock__item","data-testid":"out-of-stock-item",children:o(O,{alt:a.image.alt,height:"100",loading:"eager",params:{width:100},src:a.image.src,width:"100"})},a.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[t&&o("a",{className:"checkout-out-of-stock__action","data-testid":"review-cart",href:t,children:i.reviewCart}),s&&o("button",{className:"checkout-out-of-stock__action","data-testid":"remove-out-of-stock",type:"button",onClick:s,children:i.removeOutOfStock})]})]})},A=({onCartProductsUpdate:r,routeCart:u,active:s=!0})=>{const[t,m]=g([]),i=v(()=>{if(!r)return;const e=t.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));r(e)},[t,r]);if(N(()=>{if(!s)return;const e=_.on("cart/data",c=>{const k=(c==null?void 0:c.items)||[];m(k.filter(f=>f.outOfStock||f.insufficientQuantity))},{eager:!0});return()=>{e==null||e.off()}},[s]),!s||t.length===0)return null;const a=!t.some(e=>e.insufficientQuantity);return o(w,{items:t,routeCart:u==null?void 0:u(),onRemoveOutOfStock:a?i:void 0})};export{A as OutOfStock,A as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UIComponentType } from '../../types/ComponentTypes';
|
|
2
2
|
import { TitleProps } from '../../types/TitleProps';
|
|
3
|
-
import { Container, SlotProps } from '
|
|
3
|
+
import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
4
4
|
import { HTMLAttributes } from 'preact/compat';
|
|
5
5
|
|
|
6
6
|
export interface PaymentMethodRenderCtx {
|
|
@@ -11,33 +11,19 @@ export interface PaymentMethodConfig {
|
|
|
11
11
|
displayLabel?: boolean;
|
|
12
12
|
enabled?: boolean;
|
|
13
13
|
icon?: string;
|
|
14
|
-
|
|
14
|
+
autoSync?: boolean;
|
|
15
15
|
render?: SlotProps<PaymentMethodRenderCtx>;
|
|
16
16
|
}
|
|
17
17
|
export interface PaymentMethodsSlot {
|
|
18
18
|
[code: string]: PaymentMethodConfig;
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated This property is deprecated and will be removed in future versions.
|
|
22
|
-
*/
|
|
23
|
-
export interface PaymentMethodsHandlerSlot {
|
|
24
|
-
[code: string]: PaymentMethodConfig['render'];
|
|
25
|
-
}
|
|
26
20
|
export interface PaymentMethodsProps extends HTMLAttributes<HTMLDivElement>, TitleProps {
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated This property is deprecated and will be removed in future versions.
|
|
29
|
-
*/
|
|
30
|
-
setOnChange?: {
|
|
31
|
-
[key: string]: boolean;
|
|
32
|
-
};
|
|
33
21
|
slots?: {
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated This property is deprecated and will be removed in future versions, use Methods instead.
|
|
36
|
-
*/
|
|
37
|
-
Handlers?: PaymentMethodsHandlerSlot;
|
|
38
22
|
Methods?: PaymentMethodsSlot;
|
|
39
23
|
} & TitleProps['slots'];
|
|
40
24
|
UIComponentType?: UIComponentType;
|
|
25
|
+
active?: boolean;
|
|
26
|
+
autoSync?: boolean;
|
|
41
27
|
}
|
|
42
28
|
export declare const PaymentMethods: Container<PaymentMethodsProps>;
|
|
43
29
|
//# sourceMappingURL=PaymentMethods.d.ts.map
|