@wix/himalaya-cli 0.1750.0 → 0.1752.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 (185) 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/dev-server/src/builder.d.ts +3 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +16 -1
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/himi-package.d.ts +478 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/host-compatibility.d.ts +56 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +154 -7
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +3 -0
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/index.d.ts +1 -1
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/auth-providers/wix/src/native-engine.d.ts +49 -3
  13. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/copy.generated.d.ts +16 -1
  14. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/feedback.d.ts +1 -1
  15. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +2 -0
  16. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast-service.d.ts +105 -0
  17. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast.d.ts +116 -0
  18. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/auth.mjs +27 -2
  19. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +326 -13
  20. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +757 -83
  21. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +156 -0
  22. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth/worker.mjs +133 -13
  23. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth.mjs +139 -13
  24. package/dist/browser-plane/assets.json +5 -5
  25. package/dist/browser-plane/preview-deferred/{b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin → 2671d1cadb15daa5e59440f4c924e30c221ab3d405e8a56a0ab1cdbe4764af3d.bin} +1 -1
  26. package/dist/browser-plane/sw.js +7 -7
  27. package/dist/cli.mjs +37219 -33014
  28. package/dist/preview-assets.generated.bin +0 -0
  29. package/guides/app-config.md +1 -1
  30. package/guides/component-reference.json +1 -1
  31. package/guides/component-reference.md +4 -0
  32. package/guides/designing-himi-screens.md +7 -0
  33. package/guides/getting-started.md +2 -0
  34. package/guides/headless-loop.md +1 -1
  35. package/guides/himi-json-output.md +25 -3
  36. package/guides/himi-skill.md +2 -0
  37. package/guides/index.json +6 -0
  38. package/guides/push-cli-onboarding.md +13 -0
  39. package/guides/qa-builds.md +15 -2
  40. package/guides/recipe-podcast.md +149 -0
  41. package/guides/releasing-with-himi-serve.md +51 -0
  42. package/guides/store-submission.md +46 -1
  43. package/guides/tier-5-add-a-screen.md +16 -2
  44. package/guides/wix-business-context.md +29 -0
  45. package/guides/wix-platform-usage.md +7 -2
  46. package/package.json +10 -10
  47. package/template-icons/fitness-gym.png +0 -0
  48. package/templates/beauty-salon/dev/index.ts +1 -1
  49. package/templates/beauty-salon/l10n/en.json +1 -1
  50. package/templates/beauty-salon/tier5-src/_shared/program-fields.ts +16 -0
  51. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +5 -8
  52. package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  53. package/templates/branded-lite/dev/index.ts +101 -1
  54. package/templates/branded-lite/l10n/en.json +22 -1
  55. package/templates/branded-lite/l10n/es.json +22 -0
  56. package/templates/branded-lite/l10n/fr.json +18 -0
  57. package/templates/branded-lite/l10n/he.json +15 -0
  58. package/templates/branded-lite/tier5-src/_shared/program-fields.ts +16 -0
  59. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +5 -8
  60. package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  61. package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
  62. package/templates/brandy/README.md +33 -0
  63. package/templates/brandy/config.ts +51 -7
  64. package/templates/brandy/dev/index.ts +23 -9
  65. package/templates/community-club/l10n/en.json +1 -1
  66. package/templates/community-club/tier5-src/_shared/program-fields.ts +16 -0
  67. package/templates/community-club/tier5-src/_shared/programs-section.ts +5 -8
  68. package/templates/events-meetups/l10n/en.json +1 -1
  69. package/templates/events-meetups/tier5-src/_shared/program-fields.ts +16 -0
  70. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +5 -8
  71. package/templates/fitness-gym/README.md +53 -0
  72. package/templates/fitness-gym/config.ts +560 -0
  73. package/templates/fitness-gym/dev/index.ts +25787 -0
  74. package/templates/fitness-gym/himalaya.content.json +64 -0
  75. package/templates/fitness-gym/himalaya.template.json +15 -0
  76. package/templates/fitness-gym/icon.png +0 -0
  77. package/templates/fitness-gym/platforms.json +1 -0
  78. package/templates/fitness-gym/tier5-src/_shared/app-locale.ts +61 -0
  79. package/templates/fitness-gym/tier5-src/_shared/booking-location.ts +147 -0
  80. package/templates/fitness-gym/tier5-src/_shared/booking-session.ts +224 -0
  81. package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  82. package/templates/fitness-gym/tier5-src/_shared/branded-load-state.ts +109 -0
  83. package/templates/fitness-gym/tier5-src/_shared/business-chat-copy.ts +40 -0
  84. package/templates/fitness-gym/tier5-src/_shared/business-chat-history.ts +51 -0
  85. package/templates/fitness-gym/tier5-src/_shared/business-chat-message-model.ts +177 -0
  86. package/templates/fitness-gym/tier5-src/_shared/business-chat-model.ts +56 -0
  87. package/templates/fitness-gym/tier5-src/_shared/business-chat-presenter.ts +576 -0
  88. package/templates/fitness-gym/tier5-src/_shared/business-chat-transport.ts +148 -0
  89. package/templates/fitness-gym/tier5-src/_shared/collection-contract.ts +228 -0
  90. package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +193 -0
  91. package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +400 -0
  92. package/templates/fitness-gym/tier5-src/_shared/detail-presence.ts +51 -0
  93. package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +523 -0
  94. package/templates/fitness-gym/tier5-src/_shared/himi-account.ts +194 -0
  95. package/templates/fitness-gym/tier5-src/_shared/himi-booking-saved.ts +88 -0
  96. package/templates/fitness-gym/tier5-src/_shared/himi-bookings.ts +318 -0
  97. package/templates/fitness-gym/tier5-src/_shared/himi-copy.ts +116 -0
  98. package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +29 -0
  99. package/templates/fitness-gym/tier5-src/_shared/himi-store.ts +7 -0
  100. package/templates/fitness-gym/tier5-src/_shared/himi-text.ts +24 -0
  101. package/templates/fitness-gym/tier5-src/_shared/host-events.ts +66 -0
  102. package/templates/fitness-gym/tier5-src/_shared/hosted-checkout.ts +70 -0
  103. package/templates/fitness-gym/tier5-src/_shared/iap-attendance-form.ts +106 -0
  104. package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
  105. package/templates/fitness-gym/tier5-src/_shared/iap-attendance.ts +38 -0
  106. package/templates/fitness-gym/tier5-src/_shared/iap-worker.ts +127 -0
  107. package/templates/fitness-gym/tier5-src/_shared/inbox-rooms.ts +68 -0
  108. package/templates/fitness-gym/tier5-src/_shared/local-preferences.ts +38 -0
  109. package/templates/fitness-gym/tier5-src/_shared/member-access.ts +63 -0
  110. package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +52 -0
  111. package/templates/fitness-gym/tier5-src/_shared/member-bookings.ts +107 -0
  112. package/templates/fitness-gym/tier5-src/_shared/member-screen.ts +99 -0
  113. package/templates/fitness-gym/tier5-src/_shared/notification-target.ts +141 -0
  114. package/templates/fitness-gym/tier5-src/_shared/offset-page.ts +10 -0
  115. package/templates/fitness-gym/tier5-src/_shared/online-actions.ts +76 -0
  116. package/templates/fitness-gym/tier5-src/_shared/owner-load-error.ts +348 -0
  117. package/templates/fitness-gym/tier5-src/_shared/payment-setup.ts +6 -0
  118. package/templates/fitness-gym/tier5-src/_shared/pricing-plan-display.ts +64 -0
  119. package/templates/fitness-gym/tier5-src/_shared/program-description.ts +11 -0
  120. package/templates/fitness-gym/tier5-src/_shared/program-fields.ts +16 -0
  121. package/templates/fitness-gym/tier5-src/_shared/program-standing.ts +46 -0
  122. package/templates/fitness-gym/tier5-src/_shared/rich-body.ts +78 -0
  123. package/templates/fitness-gym/tier5-src/_shared/rich-content-link.ts +34 -0
  124. package/templates/fitness-gym/tier5-src/_shared/sign-in-sheet.ts +18 -0
  125. package/templates/fitness-gym/tier5-src/_shared/staff-name.ts +18 -0
  126. package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +107 -0
  127. package/templates/fitness-gym/tier5-src/_shared/wix-bi.ts +85 -0
  128. package/templates/fitness-gym/tier5-src/_shared/wix-member-links.ts +114 -0
  129. package/templates/fitness-gym/tier5-src/_shared/wix-service-price.ts +146 -0
  130. package/templates/fitness-gym/tier5-src/business-chat/index.ts +732 -0
  131. package/templates/fitness-gym/tier5-src/business-contact/index.ts +6 -0
  132. package/templates/fitness-gym/tier5-src/himi-booking-account/index.ts +267 -0
  133. package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +468 -0
  134. package/templates/fitness-gym/tier5-src/himi-booking-service/index.ts +1190 -0
  135. package/templates/fitness-gym/tier5-src/himi-booking-services/index.ts +791 -0
  136. package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1729 -0
  137. package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
  138. package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +656 -0
  139. package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
  140. package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +495 -0
  141. package/templates/fitness-gym/tier5-src/himi-branded-lite-program/facts.ts +52 -0
  142. package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +845 -0
  143. package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +190 -0
  144. package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +619 -0
  145. package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +1007 -0
  146. package/templates/fitness-gym/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
  147. package/templates/fitness-gym/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
  148. package/templates/fitness-gym/tokens.json +414 -0
  149. package/templates/gym-fitness/dev/index.ts +1 -1
  150. package/templates/gym-fitness/l10n/en.json +1 -1
  151. package/templates/gym-fitness/tier5-src/_shared/program-fields.ts +16 -0
  152. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +5 -8
  153. package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  154. package/templates/medical-services/dev/index.ts +2 -1
  155. package/templates/medical-services/tier5-src/himi-booking-account/index.ts +16 -1
  156. package/templates/nonprofit-cause/l10n/en.json +1 -1
  157. package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +16 -0
  158. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +5 -8
  159. package/templates/personal-fitness-trainer/dev/index.ts +2 -2
  160. package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  161. package/templates/podcast-creator/dev/index.ts +100 -0
  162. package/templates/podcast-creator/l10n/en.json +22 -1
  163. package/templates/podcast-creator/l10n/es.json +22 -0
  164. package/templates/podcast-creator/l10n/fr.json +18 -0
  165. package/templates/podcast-creator/l10n/he.json +15 -0
  166. package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +16 -0
  167. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +5 -8
  168. package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
  169. package/templates/portfolio-creative/l10n/en.json +1 -1
  170. package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +16 -0
  171. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +5 -8
  172. package/templates/restaurant/l10n/en.json +1 -1
  173. package/templates/restaurant/tier5-src/_shared/program-fields.ts +16 -0
  174. package/templates/restaurant/tier5-src/_shared/programs-section.ts +5 -8
  175. package/templates/retail-store/l10n/en.json +1 -1
  176. package/templates/retail-store/tier5-src/_shared/program-fields.ts +16 -0
  177. package/templates/retail-store/tier5-src/_shared/programs-section.ts +5 -8
  178. package/templates/salon-spa/dev/index.ts +1 -1
  179. package/templates/salon-spa/tier5-src/himi-booking-account/index.ts +16 -1
  180. package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
  181. package/templates/yoga-studio/dev/index.ts +1 -1
  182. package/templates/yoga-studio/l10n/en.json +1 -1
  183. package/templates/yoga-studio/tier5-src/_shared/program-fields.ts +16 -0
  184. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +5 -8
  185. package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
@@ -478,8 +478,8 @@ function deeperThan(nodes, depth, max) {
478
478
  var isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
479
479
  function ricosToPlainText(doc) {
480
480
  const kids = (v) => Array.isArray(v) ? v.filter(isObj) : [];
481
- const inline = (node3) => typeof node3.textData?.text === "string" ? node3.textData.text : kids(node3.nodes).map(inline).join("");
482
- const blocks = (nodes) => nodes.flatMap((node3) => node3.type === "PARAGRAPH" || node3.type === "HEADING" || node3.type === "TEXT" ? [inline(node3)] : blocks(kids(node3.nodes)));
481
+ const inline = (node4) => typeof node4.textData?.text === "string" ? node4.textData.text : kids(node4.nodes).map(inline).join("");
482
+ const blocks = (nodes) => nodes.flatMap((node4) => node4.type === "PARAGRAPH" || node4.type === "HEADING" || node4.type === "TEXT" ? [inline(node4)] : blocks(kids(node4.nodes)));
483
483
  return blocks(kids(doc?.nodes)).join("\n\n");
484
484
  }
485
485
  function plainTextToRicos(text2) {
@@ -554,29 +554,29 @@ function cleanNodes(nodes, base, depth, ctx, parentType) {
554
554
  if (!isObj(raw)) continue;
555
555
  if (depth > RICH_CONTENT_LIMITS.maxDepth) throw TOO_DEEP;
556
556
  const path = base === "" ? String(out.length) : `${base}.${out.length}`;
557
- const node3 = cleanNode({ ...raw }, path, depth, ctx, parentType);
558
- if (node3) out.push(node3);
557
+ const node4 = cleanNode({ ...raw }, path, depth, ctx, parentType);
558
+ if (node4) out.push(node4);
559
559
  }
560
560
  return out;
561
561
  }
562
- function cleanNode(node3, path, depth, ctx, parentType) {
563
- if (node3.type === "TEXT") {
564
- const decorations = node3.textData?.decorations;
562
+ function cleanNode(node4, path, depth, ctx, parentType) {
563
+ if (node4.type === "TEXT") {
564
+ const decorations = node4.textData?.decorations;
565
565
  if (Array.isArray(decorations)) {
566
566
  const kept = decorations.flatMap((d) => {
567
567
  if (!(isObj(d) && d.type === "LINK")) return [d];
568
568
  const next = rewriteAt(d, LINK_DECORATION_URL, cleanLink);
569
569
  return getAt(next, LINK_DECORATION_URL) === void 0 ? [] : [next];
570
570
  });
571
- node3.textData = { ...node3.textData, decorations: kept };
571
+ node4.textData = { ...node4.textData, decorations: kept };
572
572
  }
573
- } else if (node3.type === "IMAGE") {
574
- const data = isObj(node3.imageData) ? node3.imageData : {};
573
+ } else if (node4.type === "IMAGE") {
574
+ const data = isObj(node4.imageData) ? node4.imageData : {};
575
575
  const url = ricosImageUrl(data, ctx.imageWidth);
576
576
  if (!url) return null;
577
- node3.imageData = { ...data, image: { ...isObj(data.image) ? data.image : {}, src: { url } } };
578
- } else if (node3.type === "GALLERY") {
579
- const data = isObj(node3.galleryData) ? node3.galleryData : {};
577
+ node4.imageData = { ...data, image: { ...isObj(data.image) ? data.image : {}, src: { url } } };
578
+ } else if (node4.type === "GALLERY") {
579
+ const data = isObj(node4.galleryData) ? node4.galleryData : {};
580
580
  const items = (Array.isArray(data.items) ? data.items : []).flatMap((item) => {
581
581
  if (!isObj(item) || !isObj(item.image)) return [];
582
582
  const media = isObj(item.image.media) ? item.image.media : {};
@@ -584,9 +584,9 @@ function cleanNode(node3, path, depth, ctx, parentType) {
584
584
  return url ? [{ ...item, image: { ...item.image, media: { ...media, src: { url } } } }] : [];
585
585
  });
586
586
  if (items.length === 0) return null;
587
- node3.galleryData = { ...data, items };
588
- } else if (node3.type === "VIDEO") {
589
- const data = isObj(node3.videoData) ? { ...node3.videoData } : {};
587
+ node4.galleryData = { ...data, items };
588
+ } else if (node4.type === "VIDEO") {
589
+ const data = isObj(node4.videoData) ? { ...node4.videoData } : {};
590
590
  const video = isObj(data.video) ? data.video : {};
591
591
  const url = ricosVideoUrl(video.src);
592
592
  if (!url) return null;
@@ -594,32 +594,32 @@ function cleanNode(node3, path, depth, ctx, parentType) {
594
594
  const poster = ricosImageUrl({ image: data.thumbnail }, ctx.tileWidth);
595
595
  if (poster) data.thumbnail = { ...data.thumbnail, src: { url: poster } };
596
596
  else delete data.thumbnail;
597
- node3.videoData = data;
598
- } else if (node3.type === "BUTTON" || node3.type === "LINK_BUTTON") {
599
- node3.buttonData = rewriteAt(node3.buttonData, BUTTON_URL, cleanLink);
600
- if (getAt(node3.buttonData, BUTTON_URL) === void 0) return null;
601
- } else if (node3.type === "HTML") {
602
- node3.htmlData = rewriteAt(node3.htmlData, ["html"], drop);
603
- } else if (node3.type === "EMBED") {
604
- node3.embedData = rewriteAt(node3.embedData, ["oembed", "html"], drop);
605
- }
606
- for (const [field, ...rest] of (typeof node3.type === "string" ? LINK_FIELDS[node3.type] : void 0) ?? []) {
607
- if (field in node3) node3[field] = rewriteAt(node3[field], rest, cleanLink);
597
+ node4.videoData = data;
598
+ } else if (node4.type === "BUTTON" || node4.type === "LINK_BUTTON") {
599
+ node4.buttonData = rewriteAt(node4.buttonData, BUTTON_URL, cleanLink);
600
+ if (getAt(node4.buttonData, BUTTON_URL) === void 0) return null;
601
+ } else if (node4.type === "HTML") {
602
+ node4.htmlData = rewriteAt(node4.htmlData, ["html"], drop);
603
+ } else if (node4.type === "EMBED") {
604
+ node4.embedData = rewriteAt(node4.embedData, ["oembed", "html"], drop);
605
+ }
606
+ for (const [field, ...rest] of (typeof node4.type === "string" ? LINK_FIELDS[node4.type] : void 0) ?? []) {
607
+ if (field in node4) node4[field] = rewriteAt(node4[field], rest, cleanLink);
608
608
  }
609
609
  const inBlocks = holdsBlocks(parentType);
610
- if (node3.type !== "TEXT" || inBlocks) {
611
- const own = typeof node3.id === "string" ? node3.id : "";
610
+ if (node4.type !== "TEXT" || inBlocks) {
611
+ const own = typeof node4.id === "string" ? node4.id : "";
612
612
  const usable = own !== "" && !unusableId(own);
613
- if (inBlocks && !isWrapper(node3.type)) {
613
+ if (inBlocks && !isWrapper(node4.type)) {
614
614
  if (usable && !ctx.ids.has(own)) ctx.ids.add(own);
615
- else node3.id = path;
616
- } else if (!usable) node3.id = path;
615
+ else node4.id = path;
616
+ } else if (!usable) node4.id = path;
617
617
  }
618
- if (Array.isArray(node3.nodes)) node3.nodes = cleanNodes(node3.nodes, path, depth + 1, ctx, typeof node3.type === "string" ? node3.type : "");
619
- return node3;
618
+ if (Array.isArray(node4.nodes)) node4.nodes = cleanNodes(node4.nodes, path, depth + 1, ctx, typeof node4.type === "string" ? node4.type : "");
619
+ return node4;
620
620
  }
621
621
  function countNodes(nodes) {
622
- return nodes.reduce((n, node3) => isObj(node3) ? n + 1 + (Array.isArray(node3.nodes) ? countNodes(node3.nodes) : 0) : n, 0);
622
+ return nodes.reduce((n, node4) => isObj(node4) ? n + 1 + (Array.isArray(node4.nodes) ? countNodes(node4.nodes) : 0) : n, 0);
623
623
  }
624
624
  function canonicalJson(v, depth, max) {
625
625
  if (depth > max) throw TOO_DEEP;
@@ -674,18 +674,18 @@ function normalizeWebsiteLinks(nodes) {
674
674
  GIF: [["gifData", "original", "gif"]],
675
675
  IMAGE: [["imageData", "link", "url"]]
676
676
  };
677
- for (const node3 of nodes) {
678
- for (const path of linkFields[node3.type ?? ""] ?? []) {
679
- const parent = object(path.slice(0, -1).reduce((value, key2) => object(value)[key2], node3));
677
+ for (const node4 of nodes) {
678
+ for (const path of linkFields[node4.type ?? ""] ?? []) {
679
+ const parent = object(path.slice(0, -1).reduce((value, key2) => object(value)[key2], node4));
680
680
  const key = path[path.length - 1];
681
681
  const holder = { url: parent[key] };
682
682
  normalize(holder);
683
683
  if (typeof holder.url === "string") parent[key] = holder.url;
684
684
  }
685
- if (Array.isArray(node3.textData?.decorations)) for (const decoration of node3.textData.decorations) {
685
+ if (Array.isArray(node4.textData?.decorations)) for (const decoration of node4.textData.decorations) {
686
686
  if (object(decoration).type === "LINK") normalize(object(object(decoration).linkData).link);
687
687
  }
688
- if (Array.isArray(node3.nodes)) changed += normalizeWebsiteLinks(node3.nodes);
688
+ if (Array.isArray(node4.nodes)) changed += normalizeWebsiteLinks(node4.nodes);
689
689
  }
690
690
  return changed;
691
691
  }
@@ -978,7 +978,6 @@ var copy_generated_default = {
978
978
  "auth.gate.forgotPassword": "Forgot password?",
979
979
  "auth.gate.backToSignIn": "Back to sign in",
980
980
  "auth.gate.continueWith": "Continue with {provider}",
981
- "auth.gate.sendCodeVia": "Send code via",
982
981
  "auth.gate.resendCode": "Didn't get it? Resend code",
983
982
  "auth.gate.field.code": "Verification code",
984
983
  "auth.gate.pushWaiting": "Approve the sign-in on your other device.",
@@ -990,6 +989,19 @@ var copy_generated_default = {
990
989
  "auth.gate.password.hide": "Hide password",
991
990
  "auth.gate.notice.codeResent": "A new code was sent.",
992
991
  "auth.gate.notice.codeSentVia": "Code sent via {method}.",
992
+ "auth.gate.tryAnotherWay": "Try another way",
993
+ "auth.gate.chooseAnotherWay": "Choose another way to verify",
994
+ "auth.gate.method.sms": "SMS",
995
+ "auth.gate.method.voice": "Phone call",
996
+ "auth.gate.method.totp": "Authenticator app",
997
+ "auth.gate.method.push": "Approve on another device",
998
+ "auth.gate.codePrompt.sms": "We sent a code by SMS to {destination}.",
999
+ "auth.gate.codePrompt.smsNoHint": "We sent a code to your phone by SMS.",
1000
+ "auth.gate.codePrompt.voice": "We're calling {destination} to read you a code.",
1001
+ "auth.gate.codePrompt.voiceNoHint": "We're calling your phone to read you a code.",
1002
+ "auth.gate.codePrompt.email": "We sent a code to {destination}.",
1003
+ "auth.gate.codePrompt.emailNoHint": "We sent a code to your email.",
1004
+ "auth.gate.codePrompt.totp": "Enter the code from your authenticator app.",
993
1005
  "auth.gate.notice.resetSent": "If that email is registered, a reset link is on its way.",
994
1006
  "auth.biometric.unlockWith": "Unlock with {method}",
995
1007
  "auth.biometric.orPassword": "or sign in with your password",
@@ -1061,6 +1073,9 @@ var copy_generated_default = {
1061
1073
  "auth.feedback.totp": "That code did not work. Enter the current code from your authenticator app.",
1062
1074
  "auth.feedback.network": "We could not connect. Check your connection and try again.",
1063
1075
  "auth.feedback.rate_limited": "Too many attempts. Wait a few minutes and try again.",
1076
+ "auth.feedback.delivery_failed": "We couldn't send the code. Try again, or try another way.",
1077
+ "auth.feedback.sms_region_unsupported": "SMS codes aren't available in your region. Try another way.",
1078
+ "auth.feedback.verification_expired": "This verification has expired. Go back and sign in again.",
1064
1079
  "auth.feedback.unavailable": "This action is not available here. Use a supported sign-in method or open the app.",
1065
1080
  "auth.feedback.cancelled": "Sign-in was cancelled. Try again when you are ready.",
1066
1081
  "auth.feedback.verification_required": "Complete verification to continue, then try again.",
@@ -1090,6 +1105,11 @@ var failureKeys = {
1090
1105
  unavailable: "auth.feedback.unavailable",
1091
1106
  cancelled: "auth.feedback.cancelled",
1092
1107
  verification_required: "auth.feedback.verification_required",
1108
+ // A second factor's code could not be sent, SMS is not offered in the region, or the pending
1109
+ // verification expired (Wix legacy 2FA 8034 / 8056 / 8002 — the native engines raise them).
1110
+ delivery_failed: "auth.feedback.delivery_failed",
1111
+ sms_region_unsupported: "auth.feedback.sms_region_unsupported",
1112
+ verification_expired: "auth.feedback.verification_expired",
1093
1113
  unknown: "auth.feedback.unknown"
1094
1114
  };
1095
1115
  var codes = new Set(Object.keys(failureKeys));
@@ -1107,7 +1127,12 @@ var aliases = {
1107
1127
  RECAPTCHA_REQUIRED: "verification_required",
1108
1128
  INVALID_CODE: "invalid_code",
1109
1129
  EXPIRED_CODE: "expired_code",
1110
- TOO_MANY_REQUESTS: "rate_limited"
1130
+ TOO_MANY_REQUESTS: "rate_limited",
1131
+ // The TS WixNativeAuthEngine's legacy-2FA kinds (8004 / 8034 / 8056 / 8002).
1132
+ rateLimited: "rate_limited",
1133
+ deliveryFailed: "delivery_failed",
1134
+ smsRegionUnsupported: "sms_region_unsupported",
1135
+ verificationExpired: "verification_expired"
1111
1136
  };
1112
1137
  var iamCredentialCodes = /* @__PURE__ */ new Set(["-19999", "-19976"]);
1113
1138
  function authMessage(key, translate) {
@@ -1118,14 +1143,14 @@ function authFailure(raw, operation = "signIn", translate) {
1118
1143
  const value = raw && typeof raw === "object" ? raw : {};
1119
1144
  const payload = value.payload && typeof value.payload === "object" ? value.payload : value;
1120
1145
  const named = payload.code ?? value.code ?? value.kind;
1121
- const status = value.statusCode ?? value.status;
1146
+ const status2 = value.statusCode ?? value.status;
1122
1147
  const application = String(payload.details?.applicationError?.code ?? value.details?.applicationError?.code ?? payload.applicationCode ?? value.applicationCode ?? named ?? "");
1123
1148
  let code = codes.has(named) ? named : aliases[named] ?? "unknown";
1124
1149
  if (operation === "signIn" && iamCredentialCodes.has(application)) code = "invalid_credentials";
1125
- else if (status === 429) code = "rate_limited";
1126
- else if ([404, 405, 501].includes(status)) code = "unavailable";
1127
- else if ([401, 403].includes(status) && operation === "signIn") code = "invalid_credentials";
1128
- else if (status === 0 || status >= 500 || value.name === "TypeError" || value.name === "TimeoutError") code = "network";
1150
+ else if (status2 === 429) code = "rate_limited";
1151
+ else if ([404, 405, 501].includes(status2)) code = "unavailable";
1152
+ else if ([401, 403].includes(status2) && operation === "signIn") code = "invalid_credentials";
1153
+ else if (status2 === 0 || status2 >= 500 || value.name === "TypeError" || value.name === "TimeoutError") code = "network";
1129
1154
  if (operation === "verify" && code === "invalid_credentials") code = "invalid_code";
1130
1155
  if (operation === "register" && code === "invalid_credentials") code = "registration_failed";
1131
1156
  return { code, reason: authMessage(failureKeys[code], translate) };
@@ -1159,9 +1184,9 @@ function emailOf(raw) {
1159
1184
  return typeof email === "string" ? email : "";
1160
1185
  }
1161
1186
  function reportedOk(raw) {
1162
- const status = raw?.status;
1163
- if (typeof status !== "string") return true;
1164
- return status === "ok" || status === "success";
1187
+ const status2 = raw?.status;
1188
+ if (typeof status2 !== "string") return true;
1189
+ return status2 === "ok" || status2 === "success";
1165
1190
  }
1166
1191
  async function authState(opts) {
1167
1192
  try {
@@ -1523,6 +1548,644 @@ function createInviteService(opts) {
1523
1548
  return svc;
1524
1549
  }
1525
1550
 
1551
+ // ../../stdlib/flows/screens/src/podcast.ts
1552
+ var PODCAST_FEED_ENDPOINT = "https://podcasts.wix.com/api/feed/graphql";
1553
+ var PODCAST_EPISODES_QUERY = `
1554
+ query PodcastEpisodes($url: String!, $limit: Int) {
1555
+ episodes(url: $url, limit: $limit) {
1556
+ id title date duration image descriptionExcerpt(length: 220) playback { url type length }
1557
+ }
1558
+ }
1559
+ `;
1560
+ var MAX_URL_LENGTH = 2048;
1561
+ var CONTROL = /[\u0000- \u007f]/;
1562
+ function publicHttpHost(raw) {
1563
+ if (!raw || raw.length > MAX_URL_LENGTH || CONTROL.test(raw)) return "";
1564
+ const match = /^https?:\/\/([^/?#]*)/i.exec(raw);
1565
+ const authority = match?.[1] ?? "";
1566
+ if (!authority || authority.includes("@")) return "";
1567
+ const parts = /^([a-z0-9.-]+)(?::([0-9]+))?$/i.exec(authority);
1568
+ if (!parts || parts[2] && (Number(parts[2]) < 1 || Number(parts[2]) > 65535)) return "";
1569
+ const host = parts[1].toLowerCase();
1570
+ if (host.split(".").some((label) => !/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(label))) return "";
1571
+ if (/\d$/.test(host)) {
1572
+ const octets = host.split(".");
1573
+ if (octets.length !== 4 || octets.some((part) => !/^(?:0|[1-9][0-9]{0,2})$/.test(part) || Number(part) > 255)) return "";
1574
+ }
1575
+ return host;
1576
+ }
1577
+ function isPrivateHost(host) {
1578
+ if (host.startsWith("[")) return true;
1579
+ if (host === "localhost" || /\.(?:localhost|local|internal|lan|home|arpa)$/.test(host) || !host.includes(".")) return true;
1580
+ const ip = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(host);
1581
+ if (!ip) return false;
1582
+ const [a, b] = [Number(ip[1]), Number(ip[2])];
1583
+ return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a >= 224;
1584
+ }
1585
+ function podcastFeedUrl(raw) {
1586
+ const url = typeof raw === "string" ? raw.trim() : "";
1587
+ if (!url) return { ok: false, code: "feed_not_configured" };
1588
+ const host = publicHttpHost(url);
1589
+ return host && !isPrivateHost(host) ? { ok: true, url } : { ok: false, code: "invalid_feed_url" };
1590
+ }
1591
+ function podcastAudioUrl(raw) {
1592
+ const url = typeof raw === "string" ? raw.trim() : "";
1593
+ const host = publicHttpHost(url);
1594
+ return /^https:\/\//i.test(url) && host && !isPrivateHost(host) ? url : "";
1595
+ }
1596
+ function podcastFeedRequest(feedUrl, limit = 40) {
1597
+ return { query: PODCAST_EPISODES_QUERY, variables: { url: feedUrl, limit: Math.max(1, Math.min(100, Math.trunc(limit) || 40)) } };
1598
+ }
1599
+ function podcastDurationMs(value) {
1600
+ const raw = typeof value === "string" ? value.trim() : typeof value === "number" ? String(value) : "";
1601
+ if (/^\d+$/.test(raw)) return Number(raw) * 1e3;
1602
+ const pieces = raw.split(":");
1603
+ if (pieces.length < 2 || pieces.length > 3 || !pieces.every((p) => /^\d+$/.test(p))) return 0;
1604
+ return pieces.map(Number).reduce((total, piece) => total * 60 + piece, 0) * 1e3;
1605
+ }
1606
+ var plain = (value) => typeof value === "string" ? value.replace(/<[^>]*>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/\s+/g, " ").trim() : "";
1607
+ function mapPodcastFeed(response, describe = plain) {
1608
+ if (!response || typeof response !== "object") return { ok: false, code: "feed_malformed" };
1609
+ const body = response;
1610
+ if (Array.isArray(body.errors) && body.errors.length) return { ok: false, code: "feed_unavailable" };
1611
+ const raw = body.data?.episodes ?? body.episodes;
1612
+ if (!Array.isArray(raw)) return { ok: false, code: "feed_malformed" };
1613
+ const episodes = [];
1614
+ const seen = /* @__PURE__ */ new Set();
1615
+ let unplayable = 0;
1616
+ for (const item of raw) {
1617
+ const audioUrl = podcastAudioUrl(item?.playback?.url);
1618
+ if (!audioUrl) {
1619
+ unplayable++;
1620
+ continue;
1621
+ }
1622
+ const id2 = (typeof item.id === "string" && item.id.trim() ? item.id.trim() : audioUrl).slice(0, 512);
1623
+ if (seen.has(id2)) continue;
1624
+ seen.add(id2);
1625
+ episodes.push({
1626
+ id: id2,
1627
+ title: plain(item.title) || "Episode",
1628
+ date: typeof item.date === "string" ? item.date : "",
1629
+ durationMs: podcastDurationMs(item.duration),
1630
+ image: podcastAudioUrl(item.image),
1631
+ description: describe(item.descriptionExcerpt),
1632
+ audioUrl,
1633
+ mimeType: typeof item.playback?.type === "string" ? item.playback.type : ""
1634
+ });
1635
+ }
1636
+ return { ok: true, episodes, unplayable };
1637
+ }
1638
+ var node2 = (id2, type, props, modifiers) => ({ id: id2, body: { package: "himalaya", type, props }, ...modifiers ? { modifiers } : {} });
1639
+ var PODCAST_SCREEN_CAPABILITIES = ["wix_api", "media_playback"];
1640
+ function podcastFeedSetting(raw) {
1641
+ const configured = podcastFeedUrl(raw);
1642
+ if (!configured.ok && configured.code === "invalid_feed_url") {
1643
+ throw Object.assign(new Error("Podcasts requires a public feed URL without credentials."), { code: configured.code });
1644
+ }
1645
+ return configured.ok ? configured.url : "";
1646
+ }
1647
+ function podcastScreen(opts) {
1648
+ const feedUrl = podcastFeedSetting(opts.feedUrl);
1649
+ const s2 = opts.service ?? "podcast";
1650
+ const id2 = opts.screenId ?? "podcasts";
1651
+ const c = {
1652
+ title: "Episodes",
1653
+ queue: "Add to queue",
1654
+ retry: "Try again",
1655
+ previous: "Previous episode",
1656
+ next: "Next episode",
1657
+ back: "Back 15 seconds",
1658
+ forward: "Forward 30 seconds",
1659
+ seek: "Playback position",
1660
+ ...opts.copy
1661
+ };
1662
+ const bind = (field) => `$service:${s2}.${field}`;
1663
+ const act = (action2, params) => ({ actionId: `tier5.${s2}.${action2}`, ...params ? { params } : {} });
1664
+ const text2 = (key, value, style, extra = {}) => node2(`${id2}.${key}`, "Text", { text: value, style, collapseWhenEmpty: true, ...extra });
1665
+ const hiddenWhen = (n, field) => ({ ...n, modifiers: { ...n.modifiers ?? {}, hiddenPath: bind(field) } });
1666
+ const iconButton = (key, icon, label, action2) => node2(`${id2}.${key}`, "Button", { title: label, leadingIcon: icon, iconOnly: true, style: "plain", action: action2 });
1667
+ const row = node2(`${id2}.episode`, "ListItem", {
1668
+ title: "$item.title",
1669
+ subtitle: "$item.subtitle",
1670
+ overline: "$item.progressLabel",
1671
+ leading: node2(`${id2}.episode_art`, "Image", { url: "$item.image", initials: "P", width: 56, height: 56, contentMode: "fill", shape: "rounded", contentDescription: "$item.title" }),
1672
+ trailing: iconButton("episode_queue", "list", c.queue, act("queueEpisode", { id: "$item.id" })),
1673
+ onTap: act("playEpisode", { id: "$item.id" })
1674
+ }, { accessibilityLabel: "$item.title" });
1675
+ const list = node2(`${id2}.episodes`, "LazyList", { itemsPath: bind("episodes"), items: [row], spacing: 0 });
1676
+ const feedStatus = node2(`${id2}.feed_status`, "VStack", { spacing: 8, alignment: "leading", children: [
1677
+ text2("feed_message", bind("emptyText"), "body", { color: "textSecondary" }),
1678
+ hiddenWhen(node2(`${id2}.feed_retry`, "Button", { title: c.retry, style: "secondary", action: act("retryFeed") }), "hideFeedRetry")
1679
+ ] });
1680
+ const payload = node2(`${id2}.root`, "VStack", { spacing: 16, alignment: "leading", children: [
1681
+ text2("title", c.title, "title1"),
1682
+ list,
1683
+ feedStatus
1684
+ ] }, { padding: { leading: 16, trailing: 16, top: 16, bottom: 24 }, onAppear: act("load", { feedUrl }) });
1685
+ const player = hiddenWhen(node2(`${id2}.player`, "VStack", { spacing: 8, alignment: "leading", children: [
1686
+ text2("now_title", bind("nowTitle"), "body", { maxLines: 1 }),
1687
+ text2("now_subtitle", bind("nowSubtitle"), "caption", { color: "textSecondary", maxLines: 1 }),
1688
+ node2(
1689
+ `${id2}.scrubber`,
1690
+ "Slider",
1691
+ { value: 0, min: 0, max: 1, step: 1e-3, valuePath: bind("progress"), debounceMs: 250, onChange: act("seek") },
1692
+ { accessibilityLabel: c.seek, accessibilityValue: bind("progressLabel") }
1693
+ ),
1694
+ text2("progress", bind("progressLabel"), "caption", { color: "textSecondary" }),
1695
+ node2(`${id2}.controls`, "HStack", { spacing: 8, children: [
1696
+ iconButton("previous", "skip_previous", c.previous, act("previousEpisode")),
1697
+ iconButton("back", "undo", c.back, act("seekBy", { deltaMs: "-15000" })),
1698
+ node2(`${id2}.toggle`, "Button", { title: bind("playLabel"), leadingIcon: bind("playIcon"), style: "primary", action: act("togglePlay") }),
1699
+ iconButton("forward", "refresh", c.forward, act("seekBy", { deltaMs: "30000" })),
1700
+ iconButton("next", "skip_next", c.next, act("nextEpisode"))
1701
+ ] }),
1702
+ hiddenWhen(node2(`${id2}.playback_error`, "VStack", { spacing: 6, alignment: "leading", children: [
1703
+ text2("playback_error_text", bind("playbackErrorText"), "caption", { color: "danger" }),
1704
+ hiddenWhen(node2(`${id2}.playback_retry`, "Button", { title: c.retry, style: "secondary", action: act("retryPlayback") }), "hidePlaybackRetry")
1705
+ ] }), "hidePlaybackError")
1706
+ ] }, { background: { token: "surfaceSecondary" }, padding: { leading: 16, trailing: 16, top: 10, bottom: 12 } }), "hidePlayer");
1707
+ return {
1708
+ screenId: id2,
1709
+ renderer: "sdui_intent",
1710
+ title: c.title,
1711
+ schemaVersion: 1,
1712
+ cacheControl: { maxAge: 0, staleWhileRevalidate: 0 },
1713
+ logicBundle: { url: opts.bundleUrl, integrity: "", declaredCapabilities: [...PODCAST_SCREEN_CAPABILITIES] },
1714
+ payload,
1715
+ stickyFooter: player
1716
+ };
1717
+ }
1718
+
1719
+ // ../../core/sdk/media-playback/src/index.ts
1720
+ function encodeItem(item) {
1721
+ if (!item?.id || !item?.url) throw new Error("media-playback: queue item id and url are required");
1722
+ return JSON.stringify(item);
1723
+ }
1724
+ function decodeStatus(raw) {
1725
+ return {
1726
+ state: raw?.state ?? "idle",
1727
+ currentItem: raw?.currentItem ?? null,
1728
+ currentIndex: typeof raw?.currentIndex === "number" ? raw.currentIndex : -1,
1729
+ positionMs: typeof raw?.positionMs === "number" ? raw.positionMs : 0,
1730
+ durationMs: typeof raw?.durationMs === "number" ? raw.durationMs : 0,
1731
+ rate: typeof raw?.rate === "number" ? raw.rate : 1,
1732
+ bufferedMs: typeof raw?.bufferedMs === "number" ? raw.bufferedMs : 0,
1733
+ queue: Array.isArray(raw?.queue) ? raw.queue : [],
1734
+ error: raw?.error,
1735
+ ...typeof raw?.resumedFromMs === "number" ? { resumedFromMs: raw.resumedFromMs } : {}
1736
+ };
1737
+ }
1738
+ function isSessionRef(value) {
1739
+ return Boolean(value && typeof value === "object" && typeof value.sessionId === "string");
1740
+ }
1741
+ async function setQueue(items, options = {}) {
1742
+ if (!Array.isArray(items)) throw new Error("media-playback.setQueue: items must be an array");
1743
+ const persist = options.persistPosition === true;
1744
+ const r = await dispatch("capability.media_playback.setQueue", {
1745
+ items: JSON.stringify(items),
1746
+ startIndex: String(options.startIndex ?? 0),
1747
+ // With persistPosition, an ABSENT start position is how the host knows to resume from
1748
+ // the saved one — so it is only omitted then. Every other caller sends what it always did.
1749
+ ...persist && options.startPositionMs === void 0 ? {} : { startPositionMs: String(options.startPositionMs ?? 0) },
1750
+ autoplay: String(options.autoplay === true),
1751
+ ...options.onStatus ? { onStatus: options.onStatus } : {},
1752
+ ...encodeSessionOptions(options)
1753
+ });
1754
+ return decodeStatus(r);
1755
+ }
1756
+ function positiveSeconds(value) {
1757
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.round(value) : void 0;
1758
+ }
1759
+ function encodeSessionOptions(options) {
1760
+ const out = {};
1761
+ const forward = positiveSeconds(options.skipIntervals?.forwardSec);
1762
+ const backward = positiveSeconds(options.skipIntervals?.backwardSec);
1763
+ if (forward !== void 0) out.skipForwardSec = String(forward);
1764
+ if (backward !== void 0) out.skipBackwardSec = String(backward);
1765
+ const rates = (options.playbackRates ?? []).filter((r) => typeof r === "number" && Number.isFinite(r)).map((r) => Math.min(3, Math.max(0.5, r)));
1766
+ if (rates.length) out.playbackRates = [...new Set(rates)].sort((a, b) => a - b).join(",");
1767
+ if (options.persistPosition === true) out.persistPosition = "true";
1768
+ if (options.persistPosition === true && options.startPositionIsFallback === true && options.startPositionMs !== void 0) {
1769
+ out.startPositionFallback = "true";
1770
+ }
1771
+ return out;
1772
+ }
1773
+ async function subscribeStatus(handler) {
1774
+ if (!handler.includes(".")) {
1775
+ throw new Error('media-playback.subscribeStatus: handler must be "<service>.<action>"');
1776
+ }
1777
+ await dispatch("capability.media_playback.subscribeStatus", { onStatus: handler });
1778
+ }
1779
+ async function play(target2) {
1780
+ if (isSessionRef(target2)) {
1781
+ await dispatch("capability.media_playback.play", target2);
1782
+ return;
1783
+ }
1784
+ const params = target2 ? { item: encodeItem(target2) } : {};
1785
+ const r = await dispatch("capability.media_playback.play", params);
1786
+ return decodeStatus(r);
1787
+ }
1788
+ async function pause(ref) {
1789
+ if (isSessionRef(ref)) {
1790
+ await dispatch("capability.media_playback.pause", ref);
1791
+ return;
1792
+ }
1793
+ const r = await dispatch("capability.media_playback.pause");
1794
+ return decodeStatus(r);
1795
+ }
1796
+ async function seek(positionMs) {
1797
+ const r = await dispatch("capability.media_playback.seek", { positionMs: String(Math.max(0, Math.trunc(positionMs || 0))) });
1798
+ return decodeStatus(r);
1799
+ }
1800
+ async function skip(delta) {
1801
+ const r = await dispatch("capability.media_playback.skip", { delta: String(Math.trunc(delta || 0)) });
1802
+ return decodeStatus(r);
1803
+ }
1804
+ async function status() {
1805
+ const r = await dispatch("capability.media_playback.status");
1806
+ return decodeStatus(r);
1807
+ }
1808
+
1809
+ // ../../stdlib/flows/screens/src/podcast-service.ts
1810
+ var DEFAULT_MESSAGES = {
1811
+ notConfigured: "No episodes yet \u2014 check back soon.",
1812
+ empty: "No episodes yet \u2014 check back soon.",
1813
+ noPlayable: "No playable episodes are available in this feed.",
1814
+ feedUnavailable: "Podcast episodes could not be loaded. Try again.",
1815
+ invalidFeed: "This podcast feed is not available.",
1816
+ noAudio: "This episode has no audio.",
1817
+ mediaFailed: "This episode could not be played. Try again.",
1818
+ queueEmpty: "Queue is empty",
1819
+ play: "Play",
1820
+ pause: "Pause",
1821
+ queueOne: "{count} episode in queue",
1822
+ queueMany: "{count} episodes in queue",
1823
+ resume: "Continue at {time}"
1824
+ };
1825
+ function memory(initial) {
1826
+ let value = initial;
1827
+ return { read: () => value, write: (next) => {
1828
+ value = next;
1829
+ } };
1830
+ }
1831
+ function clock(ms) {
1832
+ const seconds = Math.max(0, Math.round(ms / 1e3));
1833
+ const hours = Math.floor(seconds / 3600);
1834
+ const minutes = Math.floor(seconds % 3600 / 60);
1835
+ const rest = String(seconds % 60).padStart(2, "0");
1836
+ return hours ? `${hours}:${String(minutes).padStart(2, "0")}:${rest}` : `${minutes}:${rest}`;
1837
+ }
1838
+ function dateLabel(iso) {
1839
+ const parsed = iso ? Date.parse(iso) : NaN;
1840
+ return Number.isFinite(parsed) ? new Date(parsed).toLocaleDateString(void 0, { month: "short", day: "numeric" }) : "";
1841
+ }
1842
+ function toRow(episode) {
1843
+ return {
1844
+ id: episode.id,
1845
+ title: episode.title,
1846
+ subtitle: [dateLabel(episode.date), episode.durationMs ? clock(episode.durationMs) : ""].filter(Boolean).join(" \xB7 "),
1847
+ image: episode.image,
1848
+ description: episode.description,
1849
+ audioUrl: episode.audioUrl,
1850
+ durationMs: episode.durationMs,
1851
+ progressLabel: ""
1852
+ };
1853
+ }
1854
+ var SUPERSEDED_PLAYBACK = { code: "podcast_command_superseded" };
1855
+ var isSupersededPlayback = (error) => !!error && typeof error === "object" && error.code === SUPERSEDED_PLAYBACK.code;
1856
+ var idOf = (arg) => typeof arg === "string" ? arg : String(arg?.id ?? "");
1857
+ var numberOf = (arg, key) => {
1858
+ const raw = typeof arg === "number" || typeof arg === "string" ? arg : arg?.[key];
1859
+ const n = typeof raw === "number" ? raw : Number(raw);
1860
+ return Number.isFinite(n) ? n : NaN;
1861
+ };
1862
+ function createPodcastService(opts = {}) {
1863
+ const name = opts.service ?? "podcast";
1864
+ const statusHandler = `${name}.mediaStatus`;
1865
+ const messages = { ...DEFAULT_MESSAGES, ...opts.messages };
1866
+ const message = (key) => opts.text?.(key, messages[key]) ?? messages[key];
1867
+ const template = (key, values) => message(key).replace(/\{(count|time)\}/g, (_match, name2) => String(values[name2] ?? ""));
1868
+ const limit = opts.limit ?? 40;
1869
+ const queueStore = opts.queue ?? memory([]);
1870
+ const progressStore = opts.progress ?? memory({});
1871
+ const define = opts.defineService ?? defineService;
1872
+ let savedProgress = progressStore.read();
1873
+ let feedUrl = "";
1874
+ let loadGeneration = 0;
1875
+ let commandGeneration = 0;
1876
+ let queueTail = Promise.resolve();
1877
+ let statusRead;
1878
+ let retryPlayer;
1879
+ const readPlayerStatus = () => {
1880
+ if (statusRead?.generation === commandGeneration) return statusRead.promise;
1881
+ const promise = status().catch(() => void 0);
1882
+ statusRead = { generation: commandGeneration, promise };
1883
+ void promise.then(() => {
1884
+ if (statusRead?.promise === promise) statusRead = void 0;
1885
+ });
1886
+ return promise;
1887
+ };
1888
+ const persistProgress = (value) => {
1889
+ savedProgress = value;
1890
+ progressStore.write(value);
1891
+ };
1892
+ const persistQueue = (value) => queueStore.write(value);
1893
+ const queueItems = (rows, ids) => {
1894
+ const byId = new Map(rows.map((row) => [row.id, row]));
1895
+ return ids.flatMap((id2) => {
1896
+ const row = byId.get(id2);
1897
+ return row ? [{ id: row.id, episodeId: row.id, url: row.audioUrl, title: row.title, subtitle: row.subtitle, artworkUrl: row.image || void 0, durationMs: row.durationMs || void 0 }] : [];
1898
+ });
1899
+ };
1900
+ const queueOptions = (startIndex, startPositionMs, autoplay) => ({ startIndex, startPositionMs, autoplay, onStatus: statusHandler, skipIntervals: { backwardSec: 15, forwardSec: 30 } });
1901
+ const derive = (state) => {
1902
+ const now = state.episodes.find((episode) => episode.id === state.nowId);
1903
+ const duration = state.durationMs || now?.durationMs || 0;
1904
+ const position = Math.max(0, Math.min(state.positionMs, duration || state.positionMs));
1905
+ const episodes = state.episodes.map((episode) => {
1906
+ const saved = savedProgress[episode.id] ?? 0;
1907
+ const resumable = saved >= 1e3 && (!episode.durationMs || saved < episode.durationMs - 1e3);
1908
+ return { ...episode, progressLabel: resumable ? template("resume", { time: clock(saved) }) : "" };
1909
+ });
1910
+ return {
1911
+ ...state,
1912
+ episodes,
1913
+ queueLabel: state.queue.length ? template(state.queue.length === 1 ? "queueOne" : "queueMany", { count: state.queue.length }) : message("queueEmpty"),
1914
+ nowTitle: now?.title ?? "",
1915
+ nowSubtitle: now?.subtitle ?? "",
1916
+ playLabel: state.isPlaying ? message("pause") : message("play"),
1917
+ playIcon: state.isPlaying ? "pause" : "play",
1918
+ positionMs: position,
1919
+ durationMs: duration,
1920
+ progress: duration > 0 ? Math.min(1, position / duration) : 0,
1921
+ progressLabel: state.nowId ? `${clock(position)} / ${clock(duration)}` : "",
1922
+ hidePlayer: !state.nowId,
1923
+ playbackErrorText: state.playbackError ? message(state.playbackError === "no_audio" ? "noAudio" : "mediaFailed") : "",
1924
+ hidePlaybackError: !state.playbackError,
1925
+ // Retrying cannot add audio to an episode that has none.
1926
+ hidePlaybackRetry: state.playbackError !== "media_failed"
1927
+ };
1928
+ };
1929
+ const feedFailure = (state, code) => derive({
1930
+ ...state,
1931
+ status: "error",
1932
+ feedState: "error",
1933
+ feedError: code,
1934
+ episodes: [],
1935
+ unplayableCount: 0,
1936
+ emptyText: code === "invalid_feed_url" ? message("invalidFeed") : message("feedUnavailable"),
1937
+ // A rejected URL fails the same way every time; only a read failure is worth retrying.
1938
+ hideFeedRetry: code === "invalid_feed_url"
1939
+ });
1940
+ const applyStatus = (state, snapshot) => {
1941
+ const id2 = snapshot.currentItem?.episodeId ?? snapshot.currentItem?.id ?? state.nowId;
1942
+ if (id2 && snapshot.currentItem) {
1943
+ const progress = { ...savedProgress };
1944
+ if (snapshot.state === "ended" || snapshot.positionMs < 1e3 || snapshot.durationMs > 0 && snapshot.positionMs >= snapshot.durationMs - 1e3) delete progress[id2];
1945
+ else if (snapshot.positionMs >= 1e3) progress[id2] = snapshot.positionMs;
1946
+ persistProgress(progress);
1947
+ }
1948
+ const episodeIds = new Set(state.episodes.map((episode) => episode.id));
1949
+ const hostQueue = (snapshot.queue ?? []).map((item) => item.episodeId ?? item.id).filter((itemId) => episodeIds.has(itemId));
1950
+ const queue = snapshot.currentItem && hostQueue.includes(id2) ? hostQueue : state.queue;
1951
+ persistQueue(queue);
1952
+ const failed = snapshot.state === "error";
1953
+ return derive({
1954
+ ...state,
1955
+ nowId: id2,
1956
+ queue,
1957
+ playbackState: snapshot.state,
1958
+ isPlaying: snapshot.state === "playing",
1959
+ isBuffering: snapshot.state === "buffering" || snapshot.state === "loading",
1960
+ positionMs: snapshot.positionMs,
1961
+ durationMs: snapshot.durationMs || state.durationMs,
1962
+ playbackError: failed ? "media_failed" : state.playbackError === "no_audio" ? state.playbackError : ""
1963
+ });
1964
+ };
1965
+ const runPlayer = (operation) => {
1966
+ const generation = ++commandGeneration;
1967
+ void operation().then((snapshot) => {
1968
+ if (generation !== commandGeneration) return;
1969
+ retryPlayer = void 0;
1970
+ return svc.mediaStatus(snapshot);
1971
+ }).catch((error) => {
1972
+ if (isSupersededPlayback(error) || generation !== commandGeneration) return;
1973
+ retryPlayer = operation;
1974
+ svc.playbackFailed("media_failed");
1975
+ });
1976
+ };
1977
+ const startQueue = (state, ids, startId, autoplay) => {
1978
+ const items = queueItems(state.episodes, ids);
1979
+ const startIndex = Math.max(0, items.findIndex((item) => item.id === startId));
1980
+ runPlayer(() => setQueue(items, queueOptions(startIndex, savedProgress[startId] ?? 0, autoplay)));
1981
+ };
1982
+ const initial = derive({
1983
+ status: "loading",
1984
+ feedState: "loading",
1985
+ feedError: "",
1986
+ emptyText: "",
1987
+ hideFeedRetry: true,
1988
+ episodes: [],
1989
+ unplayableCount: 0,
1990
+ isMock: false,
1991
+ notMock: true,
1992
+ mockBanner: "",
1993
+ queue: queueStore.read(),
1994
+ queueLabel: "",
1995
+ nowId: "",
1996
+ nowTitle: "",
1997
+ nowSubtitle: "",
1998
+ playbackState: "idle",
1999
+ isPlaying: false,
2000
+ isBuffering: false,
2001
+ playLabel: "",
2002
+ playIcon: "play",
2003
+ positionMs: 0,
2004
+ durationMs: 0,
2005
+ progress: 0,
2006
+ progressLabel: "",
2007
+ hidePlayer: true,
2008
+ playbackError: "",
2009
+ playbackErrorText: "",
2010
+ hidePlaybackError: true,
2011
+ hidePlaybackRetry: true
2012
+ });
2013
+ const loadFeed = async (state) => {
2014
+ const generation = ++loadGeneration;
2015
+ const checked = podcastFeedUrl(feedUrl);
2016
+ if (!checked.ok) {
2017
+ if (checked.code === "invalid_feed_url") return feedFailure(state, "invalid_feed_url");
2018
+ return derive({ ...state, status: "ready", feedState: "unconfigured", feedError: "", episodes: [], unplayableCount: 0, emptyText: message("notConfigured"), hideFeedRetry: true });
2019
+ }
2020
+ const api = globalThis.himalaya?.wixApi;
2021
+ if (!api) return feedFailure(state, "transport_unavailable");
2022
+ let response;
2023
+ try {
2024
+ response = await api.call("POST", PODCAST_FEED_ENDPOINT, podcastFeedRequest(checked.url, limit));
2025
+ } catch {
2026
+ return generation === loadGeneration ? feedFailure(svc.getState(), "feed_unavailable") : svc.getState();
2027
+ }
2028
+ if (generation !== loadGeneration) return svc.getState();
2029
+ const mapped = mapPodcastFeed(response, opts.describe);
2030
+ if (!mapped.ok) return feedFailure(svc.getState(), mapped.code);
2031
+ const episodes = mapped.episodes.map(toRow);
2032
+ const queue = queueStore.read().filter((id2) => episodes.some((episode) => episode.id === id2));
2033
+ persistQueue(queue);
2034
+ const commandAtStatus = commandGeneration;
2035
+ let snapshot = await status().catch(() => void 0);
2036
+ if (generation !== loadGeneration) return svc.getState();
2037
+ if (commandAtStatus !== commandGeneration) snapshot = void 0;
2038
+ if (snapshot && !snapshot.currentItem && queue.length) {
2039
+ snapshot = await setQueue(queueItems(episodes, queue), queueOptions(0, savedProgress[queue[0]] ?? 0, false)).catch(() => void 0);
2040
+ }
2041
+ if (generation !== loadGeneration) return svc.getState();
2042
+ const ready = derive({
2043
+ ...svc.getState(),
2044
+ status: "ready",
2045
+ feedState: episodes.length ? "ready" : "empty",
2046
+ feedError: "",
2047
+ episodes,
2048
+ unplayableCount: mapped.unplayable,
2049
+ queue: commandAtStatus === commandGeneration ? queue : svc.getState().queue,
2050
+ emptyText: episodes.length ? "" : mapped.unplayable ? message("noPlayable") : message("empty"),
2051
+ hideFeedRetry: true
2052
+ });
2053
+ return snapshot && commandAtStatus === commandGeneration ? applyStatus(ready, snapshot) : ready;
2054
+ };
2055
+ const svc = define(name, {
2056
+ state: initial,
2057
+ actions: {
2058
+ load: async (s2, arg) => {
2059
+ const requested = arg?.feedUrl;
2060
+ feedUrl = typeof requested === "string" ? requested : "";
2061
+ return loadFeed(derive({ ...s2, status: "loading", feedState: "loading", feedError: "", emptyText: "", hideFeedRetry: true }));
2062
+ },
2063
+ // Collection retry and worker refresh retain the configured feed, unlike a new load.
2064
+ refresh: async (s2) => loadFeed(derive({ ...s2, status: "loading", feedState: "loading", feedError: "", emptyText: "", hideFeedRetry: true })),
2065
+ // Retries the read that failed, for the feed the screen asked for.
2066
+ retryFeed: async (s2) => loadFeed(derive({ ...s2, status: "loading", feedState: "loading", feedError: "", emptyText: "", hideFeedRetry: true })),
2067
+ playEpisode: (s2, arg) => {
2068
+ const id2 = idOf(arg);
2069
+ const selected = s2.episodes.find((episode) => episode.id === id2);
2070
+ if (!selected) return s2;
2071
+ if (!selected.audioUrl) return derive({ ...s2, playbackError: "no_audio" });
2072
+ const queue = [id2, ...s2.queue.filter((queued) => queued !== id2)];
2073
+ persistQueue(queue);
2074
+ startQueue(s2, queue, id2, true);
2075
+ return derive({
2076
+ ...s2,
2077
+ queue,
2078
+ nowId: id2,
2079
+ isPlaying: false,
2080
+ isBuffering: true,
2081
+ playbackState: "loading",
2082
+ positionMs: savedProgress[id2] ?? 0,
2083
+ durationMs: selected.durationMs,
2084
+ playbackError: ""
2085
+ });
2086
+ },
2087
+ queueEpisode: (_s, arg) => {
2088
+ const task = queueTail.then(async () => {
2089
+ const s2 = svc.getState();
2090
+ const id2 = idOf(arg);
2091
+ const existing = s2.queue;
2092
+ if (!s2.episodes.some((episode) => episode.id === id2) || existing.includes(id2)) return s2;
2093
+ const queue = [...existing, id2];
2094
+ persistQueue(queue);
2095
+ const operation = async () => {
2096
+ const generation = commandGeneration;
2097
+ const snapshot = await status();
2098
+ if (generation !== commandGeneration) throw SUPERSEDED_PLAYBACK;
2099
+ const activeId = snapshot.currentItem?.episodeId ?? snapshot.currentItem?.id ?? s2.nowId;
2100
+ if (!activeId) return snapshot;
2101
+ const next = await setQueue(
2102
+ queueItems(s2.episodes, queue),
2103
+ queueOptions(Math.max(0, queue.indexOf(activeId)), snapshot.positionMs, snapshot.state === "playing")
2104
+ );
2105
+ if (generation !== commandGeneration) throw SUPERSEDED_PLAYBACK;
2106
+ return next;
2107
+ };
2108
+ ++commandGeneration;
2109
+ try {
2110
+ const next = await operation();
2111
+ retryPlayer = void 0;
2112
+ return applyStatus(derive({ ...svc.getState(), queue }), next);
2113
+ } catch (error) {
2114
+ if (isSupersededPlayback(error)) {
2115
+ if (JSON.stringify(queueStore.read()) === JSON.stringify(queue)) persistQueue(svc.getState().queue);
2116
+ return svc.getState();
2117
+ }
2118
+ retryPlayer = operation;
2119
+ return derive({ ...svc.getState(), queue, playbackError: "media_failed", isBuffering: false });
2120
+ }
2121
+ });
2122
+ queueTail = task.then(() => {
2123
+ }, () => {
2124
+ });
2125
+ return task;
2126
+ },
2127
+ togglePlay: async (s2) => {
2128
+ if (!s2.nowId) return s2;
2129
+ runPlayer(async () => {
2130
+ const snapshot = await status();
2131
+ if (!snapshot.currentItem) {
2132
+ const ids = s2.queue.includes(s2.nowId) ? s2.queue : [s2.nowId, ...s2.queue];
2133
+ const items = queueItems(s2.episodes, ids);
2134
+ return setQueue(items, queueOptions(Math.max(0, ids.indexOf(s2.nowId)), savedProgress[s2.nowId] ?? 0, true));
2135
+ }
2136
+ return snapshot.state === "playing" || snapshot.state === "buffering" ? pause() : play();
2137
+ });
2138
+ return s2;
2139
+ },
2140
+ seek: (s2, arg) => {
2141
+ if (!s2.nowId) return s2;
2142
+ const raw = numberOf(arg, "value");
2143
+ if (!Number.isFinite(raw)) return s2;
2144
+ const positionMs = Math.max(0, Math.round(raw <= 1 ? raw * s2.durationMs : raw));
2145
+ runPlayer(() => seek(positionMs));
2146
+ return s2;
2147
+ },
2148
+ seekBy: (s2, arg) => {
2149
+ if (!s2.nowId) return s2;
2150
+ const delta = numberOf(arg, "deltaMs");
2151
+ if (!Number.isFinite(delta)) return s2;
2152
+ const positionMs = Math.max(0, Math.min(s2.durationMs || Infinity, s2.positionMs + delta));
2153
+ runPlayer(() => seek(positionMs));
2154
+ return s2;
2155
+ },
2156
+ previousEpisode: (s2) => {
2157
+ if (!s2.nowId) return s2;
2158
+ runPlayer(() => skip(-1));
2159
+ return s2;
2160
+ },
2161
+ nextEpisode: (s2) => {
2162
+ if (!s2.nowId) return s2;
2163
+ runPlayer(() => skip(1));
2164
+ return s2;
2165
+ },
2166
+ // Retry the failed command (or a player-reported episode error). Never opens a browser.
2167
+ retryPlayback: (s2) => {
2168
+ if (s2.playbackError !== "media_failed" || !s2.nowId) return s2;
2169
+ if (retryPlayer) runPlayer(retryPlayer);
2170
+ else startQueue(s2, s2.queue.includes(s2.nowId) ? s2.queue : [s2.nowId, ...s2.queue], s2.nowId, true);
2171
+ return derive({ ...s2, playbackError: "" });
2172
+ },
2173
+ // A rejected control does not prove transport stopped. Only mediaStatus owns it.
2174
+ playbackFailed: (s2, code) => derive({ ...s2, isBuffering: false, playbackError: code ?? "media_failed" }),
2175
+ mediaStatus: async (_s, arg) => {
2176
+ const generation = commandGeneration;
2177
+ const snapshot = arg?.state && arg.currentItem !== void 0 ? arg : await readPlayerStatus();
2178
+ const current = svc.getState();
2179
+ if (generation !== commandGeneration) return current;
2180
+ return snapshot ? applyStatus(current, snapshot) : current;
2181
+ }
2182
+ }
2183
+ });
2184
+ subscribeStatus(statusHandler).catch(() => {
2185
+ });
2186
+ return svc;
2187
+ }
2188
+
1526
2189
  // ../../core/sdk/wix-cashier/src/index.ts
1527
2190
  function normalizeAvailability(raw) {
1528
2191
  switch ((raw ?? "").toLowerCase()) {
@@ -2845,8 +3508,8 @@ function decodePaymentAnswer(raw, expected) {
2845
3508
  }
2846
3509
  function decodePayment(raw, expected) {
2847
3510
  if (!isObject3(raw) || !hasPaymentIds(raw) || !echoes(raw, expected) || !hasValidOptionals(raw)) return null;
2848
- const status = ownValue(STATUSES, raw.status);
2849
- return status ? toPayment(raw, status) : null;
3511
+ const status2 = ownValue(STATUSES, raw.status);
3512
+ return status2 ? toPayment(raw, status2) : null;
2850
3513
  }
2851
3514
  function hasPaymentIds(raw) {
2852
3515
  return isUUID(raw.id) && isUUID(raw.appId) && isUUID(raw.memberId) && isUUID(raw.wixTransactionId);
@@ -2857,7 +3520,7 @@ function echoes(raw, expected) {
2857
3520
  function hasValidOptionals(raw) {
2858
3521
  return (raw.appProductId === void 0 || isStoreProductId(raw.appProductId)) && (raw.purchaseTransactionId === void 0 || isUUID(raw.purchaseTransactionId)) && TIMESTAMPS.every((field) => raw[field] === void 0 || isTimestamp(raw[field]));
2859
3522
  }
2860
- function toPayment(raw, status) {
3523
+ function toPayment(raw, status2) {
2861
3524
  const optional = {
2862
3525
  appProductId: raw.appProductId,
2863
3526
  cancelReason: ownValue(CANCEL_REASONS, raw.cancelReason),
@@ -2868,7 +3531,7 @@ function toPayment(raw, status) {
2868
3531
  refundedDate: raw.refundedDate
2869
3532
  };
2870
3533
  const ids = { paymentId: raw.id, appId: raw.appId, memberId: raw.memberId, wixTransactionId: raw.wixTransactionId };
2871
- return { ...ids, status, ...withoutUndefined(optional) };
3534
+ return { ...ids, status: status2, ...withoutUndefined(optional) };
2872
3535
  }
2873
3536
  function classifyFailure(error, operation, codes2) {
2874
3537
  const message = messageOf(error);
@@ -3080,8 +3743,8 @@ function isUndecided(result) {
3080
3743
  return failed.status === "failed" && UNDECIDED.has(failed.kind);
3081
3744
  }
3082
3745
  function outcomeUnknown(failed) {
3083
- const status = failed.httpStatus === void 0 ? {} : { httpStatus: failed.httpStatus };
3084
- return { status: "outcomeUnknown", operation: "startItemPayment", kind: failed.kind, ...status };
3746
+ const status2 = failed.httpStatus === void 0 ? {} : { httpStatus: failed.httpStatus };
3747
+ return { status: "outcomeUnknown", operation: "startItemPayment", kind: failed.kind, ...status2 };
3085
3748
  }
3086
3749
  async function read(call, operation) {
3087
3750
  try {
@@ -3367,8 +4030,8 @@ var COMPLETE_PAYMENT_REFUSALS = {
3367
4030
  APP_NOT_CONFIGURED: "hold",
3368
4031
  OWNED_BY_ANOTHER_CUSTOMER: "ownershipConflict"
3369
4032
  };
3370
- function isFinalRefusal(status) {
3371
- return status === "canceling" || status === "canceled" || status === "refunding" || status === "refunded";
4033
+ function isFinalRefusal(status2) {
4034
+ return status2 === "canceling" || status2 === "canceled" || status2 === "refunding" || status2 === "refunded";
3372
4035
  }
3373
4036
 
3374
4037
  // ../../stdlib/flows/iap-checkout/src/order-refs.ts
@@ -4027,12 +4690,12 @@ function createWixOrderBackend(deps) {
4027
4690
  if (refusal === "hold" || refusal === "rejected") return heldProof(proof, "rejected");
4028
4691
  return refusal === "ownershipConflict" ? heldProof(proof, "ownershipConflict") : { status: refusal };
4029
4692
  }
4030
- function heldProof(proof, status) {
4693
+ function heldProof(proof, status2) {
4031
4694
  const started = startedRefFor(proof);
4032
4695
  const hold = started && { ...started, stage: "held", appleTransactionId: proof.transaction.transactionId, updatedAt: now() };
4033
4696
  if (hold && !(isCurrent(proof.session) && proof.member.partition?.put(hold))) return RETRYABLE;
4034
4697
  deps.report({ key: started?.key ?? `payment:${proof.transaction.transactionId}`, failure: "paymentHeld" });
4035
- return { status };
4698
+ return { status: status2 };
4036
4699
  }
4037
4700
  function startedRefFor(proof) {
4038
4701
  const refs = proof.member.partition?.refs() ?? [];
@@ -5074,9 +5737,9 @@ async function readAccess(verticalRef, port) {
5074
5737
  return ENDED.has(purchase.status) ? "none" : "unavailable";
5075
5738
  }
5076
5739
  function dataAt(body, path) {
5077
- let node3 = isObject7(body) && isObject7(body.data) ? body.data : body;
5078
- for (const key of path) node3 = isObject7(node3) ? node3[key] : void 0;
5079
- return isObject7(node3) ? node3 : null;
5740
+ let node4 = isObject7(body) && isObject7(body.data) ? body.data : body;
5741
+ for (const key of path) node4 = isObject7(node4) ? node4[key] : void 0;
5742
+ return isObject7(node4) ? node4 : null;
5080
5743
  }
5081
5744
  var ENDED = /* @__PURE__ */ new Set(["DECLINED", "EXPIRED", "CANCELED", "REFUNDED", "FAILED"]);
5082
5745
  var UNPAID = /* @__PURE__ */ new Set(["INITIALIZED", "PENDING"]);
@@ -5138,14 +5801,14 @@ function createRedirectSession(req = {}, opts) {
5138
5801
 
5139
5802
  // ../../stdlib/flows/screens/src/index.ts
5140
5803
  var PKG = "himalaya";
5141
- var node2 = (id2, type, props) => ({ id: id2, body: { package: PKG, type, props } });
5804
+ var node3 = (id2, type, props) => ({ id: id2, body: { package: PKG, type, props } });
5142
5805
  var hideWhen = (n, path) => ({
5143
5806
  ...n,
5144
5807
  modifiers: { ...n.modifiers ?? {}, hiddenPath: path }
5145
5808
  });
5146
- var text = (id2, value, style = "body") => node2(id2, "Text", { text: value, style });
5147
- var vstack = (id2, children, spacing = 12, alignment = "leading") => node2(id2, "VStack", { spacing, alignment, children });
5148
- var button = (id2, title, action2, style = "primary") => node2(id2, "Button", { title, style, fullWidth: true, action: action2 });
5809
+ var text = (id2, value, style = "body") => node3(id2, "Text", { text: value, style });
5810
+ var vstack = (id2, children, spacing = 12, alignment = "leading") => node3(id2, "VStack", { spacing, alignment, children });
5811
+ var button = (id2, title, action2, style = "primary") => node3(id2, "Button", { title, style, fullWidth: true, action: action2 });
5149
5812
  var openScreen = (screenId) => ({ actionId: "himi.open", params: { screenId } });
5150
5813
  function detailedHeader(opts) {
5151
5814
  const id2 = opts.id ?? "detailed_header";
@@ -5153,7 +5816,7 @@ function detailedHeader(opts) {
5153
5816
  if (opts.logoUrl || opts.locationLabel) {
5154
5817
  const identity = [];
5155
5818
  if (opts.logoUrl) {
5156
- identity.push(node2(`${id2}.logo`, "Image", {
5819
+ identity.push(node3(`${id2}.logo`, "Image", {
5157
5820
  url: opts.logoUrl,
5158
5821
  width: 56,
5159
5822
  height: 56,
@@ -5164,12 +5827,12 @@ function detailedHeader(opts) {
5164
5827
  }
5165
5828
  if (opts.locationLabel) {
5166
5829
  if (opts.locationAction) {
5167
- identity.push(node2(`${id2}.locationGroup`, "HStack", {
5830
+ identity.push(node3(`${id2}.locationGroup`, "HStack", {
5168
5831
  spacing: 8,
5169
5832
  alignment: "center",
5170
5833
  children: [
5171
5834
  text(`${id2}.location`, opts.locationLabel, "caption"),
5172
- node2(`${id2}.location.action`, "Button", {
5835
+ node3(`${id2}.location.action`, "Button", {
5173
5836
  title: opts.locationAction.label,
5174
5837
  style: opts.locationAction.style ?? "plain",
5175
5838
  fullWidth: false,
@@ -5181,10 +5844,10 @@ function detailedHeader(opts) {
5181
5844
  identity.push(text(`${id2}.location`, opts.locationLabel, "caption"));
5182
5845
  }
5183
5846
  }
5184
- cardChildren.push(node2(`${id2}.identity`, "HStack", { spacing: 12, alignment: "center", children: identity }));
5847
+ cardChildren.push(node3(`${id2}.identity`, "HStack", { spacing: 12, alignment: "center", children: identity }));
5185
5848
  }
5186
5849
  if (opts.memberCaption || opts.memberAvatarsPath || opts.memberAvatars?.length) {
5187
- cardChildren.push(node2(`${id2}.members`, "AvatarStrip", {
5850
+ cardChildren.push(node3(`${id2}.members`, "AvatarStrip", {
5188
5851
  size: 36,
5189
5852
  maxVisible: 5,
5190
5853
  ...opts.memberCaption ? { caption: opts.memberCaption } : {},
@@ -5199,7 +5862,7 @@ function detailedHeader(opts) {
5199
5862
  ]) {
5200
5863
  if (action2) cardChildren.push(button(`${id2}.${key}`, action2.label, action2.action, action2.style ?? (key === "primary" ? "primary" : "secondary")));
5201
5864
  }
5202
- const card = node2(`${id2}.card`, "VStack", {
5865
+ const card = node3(`${id2}.card`, "VStack", {
5203
5866
  spacing: 14,
5204
5867
  alignment: "leading",
5205
5868
  children: cardChildren
@@ -5212,7 +5875,7 @@ function detailedHeader(opts) {
5212
5875
  fillMaxWidth: true
5213
5876
  };
5214
5877
  const fixed = opts.collapsible === false;
5215
- return node2(id2, "CollapsingHeader", {
5878
+ return node3(id2, "CollapsingHeader", {
5216
5879
  ...opts.imageUrl ? { imageUrl: opts.imageUrl } : {},
5217
5880
  title: opts.title,
5218
5881
  ...opts.subtitle ? { subtitle: opts.subtitle } : {},
@@ -5238,7 +5901,7 @@ function authScreen(opts) {
5238
5901
  const screenId = opts.screenId ?? "signin";
5239
5902
  const c = opts.copy ?? {};
5240
5903
  const withRegister = opts.register !== false;
5241
- const field = (key, label, action2, extra = {}) => node2(`${s2}.${key}`, "TextField", {
5904
+ const field = (key, label, action2, extra = {}) => node3(`${s2}.${key}`, "TextField", {
5242
5905
  label,
5243
5906
  placeholder: label,
5244
5907
  valuePath: `$service:${s2}.${key}`,
@@ -5258,7 +5921,7 @@ function authScreen(opts) {
5258
5921
  `$service:${s2}.signedIn`
5259
5922
  ),
5260
5923
  hideWhen(
5261
- node2(`${s2}.submit`, "Button", {
5924
+ node3(`${s2}.submit`, "Button", {
5262
5925
  title: `$service:${s2}.submitCta`,
5263
5926
  style: "primary",
5264
5927
  fullWidth: true,
@@ -5270,7 +5933,7 @@ function authScreen(opts) {
5270
5933
  if (withRegister) {
5271
5934
  children.push(
5272
5935
  hideWhen(
5273
- node2(`${s2}.toggle`, "Button", {
5936
+ node3(`${s2}.toggle`, "Button", {
5274
5937
  title: `$service:${s2}.switchCta`,
5275
5938
  style: "secondary",
5276
5939
  fullWidth: true,
@@ -5290,7 +5953,7 @@ function authScreen(opts) {
5290
5953
  }
5291
5954
  children.push(
5292
5955
  hideWhen(
5293
- node2(`${s2}.signout`, "Button", {
5956
+ node3(`${s2}.signout`, "Button", {
5294
5957
  title: c.signOutCta ?? "Sign out",
5295
5958
  style: "secondary",
5296
5959
  fullWidth: true,
@@ -5628,8 +6291,8 @@ function createCheckoutService(opts = {}) {
5628
6291
  try {
5629
6292
  const res = await createOnlineOrder(id2);
5630
6293
  purchaseFlowId = String(res?.purchaseFlowId ?? "");
5631
- const status = String(res?.order?.status ?? "").toUpperCase();
5632
- if (status === GRANTS_ACCESS) {
6294
+ const status2 = String(res?.order?.status ?? "").toUpperCase();
6295
+ if (status2 === GRANTS_ACCESS) {
5633
6296
  if (generation !== memberSession.current().generation) return void 0;
5634
6297
  offerGeneration = generation;
5635
6298
  regularAccess.add(id2);
@@ -5748,7 +6411,7 @@ function checkoutScreen(opts) {
5748
6411
  // someone the thing they are currently paying for is the obvious next bug.
5749
6412
  hideWhen(text(`${s2}.row_joined`, "$item.joinedLabel", "bodyEmphasis"), "$item.notJoined"),
5750
6413
  hideWhen(
5751
- node2(`${s2}.row_join`, "Button", {
6414
+ node3(`${s2}.row_join`, "Button", {
5752
6415
  title: "$item.cta",
5753
6416
  disabledPath: "$item.joinDisabled",
5754
6417
  style: "primary",
@@ -5787,7 +6450,7 @@ function checkoutScreen(opts) {
5787
6450
  }
5788
6451
  children.push(
5789
6452
  hideWhen(
5790
- node2(`${s2}.list`, "LazyList", { itemsPath: `$service:${s2}.rows`, spacing: 18, items: [row] }),
6453
+ node3(`${s2}.list`, "LazyList", { itemsPath: `$service:${s2}.rows`, spacing: 18, items: [row] }),
5791
6454
  `$service:${s2}.noRows`
5792
6455
  )
5793
6456
  );
@@ -5800,6 +6463,9 @@ function checkoutScreen(opts) {
5800
6463
  }
5801
6464
  export {
5802
6465
  ONE_APP_MEMBER_ONLY_SECTIONS,
6466
+ PODCAST_EPISODES_QUERY,
6467
+ PODCAST_FEED_ENDPOINT,
6468
+ PODCAST_SCREEN_CAPABILITIES,
5803
6469
  authScreen,
5804
6470
  businessContactLink,
5805
6471
  businessContactPoint,
@@ -5812,6 +6478,7 @@ export {
5812
6478
  createInviteAvailabilityService,
5813
6479
  createInviteService,
5814
6480
  createOneAppSectionService,
6481
+ createPodcastService,
5815
6482
  decodeOneAppPage,
5816
6483
  detailedHeader,
5817
6484
  entitlement,
@@ -5820,9 +6487,16 @@ export {
5820
6487
  inviteScreen,
5821
6488
  isOneAppPageId,
5822
6489
  isOneAppSectionVisible,
6490
+ mapPodcastFeed,
5823
6491
  oneAppPageContentErrorCode,
5824
6492
  oneAppPageSection,
5825
6493
  oneAppSection,
5826
- oneAppSectionVisibility
6494
+ oneAppSectionVisibility,
6495
+ podcastAudioUrl,
6496
+ podcastDurationMs,
6497
+ podcastFeedRequest,
6498
+ podcastFeedSetting,
6499
+ podcastFeedUrl,
6500
+ podcastScreen
5827
6501
  };
5828
6502
  //# sourceMappingURL=screens.mjs.map