@wix/himalaya-cli 0.1279.0 → 0.1281.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.
Files changed (27) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +9 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/delivery-contract.d.ts +10 -3
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +33 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +178 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-core.d.ts +4 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap.d.ts +12 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/cashier-charges.d.ts +23 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-source.d.ts +1 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-finish-policy.d.ts +8 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-order-backend.d.ts +29 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/index.d.ts +3 -0
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/online-programs.d.ts +2 -0
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/pricing-plans.d.ts +2 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/shared.d.ts +19 -0
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/stores.d.ts +9 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +4 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/order-refs.d.ts +17 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/wix-bridge.d.ts +8 -0
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +1709 -0
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +34 -18
  21. package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
  22. package/dist/cli.mjs +53 -4
  23. package/guides/component-reference.json +3 -2
  24. package/guides/component-reference.md +28 -1
  25. package/guides/iap-pricing.md +9 -0
  26. package/guides/sdk-reference.json +12 -6
  27. package/package.json +2 -2
@@ -36,6 +36,12 @@ export interface IapItemView {
36
36
  /** Apple purchasing is not available until a backend verifies transactions. */
37
37
  purchasable: false;
38
38
  }
39
+ /** The App Store product a settled route sells. For a checkout to compare with the product the
40
+ * payment service names; not screen state and not a purchase authorization. */
41
+ export interface IapAppleProduct {
42
+ productId: string;
43
+ mappingRevision: string;
44
+ }
39
45
  export interface IapCheckoutDecision {
40
46
  allowed: boolean;
41
47
  route: IapPaymentRoute;
@@ -66,6 +72,9 @@ export interface IapCatalogPricing {
66
72
  * route the last settled lookup gave for the current scope, so a routine refresh cannot strand a
67
73
  * regular checkout halfway; any new answer other than regular stops it. */
68
74
  continueCheckoutGuard(reference: CatalogReference): IapCheckoutDecision;
75
+ /** The App Store product the item's settled Apple route sells; null on any other route, while
76
+ * a lookup is resolving, while disabled or after dispose. */
77
+ appleProduct(reference: CatalogReference): IapAppleProduct | null;
69
78
  /** The host-scheduled visible refresh; undefined while disabled. */
70
79
  pollDirective(action: string): IapPollDirective | undefined;
71
80
  dispose(): void;
@@ -42,8 +42,13 @@ export interface ProcessingAcknowledgement {
42
42
  environment: AppleTransaction["environment"];
43
43
  scopeKey: string;
44
44
  }
45
+ /** `processed`/`alreadyProcessed`: durable access; finish. `accepted`: the backend durably owns the
46
+ * proof and its own tracking, but access is not confirmed yet; finish, access stays `processing`.
47
+ * `refusedFinal`: the backend recorded the proof and refused it for good; finish, access stays
48
+ * `rejected`. All four must echo the acknowledgement. `rejected`/`ownershipConflict` hold the
49
+ * transaction unfinished. */
45
50
  export type SubmitProofResult = {
46
- status: "processed" | "alreadyProcessed";
51
+ status: "processed" | "alreadyProcessed" | "accepted" | "refusedFinal";
47
52
  acknowledgement: ProcessingAcknowledgement;
48
53
  } | {
49
54
  status: "retryable";
@@ -78,7 +83,9 @@ export interface Clock {
78
83
  export type DeliveryPhase = "idle" | "purchasing" | "awaitingApproval" | "cancelled" | "signInRequired" | "unavailable";
79
84
  /** `sessionChanged`: a purchase was requested under an earlier session and was not carried out. */
80
85
  export type DeliveryErrorCode = TransactionErrorCode | "contextUnavailable" | "contextRejected" | "proofRejected" | "sessionChanged";
81
- export type AccessStatus = "pending" | "confirming" | "waitingToRetry" | "signInRequired" | "ownershipConflict" | "rejected" | "confirmed";
86
+ /** `processing`: the backend accepted the proof and the transaction may finish, but access is not
87
+ * confirmed; the backend's own tracking decides it. */
88
+ export type AccessStatus = "pending" | "confirming" | "waitingToRetry" | "signInRequired" | "ownershipConflict" | "rejected" | "processing" | "confirmed";
82
89
  export type CompletionStatus = "pending" | "finished" | "notFound" | "retryRequired";
83
90
  /** Safe to render and persist: no proof, account token, transaction or member id. */
84
91
  export interface DeliveryItemState {
@@ -86,7 +93,7 @@ export interface DeliveryItemState {
86
93
  environment: AppleTransaction["environment"];
87
94
  /** Present in the last native unfinished enumeration; null before one succeeded. */
88
95
  held: boolean | null;
89
- /** `confirmed` only from a matching acknowledgement for the current session. */
96
+ /** `confirmed` only from a matching `processed` acknowledgement for the current session. */
90
97
  access: AccessStatus;
91
98
  completion: CompletionStatus;
92
99
  attempts: number;
@@ -960,6 +960,31 @@ export type ValidationMode = "live" | "on_blur" | "on_submit" | (string & {});
960
960
  export interface PickerOption {
961
961
  id: string;
962
962
  label: string;
963
+ /** #3801 — a colour chip before the label: a colour token name or "#RRGGBB". Drawn first. */
964
+ swatch?: string;
965
+ /** #3801 — a small remote thumbnail before the label (drawn when there is no swatch). */
966
+ imageUrl?: string;
967
+ /** #3801 — a leading icon name (drawn when there is no swatch or image). */
968
+ icon?: IconRef;
969
+ /** #3801 — shown but not choosable; never dispatched through `onChange`. */
970
+ disabled?: boolean;
971
+ }
972
+ /**
973
+ * #3801 — the drawn field's look. An unset value takes the matching token, then the default:
974
+ * `borderColor` ← colors.pickerFieldBorder ← colors.border; `borderWidth` ←
975
+ * spacing.pickerFieldBorderWidth ← 1; `cornerRadius` ← radius.pickerField ← radius.md ← 8;
976
+ * `minHeight` ← spacing.pickerFieldMinHeight ← 44; `padding` ← spacing.pickerFieldPadding ← 12;
977
+ * `chevronIcon` ← "chevron_down" ("none" hides it); `placeholderColor` ←
978
+ * colors.pickerFieldPlaceholder ← colors.textSecondary.
979
+ */
980
+ export interface PickerFieldStyle {
981
+ borderColor?: string;
982
+ borderWidth?: number;
983
+ cornerRadius?: number;
984
+ minHeight?: number;
985
+ padding?: number;
986
+ chevronIcon?: string;
987
+ placeholderColor?: string;
963
988
  }
964
989
  export interface PickerProps {
965
990
  options: PickerOption[];
@@ -968,6 +993,14 @@ export interface PickerProps {
968
993
  placeholder?: string;
969
994
  /** "$service:" sentinel → worker array of {id,label}; `options` is the fallback. */
970
995
  optionsPath?: string;
996
+ /** #3801 — the drawn field's look; setting it selects the drawn field ("menu" by default). */
997
+ field?: PickerFieldStyle;
998
+ /**
999
+ * #3801 — unset keeps each platform's own control, unless `field` is set or an option
1000
+ * carries a swatch/imageUrl/icon (then "menu"). "menu": the drawn field + an anchored menu
1001
+ * as wide as the field. "wheel": an inline wheel. "sheet": the drawn field + a bottom sheet.
1002
+ */
1003
+ presentation?: "menu" | "wheel" | "sheet";
971
1004
  }
972
1005
  export interface DatePickerProps {
973
1006
  valueUnix?: number;
@@ -0,0 +1,178 @@
1
+ import type { AppBindingSource, CatalogReference, Clock, DeliveryState, IapCatalogPricing, SessionProvider, TransactionStore, WixIapClient } from "@wix/himalaya/iap";
2
+ /** The host's Wix REST bridge (`himalaya.wixApi`). Resolves a 2xx body; rejects with
3
+ * `HTTP <status> [<code>]: <message>` otherwise. Credentials are attached natively. */
4
+ export interface WixBridge {
5
+ call(method: "GET" | "POST", path: string, body?: unknown): Promise<unknown>;
6
+ }
7
+ /** Why a bridge call gave no body. `sessionChanged`: the captured session is no longer current,
8
+ * before the send or after the answer; nothing from it may be used or stored. */
9
+ export type BridgeRefusal = {
10
+ status: "sessionChanged";
11
+ } | {
12
+ status: "notEnabled";
13
+ } | {
14
+ status: "unavailable";
15
+ } | {
16
+ status: "http";
17
+ httpStatus: number;
18
+ code: string;
19
+ };
20
+ export type BridgeOutcome = {
21
+ status: "ok";
22
+ body: unknown;
23
+ } | BridgeRefusal;
24
+ /** A bridge bound to one captured member session: it refuses to send, and drops the answer,
25
+ * once that session is no longer current. */
26
+ export interface SessionBoundBridge {
27
+ call(method: "GET" | "POST", path: string, body?: unknown): Promise<BridgeOutcome>;
28
+ isCurrent(): boolean;
29
+ }
30
+ /** Cashier pay v2 (`wix.payment.api.pay.v2.PaymentService`). The member-accepted gateway path
31
+ * is unverified, so there is deliberately no default. */
32
+ export interface CashierRoute {
33
+ /** The gateway path that maps to `/api/payments/v2`, without a trailing slash. */
34
+ prefix: string;
35
+ }
36
+ /** One item a screen sells. `reference` is the same catalog reference its price came from. */
37
+ export interface IapOrderItem {
38
+ reference: CatalogReference;
39
+ /** eCom catalog reference, required for a Wix Stores item. */
40
+ catalogReference?: {
41
+ appId: string;
42
+ catalogItemId: string;
43
+ options?: Record<string, unknown>;
44
+ };
45
+ /** Only 1 is supported. */
46
+ quantity?: number;
47
+ }
48
+ /** Ids an adapter needs to find its order and the member's access again. No member data. */
49
+ export type VerticalRef = Record<string, string>;
50
+ export type IapEligibility = {
51
+ eligible: true;
52
+ } | {
53
+ eligible: false;
54
+ reason: OrderFailureCode;
55
+ };
56
+ /** `open`: a pending order the cashier can charge. `granted`: the vertical already gives the
57
+ * member access, so nothing is sold. */
58
+ export type OrderAttempt = {
59
+ status: "open";
60
+ cashierOrderId: string;
61
+ verticalRef: VerticalRef;
62
+ } | {
63
+ status: "granted";
64
+ } | {
65
+ status: "refused";
66
+ reason: OrderFailureCode;
67
+ } | {
68
+ status: "unavailable";
69
+ } | {
70
+ status: "sessionChanged";
71
+ };
72
+ export type AccessRead = "granted" | "pending" | "none" | "unavailable" | "sessionChanged";
73
+ /** The only per-vertical code. Every call goes through the session-bound bridge it is given. */
74
+ export interface IapOrderAdapter {
75
+ /** The catalog kind it sells (`onlineProgram`, `pricingPlan`, `storesProduct`, or a custom one). */
76
+ readonly kind: string;
77
+ /** Structural check before any call: one item, quantity 1, a supported shape. */
78
+ eligibility(item: IapOrderItem): IapEligibility;
79
+ /** Opens, or reuses the vertical's own open, order for the signed-in member. */
80
+ openOrder(item: IapOrderItem, bridge: SessionBoundBridge): Promise<OrderAttempt>;
81
+ /** Re-reads an order opened earlier; `open` only while it can still be paid. */
82
+ reopenOrder(order: {
83
+ cashierOrderId: string;
84
+ verticalRef: VerticalRef;
85
+ }, bridge: SessionBoundBridge): Promise<OrderAttempt>;
86
+ /** The vertical's authoritative answer for the order's item and the signed-in member. */
87
+ readAccess(verticalRef: VerticalRef, bridge: SessionBoundBridge): Promise<AccessRead>;
88
+ }
89
+ /** Durable, member-partitioned purchase references. Ids only: never a proof, an account token
90
+ * (the customer id is stored only as a one-way hash in the key), or a credential. */
91
+ export interface OrderPartitionKey {
92
+ purchasesAppId: string;
93
+ siteId: string;
94
+ /** The member's wix-iap customer id: server-derived per member per app. */
95
+ customerId: string;
96
+ }
97
+ /** `held`: Apple charged, and CompletePayment refused the proof without recording it, so the
98
+ * transaction stays unfinished and is retried. `needsSupport`: recorded and refused for good. */
99
+ export type OrderRefStage = "ordered" | "charged" | "started" | "submitted" | "held" | "needsSupport";
100
+ export interface OrderRef {
101
+ /** `<kind>:<id>` of the item, or `payment:<paymentId>` for a payment with no local order. */
102
+ key: string;
103
+ stage: OrderRefStage;
104
+ kind?: string;
105
+ verticalRef?: VerticalRef;
106
+ cashierOrderId?: string;
107
+ wixTransactionId?: string;
108
+ paymentId?: string;
109
+ storeProductId?: string;
110
+ appProductId?: string;
111
+ appleTransactionId?: string;
112
+ updatedAt: number;
113
+ }
114
+ export interface OrderRefPartition {
115
+ refs(): readonly OrderRef[];
116
+ /** False when the write could not be verified as durable; the caller must not proceed. */
117
+ put(ref: OrderRef): boolean;
118
+ remove(key: string): boolean;
119
+ }
120
+ export interface OrderRefStore {
121
+ /** Null when this partition cannot be stored durably: no storage bridge, unreadable or
122
+ * unknown-version data. Never an empty stand-in. */
123
+ open(key: OrderPartitionKey): OrderRefPartition | null;
124
+ /** Whether any member holds references for this app and site; null when unreadable. Lets a
125
+ * start-up skip GetCustomerId (which creates a customer) when nothing was ever handed over. */
126
+ hasRefs(app: {
127
+ purchasesAppId: string;
128
+ siteId: string;
129
+ }): boolean | null;
130
+ }
131
+ export type OrderFailureCode = "notEnabled" | "notConfigured" | "signInRequired" | "unsupportedItem" | "notAppleRoute" | "storageUnavailable" | "approvalRequired" | "orderClosed" | "orderRefused" | "chargeFailed" | "paymentRefused" | "paymentHeld" | "alreadyOwned" | "paymentInProgress" | "productChanged" | "matchedOtherOrder" | "invalidAssociation" | "needsSupport" | "unavailable" | "sessionChanged";
132
+ /** Progress of a payment this device handed to wix-iap, tracked from its durable reference. */
133
+ export type PaymentAccess = "processing" | "granted" | "accessUnknown" | "needsSupport";
134
+ export interface PaymentProgress {
135
+ /** `<kind>:<id>` of the item, or `payment` when no local order is known. */
136
+ item: string;
137
+ access: PaymentAccess;
138
+ nextAttemptAt: number | null;
139
+ }
140
+ export type AppleIapCheckoutPhase = "notEnabled" | "idle" | "preparing" | "purchasing" | "awaitingApproval" | "processing" | "accessReady" | "cancelled" | "signInRequired" | "unavailable" | "refused";
141
+ /** Safe to render: no proof, account token, member, order or payment id. */
142
+ export interface AppleIapCheckoutState {
143
+ enabled: boolean;
144
+ phase: AppleIapCheckoutPhase;
145
+ /** The item the last `buy` was for, as `<kind>:<id>`. */
146
+ item: string | null;
147
+ failure: OrderFailureCode | null;
148
+ purchase: DeliveryState;
149
+ payments: PaymentProgress[];
150
+ nextWakeAt: number | null;
151
+ }
152
+ export interface AppleIapCheckoutDependencies {
153
+ wixIap: WixIapClient;
154
+ /** The same trusted binding the wix-iap client uses; it partitions the stored references. */
155
+ binding: AppBindingSource;
156
+ /** The same host provider the wix-iap client was given: every step compares generations. */
157
+ session: SessionProvider;
158
+ clock: Clock;
159
+ cashier: CashierRoute;
160
+ adapters: readonly IapOrderAdapter[];
161
+ /** The screen's catalog pricing: the route and the App Store product a sale must match. */
162
+ pricing: Pick<IapCatalogPricing, "view" | "appleProduct">;
163
+ store?: TransactionStore;
164
+ refs?: OrderRefStore;
165
+ bridge?: WixBridge;
166
+ jitter?: (baseDelayMs: number) => number;
167
+ onState?: (state: AppleIapCheckoutState) => void;
168
+ }
169
+ export interface AppleIapCheckout {
170
+ /** Recovers held purchases and resumes tracking payments already handed over. */
171
+ start(): Promise<AppleIapCheckoutState>;
172
+ buy(item: IapOrderItem): Promise<AppleIapCheckoutState>;
173
+ reconcile(): Promise<AppleIapCheckoutState>;
174
+ retry(): Promise<AppleIapCheckoutState>;
175
+ tick(): Promise<AppleIapCheckoutState>;
176
+ state(): AppleIapCheckoutState;
177
+ dispose(): void;
178
+ }
@@ -0,0 +1,4 @@
1
+ import type { AppleIapCheckout, AppleIapCheckoutDependencies } from "./apple-iap-contract.js";
2
+ export declare function createAppleIapCheckoutWith(deps: AppleIapCheckoutDependencies & {
3
+ enabled: boolean;
4
+ }): AppleIapCheckout;
@@ -0,0 +1,12 @@
1
+ import type { AppleIapCheckout, AppleIapCheckoutDependencies } from "./apple-iap-contract.js";
2
+ /**
3
+ * Creates the shared Apple-IAP checkout for one worker: vertical order → `appleIAP` cashier
4
+ * charge → wix-iap StartPayment → managed StoreKit purchase → CompletePayment → GetPayment →
5
+ * the vertical's own access read. It reuses `createPurchaseCoordinator` for StoreKit, proof
6
+ * delivery and finishing, and opens content only when the vertical confirms access.
7
+ *
8
+ * NOT ENABLED: it answers `notEnabled` and makes no call until the documented dependencies (a
9
+ * wix-iap route, the cashier route, a real mapping source, a trusted binding, the native identity
10
+ * fence and the finish-policy confirmation) are resolved.
11
+ */
12
+ export declare function createAppleIapCheckout(deps: AppleIapCheckoutDependencies): AppleIapCheckout;
@@ -0,0 +1,23 @@
1
+ import type { CashierRoute, SessionBoundBridge } from "./apple-iap-contract.js";
2
+ export interface CashierCharge {
3
+ chargeId: string;
4
+ transactionId: string;
5
+ status: string;
6
+ paymentMethod: string;
7
+ }
8
+ /** `pending`: an appleIAP Wix transaction waiting to be paid in the app store. `approved`: the
9
+ * order is already paid. `closed`: the order can no longer be charged (cancelled, timed out,
10
+ * refunded); a new order is needed. `inOtherPayment`: another method is settling it. */
11
+ export type AppleIapChargeResult = {
12
+ status: "pending" | "approved";
13
+ transactionId: string;
14
+ } | {
15
+ status: "closed" | "inOtherPayment" | "refused" | "notConfigured" | "invalidResponse" | "unavailable" | "notEnabled" | "sessionChanged";
16
+ };
17
+ export declare function ensureAppleIapCharge(bridge: SessionBoundBridge, route: CashierRoute, orderId: string): Promise<AppleIapChargeResult>;
18
+ export declare function listOrderCharges(bridge: SessionBoundBridge, route: CashierRoute, orderId: string): Promise<{
19
+ status: "ok";
20
+ charges: CashierCharge[];
21
+ } | Exclude<AppleIapChargeResult, {
22
+ transactionId: string;
23
+ }>>;
@@ -0,0 +1 @@
1
+ export declare function appleIapCheckoutEnabled(): boolean;
@@ -0,0 +1,8 @@
1
+ import type { CompletePaymentErrorCode, WixIapPaymentStatus } from "@wix/himalaya/iap";
2
+ /** `refusedFinal`: recorded and refused for good: finish, then the member needs support.
3
+ * `hold`: not recorded: keep the transaction unfinished. `ownershipConflict`: another customer. */
4
+ export type CompletionRefusal = "refusedFinal" | "hold" | "ownershipConflict";
5
+ export declare const COMPLETE_PAYMENT_REFUSALS: Readonly<Record<CompletePaymentErrorCode, CompletionRefusal>>;
6
+ /** A matched Payment's status: `approving` and `approved` are owned by the service (the timer
7
+ * armed at claim time reports them); the others mean Apple charged but Wix was not paid. */
8
+ export declare function isFinalRefusal(status: WixIapPaymentStatus): boolean;
@@ -0,0 +1,29 @@
1
+ import type { AppBindingSource, Clock, DeliveryBackend, IapAppleProduct, SessionProvider, WixIapClient } from "@wix/himalaya/iap";
2
+ import type { CashierRoute, IapOrderAdapter, IapOrderItem, OrderFailureCode, OrderRefStore, PaymentAccess, WixBridge } from "./apple-iap-contract.js";
3
+ /** What the backend tells the checkout about an item: why it stopped, or how its payment is. */
4
+ export interface OrderEvent {
5
+ /** The reference key: `<kind>:<id>`, or `payment:<id>` when no local order is known. */
6
+ key: string;
7
+ failure?: OrderFailureCode;
8
+ access?: PaymentAccess;
9
+ }
10
+ /** The item a `buy` asked for, with the App Store product its price showed when the buy started:
11
+ * the sale must sell that product, even if a pricing refresh is resolving meanwhile. */
12
+ export interface SaleItem {
13
+ item: IapOrderItem;
14
+ appleProduct: IapAppleProduct;
15
+ }
16
+ export interface WixOrderBackendDependencies {
17
+ wixIap: WixIapClient;
18
+ binding: AppBindingSource;
19
+ session: SessionProvider;
20
+ clock: Clock;
21
+ cashier: CashierRoute;
22
+ adapters: readonly IapOrderAdapter[];
23
+ refs: OrderRefStore;
24
+ bridge: WixBridge;
25
+ /** The item a `buy` asked for, by the catalog ref the coordinator carries. */
26
+ itemFor(catalogRef: string): SaleItem | undefined;
27
+ report(event: OrderEvent): void;
28
+ }
29
+ export declare function createWixOrderBackend(deps: WixOrderBackendDependencies): DeliveryBackend;
@@ -0,0 +1,3 @@
1
+ export { onlineProgramOrders } from "./online-programs.js";
2
+ export { pricingPlanOrders } from "./pricing-plans.js";
3
+ export { storesProductOrders, classifyCart } from "./stores.js";
@@ -0,0 +1,2 @@
1
+ import type { IapOrderAdapter } from "../apple-iap-contract.js";
2
+ export declare const onlineProgramOrders: IapOrderAdapter;
@@ -0,0 +1,2 @@
1
+ import type { IapOrderAdapter } from "../apple-iap-contract.js";
2
+ export declare const pricingPlanOrders: IapOrderAdapter;
@@ -0,0 +1,19 @@
1
+ import type { AccessRead, BridgeOutcome, BridgeRefusal, IapEligibility, IapOrderItem, OrderAttempt } from "../apple-iap-contract.js";
2
+ /** One unit of one item of the adapter's own kind. */
3
+ export declare function singleUnitOf(kind: string, item: IapOrderItem): IapEligibility;
4
+ /** A refusal an order step got: retryable when the vertical is down, final when it named one. */
5
+ export declare function attemptRefused(refusal: BridgeRefusal): OrderAttempt;
6
+ /** An access read that got no body: a missing record is no access; anything else is unknown. */
7
+ export declare function accessRefused(refusal: BridgeRefusal): AccessRead;
8
+ export declare function isRefusal(outcome: BridgeOutcome): outcome is BridgeRefusal;
9
+ export declare function isHttp(outcome: BridgeOutcome, httpStatus: number): boolean;
10
+ /** The named child object of a 2xx body, or null when the body has no such object. */
11
+ export declare function bodyObject(outcome: BridgeOutcome & {
12
+ status: "ok";
13
+ }, name: string): Record<string, unknown> | null;
14
+ export declare function isObject(value: unknown): value is Record<string, unknown>;
15
+ export declare function isNonEmpty(value: unknown): value is string;
16
+ export declare const UNSUPPORTED: IapEligibility;
17
+ export declare const ORDER_REFUSED: OrderAttempt;
18
+ export declare const ORDER_CLOSED: OrderAttempt;
19
+ export declare const GRANTED: OrderAttempt;
@@ -0,0 +1,9 @@
1
+ import type { IapOrderAdapter } from "../apple-iap-contract.js";
2
+ import type { IapPaymentRoute } from "@wix/himalaya/iap";
3
+ export declare const storesProductOrders: IapOrderAdapter;
4
+ /** How a cart may be paid: a single Apple-routed line of quantity 1 is an Apple sale; regular or
5
+ * disabled lines keep the existing checkout; any mix is refused; an unsettled route blocks. */
6
+ export declare function classifyCart(lines: ReadonlyArray<{
7
+ route: IapPaymentRoute;
8
+ quantity: number;
9
+ }>): "regular" | "appleIap" | "mixedRefused" | "blocked";
@@ -0,0 +1,4 @@
1
+ export { createAppleIapCheckout } from "./apple-iap.js";
2
+ export { onlineProgramOrders, pricingPlanOrders, storesProductOrders, classifyCart } from "./iap-verticals/index.js";
3
+ export { createWorkerOrderRefStore } from "./order-refs.js";
4
+ export type { AccessRead, AppleIapCheckout, AppleIapCheckoutDependencies, AppleIapCheckoutPhase, AppleIapCheckoutState, BridgeOutcome, BridgeRefusal, CashierRoute, IapEligibility, IapOrderAdapter, IapOrderItem, OrderAttempt, OrderFailureCode, OrderPartitionKey, OrderRef, OrderRefPartition, OrderRefStage, OrderRefStore, PaymentAccess, PaymentProgress, SessionBoundBridge, VerticalRef, WixBridge, } from "./apple-iap-contract.js";
@@ -0,0 +1,17 @@
1
+ import type { OrderRefPartition, OrderRefStore } from "./apple-iap-contract.js";
2
+ export interface KeyValueStorage {
3
+ getItem(key: string): string | null;
4
+ setItem(key: string, value: string): void;
5
+ }
6
+ /** How long (7 days) a payment Apple charged but Wix did not take keeps a support hold: its item
7
+ * is not sold again meanwhile. A literal: an expression at module scope is kept in every bundle. */
8
+ export declare const NEEDS_SUPPORT_HOLD_MS = 604800000;
9
+ /** Drops every hold older than NEEDS_SUPPORT_HOLD_MS, whatever its key (an item, or a `payment:`
10
+ * with no local order), so holds never accumulate and lock the member out. A held proof still
11
+ * unfinished renews its hold on every retry, so only one Apple no longer delivers expires. Returns
12
+ * the keys it removed. */
13
+ export declare function pruneExpiredHolds(partition: OrderRefPartition, now: number): string[];
14
+ /** References one member keeps at once. When full, the oldest reference from before Apple's sheet
15
+ * is evicted; a partition full of handed-over payments refuses new sales instead. */
16
+ export declare const MAX_ORDER_REFS = 16;
17
+ export declare function createWorkerOrderRefStore(storage?: KeyValueStorage): OrderRefStore;
@@ -0,0 +1,8 @@
1
+ import type { SessionProvider, SessionSnapshot } from "@wix/himalaya/iap";
2
+ import type { SessionBoundBridge, WixBridge } from "./apple-iap-contract.js";
3
+ export declare function bindBridge(session: SessionSnapshot, provider: SessionProvider, bridge: WixBridge): SessionBoundBridge;
4
+ /** The host's bridge. A plain `himalaya.wixApi` read, not an optional chain: it is the marker the
5
+ * capability scanners look for, so a worker using the checkout is declared `wix_api`. */
6
+ export declare function hostBridge(): WixBridge | undefined;
7
+ /** A bridge that refuses every call, for hosts without one. */
8
+ export declare const MISSING_BRIDGE: WixBridge;