@wix/himalaya-cli 0.1954.0 → 0.1956.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/cli.mjs +154 -72
  2. package/guides/one-app-section-mappings.md +1 -1
  3. package/guides/one-app-to-himi-app.md +11 -7
  4. package/package.json +2 -2
  5. package/templates/branded-lite/l10n/ar.json +5 -0
  6. package/templates/branded-lite/l10n/cs.json +5 -0
  7. package/templates/branded-lite/l10n/da.json +5 -0
  8. package/templates/branded-lite/l10n/de.json +5 -0
  9. package/templates/branded-lite/l10n/el.json +5 -0
  10. package/templates/branded-lite/l10n/es.json +5 -0
  11. package/templates/branded-lite/l10n/fi.json +5 -0
  12. package/templates/branded-lite/l10n/fr.json +5 -0
  13. package/templates/branded-lite/l10n/he.json +5 -0
  14. package/templates/branded-lite/l10n/hu.json +5 -0
  15. package/templates/branded-lite/l10n/id.json +5 -0
  16. package/templates/branded-lite/l10n/it.json +5 -0
  17. package/templates/branded-lite/l10n/ja.json +5 -0
  18. package/templates/branded-lite/l10n/ko.json +5 -0
  19. package/templates/branded-lite/l10n/lt.json +5 -0
  20. package/templates/branded-lite/l10n/nl.json +5 -0
  21. package/templates/branded-lite/l10n/no.json +5 -0
  22. package/templates/branded-lite/l10n/pl.json +5 -0
  23. package/templates/branded-lite/l10n/pt.json +5 -0
  24. package/templates/branded-lite/l10n/ru.json +5 -0
  25. package/templates/branded-lite/l10n/sv.json +5 -0
  26. package/templates/branded-lite/l10n/th.json +5 -0
  27. package/templates/branded-lite/l10n/tr.json +5 -0
  28. package/templates/branded-lite/l10n/uk.json +5 -0
  29. package/templates/branded-lite/l10n/vi.json +5 -0
  30. package/templates/branded-lite/l10n/zh.json +5 -0
  31. package/templates/branded-lite/recipes/blog-carousel-classic.json +335 -0
  32. package/templates/branded-lite/recipes/blog-carousel-full.json +374 -0
  33. package/templates/branded-lite/recipes/events-inline-carousel.json +308 -0
  34. package/templates/branded-lite/recipes/galleries-carousel.json +51 -2
  35. package/templates/branded-lite/recipes/galleries-collage.json +51 -2
  36. package/templates/branded-lite/recipes/galleries-list.json +51 -2
  37. package/templates/branded-lite/recipes/groups-cards.json +194 -86
  38. package/templates/branded-lite/recipes/groups-list.json +209 -62
  39. package/templates/branded-lite/tier5-src/_shared/blog-list.ts +5 -1
  40. package/templates/branded-lite/tier5-src/_shared/galleries-section.ts +70 -23
  41. package/templates/branded-lite/tier5-src/_shared/groups-section.ts +297 -26
  42. package/templates/branded-lite/recipes/blog-hero.json +0 -95
@@ -1,9 +1,13 @@
1
1
  {
2
- "_recipe": "A page's groups: a list of rows (cover, name, teaser, member count; a tap opens the group), the section's own View All button when there are more groups than it shows, and the empty text. ONE node, always mounted. Service: registerGroupsSection(svc, { groupIds, limit }).",
2
+ "_recipe": "A page's groups: the section's title with its Search link (the source's call to action), which opens a search field over every group the section may show, a list of rows (cover, name, teaser, member count; a tap opens the group) each with the viewer's join control (Join group, Request to join) or membership status (Joined, Pending request), the section's own View All button when there are more groups than it shows, the join message and the empty text. ONE node, always mounted. Service: registerGroupsSection(svc, { groupIds, limit }).",
3
3
  "_placeholders": {
4
4
  "svc": "service name the page worker registered with registerGroupsSection",
5
5
  "id": "unique node id prefix for this section",
6
+ "title": "the section's title. The header keeps exactly one flexing child: the generator removes {{id}}.headSpacer when the title shows (the title takes the row) and {{id}}.headTitle when the source hides it (the spacer keeps the link trailing)",
7
+ "headLabel": "the header link's label (the source's section call to action: Search); it opens and closes the section's search field",
8
+ "searchPlaceholder": "the search field's placeholder",
6
9
  "detailScreen": "group screen id, himi_group",
10
+ "signInScreen": "the app's sign-in screen, himi_sign_in: a visitor's join control signs in first and then opens the group",
7
11
  "seeAllLabel": "the View All button's label (the source's own expand text)",
8
12
  "seeAllScreen": "the screen View All opens, himi_groups"
9
13
  },
@@ -16,6 +20,78 @@
16
20
  "spacing": 12,
17
21
  "alignment": "leading",
18
22
  "children": [
23
+ {
24
+ "id": "{{id}}.head",
25
+ "body": {
26
+ "package": "himalaya",
27
+ "type": "HStack",
28
+ "props": {
29
+ "spacing": 8,
30
+ "alignment": "center",
31
+ "children": [
32
+ {
33
+ "id": "{{id}}.headTitle",
34
+ "body": {
35
+ "package": "himalaya",
36
+ "type": "Text",
37
+ "props": {
38
+ "text": "{{title}}",
39
+ "style": "title3",
40
+ "maxLines": 2
41
+ }
42
+ },
43
+ "modifiers": {
44
+ "weight": 1
45
+ }
46
+ },
47
+ {
48
+ "id": "{{id}}.headSpacer",
49
+ "body": {
50
+ "package": "himalaya",
51
+ "type": "Spacer",
52
+ "props": {}
53
+ }
54
+ },
55
+ {
56
+ "id": "{{id}}.all",
57
+ "body": {
58
+ "package": "himalaya",
59
+ "type": "Button",
60
+ "props": {
61
+ "title": "{{headLabel}}",
62
+ "style": "tertiary",
63
+ "size": "md",
64
+ "action": {
65
+ "actionId": "tier5.{{svc}}.toggleSearch"
66
+ }
67
+ }
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ },
73
+ "modifiers": {
74
+ "fillMaxWidth": true
75
+ }
76
+ },
77
+ {
78
+ "id": "{{id}}.search",
79
+ "body": {
80
+ "package": "himalaya",
81
+ "type": "SearchField",
82
+ "props": {
83
+ "placeholder": "{{searchPlaceholder}}",
84
+ "debounceMs": 200,
85
+ "value": "$service:{{svc}}.query",
86
+ "onChange": {
87
+ "actionId": "tier5.{{svc}}.search"
88
+ }
89
+ }
90
+ },
91
+ "modifiers": {
92
+ "hiddenPath": "$service:{{svc}}.noSearch"
93
+ }
94
+ },
19
95
  {
20
96
  "id": "{{id}}.loading",
21
97
  "body": {
@@ -47,108 +123,179 @@
47
123
  "itemsPath": "$service:{{svc}}.rows",
48
124
  "items": [
49
125
  {
50
- "id": "{{id}}.row",
126
+ "id": "{{id}}.item",
51
127
  "body": {
52
128
  "package": "himalaya",
53
- "type": "HStack",
129
+ "type": "VStack",
54
130
  "props": {
55
- "spacing": 12,
56
- "alignment": "center",
131
+ "spacing": 8,
132
+ "alignment": "leading",
57
133
  "children": [
58
134
  {
59
- "id": "{{id}}.cover",
135
+ "id": "{{id}}.row",
60
136
  "body": {
61
137
  "package": "himalaya",
62
- "type": "Image",
138
+ "type": "HStack",
63
139
  "props": {
64
- "url": "$item.image",
65
- "initials": "$item.initial",
66
- "width": 72,
67
- "height": 72,
68
- "shape": "rounded",
69
- "contentMode": "fill",
70
- "contentDescription": "$item.title"
71
- }
72
- }
73
- },
74
- {
75
- "id": "{{id}}.text",
76
- "body": {
77
- "package": "himalaya",
78
- "type": "VStack",
79
- "props": {
80
- "spacing": 4,
81
- "alignment": "leading",
140
+ "spacing": 12,
141
+ "alignment": "center",
82
142
  "children": [
83
143
  {
84
- "id": "{{id}}.title",
85
- "body": {
86
- "package": "himalaya",
87
- "type": "Text",
88
- "props": {
89
- "text": "$item.title",
90
- "style": "bodyEmphasis",
91
- "maxLines": 2
92
- }
93
- }
94
- },
95
- {
96
- "id": "{{id}}.subtitle",
144
+ "id": "{{id}}.cover",
97
145
  "body": {
98
146
  "package": "himalaya",
99
- "type": "Text",
147
+ "type": "Image",
100
148
  "props": {
101
- "text": "$item.subtitle",
102
- "style": "caption",
103
- "maxLines": 2,
104
- "color": "textSecondary"
149
+ "url": "$item.image",
150
+ "initials": "$item.initial",
151
+ "width": 72,
152
+ "height": 72,
153
+ "shape": "rounded",
154
+ "contentMode": "fill",
155
+ "contentDescription": "$item.title"
105
156
  }
106
157
  }
107
158
  },
108
159
  {
109
- "id": "{{id}}.meta",
160
+ "id": "{{id}}.text",
110
161
  "body": {
111
162
  "package": "himalaya",
112
- "type": "Text",
163
+ "type": "VStack",
113
164
  "props": {
114
- "text": "$item.meta",
115
- "style": "caption",
116
- "maxLines": 1,
117
- "color": "textSecondary",
118
- "collapseWhenEmpty": true
165
+ "spacing": 4,
166
+ "alignment": "leading",
167
+ "children": [
168
+ {
169
+ "id": "{{id}}.title",
170
+ "body": {
171
+ "package": "himalaya",
172
+ "type": "Text",
173
+ "props": {
174
+ "text": "$item.title",
175
+ "style": "bodyEmphasis",
176
+ "maxLines": 2
177
+ }
178
+ }
179
+ },
180
+ {
181
+ "id": "{{id}}.subtitle",
182
+ "body": {
183
+ "package": "himalaya",
184
+ "type": "Text",
185
+ "props": {
186
+ "text": "$item.subtitle",
187
+ "style": "caption",
188
+ "maxLines": 2,
189
+ "color": "textSecondary"
190
+ }
191
+ }
192
+ },
193
+ {
194
+ "id": "{{id}}.meta",
195
+ "body": {
196
+ "package": "himalaya",
197
+ "type": "Text",
198
+ "props": {
199
+ "text": "$item.meta",
200
+ "style": "caption",
201
+ "maxLines": 1,
202
+ "color": "textSecondary",
203
+ "collapseWhenEmpty": true
204
+ }
205
+ },
206
+ "modifiers": {
207
+ "hiddenPath": "$item.noMeta"
208
+ }
209
+ }
210
+ ]
119
211
  }
120
212
  },
121
213
  "modifiers": {
122
- "hiddenPath": "$item.noMeta"
214
+ "weight": 1
123
215
  }
124
216
  }
125
217
  ]
126
218
  }
127
219
  },
128
220
  "modifiers": {
129
- "weight": 1
221
+ "fillMaxWidth": true,
222
+ "onTap": {
223
+ "actionId": "himi.open",
224
+ "params": {
225
+ "screenId": "{{detailScreen}}",
226
+ "id": "$item.id"
227
+ }
228
+ },
229
+ "pressFeedback": "scale",
230
+ "accessibilityLabel": "$item.title"
231
+ }
232
+ },
233
+ {
234
+ "id": "{{id}}.join",
235
+ "body": {
236
+ "package": "himalaya",
237
+ "type": "Button",
238
+ "props": {
239
+ "title": "$item.actionLabel",
240
+ "style": "secondary",
241
+ "size": "md",
242
+ "fullWidth": true,
243
+ "action": {
244
+ "actionId": "tier5.{{svc}}.join",
245
+ "params": {
246
+ "id": "$item.id",
247
+ "signInScreenId": "{{signInScreen}}"
248
+ }
249
+ }
250
+ }
251
+ },
252
+ "modifiers": {
253
+ "hiddenPath": "$item.noAction"
254
+ }
255
+ },
256
+ {
257
+ "id": "{{id}}.status",
258
+ "body": {
259
+ "package": "himalaya",
260
+ "type": "Text",
261
+ "props": {
262
+ "text": "$item.statusLabel",
263
+ "style": "caption",
264
+ "maxLines": 1,
265
+ "color": "textSecondary",
266
+ "collapseWhenEmpty": true
267
+ }
268
+ },
269
+ "modifiers": {
270
+ "hiddenPath": "$item.noStatus"
130
271
  }
131
272
  }
132
273
  ]
133
274
  }
134
275
  },
135
276
  "modifiers": {
136
- "fillMaxWidth": true,
137
- "onTap": {
138
- "actionId": "himi.open",
139
- "params": {
140
- "screenId": "{{detailScreen}}",
141
- "id": "$item.id"
142
- }
143
- },
144
- "pressFeedback": "scale",
145
- "accessibilityLabel": "$item.title"
277
+ "fillMaxWidth": true
146
278
  }
147
279
  }
148
280
  ]
149
281
  }
150
282
  }
151
283
  },
284
+ {
285
+ "id": "{{id}}.message",
286
+ "body": {
287
+ "package": "himalaya",
288
+ "type": "Text",
289
+ "props": {
290
+ "text": "$service:{{svc}}.message",
291
+ "style": "caption",
292
+ "color": "textSecondary"
293
+ }
294
+ },
295
+ "modifiers": {
296
+ "hiddenPath": "$service:{{svc}}.noMessage"
297
+ }
298
+ },
152
299
  {
153
300
  "id": "{{id}}.more",
154
301
  "body": {
@@ -7,7 +7,8 @@
7
7
  // seeAll -> a limited list whose section has a See All Posts footer: shown whenever the list has posts, even when
8
8
  // they all fit the limit (the source shows it then too); unset keeps "only when there are more posts",
9
9
  // search -> a search section: no posts until the reader types, then the latest posts whose title or excerpt hold the text.
10
- // A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipe blog-post-row.json).
10
+ // A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipes blog-list.json, and
11
+ // blog-carousel-full.json / blog-carousel-classic.json for the two carousel layouts).
11
12
  import { defineService as register } from "@himalaya/state";
12
13
  import { queryPosts, type WixPost, type WixQueryPostsRequest } from "@himalaya/wix-blog";
13
14
  import { getPublicMember } from "@himalaya/wix-members";
@@ -56,6 +57,8 @@ export interface BlogRow {
56
57
  authorPhoto: string; hasAvatar: boolean;
57
58
  /** The photo's accessible label: the author's name whenever the photo shows, also when the name itself is off. */
58
59
  avatarLabel: string; noAvatar: boolean; hasByline: boolean; noByline: boolean;
60
+ /** Nothing for the carousel cards' author line (photo, name and time) to show, so the whole line collapses. */
61
+ noInfo: boolean;
59
62
  /** The post's summary (the excerpt setting), "" when off or empty. */
60
63
  excerpt: string; hasExcerpt: boolean; noExcerpt: boolean;
61
64
  counts: Count[]; hasCounts: boolean; noCounts: boolean;
@@ -159,6 +162,7 @@ export function registerBlogList(serviceName: string, options: BlogListOptions)
159
162
  meta, hasMeta: !!meta, noMeta: !meta,
160
163
  authorName, hasAuthor: !!authorName, noAuthor: !authorName,
161
164
  authorPhoto, avatarLabel, hasAvatar: !!authorPhoto, noAvatar: !authorPhoto, hasByline: !!(authorName || authorPhoto), noByline: !(authorName || authorPhoto),
165
+ noInfo: !(authorName || authorPhoto || meta),
162
166
  excerpt, hasExcerpt: !!excerpt, noExcerpt: !excerpt,
163
167
  counts, hasCounts: counts.length > 0, noCounts: counts.length === 0,
164
168
  count1Icon: one.Icon, count1Text: one.Text, count1Num: one.Num, hasCount1: one.has, noCount1: one.no,
@@ -3,18 +3,24 @@
3
3
  // which is when the section's See All button (to the galleries screen) shows.
4
4
  // showName -> whether a card shows the gallery's name (the source section's `isShowName`); the accessibility label always has it.
5
5
  // The source reads the One App's own galleries service with the MEMBER's signed instance, never hidden galleries (`withHidden=false`), and
6
- // drops empty ones; a visitor has no member instance, so the source shows them its "no galleries" state, and so does a failed read. This section
7
- // does the same, and never falls back to the public Pro Gallery list (`/progallery/v2/galleries`), which has no hidden flag:
8
- // - a signed-out visitor gets the empty state, without a read;
6
+ // drops empty ones. This section reads the same list and never falls back to the public Pro Gallery list (`/progallery/v2/galleries`), which
7
+ // has no hidden flag:
8
+ // - a signed-out visitor (or a member Wix refuses) gets the sign-in state (`signedOut`), without a read: "No galleries yet" would be a claim
9
+ // about a list nobody read;
9
10
  // - a member reads that service (`photography-one-app-viewer/galleries`), which a native host reaches;
10
- // - where it cannot be read (the published web bridge refuses that host) the member gets the empty state too: a hidden gallery must never show.
11
+ // - where it cannot be read (the published web bridge refuses that host, a failed or malformed answer) the member gets the error state, never
12
+ // the empty one: only a list that answered with no gallery is "No galleries yet". A hidden gallery must never show.
13
+ // Signing in or out on another screen reads again for whoever is signed in now.
11
14
  // A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipes galleries-carousel / galleries-list).
12
15
  // `collage: true` is the source's single-gallery mode (`maxGalleries: 1`): the first gallery's name, View All, and its first five pictures as one
13
16
  // big tile and four small ones, the last small tile carrying "+N" for the pictures past the five (recipe galleries-collage).
14
17
  import { defineService } from "@himalaya/state";
18
+ import { hostSessionFromGlobal } from "@himalaya/iap";
15
19
  import { wixMediaUrl } from "@himalaya/wix-media";
16
20
  import { copyParam, stashCopy, copyTemplate } from "./himi-copy.js";
21
+ import { resetUnhydratedKeysOnOlderRuntime } from "./iap-worker.js";
17
22
  import { memberAccess } from "./member-access.js";
23
+ import { isHttp401 } from "./member-read.js";
18
24
 
19
25
  export interface GalleriesSectionOptions {
20
26
  /** How many galleries to show. */
@@ -49,9 +55,14 @@ export interface GalleryRow {
49
55
 
50
56
  export interface GalleriesSectionState {
51
57
  status: "loading" | "ready" | "error";
58
+ /** A visitor, or a member Wix refused: the section asks to sign in instead of reading. */
59
+ signedOut: boolean;
52
60
  rows: GalleryRow[];
61
+ /** "No galleries yet": only once a member's read answered with none. */
53
62
  emptyText: string;
54
- notLoading: boolean; notErrored: boolean; noRows: boolean; noEmpty: boolean;
63
+ /** The stock galleries screen's sign-in sentence (`galleries.signInText`) and the stock Sign in button's title. */
64
+ signInText: string; signInLabel: string;
65
+ notLoading: boolean; notErrored: boolean; notSignedOut: boolean; noRows: boolean; noEmpty: boolean;
55
66
  /** false when the site has more galleries than the section shows. */
56
67
  noMore: boolean;
57
68
  /** The collage's tiles: the first one, and up to four after it (both empty outside `collage`). */
@@ -158,35 +169,71 @@ export function registerGalleriesSection(serviceName: string, options: Galleries
158
169
  const collage = options.collage === true;
159
170
  const limit = collage ? 1 : Math.min(Math.max(Math.floor(options.limit ?? DEFAULT_LIMIT), 1), MAX_GALLERIES);
160
171
  const showName = options.showName !== false;
161
- const view = (status: GalleriesSectionState["status"], rows: GalleryRow[], more: boolean, tiles: { big: CollageTile[]; small: CollageTile[] } = { big: [], small: [] }): GalleriesSectionState => ({
162
- status, rows, bigTile: tiles.big, smallTiles: tiles.small, noCollage: !tiles.big.length,
163
- emptyText: status === "ready" && !rows.length ? copyParam("galleries.sectionEmptyText", "No galleries yet.") : "",
164
- notLoading: status !== "loading", notErrored: status !== "error",
165
- noRows: !rows.length, noEmpty: !(status === "ready" && !rows.length),
166
- noMore: !more,
167
- });
168
- return defineService<GalleriesSectionState, { load: (state: GalleriesSectionState, arg?: unknown) => Promise<GalleriesSectionState> }>(serviceName, {
169
- state: view("loading", [], false),
172
+ const view = (status: GalleriesSectionState["status"], signedOut: boolean, rows: GalleryRow[], more: boolean, tiles: { big: CollageTile[]; small: CollageTile[] } = { big: [], small: [] }): GalleriesSectionState => {
173
+ const empty = status === "ready" && !signedOut && !rows.length;
174
+ return {
175
+ status, signedOut, rows, bigTile: tiles.big, smallTiles: tiles.small, noCollage: !tiles.big.length,
176
+ emptyText: empty ? copyParam("galleries.sectionEmptyText", "No galleries yet.") : "",
177
+ signInText: copyParam("galleries.signInText", "Sign in to see galleries."), signInLabel: copyParam("account.signInCta", "Sign in"),
178
+ notLoading: status !== "loading", notErrored: status !== "error", notSignedOut: !signedOut,
179
+ noRows: !rows.length, noEmpty: !empty,
180
+ noMore: !more,
181
+ };
182
+ };
183
+ const initial = view("loading", false, [], false);
184
+ // Only the newest load may answer: a visitor's load that finishes after the member signed in must not overwrite the member's list.
185
+ let sequence = 0;
186
+ // The viewer changed: what is published is the previous viewer's, so it goes at once, before the read for the new one finishes. Only a
187
+ // section that has loaded reads again: one page worker can register many sections, and one its screen never showed reads on its onAppear.
188
+ const restart = () => { if (!sequence) return; void service.clear(); void service.load(); };
189
+ // The list is read as one member: kept out of the worker snapshot (on a runtime that honours `notPersisted`), and never restored for
190
+ // the next person on the device.
191
+ const memberKeys = Object.keys(initial) as Array<keyof GalleriesSectionState>;
192
+ const service = defineService<GalleriesSectionState, { load: (state: GalleriesSectionState, arg?: unknown) => Promise<GalleriesSectionState | undefined>; clear: () => GalleriesSectionState }>(serviceName, {
193
+ state: initial,
194
+ notPersisted: memberKeys,
195
+ notHydrated: memberKeys,
170
196
  actions: {
197
+ // A read still in flight belongs to the previous viewer: it must not publish over the cleared state. Synchronous, as in
198
+ // upcoming-sessions, so the bump lands before the load `restart` sends next.
199
+ clear: () => { ++sequence; return initial; },
171
200
  load: async (_state, arg) => {
172
201
  stashCopy(arg);
202
+ const seq = ++sequence;
173
203
  try {
174
- // The source reads as the member: a visitor has no instance for it and sees its "no galleries" state.
175
- if (!(await memberAccess()).signedIn) return view("ready", [], false);
204
+ // The source reads as the member: a visitor has no instance for it. Strict: an identity lookup that merely failed is an error, not a visitor.
205
+ const member = await memberAccess({ throwOnUnavailable: true });
206
+ if (seq !== sequence) return undefined;
207
+ if (!member.signedIn) return view("ready", true, [], false);
176
208
  const api = (globalThis as { himalaya?: { wixApi?: WixApi } }).himalaya?.wixApi;
177
209
  if (!api) throw new Error("Wix bridge unavailable");
178
- const { galleries, more } = await readGalleries(api, limit, collage ? COLLAGE_TILES : 1).catch((oneAppError) => {
179
- // As in the source, a list that cannot be read is its "no galleries" state (and it is never replaced by the public list: that one cannot tell a hidden gallery).
180
- console.warn("galleries_section: the One App galleries service could not be read", oneAppError);
181
- return { galleries: [] as RawGallery[], more: false };
182
- });
210
+ // A list that cannot be read is the error state, and never replaced by the public list: that one cannot tell a hidden gallery.
211
+ const { galleries, more } = await readGalleries(api, limit, collage ? COLLAGE_TILES : 1);
212
+ if (seq !== sequence) return undefined;
183
213
  const rows = galleries.slice(0, limit).map((gallery, index) => rowOf(gallery, index, showName));
184
- return view("ready", rows, more, collage && rows[0] && galleries[0] ? collageOf(galleries[0], rows[0]) : undefined);
214
+ return view("ready", false, rows, more, collage && rows[0] && galleries[0] ? collageOf(galleries[0], rows[0]) : undefined);
185
215
  } catch (error) {
216
+ if (seq !== sequence) return undefined;
217
+ // Wix refusing the session (the status, HTTP 401) is a sign-in state; a 401 quoted in another status's body is not. A 403 is not: it also answers an app that is not
218
+ // installed, and a Sign in button would loop a member who is already signed in. Anything else is a failed read.
219
+ if (isHttp401(error)) return view("ready", true, [], false);
186
220
  console.warn("galleries_section: the galleries could not be read", error);
187
- return view("error", [], false);
221
+ return view("error", false, [], false);
188
222
  }
189
223
  },
190
224
  },
191
225
  });
226
+ // A runtime older than both options restores a snapshot written before this module stopped persisting: it goes before the first paint.
227
+ resetUnhydratedKeysOnOlderRuntime(service, initial, memberKeys);
228
+ // Signing in or out on another screen changes whose list the section shows. A new generation is a new identity; a notification within
229
+ // one (the session turning ready, a token refresh) keeps the list, as the top-bar avatar does.
230
+ const session = hostSessionFromGlobal();
231
+ let generation = session.current().generation;
232
+ session.subscribe(() => {
233
+ const now = session.current().generation;
234
+ if (now === generation) return;
235
+ generation = now;
236
+ restart();
237
+ });
238
+ return service;
192
239
  }