@reblu/site-blocks 0.12.0 → 0.13.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/CHANGELOG.md +55 -0
- package/README.md +85 -0
- package/dist/index.cjs +343 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +145 -9
- package/dist/index.d.ts +145 -9
- package/dist/index.js +335 -29
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
1
|
+
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
|
|
2
2
|
import { FaqItem } from './seo.cjs';
|
|
3
3
|
export { FaqPageJsonLd, buildFaqPageJsonLd, collectFaqItems } from './seo.cjs';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -752,13 +752,20 @@ declare function AddedToCartToast({ status, productName, quantity, imageUrl, car
|
|
|
752
752
|
/**
|
|
753
753
|
* `CheckoutLoginPrompt` — the "login prompt hook" the checkout flow needs
|
|
754
754
|
* (REB-829): a guest-checkout identification dialog offering "continue with
|
|
755
|
-
* this email"
|
|
756
|
-
*
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
755
|
+
* this email" or "continue as guest" outright. Fully controlled/presentational
|
|
756
|
+
* — it performs NO fetch itself; the consuming SITE owns `email` state and
|
|
757
|
+
* decides what `onSubmitEmail` does.
|
|
758
|
+
*
|
|
759
|
+
* Never reveal whether an account exists (REB-834). Do NOT wire
|
|
760
|
+
* `onSubmitEmail` to `client.shop.checkEmail` (deprecated, it always answers
|
|
761
|
+
* `{ exists: false }`) or build any UI on an `exists` answer. Treat both
|
|
762
|
+
* actions the same way for every email: `onSubmitEmail` carries the typed
|
|
763
|
+
* email into the checkout (or into the SITE's own login page), and
|
|
764
|
+
* `onContinueAsGuest` proceeds without it. If a guest's email belongs to an
|
|
765
|
+
* account, the server links the order to it after payment — the browser is
|
|
766
|
+
* never told before. `checking`/`error` remain for a SITE's own synchronous
|
|
767
|
+
* work (e.g. saving the email to its checkout state); leave them unset
|
|
768
|
+
* otherwise.
|
|
762
769
|
*/
|
|
763
770
|
interface CheckoutLoginPromptLabels {
|
|
764
771
|
title: string;
|
|
@@ -793,6 +800,13 @@ declare function CheckoutLoginPrompt({ open, email, onEmailChange, onClose, onSu
|
|
|
793
800
|
* dependency surface minimal); the consuming SITE owns validation and wires
|
|
794
801
|
* its own `onSubmit`.
|
|
795
802
|
*
|
|
803
|
+
* Account handling (REB-834): render the same form for every email. The
|
|
804
|
+
* `loginPrompt` slot is a static «Iniciar sesión o continuar como invitado»
|
|
805
|
+
* offer — never a branch on whether the typed email has an account (the
|
|
806
|
+
* deprecated `client.shop.checkEmail` always answers `{ exists: false }`). If
|
|
807
|
+
* a guest's email belongs to an account, the server links the order to it
|
|
808
|
+
* after payment.
|
|
809
|
+
*
|
|
796
810
|
* Scope note: shipping/billing address collection is intentionally OUT of
|
|
797
811
|
* this component — those field sets vary by tenant shop config (shipping
|
|
798
812
|
* enabled/disabled, invoicing requirements) far more than the guest-email +
|
|
@@ -908,6 +922,10 @@ interface OrderConfirmationLabels {
|
|
|
908
922
|
errorDescription: string;
|
|
909
923
|
/** REB-837 review fix — label for the neutral order-number-only reference shown on refunded/pending_timeout. */
|
|
910
924
|
orderReferenceLabel: string;
|
|
925
|
+
/** REB-73 — the invoice link text; `{number}` is replaced by the invoice number. */
|
|
926
|
+
invoiceLinkLabel: string;
|
|
927
|
+
/** REB-73 — the line under the invoice link. */
|
|
928
|
+
invoiceSignInHint: string;
|
|
911
929
|
}
|
|
912
930
|
interface OrderConfirmationProps {
|
|
913
931
|
status: OrderConfirmationStatus;
|
|
@@ -925,4 +943,122 @@ interface OrderConfirmationProps {
|
|
|
925
943
|
}
|
|
926
944
|
declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
927
945
|
|
|
928
|
-
|
|
946
|
+
/**
|
|
947
|
+
* `FullInvoiceFields` — the shop checkout's full-invoice request, drop-in
|
|
948
|
+
* (REB-73). Fully controlled (`value`/`onChange`), no hooks, no fetch: the
|
|
949
|
+
* SITE owns the state and sends `toCheckoutInvoiceFields(value, overCap)`
|
|
950
|
+
* with its checkout body.
|
|
951
|
+
*
|
|
952
|
+
* The rule it presents (owner decision 15-Oct-2026): «Si quieren factura
|
|
953
|
+
* completa, si o si deben aportar el NIF, si no lo aportan se emite factura
|
|
954
|
+
* simplificada». The identifier is a Spanish NIF/NIE/CIF or, for a foreign
|
|
955
|
+
* buyer, an EU VAT id, a passport or an ID document of their country — with
|
|
956
|
+
* the country that issued it. Over the shop's simplified-invoice cap
|
|
957
|
+
* (`ShopConfig.simplifiedInvoiceCapCents`, see `isOverSimplifiedInvoiceCap`)
|
|
958
|
+
* a full invoice is the only legal one: pass `overCap` and the fields become
|
|
959
|
+
* required, without a toggle. The server validates the identifier and
|
|
960
|
+
* refuses with `BILLING_DATA_REQUIRED` what this form cannot prevent.
|
|
961
|
+
*
|
|
962
|
+
* A shop that issues no invoices (`ShopConfig.simplifiedInvoiceCapCents` is
|
|
963
|
+
* `null`, see `shopIssuesInvoices`) offers no opt-in: pass
|
|
964
|
+
* `issuesInvoices={false}` and the block renders nothing — the server would
|
|
965
|
+
* refuse `wantsFullInvoice: true` with `FULL_INVOICE_UNAVAILABLE`.
|
|
966
|
+
*/
|
|
967
|
+
type FullInvoiceIdType = NonNullable<ShopBillingInput['billingIdType']>;
|
|
968
|
+
interface FullInvoiceValue {
|
|
969
|
+
wantsFullInvoice: boolean;
|
|
970
|
+
billingIdType: FullInvoiceIdType;
|
|
971
|
+
/** ISO 3166-1 alpha-2 country that issued a foreign document. */
|
|
972
|
+
billingIdCountry: string;
|
|
973
|
+
billingNif: string;
|
|
974
|
+
billingName: string;
|
|
975
|
+
street: string;
|
|
976
|
+
postalCode: string;
|
|
977
|
+
city: string;
|
|
978
|
+
/** ISO 3166-1 alpha-2 country of the billing address. */
|
|
979
|
+
country: string;
|
|
980
|
+
}
|
|
981
|
+
declare const EMPTY_FULL_INVOICE_VALUE: FullInvoiceValue;
|
|
982
|
+
type FullInvoiceErrors = Partial<Record<'billingIdType' | 'billingIdCountry' | 'billingNif' | 'billingName' | 'address', string>>;
|
|
983
|
+
interface FullInvoiceFieldsLabels {
|
|
984
|
+
toggle: string;
|
|
985
|
+
underCapNotice: string;
|
|
986
|
+
overCapNotice: string;
|
|
987
|
+
idType: string;
|
|
988
|
+
idCountry: string;
|
|
989
|
+
chooseCountry: string;
|
|
990
|
+
spanishNif: string;
|
|
991
|
+
documentNumber: string;
|
|
992
|
+
name: string;
|
|
993
|
+
street: string;
|
|
994
|
+
postalCode: string;
|
|
995
|
+
city: string;
|
|
996
|
+
country: string;
|
|
997
|
+
idTypeOptions: Record<FullInvoiceIdType, string>;
|
|
998
|
+
}
|
|
999
|
+
/** ISO 3166-1 alpha-2 countries offered by default: Spain, the EU and frequent others. */
|
|
1000
|
+
declare const DEFAULT_INVOICE_COUNTRIES: ReadonlyArray<{
|
|
1001
|
+
code: string;
|
|
1002
|
+
name: string;
|
|
1003
|
+
}>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Whether the shop issues invoices at all, read from the field the contract
|
|
1006
|
+
* defines for it: `ShopConfig.simplifiedInvoiceCapCents` is the effective cap
|
|
1007
|
+
* while invoicing is on and `null` otherwise (absent on an older base-api,
|
|
1008
|
+
* which accepts no opt-in either).
|
|
1009
|
+
*/
|
|
1010
|
+
declare function shopIssuesInvoices(config: {
|
|
1011
|
+
simplifiedInvoiceCapCents?: number | null;
|
|
1012
|
+
}): boolean;
|
|
1013
|
+
/** Whether a cart total (cents) is over the shop's simplified-invoice cap; `null` cap = no gate. */
|
|
1014
|
+
declare function isOverSimplifiedInvoiceCap(totalCents: number, capCents: number | null): boolean;
|
|
1015
|
+
/**
|
|
1016
|
+
* The checkout body fields for the request: `wantsFullInvoice` and the
|
|
1017
|
+
* `billing` block (identifier, its type and country, name and address). Empty
|
|
1018
|
+
* when the buyer asks for no full invoice within the cap, and always empty
|
|
1019
|
+
* when the shop issues no invoices (`issuesInvoices` false).
|
|
1020
|
+
*/
|
|
1021
|
+
declare function toCheckoutInvoiceFields(value: FullInvoiceValue, overCap: boolean, issuesInvoices?: boolean): Pick<ShopCheckoutInput, 'wantsFullInvoice' | 'billing'>;
|
|
1022
|
+
interface FullInvoiceFieldsProps {
|
|
1023
|
+
value: FullInvoiceValue;
|
|
1024
|
+
onChange: (next: FullInvoiceValue) => void;
|
|
1025
|
+
/** The cart total is over `ShopConfig.simplifiedInvoiceCapCents`. */
|
|
1026
|
+
overCap: boolean;
|
|
1027
|
+
/**
|
|
1028
|
+
* `false` when the shop issues no invoices (`shopIssuesInvoices(config)`):
|
|
1029
|
+
* the block renders nothing. Defaults to `true`.
|
|
1030
|
+
*/
|
|
1031
|
+
issuesInvoices?: boolean;
|
|
1032
|
+
errors?: FullInvoiceErrors;
|
|
1033
|
+
countries?: ReadonlyArray<{
|
|
1034
|
+
code: string;
|
|
1035
|
+
name: string;
|
|
1036
|
+
}>;
|
|
1037
|
+
labels?: Partial<FullInvoiceFieldsLabels>;
|
|
1038
|
+
className?: string;
|
|
1039
|
+
}
|
|
1040
|
+
declare function FullInvoiceFields({ value, onChange, overCap, issuesInvoices, errors, countries, labels, className, }: FullInvoiceFieldsProps): react_jsx_runtime.JSX.Element | null;
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* `OrderInvoiceLink` — the sale invoice of an order, drop-in (REB-73). Pure
|
|
1044
|
+
* data in, RSC-safe (no hooks). Pass `order.invoice` from the order lookup
|
|
1045
|
+
* (`client.shop.order(sessionId)` / `useShopOrderStatus`): once the invoice
|
|
1046
|
+
* is issued it carries `{ number, url }`, where `url` is the tenant's
|
|
1047
|
+
* AUTHENTICATED portal route — the buyer signs in to open it, so the link
|
|
1048
|
+
* never expires and is safe to show. Renders nothing while there is none.
|
|
1049
|
+
* `OrderConfirmation` already renders it for a confirmed order.
|
|
1050
|
+
*/
|
|
1051
|
+
interface OrderInvoiceLinkLabels {
|
|
1052
|
+
/** The link text; `{number}` is replaced by the invoice number. */
|
|
1053
|
+
linkLabel: string;
|
|
1054
|
+
/** The line under the link. */
|
|
1055
|
+
signInHint: string;
|
|
1056
|
+
}
|
|
1057
|
+
interface OrderInvoiceLinkProps {
|
|
1058
|
+
invoice: ShopOrderInvoice | null | undefined;
|
|
1059
|
+
labels?: Partial<OrderInvoiceLinkLabels>;
|
|
1060
|
+
className?: string;
|
|
1061
|
+
}
|
|
1062
|
+
declare function OrderInvoiceLink({ invoice, labels, className }: OrderInvoiceLinkProps): react_jsx_runtime.JSX.Element | null;
|
|
1063
|
+
|
|
1064
|
+
export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartLineItemView, CartLineList, type CartLineListLabels, type CartLineListProps, CartSummary, type CartSummaryLabels, type CartSummaryProps, type CheckoutAppliedDiscount, type CheckoutContactErrors, type CheckoutContactValues, CheckoutForm, type CheckoutFormLabels, type CheckoutFormProps, CheckoutLoginPrompt, type CheckoutLoginPromptLabels, type CheckoutLoginPromptProps, DEFAULT_INVOICE_COUNTRIES, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, DEFAULT_TRUST_ICONS, EMPTY_FULL_INVOICE_VALUE, FaqAccordion, type FaqAccordionProps, FaqItem, type FullInvoiceErrors, FullInvoiceFields, type FullInvoiceFieldsLabels, type FullInvoiceFieldsProps, type FullInvoiceIdType, type FullInvoiceValue, type HeadingLevel, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, OrderInvoiceLink, type OrderInvoiceLinkLabels, type OrderInvoiceLinkProps, PageBlocks, type PageBlocksComponents, type PageBlocksProps, PageCardGrid, type PageCardGridProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProductTrustItems, type ProductTrustItemsProps, ProfileCard, type ProfileCardProps, type RenderableBlock, SafeHtml, type SafeHtmlProps, type ShareUrls, type ShopFilterPriceBand, ShopFilters, type ShopFiltersActive, type ShopFiltersHrefs, type ShopFiltersLabels, type ShopFiltersProps, Specialty, type SpecialtyProps, Treatment, type TreatmentProps, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, isOverSimplifiedInvoiceCap, markdownToSafeHtml, readingTime, sanitizeHtml, shopIssuesInvoices, shouldRenderShopFilters, toCheckoutInvoiceFields };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder } from '@reblu/site-contracts';
|
|
1
|
+
import { ShopErrorCode, PageDetail, PageListItem, ShopProductListItem, ShopProductTrustIcon, ShopProductTrustItem, BlockType, PageBlock, ResolvedEmbed, ShopFacets, ShopOrder, ShopBillingInput, ShopCheckoutInput, ShopOrderInvoice } from '@reblu/site-contracts';
|
|
2
2
|
import { FaqItem } from './seo.js';
|
|
3
3
|
export { FaqPageJsonLd, buildFaqPageJsonLd, collectFaqItems } from './seo.js';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -752,13 +752,20 @@ declare function AddedToCartToast({ status, productName, quantity, imageUrl, car
|
|
|
752
752
|
/**
|
|
753
753
|
* `CheckoutLoginPrompt` — the "login prompt hook" the checkout flow needs
|
|
754
754
|
* (REB-829): a guest-checkout identification dialog offering "continue with
|
|
755
|
-
* this email"
|
|
756
|
-
*
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
*
|
|
760
|
-
*
|
|
761
|
-
*
|
|
755
|
+
* this email" or "continue as guest" outright. Fully controlled/presentational
|
|
756
|
+
* — it performs NO fetch itself; the consuming SITE owns `email` state and
|
|
757
|
+
* decides what `onSubmitEmail` does.
|
|
758
|
+
*
|
|
759
|
+
* Never reveal whether an account exists (REB-834). Do NOT wire
|
|
760
|
+
* `onSubmitEmail` to `client.shop.checkEmail` (deprecated, it always answers
|
|
761
|
+
* `{ exists: false }`) or build any UI on an `exists` answer. Treat both
|
|
762
|
+
* actions the same way for every email: `onSubmitEmail` carries the typed
|
|
763
|
+
* email into the checkout (or into the SITE's own login page), and
|
|
764
|
+
* `onContinueAsGuest` proceeds without it. If a guest's email belongs to an
|
|
765
|
+
* account, the server links the order to it after payment — the browser is
|
|
766
|
+
* never told before. `checking`/`error` remain for a SITE's own synchronous
|
|
767
|
+
* work (e.g. saving the email to its checkout state); leave them unset
|
|
768
|
+
* otherwise.
|
|
762
769
|
*/
|
|
763
770
|
interface CheckoutLoginPromptLabels {
|
|
764
771
|
title: string;
|
|
@@ -793,6 +800,13 @@ declare function CheckoutLoginPrompt({ open, email, onEmailChange, onClose, onSu
|
|
|
793
800
|
* dependency surface minimal); the consuming SITE owns validation and wires
|
|
794
801
|
* its own `onSubmit`.
|
|
795
802
|
*
|
|
803
|
+
* Account handling (REB-834): render the same form for every email. The
|
|
804
|
+
* `loginPrompt` slot is a static «Iniciar sesión o continuar como invitado»
|
|
805
|
+
* offer — never a branch on whether the typed email has an account (the
|
|
806
|
+
* deprecated `client.shop.checkEmail` always answers `{ exists: false }`). If
|
|
807
|
+
* a guest's email belongs to an account, the server links the order to it
|
|
808
|
+
* after payment.
|
|
809
|
+
*
|
|
796
810
|
* Scope note: shipping/billing address collection is intentionally OUT of
|
|
797
811
|
* this component — those field sets vary by tenant shop config (shipping
|
|
798
812
|
* enabled/disabled, invoicing requirements) far more than the guest-email +
|
|
@@ -908,6 +922,10 @@ interface OrderConfirmationLabels {
|
|
|
908
922
|
errorDescription: string;
|
|
909
923
|
/** REB-837 review fix — label for the neutral order-number-only reference shown on refunded/pending_timeout. */
|
|
910
924
|
orderReferenceLabel: string;
|
|
925
|
+
/** REB-73 — the invoice link text; `{number}` is replaced by the invoice number. */
|
|
926
|
+
invoiceLinkLabel: string;
|
|
927
|
+
/** REB-73 — the line under the invoice link. */
|
|
928
|
+
invoiceSignInHint: string;
|
|
911
929
|
}
|
|
912
930
|
interface OrderConfirmationProps {
|
|
913
931
|
status: OrderConfirmationStatus;
|
|
@@ -925,4 +943,122 @@ interface OrderConfirmationProps {
|
|
|
925
943
|
}
|
|
926
944
|
declare function OrderConfirmation({ status, order, sessionId, cartHref, onRecheck, labels, currencyCode, locale, className, }: OrderConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
927
945
|
|
|
928
|
-
|
|
946
|
+
/**
|
|
947
|
+
* `FullInvoiceFields` — the shop checkout's full-invoice request, drop-in
|
|
948
|
+
* (REB-73). Fully controlled (`value`/`onChange`), no hooks, no fetch: the
|
|
949
|
+
* SITE owns the state and sends `toCheckoutInvoiceFields(value, overCap)`
|
|
950
|
+
* with its checkout body.
|
|
951
|
+
*
|
|
952
|
+
* The rule it presents (owner decision 15-Oct-2026): «Si quieren factura
|
|
953
|
+
* completa, si o si deben aportar el NIF, si no lo aportan se emite factura
|
|
954
|
+
* simplificada». The identifier is a Spanish NIF/NIE/CIF or, for a foreign
|
|
955
|
+
* buyer, an EU VAT id, a passport or an ID document of their country — with
|
|
956
|
+
* the country that issued it. Over the shop's simplified-invoice cap
|
|
957
|
+
* (`ShopConfig.simplifiedInvoiceCapCents`, see `isOverSimplifiedInvoiceCap`)
|
|
958
|
+
* a full invoice is the only legal one: pass `overCap` and the fields become
|
|
959
|
+
* required, without a toggle. The server validates the identifier and
|
|
960
|
+
* refuses with `BILLING_DATA_REQUIRED` what this form cannot prevent.
|
|
961
|
+
*
|
|
962
|
+
* A shop that issues no invoices (`ShopConfig.simplifiedInvoiceCapCents` is
|
|
963
|
+
* `null`, see `shopIssuesInvoices`) offers no opt-in: pass
|
|
964
|
+
* `issuesInvoices={false}` and the block renders nothing — the server would
|
|
965
|
+
* refuse `wantsFullInvoice: true` with `FULL_INVOICE_UNAVAILABLE`.
|
|
966
|
+
*/
|
|
967
|
+
type FullInvoiceIdType = NonNullable<ShopBillingInput['billingIdType']>;
|
|
968
|
+
interface FullInvoiceValue {
|
|
969
|
+
wantsFullInvoice: boolean;
|
|
970
|
+
billingIdType: FullInvoiceIdType;
|
|
971
|
+
/** ISO 3166-1 alpha-2 country that issued a foreign document. */
|
|
972
|
+
billingIdCountry: string;
|
|
973
|
+
billingNif: string;
|
|
974
|
+
billingName: string;
|
|
975
|
+
street: string;
|
|
976
|
+
postalCode: string;
|
|
977
|
+
city: string;
|
|
978
|
+
/** ISO 3166-1 alpha-2 country of the billing address. */
|
|
979
|
+
country: string;
|
|
980
|
+
}
|
|
981
|
+
declare const EMPTY_FULL_INVOICE_VALUE: FullInvoiceValue;
|
|
982
|
+
type FullInvoiceErrors = Partial<Record<'billingIdType' | 'billingIdCountry' | 'billingNif' | 'billingName' | 'address', string>>;
|
|
983
|
+
interface FullInvoiceFieldsLabels {
|
|
984
|
+
toggle: string;
|
|
985
|
+
underCapNotice: string;
|
|
986
|
+
overCapNotice: string;
|
|
987
|
+
idType: string;
|
|
988
|
+
idCountry: string;
|
|
989
|
+
chooseCountry: string;
|
|
990
|
+
spanishNif: string;
|
|
991
|
+
documentNumber: string;
|
|
992
|
+
name: string;
|
|
993
|
+
street: string;
|
|
994
|
+
postalCode: string;
|
|
995
|
+
city: string;
|
|
996
|
+
country: string;
|
|
997
|
+
idTypeOptions: Record<FullInvoiceIdType, string>;
|
|
998
|
+
}
|
|
999
|
+
/** ISO 3166-1 alpha-2 countries offered by default: Spain, the EU and frequent others. */
|
|
1000
|
+
declare const DEFAULT_INVOICE_COUNTRIES: ReadonlyArray<{
|
|
1001
|
+
code: string;
|
|
1002
|
+
name: string;
|
|
1003
|
+
}>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Whether the shop issues invoices at all, read from the field the contract
|
|
1006
|
+
* defines for it: `ShopConfig.simplifiedInvoiceCapCents` is the effective cap
|
|
1007
|
+
* while invoicing is on and `null` otherwise (absent on an older base-api,
|
|
1008
|
+
* which accepts no opt-in either).
|
|
1009
|
+
*/
|
|
1010
|
+
declare function shopIssuesInvoices(config: {
|
|
1011
|
+
simplifiedInvoiceCapCents?: number | null;
|
|
1012
|
+
}): boolean;
|
|
1013
|
+
/** Whether a cart total (cents) is over the shop's simplified-invoice cap; `null` cap = no gate. */
|
|
1014
|
+
declare function isOverSimplifiedInvoiceCap(totalCents: number, capCents: number | null): boolean;
|
|
1015
|
+
/**
|
|
1016
|
+
* The checkout body fields for the request: `wantsFullInvoice` and the
|
|
1017
|
+
* `billing` block (identifier, its type and country, name and address). Empty
|
|
1018
|
+
* when the buyer asks for no full invoice within the cap, and always empty
|
|
1019
|
+
* when the shop issues no invoices (`issuesInvoices` false).
|
|
1020
|
+
*/
|
|
1021
|
+
declare function toCheckoutInvoiceFields(value: FullInvoiceValue, overCap: boolean, issuesInvoices?: boolean): Pick<ShopCheckoutInput, 'wantsFullInvoice' | 'billing'>;
|
|
1022
|
+
interface FullInvoiceFieldsProps {
|
|
1023
|
+
value: FullInvoiceValue;
|
|
1024
|
+
onChange: (next: FullInvoiceValue) => void;
|
|
1025
|
+
/** The cart total is over `ShopConfig.simplifiedInvoiceCapCents`. */
|
|
1026
|
+
overCap: boolean;
|
|
1027
|
+
/**
|
|
1028
|
+
* `false` when the shop issues no invoices (`shopIssuesInvoices(config)`):
|
|
1029
|
+
* the block renders nothing. Defaults to `true`.
|
|
1030
|
+
*/
|
|
1031
|
+
issuesInvoices?: boolean;
|
|
1032
|
+
errors?: FullInvoiceErrors;
|
|
1033
|
+
countries?: ReadonlyArray<{
|
|
1034
|
+
code: string;
|
|
1035
|
+
name: string;
|
|
1036
|
+
}>;
|
|
1037
|
+
labels?: Partial<FullInvoiceFieldsLabels>;
|
|
1038
|
+
className?: string;
|
|
1039
|
+
}
|
|
1040
|
+
declare function FullInvoiceFields({ value, onChange, overCap, issuesInvoices, errors, countries, labels, className, }: FullInvoiceFieldsProps): react_jsx_runtime.JSX.Element | null;
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* `OrderInvoiceLink` — the sale invoice of an order, drop-in (REB-73). Pure
|
|
1044
|
+
* data in, RSC-safe (no hooks). Pass `order.invoice` from the order lookup
|
|
1045
|
+
* (`client.shop.order(sessionId)` / `useShopOrderStatus`): once the invoice
|
|
1046
|
+
* is issued it carries `{ number, url }`, where `url` is the tenant's
|
|
1047
|
+
* AUTHENTICATED portal route — the buyer signs in to open it, so the link
|
|
1048
|
+
* never expires and is safe to show. Renders nothing while there is none.
|
|
1049
|
+
* `OrderConfirmation` already renders it for a confirmed order.
|
|
1050
|
+
*/
|
|
1051
|
+
interface OrderInvoiceLinkLabels {
|
|
1052
|
+
/** The link text; `{number}` is replaced by the invoice number. */
|
|
1053
|
+
linkLabel: string;
|
|
1054
|
+
/** The line under the link. */
|
|
1055
|
+
signInHint: string;
|
|
1056
|
+
}
|
|
1057
|
+
interface OrderInvoiceLinkProps {
|
|
1058
|
+
invoice: ShopOrderInvoice | null | undefined;
|
|
1059
|
+
labels?: Partial<OrderInvoiceLinkLabels>;
|
|
1060
|
+
className?: string;
|
|
1061
|
+
}
|
|
1062
|
+
declare function OrderInvoiceLink({ invoice, labels, className }: OrderInvoiceLinkProps): react_jsx_runtime.JSX.Element | null;
|
|
1063
|
+
|
|
1064
|
+
export { ALLOWED_YOUTUBE_HOSTS, AddedToCartToast, type AddedToCartToastLabels, type AddedToCartToastProps, type AddedToCartToastStatus, type BlockRendererProps, type CanonicalBlockType, type CartLineItemView, CartLineList, type CartLineListLabels, type CartLineListProps, CartSummary, type CartSummaryLabels, type CartSummaryProps, type CheckoutAppliedDiscount, type CheckoutContactErrors, type CheckoutContactValues, CheckoutForm, type CheckoutFormLabels, type CheckoutFormProps, CheckoutLoginPrompt, type CheckoutLoginPromptLabels, type CheckoutLoginPromptProps, DEFAULT_INVOICE_COUNTRIES, DEFAULT_SHOP_ERROR_FALLBACK_MESSAGE, DEFAULT_SHOP_ERROR_MESSAGES, DEFAULT_SHOP_PRICE_BANDS, DEFAULT_TRUST_ICONS, EMPTY_FULL_INVOICE_VALUE, FaqAccordion, type FaqAccordionProps, FaqItem, type FullInvoiceErrors, FullInvoiceFields, type FullInvoiceFieldsLabels, type FullInvoiceFieldsProps, type FullInvoiceIdType, type FullInvoiceValue, type HeadingLevel, MarkdownRenderer, type MarkdownRendererProps, OrderConfirmation, type OrderConfirmationLabels, type OrderConfirmationOrder, type OrderConfirmationProps, type OrderConfirmationStatus, OrderInvoiceLink, type OrderInvoiceLinkLabels, type OrderInvoiceLinkProps, PageBlocks, type PageBlocksComponents, type PageBlocksProps, PageCardGrid, type PageCardGridProps, ParentPage, type ParentPageProps, ProductCard, type ProductCardProps, ProductTrustItems, type ProductTrustItemsProps, ProfileCard, type ProfileCardProps, type RenderableBlock, SafeHtml, type SafeHtmlProps, type ShareUrls, type ShopFilterPriceBand, ShopFilters, type ShopFiltersActive, type ShopFiltersHrefs, type ShopFiltersLabels, type ShopFiltersProps, Specialty, type SpecialtyProps, Treatment, type TreatmentProps, type TrustIconComponent, type TrustIconProps, buildShareUrls, formatPrice, getShopErrorMessage, isAllowedYouTubeHost, isOverSimplifiedInvoiceCap, markdownToSafeHtml, readingTime, sanitizeHtml, shopIssuesInvoices, shouldRenderShopFilters, toCheckoutInvoiceFields };
|