@wix/himalaya-cli 0.1750.0 → 0.1751.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/builder.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/himi-package.d.ts +478 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/host-compatibility.d.ts +56 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +154 -7
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast-service.d.ts +105 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast.d.ts +116 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +326 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +730 -81
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +155 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin → 21f35a12bd94f4ab97a9a75453c4adcadc438daf024a4b1950d5c356c123bd01.bin} +1 -1
- package/dist/browser-plane/sw.js +7 -7
- package/dist/cli.mjs +34995 -31326
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +4 -0
- package/guides/designing-himi-screens.md +7 -0
- package/guides/getting-started.md +2 -0
- package/guides/headless-loop.md +1 -1
- package/guides/himi-skill.md +2 -0
- package/guides/index.json +6 -0
- package/guides/qa-builds.md +12 -1
- package/guides/recipe-podcast.md +149 -0
- package/guides/tier-5-add-a-screen.md +16 -2
- package/guides/wix-business-context.md +29 -0
- package/guides/wix-platform-usage.md +7 -2
- package/package.json +10 -10
- package/template-icons/fitness-gym.png +0 -0
- package/templates/beauty-salon/dev/index.ts +1 -1
- package/templates/beauty-salon/l10n/en.json +1 -1
- package/templates/beauty-salon/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/branded-lite/dev/index.ts +101 -1
- package/templates/branded-lite/l10n/en.json +22 -1
- package/templates/branded-lite/l10n/es.json +22 -0
- package/templates/branded-lite/l10n/fr.json +18 -0
- package/templates/branded-lite/l10n/he.json +15 -0
- package/templates/branded-lite/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/branded-lite/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
- package/templates/brandy/README.md +33 -0
- package/templates/brandy/config.ts +51 -7
- package/templates/brandy/dev/index.ts +23 -9
- package/templates/community-club/l10n/en.json +1 -1
- package/templates/community-club/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/community-club/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/events-meetups/l10n/en.json +1 -1
- package/templates/events-meetups/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/events-meetups/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/fitness-gym/README.md +53 -0
- package/templates/fitness-gym/config.ts +560 -0
- package/templates/fitness-gym/dev/index.ts +25787 -0
- package/templates/fitness-gym/himalaya.content.json +64 -0
- package/templates/fitness-gym/himalaya.template.json +15 -0
- package/templates/fitness-gym/icon.png +0 -0
- package/templates/fitness-gym/platforms.json +1 -0
- package/templates/fitness-gym/tier5-src/_shared/app-locale.ts +61 -0
- package/templates/fitness-gym/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/fitness-gym/tier5-src/_shared/booking-session.ts +224 -0
- package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +280 -0
- package/templates/fitness-gym/tier5-src/_shared/branded-load-state.ts +109 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-history.ts +51 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-model.ts +56 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-presenter.ts +576 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +193 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +400 -0
- package/templates/fitness-gym/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +523 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-account.ts +194 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-booking-saved.ts +88 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-bookings.ts +318 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-copy.ts +116 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +29 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/fitness-gym/tier5-src/_shared/host-events.ts +66 -0
- package/templates/fitness-gym/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-worker.ts +127 -0
- package/templates/fitness-gym/tier5-src/_shared/inbox-rooms.ts +68 -0
- package/templates/fitness-gym/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/fitness-gym/tier5-src/_shared/member-access.ts +63 -0
- package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +52 -0
- package/templates/fitness-gym/tier5-src/_shared/member-bookings.ts +107 -0
- package/templates/fitness-gym/tier5-src/_shared/member-screen.ts +99 -0
- package/templates/fitness-gym/tier5-src/_shared/notification-target.ts +141 -0
- package/templates/fitness-gym/tier5-src/_shared/offset-page.ts +10 -0
- package/templates/fitness-gym/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/fitness-gym/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/fitness-gym/tier5-src/_shared/payment-setup.ts +6 -0
- package/templates/fitness-gym/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/fitness-gym/tier5-src/_shared/program-description.ts +11 -0
- package/templates/fitness-gym/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/fitness-gym/tier5-src/_shared/program-standing.ts +46 -0
- package/templates/fitness-gym/tier5-src/_shared/rich-body.ts +78 -0
- package/templates/fitness-gym/tier5-src/_shared/rich-content-link.ts +34 -0
- package/templates/fitness-gym/tier5-src/_shared/sign-in-sheet.ts +18 -0
- package/templates/fitness-gym/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-member-links.ts +114 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-service-price.ts +146 -0
- package/templates/fitness-gym/tier5-src/business-chat/index.ts +732 -0
- package/templates/fitness-gym/tier5-src/business-contact/index.ts +6 -0
- package/templates/fitness-gym/tier5-src/himi-booking-account/index.ts +267 -0
- package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +468 -0
- package/templates/fitness-gym/tier5-src/himi-booking-service/index.ts +1190 -0
- package/templates/fitness-gym/tier5-src/himi-booking-services/index.ts +791 -0
- package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1729 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +656 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +495 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/facts.ts +52 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +845 -0
- package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +191 -0
- package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +619 -0
- package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +1007 -0
- package/templates/fitness-gym/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
- package/templates/fitness-gym/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
- package/templates/fitness-gym/tokens.json +414 -0
- package/templates/gym-fitness/dev/index.ts +1 -1
- package/templates/gym-fitness/l10n/en.json +1 -1
- package/templates/gym-fitness/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/medical-services/dev/index.ts +2 -1
- package/templates/medical-services/tier5-src/himi-booking-account/index.ts +16 -1
- package/templates/nonprofit-cause/l10n/en.json +1 -1
- package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/personal-fitness-trainer/dev/index.ts +2 -2
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/podcast-creator/dev/index.ts +100 -0
- package/templates/podcast-creator/l10n/en.json +22 -1
- package/templates/podcast-creator/l10n/es.json +22 -0
- package/templates/podcast-creator/l10n/fr.json +18 -0
- package/templates/podcast-creator/l10n/he.json +15 -0
- package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
- package/templates/portfolio-creative/l10n/en.json +1 -1
- package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/restaurant/l10n/en.json +1 -1
- package/templates/restaurant/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/restaurant/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/retail-store/l10n/en.json +1 -1
- package/templates/retail-store/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/retail-store/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/salon-spa/dev/index.ts +1 -1
- package/templates/salon-spa/tier5-src/himi-booking-account/index.ts +16 -1
- package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/yoga-studio/dev/index.ts +1 -1
- package/templates/yoga-studio/l10n/en.json +1 -1
- package/templates/yoga-studio/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineService } from "@himalaya/state";
|
|
2
|
+
import { listMyPlanOrders, type WixPlanOrder } from "@himalaya/wix-pricing-plans";
|
|
3
|
+
import { hostSessionFromGlobal } from "@himalaya/iap";
|
|
4
|
+
import { memberAccess, assertMemberAccess, memberAccessDenied, memberChanged } from "../_shared/member-access.js";
|
|
5
|
+
import { orderDate, orderPrice, orderStatus } from "../_shared/pricing-plan-display.js";
|
|
6
|
+
import { descriptionBody } from "../_shared/rich-body.js";
|
|
7
|
+
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
8
|
+
|
|
9
|
+
interface Row { id: string; name: string; subtitle: string; description: string; price: string; endDate: string; noEndDate: boolean; expired: boolean; dateLabel: string }
|
|
10
|
+
interface S {
|
|
11
|
+
status: string; orders: Row[]; rows: Row[]; allOrders: Row[]; selectedTab: string; nextCursor: string;
|
|
12
|
+
emptyText: string; hideAccountCta: boolean; noOrders: boolean;
|
|
13
|
+
isLoading: boolean; notLoading: boolean; hideError: boolean; denied: boolean;
|
|
14
|
+
hideEmpty: boolean; hideEmptyLoadMore: boolean; hideDeniedError: boolean; hideRetryError: boolean; pageError: boolean; loadingPage: boolean;
|
|
15
|
+
}
|
|
16
|
+
const initial = (): S => ({ status: "loading", orders: [], rows: [], allOrders: [], selectedTab: "active", nextCursor: "", emptyText: "", hideAccountCta: true, noOrders: true, isLoading: true, notLoading: false, hideError: true, denied: false, hideEmpty: true, hideEmptyLoadMore: true, hideDeniedError: true, hideRetryError: true, pageError: false, loadingPage: false });
|
|
17
|
+
let sequence = 0;
|
|
18
|
+
let scope = "";
|
|
19
|
+
let offset = 0;
|
|
20
|
+
let pending = false;
|
|
21
|
+
const session = hostSessionFromGlobal();
|
|
22
|
+
|
|
23
|
+
function project(state: S): S {
|
|
24
|
+
// Keep the unfiltered `orders` contract for older descriptors without tabs.
|
|
25
|
+
const orders = state.allOrders;
|
|
26
|
+
const rows = orders.filter(row => row.expired === (state.selectedTab === "expired"));
|
|
27
|
+
return { ...state, orders, rows, noOrders: rows.length === 0, hideEmpty: state.status !== "ready" || rows.length > 0 || Boolean(state.nextCursor),
|
|
28
|
+
hideEmptyLoadMore: state.status !== "ready" || rows.length > 0 || !state.nextCursor,
|
|
29
|
+
emptyText: orders.length ? "" : state.selectedTab === "expired" ? copyParam("mySubscriptions.expiredEmpty", "No expired subscriptions") : copyParam("mySubscriptions.activeEmpty", "No active subscriptions") };
|
|
30
|
+
}
|
|
31
|
+
function norm(order: WixPlanOrder): Row {
|
|
32
|
+
const periodEnd = !order.earliestEndDate && !order.endDate && order.status === "ACTIVE" && (order.pricing?.subscription ?? order.priceDetails?.subscription) ? orderDate(order.currentCycle?.endedDate) : "";
|
|
33
|
+
const endDate = orderDate(order.earliestEndDate ?? order.endDate) || periodEnd;
|
|
34
|
+
return { id: order.id, name: order.planName || copyParam("plans.planFallbackName", "Plan"), subtitle: orderStatus(order),
|
|
35
|
+
description: descriptionBody(order.planDescription).bodyText, price: orderPrice(order), endDate, noEndDate: !endDate, dateLabel: periodEnd ? copyParam("subscriptionDetail.periodEnd", "Current period ends") : order.status === "CANCELED" ? copyParam("subscriptionDetail.endDate", "End date") : order.status === "ENDED" ? copyParam("mySubscriptions.expiredOn", "Expired on") : copyParam("mySubscriptions.validUntil", "Valid until"),
|
|
36
|
+
expired: ["ENDED", "CANCELED"].includes(order.status ?? "") };
|
|
37
|
+
}
|
|
38
|
+
async function readPage(state: S, reset: boolean): Promise<S | undefined> {
|
|
39
|
+
if (!reset && pending) return undefined;
|
|
40
|
+
const seq = reset ? ++sequence : sequence;
|
|
41
|
+
pending = true;
|
|
42
|
+
if (!reset) void svc.beginPage();
|
|
43
|
+
const member = await memberAccess();
|
|
44
|
+
const key = JSON.stringify([member.email, member.scope]);
|
|
45
|
+
if (seq !== sequence) return undefined;
|
|
46
|
+
if (key !== scope) { scope = key; offset = 0; state = initial(); void svc.clear(); }
|
|
47
|
+
if (!member.email) { pending = false; return { ...initial(), status: "guest", emptyText: copyParam("mySubscriptions.guestBody", "Sign in to see your subscriptions."), isLoading: false, notLoading: true, hideAccountCta: false }; }
|
|
48
|
+
try {
|
|
49
|
+
const start = reset ? 0 : offset;
|
|
50
|
+
const result = await listMyPlanOrders({ statuses: ["ACTIVE", "PENDING", "PAUSED", "CANCELED", "ENDED"], limit: 50, offset: start });
|
|
51
|
+
await assertMemberAccess(member);
|
|
52
|
+
if (seq !== sequence) return undefined;
|
|
53
|
+
const raw = result.orders ?? [];
|
|
54
|
+
offset = start + raw.length;
|
|
55
|
+
const rows = raw.filter(order => order.id && order.status !== "DRAFT").map(norm);
|
|
56
|
+
const allOrders = [...new Map([...(reset ? [] : state.allOrders), ...rows].map(row => [row.id, row])).values()];
|
|
57
|
+
return project({ ...state, status: "ready", allOrders, isLoading: false, notLoading: true, hideError: true, denied: false, hideAccountCta: true,
|
|
58
|
+
selectedTab: svc.getState().selectedTab, hideDeniedError: true, hideRetryError: true, nextCursor: raw.length === 50 ? String(offset) : "", pageError: false, loadingPage: false });
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (seq !== sequence) return undefined;
|
|
61
|
+
if (await memberChanged(member, error)) { scope = ""; void svc.clear(); void svc.load(); return undefined; }
|
|
62
|
+
state = project({ ...state, selectedTab: svc.getState().selectedTab });
|
|
63
|
+
const denied = memberAccessDenied(error);
|
|
64
|
+
if (denied) return { ...initial(), selectedTab: state.selectedTab, status: "error", emptyText: copyParam("mySubscriptions.accessDenied", "Subscriptions are unavailable for this account."), isLoading: false, notLoading: true, hideError: false, denied: true, hideDeniedError: false, hideRetryError: true };
|
|
65
|
+
return { ...state, status: "error", emptyText: copyParam("mySubscriptions.loadError", "Subscriptions could not be loaded."), isLoading: false, notLoading: true, hideError: false, denied: false, hideDeniedError: true, hideRetryError: false, hideEmpty: true, hideEmptyLoadMore: true, pageError: !reset && state.allOrders.length > 0, loadingPage: false };
|
|
66
|
+
} finally { if (seq === sequence) pending = false; }
|
|
67
|
+
}
|
|
68
|
+
const svc = defineService<S, {
|
|
69
|
+
clear: (s: S) => S; beginPage: (s: S) => S; load: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
70
|
+
retry: (s: S) => Promise<S | undefined>; nextPage: (s: S) => Promise<S | undefined>; selectTab: (s: S, arg?: unknown) => S;
|
|
71
|
+
}>("spacesMySubscriptions", {
|
|
72
|
+
state: initial(), notHydrated: Object.keys(initial()) as Array<keyof S>,
|
|
73
|
+
actions: {
|
|
74
|
+
clear: () => initial(),
|
|
75
|
+
beginPage: state => ({ ...state, loadingPage: true }),
|
|
76
|
+
load: (state, arg) => { stashCopy(arg); return readPage(state, true); },
|
|
77
|
+
retry: state => readPage(state, !state.pageError),
|
|
78
|
+
nextPage: state => state.nextCursor ? readPage(state, false) : Promise.resolve(undefined),
|
|
79
|
+
selectTab: (state, arg) => { const raw = typeof arg === "string" ? arg : (arg as { selectedId?: string; id?: string; value?: string })?.selectedId ?? (arg as { id?: string })?.id ?? (arg as { value?: string })?.value; return project({ ...state, selectedTab: raw === "expired" ? "expired" : "active" }); },
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
session.subscribe(() => { ++sequence; scope = ""; pending = false; void svc.clear(); void svc.load(); });
|
|
83
|
+
svc.load();
|
|
84
|
+
export { svc };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { defineService } from "@himalaya/state";
|
|
2
|
+
import { getMyPlanOrder, requestCancellation, type WixPlanOrder } from "@himalaya/wix-pricing-plans";
|
|
3
|
+
import { hostSessionFromGlobal } from "@himalaya/iap";
|
|
4
|
+
import { memberAccess, assertMemberAccess, memberAccessDenied, memberChanged, type MemberAccess } from "../_shared/member-access.js";
|
|
5
|
+
import { orderDate, orderPrice, orderStatus, orderFacts } from "../_shared/pricing-plan-display.js";
|
|
6
|
+
import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
7
|
+
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
8
|
+
|
|
9
|
+
interface S extends PresenceFlags {
|
|
10
|
+
denied: boolean; hideDeniedError: boolean; notActive: boolean; isActive: boolean;
|
|
11
|
+
status: string; name: string; subtitle: string; price: string; validity: string;
|
|
12
|
+
facts: ReturnType<typeof orderFacts>; hideAccountCta: boolean;
|
|
13
|
+
hideCancel: boolean; hideConfirmation: boolean; showConfirmation: boolean; busy: boolean; noScheduledOption: boolean;
|
|
14
|
+
effectiveAt: string; confirmation: string; actionMessage: string; actionError: string; hasActionError: boolean; noActionError: boolean;
|
|
15
|
+
}
|
|
16
|
+
const initial = (): S => ({ denied: false, hideDeniedError: true, notActive: true, isActive: false, status: "loading", name: "", subtitle: "", price: "", validity: "", facts: [], hideAccountCta: true,
|
|
17
|
+
hideCancel: true, hideConfirmation: true, showConfirmation: false, busy: false, noScheduledOption: true, effectiveAt: "IMMEDIATELY", confirmation: "", actionMessage: "", actionError: "none", hasActionError: false, noActionError: true, ...presence("loading") });
|
|
18
|
+
let order: WixPlanOrder | null = null;
|
|
19
|
+
let sequence = 0;
|
|
20
|
+
let cancelInFlight = false;
|
|
21
|
+
const cancellationsSent = new Set<string>();
|
|
22
|
+
let orderMemberKey = "";
|
|
23
|
+
const memberKey = (member: MemberAccess): string => JSON.stringify([member.scope, member.email]);
|
|
24
|
+
const cancellationKey = (id: string, owner = orderMemberKey): string => JSON.stringify([owner, id]);
|
|
25
|
+
const session = hostSessionFromGlobal();
|
|
26
|
+
function canCancel(o: WixPlanOrder): boolean {
|
|
27
|
+
// The member API enforces the PURCHASED policy. Current public plan settings are not the
|
|
28
|
+
// historical policy, and an archived plan must not prevent canceling an existing order.
|
|
29
|
+
return Boolean(o.id) && ["ACTIVE", "PENDING", "PAUSED"].includes(o.status ?? "") && o.type !== "EXTERNAL"
|
|
30
|
+
&& !o.autoRenewCanceled && o.cancellation?.effectiveAt !== "NEXT_PAYMENT_DATE";
|
|
31
|
+
}
|
|
32
|
+
function project(o: WixPlanOrder, message = ""): S {
|
|
33
|
+
const end = orderDate(o.earliestEndDate ?? o.endDate ?? o.currentCycle?.endedDate);
|
|
34
|
+
const scheduled = Boolean((o.pricing?.subscription ?? o.priceDetails?.subscription) && o.currentCycle?.endedDate && Date.parse(o.currentCycle.endedDate) > Date.now());
|
|
35
|
+
const renews = o.status === "ACTIVE" && scheduled ? orderDate(o.currentCycle?.endedDate) : "";
|
|
36
|
+
return { ...initial(), ...presence("found"), status: "ready", notActive: o.status !== "ACTIVE", isActive: o.status === "ACTIVE", name: o.planName || copyParam("subscriptionDetail.fallbackName", "Subscription"), subtitle: orderStatus(o), price: orderPrice(o),
|
|
37
|
+
validity: (o.earliestEndDate || o.autoRenewCanceled || o.cancellation?.effectiveAt === "NEXT_PAYMENT_DATE") && end ? copyTemplate("subscriptionDetail.scheduledEndMessage", "Your subscription ends on {date}.", { date: end }) : renews ? copyTemplate("placeSummary.planRenews", "Renews {date}", { date: renews }) : "",
|
|
38
|
+
facts: orderFacts(o), hideCancel: !canCancel(o) || cancellationsSent.has(cancellationKey(o.id)), noScheduledOption: !scheduled,
|
|
39
|
+
effectiveAt: scheduled ? "NEXT_PAYMENT_DATE" : "IMMEDIATELY", actionMessage: message };
|
|
40
|
+
}
|
|
41
|
+
function confirmation(effectiveAt: string): string {
|
|
42
|
+
const end = orderDate(order?.currentCycle?.endedDate);
|
|
43
|
+
return effectiveAt === "NEXT_PAYMENT_DATE" && end
|
|
44
|
+
? copyTemplate("subscriptionDetail.cancelAtPeriodEndBody", "Request cancellation at the next payment date, {date}?", { date: end })
|
|
45
|
+
: copyParam("subscriptionDetail.cancelImmediatelyBody", "Request cancellation now? Your access can end immediately.");
|
|
46
|
+
}
|
|
47
|
+
async function load(_state: S, arg?: unknown): Promise<S | undefined> {
|
|
48
|
+
stashCopy(arg);
|
|
49
|
+
const seq = ++sequence;
|
|
50
|
+
if (order && order.id !== detailInputId()) { order = null; void svc.clear(); }
|
|
51
|
+
const member = await memberAccess();
|
|
52
|
+
if (seq !== sequence) return undefined;
|
|
53
|
+
if (!member.email) { order = null; return { ...initial(), status: "guest", subtitle: copyParam("mySubscriptions.guestBody", "Sign in to see your subscriptions."), hideAccountCta: false, ...presence("missing"), hideNotFound: true }; }
|
|
54
|
+
const id = detailInputId();
|
|
55
|
+
if (!id) return { ...initial(), status: "ready", subtitle: copyParam("subscriptionDetail.missingId", "Open a subscription from My Subscriptions."), ...presence("missing") };
|
|
56
|
+
try {
|
|
57
|
+
const result = await getMyPlanOrder(id);
|
|
58
|
+
await assertMemberAccess(member);
|
|
59
|
+
if (seq !== sequence) return undefined;
|
|
60
|
+
orderMemberKey = memberKey(member);
|
|
61
|
+
order = result.order;
|
|
62
|
+
if (!order?.id || order.status === "DRAFT") { order = null; return { ...initial(), status: "ready", ...presence("missing") }; }
|
|
63
|
+
return project(order, cancellationsSent.has(cancellationKey(order.id)) && canCancel(order) ? copyParam("subscriptionDetail.cancelPending", "Cancellation requested. Refresh to see the latest status.") : "");
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (seq !== sequence) return undefined;
|
|
66
|
+
order = null;
|
|
67
|
+
if (await memberChanged(member, error)) { void svc.clear(); void svc.load(); return undefined; }
|
|
68
|
+
const denied = memberAccessDenied(error);
|
|
69
|
+
const flags = presenceAfterError(error);
|
|
70
|
+
return { ...initial(), status: "ready", subtitle: copyParam("subscriptionDetail.loadError", "This subscription could not be loaded."), ...flags, denied, hideLoadError: denied || flags.hideLoadError, hideDeniedError: !denied };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
type SubscriptionActions = {
|
|
74
|
+
beginCancel: (s: S) => S; clear: (s: S) => S; load: typeof load; requestCancel: (s: S) => S;
|
|
75
|
+
dismissCancel: (s: S) => S; chooseEffectiveAt: (s: S, arg?: unknown) => S;
|
|
76
|
+
confirmCancel: (s: S) => Promise<S | undefined>;
|
|
77
|
+
};
|
|
78
|
+
const svc: ReturnType<typeof defineService<S, SubscriptionActions>> = defineService<S, SubscriptionActions>("spacesSubscriptionDetail", {
|
|
79
|
+
state: initial(), notHydrated: Object.keys(initial()) as Array<keyof S>,
|
|
80
|
+
actions: {
|
|
81
|
+
beginCancel: state => ({ ...state, busy: true }),
|
|
82
|
+
clear: () => initial(), load,
|
|
83
|
+
requestCancel: state => !order || order.id !== detailInputId() || state.hideCancel || cancelInFlight ? state : { ...state, hideConfirmation: false, showConfirmation: true, actionMessage: "", actionError: "none", hasActionError: false, noActionError: true, confirmation: confirmation(state.effectiveAt) },
|
|
84
|
+
dismissCancel: state => cancelInFlight ? state : { ...state, hideConfirmation: true, showConfirmation: false },
|
|
85
|
+
chooseEffectiveAt: (state, arg) => {
|
|
86
|
+
if (cancelInFlight || state.hideConfirmation) return state;
|
|
87
|
+
const value = typeof arg === "string" ? arg : (arg as { value?: string; selectedId?: string })?.value ?? (arg as { selectedId?: string })?.selectedId;
|
|
88
|
+
const effectiveAt = value === "NEXT_PAYMENT_DATE" && !state.noScheduledOption ? value : "IMMEDIATELY";
|
|
89
|
+
return { ...state, effectiveAt, confirmation: confirmation(effectiveAt) };
|
|
90
|
+
},
|
|
91
|
+
confirmCancel: async (state): Promise<S | undefined> => {
|
|
92
|
+
if (state.hideConfirmation || state.hideCancel || !order || order.id !== detailInputId() || !canCancel(order) || cancelInFlight || cancellationsSent.has(cancellationKey(order.id))) return undefined;
|
|
93
|
+
cancelInFlight = true;
|
|
94
|
+
void svc.beginCancel();
|
|
95
|
+
const seq = sequence;
|
|
96
|
+
const id = order.id;
|
|
97
|
+
const isCurrent = (): boolean => seq === sequence && detailInputId() === id;
|
|
98
|
+
const member = await memberAccess();
|
|
99
|
+
const requestKey = cancellationKey(id, memberKey(member));
|
|
100
|
+
try {
|
|
101
|
+
if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
|
|
102
|
+
await assertMemberAccess(member);
|
|
103
|
+
if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
|
|
104
|
+
// Refresh policy/lifecycle facts before writing; never cancel a stale/other member order.
|
|
105
|
+
const latest = (await getMyPlanOrder(id)).order;
|
|
106
|
+
await assertMemberAccess(member);
|
|
107
|
+
if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
|
|
108
|
+
if (!latest || !canCancel(latest)) { order = latest; return latest ? project(latest) : { ...initial(), ...presence("missing") }; }
|
|
109
|
+
if (state.effectiveAt === "NEXT_PAYMENT_DATE" && (!latest.currentCycle?.endedDate || Date.parse(latest.currentCycle.endedDate) <= Date.now())) {
|
|
110
|
+
order = latest; return { ...project(latest), actionMessage: copyParam("subscriptionDetail.changedBeforeCancel", "Your subscription changed. Review the details before canceling.") };
|
|
111
|
+
}
|
|
112
|
+
await requestCancellation(id, state.effectiveAt === "NEXT_PAYMENT_DATE" ? "NEXT_PAYMENT_DATE" : "IMMEDIATELY");
|
|
113
|
+
// An accepted write remains fenced for its original member even when a session
|
|
114
|
+
// change overtakes its response. Check ownership before publishing, not before
|
|
115
|
+
// remembering the acknowledgement; reads can still report ACTIVE afterward.
|
|
116
|
+
cancellationsSent.add(requestKey);
|
|
117
|
+
if (!isCurrent()) return load(svc.getState());
|
|
118
|
+
await assertMemberAccess(member);
|
|
119
|
+
if (!isCurrent()) return load(svc.getState());
|
|
120
|
+
const refreshed = (await getMyPlanOrder(id)).order;
|
|
121
|
+
await assertMemberAccess(member);
|
|
122
|
+
if (!isCurrent()) return load(svc.getState());
|
|
123
|
+
order = refreshed;
|
|
124
|
+
return project(refreshed, canCancel(refreshed) ? copyParam("subscriptionDetail.cancelPending", "Cancellation requested. Refresh to see the latest status.") : "");
|
|
125
|
+
} catch (error) {
|
|
126
|
+
if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
|
|
127
|
+
if (await memberChanged(member, error)) { order = null; orderMemberKey = ""; void svc.clear(); void svc.load(); return undefined; }
|
|
128
|
+
if (!isCurrent()) return seq === sequence ? load(svc.getState()) : undefined;
|
|
129
|
+
return { ...state, busy: false, hideConfirmation: true, showConfirmation: false, actionError: cancellationsSent.has(requestKey) ? "cancelRefreshFailed" : memberAccessDenied(error) ? "cancelDenied" : "cancelFailed", hasActionError: true, noActionError: false, hideCancel: cancellationsSent.has(requestKey) || memberAccessDenied(error) || state.hideCancel,
|
|
130
|
+
actionMessage: cancellationsSent.has(requestKey) ? copyParam("subscriptionDetail.cancelRefreshFailed", "Cancellation requested, but the latest status could not be loaded. Refresh the details.")
|
|
131
|
+
: memberAccessDenied(error) ? copyParam("subscriptionDetail.cancelDenied", "This subscription cannot be canceled from this account. Contact the business for help.")
|
|
132
|
+
: copyParam("subscriptionDetail.cancelFailed", "Cancellation failed. Try again.") };
|
|
133
|
+
} finally { cancelInFlight = false; }
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
session.subscribe(() => { ++sequence; order = null; orderMemberKey = ""; void svc.clear(); void svc.load(); });
|
|
138
|
+
svc.load();
|
|
139
|
+
export { svc };
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
{
|
|
2
|
+
"colors": {
|
|
3
|
+
"surfacePrimary": {
|
|
4
|
+
"light": "#0C0C0C",
|
|
5
|
+
"dark": "#0C0C0C",
|
|
6
|
+
"highContrast": "#000000"
|
|
7
|
+
},
|
|
8
|
+
"surfaceSubtle": {
|
|
9
|
+
"light": "#121212",
|
|
10
|
+
"dark": "#121212",
|
|
11
|
+
"highContrast": "#0A0A0A"
|
|
12
|
+
},
|
|
13
|
+
"surfaceSecondary": {
|
|
14
|
+
"light": "#151515",
|
|
15
|
+
"dark": "#151515",
|
|
16
|
+
"highContrast": "#0F0F0F"
|
|
17
|
+
},
|
|
18
|
+
"surfaceElevated": {
|
|
19
|
+
"light": "#1D1D1D",
|
|
20
|
+
"dark": "#1D1D1D",
|
|
21
|
+
"highContrast": "#161616"
|
|
22
|
+
},
|
|
23
|
+
"surfaceTertiary": {
|
|
24
|
+
"light": "#2A2A2A",
|
|
25
|
+
"dark": "#2A2A2A",
|
|
26
|
+
"highContrast": "#262626"
|
|
27
|
+
},
|
|
28
|
+
"textPrimary": {
|
|
29
|
+
"light": "#FFFFFF",
|
|
30
|
+
"dark": "#FFFFFF",
|
|
31
|
+
"highContrast": "#FFFFFF"
|
|
32
|
+
},
|
|
33
|
+
"textSecondary": {
|
|
34
|
+
"light": "#A6A6A6",
|
|
35
|
+
"dark": "#A6A6A6",
|
|
36
|
+
"highContrast": "#D9D9D9"
|
|
37
|
+
},
|
|
38
|
+
"textTertiary": {
|
|
39
|
+
"light": "#808080",
|
|
40
|
+
"dark": "#808080",
|
|
41
|
+
"highContrast": "#BFBFBF"
|
|
42
|
+
},
|
|
43
|
+
"textOnAccent": {
|
|
44
|
+
"light": "#0C0C0C",
|
|
45
|
+
"dark": "#0C0C0C",
|
|
46
|
+
"highContrast": "#000000"
|
|
47
|
+
},
|
|
48
|
+
"accentPrimary": {
|
|
49
|
+
"light": "#CBE332",
|
|
50
|
+
"dark": "#CBE332",
|
|
51
|
+
"highContrast": "#DDF25A"
|
|
52
|
+
},
|
|
53
|
+
"accentText": {
|
|
54
|
+
"light": "#CBE332",
|
|
55
|
+
"dark": "#CBE332",
|
|
56
|
+
"highContrast": "#DDF25A"
|
|
57
|
+
},
|
|
58
|
+
"accentSecondary": {
|
|
59
|
+
"light": "#FFFFFF",
|
|
60
|
+
"dark": "#FFFFFF",
|
|
61
|
+
"highContrast": "#FFFFFF"
|
|
62
|
+
},
|
|
63
|
+
"accentSurface": {
|
|
64
|
+
"light": "#252C0A",
|
|
65
|
+
"dark": "#252C0A",
|
|
66
|
+
"highContrast": "#2E3608"
|
|
67
|
+
},
|
|
68
|
+
"success": {
|
|
69
|
+
"light": "#5BD98A",
|
|
70
|
+
"dark": "#5BD98A",
|
|
71
|
+
"highContrast": "#6FE79A"
|
|
72
|
+
},
|
|
73
|
+
"successSurface": {
|
|
74
|
+
"light": "#11291A",
|
|
75
|
+
"dark": "#11291A",
|
|
76
|
+
"highContrast": "#12331B"
|
|
77
|
+
},
|
|
78
|
+
"warning": {
|
|
79
|
+
"light": "#F5B83D",
|
|
80
|
+
"dark": "#F5B83D",
|
|
81
|
+
"highContrast": "#FFC857"
|
|
82
|
+
},
|
|
83
|
+
"warningSurface": {
|
|
84
|
+
"light": "#33270A",
|
|
85
|
+
"dark": "#33270A",
|
|
86
|
+
"highContrast": "#3A2C0A"
|
|
87
|
+
},
|
|
88
|
+
"danger": {
|
|
89
|
+
"light": "#FF6B5E",
|
|
90
|
+
"dark": "#FF6B5E",
|
|
91
|
+
"highContrast": "#FF8A80"
|
|
92
|
+
},
|
|
93
|
+
"dangerSurface": {
|
|
94
|
+
"light": "#3A1512",
|
|
95
|
+
"dark": "#3A1512",
|
|
96
|
+
"highContrast": "#3A1513"
|
|
97
|
+
},
|
|
98
|
+
"border": {
|
|
99
|
+
"light": "#2E2E2E",
|
|
100
|
+
"dark": "#2E2E2E",
|
|
101
|
+
"highContrast": "#8C8C8C"
|
|
102
|
+
},
|
|
103
|
+
"scrimClear": {
|
|
104
|
+
"light": "#0C0C0C00",
|
|
105
|
+
"dark": "#0C0C0C00",
|
|
106
|
+
"highContrast": "#00000000"
|
|
107
|
+
},
|
|
108
|
+
"scrimMid": {
|
|
109
|
+
"light": "#0C0C0CBF",
|
|
110
|
+
"dark": "#0C0C0CBF",
|
|
111
|
+
"highContrast": "#000000CC"
|
|
112
|
+
},
|
|
113
|
+
"onPhoto": {
|
|
114
|
+
"light": "#FFFFFF",
|
|
115
|
+
"dark": "#FFFFFF",
|
|
116
|
+
"highContrast": "#FFFFFF"
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"spacing": {
|
|
120
|
+
"xs": 4,
|
|
121
|
+
"sm": 8,
|
|
122
|
+
"md": 12,
|
|
123
|
+
"lg": 16,
|
|
124
|
+
"screenMargin": 20,
|
|
125
|
+
"pricingScreenMargin": 20,
|
|
126
|
+
"xl": 24,
|
|
127
|
+
"xxl": 32
|
|
128
|
+
},
|
|
129
|
+
"typography": {
|
|
130
|
+
"displayHero": {
|
|
131
|
+
"family": "Wix Madefor Display",
|
|
132
|
+
"size": 40,
|
|
133
|
+
"weight": 800,
|
|
134
|
+
"line": 1.0,
|
|
135
|
+
"letterSpacing": -0.5
|
|
136
|
+
},
|
|
137
|
+
"display": {
|
|
138
|
+
"family": "Wix Madefor Display",
|
|
139
|
+
"size": 32,
|
|
140
|
+
"weight": 800,
|
|
141
|
+
"line": 1.05,
|
|
142
|
+
"letterSpacing": -0.3
|
|
143
|
+
},
|
|
144
|
+
"screenTitle": {
|
|
145
|
+
"family": "Wix Madefor Display",
|
|
146
|
+
"size": 28,
|
|
147
|
+
"weight": 800,
|
|
148
|
+
"line": 1.1,
|
|
149
|
+
"letterSpacing": 0
|
|
150
|
+
},
|
|
151
|
+
"pageTitle": {
|
|
152
|
+
"family": "Wix Madefor Display",
|
|
153
|
+
"size": 28,
|
|
154
|
+
"weight": 800,
|
|
155
|
+
"line": 1.1,
|
|
156
|
+
"letterSpacing": 0
|
|
157
|
+
},
|
|
158
|
+
"pricingTitle": {
|
|
159
|
+
"family": "Wix Madefor Display",
|
|
160
|
+
"size": 28,
|
|
161
|
+
"weight": 800,
|
|
162
|
+
"line": 1.1,
|
|
163
|
+
"letterSpacing": 0
|
|
164
|
+
},
|
|
165
|
+
"statValue": {
|
|
166
|
+
"family": "Wix Madefor Display",
|
|
167
|
+
"size": 28,
|
|
168
|
+
"weight": 800,
|
|
169
|
+
"line": 1.0,
|
|
170
|
+
"letterSpacing": 0
|
|
171
|
+
},
|
|
172
|
+
"title1": {
|
|
173
|
+
"family": "Wix Madefor Display",
|
|
174
|
+
"size": 24,
|
|
175
|
+
"weight": 800,
|
|
176
|
+
"line": 1.15,
|
|
177
|
+
"letterSpacing": 0
|
|
178
|
+
},
|
|
179
|
+
"title2": {
|
|
180
|
+
"family": "Wix Madefor Text",
|
|
181
|
+
"size": 20,
|
|
182
|
+
"weight": 700,
|
|
183
|
+
"line": 1.25,
|
|
184
|
+
"letterSpacing": 0
|
|
185
|
+
},
|
|
186
|
+
"title3": {
|
|
187
|
+
"family": "Wix Madefor Text",
|
|
188
|
+
"size": 17,
|
|
189
|
+
"weight": 700,
|
|
190
|
+
"line": 1.3,
|
|
191
|
+
"letterSpacing": 0
|
|
192
|
+
},
|
|
193
|
+
"headline": {
|
|
194
|
+
"family": "Wix Madefor Text",
|
|
195
|
+
"size": 17,
|
|
196
|
+
"weight": 700,
|
|
197
|
+
"line": 1.3,
|
|
198
|
+
"letterSpacing": 0
|
|
199
|
+
},
|
|
200
|
+
"body": {
|
|
201
|
+
"family": "Wix Madefor Text",
|
|
202
|
+
"size": 16,
|
|
203
|
+
"weight": 400,
|
|
204
|
+
"line": 1.5,
|
|
205
|
+
"letterSpacing": 0
|
|
206
|
+
},
|
|
207
|
+
"bodyEmphasis": {
|
|
208
|
+
"family": "Wix Madefor Text",
|
|
209
|
+
"size": 16,
|
|
210
|
+
"weight": 700,
|
|
211
|
+
"line": 1.35,
|
|
212
|
+
"letterSpacing": 0
|
|
213
|
+
},
|
|
214
|
+
"callout": {
|
|
215
|
+
"family": "Wix Madefor Text",
|
|
216
|
+
"size": 16,
|
|
217
|
+
"weight": 700,
|
|
218
|
+
"line": 1.35,
|
|
219
|
+
"letterSpacing": 0
|
|
220
|
+
},
|
|
221
|
+
"footnote": {
|
|
222
|
+
"family": "Wix Madefor Text",
|
|
223
|
+
"size": 14,
|
|
224
|
+
"weight": 600,
|
|
225
|
+
"line": 1.35,
|
|
226
|
+
"letterSpacing": 0
|
|
227
|
+
},
|
|
228
|
+
"footnoteRegular": {
|
|
229
|
+
"family": "Wix Madefor Text",
|
|
230
|
+
"size": 14,
|
|
231
|
+
"weight": 400,
|
|
232
|
+
"line": 1.45,
|
|
233
|
+
"letterSpacing": 0
|
|
234
|
+
},
|
|
235
|
+
"label": {
|
|
236
|
+
"family": "Wix Madefor Text",
|
|
237
|
+
"size": 14,
|
|
238
|
+
"weight": 600,
|
|
239
|
+
"line": 1.35,
|
|
240
|
+
"letterSpacing": 0
|
|
241
|
+
},
|
|
242
|
+
"caption": {
|
|
243
|
+
"family": "Wix Madefor Text",
|
|
244
|
+
"size": 12,
|
|
245
|
+
"weight": 500,
|
|
246
|
+
"line": 1.35,
|
|
247
|
+
"letterSpacing": 0.2
|
|
248
|
+
},
|
|
249
|
+
"overline": {
|
|
250
|
+
"family": "Wix Madefor Text",
|
|
251
|
+
"size": 12,
|
|
252
|
+
"weight": 700,
|
|
253
|
+
"line": 1.3,
|
|
254
|
+
"letterSpacing": 1
|
|
255
|
+
},
|
|
256
|
+
"pricingSection": {
|
|
257
|
+
"family": "Wix Madefor Text",
|
|
258
|
+
"size": 12,
|
|
259
|
+
"weight": 700,
|
|
260
|
+
"line": 1.3,
|
|
261
|
+
"letterSpacing": 1
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"radius": {
|
|
265
|
+
"sm": 8,
|
|
266
|
+
"md": 14,
|
|
267
|
+
"lg": 20,
|
|
268
|
+
"xl": 28,
|
|
269
|
+
"pill": 999
|
|
270
|
+
},
|
|
271
|
+
"kit": {
|
|
272
|
+
"colorScheme": "dark",
|
|
273
|
+
"material": "flat",
|
|
274
|
+
"variant": "default",
|
|
275
|
+
"density": "spacious",
|
|
276
|
+
"motion": "smooth",
|
|
277
|
+
"motionDefaults": "subtle"
|
|
278
|
+
},
|
|
279
|
+
"shadows": {
|
|
280
|
+
"sm": {
|
|
281
|
+
"color": "#000000",
|
|
282
|
+
"opacity": 0,
|
|
283
|
+
"radius": 0,
|
|
284
|
+
"x": 0,
|
|
285
|
+
"y": 0
|
|
286
|
+
},
|
|
287
|
+
"md": {
|
|
288
|
+
"color": "#000000",
|
|
289
|
+
"opacity": 0,
|
|
290
|
+
"radius": 0,
|
|
291
|
+
"x": 0,
|
|
292
|
+
"y": 0
|
|
293
|
+
},
|
|
294
|
+
"lg": {
|
|
295
|
+
"color": "#000000",
|
|
296
|
+
"opacity": 0,
|
|
297
|
+
"radius": 0,
|
|
298
|
+
"x": 0,
|
|
299
|
+
"y": 0
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
"gradients": {
|
|
303
|
+
"brand": {
|
|
304
|
+
"colors": [
|
|
305
|
+
"accentPrimary",
|
|
306
|
+
"accentText"
|
|
307
|
+
],
|
|
308
|
+
"angle": 135
|
|
309
|
+
},
|
|
310
|
+
"subtle": {
|
|
311
|
+
"colors": [
|
|
312
|
+
"surfaceSecondary",
|
|
313
|
+
"surfacePrimary"
|
|
314
|
+
],
|
|
315
|
+
"angle": 180
|
|
316
|
+
},
|
|
317
|
+
"hero": {
|
|
318
|
+
"colors": [
|
|
319
|
+
"scrimClear",
|
|
320
|
+
"scrimMid",
|
|
321
|
+
"surfacePrimary"
|
|
322
|
+
],
|
|
323
|
+
"angle": 180
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"materials": {
|
|
327
|
+
"flat": {
|
|
328
|
+
"style": "flat",
|
|
329
|
+
"tint": "surfaceSecondary",
|
|
330
|
+
"opacity": 1
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"motions": {
|
|
334
|
+
"smooth": {
|
|
335
|
+
"duration": 260,
|
|
336
|
+
"easing": "easeInOut"
|
|
337
|
+
},
|
|
338
|
+
"quick": {
|
|
339
|
+
"duration": 140,
|
|
340
|
+
"easing": "easeOut"
|
|
341
|
+
},
|
|
342
|
+
"ring": {
|
|
343
|
+
"duration": 600,
|
|
344
|
+
"easing": "easeInOut"
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"controls": {
|
|
348
|
+
"button": {
|
|
349
|
+
"sm": {
|
|
350
|
+
"height": 36,
|
|
351
|
+
"paddingH": 16,
|
|
352
|
+
"paddingV": 8,
|
|
353
|
+
"text": "footnote",
|
|
354
|
+
"icon": 16,
|
|
355
|
+
"radius": 999
|
|
356
|
+
},
|
|
357
|
+
"md": {
|
|
358
|
+
"height": 52,
|
|
359
|
+
"paddingH": 24,
|
|
360
|
+
"paddingV": 14,
|
|
361
|
+
"text": "bodyEmphasis",
|
|
362
|
+
"icon": 20,
|
|
363
|
+
"radius": 999
|
|
364
|
+
},
|
|
365
|
+
"lg": {
|
|
366
|
+
"height": 64,
|
|
367
|
+
"paddingH": 24,
|
|
368
|
+
"paddingV": 16,
|
|
369
|
+
"text": "bodyEmphasis",
|
|
370
|
+
"icon": 22,
|
|
371
|
+
"radius": 999
|
|
372
|
+
},
|
|
373
|
+
"variants": {
|
|
374
|
+
"primary": {
|
|
375
|
+
"fill": "accentPrimary",
|
|
376
|
+
"label": "textOnAccent",
|
|
377
|
+
"borderWidth": 0
|
|
378
|
+
},
|
|
379
|
+
"secondary": {
|
|
380
|
+
"label": "textPrimary",
|
|
381
|
+
"border": "accentSecondary",
|
|
382
|
+
"borderWidth": 1.5
|
|
383
|
+
},
|
|
384
|
+
"tertiary": {
|
|
385
|
+
"label": "accentText",
|
|
386
|
+
"borderWidth": 0
|
|
387
|
+
},
|
|
388
|
+
"destructive": {
|
|
389
|
+
"label": "danger",
|
|
390
|
+
"border": "danger",
|
|
391
|
+
"borderWidth": 1.5
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
"tabBar": {
|
|
397
|
+
"background": {
|
|
398
|
+
"color": "surfaceSecondary"
|
|
399
|
+
},
|
|
400
|
+
"activeTint": "accentPrimary",
|
|
401
|
+
"inactiveTint": "textSecondary",
|
|
402
|
+
"labels": {
|
|
403
|
+
"show": true,
|
|
404
|
+
"typography": "caption"
|
|
405
|
+
},
|
|
406
|
+
"iconSize": 22,
|
|
407
|
+
"motion": "smooth"
|
|
408
|
+
},
|
|
409
|
+
"contentMaxWidth": {
|
|
410
|
+
"base": 480,
|
|
411
|
+
"medium": 600,
|
|
412
|
+
"expanded": 760
|
|
413
|
+
}
|
|
414
|
+
}
|
|
@@ -25413,7 +25413,7 @@ const SCREENS = runtimeSetting({
|
|
|
25413
25413
|
}
|
|
25414
25414
|
},
|
|
25415
25415
|
"modifiers": {
|
|
25416
|
-
"width":
|
|
25416
|
+
"width": 80
|
|
25417
25417
|
}
|
|
25418
25418
|
},
|
|
25419
25419
|
{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// How a worker reads an Online Program's lifecycle and name. Wix returns them in more than one
|
|
2
|
+
// shape (v3 `status` or `state`; `description.title`, `settings.title`, a flat `title` or
|
|
3
|
+
// `details.title`), so every screen that lists programs reads them here, the same way.
|
|
4
|
+
import type { WixProgram } from "@himalaya/wix-online-programs";
|
|
5
|
+
import { cleanTitle } from "./himi-text.js";
|
|
6
|
+
|
|
7
|
+
export function programStatus(p: WixProgram): string {
|
|
8
|
+
return (p.status ?? p.state ?? "").toUpperCase();
|
|
9
|
+
}
|
|
10
|
+
export const isProgramEnded = (p: WixProgram): boolean => programStatus(p) === "ENDED" || programStatus(p) === "FINISHED";
|
|
11
|
+
export const isProgramDraft = (p: WixProgram): boolean => programStatus(p) === "DRAFT";
|
|
12
|
+
|
|
13
|
+
/** The program's own name, cleaned; "" when it has none (the caller picks its own fallback word). */
|
|
14
|
+
export function programName(p: WixProgram): string {
|
|
15
|
+
return cleanTitle(p.description?.title ?? p.settings?.title ?? p.title ?? p.details?.title);
|
|
16
|
+
}
|