@dropins/storefront-checkout 0.1.0-alpha50 → 0.1.0-alpha52
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/authenticateCustomer/authenticateCustomer.d.ts +18 -0
- package/api/authenticateCustomer/index.d.ts +18 -0
- package/api/fragments.d.ts +19 -0
- package/api/getCart/graphql/getCart.graphql.d.ts +0 -1
- package/api/getCustomer/graphql/getCustomer.graphql.d.ts +16 -16
- package/api/graphql/CartAddressFragment.graphql.d.ts +19 -0
- package/api/graphql/CheckoutDataFragment.graphql.d.ts +18 -0
- package/api/graphql/CustomerFragment.graphql.d.ts +18 -0
- package/api/graphql/OrderAddressFragment.graphql.d.ts +18 -0
- package/api/graphql/OrderFragment.graphql.d.ts +19 -0
- package/api/graphql/OrderItemFragment.graphql.d.ts +6 -0
- package/api/index.d.ts +17 -18
- package/api/initialize/initialize.d.ts +5 -5
- package/api/initialize/listeners.d.ts +15 -15
- package/api/initializeCheckout/initializeCheckout.d.ts +2 -2
- package/api/placeOrder/fixtures.d.ts +19 -5
- package/api/placeOrder/graphql/placeOrder.graphql.d.ts +16 -16
- package/api/placeOrder/placeOrder.d.ts +1 -1
- package/api/resetCheckout/index.d.ts +0 -16
- package/api/resetCheckout/resetCheckout.d.ts +15 -15
- package/api/setGuestEmailOnCart/graphql/setGuestEmailOnCart.graphql.d.ts +15 -15
- package/api/setPaymentMethod/graphql/setPaymentMethod.graphql.d.ts +15 -15
- package/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.d.ts +15 -15
- package/api/synchronizeCheckout/index.d.ts +18 -0
- package/api/synchronizeCheckout/synchronizeCheckout.d.ts +4 -0
- package/api.js +8 -6
- package/chunks/Heading.js +2 -0
- package/chunks/OrderError.js +2 -0
- package/chunks/ServerErrorSignal.js +3 -0
- package/chunks/classes.js +2 -0
- package/chunks/fetch-graphql.js +4 -2
- package/chunks/isEmailAvailable.js +9 -0
- package/chunks/placeOrder2.js +252 -120
- package/chunks/setBillingAddress.js +7 -5
- package/chunks/setGuestEmailOnCart.js +7 -11
- package/chunks/setPaymentMethod.js +7 -5
- package/chunks/setShippingMethods.js +7 -5
- package/chunks/store-config.js +3 -1
- package/chunks/synchronizeCheckout.js +27 -0
- package/chunks/withConditionalRendering.js +3 -1
- package/components/BillToShippingAddress/BillToShippingAddress.d.ts +2 -1
- package/components/OrderConfirmationHeader/OrderConfirmationHeader.d.ts +10 -0
- package/components/OrderConfirmationHeader/OrderConfirmationHeaderSkeleton.d.ts +4 -0
- package/components/OrderConfirmationHeader/index.d.ts +3 -0
- package/components/index.d.ts +1 -0
- package/containers/BillToShippingAddress.js +3 -1
- package/containers/ErrorBanner.js +2 -0
- package/containers/EstimateShipping.js +3 -1
- package/containers/LoginForm.js +3 -1
- package/containers/MergedCartBanner.js +2 -0
- package/containers/OrderConfirmationHeader/OrderConfirmationHeader.d.ts +18 -0
- package/containers/OrderConfirmationHeader/index.d.ts +3 -0
- package/containers/OrderConfirmationHeader.d.ts +3 -0
- package/containers/OrderConfirmationHeader.js +3 -0
- package/containers/OutOfStock.js +2 -0
- package/containers/PaymentMethods.js +3 -1
- package/containers/PlaceOrder.js +3 -1
- package/containers/ServerError/ServerError.d.ts +3 -3
- package/containers/ServerError.js +3 -1
- package/containers/ShippingMethods.js +3 -1
- package/containers/index.d.ts +1 -0
- package/data/models/cart.d.ts +1 -0
- package/data/models/customer.d.ts +18 -10
- package/data/models/order.d.ts +111 -42
- package/data/transforms/index.d.ts +1 -0
- package/data/transforms/transform-acdl.d.ts +0 -1
- package/data/transforms/transform-cart.d.ts +1 -1
- package/data/transforms/transform-customer-address-input.d.ts +5 -0
- package/data/transforms/transform-customer.d.ts +2 -9
- package/data/transforms/transform-order.d.ts +16 -3
- package/fragments.d.ts +1 -0
- package/fragments.js +126 -0
- package/i18n/en_US.json.d.ts +9 -0
- package/lib/state.d.ts +17 -16
- package/package.json +1 -1
- package/render.js +6 -4
- package/utils/convertCase/convertCase.d.ts +4 -0
- package/utils/convertCase/index.d.ts +18 -0
- package/utils/index.d.ts +1 -0
- package/api/getCheckoutData/getCheckoutData.d.ts +0 -18
- package/api/getCheckoutData/index.d.ts +0 -18
- package/api/redirect/index.d.ts +0 -18
- package/api/redirect/redirect.d.ts +0 -18
- package/api/resetCustomer/index.d.ts +0 -18
- package/api/resetCustomer/resetCustomer.d.ts +0 -18
- package/chunks/getCart.graphql.js +0 -122
- package/chunks/getCustomer.js +0 -34
- package/chunks/resetCustomer.js +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FunctionComponent } from 'preact';
|
|
2
2
|
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
|
-
export interface BillToShippingAddressProps extends Omit<HTMLAttributes<HTMLInputElement>, 'loading'> {
|
|
4
|
+
export interface BillToShippingAddressProps extends Omit<HTMLAttributes<HTMLInputElement>, 'loading' | 'disabled'> {
|
|
5
5
|
loading?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const BillToShippingAddress: FunctionComponent<BillToShippingAddressProps>;
|
|
8
9
|
//# sourceMappingURL=BillToShippingAddress.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
|
|
3
|
+
export interface OrderConfirmationHeaderProps {
|
|
4
|
+
customerName?: string;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
onSignUpClick?: () => void;
|
|
7
|
+
orderNumber?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const OrderConfirmationHeader: FunctionComponent<OrderConfirmationHeaderProps>;
|
|
10
|
+
//# sourceMappingURL=OrderConfirmationHeader.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import{i as d,c as u}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import"../chunks/fetch-graphql.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"../fragments.js";import"../chunks/synchronizeCheckout.js";const w=({className:i,checked:e,loading:r,onChange:n,disabled: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:s,label:c.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:n})})},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 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
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 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsxs as E,Fragment as L,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as M,SkeletonRow as w,Price as l}from"@dropins/tools/components.js";/* empty css */import{VComponent as A,classes as S}from"@dropins/tools/lib.js";import{Text as c,useText as B}from"@dropins/tools/i18n.js";import{useState as G,useEffect as k}from"@dropins/tools/preact-hooks.js";/* empty css */import{a as P,T as I}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as C}from"@dropins/tools/event-bus.js";import"@dropins/tools/signals.js";const U=({estimated:e=!1,price:o,priceExclTax:r,taxExcluded:s=!1,taxIncluded:n=!1})=>E(L,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(c,{id:"Checkout.EstimateShipping.estimated"}):t(c,{id:"Checkout.EstimateShipping.label"})}),t(A,{node:o,className:"checkout-estimate-shipping__price"}),n&&t("span",{"data-testid":"shipping-tax-included",className:S(["checkout-estimate-shipping__caption"]),children:t(c,{id:"Checkout.EstimateShipping.withTaxes"})}),s&&E("span",{"data-testid":"shipping-tax-included-excluded",className:S(["checkout-estimate-shipping__caption"]),children:[r," ",t(c,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),X=()=>t(M,{"data-testid":"estimate-shipping-skeleton",children:t(w,{size:"xsmall"})}),Q=()=>{const[e,o]=G(),r=e!==void 0,s=(e==null?void 0:e.amount.value)===0,{data:n,pending:_}=P.value,y=_||n===void 0,d=n==null?void 0:n.shoppingCartDisplaySetting.shipping,D=d===I.INCLUDING_EXCLUDING_TAX,g=d===I.INCLUDING_TAX,x=B({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});k(()=>{const i=C.on("shipping/estimate",a=>{const p=a.shippingMethod,{amount:m,amountExclTax:u,amountInclTax:h}=p;o({estimated:!0,amount:m,amountExclTax:u,amountInclTax:h})},{eager:!0});return()=>{i==null||i.off()}},[]),k(()=>{const i=C.on("checkout/updated",a=>{var f,T;const p=(T=(f=a==null?void 0:a.shippingAddresses)==null?void 0:f[0])==null?void 0:T.selectedShippingMethod;if(!p)return;const{amount:m,amountExclTax:u,amountInclTax:h}=p;o({estimated:!1,amount:m,amountExclTax:u,amountInclTax:h})},{eager:!0});return()=>{i==null||i.off()}},[]);const N=()=>s?t("span",{"data-testId":"free-shipping",children:x.freeShipping}):g&&(e!=null&&e.amountInclTax)?t(l,{"data-testid":"shipping",amount:e.amountInclTax.value,currency:e.amountInclTax.currency}):t(l,{"data-testid":"shipping",amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency}),v=()=>e!=null&&e.amountExclTax?t(l,{"data-testid":"shipping-excluding-tax",amount:e.amountExclTax.value,currency:e.amountExclTax.currency}):t("span",{children:x.taxToBeDetermined});return t("div",{"data-testid":"estimate-shipping",className:"checkout-estimate-shipping",children:!r||y?t(X,{}):t(U,{estimated:e.estimated,price:N(),taxExcluded:D&&!s,taxIncluded:g&&!s,priceExclTax:v()})})};export{Q as EstimateShipping,Q as default};
|
package/containers/LoginForm.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as e,jsxs as s,Fragment as P}from"@dropins/tools/preact-jsx-runtime.js";import{c as w,d as R,s as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as j}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{i as q}from"../chunks/isEmailAvailable.js";import{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{H as J}from"../chunks/Heading.js";import{useText as b,Text as _}from"@dropins/tools/i18n.js";import{useState as p,useRef as K,useEffect as C}from"@dropins/tools/preact-hooks.js";/* empty css */import{w as O}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const Q=({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})})},X=({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"})})]}),Y=({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(Z,{}):s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[e(J,{level:2,className:"checkout-login-form__title",children:l.Title}),i?e(S,{onClick:d=>{d.preventDefault(),F==null||F()}}):e(X,{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(Q,{value:g,error:h,hint:o,onChange:k,onBlur:f,onInvalid:E})]})})]})},Z=()=>s(U,{"data-testid":"login-form-skeleton",children:[e(x,{variant:"heading",fullWidth:!0}),e(x,{size:"medium",fullWidth:!0})]}),S=({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"})})]}),ee={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},N=t=>ee.EMAIL.test(t),re=1e3,y=({onSignInClick:t,onSignOutClick:i,initialData:g,...h})=>{const[o,u]=p(""),[m,f]=p(""),[k,E]=p(!0),[a,F]=p(!0),L=K(""),l=w.value.data,d=(l==null?void 0:l.email)||"",v=R.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||V.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)}))},re);return()=>{r&&clearTimeout(r)}},[d,o,a]);const I=k?"":s(P,{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:"")},H=v?{firstName:v.firstName,lastName:v.lastName,email:v.email}:void 0;return e(Y,{...h,customerDetails:H,email:o,error:m,hint:I,loading:a,onEmailBlur:T,onEmailChange:M,onEmailInvalid:z,onSignInClick:$,onSignOutClick:i})};y.displayName="LoginFormContainer";const ke=O(y);export{ke as LoginForm,ke as default};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
3
|
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as u,Icon as g}from"@dropins/tools/components.js";import{c as p}from"../chunks/classes.js";import{events as I}from"@dropins/tools/event-bus.js";import*as i from"@dropins/tools/preact-compat.js";import{useState as h,useEffect as v}from"@dropins/tools/preact-compat.js";import{useText as B,Text as M}from"@dropins/tools/i18n.js";const w=t=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},i.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"})),b=({className:t,initialData:x,...c})=>{const[r,s]=h(0),a=B({mergedCartBannerItems:e(M,{id:"Checkout.MergedCartBanner.items",fields:{count:r},plural:r})});v(()=>{const n=I.on("cart/merged",o=>{var m;const l=(m=o==null?void 0:o.oldCartItems)==null?void 0:m.reduce((d,f)=>d+f.quantity,0);l>0&&s(l)});return()=>{n==null||n.off()}},[]);const C=()=>{s(0)};return r?e(u,{...c,"aria-label":a.mergedCartBannerItems,className:p(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(g,{source:w}),message:e("span",{children:a.mergedCartBannerItems}),onDismiss:C,variant:"neutral"}):null};export{b as MergedCartBanner,b as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { OrderDataModel } from '../../data/models';
|
|
3
|
+
import { CustomerAddressInput } from '../../__generated__/types';
|
|
4
|
+
|
|
5
|
+
type SignUpInputsDefaultValueSetProps = {
|
|
6
|
+
code: string;
|
|
7
|
+
defaultValue: string;
|
|
8
|
+
};
|
|
9
|
+
export type OrderConfirmationHeaderProps = {
|
|
10
|
+
onSignUpClick?: ({ inputsDefaultValueSet, addressesData, }: {
|
|
11
|
+
inputsDefaultValueSet: SignUpInputsDefaultValueSetProps[];
|
|
12
|
+
addressesData: CustomerAddressInput[];
|
|
13
|
+
}) => void;
|
|
14
|
+
orderData: OrderDataModel;
|
|
15
|
+
};
|
|
16
|
+
export declare const OrderConfirmationHeader: FunctionComponent<OrderConfirmationHeaderProps>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=OrderConfirmationHeader.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as t,jsxs as h}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Icon as E,Button as y,Skeleton as A,SkeletonRow as n}from"@dropins/tools/components.js";/* empty css */import"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import*as o from"@dropins/tools/preact-compat.js";import{useState as C,useEffect as N}from"@dropins/tools/preact-compat.js";import{Text as l}from"@dropins/tools/i18n.js";import{s as f}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import"../chunks/fetch-graphql.js";import{i as b}from"../chunks/isEmailAvailable.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";function p(e){var r;return{region:{region_id:e!=null&&e.regionId?Number(e==null?void 0:e.regionId):null,region:e==null?void 0:e.region},city:e==null?void 0:e.city,company:e==null?void 0:e.company,country_code:e==null?void 0:e.country,firstname:e==null?void 0:e.firstName,lastname:e==null?void 0:e.lastName,middlename:e==null?void 0:e.middleName,postcode:e==null?void 0:e.postCode,street:e==null?void 0:e.street,telephone:e==null?void 0:e.telephone,custom_attributesV2:((r=e==null?void 0:e.customAttributes)==null?void 0:r.map(c=>({attribute_code:c.code,value:c.value})))||[]}}const z=e=>o.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},o.createElement("g",{clipPath:"url(#clip0_4797_15077)"},o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M10.15 20.85L1.5 17.53V6.63L10.15 10V20.85Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1.5 6.63001L10.15 3.20001L18.8 6.63001L10.15 10L1.5 6.63001Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.17969 4.77002L14.8297 8.15002V11.47",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),o.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.7896 12.64V6.63L10.1396 10V20.85L14.8296 19.05",stroke:"currentColor",strokeLinejoin:"round"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M15.71 17.26C15.71 15.38 17.23 13.86 19.11 13.86C20.99 13.86 22.51 15.38 22.51 17.26C22.51 19.14 20.99 20.66 19.11 20.66C17.23 20.66 15.71 19.14 15.71 17.26Z",stroke:"currentColor"}),o.createElement("path",{className:"success-icon",vectorEffect:"non-scaling-stroke",d:"M17.4805 17.49L18.5605 18.41L20.7205 16.33",stroke:"currentColor",strokeLinecap:"square",strokeLinejoin:"round"})),o.createElement("defs",null,o.createElement("clipPath",{id:"clip0_4797_15077"},o.createElement("rect",{width:22,height:18.65,fill:"white",transform:"translate(1 2.70001)"})))),V=({customerName:e,isLoading:r,orderNumber:c,onSignUpClick:m})=>r?t(w,{}):h("div",{className:"order-confirmation-header order-confirmation__card",children:[t(E,{source:z,size:"64",className:"order-confirmation-header__icon"}),t("h1",{className:"order-confirmation-header__title",children:e?t(l,{id:"Checkout.OrderConfirmationHeader.title",fields:{name:e}}):t(l,{id:"Checkout.OrderConfirmationHeader.defaultTitle"})}),c&&t("p",{className:"order-confirmation-header__order",children:t(l,{id:"Checkout.OrderConfirmationHeader.order",fields:{order:c}})}),m&&h("div",{className:"order-confirmation-create-account",children:[t("p",{className:"order-confirmation-create-account__message",children:t(l,{id:"Checkout.OrderConfirmationHeader.CreateAccount.message"})}),t(y,{"data-testid":"create-account-button",className:"order-confirmation-create-account__button",size:"medium",variant:"secondary",type:"submit",onClick:m,children:t(l,{id:"Checkout.OrderConfirmationHeader.CreateAccount.button"})})]})]}),w=()=>h(A,{"data-testid":"order-confirmation-header-skeleton",className:"order-confirmation-header",children:[t(n,{variant:"empty",size:"xlarge",fullWidth:!0}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{variant:"empty",size:"medium"}),t(n,{size:"small",fullWidth:!0}),t(n,{variant:"heading",size:"xsmall",fullWidth:!0})]}),J=({orderData:e,onSignUpClick:r})=>{var g;const[c,m]=C(!f.authenticated),[v,s]=C();N(()=>{f.authenticated||b(e.email).then(a=>s(!a)).catch(()=>s(!0)).finally(()=>m(!1))},[e.email]);const _=r&&!f.authenticated&&v===!1?()=>{const a=e.shippingAddress,i=e.billingAddress,L=[{code:"firstname",defaultValue:(i==null?void 0:i.firstName)||""},{code:"lastname",defaultValue:(i==null?void 0:i.lastName)||""},{code:"email",defaultValue:e.email||""}];let u;if(a){const k={...p(a),default_shipping:!0};u=[{...p(i),default_billing:!0},k]}else u=[{...p(i),default_billing:!0,default_shipping:!0}];r({inputsDefaultValueSet:L,addressesData:u})}:void 0;return t("div",{children:t(V,{customerName:(g=e.billingAddress)==null?void 0:g.firstName,isLoading:c,onSignUpClick:_,orderNumber:e.number})})};export{J as OrderConfirmationHeader,J as default};
|
package/containers/OutOfStock.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
1
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 S}from"@dropins/tools/i18n.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{events as p}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=S({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})]})]})},z=({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=p.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{z as OutOfStock,z as default};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as n,jsxs as M,Fragment as R}from"@dropins/tools/preact-jsx-runtime.js";import{c as C,s as D}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import"@dropins/tools/event-bus.js";import{classes as H,Slot as L}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as $}from"../chunks/setPaymentMethod.js";/* empty css */import{IllustratedMessage as B,Icon as U,ProgressSpinner as Z,ToggleButton as F,Skeleton as q,SkeletonRow as y}from"@dropins/tools/components.js";/* empty css */import{H as G}from"../chunks/Heading.js";import{useRef as J}from"@dropins/tools/preact-hooks.js";/* empty css */import*as g from"@dropins/tools/preact-compat.js";import{useState as S,useCallback as T,useEffect as w}from"@dropins/tools/preact-compat.js";import{useText as K}from"@dropins/tools/i18n.js";import{w as Q}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";const X=e=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.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"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),g.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Y=({code:e,loading:a,selected:r,onChange:d,title:h})=>n(F,{className:"checkout-payment-methods__method",label:h,name:"payment-method",value:e,selected:r,onChange:d,busy:a}),ee=({className:e,paymentMethodContent:a,loading:r=!1,initializing:d=!1,onChange:h=()=>{},options:s,selection:k})=>{const o=K({Title:"Checkout.PaymentMethods.title",EmptyState:"Checkout.PaymentMethods.emptyState"});return d?n(te,{}):M("div",{className:H(["checkout-payment-methods",e]),children:[n(G,{level:2,className:"checkout-payment-methods__title",children:o.Title}),!r&&s.length===0&&n(B,{icon:n(U,{source:X}),message:n("p",{children:o.EmptyState})}),M("div",{className:H(["checkout-payment-methods__wrapper"]),children:[r&&n(Z,{className:"checkout-payment-methods__spinner"}),n("div",{className:H(["checkout-payment-methods__methods",["checkout-payment-methods--loading",r],["checkout-payment-methods--full-width",s.length%2!==0]]),children:s==null?void 0:s.map(i=>n(Y,{code:i.code,onChange:h,selected:i.code===k,title:i.title},i.code))}),a&&n("div",{className:"checkout-payment-methods__content",children:a})]})]})},te=()=>M(q,{"data-testid":"payment-methods-skeleton",children:[n(y,{variant:"heading",size:"medium"}),n(y,{variant:"empty",size:"medium"}),n(y,{size:"xlarge",fullWidth:!0}),n(y,{size:"xlarge",fullWidth:!0})]}),N={free:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)},checkmo:e=>{const a=document.createElement("div");a.innerText="",e.replaceHTML(a)}},ne=(e,a)=>{const r=J(e);return a(r.current,e)||(r.current=e),r.current},V=({slots:e})=>{var x,_;const[a,r]=S(),[d,h]=S(N),[s,k]=S(!0),o=C.value.data,i=!!C.value.data,W=C.value.pending,j=(o==null?void 0:o.isVirtual)??!1,z=(x=o==null?void 0:o.shippingAddresses)==null?void 0:x[0],A=(o==null?void 0:o.availablePaymentMethods)||[],l=(_=o==null?void 0:o.selectedPaymentMethod)==null?void 0:_.code,E=j?!0:!!z,m=ne(A,(t,c)=>t.length!==c.length?!1:t.every((p,v)=>p.code===c[v].code)),u=T(t=>{r(t),!(!t||!E)&&t!==l&&$(t).catch(console.error)},[E,l]);w(()=>{if(!i)return;if(!!!(m!=null&&m.length)){u(void 0);return}const c=m[0].code;if(!l){u(c);return}const p=m.some(v=>v.code===l);u(p?l:c)},[m,i,l,u]);const I=t=>{u(t)},b=T((t,c)=>{if(!t){console.warn("Payment method handler is ignored because it has no code");return}if(!c){console.warn("Payment method handler is ignored because it is empty");return}h(p=>({...p,[t]:c}))},[]);w(()=>{e!=null&&e.Handlers&&Object.entries(e.Handlers).forEach(([t,c])=>{b(t,c)})},[b,e==null?void 0:e.Handlers]);const f=e!=null&&e.Main?n(L,{name:"PaymentMethods",slot:e==null?void 0:e.Main,context:{replaceHTML(t){this.replaceWith(t),k(!1)}}}):null,P=a?d[a]:null,O=P?n(L,{name:"PaymentMethodContent",slot:P,context:{cartId:D.cartId||"",replaceHTML(t){this.replaceWith(t)}}},P):void 0;return w(()=>{!s&&d!=N&&console.warn("Payment method handlers you have added are ignored because the default content has been replaced")},[s,d]),M(R,{children:[f&&n(f.type,{ref:f.ref,...f.props}),s&&n(ee,{initializing:i===!1,loading:i&&W,onChange:I,options:m,paymentMethodContent:O,selection:a})]})};V.displayName="PaymentMethodsContainer";const He=Q(V);export{He as PaymentMethods,He as default};
|
package/containers/PlaceOrder.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{c as x}from"../chunks/store-config.js";import{s as E}from"../chunks/ServerErrorSignal.js";import{events as g}from"@dropins/tools/event-bus.js";import{classes as u}from"@dropins/tools/lib.js";import{U as P}from"../chunks/fetch-graphql.js";import{p as v}from"../chunks/placeOrder2.js";/* empty css */import{Button as S}from"@dropins/tools/components.js";import{Text as b,useText as U}from"@dropins/tools/i18n.js";import{w}from"../chunks/withConditionalRendering.js";import{useState as T,useCallback as l,useEffect as z}from"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const H=({className:e,onClick:t,disabled:n=!1})=>s("div",{className:u(["checkout-place-order",e]),children:s(S,{className:u(["checkout-place-order__button",e]),"data-testid":"place-order-button",disabled:n,onClick:t,size:"medium",type:"submit",variant:"primary",children:s(b,{id:"Checkout.PlaceOrder.button"})},"placeOrder")}),I=e=>e instanceof TypeError||e instanceof P,f=({handleValidation:e,onPlaceOrder:t})=>{var d;const[n,h]=T(!1),{data:c,pending:O}=x.value,k=!!c,a=((d=c==null?void 0:c.selectedPaymentMethod)==null?void 0:d.code)||"",i=U({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),m=l(r=>{const o=I(r)?i.CheckoutUnexpectedError:r.message;E.value=o},[i]),C=l(async()=>{try{if(!(e?e():!0))return;t?await t({code:a}):await v()}catch(r){m(r)}},[e,t,a,m]);return z(()=>{const r=g.on("cart/initialized",o=>{const y=(o==null?void 0:o.items)||[];h(y.some(p=>p.outOfStock||p.insufficientQuantity))},{eager:!0});return()=>{r==null||r.off()}},[]),s(H,{onClick:C,disabled:!k||O||n})};f.displayName="PlaceOrderContainer";const W=w(f);export{W as PlaceOrder,W as default};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
|
|
3
|
-
interface ServerErrorProps {
|
|
4
|
-
|
|
3
|
+
export interface ServerErrorProps {
|
|
4
|
+
onRetry?: () => void;
|
|
5
|
+
onServerError?: (error: string) => void;
|
|
5
6
|
}
|
|
6
7
|
export declare const ServerError: Container<ServerErrorProps>;
|
|
7
|
-
export {};
|
|
8
8
|
//# sourceMappingURL=ServerError.d.ts.map
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as t,jsxs as u}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{IllustratedMessage as m,Icon as l,Button as n}from"@dropins/tools/components.js";/* empty css */import{classes as a}from"@dropins/tools/lib.js";import{useEffect as p}from"@dropins/tools/preact-hooks.js";/* empty css */import{S as d}from"../chunks/OrderError.js";import{useText as h}from"@dropins/tools/i18n.js";import{s as i}from"../chunks/ServerErrorSignal.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/signals.js";const v=({className:o,contactSupport:e,errorMessage:r,onClick:c})=>{const s=h({Title:"Checkout.ServerError.title",Message:"Checkout.ServerError.message",ContactSupport:"Checkout.ServerError.contactSupport",Button:"Checkout.ServerError.button"});return t(m,{"aria-invalid":"true","aria-describedby":"checkout-server-error__message","aria-live":"polite",className:a(["checkout-server-error",o]),"data-testid":"checkout-server-error",heading:r??s.Title,message:u("p",{id:a(["checkout-server-error__message"]),children:[s.Message,t("br",{}),t("span",{children:e??s.ContactSupport})]}),icon:t(l,{className:a(["checkout-server-error__icon"]),source:d}),action:t(n,{className:a(["checkout-server-error__button"]),onClick:c,children:s.Button})})},T=({onRetry:o,onServerError:e})=>{const r=i.value,c=async()=>{o==null||o(),i.value=void 0};return p(()=>{r&&(e==null||e(r))},[r,e]),r?t(v,{errorMessage:r,onClick:c}):null};export{T as ServerError,T as default};
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Copyright 2024 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as i,jsxs as L,Fragment as z}from"@dropins/tools/preact-jsx-runtime.js";import{b as v,e as M,c as W,a as V}from"../chunks/store-config.js";import"../chunks/ServerErrorSignal.js";import{events as T}from"@dropins/tools/event-bus.js";import{classes as j,Slot as A}from"@dropins/tools/lib.js";import"../chunks/fetch-graphql.js";import{s as O}from"../chunks/setShippingMethods.js";/* empty css */import{IllustratedMessage as P,Icon as Z,ProgressSpinner as $,RadioButton as q,Price as F,Skeleton as G,SkeletonRow as _}from"@dropins/tools/components.js";/* empty css */import{H as J}from"../chunks/Heading.js";import{useState as I,useEffect as S}from"@dropins/tools/preact-hooks.js";/* empty css */import*as p from"@dropins/tools/preact-compat.js";import{useCallback as K,useMemo as Q,useEffect as X}from"@dropins/tools/preact-compat.js";import{useText as Y}from"@dropins/tools/i18n.js";import{w as D}from"../chunks/withConditionalRendering.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";const U=e=>({countryCode:e.country_id,postCode:e.postcode||"",...e.region_id?{regionId:Number(e.region_id)}:{...e.region?{region:e.region}:{}}}),ee=e=>({carrierCode:e.carrier.code||"",methodCode:e.code||"",amount:e.amount,amountExclTax:e.amountExclTax,amountInclTax:e.amountInclTax}),te=e=>p.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},p.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"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.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"}),p.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"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),p.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),oe=({className:e,isLoading:t=!1,onSelectionChange:o=()=>{},options:s,selection:u,...a})=>{const c=Y({Title:"Checkout.ShippingMethods.title",EmptyState:"Checkout.ShippingMethods.emptyState"});return s===void 0?i(ne,{}):L("div",{...a,className:j(["checkout-shipping-methods",e]),children:[i(J,{level:3,className:"checkout-shipping-methods__title",children:c.Title}),!t&&s.length===0&&i(P,{icon:i(Z,{source:te}),message:i("p",{children:c.EmptyState})}),L("div",{className:j(["checkout-shipping-methods__content"]),children:[t&&i($,{className:"checkout-shipping-methods__spinner"}),i("div",{className:j(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:s.map(n=>i(q,{"data-testid":"shipping-method-radiobutton","aria-busy":t,id:n.value,name:"shipping-method",className:"checkout-shipping-methods__method",label:L(z,{children:[i(F,{amount:n.amount.value,currency:n.amount.currency})," ",i("span",{children:n.carrier.title})]}),description:n.title,value:n.value,checked:(u==null?void 0:u.value)===n.value,onChange:()=>o(n)},n.value))})]})]})},ne=()=>L(G,{"data-testid":"shipping-methods-skeleton",children:[i(_,{variant:"heading",size:"small"}),i(_,{variant:"empty",size:"small"}),i(_,{size:"medium",fullWidth:!0}),i(_,{size:"medium",fullWidth:!0})]});function ie(){var C;const[e,t]=I(),[o,s]=I();S(()=>{T.on("checkout/estimate-shipping-address",({address:x,isValid:g})=>{t({address:x,isValid:g})})},[]),S(()=>{s(v.value)},[v.value]),S(()=>{M.value.pending?s(void 0):s(v.value)},[M.value.pending]);const{country_id:u,region_id:a,region:c,postcode:n}=(e==null?void 0:e.address)||{},f=!!e,r=W.value.data,k=!!((C=r==null?void 0:r.shippingAddresses)!=null&&C[0]),l=e==null?void 0:e.isValid;S(()=>{k||l||!o||!f||T.emit("shipping/estimate",{address:U({country_id:u,region_id:a,region:c,postcode:n}),shippingMethod:ee(o)})},[o,u,a,c,n,f,k,l])}const H=(e,t)=>e.code===t.code&&e.carrier.code===t.carrier.code;function re({onCheckoutDataUpdate:e,preSelectedMethod:t,onShippingMethodSelect:o}){const u=!V.value.data,a=W.value.data,c=W.value.pending,n=M.value.data,f=M.value.pending,r=v.value,k=a==null?void 0:a.shippingAddresses,l=k==null?void 0:k[0],C=!!l,x=l==null?void 0:l.availableShippingMethods,g=l==null?void 0:l.selectedShippingMethod,d=x||n,b=K(h=>{if(!C)return;const E={method_code:h.code,carrier_code:h.carrier.code};O([E]).then(()=>{e==null||e()}).catch(y=>{console.error("setting shipping methods on cart failed:",y)})},[C,e]),R=h=>{v.value=h,o==null||o(h)},m=Q(()=>{if(!(d!=null&&d.length))return;const h=d[0],E=r||g;return E?d.some(w=>H(w,E))?E:h:d.find(N=>N.carrier.code===(t==null?void 0:t.carrierCode)&&N.code===(t==null?void 0:t.methodCode))||h},[r,g,d,t]);return X(()=>{m&&((!r||!H(m,r))&&(v.value=m,o==null||o(m)),(!g||!H(m,g))&&b(m))},[m,r,g,b,o]),{isLoading:c||u||f,options:d,selection:m,onSelectionChange:R}}const B=({preSelectedMethod:e,onCheckoutDataUpdate:t,shippingMethodsSlot:o,onShippingMethodSelect:s,initialData:u,...a})=>{const{isLoading:c,options:n,selection:f,onSelectionChange:r}=re({preSelectedMethod:e,onCheckoutDataUpdate:t,onShippingMethodSelect:s});return ie(),L(z,{children:[i(oe,{...a,isLoading:c,onSelectionChange:r,options:n,selection:f}),!c&&o&&i(A,{name:"ShippingMethods",slot:o})]})};B.displayName="ShippingMethodsContainer";const je=D(B);export{je as ShippingMethods,je as default};
|
package/containers/index.d.ts
CHANGED
package/data/models/cart.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export interface Customer {
|
|
7
18
|
firstName: string;
|
|
8
19
|
lastName: string;
|
|
9
20
|
email: string;
|
|
10
|
-
|
|
11
|
-
defaultBillingAddress?: CustomerAddress;
|
|
12
|
-
defaultShippingAddress?: CustomerAddress;
|
|
13
|
-
};
|
|
21
|
+
}
|
|
14
22
|
//# sourceMappingURL=customer.d.ts.map
|
package/data/models/order.d.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { Price } from './price';
|
|
2
2
|
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
export type OrderAddressModel = {
|
|
4
|
+
city: string;
|
|
5
|
+
company: string;
|
|
6
|
+
country: string;
|
|
7
|
+
firstName: string;
|
|
8
|
+
middleName: string;
|
|
9
|
+
lastName: string;
|
|
10
|
+
postCode: string;
|
|
11
|
+
region: string;
|
|
12
|
+
regionId: string;
|
|
13
|
+
street: string[];
|
|
14
|
+
telephone: string;
|
|
15
|
+
customAttributes: {
|
|
16
|
+
code: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}[];
|
|
19
|
+
} | null;
|
|
20
|
+
export type OrderItemProductModel = {
|
|
21
|
+
stockStatus?: string;
|
|
11
22
|
canonicalUrl?: string;
|
|
12
23
|
id: string;
|
|
13
24
|
image?: string;
|
|
@@ -15,67 +26,125 @@ export type OrderItemProduct = {
|
|
|
15
26
|
name: string;
|
|
16
27
|
productType: string;
|
|
17
28
|
sku: string;
|
|
29
|
+
thumbnail: {
|
|
30
|
+
url: string;
|
|
31
|
+
label: string;
|
|
32
|
+
};
|
|
18
33
|
};
|
|
19
|
-
export type
|
|
20
|
-
type
|
|
21
|
-
discounted
|
|
34
|
+
export type OrderItemModel = {
|
|
35
|
+
type?: string;
|
|
36
|
+
discounted?: boolean;
|
|
22
37
|
id: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
productName?: string;
|
|
39
|
+
regularPrice?: Price;
|
|
40
|
+
price?: Price;
|
|
41
|
+
product?: OrderItemProductModel;
|
|
26
42
|
selectedOptions?: Array<{
|
|
27
43
|
label: string;
|
|
28
44
|
value: any;
|
|
29
45
|
}>;
|
|
30
|
-
totalQuantity
|
|
31
|
-
thumbnail
|
|
46
|
+
totalQuantity?: number;
|
|
47
|
+
thumbnail?: {
|
|
32
48
|
label: string;
|
|
33
49
|
url: string;
|
|
34
50
|
};
|
|
51
|
+
downloadableLinks: {
|
|
52
|
+
count: number;
|
|
53
|
+
result: string;
|
|
54
|
+
} | null;
|
|
55
|
+
itemPrices: {
|
|
56
|
+
priceIncludingTax: Price;
|
|
57
|
+
originalPrice: Price;
|
|
58
|
+
originalPriceIncludingTax: Price;
|
|
59
|
+
price: Price;
|
|
60
|
+
};
|
|
61
|
+
bundleOptions: Record<string, string> | null;
|
|
62
|
+
totalInclTax: Price;
|
|
63
|
+
priceInclTax: Price;
|
|
64
|
+
total: Price;
|
|
65
|
+
configurableOptions: Record<string, string | number | boolean> | undefined;
|
|
35
66
|
giftCard?: {
|
|
36
67
|
senderName: string;
|
|
37
68
|
senderEmail: string;
|
|
38
69
|
recipientEmail: string;
|
|
39
70
|
recipientName: string;
|
|
71
|
+
message: string;
|
|
40
72
|
};
|
|
73
|
+
quantityCanceled: number;
|
|
74
|
+
quantityInvoiced: number;
|
|
75
|
+
quantityOrdered: number;
|
|
76
|
+
quantityRefunded: number;
|
|
77
|
+
quantityReturned: number;
|
|
78
|
+
quantityShipped: number;
|
|
41
79
|
};
|
|
42
|
-
export type
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
80
|
+
export type ShipmentItemsModel = {
|
|
81
|
+
id: string;
|
|
82
|
+
productSku: string;
|
|
83
|
+
productName: string;
|
|
84
|
+
orderItem: OrderItemModel;
|
|
85
|
+
};
|
|
86
|
+
export type ShipmentsTracingModel = {
|
|
87
|
+
carrier: string;
|
|
88
|
+
number: string;
|
|
89
|
+
title: string;
|
|
90
|
+
};
|
|
91
|
+
export type ShipmentsModel = {
|
|
92
|
+
id: string;
|
|
93
|
+
number: string;
|
|
94
|
+
tracking: ShipmentsTracingModel[];
|
|
95
|
+
comments: {
|
|
96
|
+
message: string;
|
|
97
|
+
timestamp: string;
|
|
57
98
|
}[];
|
|
58
|
-
|
|
59
|
-
|
|
99
|
+
items: ShipmentItemsModel[];
|
|
100
|
+
};
|
|
101
|
+
export type OrderDataModel = {
|
|
102
|
+
id: string;
|
|
103
|
+
orderStatusChangeDate?: string;
|
|
104
|
+
number: string;
|
|
105
|
+
email?: string;
|
|
106
|
+
token?: string;
|
|
60
107
|
status: string;
|
|
61
108
|
isVirtual: boolean;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
109
|
+
totalQuantity: number;
|
|
110
|
+
shippingMethod?: string;
|
|
111
|
+
carrier?: string;
|
|
112
|
+
discounts: {
|
|
113
|
+
amount: Price;
|
|
114
|
+
label: string;
|
|
115
|
+
}[];
|
|
116
|
+
coupons: {
|
|
117
|
+
code: string;
|
|
118
|
+
}[];
|
|
119
|
+
payments: {
|
|
120
|
+
code: string;
|
|
121
|
+
name: string;
|
|
122
|
+
}[];
|
|
67
123
|
shipping?: {
|
|
68
124
|
code: string;
|
|
69
125
|
amount: number;
|
|
70
126
|
currency: string;
|
|
71
127
|
};
|
|
128
|
+
shipments: ShipmentsModel[];
|
|
129
|
+
items: OrderItemModel[];
|
|
130
|
+
totalGiftcard: Price;
|
|
72
131
|
grandTotal: Price;
|
|
132
|
+
totalShipping?: Price;
|
|
73
133
|
subtotal: Price;
|
|
74
|
-
token: string;
|
|
75
|
-
totalQuantity: number;
|
|
76
134
|
totalTax: Price;
|
|
77
|
-
shippingAddress:
|
|
78
|
-
billingAddress:
|
|
135
|
+
shippingAddress: OrderAddressModel;
|
|
136
|
+
billingAddress: OrderAddressModel;
|
|
137
|
+
availableActions: AvailableActionsProps[];
|
|
138
|
+
taxes: {
|
|
139
|
+
amount: Price;
|
|
140
|
+
rate: number;
|
|
141
|
+
title: string;
|
|
142
|
+
}[];
|
|
79
143
|
};
|
|
144
|
+
declare enum AvailableActionsProps {
|
|
145
|
+
CANCEL = "CANCEL",
|
|
146
|
+
RETURN = "RETURN",
|
|
147
|
+
REORDER = "REORDER"
|
|
148
|
+
}
|
|
80
149
|
export {};
|
|
81
150
|
//# sourceMappingURL=order.d.ts.map
|
|
@@ -23,4 +23,5 @@ export * from './transform-order';
|
|
|
23
23
|
export * from './transform-shipping-estimate';
|
|
24
24
|
export * from './transform-shipping-methods';
|
|
25
25
|
export * from './transform-store-config';
|
|
26
|
+
export * from './transform-customer-address-input';
|
|
26
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OrderContext, ShoppingCartContext } from '../models/acdl';
|
|
2
|
-
import { Order } from '../models/order';
|
|
3
2
|
|
|
4
3
|
export declare const transformShoppingCartContext: (order: Order) => ShoppingCartContext;
|
|
5
4
|
export declare const transformOrderContext: (order: Order) => OrderContext;
|
|
@@ -2,6 +2,6 @@ import { GetCartQuery } from '../../__generated__/types';
|
|
|
2
2
|
import { Cart as CartModel } from '../models';
|
|
3
3
|
|
|
4
4
|
type Cart = NonNullable<GetCartQuery['cart']>;
|
|
5
|
-
declare const transformCart: (
|
|
5
|
+
declare const transformCart: (data: Cart) => CartModel | undefined;
|
|
6
6
|
export { Cart, transformCart };
|
|
7
7
|
//# sourceMappingURL=transform-cart.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CustomerAddressInput } from '../../__generated__/types';
|
|
2
|
+
import { OrderAddressModel } from '../models';
|
|
3
|
+
|
|
4
|
+
export declare function transformCustomerAddressInput(address: OrderAddressModel): CustomerAddressInput;
|
|
5
|
+
//# sourceMappingURL=transform-customer-address-input.d.ts.map
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
+
import { Customer as CustomerModel } from '../models';
|
|
1
2
|
import { GetCustomerQuery } from '../../__generated__/types';
|
|
2
|
-
import { Customer as CustomerModel, CustomAttribute as CustomAttributeModel } from '../models';
|
|
3
3
|
|
|
4
4
|
type Customer = GetCustomerQuery['customer'];
|
|
5
|
-
export declare const transformCustomAttributesV2: (data: ({
|
|
6
|
-
__typename?: "AttributeSelectedOptions" | undefined;
|
|
7
|
-
} | {
|
|
8
|
-
__typename?: "AttributeValue" | undefined;
|
|
9
|
-
code: string;
|
|
10
|
-
value: string;
|
|
11
|
-
} | null)[]) => CustomAttributeModel[];
|
|
12
5
|
declare const transformCustomer: (data: Customer) => CustomerModel | undefined;
|
|
13
|
-
export { transformCustomer };
|
|
6
|
+
export { Customer, transformCustomer };
|
|
14
7
|
//# sourceMappingURL=transform-customer.d.ts.map
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OrderItemModel } from '../models/order';
|
|
2
2
|
import { PlaceOrderMutation } from '../../__generated__/types';
|
|
3
3
|
|
|
4
|
-
type
|
|
5
|
-
|
|
4
|
+
type OrderProps = NonNullable<NonNullable<PlaceOrderMutation['placeOrder']>['orderV2']>;
|
|
5
|
+
type OrderItems = OrderProps['items'];
|
|
6
|
+
type OrderItemProps = NonNullable<OrderItems>[number];
|
|
7
|
+
export declare const transformConfigurableOptions: (item: OrderItemProps) => Record<string, string> | undefined;
|
|
8
|
+
export declare const transformBundleOptions: (data: any) => {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare const transformLinks: (links: {
|
|
12
|
+
title: string;
|
|
13
|
+
}[]) => {
|
|
14
|
+
count: number;
|
|
15
|
+
result: string;
|
|
16
|
+
} | null;
|
|
17
|
+
export declare const transformOrderItems: (items: OrderItemProps[]) => OrderItemModel[];
|
|
18
|
+
export declare const transformOrder: (orderData: OrderProps) => any;
|
|
6
19
|
export {};
|
|
7
20
|
//# sourceMappingURL=transform-order.d.ts.map
|