@nevios/storefront-kit 1.0.0 → 1.3.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/README.md +78 -0
- package/dist/index.cjs +704 -120
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +202 -3
- package/dist/index.d.ts +202 -3
- package/dist/index.js +695 -121
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, Cart, AddLineInput, CartLine, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, OrderStatus, Customer, MagicLinkResult, ReorderResult } from '@nevios/storefront-js';
|
|
2
|
+
import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, Cart, AddLineInput, CartLine, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, OrderStatus, PaymentState, OrderPhase, PaymentInstructions, Customer, MagicLinkResult, ReorderResult } from '@nevios/storefront-js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeviosProvider — puts a configured storefront client on React context so
|
|
@@ -173,6 +173,32 @@ declare const en: {
|
|
|
173
173
|
"order.terminal.cancelled": string;
|
|
174
174
|
"order.terminal.refunded": string;
|
|
175
175
|
"order.terminal.returned": string;
|
|
176
|
+
"payment.title": string;
|
|
177
|
+
"payment.amountDue": string;
|
|
178
|
+
"payment.methodLabel": string;
|
|
179
|
+
"payment.payNow": string;
|
|
180
|
+
"payment.finish": string;
|
|
181
|
+
"payment.loading": string;
|
|
182
|
+
"payment.loadError": string;
|
|
183
|
+
"payment.actionError": string;
|
|
184
|
+
"payment.paidTitle": string;
|
|
185
|
+
"payment.paidBody": string;
|
|
186
|
+
"payment.paidAmount": string;
|
|
187
|
+
"payment.verifyingTitle": string;
|
|
188
|
+
"payment.verifyingBody": string;
|
|
189
|
+
"payment.blockedTitle": string;
|
|
190
|
+
"payment.blocked.orderCancelled": string;
|
|
191
|
+
"payment.blocked.alreadyPaid": string;
|
|
192
|
+
"payment.blocked.authorizationHeld": string;
|
|
193
|
+
"payment.blocked.documentIssued": string;
|
|
194
|
+
"payment.account": string;
|
|
195
|
+
"payment.beneficiary": string;
|
|
196
|
+
"payment.variableSymbol": string;
|
|
197
|
+
"payment.amount": string;
|
|
198
|
+
"payment.copy": string;
|
|
199
|
+
"payment.copied": string;
|
|
200
|
+
"payment.qrAlt": string;
|
|
201
|
+
"payment.qrCaption": string;
|
|
176
202
|
"error.notFound.title": string;
|
|
177
203
|
"error.notFound.body": string;
|
|
178
204
|
"error.generic.title": string;
|
|
@@ -187,6 +213,20 @@ declare const en: {
|
|
|
187
213
|
"account.signOut": string;
|
|
188
214
|
"account.greeting": string;
|
|
189
215
|
"account.orders": string;
|
|
216
|
+
"account.loadError": string;
|
|
217
|
+
"account.retry": string;
|
|
218
|
+
"account.loadMore": string;
|
|
219
|
+
"account.signInError": string;
|
|
220
|
+
"account.security": string;
|
|
221
|
+
"account.newEmail": string;
|
|
222
|
+
"account.changeEmail": string;
|
|
223
|
+
"account.recentLogin": string;
|
|
224
|
+
"account.sessions": string;
|
|
225
|
+
"account.currentSession": string;
|
|
226
|
+
"account.revokeSession": string;
|
|
227
|
+
"account.closeAccount": string;
|
|
228
|
+
"account.closeWarning": string;
|
|
229
|
+
"account.confirmClose": string;
|
|
190
230
|
"account.noOrders": string;
|
|
191
231
|
"account.addresses": string;
|
|
192
232
|
"account.noAddresses": string;
|
|
@@ -729,6 +769,27 @@ interface OrderStatusState {
|
|
|
729
769
|
}
|
|
730
770
|
declare function useOrderStatus(statusToken: string | null, initial?: OrderStatus | null): OrderStatusState;
|
|
731
771
|
|
|
772
|
+
interface PaymentPageState {
|
|
773
|
+
payment: PaymentState | null;
|
|
774
|
+
methods: PaymentMethod[];
|
|
775
|
+
loading: boolean;
|
|
776
|
+
/** True while a method change or a gateway start is in flight — the moment
|
|
777
|
+
* to disable the buttons, because both mutate the order. */
|
|
778
|
+
busy: boolean;
|
|
779
|
+
error: Error | null;
|
|
780
|
+
reload(): Promise<void>;
|
|
781
|
+
/** Switch method. The order's total can move with it (the fee differs), so
|
|
782
|
+
* the refreshed state is returned and stored, not merged. */
|
|
783
|
+
selectMethod(method: string): Promise<PaymentState | null>;
|
|
784
|
+
/** Open a gateway session. Returns the URL to send the browser to; null when
|
|
785
|
+
* the connector needs no redirect. */
|
|
786
|
+
startPayment(input?: {
|
|
787
|
+
returnUrl?: string;
|
|
788
|
+
cancelUrl?: string;
|
|
789
|
+
}): Promise<string | null>;
|
|
790
|
+
}
|
|
791
|
+
declare function usePayment(token: string | null, initial?: PaymentState | null): PaymentPageState;
|
|
792
|
+
|
|
732
793
|
/**
|
|
733
794
|
* OrderConfirmation — the compact post-checkout "thank you" block. Drop it on
|
|
734
795
|
* the return route after `checkout.complete()` / a gateway redirect back, keyed
|
|
@@ -762,9 +823,143 @@ interface OrderStatusPageProps {
|
|
|
762
823
|
order?: OrderStatus;
|
|
763
824
|
/** Contact-support callback (shown when the order allows it). */
|
|
764
825
|
onContactSupport?: () => void;
|
|
826
|
+
/** Builds the URL of your payment page from the payment's token. Given one,
|
|
827
|
+
* an unpaid order shows a "finish payment" link; without it the page stays
|
|
828
|
+
* read-only, because a link to a route the shop does not have is worse than
|
|
829
|
+
* no link. */
|
|
830
|
+
payHref?: (paymentToken: string) => string;
|
|
831
|
+
locale?: string;
|
|
832
|
+
}
|
|
833
|
+
declare function OrderStatusPage({ statusToken, order: initial, onContactSupport, payHref, locale, }: OrderStatusPageProps): React.ReactElement;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Shared presentational parts for the order views — phase timeline, terminal
|
|
837
|
+
* status banner, line items, and totals. Themeable via `--nv-*`. Internal to
|
|
838
|
+
* the order slice.
|
|
839
|
+
*/
|
|
840
|
+
|
|
841
|
+
declare function isTerminal(phase: OrderPhase): boolean;
|
|
842
|
+
/** The happy-path progress bar. Hidden for terminal phases (use StatusBanner). */
|
|
843
|
+
declare function PhaseTimeline({ phase }: {
|
|
844
|
+
phase: OrderPhase;
|
|
845
|
+
}): React.ReactElement | null;
|
|
846
|
+
/** Banner shown for terminal phases (cancelled / refunded / returned). */
|
|
847
|
+
declare function StatusBanner({ phase }: {
|
|
848
|
+
phase: OrderPhase;
|
|
849
|
+
}): React.ReactElement | null;
|
|
850
|
+
declare function OrderLines({ order, locale, }: {
|
|
851
|
+
order: OrderStatus;
|
|
852
|
+
locale?: string;
|
|
853
|
+
}): React.ReactElement;
|
|
854
|
+
declare function OrderTotals({ order, locale, }: {
|
|
855
|
+
order: OrderStatus;
|
|
856
|
+
locale?: string;
|
|
857
|
+
}): React.ReactElement;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* PaymentPage — the merchant's own payment page for a placed order.
|
|
861
|
+
*
|
|
862
|
+
* A whole page, not a widget, because of who reaches it: somebody who clicked
|
|
863
|
+
* "finish your payment" in an order e-mail, possibly days later, on a phone,
|
|
864
|
+
* with none of the shop's context around them. It has to answer "what do I owe
|
|
865
|
+
* and what do I do now" on its own.
|
|
866
|
+
*
|
|
867
|
+
* <PaymentPage token={order.payment.token} statusHref={`/order/${t}`} />
|
|
868
|
+
*
|
|
869
|
+
* It renders exactly one of four situations, and the difference between them is
|
|
870
|
+
* the entire job:
|
|
871
|
+
*
|
|
872
|
+
* 1. THERE IS SOMETHING TO PAY — the picker plus one button named after what
|
|
873
|
+
* it does. The surcharge sits on the row and the amount due moves when the
|
|
874
|
+
* method changes, so nobody picks cash-on-delivery and watches the total
|
|
875
|
+
* grow afterwards.
|
|
876
|
+
* 2. BANK TRANSFER — account, variable symbol, amount, QR. No
|
|
877
|
+
* button; the details are the action.
|
|
878
|
+
* 3. ALREADY PAID — a receipt, NOT an error. Arriving at a paid
|
|
879
|
+
* link is the normal end of the happy path (and of every gateway return).
|
|
880
|
+
* 4. LOCKED — one of four reasons, each its own sentence.
|
|
881
|
+
* `blocked_reason` carries four values precisely so the page can say four
|
|
882
|
+
* different things; collapsing them into "cannot pay" sends the customer
|
|
883
|
+
* to support.
|
|
884
|
+
*
|
|
885
|
+
* `token === null` renders nothing at all. The token is minted only while there
|
|
886
|
+
* is something to pay, so its absence is the server saying "no button here" —
|
|
887
|
+
* a disabled button would be a worse answer.
|
|
888
|
+
*
|
|
889
|
+
* **Returning from a gateway.** The page can be the `return_url`. Before it
|
|
890
|
+
* sends the browser to a gateway it remembers that in `sessionStorage`, so on
|
|
891
|
+
* the way back it knows to show "verifying your payment" and poll instead of
|
|
892
|
+
* offering to pay again — the callback often lands a second or two after the
|
|
893
|
+
* customer does, and a payable-looking page at that moment invites a double
|
|
894
|
+
* payment. Needs no cooperation from the route.
|
|
895
|
+
*/
|
|
896
|
+
|
|
897
|
+
interface PaymentPageProps {
|
|
898
|
+
/** The payment page's own token — the status page hands it over as
|
|
899
|
+
* `order.payment.token`. `null` renders nothing. */
|
|
900
|
+
token: string | null;
|
|
901
|
+
/** Pre-fetched state (SSR / loader) — skips the first client fetch. */
|
|
902
|
+
payment?: PaymentState | null;
|
|
903
|
+
/** Where the gateway returns the customer after paying. Defaults to the
|
|
904
|
+
* current URL, which makes this page its own return route. */
|
|
905
|
+
returnUrl?: string;
|
|
906
|
+
cancelUrl?: string;
|
|
907
|
+
/** Link to the full order status page, offered once there is nothing to pay. */
|
|
908
|
+
statusHref?: string;
|
|
765
909
|
locale?: string;
|
|
910
|
+
/** Called once the payment reads as settled — e.g. to refresh an order view. */
|
|
911
|
+
onPaid?(payment: PaymentState): void;
|
|
766
912
|
}
|
|
767
|
-
declare function
|
|
913
|
+
declare function PaymentPage({ token, payment: initial, returnUrl, cancelUrl, statusHref, locale, onPaid, }: PaymentPageProps): React.ReactElement | null;
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* PaymentMethodPicker — the ONE payment picker in the kit.
|
|
917
|
+
*
|
|
918
|
+
* Used by both the checkout's payment step and the payment page, and that is
|
|
919
|
+
* the whole point of it existing separately: switching from card to transfer
|
|
920
|
+
* has to look identical in the shop and on the page a customer reaches from an
|
|
921
|
+
* e-mail two days later. Two pickers that drift make the second one feel like
|
|
922
|
+
* somebody else's site — at the exact moment the customer is deciding whether
|
|
923
|
+
* to send money.
|
|
924
|
+
*
|
|
925
|
+
* The surcharge rides on the row because it is the consequence of the choice.
|
|
926
|
+
* Cash on delivery costs 39 Kč more; a picker that hides that until the total
|
|
927
|
+
* moves has let the shopper choose blind.
|
|
928
|
+
*/
|
|
929
|
+
|
|
930
|
+
interface PaymentMethodPickerProps {
|
|
931
|
+
methods: PaymentMethod[];
|
|
932
|
+
/** The chosen method's key (`PaymentMethod.method`), or null when none is. */
|
|
933
|
+
value: string | null;
|
|
934
|
+
onSelect(method: string): void;
|
|
935
|
+
/** Currency of the order/checkout — the surcharge is formatted in it. */
|
|
936
|
+
currency: string;
|
|
937
|
+
locale?: string;
|
|
938
|
+
/** Renders the rows unselectable (e.g. while a switch is in flight). */
|
|
939
|
+
disabled?: boolean;
|
|
940
|
+
/** Accessible name for the group. */
|
|
941
|
+
label?: string;
|
|
942
|
+
}
|
|
943
|
+
declare function PaymentMethodPicker({ methods, value, onSelect, currency, locale, disabled, label, }: PaymentMethodPickerProps): React.ReactElement;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* TransferInstructions — where to send the money for a bank-transfer order.
|
|
947
|
+
*
|
|
948
|
+
* Nothing in the kit rendered this until now, which meant a shopper who chose
|
|
949
|
+
* "bank transfer" placed the order and was told nothing about where to pay.
|
|
950
|
+
* The backend has always returned the account, the variable symbol, the amount
|
|
951
|
+
* and a ready-made QR image; it just had no home.
|
|
952
|
+
*
|
|
953
|
+
* There is deliberately NO button here. For a transfer these details ARE the
|
|
954
|
+
* action — the customer leaves for their banking app. A button would either lie
|
|
955
|
+
* about what it does or do nothing.
|
|
956
|
+
*/
|
|
957
|
+
|
|
958
|
+
interface TransferInstructionsProps {
|
|
959
|
+
instructions: PaymentInstructions;
|
|
960
|
+
locale?: string;
|
|
961
|
+
}
|
|
962
|
+
declare function TransferInstructions({ instructions: i, locale, }: TransferInstructionsProps): React.ReactElement;
|
|
768
963
|
|
|
769
964
|
/**
|
|
770
965
|
* AccountProvider + useAccount — shared logged-in-customer state. Resolves the
|
|
@@ -777,6 +972,7 @@ interface AccountState {
|
|
|
777
972
|
signedIn: boolean;
|
|
778
973
|
/** True until the initial session check resolves. */
|
|
779
974
|
loading: boolean;
|
|
975
|
+
error: boolean;
|
|
780
976
|
requestMagicLink(email: string): Promise<MagicLinkResult>;
|
|
781
977
|
/** Exchange a magic token for a session (sets `customer`). */
|
|
782
978
|
verify(token: string): Promise<Customer>;
|
|
@@ -852,6 +1048,9 @@ declare function AddressBook(): React.ReactElement;
|
|
|
852
1048
|
|
|
853
1049
|
declare function ProfileEditor(): React.ReactElement | null;
|
|
854
1050
|
|
|
1051
|
+
/** Email verification, session revocation and explicit account-closure confirmation. */
|
|
1052
|
+
declare function AccountSecurity(): React.ReactElement | null;
|
|
1053
|
+
|
|
855
1054
|
/**
|
|
856
1055
|
* ProductJsonLd — schema.org/Product structured data for rich results (price,
|
|
857
1056
|
* availability, brand). Drop it in the PDP <head> (or anywhere; it's a script).
|
|
@@ -928,4 +1127,4 @@ interface JsonLdProps {
|
|
|
928
1127
|
/** Render a JSON-LD `<script>` for the given (already-shaped) data object. */
|
|
929
1128
|
declare function JsonLd({ data }: JsonLdProps): React.ReactElement;
|
|
930
1129
|
|
|
931
|
-
export { AccountDashboard, type AccountDashboardProps, AccountProvider, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentSection, type PaymentSectionProps, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StockBadge, type StockBadgeProps, type StorefrontTheme, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useI18n, useMagicLinkVerify, useOrderStatus, useStorefront, useStorefrontOptional, useT };
|
|
1130
|
+
export { AccountDashboard, type AccountDashboardProps, AccountProvider, AccountSecurity, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderLines, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrderTotals, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentMethodPicker, type PaymentMethodPickerProps, PaymentPage, type PaymentPageProps, type PaymentPageState, PaymentSection, type PaymentSectionProps, PhaseTimeline, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StatusBanner, StockBadge, type StockBadgeProps, type StorefrontTheme, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, TransferInstructions, type TransferInstructionsProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, isTerminal, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useI18n, useMagicLinkVerify, useOrderStatus, usePayment, useStorefront, useStorefrontOptional, useT };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, Cart, AddLineInput, CartLine, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, OrderStatus, Customer, MagicLinkResult, ReorderResult } from '@nevios/storefront-js';
|
|
2
|
+
import { StorefrontClient, Money, Product, ProductMedia, ProductVariant, CollectionDetail, ProductSort, Cart, AddLineInput, CartLine, Checkout, CreateCheckoutInput, SetAddressInput, ShippingQuote, PaymentMethod, OrderStatus, PaymentState, OrderPhase, PaymentInstructions, Customer, MagicLinkResult, ReorderResult } from '@nevios/storefront-js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* NeviosProvider — puts a configured storefront client on React context so
|
|
@@ -173,6 +173,32 @@ declare const en: {
|
|
|
173
173
|
"order.terminal.cancelled": string;
|
|
174
174
|
"order.terminal.refunded": string;
|
|
175
175
|
"order.terminal.returned": string;
|
|
176
|
+
"payment.title": string;
|
|
177
|
+
"payment.amountDue": string;
|
|
178
|
+
"payment.methodLabel": string;
|
|
179
|
+
"payment.payNow": string;
|
|
180
|
+
"payment.finish": string;
|
|
181
|
+
"payment.loading": string;
|
|
182
|
+
"payment.loadError": string;
|
|
183
|
+
"payment.actionError": string;
|
|
184
|
+
"payment.paidTitle": string;
|
|
185
|
+
"payment.paidBody": string;
|
|
186
|
+
"payment.paidAmount": string;
|
|
187
|
+
"payment.verifyingTitle": string;
|
|
188
|
+
"payment.verifyingBody": string;
|
|
189
|
+
"payment.blockedTitle": string;
|
|
190
|
+
"payment.blocked.orderCancelled": string;
|
|
191
|
+
"payment.blocked.alreadyPaid": string;
|
|
192
|
+
"payment.blocked.authorizationHeld": string;
|
|
193
|
+
"payment.blocked.documentIssued": string;
|
|
194
|
+
"payment.account": string;
|
|
195
|
+
"payment.beneficiary": string;
|
|
196
|
+
"payment.variableSymbol": string;
|
|
197
|
+
"payment.amount": string;
|
|
198
|
+
"payment.copy": string;
|
|
199
|
+
"payment.copied": string;
|
|
200
|
+
"payment.qrAlt": string;
|
|
201
|
+
"payment.qrCaption": string;
|
|
176
202
|
"error.notFound.title": string;
|
|
177
203
|
"error.notFound.body": string;
|
|
178
204
|
"error.generic.title": string;
|
|
@@ -187,6 +213,20 @@ declare const en: {
|
|
|
187
213
|
"account.signOut": string;
|
|
188
214
|
"account.greeting": string;
|
|
189
215
|
"account.orders": string;
|
|
216
|
+
"account.loadError": string;
|
|
217
|
+
"account.retry": string;
|
|
218
|
+
"account.loadMore": string;
|
|
219
|
+
"account.signInError": string;
|
|
220
|
+
"account.security": string;
|
|
221
|
+
"account.newEmail": string;
|
|
222
|
+
"account.changeEmail": string;
|
|
223
|
+
"account.recentLogin": string;
|
|
224
|
+
"account.sessions": string;
|
|
225
|
+
"account.currentSession": string;
|
|
226
|
+
"account.revokeSession": string;
|
|
227
|
+
"account.closeAccount": string;
|
|
228
|
+
"account.closeWarning": string;
|
|
229
|
+
"account.confirmClose": string;
|
|
190
230
|
"account.noOrders": string;
|
|
191
231
|
"account.addresses": string;
|
|
192
232
|
"account.noAddresses": string;
|
|
@@ -729,6 +769,27 @@ interface OrderStatusState {
|
|
|
729
769
|
}
|
|
730
770
|
declare function useOrderStatus(statusToken: string | null, initial?: OrderStatus | null): OrderStatusState;
|
|
731
771
|
|
|
772
|
+
interface PaymentPageState {
|
|
773
|
+
payment: PaymentState | null;
|
|
774
|
+
methods: PaymentMethod[];
|
|
775
|
+
loading: boolean;
|
|
776
|
+
/** True while a method change or a gateway start is in flight — the moment
|
|
777
|
+
* to disable the buttons, because both mutate the order. */
|
|
778
|
+
busy: boolean;
|
|
779
|
+
error: Error | null;
|
|
780
|
+
reload(): Promise<void>;
|
|
781
|
+
/** Switch method. The order's total can move with it (the fee differs), so
|
|
782
|
+
* the refreshed state is returned and stored, not merged. */
|
|
783
|
+
selectMethod(method: string): Promise<PaymentState | null>;
|
|
784
|
+
/** Open a gateway session. Returns the URL to send the browser to; null when
|
|
785
|
+
* the connector needs no redirect. */
|
|
786
|
+
startPayment(input?: {
|
|
787
|
+
returnUrl?: string;
|
|
788
|
+
cancelUrl?: string;
|
|
789
|
+
}): Promise<string | null>;
|
|
790
|
+
}
|
|
791
|
+
declare function usePayment(token: string | null, initial?: PaymentState | null): PaymentPageState;
|
|
792
|
+
|
|
732
793
|
/**
|
|
733
794
|
* OrderConfirmation — the compact post-checkout "thank you" block. Drop it on
|
|
734
795
|
* the return route after `checkout.complete()` / a gateway redirect back, keyed
|
|
@@ -762,9 +823,143 @@ interface OrderStatusPageProps {
|
|
|
762
823
|
order?: OrderStatus;
|
|
763
824
|
/** Contact-support callback (shown when the order allows it). */
|
|
764
825
|
onContactSupport?: () => void;
|
|
826
|
+
/** Builds the URL of your payment page from the payment's token. Given one,
|
|
827
|
+
* an unpaid order shows a "finish payment" link; without it the page stays
|
|
828
|
+
* read-only, because a link to a route the shop does not have is worse than
|
|
829
|
+
* no link. */
|
|
830
|
+
payHref?: (paymentToken: string) => string;
|
|
831
|
+
locale?: string;
|
|
832
|
+
}
|
|
833
|
+
declare function OrderStatusPage({ statusToken, order: initial, onContactSupport, payHref, locale, }: OrderStatusPageProps): React.ReactElement;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* Shared presentational parts for the order views — phase timeline, terminal
|
|
837
|
+
* status banner, line items, and totals. Themeable via `--nv-*`. Internal to
|
|
838
|
+
* the order slice.
|
|
839
|
+
*/
|
|
840
|
+
|
|
841
|
+
declare function isTerminal(phase: OrderPhase): boolean;
|
|
842
|
+
/** The happy-path progress bar. Hidden for terminal phases (use StatusBanner). */
|
|
843
|
+
declare function PhaseTimeline({ phase }: {
|
|
844
|
+
phase: OrderPhase;
|
|
845
|
+
}): React.ReactElement | null;
|
|
846
|
+
/** Banner shown for terminal phases (cancelled / refunded / returned). */
|
|
847
|
+
declare function StatusBanner({ phase }: {
|
|
848
|
+
phase: OrderPhase;
|
|
849
|
+
}): React.ReactElement | null;
|
|
850
|
+
declare function OrderLines({ order, locale, }: {
|
|
851
|
+
order: OrderStatus;
|
|
852
|
+
locale?: string;
|
|
853
|
+
}): React.ReactElement;
|
|
854
|
+
declare function OrderTotals({ order, locale, }: {
|
|
855
|
+
order: OrderStatus;
|
|
856
|
+
locale?: string;
|
|
857
|
+
}): React.ReactElement;
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* PaymentPage — the merchant's own payment page for a placed order.
|
|
861
|
+
*
|
|
862
|
+
* A whole page, not a widget, because of who reaches it: somebody who clicked
|
|
863
|
+
* "finish your payment" in an order e-mail, possibly days later, on a phone,
|
|
864
|
+
* with none of the shop's context around them. It has to answer "what do I owe
|
|
865
|
+
* and what do I do now" on its own.
|
|
866
|
+
*
|
|
867
|
+
* <PaymentPage token={order.payment.token} statusHref={`/order/${t}`} />
|
|
868
|
+
*
|
|
869
|
+
* It renders exactly one of four situations, and the difference between them is
|
|
870
|
+
* the entire job:
|
|
871
|
+
*
|
|
872
|
+
* 1. THERE IS SOMETHING TO PAY — the picker plus one button named after what
|
|
873
|
+
* it does. The surcharge sits on the row and the amount due moves when the
|
|
874
|
+
* method changes, so nobody picks cash-on-delivery and watches the total
|
|
875
|
+
* grow afterwards.
|
|
876
|
+
* 2. BANK TRANSFER — account, variable symbol, amount, QR. No
|
|
877
|
+
* button; the details are the action.
|
|
878
|
+
* 3. ALREADY PAID — a receipt, NOT an error. Arriving at a paid
|
|
879
|
+
* link is the normal end of the happy path (and of every gateway return).
|
|
880
|
+
* 4. LOCKED — one of four reasons, each its own sentence.
|
|
881
|
+
* `blocked_reason` carries four values precisely so the page can say four
|
|
882
|
+
* different things; collapsing them into "cannot pay" sends the customer
|
|
883
|
+
* to support.
|
|
884
|
+
*
|
|
885
|
+
* `token === null` renders nothing at all. The token is minted only while there
|
|
886
|
+
* is something to pay, so its absence is the server saying "no button here" —
|
|
887
|
+
* a disabled button would be a worse answer.
|
|
888
|
+
*
|
|
889
|
+
* **Returning from a gateway.** The page can be the `return_url`. Before it
|
|
890
|
+
* sends the browser to a gateway it remembers that in `sessionStorage`, so on
|
|
891
|
+
* the way back it knows to show "verifying your payment" and poll instead of
|
|
892
|
+
* offering to pay again — the callback often lands a second or two after the
|
|
893
|
+
* customer does, and a payable-looking page at that moment invites a double
|
|
894
|
+
* payment. Needs no cooperation from the route.
|
|
895
|
+
*/
|
|
896
|
+
|
|
897
|
+
interface PaymentPageProps {
|
|
898
|
+
/** The payment page's own token — the status page hands it over as
|
|
899
|
+
* `order.payment.token`. `null` renders nothing. */
|
|
900
|
+
token: string | null;
|
|
901
|
+
/** Pre-fetched state (SSR / loader) — skips the first client fetch. */
|
|
902
|
+
payment?: PaymentState | null;
|
|
903
|
+
/** Where the gateway returns the customer after paying. Defaults to the
|
|
904
|
+
* current URL, which makes this page its own return route. */
|
|
905
|
+
returnUrl?: string;
|
|
906
|
+
cancelUrl?: string;
|
|
907
|
+
/** Link to the full order status page, offered once there is nothing to pay. */
|
|
908
|
+
statusHref?: string;
|
|
765
909
|
locale?: string;
|
|
910
|
+
/** Called once the payment reads as settled — e.g. to refresh an order view. */
|
|
911
|
+
onPaid?(payment: PaymentState): void;
|
|
766
912
|
}
|
|
767
|
-
declare function
|
|
913
|
+
declare function PaymentPage({ token, payment: initial, returnUrl, cancelUrl, statusHref, locale, onPaid, }: PaymentPageProps): React.ReactElement | null;
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* PaymentMethodPicker — the ONE payment picker in the kit.
|
|
917
|
+
*
|
|
918
|
+
* Used by both the checkout's payment step and the payment page, and that is
|
|
919
|
+
* the whole point of it existing separately: switching from card to transfer
|
|
920
|
+
* has to look identical in the shop and on the page a customer reaches from an
|
|
921
|
+
* e-mail two days later. Two pickers that drift make the second one feel like
|
|
922
|
+
* somebody else's site — at the exact moment the customer is deciding whether
|
|
923
|
+
* to send money.
|
|
924
|
+
*
|
|
925
|
+
* The surcharge rides on the row because it is the consequence of the choice.
|
|
926
|
+
* Cash on delivery costs 39 Kč more; a picker that hides that until the total
|
|
927
|
+
* moves has let the shopper choose blind.
|
|
928
|
+
*/
|
|
929
|
+
|
|
930
|
+
interface PaymentMethodPickerProps {
|
|
931
|
+
methods: PaymentMethod[];
|
|
932
|
+
/** The chosen method's key (`PaymentMethod.method`), or null when none is. */
|
|
933
|
+
value: string | null;
|
|
934
|
+
onSelect(method: string): void;
|
|
935
|
+
/** Currency of the order/checkout — the surcharge is formatted in it. */
|
|
936
|
+
currency: string;
|
|
937
|
+
locale?: string;
|
|
938
|
+
/** Renders the rows unselectable (e.g. while a switch is in flight). */
|
|
939
|
+
disabled?: boolean;
|
|
940
|
+
/** Accessible name for the group. */
|
|
941
|
+
label?: string;
|
|
942
|
+
}
|
|
943
|
+
declare function PaymentMethodPicker({ methods, value, onSelect, currency, locale, disabled, label, }: PaymentMethodPickerProps): React.ReactElement;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* TransferInstructions — where to send the money for a bank-transfer order.
|
|
947
|
+
*
|
|
948
|
+
* Nothing in the kit rendered this until now, which meant a shopper who chose
|
|
949
|
+
* "bank transfer" placed the order and was told nothing about where to pay.
|
|
950
|
+
* The backend has always returned the account, the variable symbol, the amount
|
|
951
|
+
* and a ready-made QR image; it just had no home.
|
|
952
|
+
*
|
|
953
|
+
* There is deliberately NO button here. For a transfer these details ARE the
|
|
954
|
+
* action — the customer leaves for their banking app. A button would either lie
|
|
955
|
+
* about what it does or do nothing.
|
|
956
|
+
*/
|
|
957
|
+
|
|
958
|
+
interface TransferInstructionsProps {
|
|
959
|
+
instructions: PaymentInstructions;
|
|
960
|
+
locale?: string;
|
|
961
|
+
}
|
|
962
|
+
declare function TransferInstructions({ instructions: i, locale, }: TransferInstructionsProps): React.ReactElement;
|
|
768
963
|
|
|
769
964
|
/**
|
|
770
965
|
* AccountProvider + useAccount — shared logged-in-customer state. Resolves the
|
|
@@ -777,6 +972,7 @@ interface AccountState {
|
|
|
777
972
|
signedIn: boolean;
|
|
778
973
|
/** True until the initial session check resolves. */
|
|
779
974
|
loading: boolean;
|
|
975
|
+
error: boolean;
|
|
780
976
|
requestMagicLink(email: string): Promise<MagicLinkResult>;
|
|
781
977
|
/** Exchange a magic token for a session (sets `customer`). */
|
|
782
978
|
verify(token: string): Promise<Customer>;
|
|
@@ -852,6 +1048,9 @@ declare function AddressBook(): React.ReactElement;
|
|
|
852
1048
|
|
|
853
1049
|
declare function ProfileEditor(): React.ReactElement | null;
|
|
854
1050
|
|
|
1051
|
+
/** Email verification, session revocation and explicit account-closure confirmation. */
|
|
1052
|
+
declare function AccountSecurity(): React.ReactElement | null;
|
|
1053
|
+
|
|
855
1054
|
/**
|
|
856
1055
|
* ProductJsonLd — schema.org/Product structured data for rich results (price,
|
|
857
1056
|
* availability, brand). Drop it in the PDP <head> (or anywhere; it's a script).
|
|
@@ -928,4 +1127,4 @@ interface JsonLdProps {
|
|
|
928
1127
|
/** Render a JSON-LD `<script>` for the given (already-shaped) data object. */
|
|
929
1128
|
declare function JsonLd({ data }: JsonLdProps): React.ReactElement;
|
|
930
1129
|
|
|
931
|
-
export { AccountDashboard, type AccountDashboardProps, AccountProvider, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentSection, type PaymentSectionProps, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StockBadge, type StockBadgeProps, type StorefrontTheme, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useI18n, useMagicLinkVerify, useOrderStatus, useStorefront, useStorefrontOptional, useT };
|
|
1130
|
+
export { AccountDashboard, type AccountDashboardProps, AccountProvider, AccountSecurity, type AccountState, AddToCart, type AddToCartProps, AddressBook, AddressForm, type AddressFormProps, AvailabilityFilter, type AvailabilityFilterProps, BackInStockForm, type BackInStockFormProps, type BreadcrumbItem, BreadcrumbJsonLd, type BreadcrumbJsonLdProps, CartDrawer, type CartDrawerProps, CartLineItem, type CartLineItemProps, CartProvider, type CartState, CartSummary, type CartSummaryProps, CheckoutFlow, type CheckoutFlowProps, CheckoutProvider, type CheckoutState, CollectionPage, type CollectionPageProps, I18nProvider, type I18nProviderProps, type I18nValue, JsonLd, type JsonLdProps, LoginForm, type LoginFormProps, type MarketOption, MarketSwitcher, type MarketSwitcherProps, type MessageKey, type Messages, NeviosProvider, type NeviosProviderProps, OrderConfirmation, type OrderConfirmationProps, OrderHistory, type OrderHistoryProps, OrderLines, OrderStatusPage, type OrderStatusPageProps, type OrderStatusState, OrderSummary, type OrderSummaryProps, OrderTotals, OrganizationJsonLd, type OrganizationJsonLdProps, type PayOptions, type PayResult, PaymentMethodPicker, type PaymentMethodPickerProps, PaymentPage, type PaymentPageProps, type PaymentPageState, PaymentSection, type PaymentSectionProps, PhaseTimeline, PriceMoney, type PriceMoneyProps, PriceRangeFilter, type PriceRangeFilterProps, ProductCard, type ProductCardProps, ProductDetailPage, type ProductDetailPageProps, ProductGallery, type ProductGalleryProps, ProductJsonLd, type ProductJsonLdProps, ProfileEditor, ShippingPicker, type ShippingPickerProps, SortSelect, type SortSelectProps, StatusBanner, StockBadge, type StockBadgeProps, type StorefrontTheme, type TFunction, type TVars, TagFilter, type TagFilterProps, ThemeProvider, type ThemeProviderProps, TransferInstructions, type TransferInstructionsProps, VariantPicker, type VariantPickerProps, type VerifyStatus, absoluteUrl, bundledMessages, cs, en, formatCents, formatMoney, isTerminal, serializeJsonLd, stripHtml, themeToCssVars, useAccount, useCart, useCheckout, useI18n, useMagicLinkVerify, useOrderStatus, usePayment, useStorefront, useStorefrontOptional, useT };
|