@wix/himalaya-cli 0.1376.0 → 0.1377.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.
@@ -56,9 +56,11 @@ export declare const STORES_APPLE_SALES_ENABLED = true;
56
56
  /** StartItemPayment's CatalogReference: the purchases catalog sells a Stores product under its product
57
57
  * id (eCom's `catalogItemId`). One-time unlocks only, whatever the backend also accepts. */
58
58
  export declare const STORES_PRODUCT_SALE_RULE: AppleSaleRule;
59
- /** Off until a member's plan order, its cashier item id and Sandbox fulfillment are proven live.
60
- * Recurring and time-limited plans stay outside this rule; their Billing lifecycle is unfinished. */
61
- export declare const PRICING_PLAN_APPLE_SALES_ENABLED = false;
59
+ /** One-time unlimited plans sell through the App Store. Proven live in Sandbox on 2026-10-19: a member's
60
+ * online plan order is charged with one cashier item whose id is the plan id, so StartPayment maps it to the
61
+ * plan's Apple product, and the order reads ACTIVE and PAID. Recurring and time-limited plans stay outside
62
+ * this rule; their Billing lifecycle is unfinished. */
63
+ export declare const PRICING_PLAN_APPLE_SALES_ENABLED = true;
62
64
  /**
63
65
  * The one definition `himi store iap connect` writes mappings by and the mapping source reads them by,
64
66
  * keyed by catalog kind. wix-iap StartPayment maps the cashier order's single item id, and Online
@@ -689,7 +689,7 @@ var STORES_ITEM_PAYMENT_ENABLED = false;
689
689
  var STORES_APPLE_SALES_ENABLED = true;
690
690
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
691
691
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
692
- var PRICING_PLAN_APPLE_SALES_ENABLED = false;
692
+ var PRICING_PLAN_APPLE_SALES_ENABLED = true;
693
693
  var PRICING_PLAN_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
694
694
  function appleSaleRules(options = {}) {
695
695
  return {
@@ -667,7 +667,7 @@ var STORES_ITEM_PAYMENT_ENABLED = false;
667
667
  var STORES_APPLE_SALES_ENABLED = true;
668
668
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
669
669
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
670
- var PRICING_PLAN_APPLE_SALES_ENABLED = false;
670
+ var PRICING_PLAN_APPLE_SALES_ENABLED = true;
671
671
  var PRICING_PLAN_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
672
672
  function appleSaleRules(options = {}) {
673
673
  return {
@@ -942,7 +942,7 @@ var STORES_ITEM_PAYMENT_ENABLED = false;
942
942
  var STORES_APPLE_SALES_ENABLED = true;
943
943
  var STORES_PRODUCT_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
944
944
  var ONLINE_PROGRAM_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
945
- var PRICING_PLAN_APPLE_SALES_ENABLED = false;
945
+ var PRICING_PLAN_APPLE_SALES_ENABLED = true;
946
946
  var PRICING_PLAN_SALE_RULE = { appProductId: (id2) => id2, productType: "NON_CONSUMABLE" };
947
947
  function appleSaleRules(options = {}) {
948
948
  return {
package/dist/cli.mjs CHANGED
@@ -7708,7 +7708,6 @@ function resolveTranslation(value, catalog3, sourceCatalog) {
7708
7708
  var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
7709
7709
  var init_bindings = __esm({
7710
7710
  "../../core/ts/src/bindings.ts"() {
7711
- "use strict";
7712
7711
  BINDING_SIGILS = ["service", "flag", "item", "t"];
7713
7712
  BINDING_SIGIL_RE = new RegExp(
7714
7713
  `^\\$(?:${BINDING_SIGILS.filter((s2) => s2 !== "t").join("|")})\\b|^\\$t:`
@@ -159772,7 +159771,7 @@ var init_wix_payments_contract = __esm({
159772
159771
  STORES_APPLE_SALES_ENABLED = true;
159773
159772
  STORES_PRODUCT_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
159774
159773
  ONLINE_PROGRAM_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
159775
- PRICING_PLAN_APPLE_SALES_ENABLED = false;
159774
+ PRICING_PLAN_APPLE_SALES_ENABLED = true;
159776
159775
  PRICING_PLAN_SALE_RULE = { appProductId: (id) => id, productType: "NON_CONSUMABLE" };
159777
159776
  APPLE_SALE_RULES = appleSaleRules();
159778
159777
  }
@@ -160506,6 +160505,13 @@ async function readPlans(wix, notes) {
160506
160505
  throw e2;
160507
160506
  }
160508
160507
  }
160508
+ async function readOneTimeUnlimitedPlanIds(wix) {
160509
+ const rows = await allByOffset(async (offset) => {
160510
+ const res = await wix("GET", `/pricing-plans/v2/plans?limit=${PAGE2}&offset=${offset}`);
160511
+ return { rows: res.plans ?? [], total: res.pagingMetadata?.total };
160512
+ }, "/pricing-plans/v2/plans");
160513
+ return new Set(rows.filter((p2) => planKind(p2.pricing) === "digital" && p2.archived !== true && typeof p2.id === "string").map((p2) => p2.id));
160514
+ }
160509
160515
  async function readWixCatalog(wix) {
160510
160516
  const notes = [];
160511
160517
  const items = [...await readStores(wix, notes), ...await readPrograms(wix, notes), ...await readPlans(wix, notes)];
@@ -160595,6 +160601,16 @@ var init_store_iap_purchases = __esm({
160595
160601
  });
160596
160602
 
160597
160603
  // src/store-iap-connect.ts
160604
+ async function planCheck(items, deps) {
160605
+ const rules = deps.saleRules ?? APPLE_SALE_RULES;
160606
+ if (!rules.pricingPlan || !items.some((item) => item.wix?.entityType === "pricingPlan")) return { ok: true, ids: /* @__PURE__ */ new Set() };
160607
+ if (!deps.oneTimePlans) return { ok: false, why: "the site's plans were not read" };
160608
+ try {
160609
+ return { ok: true, ids: await deps.oneTimePlans() };
160610
+ } catch (error) {
160611
+ return { ok: false, why: `the site's plans could not be read (${error instanceof Error ? error.message : String(error)})` };
160612
+ }
160613
+ }
160598
160614
  async function connectIap(manifest, deps, options) {
160599
160615
  const { target } = manifest;
160600
160616
  const report3 = (app2, appId2, rest) => {
@@ -160609,19 +160625,20 @@ async function connectIap(manifest, deps, options) {
160609
160625
  ...rest
160610
160626
  };
160611
160627
  };
160628
+ const plans = await planCheck(manifest.items, deps);
160612
160629
  const found = await findOrRegister(deps.api, manifest, options.apply);
160613
160630
  if (!found.app) {
160614
160631
  const skipped = found.step.state === "planned" ? planned : noApp;
160615
160632
  return report3(found.step, null, {
160616
160633
  credentials: found.step.state === "planned" ? credentialsPlan(deps.appleKey) : skipped("the app is not registered"),
160617
160634
  provider: found.step.state === "planned" ? providerPlan(deps.provider) : skipped("the app is not registered"),
160618
- mappings: manifest.items.map((item) => mappingWithoutApp(item, found.step.state === "planned", deps.saleRules))
160635
+ mappings: manifest.items.map((item) => mappingWithoutApp(item, found.step.state === "planned", plans, deps.saleRules))
160619
160636
  });
160620
160637
  }
160621
160638
  const { app } = found;
160622
160639
  const credentials = await storeKey(deps, app, options.apply);
160623
160640
  const provider = await connectProvider(deps.provider, app.id, options.apply);
160624
- const mappings = await mapItems(deps.api, app.id, manifest.items, options.apply, deps.saleRules);
160641
+ const mappings = await mapItems(deps.api, app.id, manifest.items, options.apply, plans, deps.saleRules);
160625
160642
  return report3(found.step, app.id, { credentials, provider, mappings });
160626
160643
  }
160627
160644
  async function findOrRegister(api2, manifest, apply) {
@@ -160687,19 +160704,19 @@ function providerPlan(provider) {
160687
160704
  detail: "the appleIAP provider is connected through Serve's IAP routes (wix-iap ConnectProviderAccount), and this Serve target has none."
160688
160705
  };
160689
160706
  }
160690
- async function mapItems(api2, appId2, items, apply, rules = APPLE_SALE_RULES) {
160707
+ async function mapItems(api2, appId2, items, apply, plans, rules = APPLE_SALE_RULES) {
160691
160708
  let catalog3;
160692
160709
  try {
160693
160710
  catalog3 = await api2.listProducts(appId2);
160694
160711
  } catch (error) {
160695
160712
  return items.map((item) => {
160696
- const target = mappingTarget(item, rules);
160713
+ const target = mappingTarget(item, plans, rules);
160697
160714
  return "skip" in target ? target.skip : { ...target, ...failed("read the app's catalog", error) };
160698
160715
  });
160699
160716
  }
160700
160717
  const steps = [];
160701
160718
  for (const item of items) {
160702
- const target = mappingTarget(item, rules);
160719
+ const target = mappingTarget(item, plans, rules);
160703
160720
  if ("skip" in target) {
160704
160721
  steps.push(target.skip);
160705
160722
  continue;
@@ -160719,7 +160736,7 @@ async function mapItems(api2, appId2, items, apply, rules = APPLE_SALE_RULES) {
160719
160736
  }
160720
160737
  return steps;
160721
160738
  }
160722
- function mappingTarget(item, rules = APPLE_SALE_RULES) {
160739
+ function mappingTarget(item, plans, rules = APPLE_SALE_RULES) {
160723
160740
  const skip = (entity2, detail) => ({ skip: { entity: entity2, appProductId: null, storeProductId: item.productId, state: "skipped", code: "mapping_unsupported", detail } });
160724
160741
  if (!item.wix || item.unlocks?.length) {
160725
160742
  return skip(item.productId, "a consumable tier unlocks several Wix items, but a purchase pays one order item, so it cannot be mapped");
@@ -160730,6 +160747,12 @@ function mappingTarget(item, rules = APPLE_SALE_RULES) {
160730
160747
  if (PRODUCT_TYPE[item.type] !== rule.productType) {
160731
160748
  return skip(entity, `the App Store purchase flow sells ${item.wix.entityType} items only as ${rule.productType}, not ${PRODUCT_TYPE[item.type]}`);
160732
160749
  }
160750
+ if (item.wix.entityType === "pricingPlan") {
160751
+ if (!plans.ok) return skip(entity, `only one-time unlimited plans sell through the App Store, and ${plans.why}, so this plan was not mapped`);
160752
+ if (!plans.ids.has(item.wix.entityId)) {
160753
+ return skip(entity, "only one-time unlimited plans (one payment, valid until cancelled) sell through the App Store; this plan is recurring, time-limited, archived or not on the site");
160754
+ }
160755
+ }
160733
160756
  return { entity, appProductId: rule.appProductId(item.wix.entityId), storeProductId: item.productId, type: rule.productType };
160734
160757
  }
160735
160758
  function decide(catalog3, target) {
@@ -160752,8 +160775,8 @@ function decide(catalog3, target) {
160752
160775
  }
160753
160776
  return void 0;
160754
160777
  }
160755
- function mappingWithoutApp(item, planning, rules = APPLE_SALE_RULES) {
160756
- const target = mappingTarget(item, rules);
160778
+ function mappingWithoutApp(item, planning, plans, rules = APPLE_SALE_RULES) {
160779
+ const target = mappingTarget(item, plans, rules);
160757
160780
  if ("skip" in target) return target.skip;
160758
160781
  return planning ? { ...target, state: "planned", detail: `map ${target.appProductId} \u2192 ${target.storeProductId}` } : { ...target, ...noApp("the app is not registered") };
160759
160782
  }
@@ -161230,7 +161253,12 @@ async function connectWith(flags, deps, out2) {
161230
161253
  const transport = deps.wixTransport(manifest.target.wixSiteId);
161231
161254
  const route = deps.wixIapRoute();
161232
161255
  const serve = route ? deps.serveTransport?.(manifest.target.wixSiteId, previewTag) ?? transport : transport;
161233
- const connectDeps = { api: createPurchasesOwnerApi(transport), appleKey, provider: route ? wixIapProviderConnector(serve, route) : null };
161256
+ const connectDeps = {
161257
+ api: createPurchasesOwnerApi(transport),
161258
+ appleKey,
161259
+ provider: route ? wixIapProviderConnector(serve, route) : null,
161260
+ oneTimePlans: () => readOneTimeUnlimitedPlanIds(transport)
161261
+ };
161234
161262
  let plan;
161235
161263
  try {
161236
161264
  plan = await connectIap(manifest, connectDeps, { apply: false });
@@ -117,9 +117,9 @@ exit statuses remain intact. Manifest parsing failures still use their legacy en
117
117
  | `provider_not_connected` | wix-iap answered, but reported the provider account as not connected. |
118
118
  | `mapping_conflict` | The Wix item is already mapped to a different Apple product; left as it is. |
119
119
  | `mapping_inactive` | The mapping exists but is inactive; left as it is. |
120
- | `mapping_type_mismatch` | The mapping exists as a product type the purchase flow cannot sell (programs sell only as `NON_CONSUMABLE`); left as it is. |
120
+ | `mapping_type_mismatch` | The mapping exists as a product type the purchase flow cannot sell (programs, Stores products and one-time plans sell only as `NON_CONSUMABLE`); left as it is. |
121
121
  | `sku_in_use` | The Apple product is already mapped to another Wix item; left as it is. |
122
- | `mapping_unsupported` | The purchase flow cannot map this item yet (a vertical other than Online Programs, a price tier, or a program declared as a consumable). |
122
+ | `mapping_unsupported` | The purchase flow cannot map this item yet (a vertical other than Online Programs, Wix Stores or one-time Pricing Plans, a price tier, or an item declared as a consumable). |
123
123
  | `no_purchases_app` | A step did not run because the site has no purchases app for the bundle. |
124
124
  | `request_failed` | A purchases-service call failed for another reason; the original message is preserved. |
125
125
  | `setup_incomplete` | Steps are only planned (a dry run) or otherwise not yet in place. |
@@ -280,9 +280,12 @@ called as usual. In order:
280
280
  (`ConnectProviderAccount`). Reported as `provider_route_unavailable` only when the Serve target
281
281
  has no IAP routes; a refusal from the service behind it is `request_failed`. There is no read
282
282
  of the provider's state, so a rerun connects it again (the call is safe to repeat).
283
- 4. **One mapping per Wix item → Apple product.** Online Programs map by program id (the id the
284
- purchase flow looks up), and only as non-consumables. Other verticals, price tiers and
285
- consumable programs are skipped with `mapping_unsupported`. An item already mapped to another
283
+ 4. **One mapping per Wix item → Apple product.** Online Programs map by program id, Wix Stores
284
+ digital products by product id, and one-time unlimited Pricing Plans by plan id (the ids the
285
+ purchase flow looks up), all only as non-consumables. A plan is mapped only when the site reads it
286
+ as one-time unlimited (one payment, valid until cancelled); a recurring, time-limited or archived
287
+ plan, or one connect cannot read, is skipped. Other verticals, price tiers and consumable items
288
+ are skipped with `mapping_unsupported`. An item already mapped to another
286
289
  product (`mapping_conflict`), a mapping of another product type (`mapping_type_mismatch`), an
287
290
  inactive mapping (`mapping_inactive`), or an Apple product mapped to another item
288
291
  (`sku_in_use`) is reported and left exactly as it is.
@@ -1979,8 +1979,8 @@
1979
1979
  {
1980
1980
  "name": "PRICING_PLAN_APPLE_SALES_ENABLED",
1981
1981
  "kind": "const",
1982
- "jsdoc": "/** Off until a member's plan order, its cashier item id and Sandbox fulfillment are proven live.\n * Recurring and time-limited plans stay outside this rule; their Billing lifecycle is unfinished. */",
1983
- "decl": "export const PRICING_PLAN_APPLE_SALES_ENABLED = false;"
1982
+ "jsdoc": "/** One-time unlimited plans sell through the App Store. Proven live in Sandbox on 2026-10-19: a member's\n * online plan order is charged with one cashier item whose id is the plan id, so StartPayment maps it to the\n * plan's Apple product, and the order reads ACTIVE and PAID. Recurring and time-limited plans stay outside\n * this rule; their Billing lifecycle is unfinished. */",
1983
+ "decl": "export const PRICING_PLAN_APPLE_SALES_ENABLED = true;"
1984
1984
  },
1985
1985
  {
1986
1986
  "name": "appleSaleRules",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1376.0",
3
+ "version": "0.1377.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -71,5 +71,5 @@
71
71
  "artifactId": "himalaya-cli"
72
72
  }
73
73
  },
74
- "falconPackageHash": "4ea8c5abde370c4eec296f1ee365961a1dcd6337de44c6a859a25098"
74
+ "falconPackageHash": "8715e384332676e713233834b2588b1eb2a99e95bb50e9a4cda54340"
75
75
  }