@dropins/storefront-checkout 2.0.1 → 2.1.0-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fragments.d.ts +4 -1
- package/api/getCompanyCredit/getCompanyCredit.d.ts +4 -0
- package/api/getCompanyCredit/graphql/getCompanyCredit.graphql.d.ts +18 -0
- package/api/getCompanyCredit/graphql/index.d.ts +18 -0
- package/{errors → api/getCompanyCredit}/index.d.ts +1 -1
- package/api/getNegotiableQuote/getNegotiableQuote.d.ts +22 -0
- package/api/getNegotiableQuote/graphql/getNegotiableQuote.graphql.d.ts +18 -0
- package/api/getNegotiableQuote/graphql/index.d.ts +18 -0
- package/{signals → api/getNegotiableQuote}/index.d.ts +2 -2
- package/api/getStoreConfig/getStoreConfig.d.ts +1 -0
- package/api/graphql/CartAddressFragment.graphql.d.ts +2 -2
- package/api/graphql/NegotiableQuoteAddressFragment.graphql.d.ts +19 -0
- package/api/graphql/NegotiableQuoteFragment.graphql.d.ts +18 -0
- package/api/graphql/{CartPaymentMethodFragment.graphql.d.ts → PaymentMethodFragment.graphql.d.ts} +2 -2
- package/api/graphql/ShippingMethodFragment.graphql.d.ts +19 -0
- package/api/index.d.ts +2 -2
- package/api/initialize/initialize.d.ts +21 -3
- package/api/initialize/listeners.d.ts +3 -17
- package/api/initializeCheckout/initializeCheckout.d.ts +2 -2
- package/api/setBillingAddress/graphql/index.d.ts +19 -0
- package/api/{setPaymentMethod/graphql/setPaymentMethod.graphql.d.ts → setBillingAddress/graphql/setBillingAddressOnCartMutation.graphql.d.ts} +2 -2
- package/api/setBillingAddress/graphql/setBillingAddressOnQuoteMutation.graphql.d.ts +18 -0
- package/api/setBillingAddress/setBillingAddress.d.ts +2 -2
- package/api/setPaymentMethod/graphql/index.d.ts +19 -0
- package/api/{setBillingAddress/graphql/setBillingAddress.graphql.d.ts → setPaymentMethod/graphql/setPaymentMethodOnCart.graphql.d.ts} +2 -2
- package/api/setPaymentMethod/graphql/setPaymentMethodOnQuote.graphql.d.ts +18 -0
- package/api/setPaymentMethod/setPaymentMethod.d.ts +2 -2
- package/api/setShippingAddress/graphql/index.d.ts +21 -0
- package/api/setShippingAddress/graphql/{setShippingAddressAndUseAsBilling.graphql.d.ts → setShippingAddressOnCartAndUseAsBillingMutation.graphql.d.ts} +2 -2
- package/api/setShippingAddress/graphql/{setShippingAddress.graphql.d.ts → setShippingAddressOnCartMutation.graphql.d.ts} +2 -2
- package/api/setShippingAddress/graphql/setShippingAddressOnQuote.graphql.d.ts +18 -0
- package/api/setShippingAddress/graphql/setShippingAddressOnQuoteAndUseAsBillingMutation.graphql.d.ts +18 -0
- package/api/setShippingAddress/setShippingAddress.d.ts +1 -1
- package/api/setShippingMethods/graphql/index.d.ts +19 -0
- package/api/setShippingMethods/graphql/setShippingMethodsOnCart.graphql.d.ts +1 -1
- package/api/setShippingMethods/graphql/setShippingMethodsOnQuote.graphql.d.ts +18 -0
- package/api/setShippingMethods/index.d.ts +1 -0
- package/api/setShippingMethods/setShippingMethods.d.ts +3 -17
- package/api/synchronizeCheckout/synchronizeCheckout.d.ts +2 -2
- package/api.js +2 -66
- package/api.js.map +1 -1
- package/chunks/ConditionalWrapper.js +1 -1
- package/chunks/ConditionalWrapper.js.map +1 -1
- package/chunks/PaymentOnAccount2.js +4 -0
- package/chunks/PaymentOnAccount2.js.map +1 -0
- package/chunks/PurchaseOrder.js +4 -0
- package/chunks/PurchaseOrder.js.map +1 -0
- package/chunks/checkout.js.map +1 -1
- package/chunks/classifiers.js +4 -0
- package/chunks/classifiers.js.map +1 -0
- package/chunks/dom.js.map +1 -1
- package/chunks/events.js +4 -0
- package/chunks/events.js.map +1 -0
- package/chunks/events2.js +4 -0
- package/chunks/events2.js.map +1 -0
- package/chunks/fetch-graphql.js +14 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/getCompanyCredit.js +15 -0
- package/chunks/getCompanyCredit.js.map +1 -0
- package/chunks/guards.js +4 -0
- package/chunks/guards.js.map +1 -0
- package/chunks/render.js +10 -0
- package/chunks/render.js.map +1 -0
- package/chunks/setBillingAddress.js +25 -5
- package/chunks/setBillingAddress.js.map +1 -1
- package/chunks/setGuestEmailOnCart.js +3 -3
- package/chunks/setGuestEmailOnCart.js.map +1 -1
- package/chunks/setPaymentMethod.js +21 -6
- package/chunks/setPaymentMethod.js.map +1 -1
- package/chunks/setShippingAddress.js +109 -0
- package/chunks/setShippingAddress.js.map +1 -0
- package/chunks/setShippingMethods.js +19 -4
- package/chunks/setShippingMethods.js.map +1 -1
- package/chunks/synchronizeCheckout.js +13 -5
- package/chunks/synchronizeCheckout.js.map +1 -1
- package/chunks/transform-shipping-estimate.js +4 -0
- package/chunks/transform-shipping-estimate.js.map +1 -0
- package/chunks/transform-shipping-methods.js +4 -0
- package/chunks/transform-shipping-methods.js.map +1 -0
- package/chunks/values.js +1 -1
- package/chunks/values.js.map +1 -1
- package/components/AddressValidation/AddressValidation.d.ts +14 -0
- package/components/AddressValidation/index.d.ts +19 -0
- package/components/PaymentMethods/PaymentMethods.d.ts +1 -1
- package/components/PaymentOnAccount/PaymentOnAccount.d.ts +17 -0
- package/components/PaymentOnAccount/PaymentOnAccountSkeleton.d.ts +4 -0
- package/components/PaymentOnAccount/index.d.ts +20 -0
- package/components/PurchaseOrder/PurchaseOrder.d.ts +10 -0
- package/components/PurchaseOrder/index.d.ts +19 -0
- package/components/ShippingMethods/ShippingMethods.d.ts +1 -1
- package/components/index.d.ts +4 -1
- package/containers/AddressValidation/AddressValidation.d.ts +12 -0
- package/containers/AddressValidation/index.d.ts +19 -0
- package/containers/AddressValidation.d.ts +3 -0
- package/containers/AddressValidation.js +4 -0
- package/containers/AddressValidation.js.map +1 -0
- package/containers/BillToShippingAddress.js +1 -1
- package/containers/BillToShippingAddress.js.map +1 -1
- package/containers/EstimateShipping.js +1 -1
- package/containers/EstimateShipping.js.map +1 -1
- package/containers/LoginForm/LoginForm.d.ts +1 -1
- package/containers/LoginForm.js +1 -1
- package/containers/LoginForm.js.map +1 -1
- package/containers/MergedCartBanner.js +1 -1
- package/containers/MergedCartBanner.js.map +1 -1
- package/containers/OutOfStock.js +1 -1
- package/containers/OutOfStock.js.map +1 -1
- package/containers/PaymentMethods/PaymentMethods.d.ts +9 -8
- package/containers/PaymentMethods/handlers.d.ts +11 -0
- package/containers/PaymentMethods.js +1 -1
- package/containers/PaymentMethods.js.map +1 -1
- package/containers/PaymentOnAccount/PaymentOnAccount.d.ts +10 -0
- package/containers/PaymentOnAccount/index.d.ts +11 -0
- package/containers/PaymentOnAccount.d.ts +3 -0
- package/containers/PaymentOnAccount.js +4 -0
- package/containers/PaymentOnAccount.js.map +1 -0
- package/containers/PlaceOrder/PlaceOrder.d.ts +2 -1
- package/containers/PlaceOrder.js +1 -1
- package/containers/PlaceOrder.js.map +1 -1
- package/containers/PurchaseOrder/PurchaseOrder.d.ts +10 -0
- package/containers/PurchaseOrder/index.d.ts +19 -0
- package/containers/PurchaseOrder.d.ts +3 -0
- package/containers/PurchaseOrder.js +4 -0
- package/containers/PurchaseOrder.js.map +1 -0
- package/containers/ServerError/ServerError.d.ts +2 -1
- package/containers/ServerError.js +1 -1
- package/containers/ServerError.js.map +1 -1
- package/containers/ShippingMethods/ShippingMethods.d.ts +2 -2
- package/containers/ShippingMethods.js +1 -1
- package/containers/ShippingMethods.js.map +1 -1
- package/containers/TermsAndConditions.js +1 -1
- package/containers/TermsAndConditions.js.map +1 -1
- package/containers/index.d.ts +3 -0
- package/data/models/address.d.ts +11 -6
- package/data/models/api.d.ts +23 -10
- package/data/models/cart.d.ts +7 -7
- package/data/models/checkout.d.ts +14 -0
- package/data/models/company-credit.d.ts +7 -0
- package/data/models/country.d.ts +1 -1
- package/data/models/index.d.ts +3 -1
- package/data/models/{price.d.ts → money.d.ts} +2 -2
- package/data/models/payment-method.d.ts +2 -0
- package/data/models/quote.d.ts +16 -0
- package/data/models/shipping-estimate.d.ts +4 -4
- package/data/models/shipping-method.d.ts +4 -4
- package/data/models/values.d.ts +1 -1
- package/data/transforms/index.d.ts +9 -1
- package/data/transforms/transform-api.d.ts +12 -0
- package/data/transforms/{transform-address.d.ts → transform-cart-address.d.ts} +41 -43
- package/data/transforms/transform-cart.d.ts +1 -1
- package/data/transforms/transform-company-credit.d.ts +7 -0
- package/data/transforms/transform-country.d.ts +8 -0
- package/data/transforms/transform-custom-attributes.d.ts +5 -0
- package/data/transforms/transform-negotiable-quote.d.ts +7 -0
- package/data/transforms/transform-payment-methods.d.ts +1 -1
- package/data/transforms/transform-quote-address.d.ts +90 -0
- package/data/transforms/transform-region.d.ts +8 -0
- package/fragments.js +180 -70
- package/fragments.js.map +1 -1
- package/i18n/en_US.json.d.ts +26 -0
- package/lib/enqueueRequest.d.ts +2 -2
- package/lib/errors/classifiers.d.ts +38 -0
- package/lib/errors/customErrors.d.ts +42 -0
- package/lib/errors/index.d.ts +20 -0
- package/lib/errors/mapErrorToCode.d.ts +4 -0
- package/lib/events.d.ts +3 -2
- package/lib/guards.d.ts +18 -0
- package/lib/index.d.ts +2 -2
- package/lib/state.d.ts +5 -3
- package/lib/utils/api.d.ts +16 -0
- package/lib/utils/events.d.ts +10 -0
- package/lib/utils/forms.d.ts +5 -0
- package/lib/utils/fragments.d.ts +19 -0
- package/lib/utils/index.d.ts +24 -0
- package/lib/utils/meta.d.ts +19 -0
- package/lib/utils/transformers.d.ts +6 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +4 -0
- package/lib/utils.js.map +1 -0
- package/package.json +1 -1
- package/render.js +4 -4
- package/render.js.map +1 -1
- package/tests/constants.d.ts +1 -0
- package/tests/fixtures/fragments/cart.d.ts +47 -42
- package/tests/fixtures/fragments/shipping-address.d.ts +2 -1
- package/tests/fixtures/helpers/session-storage.d.ts +68 -0
- package/tests/fixtures/index.d.ts +1 -0
- package/tests/fixtures/models/index.d.ts +1 -1
- package/tests/fixtures/models/quote.d.ts +9 -0
- package/tests/fixtures/queries/get-company-credit.d.ts +14 -0
- package/tests/fixtures/queries/index.d.ts +1 -0
- package/types/api.d.ts +6 -0
- package/types/{TitleProps.d.ts → components.d.ts} +2 -1
- package/types/guards.d.ts +5 -0
- package/types/index.d.ts +22 -0
- package/types/storefront.d.ts +165 -0
- package/types/utils.d.ts +19 -0
- package/chunks/ServerErrorSignal.js +0 -4
- package/chunks/ServerErrorSignal.js.map +0 -1
- package/chunks/errors.js +0 -14
- package/chunks/errors.js.map +0 -1
- package/errors/errors.d.ts +0 -30
- package/lib/network-error.d.ts +0 -22
- package/signals/ServerErrorSignal.d.ts +0 -18
- package/types/ComponentTypes.d.ts +0 -18
- /package/lib/{dom.d.ts → utils/dom.d.ts} +0 -0
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export declare const shippingAddressFixture: {
|
|
18
|
+
uid: string;
|
|
18
19
|
firstname: string;
|
|
19
20
|
lastname: string;
|
|
20
21
|
company: null;
|
|
@@ -33,7 +34,7 @@ export declare const shippingAddressFixture: {
|
|
|
33
34
|
label: string;
|
|
34
35
|
};
|
|
35
36
|
telephone: string;
|
|
36
|
-
custom_attributes:
|
|
37
|
+
custom_attributes: never[];
|
|
37
38
|
available_shipping_methods: {
|
|
38
39
|
amount: {
|
|
39
40
|
currency: import('../../../__generated__/types').CurrencyEnum;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 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
|
+
/**
|
|
18
|
+
* Fixture flag keys used in sessionStorage for test scenarios
|
|
19
|
+
*/
|
|
20
|
+
export declare const FIXTURE_FLAGS: {
|
|
21
|
+
readonly USE_EXCEED_LIMIT_FIXTURE: "useExceedLimitFixture";
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Helper functions to manage fixture flags in sessionStorage
|
|
25
|
+
* These functions safely check for window availability for SSR compatibility
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Sets a fixture flag in sessionStorage
|
|
29
|
+
* @param flag - The fixture flag key
|
|
30
|
+
* @param value - The value to set (defaults to 'true')
|
|
31
|
+
*/
|
|
32
|
+
export declare function setFixtureFlag(flag: string, value?: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Removes a fixture flag from sessionStorage
|
|
35
|
+
* @param flag - The fixture flag key
|
|
36
|
+
*/
|
|
37
|
+
export declare function removeFixtureFlag(flag: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Gets a fixture flag value from sessionStorage
|
|
40
|
+
* @param flag - The fixture flag key
|
|
41
|
+
* @returns The flag value or null if not set
|
|
42
|
+
*/
|
|
43
|
+
export declare function getFixtureFlag(flag: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if a fixture flag is set to 'true' in sessionStorage
|
|
46
|
+
* @param flag - The fixture flag key
|
|
47
|
+
* @returns True if the flag is set to 'true', false otherwise
|
|
48
|
+
*/
|
|
49
|
+
export declare function isFixtureFlagSet(flag: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Specific helper for the useExceedLimitFixture flag
|
|
52
|
+
*/
|
|
53
|
+
export declare const exceedLimitFixture: {
|
|
54
|
+
/**
|
|
55
|
+
* Enables the exceed limit fixture (sets useExceedLimitFixture to 'true')
|
|
56
|
+
*/
|
|
57
|
+
readonly enable: () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Disables the exceed limit fixture (removes useExceedLimitFixture from sessionStorage)
|
|
60
|
+
*/
|
|
61
|
+
readonly disable: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Checks if the exceed limit fixture is enabled
|
|
64
|
+
* @returns True if useExceedLimitFixture is set to 'true'
|
|
65
|
+
*/
|
|
66
|
+
readonly isEnabled: () => boolean;
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=session-storage.d.ts.map
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export * from './fragments/index';
|
|
18
|
+
export * from './helpers/session-storage';
|
|
18
19
|
export * from './models/index';
|
|
19
20
|
export * from './mutations/index';
|
|
20
21
|
export * from './queries/index';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export * from './cart';
|
|
18
|
-
export * from './customer';
|
|
19
18
|
export * from './payments';
|
|
19
|
+
export * from './quote';
|
|
20
20
|
export * from './shipping';
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NegotiableQuote } from '../../../data/models/quote';
|
|
2
|
+
import { ShippingMethod } from '../../../data/models/shipping-method';
|
|
3
|
+
|
|
4
|
+
export declare const simpleQuote: NegotiableQuote;
|
|
5
|
+
export declare const quoteWithShippingInfo: ({ methods, selection, }?: {
|
|
6
|
+
methods?: ShippingMethod[] | undefined;
|
|
7
|
+
selection?: ShippingMethod | undefined;
|
|
8
|
+
}) => NegotiableQuote;
|
|
9
|
+
//# sourceMappingURL=quote.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GetCompanyCreditQuery } from '../../../__generated__/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Standard company credit fixture with $1000 available credit
|
|
5
|
+
* Use this for normal scenarios where credit limit is not exceeded
|
|
6
|
+
*/
|
|
7
|
+
export declare const getCompanyCreditFixture: GetCompanyCreditQuery;
|
|
8
|
+
/**
|
|
9
|
+
* Company credit fixture with $500 available credit
|
|
10
|
+
* Use this for scenarios where credit limit is exceeded (when cart amount > $500)
|
|
11
|
+
* The MSW handler will use this fixture when sessionStorage has 'useExceedLimitFixture' set to 'true'
|
|
12
|
+
*/
|
|
13
|
+
export declare const getCompanyCreditExceedLimitFixture: GetCompanyCreditQuery;
|
|
14
|
+
//# sourceMappingURL=get-company-credit.d.ts.map
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export * from './get-cart';
|
|
18
|
+
export * from './get-company-credit';
|
|
18
19
|
export * from './get-customer';
|
|
19
20
|
export * from './get-store-config';
|
|
20
21
|
export * from './is-email-available';
|
package/types/api.d.ts
ADDED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
|
|
2
2
|
|
|
3
|
+
export type UIComponentType = 'ToggleButton' | 'RadioButton';
|
|
3
4
|
export interface TitleProps {
|
|
4
5
|
displayTitle?: boolean;
|
|
5
6
|
slots?: {
|
|
6
7
|
Title?: SlotProps;
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=components.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CartModel, InitializeInput, NegotiableQuoteModel, SynchronizeInput } from '.';
|
|
2
|
+
|
|
3
|
+
export declare const isCartInput: (input: NonNullable<InitializeInput | SynchronizeInput>) => input is CartModel;
|
|
4
|
+
export declare const isNegotiableQuoteInput: (input: NonNullable<InitializeInput | SynchronizeInput>) => input is NegotiableQuoteModel;
|
|
5
|
+
//# sourceMappingURL=guards.d.ts.map
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 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 type { InitializeInput, Nullable, SynchronizeInput } from './api';
|
|
18
|
+
export type { TitleProps, UIComponentType } from './components';
|
|
19
|
+
export * from './guards';
|
|
20
|
+
export type { CartModel, FormRef, Item, NegotiableQuoteModel, RenderAPI, } from './storefront';
|
|
21
|
+
export type { Filter, Selector } from './utils';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 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 type RenderAPI = {
|
|
18
|
+
remove: () => void;
|
|
19
|
+
setProps: (cb: (prev: any) => any) => void;
|
|
20
|
+
};
|
|
21
|
+
export type FormRef = {
|
|
22
|
+
handleValidationSubmit: (disableShowError: boolean) => boolean;
|
|
23
|
+
isDataValid: boolean;
|
|
24
|
+
};
|
|
25
|
+
export interface CartModel {
|
|
26
|
+
id: string;
|
|
27
|
+
totalQuantity: number;
|
|
28
|
+
errors?: ItemError[];
|
|
29
|
+
items: Item[];
|
|
30
|
+
miniCartMaxItems: Item[];
|
|
31
|
+
total: {
|
|
32
|
+
includingTax: Price;
|
|
33
|
+
excludingTax: Price;
|
|
34
|
+
};
|
|
35
|
+
discount?: Price;
|
|
36
|
+
subtotal: {
|
|
37
|
+
excludingTax: Price;
|
|
38
|
+
includingTax: Price;
|
|
39
|
+
includingDiscountOnly: Price;
|
|
40
|
+
};
|
|
41
|
+
appliedTaxes: TotalPriceModifier[];
|
|
42
|
+
totalTax?: Price;
|
|
43
|
+
appliedDiscounts: TotalPriceModifier[];
|
|
44
|
+
shipping?: Price;
|
|
45
|
+
isVirtual?: boolean;
|
|
46
|
+
addresses: {
|
|
47
|
+
shipping?: {
|
|
48
|
+
countryCode: string;
|
|
49
|
+
zipCode?: string;
|
|
50
|
+
regionCode?: string;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
53
|
+
isGuestCart?: boolean;
|
|
54
|
+
}
|
|
55
|
+
interface TotalPriceModifier {
|
|
56
|
+
amount: Price;
|
|
57
|
+
label: string;
|
|
58
|
+
}
|
|
59
|
+
export interface Item {
|
|
60
|
+
taxedPrice: Price;
|
|
61
|
+
rowTotal: Price;
|
|
62
|
+
rowTotalIncludingTax: Price;
|
|
63
|
+
itemType: string;
|
|
64
|
+
uid: string;
|
|
65
|
+
url: ItemURL;
|
|
66
|
+
quantity: number;
|
|
67
|
+
sku: string;
|
|
68
|
+
name: string;
|
|
69
|
+
image: ItemImage;
|
|
70
|
+
links?: ItemLinks;
|
|
71
|
+
price: Price;
|
|
72
|
+
total: Price;
|
|
73
|
+
discountedTotal?: Price;
|
|
74
|
+
discount?: Price;
|
|
75
|
+
regularPrice: Price;
|
|
76
|
+
discounted: boolean;
|
|
77
|
+
bundleOptions?: {
|
|
78
|
+
[key: string]: any;
|
|
79
|
+
};
|
|
80
|
+
selectedOptions?: {
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
};
|
|
83
|
+
customizableOptions?: {
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
};
|
|
86
|
+
message?: string;
|
|
87
|
+
recipient?: string;
|
|
88
|
+
recipientEmail?: string;
|
|
89
|
+
sender?: string;
|
|
90
|
+
senderEmail?: string;
|
|
91
|
+
lowInventory?: boolean;
|
|
92
|
+
insufficientQuantity?: boolean;
|
|
93
|
+
onlyXLeftInStock?: number | null;
|
|
94
|
+
outOfStock?: boolean;
|
|
95
|
+
notAvailableMessage?: string;
|
|
96
|
+
stockLevel?: string;
|
|
97
|
+
}
|
|
98
|
+
interface ItemError {
|
|
99
|
+
id: string;
|
|
100
|
+
text: string;
|
|
101
|
+
}
|
|
102
|
+
interface ItemImage {
|
|
103
|
+
src: string;
|
|
104
|
+
alt: string;
|
|
105
|
+
}
|
|
106
|
+
interface Price {
|
|
107
|
+
value: number;
|
|
108
|
+
currency: string;
|
|
109
|
+
}
|
|
110
|
+
interface ItemURL {
|
|
111
|
+
urlKey: string;
|
|
112
|
+
categories: string[];
|
|
113
|
+
}
|
|
114
|
+
interface ItemLinks {
|
|
115
|
+
count: number;
|
|
116
|
+
result: string;
|
|
117
|
+
}
|
|
118
|
+
export interface NegotiableQuoteModel {
|
|
119
|
+
uid: string;
|
|
120
|
+
createdAt: string;
|
|
121
|
+
status: string;
|
|
122
|
+
buyer: {
|
|
123
|
+
firstname: string;
|
|
124
|
+
lastname: string;
|
|
125
|
+
};
|
|
126
|
+
comments: {
|
|
127
|
+
uid: string;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
author: {
|
|
130
|
+
firstname: string;
|
|
131
|
+
lastname: string;
|
|
132
|
+
};
|
|
133
|
+
}[];
|
|
134
|
+
items: {
|
|
135
|
+
product: {
|
|
136
|
+
uid: string;
|
|
137
|
+
sku: string;
|
|
138
|
+
name: string;
|
|
139
|
+
priceRange: {
|
|
140
|
+
maximumPrice: {
|
|
141
|
+
regularPrice: {
|
|
142
|
+
value: number;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
quantity: number;
|
|
148
|
+
prices: {
|
|
149
|
+
subtotalExcludingTax: {
|
|
150
|
+
value: number;
|
|
151
|
+
};
|
|
152
|
+
subtotalIncludingTax: {
|
|
153
|
+
value: number;
|
|
154
|
+
};
|
|
155
|
+
subtotalWithDiscountExcludingTax: {
|
|
156
|
+
value: number;
|
|
157
|
+
};
|
|
158
|
+
grandTotal: {
|
|
159
|
+
value: number;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
}[];
|
|
163
|
+
}
|
|
164
|
+
export {};
|
|
165
|
+
//# sourceMappingURL=storefront.d.ts.map
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 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 type Selector<T> = (options: Array<T>) => T | null;
|
|
18
|
+
export type Filter<T> = (option: T) => boolean;
|
|
19
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ServerErrorSignal.js","sources":["/@dropins/storefront-checkout/src/signals/ServerErrorSignal.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { signal } from '@adobe-commerce/elsie/lib/signals';\n\nexport const serverErrorSignal = signal<string | undefined>();\n"],"names":["serverErrorSignal","signal"],"mappings":"mDAmBO,MAAMA,EAAoBC,EAA2B"}
|
package/chunks/errors.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2025 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import"@dropins/tools/lib.js";import{events as m}from"@dropins/tools/event-bus.js";import{signal as y,computed as E}from"@dropins/tools/signals.js";import{FetchGraphQL as w}from"@dropins/tools/fetch-graphql.js";const A={authenticated:!1,cartId:null,initialized:!1,config:null},N=new Proxy(A,{set(e,t,r){return e[t]=r,!0},get(e,t){return e[t]}}),V=()=>N.config;var i=(e=>(e.EXCLUDING_TAX="EXCLUDING_TAX",e.INCLUDING_EXCLUDING_TAX="INCLUDING_AND_EXCLUDING_TAX",e.INCLUDING_TAX="INCLUDING_TAX",e))(i||{}),D=(e=>(e.CartUpdate="cartUpdate",e.Default="default",e.ShippingEstimate="shippingEstimate",e))(D||{});const d=new Map,g=new Map,c=y(new Set),I=new Map;I.set("cartUpdate",e=>{m.emit("checkout/updated",e)});async function G(e){g.set(e,!0);const t=d.get(e);let r;for(;t.length>0;){const o=t.shift();try{const n=await o.requestFn();o.resolve(n),r=n}catch(n){o.reject(n)}}g.set(e,!1);const s=new Set(c.value);s.delete(e),c.value=s;const a=I.get(e);a&&r&&a(r)}function S(e,t="default"){d.has(t)||d.set(t,[]);const r=d.get(t),s=new Promise((o,n)=>{r.push({requestFn:e,resolve:o,reject:n})}),a=new Set(c.value);return a.add(t),c.value=a,g.get(t)||G(t),s}const B=E(()=>c.value.has("cartUpdate")),z=E(()=>c.value.has("shippingEstimate")),q=["sender_email","recipient_email"];function X(e){return e.filter(t=>!t.path||!q.some(r=>{var s;return((s=t.path)==null?void 0:s.at(-1))===r}))}const v=e=>{throw e instanceof DOMException&&e.name==="AbortError"||m.emit("error",{source:"checkout",type:"network",error:e}),e};function T(e,t){return t.split(".").reduce((r,s)=>r&&r[s]!==void 0?r[s]:void 0,e)}async function L(e){const{defaultValueOnFail:t,options:r,path:s,query:a,queueName:o,transformer:n,type:p}=e;try{const l=async()=>{const{data:U,errors:_}=await k(a,{method:p==="query"?"GET":"POST",cache:p==="query"?"no-cache":void 0,...r}).catch(v);if(_){const C=X(_);if(C.length>0)throw new P(C)}let h=T(U,s);if(h===void 0)throw new Error(`No data found at path: ${s}`);return n?n(h):h};return p==="mutation"?await S(l,o):await l()}catch(l){if(t!==void 0)return t;throw l}}const x=`
|
|
4
|
-
query getStoreConfig {
|
|
5
|
-
storeConfig {
|
|
6
|
-
default_country
|
|
7
|
-
is_checkout_agreements_enabled
|
|
8
|
-
is_guest_checkout_enabled
|
|
9
|
-
is_one_page_checkout_enabled
|
|
10
|
-
shopping_cart_display_shipping
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`,F="US",f={defaultCountry:F,agreementsEnabled:!0,shoppingCartDisplaySetting:{shipping:i.EXCLUDING_TAX}},Y=async()=>await L({defaultValueOnFail:f,options:{method:"GET",cache:"no-cache"},path:"storeConfig",query:x,transformer:b,type:"query"});function M(e){switch(e){case 1:return i.EXCLUDING_TAX;case 2:return i.INCLUDING_TAX;case 3:return i.INCLUDING_EXCLUDING_TAX;default:return i.EXCLUDING_TAX}}function b(e){if(!e)return f;const{default_country:t,is_checkout_agreements_enabled:r,shopping_cart_display_shipping:s}=e;return{defaultCountry:t||f.defaultCountry,agreementsEnabled:r,shoppingCartDisplaySetting:{shipping:M(s)}}}const{setEndpoint:$,setFetchGraphQlHeader:J,removeFetchGraphQlHeader:K,setFetchGraphQlHeaders:W,fetchGraphQl:k,getConfig:Z}=new w().getMethods();class P extends Error{constructor(t){super(t.map(r=>r.message).join(" ")),this.name="FetchError"}}class u extends Error{constructor(t){super(t),this.name="InvalidArgument"}}class ee extends Error{constructor(t){super(t),this.name="UnexpectedError"}}class te extends u{constructor(){super("Cart ID is required")}}class re extends u{constructor(){super("Email is required")}}class se extends u{constructor(){super("Payment method code is required")}}class ne extends u{constructor(){super("Shipping address is required")}}class ae extends u{constructor(){super("Billing address is required")}}class oe extends u{constructor(){super("Country Code is required")}}export{F as D,P as F,u as I,te as M,D as Q,f as S,i as T,ee as U,z as a,oe as b,ne as c,L as d,$ as e,J as f,V as g,B as h,W as i,k as j,Z as k,Y as l,re as m,se as n,ae as o,K as r,N as s};
|
|
14
|
-
//# sourceMappingURL=errors.js.map
|
package/chunks/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["/@dropins/storefront-checkout/src/lib/state.ts","/@dropins/storefront-checkout/src/data/models/store-config.ts","/@dropins/storefront-checkout/src/lib/enqueueRequest.ts","/@dropins/storefront-checkout/src/lib/filterControlledErrors.ts","/@dropins/storefront-checkout/src/lib/network-error.ts","/@dropins/storefront-checkout/src/lib/dispatchApiCall.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/graphql/getStoreConfig.graphql.ts","/@dropins/storefront-checkout/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-checkout/src/data/transforms/transform-store-config.ts","/@dropins/storefront-checkout/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-checkout/src/errors/errors.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfig } from '@/checkout/data/models';\n\ntype State = {\n authenticated: boolean;\n cartId: string | null;\n initialized: boolean;\n config: StoreConfig | null;\n};\n\nconst _state: State = (() => ({\n authenticated: false,\n cartId: null,\n initialized: false,\n config: null,\n}))();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n // @ts-ignore\n target[key] = value;\n return true;\n },\n get(target, key) {\n return target[key as keyof State];\n },\n});\n\nexport const getStoreConfigCache = () => state.config;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport enum TaxDisplay {\n EXCLUDING_TAX = 'EXCLUDING_TAX',\n INCLUDING_EXCLUDING_TAX = 'INCLUDING_AND_EXCLUDING_TAX',\n INCLUDING_TAX = 'INCLUDING_TAX',\n}\n\nexport interface StoreConfig {\n defaultCountry: string;\n agreementsEnabled: boolean;\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay;\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Cart } from '@/checkout/data/models';\nimport {\n computed,\n ReadonlySignal,\n signal,\n} from '@adobe-commerce/elsie/lib/signals';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport enum QueueName {\n CartUpdate = 'cartUpdate',\n Default = 'default',\n ShippingEstimate = 'shippingEstimate',\n}\n\ntype Request<T> = () => Promise<T>;\ntype QueueCompletedHandler<T> = (result: T) => void;\n\ninterface QueuedRequest<T> {\n requestFn: Request<T>;\n resolve: (value: T) => void;\n reject: (error: any) => void;\n}\n\nconst queues = new Map<QueueName, QueuedRequest<any>[]>();\nconst processing = new Map<QueueName, boolean>();\nconst pendingRequests = signal<Set<QueueName>>(new Set());\nconst onQueueCompleted = new Map<QueueName, QueueCompletedHandler<any>>();\n\nonQueueCompleted.set(QueueName.CartUpdate, (latestResult: Cart) => {\n events.emit('checkout/updated', latestResult);\n});\n\nasync function processQueue(type: QueueName): Promise<void> {\n processing.set(type, true);\n\n const queue = queues.get(type)!;\n let latestSuccessResult: any;\n\n while (queue.length > 0) {\n const request = queue.shift()!;\n\n try {\n const result = await request.requestFn();\n request.resolve(result);\n latestSuccessResult = result;\n } catch (error) {\n request.reject(error);\n }\n }\n\n processing.set(type, false);\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.delete(type);\n pendingRequests.value = pendingSet;\n\n const handler = onQueueCompleted.get(type);\n\n if (handler && latestSuccessResult) {\n handler(latestSuccessResult);\n }\n}\n\nexport function enqueueRequest<T>(\n requestFn: Request<T>,\n name: QueueName = QueueName.Default\n): Promise<T> {\n if (!queues.has(name)) {\n queues.set(name, []);\n }\n\n const queue = queues.get(name)!;\n\n const promise = new Promise<T>((resolve, reject) => {\n queue.push({ requestFn, resolve, reject });\n });\n\n const pendingSet = new Set(pendingRequests.value);\n pendingSet.add(name);\n pendingRequests.value = pendingSet;\n\n if (!processing.get(name)) {\n processQueue(name);\n }\n\n return promise;\n}\n\nexport const hasPendingCartUpdates: ReadonlySignal<boolean> = computed(() => {\n return pendingRequests.value.has(QueueName.CartUpdate);\n});\n\nexport const hasPendingShippingEstimate: ReadonlySignal<boolean> = computed(\n () => {\n return pendingRequests.value.has(QueueName.ShippingEstimate);\n }\n);\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\ntype ErrorPath = (string | number)[];\n\nexport type ErrorWithPath = FetchQueryError[number] & {\n path?: ErrorPath;\n};\n\nconst controlledErrorProps: string[] = ['sender_email', 'recipient_email'];\n\n/**\n * Filters out errors with known paths from a list of errors generated by a GraphQL query.\n *\n * Known issue: The query does not differentiate between physical and virtual gift cards, leading\n * to errors for physical ones as they don't have 'sender_email' and 'recipient_email' properties.\n *\n * @param {ErrorWithPath[]} errors - Array of errors to be filtered.\n * @return {ErrorWithPath[]} Uncontrolled (unexpected) errors not matching predefined paths.\n */\n\nexport function filterControlledErrors(errors: ErrorWithPath[]) {\n return errors.filter(\n (error) =>\n !error.path ||\n !controlledErrorProps.some((controlledErrorProp) => {\n return error.path?.at(-1) === controlledErrorProp;\n })\n );\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n events.emit('error', {\n source: 'checkout',\n type: 'network',\n error,\n });\n }\n\n throw error;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n FetchError,\n fetchGraphQl,\n FetchOptions,\n FetchQueryError,\n} from '@/checkout/api';\nimport { enqueueRequest, QueueName } from '@/checkout/lib/enqueueRequest';\nimport { filterControlledErrors } from '@/checkout/lib/filterControlledErrors';\nimport { handleNetworkError } from '@/checkout/lib/network-error';\n\ntype DispatchApiCallParams<T> = {\n defaultValueOnFail?: T;\n options?: FetchOptions;\n path: string;\n query: string;\n queueName?: QueueName;\n transformer?: (data: any) => T;\n type: 'query' | 'mutation';\n};\n\nexport function getValueAtPath(obj: any, path: string) {\n return path\n .split('.')\n .reduce(\n (acc, part) => (acc && acc[part] !== undefined ? acc[part] : undefined),\n obj\n );\n}\n\nasync function dispatchApiCall<T>(\n params: DispatchApiCallParams<T>\n): Promise<T> {\n const {\n defaultValueOnFail,\n options,\n path,\n query,\n queueName,\n transformer,\n type,\n } = params;\n\n try {\n const processApiCall = async () => {\n const { data, errors } = await fetchGraphQl<T>(query, {\n method: type === 'query' ? 'GET' : 'POST',\n cache: type === 'query' ? 'no-cache' : undefined,\n ...options,\n }).catch(handleNetworkError);\n\n if (errors) {\n const uncontrolledErrors = filterControlledErrors(errors);\n\n if (uncontrolledErrors.length > 0) {\n throw new FetchError(uncontrolledErrors as FetchQueryError);\n }\n }\n\n let result = getValueAtPath(data, path);\n\n if (result === undefined) {\n throw new Error(`No data found at path: ${path}`);\n }\n\n return transformer ? transformer(result) : result;\n };\n\n // Execute the API call, either directly or through the queue\n const result =\n type === 'mutation'\n ? await enqueueRequest<T>(processApiCall, queueName)\n : await processApiCall();\n\n return result;\n } catch (error: any) {\n if (defaultValueOnFail !== undefined) return defaultValueOnFail;\n throw error;\n }\n}\n\nexport { dispatchApiCall };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const getStoreConfigQuery = /* GraphQL */ `\n query getStoreConfig {\n storeConfig {\n default_country\n is_checkout_agreements_enabled\n is_guest_checkout_enabled\n is_one_page_checkout_enabled\n shopping_cart_display_shipping\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { StoreConfig, TaxDisplay } from '@/checkout/data/models';\nimport { transformStoreConfig } from '@/checkout/data/transforms';\nimport { dispatchApiCall } from '@/checkout/lib';\nimport { getStoreConfigQuery } from './graphql/getStoreConfig.graphql';\n\nexport const DEFAULT_COUNTRY = 'US';\n\nexport const STORE_CONFIG_DEFAULTS: StoreConfig = {\n defaultCountry: DEFAULT_COUNTRY,\n agreementsEnabled: true,\n shoppingCartDisplaySetting: {\n shipping: TaxDisplay.EXCLUDING_TAX,\n },\n};\n\nexport const getStoreConfig = async () => {\n return await dispatchApiCall({\n defaultValueOnFail: STORE_CONFIG_DEFAULTS,\n options: { method: 'GET', cache: 'no-cache' },\n path: 'storeConfig',\n query: getStoreConfigQuery,\n transformer: transformStoreConfig,\n type: 'query',\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GetStoreConfigQuery } from '@/checkout/__generated__/types';\nimport { STORE_CONFIG_DEFAULTS } from '@/checkout/api/getStoreConfig';\nimport { StoreConfig, TaxDisplay } from '@/checkout/data/models';\n\nexport function transformTaxDisplay(data: number | null | undefined) {\n switch (data) {\n case 1:\n return TaxDisplay.EXCLUDING_TAX;\n case 2:\n return TaxDisplay.INCLUDING_TAX;\n case 3:\n return TaxDisplay.INCLUDING_EXCLUDING_TAX;\n default:\n return TaxDisplay.EXCLUDING_TAX;\n }\n}\n\nexport function transformStoreConfig(\n data: GetStoreConfigQuery['storeConfig']\n): StoreConfig {\n if (!data) return STORE_CONFIG_DEFAULTS;\n\n const {\n default_country,\n is_checkout_agreements_enabled,\n shopping_cart_display_shipping,\n } = data;\n\n return {\n defaultCountry: default_country || STORE_CONFIG_DEFAULTS.defaultCountry,\n agreementsEnabled: is_checkout_agreements_enabled,\n shoppingCartDisplaySetting: {\n shipping: transformTaxDisplay(shopping_cart_display_shipping),\n },\n };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n\nexport type {\n FetchOptions,\n FetchQueryError,\n} from '@adobe-commerce/fetch-graphql';\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2024 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchQueryError } from '@/checkout/api/fetch-graphql';\n\nexport class FetchError extends Error {\n constructor(reasons: FetchQueryError) {\n super(reasons.map((e: any) => e.message).join(' '));\n this.name = 'FetchError';\n }\n}\n\nexport class InvalidArgument extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'InvalidArgument';\n }\n}\n\nexport class UnexpectedError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'UnexpectedError';\n }\n}\n\nexport class MissingCart extends InvalidArgument {\n constructor() {\n super('Cart ID is required');\n }\n}\nexport class MissingEmail extends InvalidArgument {\n constructor() {\n super('Email is required');\n }\n}\n\nexport class MissingPaymentMethod extends InvalidArgument {\n constructor() {\n super('Payment method code is required');\n }\n}\n\nexport class MissingShippinghAddress extends InvalidArgument {\n constructor() {\n super('Shipping address is required');\n }\n}\n\nexport class MissingBillingAddress extends InvalidArgument {\n constructor() {\n super('Billing address is required');\n }\n}\n\nexport class MissingCountry extends InvalidArgument {\n constructor() {\n super('Country Code is required');\n }\n}\n"],"names":["_state","state","target","key","value","getStoreConfigCache","TaxDisplay","QueueName","queues","processing","pendingRequests","signal","onQueueCompleted","latestResult","events","processQueue","type","queue","latestSuccessResult","request","result","error","pendingSet","handler","enqueueRequest","requestFn","name","promise","resolve","reject","hasPendingCartUpdates","computed","hasPendingShippingEstimate","controlledErrorProps","filterControlledErrors","errors","controlledErrorProp","_a","handleNetworkError","getValueAtPath","obj","path","acc","part","dispatchApiCall","params","defaultValueOnFail","options","query","queueName","transformer","processApiCall","data","fetchGraphQl","uncontrolledErrors","FetchError","getStoreConfigQuery","DEFAULT_COUNTRY","STORE_CONFIG_DEFAULTS","getStoreConfig","transformStoreConfig","transformTaxDisplay","default_country","is_checkout_agreements_enabled","shopping_cart_display_shipping","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","getConfig","FetchGraphQL","reasons","e","InvalidArgument","message","UnexpectedError","MissingCart","MissingEmail","MissingPaymentMethod","MissingShippinghAddress","MissingBillingAddress","MissingCountry"],"mappings":"mNA0BA,MAAMA,EAAwB,CAC5B,cAAe,GACf,OAAQ,KACR,YAAa,GACb,OAAQ,IACV,EAGaC,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAIE,EAAQC,EAAKC,EAAO,CAEtB,OAAAF,EAAOC,CAAG,EAAIC,EACP,EACT,EACA,IAAIF,EAAQC,EAAK,CACf,OAAOD,EAAOC,CAAkB,CAAA,CAEpC,CAAC,EAEYE,EAAsB,IAAMJ,EAAM,OC5BnC,IAAAK,GAAAA,IACVA,EAAA,cAAgB,gBAChBA,EAAA,wBAA0B,8BAC1BA,EAAA,cAAgB,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B,CAC9B,MAAAA,EAAQ,IAAKC,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,CAAC,EAClD,KAAK,KAAO,YAAA,CAEhB,CAEO,MAAMC,UAAwB,KAAM,CACzC,YAAYC,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,iBAAA,CAEhB,CAEO,MAAMC,WAAwB,KAAM,CACzC,YAAYD,EAAiB,CAC3B,MAAMA,CAAO,EACb,KAAK,KAAO,iBAAA,CAEhB,CAEO,MAAME,WAAoBH,CAAgB,CAC/C,aAAc,CACZ,MAAM,qBAAqB,CAAA,CAE/B,CACO,MAAMI,WAAqBJ,CAAgB,CAChD,aAAc,CACZ,MAAM,mBAAmB,CAAA,CAE7B,CAEO,MAAMK,WAA6BL,CAAgB,CACxD,aAAc,CACZ,MAAM,iCAAiC,CAAA,CAE3C,CAEO,MAAMM,WAAgCN,CAAgB,CAC3D,aAAc,CACZ,MAAM,8BAA8B,CAAA,CAExC,CAEO,MAAMO,WAA8BP,CAAgB,CACzD,aAAc,CACZ,MAAM,6BAA6B,CAAA,CAEvC,CAEO,MAAMQ,WAAuBR,CAAgB,CAClD,aAAc,CACZ,MAAM,0BAA0B,CAAA,CAEpC"}
|
package/errors/errors.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { FetchQueryError } from '../api/fetch-graphql';
|
|
2
|
-
|
|
3
|
-
export declare class FetchError extends Error {
|
|
4
|
-
constructor(reasons: FetchQueryError);
|
|
5
|
-
}
|
|
6
|
-
export declare class InvalidArgument extends Error {
|
|
7
|
-
constructor(message: string);
|
|
8
|
-
}
|
|
9
|
-
export declare class UnexpectedError extends Error {
|
|
10
|
-
constructor(message: string);
|
|
11
|
-
}
|
|
12
|
-
export declare class MissingCart extends InvalidArgument {
|
|
13
|
-
constructor();
|
|
14
|
-
}
|
|
15
|
-
export declare class MissingEmail extends InvalidArgument {
|
|
16
|
-
constructor();
|
|
17
|
-
}
|
|
18
|
-
export declare class MissingPaymentMethod extends InvalidArgument {
|
|
19
|
-
constructor();
|
|
20
|
-
}
|
|
21
|
-
export declare class MissingShippinghAddress extends InvalidArgument {
|
|
22
|
-
constructor();
|
|
23
|
-
}
|
|
24
|
-
export declare class MissingBillingAddress extends InvalidArgument {
|
|
25
|
-
constructor();
|
|
26
|
-
}
|
|
27
|
-
export declare class MissingCountry extends InvalidArgument {
|
|
28
|
-
constructor();
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/lib/network-error.d.ts
DELETED
|
@@ -1,22 +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
|
-
/**
|
|
18
|
-
* A function which can be attached to fetchGraphQL to handle thrown errors in
|
|
19
|
-
* a generic way.
|
|
20
|
-
*/
|
|
21
|
-
export declare const handleNetworkError: (error: Error) => never;
|
|
22
|
-
//# sourceMappingURL=network-error.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 serverErrorSignal: import('@preact/signals-core').Signal<string | undefined>;
|
|
18
|
-
//# sourceMappingURL=ServerErrorSignal.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 type UIComponentType = 'ToggleButton' | 'RadioButton';
|
|
18
|
-
//# sourceMappingURL=ComponentTypes.d.ts.map
|
|
File without changes
|