@wix/himalaya-cli 0.1641.0 → 0.1643.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 (89) hide show
  1. package/dist/cli.mjs +327 -155
  2. package/guides/himi-json-output.md +20 -1
  3. package/guides/qa-builds.md +33 -0
  4. package/package.json +2 -2
  5. package/template-icons/conference.png +0 -0
  6. package/templates/branded-lite/dev/index.ts +152 -88
  7. package/templates/branded-lite/l10n/en.json +1 -1
  8. package/templates/branded-lite/tier5-src/_shared/featured-event.ts +63 -0
  9. package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +93 -11
  10. package/templates/community-club/dev/index.ts +152 -88
  11. package/templates/community-club/tier5-src/_shared/featured-event.ts +63 -0
  12. package/templates/community-club/tier5-src/himi-events-detail/index.ts +93 -11
  13. package/templates/conference/README.md +53 -0
  14. package/templates/conference/config.ts +321 -0
  15. package/templates/conference/dev/index.ts +17252 -0
  16. package/templates/conference/himalaya.content.json +46 -0
  17. package/templates/conference/himalaya.template.json +15 -0
  18. package/templates/conference/icon.png +0 -0
  19. package/templates/conference/platforms.json +1 -0
  20. package/templates/conference/tier5-src/_shared/agenda-stars.ts +64 -0
  21. package/templates/conference/tier5-src/_shared/app-locale.ts +61 -0
  22. package/templates/conference/tier5-src/_shared/branded-lite-hosted.ts +279 -0
  23. package/templates/conference/tier5-src/_shared/branded-load-state.ts +109 -0
  24. package/templates/conference/tier5-src/_shared/business-chat-copy.ts +40 -0
  25. package/templates/conference/tier5-src/_shared/business-chat-history.ts +51 -0
  26. package/templates/conference/tier5-src/_shared/business-chat-message-model.ts +177 -0
  27. package/templates/conference/tier5-src/_shared/business-chat-model.ts +56 -0
  28. package/templates/conference/tier5-src/_shared/business-chat-presenter.ts +576 -0
  29. package/templates/conference/tier5-src/_shared/business-chat-transport.ts +148 -0
  30. package/templates/conference/tier5-src/_shared/collection-contract.ts +229 -0
  31. package/templates/conference/tier5-src/_shared/collection-query.ts +193 -0
  32. package/templates/conference/tier5-src/_shared/collection-service.ts +400 -0
  33. package/templates/conference/tier5-src/_shared/engine-intl.ts +508 -0
  34. package/templates/conference/tier5-src/_shared/event-agenda.ts +122 -0
  35. package/templates/conference/tier5-src/_shared/event-registration.ts +86 -0
  36. package/templates/conference/tier5-src/_shared/featured-event.ts +63 -0
  37. package/templates/conference/tier5-src/_shared/himi-account.ts +164 -0
  38. package/templates/conference/tier5-src/_shared/himi-copy.ts +89 -0
  39. package/templates/conference/tier5-src/_shared/himi-events.ts +65 -0
  40. package/templates/conference/tier5-src/_shared/himi-store.ts +7 -0
  41. package/templates/conference/tier5-src/_shared/hosted-checkout.ts +70 -0
  42. package/templates/conference/tier5-src/_shared/iap-attendance-form.ts +106 -0
  43. package/templates/conference/tier5-src/_shared/iap-attendance-purchase.ts +211 -0
  44. package/templates/conference/tier5-src/_shared/iap-attendance.ts +38 -0
  45. package/templates/conference/tier5-src/_shared/iap-worker.ts +125 -0
  46. package/templates/conference/tier5-src/_shared/inbox-rooms.ts +68 -0
  47. package/templates/conference/tier5-src/_shared/local-preferences.ts +38 -0
  48. package/templates/conference/tier5-src/_shared/member-access.ts +52 -0
  49. package/templates/conference/tier5-src/_shared/member-account-routes.ts +52 -0
  50. package/templates/conference/tier5-src/_shared/member-read.ts +52 -0
  51. package/templates/conference/tier5-src/_shared/member-screen.ts +99 -0
  52. package/templates/conference/tier5-src/_shared/offset-page.ts +10 -0
  53. package/templates/conference/tier5-src/_shared/online-actions.ts +76 -0
  54. package/templates/conference/tier5-src/_shared/owner-load-error.ts +348 -0
  55. package/templates/conference/tier5-src/_shared/payment-setup.ts +6 -0
  56. package/templates/conference/tier5-src/_shared/rich-body.ts +78 -0
  57. package/templates/conference/tier5-src/_shared/rich-content-link.ts +34 -0
  58. package/templates/conference/tier5-src/_shared/sign-in-sheet.ts +18 -0
  59. package/templates/conference/tier5-src/business-chat/index.ts +724 -0
  60. package/templates/conference/tier5-src/himi-conference-agenda/index.ts +183 -0
  61. package/templates/conference/tier5-src/himi-conference-home/index.ts +389 -0
  62. package/templates/conference/tier5-src/himi-events-account/index.ts +219 -0
  63. package/templates/conference/tier5-src/himi-events-detail/index.ts +1304 -0
  64. package/templates/conference/tier5-src/himi-events-list/index.ts +124 -0
  65. package/templates/conference/tier5-src/himi-events-my-events/index.ts +225 -0
  66. package/templates/conference/tier5-src/himi-events-rsvp/index.ts +230 -0
  67. package/templates/conference/tier5-src/himi-store-account/index.ts +998 -0
  68. package/templates/conference/tokens.json +365 -0
  69. package/templates/events-meetups/dev/index.ts +152 -88
  70. package/templates/events-meetups/tier5-src/_shared/featured-event.ts +63 -0
  71. package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +93 -11
  72. package/templates/gym-fitness/dev/index.ts +152 -88
  73. package/templates/gym-fitness/tier5-src/_shared/featured-event.ts +63 -0
  74. package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +93 -11
  75. package/templates/nonprofit-cause/dev/index.ts +152 -88
  76. package/templates/nonprofit-cause/tier5-src/_shared/featured-event.ts +63 -0
  77. package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +93 -11
  78. package/templates/podcast-creator/dev/index.ts +152 -88
  79. package/templates/podcast-creator/tier5-src/_shared/featured-event.ts +63 -0
  80. package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +93 -11
  81. package/templates/portfolio-creative/dev/index.ts +152 -88
  82. package/templates/portfolio-creative/tier5-src/_shared/featured-event.ts +63 -0
  83. package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +93 -11
  84. package/templates/restaurant/dev/index.ts +152 -88
  85. package/templates/restaurant/tier5-src/_shared/featured-event.ts +63 -0
  86. package/templates/restaurant/tier5-src/himi-events-detail/index.ts +93 -11
  87. package/templates/yoga-studio/dev/index.ts +152 -88
  88. package/templates/yoga-studio/tier5-src/_shared/featured-event.ts +63 -0
  89. package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +93 -11
@@ -6,7 +6,7 @@ repurposed when human wording changes. New codes may be added; consumers must
6
6
  handle an unknown code as a failure, without parsing prose.
7
7
 
8
8
  **Rollout:** this contract is enforced for **`himi push`**, including `--only`,
9
- first, for **`himi publish-size`**, for **`himi store iap connect`**, for **`himi site member-app`**, for **`himi fidelity`**, for the **`himi base44`** entity and function verbs, for **`himi l10n import`**, and for **`himi login --device`**. Other subcommands still have legacy failures without codes and are a
9
+ first, for **`himi publish-size`**, for **`himi store iap connect`**, for **`himi site member-app`**, for **`himi store app`**, for **`himi fidelity`**, for the **`himi base44`** entity and function verbs, for **`himi l10n import`**, and for **`himi login --device`**. Other subcommands still have legacy failures without codes and are a
10
10
  follow-up migration. This is an additive change: existing `error`, `errors`,
11
11
  `message`, `hint`, status, body, and gate-specific fields stay as they were.
12
12
  Some legacy envelopes have no singular `error` or `hint`; consumers must not
@@ -800,3 +800,22 @@ values on failures: `unauthorized`, `token_revoked`, `revocation_check_unavailab
800
800
  `apple_keys_unavailable`. `build_secrets_busy` is HTTP 409: another ASC upload or
801
801
  push setup holds the site; retry after it finishes. Responses have `Cache-Control:
802
802
  no-store`; both methods require app authority and current Wix site ownership.
803
+
804
+ ## `himi store app` codes
805
+
806
+ `himi store app set|show --app <id> --site <msid>` prints one envelope. A refusal from the publishing
807
+ service keeps the service's own code in `serverError` (for example `forbidden_app`,
808
+ `store_app_linked_to_other_site`, `store_app_site_taken`, `premium_plan_required`) and its HTTP
809
+ `status`; the CLI `code` is one of:
810
+
811
+ | Code | Meaning |
812
+ |---|---|
813
+ | `invalid_usage` | Missing or malformed op, `--app`, `--site` or (for `set`) `--android-package`, which is checked with the plane's own rule (`reason`: `package_name_prefix_required`, `invalid_package_name` or `package_name_reserved`). No Wix token was minted and nothing was sent. |
814
+ | `insecure_target` | The target's control URL is not an https `wix.com` host (or loopback), so the Wix credential was neither minted nor sent. Nothing was sent. |
815
+ | `control_token_required` | No control token for the target — run `himi login`. Nothing was sent. |
816
+ | `wix_token_unavailable` | The account Wix token (`wix token`) could not be minted; the publishing service needs it to verify you own the app and the site. Nothing was sent. |
817
+ | `unauthorized` | The control token was refused or revoked (401). |
818
+ | `forbidden` | Not your app, not your site, or the token may not act for the app (403); `serverError` says which. |
819
+ | `refused` | A rule refused it (another 4xx): the package name, another app holding the site's store app, the app linked to another site, no saved package name, the site's plan; `serverError` says which. |
820
+ | `control_unreachable` | The publishing service could not be reached. |
821
+ | `request_failed` | Any other failure (5xx); `status` and `serverError` say which. |
@@ -1259,6 +1259,39 @@ himi dist --app <app> --platform android --aab --wait --target bo
1259
1259
  `409 release_predates_store_builds`; a draft the editor just built is on a current commit. It is
1260
1260
  not sent the App name and icon either, so it cannot give their refusals (below). It never
1261
1261
  falls back to the locking call.
1262
+ - **An app you own, linked to a site you own, gets the same store build.** An app made with the
1263
+ CLI (`himi init`) is owned by your Wix account and bound to no site, so its `--aab` was
1264
+ `403 android_format_not_allowed`. Binding it to a site is the wrong tool: that converts it into a
1265
+ site app, after which your own `himi login` token can no longer push it. Instead, LINK it — the
1266
+ first save of its package name does it:
1267
+
1268
+ ```bash
1269
+ himi store app set --app <app> --site <msid> --android-package himi.<name> # link + save the package name
1270
+ himi store app show --app <app> --site <msid> # the store build's checks, no build
1271
+ himi dist --app <app> --platform android --shell branded-lite --aab \
1272
+ --app-name "My App" --app-icon-url https://…/icon.png
1273
+ ```
1274
+
1275
+ `set` is `PUT /v1/admin/site/store-app` and `show` is the store-build-check above, both with your
1276
+ `himi login` control token AND your account's Wix credential (`wix token`, sent as
1277
+ `Authorization`). The plane accepts the app only when the token's account is the app's OWNER (a
1278
+ collaborator is `403 forbidden_app`), that same account controls the Wix credential and owns the
1279
+ site (`403 forbidden_site`, or `store_build_site_forbidden` on the check), and the app is not
1280
+ already linked to another site (`409 store_app_linked_to_other_site`; moving needs Wix support,
1281
+ because a build may have locked the package name). It records a link (app → site, one site per
1282
+ app), holds the site's store app (`409 store_app_site_taken` if another app holds it), and saves
1283
+ the package name; the response says `linked: true` the first time. Only the Google Play package
1284
+ name is saved this way (`400 store_app_link_android_only` for iOS ids): App Store builds stay
1285
+ Containers-only. Before a link exists, the check and `GET /v1/admin/site/store-app` answer
1286
+ `409 store_app_requires_site_binding`, the code an unbound app always got.
1287
+
1288
+ `himi dist --aab` then finds the site from the link and runs every store-build check above against
1289
+ it, including the strict site-owner check, the store-app hold, the plan (`premium_plan_required`)
1290
+ and the package lock, with the app name and icon required, `branded-lite` only, WixOne signing.
1291
+ The link is re-checked on every build: if the app changed owner, was deactivated, or was since
1292
+ bound to a site, it no longer counts and the bundle is `403 android_format_not_allowed` again. The
1293
+ app is never site-bound anywhere else: push, CAPTCHA and every other route treat it as the
1294
+ account app it is. An `--android-signing owner` bundle keeps its own path.
1262
1295
  - **A Containers app's TestFlight build is an App Store build.** For an app bound to a Wix site,
1263
1296
  `--platform ios --destination testflight --version <x.y.z>` with no `--signing` builds the app for
1264
1297
  the owner's own App Store account: signed with the owner's certificate, under the bundle id saved
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1641.0",
3
+ "version": "0.1643.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -72,5 +72,5 @@
72
72
  "artifactId": "himalaya-cli"
73
73
  }
74
74
  },
75
- "falconPackageHash": "7af626ee21c1652fe37958bdb1e4a724c37de914dc7ddbfe1f6c15be"
75
+ "falconPackageHash": "924da2897698b20505e7c4aee688422ab2ed46b3e893055e0231df2c"
76
76
  }
Binary file
@@ -64350,6 +64350,7 @@ const SCREENS = runtimeSetting({
64350
64350
  "type": "HStack",
64351
64351
  "props": {
64352
64352
  "spacing": 10,
64353
+ "alignment": "center",
64353
64354
  "children": [
64354
64355
  {
64355
64356
  "id": "",
@@ -64363,7 +64364,8 @@ const SCREENS = runtimeSetting({
64363
64364
  }
64364
64365
  },
64365
64366
  "modifiers": {
64366
- "accessibilityRole": "decorative"
64367
+ "accessibilityRole": "decorative",
64368
+ "hiddenPath": "$service:himiMyEvents.signInRequired"
64367
64369
  }
64368
64370
  },
64369
64371
  {
@@ -64375,6 +64377,39 @@ const SCREENS = runtimeSetting({
64375
64377
  "text": "Something did not load.",
64376
64378
  "style": "bodyEmphasis"
64377
64379
  }
64380
+ },
64381
+ "modifiers": {
64382
+ "hiddenPath": "$service:himiMyEvents.signInRequired"
64383
+ }
64384
+ },
64385
+ {
64386
+ "id": "",
64387
+ "body": {
64388
+ "package": "himalaya",
64389
+ "type": "Icon",
64390
+ "props": {
64391
+ "name": "person",
64392
+ "size": 18,
64393
+ "tint": "textSecondary"
64394
+ }
64395
+ },
64396
+ "modifiers": {
64397
+ "accessibilityRole": "decorative",
64398
+ "hiddenPath": "$service:himiMyEvents.noSignIn"
64399
+ }
64400
+ },
64401
+ {
64402
+ "id": "",
64403
+ "body": {
64404
+ "package": "himalaya",
64405
+ "type": "Text",
64406
+ "props": {
64407
+ "text": "Sign in to see your events.",
64408
+ "style": "bodyEmphasis"
64409
+ }
64410
+ },
64411
+ "modifiers": {
64412
+ "hiddenPath": "$service:himiMyEvents.noSignIn"
64378
64413
  }
64379
64414
  }
64380
64415
  ]
@@ -104801,12 +104836,19 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
104801
104836
  }
104802
104837
  },
104803
104838
  {
104804
- "id": "",
104839
+ "id": "himi_event.full_schedule",
104805
104840
  "body": {
104806
104841
  "package": "himalaya",
104807
104842
  "type": "DisclosureGroup",
104808
104843
  "props": {
104809
104844
  "title": "See Full Schedule",
104845
+ "expandedPath": "$service:himiEventDetail.fullScheduleOpen",
104846
+ "onToggle": {
104847
+ "actionId": "tier5.himiEventDetail.toggleDisclosure",
104848
+ "params": {
104849
+ "id": "fullSchedule"
104850
+ }
104851
+ },
104810
104852
  "content": [
104811
104853
  {
104812
104854
  "id": "",
@@ -104992,12 +105034,19 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
104992
105034
  }
104993
105035
  },
104994
105036
  {
104995
- "id": "",
105037
+ "id": "himi_event.all_dates",
104996
105038
  "body": {
104997
105039
  "package": "himalaya",
104998
105040
  "type": "DisclosureGroup",
104999
105041
  "props": {
105000
105042
  "title": "See All Dates",
105043
+ "expandedPath": "$service:himiEventDetail.allDatesOpen",
105044
+ "onToggle": {
105045
+ "actionId": "tier5.himiEventDetail.toggleDisclosure",
105046
+ "params": {
105047
+ "id": "allDates"
105048
+ }
105049
+ },
105001
105050
  "content": [
105002
105051
  {
105003
105052
  "id": "",
@@ -105093,6 +105142,13 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
105093
105142
  "type": "DisclosureGroup",
105094
105143
  "props": {
105095
105144
  "title": "Policies",
105145
+ "expandedPath": "$service:himiEventDetail.policiesOpen",
105146
+ "onToggle": {
105147
+ "actionId": "tier5.himiEventDetail.toggleDisclosure",
105148
+ "params": {
105149
+ "id": "policies"
105150
+ }
105151
+ },
105096
105152
  "content": [
105097
105153
  {
105098
105154
  "id": "",
@@ -105241,8 +105297,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
105241
105297
  "props": {
105242
105298
  "presentedPath": "$service:himiEventDetail.ticketSheetOpen",
105243
105299
  "detents": [
105244
- 0.48,
105245
- 0.9
105300
+ 0.62
105246
105301
  ],
105247
105302
  "showGrabber": true,
105248
105303
  "dismissible": true,
@@ -105312,6 +105367,89 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
105312
105367
  }
105313
105368
  }
105314
105369
  },
105370
+ {
105371
+ "id": "himi_event.ticket_summary",
105372
+ "body": {
105373
+ "package": "himalaya",
105374
+ "type": "VStack",
105375
+ "props": {
105376
+ "spacing": 8,
105377
+ "children": [
105378
+ {
105379
+ "id": "",
105380
+ "body": {
105381
+ "package": "himalaya",
105382
+ "type": "Text",
105383
+ "props": {
105384
+ "text": "$service:himiEventDetail.ticketCountLabel",
105385
+ "style": "caption",
105386
+ "color": "textSecondary"
105387
+ }
105388
+ }
105389
+ },
105390
+ {
105391
+ "id": "",
105392
+ "body": {
105393
+ "package": "himalaya",
105394
+ "type": "HStack",
105395
+ "props": {
105396
+ "spacing": 12,
105397
+ "alignment": "center",
105398
+ "children": [
105399
+ {
105400
+ "id": "",
105401
+ "body": {
105402
+ "package": "himalaya",
105403
+ "type": "Text",
105404
+ "props": {
105405
+ "text": "$service:himiEventDetail.ticketTotal",
105406
+ "style": "title3",
105407
+ "monospacedDigits": true
105408
+ }
105409
+ }
105410
+ },
105411
+ {
105412
+ "id": "",
105413
+ "body": {
105414
+ "package": "himalaya",
105415
+ "type": "Spacer",
105416
+ "props": {}
105417
+ }
105418
+ },
105419
+ {
105420
+ "id": "himi_event.checkout",
105421
+ "body": {
105422
+ "package": "himalaya",
105423
+ "type": "Button",
105424
+ "props": {
105425
+ "title": "Checkout",
105426
+ "style": "primary",
105427
+ "disabledPath": "$service:himiEventDetail.checkoutDisabled",
105428
+ "action": {
105429
+ "actionId": "tier5.himiEventDetail.checkout"
105430
+ }
105431
+ }
105432
+ }
105433
+ }
105434
+ ]
105435
+ }
105436
+ }
105437
+ },
105438
+ {
105439
+ "id": "",
105440
+ "body": {
105441
+ "package": "himalaya",
105442
+ "type": "Divider",
105443
+ "props": {}
105444
+ }
105445
+ }
105446
+ ]
105447
+ }
105448
+ },
105449
+ "modifiers": {
105450
+ "hiddenPath": "$service:himiEventDetail.regularTicketsHidden"
105451
+ }
105452
+ },
105315
105453
  {
105316
105454
  "id": "",
105317
105455
  "body": {
@@ -105411,12 +105549,20 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
105411
105549
  }
105412
105550
  },
105413
105551
  {
105414
- "id": "",
105552
+ "id": "himi_event.ticket_terms",
105415
105553
  "body": {
105416
105554
  "package": "himalaya",
105417
105555
  "type": "DisclosureGroup",
105418
105556
  "props": {
105419
105557
  "title": "Ticket terms",
105558
+ "expandedPath": "$item.termsOpen",
105559
+ "onToggle": {
105560
+ "actionId": "tier5.himiEventDetail.toggleDisclosure",
105561
+ "params": {
105562
+ "id": "terms",
105563
+ "tier": "$item.id"
105564
+ }
105565
+ },
105420
105566
  "content": [
105421
105567
  {
105422
105568
  "id": "",
@@ -105931,88 +106077,6 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
105931
106077
  "modifiers": {
105932
106078
  "hiddenPath": "$service:himiEventDetail.iapBuyHidden"
105933
106079
  }
105934
- },
105935
- {
105936
- "id": "",
105937
- "body": {
105938
- "package": "himalaya",
105939
- "type": "VStack",
105940
- "props": {
105941
- "spacing": 8,
105942
- "children": [
105943
- {
105944
- "id": "",
105945
- "body": {
105946
- "package": "himalaya",
105947
- "type": "Divider",
105948
- "props": {}
105949
- }
105950
- },
105951
- {
105952
- "id": "",
105953
- "body": {
105954
- "package": "himalaya",
105955
- "type": "Text",
105956
- "props": {
105957
- "text": "$service:himiEventDetail.ticketCountLabel",
105958
- "style": "caption",
105959
- "color": "textSecondary"
105960
- }
105961
- }
105962
- },
105963
- {
105964
- "id": "",
105965
- "body": {
105966
- "package": "himalaya",
105967
- "type": "HStack",
105968
- "props": {
105969
- "spacing": 12,
105970
- "children": [
105971
- {
105972
- "id": "",
105973
- "body": {
105974
- "package": "himalaya",
105975
- "type": "Text",
105976
- "props": {
105977
- "text": "$service:himiEventDetail.ticketTotal",
105978
- "style": "title3",
105979
- "monospacedDigits": true
105980
- }
105981
- }
105982
- },
105983
- {
105984
- "id": "",
105985
- "body": {
105986
- "package": "himalaya",
105987
- "type": "Spacer",
105988
- "props": {}
105989
- }
105990
- },
105991
- {
105992
- "id": "btn_tier5_himieventdetail_checkout",
105993
- "body": {
105994
- "package": "himalaya",
105995
- "type": "Button",
105996
- "props": {
105997
- "title": "Checkout",
105998
- "style": "primary",
105999
- "disabledPath": "$service:himiEventDetail.checkoutDisabled",
106000
- "action": {
106001
- "actionId": "tier5.himiEventDetail.checkout"
106002
- }
106003
- }
106004
- }
106005
- }
106006
- ]
106007
- }
106008
- }
106009
- }
106010
- ]
106011
- }
106012
- },
106013
- "modifiers": {
106014
- "hiddenPath": "$service:himiEventDetail.regularTicketsHidden"
106015
- }
106016
106080
  }
106017
106081
  ]
106018
106082
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$source": "en",
3
- "$generated": "2026-11-10T10:43:25.380Z",
3
+ "$generated": "2026-11-10T16:25:29.005Z",
4
4
  "messages": {
5
5
  "h_042c862e4467": {
6
6
  "source": "Try again",
@@ -0,0 +1,63 @@
1
+ // The site's featured event: the one on now, else the next one to start. A conference app is
2
+ // about one event at a time — its Home hero, its Tickets tab and its Agenda all show this one —
3
+ // and a site with several events reaches the rest from the events list.
4
+ //
5
+ // Read from the visitor-readable Events v3 query. "None" (no live or upcoming event) is a real
6
+ // answer, distinct from a failed read: the caller shows an empty state for the first and an
7
+ // error with Retry for the second, never a sample event.
8
+ import { queryEvents, startDateOf, endDateOf, type WixEvent, type WixEventFieldset } from "@himalaya/wix-events";
9
+
10
+ export type FeaturedEventRead = { ok: true; event: WixEvent | null } | { ok: false; event: null };
11
+
12
+ // Only live and upcoming events, earliest first, filtered and sorted by Wix (verified on a visitor
13
+ // token, 2026-11-10): the featured one is on the first page however many events the site has. The
14
+ // pick below still checks each row, and pages on (to Wix's own total) only while no page has
15
+ // produced an event to feature — never a fixed page cap that could miss one.
16
+ const FEATURED_QUERY = {
17
+ filter: { status: { $in: ["UPCOMING", "STARTED"] } },
18
+ sort: [{ fieldName: "dateAndTimeSettings.startDate", order: "ASC" }],
19
+ };
20
+ const PAGE = 50;
21
+
22
+ const millis = (iso: string | undefined): number => {
23
+ const ms = iso ? Date.parse(iso) : NaN;
24
+ return Number.isNaN(ms) ? NaN : ms;
25
+ };
26
+
27
+ /** The event to feature among `events` at `now`: a published event that has not ended — the one
28
+ * that started first when several run now, else the next to start. A draft, a canceled event
29
+ * and an ended one are never featured; an event with no date is featured only when no dated one
30
+ * qualifies (its date is "to be announced"). */
31
+ export function pickFeaturedEvent(events: WixEvent[], now: number): WixEvent | null {
32
+ const eligible = events.filter((e) => {
33
+ const status = String(e.eventStatus ?? (e as { status?: string }).status ?? "").toUpperCase();
34
+ if (status === "DRAFT" || status === "CANCELED" || status === "ENDED") return false;
35
+ const end = millis(endDateOf(e)), start = millis(startDateOf(e));
36
+ const last = Number.isNaN(end) ? start : end;
37
+ return Number.isNaN(last) || last >= now;
38
+ });
39
+ const dated = eligible.filter((e) => !Number.isNaN(millis(startDateOf(e))));
40
+ if (dated.length) return dated.slice().sort((a, b) => millis(startDateOf(a)) - millis(startDateOf(b)))[0];
41
+ return eligible[0] ?? null;
42
+ }
43
+
44
+ /** Read the site's live and upcoming events and pick the featured one. */
45
+ export async function readFeaturedEvent(fields: WixEventFieldset[] = ["DETAILS", "REGISTRATION"], now: number = Date.now()): Promise<FeaturedEventRead> {
46
+ const events: WixEvent[] = [];
47
+ try {
48
+ for (let offset = 0; ; offset += PAGE) {
49
+ const res = await queryEvents({ limit: PAGE, offset, fields, query: FEATURED_QUERY as never });
50
+ const page = (res.events ?? []).filter((e) => !!e.id);
51
+ events.push(...page);
52
+ const total = Number((res as { pagingMetadata?: { total?: unknown } }).pagingMetadata?.total);
53
+ const done = page.length < PAGE || (Number.isFinite(total) && offset + PAGE >= total);
54
+ // A dated pick is final (a later page starts later); an undated one is not — a dated event
55
+ // may still follow, and a dated event is always featured before a "to be announced" one.
56
+ const pick = pickFeaturedEvent(events, now);
57
+ if (done || (pick && !Number.isNaN(millis(startDateOf(pick))))) break;
58
+ }
59
+ } catch {
60
+ return { ok: false, event: null };
61
+ }
62
+ return { ok: true, event: pickFeaturedEvent(events, now) };
63
+ }