@wix/himalaya-cli 0.1310.0 → 0.1311.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.
@@ -6,7 +6,7 @@ repurposed when human wording changes. New codes may be added; consumers must
6
6
  handle an unknown code as a failure, without parsing prose.
7
7
 
8
8
  **Rollout:** this contract is enforced for **`himi push`**, including `--only`,
9
- first. Other subcommands still have legacy failures without codes and are a
9
+ first, and for **`himi store iap connect`**. Other subcommands still have legacy failures without codes and are a
10
10
  follow-up migration. This is an additive change: existing `error`, `errors`,
11
11
  `message`, `hint`, status, body, and gate-specific fields stay as they were.
12
12
  Some legacy envelopes have no singular `error` or `hint`; consumers must not
@@ -78,6 +78,34 @@ The `ux_evidence_*` codes map to the existing typed `uxEvidence.state`; a succes
78
78
  `recorded` state has no refusal code. Successful pushes and warnings do not gain
79
79
  failure codes. A forced push still follows the existing override rules.
80
80
 
81
+ ## `himi store iap connect` codes
82
+
83
+ `connect` prints one envelope with the whole report. When the setup is not complete it is
84
+ `ok: false` with the first step's code; each step also carries its own `code`.
85
+
86
+ | Code | Meaning |
87
+ |---|---|
88
+ | `bundle_registered_elsewhere` | The bundle id is registered to another purchases app (another site's). Nothing was changed; only that registration's owner can remove it. |
89
+ | `apple_key_missing` | No In-App Purchase key was given and the app has none stored. |
90
+ | `invalid_usage` | The flags are incomplete or malformed (for example `--iap-key` without `--iap-key-id`). Nothing was read or written. |
91
+ | `iap_key_unreadable` | `--iap-key` is missing, unreadable, inside the repository, or not a PEM private key. Nothing was written. |
92
+ | `provider_route_unavailable` | The Serve target has no IAP routes, so the appleIAP provider was not connected. |
93
+ | `manifest_invalid` | `--manifest` is not a valid IAP manifest; `problems` lists why. Nothing was read or written. |
94
+ | `credentials_unavailable` | The `--profile` App Store Connect credentials could not be resolved. Nothing was read or written. |
95
+ | `provider_not_connected` | wix-iap answered, but reported the provider account as not connected. |
96
+ | `mapping_conflict` | The Wix item is already mapped to a different Apple product; left as it is. |
97
+ | `mapping_inactive` | The mapping exists but is inactive; left as it is. |
98
+ | `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. |
99
+ | `sku_in_use` | The Apple product is already mapped to another Wix item; left as it is. |
100
+ | `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). |
101
+ | `no_purchases_app` | A step did not run because the site has no purchases app for the bundle. |
102
+ | `request_failed` | A purchases-service call failed for another reason; the original message is preserved. |
103
+ | `setup_incomplete` | Steps are only planned (a dry run) or otherwise not yet in place. |
104
+ | `confirmation_required` | Writes were planned, but there was no terminal to ask and no `--yes`. Nothing was written. |
105
+ | `config_conflict` | The backend setup is complete, but the app's config names a different purchases app, site or bundle. |
106
+ | `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. |
107
+ | `connect_failed` | An otherwise unclassified error stopped connect (for example an unreadable manifest, or a failed `--out` write). The original message is preserved. |
108
+
81
109
  ## Follow-ups
82
110
 
83
111
  - Migrate failure envelopes in subcommands other than `push`, keeping this contract.
@@ -149,6 +149,8 @@ himi store iap draft --site <msid> --profile fit-club-owner --apple-app 6450000
149
149
  himi store iap plan --manifest ./iap-products.json --profile fit-club-owner --out ./iap-plan.json
150
150
  himi store iap apply --plan ./iap-plan.json --profile fit-club-owner --out ./iap-result.json
151
151
  himi store iap status --manifest ./iap-products.json --profile fit-club-owner --json
152
+ himi store iap connect --manifest ./iap-products.json --profile fit-club-owner \
153
+ --iap-key ~/keys/SubscriptionKey_ABCD123456.p8 --iap-key-id ABCD123456 --content . --dry-run
152
154
  ```
153
155
 
154
156
  **`plan` is read-only.** It:
@@ -222,6 +224,53 @@ schedule, even without the local journal. Nothing is ever deleted or rolled back
222
224
  **`status` is read-only.** It reports what Apple has for each product. Add `--out <file>`
223
225
  to save it in the same shape as the result file.
224
226
 
227
+ ## Connecting the Wix site: `connect`
228
+
229
+ `connect` makes the manifest's Wix site ready to sell those products, from the same manifest,
230
+ as the site owner (your Wix login, like `draft`). To run it against a Serve deploy preview, pass
231
+ `--preview-tag dp-<tag>` (or set `HIMI_SERVE_PREVIEW_TAG`). Only the Serve calls (the appleIAP
232
+ provider connection) are routed to the preview; the purchases service and App Store Connect are
233
+ called as usual. In order:
234
+
235
+ 1. **The purchases app.** It reads the site's apps and reuses the one for the manifest's bundle
236
+ id. Only when the site has none does it register one. A bundle id belongs to one purchases
237
+ app platform-wide: if another app holds it (another site's, or another account's), that is a
238
+ `bundle_registered_elsewhere` conflict. Only that registration's owner can remove it; `connect`
239
+ never does.
240
+ 2. **The In-App Purchase key.** It stores `--iap-key` / `--iap-key-id` once, server-side. This is
241
+ an App Store Connect **In-App Purchase** key (Users and Access → Integrations → In-App
242
+ Purchase), not the App Store Connect API key `--profile` names; the service rejects that kind.
243
+ The issuer comes from the profile. Skipped when a key is already stored.
244
+ 3. **The appleIAP payment provider** on the site, through Serve's IAP route to wix-iap
245
+ (`ConnectProviderAccount`). Reported as `provider_route_unavailable` only when the Serve target
246
+ has no IAP routes; a refusal from the service behind it is `request_failed`. There is no read
247
+ of the provider's state, so a rerun connects it again (the call is safe to repeat).
248
+ 4. **One mapping per Wix item → Apple product.** Online Programs map by program id (the id the
249
+ purchase flow looks up), and only as non-consumables. Other verticals, price tiers and
250
+ consumable programs are skipped with `mapping_unsupported`. An item already mapped to another
251
+ product (`mapping_conflict`), a mapping of another product type (`mapping_type_mismatch`), an
252
+ inactive mapping (`mapping_inactive`), or an Apple product mapped to another item
253
+ (`sku_in_use`) is reported and left exactly as it is.
254
+ 5. **The app's config.** With `--content <dir>`, it records `wixIap: { purchasesAppId }` (and the
255
+ `iap` capability) in the package's `config.ts`, keeping everything else byte for byte. The edit
256
+ is backed up under `.himi/store-iap-backup/`, checked with `himi validate`, and rolled back if it
257
+ introduces an error. A different purchases app already there, a member login on another
258
+ site, or another app's bundle is a conflict and the file is not touched. The bundle that must match
259
+ the manifest is the package's `store/store.config.yaml` `ios.bundleId` when it sets one;
260
+ otherwise `bundleId` itself or, for a dev bundle, the same without `.dev`. Whenever `--content` was given and the binding
261
+ did not land, the run is `ok: false` (`config_not_applied`) with what to add by hand.
262
+
263
+ **Review first.** `--dry-run` reads everything and writes nothing. Without `--dry-run` it prints
264
+ the plan and asks; a shell with no terminal (or `--json`) needs `--yes`. A rerun reuses every
265
+ record and writes nothing new. Adding products later means adding them to the manifest and
266
+ rerunning: only their mappings are added, and the purchases-app id (the one thing a build bakes)
267
+ does not change, so no new build is needed.
268
+
269
+ **What it does not do.** It never removes, replaces or reactivates a record. The app reads the
270
+ mappings it writes through Serve's member and visitor route (`POST /himalaya-serve/v1/iap/mappings`;
271
+ see [the backend integration](iap-backend-integration.md)); a build still needs the binding baked
272
+ for its screens to use them.
273
+
225
274
  ## Local state
226
275
 
227
276
  Local state lives in `~/.himalaya/store-iap/<appleAppId>/`:
@@ -261,7 +310,7 @@ future importer must authenticate ownership and re-read Apple before activating
261
310
 
262
311
  | Code | Meaning |
263
312
  |---|---|
264
- | `0` | everything requested is in place (`apply`, `status`), or the plan has no conflicts (`plan`) |
313
+ | `0` | everything requested is in place (`apply`, `status`, `connect`), or the plan has no conflicts (`plan`) |
265
314
  | `1` | partial, conflict, drift, or a declined prompt |
266
315
  | `2` | usage, manifest, credential, target or access error; nothing was written |
267
316
 
@@ -284,4 +333,4 @@ Not in this version:
284
333
  - review screenshot upload and submission
285
334
  - changing a live price
286
335
  - Google Play
287
- - backend import and checkout activation
336
+ - the build-time binding bake and the screens' checkout (the companion PR)
@@ -1932,7 +1932,7 @@
1932
1932
  "name": "AppBindingSource",
1933
1933
  "kind": "interface",
1934
1934
  "jsdoc": "",
1935
- "decl": "export interface AppBindingSource {\n /** Null when the app was never registered. */\n current(): Promise<PurchasesAppBinding | null>;\n}"
1935
+ "decl": "export interface AppBindingSource {\n /** Null when the app was never registered; rejects when the host could not say. */\n current(): Promise<PurchasesAppBinding | null>;\n}"
1936
1936
  },
1937
1937
  {
1938
1938
  "name": "IapAppHost",
@@ -1946,6 +1946,24 @@
1946
1946
  "jsdoc": "/** Where the Payments service is reachable through the Wix gateway. */",
1947
1947
  "decl": "export interface WixIapRoute {\n /** The gateway path that maps to the service's `/v1`, without a trailing slash. No public route\n * was in the generated gateway metadata on 2026-10-08, so there is deliberately no default. */\n prefix: string;\n}"
1948
1948
  },
1949
+ {
1950
+ "name": "HIMALAYA_SERVE_IAP_ROUTE",
1951
+ "kind": "const",
1952
+ "jsdoc": "/**\n * Serve's Apple-IAP routes on the public gateway (`www.wixapis.com/himalaya-serve/v1/iap`), where the\n * native bridge sends the member's or visitor's own token. One prefix for the wix-iap payment calls, the\n * cashier charge and the mapping read; Serve forwards each to the internal service that owns it.\n */",
1953
+ "decl": "export const HIMALAYA_SERVE_IAP_ROUTE: WixIapRoute = { prefix: \"/himalaya-serve/v1/iap\" };"
1954
+ },
1955
+ {
1956
+ "name": "AppleSaleRule",
1957
+ "kind": "interface",
1958
+ "jsdoc": "/** How the App Store sells one vertical's Wix item: the purchases catalog's `appProductId` for it, and\n * the only product type the purchase flow sells it as. */",
1959
+ "decl": "export interface AppleSaleRule {\n appProductId(entityId: string): string;\n productType: \"NON_CONSUMABLE\";\n}"
1960
+ },
1961
+ {
1962
+ "name": "APPLE_SALE_RULES",
1963
+ "kind": "const",
1964
+ "jsdoc": "/**\n * The one definition `himi store iap connect` writes mappings by and the mapping source reads them by,\n * keyed by catalog kind. wix-iap StartPayment maps the cashier order's single item id, and Online\n * Programs builds that order with the program id as the item id; programs are one-time unlocks.\n * Other verticals' order item ids are not established yet, so their items keep their own commerce.\n */",
1965
+ "decl": "export const APPLE_SALE_RULES: Readonly<Record<string, AppleSaleRule>> = {\n onlineProgram: { appProductId: (id) => id, productType: \"NON_CONSUMABLE\" },\n};"
1966
+ },
1949
1967
  {
1950
1968
  "name": "HostCallExpectation",
1951
1969
  "kind": "interface",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1310.0",
3
+ "version": "0.1311.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": "aed0d12edf97361177bd9f7e6ba033b9cce8f83615824cd195882dbf"
74
+ "falconPackageHash": "105e0572efcdcccbc0bea292e6e88354813e2abb6f818908beff3f79"
75
75
  }