@wix/himalaya-cli 0.1397.0 → 0.1399.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 (88) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/serve-runtime/src/wix-bridge.d.ts +30 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +2 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validation.d.ts +1 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/copy.generated.d.ts +109 -0
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/feedback.d.ts +15 -0
  7. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/index.d.ts +3 -0
  8. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +44 -0
  9. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/auth.mjs +304 -18
  10. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core/validation.mjs +1 -1
  11. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +72 -1
  12. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +377 -20
  13. package/dist/cli.mjs +983 -342
  14. package/dist/preview-assets.generated.bin +0 -0
  15. package/guides/component-reference.json +1 -1
  16. package/guides/component-reference.md +2 -0
  17. package/guides/headless-loop.md +1 -1
  18. package/guides/importable-sdks.md +2 -1
  19. package/guides/one-app-to-himi-app.md +30 -0
  20. package/guides/one-app-viewer.md +8 -1
  21. package/guides/sdk-reference.json +92 -1
  22. package/package.json +2 -2
  23. package/templates/beauty-salon/dev/index.ts +41 -1
  24. package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +90 -76
  25. package/templates/beauty-salon-owner/dev/index.ts +304 -7
  26. package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +39 -33
  27. package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  28. package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  29. package/templates/branded-lite/dev/index.ts +41 -1
  30. package/templates/branded-lite/tier5-src/himi-store-account/index.ts +90 -76
  31. package/templates/community-club/dev/index.ts +41 -1
  32. package/templates/community-club/tier5-src/himi-store-account/index.ts +90 -76
  33. package/templates/community-club-owner/dev/index.ts +304 -7
  34. package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +39 -33
  35. package/templates/community-club-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  36. package/templates/community-club-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  37. package/templates/events-meetups/dev/index.ts +41 -1
  38. package/templates/events-meetups/tier5-src/himi-store-account/index.ts +90 -76
  39. package/templates/events-meetups-owner/dev/index.ts +304 -7
  40. package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +39 -33
  41. package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  42. package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  43. package/templates/gym-fitness/dev/index.ts +41 -1
  44. package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +90 -76
  45. package/templates/gym-fitness-owner/dev/index.ts +304 -7
  46. package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +39 -33
  47. package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  48. package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  49. package/templates/nonprofit-cause/dev/index.ts +41 -1
  50. package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +90 -76
  51. package/templates/nonprofit-cause-owner/dev/index.ts +304 -7
  52. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +39 -33
  53. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  54. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  55. package/templates/owner-lite/dev/index.ts +304 -7
  56. package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +39 -33
  57. package/templates/owner-lite/tier5-src/_shared/aria-widget-model.ts +26 -4
  58. package/templates/owner-lite/tier5-src/_shared/aria-widget-view.ts +63 -16
  59. package/templates/podcast-creator/dev/index.ts +41 -1
  60. package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +90 -76
  61. package/templates/podcast-creator-owner/dev/index.ts +304 -7
  62. package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +39 -33
  63. package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  64. package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  65. package/templates/portfolio-creative/dev/index.ts +41 -1
  66. package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +90 -76
  67. package/templates/portfolio-creative-owner/dev/index.ts +304 -7
  68. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +39 -33
  69. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  70. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  71. package/templates/restaurant/dev/index.ts +41 -1
  72. package/templates/restaurant/tier5-src/himi-store-account/index.ts +90 -76
  73. package/templates/restaurant-owner/dev/index.ts +304 -7
  74. package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +39 -33
  75. package/templates/restaurant-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  76. package/templates/restaurant-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  77. package/templates/retail-store/dev/index.ts +41 -1
  78. package/templates/retail-store/tier5-src/himi-store-account/index.ts +90 -76
  79. package/templates/retail-store-owner/dev/index.ts +304 -7
  80. package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +39 -33
  81. package/templates/retail-store-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  82. package/templates/retail-store-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
  83. package/templates/yoga-studio/dev/index.ts +41 -1
  84. package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +90 -76
  85. package/templates/yoga-studio-owner/dev/index.ts +304 -7
  86. package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +39 -33
  87. package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-model.ts +26 -4
  88. package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-view.ts +63 -16
@@ -197,7 +197,7 @@ function errorMessageFor(args) {
197
197
  return defaultMessage(failure, args.catalog);
198
198
  }
199
199
  function shouldRevealError(args) {
200
- if (args.hasWorkerError) return true;
200
+ if (args.hasWorkerError || args.feedbackShown) return true;
201
201
  if (args.submitAttempted) return true;
202
202
  switch (resolveMode(args.rule)) {
203
203
  case "live":
@@ -9373,7 +9373,7 @@ function errorMessageFor(args) {
9373
9373
  return defaultMessage(failure, args.catalog);
9374
9374
  }
9375
9375
  function shouldRevealError(args) {
9376
- if (args.hasWorkerError) return true;
9376
+ if (args.hasWorkerError || args.feedbackShown) return true;
9377
9377
  if (args.submitAttempted) return true;
9378
9378
  switch (resolveMode(args.rule)) {
9379
9379
  case "live":
@@ -11149,6 +11149,27 @@ var ICON_CATALOG = {
11149
11149
  "license": "Apache-2.0",
11150
11150
  "libVersion": "0.45.9"
11151
11151
  },
11152
+ "concealed": {
11153
+ "category": "status",
11154
+ "path": [
11155
+ "M15.725 13.525L14.625 12.425C15.058 11.242 14.833 10.258 13.95 9.475C13.067 8.692 12.108 8.492 11.075 8.875L9.975 7.775C10.258 7.592 10.575 7.458 10.925 7.375C11.275 7.292 11.633 7.25 12 7.25C13.183 7.25 14.188 7.663 15.013 8.488C15.838 9.313 16.25 10.317 16.25 11.5C16.25 11.867 16.204 12.229 16.113 12.588C16.021 12.946 15.892 13.258 15.725 13.525ZM18.95 16.75L17.95 15.75C18.767 15.15 19.479 14.479 20.088 13.738C20.696 12.996 21.142 12.25 21.425 11.5C20.592 9.65 19.342 8.188 17.675 7.113C16.008 6.038 14.2 5.5 12.25 5.5C11.55 5.5 10.833 5.567 10.1 5.7C9.367 5.833 8.792 5.992 8.375 6.175L7.225 5C7.808 4.733 8.554 4.5 9.463 4.3C10.371 4.1 11.258 4 12.125 4C14.508 4 16.688 4.679 18.663 6.038C20.638 7.396 22.083 9.217 23 11.5C22.567 12.567 22.008 13.542 21.325 14.425C20.642 15.308 19.85 16.083 18.95 16.75ZM20.4 22.4L16.2 18.275C15.617 18.508 14.958 18.688 14.225 18.813C13.492 18.938 12.75 19 12 19C9.567 19 7.358 18.321 5.375 16.963C3.392 15.604 1.933 13.783 1 11.5C1.333 10.633 1.796 9.788 2.388 8.963C2.979 8.138 3.7 7.35 4.55 6.6L1.4 3.45L2.45 2.375L21.375 21.3L20.4 22.4ZM5.575 7.65C4.958 8.1 4.362 8.692 3.788 9.425C3.213 10.158 2.8 10.85 2.55 11.5C3.4 13.35 4.679 14.813 6.388 15.888C8.096 16.963 10.033 17.5 12.2 17.5C12.75 17.5 13.292 17.467 13.825 17.4C14.358 17.333 14.758 17.233 15.025 17.1L13.425 15.5C13.242 15.583 13.017 15.646 12.75 15.688C12.483 15.729 12.233 15.75 12 15.75C10.833 15.75 9.833 15.342 9 14.525C8.167 13.708 7.75 12.7 7.75 11.5C7.75 11.25 7.771 11 7.813 10.75C7.854 10.5 7.917 10.275 8 10.075L5.575 7.65ZM13.2 11.2ZM10.3 12.65Z"
11156
+ ],
11157
+ "style": "filled",
11158
+ "ios": {
11159
+ "sf": "eye.slash",
11160
+ "match": "exact"
11161
+ },
11162
+ "android": {
11163
+ "material": "VisibilityOff",
11164
+ "match": "exact"
11165
+ },
11166
+ "aliases": [
11167
+ "eye_slash"
11168
+ ],
11169
+ "source": "material-symbols/visibility_off",
11170
+ "license": "Apache-2.0",
11171
+ "libVersion": "0.45.9"
11172
+ },
11152
11173
  "cookie": {
11153
11174
  "category": "commerce",
11154
11175
  "path": [
@@ -11408,6 +11429,24 @@ var ICON_CATALOG = {
11408
11429
  "license": "Apache-2.0",
11409
11430
  "libVersion": "0.45.9"
11410
11431
  },
11432
+ "gift": {
11433
+ "category": "commerce",
11434
+ "path": [
11435
+ "M4 22L4 10.875L2 10.875L2 5.125L7.5 5.125C7.367 4.925 7.267 4.713 7.2 4.487C7.133 4.263 7.1 4.033 7.1 3.8C7.1 3.022 7.372 2.361 7.917 1.817C8.461 1.272 9.122 1 9.9 1C10.3 1 10.688 1.083 11.063 1.25C11.438 1.417 11.75 1.658 12 1.975C12.25 1.658 12.563 1.417 12.938 1.25C13.313 1.083 13.7 1 14.1 1C14.878 1 15.539 1.272 16.083 1.817C16.628 2.361 16.9 3.022 16.9 3.8C16.9 4.033 16.867 4.263 16.8 4.487C16.733 4.713 16.633 4.925 16.5 5.125L22 5.125L22 10.875L20 10.875L20 22L4 22ZM13.175 2.873C12.925 3.122 12.8 3.43 12.8 3.798C12.8 4.166 12.924 4.475 13.173 4.725C13.422 4.975 13.73 5.1 14.098 5.1C14.466 5.1 14.775 4.976 15.025 4.727C15.275 4.478 15.4 4.17 15.4 3.802C15.4 3.434 15.276 3.125 15.027 2.875C14.778 2.625 14.47 2.5 14.102 2.5C13.734 2.5 13.425 2.624 13.175 2.873ZM8.6 3.798C8.6 4.166 8.724 4.475 8.973 4.725C9.222 4.975 9.53 5.1 9.898 5.1C10.266 5.1 10.575 4.976 10.825 4.727C11.075 4.478 11.2 4.17 11.2 3.802C11.2 3.434 11.076 3.125 10.827 2.875C10.578 2.625 10.27 2.5 9.902 2.5C9.534 2.5 9.225 2.624 8.975 2.873C8.725 3.122 8.6 3.43 8.6 3.798ZM3.5 6.625L3.5 9.375L11.25 9.375L11.25 6.625L3.5 6.625ZM11.25 20.5L11.25 10.875L5.35 10.875L5.35 20.5L11.25 20.5ZM12.75 20.5L18.65 20.5L18.65 10.875L12.75 10.875L12.75 20.5ZM20.5 9.375L20.5 6.625L12.75 6.625L12.75 9.375L20.5 9.375Z"
11436
+ ],
11437
+ "style": "filled",
11438
+ "ios": {
11439
+ "sf": "gift",
11440
+ "match": "exact"
11441
+ },
11442
+ "android": {
11443
+ "material": "CardGiftcard",
11444
+ "match": "exact"
11445
+ },
11446
+ "source": "material-symbols/featured_seasonal_and_gifts",
11447
+ "license": "Apache-2.0",
11448
+ "libVersion": "0.45.9"
11449
+ },
11411
11450
  "globe": {
11412
11451
  "category": "place",
11413
11452
  "path": [
@@ -11971,6 +12010,25 @@ var ICON_CATALOG = {
11971
12010
  "license": "Apache-2.0",
11972
12011
  "libVersion": "0.45.9"
11973
12012
  },
12013
+ "paper_plane": {
12014
+ "category": "communication",
12015
+ "path": [
12016
+ "M3 20L3 4L22 12L3 20ZM4.5 17.675L18.1 12L4.5 6.25L4.5 10.45L10.55 12L4.5 13.5L4.5 17.675ZM4.5 17.675L4.5 6.25L4.5 17.675Z"
12017
+ ],
12018
+ "style": "filled",
12019
+ "mirrorsInRTL": true,
12020
+ "ios": {
12021
+ "sf": "paperplane",
12022
+ "match": "exact"
12023
+ },
12024
+ "android": {
12025
+ "material": "Send",
12026
+ "match": "exact"
12027
+ },
12028
+ "source": "material-symbols/send",
12029
+ "license": "Apache-2.0",
12030
+ "libVersion": "0.45.9"
12031
+ },
11974
12032
  "pause": {
11975
12033
  "category": "media",
11976
12034
  "path": [
@@ -12614,6 +12672,9 @@ var ICON_CATALOG = {
12614
12672
  "material": "Visibility",
12615
12673
  "match": "exact"
12616
12674
  },
12675
+ "aliases": [
12676
+ "eye"
12677
+ ],
12617
12678
  "source": "material-symbols/visibility",
12618
12679
  "license": "Apache-2.0",
12619
12680
  "libVersion": "0.45.9"
@@ -12725,6 +12786,8 @@ var ICON_NORMALIZED_INDEX = {
12725
12786
  "clock": "clock",
12726
12787
  "close": "close",
12727
12788
  "xmark": "close",
12789
+ "concealed": "concealed",
12790
+ "eyeslash": "concealed",
12728
12791
  "cookie": "cookie",
12729
12792
  "copy": "copy",
12730
12793
  "dashboard": "dashboard",
@@ -12741,6 +12804,7 @@ var ICON_NORMALIZED_INDEX = {
12741
12804
  "filter": "filter",
12742
12805
  "folder": "folder",
12743
12806
  "fullscreen": "fullscreen",
12807
+ "gift": "gift",
12744
12808
  "globe": "globe",
12745
12809
  "grid": "grid",
12746
12810
  "gridfill": "grid_fill",
@@ -12777,6 +12841,7 @@ var ICON_NORMALIZED_INDEX = {
12777
12841
  "newspaperfill": "newspaper_fill",
12778
12842
  "next": "next",
12779
12843
  "skipforward": "next",
12844
+ "paperplane": "paper_plane",
12780
12845
  "pause": "pause",
12781
12846
  "people": "people",
12782
12847
  "person": "person",
@@ -12815,6 +12880,7 @@ var ICON_NORMALIZED_INDEX = {
12815
12880
  "trash": "trash",
12816
12881
  "undo": "undo",
12817
12882
  "visible": "visible",
12883
+ "eye": "visible",
12818
12884
  "volume": "volume",
12819
12885
  "warning": "warning",
12820
12886
  "wifi": "wifi",
@@ -12856,6 +12922,7 @@ var ICON_NAMES = [
12856
12922
  "circle_fill",
12857
12923
  "clock",
12858
12924
  "close",
12925
+ "concealed",
12859
12926
  "cookie",
12860
12927
  "copy",
12861
12928
  "dashboard",
@@ -12867,11 +12934,14 @@ var ICON_NAMES = [
12867
12934
  "error",
12868
12935
  "expand",
12869
12936
  "external_link",
12937
+ "eye",
12938
+ "eye_slash",
12870
12939
  "filter",
12871
12940
  "folder",
12872
12941
  "forward",
12873
12942
  "fullscreen",
12874
12943
  "gear",
12944
+ "gift",
12875
12945
  "globe",
12876
12946
  "grid",
12877
12947
  "grid_fill",
@@ -12907,6 +12977,7 @@ var ICON_NAMES = [
12907
12977
  "newspaper",
12908
12978
  "newspaper_fill",
12909
12979
  "next",
12980
+ "paper_plane",
12910
12981
  "pause",
12911
12982
  "pencil",
12912
12983
  "people",
@@ -1,3 +1,117 @@
1
+ // ../../core/ts/src/validation.ts
2
+ var EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
3
+ var URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
4
+ var INTEGER_RE = /^[+-]?[0-9]+$/;
5
+ var NUMBER_RE = /^[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
6
+ function isEmail(value) {
7
+ if (!EMAIL_RE.test(value)) return false;
8
+ if (value.includes("..")) return false;
9
+ const local = value.slice(0, value.indexOf("@"));
10
+ return !local.startsWith(".") && !local.endsWith(".");
11
+ }
12
+ function isPhone(value) {
13
+ let s2 = "";
14
+ for (const ch of value) {
15
+ if (" -().\xA0 ".includes(ch)) continue;
16
+ s2 += ch;
17
+ }
18
+ if (s2.startsWith("+")) s2 = s2.slice(1);
19
+ if (s2.length < 7 || s2.length > 15) return false;
20
+ for (const ch of s2) if (ch < "0" || ch > "9") return false;
21
+ return true;
22
+ }
23
+ function isUrl(value) {
24
+ if (/\s/.test(value)) return false;
25
+ let rest = value;
26
+ const lower = value.toLowerCase();
27
+ if (lower.startsWith("http://")) rest = value.slice(7);
28
+ else if (lower.startsWith("https://")) rest = value.slice(8);
29
+ else if (value.includes("://")) return false;
30
+ if (rest.length === 0) return false;
31
+ let end = rest.length;
32
+ for (let i = 0; i < rest.length; i++) {
33
+ const c = rest[i];
34
+ if (c === "/" || c === "?" || c === "#") {
35
+ end = i;
36
+ break;
37
+ }
38
+ }
39
+ const hostPort = rest.slice(0, end);
40
+ if (!URL_HOST_RE.test(hostPort)) return false;
41
+ const host = hostPort.split(":")[0];
42
+ if (host === "localhost") return true;
43
+ const dot = host.lastIndexOf(".");
44
+ if (dot < 1) return false;
45
+ const tld = host.slice(dot + 1);
46
+ if (tld.length < 2) return false;
47
+ for (const ch of tld) {
48
+ const isAlpha = ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z";
49
+ if (!isAlpha) return false;
50
+ }
51
+ return true;
52
+ }
53
+ function parseNumeric(value) {
54
+ if (!NUMBER_RE.test(value)) return null;
55
+ const n = Number(value);
56
+ return Number.isFinite(n) ? n : null;
57
+ }
58
+ function matchesType(type, value) {
59
+ switch (type) {
60
+ case "email":
61
+ return isEmail(value);
62
+ case "phone":
63
+ return isPhone(value);
64
+ case "url":
65
+ return isUrl(value);
66
+ case "number":
67
+ return NUMBER_RE.test(value);
68
+ case "integer":
69
+ return INTEGER_RE.test(value);
70
+ // Additive decoding: an unknown type is NOT a failure. A renderer that has
71
+ // not shipped a new type yet must let the value through rather than block a
72
+ // form it cannot understand — the server still re-validates on submit.
73
+ default:
74
+ return true;
75
+ }
76
+ }
77
+ function validate(rule, rawValue) {
78
+ if (!rule) return null;
79
+ const value = rawValue ?? "";
80
+ if (value.length === 0) {
81
+ return rule.required === true ? { rule: "required" } : null;
82
+ }
83
+ if (rule.type && !matchesType(rule.type, value)) {
84
+ return { rule: "type", type: rule.type };
85
+ }
86
+ if (rule.regex) {
87
+ let ok;
88
+ try {
89
+ ok = new RegExp(`^(?:${rule.regex})$`).test(value);
90
+ } catch {
91
+ ok = true;
92
+ }
93
+ if (!ok) return { rule: "regex" };
94
+ }
95
+ if (typeof rule.minLength === "number" && rule.minLength > 0 && value.length < rule.minLength) {
96
+ return { rule: "minLength", limit: rule.minLength };
97
+ }
98
+ if (typeof rule.maxLength === "number" && rule.maxLength > 0 && value.length > rule.maxLength) {
99
+ return { rule: "maxLength", limit: rule.maxLength };
100
+ }
101
+ if (typeof rule.minValue === "number" || typeof rule.maxValue === "number") {
102
+ const n = parseNumeric(value);
103
+ if (n !== null) {
104
+ if (typeof rule.minValue === "number" && n < rule.minValue) {
105
+ return { rule: "minValue", limit: rule.minValue };
106
+ }
107
+ if (typeof rule.maxValue === "number" && n > rule.maxValue) {
108
+ return { rule: "maxValue", limit: rule.maxValue };
109
+ }
110
+ }
111
+ }
112
+ return null;
113
+ }
114
+
1
115
  // ../../core/sdk/state/src/index.ts
2
116
  function defineService(name, def) {
3
117
  const himalaya = globalThis.himalaya;
@@ -9,6 +123,179 @@ function defineService(name, def) {
9
123
  return himalaya.defineService(name, def);
10
124
  }
11
125
 
126
+ // ../../stdlib/flows/auth/src/copy.generated.ts
127
+ var copy_generated_default = {
128
+ "auth.gate.title": "Welcome",
129
+ "auth.gate.subtitle": "Sign in to continue",
130
+ "auth.gate.signIn": "Sign In",
131
+ "auth.gate.createAccount": "Create account",
132
+ "auth.gate.resetPassword": "Reset password",
133
+ "auth.gate.verifyTitle": "Verify it's you",
134
+ "auth.gate.sendResetLink": "Send reset link",
135
+ "auth.gate.verify": "Verify",
136
+ "auth.gate.continue": "Continue",
137
+ "auth.gate.forgotPassword": "Forgot password?",
138
+ "auth.gate.backToSignIn": "Back to sign in",
139
+ "auth.gate.continueWith": "Continue with {provider}",
140
+ "auth.gate.sendCodeVia": "Send code via",
141
+ "auth.gate.resendCode": "Didn't get it? Resend code",
142
+ "auth.gate.field.code": "Verification code",
143
+ "auth.gate.field.email": "Email",
144
+ "auth.gate.field.name": "Name",
145
+ "auth.gate.field.password": "Password",
146
+ "auth.gate.field.captcha": "reCAPTCHA token (account only)",
147
+ "auth.gate.password.show": "Show password",
148
+ "auth.gate.password.hide": "Hide password",
149
+ "auth.gate.notice.codeResent": "A new code was sent.",
150
+ "auth.gate.notice.codeSentVia": "Code sent via {method}.",
151
+ "auth.gate.notice.resetSent": "If that email is registered, a reset link is on its way.",
152
+ "auth.biometric.unlockWith": "Unlock with {method}",
153
+ "auth.biometric.orPassword": "or sign in with your password",
154
+ "auth.biometric.label.faceId": "Face ID",
155
+ "auth.biometric.label.touchId": "Touch ID",
156
+ "auth.biometric.label.faceUnlock": "Face Unlock",
157
+ "auth.biometric.label.fingerprint": "Fingerprint",
158
+ "auth.biometric.label.generic": "biometrics",
159
+ "auth.biometric.prompt.usePassword": "Use password",
160
+ "auth.biometric.error.unavailable": "Biometric unlock isn't available on this device.",
161
+ "auth.biometric.error.cancelled": "Biometric unlock was cancelled.",
162
+ "auth.biometric.error.notEnrolled": "No Face ID / Touch ID is enrolled.",
163
+ "auth.biometric.error.failed": "Biometric unlock failed.",
164
+ "auth.biometric.error.invalidated": "Biometrics changed; sign in again.",
165
+ "auth.biometric.prompt.unlock": "Unlock your account",
166
+ "auth.biometric.prompt.disable": "Confirm to turn off biometric unlock",
167
+ "auth.biometric.enrollTitle": "Unlock with {method}?",
168
+ "auth.biometric.enrollMessage": "Use {method} instead of your password the next time you open the app.",
169
+ "auth.biometric.enrollAccept": "Use {method}",
170
+ "auth.biometric.enrollDecline": "Not now",
171
+ "auth.error.invalidCredentials": "Wrong email or password.",
172
+ "auth.error.accountNotFound": "We couldn't find an account for that email.",
173
+ "auth.error.emailInUse": "That email is already registered.",
174
+ "auth.error.verificationRequired": "Additional verification is required.",
175
+ "auth.error.verifyEmail": "Check your email to verify your account, then sign in.",
176
+ "auth.error.incorrectCode": "Incorrect code.",
177
+ "auth.error.network": "Network error.",
178
+ "auth.error.visitorToken": "Could not obtain a visitor token.",
179
+ "auth.error.noSessionToken": "Login succeeded but no session token.",
180
+ "auth.error.authSession": "Could not create an auth session.",
181
+ "auth.error.signInIncomplete": "Sign-in did not complete.",
182
+ "auth.error.tokenExchange": "Token exchange failed.",
183
+ "auth.error.noRedirect": "No auth redirect.",
184
+ "auth.error.registrationFailed": "Registration failed ({code}).",
185
+ "auth.error.twoFactorRequired": "Two-factor verification required.",
186
+ "auth.error.noPendingVerification": "No pending verification.",
187
+ "auth.error.verificationCancelled": "Verification cancelled.",
188
+ "auth.error.biometricSignInFirst": "Sign in before enabling biometric unlock.",
189
+ "auth.error.noSessionToProtect": "No session to protect.",
190
+ "auth.error.biometricEnableFailed": "Couldn't enable biometric unlock.",
191
+ "auth.error.biometricUnlockFailed": "Couldn't unlock. Sign in with your password.",
192
+ "auth.error.biometricsUnavailable": "Biometrics unavailable.",
193
+ "auth.error.noBiometricsEnrolled": "No biometrics enrolled.",
194
+ "auth.error.biometricNotEnabled": "Biometric unlock not enabled.",
195
+ "auth.error.unsupported": "Unsupported.",
196
+ "auth.error.methodUnavailable": "This sign-in method isn't available.",
197
+ "auth.error.verificationRequiredRetry": "Additional verification is required. Please try again.",
198
+ "auth.error.networkRetry": "Network error. Please try again.",
199
+ "auth.error.signInCancelled": "Sign-in was cancelled.",
200
+ "auth.error.genericRetry": "Something went wrong. Please try again.",
201
+ "auth.error.biometricLocked": "Locked: unlock with biometrics first.",
202
+ "auth.error.googleNoPresenter": "No presenter for Google sign-in.",
203
+ "auth.error.googleNoToken": "Google sign-in returned no id_token.",
204
+ "auth.error.appleNoToken": "Apple sign-in returned no token.",
205
+ "auth.error.memberSettingsUnreadable": "Could not read the site's member settings.",
206
+ "auth.error.memberSettingsMalformed": "Member settings response was not a JSON object.",
207
+ "auth.biometric.error.noCipher": "No cipher.",
208
+ "auth.error.unlockOvertaken": "Unlock overtaken by a sign-in or sign-out.",
209
+ "auth.gate.code.show": "Show code",
210
+ "auth.gate.code.hide": "Hide code",
211
+ "auth.feedback.invalid_input": "Check the highlighted fields and try again.",
212
+ "auth.feedback.invalid_credentials": "The email or password is incorrect. Check your details or reset your password.",
213
+ "auth.feedback.registration_failed": "We could not create an account. Check your details, or try signing in or resetting your password.",
214
+ "auth.feedback.invalid_code": "That code is invalid or has expired. Check the code or request a new one.",
215
+ "auth.feedback.expired_code": "That code has expired. Request a new code and try again.",
216
+ "auth.feedback.totp": "That code did not work. Enter the current code from your authenticator app.",
217
+ "auth.feedback.network": "We could not connect. Check your connection and try again.",
218
+ "auth.feedback.rate_limited": "Too many attempts. Wait a few minutes and try again.",
219
+ "auth.feedback.unavailable": "This action is not available here. Use a supported sign-in method or open the app.",
220
+ "auth.feedback.cancelled": "Sign-in was cancelled. Try again when you are ready.",
221
+ "auth.feedback.verification_required": "Complete verification to continue, then try again.",
222
+ "auth.feedback.unknown": "We could not complete this action. Please try again.",
223
+ "auth.validation.emailRequired": "Enter your email address.",
224
+ "auth.validation.emailInvalid": "Enter a valid email address.",
225
+ "auth.validation.passwordMinimum": "Use at least 8 characters for your new password.",
226
+ "auth.validation.passwordRequired": "Enter your password.",
227
+ "auth.validation.codeRequired": "Enter your verification code.",
228
+ "auth.validation.nameRequired": "Enter your name.",
229
+ "auth.feedback.busy": "Please wait\u2026",
230
+ "auth.gate.verify.title": "Verify your email",
231
+ "auth.gate.verify.body": "Enter the confirmation code sent to your email to finish signing in.",
232
+ "auth.gate.cancel": "Cancel",
233
+ "auth.gate.codePlaceholder": "Confirmation code"
234
+ };
235
+
236
+ // ../../stdlib/flows/auth/src/feedback.ts
237
+ var failureKeys = {
238
+ invalid_input: "auth.feedback.invalid_input",
239
+ invalid_credentials: "auth.feedback.invalid_credentials",
240
+ registration_failed: "auth.feedback.registration_failed",
241
+ invalid_code: "auth.feedback.invalid_code",
242
+ expired_code: "auth.feedback.expired_code",
243
+ network: "auth.feedback.network",
244
+ rate_limited: "auth.feedback.rate_limited",
245
+ unavailable: "auth.feedback.unavailable",
246
+ cancelled: "auth.feedback.cancelled",
247
+ verification_required: "auth.feedback.verification_required",
248
+ unknown: "auth.feedback.unknown"
249
+ };
250
+ var codes = new Set(Object.keys(failureKeys));
251
+ var aliases = {
252
+ invalidCredentials: "invalid_credentials",
253
+ emailInUse: "registration_failed",
254
+ unsupported: "unavailable",
255
+ recaptchaRequired: "verification_required",
256
+ needsTwoFactor: "verification_required",
257
+ INVALID_CREDENTIALS: "invalid_credentials",
258
+ EMAIL_IN_USE: "registration_failed",
259
+ UNSUPPORTED: "unavailable",
260
+ NETWORK: "network",
261
+ CANCELLED: "cancelled",
262
+ RECAPTCHA_REQUIRED: "verification_required",
263
+ INVALID_CODE: "invalid_code",
264
+ EXPIRED_CODE: "expired_code",
265
+ TOO_MANY_REQUESTS: "rate_limited"
266
+ };
267
+ function authMessage(key, translate) {
268
+ const translated = translate?.(key);
269
+ return translated && translated !== key ? translated : copy_generated_default[key] ?? copy_generated_default["auth.feedback.unknown"];
270
+ }
271
+ function authFailure(raw, operation = "signIn", translate) {
272
+ const value = raw && typeof raw === "object" ? raw : {};
273
+ const payload = value.payload && typeof value.payload === "object" ? value.payload : value;
274
+ const named = payload.code ?? value.code ?? value.kind;
275
+ const status = value.statusCode ?? value.status;
276
+ let code = codes.has(named) ? named : aliases[named] ?? "unknown";
277
+ if (status === 429) code = "rate_limited";
278
+ else if ([404, 405, 501].includes(status)) code = "unavailable";
279
+ else if ([401, 403].includes(status) && operation === "signIn") code = "invalid_credentials";
280
+ else if (status === 0 || status >= 500 || value.name === "TypeError" || value.name === "TimeoutError") code = "network";
281
+ if (operation === "verify" && code === "invalid_credentials") code = "invalid_code";
282
+ if (operation === "register" && code === "invalid_credentials") code = "registration_failed";
283
+ return { code, reason: authMessage(failureKeys[code], translate) };
284
+ }
285
+ function identityErrors(input, operation, requireName = false) {
286
+ const errors = {};
287
+ if (operation === "verify") {
288
+ if (!input.code?.trim()) errors.code = "auth.validation.codeRequired";
289
+ return errors;
290
+ }
291
+ const email = input.email?.trim() ?? "";
292
+ if (!email) errors.email = "auth.validation.emailRequired";
293
+ else if (validate({ type: "email" }, email)) errors.email = "auth.validation.emailInvalid";
294
+ if ((operation === "signIn" || operation === "register") && !input.password?.length) errors.password = "auth.validation.passwordRequired";
295
+ if (operation === "register" && requireName && !input.name?.trim()) errors.name = "auth.validation.nameRequired";
296
+ return errors;
297
+ }
298
+
12
299
  // ../../stdlib/flows/auth/src/index.ts
13
300
  async function dispatch(handlerId, params) {
14
301
  const fn = globalThis.himalaya?.dispatch;
@@ -23,12 +310,6 @@ function emailOf(raw) {
23
310
  const email = direct?.email ?? wrapped?.payload?.email;
24
311
  return typeof email === "string" ? email : "";
25
312
  }
26
- function reasonOf(raw, fallback) {
27
- const direct = raw;
28
- const wrapped = raw;
29
- const err = direct?.error ?? wrapped?.payload?.error;
30
- return typeof err === "string" && err ? err : fallback;
31
- }
32
313
  function reportedOk(raw) {
33
314
  const status = raw?.status;
34
315
  if (typeof status !== "string") return true;
@@ -49,9 +330,9 @@ async function attempt(action2, params, failureText, opts) {
49
330
  try {
50
331
  raw = await dispatch(id(opts, action2), params);
51
332
  } catch (e) {
52
- return { ok: false, reason: e?.message || failureText };
333
+ return { ok: false, ...authFailure(e, action2 === "registerDirect" ? "register" : "signIn") };
53
334
  }
54
- if (!reportedOk(raw)) return { ok: false, reason: reasonOf(raw, failureText) };
335
+ if (!reportedOk(raw) || raw?.error || raw?.payload?.error) return { ok: false, ...authFailure(raw, action2 === "registerDirect" ? "register" : "signIn") };
55
336
  const state = await authState(opts);
56
337
  if (!state.signedIn) {
57
338
  return { ok: false, reason: failureText };
@@ -59,24 +340,24 @@ async function attempt(action2, params, failureText, opts) {
59
340
  return { ok: true, email: state.email };
60
341
  }
61
342
  function signInDirect(email, password, opts) {
62
- if (!email || !password) {
63
- return Promise.resolve({ ok: false, reason: "Enter your email and password." });
343
+ if (Object.keys(identityErrors({ email: email.trim(), password }, "signIn")).length) {
344
+ return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input") });
64
345
  }
65
346
  return attempt(
66
347
  "signInDirect",
67
- { email, password },
348
+ { email: email.trim(), password },
68
349
  "Sign-in did not complete. Please try again.",
69
350
  opts
70
351
  );
71
352
  }
72
353
  function registerMember(email, password, profile, opts) {
73
- if (!email || !password) {
74
- return Promise.resolve({ ok: false, reason: "Enter your email and password." });
354
+ if (Object.keys(identityErrors({ email: email.trim(), password }, "register")).length) {
355
+ return Promise.resolve({ ok: false, code: "invalid_input", reason: authMessage("auth.feedback.invalid_input") });
75
356
  }
76
357
  return attempt(
77
358
  "registerDirect",
78
359
  {
79
- email,
360
+ email: email.trim(),
80
361
  password,
81
362
  ...profile?.firstName ? { firstName: profile.firstName } : {},
82
363
  ...profile?.lastName ? { lastName: profile.lastName } : {}
@@ -1357,21 +1638,21 @@ function toPayment(raw, status) {
1357
1638
  const ids = { paymentId: raw.id, appId: raw.appId, memberId: raw.memberId, wixTransactionId: raw.wixTransactionId };
1358
1639
  return { ...ids, status, ...withoutUndefined(optional) };
1359
1640
  }
1360
- function classifyFailure(error, operation, codes) {
1641
+ function classifyFailure(error, operation, codes2) {
1361
1642
  const message = messageOf(error);
1362
1643
  if (BRIDGE_REFUSAL.test(message)) return failure(operation, "notEnabled");
1363
1644
  if (PRINCIPAL_CHANGED.test(message)) return failure(operation, "sessionChanged");
1364
1645
  const http = /^HTTP (\d{3})(?: \[([^\]]+)\])?:/.exec(message);
1365
1646
  if (!http) return failure(operation, "unavailable");
1366
- return classifyHttp({ operation, codes, httpStatus: Number(http[1]), code: http[2] ?? "" });
1647
+ return classifyHttp({ operation, codes: codes2, httpStatus: Number(http[1]), code: http[2] ?? "" });
1367
1648
  }
1368
1649
  function failure(operation, kind) {
1369
1650
  return { status: "failed", operation, kind };
1370
1651
  }
1371
1652
  function classifyHttp(refusal) {
1372
- const { operation, codes, httpStatus, code } = refusal;
1653
+ const { operation, codes: codes2, httpStatus, code } = refusal;
1373
1654
  if (code === "PRINCIPAL_CHANGED") return failure(operation, "sessionChanged");
1374
- if (isOneOf(codes, code)) return { status: "failed", operation, kind: "application", code, httpStatus };
1655
+ if (isOneOf(codes2, code)) return { status: "failed", operation, kind: "application", code, httpStatus };
1375
1656
  return { status: "failed", operation, kind: kindForStatus(httpStatus, code), httpStatus };
1376
1657
  }
1377
1658
  function kindForStatus(httpStatus, code) {
@@ -1400,8 +1681,8 @@ function withoutUndefined(value) {
1400
1681
  }
1401
1682
  return kept;
1402
1683
  }
1403
- function isOneOf(codes, code) {
1404
- return codes.includes(code);
1684
+ function isOneOf(codes2, code) {
1685
+ return codes2.includes(code);
1405
1686
  }
1406
1687
  function ownValue(table, key) {
1407
1688
  return typeof key === "string" && Object.prototype.hasOwnProperty.call(table, key) ? table[key] : void 0;
@@ -3230,6 +3511,81 @@ var text = (id2, value, style = "body") => node(id2, "Text", { text: value, styl
3230
3511
  var vstack = (id2, children, spacing = 12, alignment = "leading") => node(id2, "VStack", { spacing, alignment, children });
3231
3512
  var button = (id2, title, action2, style = "primary") => node(id2, "Button", { title, style, fullWidth: true, action: action2 });
3232
3513
  var openScreen = (screenId) => ({ actionId: "himi.open", params: { screenId } });
3514
+ function detailedHeader(opts) {
3515
+ const id2 = opts.id ?? "detailed_header";
3516
+ const cardChildren = [];
3517
+ if (opts.logoUrl || opts.locationLabel) {
3518
+ const identity = [];
3519
+ if (opts.logoUrl) {
3520
+ identity.push(node(`${id2}.logo`, "Image", {
3521
+ url: opts.logoUrl,
3522
+ width: 56,
3523
+ height: 56,
3524
+ shape: "rounded",
3525
+ contentMode: "fill",
3526
+ contentDescription: opts.title
3527
+ }));
3528
+ }
3529
+ if (opts.locationLabel) {
3530
+ if (opts.locationAction) {
3531
+ identity.push(node(`${id2}.locationGroup`, "HStack", {
3532
+ spacing: 8,
3533
+ alignment: "center",
3534
+ children: [
3535
+ text(`${id2}.location`, opts.locationLabel, "caption"),
3536
+ node(`${id2}.location.action`, "Button", {
3537
+ title: opts.locationAction.label,
3538
+ style: opts.locationAction.style ?? "plain",
3539
+ fullWidth: false,
3540
+ action: opts.locationAction.action
3541
+ })
3542
+ ]
3543
+ }));
3544
+ } else {
3545
+ identity.push(text(`${id2}.location`, opts.locationLabel, "caption"));
3546
+ }
3547
+ }
3548
+ cardChildren.push(node(`${id2}.identity`, "HStack", { spacing: 12, alignment: "center", children: identity }));
3549
+ }
3550
+ if (opts.memberCaption || opts.memberAvatarsPath || opts.memberAvatars?.length) {
3551
+ cardChildren.push(node(`${id2}.members`, "AvatarStrip", {
3552
+ size: 36,
3553
+ maxVisible: 5,
3554
+ ...opts.memberCaption ? { caption: opts.memberCaption } : {},
3555
+ ...opts.memberAvatarsPath ? { avatarsPath: opts.memberAvatarsPath } : {},
3556
+ ...!opts.memberAvatarsPath && opts.memberAvatars ? { avatars: opts.memberAvatars } : {}
3557
+ }));
3558
+ }
3559
+ for (const [key, action2] of [
3560
+ ["invite", opts.inviteAction],
3561
+ ["primary", opts.primaryAction],
3562
+ ["about", opts.aboutAction]
3563
+ ]) {
3564
+ if (action2) cardChildren.push(button(`${id2}.${key}`, action2.label, action2.action, action2.style ?? (key === "primary" ? "primary" : "secondary")));
3565
+ }
3566
+ const card = node(`${id2}.card`, "VStack", {
3567
+ spacing: 14,
3568
+ alignment: "leading",
3569
+ children: cardChildren
3570
+ });
3571
+ card.modifiers = {
3572
+ background: { token: "surfacePrimary" },
3573
+ cornerRadius: 24,
3574
+ padding: { leading: 20, trailing: 20, top: 20, bottom: 20 },
3575
+ offsetY: -20,
3576
+ fillMaxWidth: true
3577
+ };
3578
+ const fixed = opts.collapsible === false;
3579
+ return node(id2, "CollapsingHeader", {
3580
+ ...opts.imageUrl ? { imageUrl: opts.imageUrl } : {},
3581
+ title: opts.title,
3582
+ ...opts.subtitle ? { subtitle: opts.subtitle } : {},
3583
+ expandedHeight: fixed ? opts.expandedHeight ?? 240 : opts.expandedHeight ?? 280,
3584
+ collapsedHeight: fixed ? opts.expandedHeight ?? 240 : opts.collapsedHeight ?? 68,
3585
+ children: [...cardChildren.length ? [card] : [], ...opts.content ?? []],
3586
+ parallaxFactor: 0.45
3587
+ });
3588
+ }
3233
3589
  function envelope(screenId, title, root, logic) {
3234
3590
  return {
3235
3591
  screenId,
@@ -3807,6 +4163,7 @@ export {
3807
4163
  checkoutScreen,
3808
4164
  createAuthService,
3809
4165
  createCheckoutService,
4166
+ detailedHeader,
3810
4167
  entitlement
3811
4168
  };
3812
4169
  //# sourceMappingURL=screens.mjs.map