@wix/himalaya-cli 0.1537.0 → 0.1538.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/dist/cli.mjs CHANGED
@@ -23049,6 +23049,7 @@ function resolveIdiom(tokens2, ctx = {}) {
23049
23049
  var IDIOM_CONTEXTS, UNSAFE_KEYS;
23050
23050
  var init_idiom = __esm({
23051
23051
  "../../core/ts/src/idiom.ts"() {
23052
+ "use strict";
23052
23053
  IDIOM_CONTEXTS = {
23053
23054
  ios: { native: ["ios"] },
23054
23055
  android: { native: ["material"] },
@@ -173316,6 +173317,12 @@ function credentialsPlan(deps) {
173316
173317
  };
173317
173318
  }
173318
173319
  async function connectProvider(provider, appId2, apply) {
173320
+ if (provider && !apply) {
173321
+ return {
173322
+ state: "unverified",
173323
+ detail: "whether the appleIAP payment provider is connected cannot be read (wix-iap has no read-only provider-readiness method), so applying sends ConnectProviderAccount again"
173324
+ };
173325
+ }
173319
173326
  if (!provider || !apply) return providerPlan(provider);
173320
173327
  try {
173321
173328
  const { connected } = await provider.connect(appId2);
@@ -173377,7 +173384,16 @@ function mappingTarget(item, plans, rules = APPLE_PROVISIONING_RULES) {
173377
173384
  return skip(entity, `the App Store purchase flow sells ${item.wix.entityType} items only as ${rule.productType}, not ${PRODUCT_TYPE[item.type]}`);
173378
173385
  }
173379
173386
  if (item.wix.entityType === "pricingPlan") {
173380
- 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`);
173387
+ if (!plans.ok) {
173388
+ return { skip: {
173389
+ entity,
173390
+ appProductId: rule.appProductId(item.wix.entityId),
173391
+ storeProductId: item.productId,
173392
+ state: "failed",
173393
+ code: "request_failed",
173394
+ detail: `only one-time unlimited plans sell through the App Store, and ${plans.why}, so this plan was not mapped`
173395
+ } };
173396
+ }
173381
173397
  if (!plans.ids.has(item.wix.entityId)) {
173382
173398
  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");
173383
173399
  }
@@ -173404,6 +173420,17 @@ function decide(catalog4, target) {
173404
173420
  }
173405
173421
  return void 0;
173406
173422
  }
173423
+ function connectDiff(report3) {
173424
+ const diff = { inPlace: [], toCreate: [], conflicts: [], unverified: [], blocked: [], skipped: [] };
173425
+ const steps = [
173426
+ ["app", report3.app],
173427
+ ["key", report3.credentials],
173428
+ ["provider", report3.provider],
173429
+ ...report3.mappings.map((m2) => [`mapping ${m2.appProductId ?? m2.entity}`, m2])
173430
+ ];
173431
+ for (const [label3, step] of steps) diff[DIFF_BUCKET[step.state]].push(label3);
173432
+ return diff;
173433
+ }
173407
173434
  function mappingWithoutApp(item, planning, plans, rules = APPLE_PROVISIONING_RULES) {
173408
173435
  const target = mappingTarget(item, plans, rules);
173409
173436
  if ("skip" in target) return target.skip;
@@ -173418,12 +173445,22 @@ function noApp(why) {
173418
173445
  function failed(what, error) {
173419
173446
  return { state: "failed", code: "request_failed", detail: `could not ${what}: ${error instanceof Error ? error.message : String(error)}` };
173420
173447
  }
173421
- var PRODUCT_TYPE;
173448
+ var PRODUCT_TYPE, DIFF_BUCKET;
173422
173449
  var init_store_iap_connect = __esm({
173423
173450
  "src/store-iap-connect.ts"() {
173424
173451
  init_wix_payments_contract();
173425
173452
  init_store_iap_purchases();
173426
173453
  PRODUCT_TYPE = { nonConsumable: "NON_CONSUMABLE", consumable: "CONSUMABLE" };
173454
+ DIFF_BUCKET = {
173455
+ reused: "inPlace",
173456
+ done: "inPlace",
173457
+ planned: "toCreate",
173458
+ conflict: "conflicts",
173459
+ unverified: "unverified",
173460
+ failed: "unverified",
173461
+ blocked: "blocked",
173462
+ skipped: "skipped"
173463
+ };
173427
173464
  }
173428
173465
  });
173429
173466
 
@@ -174128,13 +174165,17 @@ function firstProblem(report3) {
174128
174165
  function printConnect(out2, report3, heading) {
174129
174166
  out2.line(`himi store iap connect \u2014 ${heading}`);
174130
174167
  out2.line(` ${pad("site")}${report3.site} \xB7 bundle ${report3.bundleId}`);
174131
- const row2 = (label3, step) => out2.line(` ${pad(label3)}${step.state.padEnd(9)}${step.detail}`);
174168
+ const row2 = (label3, step) => out2.line(` ${pad(label3)}${step.state.padEnd(11)}${step.detail}`);
174132
174169
  row2("app", report3.app);
174133
174170
  row2("key", report3.credentials);
174134
174171
  row2("provider", report3.provider);
174135
174172
  for (const mapping of report3.mappings) row2("mapping", mapping);
174136
174173
  if (report3.purchasesAppId) out2.line(` ${pad("binding")}wixIap: { purchasesAppId: "${report3.purchasesAppId}" }`);
174137
174174
  }
174175
+ function printDiff(out2, diff) {
174176
+ const parts = [["in place", diff.inPlace], ["to create", diff.toCreate], ["conflicts", diff.conflicts], ["unverified", diff.unverified], ["blocked", diff.blocked], ["skipped", diff.skipped]].filter(([, labels]) => labels.length).map(([name, labels]) => `${name}: ${labels.join(", ")}`);
174177
+ out2.line(` ${pad("diff")}${parts.join(" \xB7 ") || "nothing to change"}`);
174178
+ }
174138
174179
  function printConfig(out2, config, note) {
174139
174180
  if (note) out2.line(` ${pad("config")}${note}`);
174140
174181
  if (!config) return;
@@ -174241,10 +174282,12 @@ async function connectWith(flags, deps, out2) {
174241
174282
  if (outPath) writeJson(deps, out2, outPath, { report: report3, config });
174242
174283
  const configProblem = config?.conflicts.length ? "config_conflict" : unapplied ? "config_not_applied" : void 0;
174243
174284
  const code = firstProblem(report3) ?? configProblem;
174244
- if (out2.json) out2.print({ ok: !code, ...code ? { code } : {}, dryRun, report: report3, config, ...note ? { note } : {} });
174285
+ const diff = dryRun ? connectDiff(report3) : void 0;
174286
+ if (out2.json) out2.print({ ok: !code, ...code ? { code } : {}, dryRun, report: report3, ...diff ? { diff } : {}, config, ...note ? { note } : {} });
174245
174287
  else {
174246
174288
  printConnect(out2, report3, dryRun ? "dry run (nothing was written)" : "result");
174247
174289
  printConfig(out2, config, note);
174290
+ if (diff) printDiff(out2, diff);
174248
174291
  }
174249
174292
  return code ? 1 : 0;
174250
174293
  }
@@ -174558,7 +174601,7 @@ var init_store_iap = __esm({
174558
174601
  };
174559
174602
  CredentialsError = class extends Error {
174560
174603
  };
174561
- writesPlanned = (report3) => [report3.app, report3.credentials, report3.provider, ...report3.mappings].some((step) => step.state === "planned");
174604
+ writesPlanned = (report3) => [report3.app, report3.credentials, report3.provider, ...report3.mappings].some((step) => step.state === "planned" || step.state === "unverified");
174562
174605
  COMMANDS2 = {
174563
174606
  draft: draftCommand,
174564
174607
  plan: planCommand,
@@ -125,7 +125,9 @@ An invalid manifest fails with `manifest_invalid`, like the other `store iap` co
125
125
  ## `himi store iap connect` codes
126
126
 
127
127
  `connect` prints one envelope with the whole report. When the setup is not complete it is
128
- `ok: false` with the first step's code; each step also carries its own `code`.
128
+ `ok: false` with the first step's code; each step also carries its own `code`. A dry run adds
129
+ `diff: { inPlace, toCreate, conflicts, unverified, blocked, skipped }` (every step in exactly one list), and reports a step whose state cannot be read
130
+ without writing (the appleIAP provider, once the app is registered) as `state: "unverified"`.
129
131
 
130
132
  | Code | Meaning |
131
133
  |---|---|
@@ -145,7 +147,7 @@ An invalid manifest fails with `manifest_invalid`, like the other `store iap` co
145
147
  | `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). |
146
148
  | `no_purchases_app` | A step did not run because the site has no purchases app for the bundle. |
147
149
  | `request_failed` | A Purchases or Catalog call failed for another reason; the original message is preserved. |
148
- | `setup_incomplete` | Steps are only planned (a dry run) or otherwise not yet in place. |
150
+ | `setup_incomplete` | Steps are only planned or unverified (a dry run) or otherwise not yet in place. |
149
151
  | `confirmation_required` | Writes were planned, but there was no terminal to ask and no `--yes`. Nothing was written. |
150
152
  | `config_conflict` | The backend setup is complete, but the app's config names a different purchases app, site or bundle. |
151
153
  | `config_not_applied` | `--content` was given, but the binding is not in its `config.ts` (no config file, a dynamic or symlinked config, an edit `himi validate` rolled back, or no validator); the `config` report or `note` says what to add by hand. |
@@ -109,8 +109,8 @@ managed submission. Other per-item failures include `catalog_screenshot_upload_f
109
109
 
110
110
  `check` combines the registration, stored purchase key, Catalog mappings, Apple product and
111
111
  screenshot readiness, vertical sales rules, app visibility, and source/build binding in one
112
- read-only report. Unlike `connect --dry-run`, it never reports the payment provider as planned
113
- and counts that as readiness. Every finding carries `state: "ok" | "missing" | "blocked"`, a
112
+ read-only report. Like `connect --dry-run`, which reports the payment provider `unverified`, it
113
+ never counts the unread provider as ready. Every finding carries `state: "ok" | "missing" | "blocked"`, a
114
114
  stable `code`, and a `fix`; overall `code` is `ok` or `setup_incomplete` (exit 0 or 1).
115
115
 
116
116
  ```sh
@@ -490,12 +490,14 @@ In order:
490
490
  3. **The appleIAP payment provider** on the site, through Serve's IAP route to wix-iap
491
491
  (`ConnectProviderAccount`). Reported as `provider_route_unavailable` only when the Serve target
492
492
  has no IAP routes; a refusal from the service behind it is `request_failed`. There is no read
493
- of the provider's state, so a rerun connects it again (the call is safe to repeat).
493
+ of the provider's state, so a rerun connects it again (the call is safe to repeat), and a dry
494
+ run for an app that is already registered reports this step `unverified` instead of planned.
494
495
  4. **One mapping per Wix item → Apple product, through Catalog `listProducts` / `createProduct`.** Online Programs map by program id, Wix Stores
495
496
  digital products by product id, and one-time unlimited Pricing Plans by plan id (the ids the
496
497
  purchase flow looks up), all only as non-consumables. A plan is mapped only when the site reads it
497
498
  as one-time unlimited (one payment, valid until cancelled); a recurring, time-limited or archived
498
- plan, or one connect cannot read, is skipped. Other verticals, price tiers and consumable items
499
+ plan is skipped. When the site's plans cannot be read, each plan is `failed` (`request_failed`,
500
+ `unverified` in the dry-run diff) and not mapped. Other verticals, price tiers and consumable items
499
501
  are skipped with `mapping_unsupported`. An item already mapped to another
500
502
  product (`mapping_conflict`), a mapping of another product type (`mapping_type_mismatch`), an
501
503
  inactive mapping (`mapping_inactive`), or an Apple product mapped to another item
@@ -509,7 +511,13 @@ In order:
509
511
  otherwise `bundleId` itself or, for a dev bundle, the same without `.dev`. Whenever `--content` was given and the binding
510
512
  did not land, the run is `ok: false` (`config_not_applied`) with what to add by hand.
511
513
 
512
- **Review first.** `--dry-run` reads everything and writes nothing. Without `--dry-run` it prints
514
+ **Review first.** `--dry-run` reads everything it can and writes nothing: the site's purchases
515
+ apps and the app's Catalog mappings (plus the site's plans when the manifest maps plans), never
516
+ the provider connection, the key write or a mapping write. It ends with a `diff` (in JSON,
517
+ `diff: { inPlace, toCreate, conflicts, unverified, blocked, skipped }`, each a list of `app`,
518
+ `key`, `provider` or `mapping <id>`, every step in exactly one): what is already in place, what
519
+ applying would create, what it would leave as a conflict, what could not be read (including a
520
+ read that failed), what is blocked, and what connect does not handle. Without `--dry-run` it prints
513
521
  the plan and asks; a shell with no terminal (or `--json`) needs `--yes`. A rerun reuses every
514
522
  record and writes nothing new. Adding products later means adding them to the manifest and
515
523
  rerunning: only their mappings are added, and the purchases-app id (the one thing a build bakes)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1537.0",
3
+ "version": "0.1538.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": "d6ee8032d51eaeb8dc274ee3f30d37f7461aff9849c18acd863e9fd6"
74
+ "falconPackageHash": "a1a15dbe939dfa2c63ef1cc4b38f88d026f5eda14efaf885d5c9aa84"
75
75
  }