@wix/himalaya-cli 0.1572.0 → 0.1574.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 (103) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +2 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/message-format.d.ts +59 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/checkout/src/index.d.ts +4 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/apple-iap-contract.d.ts +1 -1
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/iap-checkout/src/commerce-contract.d.ts +2 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +1 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/one-app-page.d.ts +61 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/social-feed/src/index.d.ts +34 -9
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/checkout.mjs +28 -3
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +3 -3
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/iap-checkout.mjs +2 -1
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +8 -3
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +573 -73
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +3 -3
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-social-feed.mjs +24 -1
  16. package/dist/cli.mjs +2708 -1182
  17. package/dist/preview-assets.generated.bin +0 -0
  18. package/guides/himi-json-output.md +41 -2
  19. package/guides/himi-mcp.md +1 -1
  20. package/guides/himi-test.md +3 -2
  21. package/guides/iap-products.md +1 -1
  22. package/guides/importing-oneapp-translations.md +115 -0
  23. package/guides/index.json +6 -0
  24. package/guides/one-app-section-mappings.md +16 -4
  25. package/guides/one-app-to-himi-app.md +221 -10
  26. package/guides/qa-builds.md +21 -1
  27. package/guides/sdk-reference.json +28 -4
  28. package/guides/templates.md +3 -2
  29. package/guides/testing-himi-apps.md +1 -1
  30. package/guides/webview-page-sdk.md +68 -3
  31. package/package.json +3 -3
  32. package/templates/beauty-salon/dev/index.ts +22 -6
  33. package/templates/beauty-salon/tier5-src/_shared/iap-worker.ts +2 -0
  34. package/templates/beauty-salon/tier5-src/_shared/payment-setup.ts +6 -0
  35. package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +5 -2
  36. package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  37. package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  38. package/templates/beauty-salon-owner/dev/index.ts +22 -6
  39. package/templates/branded-lite/dev/index.ts +22 -6
  40. package/templates/branded-lite/tier5-src/_shared/iap-worker.ts +2 -0
  41. package/templates/branded-lite/tier5-src/_shared/payment-setup.ts +6 -0
  42. package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +5 -2
  43. package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  44. package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  45. package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +5 -2
  46. package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +9 -4
  47. package/templates/community-club/dev/index.ts +22 -6
  48. package/templates/community-club/tier5-src/_shared/iap-worker.ts +2 -0
  49. package/templates/community-club/tier5-src/_shared/payment-setup.ts +6 -0
  50. package/templates/community-club/tier5-src/himi-events-detail/index.ts +9 -4
  51. package/templates/community-club-owner/dev/index.ts +22 -6
  52. package/templates/events-meetups/dev/index.ts +22 -6
  53. package/templates/events-meetups/tier5-src/_shared/iap-worker.ts +2 -0
  54. package/templates/events-meetups/tier5-src/_shared/payment-setup.ts +6 -0
  55. package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +9 -4
  56. package/templates/events-meetups-owner/dev/index.ts +22 -6
  57. package/templates/gym-fitness/dev/index.ts +22 -6
  58. package/templates/gym-fitness/tier5-src/_shared/iap-worker.ts +2 -0
  59. package/templates/gym-fitness/tier5-src/_shared/payment-setup.ts +6 -0
  60. package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +5 -2
  61. package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  62. package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  63. package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +9 -4
  64. package/templates/gym-fitness-owner/dev/index.ts +22 -6
  65. package/templates/himi-chat/dev/index.ts +22 -6
  66. package/templates/nonprofit-cause/dev/index.ts +22 -6
  67. package/templates/nonprofit-cause/tier5-src/_shared/iap-worker.ts +2 -0
  68. package/templates/nonprofit-cause/tier5-src/_shared/payment-setup.ts +6 -0
  69. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  70. package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +9 -4
  71. package/templates/nonprofit-cause-owner/dev/index.ts +22 -6
  72. package/templates/owner-lite/dev/index.ts +22 -6
  73. package/templates/podcast-creator/dev/index.ts +22 -6
  74. package/templates/podcast-creator/tier5-src/_shared/iap-worker.ts +2 -0
  75. package/templates/podcast-creator/tier5-src/_shared/payment-setup.ts +6 -0
  76. package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  77. package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +9 -4
  78. package/templates/podcast-creator-owner/dev/index.ts +22 -6
  79. package/templates/portfolio-creative/dev/index.ts +22 -6
  80. package/templates/portfolio-creative/tier5-src/_shared/iap-worker.ts +2 -0
  81. package/templates/portfolio-creative/tier5-src/_shared/payment-setup.ts +6 -0
  82. package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  83. package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +9 -4
  84. package/templates/portfolio-creative-owner/dev/index.ts +22 -6
  85. package/templates/restaurant/dev/index.ts +22 -6
  86. package/templates/restaurant/tier5-src/_shared/iap-worker.ts +2 -0
  87. package/templates/restaurant/tier5-src/_shared/payment-setup.ts +6 -0
  88. package/templates/restaurant/tier5-src/himi-events-detail/index.ts +9 -4
  89. package/templates/restaurant-owner/dev/index.ts +22 -6
  90. package/templates/retail-store/dev/index.ts +22 -6
  91. package/templates/retail-store/tier5-src/_shared/iap-worker.ts +2 -0
  92. package/templates/retail-store/tier5-src/_shared/payment-setup.ts +6 -0
  93. package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +5 -2
  94. package/templates/retail-store-owner/dev/index.ts +22 -6
  95. package/templates/surface-showcase/dev/index.ts +22 -6
  96. package/templates/yoga-studio/dev/index.ts +22 -6
  97. package/templates/yoga-studio/tier5-src/_shared/iap-worker.ts +2 -0
  98. package/templates/yoga-studio/tier5-src/_shared/payment-setup.ts +6 -0
  99. package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +5 -2
  100. package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +5 -2
  101. package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +5 -2
  102. package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +9 -4
  103. package/templates/yoga-studio-owner/dev/index.ts +22 -6
@@ -324,6 +324,477 @@ function createBusinessContactService(opts = {}) {
324
324
  return svc;
325
325
  }
326
326
 
327
+ // ../../stdlib/wix-sdk/media/src/index.ts
328
+ var WIX_LIST_IMAGE = { width: 1e3, height: 1e3, quality: 85 };
329
+ var WIX_DETAIL_IMAGE = { width: 1400, height: 1400, quality: 85 };
330
+ var WIX_MEDIA = /^https?:\/\/static\.wixstatic\.com\/media\/[^/]/;
331
+ var WIX_IMAGE = /^wix:image:\/\/v1\/([^/]+)/i;
332
+ var WIX_TRANSFORM = /^(https?:\/\/static\.wixstatic\.com\/media\/[^/]+\/v1\/)([^/]+)\/([^/?#]+)(?:\/([^/?#]+))?([?#].*)?$/i;
333
+ var SIZING_PARAM = /^(w|h|q)_\d+$/i;
334
+ var WEB_URL = /^https?:\/\//i;
335
+ var RESIZABLE_MODES = /* @__PURE__ */ new Set(["fit", "fill"]);
336
+ var OWNED_PARAM = /^(w|h|q)_/i;
337
+ var DROPPED_PARAM = /^enc_/i;
338
+ function wixMediaId(reference) {
339
+ return WIX_IMAGE.exec(reference)?.[1] ?? (reference.includes("/") || reference.includes(":") ? "" : reference);
340
+ }
341
+ function resolveWixMediaReference(reference) {
342
+ if (/^\/?media\/[^/]/.test(reference)) return `https://static.wixstatic.com/${reference.replace(/^\//, "")}`;
343
+ const mediaId = wixMediaId(reference);
344
+ return mediaId ? `https://static.wixstatic.com/media/${mediaId}` : reference;
345
+ }
346
+ function requestedParams(size) {
347
+ return [`w_${size.width}`, `h_${size.height}`, `q_${size.quality ?? 85}`];
348
+ }
349
+ function fittedParams(size, source, mode) {
350
+ const quality = `q_${size.quality ?? 85}`;
351
+ const { width: sourceWidth, height: sourceHeight } = source;
352
+ if (sourceWidth && sourceHeight) {
353
+ if (mode.toLowerCase() === "fill") {
354
+ const scale = Math.min(size.width / sourceWidth, size.height / sourceHeight, 1);
355
+ return [
356
+ `w_${Math.max(1, Math.round(sourceWidth * scale))}`,
357
+ `h_${Math.max(1, Math.round(sourceHeight * scale))}`,
358
+ quality
359
+ ];
360
+ }
361
+ return [
362
+ `w_${Math.min(sourceWidth, size.width)}`,
363
+ `h_${Math.min(sourceHeight, size.height)}`,
364
+ quality
365
+ ];
366
+ }
367
+ if (sourceWidth) return [`w_${Math.min(sourceWidth, size.width)}`, quality];
368
+ if (sourceHeight) return [`h_${Math.min(sourceHeight, size.height)}`, quality];
369
+ return requestedParams(size);
370
+ }
371
+ function resizeWixTransform(url, size) {
372
+ const transform = WIX_TRANSFORM.exec(url);
373
+ if (!transform || !RESIZABLE_MODES.has(transform[2].toLowerCase())) return url;
374
+ const [, base, mode, rawParams, filename, suffix] = transform;
375
+ const source = rawParams.split(",").filter(Boolean);
376
+ if (!filename && !source.some((param) => SIZING_PARAM.test(param))) return url;
377
+ const dimensions = dimensionsOf(source);
378
+ if (mode.toLowerCase() === "fill" && !dimensions.width && !dimensions.height) return url;
379
+ const stated = [dimensions.width, dimensions.height].filter((d) => d !== void 0);
380
+ if (stated.length > 0 && (dimensions.width ?? 0) <= size.width && (dimensions.height ?? 0) <= size.height) return url;
381
+ const carried = source.filter((p) => !OWNED_PARAM.test(p) && !DROPPED_PARAM.test(p));
382
+ const params = [...fittedParams(size, dimensions, mode), ...carried];
383
+ return `${base}${mode}/${params.join(",")}/image.jpg${suffix ?? ""}`;
384
+ }
385
+ function wixTransformDimension(params, name) {
386
+ const match = params.find((param) => new RegExp(`^${name}_\\d+$`, "i").test(param));
387
+ return match ? Number(match.slice(2)) : void 0;
388
+ }
389
+ function dimensionsOf(params) {
390
+ return {
391
+ width: wixTransformDimension(params, "w"),
392
+ height: wixTransformDimension(params, "h")
393
+ };
394
+ }
395
+ function wixMediaUrl(value, size = WIX_LIST_IMAGE) {
396
+ const reference = typeof value === "string" ? value.trim() : "";
397
+ if (!reference) return "";
398
+ const resolvedUrl = resolveWixMediaReference(reference);
399
+ if (!WEB_URL.test(resolvedUrl)) return "";
400
+ if (size === null) return resolvedUrl;
401
+ if (!WIX_MEDIA.test(resolvedUrl)) return resolvedUrl;
402
+ const base = resolvedUrl.split(/[?#]/)[0];
403
+ if (base.includes("/v1/")) return resizeWixTransform(resolvedUrl, size);
404
+ const suffix = resolvedUrl.slice(base.length);
405
+ return `${base}/v1/fit/${requestedParams(size).join(",")}/image.jpg${suffix}`;
406
+ }
407
+
408
+ // ../../stdlib/wix-sdk/rich-content/src/display.ts
409
+ var HTTPS = /^https:\/\/[^\s/?#]\S*$/i;
410
+ var LINK = /^(https?:\/\/[^\s/?#]\S*|mailto:\S+|tel:\S+)$/i;
411
+ var HTTP_HOST = /^https?:\/\/([^\s/?#]+)/i;
412
+ var VIDEO_CARD_HOST = /^(?:(?:www\.|m\.)?youtube\.com|youtu\.be|(?:www\.|player\.)?vimeo\.com)$/;
413
+ function trimAscii(s2) {
414
+ return s2.replace(/^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g, "");
415
+ }
416
+ function normalizeMediaRef(s2) {
417
+ return s2.trim().replace(/^http:\/\/(static|video)\.wixstatic\.com\//i, (_all, sub) => `https://${sub.toLowerCase()}.wixstatic.com/`);
418
+ }
419
+ var hostOf = (url) => HTTP_HOST.exec(url)?.[1]?.toLowerCase().replace(/:\d+$/, "");
420
+ function cleanLink(url) {
421
+ if (typeof url !== "string") return void 0;
422
+ const t = trimAscii(url);
423
+ return LINK.test(t) ? t : void 0;
424
+ }
425
+ function ricosImageUrl(holder, width) {
426
+ const src = holder?.image?.src;
427
+ const fromUrl = typeof src?.url === "string" ? normalizeMediaRef(src.url) : "";
428
+ const ref = fromUrl !== "" ? fromUrl : typeof src?.id === "string" ? normalizeMediaRef(src.id) : src?.id;
429
+ const url = wixMediaUrl(ref, { width, height: width, quality: 85 });
430
+ return HTTPS.test(url) ? url : "";
431
+ }
432
+ function ricosVideoUrl(src) {
433
+ if (!src || typeof src !== "object") return "";
434
+ const { url, id: id2 } = src;
435
+ if (typeof url === "string" && url.trim() !== "") {
436
+ const link = cleanLink(url);
437
+ const linkHost = link === void 0 ? void 0 : hostOf(link);
438
+ if (link !== void 0 && linkHost !== void 0 && VIDEO_CARD_HOST.test(linkHost)) return link;
439
+ const media = normalizeMediaRef(url);
440
+ const mediaHost = hostOf(media);
441
+ return HTTPS.test(media) && !(mediaHost !== void 0 && VIDEO_CARD_HOST.test(mediaHost)) ? media : "";
442
+ }
443
+ const ref = typeof id2 === "string" ? id2.trim().replace(/^video\//, "") : "";
444
+ if (/^\w[\w~.-]*$/.test(ref)) return `https://video.wixstatic.com/video/${ref}/file`;
445
+ if (/^\w[\w~.-]*\/[\w~./-]+$/.test(ref)) return `https://video.wixstatic.com/video/${ref}`;
446
+ return "";
447
+ }
448
+
449
+ // ../../stdlib/wix-sdk/rich-content/src/index.ts
450
+ var RICH_CONTENT_LIMITS = { maxBytes: 262144, maxNodes: 5e3, maxDepth: 16 };
451
+ function richContentOverLimits(json, parsed) {
452
+ if (utf8Length(json) > RICH_CONTENT_LIMITS.maxBytes) return "too_large";
453
+ let doc = parsed;
454
+ if (doc === void 0) {
455
+ try {
456
+ doc = JSON.parse(json);
457
+ } catch {
458
+ return null;
459
+ }
460
+ }
461
+ const nodes = isObj(doc) && Array.isArray(doc.nodes) ? doc.nodes : null;
462
+ if (!nodes) return null;
463
+ if (deeperThan(nodes, 1, RICH_CONTENT_LIMITS.maxDepth)) return "too_deep";
464
+ return countNodes(nodes) > RICH_CONTENT_LIMITS.maxNodes ? "too_many_nodes" : null;
465
+ }
466
+ function deeperThan(nodes, depth, max) {
467
+ for (const n of nodes) {
468
+ if (!isObj(n)) continue;
469
+ if (depth > max) return true;
470
+ if (Array.isArray(n.nodes) && deeperThan(n.nodes, depth + 1, max)) return true;
471
+ }
472
+ return false;
473
+ }
474
+ var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
475
+ function ricosToPlainText(doc) {
476
+ const kids = (v) => Array.isArray(v) ? v.filter(isObj) : [];
477
+ const inline = (node3) => typeof node3.textData?.text === "string" ? node3.textData.text : kids(node3.nodes).map(inline).join("");
478
+ const blocks = (nodes) => nodes.flatMap((node3) => node3.type === "PARAGRAPH" || node3.type === "HEADING" || node3.type === "TEXT" ? [inline(node3)] : blocks(kids(node3.nodes)));
479
+ return blocks(kids(doc?.nodes)).join("\n\n");
480
+ }
481
+ function plainTextToRicos(text3) {
482
+ return { nodes: text3.split("\n\n").map((t) => ({ type: "PARAGRAPH", nodes: [{ type: "TEXT", textData: { text: t, decorations: [] } }] })) };
483
+ }
484
+ function encodeRichContent(doc, opts = {}) {
485
+ if (doc === null || doc === void 0) return { json: "" };
486
+ if (!isObj(doc) || !Array.isArray(doc.nodes)) return { json: "", rejected: "not_a_document" };
487
+ const w = opts.imageWidth;
488
+ const imageWidth = typeof w === "number" && Number.isInteger(w) && w > 0 ? Math.min(w, WIX_DETAIL_IMAGE.width) : WIX_DETAIL_IMAGE.width;
489
+ const ctx = {
490
+ imageWidth,
491
+ // Gallery tiles and video posters are half-width at most, so the list budget caps them.
492
+ tileWidth: Math.min(imageWidth, WIX_LIST_IMAGE.width),
493
+ // Serialized nesting allowed: each node level is a node and its `nodes` array, plus generous room for type
494
+ // data. Past it the document is rejected rather than overflowing the worker's stack.
495
+ maxJsonDepth: RICH_CONTENT_LIMITS.maxDepth * 2 + 64,
496
+ ids: /* @__PURE__ */ new Set()
497
+ };
498
+ let nodes;
499
+ let json;
500
+ try {
501
+ nodes = cleanNodes(doc.nodes, "", 1, ctx, void 0);
502
+ if (nodes.length === 0) return { json: "" };
503
+ const out = { nodes };
504
+ if (doc.documentStyle !== void 0) out.documentStyle = doc.documentStyle;
505
+ if (doc.metadata !== void 0) out.metadata = doc.metadata;
506
+ json = canonicalJson(out, 0, ctx.maxJsonDepth);
507
+ } catch (e) {
508
+ if (e === TOO_DEEP) return { json: "", rejected: "too_deep" };
509
+ throw e;
510
+ }
511
+ if (utf8Length(json) > RICH_CONTENT_LIMITS.maxBytes) return { json: "", rejected: "too_large" };
512
+ if (countNodes(nodes) > RICH_CONTENT_LIMITS.maxNodes) return { json: "", rejected: "too_many_nodes" };
513
+ return { json };
514
+ }
515
+ var TOO_DEEP = { reason: "too_deep" };
516
+ var PATH_SHAPED = /^[0-9.]+$/;
517
+ var unusableId = (id2) => PATH_SHAPED.test(id2) || id2.includes("/") || id2.includes("$");
518
+ var isWrapper = (t) => t === "COLLAPSIBLE_LIST" || t === "COLLAPSIBLE_ITEM" || t === "COLLAPSIBLE_ITEM_TITLE" || t === "COLLAPSIBLE_ITEM_BODY";
519
+ var holdsBlocks = (t) => t === void 0 || t === "BULLETED_LIST" || t === "ORDERED_LIST" || t === "LIST_ITEM" || t === "BLOCKQUOTE" || isWrapper(t);
520
+ var LINK_FIELDS = {
521
+ EMBED: [["embedData", "oembed", "url"], ["embedData", "src"]],
522
+ HTML: [["htmlData", "url"]],
523
+ APP_EMBED: [["appEmbedData", "url"]],
524
+ LINK_PREVIEW: [["linkPreviewData", "link", "url"]],
525
+ FILE: [["fileData", "src", "url"]],
526
+ AUDIO: [["audioData", "audio", "src", "url"]],
527
+ GIF: [["gifData", "original", "gif"]],
528
+ IMAGE: [["imageData", "link", "url"]]
529
+ };
530
+ function rewriteAt(v, path, fix) {
531
+ if (!isObj(v) || !(path[0] in v)) return v;
532
+ const [k, ...rest] = path;
533
+ if (rest.length > 0) return { ...v, [k]: rewriteAt(v[k], rest, fix) };
534
+ const next = fix(v[k]);
535
+ if (next === v[k]) return v;
536
+ const { [k]: _old, ...kept } = v;
537
+ return next === void 0 ? kept : { ...kept, [k]: next };
538
+ }
539
+ function getAt(v, path) {
540
+ let cur = v;
541
+ for (const k of path) cur = isObj(cur) ? cur[k] : void 0;
542
+ return cur;
543
+ }
544
+ var drop = () => void 0;
545
+ var LINK_DECORATION_URL = ["linkData", "link", "url"];
546
+ var BUTTON_URL = ["link", "url"];
547
+ function cleanNodes(nodes, base, depth, ctx, parentType) {
548
+ const out = [];
549
+ for (const raw of nodes) {
550
+ if (!isObj(raw)) continue;
551
+ if (depth > RICH_CONTENT_LIMITS.maxDepth) throw TOO_DEEP;
552
+ const path = base === "" ? String(out.length) : `${base}.${out.length}`;
553
+ const node3 = cleanNode({ ...raw }, path, depth, ctx, parentType);
554
+ if (node3) out.push(node3);
555
+ }
556
+ return out;
557
+ }
558
+ function cleanNode(node3, path, depth, ctx, parentType) {
559
+ if (node3.type === "TEXT") {
560
+ const decorations = node3.textData?.decorations;
561
+ if (Array.isArray(decorations)) {
562
+ const kept = decorations.flatMap((d) => {
563
+ if (!(isObj(d) && d.type === "LINK")) return [d];
564
+ const next = rewriteAt(d, LINK_DECORATION_URL, cleanLink);
565
+ return getAt(next, LINK_DECORATION_URL) === void 0 ? [] : [next];
566
+ });
567
+ node3.textData = { ...node3.textData, decorations: kept };
568
+ }
569
+ } else if (node3.type === "IMAGE") {
570
+ const data = isObj(node3.imageData) ? node3.imageData : {};
571
+ const url = ricosImageUrl(data, ctx.imageWidth);
572
+ if (!url) return null;
573
+ node3.imageData = { ...data, image: { ...isObj(data.image) ? data.image : {}, src: { url } } };
574
+ } else if (node3.type === "GALLERY") {
575
+ const data = isObj(node3.galleryData) ? node3.galleryData : {};
576
+ const items = (Array.isArray(data.items) ? data.items : []).flatMap((item) => {
577
+ if (!isObj(item) || !isObj(item.image)) return [];
578
+ const media = isObj(item.image.media) ? item.image.media : {};
579
+ const url = ricosImageUrl({ image: media }, ctx.tileWidth);
580
+ return url ? [{ ...item, image: { ...item.image, media: { ...media, src: { url } } } }] : [];
581
+ });
582
+ if (items.length === 0) return null;
583
+ node3.galleryData = { ...data, items };
584
+ } else if (node3.type === "VIDEO") {
585
+ const data = isObj(node3.videoData) ? { ...node3.videoData } : {};
586
+ const video = isObj(data.video) ? data.video : {};
587
+ const url = ricosVideoUrl(video.src);
588
+ if (!url) return null;
589
+ data.video = { ...video, src: { url } };
590
+ const poster = ricosImageUrl({ image: data.thumbnail }, ctx.tileWidth);
591
+ if (poster) data.thumbnail = { ...data.thumbnail, src: { url: poster } };
592
+ else delete data.thumbnail;
593
+ node3.videoData = data;
594
+ } else if (node3.type === "BUTTON" || node3.type === "LINK_BUTTON") {
595
+ node3.buttonData = rewriteAt(node3.buttonData, BUTTON_URL, cleanLink);
596
+ if (getAt(node3.buttonData, BUTTON_URL) === void 0) return null;
597
+ } else if (node3.type === "HTML") {
598
+ node3.htmlData = rewriteAt(node3.htmlData, ["html"], drop);
599
+ } else if (node3.type === "EMBED") {
600
+ node3.embedData = rewriteAt(node3.embedData, ["oembed", "html"], drop);
601
+ }
602
+ for (const [field, ...rest] of (typeof node3.type === "string" ? LINK_FIELDS[node3.type] : void 0) ?? []) {
603
+ if (field in node3) node3[field] = rewriteAt(node3[field], rest, cleanLink);
604
+ }
605
+ const inBlocks = holdsBlocks(parentType);
606
+ if (node3.type !== "TEXT" || inBlocks) {
607
+ const own = typeof node3.id === "string" ? node3.id : "";
608
+ const usable = own !== "" && !unusableId(own);
609
+ if (inBlocks && !isWrapper(node3.type)) {
610
+ if (usable && !ctx.ids.has(own)) ctx.ids.add(own);
611
+ else node3.id = path;
612
+ } else if (!usable) node3.id = path;
613
+ }
614
+ if (Array.isArray(node3.nodes)) node3.nodes = cleanNodes(node3.nodes, path, depth + 1, ctx, typeof node3.type === "string" ? node3.type : "");
615
+ return node3;
616
+ }
617
+ function countNodes(nodes) {
618
+ return nodes.reduce((n, node3) => isObj(node3) ? n + 1 + (Array.isArray(node3.nodes) ? countNodes(node3.nodes) : 0) : n, 0);
619
+ }
620
+ function canonicalJson(v, depth, max) {
621
+ if (depth > max) throw TOO_DEEP;
622
+ if (Array.isArray(v)) return `[${v.map((x) => x === void 0 ? "null" : canonicalJson(x, depth + 1, max)).join(",")}]`;
623
+ if (isObj(v)) return `{${Object.keys(v).sort().filter((k) => v[k] !== void 0).map((k) => `${JSON.stringify(k)}:${canonicalJson(v[k], depth + 1, max)}`).join(",")}}`;
624
+ return JSON.stringify(v) ?? "null";
625
+ }
626
+ function utf8Length(s2) {
627
+ let bytes = 0;
628
+ for (let i = 0; i < s2.length; i++) {
629
+ const c = s2.charCodeAt(i);
630
+ if (c < 128) bytes += 1;
631
+ else if (c < 2048) bytes += 2;
632
+ else if (c >= 55296 && c <= 56319 && i + 1 < s2.length && s2.charCodeAt(i + 1) >= 56320 && s2.charCodeAt(i + 1) <= 57343) {
633
+ bytes += 4;
634
+ i++;
635
+ } else bytes += 3;
636
+ }
637
+ return bytes;
638
+ }
639
+
640
+ // ../../stdlib/flows/screens/src/one-app-page.ts
641
+ function oneAppPageContentErrorCode(error) {
642
+ const value = error;
643
+ return value?.name === "OneAppPageContentError" && (value.code === "invalid" || value.code === "unsupported") ? value.code : void 0;
644
+ }
645
+ var failure = (code, message) => {
646
+ throw Object.assign(new Error(message), { name: "OneAppPageContentError", code });
647
+ };
648
+ var object = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : {};
649
+ var invalid = () => failure("invalid", "The referenced page returned malformed content.");
650
+ var unsupported = () => failure("unsupported", "The referenced page uses an unsupported content format.");
651
+ var isOneAppPageId = (value) => typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
652
+ function normalizeWebsiteLinks(nodes) {
653
+ let changed = 0;
654
+ const normalize = (link) => {
655
+ const value = typeof link?.url === "string" ? link.url.trim() : "";
656
+ if (link && value && !/[\s\\@\u0000-\u001f\u007f]/.test(value) && /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}(?:[/?#].*)?$/i.test(value)) {
657
+ link.url = `https://${value}`;
658
+ changed++;
659
+ }
660
+ };
661
+ const linkFields = {
662
+ BUTTON: [["buttonData", "link", "url"]],
663
+ LINK_BUTTON: [["buttonData", "link", "url"]],
664
+ EMBED: [["embedData", "oembed", "url"], ["embedData", "src"]],
665
+ HTML: [["htmlData", "url"]],
666
+ APP_EMBED: [["appEmbedData", "url"]],
667
+ LINK_PREVIEW: [["linkPreviewData", "link", "url"]],
668
+ FILE: [["fileData", "src", "url"]],
669
+ AUDIO: [["audioData", "audio", "src", "url"]],
670
+ GIF: [["gifData", "original", "gif"]],
671
+ IMAGE: [["imageData", "link", "url"]]
672
+ };
673
+ for (const node3 of nodes) {
674
+ for (const path of linkFields[node3.type ?? ""] ?? []) {
675
+ const parent = object(path.slice(0, -1).reduce((value, key2) => object(value)[key2], node3));
676
+ const key = path[path.length - 1];
677
+ const holder = { url: parent[key] };
678
+ normalize(holder);
679
+ if (typeof holder.url === "string") parent[key] = holder.url;
680
+ }
681
+ if (Array.isArray(node3.textData?.decorations)) for (const decoration of node3.textData.decorations) {
682
+ if (object(decoration).type === "LINK") normalize(object(object(decoration).linkData).link);
683
+ }
684
+ if (Array.isArray(node3.nodes)) changed += normalizeWebsiteLinks(node3.nodes);
685
+ }
686
+ return changed;
687
+ }
688
+ function draftDocument(value) {
689
+ const draft = object(value);
690
+ if (!Array.isArray(draft.blocks) || draft.blocks.length > 5e3) return invalid();
691
+ if (draft.entityMap !== void 0 && (!draft.entityMap || typeof draft.entityMap !== "object" || Array.isArray(draft.entityMap))) return invalid();
692
+ const entities = object(draft.entityMap);
693
+ const nodes = [];
694
+ for (const raw of draft.blocks) {
695
+ const block2 = object(raw);
696
+ if (typeof block2.text !== "string") return invalid();
697
+ if (block2.depth !== void 0 && block2.depth !== 0) return unsupported();
698
+ const text3 = block2.text;
699
+ const styles = block2.inlineStyleRanges ?? [];
700
+ const ranges = block2.entityRanges ?? [];
701
+ if (!Array.isArray(styles) || !Array.isArray(ranges) || styles.length + ranges.length > 500) return invalid();
702
+ const spans = [...styles.map((v) => ({ ...object(v), kind: "style" })), ...ranges.map((v) => ({ ...object(v), kind: "entity" }))];
703
+ for (const span of spans) {
704
+ if (!Number.isInteger(span.offset) || !Number.isInteger(span.length) || Number(span.offset) < 0 || Number(span.length) < 0 || Number(span.offset) + Number(span.length) > text3.length) return invalid();
705
+ }
706
+ if (block2.type === "atomic") {
707
+ if (ranges.length !== 1) return unsupported();
708
+ const entity = object(entities[String(object(ranges[0]).key)]);
709
+ const data = object(entity.data);
710
+ if (entity.type !== "IMAGE" && entity.type !== "wix-draft-plugin-image") return unsupported();
711
+ const url = data.src ?? data.url;
712
+ if (typeof url !== "string" || !url) return invalid();
713
+ nodes.push({ type: "IMAGE", imageData: { image: { src: { url }, ...typeof data.width === "number" ? { width: data.width } : {}, ...typeof data.height === "number" ? { height: data.height } : {} }, ...typeof data.alt === "string" ? { altText: data.alt } : {} } });
714
+ continue;
715
+ }
716
+ const cuts = [.../* @__PURE__ */ new Set([0, text3.length, ...spans.flatMap((s2) => [Number(s2.offset), Number(s2.offset) + Number(s2.length)])])].sort((a, b) => a - b);
717
+ const runs = [];
718
+ for (let i = 1; i < cuts.length; i++) {
719
+ const start = cuts[i - 1], end = cuts[i];
720
+ const decorations = [];
721
+ for (const span of spans.filter((s2) => Number(s2.offset) <= start && Number(s2.offset) + Number(s2.length) >= end)) {
722
+ if (span.kind === "style") {
723
+ if (!["BOLD", "ITALIC", "UNDERLINE", "STRIKETHROUGH"].includes(String(span.style))) return unsupported();
724
+ decorations.push({ type: String(span.style) });
725
+ } else {
726
+ const entity = object(entities[String(span.key)]);
727
+ if (entity.type !== "LINK" || typeof object(entity.data).url !== "string") return unsupported();
728
+ decorations.push({ type: "LINK", linkData: { link: { url: object(entity.data).url } } });
729
+ }
730
+ }
731
+ runs.push({ type: "TEXT", textData: { text: text3.slice(start, end), decorations } });
732
+ }
733
+ const paragraph = { type: "PARAGRAPH", nodes: runs };
734
+ if (block2.type === "unordered-list-item" || block2.type === "ordered-list-item") {
735
+ const type = block2.type === "ordered-list-item" ? "ORDERED_LIST" : "BULLETED_LIST";
736
+ const last = nodes[nodes.length - 1];
737
+ const list = last?.type === type ? last : { type, nodes: [] };
738
+ if (last !== list) nodes.push(list);
739
+ list.nodes?.push({ type: "LIST_ITEM", nodes: [paragraph] });
740
+ } else if (/^header-(one|two|three|four|five|six)$/.test(String(block2.type))) {
741
+ nodes.push({ type: "HEADING", headingData: { level: ["one", "two", "three", "four", "five", "six"].indexOf(String(block2.type).slice(7)) + 1 }, nodes: runs });
742
+ } else if (block2.type === "unstyled" || block2.type === "paragraph" || block2.type === void 0) nodes.push(paragraph);
743
+ else return unsupported();
744
+ }
745
+ return { nodes };
746
+ }
747
+ function decodeOneAppPage(response, expectedPageId) {
748
+ const dto = object(response), content = object(dto.content), body = object(content.body);
749
+ if (!isOneAppPageId(expectedPageId) || dto.pageId !== expectedPageId || typeof body.content !== "string" || content.title !== void 0 && typeof content.title !== "string") return invalid();
750
+ const raw = body.content;
751
+ if (richContentOverLimits(raw, null)) return invalid();
752
+ let document;
753
+ const contentType = body.contentType;
754
+ if (contentType === "PLAIN_TEXT") document = plainTextToRicos(raw);
755
+ else if (contentType === "RICH_CONTENT" || contentType === "DRAFTJS") {
756
+ let parsed;
757
+ try {
758
+ parsed = JSON.parse(raw);
759
+ } catch {
760
+ return invalid();
761
+ }
762
+ if (richContentOverLimits(raw, parsed)) return invalid();
763
+ if (contentType === "DRAFTJS") document = draftDocument(parsed);
764
+ else {
765
+ if (!Array.isArray(object(parsed).nodes)) return invalid();
766
+ document = parsed;
767
+ }
768
+ } else return unsupported();
769
+ const validNodes = (nodes) => nodes.every((value) => {
770
+ const n = object(value);
771
+ return typeof n.type === "string" && n.type.length > 0 && (n.type !== "TEXT" || typeof object(n.textData).text === "string") && (n.nodes === void 0 || Array.isArray(n.nodes) && validNodes(n.nodes));
772
+ });
773
+ if (!validNodes(document.nodes)) return invalid();
774
+ const normalizedWebsiteLinks = normalizeWebsiteLinks(document.nodes);
775
+ let encoded;
776
+ try {
777
+ encoded = encodeRichContent({ nodes: document.nodes, ...document.documentStyle !== void 0 ? { documentStyle: document.documentStyle } : {} });
778
+ } catch {
779
+ return invalid();
780
+ }
781
+ if (encoded.rejected) return invalid();
782
+ const plainText = ricosToPlainText(document);
783
+ const authored = document.nodes.some((n) => n.type !== "PARAGRAPH" || (n.nodes ?? []).some((c) => c.type !== "TEXT" || !!c.textData?.text?.trim()));
784
+ if (!encoded.json && authored) return unsupported();
785
+ return { pageId: expectedPageId, title: typeof content.title === "string" ? content.title : "", contentType, documentJson: encoded.json, plainText, empty: !authored, normalizedWebsiteLinks };
786
+ }
787
+ function oneAppPageSection(page, options) {
788
+ if (!options.id) throw new Error("oneAppPageSection requires a stable placement id");
789
+ if (page.empty) return { id: options.id, body: { package: "himalaya", type: "VStack", props: { spacing: 8, children: [
790
+ { id: `${options.id}.empty_title`, body: { package: "himalaya", type: "Text", props: { text: options.emptyTitle ?? "No content yet", style: "bodyEmphasis" } } },
791
+ ...options.emptyDescription ? [{ id: `${options.id}.empty_description`, body: { package: "himalaya", type: "Text", props: { text: options.emptyDescription, style: "body" } } }] : []
792
+ ] } } };
793
+ return { id: options.id, body: { package: "himalaya", type: "RichContent", props: {
794
+ documentJson: page.documentJson
795
+ } } };
796
+ }
797
+
327
798
  // ../../core/sdk/app-info/src/index.ts
328
799
  var PLATFORMS = ["ios", "android", "macos", "web", "react-native"];
329
800
  function str(v) {
@@ -1023,6 +1494,26 @@ async function entitlement(planId) {
1023
1494
  }
1024
1495
  return { entitled: false, planName: "", planId: "" };
1025
1496
  }
1497
+ function isPaymentSetupFailure(error) {
1498
+ if (!error || typeof error !== "object") return false;
1499
+ const value = error;
1500
+ if (value.code === "SITE_NOT_ACCEPTING_PAYMENTS" || value.applicationError?.code === "SITE_NOT_ACCEPTING_PAYMENTS" || value.details?.applicationError?.code === "SITE_NOT_ACCEPTING_PAYMENTS") return true;
1501
+ if (typeof value.message !== "string") return false;
1502
+ if (/^HTTP \d{3} \[SITE_NOT_ACCEPTING_PAYMENTS\]:/.test(value.message)) return true;
1503
+ const web = /^HTTP \d{3}: (\{[\s\S]*\})$/.exec(value.message);
1504
+ if (!web) return false;
1505
+ try {
1506
+ const body = JSON.parse(web[1]);
1507
+ return body?.code === "SITE_NOT_ACCEPTING_PAYMENTS" || body?.applicationError?.code === "SITE_NOT_ACCEPTING_PAYMENTS" || body?.details?.applicationError?.code === "SITE_NOT_ACCEPTING_PAYMENTS";
1508
+ } catch {
1509
+ return false;
1510
+ }
1511
+ }
1512
+ var PAYMENT_SETUP_FAILURE = {
1513
+ kind: "failed",
1514
+ code: "SITE_NOT_ACCEPTING_PAYMENTS",
1515
+ reason: "the site is not accepting online payments"
1516
+ };
1026
1517
  var WITHDRAWN = { kind: "failed", reason: "the caller withdrew the charge" };
1027
1518
  async function payOrder(req) {
1028
1519
  if (!req.snapshotId && !req.cashierUrl && !req.openCashier) {
@@ -1037,7 +1528,9 @@ async function payOrder(req) {
1037
1528
  msid: req.msid,
1038
1529
  amount: req.amount,
1039
1530
  currency: req.currency
1040
- }).catch(() => ({ status: "failed" }));
1531
+ }).catch((error) => ({ status: "failed", setupUnavailable: isPaymentSetupFailure(error) }));
1532
+ if ("setupUnavailable" in r && r.setupUnavailable) return PAYMENT_SETUP_FAILURE;
1533
+ if (r.status === "failed" && isPaymentSetupFailure({ message: "error" in r ? r.error : void 0 })) return PAYMENT_SETUP_FAILURE;
1041
1534
  if (r.status === "paid" || r.status === "pending") {
1042
1535
  const chargeId = r.chargeId;
1043
1536
  return {
@@ -1050,11 +1543,13 @@ async function payOrder(req) {
1050
1543
  }
1051
1544
  if (req.openCashier) {
1052
1545
  if (await req.mayCharge?.() === false) return WITHDRAWN;
1053
- const opened = await req.openCashier(async () => await req.mayCharge?.() !== false).catch(() => false);
1546
+ const opened = await req.openCashier(async () => await req.mayCharge?.() !== false).catch((error) => isPaymentSetupFailure(error) ? PAYMENT_SETUP_FAILURE : false);
1547
+ if (typeof opened === "object") return opened;
1054
1548
  if (opened === "withdrawn") return WITHDRAWN;
1055
1549
  if (opened === true) return { kind: "handoff" };
1056
1550
  } else if (req.cashierUrl) {
1057
- const url = await req.cashierUrl().catch(() => void 0);
1551
+ const url = await req.cashierUrl().catch((error) => isPaymentSetupFailure(error) ? PAYMENT_SETUP_FAILURE : void 0);
1552
+ if (typeof url === "object") return url;
1058
1553
  if (url) {
1059
1554
  if (await req.mayCharge?.() === false) return WITHDRAWN;
1060
1555
  const opened = await open(url, "in_app_browser").catch(() => ({ opened: false }));
@@ -2158,18 +2653,18 @@ function toPayment(raw, status) {
2158
2653
  }
2159
2654
  function classifyFailure(error, operation, codes2) {
2160
2655
  const message = messageOf(error);
2161
- if (BRIDGE_REFUSAL.test(message)) return failure(operation, "notEnabled");
2162
- if (PRINCIPAL_CHANGED.test(message)) return failure(operation, "sessionChanged");
2656
+ if (BRIDGE_REFUSAL.test(message)) return failure2(operation, "notEnabled");
2657
+ if (PRINCIPAL_CHANGED.test(message)) return failure2(operation, "sessionChanged");
2163
2658
  const http = /^HTTP (\d{3})(?: \[([^\]]+)\])?:/.exec(message);
2164
- if (!http) return failure(operation, "unavailable");
2659
+ if (!http) return failure2(operation, "unavailable");
2165
2660
  return classifyHttp({ operation, codes: codes2, httpStatus: Number(http[1]), code: http[2] ?? "" });
2166
2661
  }
2167
- function failure(operation, kind) {
2662
+ function failure2(operation, kind) {
2168
2663
  return { status: "failed", operation, kind };
2169
2664
  }
2170
2665
  function classifyHttp(refusal) {
2171
2666
  const { operation, codes: codes2, httpStatus, code } = refusal;
2172
- if (code === "PRINCIPAL_CHANGED") return failure(operation, "sessionChanged");
2667
+ if (code === "PRINCIPAL_CHANGED") return failure2(operation, "sessionChanged");
2173
2668
  if (isOneOf(codes2, code)) return { status: "failed", operation, kind: "application", code, httpStatus };
2174
2669
  return { status: "failed", operation, kind: kindForStatus(httpStatus, code), httpStatus };
2175
2670
  }
@@ -2237,7 +2732,7 @@ var PRINCIPAL_CHANGED = /^PRINCIPAL_CHANGED\b/;
2237
2732
  // ../../core/sdk/iap/src/wix-payments.ts
2238
2733
  function createWixIapClient(deps) {
2239
2734
  function startPayment(input) {
2240
- if (!isUUID(input.wixTransactionId)) return Promise.resolve(failure("startPayment", "invalidArgument"));
2735
+ if (!isUUID(input.wixTransactionId)) return Promise.resolve(failure2("startPayment", "invalidArgument"));
2241
2736
  return run({
2242
2737
  operation: "startPayment",
2243
2738
  codes: START_PAYMENT_CODES,
@@ -2250,7 +2745,7 @@ function createWixIapClient(deps) {
2250
2745
  }
2251
2746
  function startItemPayment(input) {
2252
2747
  const item = catalogItemOf(input.item);
2253
- if (!item) return Promise.resolve(failure("startItemPayment", "invalidArgument"));
2748
+ if (!item) return Promise.resolve(failure2("startItemPayment", "invalidArgument"));
2254
2749
  return runUnrepeatable({
2255
2750
  operation: "startItemPayment",
2256
2751
  codes: START_ITEM_PAYMENT_CODES,
@@ -2275,7 +2770,7 @@ function createWixIapClient(deps) {
2275
2770
  });
2276
2771
  }
2277
2772
  function getPayment(input) {
2278
- if (!isUUID(input.paymentId)) return Promise.resolve(failure("getPayment", "invalidArgument"));
2773
+ if (!isUUID(input.paymentId)) return Promise.resolve(failure2("getPayment", "invalidArgument"));
2279
2774
  return run({
2280
2775
  operation: "getPayment",
2281
2776
  codes: GET_PAYMENT_CODES,
@@ -2298,7 +2793,7 @@ function createWixIapClient(deps) {
2298
2793
  if ("failure" in scope) return { result: scope.failure, handedOff: false };
2299
2794
  const sent = await send(scope, spec);
2300
2795
  if ("failure" in sent) return { result: sent.failure, handedOff: sent.handedOff };
2301
- return { result: spec.decode(sent.answer, scope) ?? failure(spec.operation, "invalidResponse"), handedOff: true };
2796
+ return { result: spec.decode(sent.answer, scope) ?? failure2(spec.operation, "invalidResponse"), handedOff: true };
2302
2797
  }
2303
2798
  async function resolveScope(session, operation) {
2304
2799
  if (session.kind !== "member") return refused(operation, "authRequired");
@@ -2324,7 +2819,7 @@ function createWixIapClient(deps) {
2324
2819
  const expectation = boundExpectation2(scope.session, deps.transport == null);
2325
2820
  if (expectation === "refuse") return notSent(spec.operation, "notEnabled");
2326
2821
  const outcome = await attempt2(transport, spec.request(scope), spec, expectation);
2327
- return isCurrent(scope.session) ? outcome : { failure: failure(spec.operation, "sessionChanged"), handedOff: true };
2822
+ return isCurrent(scope.session) ? outcome : { failure: failure2(spec.operation, "sessionChanged"), handedOff: true };
2328
2823
  }
2329
2824
  function boundExpectation2(session, liveHost) {
2330
2825
  const source = deps.session;
@@ -2346,7 +2841,7 @@ async function attempt2(transport, call, spec, expectation) {
2346
2841
  }
2347
2842
  }
2348
2843
  function notSent(operation, kind) {
2349
- return { failure: failure(operation, kind), handedOff: false };
2844
+ return { failure: failure2(operation, kind), handedOff: false };
2350
2845
  }
2351
2846
  function isUndecided(result) {
2352
2847
  const failed = result;
@@ -2364,15 +2859,15 @@ async function read(call, operation) {
2364
2859
  }
2365
2860
  }
2366
2861
  function refused(operation, kind) {
2367
- return { failure: failure(operation, kind) };
2862
+ return { failure: failure2(operation, kind) };
2368
2863
  }
2369
2864
  function expectationOf2(scope) {
2370
2865
  return { appId: scope.binding.purchasesAppId, memberId: scope.memberId };
2371
2866
  }
2372
2867
  function refuseProof(transaction) {
2373
- if (transaction.environment !== "production" && transaction.environment !== "sandbox") return failure("completePayment", "environmentUnsupported");
2868
+ if (transaction.environment !== "production" && transaction.environment !== "sandbox") return failure2("completePayment", "environmentUnsupported");
2374
2869
  const signed = transaction.signedTransaction;
2375
- return typeof signed === "string" && signed.length > 0 && signed.length <= MAX_SIGNED_TRANSACTION ? null : failure("completePayment", "invalidArgument");
2870
+ return typeof signed === "string" && signed.length > 0 && signed.length <= MAX_SIGNED_TRANSACTION ? null : failure2("completePayment", "invalidArgument");
2376
2871
  }
2377
2872
  function isBindingFor(binding, host) {
2378
2873
  return binding.himalayaAppId === host.appId && binding.bundleId === host.bundleId && binding.siteId === host.siteId;
@@ -2451,21 +2946,21 @@ function fixedPriceRoute(item, currency) {
2451
2946
  return typeof amount === "string" && /^\d+(?:\.\d+)?$/.test(amount) && Number.isFinite(Number(amount)) && Number(amount) > 0 && /^[A-Z]{3}$/.test(currency) && item.currency === currency ? "appleIap" : "decide";
2452
2947
  }
2453
2948
  function bookingAttendanceOf(raw) {
2454
- const s2 = object(raw);
2455
- const payment = object(s2.payment);
2456
- const fixed = object(payment.fixed);
2457
- const price = object(fixed.price);
2458
- const options = object(payment.options);
2459
- const policy = object(object(s2.bookingPolicy).participantsPolicy);
2949
+ const s2 = object2(raw);
2950
+ const payment = object2(s2.payment);
2951
+ const fixed = object2(payment.fixed);
2952
+ const price = object2(fixed.price);
2953
+ const options = object2(payment.options);
2954
+ const policy = object2(object2(s2.bookingPolicy).participantsPolicy);
2460
2955
  return {
2461
2956
  kind: "bookingsService",
2462
2957
  type: text(s2.type),
2463
2958
  capacity: numeric(s2.defaultCapacity),
2464
2959
  maxParticipantsPerBooking: policy.enabled === true ? numeric(policy.maxParticipantsPerBooking) : void 0,
2465
2960
  hidden: boolean(s2.hidden),
2466
- conferencing: boolean(object(s2.conferencing).enabled),
2961
+ conferencing: boolean(object2(s2.conferencing).enabled),
2467
2962
  locations: Array.isArray(s2.locations) ? s2.locations.map(locationType) : void 0,
2468
- onlineBooking: boolean(object(s2.onlineBooking).enabled),
2963
+ onlineBooking: boolean(object2(s2.onlineBooking).enabled),
2469
2964
  onlinePayment: boolean(options.online),
2470
2965
  deposit: options.deposit === true || fixed.deposit !== void 0,
2471
2966
  priceType: text(payment.rateType),
@@ -2474,9 +2969,9 @@ function bookingAttendanceOf(raw) {
2474
2969
  };
2475
2970
  }
2476
2971
  function locationType(raw) {
2477
- const location = object(raw);
2972
+ const location = object2(raw);
2478
2973
  const type = text(location.type) ?? "UNKNOWN";
2479
- const addresses = [object(location.custom).address, location.calculatedAddress].map(object);
2974
+ const addresses = [object2(location.custom).address, location.calculatedAddress].map(object2);
2480
2975
  return type === "CUSTOM" && addresses.every(describesNoPlace) ? ADDRESSLESS_CUSTOM : type;
2481
2976
  }
2482
2977
  function describesNoPlace(address) {
@@ -2490,16 +2985,16 @@ function describesNoPlace(address) {
2490
2985
  }
2491
2986
  var ONLINE_LABEL = /^(online|virtual)(\s+(class|classes|classroom|course|session|sessions|meeting|lesson|training|workshop|event))?$/i;
2492
2987
  function ticketAttendanceOf(event, definition) {
2493
- const e = object(event);
2494
- const t = object(definition);
2495
- const pricing = object(t.pricingMethod);
2496
- const price = object(pricing.fixedPrice);
2497
- const registration = object(e.registration);
2988
+ const e = object2(event);
2989
+ const t = object2(definition);
2990
+ const pricing = object2(t.pricingMethod);
2991
+ const price = object2(pricing.fixedPrice);
2992
+ const registration = object2(e.registration);
2498
2993
  const type = text(registration.type) ?? text(registration.initialType) ?? text(e.eventType);
2499
2994
  const status = text(e.status) ?? text(e.eventStatus);
2500
2995
  return {
2501
2996
  kind: "eventsTicket",
2502
- location: text(object(e.location).type),
2997
+ location: text(object2(e.location).type),
2503
2998
  registration: type === "TICKETS" || type === "RSVP_AND_TICKETS" ? "TICKETING" : type,
2504
2999
  eventStatus: status === "SCHEDULED" ? "UPCOMING" : status,
2505
3000
  saleStatus: text(t.saleStatus),
@@ -2510,12 +3005,12 @@ function ticketAttendanceOf(event, definition) {
2510
3005
  };
2511
3006
  }
2512
3007
  function availableTicketAttendanceOf(event, ticket) {
2513
- const e = object(event);
2514
- const t = object(ticket);
2515
- const pricing = object(t.pricing);
2516
- const fixed = object(pricing.fixedPrice);
2517
- const price = object(t.price);
2518
- const visible = Array.isArray(t.state) && t.state.length === 0 && object(t.dashboard).hidden !== true && typeof t.id === "string" && t.id.length > 0 && typeof e.id === "string" && e.id.length > 0 && t.eventId === e.id;
3008
+ const e = object2(event);
3009
+ const t = object2(ticket);
3010
+ const pricing = object2(t.pricing);
3011
+ const fixed = object2(pricing.fixedPrice);
3012
+ const price = object2(t.price);
3013
+ const visible = Array.isArray(t.state) && t.state.length === 0 && object2(t.dashboard).hidden !== true && typeof t.id === "string" && t.id.length > 0 && typeof e.id === "string" && e.id.length > 0 && t.eventId === e.id;
2519
3014
  const fixedPrice = t.free === false && pricing.pricingType === "STANDARD" && sameTicketAmount(fixed.amount, price.amount) && fixed.currency === price.currency;
2520
3015
  return ticketAttendanceOf(e, {
2521
3016
  hidden: visible ? false : void 0,
@@ -2528,7 +3023,7 @@ function sameTicketAmount(left, right) {
2528
3023
  const normalized = (value) => value.replace(/^0+(?=\d)/, "").replace(/(\.\d*?)0+$/, "$1").replace(/\.$/, "");
2529
3024
  return valid(left) && valid(right) && normalized(left) === normalized(right);
2530
3025
  }
2531
- function object(value) {
3026
+ function object2(value) {
2532
3027
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
2533
3028
  }
2534
3029
  var text = (value) => typeof value === "string" ? value : void 0;
@@ -2551,7 +3046,7 @@ async function restore() {
2551
3046
  return Array.isArray(r?.entitlements) ? r.entitlements : [];
2552
3047
  }
2553
3048
  async function purchaseForVerification(input) {
2554
- if (!nonempty2(input?.productId) || !isUUID2(input?.appAccountToken)) return failure2("invalidArgument");
3049
+ if (!nonempty2(input?.productId) || !isUUID2(input?.appAccountToken)) return failure3("invalidArgument");
2555
3050
  const result = await managedDispatch(() => dispatch("capability.iap.purchaseForVerification", input));
2556
3051
  if (result?.status === "purchased" && isAppleTransaction(result.transaction)) {
2557
3052
  return { status: "purchased", transaction: decodeTransaction(result.transaction) };
@@ -2567,7 +3062,7 @@ async function getUnfinishedTransactions() {
2567
3062
  return decodeFailure(result);
2568
3063
  }
2569
3064
  async function finishTransaction(input) {
2570
- if (!nonempty2(input?.transactionId)) return failure2("invalidArgument");
3065
+ if (!nonempty2(input?.transactionId)) return failure3("invalidArgument");
2571
3066
  const result = await managedDispatch(() => dispatch("capability.iap.finishTransaction", input));
2572
3067
  if (result?.status === "finished" || result?.status === "notFound") return { status: result.status };
2573
3068
  return decodeFailure(result);
@@ -2610,7 +3105,7 @@ function decodeBinding(raw) {
2610
3105
  return { purchasesAppId, himalayaAppId, bundleId, siteId };
2611
3106
  }
2612
3107
  var transactionErrors = /* @__PURE__ */ new Set(["unsupported", "unavailable", "invalidArgument", "invalidResponse", "notEnabled", "unsupportedProductType", "unknownProduct", "verificationFailed", "persistenceFailed", "ownershipConflict", "storeError", "busy"]);
2613
- var failure2 = (code) => ({ status: "failed", code });
3108
+ var failure3 = (code) => ({ status: "failed", code });
2614
3109
  var nonempty2 = (value) => typeof value === "string" && value.trim().length > 0;
2615
3110
  var isUUID2 = (value) => typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value) && value.length === 36;
2616
3111
  var isObject4 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
@@ -2619,11 +3114,11 @@ async function managedDispatch(invoke) {
2619
3114
  const value = await invoke();
2620
3115
  return isObject4(value) ? value : null;
2621
3116
  } catch {
2622
- return failure2("unavailable");
3117
+ return failure3("unavailable");
2623
3118
  }
2624
3119
  }
2625
3120
  function decodeFailure(value) {
2626
- return value?.status === "failed" && transactionErrors.has(value.code) ? failure2(value.code) : failure2("invalidResponse");
3121
+ return value?.status === "failed" && transactionErrors.has(value.code) ? failure3(value.code) : failure3("invalidResponse");
2627
3122
  }
2628
3123
  function isAppleTransaction(value) {
2629
3124
  if (!isObject4(value)) return false;
@@ -2648,8 +3143,8 @@ function itemPaymentEnabled() {
2648
3143
 
2649
3144
  // ../../stdlib/flows/iap-checkout/src/cashier-charges.ts
2650
3145
  async function ensureAppleIapCharge(bridge, route, orderId) {
2651
- const invalid = invalidRequest(route, orderId);
2652
- if (invalid) return invalid;
3146
+ const invalid2 = invalidRequest(route, orderId);
3147
+ if (invalid2) return invalid2;
2653
3148
  const listed = await listOrderCharges(bridge, route, orderId);
2654
3149
  if (listed.status !== "ok") return listed;
2655
3150
  return decideFromCharges(listed.charges) ?? chargeThenReconcile(bridge, route, orderId);
@@ -3013,8 +3508,8 @@ function createWixOrderBackend(deps) {
3013
3508
  }
3014
3509
  function saleBlocked(sale) {
3015
3510
  const stage = refAt(sale.partition, sale.catalogRef)?.stage;
3016
- const failure3 = stage && BLOCKING_STAGES[stage];
3017
- if (failure3) return stopWith("rejected", failure3);
3511
+ const failure4 = stage && BLOCKING_STAGES[stage];
3512
+ if (failure4) return stopWith("rejected", failure4);
3018
3513
  if (sale.adapter.repeatable) {
3019
3514
  const prefix = `${sale.item.reference.kind}:${sale.item.reference.id}#`;
3020
3515
  const unresolved = sale.partition.refs().find((ref) => ref.key.startsWith(prefix) && !sale.unrelated.has(ref.key) && ["openingOrder", "held", "needsSupport"].includes(ref.stage));
@@ -3203,9 +3698,9 @@ function createWixOrderBackend(deps) {
3203
3698
  if (isStop(recorded)) return contextResult(sale.catalogRef, recorded);
3204
3699
  return { status: "ok", context: { productId: storeProductId, appAccountToken, scopeKey: sale.member.scopeKey } };
3205
3700
  }
3206
- function itemRefusal(sale, failure3) {
3207
- if (failure3.kind === "application") return undoAttempt(sale, stopWith("rejected", ITEM_REFUSALS[failure3.code]));
3208
- return undoAttempt(sale, failure3.kind === "unrecognized" ? NOT_CONFIGURED : failureStop(failure3));
3701
+ function itemRefusal(sale, failure4) {
3702
+ if (failure4.kind === "application") return undoAttempt(sale, stopWith("rejected", ITEM_REFUSALS[failure4.code]));
3703
+ return undoAttempt(sale, failure4.kind === "unrecognized" ? NOT_CONFIGURED : failureStop(failure4));
3209
3704
  }
3210
3705
  function undoAttempt(sale, stop) {
3211
3706
  sale.partition.remove(sale.catalogRef);
@@ -3214,14 +3709,14 @@ function createWixOrderBackend(deps) {
3214
3709
  function startedMismatch(sale, started) {
3215
3710
  return sale.appleProduct.productId === started.storeProductId ? null : "productChanged";
3216
3711
  }
3217
- async function startRefusal(sale, ref, failure3) {
3218
- if (failure3.kind !== "application") return failureStop(failure3);
3219
- if (failure3.code === "SUBSCRIPTION_NOT_IN_APP" || failure3.code === "ALREADY_SUBSCRIBED") {
3712
+ async function startRefusal(sale, ref, failure4) {
3713
+ if (failure4.kind !== "application") return failureStop(failure4);
3714
+ if (failure4.code === "SUBSCRIPTION_NOT_IN_APP" || failure4.code === "ALREADY_SUBSCRIBED") {
3220
3715
  return stopWith("rejected", "paymentRefused");
3221
3716
  }
3222
- if (failure3.code === "ALREADY_OWNED") return alreadyPaid(sale, ref);
3223
- if (failure3.code === "NOT_PENDING" || failure3.code === "NOT_ORDER_BUYER") forget(sale, sale.catalogRef);
3224
- return stopWith("rejected", failure3.code === "NOT_PENDING" ? "orderClosed" : "paymentRefused");
3717
+ if (failure4.code === "ALREADY_OWNED") return alreadyPaid(sale, ref);
3718
+ if (failure4.code === "NOT_PENDING" || failure4.code === "NOT_ORDER_BUYER") forget(sale, sale.catalogRef);
3719
+ return stopWith("rejected", failure4.code === "NOT_PENDING" ? "orderClosed" : "paymentRefused");
3225
3720
  }
3226
3721
  function alreadyOwned(sale) {
3227
3722
  if (!sale.adapter.repeatable) forget(sale, sale.catalogRef);
@@ -3294,8 +3789,8 @@ function createWixOrderBackend(deps) {
3294
3789
  deps.report({ key: hold.key, access: "needsSupport" });
3295
3790
  return { status: "refusedFinal", acknowledgement: proof.acknowledgement };
3296
3791
  }
3297
- function refusedProof(proof, failure3) {
3298
- const refusal = failure3.kind === "application" ? COMPLETE_PAYMENT_REFUSALS[failure3.code] : failureStop(failure3).result;
3792
+ function refusedProof(proof, failure4) {
3793
+ const refusal = failure4.kind === "application" ? COMPLETE_PAYMENT_REFUSALS[failure4.code] : failureStop(failure4).result;
3299
3794
  if (refusal === "refusedFinal") return finalRefusal(proof, startedRefFor(proof));
3300
3795
  if (refusal === "hold" || refusal === "rejected") return heldProof(proof, "rejected");
3301
3796
  return refusal === "ownershipConflict" ? heldProof(proof, "ownershipConflict") : { status: refusal };
@@ -3324,18 +3819,18 @@ function createWixOrderBackend(deps) {
3324
3819
  }
3325
3820
  var RETRYABLE = { status: "retryable" };
3326
3821
  var STALE2 = { stop: true, result: "retryable" };
3327
- function stopWith(result, failure3) {
3328
- return { stop: true, result, failure: failure3 };
3822
+ function stopWith(result, failure4) {
3823
+ return { stop: true, result, failure: failure4 };
3329
3824
  }
3330
- function retry(failure3) {
3331
- return stopWith("retryable", failure3);
3825
+ function retry(failure4) {
3826
+ return stopWith("retryable", failure4);
3332
3827
  }
3333
3828
  function isStop(value) {
3334
3829
  return typeof value === "object" && value !== null && value.stop === true;
3335
3830
  }
3336
- function failureStop(failure3) {
3337
- if (failure3.kind === "application") return stopWith("rejected", "notConfigured");
3338
- return KIND_STOPS[failure3.kind];
3831
+ function failureStop(failure4) {
3832
+ if (failure4.kind === "application") return stopWith("rejected", "notConfigured");
3833
+ return KIND_STOPS[failure4.kind];
3339
3834
  }
3340
3835
  var SIGN_IN = { stop: true, result: "authRequired", failure: "signInRequired" };
3341
3836
  var NOT_CONFIGURED = { stop: true, result: "rejected", failure: "notConfigured" };
@@ -3353,7 +3848,7 @@ var ITEM_REFUSALS = {
3353
3848
  PRODUCT_NOT_AVAILABLE: "paymentRefused",
3354
3849
  ALREADY_OWNED: "paymentRefused",
3355
3850
  ITEM_NOT_AVAILABLE: "orderRefused",
3356
- SITE_NOT_ACCEPTING_PAYMENTS: "orderRefused",
3851
+ SITE_NOT_ACCEPTING_PAYMENTS: "sitePaymentUnavailable",
3357
3852
  UNSUPPORTED_ORDER: "orderRefused"
3358
3853
  };
3359
3854
  var KIND_STOPS = {
@@ -3536,10 +4031,10 @@ function enabledCheckout(deps) {
3536
4031
  resetIfSessionChanged();
3537
4032
  const owned = event.failure === "alreadyOwned";
3538
4033
  const access = owned ? "granted" : event.access;
3539
- const failure3 = owned ? void 0 : event.failure;
4034
+ const failure4 = owned ? void 0 : event.failure;
3540
4035
  if (access) setPayment(event.key, access);
3541
4036
  if (owned) readGrants.add(event.key);
3542
- if (labelOf(event.key) === current.item && (failure3 || access)) current.failure = failure3 ?? failureOfAccess(access);
4037
+ if (labelOf(event.key) === current.item && (failure4 || access)) current.failure = failure4 ?? failureOfAccess(access);
3543
4038
  }
3544
4039
  function setPayment(key, access) {
3545
4040
  const due = access === "processing" ? deps.clock.now() + BASE_DELAY_MS : null;
@@ -3821,8 +4316,9 @@ function outcomeAction(state, copy) {
3821
4316
  return action(copy, "enabled", "");
3822
4317
  }
3823
4318
  }
3824
- function refusalAction(failure3, copy) {
3825
- const [mode, note] = REFUSALS[failure3 ?? "unavailable"] ?? ["enabled", "retry"];
4319
+ function refusalAction(failure4, copy) {
4320
+ if (failure4 === "sitePaymentUnavailable") return action(copy, "enabled", copy.sitePaymentUnavailable ?? copy.retry);
4321
+ const [mode, note] = REFUSALS[failure4 ?? "unavailable"] ?? ["enabled", "retry"];
3826
4322
  return action(copy, mode, note ? copy[note] ?? "" : "");
3827
4323
  }
3828
4324
  function action(copy, mode, note) {
@@ -5173,10 +5669,14 @@ export {
5173
5669
  createCheckoutService,
5174
5670
  createInviteAvailabilityService,
5175
5671
  createInviteService,
5672
+ decodeOneAppPage,
5176
5673
  detailedHeader,
5177
5674
  entitlement,
5178
5675
  inviteAction,
5179
5676
  inviteButton,
5180
- inviteScreen
5677
+ inviteScreen,
5678
+ isOneAppPageId,
5679
+ oneAppPageContentErrorCode,
5680
+ oneAppPageSection
5181
5681
  };
5182
5682
  //# sourceMappingURL=screens.mjs.map