@wix/himalaya-cli 0.1852.0 → 0.1854.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/cli.mjs +1104 -711
- package/guides/himi-json-output.md +8 -2
- package/guides/iap-products.md +4 -0
- package/guides/one-app-section-mappings.md +2 -2
- package/guides/one-app-to-himi-app.md +28 -12
- package/guides/push-cli-onboarding.md +20 -0
- package/package.json +2 -2
- package/template-icons/bare-fashion.png +0 -0
- package/templates/bare-fashion/README.md +52 -0
- package/templates/bare-fashion/config.ts +474 -0
- package/templates/bare-fashion/dev/index.ts +16526 -0
- package/templates/bare-fashion/himalaya.content.json +70 -0
- package/templates/bare-fashion/himalaya.template.json +18 -0
- package/templates/bare-fashion/icon.png +0 -0
- package/templates/bare-fashion/platforms.json +3 -0
- package/templates/bare-fashion/tier5-src/_shared/app-locale.ts +70 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-book.ts +116 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-countries.ts +261 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-bag-count.ts +24 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-categories.ts +48 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-facets.ts +265 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-load-error.ts +38 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-product-card.ts +136 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-store-options.ts +129 -0
- package/templates/bare-fashion/tier5-src/_shared/branded-lite-hosted.ts +282 -0
- package/templates/bare-fashion/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/bare-fashion/tier5-src/_shared/collection-query.ts +201 -0
- package/templates/bare-fashion/tier5-src/_shared/collection-service.ts +429 -0
- package/templates/bare-fashion/tier5-src/_shared/engine-intl.ts +529 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-copy.ts +123 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-layouts.ts +142 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-store-categories.ts +108 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-store-saved.ts +57 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/bare-fashion/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/bare-fashion/tier5-src/_shared/live-session.ts +172 -0
- package/templates/bare-fashion/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/bare-fashion/tier5-src/_shared/member-access.ts +63 -0
- package/templates/bare-fashion/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/bare-fashion/tier5-src/_shared/member-orders.ts +8 -0
- package/templates/bare-fashion/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/bare-fashion/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-account/index.ts +127 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-address-form/index.ts +367 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-addresses/index.ts +202 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-appearance/index.ts +73 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-cart/index.ts +540 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-collection/index.ts +111 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +241 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-nav/index.ts +56 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-order/index.ts +437 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-product/index.ts +650 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-products/index.ts +142 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-saved/index.ts +45 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-search/index.ts +199 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-shop/index.ts +79 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-sign-in/index.ts +269 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-wallet/index.ts +224 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-info/index.ts +209 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-orders/index.ts +327 -0
- package/templates/bare-fashion/tier5-src/wix-spaces-collections/index.ts +48 -0
- package/templates/bare-fashion/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/bare-fashion/tier5-src/wix-spaces-view-profile/index.ts +119 -0
- package/templates/bare-fashion/tokens.json +348 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/branded-lite/recipes/upcoming-bookings.json +118 -6
- package/templates/branded-lite/tier5-src/_shared/announcement-section.ts +6 -14
- package/templates/branded-lite/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/branded-lite/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/branded-lite/tier5-src/_shared/draft-content.ts +66 -0
- package/templates/branded-lite/tier5-src/_shared/events-inline-options.ts +55 -3
- package/templates/branded-lite/tier5-src/_shared/events-inline.ts +5 -3
- package/templates/branded-lite/tier5-src/_shared/upcoming-bookings-section.ts +15 -4
- package/templates/branded-lite/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/brandy/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/brandy/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/brandy/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/community-club/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/community-club/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/community-club/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/community-club/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/community-club-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/conference/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/conference/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/conference/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/conference/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/events-meetups/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/events-meetups/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/events-meetups/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/events-meetups-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/gym-fitness/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/gym-fitness/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/gym-fitness/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/medical-services/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/medical-services/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/nonprofit-cause/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/nonprofit-cause/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/nonprofit-cause/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/owner-lite/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/podcast-creator/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/podcast-creator/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/podcast-creator/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/portfolio-creative/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/portfolio-creative/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/portfolio-creative/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/restaurant/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/restaurant/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/restaurant/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/restaurant-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/retail-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/retail-store/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/retail-store-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/salon-spa/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/salon-spa/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/wholesale-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/wholesale-store/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/wholesale-store/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/yoga-studio/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/yoga-studio/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/yoga-studio/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +7 -1
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Tier-5 bundle: Wix Spaces clone — View Profile (member's own public profile).
|
|
2
|
+
// Prefer site Members Area (`GET /members/v1/members/my`) + session email; never
|
|
3
|
+
// paint the seeded "apptestercoowner" demo identity when the session is a real
|
|
4
|
+
// member (or a guest — show honesty instead).
|
|
5
|
+
import { defineService } from "@himalaya/state";
|
|
6
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
7
|
+
import { getMyData, displayName } from "@himalaya/wix-users";
|
|
8
|
+
|
|
9
|
+
// `needsSignIn` / `noSignIn` drive the shared member gate: a guest gets the
|
|
10
|
+
// gate with a Sign in button and no placeholder profile. `profileHidden` stays true until
|
|
11
|
+
// `load` has resolved a member, so a guest never glimpses the placeholder avatar while
|
|
12
|
+
// the membership check is still running; `hideLoading` is false for exactly that moment,
|
|
13
|
+
// so the screen shows a loading line instead of going blank.
|
|
14
|
+
interface S { status: "loading" | "ready"; name: string; handle: string; about: string; initial: string; photo: string; needsSignIn: boolean; noSignIn: boolean; profileHidden: boolean; hideLoading: boolean; hideError: boolean; hideAbout: boolean }
|
|
15
|
+
|
|
16
|
+
const EMPTY: S = {
|
|
17
|
+
status: "loading",
|
|
18
|
+
name: "",
|
|
19
|
+
handle: "",
|
|
20
|
+
about: "No info to display.",
|
|
21
|
+
initial: "?",
|
|
22
|
+
photo: "",
|
|
23
|
+
needsSignIn: false,
|
|
24
|
+
noSignIn: true,
|
|
25
|
+
profileHidden: true,
|
|
26
|
+
hideLoading: false,
|
|
27
|
+
hideError: true,
|
|
28
|
+
hideAbout: false,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// The SAME member check create-post and orders use (`memberAccess`: the host's
|
|
32
|
+
// memberIdentity, falling back to wix-users only on hosts that predate that action), so
|
|
33
|
+
// one shared gate never gives two answers in one app.
|
|
34
|
+
async function sessionEmail(): Promise<string> {
|
|
35
|
+
return (await memberAccess()).email;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function wixApi() {
|
|
39
|
+
return (globalThis as { himalaya?: { wixApi?: { call: (m: string, p: string, b?: unknown) => Promise<unknown> } } }).himalaya?.wixApi;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function fromParts(name: string, handleRaw: string, about: string, photo = ""): S {
|
|
43
|
+
const clean = name.trim();
|
|
44
|
+
const handle = "@" + (handleRaw || clean || "member").replace(/\s+/g, "").replace(/^@+/, "").toLowerCase();
|
|
45
|
+
const initial = (clean.split(/\s+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2) || "?").toUpperCase();
|
|
46
|
+
return { status: "ready", name: clean || "Member", handle, about: about || "No info to display.", initial, photo, needsSignIn: false, noSignIn: true, profileHidden: false, hideLoading: true, hideError: true, hideAbout: false };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function readProfile(): Promise<S> {
|
|
50
|
+
const email = await sessionEmail();
|
|
51
|
+
if (!email) {
|
|
52
|
+
return {
|
|
53
|
+
status: "ready",
|
|
54
|
+
// Kept for hosts without the shared member gate (the Spaces clone renders these
|
|
55
|
+
// fields directly); branded-lite hides the profile block behind `profileHidden`.
|
|
56
|
+
name: "Sign in to view your profile",
|
|
57
|
+
handle: "",
|
|
58
|
+
about: "Your public profile is available after you sign in from Account.",
|
|
59
|
+
initial: "?",
|
|
60
|
+
photo: "",
|
|
61
|
+
needsSignIn: true,
|
|
62
|
+
noSignIn: false,
|
|
63
|
+
profileHidden: true,
|
|
64
|
+
hideLoading: true,
|
|
65
|
+
hideError: true,
|
|
66
|
+
hideAbout: false,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const api = wixApi();
|
|
71
|
+
if (api) {
|
|
72
|
+
const res = (await api.call("GET", "/members/v1/members/my?fieldSet=FULL")) as {
|
|
73
|
+
member?: {
|
|
74
|
+
loginEmail?: string;
|
|
75
|
+
contact?: { firstName?: string; lastName?: string };
|
|
76
|
+
profile?: { nickname?: string; slug?: string; title?: string; photo?: { url?: string } };
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
const m = res.member;
|
|
80
|
+
if (m) {
|
|
81
|
+
const nick = m.profile?.nickname?.trim() || "";
|
|
82
|
+
const full = [m.contact?.firstName, m.contact?.lastName].filter(Boolean).join(" ").trim();
|
|
83
|
+
const name = full || nick || m.loginEmail || email;
|
|
84
|
+
const slug = m.profile?.slug || nick || name;
|
|
85
|
+
const about = m.profile?.title || "No info to display.";
|
|
86
|
+
return fromParts(name, slug, about, m.profile?.photo?.url || "");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} catch { /* fall through to users my-data / email */ }
|
|
90
|
+
try {
|
|
91
|
+
const d = await getMyData();
|
|
92
|
+
const name = displayName(d) || email;
|
|
93
|
+
const dd = d as unknown as { nickname?: string; slug?: string; about?: string; aboutPlain?: string; profile?: { photo?: { url?: string } }; photo?: { url?: string } };
|
|
94
|
+
return fromParts(
|
|
95
|
+
name,
|
|
96
|
+
dd.slug || dd.nickname || name,
|
|
97
|
+
dd.aboutPlain || dd.about || "No info to display.",
|
|
98
|
+
dd.profile?.photo?.url || dd.photo?.url || "",
|
|
99
|
+
);
|
|
100
|
+
} catch {
|
|
101
|
+
// Session identity is still known; missing profile data is not an empty biography.
|
|
102
|
+
return { ...fromParts(email, email.split("@")[0] || email, ""), about: "Profile details could not be loaded. Please try again.", hideError: false, hideAbout: true };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
let generation = 0;
|
|
106
|
+
const svc = defineService<S, { load: (s: S) => Promise<S | undefined> }>("spacesViewProfile", {
|
|
107
|
+
state: { ...EMPTY },
|
|
108
|
+
notHydrated: Object.keys(EMPTY) as (keyof S & string)[],
|
|
109
|
+
actions: {
|
|
110
|
+
load: async () => {
|
|
111
|
+
const request = ++generation;
|
|
112
|
+
const next = await readProfile();
|
|
113
|
+
return request === generation ? next : undefined;
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
if (!(globalThis as { himalaya?: { hydrationOptOut?: boolean } }).himalaya?.hydrationOptOut) Object.assign(svc.getState(), EMPTY);
|
|
118
|
+
void svc.load();
|
|
119
|
+
export { svc };
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
{
|
|
2
|
+
"colors": {
|
|
3
|
+
"surfacePrimary": {
|
|
4
|
+
"light": "#FFFFFF",
|
|
5
|
+
"dark": "#151414",
|
|
6
|
+
"highContrast": "#000000"
|
|
7
|
+
},
|
|
8
|
+
"surfaceSecondary": {
|
|
9
|
+
"light": "#F7F7F7",
|
|
10
|
+
"dark": "#1F1E1E",
|
|
11
|
+
"highContrast": "#0A0A0A"
|
|
12
|
+
},
|
|
13
|
+
"surfaceElevated": {
|
|
14
|
+
"light": "#FFFFFF",
|
|
15
|
+
"dark": "#1F1E1E",
|
|
16
|
+
"highContrast": "#000000"
|
|
17
|
+
},
|
|
18
|
+
"surfaceSubtle": {
|
|
19
|
+
"light": "#F7F7F7",
|
|
20
|
+
"dark": "#1F1E1E",
|
|
21
|
+
"highContrast": "#0A0A0A"
|
|
22
|
+
},
|
|
23
|
+
"surfaceTertiary": {
|
|
24
|
+
"light": "#EEEEEE",
|
|
25
|
+
"dark": "#383838",
|
|
26
|
+
"highContrast": "#141414"
|
|
27
|
+
},
|
|
28
|
+
"textPrimary": {
|
|
29
|
+
"light": "#000000",
|
|
30
|
+
"dark": "#FFFFFF",
|
|
31
|
+
"highContrast": "#FFFFFF"
|
|
32
|
+
},
|
|
33
|
+
"textSecondary": {
|
|
34
|
+
"light": "#595959",
|
|
35
|
+
"dark": "#C9C9C9",
|
|
36
|
+
"highContrast": "#E0E0E0"
|
|
37
|
+
},
|
|
38
|
+
"textTertiary": {
|
|
39
|
+
"light": "#595959",
|
|
40
|
+
"dark": "#C9C9C9",
|
|
41
|
+
"highContrast": "#E0E0E0"
|
|
42
|
+
},
|
|
43
|
+
"textOnAccent": {
|
|
44
|
+
"light": "#FFFFFF",
|
|
45
|
+
"dark": "#000000",
|
|
46
|
+
"highContrast": "#000000"
|
|
47
|
+
},
|
|
48
|
+
"accentPrimary": {
|
|
49
|
+
"light": "#000000",
|
|
50
|
+
"dark": "#FFFFFF",
|
|
51
|
+
"highContrast": "#FFFFFF"
|
|
52
|
+
},
|
|
53
|
+
"accentSecondary": {
|
|
54
|
+
"light": "#000000",
|
|
55
|
+
"dark": "#FFFFFF",
|
|
56
|
+
"highContrast": "#FFFFFF"
|
|
57
|
+
},
|
|
58
|
+
"accentSurface": {
|
|
59
|
+
"light": "#EEEEEE",
|
|
60
|
+
"dark": "#383838",
|
|
61
|
+
"highContrast": "#1C1C1C"
|
|
62
|
+
},
|
|
63
|
+
"success": {
|
|
64
|
+
"light": "#146C43",
|
|
65
|
+
"dark": "#7ADBA2",
|
|
66
|
+
"highContrast": "#3FB950"
|
|
67
|
+
},
|
|
68
|
+
"successSurface": {
|
|
69
|
+
"light": "#DFF2E6",
|
|
70
|
+
"dark": "#15281E",
|
|
71
|
+
"highContrast": "#FFFFFF"
|
|
72
|
+
},
|
|
73
|
+
"warning": {
|
|
74
|
+
"light": "#8D5400",
|
|
75
|
+
"dark": "#E9B75E",
|
|
76
|
+
"highContrast": "#D29922"
|
|
77
|
+
},
|
|
78
|
+
"warningSurface": {
|
|
79
|
+
"light": "#F6EBD8",
|
|
80
|
+
"dark": "#2B2213",
|
|
81
|
+
"highContrast": "#FFFFFF"
|
|
82
|
+
},
|
|
83
|
+
"danger": {
|
|
84
|
+
"light": "#DF3131",
|
|
85
|
+
"dark": "#F05252",
|
|
86
|
+
"highContrast": "#FF8A8A"
|
|
87
|
+
},
|
|
88
|
+
"dangerSurface": {
|
|
89
|
+
"light": "#FCECEC",
|
|
90
|
+
"dark": "#3A1D1D",
|
|
91
|
+
"highContrast": "#2A0F0F"
|
|
92
|
+
},
|
|
93
|
+
"border": {
|
|
94
|
+
"light": "#EEEEEE",
|
|
95
|
+
"dark": "#383838",
|
|
96
|
+
"highContrast": "#FFFFFF"
|
|
97
|
+
},
|
|
98
|
+
"onMedia": {
|
|
99
|
+
"light": "#FFFFFF",
|
|
100
|
+
"dark": "#FFFFFF",
|
|
101
|
+
"highContrast": "#FFFFFF"
|
|
102
|
+
},
|
|
103
|
+
"staticBlack": {
|
|
104
|
+
"light": "#000000",
|
|
105
|
+
"dark": "#000000",
|
|
106
|
+
"highContrast": "#000000"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"spacing": {
|
|
110
|
+
"xs": 4,
|
|
111
|
+
"sm": 8,
|
|
112
|
+
"md": 12,
|
|
113
|
+
"lg": 16,
|
|
114
|
+
"xl": 24
|
|
115
|
+
},
|
|
116
|
+
"typography": {
|
|
117
|
+
"title1": {
|
|
118
|
+
"size": 28,
|
|
119
|
+
"weight": 400,
|
|
120
|
+
"line": 1.25,
|
|
121
|
+
"letterSpacing": 1.0,
|
|
122
|
+
"family": "Georgia"
|
|
123
|
+
},
|
|
124
|
+
"title2": {
|
|
125
|
+
"size": 22,
|
|
126
|
+
"weight": 500,
|
|
127
|
+
"line": 1.3,
|
|
128
|
+
"letterSpacing": 1.0,
|
|
129
|
+
"family": "Georgia"
|
|
130
|
+
},
|
|
131
|
+
"title3": {
|
|
132
|
+
"size": 18,
|
|
133
|
+
"weight": 500,
|
|
134
|
+
"line": 1.3,
|
|
135
|
+
"letterSpacing": 1.6,
|
|
136
|
+
"family": "Georgia"
|
|
137
|
+
},
|
|
138
|
+
"body": {
|
|
139
|
+
"size": 16,
|
|
140
|
+
"weight": 400,
|
|
141
|
+
"line": 1.5,
|
|
142
|
+
"letterSpacing": 0.15,
|
|
143
|
+
"family": "Georgia"
|
|
144
|
+
},
|
|
145
|
+
"bodyEmphasis": {
|
|
146
|
+
"size": 16,
|
|
147
|
+
"weight": 500,
|
|
148
|
+
"line": 1.5,
|
|
149
|
+
"letterSpacing": 0.15,
|
|
150
|
+
"family": "Georgia"
|
|
151
|
+
},
|
|
152
|
+
"footnote": {
|
|
153
|
+
"size": 14,
|
|
154
|
+
"weight": 500,
|
|
155
|
+
"line": 1.4,
|
|
156
|
+
"letterSpacing": 0,
|
|
157
|
+
"family": "Georgia"
|
|
158
|
+
},
|
|
159
|
+
"footnoteRegular": {
|
|
160
|
+
"size": 14,
|
|
161
|
+
"weight": 400,
|
|
162
|
+
"line": 1.4,
|
|
163
|
+
"letterSpacing": 0,
|
|
164
|
+
"family": "Georgia"
|
|
165
|
+
},
|
|
166
|
+
"caption": {
|
|
167
|
+
"size": 12,
|
|
168
|
+
"weight": 500,
|
|
169
|
+
"line": 1.35,
|
|
170
|
+
"letterSpacing": 1.4,
|
|
171
|
+
"family": "Georgia"
|
|
172
|
+
},
|
|
173
|
+
"fieldError": {
|
|
174
|
+
"size": 12,
|
|
175
|
+
"weight": 500,
|
|
176
|
+
"line": 1.35,
|
|
177
|
+
"letterSpacing": 0,
|
|
178
|
+
"family": "Georgia"
|
|
179
|
+
},
|
|
180
|
+
"display": {
|
|
181
|
+
"size": 36,
|
|
182
|
+
"weight": 300,
|
|
183
|
+
"line": 1.15,
|
|
184
|
+
"letterSpacing": 0.5,
|
|
185
|
+
"family": "Georgia"
|
|
186
|
+
},
|
|
187
|
+
"heroTitle": {
|
|
188
|
+
"size": 32,
|
|
189
|
+
"weight": 300,
|
|
190
|
+
"line": 1.22,
|
|
191
|
+
"letterSpacing": 0.5,
|
|
192
|
+
"family": "Georgia"
|
|
193
|
+
},
|
|
194
|
+
"logoWordmark": {
|
|
195
|
+
"size": 132,
|
|
196
|
+
"weight": 500,
|
|
197
|
+
"line": 1.0,
|
|
198
|
+
"letterSpacing": 12,
|
|
199
|
+
"family": "Georgia"
|
|
200
|
+
},
|
|
201
|
+
"pageTitle": {
|
|
202
|
+
"size": 28,
|
|
203
|
+
"weight": 400,
|
|
204
|
+
"line": 1.25,
|
|
205
|
+
"letterSpacing": 0,
|
|
206
|
+
"family": "Georgia"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"radius": {
|
|
210
|
+
"sm": 0,
|
|
211
|
+
"md": 0,
|
|
212
|
+
"lg": 0,
|
|
213
|
+
"pill": 0
|
|
214
|
+
},
|
|
215
|
+
"kit": {
|
|
216
|
+
"material": "flat",
|
|
217
|
+
"variant": "default",
|
|
218
|
+
"density": "spacious",
|
|
219
|
+
"motion": "smooth"
|
|
220
|
+
},
|
|
221
|
+
"shadows": {
|
|
222
|
+
"sm": {
|
|
223
|
+
"color": "#000000",
|
|
224
|
+
"opacity": 0.08,
|
|
225
|
+
"radius": 6,
|
|
226
|
+
"x": 0,
|
|
227
|
+
"y": 2
|
|
228
|
+
},
|
|
229
|
+
"md": {
|
|
230
|
+
"color": "#000000",
|
|
231
|
+
"opacity": 0.12,
|
|
232
|
+
"radius": 16,
|
|
233
|
+
"x": 0,
|
|
234
|
+
"y": 6
|
|
235
|
+
},
|
|
236
|
+
"lg": {
|
|
237
|
+
"color": "#000000",
|
|
238
|
+
"opacity": 0.16,
|
|
239
|
+
"radius": 28,
|
|
240
|
+
"x": 0,
|
|
241
|
+
"y": 12
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"gradients": {
|
|
245
|
+
"brand": {
|
|
246
|
+
"colors": [
|
|
247
|
+
"accentPrimary",
|
|
248
|
+
"accentSecondary"
|
|
249
|
+
],
|
|
250
|
+
"angle": 135
|
|
251
|
+
},
|
|
252
|
+
"subtle": {
|
|
253
|
+
"colors": [
|
|
254
|
+
"surfaceSecondary",
|
|
255
|
+
"surfacePrimary"
|
|
256
|
+
],
|
|
257
|
+
"angle": 180
|
|
258
|
+
},
|
|
259
|
+
"hero": {
|
|
260
|
+
"colors": [
|
|
261
|
+
"accentSurface",
|
|
262
|
+
"surfacePrimary"
|
|
263
|
+
],
|
|
264
|
+
"angle": 160
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"materials": {
|
|
268
|
+
"flat": {
|
|
269
|
+
"style": "flat",
|
|
270
|
+
"tint": "surfaceSecondary",
|
|
271
|
+
"opacity": 1
|
|
272
|
+
},
|
|
273
|
+
"glass": {
|
|
274
|
+
"style": "glass",
|
|
275
|
+
"tint": "surfaceSecondary",
|
|
276
|
+
"opacity": 0.6,
|
|
277
|
+
"blur": 20
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
"motions": {
|
|
281
|
+
"smooth": {
|
|
282
|
+
"duration": 250,
|
|
283
|
+
"easing": "easeInOut"
|
|
284
|
+
},
|
|
285
|
+
"bouncy": {
|
|
286
|
+
"duration": 420,
|
|
287
|
+
"easing": "spring"
|
|
288
|
+
},
|
|
289
|
+
"quick": {
|
|
290
|
+
"duration": 140,
|
|
291
|
+
"easing": "easeOut"
|
|
292
|
+
},
|
|
293
|
+
"appearSoft": {
|
|
294
|
+
"duration": 500,
|
|
295
|
+
"easing": "easeOut"
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
"tabBar": {
|
|
299
|
+
"background": {
|
|
300
|
+
"material": "glass"
|
|
301
|
+
},
|
|
302
|
+
"shape": {
|
|
303
|
+
"kind": "full",
|
|
304
|
+
"inset": 0,
|
|
305
|
+
"cornerRadius": 0
|
|
306
|
+
},
|
|
307
|
+
"selectedIndicator": {
|
|
308
|
+
"kind": "none",
|
|
309
|
+
"color": "accentPrimary"
|
|
310
|
+
},
|
|
311
|
+
"activeTint": "accentPrimary",
|
|
312
|
+
"inactiveTint": "textSecondary",
|
|
313
|
+
"labels": {
|
|
314
|
+
"show": false,
|
|
315
|
+
"typography": "caption"
|
|
316
|
+
},
|
|
317
|
+
"iconSize": 22,
|
|
318
|
+
"motion": "smooth",
|
|
319
|
+
"border": {
|
|
320
|
+
"topHairline": true,
|
|
321
|
+
"color": "border"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"drawer": {
|
|
325
|
+
"background": {
|
|
326
|
+
"color": "surfaceSecondary"
|
|
327
|
+
},
|
|
328
|
+
"width": 300,
|
|
329
|
+
"activeTint": "accentPrimary",
|
|
330
|
+
"inactiveTint": "textSecondary",
|
|
331
|
+
"selectedIndicator": {
|
|
332
|
+
"kind": "pill",
|
|
333
|
+
"color": "accentPrimary"
|
|
334
|
+
},
|
|
335
|
+
"labels": {
|
|
336
|
+
"show": true,
|
|
337
|
+
"typography": "body"
|
|
338
|
+
},
|
|
339
|
+
"iconSize": 22,
|
|
340
|
+
"edgeInsets": 12,
|
|
341
|
+
"motion": "smooth"
|
|
342
|
+
},
|
|
343
|
+
"contentMaxWidth": {
|
|
344
|
+
"base": 480,
|
|
345
|
+
"medium": 600,
|
|
346
|
+
"expanded": 760
|
|
347
|
+
}
|
|
348
|
+
}
|
|
@@ -5,6 +5,10 @@ export interface CollectionQuery {
|
|
|
5
5
|
filter: string;
|
|
6
6
|
sort: 'default' | 'az' | 'za';
|
|
7
7
|
savedIds: string[];
|
|
8
|
+
/** What the list is limited to beyond the controls above (a domain's own selection, e.g. the events of some categories), as one
|
|
9
|
+
* canonical string. Part of the criteria, so a list opened on another selection never shows or restores this one's rows. Absent
|
|
10
|
+
* when there is none: criteria without it keep the key they always had. */
|
|
11
|
+
scope?: string;
|
|
8
12
|
}
|
|
9
13
|
export interface CollectionPage<Row> {
|
|
10
14
|
items: Row[];
|
|
@@ -39,11 +43,15 @@ export interface CollectionQuerySource<Row> {
|
|
|
39
43
|
* key carries the account, and a purge tears parked workers down). */
|
|
40
44
|
clearOnError?(error: unknown): boolean;
|
|
41
45
|
}
|
|
46
|
+
/** A scope is read back by its domain, so it is never cut: this exceeds the largest selection the events list encodes (100 ids of 64 characters, about 6.9k). */
|
|
47
|
+
const SCOPE_MAX = 8192;
|
|
42
48
|
const normalize = (q: Partial<CollectionQuery>): CollectionQuery => ({
|
|
43
49
|
query: typeof q.query === 'string' ? q.query.trim().slice(0, 256) : '',
|
|
44
50
|
filter: typeof q.filter === 'string' ? q.filter.slice(0, 256) : 'all',
|
|
45
51
|
sort: q.sort === 'az' || q.sort === 'za' ? q.sort : 'default',
|
|
46
52
|
savedIds: Array.isArray(q.savedIds) ? [...new Set(q.savedIds.filter(id => typeof id === 'string' && id.length > 0 && id.length <= 256))].slice(0, 500) : [],
|
|
53
|
+
|
|
54
|
+
...(typeof q.scope === 'string' && q.scope ? { scope: q.scope.slice(0, SCOPE_MAX) } : {}),
|
|
47
55
|
});
|
|
48
56
|
const copyQuery = (q: CollectionQuery): CollectionQuery => ({ ...q, savedIds: [...q.savedIds] });
|
|
49
57
|
|
|
@@ -23,6 +23,8 @@ interface BackendCollection {
|
|
|
23
23
|
/** Sees the load action's argument (the screen's onAppear params) BEFORE the query runs. A returned
|
|
24
24
|
* `{ filter, sort }` resets the criteria for that load (a screen that always opens on one view). */
|
|
25
25
|
onLoad?(arg: unknown): CollectionCriteriaReset | void;
|
|
26
|
+
/** The collection's own selection as part of every query's criteria (see `CollectionQuery.scope`); "" for none. */
|
|
27
|
+
scope?(): string;
|
|
26
28
|
controller: ReturnType<typeof createCollectionQuery<CollectionRow>>;
|
|
27
29
|
apply(state: State, page: CollectionQueryState<CollectionRow>): State;
|
|
28
30
|
}
|
|
@@ -284,7 +286,7 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
284
286
|
// A screen with no search field clears a query an older screen persisted, or it narrows every view for good.
|
|
285
287
|
if (typeof input.query === 'string') prefs.query = input.query.slice(0, 256);
|
|
286
288
|
};
|
|
287
|
-
const criteria = () => ({ query: prefs.query, sort: prefs.sort, filter: prefs.filter, savedIds: prefs.filter === 'saved' ? prefs.savedIds : [] });
|
|
289
|
+
const criteria = () => ({ query: prefs.query, sort: prefs.sort, filter: prefs.filter, savedIds: prefs.filter === 'saved' ? prefs.savedIds : [], ...(backend?.scope ? { scope: backend.scope() } : {}) });
|
|
288
290
|
const criteriaKey = () => JSON.stringify(criteria());
|
|
289
291
|
actions.collectionDismissFilters = change(() => { filtersPresented = false; });
|
|
290
292
|
actions.collectionFilters = change(() => { filtersPresented = !filtersPresented; });
|
|
@@ -365,6 +367,9 @@ export function defineBackendCollection<S extends object, Row extends object>(na
|
|
|
365
367
|
/** The load action's argument (onAppear params beyond `copy`), before the query runs — for a
|
|
366
368
|
* domain setting that rides the descriptor, e.g. My Bookings' `weeklyGoal`. */
|
|
367
369
|
onLoad?(arg: unknown): CollectionCriteriaReset | void;
|
|
370
|
+
/** A selection the list is limited to, as one canonical string ("" for none): it joins the criteria, so another selection is another
|
|
371
|
+
* result set (no stale rows behind a revalidation, no restore of another selection's pages) and `source` reads it off `criteria.scope`. */
|
|
372
|
+
scope?(): string;
|
|
368
373
|
state: S;
|
|
369
374
|
source: CollectionQuerySource<Row>;
|
|
370
375
|
apply(state: S, page: CollectionQueryState<Row>): S;
|
|
@@ -380,6 +385,7 @@ export function defineBackendCollection<S extends object, Row extends object>(na
|
|
|
380
385
|
const definition = decorateCollection(name, { state: options.state as State, actions: options.actions as Record<string, Reducer> | undefined }, options.saving, {
|
|
381
386
|
restorePagesOnLoad: options.restorePagesOnLoad,
|
|
382
387
|
onLoad: avatar ? arg => { avatar.onLoad(arg); return options.onLoad?.(arg); } : options.onLoad,
|
|
388
|
+
scope: options.scope,
|
|
383
389
|
controller: controller as unknown as BackendCollection['controller'],
|
|
384
390
|
apply: (state, page) => {
|
|
385
391
|
const applied = options.apply(state as S, page as unknown as CollectionQueryState<Row>) as State;
|
|
@@ -5,6 +5,10 @@ export interface CollectionQuery {
|
|
|
5
5
|
filter: string;
|
|
6
6
|
sort: 'default' | 'az' | 'za';
|
|
7
7
|
savedIds: string[];
|
|
8
|
+
/** What the list is limited to beyond the controls above (a domain's own selection, e.g. the events of some categories), as one
|
|
9
|
+
* canonical string. Part of the criteria, so a list opened on another selection never shows or restores this one's rows. Absent
|
|
10
|
+
* when there is none: criteria without it keep the key they always had. */
|
|
11
|
+
scope?: string;
|
|
8
12
|
}
|
|
9
13
|
export interface CollectionPage<Row> {
|
|
10
14
|
items: Row[];
|
|
@@ -39,11 +43,15 @@ export interface CollectionQuerySource<Row> {
|
|
|
39
43
|
* key carries the account, and a purge tears parked workers down). */
|
|
40
44
|
clearOnError?(error: unknown): boolean;
|
|
41
45
|
}
|
|
46
|
+
/** A scope is read back by its domain, so it is never cut: this exceeds the largest selection the events list encodes (100 ids of 64 characters, about 6.9k). */
|
|
47
|
+
const SCOPE_MAX = 8192;
|
|
42
48
|
const normalize = (q: Partial<CollectionQuery>): CollectionQuery => ({
|
|
43
49
|
query: typeof q.query === 'string' ? q.query.trim().slice(0, 256) : '',
|
|
44
50
|
filter: typeof q.filter === 'string' ? q.filter.slice(0, 256) : 'all',
|
|
45
51
|
sort: q.sort === 'az' || q.sort === 'za' ? q.sort : 'default',
|
|
46
52
|
savedIds: Array.isArray(q.savedIds) ? [...new Set(q.savedIds.filter(id => typeof id === 'string' && id.length > 0 && id.length <= 256))].slice(0, 500) : [],
|
|
53
|
+
|
|
54
|
+
...(typeof q.scope === 'string' && q.scope ? { scope: q.scope.slice(0, SCOPE_MAX) } : {}),
|
|
47
55
|
});
|
|
48
56
|
const copyQuery = (q: CollectionQuery): CollectionQuery => ({ ...q, savedIds: [...q.savedIds] });
|
|
49
57
|
|
|
@@ -23,6 +23,8 @@ interface BackendCollection {
|
|
|
23
23
|
/** Sees the load action's argument (the screen's onAppear params) BEFORE the query runs. A returned
|
|
24
24
|
* `{ filter, sort }` resets the criteria for that load (a screen that always opens on one view). */
|
|
25
25
|
onLoad?(arg: unknown): CollectionCriteriaReset | void;
|
|
26
|
+
/** The collection's own selection as part of every query's criteria (see `CollectionQuery.scope`); "" for none. */
|
|
27
|
+
scope?(): string;
|
|
26
28
|
controller: ReturnType<typeof createCollectionQuery<CollectionRow>>;
|
|
27
29
|
apply(state: State, page: CollectionQueryState<CollectionRow>): State;
|
|
28
30
|
}
|
|
@@ -284,7 +286,7 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
284
286
|
// A screen with no search field clears a query an older screen persisted, or it narrows every view for good.
|
|
285
287
|
if (typeof input.query === 'string') prefs.query = input.query.slice(0, 256);
|
|
286
288
|
};
|
|
287
|
-
const criteria = () => ({ query: prefs.query, sort: prefs.sort, filter: prefs.filter, savedIds: prefs.filter === 'saved' ? prefs.savedIds : [] });
|
|
289
|
+
const criteria = () => ({ query: prefs.query, sort: prefs.sort, filter: prefs.filter, savedIds: prefs.filter === 'saved' ? prefs.savedIds : [], ...(backend?.scope ? { scope: backend.scope() } : {}) });
|
|
288
290
|
const criteriaKey = () => JSON.stringify(criteria());
|
|
289
291
|
actions.collectionDismissFilters = change(() => { filtersPresented = false; });
|
|
290
292
|
actions.collectionFilters = change(() => { filtersPresented = !filtersPresented; });
|
|
@@ -365,6 +367,9 @@ export function defineBackendCollection<S extends object, Row extends object>(na
|
|
|
365
367
|
/** The load action's argument (onAppear params beyond `copy`), before the query runs — for a
|
|
366
368
|
* domain setting that rides the descriptor, e.g. My Bookings' `weeklyGoal`. */
|
|
367
369
|
onLoad?(arg: unknown): CollectionCriteriaReset | void;
|
|
370
|
+
/** A selection the list is limited to, as one canonical string ("" for none): it joins the criteria, so another selection is another
|
|
371
|
+
* result set (no stale rows behind a revalidation, no restore of another selection's pages) and `source` reads it off `criteria.scope`. */
|
|
372
|
+
scope?(): string;
|
|
368
373
|
state: S;
|
|
369
374
|
source: CollectionQuerySource<Row>;
|
|
370
375
|
apply(state: S, page: CollectionQueryState<Row>): S;
|
|
@@ -380,6 +385,7 @@ export function defineBackendCollection<S extends object, Row extends object>(na
|
|
|
380
385
|
const definition = decorateCollection(name, { state: options.state as State, actions: options.actions as Record<string, Reducer> | undefined }, options.saving, {
|
|
381
386
|
restorePagesOnLoad: options.restorePagesOnLoad,
|
|
382
387
|
onLoad: avatar ? arg => { avatar.onLoad(arg); return options.onLoad?.(arg); } : options.onLoad,
|
|
388
|
+
scope: options.scope,
|
|
383
389
|
controller: controller as unknown as BackendCollection['controller'],
|
|
384
390
|
apply: (state, page) => {
|
|
385
391
|
const applied = options.apply(state as S, page as unknown as CollectionQueryState<Row>) as State;
|