@wix/himalaya-cli 0.1479.0 → 0.1481.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 (70) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +1 -1
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/state/src/index.d.ts +47 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/app-services-gate.d.ts +86 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/bindings.d.ts +22 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +10 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/index.d.ts +1 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +35 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +87 -0
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +148 -3
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +34 -4
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/state.mjs +95 -0
  13. package/dist/cli.mjs +2153 -1411
  14. package/dist/preview-assets.generated.bin +0 -0
  15. package/guides/component-reference.json +3 -26
  16. package/guides/component-reference.md +7 -9
  17. package/guides/sdk-reference.json +32 -2
  18. package/guides/tier-5-add-a-screen.md +50 -2
  19. package/package.json +2 -2
  20. package/templates/beauty-salon/dev/index.ts +29 -229
  21. package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +69 -9
  22. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +6 -1
  23. package/templates/beauty-salon/tier5-src/wix-spaces-my-subscriptions/index.ts +2 -2
  24. package/templates/beauty-salon-owner/dev/index.ts +624 -59
  25. package/templates/branded-lite/dev/index.ts +58 -364
  26. package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +69 -9
  27. package/templates/branded-lite/tier5-src/himi-events-rsvp/index.ts +5 -0
  28. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +6 -1
  29. package/templates/branded-lite/tier5-src/wix-spaces-my-subscriptions/index.ts +2 -2
  30. package/templates/community-club/dev/index.ts +26 -134
  31. package/templates/community-club/tier5-src/himi-events-rsvp/index.ts +5 -0
  32. package/templates/community-club/tier5-src/himi-store-account/index.ts +6 -1
  33. package/templates/community-club-owner/dev/index.ts +599 -57
  34. package/templates/events-meetups/dev/index.ts +26 -134
  35. package/templates/events-meetups/tier5-src/himi-events-rsvp/index.ts +5 -0
  36. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +6 -1
  37. package/templates/events-meetups-owner/dev/index.ts +543 -52
  38. package/templates/gym-fitness/dev/index.ts +55 -363
  39. package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +69 -9
  40. package/templates/gym-fitness/tier5-src/himi-events-rsvp/index.ts +5 -0
  41. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +6 -1
  42. package/templates/gym-fitness/tier5-src/wix-spaces-my-subscriptions/index.ts +2 -2
  43. package/templates/gym-fitness-owner/dev/index.ts +649 -61
  44. package/templates/nonprofit-cause/dev/index.ts +29 -136
  45. package/templates/nonprofit-cause/tier5-src/himi-events-rsvp/index.ts +5 -0
  46. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +6 -1
  47. package/templates/nonprofit-cause/tier5-src/wix-spaces-my-subscriptions/index.ts +2 -2
  48. package/templates/nonprofit-cause-owner/dev/index.ts +593 -56
  49. package/templates/owner-lite/dev/index.ts +698 -67
  50. package/templates/podcast-creator/dev/index.ts +29 -136
  51. package/templates/podcast-creator/tier5-src/himi-events-rsvp/index.ts +5 -0
  52. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +6 -1
  53. package/templates/podcast-creator/tier5-src/wix-spaces-my-subscriptions/index.ts +2 -2
  54. package/templates/podcast-creator-owner/dev/index.ts +599 -57
  55. package/templates/portfolio-creative/dev/index.ts +26 -134
  56. package/templates/portfolio-creative/tier5-src/himi-events-rsvp/index.ts +5 -0
  57. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +6 -1
  58. package/templates/portfolio-creative-owner/dev/index.ts +624 -59
  59. package/templates/restaurant/dev/index.ts +26 -134
  60. package/templates/restaurant/tier5-src/himi-events-rsvp/index.ts +5 -0
  61. package/templates/restaurant/tier5-src/himi-store-account/index.ts +6 -1
  62. package/templates/restaurant-owner/dev/index.ts +649 -61
  63. package/templates/retail-store/tier5-src/himi-store-account/index.ts +6 -1
  64. package/templates/retail-store-owner/dev/index.ts +574 -55
  65. package/templates/yoga-studio/dev/index.ts +55 -363
  66. package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +69 -9
  67. package/templates/yoga-studio/tier5-src/himi-events-rsvp/index.ts +5 -0
  68. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +6 -1
  69. package/templates/yoga-studio/tier5-src/wix-spaces-my-subscriptions/index.ts +2 -2
  70. package/templates/yoga-studio-owner/dev/index.ts +593 -56
@@ -6951,8 +6951,9 @@ var WIDGET_COMPONENTS = new Set(Object.keys(WIDGET_VOCABULARY));
6951
6951
 
6952
6952
  // ../../core/ts/src/bindings.ts
6953
6953
  var BINDING_SIGILS = ["service", "flag", "item", "t"];
6954
+ var COLON_SIGILS = /* @__PURE__ */ new Set(["t"]);
6954
6955
  var BINDING_SIGIL_RE = new RegExp(
6955
- `^\\$(?:${BINDING_SIGILS.filter((s) => s !== "t").join("|")})\\b|^\\$t:`
6956
+ `^\\$(?:${BINDING_SIGILS.filter((s) => !COLON_SIGILS.has(s)).join("|")})\\b|^\\$(?:${[...COLON_SIGILS].join("|")}):`
6956
6957
  );
6957
6958
 
6958
6959
  // ../../core/ts/src/validator.ts
@@ -6995,6 +6996,16 @@ var screenDescriptorSchema = {
6995
6996
  jumpLabel: { type: "string" }
6996
6997
  }
6997
6998
  },
6999
+ // RFC 0010 "Native search in an embed host" companion: the page's title for a host that shows it in its own bar.
7000
+ hostTitle: {
7001
+ type: "object",
7002
+ additionalProperties: false,
7003
+ properties: {
7004
+ title: { type: "string" },
7005
+ subtitle: { type: "string" },
7006
+ replaces: { type: "string" }
7007
+ }
7008
+ },
6998
7009
  url: { type: "string", format: "uri" },
6999
7010
  capabilitiesRequired: {
7000
7011
  type: "array",
@@ -7200,8 +7211,9 @@ var screenDescriptorSchema = {
7200
7211
  leading: { type: "string" },
7201
7212
  style: { type: "string" },
7202
7213
  // RFC 0066 §1 (fields 4–8) + the "top-bar gap items" amendment (#4414, fields
7203
- // 10–14). Discriminators stay free strings (invariant 6). Field 9 (`searchable`)
7204
- // arrives with the RFC 0010 search implementation.
7214
+ // 10–14). Discriminators stay free strings (invariant 6). Field 9 is the RFC 0010
7215
+ // native search.
7216
+ searchable: { $ref: "#/$defs/searchableConfig" },
7205
7217
  items: { type: "array", items: { $ref: "#/$defs/toolbarItem" } },
7206
7218
  titleDisplay: { type: "string" },
7207
7219
  subtitle: { type: "string" },
@@ -7214,6 +7226,22 @@ var screenDescriptorSchema = {
7214
7226
  dirtyPath: { type: "string" }
7215
7227
  }
7216
7228
  },
7229
+ // RFC 0010 "Native top-bar search" (SearchableConfig fields 1–5, 12–15). `placement` stays a free string.
7230
+ searchableConfig: {
7231
+ type: "object",
7232
+ additionalProperties: false,
7233
+ properties: {
7234
+ placeholder: { type: "string" },
7235
+ valuePath: { type: "string" },
7236
+ onChange: { $ref: "#/$defs/action" },
7237
+ onSubmit: { $ref: "#/$defs/action" },
7238
+ debounceMs: { type: "integer" },
7239
+ placement: { type: "string" },
7240
+ focusPath: { type: "string" },
7241
+ onCancel: { $ref: "#/$defs/action" },
7242
+ loadingPath: { type: "string" }
7243
+ }
7244
+ },
7217
7245
  toolbarItem: {
7218
7246
  type: "object",
7219
7247
  additionalProperties: false,
@@ -9285,7 +9313,9 @@ function deriveAppMeta(name, m, platforms = {}, provisioning = {}) {
9285
9313
  orientation: config.navigation?.orientation,
9286
9314
  cache: config.cache,
9287
9315
  sidebar: config.navigation?.sidebar,
9288
- navLogicBundle: config.navigation?.navLogicBundle,
9316
+ // RFC 0074 §3 — `app.logicBundle` (canonical) or the `navigation.navLogicBundle` alias; both
9317
+ // bake into the same wire field (15). defineApp rejects declaring both.
9318
+ navLogicBundle: config.app?.logicBundle ?? config.navigation?.navLogicBundle,
9289
9319
  appIconBadgeSources: config.navigation?.appIconBadgeSources,
9290
9320
  site: config.navigation?.site,
9291
9321
  streamPolicy: config.navigation?.streamPolicy,
@@ -233,9 +233,104 @@ function defineService(name, def) {
233
233
  }
234
234
  return himalaya.defineService(name, def);
235
235
  }
236
+ var APP_SERVICE_CODES = /* @__PURE__ */ new Set([
237
+ "not_booted",
238
+ "unavailable",
239
+ "no_service",
240
+ "no_action",
241
+ "not_exported",
242
+ "undeclared"
243
+ ]);
244
+ function appServiceError(code, message) {
245
+ const err = new Error(message);
246
+ err.name = "AppServiceError";
247
+ err.code = code;
248
+ return err;
249
+ }
250
+ function isAppServiceError(err) {
251
+ return err instanceof Error && err.name === "AppServiceError" && APP_SERVICE_CODES.has(err.code);
252
+ }
253
+ function appBridge(name) {
254
+ const fn = globalThis[name];
255
+ return typeof fn === "function" ? fn : void 0;
256
+ }
257
+ function appFailure(what, code, message) {
258
+ const known = typeof code === "string" && APP_SERVICE_CODES.has(code);
259
+ const detail = typeof message === "string" && message ? `: ${message}` : "";
260
+ return appServiceError(
261
+ known ? code : "unavailable",
262
+ known ? `@himalaya/state: ${what} failed (${code})${detail}` : `@himalaya/state: ${what} failed (unrecognised reason ${JSON.stringify(code)})${detail}`
263
+ );
264
+ }
265
+ async function callAppBridge(name, what, args) {
266
+ const bridge = appBridge(name);
267
+ if (!bridge) {
268
+ throw appServiceError("unavailable", `@himalaya/state: ${what} needs a runtime with app services; this one has no ${name} bridge`);
269
+ }
270
+ let raw;
271
+ try {
272
+ raw = await bridge(...args);
273
+ } catch (err) {
274
+ const e = err;
275
+ throw appFailure(what, e?.code, e?.message ?? String(err));
276
+ }
277
+ let envelope = raw;
278
+ if (typeof raw === "string") {
279
+ try {
280
+ envelope = JSON.parse(raw);
281
+ } catch {
282
+ throw appFailure(what, void 0, "the bridge answered with text that is not an envelope");
283
+ }
284
+ }
285
+ const env = envelope;
286
+ if (!env || typeof env !== "object" || typeof env.ok !== "boolean") {
287
+ throw appFailure(what, void 0, "the bridge answered without an { ok } envelope");
288
+ }
289
+ if (env.ok === false) throw appFailure(what, env.code, env.message);
290
+ return env.value;
291
+ }
292
+ function checkAppTarget(kind, target) {
293
+ if (typeof target !== "string" || !/^[A-Za-z0-9_-]+\.[^\s]+$/.test(target)) {
294
+ throw appServiceError(
295
+ kind === "path" ? "no_service" : "no_action",
296
+ `@himalaya/state: app.${kind === "path" ? "read" : "dispatch"} wants "<service>.<${kind}>" (e.g. "jobs.${kind === "path" ? "active" : "start"}"), got ${JSON.stringify(target)}`
297
+ );
298
+ }
299
+ return target;
300
+ }
301
+ var app = {
302
+ /**
303
+ * A read-only, point-in-time JSON copy of an exported app-service path (`"jobs.active"`).
304
+ * Resolves `undefined` only for an exported path that is unset; rejects with an
305
+ * {@link AppServiceError} when it cannot answer.
306
+ */
307
+ read(path) {
308
+ return Promise.resolve().then(() => checkAppTarget("path", path)).then((p) => callAppBridge("__himalaya_app_read", `app.read("${p}")`, [p]));
309
+ },
310
+ /**
311
+ * Run an exported app-service action (`"jobs.start"`) and resolve with its result payload
312
+ * (never its state). Rejects with an {@link AppServiceError} when the call cannot run, so
313
+ * "it started" can never be confused with "nothing ran".
314
+ */
315
+ dispatch(action, args) {
316
+ let argsJson;
317
+ let why = "";
318
+ try {
319
+ argsJson = args === void 0 ? "" : JSON.stringify(args);
320
+ } catch (err) {
321
+ why = `: ${String(err?.message ?? err)}`;
322
+ }
323
+ if (typeof argsJson !== "string") {
324
+ return Promise.reject(appServiceError("no_action", `@himalaya/state: app.dispatch("${String(action)}") args are not JSON-serializable${why}`));
325
+ }
326
+ return Promise.resolve().then(() => checkAppTarget("action", action)).then((a) => callAppBridge("__himalaya_app_dispatch", `app.dispatch("${a}")`, [a, argsJson]));
327
+ }
328
+ };
236
329
  export {
330
+ app,
237
331
  defineService,
238
332
  encodeSubtree,
333
+ isAppServiceError,
239
334
  isValid as isValidValue,
240
335
  navigate,
241
336
  validate,