@fayz-ai/storefront 0.14.3 → 0.16.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.
@@ -1 +1 @@
1
- {"version":3,"file":"CartDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/cart/CartDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAmDlD,wBAAgB,UAAU,6BAiSzB"}
1
+ {"version":3,"file":"CartDrawer.d.ts","sourceRoot":"","sources":["../../../src/components/cart/CartDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAmDlD,wBAAgB,UAAU,6BA6SzB"}
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ /**
3
+ * Mercado Pago's Card Payment Brick, mounted in the store's own checkout.
4
+ *
5
+ * WHY THIS COMPONENT EXISTS AT ALL
6
+ *
7
+ * Every other acquirer in this repo sends a card buyer to a hosted page, and not
8
+ * for taste: AbacatePay's and Vindi's transparent calls want the card number (or
9
+ * the CVV) inside a request the edge function makes, which would put the pool in
10
+ * PCI scope. Mercado Pago tokenises HERE — the fields below live in their
11
+ * iframes, not in this DOM — so the store never touches a card number and the
12
+ * buyer never leaves. The only thing this component hands upward is a
13
+ * single-use token.
14
+ *
15
+ * So the guarantee is structural, not a promise: there is no state in this file
16
+ * that could hold a PAN, because the inputs are not ours to read.
17
+ */
18
+ /** The slice of their SDK this file uses. Declared rather than `any`, so a
19
+ * change in their shape is a type error here and not a runtime one. */
20
+ interface BricksBuilder {
21
+ create(brick: 'cardPayment', containerId: string, settings: Record<string, unknown>): Promise<{
22
+ unmount: () => void;
23
+ }>;
24
+ }
25
+ interface MercadoPagoSdk {
26
+ bricks(): BricksBuilder;
27
+ }
28
+ declare global {
29
+ interface Window {
30
+ MercadoPago?: new (publicKey: string, options?: {
31
+ locale?: string;
32
+ }) => MercadoPagoSdk;
33
+ }
34
+ }
35
+ declare global {
36
+ var MP_DEVICE_SESSION_ID: string | undefined;
37
+ }
38
+ /** Whatever the script has produced by now — never a fabricated value. */
39
+ export declare function deviceSessionId(): string | null;
40
+ export interface CardBrickResult {
41
+ token: string;
42
+ paymentMethodId: string | null;
43
+ issuerId: string | null;
44
+ installments: number;
45
+ /** What the Brick collected, which may differ from the checkout's own copy. */
46
+ email: string | null;
47
+ document: {
48
+ type: string;
49
+ number: string;
50
+ } | null;
51
+ }
52
+ export interface CardBrickProps {
53
+ publicKey: string;
54
+ /** In reais, as their SDK wants it — it prices the installment options. */
55
+ amount: number;
56
+ /** Prefilled so the buyer does not retype what the checkout already asked. */
57
+ email?: string | null;
58
+ /** Called with the token. Rejecting keeps the Brick mounted and its form filled. */
59
+ onSubmit: (result: CardBrickResult) => Promise<void>;
60
+ onError?: (message: string) => void;
61
+ }
62
+ export declare function CardBrick({ publicKey, amount, email, onSubmit, onError }: CardBrickProps): React.JSX.Element;
63
+ export {};
64
+ //# sourceMappingURL=CardBrick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardBrick.d.ts","sourceRoot":"","sources":["../../../src/components/checkout/CardBrick.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D;;;;;;;;;;;;;;;GAeG;AAEH;wEACwE;AACxE,UAAU,aAAa;IACrB,MAAM,CACJ,KAAK,EAAE,aAAa,EACpB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,CAAC,CAAA;CACpC;AACD,UAAU,cAAc;IACtB,MAAM,IAAI,aAAa,CAAA;CACxB;AACD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,EAAE,KAAK,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,KAAK,cAAc,CAAA;KACvF;CACF;AAiBD,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7C;AAaD,0EAA0E;AAC1E,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAI/C;AA+BD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAA;CAClD;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAA;IACd,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,oFAAoF;IACpF,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,cAAc,qBA4GxF"}
@@ -1,17 +1,41 @@
1
1
  import React from 'react';
2
2
  import type { CheckoutSessionInput } from '@fayz-ai/shop/types';
3
+ /** O adquirente guardado para ESTA sessão, se for a mesma que voltou. */
4
+ export declare function recallSessionProvider(sessionId: string): string | null;
3
5
  export interface CheckoutPaymentProps {
4
6
  input: CheckoutSessionInput;
5
7
  /** Chamado uma vez, com o pedido que o servidor criou. */
6
8
  onPaid: (orderId: string) => void;
7
9
  onBack: () => void;
8
10
  money: (value: number) => string;
11
+ /**
12
+ * Uma sessão que JÁ existe, para retomar em vez de abrir outra.
13
+ *
14
+ * É o comprador voltando da página do adquirente depois de pagar com cartão:
15
+ * a página recarregou do zero, o formulário e o passo se perderam, e a única
16
+ * coisa que sobrevive é o id que veio na URL. Com ele a tela não abre cobrança
17
+ * nenhuma — só pergunta se o dinheiro entrou.
18
+ */
19
+ resume?: {
20
+ sessionId: string;
21
+ provider?: string | null;
22
+ chargeToken?: string | null;
23
+ } | null;
9
24
  /**
10
25
  * A loja não tem adquirente — não é um erro do comprador, e ele não pode
11
26
  * fazer nada a respeito. Quem sabe disso é o servidor, então em vez de pintar
12
27
  * um erro na tela avisamos o checkout para oferecer o pedido sem cobrança.
13
28
  */
14
29
  onUnavailable?: () => void;
30
+ /**
31
+ * The cart total as the page already shows it.
32
+ *
33
+ * Only an in-store card form needs it: that mounts before any charge exists,
34
+ * and the acquirer's SDK prices installments from the amount it was created
35
+ * with. Every other flow learns the total from the opened session, which is
36
+ * the figure the server will actually charge.
37
+ */
38
+ amount?: number;
15
39
  }
16
- export declare function CheckoutPayment({ input, onPaid, onBack, money, onUnavailable }: CheckoutPaymentProps): React.JSX.Element;
40
+ export declare function CheckoutPayment({ input, onPaid, onBack, money, onUnavailable, resume, amount }: CheckoutPaymentProps): React.JSX.Element;
17
41
  //# sourceMappingURL=CheckoutPayment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CheckoutPayment.d.ts","sourceRoot":"","sources":["../../../src/components/checkout/CheckoutPayment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAGvE,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,qBAAqB,CAAA;AAsB9E,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,oBAAoB,CAAA;IAC3B,0DAA0D;IAC1D,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAChC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;CAC3B;AAID,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,oBAAoB,qBAmPpG"}
1
+ {"version":3,"file":"CheckoutPayment.d.ts","sourceRoot":"","sources":["../../../src/components/checkout/CheckoutPayment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAKvE,OAAO,KAAK,EAAE,oBAAoB,EAAiB,MAAM,qBAAqB,CAAA;AAkH9E,yEAAyE;AACzE,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOtE;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,oBAAoB,CAAA;IAC3B,0DAA0D;IAC1D,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAChC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAA;IAC5F;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,oBAAoB,qBA4hBpH"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-checkout.d.ts","sourceRoot":"","sources":["../../src/hooks/use-checkout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAYlF,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAE9B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,0BAA0B,CAAA;IACpC,OAAO,CAAC,EAAE,yBAAyB,CAAA;IACnC,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,OAAO,EAAE,OAAO,CAAA;IAChB,iGAAiG;IACjG,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAA;CACtF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,WAAW,CAqDzC"}
1
+ {"version":3,"file":"use-checkout.d.ts","sourceRoot":"","sources":["../../src/hooks/use-checkout.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAYlF,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,uBAAuB,CAAA;AAE9B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,0BAA0B,CAAA;IACpC,OAAO,CAAC,EAAE,yBAAyB,CAAA;IACnC,eAAe,CAAC,EAAE,oBAAoB,CAAA;IACtC,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,yFAAyF;IACzF,OAAO,EAAE,OAAO,CAAA;IAChB,iGAAiG;IACjG,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,cAAc,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAA;CACtF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,WAAW,CAyDzC"}
@@ -1,6 +1,8 @@
1
1
  export interface DiscountValidation {
2
2
  valid: boolean;
3
3
  percent: number;
4
+ /** The coupon zeroes freight instead of discounting the subtotal. */
5
+ freeShipping?: boolean;
4
6
  message?: string;
5
7
  }
6
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-discount-validator.d.ts","sourceRoot":"","sources":["../../src/hooks/use-discount-validator.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AA0BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAoDpF"}
1
+ {"version":3,"file":"use-discount-validator.d.ts","sourceRoot":"","sources":["../../src/hooks/use-discount-validator.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,qEAAqE;IACrE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAgCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAkEpF"}
@@ -0,0 +1,26 @@
1
+ import type { ShippingAddressInput } from '@fayz-ai/shop/types';
2
+ /**
3
+ * What the store already knows about the person filling this checkout in.
4
+ *
5
+ * A signed-in buyer typed their CPF, their phone and their address the last time
6
+ * they bought something, and every one of those is stored: the document and the
7
+ * phone on their customer row, the address frozen on the order. Asking again is
8
+ * asking someone to prove twice that they are themselves — and the CPF is the
9
+ * field AbacatePay needs to create a client at all, so a blank one is also a
10
+ * charge with no customer attached to it.
11
+ *
12
+ * Two sources because they are two different facts. The document belongs to the
13
+ * PERSON and lives on the customer row; the address belongs to an ORDER and is
14
+ * whatever they last shipped to. Reading the customer row is allowed by the
15
+ * `plg_shop_customers_self_read` policy (`auth_user_id = auth.uid()`), so this
16
+ * needs no new endpoint and no new grant — a guest simply resolves to nothing.
17
+ */
18
+ export interface KnownCustomer {
19
+ phone: string | null;
20
+ document: string | null;
21
+ address: ShippingAddressInput | null;
22
+ /** False until both lookups have settled, so a prefill never races typing. */
23
+ ready: boolean;
24
+ }
25
+ export declare function useKnownCustomer(): KnownCustomer;
26
+ //# sourceMappingURL=use-known-customer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-known-customer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-known-customer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAS,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAItE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAA;IACpC,8EAA8E;IAC9E,KAAK,EAAE,OAAO,CAAA;CACf;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAoChD"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-shipping.d.ts","sourceRoot":"","sources":["../../src/hooks/use-shipping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAI9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,cAAc,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,mBAAmB,EAAE,CAAA;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAA;IACZ;8EAC0E;IAC1E,gBAAgB,EAAE,OAAO,CAAA;IACzB,mEAAmE;IACnE,IAAI,EAAE,OAAO,CAAA;IACb,2FAA2F;IAC3F,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,WAAW,CAwBzC"}
1
+ {"version":3,"file":"use-shipping.d.ts","sourceRoot":"","sources":["../../src/hooks/use-shipping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAI9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,cAAc,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,mBAAmB,EAAE,CAAA;IAC9B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAA;IACZ;8EAC0E;IAC1E,gBAAgB,EAAE,OAAO,CAAA;IACzB,mEAAmE;IACnE,IAAI,EAAE,OAAO,CAAA;IACb,2FAA2F;IAC3F,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,IAAI,WAAW,CAyBzC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { STORE_SECTION_NAMES, isRecord, STORE_SECTIONS, slugifyStoreName, exportStore, resolveConfig, initStorefrontRuntime, StorefrontConfigHost, StorefrontShell, validateStore, isJsonValue, registerStorefrontBlocks, registerStorefrontExtensionPoints, sectionToJsonSchema, STOREFRONT_PAGE_KINDS, STOREFRONT_COMPONENT_KEYS, STOREFRONT_SLOTS, useStorefrontConfig, useCatalogStore, formatMoney, useCartStore, useSessionStore, selectTotal, selectShipping, selectDiscountTotal, selectSubtotal, selectCount, placeStorefrontOrder, useDeliveryStore, selectRequiresShipping, isNestedBlockRef, BLOCK_STRUCTURAL_KEYS, StorefrontPage, hydrateStoreDocument, blockInstanceId } from './chunk-GS7TDBF5.js';
2
- export { BEFORE_PLACE_ORDER_VALVE, BenefitsRow, BlockDataError, CART_LINE_ANNOTATION_POINT, CATALOG_BODY_BLOCK, CHECKOUT_FIELD_POINT, CartDrawer, CatalogPage, CategoryShowcase, CheckoutPage, CollectionCta, CollectionHero, ContentPage, CountdownBand, EmailConfirmationRequiredError, EntityListBlock, FaqSection, FiltersPanel, FormBlock, HeroSection, ImageTiles, Link, ManifestoBlock, MediaCarousel, MotifStrip, MyPurchasesPage, NewsletterBand, ORDER_METADATA_POINT, OrderConfirmationPage, OrderTrackingTimeline, PAGE_DATA_SCRIPT_ID, PLACEHOLDER_ASPECTS, PRODUCT_BODY_BLOCK, PRODUCT_CARD_BADGE_POINT, PageDataScope, PaymentTerms, Price, ProductCard, ProductDetailPage, ProductEnquiryForm, ProductGallery, ProductGrid, ProductOptionSelector, ProductRail, ProductReviews, ProductSlider, ProductSpecs, ProductSpotlight, PromoBanner, QuantityInput, Reveal, STOREFRONT_COMPONENT_KEYS, STOREFRONT_PAGE_KINDS, STOREFRONT_SLOTS, STORE_BACKEND_PROVIDERS, STORE_COMMERCE_MODES, STORE_DOCUMENT_KIND, STORE_PAYMENT_METHOD_KINDS, STORE_PAYMENT_MODES, STORE_ROUTE_CHROMES, STORE_ROUTE_KINDS, STORE_SECTIONS, STORE_SECTION_NAMES, SealsBand, SearchOverlay, Slot, SmoothImage, StepsSection, StorefrontConfigHost, StorefrontConfigProvider, StorefrontFooter, StorefrontHeader, StorefrontPage, StorefrontRouterProvider, StorefrontShell, StorefrontThemeStyle, StoryQuote, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX, TID, Testimonials, TierCards, applyStoreSettings, bannerPlaceholder, buildEnquiryFromForm, checkPageBlocks, collectDataNeeds, collectOrderMetadata, contentPagePath, createStorefront, createStorefrontApp, currentStaticRenderPass, defaultPageBlocks, entityListBlockMeta, establishCustomerSession, exportStore, formatMoney, formatProductOptionSelection, getCartLineAnnotations, getCheckoutFieldContributions, getCustomerAuthAdapter, getProductCardBadges, getProductOptionGroups, hydrateStoreDocument, hydratedEntriesFor, initStorefrontRuntime, isKnownPath, isPublicPath, listSlots, matchContentPage, matchPath, matchesFacets, mergeCollectionFacet, mergePageTheme, navigateTo, nextMilestone, normalizeProductOptionSelection, orderGalleryImages, overrideComponent, overrideProps, pageSeo, pageThemeSelector, pickProductCardImage, placeStorefrontOrder, prefersReducedMotion, primaryImageUrl, productCardComponentContract, productJsonLd, productOptionSelectionKey, productPlaceholder, productSeo, readHydratedPageData, registerStorefrontBlocks, registerStorefrontEntities, registerStorefrontExtensionPoints, registerStorefrontLoaders, resetPageDiagnostics, resetProductOptionsDeprecationWarnings, resetStorefrontExtensionPoints, resolveAuthAdapter, resolveConfig, resolveDataParams, resolveOverride, resolvePageData, resolvePageDataNeed, resolvePaymentTerms, resolveStorefrontProvider, resolveStorefrontRoute, resolveVariantForSelection, roundCents, routePathParams, runBeforePlaceOrderValve, sectionToJsonSchema, sectionsToBlocks, selectCount, selectDiscountTotal, selectShipping, selectSubtotal, selectTotal, selectionPrice, serializePageData, shellRouterAdapter, signInByEmail, signOutCustomer, signUpCustomer, slugifyStoreName, storefrontComponentContracts, storefrontPaths, themeToCss, toBlockNodes, toFacetMap, useBlockData, useCartStore, useCatalogStore, useCategories, useDiscountValidator, useEnquiry, useHashPath, useInView, useLoader, useMyOrders, useNavigate, usePopOnChange, useProduct, useProducts, useRoutePath, useRouterAdapter, useScrollToTopOnNavigate, useScrolled, useSessionStore, useSlotContext, useStorefrontActions, useStorefrontConfig, useStorefrontConfigOptional, useStorefrontHead, useStorefrontPage, useStorefrontPageOptional, usedSlots, validateStore, withFacet, withStaticRenderPass } from './chunk-GS7TDBF5.js';
1
+ import { STORE_SECTION_NAMES, isRecord, STORE_SECTIONS, slugifyStoreName, exportStore, resolveConfig, initStorefrontRuntime, StorefrontConfigHost, StorefrontShell, validateStore, isJsonValue, registerStorefrontBlocks, registerStorefrontExtensionPoints, sectionToJsonSchema, STOREFRONT_PAGE_KINDS, STOREFRONT_COMPONENT_KEYS, STOREFRONT_SLOTS, useStorefrontConfig, useCatalogStore, formatMoney, useCartStore, useSessionStore, selectTotal, selectShipping, selectDiscountTotal, selectSubtotal, selectCount, placeStorefrontOrder, useDeliveryStore, selectRequiresShipping, isNestedBlockRef, BLOCK_STRUCTURAL_KEYS, StorefrontPage, hydrateStoreDocument, blockInstanceId } from './chunk-STL6MATQ.js';
2
+ export { BEFORE_PLACE_ORDER_VALVE, BenefitsRow, BlockDataError, CART_LINE_ANNOTATION_POINT, CATALOG_BODY_BLOCK, CHECKOUT_FIELD_POINT, CartDrawer, CatalogPage, CategoryShowcase, CheckoutPage, CollectionCta, CollectionHero, ContentPage, CountdownBand, EmailConfirmationRequiredError, EntityListBlock, FaqSection, FiltersPanel, FormBlock, HeroSection, ImageTiles, Link, ManifestoBlock, MediaCarousel, MotifStrip, MyPurchasesPage, NewsletterBand, ORDER_METADATA_POINT, OrderConfirmationPage, OrderTrackingTimeline, PAGE_DATA_SCRIPT_ID, PLACEHOLDER_ASPECTS, PRODUCT_BODY_BLOCK, PRODUCT_CARD_BADGE_POINT, PageDataScope, PaymentTerms, Price, ProductCard, ProductDetailPage, ProductEnquiryForm, ProductGallery, ProductGrid, ProductOptionSelector, ProductRail, ProductReviews, ProductSlider, ProductSpecs, ProductSpotlight, PromoBanner, QuantityInput, Reveal, STOREFRONT_COMPONENT_KEYS, STOREFRONT_PAGE_KINDS, STOREFRONT_SLOTS, STORE_BACKEND_PROVIDERS, STORE_COMMERCE_MODES, STORE_DOCUMENT_KIND, STORE_PAYMENT_METHOD_KINDS, STORE_PAYMENT_MODES, STORE_ROUTE_CHROMES, STORE_ROUTE_KINDS, STORE_SECTIONS, STORE_SECTION_NAMES, SealsBand, SearchOverlay, Slot, SmoothImage, StepsSection, StorefrontConfigHost, StorefrontConfigProvider, StorefrontFooter, StorefrontHeader, StorefrontPage, StorefrontRouterProvider, StorefrontShell, StorefrontThemeStyle, StoryQuote, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX, TID, Testimonials, TierCards, applyStoreSettings, bannerPlaceholder, buildEnquiryFromForm, checkPageBlocks, collectDataNeeds, collectOrderMetadata, contentPagePath, createStorefront, createStorefrontApp, currentStaticRenderPass, defaultPageBlocks, entityListBlockMeta, establishCustomerSession, exportStore, formatMoney, formatProductOptionSelection, getCartLineAnnotations, getCheckoutFieldContributions, getCustomerAuthAdapter, getProductCardBadges, getProductOptionGroups, hydrateStoreDocument, hydratedEntriesFor, initStorefrontRuntime, isKnownPath, isPublicPath, listSlots, matchContentPage, matchPath, matchesFacets, mergeCollectionFacet, mergePageTheme, navigateTo, nextMilestone, normalizeProductOptionSelection, orderGalleryImages, overrideComponent, overrideProps, pageSeo, pageThemeSelector, pickProductCardImage, placeStorefrontOrder, prefersReducedMotion, primaryImageUrl, productCardComponentContract, productJsonLd, productOptionSelectionKey, productPlaceholder, productSeo, readHydratedPageData, registerStorefrontBlocks, registerStorefrontEntities, registerStorefrontExtensionPoints, registerStorefrontLoaders, resetPageDiagnostics, resetProductOptionsDeprecationWarnings, resetStorefrontExtensionPoints, resolveAuthAdapter, resolveConfig, resolveDataParams, resolveOverride, resolvePageData, resolvePageDataNeed, resolvePaymentTerms, resolveStorefrontProvider, resolveStorefrontRoute, resolveVariantForSelection, roundCents, routePathParams, runBeforePlaceOrderValve, sectionToJsonSchema, sectionsToBlocks, selectCount, selectDiscountTotal, selectShipping, selectSubtotal, selectTotal, selectionPrice, serializePageData, shellRouterAdapter, signInByEmail, signOutCustomer, signUpCustomer, slugifyStoreName, storefrontComponentContracts, storefrontPaths, themeToCss, toBlockNodes, toFacetMap, useBlockData, useCartStore, useCatalogStore, useCategories, useDiscountValidator, useEnquiry, useHashPath, useInView, useLoader, useMyOrders, useNavigate, usePopOnChange, useProduct, useProducts, useRoutePath, useRouterAdapter, useScrollToTopOnNavigate, useScrolled, useSessionStore, useSlotContext, useStorefrontActions, useStorefrontConfig, useStorefrontConfigOptional, useStorefrontHead, useStorefrontPage, useStorefrontPageOptional, usedSlots, validateStore, withFacet, withStaticRenderPass } from './chunk-STL6MATQ.js';
3
3
  export { auditStorefrontSeo, collectSeoAuditInput } from './chunk-6IXTENLB.js';
4
4
  import React3 from 'react';
5
5
  import { defineApp, registerScaffold, describeExtensionPoints, handleRegistry, describeEntities, describeLoaders, describeBlocks, ENTITY_FIELD_TYPES, BLOCK_SETTING_TYPES, normalizePostalCode, lookupPostalCode, formatPostalCode, BLOCK_PATH_ATTRIBUTE, BLOCK_TYPE_ATTRIBUTE, setBlockEditorMode, renderApp as renderApp$1 } from '@fayz-ai/core';
@@ -1001,8 +1001,11 @@ function useCheckout() {
1001
1001
  count: selectCount({ lines }),
1002
1002
  subtotal: selectSubtotal({ lines }),
1003
1003
  discountTotal: selectDiscountTotal({ lines, discountPercent: cart.discountPercent }),
1004
- shipping: selectShipping({ lines }, config),
1005
- total: selectTotal({ lines, discountPercent: cart.discountPercent }, config)
1004
+ shipping: selectShipping({ lines, discountFreeShipping: cart.discountFreeShipping }, config),
1005
+ total: selectTotal(
1006
+ { lines, discountPercent: cart.discountPercent, discountFreeShipping: cart.discountFreeShipping },
1007
+ config
1008
+ )
1006
1009
  };
1007
1010
  const placeOrder = React3.useCallback(
1008
1011
  async (input) => {
@@ -1016,7 +1019,8 @@ function useCheckout() {
1016
1019
  cart: {
1017
1020
  lines: useCartStore.getState().lines,
1018
1021
  discountCode: useCartStore.getState().discountCode,
1019
- discountPercent: useCartStore.getState().discountPercent
1022
+ discountPercent: useCartStore.getState().discountPercent,
1023
+ discountFreeShipping: useCartStore.getState().discountFreeShipping
1020
1024
  },
1021
1025
  session: { customerId: session.customerId, email: session.email },
1022
1026
  ...input
@@ -1056,9 +1060,10 @@ function usePaymentMethods() {
1056
1060
  function useShipping() {
1057
1061
  const config = useStorefrontConfig();
1058
1062
  const lines = useCartStore((state) => state.lines);
1063
+ const freeShipping = useCartStore((state) => state.discountFreeShipping);
1059
1064
  const delivery = useDeliveryStore();
1060
1065
  const subtotal = selectSubtotal({ lines });
1061
- const rate = selectShipping({ lines }, config);
1066
+ const rate = selectShipping({ lines, discountFreeShipping: freeShipping }, config);
1062
1067
  const threshold = config.shipping.freeAbove ?? null;
1063
1068
  return {
1064
1069
  postalCode: delivery.postalCode,