@wix/himalaya-cli 0.1320.0 → 0.1322.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/core/dev-server/src/app-config.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/biometrics/src/index.d.ts +11 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/host-session.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts +13 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/mapping-source.d.ts +8 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments.d.ts +5 -4
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview/src/index.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/index.d.ts +16 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/tokens.d.ts +9 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-core.d.ts +3 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-source.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-contract.d.ts +83 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-core.d.ts +36 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce.d.ts +8 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/purchase-fields.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-v1/src/display.d.ts +21 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +1205 -71
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +125 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview-page.mjs +78 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview.mjs +16 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores.mjs +13 -4
- package/dist/cli.mjs +87 -23
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/getting-started.md +4 -2
- package/guides/himi-skill.md +4 -2
- package/guides/iap-pricing.md +33 -26
- package/guides/index.json +2 -1
- package/guides/sdk-reference.json +50 -8
- package/guides/tokens.md +22 -1
- package/guides/web-page-native-sdk.md +154 -33
- package/guides/webview-page-sdk.md +11 -0
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +492 -0
- package/templates/beauty-salon/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
- package/templates/branded-lite/dev/index.ts +533 -0
- package/templates/branded-lite/tier5-src/_shared/iap-worker.ts +21 -44
- package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +77 -47
- package/templates/branded-lite/tier5-src/himi-branded-lite-programs/index.ts +24 -38
- package/templates/branded-lite/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
- package/templates/gym-fitness/dev/index.ts +492 -0
- package/templates/gym-fitness/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
- package/templates/portfolio-creative/dev/index.ts +492 -0
- package/templates/portfolio-creative/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
- package/templates/retail-store/dev/index.ts +492 -0
- package/templates/retail-store/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
- package/templates/yoga-studio/dev/index.ts +41 -0
- package/templates/yoga-studio/tier5-src/_shared/iap-worker.ts +21 -44
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +77 -47
- package/templates/yoga-studio/tier5-src/himi-branded-lite-programs/index.ts +24 -38
|
@@ -7,16 +7,17 @@
|
|
|
7
7
|
// screen; enrolling stays a hosted-site flow.
|
|
8
8
|
// Four-state (loading / error / rows / empty) like the sibling branded workers.
|
|
9
9
|
//
|
|
10
|
-
// App Store prices come from the shared IAP catalog layer (@himalaya/iap).
|
|
11
|
-
//
|
|
10
|
+
// App Store prices come from the shared IAP catalog layer (@himalaya/iap). An app that sells nothing
|
|
11
|
+
// through the App Store reads every program as `disabled` and shows no price line.
|
|
12
12
|
import { defineService as register } from "@himalaya/state";
|
|
13
13
|
import { decorateCollection } from "../_shared/collection-service.js";
|
|
14
14
|
import { queryPrograms, type WixProgram } from "@himalaya/wix-online-programs";
|
|
15
|
-
import {
|
|
15
|
+
import { iapPriceFields, onlineProgramItem, type IapPollDirective } from "@himalaya/iap";
|
|
16
|
+
import { createIapCommerce } from "@himalaya/iap-checkout";
|
|
16
17
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
17
18
|
import { cleanTitle, initials } from "../_shared/himi-text.js";
|
|
18
19
|
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
19
|
-
import {
|
|
20
|
+
import { iapPriceCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
|
|
20
21
|
|
|
21
22
|
const SERVICE = "himiBrandedPrograms";
|
|
22
23
|
|
|
@@ -133,10 +134,6 @@ function programFields(p: WixProgram): Omit<ProgramRow, "priceLine"> {
|
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
function programRow(p: WixProgram): ProgramRow {
|
|
137
|
-
return { ...programFields(p), priceLine: "" };
|
|
138
|
-
}
|
|
139
|
-
|
|
140
137
|
function programContent(p: WixProgram): ProgramContent {
|
|
141
138
|
return { ...programFields(p), wixId: p.id ?? "" };
|
|
142
139
|
}
|
|
@@ -177,28 +174,22 @@ async function fetchPrograms(): Promise<WixProgram[]> {
|
|
|
177
174
|
return (response.programs ?? []).filter((p) => !isDraft(p));
|
|
178
175
|
}
|
|
179
176
|
|
|
180
|
-
|
|
181
|
-
stashCopy(arg);
|
|
182
|
-
try {
|
|
183
|
-
return ready((await fetchPrograms()).map(programRow));
|
|
184
|
-
} catch {
|
|
185
|
-
return errored(state);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// ── App Store pricing (enabled only when a mapping backend is connected) ─────
|
|
177
|
+
// ── Content and App Store prices ─────
|
|
190
178
|
//
|
|
191
|
-
// One writer: `
|
|
179
|
+
// One writer: `load` keeps its content here and every state change goes through the
|
|
192
180
|
// synchronous `pricingPublish`, which re-reads the latest content and prices. An async action
|
|
193
181
|
// that returned its own state could land after a newer publication and repaint stale prices.
|
|
194
182
|
|
|
195
|
-
|
|
183
|
+
// Prices only: the list sells nothing (each card opens the program, whose screen owns the sale),
|
|
184
|
+
// so its composition has no adapters and never starts a checkout.
|
|
185
|
+
const commerce = createIapCommerce({ onChange: () => { void svc.pricingPublish(); } });
|
|
186
|
+
const pricing = commerce.pricing;
|
|
196
187
|
const PRICING_NOT_HYDRATED = ["rows", "collection", "hidePriceRetry"] as const;
|
|
197
188
|
let content: { status: State["status"]; programs: ProgramContent[] } = { status: "loading", programs: [] };
|
|
198
189
|
let scopeIncomplete = false;
|
|
199
190
|
let loadSeq = 0;
|
|
200
191
|
|
|
201
|
-
async function
|
|
192
|
+
async function load(_state: State, arg?: unknown): Promise<undefined> {
|
|
202
193
|
stashCopy(arg);
|
|
203
194
|
const seq = ++loadSeq;
|
|
204
195
|
const programs = await fetchPrograms().catch(() => undefined);
|
|
@@ -212,12 +203,10 @@ async function loadPriced(_state: State, arg?: unknown): Promise<undefined> {
|
|
|
212
203
|
/** Prices the programs on screen now. Content never waits on this, and the host scope is re-read
|
|
213
204
|
* each time, so a failed app-info read recovers on the next refresh. */
|
|
214
205
|
async function priceContent(): Promise<void> {
|
|
215
|
-
// The Retry action is declared in both modes; with no backend it must not reach the host.
|
|
216
|
-
if (!pricing.enabled) return;
|
|
217
|
-
const host = await hostIapScope();
|
|
218
|
-
scopeIncomplete = !hostScopeComplete(host);
|
|
219
206
|
if (content.status !== "ready") return;
|
|
220
|
-
|
|
207
|
+
const items = content.programs.flatMap((program) => onlineProgramItem({ id: program.wixId }) ?? []);
|
|
208
|
+
scopeIncomplete = !(await commerce.loadPrices(items)).scopeComplete;
|
|
209
|
+
void svc.pricingPublish();
|
|
221
210
|
}
|
|
222
211
|
|
|
223
212
|
function pricedState(state: State): State {
|
|
@@ -232,7 +221,8 @@ function pricedState(state: State): State {
|
|
|
232
221
|
return {
|
|
233
222
|
...state, ...shown, programs: content.programs,
|
|
234
223
|
// Retry re-prices the programs on screen, which only a ready list has.
|
|
235
|
-
|
|
224
|
+
// `disabled`: this app sells nothing through the App Store, so there is no price lookup to retry.
|
|
225
|
+
hidePriceRetry: content.status !== "ready" || !views.some((view) => view && view.route !== "disabled" && (scopeIncomplete || view.retryable)),
|
|
236
226
|
priceRetryText: copyParam("programs.priceRetryText", "Some prices could not be loaded."),
|
|
237
227
|
};
|
|
238
228
|
}
|
|
@@ -260,7 +250,7 @@ type Actions = {
|
|
|
260
250
|
};
|
|
261
251
|
|
|
262
252
|
const actions: Actions = {
|
|
263
|
-
load
|
|
253
|
+
load,
|
|
264
254
|
pricingPublish: pricedState,
|
|
265
255
|
pricingStart: (state) => ({ ...pricedState(state), _poll: pricing.pollDirective(`${SERVICE}.pricingRefresh`) }),
|
|
266
256
|
pricingRefresh: async () => { await priceContent(); return undefined; },
|
|
@@ -269,18 +259,14 @@ const actions: Actions = {
|
|
|
269
259
|
// The collection decorator's own `defineService` drops `notHydrated`, so the decorated definition
|
|
270
260
|
// is registered directly: this run's prices must never be restored from a cold-boot snapshot.
|
|
271
261
|
const decorated = decorateCollection(SERVICE, { state: INITIAL_STATE, actions } as unknown as Parameters<typeof decorateCollection>[1]);
|
|
272
|
-
const svc = register<State, Actions>(SERVICE,
|
|
273
|
-
? { ...decorated, notHydrated: [...PRICING_NOT_HYDRATED] }
|
|
274
|
-
: decorated) as unknown as Parameters<typeof register<State, Actions>>[1]);
|
|
262
|
+
const svc = register<State, Actions>(SERVICE, { ...decorated, notHydrated: [...PRICING_NOT_HYDRATED] } as unknown as Parameters<typeof register<State, Actions>>[1]);
|
|
275
263
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
content = { status: booted.status, programs: booted.programs };
|
|
280
|
-
}
|
|
281
|
-
resetUnhydratedKeysOnOlderRuntime(svc, decorated.state as unknown as State, PRICING_NOT_HYDRATED);
|
|
282
|
-
void svc.pricingStart();
|
|
264
|
+
const booted = svc.getState();
|
|
265
|
+
if ((booted.status === "ready" || booted.status === "error") && Array.isArray(booted.programs)) {
|
|
266
|
+
content = { status: booted.status, programs: booted.programs };
|
|
283
267
|
}
|
|
268
|
+
resetUnhydratedKeysOnOlderRuntime(svc, decorated.state as unknown as State, PRICING_NOT_HYDRATED);
|
|
269
|
+
void svc.pricingStart();
|
|
284
270
|
|
|
285
271
|
// Kick the first load at module scope, like every other list bundle
|
|
286
272
|
// (himi-store-shop, himi-booking-services, himi-events-list, himi-blog-feed …).
|