@dropins/storefront-checkout 1.4.0-beta2 → 2.0.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.
Files changed (80) hide show
  1. package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +1 -1
  2. package/api/index.d.ts +0 -1
  3. package/api/initialize/initialize.d.ts +3 -3
  4. package/api.js +7 -13
  5. package/chunks/ConditionalWrapper.js +1 -1
  6. package/chunks/errors.js +13 -0
  7. package/chunks/setBillingAddress.js +2 -2
  8. package/chunks/setGuestEmailOnCart.js +4 -4
  9. package/chunks/setPaymentMethod.js +2 -2
  10. package/chunks/setShippingMethods.js +2 -2
  11. package/chunks/synchronizeCheckout.js +2 -2
  12. package/chunks/values.js +3 -0
  13. package/components/ConditionalWrapper/ConditionalWrapper.d.ts +2 -2
  14. package/components/PaymentMethods/PaymentMethods.d.ts +2 -2
  15. package/components/ShippingMethods/ShippingMethods.d.ts +2 -2
  16. package/components/index.d.ts +0 -1
  17. package/containers/BillToShippingAddress/BillToShippingAddress.d.ts +3 -1
  18. package/containers/BillToShippingAddress.js +1 -1
  19. package/containers/EstimateShipping/EstimateShipping.d.ts +5 -2
  20. package/containers/EstimateShipping.js +1 -1
  21. package/containers/LoginForm/LoginForm.d.ts +3 -1
  22. package/containers/LoginForm.js +1 -1
  23. package/containers/MergedCartBanner/MergedCartBanner.d.ts +6 -3
  24. package/containers/MergedCartBanner.js +1 -1
  25. package/containers/OutOfStock/OutOfStock.d.ts +2 -1
  26. package/containers/OutOfStock.js +1 -1
  27. package/containers/PaymentMethods/PaymentMethods.d.ts +4 -18
  28. package/containers/PaymentMethods.js +1 -1
  29. package/containers/PlaceOrder/PlaceOrder.d.ts +2 -3
  30. package/containers/PlaceOrder.js +1 -1
  31. package/containers/ServerError/ServerError.d.ts +2 -1
  32. package/containers/ServerError.js +1 -1
  33. package/containers/ShippingMethods/ShippingMethods.d.ts +6 -7
  34. package/containers/ShippingMethods.js +1 -1
  35. package/containers/TermsAndConditions/TermsAndConditions.d.ts +2 -1
  36. package/containers/TermsAndConditions.js +1 -1
  37. package/containers/index.d.ts +0 -1
  38. package/data/models/index.d.ts +1 -1
  39. package/data/models/shipping-estimate.d.ts +4 -0
  40. package/data/models/store-config.d.ts +0 -1
  41. package/data/models/values.d.ts +11 -0
  42. package/data/transforms/transform-cart.d.ts +1 -1
  43. package/data/transforms/transform-shipping-methods.d.ts +1 -1
  44. package/i18n/en_US.json.d.ts +0 -3
  45. package/lib/enqueueRequest.d.ts +1 -1
  46. package/lib/events.d.ts +8 -0
  47. package/lib/index.d.ts +3 -0
  48. package/lib/preact.d.ts +1 -1
  49. package/lib/values.d.ts +17 -0
  50. package/package.json +1 -1
  51. package/render/render.d.ts +1 -1
  52. package/render.js +3 -4
  53. package/signals/ShippingEstimateSignal.d.ts +1 -1
  54. package/signals/index.d.ts +0 -4
  55. package/{api/getCart/fixtures.d.ts → tests/fixtures/cart.d.ts} +2 -2
  56. package/{api/getCustomer/fixtures.d.ts → tests/fixtures/customer.d.ts} +1 -1
  57. package/tests/fixtures/payments.d.ts +8 -0
  58. package/{api/estimateShippingMethods/fixtures.d.ts → tests/fixtures/shipping.d.ts} +1 -1
  59. package/tests/integration/utils/setup.d.ts +1 -1
  60. package/types/TitleProps.d.ts +1 -1
  61. package/__generated__/types.d.ts +0 -12644
  62. package/api/subscribeEmailToNewsletter/graphql/subscribeEmailToNewsletter.graphql.d.ts +0 -18
  63. package/api/subscribeEmailToNewsletter/index.d.ts +0 -18
  64. package/api/subscribeEmailToNewsletter/subscribeEmailToNewsletter.d.ts +0 -4
  65. package/chunks/IsBillToShippingSignal.js +0 -14
  66. package/chunks/SelectedPaymentMethodSignal.js +0 -3
  67. package/chunks/SelectedShippingMethodSignal.js +0 -3
  68. package/chunks/subscription-email-statuses.js +0 -3
  69. package/components/Newsletter/Newsletter.d.ts +0 -7
  70. package/components/Newsletter/NewsletterSkeleton.d.ts +0 -4
  71. package/components/Newsletter/index.d.ts +0 -20
  72. package/containers/Newsletter/Newsletter.d.ts +0 -9
  73. package/containers/Newsletter/index.d.ts +0 -19
  74. package/containers/Newsletter.d.ts +0 -3
  75. package/containers/Newsletter.js +0 -3
  76. package/data/models/subscription-email-statuses.d.ts +0 -24
  77. package/signals/IsBillToShippingSignal.d.ts +0 -18
  78. package/signals/IsSubscribedToNewsletterSignal.d.ts +0 -18
  79. package/signals/SelectedPaymentMethodSignal.d.ts +0 -18
  80. package/signals/SelectedShippingMethodSignal.d.ts +0 -4
@@ -1,18 +0,0 @@
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 declare const subscribeEmailToNewsletterMutation = "\n mutation subscribeEmailToNewsletter($email: String!) {\n subscribeEmailToNewsletter(email: $email) {\n status\n }\n }\n";
18
- //# sourceMappingURL=subscribeEmailToNewsletter.graphql.d.ts.map
@@ -1,18 +0,0 @@
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 * from './subscribeEmailToNewsletter';
18
- //# sourceMappingURL=index.d.ts.map
@@ -1,4 +0,0 @@
1
- import { SubscriptionEmailStatusesEnum } from '../../data/models';
2
-
3
- export declare const subscribeEmailToNewsletter: (email: string) => Promise<SubscriptionEmailStatusesEnum>;
4
- //# sourceMappingURL=subscribeEmailToNewsletter.d.ts.map
@@ -1,14 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- import{T as u}from"./subscription-email-statuses.js";import"@dropins/tools/lib.js";import{events as C}from"@dropins/tools/event-bus.js";import{signal as m,computed as w}from"@dropins/tools/signals.js";import{FetchGraphQL as q}from"@dropins/tools/fetch-graphql.js";var U=(e=>(e.CartUpdate="cartUpdate",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(U||{});const p=new Map,g=new Map,i=m(new Set),y=new Map;y.set("cartUpdate",e=>{C.emit("checkout/updated",e)});async function v(e){g.set(e,!0);const t=p.get(e);let s;for(;t.length>0;){const o=t.shift();try{const a=await o.requestFn();o.resolve(a),s=a}catch(a){o.reject(a)}}g.set(e,!1);const r=new Set(i.value);r.delete(e),i.value=r;const n=y.get(e);n&&s&&n(s)}function A(e,t="default"){p.has(t)||p.set(t,[]);const s=p.get(t),r=new Promise((o,a)=>{s.push({requestFn:e,resolve:o,reject:a})}),n=new Set(i.value);return n.add(t),i.value=n,g.get(t)||v(t),r}const B=w(()=>i.value.has("cartUpdate")),H=w(()=>i.value.has("shippingEstimate")),D=["sender_email","recipient_email"];function T(e){return e.filter(t=>!t.path||!D.some(s=>{var r;return((r=t.path)==null?void 0:r.at(-1))===s}))}const x=e=>{throw e instanceof DOMException&&e.name==="AbortError"||C.emit("error",{source:"checkout",type:"network",error:e}),e};function b(e,t){return t.split(".").reduce((s,r)=>s&&s[r]!==void 0?s[r]:void 0,e)}async function G(e){const{defaultValueOnFail:t,options:s,path:r,query:n,queueName:o,transformer:a,type:d}=e;try{const l=async()=>{const{data:S,errors:E}=await k(n,{method:d==="query"?"GET":"POST",cache:d==="query"?"no-cache":void 0,...s}).catch(x);if(E){const _=T(E);if(_.length>0)throw new L(_)}let h=b(S,r);if(h===void 0)throw new Error(`No data found at path: ${r}`);return a?a(h):h};return d==="mutation"?await A(l,o):await l()}catch(l){if(t!==void 0)return t;throw l}}const F=`
4
- query getStoreConfig {
5
- storeConfig {
6
- default_country
7
- is_checkout_agreements_enabled
8
- is_guest_checkout_enabled
9
- is_one_page_checkout_enabled
10
- newsletter_enabled
11
- shopping_cart_display_shipping
12
- }
13
- }
14
- `,I="US",f={defaultCountry:I,agreementsEnabled:!0,newsletterEnabled:!0,shoppingCartDisplaySetting:{shipping:u.EXCLUDING_TAX}},V=async()=>await G({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:F,transformer:N,type:"query"});function M(e){switch(e){case 1:return u.EXCLUDING_TAX;case 2:return u.INCLUDING_TAX;case 3:return u.INCLUDING_EXCLUDING_TAX;default:return u.EXCLUDING_TAX}}function N(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:s,newsletter_enabled:r,shopping_cart_display_shipping:n}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:s,newsletterEnabled:r,shoppingCartDisplaySetting:{shipping:M(n)}}}const Y=m(),{setEndpoint:$,setFetchGraphQlHeader:z,removeFetchGraphQlHeader:J,setFetchGraphQlHeaders:K,fetchGraphQl:k,getConfig:W}=new q().getMethods();class L extends Error{constructor(t){super(t.map(s=>s.message).join(" ")),this.name="FetchError"}}class c extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class Z extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class ee extends c{constructor(){super("Cart ID is required")}}class te extends c{constructor(){super("Email is required")}}class se extends c{constructor(){super("Payment method code is required")}}class re extends c{constructor(){super("Shipping address is required")}}class ne extends c{constructor(){super("Billing address is required")}}class ae extends c{constructor(){super("Country Code is required")}}const oe=m(!0);export{I as D,L as F,c as I,ee as M,U as Q,f as S,Z as U,H as a,ae as b,re as c,G as d,te as e,$ as f,z as g,B as h,oe as i,K as j,k,W as l,V as m,se as n,ne as o,J as r,Y as s};
@@ -1,3 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- import{signal as e}from"@dropins/tools/signals.js";const t=e(!1),a=e();export{t as i,a as s};
@@ -1,3 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- import{signal as i}from"@dropins/tools/signals.js";const e=i(void 0);export{e as s};
@@ -1,3 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- const I={authenticated:!1,cartId:null,initialized:!1,config:null},d=new Proxy(I,{set(e,N,U){return e[N]=U,!0},get(e,N){return e[N]}}),A=()=>d.config;var C=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(C||{}),r=(e=>(e.NotActive="NOT_ACTIVE",e.Subscribed="SUBSCRIBED",e.Unconfirmed="UNCONFIRMED",e.Unsubscribed="UNSUBSCRIBED",e))(r||{}),c=(e=>(e[e.NotActive=r.NotActive]="NotActive",e[e.Subscribed=r.Subscribed]="Subscribed",e[e.Unconfirmed=r.Unconfirmed]="Unconfirmed",e[e.Unsubscribed=r.Unsubscribed]="Unsubscribed",e.Error="ERROR",e))(c||{});export{c as S,C as T,A as g,d as s};
@@ -1,7 +0,0 @@
1
- import { FunctionComponent } from 'preact';
2
- import { HTMLAttributes } from 'preact/compat';
3
-
4
- export interface NewsletterProps extends HTMLAttributes<HTMLInputElement> {
5
- }
6
- export declare const Newsletter: FunctionComponent<NewsletterProps & import('../ConditionalWrapper').ConditionalProps>;
7
- //# sourceMappingURL=Newsletter.d.ts.map
@@ -1,4 +0,0 @@
1
- import { FunctionComponent } from 'preact';
2
-
3
- export declare const NewsletterSkeleton: FunctionComponent;
4
- //# sourceMappingURL=NewsletterSkeleton.d.ts.map
@@ -1,20 +0,0 @@
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 * from './Newsletter';
18
- export * from './NewsletterSkeleton';
19
- export { Newsletter as default } from './Newsletter';
20
- //# sourceMappingURL=index.d.ts.map
@@ -1,9 +0,0 @@
1
- import { Container } from '../../../@adobe-commerce/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,19 +0,0 @@
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 * from './Newsletter';
18
- export { Newsletter as default } from './Newsletter';
19
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +0,0 @@
1
- export * from './Newsletter/index'
2
- import _default from './Newsletter/index'
3
- export default _default
@@ -1,3 +0,0 @@
1
- /*! Copyright 2025 Adobe
2
- All Rights Reserved. */
3
- import{jsx as l}from"@dropins/tools/preact-jsx-runtime.js";import{W as S}from"../chunks/ConditionalWrapper.js";/* empty css */import{Skeleton as g,SkeletonRow as V,Checkbox as z}from"@dropins/tools/components.js";import{c as I}from"../chunks/classes.js";import{useText as _}from"@dropins/tools/i18n.js";import{s as C}from"../chunks/subscription-email-statuses.js";import"@dropins/tools/lib.js";import"../chunks/IsBillToShippingSignal.js";import{events as f}from"@dropins/tools/event-bus.js";import{i as r}from"../chunks/SelectedPaymentMethodSignal.js";import"../chunks/SelectedShippingMethodSignal.js";import"../chunks/ServerErrorSignal.js";import{useState as m,useCallback as E,useEffect as n}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/signals.js";import"@dropins/tools/fetch-graphql.js";const T=()=>l(g,{className:"checkout-newsletter-skeleton","data-testid":"checkout-newsletter-skeleton",children:l(V,{size:"small",variant:"row"})}),y=({className:c,checked:i,onChange:o})=>{const u=_({title:"Checkout.Newsletter.title"});return l("div",{className:"checkout-newsletter","data-testid":"checkout-newsletter",children:l(z,{checked:i,className:I(["checkout-newsletter__checkbox",c]),"data-testid":"checkout-newsletter-checkbox",label:u.title,name:"checkout-newsletter__checkbox",onChange:o})})},W=S(y,T),Y=({defaultChecked:c=!1,onChange:i,showForAuthenticatedUsers:o=!1})=>{var p;const[u,b]=m(!0),[h,w]=m(!1),[N,v]=m(!1),d=r.value,s=((p=C.config)==null?void 0:p.newsletterEnabled)===!1,k=!o&&h,x=async e=>{const t=e.target.checked;r.value=t,i==null||i(t)},a=E(e=>{const t=!!e&&!e.isEmpty;if(b(t),!t){r.value=!1;return}},[]);return n(()=>{if(s)return;const e=f.on("authenticated",t=>{w(t),t&&!o&&(r.value=!1)},{eager:!0});return()=>{e==null||e.off()}},[s,o]),n(()=>{if(s)return;const e=f.on("checkout/initialized",t=>{v(!0),a(t)},{eager:!0});return()=>{e==null||e.off()}},[s,a]),n(()=>{if(s)return;const e=f.on("checkout/updated",a,{eager:!1});return()=>{e==null||e.off()}},[s,a]),n(()=>{c&&!d&&(r.value=c)},[]),(s||k)&&(r.value=!1),l(W,{checked:d,isInitialized:N,isVisible:u&&!s&&!k,onChange:x})};export{Y as Newsletter,Y as default};
@@ -1,24 +0,0 @@
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 declare enum SubscriptionEmailStatusesEnum {
18
- NotActive = 0,
19
- Subscribed = 0,
20
- Unconfirmed = 0,
21
- Unsubscribed = 0,
22
- Error = "ERROR"
23
- }
24
- //# sourceMappingURL=subscription-email-statuses.d.ts.map
@@ -1,18 +0,0 @@
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 declare const isBillToShippingSignal: import('@preact/signals-core').Signal<boolean>;
18
- //# sourceMappingURL=IsBillToShippingSignal.d.ts.map
@@ -1,18 +0,0 @@
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 declare const isSubscribedToNewsletterSignal: import('@preact/signals-core').Signal<boolean>;
18
- //# sourceMappingURL=IsSubscribedToNewsletterSignal.d.ts.map
@@ -1,18 +0,0 @@
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 declare const selectedPaymentMethodSignal: import('@preact/signals-core').Signal<string | undefined>;
18
- //# sourceMappingURL=SelectedPaymentMethodSignal.d.ts.map
@@ -1,4 +0,0 @@
1
- import { ShippingMethod } from '../data/models';
2
-
3
- export declare const selectedShippingMethodSignal: import('@preact/signals-core').Signal<ShippingMethod | undefined>;
4
- //# sourceMappingURL=SelectedShippingMethodSignal.d.ts.map