@dropins/storefront-checkout 1.3.0-beta1 → 1.4.0-beta1
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/getCart/fixtures.d.ts +2 -1
- package/api/getCart/getCart.d.ts +15 -15
- package/api/getCheckoutAgreements/index.d.ts +1 -1
- package/api/getCustomer/getCustomer.d.ts +1 -1
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +1 -1
- package/api/index.d.ts +1 -1
- package/api.js +4 -4
- package/chunks/ShippingEstimateSignal.js +14 -0
- package/chunks/TermsAndConditions.js +1 -1
- package/chunks/setBillingAddress.js +3 -3
- package/chunks/setGuestEmailOnCart.js +12 -4
- package/chunks/setPaymentMethod.js +3 -3
- package/chunks/setShippingMethods.js +2 -2
- package/chunks/store-config.js +1 -1
- package/chunks/synchronizeCheckout.js +5 -13
- package/chunks/withConditionalRendering.js +1 -1
- package/chunks/withSkeleton.js +3 -0
- package/components/BillToShippingAddress/BillToShippingAddress.d.ts +1 -3
- package/components/LoginForm/LoginForm.d.ts +9 -12
- package/components/LoginForm/SignOut.d.ts +1 -1
- package/components/LoginForm/index.d.ts +15 -15
- package/components/Newsletter/Newsletter.d.ts +6 -0
- package/components/Newsletter/NewsletterSkeleton.d.ts +4 -0
- package/{utils → components/Newsletter}/index.d.ts +3 -5
- package/components/PaymentMethods/PaymentMethods.d.ts +7 -4
- package/components/ShippingMethods/ShippingMethods.d.ts +5 -4
- package/components/ShippingMethods/index.d.ts +15 -15
- package/components/TermsAndConditions/TermsAndConditions.d.ts +2 -3
- package/components/index.d.ts +1 -0
- package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +1 -1
- package/containers/BillToShippingAddress.js +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/LoginForm/LoginForm.d.ts +9 -1
- package/containers/LoginForm.js +1 -1
- package/containers/MergedCartBanner/MergedCartBanner.d.ts +1 -1
- package/containers/MergedCartBanner.js +1 -1
- package/containers/Newsletter/Newsletter.d.ts +9 -0
- package/{utils/isUnexpectedError → containers/Newsletter}/index.d.ts +3 -2
- package/containers/Newsletter.d.ts +3 -0
- package/containers/Newsletter.js +3 -0
- package/containers/OutOfStock.js +1 -1
- package/containers/PaymentMethods/PaymentMethods.d.ts +5 -2
- package/containers/PaymentMethods.js +1 -1
- package/containers/PlaceOrder/PlaceOrder.d.ts +1 -0
- package/containers/PlaceOrder.js +1 -1
- package/containers/ServerError.js +1 -1
- package/containers/ShippingMethods/ShippingMethods.d.ts +2 -1
- package/containers/ShippingMethods/index.d.ts +15 -15
- package/containers/ShippingMethods.js +1 -1
- package/containers/TermsAndConditions/TermsAndConditions.d.ts +1 -1
- package/containers/TermsAndConditions.js +1 -1
- package/containers/index.d.ts +1 -0
- package/data/models/store-config.d.ts +1 -0
- package/data/transforms/transform-cart.d.ts +2 -2
- package/data/transforms/transform-checkout-agreements.d.ts +1 -1
- package/data/transforms/transform-customer.d.ts +1 -1
- package/data/transforms/transform-shipping-methods.d.ts +2 -1
- package/{api/errors → errors}/errors.d.ts +1 -1
- package/{utils/convertCase → errors}/index.d.ts +1 -1
- package/hocs/index.d.ts +1 -0
- package/hocs/withSkeleton.d.ts +8 -0
- package/i18n/en_US.json.d.ts +31 -28
- package/{signals/EmailSignal.d.ts → lib/debounce.d.ts} +15 -11
- package/{api/utils → lib}/dispatchApiCall.d.ts +3 -7
- package/lib/dom.d.ts +18 -0
- package/{api/utils → lib}/filterControlledErrors.d.ts +1 -1
- package/lib/index.d.ts +4 -0
- package/{utils/getDisplayName/getDisplayName.d.ts → lib/preact.d.ts} +1 -1
- package/package.json +1 -1
- package/render.js +5 -4
- package/signals/IsSubscribedToNewsletterSignal.d.ts +18 -0
- package/signals/ShippingEstimateSignal.d.ts +7 -0
- package/signals/index.d.ts +2 -3
- package/{utils/isUnexpectedError/isUnexpectedError.d.ts → types/ComponentTypes.d.ts} +2 -2
- package/types/TitleProps.d.ts +9 -0
- package/api/errors/index.d.ts +0 -18
- package/chunks/state.js +0 -3
- package/chunks/transform-store-config.js +0 -13
- package/signals/CustomerSignal.d.ts +0 -7
- package/signals/EstimateShippingMethodsSignal.d.ts +0 -7
- package/utils/convertCase/convertCase.d.ts +0 -4
- package/utils/getDisplayName/index.d.ts +0 -18
- package/utils/isEmpty/index.d.ts +0 -18
- package/utils/isEmpty/isEmpty.d.ts +0 -18
- package/utils/isNullish/index.d.ts +0 -18
- package/utils/isNullish/isNullish.d.ts +0 -18
- package/utils/scrollToElement/index.d.ts +0 -2
- package/utils/scrollToElement/scrollToElement.d.ts +0 -2
- package/utils/shippingMethods/index.d.ts +0 -18
- package/utils/shippingMethods/isEqual.d.ts +0 -4
- /package/{api/utils → lib}/enqueueRequest.d.ts +0 -0
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
import { PaymentMethodConfig } from '../../containers';
|
|
1
2
|
import { PaymentMethod } from '../../data/models/payment-method';
|
|
2
|
-
import {
|
|
3
|
+
import { VNode } from 'preact';
|
|
3
4
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
|
-
import {
|
|
5
|
+
import { UIComponentType } from '../../types/ComponentTypes';
|
|
5
6
|
|
|
6
7
|
interface ExtendedPaymentMethod extends PaymentMethodConfig, PaymentMethod {
|
|
7
8
|
}
|
|
8
|
-
export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading'> {
|
|
9
|
+
export interface PaymentMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'loading' | 'title'> {
|
|
10
|
+
title?: VNode;
|
|
9
11
|
initializing?: boolean;
|
|
10
12
|
loading?: boolean;
|
|
11
13
|
onChange?: (value: string) => void;
|
|
12
14
|
options?: ExtendedPaymentMethod[];
|
|
13
15
|
paymentMethodContent?: VNode;
|
|
14
16
|
selection?: string;
|
|
17
|
+
UIComponentType?: UIComponentType;
|
|
15
18
|
}
|
|
16
|
-
export declare const PaymentMethods:
|
|
19
|
+
export declare const PaymentMethods: (props: PaymentMethodsProps & import('../../hocs/withSkeleton').WithSkeletonProps) => import("preact").JSX.Element;
|
|
17
20
|
export {};
|
|
18
21
|
//# sourceMappingURL=PaymentMethods.d.ts.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { ShippingMethod } from '../../data/models';
|
|
2
|
-
import {
|
|
2
|
+
import { VNode } from 'preact';
|
|
3
3
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
4
|
|
|
5
|
-
export interface ShippingMethodsProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
export interface ShippingMethodsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
onSelectionChange?: (method: ShippingMethod) => void;
|
|
8
|
-
options
|
|
8
|
+
options: ShippingMethod[];
|
|
9
9
|
selection?: ShippingMethod;
|
|
10
|
+
title?: VNode;
|
|
10
11
|
}
|
|
11
|
-
export declare const ShippingMethods:
|
|
12
|
+
export declare const ShippingMethods: (props: ShippingMethodsProps & import('../../hocs/withSkeleton').WithSkeletonProps) => import("preact").JSX.Element;
|
|
12
13
|
//# sourceMappingURL=ShippingMethods.d.ts.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/********************************************************************
|
|
2
|
-
* ADOBE CONFIDENTIAL
|
|
3
|
-
* __________________
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2024 Adobe
|
|
6
|
-
* All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* NOTICE: All information contained herein is, and remains
|
|
9
|
-
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
-
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
-
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
-
* property laws, including trade secret and copyright laws.
|
|
13
|
-
* Dissemination of this information or reproduction of this material
|
|
14
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
-
* from Adobe.
|
|
16
|
-
*******************************************************************/
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
17
|
export * from './ShippingMethods';
|
|
18
18
|
export * from './ShippingMethodsSkeleton';
|
|
19
19
|
export { ShippingMethods as default } from './ShippingMethods';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
2
|
import { HTMLAttributes } from 'preact/compat';
|
|
3
3
|
|
|
4
4
|
export interface TermsAndConditionsProps extends HTMLAttributes<HTMLFormElement> {
|
|
5
5
|
agreements?: VNode;
|
|
6
6
|
error?: string;
|
|
7
|
-
isInitialized?: boolean;
|
|
8
7
|
}
|
|
9
|
-
export declare const TermsAndConditions:
|
|
8
|
+
export declare const TermsAndConditions: (props: TermsAndConditionsProps & import('../../hocs/withSkeleton').WithSkeletonProps) => import("preact").JSX.Element;
|
|
10
9
|
//# sourceMappingURL=TermsAndConditions.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './BillToShippingAddress';
|
|
|
18
18
|
export * from './EstimateShipping';
|
|
19
19
|
export * from './LoginForm';
|
|
20
20
|
export * from './Markup';
|
|
21
|
+
export * from './Newsletter';
|
|
21
22
|
export * from './OutOfStock';
|
|
22
23
|
export * from './PaymentMethods';
|
|
23
24
|
export * from './PlaceOrder';
|
|
@@ -18,7 +18,7 @@ export interface BillToShippingAddressProps {
|
|
|
18
18
|
onChange?: (checked: boolean) => void;
|
|
19
19
|
}
|
|
20
20
|
export declare const BillToShippingAddress: {
|
|
21
|
-
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & BillToShippingAddressProps): import("preact
|
|
21
|
+
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & BillToShippingAddressProps): import("preact").JSX.Element;
|
|
22
22
|
displayName: string;
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=BillToShippingAddress.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/
|
|
3
|
+
import{jsx as t}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/store-config.js";import"@dropins/tools/lib.js";import{e as a,c as g}from"../chunks/ShippingEstimateSignal.js";import"@dropins/tools/event-bus.js";import{s as S}from"../chunks/setBillingAddress.js";/* empty css */import{Skeleton as b,SkeletonRow as f,Checkbox as A}from"@dropins/tools/components.js";import{W as B}from"../chunks/withSkeleton.js";import{c as T}from"../chunks/classes.js";import{useText as x}from"@dropins/tools/i18n.js";import{w as v}from"../chunks/withConditionalRendering.js";import{useState as _,useEffect as w}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";import"../chunks/errors.js";const y=()=>t(b,{className:"bill-to-shipping-address__skeleton",children:t(f,{size:"small",variant:"row"})}),N=({className:i,checked:e,disabled:r,onChange:n})=>{const s=x({title:"Checkout.BillToShippingAddress.title"});return t("div",{className:"checkout-bill-to-shipping-address",children:t(A,{checked:e,className:T(["checkout-bill-to-shipping-address__checkbox",i]),"data-testid":"bill-to-shipping-checkbox",disabled:r,label:s.title,name:"checkout-bill-to-shipping-address__checkbox",onChange:n})})},C=B(N,y),k=({onChange:i})=>{var h;const[e,r]=_(!0),n=a.value,s=g.value.data,u=g.value.pending,d=!!s,p=!!(s==null?void 0:s.billingAddress),o=(h=s==null?void 0:s.shippingAddresses)==null?void 0:h[0],m=o==null?void 0:o.sameAsBilling;return w(()=>{if(!e||!d)return;r(!1);const l=m??!p;a.value=l,i==null||i(l)},[d,p,m,e,i]),t(C,{checked:n,disabled:u,initialized:!e,onChange:async l=>{const c=l.target.checked;a.value=c,i==null||i(c),!e&&o&&c&&await S({sameAsShipping:!0}).catch(console.error)}})};k.displayName="BillToShippingAddressContainer";const X=v(k);export{X as BillToShippingAddress,X as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as k,Fragment as y,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as v,SkeletonRow as M,Price as x}from"@dropins/tools/components.js";import"../chunks/TermsAndConditions.js";import{VComponent as A,classes as I}from"@dropins/tools/lib.js";import{Text as l,useText as w}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{T as C}from"../chunks/store-config.js";import{
|
|
3
|
+
import{jsxs as k,Fragment as y,jsx as t}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as v,SkeletonRow as M,Price as x}from"@dropins/tools/components.js";import"../chunks/TermsAndConditions.js";import{VComponent as A,classes as I}from"@dropins/tools/lib.js";import{Text as l,useText as w}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css *//* empty css */import{s as z,T as C}from"../chunks/store-config.js";import{events as g}from"@dropins/tools/event-bus.js";import{useState as B,useEffect as f}from"@dropins/tools/preact-hooks.js";const G=({estimated:e=!1,price:a,priceExclTax:d,taxExcluded:o=!1,taxIncluded:p=!1})=>k(y,{children:[t("span",{className:"checkout-estimate-shipping__label",children:e?t(l,{id:"Checkout.EstimateShipping.estimated"}):t(l,{id:"Checkout.EstimateShipping.label"})}),t(A,{className:"checkout-estimate-shipping__price",node:a}),p&&t("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included",children:t(l,{id:"Checkout.EstimateShipping.withTaxes"})}),o&&k("span",{className:I(["checkout-estimate-shipping__caption"]),"data-testid":"shipping-tax-included-excluded",children:[d," ",t(l,{id:"Checkout.EstimateShipping.withoutTaxes"})]})]}),L=()=>t(v,{"data-testid":"estimate-shipping-skeleton",children:t(M,{size:"xsmall"})}),Q=()=>{const[e,a]=B(),d=e!==void 0,o=(e==null?void 0:e.amount.value)===0,p=z.config,T=p==null?void 0:p.shoppingCartDisplaySetting.shipping,_=T===C.INCLUDING_EXCLUDING_TAX,E=T===C.INCLUDING_TAX,S=w({freeShipping:"Checkout.EstimateShipping.freeShipping",taxToBeDetermined:"Checkout.EstimateShipping.taxToBeDetermined"});f(()=>{const i=g.on("shipping/estimate",n=>{const s=n.shippingMethod,{amount:c,amountExclTax:r,amountInclTax:m}=s;a({estimated:!0,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),f(()=>{const i=g.on("checkout/initialized",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;a({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]),f(()=>{const i=g.on("checkout/updated",n=>{var u,h;const s=(h=(u=n==null?void 0:n.shippingAddresses)==null?void 0:u[0])==null?void 0:h.selectedShippingMethod;if(!s)return;const{amount:c,amountExclTax:r,amountInclTax:m}=s;a({estimated:!1,amount:c,amountExclTax:r,amountInclTax:m})},{eager:!0});return()=>{i==null||i.off()}},[]);const D=()=>o?t("span",{"data-testId":"free-shipping",children:S.freeShipping}):E&&(e!=null&&e.amountInclTax)?t(x,{amount:e.amountInclTax.value,currency:e.amountInclTax.currency,"data-testid":"shipping"}):t(x,{amount:e==null?void 0:e.amount.value,currency:e==null?void 0:e.amount.currency,"data-testid":"shipping"}),N=()=>e!=null&&e.amountExclTax?t(x,{amount:e.amountExclTax.value,currency:e.amountExclTax.currency,"data-testid":"shipping-excluding-tax"}):t("span",{children:S.taxToBeDetermined});return t("div",{className:"checkout-estimate-shipping","data-testid":"estimate-shipping",children:d?t(G,{estimated:e.estimated,price:D(),priceExclTax:N(),taxExcluded:_&&!o,taxIncluded:E&&!o}):t(L,{})})};export{Q as EstimateShipping,Q as default};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
import { TitleProps } from '../../types/TitleProps';
|
|
2
|
+
import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
1
3
|
import { HTMLAttributes } from 'preact/compat';
|
|
2
4
|
|
|
3
|
-
export interface LoginFormProps extends HTMLAttributes<HTMLFormElement
|
|
5
|
+
export interface LoginFormProps extends HTMLAttributes<HTMLFormElement>, TitleProps {
|
|
6
|
+
displayHeadingContent?: boolean;
|
|
4
7
|
onSignInClick?: (email: string) => void;
|
|
5
8
|
onSignOutClick?: () => void;
|
|
9
|
+
slots?: {
|
|
10
|
+
Heading?: SlotProps<{
|
|
11
|
+
authenticated: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
} & TitleProps['slots'];
|
|
6
14
|
}
|
|
7
15
|
export declare const LoginForm: {
|
|
8
16
|
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & LoginFormProps): import("preact/compat").JSX.Element;
|
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 t,jsxs as s,Fragment as X}from"@dropins/tools/preact-jsx-runtime.js";import{s as Y}from"../chunks/store-config.js";import{VComponent as I,classes as Z,Slot as H}from"@dropins/tools/lib.js";import"../chunks/ShippingEstimateSignal.js";import{events as T}from"@dropins/tools/event-bus.js";import{g as ee,i as te,s as re}from"../chunks/setGuestEmailOnCart.js";import{Field as oe,Input as ne,Skeleton as ie,SkeletonRow as x}from"@dropins/tools/components.js";import{useText as w,Text as F}from"@dropins/tools/i18n.js";/* empty css */import{W as ae}from"../chunks/withSkeleton.js";import"../chunks/TermsAndConditions.js";/* empty css *//* empty css *//* empty css *//* empty css */import{w as le}from"../chunks/withConditionalRendering.js";import{useRef as z,useState as f,useMemo as p,useCallback as M,useEffect as $}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";import"../chunks/errors.js";function ce(o,n){let r=null,i=null;function m(...l){i=l,r!==null&&clearTimeout(r),r=setTimeout(()=>{i&&(o(...i),i=null),r=null},n)}return m.cancel=function(){r!==null&&(clearTimeout(r),r=null,i=null)},m.flush=function(){r!==null&&i&&(clearTimeout(r),o(...i),r=null,i=null)},m}const ue={EMAIL:/^[a-z0-9,!#$%&'*+/=?^_`{|}~-]+(\.[a-z0-9,!#$%&'*+/=?^_`{|}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i},C=o=>ue.EMAIL.test(o),me=({value:o,error:n,hint:r,onChange:i,onBlur:m,onInvalid:l})=>{const d=w({LoginFormLabel:"Checkout.LoginForm.ariaLabel",LoginFormFloatingLabel:"Checkout.LoginForm.floatingLabel",LoginFormPlaceholder:"Checkout.LoginForm.placeholder"});return t(oe,{error:n,hint:r,children:t(ne,{"aria-label":d.LoginFormLabel,"aria-required":!0,autocomplete:"email",floatingLabel:d.LoginFormFloatingLabel,id:"customer-email",name:"customer-email",placeholder:d.LoginFormPlaceholder,required:!0,type:"email",value:o,onBlur:m,onChange:i,onInvalid:l})})},se=({onClick:o})=>s("div",{className:"checkout-login-form__sign-in",children:[t(F,{id:"Checkout.LoginForm.account"}),t("a",{className:"checkout-login-form__link","data-testid":"sign-in-link",href:"#",rel:"noreferrer",target:"_blank",onClick:n=>{n.preventDefault(),o(n)},children:t(F,{id:"Checkout.LoginForm.signIn"})})]}),de=()=>s(ie,{"data-testid":"login-form-skeleton",children:[t(x,{fullWidth:!0,variant:"heading"}),t(x,{fullWidth:!0,size:"medium"})]}),he=({className:o,customer:n=null,email:r,error:i,headingContent:m,hint:l,name:d,onEmailBlur:E,onEmailChange:g,onEmailInvalid:k,title:h,..._})=>s("div",{className:"checkout-login-form","data-testid":"checkout-login-form",children:[s("div",{className:"checkout-login-form__heading",children:[h&&t(I,{className:"checkout-login-form__title",node:h}),m&&t(I,{className:"checkout-login-form__heading-label",node:m})]}),n?s("div",{className:"checkout-login-form__customer-details",children:[t("div",{className:"checkout-login-form__customer-name",children:`${n.firstName} ${n.lastName}`}),t("div",{className:"checkout-login-form__customer-email",children:n.email})]}):t("div",{className:"checkout-login-form__content",children:s("form",{..._,noValidate:!0,className:Z(["dropin-login-form__form",o]),name:d,children:[t("button",{disabled:!0,"aria-hidden":"true",style:"display: none",type:"submit"}),t(me,{error:i,hint:l,value:r,onBlur:E,onChange:g,onInvalid:k})]})})]}),ge=ae(he,de),fe=({onClick:o})=>s("p",{className:"checkout-login-form__sign-out",children:[t(F,{id:"Checkout.LoginForm.switch"}),t("a",{className:"checkout-login-form__link",href:"#",rel:"noreferrer",target:"_blank",onClick:n=>{n.preventDefault(),o==null||o(n)},children:t(F,{id:"Checkout.LoginForm.signOut"})})]}),Ee=1e3,B=({displayTitle:o=!0,displayHeadingContent:n=!0,onSignInClick:r,onSignOutClick:i,initialData:m,slots:l,...d})=>{const E=z(""),g=z(""),[k,h]=f(!0),[_,y]=f(""),[S,L]=f(""),[V,D]=f(!1),[b,P]=f(Y.authenticated),[W,R]=f(null),u=w({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"}),j=e=>e.valid?"":e.valueMissing?u.MissingEmailError:u.InvalidEmailError,q=e=>C(e)?"":e===""?u.MissingEmailError:u.InvalidEmailError,N=p(()=>ce(async e=>{try{if(!C(e)||E.current===e)return;const[a]=await Promise.all([te(e),re(e)]);h(a),E.current=e}catch(a){console.error(a),h(!0)}},Ee),[]),G=async e=>{const c=e.target.value;y(c),h(!0),L(""),g.current=c,N(c)},U=e=>{const a=e.target,c=q(a.value);a.setCustomValidity(c),L(c),N.flush()},J=e=>{const a=e.target;L(j(a.validity))},v=M(()=>{const e=g.current;r==null||r(C(e)?e:"")},[r]),A=M(()=>{console.debug("Sign out clicked"),g.current="",i==null||i()},[i]);$(()=>{const e=T.on("authenticated",a=>{P(a),ee().then(c=>{R(c)}).catch(console.error)},{eager:!0});return()=>{e==null||e.off()}},[]),$(()=>{const e=T.on("checkout/initialized",a=>{const c=(a==null?void 0:a.email)??"";D(!0),y(c),L(""),h(!0),c!==""&&(g.current=c,E.current=c)},{eager:!0});return()=>{e==null||e.off()}},[]);const K=p(()=>{if(o)return t(H,{name:"checkout-login-form-title",slot:l==null?void 0:l.Title,children:t("h2",{children:u.Title})})},[o,l,u.Title]),O=p(()=>{if(n)return t(H,{context:{authenticated:b},name:"checkout-login-form-heading-label",slot:l==null?void 0:l.Heading,children:b?t(fe,{onClick:A}):t(se,{onClick:v})})},[n,b,l,v,A]),Q=p(()=>k?"":s(X,{children:[u.AlreadyHaveAccountHint," ",t("a",{href:"#",onClick:v,children:u.SignInLabel})," ",u.FasterCheckoutHint]}),[k,u.AlreadyHaveAccountHint,u.SignInLabel,u.FasterCheckoutHint,v]);return t(ge,{...d,customer:W,email:_,error:S,headingContent:O,hint:Q,initialized:V,title:K,onEmailBlur:U,onEmailChange:G,onEmailInvalid:J})};B.displayName="LoginFormContainer";const De=le(B);export{De as LoginForm,De as default};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AlertBannerProps } from '@dropins/tools/types/elsie/src/components';
|
|
2
2
|
|
|
3
3
|
export declare const MergedCartBanner: {
|
|
4
|
-
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs').ConditionalProps & AlertBannerProps): import("preact
|
|
4
|
+
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs').ConditionalProps & AlertBannerProps): import("preact").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=MergedCartBanner.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as u}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as B}from"@dropins/tools/event-bus.js";import
|
|
3
|
+
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{AlertBanner as g,Icon as u}from"@dropins/tools/components.js";import{c as h}from"../chunks/classes.js";import{events as B}from"@dropins/tools/event-bus.js";import{useState as I,useEffect as M}from"@dropins/tools/preact-hooks.js";import{w as v}from"../chunks/withConditionalRendering.js";import*as l from"@dropins/tools/preact-compat.js";import{useText as w,Text as x}from"@dropins/tools/i18n.js";import"../chunks/ShippingEstimateSignal.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/store-config.js";import"@dropins/tools/signals.js";import"@dropins/tools/lib.js";const H=t=>l.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},l.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 12C0 5.37931 5.37931 0 12 0C18.6207 0 24 5.37931 24 12C24 18.6207 18.6207 24 12 24C5.37931 24 0 18.6207 0 12ZM11.8885 5.06101C11.1405 5.06101 10.5357 5.66579 10.5357 6.4138V6.57295C10.5835 7.27321 11.1882 7.81433 11.8885 7.76658H12.0795C12.7797 7.70292 13.289 7.09815 13.2413 6.4138C13.2413 5.66579 12.6365 5.06101 11.8885 5.06101ZM13.1935 16.8223H14.1007C14.2599 16.8223 14.4031 16.9655 14.4031 17.1247V17.7294C14.4031 17.9045 14.2599 18.0318 14.1007 18.0318H9.8832C9.70813 18.0318 9.58081 17.8886 9.58081 17.7294V17.1247C9.58081 16.9496 9.72405 16.8223 9.8832 16.8223H10.7904V10.7905H9.8832C9.70813 10.7905 9.58081 10.6472 9.58081 10.4881V9.88329C9.58081 9.70823 9.72405 9.58091 9.8832 9.58091H12.5888C12.923 9.58091 13.1935 9.85146 13.1935 10.1857V16.8223Z",fill:"currentColor"})),C=({className:t,initialData:V,...c})=>{const[r,a]=I(0),s=w({mergedCartBannerItems:e(x,{fields:{count:r},id:"Checkout.MergedCartBanner.items",plural:r})});M(()=>{const n=B.on("cart/merged",o=>{var m;const i=(m=o==null?void 0:o.oldCartItems)==null?void 0:m.reduce((f,p)=>f+p.quantity,0);i>0&&a(i)});return()=>{n==null||n.off()}},[]);const d=()=>{a(0)};return r?e(g,{...c,"aria-label":s.mergedCartBannerItems,className:h(["checkout__banner",t]),"data-testid":"merged-cart-banner",icon:e(u,{source:H}),message:e("span",{children:s.mergedCartBannerItems}),variant:"neutral",onDismiss:d}):null};C.displayName="MergedCartBannerContainer";const q=v(C);export{q as MergedCartBanner,q as default};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
2
|
+
|
|
3
|
+
export interface NewsletterProps {
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
onChange?: (checked: boolean) => void;
|
|
6
|
+
showForAuthenticatedUsers?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const Newsletter: Container<NewsletterProps>;
|
|
9
|
+
//# sourceMappingURL=Newsletter.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************
|
|
2
|
-
* ADOBE CONFIDENTIAL
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
3
|
* __________________
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2024 Adobe
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export * from './
|
|
17
|
+
export * from './Newsletter';
|
|
18
|
+
export { Newsletter as default } from './Newsletter';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{useState as n,useEffect as u}from"@dropins/tools/preact-hooks.js";import{events as m}from"@dropins/tools/event-bus.js";/* empty css */import{Skeleton as S,SkeletonRow as v,Checkbox as x}from"@dropins/tools/components.js";import{W as E}from"../chunks/withSkeleton.js";import{c as _}from"../chunks/classes.js";import{useText as z}from"@dropins/tools/i18n.js";import{i as c}from"../chunks/ShippingEstimateSignal.js";import{s as T}from"../chunks/store-config.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";const I=()=>r(S,{className:"checkout-newsletter-skeleton","data-testid":"checkout-newsletter-skeleton",children:r(v,{size:"small",variant:"row"})}),R=({className:o,checked:s,onChange:l})=>{const i=z({title:"Checkout.Newsletter.title"});return r("div",{className:"checkout-newsletter","data-testid":"checkout-newsletter",children:r(x,{checked:s,className:_(["checkout-newsletter__checkbox",o]),"data-testid":"checkout-newsletter-checkbox",label:i.title,name:"checkout-newsletter__checkbox",onChange:l})})},W=E(R,I),M=({defaultChecked:o=!1,onChange:s,showForAuthenticatedUsers:l=!1})=>{const[i,f]=n(!0),[d,k]=n(!1),[w,h]=n(!1),a=c.value;u(()=>{o&&!a&&(c.value=o)},[]);const p=(e,t,N)=>e&&(!t||N),b=async e=>{const t=e.target.checked;c.value=t,s==null||s(t)};return u(()=>{const e=m.on("checkout/initialized",()=>{var t;k(!0),f(((t=T.config)==null?void 0:t.newsletterEnabled)??!0)},{eager:!0});return()=>{e==null||e.off()}},[]),u(()=>{const e=m.on("authenticated",t=>{h(t)},{eager:!0});return()=>{e==null||e.off()}},[]),p(i,w,l)?r(W,{checked:a,initialized:d,onChange:b}):(a&&(c.value=!1,s==null||s(!1)),null)};export{M as Newsletter,M as default};
|
package/containers/OutOfStock.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
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";import"../chunks/TermsAndConditions.js";import{classes as O}from"@dropins/tools/lib.js"
|
|
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";import"../chunks/TermsAndConditions.js";import{classes as O}from"@dropins/tools/lib.js";/* empty css */import{S as d}from"../chunks/OrderError.js";import{useText as p}from"@dropins/tools/i18n.js";/* empty css *//* empty css *//* empty css */import{events as S}from"@dropins/tools/event-bus.js";import{useState as v,useCallback as _,useEffect as g}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";const N=({className:i,items:r,onRemoveOutOfStock:o,routeCart:a,...m})=>{const s=p({title:"Checkout.OutOfStock.title",message:"Checkout.OutOfStock.message",reviewCart:"Checkout.OutOfStock.actions.reviewCart",removeOutOfStock:"Checkout.OutOfStock.actions.removeOutOfStock"});return n(k,{className:O(["checkout-out-of-stock",i]),"data-testid":"checkout-out-of-stock",variant:"secondary",...m,children:[n("h4",{className:"checkout-out-of-stock__title",children:[e(l,{size:"16",source:d,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",{className:"checkout-out-of-stock__item","data-testid":"out-of-stock-item",children:e(h,{alt:u.image.alt,height:"100",loading:"eager",params:{width:100},src:u.image.src,width:"100"})},u.sku))}),n("div",{className:"checkout-out-of-stock__actions",children:[a&&e("a",{className:"checkout-out-of-stock__action","data-testid":"review-cart",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})]})]})},A=({onCartProductsUpdate:i,routeCart:r})=>{const[o,a]=v([]),m=t=>t.outOfStock||t.insufficientQuantity,s=_(()=>{if(!i)return;const t=o.filter(c=>c.outOfStock).map(c=>({uid:c.uid,quantity:0}));i(t)},[o,i]);if(g(()=>{const t=S.on("cart/data",c=>{const f=(c==null?void 0:c.items)||[];a(f.filter(m))},{eager:!0});return()=>{t==null||t.off()}},[]),o.length===0)return null;const u=!o.some(t=>t.insufficientQuantity);return e(N,{items:o,routeCart:r==null?void 0:r(),onRemoveOutOfStock:u?s:void 0})};export{A as OutOfStock,A as default};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { TitleProps } from '../../types/TitleProps';
|
|
1
2
|
import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
2
3
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
|
+
import { UIComponentType } from '../../types/ComponentTypes';
|
|
3
5
|
|
|
4
6
|
export interface PaymentMethodRenderCtx {
|
|
5
7
|
cartId: string;
|
|
@@ -21,7 +23,7 @@ export interface PaymentMethodsSlot {
|
|
|
21
23
|
export interface PaymentMethodsHandlerSlot {
|
|
22
24
|
[code: string]: PaymentMethodConfig['render'];
|
|
23
25
|
}
|
|
24
|
-
export interface PaymentMethodsProps extends HTMLAttributes<HTMLDivElement
|
|
26
|
+
export interface PaymentMethodsProps extends HTMLAttributes<HTMLDivElement>, TitleProps {
|
|
25
27
|
/**
|
|
26
28
|
* @deprecated This property is deprecated and will be removed in future versions.
|
|
27
29
|
*/
|
|
@@ -34,7 +36,8 @@ export interface PaymentMethodsProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
34
36
|
*/
|
|
35
37
|
Handlers?: PaymentMethodsHandlerSlot;
|
|
36
38
|
Methods?: PaymentMethodsSlot;
|
|
37
|
-
};
|
|
39
|
+
} & TitleProps['slots'];
|
|
40
|
+
UIComponentType?: UIComponentType;
|
|
38
41
|
}
|
|
39
42
|
export declare const PaymentMethods: {
|
|
40
43
|
({ hideOnEmptyCart, hideOnVirtualCart, ...props }: import('../../hocs/withConditionalRendering').ConditionalProps & PaymentMethodsProps): import("preact/compat").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{jsxs as w,jsx as n}from"@dropins/tools/preact-jsx-runtime.js";import{s as Z}from"../chunks/store-config.js";import{classes as M,VComponent as D,Slot as x}from"@dropins/tools/lib.js";import{c as S,d as u}from"../chunks/ShippingEstimateSignal.js";import"@dropins/tools/event-bus.js";import{s as $}from"../chunks/setPaymentMethod.js";/* empty css */import{Skeleton as q,SkeletonRow as g,IllustratedMessage as F,Icon as V,ProgressSpinner as G,ToggleButton as J,RadioButton as K}from"@dropins/tools/components.js";import{W as Q}from"../chunks/withSkeleton.js";import*as v from"@dropins/tools/preact-compat.js";import{useText as W}from"@dropins/tools/i18n.js";import{w as X}from"../chunks/withConditionalRendering.js";import{useRef as Y,useState as ee,useEffect as L,useCallback as te}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../fragments.js";import"../chunks/synchronizeCheckout.js";import"../chunks/errors.js";const ne=r=>v.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},v.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"}),v.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),v.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),oe=()=>w(q,{"data-testid":"payment-methods-skeleton",children:[n(g,{size:"medium",variant:"heading"}),n(g,{size:"medium",variant:"empty"}),n(g,{fullWidth:!0,size:"xlarge"}),n(g,{fullWidth:!0,size:"xlarge"})]}),ae=({code:r,icon:s,loading:e,onChange:m,selected:c,title:a,UIComponentType:p="ToggleButton"})=>{const o={busy:e,className:"checkout-payment-methods__method",label:a,name:"payment-method",value:r,onChange:()=>m(r)};return p==="ToggleButton"?n(J,{...o,icon:s?n(V,{source:s}):void 0,selected:c}):n(K,{...o,checked:c,icon:s??void 0})},re=({className:r,title:s,loading:e=!1,onChange:m=()=>{},options:c,paymentMethodContent:a,UIComponentType:p,selection:o})=>{const h=W({EmptyState:"Checkout.PaymentMethods.emptyState"});return w("div",{className:M(["checkout-payment-methods",r]),children:[s&&n(D,{className:"checkout-payment-methods__title",node:s}),!e&&c.length===0&&n(F,{icon:n(V,{source:ne}),message:n("p",{children:h.EmptyState})}),w("div",{className:M(["checkout-payment-methods__wrapper",["checkout-payment-methods__wrapper--loading",e]]),children:[e&&n(G,{className:"checkout-payment-methods__spinner"}),n("div",{className:M(["checkout-payment-methods__methods",["checkout-payment-methods--full-width",c.length%2!==0]]),children:c==null?void 0:c.map(d=>n(ae,{UIComponentType:p,code:d.code,icon:d.icon,selected:d.code===o,title:d.displayLabel??!0?d.title:"",onChange:m},d.code))}),a&&n("div",{className:"checkout-payment-methods__content",children:a})]})]})},ie=Q(re,oe),ce=(r,s)=>{const e=Y(r);return s(e.current,r)||(e.current=r),e.current},N=({displayTitle:r=!0,UIComponentType:s="ToggleButton",slots:e,setOnChange:m={}})=>{var b,_,H,E,I;const[c]=ee(m),a=e==null?void 0:e.Methods;L(()=>{e!=null&&e.Handlers&&console.warn("The `slots.Handlers` prop is deprecated and will be removed in future versions. Use the `Methods` object instead."),m&&console.warn("The `setOnChange` prop is deprecated and will be removed in future versions. Use the `Methods` object instead.")},[]);const p=W({Title:"Checkout.PaymentMethods.title"}),o=S.value.data,h=!!S.value.data,d=S.value.pending,O=(o==null?void 0:o.isVirtual)??!1,j=(b=o==null?void 0:o.shippingAddresses)==null?void 0:b[0],A=(o==null?void 0:o.availablePaymentMethods)||[],y=(_=o==null?void 0:o.selectedPaymentMethod)==null?void 0:_.code,T=O?!0:!!j,l=ce(A.filter(t=>{var i;return((i=a==null?void 0:a[t.code])==null?void 0:i.enabled)!==!1}),(t,i)=>t.length!==i.length?!1:t.every((f,P)=>f.code===i[P].code)),k=te(t=>{var i;u.value=t,!(!t||!T)&&t!==y&&(c[t]===!1||((i=a==null?void 0:a[t])==null?void 0:i.setOnChange)===!1||$({code:t}).catch(console.error))},[T,a,y,c]);L(()=>{if(!h||!!!(l!=null&&l.length))return;const i=l[0].code,f=y||u.value,P=f?l.some(R=>R.code===f):!1;k(P?f:i)},[l,h,k,y]);const U=t=>{k(t)},C=u.value?((E=(H=e==null?void 0:e.Methods)==null?void 0:H[u.value])==null?void 0:E.render)||((I=e==null?void 0:e.Handlers)==null?void 0:I[u.value]):null,z=C?n(x,{context:{cartId:Z.cartId||"",replaceHTML(t){this.replaceWith(t)}},name:"PaymentMethodContent",slot:C},C):void 0,B=l.map(t=>{const i=(a==null?void 0:a[t.code])||{};return{...t,...i}});return n(ie,{UIComponentType:s,initialized:h,loading:h&&d,options:B,paymentMethodContent:z,selection:u.value,title:r?n(x,{name:"checkout-payment-methods-title",slot:e==null?void 0:e.Title,children:n("h2",{children:p.Title})}):void 0,onChange:U})};N.displayName="PaymentMethodsContainer";const Te=X(N);export{Te as PaymentMethods,Te as default};
|
package/containers/PlaceOrder.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as
|
|
3
|
+
import{jsx as o}from"@dropins/tools/preact-jsx-runtime.js";import{s as v}from"../chunks/store-config.js";import{classes as g,Slot as x}from"@dropins/tools/lib.js";import{c as y,b as E,d as l,i as P}from"../chunks/ShippingEstimateSignal.js";import{events as w}from"@dropins/tools/event-bus.js";import{U as N}from"../chunks/errors.js";/* empty css */import{Button as T}from"@dropins/tools/components.js";import{w as I}from"../chunks/withConditionalRendering.js";import{useState as U,useCallback as u,useEffect as z}from"@dropins/tools/preact-hooks.js";import{useText as D,Text as H}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";const _=({children:c,className:r,disabled:a=!1,onClick:t})=>o("div",{className:g(["checkout-place-order",r]),children:o(T,{className:"checkout-place-order__button","data-testid":"place-order-button",disabled:a,size:"medium",type:"submit",variant:"primary",onClick:t,children:c},"placeOrder")}),d=({disabled:c=!1,handleValidation:r,handlePlaceOrder:a,slots:t,...f})=>{const[p,C]=U(!1),{data:O,pending:k}=y.value,S=!!O,s=D({CheckoutUnexpectedError:"Checkout.ServerError.unexpected"}),i=u(e=>{E.value=e instanceof TypeError||e instanceof N?s.CheckoutUnexpectedError:e.message},[s]),b=u(async()=>{try{if(!(r?r():!0))return;await a({cartId:v.cartId||"",code:l.value||"",isSubscribedToNewsletter:P.value||!1})}catch(e){i(e)}},[r,a,i]);return z(()=>{const e=w.on("cart/initialized",n=>{const h=(n==null?void 0:n.items)||[];C(h.some(m=>m.outOfStock||m.insufficientQuantity))},{eager:!0});return()=>{e==null||e.off()}},[]),o(_,{...f,disabled:c||!S||k||p,onClick:b,children:t!=null&&t.Content?o(x,{context:{code:l.value||""},name:"Content",slot:t.Content}):o(H,{id:"Checkout.PlaceOrder.button"})})};d.displayName="PlaceOrderContainer";const W=I(d);export{W as PlaceOrder,W as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as s,jsxs as n}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{IllustratedMessage as l,
|
|
3
|
+
import{jsx as s,jsxs as n}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{IllustratedMessage as l,Button as p,Icon as f}from"@dropins/tools/components.js";import"../chunks/TermsAndConditions.js";import{classes as a}from"@dropins/tools/lib.js";/* empty css *//* empty css *//* empty css */import{S as h}from"../chunks/OrderError.js";import{useText as d}from"@dropins/tools/i18n.js";/* empty css */import"../chunks/store-config.js";import{b as u}from"../chunks/ShippingEstimateSignal.js";import"@dropins/tools/event-bus.js";import{useRef as v,useEffect as m}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";function g(e){e.scrollIntoView({behavior:"smooth"}),e.focus()}const k=({className:e,contactSupport:t,errorMessage:i,onClick:c,errorMessageRef:r})=>{const o=d({Title:"Checkout.ServerError.title",Message:"Checkout.ServerError.message",ContactSupport:"Checkout.ServerError.contactSupport",Button:"Checkout.ServerError.button"});return s(l,{action:s(p,{className:a(["checkout-server-error__button"]),onClick:c,children:o.Button}),"aria-describedby":"checkout-server-error__message","aria-invalid":"true","aria-live":"polite",className:a(["checkout-server-error",e]),"data-testid":"checkout-server-error",heading:i??o.Title,icon:s(f,{className:a(["checkout-server-error__icon"]),source:h}),message:n("p",{ref:r,"data-testid":"checkout-server-error-message",id:a(["checkout-server-error__message"]),children:[o.Message,s("br",{}),s("span",{children:t??o.ContactSupport})]})})},A=({onRetry:e,onServerError:t,autoScroll:i=!1})=>{const c=v(null),r=u.value,o=async()=>{e==null||e(),u.value=void 0};return m(()=>{r&&(t==null||t(r))},[r,t]),m(()=>{!i||!r||!c.current||g(c.current)},[r,i]),r?s(k,{errorMessage:r,errorMessageRef:c,onClick:o}):null};export{A as ServerError,A as default};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ShippingMethod } from '../../data/models';
|
|
2
|
+
import { TitleProps } from '../../types/TitleProps';
|
|
2
3
|
import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
3
4
|
import { HTMLAttributes } from 'preact/compat';
|
|
4
5
|
|
|
5
|
-
export interface ShippingMethodsProps extends HTMLAttributes<HTMLDivElement
|
|
6
|
+
export interface ShippingMethodsProps extends HTMLAttributes<HTMLDivElement>, TitleProps {
|
|
6
7
|
onShippingMethodSelect?: (method: ShippingMethod) => void;
|
|
7
8
|
preSelectedMethod?: {
|
|
8
9
|
carrierCode: string;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/********************************************************************
|
|
2
|
-
* ADOBE CONFIDENTIAL
|
|
3
|
-
* __________________
|
|
4
|
-
*
|
|
5
|
-
* Copyright 2024 Adobe
|
|
6
|
-
* All Rights Reserved.
|
|
7
|
-
*
|
|
8
|
-
* NOTICE: All information contained herein is, and remains
|
|
9
|
-
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
-
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
-
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
-
* property laws, including trade secret and copyright laws.
|
|
13
|
-
* Dissemination of this information or reproduction of this material
|
|
14
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
-
* from Adobe.
|
|
16
|
-
*******************************************************************/
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2024 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
17
|
export * from './ShippingMethods';
|
|
18
18
|
export { ShippingMethods as default } from './ShippingMethods';
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{jsxs as f,jsx as o,Fragment as x}from"@dropins/tools/preact-jsx-runtime.js";import"../chunks/store-config.js";import{classes as E,VComponent as O,Slot as w}from"@dropins/tools/lib.js";import{c as H,s as b,a as L}from"../chunks/ShippingEstimateSignal.js";import{events as N}from"@dropins/tools/event-bus.js";import{t as P,s as V}from"../chunks/setShippingMethods.js";/* empty css */import{Skeleton as B,SkeletonRow as v,IllustratedMessage as D,Icon as I,ProgressSpinner as Z,RadioButton as q,Price as F}from"@dropins/tools/components.js";import{W as $}from"../chunks/withSkeleton.js";import*as a from"@dropins/tools/preact-compat.js";import{useText as y}from"@dropins/tools/i18n.js";import{w as A}from"../chunks/withConditionalRendering.js";import{useMemo as T,useCallback as G,useEffect as J}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";import"../chunks/synchronizeCheckout.js";import"../fragments.js";import"../chunks/errors.js";const K=n=>a.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},a.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"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M15.1758 5.87573H19.0019L21.0394 10.7636",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.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"}),a.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"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.08792 7.63574H1.69824",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M7.11229 10.3619H1",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.16084 13.0402H1.92773",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.76172 16.7611H15.2809",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.38672 16.7611H5.17025",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),Q=()=>f(B,{"data-testid":"shipping-methods-skeleton",children:[o(v,{size:"small",variant:"heading"}),o(v,{size:"small",variant:"empty"}),o(v,{fullWidth:!0,size:"medium"}),o(v,{fullWidth:!0,size:"medium"})]}),U=({className:n,isLoading:t=!1,onSelectionChange:r=()=>{},options:h,selection:m,title:i,...c})=>{const l=y({EmptyState:"Checkout.ShippingMethods.emptyState"});return f("div",{...c,className:E(["checkout-shipping-methods",n]),children:[i&&o(O,{className:"checkout-shipping-methods__title",node:i}),!t&&h.length===0&&o(D,{icon:o(I,{source:K}),message:o("p",{children:l.EmptyState})}),f("div",{className:E(["checkout-shipping-methods__content"]),children:[t&&o(Z,{className:"checkout-shipping-methods__spinner"}),o("div",{className:E(["checkout-shipping-methods__options",["checkout-shipping-methods__options--loading",t]]),children:h.map(e=>o(q,{"aria-busy":t,checked:(m==null?void 0:m.value)===e.value,className:"checkout-shipping-methods__method","data-testid":"shipping-method-radiobutton",description:e.title,id:e.value,label:f(x,{children:[o(F,{amount:e.amount.value,currency:e.amount.currency})," ",o("span",{children:e.carrier.title})]}),name:"shipping-method",value:e.value,onChange:()=>r(e)},e.value))})]})]})},X=$(U,Q);function Y(n){const t=N.lastPayload("shipping/estimate");if(!(t!=null&&t.address))return;const r={address:t.address,shippingMethod:P(n)};N.emit("shipping/estimate",r)}function _(n,t){return n.code===t.code&&n.carrier.code===t.carrier.code}function tt({preSelectedMethod:n,onShippingMethodSelect:t}){const r=H.value.data,h=H.value.pending,m=b.value.data,i=b.value.pending,c=L.value,l=r==null?void 0:r.shippingAddresses,e=l==null?void 0:l[0],k=!!e,C=e==null?void 0:e.availableShippingMethods,d=e==null?void 0:e.selectedShippingMethod,s=C||m,W=G(p=>{if(!k)return;const g={method_code:p.code,carrier_code:p.carrier.code};V([g]).catch(j=>{console.error("Setting shipping methods on cart failed:",j)})},[k]),R=p=>{L.value=p,t==null||t(p),k||Y(p)},u=T(()=>{if(!(s!=null&&s.length))return;const p=s[0],g=c||d;return g?s.some(M=>_(M,g))?g:p:s.find(S=>S.carrier.code===(n==null?void 0:n.carrierCode)&&S.code===(n==null?void 0:n.methodCode))||p},[c,d,s,n]);return J(()=>{u&&((!c||!_(u,c))&&(L.value=u,t==null||t(u)),(!d||!_(u,d))&&W(u))},[u,c,d,W,t]),{isLoading:h||i,options:s,selection:u,onSelectionChange:R}}const z=({displayTitle:n=!0,preSelectedMethod:t,shippingMethodsSlot:r,onShippingMethodSelect:h,initialData:m,slots:i,...c})=>{const l=y({Title:"Checkout.ShippingMethods.title"}),{isLoading:e,options:k,selection:C,onSelectionChange:d}=tt({preSelectedMethod:t,onShippingMethodSelect:h}),s=T(()=>{if(n)return o(w,{name:"checkout-shipping-methods-title",slot:i==null?void 0:i.Title,children:o("h3",{children:l.Title})})},[n,i==null?void 0:i.Title,l.Title]);return f(x,{children:[o(X,{...c,initialized:k!==void 0,isLoading:e,options:k??[],selection:C,title:s,onSelectionChange:d}),!e&&r&&o(w,{name:"ShippingMethods",slot:r})]})};z.displayName="ShippingMethodsContainer";const vt=A(z);export{vt as ShippingMethods,vt as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as e,jsxs as
|
|
3
|
+
import{jsx as e,jsxs as S}from"@dropins/tools/preact-jsx-runtime.js";/* empty css */import{Skeleton as b,SkeletonRow as I,Checkbox as z}from"@dropins/tools/components.js";import{p as E}from"../chunks/TermsAndConditions.js";import{classes as p,VComponent as N,Slot as w}from"@dropins/tools/lib.js";/* empty css *//* empty css *//* empty css *//* empty css */import{W}from"../chunks/withSkeleton.js";import{A as j}from"../chunks/checkout.js";import{s as y}from"../chunks/store-config.js";import"../chunks/ShippingEstimateSignal.js";import{events as D}from"@dropins/tools/event-bus.js";import{useState as d,useCallback as f,useEffect as H}from"@dropins/tools/preact-hooks.js";import{useText as P,MarkupText as R}from"@dropins/tools/i18n.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/signals.js";const V=({html:t})=>{const n=E.sanitize(t,{ADD_ATTR:["target"]});return n===""?null:e("span",{dangerouslySetInnerHTML:{__html:n}})},$=()=>e(b,{className:"checkout-terms-and-conditions-skeleton","data-testid":"checkout-terms-and-conditions-skeleton",children:e(I,{fullWidth:!0,size:"small",variant:"row"})}),q=({className:t,agreements:n,error:r,...i})=>e("div",{className:"checkout-terms-and-conditions","data-testid":"checkout-terms-and-conditions",children:S("form",{...i,noValidate:!0,className:p(["checkout-terms-and-conditions__form",t]),"data-testid":"checkout-terms-and-conditions-form",name:"checkout-terms-and-conditions__form",children:[n&&e(N,{className:p(["checkout-terms-and-conditions__agreements"]),"data-testid":"checkout-terms-and-conditions-agreements",node:n}),r&&e("div",{className:"checkout-terms-and-conditions__error","data-testid":"checkout-terms-and-conditions-error",children:r})]})}),L=W(q,$),ae=({slots:t,...n})=>{const[r,i]=d(!0),[k,g]=d(!1),[A,c]=d(""),{errorMessage:m}=P({errorMessage:"Checkout.TermsAndConditions.error"}),_=f(()=>{c("")},[]),C=f(()=>{c(m)},[m]);return H(()=>{const o=D.on("checkout/initialized",()=>{var s;g(!0),i(((s=y.config)==null?void 0:s.isCheckoutAgreementsEnabled)??!0)},{eager:!0});return()=>{o==null||o.off()}},[]),r?e(L,{...n,agreements:e(w,{context:{appendAgreement(o){this._registerMethod((...s)=>{const l=o(...s);if(!l)return;const{mode:T,name:u,text:a,translationId:h}=l;if(!a&&!h){console.warn(`The agreement ${u} is misconfigured. Please provide a text or a translationId.`);return}const x=a?e(V,{html:a}):e(R,{id:h}),v=e(z,{checked:T===j.AUTO,label:x,name:u,required:!0,onChange:_,onInvalid:C});this._setProps(M=>({children:[...M.children||[],v]}))})}},name:"Agreements",slot:t==null?void 0:t.Agreements}),error:A,initialized:k}):null};export{ae as TermsAndConditions,ae as default};
|
package/containers/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export * from './BillToShippingAddress';
|
|
|
18
18
|
export * from './EstimateShipping';
|
|
19
19
|
export * from './LoginForm';
|
|
20
20
|
export * from './MergedCartBanner';
|
|
21
|
+
export * from './Newsletter';
|
|
21
22
|
export * from './OutOfStock';
|
|
22
23
|
export * from './PaymentMethods';
|
|
23
24
|
export * from './PlaceOrder';
|