@wix/himalaya-cli 0.1655.0 → 0.1657.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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/pricing-plans/src/index.d.ts +37 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/checkout.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-pricing-plans.mjs +10 -1
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{3912fa5f6ddb60106c630fb5e48edbf12ebfd57c616d8b7aee0d32088cd3bbdf.bin → c04dd5fc5ad48e6b19678d4313159302e9a513ada94bfe515d8dfd5a54d46f5d.bin} +1 -1
- package/dist/browser-plane/sw.js +5 -5
- package/dist/cli.mjs +109 -62
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/getting-started.md +4 -1
- package/guides/himi-skill.md +4 -1
- package/guides/index.json +12 -0
- package/guides/qa-builds.md +7 -4
- package/guides/recipe-auth.md +120 -0
- package/guides/recipe-checkout.md +108 -0
- package/guides/sdk-reference.json +21 -3
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +2151 -2596
- package/templates/beauty-salon/l10n/en.json +208 -180
- package/templates/beauty-salon/l10n/he.json +300 -138
- package/templates/beauty-salon/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +101 -31
- package/templates/beauty-salon/tier5-src/wix-spaces-my-subscriptions/index.ts +72 -70
- package/templates/beauty-salon/tier5-src/wix-spaces-subscription-detail/index.ts +129 -31
- package/templates/beauty-salon/tokens.json +17 -1
- package/templates/branded-lite/dev/index.ts +2272 -2685
- package/templates/branded-lite/l10n/en.json +225 -52
- package/templates/branded-lite/l10n/he.json +305 -39
- package/templates/branded-lite/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +101 -31
- package/templates/branded-lite/tier5-src/wix-spaces-my-subscriptions/index.ts +72 -70
- package/templates/branded-lite/tier5-src/wix-spaces-subscription-detail/index.ts +129 -31
- package/templates/branded-lite/tokens.json +5 -1
- package/templates/community-club/l10n/en.json +6 -1
- package/templates/community-club/l10n/he.json +23 -2
- package/templates/community-club/tokens.json +17 -1
- package/templates/events-meetups/l10n/en.json +6 -1
- package/templates/events-meetups/l10n/he.json +23 -2
- package/templates/events-meetups/tokens.json +17 -1
- package/templates/gym-fitness/dev/index.ts +2149 -2594
- package/templates/gym-fitness/l10n/en.json +215 -77
- package/templates/gym-fitness/l10n/he.json +300 -59
- package/templates/gym-fitness/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +101 -31
- package/templates/gym-fitness/tier5-src/wix-spaces-my-subscriptions/index.ts +72 -70
- package/templates/gym-fitness/tier5-src/wix-spaces-subscription-detail/index.ts +129 -31
- package/templates/gym-fitness/tokens.json +17 -1
- package/templates/nonprofit-cause/dev/index.ts +2163 -2608
- package/templates/nonprofit-cause/l10n/en.json +216 -38
- package/templates/nonprofit-cause/l10n/he.json +300 -30
- package/templates/nonprofit-cause/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +101 -31
- package/templates/nonprofit-cause/tier5-src/wix-spaces-my-subscriptions/index.ts +72 -70
- package/templates/nonprofit-cause/tier5-src/wix-spaces-subscription-detail/index.ts +129 -31
- package/templates/nonprofit-cause/tokens.json +17 -1
- package/templates/podcast-creator/dev/index.ts +2147 -2592
- package/templates/podcast-creator/l10n/en.json +216 -38
- package/templates/podcast-creator/l10n/he.json +300 -30
- package/templates/podcast-creator/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +101 -31
- package/templates/podcast-creator/tier5-src/wix-spaces-my-subscriptions/index.ts +72 -70
- package/templates/podcast-creator/tier5-src/wix-spaces-subscription-detail/index.ts +129 -31
- package/templates/podcast-creator/tokens.json +17 -1
- package/templates/portfolio-creative/l10n/en.json +15 -8
- package/templates/portfolio-creative/l10n/he.json +28 -6
- package/templates/portfolio-creative/tokens.json +17 -1
- package/templates/restaurant/l10n/en.json +14 -7
- package/templates/restaurant/l10n/he.json +28 -6
- package/templates/restaurant/tokens.json +17 -1
- package/templates/retail-store/l10n/en.json +15 -8
- package/templates/retail-store/l10n/he.json +28 -6
- package/templates/retail-store/tokens.json +17 -1
- package/templates/yoga-studio/dev/index.ts +2204 -2649
- package/templates/yoga-studio/l10n/en.json +216 -43
- package/templates/yoga-studio/l10n/he.json +300 -30
- package/templates/yoga-studio/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +101 -31
- package/templates/yoga-studio/tier5-src/wix-spaces-my-subscriptions/index.ts +72 -70
- package/templates/yoga-studio/tier5-src/wix-spaces-subscription-detail/index.ts +129 -31
- package/templates/yoga-studio/tokens.json +17 -1
- package/templates/beauty-salon/tier5-src/wix-spaces-plan-detail/index.ts +0 -63
- package/templates/branded-lite/tier5-src/wix-spaces-plan-detail/index.ts +0 -63
- package/templates/gym-fitness/tier5-src/wix-spaces-plan-detail/index.ts +0 -63
- package/templates/nonprofit-cause/tier5-src/wix-spaces-plan-detail/index.ts +0 -63
- package/templates/podcast-creator/tier5-src/wix-spaces-plan-detail/index.ts +0 -63
- package/templates/yoga-studio/tier5-src/wix-spaces-plan-detail/index.ts +0 -63
|
Binary file
|
|
@@ -353,7 +353,10 @@ a data-backed list `examples/dynamic-list.*` (`himi docs recipe-dynamic-list`, i
|
|
|
353
353
|
pull-to-refresh + load-more), a create/edit form `examples/form-submit.*`
|
|
354
354
|
(`himi docs recipe-form-submit`), a searchable list `examples/search-list.*`
|
|
355
355
|
(`himi docs recipe-search`), a first-run onboarding card `examples/onboarding.*`
|
|
356
|
-
(`himi docs recipe-onboarding`),
|
|
356
|
+
(`himi docs recipe-onboarding`), a sign-in/register screen and a membership paywall
|
|
357
|
+
(`himi docs recipe-auth`, `himi docs recipe-checkout` — premade `authScreen`/`checkoutScreen` from
|
|
358
|
+
`@wix/himalaya/screens`; use these instead of calling `@himalaya/wix-platform` `auth.signIn()` from a worker),
|
|
359
|
+
and the loading/empty/error/ready idiom they all share
|
|
357
360
|
(`himi docs recipe-four-state` — every recipe that loads or writes data shows a loading state,
|
|
358
361
|
a classified error state and a recovery action where the user can fix the failure). Then — **before you
|
|
359
362
|
design** — read the UX guide (`himi docs designing-himi-screens`) and, for a multi-screen app,
|
package/guides/himi-skill.md
CHANGED
|
@@ -376,7 +376,10 @@ a data-backed list `examples/dynamic-list.*` (`himi docs recipe-dynamic-list`, i
|
|
|
376
376
|
pull-to-refresh + load-more), a create/edit form `examples/form-submit.*`
|
|
377
377
|
(`himi docs recipe-form-submit`), a searchable list `examples/search-list.*`
|
|
378
378
|
(`himi docs recipe-search`), a first-run onboarding card `examples/onboarding.*`
|
|
379
|
-
(`himi docs recipe-onboarding`),
|
|
379
|
+
(`himi docs recipe-onboarding`), a sign-in/register screen and a membership paywall
|
|
380
|
+
(`himi docs recipe-auth`, `himi docs recipe-checkout` — premade `authScreen`/`checkoutScreen` from
|
|
381
|
+
`@wix/himalaya/screens`; use these instead of calling `@himalaya/wix-platform` `auth.signIn()` from a worker),
|
|
382
|
+
and the loading/empty/error/ready idiom they all share
|
|
380
383
|
(`himi docs recipe-four-state` — every recipe that loads or writes data shows a loading state,
|
|
381
384
|
a classified error state and a recovery action where the user can fix the failure). Then — **before you
|
|
382
385
|
design** — read the UX guide (`himi docs designing-himi-screens`) and, for a multi-screen app,
|
package/guides/index.json
CHANGED
|
@@ -172,6 +172,18 @@
|
|
|
172
172
|
"category": "Recipes",
|
|
173
173
|
"file": "recipe-onboarding.md"
|
|
174
174
|
},
|
|
175
|
+
{
|
|
176
|
+
"id": "recipe-auth",
|
|
177
|
+
"title": "Recipe: sign in / register (premade auth flow)",
|
|
178
|
+
"category": "Recipes",
|
|
179
|
+
"file": "recipe-auth.md"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"id": "recipe-checkout",
|
|
183
|
+
"title": "Recipe: paywall / checkout (premade checkout flow)",
|
|
184
|
+
"category": "Recipes",
|
|
185
|
+
"file": "recipe-checkout.md"
|
|
186
|
+
},
|
|
175
187
|
{
|
|
176
188
|
"id": "image-preview",
|
|
177
189
|
"title": "Image and video preview",
|
package/guides/qa-builds.md
CHANGED
|
@@ -1373,9 +1373,12 @@ signing with another key.
|
|
|
1373
1373
|
|
|
1374
1374
|
### An unsigned bundle under the owner's own name — an owner bundle
|
|
1375
1375
|
|
|
1376
|
-
**
|
|
1377
|
-
|
|
1378
|
-
|
|
1376
|
+
**Open to self-serve callers since 2026-11-11.** It's how a Himi app with no Wix site gets a Google Play
|
|
1377
|
+
file: the owner publishes to their own Google Play account under their own package name, with no WixOne
|
|
1378
|
+
link and no plan check. Plan rules belong to the Wix products that bind an app to a site (Containers,
|
|
1379
|
+
Harmony, Brandy). `HIMI_DIST_OWNER_BUNDLES=0` on the serve config closes it (`501
|
|
1380
|
+
owner_bundles_unconfigured`); a blank or missing value leaves it open. The bundle comes back unsigned:
|
|
1381
|
+
the owner signs it with their own upload key before uploading (the gplay tool does this locally).
|
|
1379
1382
|
|
|
1380
1383
|
```sh
|
|
1381
1384
|
himi dist --app <app> --platform android --aab --android-signing owner \
|
|
@@ -1403,7 +1406,7 @@ himi dist --app <app> --platform android --aab --android-signing owner \
|
|
|
1403
1406
|
`409 release_predates_owner_bundles`), and the result callback fails anything not reported as
|
|
1404
1407
|
`unsigned` and drops its link (`android_format_wrong_signer`).
|
|
1405
1408
|
- **A site-bound app is refused** (`409 owner_bundle_site_bound`). Its Google Play file is a store
|
|
1406
|
-
build, whose plan check this path must not bypass.
|
|
1409
|
+
build, made through the Wix product that bound it, whose plan check this path must not bypass.
|
|
1407
1410
|
|
|
1408
1411
|
Other refusals, each with `code` equal to `error`: `android_signing_unsigned_requires_aab`,
|
|
1409
1412
|
`owner_bundle_fields_unexpected` (the two fields on any other build), `owner_bundle_android_only`,
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Recipe: sign in / register (premade `authScreen` + `createAuthService`)
|
|
2
|
+
|
|
3
|
+
For a **login / create-account screen, use the premade flow** from
|
|
4
|
+
`@wix/himalaya/screens`.
|
|
5
|
+
Do **not** hand-write the form, and do **not** call `@himalaya/wix-platform`'s
|
|
6
|
+
native `auth.signIn()` / `auth.signOut()` from a Tier-5 worker for login UI.
|
|
7
|
+
|
|
8
|
+
## Why not `wix-platform` `auth.signIn()`
|
|
9
|
+
|
|
10
|
+
- It needs `declared_capabilities: ["wix_platform"]` **and** a native provider
|
|
11
|
+
wired by the host. A Tier-5-only / hosted-preview app has neither, so it fails
|
|
12
|
+
closed with `capability not declared: wix_platform`.
|
|
13
|
+
- On web it only works in front of a local dev server. Every hosted context (a
|
|
14
|
+
published app, `himi preview`, a hosted preview iframe) refuses it by design
|
|
15
|
+
(`sign_in_unavailable` / 404 — see `himi docs wix-login-integration`).
|
|
16
|
+
- Hand-rolled forms bind `$service:<name>.formEmail` / `formPassword` without
|
|
17
|
+
putting those fields in worker state, and `himi test` rejects them
|
|
18
|
+
(`binding-unresolved`). The premade service always carries every field its own
|
|
19
|
+
descriptor binds.
|
|
20
|
+
|
|
21
|
+
**Where it works.** Direct sign-in / register runs on the native apps and against
|
|
22
|
+
the local dev server only. Published apps, `himi preview` and every other hosted
|
|
23
|
+
web context refuse it (`sign_in_unavailable` / 404) — the same limit as
|
|
24
|
+
`auth.signIn()` above. Do not promise hosted-web member login with this recipe.
|
|
25
|
+
|
|
26
|
+
`createAuthService` signs in through the direct email/password flow
|
|
27
|
+
(`wix_api` only — no native gate), clears the password on every path, and
|
|
28
|
+
**confirms the session against the host** before reporting success.
|
|
29
|
+
|
|
30
|
+
## 1. The worker (four lines)
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
// tier5-src/signin/options.ts — side-effect free, safe to import from a screen
|
|
34
|
+
// Share one options object so both factories always agree on `register` and `copy`.
|
|
35
|
+
export const authOptions = {
|
|
36
|
+
service: "signin",
|
|
37
|
+
register: true, // false hides create-account in BOTH the worker and the screen
|
|
38
|
+
copy: { subhead: "Memberships belong to a member account." },
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// tier5-src/signin/index.ts — runs only inside the JSWorker
|
|
44
|
+
import { createAuthService } from "@wix/himalaya/screens";
|
|
45
|
+
import { authOptions } from "./options";
|
|
46
|
+
|
|
47
|
+
const svc = createAuthService(authOptions);
|
|
48
|
+
|
|
49
|
+
export default svc;
|
|
50
|
+
export { svc };
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Options (pass the same `service`, `register` and `copy` to **both**
|
|
54
|
+
`createAuthService` and `authScreen`, or a `register: false` worker still leaves a dead
|
|
55
|
+
create-account button on the screen): `service` (must match the screen), `register` (default `true`), `copy`
|
|
56
|
+
(every user-facing string: `signInTitle`, `registerTitle`, `subhead`,
|
|
57
|
+
`emailLabel`, `passwordLabel`, `signInCta`, `registerCta`, `toRegisterCta`,
|
|
58
|
+
`toSignInCta`, `signOutCta`, `signedInTitle`).
|
|
59
|
+
|
|
60
|
+
## 2. The screen
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import { authScreen } from "@wix/himalaya/screens";
|
|
64
|
+
import { authOptions } from "../tier5-src/signin/options"; // the same options the worker used (never import index.ts: it runs createAuthService at module scope)
|
|
65
|
+
|
|
66
|
+
const signin = () =>
|
|
67
|
+
authScreen({
|
|
68
|
+
bundleUrl: `http://localhost:8190/v1/bundles/signin`,
|
|
69
|
+
...authOptions, // same service, register and copy as the worker
|
|
70
|
+
title: "Sign in",
|
|
71
|
+
next: [{ label: "Go to the library", screenId: "library" }], // shown once signed in
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Declare the worker bundle with `wix_api` in its capabilities.
|
|
76
|
+
|
|
77
|
+
**App prerequisite.** The direct flow dispatches `himi.wix.signInDirect` /
|
|
78
|
+
`registerDirect`, whose native handlers need a `WixConsumerAuthProvider`.
|
|
79
|
+
`wix_api` alone only covers the REST transport; without the provider, submits
|
|
80
|
+
fail closed with no provider. Add it to `config.ts`:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { WixConsumerAuthProvider } from "@wix/himalaya/wix-auth";
|
|
84
|
+
|
|
85
|
+
export default defineApp({
|
|
86
|
+
// ...
|
|
87
|
+
auth: WixConsumerAuthProvider({
|
|
88
|
+
clientId: process.env.HIMI_WIX_CLIENT_ID!,
|
|
89
|
+
siteUrl: "https://<your-site>.wixsite.com/<site>",
|
|
90
|
+
redirectUri: "<your-scheme>://oauth/callback",
|
|
91
|
+
bootAsVisitor: true, // paint public screens before login
|
|
92
|
+
preserveVisitorOnSignOut: true,
|
|
93
|
+
}),
|
|
94
|
+
capabilities: ["wix_api"],
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
A complete,
|
|
99
|
+
working example: `members-library/dev/index.ts` +
|
|
100
|
+
`members-library/tier5-src/signin/index.ts`.
|
|
101
|
+
|
|
102
|
+
## 3. Writing your own screen
|
|
103
|
+
|
|
104
|
+
Only if the premade layout is not enough: import the primitives from
|
|
105
|
+
`@wix/himalaya/auth` (`signInDirect`, `registerMember`, `resetPassword`,
|
|
106
|
+
`signOut`, `authState`). They fail closed — a non-ok status or a missing
|
|
107
|
+
session is a failure, never "probably signed in". Keep every bound field
|
|
108
|
+
(`email`, `password`, `error`, …) in worker state.
|
|
109
|
+
|
|
110
|
+
## Gotchas
|
|
111
|
+
|
|
112
|
+
- `service` in `authScreen` and `createAuthService` must be identical.
|
|
113
|
+
- Never read a dispatch's own answer as success; use `authState()`.
|
|
114
|
+
- Gate other screens with the app's auth config (`himi docs wix-login-integration`),
|
|
115
|
+
not by re-implementing the form.
|
|
116
|
+
|
|
117
|
+
## See also
|
|
118
|
+
|
|
119
|
+
`himi docs recipe-checkout`, `himi docs wix-login-integration`,
|
|
120
|
+
`himi docs recipe-form-submit`.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Recipe: paywall / checkout (premade `checkoutScreen` + `createCheckoutService`)
|
|
2
|
+
|
|
3
|
+
For a **membership paywall** (browse Wix Pricing Plans, join one, unlock content)
|
|
4
|
+
use the premade flow from `@wix/himalaya/screens`. It pairs with the sign-in
|
|
5
|
+
flow in `himi docs recipe-auth`.
|
|
6
|
+
|
|
7
|
+
## What it already gets right
|
|
8
|
+
|
|
9
|
+
- **Member-scoped entitlement.** Uses the member orders service, not the owner
|
|
10
|
+
one that 403s for members (which fail-closed code reads as "no plan").
|
|
11
|
+
- **Only an `ACTIVE` order means joined.** A paid plan arrives as a draft order;
|
|
12
|
+
treating it as joined gives content away for free.
|
|
13
|
+
- **Money moves only through the cashier rail.** No path accepts card data.
|
|
14
|
+
- A visitor who taps Join sees "sign in first", not a raw error; the plan the
|
|
15
|
+
member already holds shows a label instead of a Join button.
|
|
16
|
+
|
|
17
|
+
## 1. The worker
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
// tier5-src/plans/index.ts
|
|
21
|
+
import { createCheckoutService } from "@wix/himalaya/screens";
|
|
22
|
+
|
|
23
|
+
// returnTo must use the app's `navigation.scheme` from config.ts (normally
|
|
24
|
+
// `himalaya-<app>`), e.g. himalaya-members-library://screen/library.
|
|
25
|
+
const svc = createCheckoutService({ returnTo: "himalaya-<app>://screen/library" });
|
|
26
|
+
|
|
27
|
+
export default svc;
|
|
28
|
+
export { svc };
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Options: `service` (default `plans`, must match the screen), `copy`, `returnTo`
|
|
32
|
+
(deep link the cashier returns to; it **must** use the app's configured
|
|
33
|
+
`navigation.scheme`, normally `himalaya-<app>`, or the deep-link router will not
|
|
34
|
+
route the member back into the app), `featuredPlanId` (gets the badge),
|
|
35
|
+
`showJoined` (default `true`).
|
|
36
|
+
|
|
37
|
+
## 2. The screen
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { checkoutScreen } from "@wix/himalaya/screens";
|
|
41
|
+
|
|
42
|
+
const plans = () =>
|
|
43
|
+
checkoutScreen({
|
|
44
|
+
bundleUrl: `http://localhost:8190/v1/bundles/plans`,
|
|
45
|
+
service: "plans",
|
|
46
|
+
title: "Membership",
|
|
47
|
+
signInScreenId: "signin", // where "Sign in to continue" goes — see recipe-auth
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The app's `config.ts` must declare the capabilities the screen uses (the
|
|
52
|
+
screen emits declarations for them), plus the consumer auth provider from
|
|
53
|
+
`himi docs recipe-auth`:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
capabilities: ["wix_api", "wix_cashier", "open_url", "iap", "app_info"],
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
See `himi docs capabilities` for what each one grants. A complete example:
|
|
60
|
+
`members-library/config.ts`, `members-library/dev/index.ts` +
|
|
61
|
+
`members-library/tier5-src/plans/`.
|
|
62
|
+
|
|
63
|
+
## 3. Gating content yourself
|
|
64
|
+
|
|
65
|
+
Import `entitlement()` / `isEntitled()` from `@wix/himalaya/checkout`. They never
|
|
66
|
+
throw and fail closed. For custom payment UI use `payOrder()` from the same
|
|
67
|
+
module (wallet rail first, then the in-app Wix cashier); a `handoff` outcome is
|
|
68
|
+
**not** success — re-check `entitlement()` afterwards.
|
|
69
|
+
|
|
70
|
+
**App Store–mapped plans do not go through `payOrder()`.** When a plan is
|
|
71
|
+
mapped to an Apple in-app purchase, sell it through `createIapCommerce` from
|
|
72
|
+
`@himalaya/iap-checkout`, configured with the Pricing Plans adapter, and keep
|
|
73
|
+
the Wix rail for unmapped plans only:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { createIapCommerce, pricingPlanOrders } from "@himalaya/iap-checkout";
|
|
77
|
+
|
|
78
|
+
// Once, at module scope — never per render or per tap.
|
|
79
|
+
const commerce = createIapCommerce({
|
|
80
|
+
adapters: [pricingPlanOrders],
|
|
81
|
+
onChange: () => void svc.pricingPublish(),
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Lifecycle, on every entry (onAppear) and BEFORE any buy:
|
|
85
|
+
// first time `await commerce.start()`, then `await commerce.reconcile()`
|
|
86
|
+
// prices: `await commerce.loadPrices(items)`
|
|
87
|
+
// Buy action: await commerce.buy({ reference });
|
|
88
|
+
// Publish: commerce.purchaseFields(reference, copy)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Never call `commerce.buy` before that start / reconcile / load-prices lifecycle has
|
|
92
|
+
run; the full worked example is in `himi docs iap-wix-checkout`.
|
|
93
|
+
|
|
94
|
+
The purchase itself is `commerce.buy({ reference })`. `purchaseFields` only
|
|
95
|
+
supplies the display and disabled fields (label, enabled, note, `accessReady`)
|
|
96
|
+
for the Buy button; it does not start a purchase. Never build your own purchase
|
|
97
|
+
flow for an App Store item — see `himi docs iap-pricing`.
|
|
98
|
+
|
|
99
|
+
## Gotchas
|
|
100
|
+
|
|
101
|
+
- `service` in `checkoutScreen` and `createCheckoutService` must match.
|
|
102
|
+
- Omit `signInScreenId` only when the app has no sign-in at all.
|
|
103
|
+
- Run against a real site: `himi test` crawls canned fixtures and cannot catch
|
|
104
|
+
endpoint-scope or draft-order bugs.
|
|
105
|
+
|
|
106
|
+
## See also
|
|
107
|
+
|
|
108
|
+
`himi docs recipe-auth`, `himi docs wix-api-usage`.
|
|
@@ -29336,7 +29336,7 @@
|
|
|
29336
29336
|
"name": "WixPlanOrderPricing",
|
|
29337
29337
|
"kind": "interface",
|
|
29338
29338
|
"jsdoc": "",
|
|
29339
|
-
"decl": "export interface WixPlanOrderPricing {
|
|
29339
|
+
"decl": "export interface WixPlanOrderPricing {\n subtotal?: string; discount?: string; total?: string; currency?: string;\n /** Plan price captured at purchase (legacy priceDetails wire shape). */\n planPrice?: string;\n subscription?: WixPlanPricing[\"subscription\"];\n singlePaymentForDuration?: WixPlanPricing[\"singlePaymentForDuration\"];\n singlePaymentUnlimited?: boolean;\n prices?: Array<{ duration?: { cycleFrom?: number; numberOfCycles?: number }; price?: { total?: string; currency?: string; formattedTotal?: string } }>;\n}",
|
|
29340
29340
|
"verificationChecked": true
|
|
29341
29341
|
},
|
|
29342
29342
|
{
|
|
@@ -29350,7 +29350,7 @@
|
|
|
29350
29350
|
"name": "WixPlanOrder",
|
|
29351
29351
|
"kind": "interface",
|
|
29352
29352
|
"jsdoc": "",
|
|
29353
|
-
"decl": "export interface WixPlanOrder {\n id: string;\n planId?: string;\n planName?: string;\n planDescription?: string;\n subscriptionId?: string;\n buyer?: WixPlanOrderBuyer;\n pricing?: WixPlanOrderPricing;\n /** ACTIVE | PENDING | CANCELED | ENDED | PAUSED | DRAFT */\n status?: string;\n lastPaymentStatus?: string;\n /** ONLINE | OFFLINE | EXTERNAL */\n type?: string;\n startDate?: string;\n endDate?: string;\n /** Current billing cycle — `endedDate` is the next-payment / period-end date. */\n currentCycle?: WixPlanOrderCurrentCycle;\n /** Earliest the order can end (set while paused/cancel-at-period-end). */\n earliestEndDate?: string;\n createdDate?: string;\n}",
|
|
29353
|
+
"decl": "export interface WixPlanOrder {\n id: string;\n planId?: string;\n planName?: string;\n planDescription?: string;\n /** Plan price captured when this order was created. */\n planPrice?: string;\n subscriptionId?: string;\n buyer?: WixPlanOrderBuyer;\n pricing?: WixPlanOrderPricing;\n /** ACTIVE | PENDING | CANCELED | ENDED | PAUSED | DRAFT */\n status?: string;\n lastPaymentStatus?: string;\n /** ONLINE | OFFLINE | EXTERNAL */\n type?: string;\n startDate?: string;\n endDate?: string;\n /** Current billing cycle — `endedDate` is the next-payment / period-end date. */\n currentCycle?: WixPlanOrderCurrentCycle;\n /** Earliest the order can end (set while paused/cancel-at-period-end). */\n earliestEndDate?: string;\n createdDate?: string;\n autoRenewCanceled?: boolean;\n cancellation?: { requestedDate?: string; cause?: string; effectiveAt?: string };\n priceDetails?: WixPlanOrderPricing & WixPlanPricing;\n}",
|
|
29354
29354
|
"verificationChecked": true
|
|
29355
29355
|
},
|
|
29356
29356
|
{
|
|
@@ -29372,7 +29372,7 @@
|
|
|
29372
29372
|
"name": "ListMyPlanOrdersOptions",
|
|
29373
29373
|
"kind": "interface",
|
|
29374
29374
|
"jsdoc": "",
|
|
29375
|
-
"decl": "export interface ListMyPlanOrdersOptions {\n /** Server-side status filter. Ask for `[\"ACTIVE\"]` when the question is\n * entitlement — see why below. */\n statuses?: string[];\n /** Page size. The endpoint's MAXIMUM is 50; 100 is rejected with\n * `limit got 100, expected 50 or less`. Measured, not assumed. */\n limit?: number;\n offset?: number;\n}",
|
|
29375
|
+
"decl": "export interface ListMyPlanOrdersOptions {\n /** Server-side status filter. Ask for `[\"ACTIVE\"]` when the question is\n * entitlement — see why below. */\n statuses?: string[];\n /** Page size. The endpoint's MAXIMUM is 50; 100 is rejected with\n * `limit got 100, expected 50 or less`. Measured, not assumed. */\n limit?: number;\n offset?: number;\n fieldSet?: string;\n}",
|
|
29376
29376
|
"verificationChecked": true
|
|
29377
29377
|
},
|
|
29378
29378
|
{
|
|
@@ -29389,6 +29389,24 @@
|
|
|
29389
29389
|
"decl": "export interface WixGetPlanOrderResponse { order: WixPlanOrder; }",
|
|
29390
29390
|
"verificationChecked": true
|
|
29391
29391
|
},
|
|
29392
|
+
{
|
|
29393
|
+
"name": "getMyPlanOrder",
|
|
29394
|
+
"kind": "function",
|
|
29395
|
+
"jsdoc": "/** Read a purchased order belonging to the authenticated member. `orderId` is required.\n * Rejects for a missing order or denied access; never fall back to the owner route.\n * @scope member — requires a signed-in site member reading their own order. */",
|
|
29396
|
+
"decl": "export function getMyPlanOrder(orderId: string, readOptions?: WixCallOptions): Promise<WixGetPlanOrderResponse>;",
|
|
29397
|
+
"http": "GET /pricing-plans/v2/member/orders/{…}",
|
|
29398
|
+
"scope": "member",
|
|
29399
|
+
"verificationChecked": true
|
|
29400
|
+
},
|
|
29401
|
+
{
|
|
29402
|
+
"name": "requestCancellation",
|
|
29403
|
+
"kind": "function",
|
|
29404
|
+
"jsdoc": "/** Request cancellation of the member's own purchased order. Both `orderId` and\n * `effectiveAt` are required: immediately ends access now; next payment date ends\n * access after the current paid term. The server enforces cancellation policy.\n * Resolves without a body on acceptance; re-read the order to confirm its state.\n * A rejection leaves the order unconfirmed and must not be shown as canceled.\n * @scope member — requires a signed-in site member canceling their own order. */",
|
|
29405
|
+
"decl": "export function requestCancellation(orderId: string, effectiveAt: \"IMMEDIATELY\" | \"NEXT_PAYMENT_DATE\"): Promise<void>;",
|
|
29406
|
+
"http": "POST /pricing-plans/v2/member/orders/{…}/cancel",
|
|
29407
|
+
"scope": "member",
|
|
29408
|
+
"verificationChecked": true
|
|
29409
|
+
},
|
|
29392
29410
|
{
|
|
29393
29411
|
"name": "getPlanOrder",
|
|
29394
29412
|
"kind": "function",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1657.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": [
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"artifactId": "himalaya-cli"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"falconPackageHash": "
|
|
75
|
+
"falconPackageHash": "b3f35c4996e062d22c95df2e5175eaa748d4c87fb0bd8524392b65c5"
|
|
76
76
|
}
|