@wix/himalaya-cli 0.1667.0 → 0.1669.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.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +15 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/wix-platform/src/index.d.ts +20 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-platform.mjs +21 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{6eb8e06efae709dec91b845b9df5a93594d4a91d157b435e053cc7789d005253.bin → 6eef5856f65113cbc7504d7f926fe7039c48f614b3b0daf20c0e6eea0315c923.bin} +1 -1
- package/dist/browser-plane/sw.js +8 -8
- package/dist/cli.mjs +463 -46
- package/dist/preview-assets.generated.bin +0 -0
- package/fixtures/wix-canned.json +3 -0
- package/guides/sdk-reference.json +8 -1
- package/guides/web-page-sdk-reference.md +1 -1
- package/guides/wix-platform-usage.md +34 -1
- package/package.json +2 -2
- package/templates/branded-lite/dev/index.ts +32 -1
- package/templates/branded-lite/l10n/en.json +16 -3
- package/templates/branded-lite/l10n/es.json +15 -0
- package/templates/branded-lite/l10n/he.json +15 -0
- package/templates/branded-lite/tier5-src/_shared/program-standing.ts +40 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-member-programs/index.ts +4 -35
- package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +302 -9
- package/templates/yoga-studio/dev/index.ts +32 -1
- package/templates/yoga-studio/l10n/en.json +16 -3
- package/templates/yoga-studio/l10n/es.json +15 -0
- package/templates/yoga-studio/l10n/he.json +15 -0
- package/templates/yoga-studio/tier5-src/_shared/program-standing.ts +40 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-member-programs/index.ts +4 -35
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +302 -9
|
Binary file
|
package/fixtures/wix-canned.json
CHANGED
|
@@ -625,6 +625,9 @@
|
|
|
625
625
|
"total": 2
|
|
626
626
|
}
|
|
627
627
|
},
|
|
628
|
+
"POST /online-programs/v3/participants/search": {
|
|
629
|
+
"participants": []
|
|
630
|
+
},
|
|
628
631
|
"POST /online-programs/participants/v3/join-applications/query": {
|
|
629
632
|
"joinApplications": [],
|
|
630
633
|
"pagingMetadata": { "count": 0, "total": 0 }
|
|
@@ -6766,7 +6766,14 @@
|
|
|
6766
6766
|
"name": "bi",
|
|
6767
6767
|
"kind": "const",
|
|
6768
6768
|
"jsdoc": "",
|
|
6769
|
-
"decl": "export const bi = {\n /** Fire a BI beacon with an explicit Frog `evid` + params. */\n async track(evid: number | string, params?: Record<string, string | number>): Promise<BiResult> {\n const r = await call<{ ok?: boolean; beacon?: string }>(\"biTrack\", {\n evid: String(evid),\n params: params ? JSON.stringify(params) : \"\",\n });\n return { ok: r?.ok ?? false, beacon: r?.beacon ?? \"\" };\n },\n /** Page-view beacon (Frog evid 501). */\n pageView(pageName: string): Promise<BiResult> {\n return bi.track(501, { page_name: pageName });\n },\n /** Click beacon (Frog evid 522). */\n click(buttonName: string, pageName?: string): Promise<BiResult> {\n return bi.track(522, pageName ? { button_name: buttonName, page_name: pageName } : { button_name: buttonName });\n },\n};",
|
|
6769
|
+
"decl": "export const bi = {\n /** Fire a BI beacon with an explicit Frog `evid` + params. */\n async track(evid: number | string, params?: Record<string, string | number>): Promise<BiResult> {\n const r = await call<{ ok?: boolean; beacon?: string }>(\"biTrack\", {\n evid: String(evid),\n params: params ? JSON.stringify(params) : \"\",\n });\n return { ok: r?.ok ?? false, beacon: r?.beacon ?? \"\" };\n },\n /** Page-view beacon (Frog evid 501). */\n pageView(pageName: string): Promise<BiResult> {\n return bi.track(501, { page_name: pageName });\n },\n /** Click beacon (Frog evid 522). */\n click(buttonName: string, pageName?: string): Promise<BiResult> {\n return bi.track(522, pageName ? { button_name: buttonName, page_name: pageName } : { button_name: buttonName });\n },\n /**\n * Send a typed `@wix/bi-logger-*` `/v2` event exactly as its generated function returns it:\n * `bi.log(bookingsAppointmentBookedSrc16Evid526({ ... }))`. In an app whose BI runs in\n * `commonParams: \"oneapp\"` mode (the Owner / Spaces / Branded lite apps) its own `src` and\n * `endpoint` are honored (`''`, the frog root, as `\"/\"`); a `himi`-mode app stamps its own\n * configured `src` on every beacon and sends the event's `endpoint` as a plain `endpoint` field, so\n * use it in oneapp apps. A param that is not a string, number or boolean is left out. The host still owns every common and identity field, and drops one a worker names.\n *\n * Prefer the platform maps (screen map, Wix API rules, action map, epic #4973): they send the\n * RN events without worker code. Use this only for an event whose fields exist only in the worker.\n */\n log(event: BiLogEvent): Promise<BiResult> {\n const params: Record<string, string | number> = {};\n for (const [k, v] of Object.entries(event.params ?? {})) {\n if (typeof v === \"string\" || (typeof v === \"number\" && Number.isFinite(v))) params[k] = v;\n else if (typeof v === \"boolean\") params[k] = v ? \"true\" : \"false\";\n }\n params.src = event.src;\n if (event.endpoint !== undefined) params.endpoint = event.endpoint === \"\" ? \"/\" : event.endpoint;\n return bi.track(event.evid, params);\n },\n};",
|
|
6770
|
+
"verificationChecked": true
|
|
6771
|
+
},
|
|
6772
|
+
{
|
|
6773
|
+
"name": "BiLogEvent",
|
|
6774
|
+
"kind": "interface",
|
|
6775
|
+
"jsdoc": "/** What a `@wix/bi-logger-*` `/v2` event function returns: `{ evid, src, endpoint, params }`. */",
|
|
6776
|
+
"decl": "export interface BiLogEvent {\n evid: number;\n src: number;\n /** The frog endpoint; `''` is the frog root. */\n endpoint?: string;\n params?: Record<string, unknown>;\n}",
|
|
6770
6777
|
"verificationChecked": true
|
|
6771
6778
|
},
|
|
6772
6779
|
{
|
|
@@ -57,4 +57,4 @@ the SDK sources, so it matches the shipped SDKs.
|
|
|
57
57
|
- [`ui`](https://apps.wix.com/_api/himi-serve/authoring/resource/web-sdk%2Fui?format=md) — Imperative popup capability. 2 methods · not in Brandy.
|
|
58
58
|
- [`wix_cashier`](https://apps.wix.com/_api/himi-serve/authoring/resource/web-sdk%2Fwix_cashier?format=md) — Native cashier. 2 methods.
|
|
59
59
|
- [`wix_chat`](https://apps.wix.com/_api/himi-serve/authoring/resource/web-sdk%2Fwix_chat?format=md) — Host-owned realtime Chat event subscriptions. 2 methods.
|
|
60
|
-
- [`wix_platform`](https://apps.wix.com/_api/himi-serve/authoring/resource/web-sdk%2Fwix_platform?format=md) — Wix Platform SDK, worker-facing bindings.
|
|
60
|
+
- [`wix_platform`](https://apps.wix.com/_api/himi-serve/authoring/resource/web-sdk%2Fwix_platform?format=md) — Wix Platform SDK, worker-facing bindings. 30 methods · not in Brandy.
|
|
@@ -49,7 +49,7 @@ await monitoring.captureError("thing failed", { code: "E1" });
|
|
|
49
49
|
|
|
50
50
|
| Member | Methods |
|
|
51
51
|
|---|---|
|
|
52
|
-
| `bi` | `track(evid, params?)`, `pageView(name)`, `click(name, page?)` |
|
|
52
|
+
| `bi` | `track(evid, params?)`, `pageView(name)`, `click(name, page?)`, `log(v2Event)` ([below](#bilog--a-typed-wix-bi-logger-v2-event)) |
|
|
53
53
|
| `experiments` | `conduct(spec, fallback?)`, `isEnabled(spec)`, `exposure(spec, variant)` |
|
|
54
54
|
| `flags` | `isEnabled(spec, fallback?)`, `value(spec, fallback?)`, `all()` |
|
|
55
55
|
| `i18n` | `t(key, fallback?)`, `locale()` |
|
|
@@ -61,6 +61,39 @@ await monitoring.captureError("thing failed", { code: "E1" });
|
|
|
61
61
|
| `userProps` | `get()`, `set(patch)` — the signed-in Wix user's server-side per-app preferences ([below](#userprops--server-side-per-user-preferences)) |
|
|
62
62
|
| `version` | the SDK surface version constant |
|
|
63
63
|
|
|
64
|
+
## `bi.log` — a typed `@wix/bi-logger-*` `/v2` event
|
|
65
|
+
|
|
66
|
+
**Prefer the platform maps. Use `bi.log` only when the event's fields exist only in the worker.**
|
|
67
|
+
In the Owner, Spaces and Branded lite apps (`commonParams: "oneapp"`), the host already sends the RN
|
|
68
|
+
events without worker code (epic #4973):
|
|
69
|
+
|
|
70
|
+
| Map | Sends |
|
|
71
|
+
|---|---|
|
|
72
|
+
| the screen map | the screen view and a detail screen's view event |
|
|
73
|
+
| the Wix API rules | the outcome event of a successful Wix API call |
|
|
74
|
+
| the action map | the tap event for a user's tap |
|
|
75
|
+
|
|
76
|
+
A worker is customer-editable, so BI that lives in it can be stripped or changed by an edit. That
|
|
77
|
+
is why it is the last resort.
|
|
78
|
+
|
|
79
|
+
`bi.log` takes what a generated `/v2` function returns, unchanged:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { bi } from "@himalaya/wix-platform";
|
|
83
|
+
import { bookingsSaveServiceX } from "@wix/bi-logger-bookings-data/v2"; // the worker's own dependency
|
|
84
|
+
|
|
85
|
+
await bi.log(bookingsSaveServiceX({ service_id: id, success: true }));
|
|
86
|
+
// → { evid: 358, src: 16, endpoint: "", params } goes to frog with src 16 at the frog root
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- **`src` and `endpoint`.** In `commonParams: "oneapp"` mode (the lite apps) the event's own values are honored, and `''`, the frog root, is sent as `"/"`. A `himi`-mode app stamps its own configured `src` on every beacon and sends the event's `endpoint` as a plain `endpoint` field, so a typed event belongs in a oneapp app.
|
|
90
|
+
- **Params.** A string, number or boolean is sent; anything else is left out.
|
|
91
|
+
- **Host fields.** The host owns every common and identity field: `installationId`, `uuid`,
|
|
92
|
+
`msid`, `mobile_app_id`, `_lv`, `bsi`, `contactId` and the rest. It drops any a worker names, in
|
|
93
|
+
`bi.log` as in `bi.track`.
|
|
94
|
+
- **Packages.** The `@wix/bi-logger-*` packages are not bundled into the platform build. A worker
|
|
95
|
+
that wants one adds it as its own dependency.
|
|
96
|
+
|
|
64
97
|
## Real vs dev seam — and best-effort
|
|
65
98
|
|
|
66
99
|
- With no `wixPlatform.real.<member>`, a member returns the **dev seam** (deterministic
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1669.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": [
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"artifactId": "himalaya-cli"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
-
"falconPackageHash": "
|
|
82
|
+
"falconPackageHash": "9f2fec7c3d522b49c7d21c67a96c5820be4950a5fd0e97030a940560"
|
|
83
83
|
}
|
|
@@ -103202,13 +103202,44 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
103202
103202
|
"spacing": 8,
|
|
103203
103203
|
"alignment": "leading",
|
|
103204
103204
|
"children": [
|
|
103205
|
+
{
|
|
103206
|
+
"id": "himi_program.standing",
|
|
103207
|
+
"body": {
|
|
103208
|
+
"package": "himalaya",
|
|
103209
|
+
"type": "Text",
|
|
103210
|
+
"props": {
|
|
103211
|
+
"text": "$service:himiBrandedProgram.standingLine",
|
|
103212
|
+
"style": "bodyEmphasis",
|
|
103213
|
+
"collapseWhenEmpty": true
|
|
103214
|
+
}
|
|
103215
|
+
}
|
|
103216
|
+
},
|
|
103217
|
+
{
|
|
103218
|
+
"id": "himi_program.cancel_request",
|
|
103219
|
+
"body": {
|
|
103220
|
+
"package": "himalaya",
|
|
103221
|
+
"type": "Button",
|
|
103222
|
+
"props": {
|
|
103223
|
+
"title": "$service:himiBrandedProgram.cancelLabel",
|
|
103224
|
+
"style": "secondary",
|
|
103225
|
+
"fullWidth": true,
|
|
103226
|
+
"disabledPath": "$service:himiBrandedProgram.cancelDisabled",
|
|
103227
|
+
"action": {
|
|
103228
|
+
"actionId": "tier5.himiBrandedProgram.cancelRequest"
|
|
103229
|
+
}
|
|
103230
|
+
}
|
|
103231
|
+
},
|
|
103232
|
+
"modifiers": {
|
|
103233
|
+
"hiddenPath": "$service:himiBrandedProgram.cancelHidden"
|
|
103234
|
+
}
|
|
103235
|
+
},
|
|
103205
103236
|
{
|
|
103206
103237
|
"id": "himi_program.enrol",
|
|
103207
103238
|
"body": {
|
|
103208
103239
|
"package": "himalaya",
|
|
103209
103240
|
"type": "Button",
|
|
103210
103241
|
"props": {
|
|
103211
|
-
"title": "
|
|
103242
|
+
"title": "$service:himiBrandedProgram.enrollLabel",
|
|
103212
103243
|
"style": "primary",
|
|
103213
103244
|
"fullWidth": true,
|
|
103214
103245
|
"disabledPath": "$service:himiBrandedProgram.enrollDisabled",
|
|
@@ -92,10 +92,8 @@
|
|
|
92
92
|
},
|
|
93
93
|
"h_050a944c6675": {
|
|
94
94
|
"source": "Enrol",
|
|
95
|
-
"kind": "Button.title",
|
|
96
|
-
"translation": "",
|
|
97
95
|
"key": "program.enrolCta",
|
|
98
|
-
"
|
|
96
|
+
"translation": ""
|
|
99
97
|
},
|
|
100
98
|
"h_0559813da230": {
|
|
101
99
|
"source": "Back to projects",
|
|
@@ -707,6 +705,11 @@
|
|
|
707
705
|
"key": "donation.notFoundBody",
|
|
708
706
|
"keyOrigin": "string-table"
|
|
709
707
|
},
|
|
708
|
+
"h_287d0c97c3f8": {
|
|
709
|
+
"source": "Your join request was cancelled.",
|
|
710
|
+
"key": "program.requestCancelledMessage",
|
|
711
|
+
"translation": ""
|
|
712
|
+
},
|
|
710
713
|
"h_295468e69a99": {
|
|
711
714
|
"source": "It may have been removed.",
|
|
712
715
|
"kind": "Text.text",
|
|
@@ -1819,6 +1822,11 @@
|
|
|
1819
1822
|
"key": "planDetail.message",
|
|
1820
1823
|
"keyOrigin": "string-table"
|
|
1821
1824
|
},
|
|
1825
|
+
"h_6dd1d806fc51": {
|
|
1826
|
+
"source": "The request could not be cancelled. Try again.",
|
|
1827
|
+
"key": "program.cancelRequestFailedMessage",
|
|
1828
|
+
"translation": ""
|
|
1829
|
+
},
|
|
1822
1830
|
"h_6df910132a36": {
|
|
1823
1831
|
"source": "Suggestion sent.",
|
|
1824
1832
|
"kind": "Worker.copy",
|
|
@@ -2157,6 +2165,11 @@
|
|
|
2157
2165
|
"key": "loyalty.sampleBody",
|
|
2158
2166
|
"keyOrigin": "string-table"
|
|
2159
2167
|
},
|
|
2168
|
+
"h_84837a216817": {
|
|
2169
|
+
"source": "Cancel request",
|
|
2170
|
+
"key": "program.cancelRequestCta",
|
|
2171
|
+
"translation": ""
|
|
2172
|
+
},
|
|
2160
2173
|
"h_849594a18598": {
|
|
2161
2174
|
"source": "Address not found",
|
|
2162
2175
|
"kind": "Text.text",
|
|
@@ -17,6 +17,21 @@
|
|
|
17
17
|
"key": "product.galleryPage",
|
|
18
18
|
"translation": "Imagen {index} de {count}"
|
|
19
19
|
},
|
|
20
|
+
"h_84837a216817": {
|
|
21
|
+
"source": "Cancel request",
|
|
22
|
+
"key": "program.cancelRequestCta",
|
|
23
|
+
"translation": "Cancelar solicitud"
|
|
24
|
+
},
|
|
25
|
+
"h_287d0c97c3f8": {
|
|
26
|
+
"source": "Your join request was cancelled.",
|
|
27
|
+
"key": "program.requestCancelledMessage",
|
|
28
|
+
"translation": "Tu solicitud de inscripción se ha cancelado."
|
|
29
|
+
},
|
|
30
|
+
"h_6dd1d806fc51": {
|
|
31
|
+
"source": "The request could not be cancelled. Try again.",
|
|
32
|
+
"key": "program.cancelRequestFailedMessage",
|
|
33
|
+
"translation": "No se ha podido cancelar la solicitud. Inténtalo de nuevo."
|
|
34
|
+
},
|
|
20
35
|
"h_0d049cb0b019": {
|
|
21
36
|
"source": "This site is not accepting online payments. Go back or contact the business for other payment options.",
|
|
22
37
|
"translation": "Este sitio no acepta pagos en línea. Vuelve atrás o contacta con el negocio para consultar otras opciones de pago."
|
|
@@ -3185,6 +3185,21 @@
|
|
|
3185
3185
|
"key": "cms.searchEmptyText",
|
|
3186
3186
|
"translation": "אין אוספים שתואמים לחיפוש."
|
|
3187
3187
|
},
|
|
3188
|
+
"h_84837a216817": {
|
|
3189
|
+
"source": "Cancel request",
|
|
3190
|
+
"key": "program.cancelRequestCta",
|
|
3191
|
+
"translation": "ביטול בקשה"
|
|
3192
|
+
},
|
|
3193
|
+
"h_287d0c97c3f8": {
|
|
3194
|
+
"source": "Your join request was cancelled.",
|
|
3195
|
+
"key": "program.requestCancelledMessage",
|
|
3196
|
+
"translation": "בקשת ההצטרפות שלך בוטלה."
|
|
3197
|
+
},
|
|
3198
|
+
"h_6dd1d806fc51": {
|
|
3199
|
+
"source": "The request could not be cancelled. Try again.",
|
|
3200
|
+
"key": "program.cancelRequestFailedMessage",
|
|
3201
|
+
"translation": "לא ניתן לבטל את הבקשה. יש לנסות שוב."
|
|
3202
|
+
},
|
|
3188
3203
|
"h_a689a999a5e6": {
|
|
3189
3204
|
"source": "Expired",
|
|
3190
3205
|
"key": "mySubscriptions.expired",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The member's standing on one Online Program — the One App participant/application states, folded.
|
|
2
|
+
// Shared by the programs list cards and the program detail screen so both read a member the same way.
|
|
3
|
+
import type { WixJoinApplication, WixParticipant } from "@himalaya/wix-online-programs";
|
|
4
|
+
|
|
5
|
+
export type Standing = "none" | "joined" | "completed" | "finished" | "suspended" | "pending" | "approved" | "invited";
|
|
6
|
+
|
|
7
|
+
export function standingOf(ended: boolean, participant: WixParticipant | undefined, application: WixJoinApplication | undefined): Standing {
|
|
8
|
+
if (participant) {
|
|
9
|
+
const progress = (participant.progressStatus ?? "").toUpperCase();
|
|
10
|
+
const enrollment = (participant.enrollmentStatus ?? "").toUpperCase();
|
|
11
|
+
if (progress === "COMPLETED") return "completed";
|
|
12
|
+
if (progress === "FAILED" || ended) return "finished";
|
|
13
|
+
if (enrollment === "SUSPENDED") return "suspended";
|
|
14
|
+
return "joined";
|
|
15
|
+
}
|
|
16
|
+
const status = (application?.status ?? "").toUpperCase();
|
|
17
|
+
const payment = (application?.paymentStatus ?? "").toUpperCase();
|
|
18
|
+
if (status === "APPROVAL_PENDING") return "pending";
|
|
19
|
+
if (status === "SUSPENDED") return "suspended";
|
|
20
|
+
if (status === "APPROVED") {
|
|
21
|
+
// The same reading as joinProgram: a free or settled approval is enrolling, and an offline payment
|
|
22
|
+
// waits on the owner. Only an approval that still owes money asks the member to pay.
|
|
23
|
+
if (payment === "NO_PAYMENT_REQUIRED" || payment === "PAYMENT_SUCCESSFUL") return application?.participantId ? "joined" : "pending";
|
|
24
|
+
if (payment === "PENDING_OWNER_APPROVAL") return "pending";
|
|
25
|
+
return "approved";
|
|
26
|
+
}
|
|
27
|
+
if (status === "PAYMENT_PENDING") return "approved";
|
|
28
|
+
if (status === "INVITED") return "invited";
|
|
29
|
+
return "none";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const STATUS: Record<Exclude<Standing, "none">, { key: string; fallback: string; icon: string; color: string }> = {
|
|
33
|
+
joined: { key: "memberPrograms.status.joined", fallback: "Joined", icon: "checkmark", color: "accentPrimary" },
|
|
34
|
+
completed: { key: "memberPrograms.status.completed", fallback: "Program complete", icon: "trophy", color: "success" },
|
|
35
|
+
finished: { key: "memberPrograms.status.ended", fallback: "Program ended", icon: "flag", color: "textSecondary" },
|
|
36
|
+
suspended: { key: "memberPrograms.status.suspended", fallback: "Participation suspended", icon: "close", color: "warning" },
|
|
37
|
+
pending: { key: "memberPrograms.status.pending", fallback: "Pending request", icon: "clock", color: "warning" },
|
|
38
|
+
approved: { key: "memberPrograms.status.approved", fallback: "Request approved", icon: "checkmark", color: "success" },
|
|
39
|
+
invited: { key: "memberPrograms.status.invited", fallback: "Invited", icon: "mail", color: "accentPrimary" },
|
|
40
|
+
};
|
|
@@ -21,6 +21,7 @@ import { getMyMember } from "@himalaya/wix-members";
|
|
|
21
21
|
import { iapPriceFields, onlineProgramItem, type IapPollDirective } from "@himalaya/iap";
|
|
22
22
|
import { createIapCommerce } from "@himalaya/iap-checkout";
|
|
23
23
|
import { createCollectionQuery, type CollectionPage, type CollectionQueryState } from "../_shared/collection-query.js";
|
|
24
|
+
import { standingOf as sharedStandingOf, STATUS, type Standing } from "../_shared/program-standing.js";
|
|
24
25
|
import { memberAccess, memberAccessChanged, memberAccessDenied, type MemberAccess } from "../_shared/member-access.js";
|
|
25
26
|
import { cleanTitle, initials } from "../_shared/himi-text.js";
|
|
26
27
|
import { programImage } from "../_shared/himi-media.js";
|
|
@@ -37,8 +38,7 @@ const DETAIL_SCREEN = "himi_program";
|
|
|
37
38
|
|
|
38
39
|
// ── Row model ────────────────────────────────────────────────────────────────
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
export type Standing = "none" | "joined" | "completed" | "finished" | "suspended" | "pending" | "approved" | "invited";
|
|
41
|
+
export type { Standing };
|
|
42
42
|
|
|
43
43
|
/** A card as loaded, before pricing. */
|
|
44
44
|
export interface ProgramContent {
|
|
@@ -166,39 +166,8 @@ function daysBetween(fromIso: string, now: number): number {
|
|
|
166
166
|
|
|
167
167
|
// ── Member standing ──────────────────────────────────────────────────────────
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
const progress = (participant.progressStatus ?? "").toUpperCase();
|
|
172
|
-
const enrollment = (participant.enrollmentStatus ?? "").toUpperCase();
|
|
173
|
-
if (progress === "COMPLETED") return "completed";
|
|
174
|
-
if (progress === "FAILED" || isEnded(p)) return "finished";
|
|
175
|
-
if (enrollment === "SUSPENDED") return "suspended";
|
|
176
|
-
return "joined";
|
|
177
|
-
}
|
|
178
|
-
const status = (application?.status ?? "").toUpperCase();
|
|
179
|
-
const payment = (application?.paymentStatus ?? "").toUpperCase();
|
|
180
|
-
if (status === "APPROVAL_PENDING") return "pending";
|
|
181
|
-
if (status === "APPROVED") {
|
|
182
|
-
// The same reading as joinProgram: a free or settled approval is enrolling, and an offline payment
|
|
183
|
-
// waits on the owner. Only an approval that still owes money asks the member to pay.
|
|
184
|
-
if (payment === "NO_PAYMENT_REQUIRED" || payment === "PAYMENT_SUCCESSFUL") return application?.participantId ? "joined" : "pending";
|
|
185
|
-
if (payment === "PENDING_OWNER_APPROVAL") return "pending";
|
|
186
|
-
return "approved";
|
|
187
|
-
}
|
|
188
|
-
if (status === "PAYMENT_PENDING") return "approved";
|
|
189
|
-
if (status === "INVITED") return "invited";
|
|
190
|
-
return "none";
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const STATUS: Record<Exclude<Standing, "none">, { key: string; fallback: string; icon: string; color: string }> = {
|
|
194
|
-
joined: { key: "memberPrograms.status.joined", fallback: "Joined", icon: "checkmark", color: "accentPrimary" },
|
|
195
|
-
completed: { key: "memberPrograms.status.completed", fallback: "Program complete", icon: "trophy", color: "success" },
|
|
196
|
-
finished: { key: "memberPrograms.status.ended", fallback: "Program ended", icon: "flag", color: "textSecondary" },
|
|
197
|
-
suspended: { key: "memberPrograms.status.suspended", fallback: "Participation suspended", icon: "close", color: "warning" },
|
|
198
|
-
pending: { key: "memberPrograms.status.pending", fallback: "Pending request", icon: "clock", color: "warning" },
|
|
199
|
-
approved: { key: "memberPrograms.status.approved", fallback: "Request approved", icon: "checkmark", color: "success" },
|
|
200
|
-
invited: { key: "memberPrograms.status.invited", fallback: "Invited", icon: "mail", color: "accentPrimary" },
|
|
201
|
-
};
|
|
169
|
+
const standingOf = (p: WixProgram, participant: WixParticipant | undefined, application: WixJoinApplication | undefined): Standing =>
|
|
170
|
+
sharedStandingOf(isEnded(p), participant, application);
|
|
202
171
|
|
|
203
172
|
function timelineLine(p: WixProgram, participant: WixParticipant | undefined, standing: Standing, now: number): string {
|
|
204
173
|
const timeline = full(p).timeline;
|