@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.
Files changed (64) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +1 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/biometrics/src/index.d.ts +11 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/catalog-pricing-contract.d.ts +4 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/host-session.d.ts +4 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/index.d.ts +13 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/mapping-source.d.ts +8 -3
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/iap/src/wix-payments.d.ts +5 -4
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/sdk-types/src/capabilities.generated.d.ts +1 -1
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview/src/index.d.ts +4 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/webview-page/src/index.d.ts +16 -1
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/tokens.d.ts +9 -1
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +5 -0
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-core.d.ts +3 -1
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/checkout-source.d.ts +4 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-contract.d.ts +83 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-core.d.ts +36 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce.d.ts +8 -0
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/index.d.ts +3 -0
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/purchase-fields.d.ts +4 -0
  21. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/stores-v1/src/display.d.ts +21 -0
  22. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/audio-record.mjs +1 -1
  23. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calendar.mjs +1 -1
  24. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/calls.mjs +1 -1
  25. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/contacts.mjs +1 -1
  26. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +1205 -71
  27. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap.mjs +125 -13
  28. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/location.mjs +1 -1
  29. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -1
  30. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/photos.mjs +1 -1
  31. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdk-types.mjs +1 -1
  32. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
  33. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/tasks.mjs +1 -1
  34. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview-page.mjs +78 -0
  35. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/webview.mjs +16 -0
  36. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores.mjs +13 -4
  37. package/dist/cli.mjs +87 -23
  38. package/dist/preview-assets.generated.bin +0 -0
  39. package/guides/getting-started.md +4 -2
  40. package/guides/himi-skill.md +4 -2
  41. package/guides/iap-pricing.md +33 -26
  42. package/guides/index.json +2 -1
  43. package/guides/sdk-reference.json +50 -8
  44. package/guides/tokens.md +22 -1
  45. package/guides/web-page-native-sdk.md +154 -33
  46. package/guides/webview-page-sdk.md +11 -0
  47. package/package.json +2 -2
  48. package/templates/beauty-salon/dev/index.ts +492 -0
  49. package/templates/beauty-salon/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  50. package/templates/branded-lite/dev/index.ts +533 -0
  51. package/templates/branded-lite/tier5-src/_shared/iap-worker.ts +21 -44
  52. package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +77 -47
  53. package/templates/branded-lite/tier5-src/himi-branded-lite-programs/index.ts +24 -38
  54. package/templates/branded-lite/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  55. package/templates/gym-fitness/dev/index.ts +492 -0
  56. package/templates/gym-fitness/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  57. package/templates/portfolio-creative/dev/index.ts +492 -0
  58. package/templates/portfolio-creative/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  59. package/templates/retail-store/dev/index.ts +492 -0
  60. package/templates/retail-store/tier5-src/wix-spaces-collection-detail/index.ts +146 -30
  61. package/templates/yoga-studio/dev/index.ts +41 -0
  62. package/templates/yoga-studio/tier5-src/_shared/iap-worker.ts +21 -44
  63. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +77 -47
  64. 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). Until a mapping backend
11
- // is connected it is disabled, and this worker runs exactly its pre-pricing path.
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 { createIapCatalogPricing, iapPriceFields, onlineProgramItem, type IapPollDirective } from "@himalaya/iap";
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 { hostIapScope, hostScopeComplete, iapPriceCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
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
- async function load(state: State, arg?: unknown): Promise<State> {
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: `loadPriced` keeps its content here and every state change goes through the
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
- const pricing = createIapCatalogPricing({ onChange: () => { void svc.pricingPublish(); } });
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 loadPriced(_state: State, arg?: unknown): Promise<undefined> {
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
- await pricing.load({ ...host, items: content.programs.flatMap((program) => onlineProgramItem({ id: program.wixId }) ?? []) });
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
- hidePriceRetry: content.status !== "ready" || !views.some((view) => view && (scopeIncomplete || view.retryable)),
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: pricing.enabled ? loadPriced : 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, (pricing.enabled
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
- if (pricing.enabled) {
277
- const booted = svc.getState();
278
- if ((booted.status === "ready" || booted.status === "error") && Array.isArray(booted.programs)) {
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 …).