@hartl-services/medusa-storefront 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +103 -2
- package/dist/browser/account-verification-channel.d.ts +11 -0
- package/dist/browser/account-verification-channel.js +32 -0
- package/dist/browser/actions.d.ts +53 -0
- package/dist/browser/actions.js +1 -0
- package/dist/browser/affiliate-referral.d.ts +152 -0
- package/dist/browser/affiliate-referral.js +85 -0
- package/dist/browser/browser-session.d.ts +3 -0
- package/dist/browser/browser-session.js +27 -0
- package/dist/browser/cart-mutations.d.ts +36 -0
- package/dist/browser/cart-mutations.js +137 -0
- package/dist/browser/cart-refresh.d.ts +11 -0
- package/dist/browser/cart-refresh.js +33 -0
- package/dist/browser/client.d.ts +15 -0
- package/dist/browser/client.js +20 -0
- package/dist/browser/fresh-order-marker.d.ts +11 -0
- package/dist/browser/fresh-order-marker.js +30 -0
- package/dist/browser/index.d.ts +946 -0
- package/dist/browser/index.js +70 -0
- package/dist/browser/query-invalidation.d.ts +4 -0
- package/dist/browser/query-invalidation.js +39 -0
- package/dist/browser/query-keys.d.ts +43 -0
- package/dist/browser/query-keys.js +28 -0
- package/dist/browser/query-options.d.ts +781 -0
- package/dist/browser/query-options.js +165 -0
- package/dist/browser/region.d.ts +5 -0
- package/dist/browser/region.js +15 -0
- package/dist/browser/unwrap-medusa-action.d.ts +7 -0
- package/dist/browser/unwrap-medusa-action.js +25 -0
- package/dist/core/action-result.d.ts +17 -0
- package/dist/core/action-result.js +12 -0
- package/dist/core/addresses.d.ts +46 -0
- package/dist/core/addresses.js +137 -0
- package/dist/core/affiliate/affiliate-application-errors.d.ts +2 -0
- package/dist/core/affiliate/affiliate-application-errors.js +14 -0
- package/dist/core/affiliate/affiliate-commission-presentation.d.ts +15 -0
- package/dist/core/affiliate/affiliate-commission-presentation.js +28 -0
- package/dist/core/affiliate/affiliate-coupon-code-presentation.d.ts +10 -0
- package/dist/core/affiliate/affiliate-coupon-code-presentation.js +22 -0
- package/dist/core/affiliate/affiliate-coupon-label.d.ts +3 -0
- package/dist/core/affiliate/affiliate-coupon-label.js +4 -0
- package/dist/core/affiliate/affiliate-date-range.d.ts +6 -0
- package/dist/core/affiliate/affiliate-date-range.js +16 -0
- package/dist/core/affiliate/affiliate-rate-presentation.d.ts +1 -0
- package/dist/core/affiliate/affiliate-rate-presentation.js +8 -0
- package/dist/core/affiliate/partner-company-address.d.ts +24 -0
- package/dist/core/affiliate/partner-company-address.js +31 -0
- package/dist/core/auth/customer-sign-in.d.ts +36 -0
- package/dist/core/auth/customer-sign-in.js +55 -0
- package/dist/core/auth/link-token.d.ts +8 -0
- package/dist/core/auth/link-token.js +11 -0
- package/dist/core/auth/login-code-auto-send.d.ts +7 -0
- package/dist/core/auth/login-code-auto-send.js +11 -0
- package/dist/core/auth/password-rule-label.d.ts +4 -0
- package/dist/core/auth/password-rule-label.js +13 -0
- package/dist/core/cart/cart-line-item-image-url.d.ts +9 -0
- package/dist/core/cart/cart-line-item-image-url.js +14 -0
- package/dist/core/cart/cart-normalization.d.ts +2 -0
- package/dist/core/cart/cart-normalization.js +11 -0
- package/dist/core/cart/cart-price-breakdown.d.ts +30 -0
- package/dist/core/cart/cart-price-breakdown.js +45 -0
- package/dist/core/cart/cart-tax-breakdown.d.ts +17 -0
- package/dist/core/cart/cart-tax-breakdown.js +18 -0
- package/dist/core/cart/coupon-promotions.d.ts +8 -0
- package/dist/core/cart/coupon-promotions.js +9 -0
- package/dist/core/cart/payment-session.d.ts +3 -0
- package/dist/core/cart/payment-session.js +12 -0
- package/dist/core/cart/refunded-cart.d.ts +27 -0
- package/dist/core/cart/refunded-cart.js +46 -0
- package/dist/core/catalog/category-filter.d.ts +16 -0
- package/dist/core/catalog/category-filter.js +33 -0
- package/dist/core/catalog/inventory.d.ts +10 -0
- package/dist/core/catalog/inventory.js +9 -0
- package/dist/core/catalog/medusa-product-image.d.ts +8 -0
- package/dist/core/catalog/medusa-product-image.js +13 -0
- package/dist/core/catalog/product-price.d.ts +8 -0
- package/dist/core/catalog/product-price.js +21 -0
- package/dist/core/catalog/selected-variant.d.ts +7 -0
- package/dist/core/catalog/selected-variant.js +9 -0
- package/dist/core/checkout/checkout-account-offer-state.d.ts +41 -0
- package/dist/core/checkout/checkout-account-offer-state.js +32 -0
- package/dist/core/checkout/checkout-address-draft.d.ts +39 -0
- package/dist/core/checkout/checkout-address-draft.js +78 -0
- package/dist/core/checkout/checkout-address-form.d.ts +24 -0
- package/dist/core/checkout/checkout-address-form.js +99 -0
- package/dist/core/checkout/checkout-coupon.d.ts +9 -0
- package/dist/core/checkout/checkout-coupon.js +13 -0
- package/dist/core/checkout/checkout-steps.d.ts +20 -0
- package/dist/core/checkout/checkout-steps.js +44 -0
- package/dist/core/checkout/customer-login-required.d.ts +12 -0
- package/dist/core/checkout/customer-login-required.js +14 -0
- package/dist/core/checkout/payment-authorization.d.ts +8 -0
- package/dist/core/checkout/payment-authorization.js +9 -0
- package/dist/core/checkout/stripe-redirect-return.d.ts +13 -0
- package/dist/core/checkout/stripe-redirect-return.js +29 -0
- package/dist/core/errors.d.ts +12 -0
- package/dist/core/errors.js +18 -0
- package/dist/core/fields.d.ts +18 -0
- package/dist/core/fields.js +20 -0
- package/dist/core/form-values.d.ts +162 -0
- package/dist/core/form-values.js +234 -0
- package/dist/core/format/money.d.ts +7 -0
- package/dist/core/format/money.js +6 -0
- package/dist/core/i18n.d.ts +24 -0
- package/dist/core/i18n.js +15 -0
- package/dist/core/image-url.d.ts +18 -0
- package/dist/core/image-url.js +34 -0
- package/dist/core/index.d.ts +48 -0
- package/dist/core/index.js +49 -0
- package/dist/core/order/order-payment-summary.d.ts +15 -0
- package/dist/core/order/order-payment-summary.js +48 -0
- package/dist/core/plugin-features.d.ts +21 -0
- package/dist/core/plugin-features.js +30 -0
- package/dist/core/query-string.d.ts +6 -0
- package/dist/core/query-string.js +16 -0
- package/dist/core/region.d.ts +11 -0
- package/dist/core/region.js +13 -0
- package/dist/core/report-error.d.ts +12 -0
- package/dist/core/report-error.js +1 -0
- package/dist/core/routing-locale.d.ts +1 -0
- package/dist/core/routing-locale.js +25 -0
- package/dist/core/settle-within.d.ts +8 -0
- package/dist/core/settle-within.js +14 -0
- package/dist/core/tax-compliance/address-tax-identification.d.ts +37 -0
- package/dist/core/tax-compliance/address-tax-identification.js +51 -0
- package/dist/core/tax-compliance/tax-identification.d.ts +18 -0
- package/dist/core/tax-compliance/tax-identification.js +58 -0
- package/dist/core/texts-de.d.ts +136 -0
- package/dist/core/texts-de.js +152 -0
- package/dist/react/cart-error-boundary.d.ts +24 -0
- package/dist/react/cart-error-boundary.js +57 -0
- package/dist/react/context.d.ts +17 -0
- package/dist/react/context.js +46 -0
- package/dist/react/index.d.ts +12 -0
- package/dist/react/index.js +14 -0
- package/dist/react/use-account.d.ts +214 -0
- package/dist/react/use-account.js +294 -0
- package/dist/react/use-affiliate.d.ts +566 -0
- package/dist/react/use-affiliate.js +573 -0
- package/dist/react/use-auth.d.ts +136 -0
- package/dist/react/use-auth.js +402 -0
- package/dist/react/use-cart.d.ts +57 -0
- package/dist/react/use-cart.js +137 -0
- package/dist/react/use-checkout-address-form.d.ts +156 -0
- package/dist/react/use-checkout-address-form.js +95 -0
- package/dist/react/use-checkout.d.ts +268 -0
- package/dist/react/use-checkout.js +873 -0
- package/dist/react/use-countdown.d.ts +5 -0
- package/dist/react/use-countdown.js +23 -0
- package/dist/react/use-link-token.d.ts +12 -0
- package/dist/react/use-link-token.js +17 -0
- package/dist/react/use-plugin-feature.d.ts +16 -0
- package/dist/react/use-plugin-feature.js +31 -0
- package/dist/react/use-verification-watch.d.ts +7 -0
- package/dist/react/use-verification-watch.js +49 -0
- package/dist/registry/account.json +248 -0
- package/dist/registry/affiliate.json +302 -0
- package/dist/registry/cart.json +127 -0
- package/dist/registry/checkout.json +169 -0
- package/dist/registry/form.json +145 -0
- package/dist/registry/registry.json +917 -0
- package/dist/registry/setup.json +76 -0
- package/dist/server/affiliate.d.ts +124 -0
- package/dist/server/affiliate.js +145 -0
- package/dist/server/cart.d.ts +10 -0
- package/dist/server/cart.js +113 -0
- package/dist/server/catalog.d.ts +28 -0
- package/dist/server/catalog.js +82 -0
- package/dist/server/checkout.d.ts +6 -0
- package/dist/server/checkout.js +12 -0
- package/dist/server/context.d.ts +38 -0
- package/dist/server/context.js +34 -0
- package/dist/server/customer.d.ts +84 -0
- package/dist/server/customer.js +362 -0
- package/dist/server/documents.d.ts +29 -0
- package/dist/server/documents.js +55 -0
- package/dist/server/index.d.ts +258 -0
- package/dist/server/index.js +45 -0
- package/dist/server/orders.d.ts +9 -0
- package/dist/server/orders.js +31 -0
- package/dist/server/plugin-features.d.ts +13 -0
- package/dist/server/plugin-features.js +52 -0
- package/dist/server/region.d.ts +6 -0
- package/dist/server/region.js +17 -0
- package/dist/server/route-response.d.ts +2 -0
- package/dist/server/route-response.js +17 -0
- package/dist/server/run-medusa-action.d.ts +7 -0
- package/dist/server/run-medusa-action.js +40 -0
- package/dist/server/session.d.ts +29 -0
- package/dist/server/session.js +106 -0
- package/dist/server/tax-compliance.d.ts +26 -0
- package/dist/server/tax-compliance.js +85 -0
- package/package.json +86 -3
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { normalizeLoginEmail } from "@hartl-services/medusa-contracts/schemas/customer-auth";
|
|
2
|
+
export function normalizeOfferEmail(email) {
|
|
3
|
+
return normalizeLoginEmail(email ?? "");
|
|
4
|
+
}
|
|
5
|
+
export function createAccountOfferState(email) {
|
|
6
|
+
return { email: normalizeOfferEmail(email), step: "ask" };
|
|
7
|
+
}
|
|
8
|
+
export function accountOfferReducer(state, action) {
|
|
9
|
+
switch (action.type) {
|
|
10
|
+
case "accepted":
|
|
11
|
+
return state.step === "ask" ? { ...state, step: "code" } : state;
|
|
12
|
+
case "declined":
|
|
13
|
+
return state.step === "ask" ? { ...state, step: "declined" } : state;
|
|
14
|
+
case "reconsidered":
|
|
15
|
+
return state.step === "declined" ? { ...state, step: "ask" } : state;
|
|
16
|
+
case "cancelled":
|
|
17
|
+
return state.step === "code" ? { ...state, step: "ask" } : state;
|
|
18
|
+
case "signedIn":
|
|
19
|
+
return state.step === "code" ? { ...state, step: "done" } : state;
|
|
20
|
+
case "emailChanged":
|
|
21
|
+
// The signed-in confirmation is about the account, not about the field.
|
|
22
|
+
return state.step === "done" || state.email === action.email ? state : { email: action.email, step: "ask" };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function isAccountOfferVisible({ codeLoginEnabled, email, fieldEmail, isGuest, isLoginRequired, step }) {
|
|
26
|
+
// The confirmation outlives the login that produced it.
|
|
27
|
+
if (step === "done") {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const cartEmail = normalizeOfferEmail(email);
|
|
31
|
+
return codeLoginEnabled && isGuest && !isLoginRequired && cartEmail !== "" && normalizeOfferEmail(fieldEmail) === cartEmail;
|
|
32
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { HttpTypes } from "@medusajs/types";
|
|
2
|
+
import type { CheckoutAddressValues, CustomerAddressValues } from "../form-values.js";
|
|
3
|
+
type CheckoutAddressKind = "shipping" | "billing";
|
|
4
|
+
interface CreateCheckoutAddressDraftInput {
|
|
5
|
+
billingAddress?: HttpTypes.StoreCartAddress;
|
|
6
|
+
countryCode: string;
|
|
7
|
+
defaultBillingAddress?: HttpTypes.StoreCustomerAddress;
|
|
8
|
+
defaultShippingAddress?: HttpTypes.StoreCustomerAddress;
|
|
9
|
+
email?: string | null;
|
|
10
|
+
shippingAddress?: HttpTypes.StoreCartAddress;
|
|
11
|
+
}
|
|
12
|
+
export declare function createCheckoutAddressDraft(input: CreateCheckoutAddressDraftInput): CheckoutAddressValues;
|
|
13
|
+
/**
|
|
14
|
+
* Takes over a saved address for one role. The UID travels with the address
|
|
15
|
+
* that acts as billing address: the billing one, or the shipping one while
|
|
16
|
+
* billing is the same.
|
|
17
|
+
*/
|
|
18
|
+
export declare function replaceCheckoutDraftAddress(draft: CheckoutAddressValues, kind: CheckoutAddressKind, address: HttpTypes.StoreCustomerAddress, countryCode: string): CheckoutAddressValues;
|
|
19
|
+
export declare function findCheckoutAddressById(addresses: HttpTypes.StoreCustomerAddress[], id: string | null | undefined): HttpTypes.StoreCustomerAddress | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Cart payload of the draft. Medusa stores every submitted address as a new
|
|
22
|
+
* cart address, so the UID goes into the billing address's metadata only
|
|
23
|
+
* while one is entered - an address without it carries none.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toCheckoutAddressUpdate(draft: CheckoutAddressValues): Pick<HttpTypes.StoreUpdateCart, "email" | "shipping_address" | "billing_address">;
|
|
26
|
+
export interface CheckoutCustomerAddress {
|
|
27
|
+
is_default_billing: boolean;
|
|
28
|
+
is_default_shipping: boolean;
|
|
29
|
+
values: CustomerAddressValues;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Address book entries for a customer who has no saved address yet. Each one
|
|
33
|
+
* is flagged as default for its role: without a flag the first saved address
|
|
34
|
+
* stands in for both roles (getDefaultCustomerAddress), and the next checkout
|
|
35
|
+
* would start with billing equal to shipping. The UID stays with the address
|
|
36
|
+
* acting as billing address.
|
|
37
|
+
*/
|
|
38
|
+
export declare function toCustomerAddressesFromCheckout(draft: CheckoutAddressValues): CheckoutCustomerAddress[];
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { addressesMatch, getAddressVatNumber, toCartAddress, vatNumberMetadataPatch } from "../addresses.js";
|
|
2
|
+
function toCheckoutAddressFields(address, countryCode) {
|
|
3
|
+
const cartAddress = address ? toCartAddress(address) : undefined;
|
|
4
|
+
return {
|
|
5
|
+
address_1: cartAddress?.address_1 ?? "",
|
|
6
|
+
address_2: cartAddress?.address_2 ?? "",
|
|
7
|
+
city: cartAddress?.city ?? "",
|
|
8
|
+
company: cartAddress?.company ?? "",
|
|
9
|
+
country_code: (cartAddress?.country_code || countryCode).toLowerCase(),
|
|
10
|
+
first_name: cartAddress?.first_name ?? "",
|
|
11
|
+
last_name: cartAddress?.last_name ?? "",
|
|
12
|
+
phone: cartAddress?.phone ?? "",
|
|
13
|
+
postal_code: cartAddress?.postal_code ?? "",
|
|
14
|
+
province: cartAddress?.province ?? "",
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function createCheckoutAddressDraft(input) {
|
|
18
|
+
const effectiveShipping = input.shippingAddress ?? input.defaultShippingAddress;
|
|
19
|
+
const effectiveBilling = input.billingAddress ?? input.defaultBillingAddress ?? effectiveShipping;
|
|
20
|
+
const hasDifferentBillingAddress = Boolean(effectiveBilling && (!effectiveShipping || !addressesMatch(effectiveShipping, effectiveBilling)));
|
|
21
|
+
const shippingAddress = toCheckoutAddressFields(effectiveShipping, input.countryCode);
|
|
22
|
+
const billingAddress = effectiveBilling ? toCheckoutAddressFields(effectiveBilling, input.countryCode) : shippingAddress;
|
|
23
|
+
return {
|
|
24
|
+
email: input.email ?? "",
|
|
25
|
+
has_different_billing_address: hasDifferentBillingAddress,
|
|
26
|
+
shipping_address: shippingAddress,
|
|
27
|
+
billing_address: billingAddress,
|
|
28
|
+
vat_number: effectiveBilling ? getAddressVatNumber(effectiveBilling) : "",
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Takes over a saved address for one role. The UID travels with the address
|
|
33
|
+
* that acts as billing address: the billing one, or the shipping one while
|
|
34
|
+
* billing is the same.
|
|
35
|
+
*/
|
|
36
|
+
export function replaceCheckoutDraftAddress(draft, kind, address, countryCode) {
|
|
37
|
+
const nextAddress = toCheckoutAddressFields(address, countryCode);
|
|
38
|
+
const actsAsBilling = kind === "billing" || !draft.has_different_billing_address;
|
|
39
|
+
const vatNumber = actsAsBilling ? getAddressVatNumber(address) : draft.vat_number;
|
|
40
|
+
return kind === "shipping" ? { ...draft, shipping_address: nextAddress, vat_number: vatNumber } : { ...draft, billing_address: nextAddress, vat_number: vatNumber };
|
|
41
|
+
}
|
|
42
|
+
export function findCheckoutAddressById(addresses, id) {
|
|
43
|
+
if (!id) {
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
return addresses.find((address) => address.id === id);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Cart payload of the draft. Medusa stores every submitted address as a new
|
|
50
|
+
* cart address, so the UID goes into the billing address's metadata only
|
|
51
|
+
* while one is entered - an address without it carries none.
|
|
52
|
+
*/
|
|
53
|
+
export function toCheckoutAddressUpdate(draft) {
|
|
54
|
+
const billingAddress = draft.has_different_billing_address ? draft.billing_address : draft.shipping_address;
|
|
55
|
+
const vatNumber = draft.vat_number.trim();
|
|
56
|
+
return {
|
|
57
|
+
email: draft.email,
|
|
58
|
+
shipping_address: draft.shipping_address,
|
|
59
|
+
billing_address: vatNumber ? { ...billingAddress, metadata: vatNumberMetadataPatch(vatNumber) } : billingAddress,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Address book entries for a customer who has no saved address yet. Each one
|
|
64
|
+
* is flagged as default for its role: without a flag the first saved address
|
|
65
|
+
* stands in for both roles (getDefaultCustomerAddress), and the next checkout
|
|
66
|
+
* would start with billing equal to shipping. The UID stays with the address
|
|
67
|
+
* acting as billing address.
|
|
68
|
+
*/
|
|
69
|
+
export function toCustomerAddressesFromCheckout(draft) {
|
|
70
|
+
const vatNumber = draft.vat_number.trim();
|
|
71
|
+
if (!draft.has_different_billing_address) {
|
|
72
|
+
return [{ is_default_billing: true, is_default_shipping: true, values: { ...draft.shipping_address, address_name: "", vat_number: vatNumber } }];
|
|
73
|
+
}
|
|
74
|
+
return [
|
|
75
|
+
{ is_default_billing: false, is_default_shipping: true, values: { ...draft.shipping_address, address_name: "", vat_number: "" } },
|
|
76
|
+
{ is_default_billing: true, is_default_shipping: false, values: { ...draft.billing_address, address_name: "", vat_number: vatNumber } },
|
|
77
|
+
];
|
|
78
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HttpTypes } from "@medusajs/types";
|
|
2
|
+
import type { CountryOption } from "../addresses.js";
|
|
3
|
+
import type { CheckoutAddressValues } from "../form-values.js";
|
|
4
|
+
export type CheckoutAddressPrefix = "billing_address" | "shipping_address";
|
|
5
|
+
/** The checkout address form's sections: e-mail, shipping and billing address. */
|
|
6
|
+
export type CheckoutSectionValue = "billing" | "general" | "shipping";
|
|
7
|
+
export declare const DEFAULT_CHECKOUT_ADDRESS_VALUES: CheckoutAddressValues["shipping_address"];
|
|
8
|
+
export declare const DEFAULT_CHECKOUT_VALUES: CheckoutAddressValues;
|
|
9
|
+
/** The form's starting values: the draft or cart values, with countries the region offers. */
|
|
10
|
+
export declare function getCheckoutAddressFormDefaults(countryCode: string, countryOptions: CountryOption[], initialValues: Partial<CheckoutAddressValues> | undefined): CheckoutAddressValues;
|
|
11
|
+
export declare function isCheckoutAddressMissing(address: CheckoutAddressValues["shipping_address"]): boolean;
|
|
12
|
+
/** A form address in the shape the saved-address match compares. */
|
|
13
|
+
export declare function toMatchingCartAddress(address: CheckoutAddressValues["shipping_address"]): HttpTypes.StoreCartAddress;
|
|
14
|
+
/** The section the form opens first: the first one still missing something. */
|
|
15
|
+
export declare function getFirstMissingCheckoutSection(values: CheckoutAddressValues): CheckoutSectionValue | undefined;
|
|
16
|
+
/** Sections to open after a failed submit, so every error is visible. */
|
|
17
|
+
export declare function getInvalidCheckoutSections(values: CheckoutAddressValues, merchantCountryCode: string | null, hasB2b: boolean): CheckoutSectionValue[];
|
|
18
|
+
/**
|
|
19
|
+
* What the address step submits: a UID typed before the billing country
|
|
20
|
+
* changed to the merchant's country is hidden and must not reach the cart;
|
|
21
|
+
* neither does one prefilled from the cart or a saved address while B2B sales
|
|
22
|
+
* are off.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toSubmittedCheckoutAddress(value: CheckoutAddressValues, merchantCountryCode: string | null, hasB2b: boolean): CheckoutAddressValues;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { asksForVatNumber } from "../form-values.js";
|
|
2
|
+
export const DEFAULT_CHECKOUT_ADDRESS_VALUES = {
|
|
3
|
+
address_1: "",
|
|
4
|
+
address_2: "",
|
|
5
|
+
city: "",
|
|
6
|
+
company: "",
|
|
7
|
+
country_code: "",
|
|
8
|
+
first_name: "",
|
|
9
|
+
last_name: "",
|
|
10
|
+
phone: "",
|
|
11
|
+
postal_code: "",
|
|
12
|
+
province: "",
|
|
13
|
+
};
|
|
14
|
+
export const DEFAULT_CHECKOUT_VALUES = {
|
|
15
|
+
billing_address: DEFAULT_CHECKOUT_ADDRESS_VALUES,
|
|
16
|
+
email: "",
|
|
17
|
+
has_different_billing_address: false,
|
|
18
|
+
shipping_address: DEFAULT_CHECKOUT_ADDRESS_VALUES,
|
|
19
|
+
vat_number: "",
|
|
20
|
+
};
|
|
21
|
+
function getDefaultCountryCode(countryCode, countryOptions, initialCountryCode) {
|
|
22
|
+
const selectedCountryCode = (initialCountryCode ?? countryCode).toLowerCase();
|
|
23
|
+
return countryOptions.some((option) => option.value === selectedCountryCode) ? selectedCountryCode : (countryOptions[0]?.value ?? selectedCountryCode);
|
|
24
|
+
}
|
|
25
|
+
/** The form's starting values: the draft or cart values, with countries the region offers. */
|
|
26
|
+
export function getCheckoutAddressFormDefaults(countryCode, countryOptions, initialValues) {
|
|
27
|
+
const initialBillingAddress = initialValues?.billing_address;
|
|
28
|
+
const initialShippingAddress = initialValues?.shipping_address;
|
|
29
|
+
return {
|
|
30
|
+
...DEFAULT_CHECKOUT_VALUES,
|
|
31
|
+
...initialValues,
|
|
32
|
+
billing_address: {
|
|
33
|
+
...DEFAULT_CHECKOUT_ADDRESS_VALUES,
|
|
34
|
+
...initialBillingAddress,
|
|
35
|
+
country_code: getDefaultCountryCode(countryCode, countryOptions, initialBillingAddress?.country_code),
|
|
36
|
+
},
|
|
37
|
+
shipping_address: {
|
|
38
|
+
...DEFAULT_CHECKOUT_ADDRESS_VALUES,
|
|
39
|
+
...initialShippingAddress,
|
|
40
|
+
country_code: getDefaultCountryCode(countryCode, countryOptions, initialShippingAddress?.country_code),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function isCheckoutAddressMissing(address) {
|
|
45
|
+
return [address.first_name, address.last_name, address.address_1, address.postal_code, address.city, address.country_code].some((value) => !value.trim());
|
|
46
|
+
}
|
|
47
|
+
/** A form address in the shape the saved-address match compares. */
|
|
48
|
+
export function toMatchingCartAddress(address) {
|
|
49
|
+
return {
|
|
50
|
+
...address,
|
|
51
|
+
created_at: "",
|
|
52
|
+
id: "",
|
|
53
|
+
updated_at: "",
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
// The UID belongs to whichever section acts as billing address.
|
|
57
|
+
function getBillingSection(values) {
|
|
58
|
+
return values.has_different_billing_address ? "billing" : "shipping";
|
|
59
|
+
}
|
|
60
|
+
/** The section the form opens first: the first one still missing something. */
|
|
61
|
+
export function getFirstMissingCheckoutSection(values) {
|
|
62
|
+
if (!values.email.trim()) {
|
|
63
|
+
return "general";
|
|
64
|
+
}
|
|
65
|
+
if (isCheckoutAddressMissing(values.shipping_address)) {
|
|
66
|
+
return "shipping";
|
|
67
|
+
}
|
|
68
|
+
if (values.has_different_billing_address && isCheckoutAddressMissing(values.billing_address)) {
|
|
69
|
+
return "billing";
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
/** Sections to open after a failed submit, so every error is visible. */
|
|
74
|
+
export function getInvalidCheckoutSections(values, merchantCountryCode, hasB2b) {
|
|
75
|
+
const sections = [];
|
|
76
|
+
if (!values.email.trim()) {
|
|
77
|
+
sections.push("general");
|
|
78
|
+
}
|
|
79
|
+
if (isCheckoutAddressMissing(values.shipping_address)) {
|
|
80
|
+
sections.push("shipping");
|
|
81
|
+
}
|
|
82
|
+
if (values.has_different_billing_address && isCheckoutAddressMissing(values.billing_address)) {
|
|
83
|
+
sections.push("billing");
|
|
84
|
+
}
|
|
85
|
+
// A UID needs a company in the same address.
|
|
86
|
+
if (hasB2b && asksForVatNumber(values, merchantCountryCode) && values.vat_number.trim()) {
|
|
87
|
+
sections.push(getBillingSection(values));
|
|
88
|
+
}
|
|
89
|
+
return sections;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* What the address step submits: a UID typed before the billing country
|
|
93
|
+
* changed to the merchant's country is hidden and must not reach the cart;
|
|
94
|
+
* neither does one prefilled from the cart or a saved address while B2B sales
|
|
95
|
+
* are off.
|
|
96
|
+
*/
|
|
97
|
+
export function toSubmittedCheckoutAddress(value, merchantCountryCode, hasB2b) {
|
|
98
|
+
return hasB2b && asksForVatNumber(value, merchantCountryCode) ? value : { ...value, vat_number: "" };
|
|
99
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HttpTypes } from "@medusajs/types";
|
|
2
|
+
export declare function hasCartPromotionCode(cart: Pick<HttpTypes.StoreCart, "promotions"> | null, code: string): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* A code Medusa accepted (no 400) that left no trace on a cart without a
|
|
5
|
+
* shipping method: most likely a shipping promotion, which Medusa can only
|
|
6
|
+
* apply to a selected shipping method. Such a code is kept for the moment the
|
|
7
|
+
* customer picks one instead of being reported as not applicable.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isAwaitingShippingMethod(cart: Pick<HttpTypes.StoreCart, "promotions" | "shipping_methods"> | null, code: string): boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function hasCartPromotionCode(cart, code) {
|
|
2
|
+
const normalizedCode = code.trim().toLowerCase();
|
|
3
|
+
return normalizedCode.length > 0 && (cart?.promotions.some((promotion) => promotion.code?.trim().toLowerCase() === normalizedCode) ?? false);
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A code Medusa accepted (no 400) that left no trace on a cart without a
|
|
7
|
+
* shipping method: most likely a shipping promotion, which Medusa can only
|
|
8
|
+
* apply to a selected shipping method. Such a code is kept for the moment the
|
|
9
|
+
* customer picks one instead of being reported as not applicable.
|
|
10
|
+
*/
|
|
11
|
+
export function isAwaitingShippingMethod(cart, code) {
|
|
12
|
+
return cart !== null && (cart.shipping_methods?.length ?? 0) === 0 && !hasCartPromotionCode(cart, code);
|
|
13
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { HttpTypes } from "@medusajs/types";
|
|
2
|
+
import type { Translate } from "../i18n.js";
|
|
3
|
+
export type CheckoutStepId = "address" | "payment";
|
|
4
|
+
export declare const CHECKOUT_STEP_IDS: CheckoutStepId[];
|
|
5
|
+
export declare function getCheckoutStepLabel(step: CheckoutStepId, t: Translate): string;
|
|
6
|
+
/**
|
|
7
|
+
* Link target of every "Zur Kasse" entry point: the checkout always opens on
|
|
8
|
+
* the address step, even when the cart already carries an address, so the
|
|
9
|
+
* customer reviews it before paying.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCheckoutStartHref(countryCode: string): string;
|
|
12
|
+
export declare function getCompletedSteps(cart: HttpTypes.StoreCart): CheckoutStepId[];
|
|
13
|
+
/**
|
|
14
|
+
* The step the checkout shows for a requested `?step=`. Once payment
|
|
15
|
+
* authorization has started (e.g. during 3-D Secure) only the payment step is
|
|
16
|
+
* reachable - going back to the address step there would let a coupon or an
|
|
17
|
+
* address change alter the price of a payment already being authorized.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getReachableStep(requestedStep: CheckoutStepId | undefined, cart: HttpTypes.StoreCart): CheckoutStepId;
|
|
20
|
+
export declare function isCheckoutStepperLocked(cart: HttpTypes.StoreCart): boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { hasPaymentAuthorizationStarted } from "./payment-authorization.js";
|
|
2
|
+
export const CHECKOUT_STEP_IDS = ["address", "payment"];
|
|
3
|
+
export function getCheckoutStepLabel(step, t) {
|
|
4
|
+
return t(step === "address" ? "checkout.step.address" : "checkout.step.payment");
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Link target of every "Zur Kasse" entry point: the checkout always opens on
|
|
8
|
+
* the address step, even when the cart already carries an address, so the
|
|
9
|
+
* customer reviews it before paying.
|
|
10
|
+
*/
|
|
11
|
+
export function getCheckoutStartHref(countryCode) {
|
|
12
|
+
return `/${countryCode}/checkout?step=address`;
|
|
13
|
+
}
|
|
14
|
+
export function getCompletedSteps(cart) {
|
|
15
|
+
const completed = [];
|
|
16
|
+
if (cart.email && cart.shipping_address) {
|
|
17
|
+
completed.push("address");
|
|
18
|
+
}
|
|
19
|
+
return completed;
|
|
20
|
+
}
|
|
21
|
+
function getFurthestStepIndex(completedSteps) {
|
|
22
|
+
const lastCompletedIndex = completedSteps.reduce((furthest, step) => Math.max(furthest, CHECKOUT_STEP_IDS.indexOf(step)), -1);
|
|
23
|
+
return Math.min(lastCompletedIndex + 1, CHECKOUT_STEP_IDS.length - 1);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The step the checkout shows for a requested `?step=`. Once payment
|
|
27
|
+
* authorization has started (e.g. during 3-D Secure) only the payment step is
|
|
28
|
+
* reachable - going back to the address step there would let a coupon or an
|
|
29
|
+
* address change alter the price of a payment already being authorized.
|
|
30
|
+
*/
|
|
31
|
+
export function getReachableStep(requestedStep, cart) {
|
|
32
|
+
if (isCheckoutStepperLocked(cart)) {
|
|
33
|
+
return "payment";
|
|
34
|
+
}
|
|
35
|
+
const furthestIndex = getFurthestStepIndex(getCompletedSteps(cart));
|
|
36
|
+
if (!requestedStep) {
|
|
37
|
+
return CHECKOUT_STEP_IDS[furthestIndex];
|
|
38
|
+
}
|
|
39
|
+
const requestedIndex = CHECKOUT_STEP_IDS.indexOf(requestedStep);
|
|
40
|
+
return CHECKOUT_STEP_IDS[Math.min(requestedIndex, furthestIndex)];
|
|
41
|
+
}
|
|
42
|
+
export function isCheckoutStepperLocked(cart) {
|
|
43
|
+
return hasPaymentAuthorizationStarted(cart.payment_collection);
|
|
44
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CUSTOMER_LOGIN_REQUIRED_MESSAGE } from "@hartl-services/medusa-contracts/paths/checkout";
|
|
2
|
+
/**
|
|
3
|
+
* The backend refuses to set a cart email, create a payment session or
|
|
4
|
+
* complete a cart under an email that belongs to a registered account unless
|
|
5
|
+
* the request is authenticated as that account - which is why login
|
|
6
|
+
* establishes a Medusa browser session. The message (a Contracts constant,
|
|
7
|
+
* thrown by the affiliate plugin) is the only usable signal: the JS SDK's
|
|
8
|
+
* FetchError keeps just the message and HTTP status, and a bare 400 is shared
|
|
9
|
+
* with unrelated validation failures.
|
|
10
|
+
*/
|
|
11
|
+
export { CUSTOMER_LOGIN_REQUIRED_MESSAGE };
|
|
12
|
+
export declare function isCustomerLoginRequiredError(error: unknown): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CUSTOMER_LOGIN_REQUIRED_MESSAGE } from "@hartl-services/medusa-contracts/paths/checkout";
|
|
2
|
+
/**
|
|
3
|
+
* The backend refuses to set a cart email, create a payment session or
|
|
4
|
+
* complete a cart under an email that belongs to a registered account unless
|
|
5
|
+
* the request is authenticated as that account - which is why login
|
|
6
|
+
* establishes a Medusa browser session. The message (a Contracts constant,
|
|
7
|
+
* thrown by the affiliate plugin) is the only usable signal: the JS SDK's
|
|
8
|
+
* FetchError keeps just the message and HTTP status, and a bare 400 is shared
|
|
9
|
+
* with unrelated validation failures.
|
|
10
|
+
*/
|
|
11
|
+
export { CUSTOMER_LOGIN_REQUIRED_MESSAGE };
|
|
12
|
+
export function isCustomerLoginRequiredError(error) {
|
|
13
|
+
return error instanceof Error && error.message === CUSTOMER_LOGIN_REQUIRED_MESSAGE;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HttpTypes } from "@medusajs/types";
|
|
2
|
+
interface PaymentAuthorizationState {
|
|
3
|
+
status?: HttpTypes.StorePaymentCollection["status"] | null;
|
|
4
|
+
payment_sessions?: Array<Pick<HttpTypes.StorePaymentSession, "status">> | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function hasPaymentAuthorizationStarted(paymentCollection?: PaymentAuthorizationState | null): boolean;
|
|
7
|
+
export declare function shouldShowOrderCompletionAction(paymentCollection?: PaymentAuthorizationState | null): boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function hasPaymentAuthorizationStarted(paymentCollection) {
|
|
2
|
+
return (paymentCollection?.status === "authorized" ||
|
|
3
|
+
paymentCollection?.status === "partially_authorized" ||
|
|
4
|
+
paymentCollection?.status === "completed" ||
|
|
5
|
+
paymentCollection?.payment_sessions?.some((session) => session.status === "authorized" || session.status === "captured" || session.status === "pending_authorization") === true);
|
|
6
|
+
}
|
|
7
|
+
export function shouldShowOrderCompletionAction(paymentCollection) {
|
|
8
|
+
return hasPaymentAuthorizationStarted(paymentCollection) || paymentCollection?.payment_sessions?.some((session) => session.status === "pending" || session.status === "requires_more") === true;
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface StripeRedirectReturn {
|
|
2
|
+
clientSecret: string;
|
|
3
|
+
redirectStatus: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function parseStripeRedirectReturn(search: string): StripeRedirectReturn | null;
|
|
6
|
+
/**
|
|
7
|
+
* Whether the browser just came back from a redirect-based payment method
|
|
8
|
+
* (Klarna, iDEAL, ...) that Stripe already confirmed for this client secret.
|
|
9
|
+
* Its PaymentIntent is then in a terminal state, and Stripe refuses to
|
|
10
|
+
* initialize Elements with it - so the payment form must not be rendered.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isConfirmedRedirectReturn(redirectReturn: StripeRedirectReturn | null | undefined, clientSecret: string | null): boolean;
|
|
13
|
+
export declare function stripReturnParamsFromUrl(): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const STRIPE_RETURN_PARAMS = ["payment_intent", "payment_intent_client_secret", "redirect_status"];
|
|
2
|
+
export function parseStripeRedirectReturn(search) {
|
|
3
|
+
const params = new URLSearchParams(search);
|
|
4
|
+
const clientSecret = params.get("payment_intent_client_secret");
|
|
5
|
+
const redirectStatus = params.get("redirect_status");
|
|
6
|
+
if (!clientSecret || !redirectStatus) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
return { clientSecret, redirectStatus };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether the browser just came back from a redirect-based payment method
|
|
13
|
+
* (Klarna, iDEAL, ...) that Stripe already confirmed for this client secret.
|
|
14
|
+
* Its PaymentIntent is then in a terminal state, and Stripe refuses to
|
|
15
|
+
* initialize Elements with it - so the payment form must not be rendered.
|
|
16
|
+
*/
|
|
17
|
+
export function isConfirmedRedirectReturn(redirectReturn, clientSecret) {
|
|
18
|
+
return (redirectReturn != null &&
|
|
19
|
+
clientSecret !== null &&
|
|
20
|
+
redirectReturn.clientSecret === clientSecret &&
|
|
21
|
+
(redirectReturn.redirectStatus === "succeeded" || redirectReturn.redirectStatus === "processing"));
|
|
22
|
+
}
|
|
23
|
+
export function stripReturnParamsFromUrl() {
|
|
24
|
+
const url = new URL(window.location.href);
|
|
25
|
+
for (const param of STRIPE_RETURN_PARAMS) {
|
|
26
|
+
url.searchParams.delete(param);
|
|
27
|
+
}
|
|
28
|
+
window.history.replaceState(null, "", url.toString());
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TextCode, TextParams } from "./i18n.js";
|
|
2
|
+
/**
|
|
3
|
+
* An error the storefront raises itself. Its message is the text code, so it
|
|
4
|
+
* survives a Server Action boundary as plain data; the UI shows it through the
|
|
5
|
+
* shop's translator (`t.message`).
|
|
6
|
+
*/
|
|
7
|
+
export declare class StorefrontError extends Error {
|
|
8
|
+
readonly code: TextCode;
|
|
9
|
+
readonly params?: TextParams;
|
|
10
|
+
constructor(code: TextCode, params?: TextParams);
|
|
11
|
+
}
|
|
12
|
+
export declare function getErrorMessage(error: unknown, fallback: string): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An error the storefront raises itself. Its message is the text code, so it
|
|
3
|
+
* survives a Server Action boundary as plain data; the UI shows it through the
|
|
4
|
+
* shop's translator (`t.message`).
|
|
5
|
+
*/
|
|
6
|
+
export class StorefrontError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
params;
|
|
9
|
+
constructor(code, params) {
|
|
10
|
+
super(code);
|
|
11
|
+
this.name = "StorefrontError";
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.params = params;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export function getErrorMessage(error, fallback) {
|
|
17
|
+
return error instanceof Error ? error.message : fallback;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The active cart, with everything the cart page, checkout and payment step read. */
|
|
2
|
+
export declare const CART_FIELDS = "*items,*region,*items.product,*items.product.images,*items.variant,*items.variant.images,*items.thumbnail,*items.metadata,+items.*,*items.tax_lines,*items.adjustments,*promotions,*shipping_methods,+shipping_methods.*,*shipping_methods.tax_lines,*shipping_methods.adjustments,*payment_collection,*payment_collection.payments,*billing_address";
|
|
3
|
+
/** What backfilling customer defaults onto a cart compares. */
|
|
4
|
+
export declare const CART_DEFAULTS_FIELDS = "*region,*region.countries,*shipping_address,*billing_address";
|
|
5
|
+
/** What claiming a cart at login needs to see whose cart it is. */
|
|
6
|
+
export declare const CART_OWNER_FIELDS = "id,customer_id,+customer.has_account";
|
|
7
|
+
/** An order for the confirmation page. */
|
|
8
|
+
export declare const ORDER_FIELDS = "*items,*items.metadata,*items.variant,*items.variant.images,*items.product,*items.product.images,*items.tax_lines,*items.adjustments,*payment_collections,*payment_collections.payments,*shipping_methods,*shipping_methods.tax_lines,*shipping_address";
|
|
9
|
+
/** An order in the order history. */
|
|
10
|
+
export declare const ORDER_LIST_FIELDS = "*items,*items.product,*items.variant";
|
|
11
|
+
/** A product with prices, stock and everything the product page shows. */
|
|
12
|
+
export declare const PRODUCT_FIELDS = "*variants.calculated_price,+variants.inventory_quantity,*variants.images,*variants.options,+metadata,+tags,*images,*collection,*categories";
|
|
13
|
+
/** A category with its children, products and parent. */
|
|
14
|
+
export declare const CATEGORY_FIELDS = "*category_children,*products,*parent_category";
|
|
15
|
+
/** A collection with its products. */
|
|
16
|
+
export declare const COLLECTION_FIELDS = "*products";
|
|
17
|
+
/** The customer with the address book. */
|
|
18
|
+
export declare const CUSTOMER_FIELDS = "*addresses";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The `fields` of every Medusa read, in one place: a missing field has broken
|
|
2
|
+
// the storefront before (payments without amounts, order lines without images).
|
|
3
|
+
/** The active cart, with everything the cart page, checkout and payment step read. */
|
|
4
|
+
export const CART_FIELDS = "*items,*region,*items.product,*items.product.images,*items.variant,*items.variant.images,*items.thumbnail,*items.metadata,+items.*,*items.tax_lines,*items.adjustments,*promotions,*shipping_methods,+shipping_methods.*,*shipping_methods.tax_lines,*shipping_methods.adjustments,*payment_collection,*payment_collection.payments,*billing_address";
|
|
5
|
+
/** What backfilling customer defaults onto a cart compares. */
|
|
6
|
+
export const CART_DEFAULTS_FIELDS = "*region,*region.countries,*shipping_address,*billing_address";
|
|
7
|
+
/** What claiming a cart at login needs to see whose cart it is. */
|
|
8
|
+
export const CART_OWNER_FIELDS = "id,customer_id,+customer.has_account";
|
|
9
|
+
/** An order for the confirmation page. */
|
|
10
|
+
export const ORDER_FIELDS = "*items,*items.metadata,*items.variant,*items.variant.images,*items.product,*items.product.images,*items.tax_lines,*items.adjustments,*payment_collections,*payment_collections.payments,*shipping_methods,*shipping_methods.tax_lines,*shipping_address";
|
|
11
|
+
/** An order in the order history. */
|
|
12
|
+
export const ORDER_LIST_FIELDS = "*items,*items.product,*items.variant";
|
|
13
|
+
/** A product with prices, stock and everything the product page shows. */
|
|
14
|
+
export const PRODUCT_FIELDS = "*variants.calculated_price,+variants.inventory_quantity,*variants.images,*variants.options,+metadata,+tags,*images,*collection,*categories";
|
|
15
|
+
/** A category with its children, products and parent. */
|
|
16
|
+
export const CATEGORY_FIELDS = "*category_children,*products,*parent_category";
|
|
17
|
+
/** A collection with its products. */
|
|
18
|
+
export const COLLECTION_FIELDS = "*products";
|
|
19
|
+
/** The customer with the address book. */
|
|
20
|
+
export const CUSTOMER_FIELDS = "*addresses";
|