@sixtyninecommerce/client 0.31.0 → 0.33.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 +91 -3
- package/dist/build-client.d.ts.map +1 -1
- package/dist/build-client.js +3 -0
- package/dist/build-client.js.map +1 -1
- package/dist/commerce/checkout.d.ts +4 -2
- package/dist/commerce/checkout.d.ts.map +1 -1
- package/dist/commerce/checkout.js +4 -2
- package/dist/commerce/checkout.js.map +1 -1
- package/dist/commerce/customer.d.ts +254 -5
- package/dist/commerce/customer.d.ts.map +1 -1
- package/dist/commerce/customer.js +85 -28
- package/dist/commerce/customer.js.map +1 -1
- package/dist/commerce/index.d.ts +261 -6
- package/dist/commerce/index.d.ts.map +1 -1
- package/dist/commerce/index.js +12 -0
- package/dist/commerce/index.js.map +1 -1
- package/dist/commerce/money-view.d.ts +33 -0
- package/dist/commerce/money-view.d.ts.map +1 -0
- package/dist/commerce/money-view.js +75 -0
- package/dist/commerce/money-view.js.map +1 -0
- package/dist/commerce/order-access-key.d.ts +29 -0
- package/dist/commerce/order-access-key.d.ts.map +1 -0
- package/dist/commerce/order-access-key.js +38 -0
- package/dist/commerce/order-access-key.js.map +1 -0
- package/dist/commerce/parked-orders.d.ts +3 -3
- package/dist/commerce/parked-orders.d.ts.map +1 -1
- package/dist/commerce/parked-orders.js +34 -5
- package/dist/commerce/parked-orders.js.map +1 -1
- package/dist/commerce/payments.d.ts +2 -1
- package/dist/commerce/payments.d.ts.map +1 -1
- package/dist/commerce/payments.js +2 -1
- package/dist/commerce/payments.js.map +1 -1
- package/dist/commerce/queries.d.ts +37 -4
- package/dist/commerce/queries.d.ts.map +1 -1
- package/dist/commerce/queries.js +180 -8
- package/dist/commerce/queries.js.map +1 -1
- package/dist/commerce/receipt-claim.d.ts +35 -0
- package/dist/commerce/receipt-claim.d.ts.map +1 -0
- package/dist/commerce/receipt-claim.js +66 -0
- package/dist/commerce/receipt-claim.js.map +1 -0
- package/dist/commerce/returns.d.ts +2 -2
- package/dist/commerce/returns.d.ts.map +1 -1
- package/dist/commerce/returns.js +24 -3
- package/dist/commerce/returns.js.map +1 -1
- package/dist/commerce/store-pickup.d.ts +37 -0
- package/dist/commerce/store-pickup.d.ts.map +1 -0
- package/dist/commerce/store-pickup.js +66 -0
- package/dist/commerce/store-pickup.js.map +1 -0
- package/dist/core/customer-session.d.ts +34 -0
- package/dist/core/customer-session.d.ts.map +1 -0
- package/dist/core/customer-session.js +48 -0
- package/dist/core/customer-session.js.map +1 -0
- package/dist/core/http.d.ts +9 -0
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +64 -25
- package/dist/core/http.js.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/events/payloads.d.ts +1 -1
- package/dist/events/payloads.d.ts.map +1 -1
- package/dist/generated/cms.d.ts +4 -2
- package/dist/generated/cms.d.ts.map +1 -1
- package/dist/generated/plugins.d.ts +2 -2
- package/dist/generated/plugins.d.ts.map +1 -1
- package/dist/generated/shop.d.ts +323 -9
- package/dist/generated/shop.d.ts.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/pricing/index.d.ts +1 -0
- package/dist/pricing/index.d.ts.map +1 -1
- package/dist/pricing/index.js +1 -0
- package/dist/pricing/index.js.map +1 -1
- package/dist/pricing/order-money-rows.d.ts +92 -0
- package/dist/pricing/order-money-rows.d.ts.map +1 -0
- package/dist/pricing/order-money-rows.js +88 -0
- package/dist/pricing/order-money-rows.js.map +1 -0
- package/dist/pricing/validation.d.ts +25 -0
- package/dist/pricing/validation.d.ts.map +1 -1
- package/dist/pricing/validation.js +37 -4
- package/dist/pricing/validation.js.map +1 -1
- package/dist/types.d.ts +373 -25
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -120,18 +120,39 @@ export interface StorefrontClientConfig {
|
|
|
120
120
|
* checkout for 15 minutes. Anything else is refused with `AGENT_SESSION_SCOPE`.
|
|
121
121
|
*/
|
|
122
122
|
customerToken?: string;
|
|
123
|
-
/**
|
|
123
|
+
/**
|
|
124
|
+
* Called when Vendure hands the client a new session token (a sign-in, or a
|
|
125
|
+
* new anonymous session for a guest or a dead token). Use to persist it.
|
|
126
|
+
*
|
|
127
|
+
* Only for a token that replaces the one the client holds now: a call
|
|
128
|
+
* answered after its token was replaced (a sign-in, `logout`, `setAuthToken`
|
|
129
|
+
* landed while it was in flight) has its token dropped, so a late answer
|
|
130
|
+
* never signs the newer session out. A sign-in's own token always applies.
|
|
131
|
+
*/
|
|
124
132
|
onAuthToken?: (token: string) => void;
|
|
125
133
|
/**
|
|
126
|
-
* Called when
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* `
|
|
134
|
+
* Called when a SIGNED-IN customer's session is gone: a Shop API call failed
|
|
135
|
+
* with UNAUTHORIZED, or with FORBIDDEN and a follow-up `activeCustomer` probe
|
|
136
|
+
* answered no customer. Vendure's Shop API returns FORBIDDEN both for a lost
|
|
137
|
+
* session and for a real authorization denial, so the probe is what tells
|
|
138
|
+
* them apart. Fires once per lost session. Use to prompt re-login or clear
|
|
139
|
+
* local user state.
|
|
140
|
+
*
|
|
141
|
+
* "Signed in" is what this client SAW: a successful `login`, `authenticate`,
|
|
142
|
+
* `loginWithMagicLink`, `loginWithMagicCode`, `verifyAccount` or
|
|
143
|
+
* `resetPassword`, or a `getCurrentCustomer()` that returned a customer.
|
|
144
|
+
* It never fires for a guest: a guest is refused with FORBIDDEN legitimately
|
|
145
|
+
* (an order placed in another browser, or past its guest read window), and
|
|
146
|
+
* its session — and cart — is still alive. A token handed in by
|
|
147
|
+
* `setAuthToken` or `customerToken` counts as signed in only once
|
|
148
|
+
* `getCurrentCustomer()` returns a customer for it, so a storefront that
|
|
149
|
+
* restores a stored token and wants this callback reads the customer first.
|
|
150
|
+
* `logout`, `setAuthToken` and `clearAuthToken` reset it.
|
|
151
|
+
*
|
|
152
|
+
* A FORBIDDEN with a still-signed-in session is an authorization denial,
|
|
153
|
+
* NOT an expiry: `onAuthExpired` does not fire and the caller receives a
|
|
154
|
+
* StorefrontError with `errorCode: 'FORBIDDEN'` / `statusCode: 403` to handle.
|
|
155
|
+
* Earlier releases also fired it for a guest's FORBIDDEN.
|
|
135
156
|
*/
|
|
136
157
|
onAuthExpired?: () => void;
|
|
137
158
|
/**
|
|
@@ -465,6 +486,21 @@ export interface StoreContext {
|
|
|
465
486
|
/** Channel tax-display storage mode — see {@link ChannelInfo.pricesIncludeTax}. */
|
|
466
487
|
pricesIncludeTax: boolean;
|
|
467
488
|
authToken: string | null;
|
|
489
|
+
/**
|
|
490
|
+
* `true` while the client knows `authToken` is a SIGNED-IN customer's
|
|
491
|
+
* session: a sign-in through this client succeeded, or an `activeCustomer`
|
|
492
|
+
* read answered a customer. Absent for a token the client never saw signed
|
|
493
|
+
* in (a guest's cart session, or one handed in by `setAuthToken` /
|
|
494
|
+
* `customerToken`); `false` once the server answered no customer. Gates
|
|
495
|
+
* `onAuthExpired`. Treat as internal.
|
|
496
|
+
*/
|
|
497
|
+
customerSession?: boolean;
|
|
498
|
+
/**
|
|
499
|
+
* Bumped on every change to `customerSession` (`core/customer-session.ts`),
|
|
500
|
+
* so a response can tell whether the session it was sent for is still the
|
|
501
|
+
* one the client holds. Treat as internal.
|
|
502
|
+
*/
|
|
503
|
+
customerSessionEpoch?: number;
|
|
468
504
|
/**
|
|
469
505
|
* Active order scope, emitted as the `x-order-scope` header. `null`/absent
|
|
470
506
|
* means "send no header" — legacy, unscoped behaviour. See
|
|
@@ -575,7 +611,7 @@ export interface Asset {
|
|
|
575
611
|
* `@sixtyninecommerce/client/pricing` does exactly that.
|
|
576
612
|
*/
|
|
577
613
|
export type ProductAvailabilityState = Shop.ProductAvailabilityState;
|
|
578
|
-
export type { AddItemInput, AdjustmentType, AuthenticationInput, BreadcrumbFragment, ChannelCustomFieldsFragment, CollectionDetailFragment, CollectionFragment, CollectionRefFragment, ConvertedAmountFragment, CreateAddressInput, CreateCustomerInput, CreateProductReviewInput, CreateQuoteRequestInput, CreditBalanceSource, CurrencyCode, CurrentUserFragment, CustomerPaymentTermsFragment, CustomerReturnFragment, CustomerSubscriptionFragment, DeliveryAdvice, DeliverySelectionSource, DeliveryTermsStatus, DepositPaymentIntentInput, FacetFragment, FacetValueFragment, FavoriteListOptions, LanguageCode, MolliePaymentIntentInput, MolliePaymentMethodsInput, MyPaymentMandateFragment, MyparcelDeliveryOptionsInput, MyparcelDropOffPointInput, NativeAuthInput, OrderDeliveryTermsFragment, OrderFragment, OrderFulfillmentParcelsFragment, OrderFulfillmentsFragment, OrderPaymentIntent, OrderPaymentTermsFragment, OrderReturnReasonCode, OrderReturnSettlementMethod, OrderReturnState, OrderSummaryFragment, OrderWritableCustomFieldsFragment, ParkedOrderFragment, ParkedOrderPaymentIntentInput, PayDepositInput, PaymentInput, PaymentTermsClassification, PaymentTermsStatus, PayParkedOrderInput, PickupLocationSearchInput, PlacementRejectionFragment, PriceTierFragment, ProductAvailabilityFragment, ProductCardFragment, ProductFragment, ProductMetadataFragment, ProductPropertyGroupValuesFragment, ProductReviewFragment, ProductReviewListOptions, ProductSummaryFragment, ProductVariantFragment, PropertyGroupFragment, PublicPaymentMethodFragment, PublicShippingMethodFragment, QuoteFragment, QuoteLegacyFragment, QuoteLineDiscountType, QuoteLineRequestInput, QuoteListOptions, QuoteStatus, RecentReviewsOptions, RecommendedProductGroupFragment, RegisterCustomerInput, RequestReturnInput, ReturnRequestLineInput, ReviewSortKey, ReviewStatus, SavedListFragment, SearchResultFragment, SearchResultItemFragment, SetupPaymentMandateInput, SubscriptionFirstChargeTiming, SubscriptionPlanPublicFragment, SubscriptionPurchaseResultFragment, UpdateAddressInput, UpdateCustomerInput, UpdateOrderCustomFieldsInput, UpdateProductReviewInput, VariantLocationAvailabilityFragment, VatValidationResultFragment, } from './generated/shop.js';
|
|
614
|
+
export type { AddItemInput, AdjustmentType, AuthenticationInput, BreadcrumbFragment, ChannelCustomFieldsFragment, CollectionDetailFragment, CollectionFragment, CollectionRefFragment, ConvertedAmountFragment, CreateAddressInput, CreateCustomerInput, CreateProductReviewInput, CreateQuoteRequestInput, CreditBalanceSource, CurrencyCode, CurrentUserFragment, CustomerPaymentTermsFragment, CustomerReturnFragment, CustomerSubscriptionFragment, DeliveryAdvice, DeliverySelectionSource, DeliveryTermsStatus, DepositPaymentIntentInput, FacetFragment, FacetValueFragment, FavoriteListOptions, LanguageCode, MolliePaymentIntentInput, MolliePaymentMethodsInput, MyPaymentMandateFragment, MyparcelDeliveryOptionsInput, MyparcelDropOffPointInput, NativeAuthInput, OrderDeliveryTermsFragment, OrderFragment, OrderFulfillmentParcelsFragment, OrderFulfillmentsFragment, OrderMoneyBasis, OrderMoneyViewFragment, OrderPaymentIntent, OrderPaymentTermsFragment, OrderReturnReasonCode, OrderReturnSettlementMethod, OrderReturnState, OrderSummaryFragment, OrderWritableCustomFieldsFragment, ParkedOrderFragment, ParkedOrderPaymentIntentInput, PayDepositInput, PaymentInput, PaymentTermsClassification, PaymentTermsStatus, PayParkedOrderInput, PickupLocationSearchInput, PlacementRejectionFragment, PriceTierFragment, ProductAvailabilityFragment, ProductCardFragment, ProductFragment, ProductMetadataFragment, ProductPropertyGroupValuesFragment, ProductReviewFragment, ProductReviewListOptions, ProductSummaryFragment, ProductVariantFragment, PropertyGroupFragment, PublicPaymentMethodFragment, PublicShippingMethodFragment, QuoteFragment, QuoteLegacyFragment, QuoteLineDiscountType, QuoteLineRequestInput, QuoteListOptions, QuoteStatus, RecentReviewsOptions, RecommendedProductGroupFragment, RegisterCustomerInput, RequestReturnInput, ReturnRequestLineInput, ReviewSortKey, ReviewStatus, SavedListFragment, SearchResultFragment, SearchResultItemFragment, SetupPaymentMandateInput, SubscriptionFirstChargeTiming, SubscriptionPlanPublicFragment, SubscriptionPurchaseResultFragment, UpdateAddressInput, UpdateCustomerInput, UpdateOrderCustomFieldsInput, UpdateProductReviewInput, VariantLocationAvailabilityFragment, VatValidationResultFragment, } from './generated/shop.js';
|
|
579
615
|
/** A strategy `commerce.authenticate` can sign in through: a member of the engine's `AuthenticationInput` (`native` today). */
|
|
580
616
|
export type AuthenticationStrategy = keyof Shop.AuthenticationInput;
|
|
581
617
|
/** What a strategy takes — `{ username, password }` for `native`. */
|
|
@@ -627,6 +663,18 @@ export type Product = Omit<Shop.ProductFragment, 'metadata'> & {
|
|
|
627
663
|
* sells (`lines` names them; the store stopped offering a product its
|
|
628
664
|
* organization shares). The buyer removes them. Adding one is refused with the
|
|
629
665
|
* same code.
|
|
666
|
+
* - `GIFT_CARD_LINE_FREE` — the cart holds a gift card priced at nothing
|
|
667
|
+
* (`lines` names it). Gift cards are sold at their price.
|
|
668
|
+
* - `GIFT_CARD_ORDER_DISCOUNT` — money would come off an order that sells gift
|
|
669
|
+
* cards: an order-wide coupon (`details` names it as `couponCode`) or a
|
|
670
|
+
* discount. Gift cards are sold without discounts: the buyer removes the
|
|
671
|
+
* coupon, or buys the gift cards in an order of their own.
|
|
672
|
+
* - `GIFT_CARD_NEEDS_BUYER_EMAIL` — the order sells gift cards, whose codes are
|
|
673
|
+
* sent only by email, and its customer has no address that can receive one.
|
|
674
|
+
* The buyer gives a real email address and places again.
|
|
675
|
+
* - `GIFT_CARD_NOT_FOR_SALE` — the cart holds a gift card, and the store sells
|
|
676
|
+
* none now (`lines` names the card lines). The buyer removes them. Adding a
|
|
677
|
+
* gift card, or raising its quantity, is refused with the same code.
|
|
630
678
|
*/
|
|
631
679
|
export type PlacementRejectionCode = Shop.PlacementRejectionCode;
|
|
632
680
|
/**
|
|
@@ -897,7 +945,21 @@ export interface CollectionListOptions {
|
|
|
897
945
|
export interface OrderListOptions {
|
|
898
946
|
take?: number;
|
|
899
947
|
skip?: number;
|
|
948
|
+
/**
|
|
949
|
+
* Also read each order's money view (`Order.moneyView`) in `basis` (default `CUSTOMER`), so
|
|
950
|
+
* the list prints the same total as the order page: `item.moneyView.total`. `null` on an
|
|
951
|
+
* engine before the field (print `totalWithTax` as before).
|
|
952
|
+
*/
|
|
953
|
+
moneyView?: {
|
|
954
|
+
basis?: Shop.OrderMoneyBasis;
|
|
955
|
+
};
|
|
900
956
|
}
|
|
957
|
+
/** An order-history page with each order's money view. */
|
|
958
|
+
export type CustomerOrdersWithMoneyView = MergedSelection<NonNullable<Shop.CustomerOrdersQuery['activeCustomer']>['orders']> & {
|
|
959
|
+
items: Array<MergedSelection<NonNullable<Shop.CustomerOrdersQuery['activeCustomer']>['orders']['items'][number]> & {
|
|
960
|
+
moneyView: Shop.OrderMoneyViewFragment | null;
|
|
961
|
+
}>;
|
|
962
|
+
};
|
|
901
963
|
/** A "back in stock" subscription, as `subscribeToStockNotification` returns it. */
|
|
902
964
|
export interface StockNotificationSubscriptionResult {
|
|
903
965
|
id: string;
|
|
@@ -1203,6 +1265,21 @@ export type QuoteLine = Shop.QuoteLegacyFragment['lines'][number] & Partial<Omit
|
|
|
1203
1265
|
export type Quote = Omit<Shop.QuoteFragment, 'lines'> & {
|
|
1204
1266
|
lines: QuoteLine[];
|
|
1205
1267
|
};
|
|
1268
|
+
/**
|
|
1269
|
+
* The money on a held order as either parked-order document answers it. `creditNoted` (what the
|
|
1270
|
+
* order's credit notes took off what it bills) and `owed` (what is left to pay after them: the
|
|
1271
|
+
* most a payment may take, and what an omitted amount pays) are `undefined` against an engine
|
|
1272
|
+
* before them, which caps a payment at `outstanding`: read `owed ?? outstanding`.
|
|
1273
|
+
*/
|
|
1274
|
+
export type ParkedOrderPosition = Shop.ParkedOrderLegacyFragment['position'] & Partial<Pick<Shop.ParkedOrderFragment['position'], 'creditNoted' | 'owed'>>;
|
|
1275
|
+
/** A held order as `getParkedOrders` answers it — see {@link ParkedOrderPosition}. */
|
|
1276
|
+
export type ParkedOrder = Omit<Shop.ParkedOrderFragment, 'position'> & {
|
|
1277
|
+
position: ParkedOrderPosition;
|
|
1278
|
+
};
|
|
1279
|
+
/** What `payParkedOrder` answers — see {@link ParkedOrderPosition}. */
|
|
1280
|
+
export type ParkedOrderPaymentResult = Omit<Shop.PayParkedOrderMutation['payParkedOrder'], 'position'> & {
|
|
1281
|
+
position: ParkedOrderPosition;
|
|
1282
|
+
};
|
|
1206
1283
|
/** One page of `getMyQuotes`. */
|
|
1207
1284
|
export type QuoteList = Omit<Shop.MyQuotesQuery['myQuotes'], 'items'> & {
|
|
1208
1285
|
items: Quote[];
|
|
@@ -1371,6 +1448,11 @@ export interface CommerceModule {
|
|
|
1371
1448
|
* released on or after 2026-10-05) when the store no longer sells the product;
|
|
1372
1449
|
* so are `addItemsToCart` (the whole call) and `updateCartLine` raising such a
|
|
1373
1450
|
* line. Lowering or removing a line always works.
|
|
1451
|
+
*
|
|
1452
|
+
* Refused with `StorefrontError` `ORDER_LINE_VARIANT_UNPRICED` (422, an engine
|
|
1453
|
+
* released on or after 2026-10-10) when the store has no price for the product
|
|
1454
|
+
* (`extensions.productVariantIds` names it); the same for `addItemsToCart` and
|
|
1455
|
+
* `updateCartLine` raising such a line. Nothing is added.
|
|
1374
1456
|
*/
|
|
1375
1457
|
addToCart(variantId: string, quantity: number): Promise<Shop.OrderFragment>;
|
|
1376
1458
|
/** Add several variants in one call (e.g. favourite-box bundles). */
|
|
@@ -1721,9 +1803,15 @@ export interface CommerceModule {
|
|
|
1721
1803
|
* Force-fetch the Mollie payment status and reconcile the order state.
|
|
1722
1804
|
* Use as a fallback when the Mollie webhook is delayed or did not arrive
|
|
1723
1805
|
* (e.g. local/staging without a public tunnel). Returns `null` when no
|
|
1724
|
-
* order matches `orderCode`.
|
|
1806
|
+
* order matches `orderCode`. Answered by the same rule as
|
|
1807
|
+
* {@link CommerceModule.getOrderByCode}: pass `{ accessKey }` (the order's
|
|
1808
|
+
* access key from the return URL) when the shopper may be back in another
|
|
1809
|
+
* browser; the key only lets the order be READ, the sync itself only lands
|
|
1810
|
+
* what Mollie reports paid.
|
|
1811
|
+
*
|
|
1812
|
+
* @effect write
|
|
1725
1813
|
*/
|
|
1726
|
-
syncMolliePaymentStatus(orderCode: string, options?: RequestOptions): Promise<Shop.SyncMolliePaymentStatusMutation['syncMolliePaymentStatus']>;
|
|
1814
|
+
syncMolliePaymentStatus(orderCode: string, options?: RequestOptions & import('./commerce/order-access-key.js').OrderAccessKeyOption): Promise<Shop.SyncMolliePaymentStatusMutation['syncMolliePaymentStatus']>;
|
|
1727
1815
|
/**
|
|
1728
1816
|
* Orders the store is currently HOLDING for the signed-in shopper.
|
|
1729
1817
|
*
|
|
@@ -1735,8 +1823,13 @@ export interface CommerceModule {
|
|
|
1735
1823
|
* An order the store is REVIEWING after the shopper paid it (an app the store
|
|
1736
1824
|
* uses could not confirm it) is left out until the store accepts it: nothing
|
|
1737
1825
|
* can be paid on it before then.
|
|
1826
|
+
*
|
|
1827
|
+
* Each `position` says what is left to pay as `owed`: on an order whose
|
|
1828
|
+
* invoice a credit note lowered it is less than `outstanding`, which still
|
|
1829
|
+
* counts the credited part. Against an engine before it, `owed` is absent
|
|
1830
|
+
* (that engine takes up to `outstanding`).
|
|
1738
1831
|
*/
|
|
1739
|
-
getParkedOrders(options?: RequestOptions): Promise<
|
|
1832
|
+
getParkedOrders(options?: RequestOptions): Promise<ParkedOrder[]>;
|
|
1740
1833
|
/**
|
|
1741
1834
|
* Pay some or all of what a held order still owes. Requires a signed-in
|
|
1742
1835
|
* customer, and the order must be theirs.
|
|
@@ -1752,6 +1845,10 @@ export interface CommerceModule {
|
|
|
1752
1845
|
* card method is refused `PAYMENT_METHOD_UNUSABLE_HERE`; use
|
|
1753
1846
|
* {@link CommerceModule.createParkedOrderPaymentIntent} for a card.
|
|
1754
1847
|
*
|
|
1848
|
+
* An omitted `amount` pays what the order still owes (`position.owed`); more
|
|
1849
|
+
* than that is refused `AMOUNT_EXCEEDS_OUTSTANDING`, its message naming the
|
|
1850
|
+
* credit notes when they lowered it.
|
|
1851
|
+
*
|
|
1755
1852
|
* Pass `idempotencyKey` for anything a shopper can double-tap: a repeat under
|
|
1756
1853
|
* the same key returns the first payment instead of taking the money twice.
|
|
1757
1854
|
*
|
|
@@ -1762,11 +1859,11 @@ export interface CommerceModule {
|
|
|
1762
1859
|
*/
|
|
1763
1860
|
payParkedOrder(orderCode: string, input: Shop.PayParkedOrderInput, options?: RequestOptions & {
|
|
1764
1861
|
idempotencyKey?: string;
|
|
1765
|
-
}): Promise<
|
|
1862
|
+
}): Promise<ParkedOrderPaymentResult>;
|
|
1766
1863
|
/**
|
|
1767
|
-
* Open a CARD payment for one of the signed-in shopper's held orders, for
|
|
1768
|
-
*
|
|
1769
|
-
* and send the shopper to the returned `url`.
|
|
1864
|
+
* Open a CARD payment for one of the signed-in shopper's held orders, for
|
|
1865
|
+
* what it still owes (`position.owed`, or, where the store takes deposits,
|
|
1866
|
+
* part of it), and send the shopper to the returned `url`.
|
|
1770
1867
|
*
|
|
1771
1868
|
* Nothing is paid by this call and the order does not change: the money is
|
|
1772
1869
|
* recorded on the order when the provider confirms it, and the order leaves
|
|
@@ -1783,6 +1880,14 @@ export interface CommerceModule {
|
|
|
1783
1880
|
createParkedOrderPaymentIntent(orderCode: string, input: Shop.ParkedOrderPaymentIntentInput, options?: RequestOptions & {
|
|
1784
1881
|
idempotencyKey?: string;
|
|
1785
1882
|
}): Promise<Shop.CreateParkedOrderPaymentIntentMutation['createParkedOrderPaymentIntent']>;
|
|
1883
|
+
/**
|
|
1884
|
+
* Sign in with email and password. An imported account without a password
|
|
1885
|
+
* answers `password_reset_required`, an unverified one `account_not_verified`;
|
|
1886
|
+
* a wrong password throws `INVALID_CREDENTIALS_ERROR`. A success marks the
|
|
1887
|
+
* client signed in, so a later lost session fires `onAuthExpired`.
|
|
1888
|
+
*
|
|
1889
|
+
* @effect write
|
|
1890
|
+
*/
|
|
1786
1891
|
login(email: string, password: string): Promise<LoginResult>;
|
|
1787
1892
|
/**
|
|
1788
1893
|
* Sign in through a named authentication strategy — the general form of
|
|
@@ -1802,6 +1907,11 @@ export interface CommerceModule {
|
|
|
1802
1907
|
* whose lifetime the engine's session duration decides. A blank `strategy`
|
|
1803
1908
|
* or an `input` that is not an object throws a 400 `INVALID_ARGUMENT` before
|
|
1804
1909
|
* any request.
|
|
1910
|
+
*
|
|
1911
|
+
* A success marks the client signed in, so a later lost session fires
|
|
1912
|
+
* `onAuthExpired`.
|
|
1913
|
+
*
|
|
1914
|
+
* @effect write
|
|
1805
1915
|
*/
|
|
1806
1916
|
authenticate<S extends AuthenticationStrategy>(strategy: S, input: AuthenticationStrategyInput<S>, options?: RequestOptions & {
|
|
1807
1917
|
rememberMe?: boolean;
|
|
@@ -1809,7 +1919,22 @@ export interface CommerceModule {
|
|
|
1809
1919
|
register(input: Shop.RegisterCustomerInput): Promise<{
|
|
1810
1920
|
success: boolean;
|
|
1811
1921
|
}>;
|
|
1922
|
+
/**
|
|
1923
|
+
* End the session: clears the token, fires `onAuthCleared`, and forgets that
|
|
1924
|
+
* the client was signed in (no `onAuthExpired` follows).
|
|
1925
|
+
*
|
|
1926
|
+
* @effect write
|
|
1927
|
+
*/
|
|
1812
1928
|
logout(): Promise<void>;
|
|
1929
|
+
/**
|
|
1930
|
+
* The signed-in customer, or `null` for a guest or a session that lost its
|
|
1931
|
+
* sign-in. Also teaches the client which one its token is: a customer makes
|
|
1932
|
+
* a later lost session fire `onAuthExpired`, `null` does not. A storefront
|
|
1933
|
+
* that restores a stored token with `setAuthToken` reads this first when it
|
|
1934
|
+
* wants that callback.
|
|
1935
|
+
*
|
|
1936
|
+
* @effect read
|
|
1937
|
+
*/
|
|
1813
1938
|
getCurrentCustomer(): Promise<Shop.MeQuery['activeCustomer']>;
|
|
1814
1939
|
/**
|
|
1815
1940
|
* Price lists currently applying to the signed-in customer (identity only,
|
|
@@ -1821,8 +1946,47 @@ export interface CommerceModule {
|
|
|
1821
1946
|
* The signed-in customer's placed orders, newest first: the order-history rows
|
|
1822
1947
|
* with each line's `backorderedQuantity` and every parcel's barcode
|
|
1823
1948
|
* (`fulfillments[].trackingCodes`). An empty page for an anonymous visitor.
|
|
1949
|
+
* `{ moneyView: { basis } }` adds each order's money view (see {@link OrderListOptions}).
|
|
1950
|
+
*
|
|
1951
|
+
* @effect read
|
|
1952
|
+
*/
|
|
1953
|
+
getCustomerOrders(options: OrderListOptions & {
|
|
1954
|
+
moneyView: {
|
|
1955
|
+
basis?: Shop.OrderMoneyBasis;
|
|
1956
|
+
};
|
|
1957
|
+
}): Promise<CustomerOrdersWithMoneyView>;
|
|
1958
|
+
getCustomerOrders(options?: OrderListOptions & {
|
|
1959
|
+
moneyView?: undefined;
|
|
1960
|
+
}): Promise<MergedSelection<NonNullable<Shop.CustomerOrdersQuery['activeCustomer']>['orders']>>;
|
|
1961
|
+
getCustomerOrders(options?: OrderListOptions): Promise<MergedSelection<NonNullable<Shop.CustomerOrdersQuery['activeCustomer']>['orders']> | CustomerOrdersWithMoneyView>;
|
|
1962
|
+
/**
|
|
1963
|
+
* The order's money as the engine prints it on the dashboard, in emails and on invoices: rows
|
|
1964
|
+
* that add up exactly to the order's own totals, in `options.basis` (default `CUSTOMER`: how
|
|
1965
|
+
* the shop shows prices to that customer). `'active'` is the shopper's cart; `{ code }` a
|
|
1966
|
+
* placed order the shopper may read (as `getOrderByCode`, else `NOT_FOUND`, 404). Print it
|
|
1967
|
+
* with `orderMoneyRows(view)`; never add the figures up yourself.
|
|
1968
|
+
*
|
|
1969
|
+
* Resolves `null` when there is nothing to print from: no active order, or an engine before
|
|
1970
|
+
* `Order.moneyView` (print the order's own fields as before). Refused before sending:
|
|
1971
|
+
* `INVALID_ORDER_MONEY_BASIS` and `INVALID_ORDER_MONEY_TARGET` (400), and a
|
|
1972
|
+
* blank `accessKey` (`INVALID_ARGUMENT`). `{ accessKey }` reads a `{ code }`
|
|
1973
|
+
* order as {@link CommerceModule.getOrderByCode} does.
|
|
1974
|
+
*
|
|
1975
|
+
* @effect read
|
|
1824
1976
|
*/
|
|
1825
|
-
|
|
1977
|
+
getOrderMoneyView(order: import('./commerce/money-view.js').OrderMoneyViewTarget, options?: RequestOptions & import('./commerce/order-access-key.js').OrderAccessKeyOption & {
|
|
1978
|
+
basis?: Shop.OrderMoneyBasis;
|
|
1979
|
+
}): Promise<Shop.OrderMoneyViewFragment | null>;
|
|
1980
|
+
/**
|
|
1981
|
+
* The cart's private access key (`Order.accessKey`), to put in the payment
|
|
1982
|
+
* return URL so the confirmation page can read the order in whatever browser
|
|
1983
|
+
* the shopper comes back in: `getOrderByCode(code, { accessKey })`. `null`
|
|
1984
|
+
* with no cart, no keys configured on the engine, or an engine before the
|
|
1985
|
+
* field. A secret of the shopper's: never log it or send it to analytics.
|
|
1986
|
+
*
|
|
1987
|
+
* @effect read
|
|
1988
|
+
*/
|
|
1989
|
+
getActiveOrderAccessKey(options?: RequestOptions): Promise<string | null>;
|
|
1826
1990
|
/**
|
|
1827
1991
|
* Add every line of a previous order to the active cart. Returns the new
|
|
1828
1992
|
* active order plus a list of lines that could not be added (e.g. variant
|
|
@@ -1872,9 +2036,23 @@ export interface CommerceModule {
|
|
|
1872
2036
|
*/
|
|
1873
2037
|
setPassword(newPassword: string): Promise<void>;
|
|
1874
2038
|
requestPasswordReset(emailAddress: string): Promise<void>;
|
|
2039
|
+
/**
|
|
2040
|
+
* Set a new password from a reset token and sign in.
|
|
2041
|
+
* A success marks the client signed in, so a later lost session fires
|
|
2042
|
+
* `onAuthExpired`.
|
|
2043
|
+
*
|
|
2044
|
+
* @effect write
|
|
2045
|
+
*/
|
|
1875
2046
|
resetPassword(token: string, password: string): Promise<Shop.CurrentUserFragment>;
|
|
1876
2047
|
requestEmailUpdate(password: string, newEmailAddress: string): Promise<void>;
|
|
1877
2048
|
updateEmail(token: string): Promise<void>;
|
|
2049
|
+
/**
|
|
2050
|
+
* Verify the account from its emailed token and sign in.
|
|
2051
|
+
* A success marks the client signed in, so a later lost session fires
|
|
2052
|
+
* `onAuthExpired`.
|
|
2053
|
+
*
|
|
2054
|
+
* @effect write
|
|
2055
|
+
*/
|
|
1878
2056
|
verifyAccount(token: string, password?: string): Promise<Shop.CurrentUserFragment>;
|
|
1879
2057
|
refreshVerification(emailAddress: string): Promise<void>;
|
|
1880
2058
|
/**
|
|
@@ -1886,7 +2064,21 @@ export interface CommerceModule {
|
|
|
1886
2064
|
* credential limiter does. Neither reveals whether the account exists.
|
|
1887
2065
|
*/
|
|
1888
2066
|
requestMagicLink(emailAddress: string, options?: RequestMagicLinkOptions): Promise<void>;
|
|
2067
|
+
/**
|
|
2068
|
+
* Sign in with the emailed link's token.
|
|
2069
|
+
* A success marks the client signed in, so a later lost session fires
|
|
2070
|
+
* `onAuthExpired`.
|
|
2071
|
+
*
|
|
2072
|
+
* @effect write
|
|
2073
|
+
*/
|
|
1889
2074
|
loginWithMagicLink(token: string): Promise<Shop.CurrentUserFragment>;
|
|
2075
|
+
/**
|
|
2076
|
+
* Sign in with the emailed 6-digit code.
|
|
2077
|
+
* A success marks the client signed in, so a later lost session fires
|
|
2078
|
+
* `onAuthExpired`.
|
|
2079
|
+
*
|
|
2080
|
+
* @effect write
|
|
2081
|
+
*/
|
|
1890
2082
|
loginWithMagicCode(emailAddress: string, code: string): Promise<Shop.CurrentUserFragment>;
|
|
1891
2083
|
createAddress(input: Shop.CreateAddressInput): Promise<Shop.CreateAddressMutation['createCustomerAddress']>;
|
|
1892
2084
|
updateAddress(input: Shop.UpdateAddressInput): Promise<Shop.UpdateAddressMutation['updateCustomerAddress']>;
|
|
@@ -1896,10 +2088,32 @@ export interface CommerceModule {
|
|
|
1896
2088
|
* One of the shopper's orders by code — the cart selection plus what a placed
|
|
1897
2089
|
* order carries: `lines[].backorderedQuantity`, `customFields.chargedParcelCount`,
|
|
1898
2090
|
* the fulfilments with every parcel's barcode, the external shipments and the
|
|
1899
|
-
* payment and delivery terms frozen at acceptance.
|
|
1900
|
-
*
|
|
1901
|
-
|
|
1902
|
-
|
|
2091
|
+
* payment and delivery terms frozen at acceptance.
|
|
2092
|
+
*
|
|
2093
|
+
* Answered only to the signed-in customer whose order it is, or to the guest
|
|
2094
|
+
* session that put the order together (the client's own session token), for
|
|
2095
|
+
* as long as that session lives: there is no limit on the order's age. The
|
|
2096
|
+
* platform drops a guest session after a year, or once it has held no cart for
|
|
2097
|
+
* 7 days; a storefront that loses or clears the token loses it too. Anyone
|
|
2098
|
+
* else, another browser of the same guest or a later session of the same
|
|
2099
|
+
* browser included, gets a `FORBIDDEN` `StorefrontError` (403), and so does a
|
|
2100
|
+
* code that names no order: the server never tells the two apart. (`NOT_FOUND`
|
|
2101
|
+
* is thrown only if the server answers no order without an error.) A
|
|
2102
|
+
* confirmation page shows a "thank you, order {code} received, the details are
|
|
2103
|
+
* in your email" fallback on `FORBIDDEN`, never the order's contents. A
|
|
2104
|
+
* guest's `FORBIDDEN` here never fires `onAuthExpired`: its session is alive.
|
|
2105
|
+
*
|
|
2106
|
+
* `{ accessKey }`: the order's private access key (the `key` of the order
|
|
2107
|
+
* email's "view your order" link, or `getActiveOrderAccessKey()` put in the
|
|
2108
|
+
* return URL). With it a client with NO sign-in reads this one order in any
|
|
2109
|
+
* browser, for as long as the order exists; a signed-in client's login
|
|
2110
|
+
* decides instead, so sign-in-aware pages send it from an anonymous client.
|
|
2111
|
+
* A wrong or foreign key is the same `FORBIDDEN`. A blank one is refused
|
|
2112
|
+
* before sending (`INVALID_ARGUMENT`).
|
|
2113
|
+
*
|
|
2114
|
+
* @effect read
|
|
2115
|
+
*/
|
|
2116
|
+
getOrderByCode(code: string, options?: import('./commerce/order-access-key.js').OrderAccessKeyOption): Promise<MergedSelection<NonNullable<Shop.OrderByCodeQuery['orderByCode']>>>;
|
|
1903
2117
|
/** Invoices for one of the signed-in customer's own orders. */
|
|
1904
2118
|
getMyOrderInvoices(orderCode: string): Promise<Shop.MyOrderInvoicesQuery['myOrderInvoices']>;
|
|
1905
2119
|
/** Download one of the signed-in customer's own invoices as a base64 PDF. */
|
|
@@ -1937,9 +2151,27 @@ export interface CommerceModule {
|
|
|
1937
2151
|
subscribeToStockNotification(productVariantId: string, emailAddress?: string): Promise<StockNotificationSubscriptionResult>;
|
|
1938
2152
|
unsubscribeFromStockNotification(token: string): Promise<boolean>;
|
|
1939
2153
|
getProductRecommendations(productId: string, groupSlug?: string): Promise<Shop.RecommendedProductGroupFragment[]>;
|
|
2154
|
+
/** The shops that offer pickup, each with `available` for the active order (never a quantity). */
|
|
2155
|
+
getStorePickupLocations(): Promise<Shop.StorePickupLocationFragment[]>;
|
|
2156
|
+
/** The active order's store pickup: the chosen shop, then the pickup's state once placed. */
|
|
2157
|
+
getActiveOrderStorePickup(): Promise<NonNullable<Shop.ActiveOrderStorePickupQuery['activeOrder']>['storePickup'] | null>;
|
|
2158
|
+
/**
|
|
2159
|
+
* Collect the active order at a shop: names it (the shipping address becomes the shop's), then
|
|
2160
|
+
* selects the store-pickup method. `STORE_PICKUP_METHOD_UNAVAILABLE` when the method is not
|
|
2161
|
+
* eligible (the shop is short of an item, or the store has none).
|
|
2162
|
+
*/
|
|
2163
|
+
chooseStorePickup(stockLocationId: string): Promise<Shop.OrderFragment>;
|
|
2164
|
+
/** Stop collecting at a shop (call it before the shopper's own address and method). */
|
|
2165
|
+
clearStorePickup(): Promise<Shop.OrderFragment>;
|
|
1940
2166
|
getAgeVerificationStatus(): Promise<Shop.AgeVerificationStatusQuery['ageVerificationStatus']>;
|
|
1941
2167
|
submitDateOfBirth(dateOfBirth: string): Promise<Shop.SubmitDateOfBirthMutation['submitDateOfBirth']>;
|
|
1942
2168
|
confirmAge(): Promise<Shop.ConfirmAgeMutation['confirmAge']>;
|
|
2169
|
+
/**
|
|
2170
|
+
* Add a till purchase to the signed-in shopper's account with the token of its receipt link
|
|
2171
|
+
* (read it with `receiptClaimTokenFrom(window.location)`). `alreadyYours` when it already was.
|
|
2172
|
+
* Every refusal is `POS_RECEIPT_CLAIM_NOT_FOUND`; a guest is `FORBIDDEN`.
|
|
2173
|
+
*/
|
|
2174
|
+
claimReceipt(token: string): Promise<Shop.ClaimPosReceiptMutation['claimPosReceipt']>;
|
|
1943
2175
|
getProductReviews(productId: string, options?: Shop.ProductReviewListOptions): Promise<Shop.ProductReviewsQuery['productReviews']>;
|
|
1944
2176
|
getRecentProductReviews(options?: Shop.RecentReviewsOptions): Promise<Shop.ProductReviewFragment[]>;
|
|
1945
2177
|
getReviewRatingSummary(productId: string): Promise<Shop.ProductRatingSummaryQuery['productRatingSummary']>;
|
|
@@ -1953,24 +2185,83 @@ export interface CommerceModule {
|
|
|
1953
2185
|
voteReview(reviewId: string, isHelpful: boolean): Promise<boolean>;
|
|
1954
2186
|
reportReview(reviewId: string, reason: string): Promise<boolean>;
|
|
1955
2187
|
uploadReviewMedia(files: File[]): Promise<Shop.UploadReviewMediaMutation['uploadReviewMedia']>;
|
|
2188
|
+
/**
|
|
2189
|
+
* Refusals: `FORBIDDEN` (signed out), `SUBSCRIPTION_GUEST_NOT_ALLOWED` (no customer in this
|
|
2190
|
+
* store), `SUBSCRIPTION_NOT_FOUND` (not the customer's, or not in this store).
|
|
2191
|
+
*/
|
|
1956
2192
|
getMySubscription(id: string): Promise<Shop.CustomerSubscriptionFragment | null>;
|
|
2193
|
+
/**
|
|
2194
|
+
* Refusals: `SUBSCRIPTION_PLAN_UNAVAILABLE`, `SUBSCRIPTION_MANDATE_UNAVAILABLE`,
|
|
2195
|
+
* `SUBSCRIPTION_GUEST_NOT_ALLOWED` (a `mandateId` while signed out), and what stops the store
|
|
2196
|
+
* billing the plan (`SUBSCRIPTION_PRODUCT_UNAVAILABLE`, `SUBSCRIPTION_SHIPPING_UNAVAILABLE`,
|
|
2197
|
+
* `SUBSCRIPTION_CURRENCY_NOT_AVAILABLE`).
|
|
2198
|
+
*/
|
|
1957
2199
|
previewSubscriptionPurchase(planId: string, options?: {
|
|
1958
2200
|
provider?: 'mollie' | 'stripe';
|
|
1959
2201
|
mandateId?: string;
|
|
1960
2202
|
}): Promise<Shop.SubscriptionPurchasePreviewQuery['subscriptionPurchasePreview']>;
|
|
2203
|
+
/**
|
|
2204
|
+
* Refusals, each before any payment starts: `SUBSCRIPTION_PREVIEW_CONFLICT` (the price changed
|
|
2205
|
+
* since the preview: preview again and confirm again), `SUBSCRIPTION_REQUEST_KEY_CONFLICT` (the
|
|
2206
|
+
* key belongs to another action), `SUBSCRIPTION_REQUEST_KEY_INVALID`,
|
|
2207
|
+
* `SUBSCRIPTION_RETURN_URL_INVALID`, `SUBSCRIPTION_INPUT_INVALID` (no or an unknown provider),
|
|
2208
|
+
* `SUBSCRIPTION_PLAN_UNAVAILABLE`, `SUBSCRIPTION_MANDATE_UNAVAILABLE`,
|
|
2209
|
+
* `SUBSCRIPTION_AMOUNT_UNREPRESENTABLE`, the order the store cannot build
|
|
2210
|
+
* (`SUBSCRIPTION_ADDRESS_REQUIRED`, `SUBSCRIPTION_PRODUCT_UNAVAILABLE`,
|
|
2211
|
+
* `SUBSCRIPTION_SHIPPING_UNAVAILABLE`, `SUBSCRIPTION_STOCK_INSUFFICIENT`,
|
|
2212
|
+
* `SUBSCRIPTION_ORDER_REFUSED`), `FORBIDDEN` (signed out) and `SUBSCRIPTION_GUEST_NOT_ALLOWED`
|
|
2213
|
+
* (no customer in this store).
|
|
2214
|
+
*/
|
|
1961
2215
|
startSubscriptionPurchase(input: SubscriptionPurchaseInput): Promise<Shop.SubscriptionPurchaseResultFragment>;
|
|
2216
|
+
/**
|
|
2217
|
+
* Refusals: `SUBSCRIPTION_PURCHASE_NOT_FOUND`, `FORBIDDEN` (signed out),
|
|
2218
|
+
* `SUBSCRIPTION_GUEST_NOT_ALLOWED` (no customer in this store).
|
|
2219
|
+
*/
|
|
1962
2220
|
getSubscriptionPurchaseStatus(id: string): Promise<Shop.SubscriptionPurchaseResultFragment>;
|
|
2221
|
+
/**
|
|
2222
|
+
* Refusals: `SUBSCRIPTION_NOT_FOUND`, `FORBIDDEN` (signed out),
|
|
2223
|
+
* `SUBSCRIPTION_GUEST_NOT_ALLOWED` (no customer in this store),
|
|
2224
|
+
* `SUBSCRIPTION_INPUT_INVALID` (an action the storefront may not ask for). A change that is not
|
|
2225
|
+
* possible now is not refused here: it answers `allowed: false` with its `reason`.
|
|
2226
|
+
*/
|
|
1963
2227
|
previewMySubscriptionChange(id: string, input: SubscriptionLifecycleCommand): Promise<Shop.PreviewMySubscriptionChangeQuery['previewMySubscriptionChange']>;
|
|
2228
|
+
/**
|
|
2229
|
+
* Refusals (also of `skipMySubscription`, `rescheduleMySubscription`,
|
|
2230
|
+
* `undoMySubscriptionCancellation`): `SUBSCRIPTION_NOT_FOUND`, `FORBIDDEN` (signed out),
|
|
2231
|
+
* `SUBSCRIPTION_GUEST_NOT_ALLOWED` (no customer in this store),
|
|
2232
|
+
* `SUBSCRIPTION_OVERRIDE_NOT_ALLOWED` (a staff-only option), `SUBSCRIPTION_INPUT_INVALID`,
|
|
2233
|
+
* `SUBSCRIPTION_DATE_INVALID`, `SUBSCRIPTION_REQUEST_KEY_CONFLICT` /
|
|
2234
|
+
* `SUBSCRIPTION_REQUEST_KEY_INVALID`, and the change not possible now:
|
|
2235
|
+
* `SUBSCRIPTION_CHANGE_CUTOFF_PASSED`, `SUBSCRIPTION_CYCLE_UNRESOLVED`,
|
|
2236
|
+
* `SUBSCRIPTION_STATUS_BLOCKS_CHANGE`, `SUBSCRIPTION_AWAITING_PAYMENT_METHOD`,
|
|
2237
|
+
* `SUBSCRIPTION_CANCELLATION_EFFECTIVE`, `SUBSCRIPTION_NO_NEXT_RENEWAL` (re-read the
|
|
2238
|
+
* subscription and show its `allowedActions`).
|
|
2239
|
+
*/
|
|
1964
2240
|
manageMySubscription(id: string, input: SubscriptionLifecycleCommand): Promise<Shop.CustomerSubscriptionFragment>;
|
|
1965
2241
|
skipMySubscription(id: string, requestKey: string): Promise<Shop.CustomerSubscriptionFragment>;
|
|
1966
2242
|
rescheduleMySubscription(id: string, date: string, requestKey: string): Promise<Shop.CustomerSubscriptionFragment>;
|
|
1967
2243
|
undoMySubscriptionCancellation(id: string, requestKey: string): Promise<Shop.CustomerSubscriptionFragment>;
|
|
2244
|
+
/**
|
|
2245
|
+
* Refusals: `SUBSCRIPTION_NOT_FOUND`, `FORBIDDEN` (signed out),
|
|
2246
|
+
* `SUBSCRIPTION_GUEST_NOT_ALLOWED` (no customer in this store),
|
|
2247
|
+
* `SUBSCRIPTION_INPUT_INVALID` (no or an unknown provider), `SUBSCRIPTION_RETURN_URL_INVALID`,
|
|
2248
|
+
* `SUBSCRIPTION_REQUEST_KEY_CONFLICT` / `SUBSCRIPTION_REQUEST_KEY_INVALID`,
|
|
2249
|
+
* `SUBSCRIPTION_STATUS_BLOCKS_CHANGE`, `SUBSCRIPTION_PAYMENT_UNRESOLVED` (a setup is still open).
|
|
2250
|
+
*/
|
|
1968
2251
|
replaceMySubscriptionMandate(id: string, input: SubscriptionPaymentActionInput & {
|
|
1969
2252
|
provider: 'mollie' | 'stripe';
|
|
1970
2253
|
}): Promise<Shop.SubscriptionPurchaseResultFragment>;
|
|
1971
2254
|
/**
|
|
1972
2255
|
* A hosted link that pays the outstanding failed or charged-back cycle again,
|
|
1973
2256
|
* without another delivery. Reuse `upcomingPayment.checkoutUrl` while it is live.
|
|
2257
|
+
*
|
|
2258
|
+
* Refusals: `SUBSCRIPTION_NOT_FOUND`, `FORBIDDEN` (signed out),
|
|
2259
|
+
* `SUBSCRIPTION_GUEST_NOT_ALLOWED` (no customer in this store),
|
|
2260
|
+
* `SUBSCRIPTION_RETURN_URL_INVALID`, `SUBSCRIPTION_REQUEST_KEY_CONFLICT` /
|
|
2261
|
+
* `SUBSCRIPTION_REQUEST_KEY_INVALID`, `SUBSCRIPTION_STATUS_BLOCKS_CHANGE`,
|
|
2262
|
+
* `SUBSCRIPTION_PAYMENT_UNRESOLVED` (the previous payment is not definitively over),
|
|
2263
|
+
* `SUBSCRIPTION_CYCLE_PAYMENT_HELD` (the store must reconcile a payment it holds),
|
|
2264
|
+
* `SUBSCRIPTION_AMOUNT_UNREPRESENTABLE`.
|
|
1974
2265
|
*/
|
|
1975
2266
|
recoverMySubscriptionPayment(id: string, input: SubscriptionPaymentActionInput): Promise<Shop.SubscriptionPurchaseResultFragment>;
|
|
1976
2267
|
getMySubscriptions(): Promise<Shop.CustomerSubscriptionFragment[]>;
|
|
@@ -1987,14 +2278,26 @@ export interface CommerceModule {
|
|
|
1987
2278
|
/**
|
|
1988
2279
|
* Begin establishing a payment mandate. Returns a `checkoutUrl` (Mollie) or
|
|
1989
2280
|
* `clientSecret` (Stripe) for the frontend to complete the setup.
|
|
2281
|
+
*
|
|
2282
|
+
* Refusals: `FORBIDDEN` (signed out), `SUBSCRIPTION_RETURN_URL_INVALID` (`redirectUrl`),
|
|
2283
|
+
* `SUBSCRIPTION_INPUT_INVALID` (an unknown provider).
|
|
1990
2284
|
*/
|
|
1991
2285
|
setupPaymentMandate(input: Shop.SetupPaymentMandateInput): Promise<Shop.SetupPaymentMandateMutation['setupPaymentMandate']>;
|
|
1992
2286
|
/**
|
|
1993
2287
|
* Create a subscription for the active customer against an enabled plan
|
|
1994
2288
|
* using one of their valid mandates.
|
|
2289
|
+
*
|
|
2290
|
+
* Refusals: `FORBIDDEN` (signed out, or another customer's mandate),
|
|
2291
|
+
* `SUBSCRIPTION_MANDATE_NOT_FOUND`, `SUBSCRIPTION_MANDATE_NOT_VALID` (not verified yet),
|
|
2292
|
+
* `SUBSCRIPTION_PLAN_UNAVAILABLE`, and `startSubscriptionPurchase`'s order and request-key
|
|
2293
|
+
* refusals.
|
|
1995
2294
|
*/
|
|
1996
2295
|
createSubscription(planId: string, mandateId: string, requestKey?: string): Promise<Shop.CustomerSubscriptionFragment>;
|
|
1997
|
-
/**
|
|
2296
|
+
/**
|
|
2297
|
+
* Pause an active or trial subscription owned by the active customer. Refusals (also of
|
|
2298
|
+
* `resumeMySubscription` and `cancelMySubscription`): `FORBIDDEN` (signed out, or another
|
|
2299
|
+
* customer's), `SUBSCRIPTION_NOT_FOUND`, and `manageMySubscription`'s "not possible now" codes.
|
|
2300
|
+
*/
|
|
1998
2301
|
pauseMySubscription(id: string, reason?: string): Promise<Shop.CustomerSubscriptionFragment>;
|
|
1999
2302
|
/** Resume a paused subscription owned by the active customer. */
|
|
2000
2303
|
resumeMySubscription(id: string): Promise<Shop.CustomerSubscriptionFragment>;
|
|
@@ -2056,8 +2359,15 @@ export interface CommerceModule {
|
|
|
2056
2359
|
* Per-line returnable quantities and the return window for one of the
|
|
2057
2360
|
* active customer's orders — drives the return-request UI. Lines only
|
|
2058
2361
|
* appear once they have shipped/delivered quantity.
|
|
2362
|
+
*
|
|
2363
|
+
* A unit an invoice correction already credited is not returnable: each
|
|
2364
|
+
* line says how many (`creditedQty`) and on which credit notes
|
|
2365
|
+
* (`correctionCredits`), so the UI can say "1 already credited on
|
|
2366
|
+
* CN-00053"; `requestReturn` refuses more with
|
|
2367
|
+
* `RETURN_QUANTITY_ALREADY_CREDITED`. Needs a vendure-server that serves
|
|
2368
|
+
* those fields.
|
|
2059
2369
|
*/
|
|
2060
|
-
getReturnableLinesForOrder(orderId: string): Promise<
|
|
2370
|
+
getReturnableLinesForOrder(orderId: string): Promise<ReturnableLinesForOrder>;
|
|
2061
2371
|
getMyVatValidationStatus(): Promise<Shop.VatValidationResultFragment | null>;
|
|
2062
2372
|
setMyVatNumber(vatNumber: string): Promise<Shop.VatValidationResultFragment>;
|
|
2063
2373
|
clearMyVatNumber(): Promise<boolean>;
|
|
@@ -2237,6 +2547,9 @@ export interface PricingModule {
|
|
|
2237
2547
|
* lines' gross total (`subTotalWithTax`, no shipping), the net minimum and
|
|
2238
2548
|
* the delivery minimum (`fulfillmentMinOrderNet`, skipped for an exempt
|
|
2239
2549
|
* customer) against the lines' net total (`subTotal`), and the item count.
|
|
2550
|
+
* The gross and net minimums are judged before a price-list order-rule
|
|
2551
|
+
* discount ("Order discount"), as the engine judges them, when the order
|
|
2552
|
+
* carries its `discounts` and `promotions` (as `OrderFragment` does).
|
|
2240
2553
|
*
|
|
2241
2554
|
* Amounts are formatted in `constraints.currencyCode` and compared only with
|
|
2242
2555
|
* an order in that currency; when the two differ (constraints fetched before
|
|
@@ -2262,6 +2575,23 @@ export interface PricingModule {
|
|
|
2262
2575
|
*/
|
|
2263
2576
|
subTotal?: number;
|
|
2264
2577
|
total?: number;
|
|
2578
|
+
/**
|
|
2579
|
+
* The order's discounts (`Order.discounts`). With `promotions`, the
|
|
2580
|
+
* price-list order-rule discount is added back before the gross and net
|
|
2581
|
+
* minimums are compared.
|
|
2582
|
+
*/
|
|
2583
|
+
discounts?: ReadonlyArray<{
|
|
2584
|
+
adjustmentSource: string;
|
|
2585
|
+
amount: number;
|
|
2586
|
+
amountWithTax: number;
|
|
2587
|
+
}>;
|
|
2588
|
+
/** The order's promotions with their condition codes (`OrderFragment.promotions`). */
|
|
2589
|
+
promotions?: ReadonlyArray<{
|
|
2590
|
+
id: string;
|
|
2591
|
+
conditions?: ReadonlyArray<{
|
|
2592
|
+
code: string;
|
|
2593
|
+
}> | null;
|
|
2594
|
+
}>;
|
|
2265
2595
|
}, constraints: {
|
|
2266
2596
|
minOrderAmountGross?: number | null;
|
|
2267
2597
|
minOrderAmountNet?: number | null;
|
|
@@ -2404,7 +2734,15 @@ export interface StorefrontClient {
|
|
|
2404
2734
|
readonly maintenanceMode: boolean;
|
|
2405
2735
|
setLanguage(code: string): void;
|
|
2406
2736
|
getLanguage(): string;
|
|
2737
|
+
/**
|
|
2738
|
+
* Send this session token on every Shop API call (a token restored from a
|
|
2739
|
+
* cookie or storage). The client cannot tell a guest's token from a
|
|
2740
|
+
* customer's, so it does not count as signed in — and `onAuthExpired` does
|
|
2741
|
+
* not fire for it — until `commerce.getCurrentCustomer()` returns a customer
|
|
2742
|
+
* or a sign-in succeeds.
|
|
2743
|
+
*/
|
|
2407
2744
|
setAuthToken(token: string): void;
|
|
2745
|
+
/** Stop sending a session token; the client is no longer signed in. */
|
|
2408
2746
|
clearAuthToken(): void;
|
|
2409
2747
|
/**
|
|
2410
2748
|
* Change which storefront this client speaks for. Takes effect on the next
|
|
@@ -2434,4 +2772,14 @@ export interface StorefrontClient {
|
|
|
2434
2772
|
*/
|
|
2435
2773
|
graphql<T = unknown>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
2436
2774
|
}
|
|
2775
|
+
/** One line of {@link ReturnableLinesForOrder}. */
|
|
2776
|
+
export type ReturnableLineForOrder = Shop.ReturnableLinesForOrderLegacyQuery['returnableLinesForOrder']['lines'][number] & Partial<Pick<Shop.ReturnableLinesForOrderQuery['returnableLinesForOrder']['lines'][number], 'creditedQty' | 'correctionCredits'>>;
|
|
2777
|
+
/**
|
|
2778
|
+
* What `getReturnableLinesForOrder` answers. `creditedQty` and `correctionCredits` are absent from
|
|
2779
|
+
* an engine released before 2026-10-09, which does not subtract what an invoice correction
|
|
2780
|
+
* credited.
|
|
2781
|
+
*/
|
|
2782
|
+
export type ReturnableLinesForOrder = Omit<Shop.ReturnableLinesForOrderLegacyQuery['returnableLinesForOrder'], 'lines'> & {
|
|
2783
|
+
lines: ReturnableLineForOrder[];
|
|
2784
|
+
};
|
|
2437
2785
|
//# sourceMappingURL=types.d.ts.map
|