@wix/himalaya-cli 0.1024.0 → 0.1026.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/ts/src/schema.d.ts +12 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +6 -0
- package/dist/cli.mjs +29 -18
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/sdk-reference.json +1 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +1031 -240
- package/templates/beauty-salon/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/beauty-salon/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/beauty-salon/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/beauty-salon/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/beauty-salon/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/beauty-salon/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/branded-lite/config.ts +3 -1
- package/templates/branded-lite/dev/index.ts +3455 -813
- package/templates/branded-lite/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio-project/index.ts +7 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-simple-detail/index.ts +4 -3
- package/templates/branded-lite/tier5-src/wix-spaces-chat-thread/index.ts +17 -4
- package/templates/branded-lite/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/branded-lite/tier5-src/wix-spaces-coupon-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/branded-lite/tier5-src/wix-spaces-food-order-detail/index.ts +6 -3
- package/templates/branded-lite/tier5-src/wix-spaces-form-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-forum-post/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-invoice-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-member-detail/index.ts +8 -8
- package/templates/branded-lite/tier5-src/wix-spaces-photo-albums/index.ts +8 -2
- package/templates/branded-lite/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/branded-lite/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/community-club/dev/index.ts +345 -97
- package/templates/community-club/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/community-club/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/events-meetups/dev/index.ts +345 -97
- package/templates/events-meetups/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/events-meetups/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/gym-fitness/dev/index.ts +1031 -240
- package/templates/gym-fitness/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/gym-fitness/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/gym-fitness/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/gym-fitness/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/gym-fitness/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/gym-fitness/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/nonprofit-cause/dev/index.ts +732 -188
- package/templates/nonprofit-cause/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/nonprofit-cause/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/nonprofit-cause/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/nonprofit-cause/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/nonprofit-cause/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/podcast-creator/dev/index.ts +942 -321
- package/templates/podcast-creator/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-simple-detail/index.ts +4 -3
- package/templates/podcast-creator/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/podcast-creator/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/podcast-creator/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/podcast-creator/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/portfolio-creative/dev/index.ts +676 -169
- package/templates/portfolio-creative/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio-project/index.ts +7 -2
- package/templates/portfolio-creative/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/portfolio-creative/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/portfolio-creative/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/restaurant/dev/index.ts +529 -149
- package/templates/restaurant/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/restaurant/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/restaurant/tier5-src/wix-spaces-food-order-detail/index.ts +6 -3
- package/templates/restaurant/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/retail-store/dev/index.ts +643 -148
- package/templates/retail-store/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/retail-store/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/retail-store/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/retail-store/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/yoga-studio/dev/index.ts +711 -183
- package/templates/yoga-studio/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/yoga-studio/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/yoga-studio/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/yoga-studio/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/yoga-studio/tier5-src/wix-spaces-view-profile/index.ts +22 -12
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
// paint the seeded "apptestercoowner" demo identity when the session is a real
|
|
4
4
|
// member (or a guest — show honesty instead).
|
|
5
5
|
import { defineService } from "@himalaya/state";
|
|
6
|
-
import {
|
|
6
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
7
7
|
import { getMyData, displayName } from "@himalaya/wix-users";
|
|
8
8
|
|
|
9
|
-
|
|
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 }
|
|
10
15
|
|
|
11
16
|
const EMPTY: S = {
|
|
12
17
|
status: "loading",
|
|
@@ -15,18 +20,17 @@ const EMPTY: S = {
|
|
|
15
20
|
about: "No info to display.",
|
|
16
21
|
initial: "?",
|
|
17
22
|
photo: "",
|
|
23
|
+
needsSignIn: false,
|
|
24
|
+
noSignIn: true,
|
|
25
|
+
profileHidden: true,
|
|
26
|
+
hideLoading: false,
|
|
18
27
|
};
|
|
19
28
|
|
|
29
|
+
// The SAME member check create-post and orders use (`memberAccess`: the host's
|
|
30
|
+
// memberIdentity, falling back to wix-users only on hosts that predate that action), so
|
|
31
|
+
// one shared gate never gives two answers in one app.
|
|
20
32
|
async function sessionEmail(): Promise<string> {
|
|
21
|
-
|
|
22
|
-
const identity = await dispatch("himi.wix.memberIdentity") as unknown;
|
|
23
|
-
const direct = identity as { email?: unknown } | null;
|
|
24
|
-
const wrapped = identity as { payload?: { email?: unknown } } | null;
|
|
25
|
-
const email = direct?.email ?? wrapped?.payload?.email;
|
|
26
|
-
return typeof email === "string" ? email.trim() : "";
|
|
27
|
-
} catch {
|
|
28
|
-
return "";
|
|
29
|
-
}
|
|
33
|
+
return (await memberAccess()).email;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
function wixApi() {
|
|
@@ -37,7 +41,7 @@ function fromParts(name: string, handleRaw: string, about: string, photo = ""):
|
|
|
37
41
|
const clean = name.trim();
|
|
38
42
|
const handle = "@" + (handleRaw || clean || "member").replace(/\s+/g, "").replace(/^@+/, "").toLowerCase();
|
|
39
43
|
const initial = (clean.split(/\s+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2) || "?").toUpperCase();
|
|
40
|
-
return { status: "ready", name: clean || "Member", handle, about: about || "No info to display.", initial, photo };
|
|
44
|
+
return { status: "ready", name: clean || "Member", handle, about: about || "No info to display.", initial, photo, needsSignIn: false, noSignIn: true, profileHidden: false, hideLoading: true };
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesViewProfile", {
|
|
@@ -48,11 +52,17 @@ const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesViewProfile"
|
|
|
48
52
|
if (!email) {
|
|
49
53
|
return {
|
|
50
54
|
status: "ready",
|
|
55
|
+
// Kept for hosts without the shared member gate (the Spaces clone renders these
|
|
56
|
+
// fields directly); branded-lite hides the profile block behind `profileHidden`.
|
|
51
57
|
name: "Sign in to view your profile",
|
|
52
58
|
handle: "",
|
|
53
59
|
about: "Your public profile is available after you sign in from Account.",
|
|
54
60
|
initial: "?",
|
|
55
61
|
photo: "",
|
|
62
|
+
needsSignIn: true,
|
|
63
|
+
noSignIn: false,
|
|
64
|
+
profileHidden: true,
|
|
65
|
+
hideLoading: true,
|
|
56
66
|
};
|
|
57
67
|
}
|
|
58
68
|
try {
|
|
@@ -14,7 +14,7 @@ const SCREENS = runtimeSetting({
|
|
|
14
14
|
"himi_branded_home": {
|
|
15
15
|
"screenId": "himi_branded_home",
|
|
16
16
|
"renderer": "sdui_intent",
|
|
17
|
-
"title": "",
|
|
17
|
+
"title": "__HIMI_APP_NAME__",
|
|
18
18
|
"schemaVersion": 1,
|
|
19
19
|
"cacheControl": {
|
|
20
20
|
"maxAge": 0,
|
|
@@ -4177,74 +4177,196 @@ const SCREENS = runtimeSetting({
|
|
|
4177
4177
|
"alignment": "center",
|
|
4178
4178
|
"children": [
|
|
4179
4179
|
{
|
|
4180
|
-
"id": "himi_view_profile.
|
|
4180
|
+
"id": "himi_view_profile.loading",
|
|
4181
4181
|
"body": {
|
|
4182
4182
|
"package": "himalaya",
|
|
4183
|
-
"type": "
|
|
4183
|
+
"type": "Text",
|
|
4184
4184
|
"props": {
|
|
4185
|
+
"text": "Loading…",
|
|
4186
|
+
"style": "body",
|
|
4187
|
+
"color": "textSecondary"
|
|
4188
|
+
}
|
|
4189
|
+
},
|
|
4190
|
+
"modifiers": {
|
|
4191
|
+
"hiddenPath": "$service:spacesViewProfile.hideLoading"
|
|
4192
|
+
}
|
|
4193
|
+
},
|
|
4194
|
+
{
|
|
4195
|
+
"id": "",
|
|
4196
|
+
"body": {
|
|
4197
|
+
"package": "himalaya",
|
|
4198
|
+
"type": "VStack",
|
|
4199
|
+
"props": {
|
|
4200
|
+
"spacing": 8,
|
|
4185
4201
|
"alignment": "center",
|
|
4186
4202
|
"children": [
|
|
4187
4203
|
{
|
|
4188
|
-
"id": "",
|
|
4204
|
+
"id": "himi_view_profile.avatar",
|
|
4189
4205
|
"body": {
|
|
4190
4206
|
"package": "himalaya",
|
|
4191
|
-
"type": "
|
|
4207
|
+
"type": "ZStack",
|
|
4192
4208
|
"props": {
|
|
4193
|
-
"
|
|
4194
|
-
"
|
|
4195
|
-
|
|
4209
|
+
"alignment": "center",
|
|
4210
|
+
"children": [
|
|
4211
|
+
{
|
|
4212
|
+
"id": "",
|
|
4213
|
+
"body": {
|
|
4214
|
+
"package": "himalaya",
|
|
4215
|
+
"type": "Icon",
|
|
4216
|
+
"props": {
|
|
4217
|
+
"name": "photo",
|
|
4218
|
+
"size": 28,
|
|
4219
|
+
"tint": "accentPrimary"
|
|
4220
|
+
}
|
|
4221
|
+
},
|
|
4222
|
+
"modifiers": {
|
|
4223
|
+
"accessibilityRole": "decorative"
|
|
4224
|
+
}
|
|
4225
|
+
}
|
|
4226
|
+
]
|
|
4196
4227
|
}
|
|
4197
4228
|
},
|
|
4198
4229
|
"modifiers": {
|
|
4199
|
-
"
|
|
4230
|
+
"width": 96,
|
|
4231
|
+
"height": 96,
|
|
4232
|
+
"background": {
|
|
4233
|
+
"token": "accentSurface"
|
|
4234
|
+
},
|
|
4235
|
+
"cornerRadius": 16
|
|
4236
|
+
}
|
|
4237
|
+
},
|
|
4238
|
+
{
|
|
4239
|
+
"id": "himi_view_profile.name",
|
|
4240
|
+
"body": {
|
|
4241
|
+
"package": "himalaya",
|
|
4242
|
+
"type": "Text",
|
|
4243
|
+
"props": {
|
|
4244
|
+
"text": "$service:spacesViewProfile.name",
|
|
4245
|
+
"style": "title1"
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
4248
|
+
},
|
|
4249
|
+
{
|
|
4250
|
+
"id": "",
|
|
4251
|
+
"body": {
|
|
4252
|
+
"package": "himalaya",
|
|
4253
|
+
"type": "Text",
|
|
4254
|
+
"props": {
|
|
4255
|
+
"text": "$service:spacesViewProfile.handle",
|
|
4256
|
+
"style": "footnote",
|
|
4257
|
+
"color": "textSecondary",
|
|
4258
|
+
"collapseWhenEmpty": true
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
},
|
|
4262
|
+
{
|
|
4263
|
+
"id": "",
|
|
4264
|
+
"body": {
|
|
4265
|
+
"package": "himalaya",
|
|
4266
|
+
"type": "Text",
|
|
4267
|
+
"props": {
|
|
4268
|
+
"text": "$service:spacesViewProfile.about",
|
|
4269
|
+
"style": "body",
|
|
4270
|
+
"collapseWhenEmpty": true
|
|
4271
|
+
}
|
|
4200
4272
|
}
|
|
4201
4273
|
}
|
|
4202
4274
|
]
|
|
4203
4275
|
}
|
|
4204
4276
|
},
|
|
4205
4277
|
"modifiers": {
|
|
4206
|
-
"
|
|
4207
|
-
"height": 96,
|
|
4208
|
-
"background": {
|
|
4209
|
-
"token": "accentSurface"
|
|
4210
|
-
},
|
|
4211
|
-
"cornerRadius": 16
|
|
4212
|
-
}
|
|
4213
|
-
},
|
|
4214
|
-
{
|
|
4215
|
-
"id": "himi_view_profile.name",
|
|
4216
|
-
"body": {
|
|
4217
|
-
"package": "himalaya",
|
|
4218
|
-
"type": "Text",
|
|
4219
|
-
"props": {
|
|
4220
|
-
"text": "$service:spacesViewProfile.name",
|
|
4221
|
-
"style": "title1"
|
|
4222
|
-
}
|
|
4278
|
+
"hiddenPath": "$service:spacesViewProfile.profileHidden"
|
|
4223
4279
|
}
|
|
4224
4280
|
},
|
|
4225
4281
|
{
|
|
4226
|
-
"id": "",
|
|
4282
|
+
"id": "himi_view_profile.member_gate",
|
|
4227
4283
|
"body": {
|
|
4228
4284
|
"package": "himalaya",
|
|
4229
|
-
"type": "
|
|
4230
|
-
"props": {
|
|
4231
|
-
"text": "$service:spacesViewProfile.handle",
|
|
4232
|
-
"style": "footnote",
|
|
4233
|
-
"color": "textSecondary",
|
|
4234
|
-
"collapseWhenEmpty": true
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4237
|
-
},
|
|
4238
|
-
{
|
|
4239
|
-
"id": "",
|
|
4240
|
-
"body": {
|
|
4241
|
-
"package": "himalaya",
|
|
4242
|
-
"type": "Text",
|
|
4285
|
+
"type": "VStack",
|
|
4243
4286
|
"props": {
|
|
4244
|
-
"
|
|
4245
|
-
"
|
|
4246
|
-
"
|
|
4287
|
+
"spacing": 10,
|
|
4288
|
+
"alignment": "center",
|
|
4289
|
+
"children": [
|
|
4290
|
+
{
|
|
4291
|
+
"id": "",
|
|
4292
|
+
"body": {
|
|
4293
|
+
"package": "himalaya",
|
|
4294
|
+
"type": "Icon",
|
|
4295
|
+
"props": {
|
|
4296
|
+
"name": "person",
|
|
4297
|
+
"size": 28,
|
|
4298
|
+
"tint": "accentPrimary"
|
|
4299
|
+
}
|
|
4300
|
+
},
|
|
4301
|
+
"modifiers": {
|
|
4302
|
+
"accessibilityRole": "decorative"
|
|
4303
|
+
}
|
|
4304
|
+
},
|
|
4305
|
+
{
|
|
4306
|
+
"id": "himi_view_profile.member_gate_title",
|
|
4307
|
+
"body": {
|
|
4308
|
+
"package": "himalaya",
|
|
4309
|
+
"type": "Text",
|
|
4310
|
+
"props": {
|
|
4311
|
+
"text": "Sign in to view your profile",
|
|
4312
|
+
"style": "bodyEmphasis"
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
},
|
|
4316
|
+
{
|
|
4317
|
+
"id": "",
|
|
4318
|
+
"body": {
|
|
4319
|
+
"package": "himalaya",
|
|
4320
|
+
"type": "Text",
|
|
4321
|
+
"props": {
|
|
4322
|
+
"text": "Your public profile appears here after you sign in.",
|
|
4323
|
+
"style": "footnote",
|
|
4324
|
+
"color": "textSecondary"
|
|
4325
|
+
}
|
|
4326
|
+
}
|
|
4327
|
+
},
|
|
4328
|
+
{
|
|
4329
|
+
"id": "himi_view_profile.member_gate_signin",
|
|
4330
|
+
"body": {
|
|
4331
|
+
"package": "himalaya",
|
|
4332
|
+
"type": "Button",
|
|
4333
|
+
"props": {
|
|
4334
|
+
"title": "Sign in",
|
|
4335
|
+
"style": "primary",
|
|
4336
|
+
"fullWidth": true,
|
|
4337
|
+
"action": {
|
|
4338
|
+
"actionId": "himi.open",
|
|
4339
|
+
"params": {
|
|
4340
|
+
"screenId": "himi_account",
|
|
4341
|
+
"intent": "profile",
|
|
4342
|
+
"returnScreenId": "himi_view_profile"
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
]
|
|
4247
4349
|
}
|
|
4350
|
+
},
|
|
4351
|
+
"modifiers": {
|
|
4352
|
+
"background": {
|
|
4353
|
+
"token": "surfaceElevated"
|
|
4354
|
+
},
|
|
4355
|
+
"border": {
|
|
4356
|
+
"width": 1,
|
|
4357
|
+
"color": {
|
|
4358
|
+
"token": "border"
|
|
4359
|
+
}
|
|
4360
|
+
},
|
|
4361
|
+
"cornerRadius": 16,
|
|
4362
|
+
"padding": {
|
|
4363
|
+
"leading": 16,
|
|
4364
|
+
"trailing": 16,
|
|
4365
|
+
"top": 20,
|
|
4366
|
+
"bottom": 20
|
|
4367
|
+
},
|
|
4368
|
+
"fillMaxWidth": true,
|
|
4369
|
+
"hiddenPath": "$service:spacesViewProfile.noSignIn"
|
|
4248
4370
|
}
|
|
4249
4371
|
}
|
|
4250
4372
|
]
|
|
@@ -4866,16 +4988,31 @@ const SCREENS = runtimeSetting({
|
|
|
4866
4988
|
}
|
|
4867
4989
|
},
|
|
4868
4990
|
{
|
|
4869
|
-
"id": "himi_feed.
|
|
4991
|
+
"id": "himi_feed.member_gate",
|
|
4870
4992
|
"body": {
|
|
4871
4993
|
"package": "himalaya",
|
|
4872
4994
|
"type": "VStack",
|
|
4873
4995
|
"props": {
|
|
4874
|
-
"spacing":
|
|
4875
|
-
"alignment": "
|
|
4996
|
+
"spacing": 10,
|
|
4997
|
+
"alignment": "center",
|
|
4876
4998
|
"children": [
|
|
4877
4999
|
{
|
|
4878
5000
|
"id": "",
|
|
5001
|
+
"body": {
|
|
5002
|
+
"package": "himalaya",
|
|
5003
|
+
"type": "Icon",
|
|
5004
|
+
"props": {
|
|
5005
|
+
"name": "person",
|
|
5006
|
+
"size": 28,
|
|
5007
|
+
"tint": "accentPrimary"
|
|
5008
|
+
}
|
|
5009
|
+
},
|
|
5010
|
+
"modifiers": {
|
|
5011
|
+
"accessibilityRole": "decorative"
|
|
5012
|
+
}
|
|
5013
|
+
},
|
|
5014
|
+
{
|
|
5015
|
+
"id": "himi_feed.member_gate_title",
|
|
4879
5016
|
"body": {
|
|
4880
5017
|
"package": "himalaya",
|
|
4881
5018
|
"type": "Text",
|
|
@@ -4898,7 +5035,7 @@ const SCREENS = runtimeSetting({
|
|
|
4898
5035
|
}
|
|
4899
5036
|
},
|
|
4900
5037
|
{
|
|
4901
|
-
"id": "himi_feed.
|
|
5038
|
+
"id": "himi_feed.member_gate_signin",
|
|
4902
5039
|
"body": {
|
|
4903
5040
|
"package": "himalaya",
|
|
4904
5041
|
"type": "Button",
|
|
@@ -4934,9 +5071,10 @@ const SCREENS = runtimeSetting({
|
|
|
4934
5071
|
"padding": {
|
|
4935
5072
|
"leading": 16,
|
|
4936
5073
|
"trailing": 16,
|
|
4937
|
-
"top":
|
|
4938
|
-
"bottom":
|
|
5074
|
+
"top": 20,
|
|
5075
|
+
"bottom": 20
|
|
4939
5076
|
},
|
|
5077
|
+
"fillMaxWidth": true,
|
|
4940
5078
|
"hiddenPath": "$service:himiBrandedFeed.noSignIn"
|
|
4941
5079
|
}
|
|
4942
5080
|
},
|
|
@@ -5438,65 +5576,172 @@ const SCREENS = runtimeSetting({
|
|
|
5438
5576
|
}
|
|
5439
5577
|
},
|
|
5440
5578
|
{
|
|
5441
|
-
"id": "",
|
|
5442
|
-
"body": {
|
|
5443
|
-
"package": "himalaya",
|
|
5444
|
-
"type": "Text",
|
|
5445
|
-
"props": {
|
|
5446
|
-
"text": "$service:spacesCreatePost.hint",
|
|
5447
|
-
"style": "footnote",
|
|
5448
|
-
"color": "textSecondary",
|
|
5449
|
-
"collapseWhenEmpty": true
|
|
5450
|
-
}
|
|
5451
|
-
}
|
|
5452
|
-
},
|
|
5453
|
-
{
|
|
5454
|
-
"id": "himi_create_post.title_field",
|
|
5579
|
+
"id": "himi_create_post.member_gate",
|
|
5455
5580
|
"body": {
|
|
5456
5581
|
"package": "himalaya",
|
|
5457
|
-
"type": "
|
|
5582
|
+
"type": "VStack",
|
|
5458
5583
|
"props": {
|
|
5459
|
-
"
|
|
5460
|
-
"
|
|
5461
|
-
"
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5584
|
+
"spacing": 10,
|
|
5585
|
+
"alignment": "center",
|
|
5586
|
+
"children": [
|
|
5587
|
+
{
|
|
5588
|
+
"id": "",
|
|
5589
|
+
"body": {
|
|
5590
|
+
"package": "himalaya",
|
|
5591
|
+
"type": "Icon",
|
|
5592
|
+
"props": {
|
|
5593
|
+
"name": "person",
|
|
5594
|
+
"size": 28,
|
|
5595
|
+
"tint": "accentPrimary"
|
|
5596
|
+
}
|
|
5597
|
+
},
|
|
5598
|
+
"modifiers": {
|
|
5599
|
+
"accessibilityRole": "decorative"
|
|
5600
|
+
}
|
|
5601
|
+
},
|
|
5602
|
+
{
|
|
5603
|
+
"id": "himi_create_post.member_gate_title",
|
|
5604
|
+
"body": {
|
|
5605
|
+
"package": "himalaya",
|
|
5606
|
+
"type": "Text",
|
|
5607
|
+
"props": {
|
|
5608
|
+
"text": "Sign in to post",
|
|
5609
|
+
"style": "bodyEmphasis"
|
|
5610
|
+
}
|
|
5611
|
+
}
|
|
5612
|
+
},
|
|
5613
|
+
{
|
|
5614
|
+
"id": "",
|
|
5615
|
+
"body": {
|
|
5616
|
+
"package": "himalaya",
|
|
5617
|
+
"type": "Text",
|
|
5618
|
+
"props": {
|
|
5619
|
+
"text": "Sign in to share something with the community.",
|
|
5620
|
+
"style": "footnote",
|
|
5621
|
+
"color": "textSecondary"
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
},
|
|
5625
|
+
{
|
|
5626
|
+
"id": "himi_create_post.member_gate_signin",
|
|
5627
|
+
"body": {
|
|
5628
|
+
"package": "himalaya",
|
|
5629
|
+
"type": "Button",
|
|
5630
|
+
"props": {
|
|
5631
|
+
"title": "Sign in",
|
|
5632
|
+
"style": "primary",
|
|
5633
|
+
"fullWidth": true,
|
|
5634
|
+
"action": {
|
|
5635
|
+
"actionId": "himi.open",
|
|
5636
|
+
"params": {
|
|
5637
|
+
"screenId": "himi_account",
|
|
5638
|
+
"intent": "post",
|
|
5639
|
+
"returnScreenId": "himi_create_post"
|
|
5640
|
+
}
|
|
5641
|
+
}
|
|
5642
|
+
}
|
|
5643
|
+
}
|
|
5644
|
+
}
|
|
5645
|
+
]
|
|
5468
5646
|
}
|
|
5469
|
-
}
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
"
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
"value": "",
|
|
5479
|
-
"multilineMaxLines": 6,
|
|
5480
|
-
"focusPath": "$service:spacesCreatePost.bodyFocus",
|
|
5481
|
-
"onChange": {
|
|
5482
|
-
"actionId": "tier5.spacesCreatePost.setBody"
|
|
5647
|
+
},
|
|
5648
|
+
"modifiers": {
|
|
5649
|
+
"background": {
|
|
5650
|
+
"token": "surfaceElevated"
|
|
5651
|
+
},
|
|
5652
|
+
"border": {
|
|
5653
|
+
"width": 1,
|
|
5654
|
+
"color": {
|
|
5655
|
+
"token": "border"
|
|
5483
5656
|
}
|
|
5484
|
-
}
|
|
5657
|
+
},
|
|
5658
|
+
"cornerRadius": 16,
|
|
5659
|
+
"padding": {
|
|
5660
|
+
"leading": 16,
|
|
5661
|
+
"trailing": 16,
|
|
5662
|
+
"top": 20,
|
|
5663
|
+
"bottom": 20
|
|
5664
|
+
},
|
|
5665
|
+
"fillMaxWidth": true,
|
|
5666
|
+
"hiddenPath": "$service:spacesCreatePost.noSignIn"
|
|
5485
5667
|
}
|
|
5486
5668
|
},
|
|
5487
5669
|
{
|
|
5488
|
-
"id": "
|
|
5670
|
+
"id": "",
|
|
5489
5671
|
"body": {
|
|
5490
5672
|
"package": "himalaya",
|
|
5491
|
-
"type": "
|
|
5673
|
+
"type": "VStack",
|
|
5492
5674
|
"props": {
|
|
5493
|
-
"
|
|
5494
|
-
"
|
|
5495
|
-
"
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5675
|
+
"spacing": 16,
|
|
5676
|
+
"alignment": "leading",
|
|
5677
|
+
"children": [
|
|
5678
|
+
{
|
|
5679
|
+
"id": "",
|
|
5680
|
+
"body": {
|
|
5681
|
+
"package": "himalaya",
|
|
5682
|
+
"type": "Text",
|
|
5683
|
+
"props": {
|
|
5684
|
+
"text": "$service:spacesCreatePost.hint",
|
|
5685
|
+
"style": "footnote",
|
|
5686
|
+
"color": "textSecondary",
|
|
5687
|
+
"collapseWhenEmpty": true
|
|
5688
|
+
}
|
|
5689
|
+
}
|
|
5690
|
+
},
|
|
5691
|
+
{
|
|
5692
|
+
"id": "himi_create_post.title_field",
|
|
5693
|
+
"body": {
|
|
5694
|
+
"package": "himalaya",
|
|
5695
|
+
"type": "TextField",
|
|
5696
|
+
"props": {
|
|
5697
|
+
"placeholder": "Title",
|
|
5698
|
+
"value": "",
|
|
5699
|
+
"submitLabel": "next",
|
|
5700
|
+
"onSubmit": {
|
|
5701
|
+
"actionId": "tier5.spacesCreatePost.focusBody"
|
|
5702
|
+
},
|
|
5703
|
+
"onChange": {
|
|
5704
|
+
"actionId": "tier5.spacesCreatePost.setTitle"
|
|
5705
|
+
}
|
|
5706
|
+
}
|
|
5707
|
+
}
|
|
5708
|
+
},
|
|
5709
|
+
{
|
|
5710
|
+
"id": "himi_create_post.body_field",
|
|
5711
|
+
"body": {
|
|
5712
|
+
"package": "himalaya",
|
|
5713
|
+
"type": "TextField",
|
|
5714
|
+
"props": {
|
|
5715
|
+
"placeholder": "Write something…",
|
|
5716
|
+
"value": "",
|
|
5717
|
+
"multilineMaxLines": 6,
|
|
5718
|
+
"focusPath": "$service:spacesCreatePost.bodyFocus",
|
|
5719
|
+
"onChange": {
|
|
5720
|
+
"actionId": "tier5.spacesCreatePost.setBody"
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5724
|
+
},
|
|
5725
|
+
{
|
|
5726
|
+
"id": "himi_create_post.submit",
|
|
5727
|
+
"body": {
|
|
5728
|
+
"package": "himalaya",
|
|
5729
|
+
"type": "Button",
|
|
5730
|
+
"props": {
|
|
5731
|
+
"title": "Post",
|
|
5732
|
+
"style": "primary",
|
|
5733
|
+
"fullWidth": true,
|
|
5734
|
+
"action": {
|
|
5735
|
+
"actionId": "tier5.spacesCreatePost.submit"
|
|
5736
|
+
}
|
|
5737
|
+
}
|
|
5738
|
+
}
|
|
5739
|
+
}
|
|
5740
|
+
]
|
|
5499
5741
|
}
|
|
5742
|
+
},
|
|
5743
|
+
"modifiers": {
|
|
5744
|
+
"hiddenPath": "$service:spacesCreatePost.hideForm"
|
|
5500
5745
|
}
|
|
5501
5746
|
}
|
|
5502
5747
|
]
|
|
@@ -5511,6 +5756,9 @@ const SCREENS = runtimeSetting({
|
|
|
5511
5756
|
"trailing": 16,
|
|
5512
5757
|
"top": 18,
|
|
5513
5758
|
"bottom": 28
|
|
5759
|
+
},
|
|
5760
|
+
"onAppear": {
|
|
5761
|
+
"actionId": "tier5.spacesCreatePost.load"
|
|
5514
5762
|
}
|
|
5515
5763
|
}
|
|
5516
5764
|
},
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// create endpoint in the SDK; blog is the available authored-content write.)
|
|
5
5
|
import { defineService } from "@himalaya/state";
|
|
6
6
|
import { createDraftPost, publishDraftPost } from "@himalaya/wix-blog";
|
|
7
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
7
8
|
|
|
8
9
|
// `bodyFocus` is a focus TOKEN, not a flag: the body field focuses whenever this
|
|
9
10
|
// becomes a new non-empty value (`TextFieldProps.focus_path`). A monotonic counter
|
|
@@ -14,7 +15,11 @@ import { createDraftPost, publishDraftPost } from "@himalaya/wix-blog";
|
|
|
14
15
|
// the new state), so there is no way to observe an intermediate value while `submit`
|
|
15
16
|
// is awaiting the network. A type that promises a state nobody can ever see reads as
|
|
16
17
|
// an in-flight guard that exists — see `posting` below for the one that works.
|
|
17
|
-
|
|
18
|
+
// `needsSignIn` / `noSignIn` / `hideForm` drive the member gate: a guest sees the
|
|
19
|
+
// gate and NO form, a member sees the form, and until `load` has asked the
|
|
20
|
+
// host who is signed in, neither shows — so a guest can never start typing a post
|
|
21
|
+
// that would only fail on submit.
|
|
22
|
+
interface S { status: "ready"; title: string; body: string; hint: string; bodyFocus: string; needsSignIn: boolean; noSignIn: boolean; hideForm: boolean }
|
|
18
23
|
|
|
19
24
|
// The real double-press guard, module-local because it must live OUTSIDE published
|
|
20
25
|
// state for the reason above. One worker instance owns one composer, so a module flag
|
|
@@ -33,15 +38,20 @@ function val(arg?: unknown): string {
|
|
|
33
38
|
return typeof arg === "string" ? arg : ((arg as { value?: string; text?: string })?.value ?? (arg as { text?: string })?.text ?? "");
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
const svc = defineService<S, { setTitle: (s: S, a?: unknown) => S; setBody: (s: S, a?: unknown) => S; focusBody: (s: S) => S; submit: (s: S) => Promise<S> }>("spacesCreatePost", {
|
|
37
|
-
state: { status: "ready", title: "", body: "", hint: "Share something with the community.", bodyFocus: "" },
|
|
41
|
+
const svc = defineService<S, { load: (s: S) => Promise<S>; setTitle: (s: S, a?: unknown) => S; setBody: (s: S, a?: unknown) => S; focusBody: (s: S) => S; submit: (s: S) => Promise<S> }>("spacesCreatePost", {
|
|
42
|
+
state: { status: "ready", title: "", body: "", hint: "Share something with the community.", bodyFocus: "", needsSignIn: false, noSignIn: true, hideForm: true },
|
|
38
43
|
actions: {
|
|
44
|
+
load: async (s) => {
|
|
45
|
+
const { email } = await memberAccess();
|
|
46
|
+
return { ...s, needsSignIn: !email, noSignIn: !!email, hideForm: !email };
|
|
47
|
+
},
|
|
39
48
|
setTitle: (s, a) => ({ ...s, title: val(a) }),
|
|
40
49
|
setBody: (s, a) => ({ ...s, body: val(a) }),
|
|
41
50
|
// Title's Next key lands here. The keyboard stays up (that is the "next"
|
|
42
51
|
// contract) and the body field takes focus.
|
|
43
52
|
focusBody: (s) => ({ ...s, bodyFocus: bumpToken(s.bodyFocus) }),
|
|
44
53
|
submit: async (s) => {
|
|
54
|
+
if (s.needsSignIn) return { ...s, hint: "Sign in to post." };
|
|
45
55
|
const title = s.title.trim();
|
|
46
56
|
if (!title) return { ...s, hint: "Please enter a title." };
|
|
47
57
|
// A second press while the first is still in flight is a NO-OP, not a second
|
|
@@ -63,7 +73,7 @@ const svc = defineService<S, { setTitle: (s: S, a?: unknown) => S; setBody: (s:
|
|
|
63
73
|
// steals focus, so those transitions must clear it (see himi-store-account's
|
|
64
74
|
// NO_FOCUS on its mode switches). Same token, opposite fix; the deciding
|
|
65
75
|
// question is always whether the field stays mounted.
|
|
66
|
-
return { status: "ready", title: "", body: "", bodyFocus: s.bodyFocus, hint: `Posted “${title}” ✓ — it now appears in Blog.` };
|
|
76
|
+
return { ...s, status: "ready", title: "", body: "", bodyFocus: s.bodyFocus, hint: `Posted “${title}” ✓ — it now appears in Blog.` };
|
|
67
77
|
} catch {
|
|
68
78
|
return { ...s, status: "ready", hint: "Couldn't post — check your connection and try again." };
|
|
69
79
|
} finally {
|