@wix/himalaya-cli 0.1631.0 → 0.1633.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 (39) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-contract.d.ts +4 -14
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments-wire.d.ts +2 -1
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments.d.ts +1 -2
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +26 -13
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-core.d.ts +0 -2
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-source.d.ts +3 -10
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-core.d.ts +0 -2
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-order-backend.d.ts +0 -3
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/iap-verticals/stores.d.ts +2 -2
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +2 -2
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/loyalty/src/index.d.ts +64 -0
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +2 -0
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +13 -45
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +2 -4
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +7 -11
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-loyalty.mjs +39 -0
  17. package/dist/cli.mjs +258 -150
  18. package/dist/preview-assets.generated.bin +0 -0
  19. package/fixtures/wix-canned.json +3 -0
  20. package/guides/getting-started.md +2 -1
  21. package/guides/himi-json-output.md +6 -0
  22. package/guides/himi-skill.md +2 -1
  23. package/guides/iap-screen-adoption.md +4 -4
  24. package/guides/importable-sdks.md +1 -1
  25. package/guides/one-app-section-mappings.md +3 -3
  26. package/guides/sdk-reference.json +8829 -4386
  27. package/guides/skill.md +11 -1
  28. package/package.json +2 -2
  29. package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +1 -1
  30. package/templates/branded-lite/dev/index.ts +2924 -2110
  31. package/templates/branded-lite/l10n/en.json +5 -3
  32. package/templates/branded-lite/tier5-src/_shared/loyalty-offerings.ts +73 -0
  33. package/templates/branded-lite/tier5-src/himi-branded-lite-loyalty/earning.ts +148 -0
  34. package/templates/branded-lite/tier5-src/himi-branded-lite-loyalty/index.ts +57 -31
  35. package/templates/branded-lite/tier5-src/himi-branded-lite-loyalty-rewards/index.ts +208 -0
  36. package/templates/branded-lite/tier5-src/himi-store-product/index.ts +1 -1
  37. package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +1 -1
  38. package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +1 -1
  39. package/templates/retail-store/tier5-src/himi-store-product/index.ts +1 -1
@@ -40,19 +40,10 @@ export interface AppleSaleRule {
40
40
  export declare const BOOKINGS_APPLE_SALES_ENABLED = true;
41
41
  export declare const EVENTS_APPLE_SALES_ENABLED = true;
42
42
  /**
43
- * Whether Wix Stores items sell through the App Store, through wix-iap StartItemPayment
44
- * (catalyst-server #24496), which places the member's eCom order for one catalog item. OFF: that RPC
45
- * is not deployed, the member's identity across Serve → wix-iap → eCom is unproven, and a paid Stores
46
- * order is not yet proven to deliver the download. Enabling this also enables the Stores rule in
47
- * `APPLE_SALE_RULES` and selects `itemPaymentEnabled` in @himalaya/iap-checkout.
48
- */
49
- export declare const STORES_ITEM_PAYMENT_ENABLED = false;
50
- /**
51
- * Whether Wix Stores items sell through the App Store at all: the Stores rule in `APPLE_SALE_RULES`
52
- * and the product screen's Buy. With StartItemPayment off, a sale uses the app's own order: an eCom
53
- * checkout and order, its `appleIAP` cashier charge, then StartPayment. ON for mapped digital
54
- * products. Member checkout, the eCom IAP flag, cashier item identity and digital fulfillment
55
- * remain unverified in Sandbox.
43
+ * Whether Wix Stores items sell through the App Store: the Stores rule in `APPLE_SALE_RULES` and the
44
+ * product screen's Buy. A sale is wix-iap StartItemPayment (catalyst-server #24496), which places and
45
+ * charges the member's eCom order for one catalog item server-side; the device never opens an eCom
46
+ * checkout or a cashier charge for it. ON for mapped digital products.
56
47
  */
57
48
  export declare const STORES_APPLE_SALES_ENABLED = true;
58
49
  /** StartItemPayment's CatalogReference: the purchases catalog sells a Stores product under its product
@@ -78,7 +69,6 @@ export declare const VIDEOS_APPLE_SALES_ENABLED = false;
78
69
  */
79
70
  export interface AppleSaleOptions {
80
71
  storesAppleSalesEnabled?: boolean;
81
- storesItemPaymentEnabled?: boolean;
82
72
  pricingPlanAppleSalesEnabled?: boolean;
83
73
  bookingsAppleSalesEnabled?: boolean;
84
74
  eventsAppleSalesEnabled?: boolean;
@@ -10,7 +10,8 @@ export interface CallScope {
10
10
  prefix: string;
11
11
  }
12
12
  export declare function startPaymentCall(scope: CallScope, wixTransactionId: string): WixIapCall;
13
- /** Only the two ids StartItemPaymentRequest.item has: no quantity, options or member. */
13
+ /** The app by its bundle, like every device call (catalyst-server #24546), and only the two ids
14
+ * StartItemPaymentRequest.item has: no quantity, options or member. */
14
15
  export declare function startItemPaymentCall(scope: CallScope, item: EcomCatalogReference): WixIapCall;
15
16
  /** CatalogReference's limits: `catalog_item_id` 1–36 characters, `catalog_app_id` a GUID. */
16
17
  export declare function catalogItemOf(raw: unknown): EcomCatalogReference | null;
@@ -38,8 +38,7 @@ export interface WixIapClient {
38
38
  *
39
39
  * The shared checkout (`createIapCommerce`) builds it with Serve's IAP route for an app whose binary
40
40
  * carries a purchases-app binding; `route` stays a parameter with no default. It calls
41
- * StartPayment (`POST …/payments/start`), StartItemPayment (`POST …/payments/start-item`, not yet
42
- * deployed), CompletePayment (`POST …/payments/complete`) and GetPayment (`GET …/payments/{id}`) through the
41
+ * StartPayment (`POST …/payments/start`), StartItemPayment (`POST …/payments/start-item`), CompletePayment (`POST …/payments/complete`) and GetPayment (`GET …/payments/{id}`) through the
43
42
  * `wix_api` bridge. A matched or approved Payment is not durable access and never finishes the
44
43
  * store transaction.
45
44
  *
@@ -107,20 +107,28 @@ export interface OpeningGuard {
107
107
  * `held`: still unknown, and it blocks this sale. `unrelated`: still unknown, but it targets other
108
108
  * inventory than this sale's. */
109
109
  export type OpeningResolution = "released" | "held" | "unrelated" | "unavailable" | "sessionChanged";
110
- /** An item wix-iap can order itself (StartItemPayment): the item as eCom's catalog reference, and
111
- * how the adapter finds the eCom order that call places again. */
110
+ /** An item wix-iap orders itself (StartItemPayment): the item as eCom's catalog reference, and how
111
+ * the adapter finds the eCom order that call placed. */
112
112
  export interface ItemPayment {
113
113
  catalogItem: EcomCatalogReference;
114
114
  /** The reference `readAccess` reads for the eCom order StartItemPayment placed. */
115
115
  verticalRefOf(ecomOrderId: string): VerticalRef;
116
116
  }
117
- /** The only per-vertical code. Every call goes through the session-bound bridge it is given. */
118
- export interface IapOrderAdapter {
117
+ /** What every vertical answers. Every call goes through the session-bound bridge it is given. */
118
+ export interface IapAdapterBase {
119
119
  /** The catalog kind it sells (`onlineProgram`, `pricingPlan`, `storesProduct`, or a custom one). */
120
120
  readonly kind: string;
121
- readonly repeatable?: boolean;
122
121
  /** Structural check before any call: one item, quantity 1, a supported shape. */
123
122
  eligibility(item: IapOrderItem): IapEligibility;
123
+ /** The vertical's authoritative answer for the order's item and the signed-in member. */
124
+ readAccess(verticalRef: VerticalRef, bridge: SessionBoundBridge): Promise<AccessRead>;
125
+ /** The member's access to an item before any order exists (bought through Wix, say). Read-only:
126
+ * never opens or prepares an order. An adapter without it shows Get access until a sale says otherwise. */
127
+ currentAccess?(item: IapOrderItem, bridge: SessionBoundBridge): Promise<AccessRead>;
128
+ }
129
+ /** A vertical whose order the device opens; it is charged through cashier and paid with StartPayment. */
130
+ export interface IapVerticalOrderAdapter extends IapAdapterBase {
131
+ readonly repeatable?: boolean;
124
132
  /** Opens, or reuses the vertical's own open, order for the signed-in member. */
125
133
  /** Repeatable adapters call beforeCreate immediately before their first inventory write,
126
134
  * after read-only checks, and abort without writing if it returns false. They call afterCreate
@@ -140,15 +148,20 @@ export interface IapOrderAdapter {
140
148
  cashierOrderId: string;
141
149
  verticalRef: VerticalRef;
142
150
  }, bridge: SessionBoundBridge): Promise<OrderAttempt>;
143
- /** The vertical's authoritative answer for the order's item and the signed-in member. */
144
- readAccess(verticalRef: VerticalRef, bridge: SessionBoundBridge): Promise<AccessRead>;
145
- /** The member's access to an item before any order exists (bought through Wix, say). Read-only:
146
- * never opens or prepares an order. An adapter without it shows Get access until a sale says otherwise. */
147
- currentAccess?(item: IapOrderItem, bridge: SessionBoundBridge): Promise<AccessRead>;
148
- /** When the platform enables StartItemPayment, an eligible item whose order wix-iap places itself
149
- * instead of `openOrder`. Null for an item outside that shape, which keeps `openOrder`. */
150
- itemPayment?(item: IapOrderItem): ItemPayment | null;
151
+ itemPayment?: never;
152
+ }
153
+ /** A vertical whose order wix-iap places and charges server-side (StartItemPayment): the device
154
+ * never opens, charges or reopens one. */
155
+ export interface IapItemPaymentAdapter extends IapAdapterBase {
156
+ /** The catalog item to order, for an item `eligibility` accepted. */
157
+ itemPayment(item: IapOrderItem): ItemPayment;
158
+ openOrder?: never;
159
+ reopenOrder?: never;
160
+ repeatable?: never;
161
+ resolveOpening?: never;
151
162
  }
163
+ /** The only per-vertical code. */
164
+ export type IapOrderAdapter = IapVerticalOrderAdapter | IapItemPaymentAdapter;
152
165
  /** Durable, member-partitioned purchase references. Ids only: never a proof or a credential, and
153
166
  * the member id is stored only as a one-way hash in the key. */
154
167
  export interface OrderPartitionKey {
@@ -1,8 +1,6 @@
1
1
  import type { AppleIapCheckout, AppleIapCheckoutDependencies, AppleIapCheckoutState } from "./apple-iap-contract.js";
2
- /** `itemPaymentEnabled`: platform configuration (checkout-source.ts), never a screen's. */
3
2
  export declare function createAppleIapCheckoutWith(deps: AppleIapCheckoutDependencies & {
4
3
  enabled: boolean;
5
- itemPaymentEnabled?: boolean;
6
4
  }): AppleIapCheckout;
7
5
  /** What a checkout that is not enabled answers: nothing sold, nothing tracked. */
8
6
  export declare function notEnabledState(): AppleIapCheckoutState;
@@ -3,14 +3,7 @@ export declare const HIMALAYA_SERVE_CHECKOUT_ROUTES: AppleIapCheckoutRoutes;
3
3
  export declare function appleIapCheckoutRoutes(): AppleIapCheckoutRoutes | null;
4
4
  /** The low-level factory's switch: on whenever the production routes exist. */
5
5
  export declare function appleIapCheckoutEnabled(): boolean;
6
- /**
7
- * Whether an item whose adapter names it in eCom's catalog (a Wix Stores product) is paid through
8
- * wix-iap StartItemPayment, which places the member's eCom order server-side. The same switch as
9
- * `STORES_ITEM_PAYMENT_ENABLED` in @himalaya/iap; otherwise an enabled Stores sale uses the app's
10
- * own order. Turning it off again stops only new attempts: stored
11
- * ones are still held, completed and tracked (docs/iap-wix-checkout.md).
12
- */
13
- export declare function itemPaymentEnabled(): boolean;
14
- /** Whether Wix Stores items sell through the App Store, by either path: StartItemPayment when
15
- * `itemPaymentEnabled`, otherwise the app's own eCom order (`STORES_APPLE_SALES_ENABLED`). */
6
+ /** Whether Wix Stores items sell through the App Store: wix-iap StartItemPayment places and charges
7
+ * the member's eCom order (`STORES_APPLE_SALES_ENABLED` in @himalaya/iap). Turning it off stops only
8
+ * new attempts: stored ones are still held, completed and tracked (docs/iap-wix-checkout.md). */
16
9
  export declare function storesAppleSalesEnabled(): boolean;
@@ -14,8 +14,6 @@ export interface CommerceHost {
14
14
  }
15
15
  export interface IapCommerceDependencies {
16
16
  routes: AppleIapCheckoutRoutes | null;
17
- /** StartItemPayment for items whose adapter names them in eCom's catalog (checkout-source.ts). */
18
- itemPaymentEnabled?: boolean;
19
17
  pricing: IapCatalogPricing;
20
18
  binding: AppBindingSource;
21
19
  /** One provider for the wix-iap client and the checkout: every step compares its generations. */
@@ -29,9 +29,6 @@ export interface WixOrderBackendDependencies {
29
29
  /** Whether Apple may already be charging for this product: an unfinished transaction, or an Ask
30
30
  * to Buy request awaiting approval. Asked inside the purchase job, after any reconcile. */
31
31
  productBusy?(productId: string): boolean;
32
- /** Pay for an item its adapter names in eCom's catalog with StartItemPayment. Off: every item
33
- * goes through its adapter's own order. Platform configuration (checkout-source.ts). */
34
- itemPaymentEnabled?: boolean;
35
32
  report(event: OrderEvent): void;
36
33
  }
37
34
  export declare function createWixOrderBackend(deps: WixOrderBackendDependencies): DeliveryBackend;
@@ -1,6 +1,6 @@
1
- import type { IapOrderAdapter } from "../apple-iap-contract.js";
1
+ import type { IapItemPaymentAdapter } from "../apple-iap-contract.js";
2
2
  import type { IapPaymentRoute } from "@wix/himalaya/iap";
3
- export declare const storesProductOrders: IapOrderAdapter;
3
+ export declare const storesProductOrders: IapItemPaymentAdapter;
4
4
  /** How a cart may be paid: a single Apple-routed line of quantity 1 is an Apple sale; regular or
5
5
  * disabled lines keep the existing checkout; any mix is refused; an unsettled route blocks. */
6
6
  export declare function classifyCart(lines: ReadonlyArray<{
@@ -3,6 +3,6 @@ export { iapPurchaseFields } from "./purchase-fields.js";
3
3
  export { createAppleIapCheckout } from "./apple-iap.js";
4
4
  export { onlineProgramOrders, pricingPlanOrders, storesProductOrders, bookingOrders, eventTicketOrders, wixVideoOrders, classifyCart } from "./iap-verticals/index.js";
5
5
  export { createWorkerOrderRefStore } from "./order-refs.js";
6
- export { itemPaymentEnabled, storesAppleSalesEnabled } from "./checkout-source.js";
7
- 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";
6
+ export { storesAppleSalesEnabled } from "./checkout-source.js";
7
+ export type { AccessRead, AppleIapCheckout, AppleIapCheckoutDependencies, AppleIapCheckoutPhase, AppleIapCheckoutState, BridgeOutcome, BridgeRefusal, CashierRoute, IapAdapterBase, IapEligibility, IapItemPaymentAdapter, IapOrderAdapter, IapOrderItem, IapVerticalOrderAdapter, OrderAttempt, OrderFailureCode, OrderPartitionKey, OrderRef, OrderRefPartition, OrderRefStage, OrderRefStore, PaymentAccess, PaymentProgress, SessionBoundBridge, VerticalRef, WixBridge, } from "./apple-iap-contract.js";
8
8
  export type { AppleIapCheckoutRoutes, IapCommerce, IapCommerceOptions, IapPurchaseCopy, IapPurchaseFields, IapPurchaseGap, IapPurchaseReadiness, IapRestoreResult, } from "./commerce-contract.js";
@@ -67,6 +67,15 @@ export interface WixLoyaltyProgram {
67
67
  monthsOfInactivity?: number;
68
68
  expiringPointsPercentage?: number;
69
69
  };
70
+ /** Mobile program settings (wix-loyalty-mobile viewer getOffering). */
71
+ socialMediaSettings?: {
72
+ channels?: {
73
+ type?: string;
74
+ enabled?: boolean;
75
+ id?: string;
76
+ url?: string;
77
+ }[];
78
+ };
70
79
  }
71
80
  export interface WixLoyaltyReward {
72
81
  id: string;
@@ -78,6 +87,9 @@ export interface WixLoyaltyReward {
78
87
  discountAmount?: {
79
88
  configsByTier?: WixLoyaltyRewardConfig[];
80
89
  };
90
+ spiDiscountAmount?: {
91
+ description?: string;
92
+ };
81
93
  couponReward?: {
82
94
  fixedAmount?: {
83
95
  configsByTier?: WixLoyaltyRewardConfig[];
@@ -145,6 +157,7 @@ export interface WixLoyaltyTier {
145
157
  id?: string;
146
158
  tierDefinition?: {
147
159
  name?: string;
160
+ description?: string;
148
161
  icon?: WixLoyaltyImage;
149
162
  };
150
163
  requiredPoints?: number;
@@ -154,6 +167,12 @@ export interface WixLoyaltyEarningRule {
154
167
  title?: string;
155
168
  status?: string;
156
169
  triggerActivityType?: string;
170
+ metadata?: {
171
+ canBeDeleted?: boolean;
172
+ ruleTypeTag?: {
173
+ ruleType?: string;
174
+ };
175
+ };
157
176
  fixedAmount?: {
158
177
  configs?: {
159
178
  tierId?: string;
@@ -200,4 +219,49 @@ export declare function getLoyaltyTiersProgram(readOptions?: WixCallOptions): Pr
200
219
  export declare function listMyLoyaltyCoupons(readOptions?: WixCallOptions): Promise<{
201
220
  loyaltyCoupons?: WixLoyaltyCoupon[];
202
221
  }>;
222
+ /** Current-member mutation: the server chooses the account and checks reward cost.
223
+ * Never cache or queue this write; ambiguous failures require reconciliation.
224
+ * @scope member */
225
+ export declare function redeemMyLoyaltyReward(rewardId: string, options?: Pick<WixCallOptions, "site">): Promise<{
226
+ coupon?: WixLoyaltyCoupon;
227
+ }>;
228
+ export interface WixLoyaltyFollowedChannel {
229
+ id?: string;
230
+ accountId?: string;
231
+ channel?: string;
232
+ createdDate?: string;
233
+ }
234
+ /** Read the current member's registered social-follow channels. The caller cannot
235
+ * select another member or loyalty account.
236
+ * @scope member */
237
+ export declare function listMyLoyaltyFollowedChannels(options?: WixCallOptions): Promise<{
238
+ followedChannels?: WixLoyaltyFollowedChannel[];
239
+ }>;
240
+ /** Register a configured channel for the current member. This records the loyalty
241
+ * action; it neither opens the external URL nor verifies a third-party follow.
242
+ * @scope member — no caller-supplied account identifier. */
243
+ export declare function followMyLoyaltyChannel(channel: string, options?: Pick<WixCallOptions, "site">): Promise<{
244
+ followedChannel?: WixLoyaltyFollowedChannel;
245
+ }>;
246
+ export interface WixReferralReward {
247
+ id?: string;
248
+ rewardType?: string;
249
+ coupon?: {
250
+ id?: string;
251
+ code?: string;
252
+ status?: string;
253
+ couponSpecification?: {
254
+ name?: string;
255
+ };
256
+ };
257
+ }
258
+ /** Member-owned referral coupons. Source: ambassador-loyalty-referral-v1-referral-reward
259
+ * 1.0.63 http.impl.js and wix-loyalty-mobile viewer/helpers.ts at faa624c.
260
+ * The public-looking /referral-rewards mount is 404; /_api is the REST mount.
261
+ * Query is read-only; contactId is always "me". An uninstalled app is known empty,
262
+ * whereas permission/network errors must remain unknown to the consumer.
263
+ * @scope member */
264
+ export declare function listMyReferralRewards(options?: WixCallOptions): Promise<{
265
+ referralRewards: WixReferralReward[];
266
+ }>;
203
267
  export * from "./extensions.js";
@@ -59,6 +59,8 @@ export interface WixMemberContact {
59
59
  lastName?: string;
60
60
  phones?: string[];
61
61
  emails?: string[];
62
+ /** Local calendar date (YYYY-MM-DD), returned by getMyMember with FULL fieldsets. */
63
+ birthdate?: string;
62
64
  }
63
65
  export interface WixMember {
64
66
  id: string;
@@ -707,7 +707,6 @@ var HIMALAYA_SERVE_IAP_ROUTE = { prefix: "/himalaya-serve/v1/iap" };
707
707
  var BOOKINGS_APPLE_SALES_ENABLED = true;
708
708
  var EVENTS_APPLE_SALES_ENABLED = true;
709
709
  var ATTENDANCE_SALE_RULE = { appProductId: (id) => id, productType: "CONSUMABLE" };
710
- var STORES_ITEM_PAYMENT_ENABLED = false;
711
710
  var STORES_APPLE_SALES_ENABLED = true;
712
711
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
713
712
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
@@ -718,7 +717,7 @@ var VIDEO_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE"
718
717
  function appleSaleRules(options = {}) {
719
718
  return {
720
719
  onlineProgram: ONLINE_PROGRAM_SALE_RULE,
721
- ...(options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED) || (options.storesItemPaymentEnabled ?? STORES_ITEM_PAYMENT_ENABLED) ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
720
+ ...options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
722
721
  ...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {},
723
722
  ...options.bookingsAppleSalesEnabled ?? BOOKINGS_APPLE_SALES_ENABLED ? { bookingsService: ATTENDANCE_SALE_RULE } : {},
724
723
  ...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {},
@@ -1068,7 +1067,7 @@ function startPaymentCall(scope, wixTransactionId) {
1068
1067
  return post(scope, "/payments/start", { appleBundleId: scope.binding.bundleId, wixTransactionId });
1069
1068
  }
1070
1069
  function startItemPaymentCall(scope, item) {
1071
- return post(scope, "/payments/start-item", { appId: scope.binding.purchasesAppId, item: { catalogItemId: item.catalogItemId, catalogAppId: item.catalogAppId } });
1070
+ return post(scope, "/payments/start-item", { appleBundleId: scope.binding.bundleId, item: { catalogItemId: item.catalogItemId, catalogAppId: item.catalogAppId } });
1072
1071
  }
1073
1072
  function catalogItemOf(raw) {
1074
1073
  const item = isObject3(raw) ? raw : {};
@@ -1615,11 +1614,8 @@ function appleIapCheckoutRoutes() {
1615
1614
  function appleIapCheckoutEnabled() {
1616
1615
  return appleIapCheckoutRoutes() !== null;
1617
1616
  }
1618
- function itemPaymentEnabled() {
1619
- return STORES_ITEM_PAYMENT_ENABLED;
1620
- }
1621
1617
  function storesAppleSalesEnabled() {
1622
- return STORES_APPLE_SALES_ENABLED || STORES_ITEM_PAYMENT_ENABLED;
1618
+ return STORES_APPLE_SALES_ENABLED;
1623
1619
  }
1624
1620
 
1625
1621
  // ../../stdlib/flows/iap-checkout/src/cashier-charges.ts
@@ -1977,8 +1973,8 @@ function createWixOrderBackend(deps) {
1977
1973
  if (unresolved) return contextResult(catalogRef, unresolved);
1978
1974
  const blocked = saleBlocked(sale);
1979
1975
  if (blocked) return contextResult(catalogRef, blocked);
1980
- const itemPayment2 = deps.itemPaymentEnabled ? sale.adapter.itemPayment?.(sale.item) : null;
1981
- return itemPayment2 ? startItemFor(sale, itemPayment2) : startOrderFor(sale);
1976
+ const { adapter } = sale;
1977
+ return paidByItem(adapter) ? startItemFor(sale, adapter.itemPayment(sale.item)) : startOrderFor({ ...sale, adapter });
1982
1978
  }
1983
1979
  async function startOrderFor(sale) {
1984
1980
  const ordered = await orderFor(sale);
@@ -2298,6 +2294,9 @@ function createWixOrderBackend(deps) {
2298
2294
  }
2299
2295
  return { getPurchaseContext, getMemberContext, submitProof };
2300
2296
  }
2297
+ function paidByItem(adapter) {
2298
+ return typeof adapter.itemPayment === "function";
2299
+ }
2301
2300
  var RETRYABLE = { status: "retryable" };
2302
2301
  var STALE2 = { stop: true, result: "retryable" };
2303
2302
  function stopWith(result, failure3) {
@@ -2416,7 +2415,6 @@ function enabledCheckout(deps) {
2416
2415
  bridge,
2417
2416
  itemFor: (key) => sales.get(key),
2418
2417
  productBusy,
2419
- itemPaymentEnabled: deps.itemPaymentEnabled,
2420
2418
  report: onEvent
2421
2419
  });
2422
2420
  const coordinator = createPurchaseCoordinator({
@@ -2947,7 +2945,6 @@ function createIapCommerceWith(deps) {
2947
2945
  stopWatchingSession = void 0;
2948
2946
  checkout = createAppleIapCheckoutWith({
2949
2947
  enabled: true,
2950
- itemPaymentEnabled: deps.itemPaymentEnabled,
2951
2948
  wixIap: deps.wixIapClient({ host, route: routes.wixIap }),
2952
2949
  binding: deps.binding,
2953
2950
  session: deps.session,
@@ -3085,7 +3082,6 @@ function createIapCommerce(options = {}) {
3085
3082
  const binding = sharedHostAppBindingSource();
3086
3083
  return createIapCommerceWith({
3087
3084
  routes: appleIapCheckoutRoutes(),
3088
- itemPaymentEnabled: itemPaymentEnabled(),
3089
3085
  pricing: createIapCatalogPricing({ onChange: options.onChange }),
3090
3086
  binding,
3091
3087
  session,
@@ -3123,7 +3119,7 @@ function preferenceSite() {
3123
3119
 
3124
3120
  // ../../stdlib/flows/iap-checkout/src/apple-iap.ts
3125
3121
  function createAppleIapCheckout(deps) {
3126
- return createAppleIapCheckoutWith({ ...deps, enabled: appleIapCheckoutEnabled(), itemPaymentEnabled: itemPaymentEnabled() });
3122
+ return createAppleIapCheckoutWith({ ...deps, enabled: appleIapCheckoutEnabled() });
3127
3123
  }
3128
3124
 
3129
3125
  // ../../stdlib/flows/iap-checkout/src/iap-verticals/shared.ts
@@ -3353,22 +3349,18 @@ var WIX_STORES_APP = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
3353
3349
  var storesProductOrders = {
3354
3350
  kind: KIND3,
3355
3351
  eligibility,
3356
- openOrder: openOrder3,
3357
- reopenOrder: reopenOrder3,
3358
- readAccess: readAccess3,
3359
- itemPayment
3352
+ itemPayment,
3353
+ readAccess: readAccess3
3360
3354
  };
3361
3355
  function eligibility(item) {
3362
3356
  const single = singleUnitOf(KIND3, item);
3363
3357
  if (!single.eligible) return single;
3364
3358
  const catalog = item.catalogReference;
3365
3359
  const variant = catalog?.options && Object.keys(catalog.options).length > 0;
3366
- return catalog && !variant && isNonEmpty3(catalog.appId) && catalog.catalogItemId === item.reference.id ? single : UNSUPPORTED;
3360
+ return catalog && !variant && isNonEmpty3(catalog.appId) && catalog.appId.toLowerCase() === WIX_STORES_APP && catalog.catalogItemId === item.reference.id ? single : UNSUPPORTED;
3367
3361
  }
3368
3362
  function itemPayment(item) {
3369
- const catalog = item.catalogReference;
3370
- if (!eligibility(item).eligible || catalog?.appId.toLowerCase() !== WIX_STORES_APP) return null;
3371
- return { catalogItem: { catalogItemId: catalog.catalogItemId, catalogAppId: WIX_STORES_APP }, verticalRefOf: (orderId) => ({ orderId }) };
3363
+ return { catalogItem: { catalogItemId: item.reference.id, catalogAppId: WIX_STORES_APP }, verticalRefOf: (orderId) => ({ orderId }) };
3372
3364
  }
3373
3365
  function classifyCart(lines) {
3374
3366
  if (lines.length === 0 || lines.some((line) => line.route === "resolving" || line.route === "unavailable")) return "blocked";
@@ -3376,21 +3368,6 @@ function classifyCart(lines) {
3376
3368
  if (apple.length === 0) return "regular";
3377
3369
  return lines.length === 1 && apple[0].quantity === 1 ? "appleIap" : "mixedRefused";
3378
3370
  }
3379
- async function openOrder3(item, bridge) {
3380
- const checkout = await bridge.call("POST", "/ecom/v1/checkouts", { lineItems: [{ quantity: 1, catalogReference: item.catalogReference }], channelType: "OTHER_PLATFORM" });
3381
- if (isRefusal(checkout)) return attemptRefused(checkout);
3382
- const checkoutId = bodyObject(checkout, "checkout")?.id;
3383
- if (!isNonEmpty3(checkoutId)) return ORDER_REFUSED;
3384
- const placed = await bridge.call("POST", `/ecom/v1/checkouts/${encodeURIComponent(checkoutId)}/create-order`, {});
3385
- if (isRefusal(placed)) return attemptRefused(placed);
3386
- return placedOrder(placed.body, bridge);
3387
- }
3388
- async function reopenOrder3(order, bridge) {
3389
- const access = await readAccess3(order.verticalRef, bridge);
3390
- if (access === "granted") return GRANTED;
3391
- if (access === "pending") return { status: "open", cashierOrderId: order.cashierOrderId, verticalRef: order.verticalRef };
3392
- return access === "sessionChanged" || access === "unavailable" ? { status: access } : ORDER_CLOSED;
3393
- }
3394
3371
  async function readAccess3(verticalRef, bridge) {
3395
3372
  if (!isNonEmpty3(verticalRef.orderId)) return "unavailable";
3396
3373
  const answer = await bridge.call("GET", `/ecom/v1/orders/${encodeURIComponent(verticalRef.orderId)}`);
@@ -3400,14 +3377,6 @@ async function readAccess3(verticalRef, bridge) {
3400
3377
  if (PAYMENT_UNDER_WAY2.has(status)) return "pending";
3401
3378
  return NO_ACCESS2.has(status) ? "none" : "unavailable";
3402
3379
  }
3403
- async function placedOrder(body, bridge) {
3404
- if (!isObject7(body) || !isNonEmpty3(body.orderId)) return ORDER_REFUSED;
3405
- const verticalRef = { orderId: body.orderId };
3406
- if (isNonEmpty3(body.paymentGatewayOrderId)) return { status: "open", cashierOrderId: body.paymentGatewayOrderId, verticalRef, placed: true };
3407
- const access = await readAccess3(verticalRef, bridge);
3408
- if (access === "granted") return GRANTED;
3409
- return access === "sessionChanged" || access === "unavailable" ? { status: access } : ORDER_REFUSED;
3410
- }
3411
3380
  var PAYMENT_UNDER_WAY2 = /* @__PURE__ */ new Set(["NOT_PAID", "PENDING", "PENDING_MERCHANT", "PARTIALLY_PAID"]);
3412
3381
  var NO_ACCESS2 = /* @__PURE__ */ new Set(["FULLY_REFUNDED", "PARTIALLY_REFUNDED", "CANCELED", "DECLINED", "VOIDED"]);
3413
3382
 
@@ -3639,7 +3608,6 @@ export {
3639
3608
  createWorkerOrderRefStore,
3640
3609
  eventTicketOrders,
3641
3610
  iapPurchaseFields,
3642
- itemPaymentEnabled,
3643
3611
  onlineProgramOrders,
3644
3612
  pricingPlanOrders,
3645
3613
  storesAppleSalesEnabled,
@@ -667,7 +667,6 @@ var HIMALAYA_SERVE_IAP_ROUTE = { prefix: "/himalaya-serve/v1/iap" };
667
667
  var BOOKINGS_APPLE_SALES_ENABLED = true;
668
668
  var EVENTS_APPLE_SALES_ENABLED = true;
669
669
  var ATTENDANCE_SALE_RULE = { appProductId: (id) => id, productType: "CONSUMABLE" };
670
- var STORES_ITEM_PAYMENT_ENABLED = false;
671
670
  var STORES_APPLE_SALES_ENABLED = true;
672
671
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
673
672
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
@@ -678,7 +677,7 @@ var VIDEO_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE"
678
677
  function appleSaleRules(options = {}) {
679
678
  return {
680
679
  onlineProgram: ONLINE_PROGRAM_SALE_RULE,
681
- ...(options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED) || (options.storesItemPaymentEnabled ?? STORES_ITEM_PAYMENT_ENABLED) ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
680
+ ...options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
682
681
  ...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {},
683
682
  ...options.bookingsAppleSalesEnabled ?? BOOKINGS_APPLE_SALES_ENABLED ? { bookingsService: ATTENDANCE_SALE_RULE } : {},
684
683
  ...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {},
@@ -1072,7 +1071,7 @@ function startPaymentCall(scope, wixTransactionId) {
1072
1071
  return post(scope, "/payments/start", { appleBundleId: scope.binding.bundleId, wixTransactionId });
1073
1072
  }
1074
1073
  function startItemPaymentCall(scope, item) {
1075
- return post(scope, "/payments/start-item", { appId: scope.binding.purchasesAppId, item: { catalogItemId: item.catalogItemId, catalogAppId: item.catalogAppId } });
1074
+ return post(scope, "/payments/start-item", { appleBundleId: scope.binding.bundleId, item: { catalogItemId: item.catalogItemId, catalogAppId: item.catalogAppId } });
1076
1075
  }
1077
1076
  function catalogItemOf(raw) {
1078
1077
  const item = isObject3(raw) ? raw : {};
@@ -1658,7 +1657,6 @@ export {
1658
1657
  MAX_RETRY_DELAY_MS,
1659
1658
  PRICING_PLAN_APPLE_SALES_ENABLED,
1660
1659
  STORES_APPLE_SALES_ENABLED,
1661
- STORES_ITEM_PAYMENT_ENABLED,
1662
1660
  STORES_PRODUCT_SALE_RULE,
1663
1661
  VIDEOS_APPLE_SALES_ENABLED,
1664
1662
  appleManagedStore,
@@ -2351,7 +2351,6 @@ var HIMALAYA_SERVE_IAP_ROUTE = { prefix: "/himalaya-serve/v1/iap" };
2351
2351
  var BOOKINGS_APPLE_SALES_ENABLED = true;
2352
2352
  var EVENTS_APPLE_SALES_ENABLED = true;
2353
2353
  var ATTENDANCE_SALE_RULE = { appProductId: (id2) => id2, productType: "CONSUMABLE" };
2354
- var STORES_ITEM_PAYMENT_ENABLED = false;
2355
2354
  var STORES_APPLE_SALES_ENABLED = true;
2356
2355
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
2357
2356
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
@@ -2362,7 +2361,7 @@ var VIDEO_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE
2362
2361
  function appleSaleRules(options = {}) {
2363
2362
  return {
2364
2363
  onlineProgram: ONLINE_PROGRAM_SALE_RULE,
2365
- ...(options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED) || (options.storesItemPaymentEnabled ?? STORES_ITEM_PAYMENT_ENABLED) ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
2364
+ ...options.storesAppleSalesEnabled ?? STORES_APPLE_SALES_ENABLED ? { storesProduct: STORES_PRODUCT_SALE_RULE } : {},
2366
2365
  ...options.pricingPlanAppleSalesEnabled ?? PRICING_PLAN_APPLE_SALES_ENABLED ? { pricingPlan: PRICING_PLAN_SALE_RULE } : {},
2367
2366
  ...options.bookingsAppleSalesEnabled ?? BOOKINGS_APPLE_SALES_ENABLED ? { bookingsService: ATTENDANCE_SALE_RULE } : {},
2368
2367
  ...options.eventsAppleSalesEnabled ?? EVENTS_APPLE_SALES_ENABLED ? { eventsTicket: ATTENDANCE_SALE_RULE } : {},
@@ -2736,7 +2735,7 @@ function startPaymentCall(scope, wixTransactionId) {
2736
2735
  return post(scope, "/payments/start", { appleBundleId: scope.binding.bundleId, wixTransactionId });
2737
2736
  }
2738
2737
  function startItemPaymentCall(scope, item) {
2739
- return post(scope, "/payments/start-item", { appId: scope.binding.purchasesAppId, item: { catalogItemId: item.catalogItemId, catalogAppId: item.catalogAppId } });
2738
+ return post(scope, "/payments/start-item", { appleBundleId: scope.binding.bundleId, item: { catalogItemId: item.catalogItemId, catalogAppId: item.catalogAppId } });
2740
2739
  }
2741
2740
  function catalogItemOf(raw) {
2742
2741
  const item = isObject3(raw) ? raw : {};
@@ -3280,9 +3279,6 @@ var HIMALAYA_SERVE_CHECKOUT_ROUTES = {
3280
3279
  function appleIapCheckoutRoutes() {
3281
3280
  return HIMALAYA_SERVE_CHECKOUT_ROUTES;
3282
3281
  }
3283
- function itemPaymentEnabled() {
3284
- return STORES_ITEM_PAYMENT_ENABLED;
3285
- }
3286
3282
 
3287
3283
  // ../../stdlib/flows/iap-checkout/src/cashier-charges.ts
3288
3284
  async function ensureAppleIapCharge(bridge, route, orderId) {
@@ -3639,8 +3635,8 @@ function createWixOrderBackend(deps) {
3639
3635
  if (unresolved) return contextResult(catalogRef, unresolved);
3640
3636
  const blocked = saleBlocked(sale);
3641
3637
  if (blocked) return contextResult(catalogRef, blocked);
3642
- const itemPayment = deps.itemPaymentEnabled ? sale.adapter.itemPayment?.(sale.item) : null;
3643
- return itemPayment ? startItemFor(sale, itemPayment) : startOrderFor(sale);
3638
+ const { adapter } = sale;
3639
+ return paidByItem(adapter) ? startItemFor(sale, adapter.itemPayment(sale.item)) : startOrderFor({ ...sale, adapter });
3644
3640
  }
3645
3641
  async function startOrderFor(sale) {
3646
3642
  const ordered = await orderFor(sale);
@@ -3960,6 +3956,9 @@ function createWixOrderBackend(deps) {
3960
3956
  }
3961
3957
  return { getPurchaseContext, getMemberContext, submitProof };
3962
3958
  }
3959
+ function paidByItem(adapter) {
3960
+ return typeof adapter.itemPayment === "function";
3961
+ }
3963
3962
  var RETRYABLE = { status: "retryable" };
3964
3963
  var STALE2 = { stop: true, result: "retryable" };
3965
3964
  function stopWith(result, failure4) {
@@ -4078,7 +4077,6 @@ function enabledCheckout(deps) {
4078
4077
  bridge,
4079
4078
  itemFor: (key) => sales.get(key),
4080
4079
  productBusy,
4081
- itemPaymentEnabled: deps.itemPaymentEnabled,
4082
4080
  report: onEvent
4083
4081
  });
4084
4082
  const coordinator = createPurchaseCoordinator({
@@ -4609,7 +4607,6 @@ function createIapCommerceWith(deps) {
4609
4607
  stopWatchingSession = void 0;
4610
4608
  checkout = createAppleIapCheckoutWith({
4611
4609
  enabled: true,
4612
- itemPaymentEnabled: deps.itemPaymentEnabled,
4613
4610
  wixIap: deps.wixIapClient({ host, route: routes.wixIap }),
4614
4611
  binding: deps.binding,
4615
4612
  session: deps.session,
@@ -4747,7 +4744,6 @@ function createIapCommerce(options = {}) {
4747
4744
  const binding = sharedHostAppBindingSource();
4748
4745
  return createIapCommerceWith({
4749
4746
  routes: appleIapCheckoutRoutes(),
4750
- itemPaymentEnabled: itemPaymentEnabled(),
4751
4747
  pricing: createIapCatalogPricing({ onChange: options.onChange }),
4752
4748
  binding,
4753
4749
  session,
@@ -48,7 +48,43 @@ function getLoyaltyTiersProgram(readOptions) {
48
48
  function listMyLoyaltyCoupons(readOptions) {
49
49
  return wixCall("GET", "/loyalty-coupons/v1/coupons/my-coupons", void 0, readOptions);
50
50
  }
51
+ function redeemMyLoyaltyReward(rewardId, options) {
52
+ if (!rewardId) return Promise.reject(new Error("A reward ID is required"));
53
+ return wixCall("POST", "/loyalty-coupons/v1/coupons/redeem-my-coupon", { rewardId }, options?.site ? { site: options.site } : void 0);
54
+ }
55
+ function listMyLoyaltyFollowedChannels(options) {
56
+ return wixCall("GET", "/loyalty-social-media/v1/followed-channels", void 0, options);
57
+ }
58
+ function followMyLoyaltyChannel(channel, options) {
59
+ if (!["FACEBOOK", "INSTAGRAM", "LINKEDIN", "TIKTOK", "X"].includes(channel)) return Promise.reject(new Error("Unsupported loyalty channel"));
60
+ return wixCall("POST", "/loyalty-social-media/v1/followed-channels", { followedChannel: { channel } }, options?.site ? { site: options.site } : void 0);
61
+ }
62
+ async function listMyReferralRewards(options) {
63
+ const rewards = [], seen = /* @__PURE__ */ new Set();
64
+ let cursor = "";
65
+ for (let page = 0; page < 20; page++) {
66
+ let response;
67
+ try {
68
+ response = await wixCall("POST", "/_api/referral-rewards/v1/referral-rewards/query", {
69
+ contactId: "me",
70
+ query: { filter: { rewardType: "CouponReward" }, cursorPaging: { limit: 100, ...cursor ? { cursor } : {} } }
71
+ }, options);
72
+ } catch (error) {
73
+ if (/\bAPP_NOT_INSTALLED\b/.test(String(error)) && page === 0) return { referralRewards: [] };
74
+ throw error;
75
+ }
76
+ if (!response || typeof response !== "object" || Array.isArray(response) || response.referralRewards !== void 0 && !Array.isArray(response.referralRewards)) throw new Error("Referral rewards response is incomplete");
77
+ rewards.push(...response.referralRewards ?? []);
78
+ const next = response.metadata?.cursors?.next;
79
+ if (!next) return { referralRewards: rewards };
80
+ if (seen.has(next)) throw new Error("Referral rewards cursor repeated");
81
+ seen.add(next);
82
+ cursor = next;
83
+ }
84
+ throw new Error("Referral rewards exceed the supported page limit");
85
+ }
51
86
  export {
87
+ followMyLoyaltyChannel,
52
88
  getCurrentMemberLoyaltyAccount,
53
89
  getLoyaltyBffDashboard,
54
90
  getLoyaltyProgram,
@@ -57,6 +93,9 @@ export {
57
93
  listLoyaltyRewards,
58
94
  listLoyaltyTiers,
59
95
  listMyLoyaltyCoupons,
96
+ listMyLoyaltyFollowedChannels,
97
+ listMyReferralRewards,
98
+ redeemMyLoyaltyReward,
60
99
  wixCall
61
100
  };
62
101
  //# sourceMappingURL=wix-loyalty.mjs.map