@wix/himalaya-cli 0.904.0 → 0.905.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/stdlib/wix-sdk/events/src/index.d.ts +39 -21
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-events.mjs +1 -9
- package/dist/cli.mjs +74 -20
- package/guides/sdk-reference.json +5 -5
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +45 -3
- package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +45 -3
|
@@ -14313,7 +14313,7 @@
|
|
|
14313
14313
|
"name": "WixEvent",
|
|
14314
14314
|
"kind": "interface",
|
|
14315
14315
|
"jsdoc": "",
|
|
14316
|
-
"decl": "export interface WixEvent {\n id: string;\n title?: string;\n /** Normally one of `WixEventStatus`,
|
|
14316
|
+
"decl": "export interface WixEvent {\n id: string;\n title?: string;\n /** Normally one of `WixEventStatus` — `UPCOMING` (published and scheduled to start),\n * `STARTED`, `ENDED`, `CANCELED`, `DRAFT`. Events v1 called the first of those `SCHEDULED`,\n * and this SDK reads v3, so a row here never carries `SCHEDULED`.\n *\n * Deliberately NOT narrowed to that union: `decodeEvent` fills this from the server's\n * `status` and passes a value it does not recognise straight through, because dropping or\n * rewriting one would lose a real event. A union here would be a claim this SDK cannot\n * enforce. Compare against `WixEventStatus` when you need the set it knows. */\n eventStatus?: string;\n /** EventType: RSVP | TICKETS | EXTERNAL | NO_REGISTRATION */\n eventType?: string;\n scheduling?: WixEventScheduling;\n location?: WixEventLocation;\n mainImage?: WixEventImage;\n slug?: string;\n about?: string;\n description?: string;\n}"
|
|
14317
14317
|
},
|
|
14318
14318
|
{
|
|
14319
14319
|
"name": "WixGetEventListResponse",
|
|
@@ -14336,20 +14336,20 @@
|
|
|
14336
14336
|
{
|
|
14337
14337
|
"name": "EVENT_STATUSES",
|
|
14338
14338
|
"kind": "const",
|
|
14339
|
-
"jsdoc": "/** The
|
|
14340
|
-
"decl": "export const EVENT_STATUSES = Object.freeze([\"
|
|
14339
|
+
"jsdoc": "/** The event statuses this SDK knows the server stores — the Events **v3** set, because that\n * is the API `queryEvents` and `getEvent` call. `UPCOMING` is a published event that has not\n * started; v1 called that one `SCHEDULED`, and v3 does not use that spelling at all, so a\n * filter copied from v1 docs matches nothing. The one source for `WixEventStatus` below, so\n * the two cannot drift.\n *\n * Known, not exhaustive. The server owns this list and versions it — it has already been\n * renamed once, and v3 declares an `UNKNOWN_EVENT_STATUS` of its own — so nothing here\n * refuses a value that is absent from it. Use it to recognise a status, never to reject one.\n *\n * Exported because `WixEventStatus` is declared in terms of it: the generated SDK reference\n * ships each exported declaration verbatim, and a reader copying a type that names a symbol\n * they cannot see gets TS2304.\n *\n * Frozen because `as const` is erased: it makes the TYPE readonly and leaves an ordinary\n * mutable array behind. Unexported that was academic; exported it is not — module bindings\n * share one array object, so a `push` from any untyped caller would edit the set every\n * caller in that realm reads. The freeze makes the runtime keep the promise the type makes. */",
|
|
14340
|
+
"decl": "export const EVENT_STATUSES = Object.freeze([\"UPCOMING\", \"STARTED\", \"ENDED\", \"CANCELED\", \"DRAFT\"] as const);"
|
|
14341
14341
|
},
|
|
14342
14342
|
{
|
|
14343
14343
|
"name": "WixEventStatus",
|
|
14344
14344
|
"kind": "type",
|
|
14345
|
-
"jsdoc": "/** One of the
|
|
14345
|
+
"jsdoc": "/** One of the event statuses this SDK knows about. `WixQueryEventsOptions.statuses` accepts\n * these and suggests them as you type, but does not require them — see that field. */",
|
|
14346
14346
|
"decl": "export type WixEventStatus = (typeof EVENT_STATUSES)[number];"
|
|
14347
14347
|
},
|
|
14348
14348
|
{
|
|
14349
14349
|
"name": "WixQueryEventsOptions",
|
|
14350
14350
|
"kind": "interface",
|
|
14351
14351
|
"jsdoc": "",
|
|
14352
|
-
"decl": "export interface WixQueryEventsOptions {\n /** Server-side WQL filter/sort for Events v3. Unlike the legacy convenience\n * options below, these criteria are applied before paging. */\n query?: { filter?: Record<string, unknown>; sort?: Array<{ fieldName: string; order: \"ASC\" | \"DESC\" }>; paging?: { limit?: number; offset?: number } };\n /** Page size. */\n limit?: number;\n /** Page offset. */\n offset?: number;\n /** Status filter (e.g. `[\"
|
|
14352
|
+
"decl": "export interface WixQueryEventsOptions {\n /** Server-side WQL filter/sort for Events v3. Unlike the legacy convenience\n * options below, these criteria are applied before paging. */\n query?: { filter?: Record<string, unknown>; sort?: Array<{ fieldName: string; order: \"ASC\" | \"DESC\" }>; paging?: { limit?: number; offset?: number } };\n /** Page size. */\n limit?: number;\n /** Page offset. */\n offset?: number;\n /** Status filter (e.g. `[\"UPCOMING\"]`), matched exactly against each row's `eventStatus`.\n * Omitted → all statuses returned; a value no row carries selects nothing.\n *\n * This route is Events **v3**, whose statuses are `UPCOMING` (published and scheduled to\n * start), `STARTED`, `ENDED`, `CANCELED` and `DRAFT`. Events v1 named the first of those\n * `SCHEDULED`, so a filter copied from v1 docs matches no row a v3 site returns — reach\n * for `UPCOMING` instead.\n *\n * The type suggests `EVENT_STATUSES` without closing on them: the server owns that list and\n * versions it, so a value it adds later must reach the match rather than be refused on the\n * strength of a copy that has fallen behind. A status this SDK does not know is filtered on\n * like any other and selects the rows that carry it — or none, which is the honest answer\n * and one a caller can read.\n *\n * Applied to the fetched page, after paging. To filter server-side instead, use\n * `query.filter`, which is passed through unchanged. */\n statuses?: Array<WixEventStatus | (string & {})>;\n /** Sort property (the Owner list orders by \"start\"). */\n order?: string;\n /** Free-t\n/* … */"
|
|
14353
14353
|
},
|
|
14354
14354
|
{
|
|
14355
14355
|
"name": "decodeEvent",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.905.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"artifactId": "himalaya-cli"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
"falconPackageHash": "
|
|
67
|
+
"falconPackageHash": "4712eb68e7f2ecbd289330a1edda23126be3218b4a5869c6fecbde14"
|
|
68
68
|
}
|
|
@@ -20,6 +20,39 @@ import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-save
|
|
|
20
20
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
21
21
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
22
22
|
|
|
23
|
+
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
24
|
+
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
25
|
+
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
26
|
+
let feedSurfaceRefused = false;
|
|
27
|
+
|
|
28
|
+
/** True for the one refusal that can never change while the app keeps running: the web
|
|
29
|
+
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
30
|
+
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
31
|
+
* this typed refusal is permanent. */
|
|
32
|
+
function isFeedSurfaceRefusal(error: unknown): boolean {
|
|
33
|
+
return /webwix_owner_only/.test(String((error as Error)?.message ?? error));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** In-flight feed reads, keyed by the container they are for.
|
|
37
|
+
*
|
|
38
|
+
* The latch alone still let ONE duplicate through: two Home refreshes that overlap both read
|
|
39
|
+
* `feedSurfaceRefused === false` before the first rejection reaches the catch. Sharing the
|
|
40
|
+
* request closes that window — the second refresh awaits the first instead of sending its own,
|
|
41
|
+
* and both see the same rejection, so the latch is set exactly once.
|
|
42
|
+
*
|
|
43
|
+
* Keyed by container, not a single slot: `active` is the most recently active group, recomputed
|
|
44
|
+
* per refresh from a live `queryGroups`, so two overlapping refreshes can legitimately want
|
|
45
|
+
* DIFFERENT containers. A single shared promise would hand the second one the first one's feed. */
|
|
46
|
+
const feedInFlight = new Map<string, Promise<Awaited<ReturnType<typeof listFeedItems>>>>();
|
|
47
|
+
|
|
48
|
+
function feedFor(containerId: string, limit: number): Promise<Awaited<ReturnType<typeof listFeedItems>>> {
|
|
49
|
+
const pending = feedInFlight.get(containerId);
|
|
50
|
+
if (pending) return pending;
|
|
51
|
+
const started = listFeedItems(containerId, limit).finally(() => { feedInFlight.delete(containerId); });
|
|
52
|
+
feedInFlight.set(containerId, started);
|
|
53
|
+
return started;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
interface ProductFeature {
|
|
24
57
|
id: string;
|
|
25
58
|
name: string;
|
|
@@ -714,10 +747,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
714
747
|
const response = await queryGroups({ paging: { limit: 12 } });
|
|
715
748
|
const groups = (response.groups ?? []).filter((group) => group.id);
|
|
716
749
|
if (verticals.includes("groups")) extras.groupCards = groups.slice(0, 6).map(groupCard);
|
|
717
|
-
if (verticals.includes("feed") && groups.length) {
|
|
750
|
+
if (verticals.includes("feed") && groups.length && !feedSurfaceRefused) {
|
|
718
751
|
const active = groups.slice().sort((a, b) =>
|
|
719
752
|
new Date(b.lastActivityDate ?? 0).getTime() - new Date(a.lastActivityDate ?? 0).getTime())[0];
|
|
720
|
-
const feed = await
|
|
753
|
+
const feed = await feedFor(active.id, 8);
|
|
721
754
|
const profiles = feed.profiles ?? [];
|
|
722
755
|
const items = (feed.feedItems ?? []).filter((item) => item.feedItemId);
|
|
723
756
|
extras.feedHighlights = items.slice(0, 5).map((item) => {
|
|
@@ -742,7 +775,15 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
742
775
|
}))
|
|
743
776
|
.slice(0, 12);
|
|
744
777
|
}
|
|
745
|
-
} catch {
|
|
778
|
+
} catch (error) {
|
|
779
|
+
// This particular refusal is PERMANENT, not a blip: in a browser the member feed's
|
|
780
|
+
// host cannot be reached at all, so asking again can only fail again. Retrying on
|
|
781
|
+
// every Home visit spent one doomed round trip each time and filled the error log
|
|
782
|
+
// with something nobody can act on. Latch it once and stop asking; on a phone,
|
|
783
|
+
// where the call does work, this never trips.
|
|
784
|
+
if (isFeedSurfaceRefusal(error)) feedSurfaceRefused = true;
|
|
785
|
+
/* otherwise collapse silently, as before */
|
|
786
|
+
}
|
|
746
787
|
})());
|
|
747
788
|
}
|
|
748
789
|
await Promise.all(jobs);
|
|
@@ -893,6 +934,7 @@ function baseState(): State {
|
|
|
893
934
|
* let a stale failure clobber a newer success (returning `undefined` keeps the
|
|
894
935
|
* current service state; see JSRuntimeBootstrap.applyNext). */
|
|
895
936
|
let refreshGen = 0;
|
|
937
|
+
|
|
896
938
|
/** Last successful featured list — catch paths read this when the action's
|
|
897
939
|
* `state` snapshot was captured before a racing refresh painted products. */
|
|
898
940
|
let lastFeaturedProducts: ProductFeature[] = [];
|
|
@@ -20,6 +20,39 @@ import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-save
|
|
|
20
20
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
21
21
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
22
22
|
|
|
23
|
+
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
24
|
+
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
25
|
+
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
26
|
+
let feedSurfaceRefused = false;
|
|
27
|
+
|
|
28
|
+
/** True for the one refusal that can never change while the app keeps running: the web
|
|
29
|
+
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
30
|
+
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
31
|
+
* this typed refusal is permanent. */
|
|
32
|
+
function isFeedSurfaceRefusal(error: unknown): boolean {
|
|
33
|
+
return /webwix_owner_only/.test(String((error as Error)?.message ?? error));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** In-flight feed reads, keyed by the container they are for.
|
|
37
|
+
*
|
|
38
|
+
* The latch alone still let ONE duplicate through: two Home refreshes that overlap both read
|
|
39
|
+
* `feedSurfaceRefused === false` before the first rejection reaches the catch. Sharing the
|
|
40
|
+
* request closes that window — the second refresh awaits the first instead of sending its own,
|
|
41
|
+
* and both see the same rejection, so the latch is set exactly once.
|
|
42
|
+
*
|
|
43
|
+
* Keyed by container, not a single slot: `active` is the most recently active group, recomputed
|
|
44
|
+
* per refresh from a live `queryGroups`, so two overlapping refreshes can legitimately want
|
|
45
|
+
* DIFFERENT containers. A single shared promise would hand the second one the first one's feed. */
|
|
46
|
+
const feedInFlight = new Map<string, Promise<Awaited<ReturnType<typeof listFeedItems>>>>();
|
|
47
|
+
|
|
48
|
+
function feedFor(containerId: string, limit: number): Promise<Awaited<ReturnType<typeof listFeedItems>>> {
|
|
49
|
+
const pending = feedInFlight.get(containerId);
|
|
50
|
+
if (pending) return pending;
|
|
51
|
+
const started = listFeedItems(containerId, limit).finally(() => { feedInFlight.delete(containerId); });
|
|
52
|
+
feedInFlight.set(containerId, started);
|
|
53
|
+
return started;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
interface ProductFeature {
|
|
24
57
|
id: string;
|
|
25
58
|
name: string;
|
|
@@ -714,10 +747,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
714
747
|
const response = await queryGroups({ paging: { limit: 12 } });
|
|
715
748
|
const groups = (response.groups ?? []).filter((group) => group.id);
|
|
716
749
|
if (verticals.includes("groups")) extras.groupCards = groups.slice(0, 6).map(groupCard);
|
|
717
|
-
if (verticals.includes("feed") && groups.length) {
|
|
750
|
+
if (verticals.includes("feed") && groups.length && !feedSurfaceRefused) {
|
|
718
751
|
const active = groups.slice().sort((a, b) =>
|
|
719
752
|
new Date(b.lastActivityDate ?? 0).getTime() - new Date(a.lastActivityDate ?? 0).getTime())[0];
|
|
720
|
-
const feed = await
|
|
753
|
+
const feed = await feedFor(active.id, 8);
|
|
721
754
|
const profiles = feed.profiles ?? [];
|
|
722
755
|
const items = (feed.feedItems ?? []).filter((item) => item.feedItemId);
|
|
723
756
|
extras.feedHighlights = items.slice(0, 5).map((item) => {
|
|
@@ -742,7 +775,15 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
742
775
|
}))
|
|
743
776
|
.slice(0, 12);
|
|
744
777
|
}
|
|
745
|
-
} catch {
|
|
778
|
+
} catch (error) {
|
|
779
|
+
// This particular refusal is PERMANENT, not a blip: in a browser the member feed's
|
|
780
|
+
// host cannot be reached at all, so asking again can only fail again. Retrying on
|
|
781
|
+
// every Home visit spent one doomed round trip each time and filled the error log
|
|
782
|
+
// with something nobody can act on. Latch it once and stop asking; on a phone,
|
|
783
|
+
// where the call does work, this never trips.
|
|
784
|
+
if (isFeedSurfaceRefusal(error)) feedSurfaceRefused = true;
|
|
785
|
+
/* otherwise collapse silently, as before */
|
|
786
|
+
}
|
|
746
787
|
})());
|
|
747
788
|
}
|
|
748
789
|
await Promise.all(jobs);
|
|
@@ -893,6 +934,7 @@ function baseState(): State {
|
|
|
893
934
|
* let a stale failure clobber a newer success (returning `undefined` keeps the
|
|
894
935
|
* current service state; see JSRuntimeBootstrap.applyNext). */
|
|
895
936
|
let refreshGen = 0;
|
|
937
|
+
|
|
896
938
|
/** Last successful featured list — catch paths read this when the action's
|
|
897
939
|
* `state` snapshot was captured before a racing refresh painted products. */
|
|
898
940
|
let lastFeaturedProducts: ProductFeature[] = [];
|
|
@@ -20,6 +20,39 @@ import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-save
|
|
|
20
20
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
21
21
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
22
22
|
|
|
23
|
+
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
24
|
+
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
25
|
+
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
26
|
+
let feedSurfaceRefused = false;
|
|
27
|
+
|
|
28
|
+
/** True for the one refusal that can never change while the app keeps running: the web
|
|
29
|
+
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
30
|
+
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
31
|
+
* this typed refusal is permanent. */
|
|
32
|
+
function isFeedSurfaceRefusal(error: unknown): boolean {
|
|
33
|
+
return /webwix_owner_only/.test(String((error as Error)?.message ?? error));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** In-flight feed reads, keyed by the container they are for.
|
|
37
|
+
*
|
|
38
|
+
* The latch alone still let ONE duplicate through: two Home refreshes that overlap both read
|
|
39
|
+
* `feedSurfaceRefused === false` before the first rejection reaches the catch. Sharing the
|
|
40
|
+
* request closes that window — the second refresh awaits the first instead of sending its own,
|
|
41
|
+
* and both see the same rejection, so the latch is set exactly once.
|
|
42
|
+
*
|
|
43
|
+
* Keyed by container, not a single slot: `active` is the most recently active group, recomputed
|
|
44
|
+
* per refresh from a live `queryGroups`, so two overlapping refreshes can legitimately want
|
|
45
|
+
* DIFFERENT containers. A single shared promise would hand the second one the first one's feed. */
|
|
46
|
+
const feedInFlight = new Map<string, Promise<Awaited<ReturnType<typeof listFeedItems>>>>();
|
|
47
|
+
|
|
48
|
+
function feedFor(containerId: string, limit: number): Promise<Awaited<ReturnType<typeof listFeedItems>>> {
|
|
49
|
+
const pending = feedInFlight.get(containerId);
|
|
50
|
+
if (pending) return pending;
|
|
51
|
+
const started = listFeedItems(containerId, limit).finally(() => { feedInFlight.delete(containerId); });
|
|
52
|
+
feedInFlight.set(containerId, started);
|
|
53
|
+
return started;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
interface ProductFeature {
|
|
24
57
|
id: string;
|
|
25
58
|
name: string;
|
|
@@ -714,10 +747,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
714
747
|
const response = await queryGroups({ paging: { limit: 12 } });
|
|
715
748
|
const groups = (response.groups ?? []).filter((group) => group.id);
|
|
716
749
|
if (verticals.includes("groups")) extras.groupCards = groups.slice(0, 6).map(groupCard);
|
|
717
|
-
if (verticals.includes("feed") && groups.length) {
|
|
750
|
+
if (verticals.includes("feed") && groups.length && !feedSurfaceRefused) {
|
|
718
751
|
const active = groups.slice().sort((a, b) =>
|
|
719
752
|
new Date(b.lastActivityDate ?? 0).getTime() - new Date(a.lastActivityDate ?? 0).getTime())[0];
|
|
720
|
-
const feed = await
|
|
753
|
+
const feed = await feedFor(active.id, 8);
|
|
721
754
|
const profiles = feed.profiles ?? [];
|
|
722
755
|
const items = (feed.feedItems ?? []).filter((item) => item.feedItemId);
|
|
723
756
|
extras.feedHighlights = items.slice(0, 5).map((item) => {
|
|
@@ -742,7 +775,15 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
742
775
|
}))
|
|
743
776
|
.slice(0, 12);
|
|
744
777
|
}
|
|
745
|
-
} catch {
|
|
778
|
+
} catch (error) {
|
|
779
|
+
// This particular refusal is PERMANENT, not a blip: in a browser the member feed's
|
|
780
|
+
// host cannot be reached at all, so asking again can only fail again. Retrying on
|
|
781
|
+
// every Home visit spent one doomed round trip each time and filled the error log
|
|
782
|
+
// with something nobody can act on. Latch it once and stop asking; on a phone,
|
|
783
|
+
// where the call does work, this never trips.
|
|
784
|
+
if (isFeedSurfaceRefusal(error)) feedSurfaceRefused = true;
|
|
785
|
+
/* otherwise collapse silently, as before */
|
|
786
|
+
}
|
|
746
787
|
})());
|
|
747
788
|
}
|
|
748
789
|
await Promise.all(jobs);
|
|
@@ -893,6 +934,7 @@ function baseState(): State {
|
|
|
893
934
|
* let a stale failure clobber a newer success (returning `undefined` keeps the
|
|
894
935
|
* current service state; see JSRuntimeBootstrap.applyNext). */
|
|
895
936
|
let refreshGen = 0;
|
|
937
|
+
|
|
896
938
|
/** Last successful featured list — catch paths read this when the action's
|
|
897
939
|
* `state` snapshot was captured before a racing refresh painted products. */
|
|
898
940
|
let lastFeaturedProducts: ProductFeature[] = [];
|
|
@@ -20,6 +20,39 @@ import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-save
|
|
|
20
20
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
21
21
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
22
22
|
|
|
23
|
+
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
24
|
+
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
25
|
+
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
26
|
+
let feedSurfaceRefused = false;
|
|
27
|
+
|
|
28
|
+
/** True for the one refusal that can never change while the app keeps running: the web
|
|
29
|
+
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
30
|
+
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
31
|
+
* this typed refusal is permanent. */
|
|
32
|
+
function isFeedSurfaceRefusal(error: unknown): boolean {
|
|
33
|
+
return /webwix_owner_only/.test(String((error as Error)?.message ?? error));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** In-flight feed reads, keyed by the container they are for.
|
|
37
|
+
*
|
|
38
|
+
* The latch alone still let ONE duplicate through: two Home refreshes that overlap both read
|
|
39
|
+
* `feedSurfaceRefused === false` before the first rejection reaches the catch. Sharing the
|
|
40
|
+
* request closes that window — the second refresh awaits the first instead of sending its own,
|
|
41
|
+
* and both see the same rejection, so the latch is set exactly once.
|
|
42
|
+
*
|
|
43
|
+
* Keyed by container, not a single slot: `active` is the most recently active group, recomputed
|
|
44
|
+
* per refresh from a live `queryGroups`, so two overlapping refreshes can legitimately want
|
|
45
|
+
* DIFFERENT containers. A single shared promise would hand the second one the first one's feed. */
|
|
46
|
+
const feedInFlight = new Map<string, Promise<Awaited<ReturnType<typeof listFeedItems>>>>();
|
|
47
|
+
|
|
48
|
+
function feedFor(containerId: string, limit: number): Promise<Awaited<ReturnType<typeof listFeedItems>>> {
|
|
49
|
+
const pending = feedInFlight.get(containerId);
|
|
50
|
+
if (pending) return pending;
|
|
51
|
+
const started = listFeedItems(containerId, limit).finally(() => { feedInFlight.delete(containerId); });
|
|
52
|
+
feedInFlight.set(containerId, started);
|
|
53
|
+
return started;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
interface ProductFeature {
|
|
24
57
|
id: string;
|
|
25
58
|
name: string;
|
|
@@ -714,10 +747,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
714
747
|
const response = await queryGroups({ paging: { limit: 12 } });
|
|
715
748
|
const groups = (response.groups ?? []).filter((group) => group.id);
|
|
716
749
|
if (verticals.includes("groups")) extras.groupCards = groups.slice(0, 6).map(groupCard);
|
|
717
|
-
if (verticals.includes("feed") && groups.length) {
|
|
750
|
+
if (verticals.includes("feed") && groups.length && !feedSurfaceRefused) {
|
|
718
751
|
const active = groups.slice().sort((a, b) =>
|
|
719
752
|
new Date(b.lastActivityDate ?? 0).getTime() - new Date(a.lastActivityDate ?? 0).getTime())[0];
|
|
720
|
-
const feed = await
|
|
753
|
+
const feed = await feedFor(active.id, 8);
|
|
721
754
|
const profiles = feed.profiles ?? [];
|
|
722
755
|
const items = (feed.feedItems ?? []).filter((item) => item.feedItemId);
|
|
723
756
|
extras.feedHighlights = items.slice(0, 5).map((item) => {
|
|
@@ -742,7 +775,15 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
742
775
|
}))
|
|
743
776
|
.slice(0, 12);
|
|
744
777
|
}
|
|
745
|
-
} catch {
|
|
778
|
+
} catch (error) {
|
|
779
|
+
// This particular refusal is PERMANENT, not a blip: in a browser the member feed's
|
|
780
|
+
// host cannot be reached at all, so asking again can only fail again. Retrying on
|
|
781
|
+
// every Home visit spent one doomed round trip each time and filled the error log
|
|
782
|
+
// with something nobody can act on. Latch it once and stop asking; on a phone,
|
|
783
|
+
// where the call does work, this never trips.
|
|
784
|
+
if (isFeedSurfaceRefusal(error)) feedSurfaceRefused = true;
|
|
785
|
+
/* otherwise collapse silently, as before */
|
|
786
|
+
}
|
|
746
787
|
})());
|
|
747
788
|
}
|
|
748
789
|
await Promise.all(jobs);
|
|
@@ -893,6 +934,7 @@ function baseState(): State {
|
|
|
893
934
|
* let a stale failure clobber a newer success (returning `undefined` keeps the
|
|
894
935
|
* current service state; see JSRuntimeBootstrap.applyNext). */
|
|
895
936
|
let refreshGen = 0;
|
|
937
|
+
|
|
896
938
|
/** Last successful featured list — catch paths read this when the action's
|
|
897
939
|
* `state` snapshot was captured before a racing refresh painted products. */
|
|
898
940
|
let lastFeaturedProducts: ProductFeature[] = [];
|
|
@@ -20,6 +20,39 @@ import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-save
|
|
|
20
20
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
21
21
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
22
22
|
|
|
23
|
+
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
24
|
+
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
25
|
+
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
26
|
+
let feedSurfaceRefused = false;
|
|
27
|
+
|
|
28
|
+
/** True for the one refusal that can never change while the app keeps running: the web
|
|
29
|
+
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
30
|
+
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
31
|
+
* this typed refusal is permanent. */
|
|
32
|
+
function isFeedSurfaceRefusal(error: unknown): boolean {
|
|
33
|
+
return /webwix_owner_only/.test(String((error as Error)?.message ?? error));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** In-flight feed reads, keyed by the container they are for.
|
|
37
|
+
*
|
|
38
|
+
* The latch alone still let ONE duplicate through: two Home refreshes that overlap both read
|
|
39
|
+
* `feedSurfaceRefused === false` before the first rejection reaches the catch. Sharing the
|
|
40
|
+
* request closes that window — the second refresh awaits the first instead of sending its own,
|
|
41
|
+
* and both see the same rejection, so the latch is set exactly once.
|
|
42
|
+
*
|
|
43
|
+
* Keyed by container, not a single slot: `active` is the most recently active group, recomputed
|
|
44
|
+
* per refresh from a live `queryGroups`, so two overlapping refreshes can legitimately want
|
|
45
|
+
* DIFFERENT containers. A single shared promise would hand the second one the first one's feed. */
|
|
46
|
+
const feedInFlight = new Map<string, Promise<Awaited<ReturnType<typeof listFeedItems>>>>();
|
|
47
|
+
|
|
48
|
+
function feedFor(containerId: string, limit: number): Promise<Awaited<ReturnType<typeof listFeedItems>>> {
|
|
49
|
+
const pending = feedInFlight.get(containerId);
|
|
50
|
+
if (pending) return pending;
|
|
51
|
+
const started = listFeedItems(containerId, limit).finally(() => { feedInFlight.delete(containerId); });
|
|
52
|
+
feedInFlight.set(containerId, started);
|
|
53
|
+
return started;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
interface ProductFeature {
|
|
24
57
|
id: string;
|
|
25
58
|
name: string;
|
|
@@ -714,10 +747,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
714
747
|
const response = await queryGroups({ paging: { limit: 12 } });
|
|
715
748
|
const groups = (response.groups ?? []).filter((group) => group.id);
|
|
716
749
|
if (verticals.includes("groups")) extras.groupCards = groups.slice(0, 6).map(groupCard);
|
|
717
|
-
if (verticals.includes("feed") && groups.length) {
|
|
750
|
+
if (verticals.includes("feed") && groups.length && !feedSurfaceRefused) {
|
|
718
751
|
const active = groups.slice().sort((a, b) =>
|
|
719
752
|
new Date(b.lastActivityDate ?? 0).getTime() - new Date(a.lastActivityDate ?? 0).getTime())[0];
|
|
720
|
-
const feed = await
|
|
753
|
+
const feed = await feedFor(active.id, 8);
|
|
721
754
|
const profiles = feed.profiles ?? [];
|
|
722
755
|
const items = (feed.feedItems ?? []).filter((item) => item.feedItemId);
|
|
723
756
|
extras.feedHighlights = items.slice(0, 5).map((item) => {
|
|
@@ -742,7 +775,15 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
742
775
|
}))
|
|
743
776
|
.slice(0, 12);
|
|
744
777
|
}
|
|
745
|
-
} catch {
|
|
778
|
+
} catch (error) {
|
|
779
|
+
// This particular refusal is PERMANENT, not a blip: in a browser the member feed's
|
|
780
|
+
// host cannot be reached at all, so asking again can only fail again. Retrying on
|
|
781
|
+
// every Home visit spent one doomed round trip each time and filled the error log
|
|
782
|
+
// with something nobody can act on. Latch it once and stop asking; on a phone,
|
|
783
|
+
// where the call does work, this never trips.
|
|
784
|
+
if (isFeedSurfaceRefusal(error)) feedSurfaceRefused = true;
|
|
785
|
+
/* otherwise collapse silently, as before */
|
|
786
|
+
}
|
|
746
787
|
})());
|
|
747
788
|
}
|
|
748
789
|
await Promise.all(jobs);
|
|
@@ -893,6 +934,7 @@ function baseState(): State {
|
|
|
893
934
|
* let a stale failure clobber a newer success (returning `undefined` keeps the
|
|
894
935
|
* current service state; see JSRuntimeBootstrap.applyNext). */
|
|
895
936
|
let refreshGen = 0;
|
|
937
|
+
|
|
896
938
|
/** Last successful featured list — catch paths read this when the action's
|
|
897
939
|
* `state` snapshot was captured before a racing refresh painted products. */
|
|
898
940
|
let lastFeaturedProducts: ProductFeature[] = [];
|
|
@@ -20,6 +20,39 @@ import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-save
|
|
|
20
20
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
21
21
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
22
22
|
|
|
23
|
+
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
24
|
+
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
25
|
+
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
26
|
+
let feedSurfaceRefused = false;
|
|
27
|
+
|
|
28
|
+
/** True for the one refusal that can never change while the app keeps running: the web
|
|
29
|
+
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
30
|
+
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
31
|
+
* this typed refusal is permanent. */
|
|
32
|
+
function isFeedSurfaceRefusal(error: unknown): boolean {
|
|
33
|
+
return /webwix_owner_only/.test(String((error as Error)?.message ?? error));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** In-flight feed reads, keyed by the container they are for.
|
|
37
|
+
*
|
|
38
|
+
* The latch alone still let ONE duplicate through: two Home refreshes that overlap both read
|
|
39
|
+
* `feedSurfaceRefused === false` before the first rejection reaches the catch. Sharing the
|
|
40
|
+
* request closes that window — the second refresh awaits the first instead of sending its own,
|
|
41
|
+
* and both see the same rejection, so the latch is set exactly once.
|
|
42
|
+
*
|
|
43
|
+
* Keyed by container, not a single slot: `active` is the most recently active group, recomputed
|
|
44
|
+
* per refresh from a live `queryGroups`, so two overlapping refreshes can legitimately want
|
|
45
|
+
* DIFFERENT containers. A single shared promise would hand the second one the first one's feed. */
|
|
46
|
+
const feedInFlight = new Map<string, Promise<Awaited<ReturnType<typeof listFeedItems>>>>();
|
|
47
|
+
|
|
48
|
+
function feedFor(containerId: string, limit: number): Promise<Awaited<ReturnType<typeof listFeedItems>>> {
|
|
49
|
+
const pending = feedInFlight.get(containerId);
|
|
50
|
+
if (pending) return pending;
|
|
51
|
+
const started = listFeedItems(containerId, limit).finally(() => { feedInFlight.delete(containerId); });
|
|
52
|
+
feedInFlight.set(containerId, started);
|
|
53
|
+
return started;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
interface ProductFeature {
|
|
24
57
|
id: string;
|
|
25
58
|
name: string;
|
|
@@ -714,10 +747,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
714
747
|
const response = await queryGroups({ paging: { limit: 12 } });
|
|
715
748
|
const groups = (response.groups ?? []).filter((group) => group.id);
|
|
716
749
|
if (verticals.includes("groups")) extras.groupCards = groups.slice(0, 6).map(groupCard);
|
|
717
|
-
if (verticals.includes("feed") && groups.length) {
|
|
750
|
+
if (verticals.includes("feed") && groups.length && !feedSurfaceRefused) {
|
|
718
751
|
const active = groups.slice().sort((a, b) =>
|
|
719
752
|
new Date(b.lastActivityDate ?? 0).getTime() - new Date(a.lastActivityDate ?? 0).getTime())[0];
|
|
720
|
-
const feed = await
|
|
753
|
+
const feed = await feedFor(active.id, 8);
|
|
721
754
|
const profiles = feed.profiles ?? [];
|
|
722
755
|
const items = (feed.feedItems ?? []).filter((item) => item.feedItemId);
|
|
723
756
|
extras.feedHighlights = items.slice(0, 5).map((item) => {
|
|
@@ -742,7 +775,15 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
742
775
|
}))
|
|
743
776
|
.slice(0, 12);
|
|
744
777
|
}
|
|
745
|
-
} catch {
|
|
778
|
+
} catch (error) {
|
|
779
|
+
// This particular refusal is PERMANENT, not a blip: in a browser the member feed's
|
|
780
|
+
// host cannot be reached at all, so asking again can only fail again. Retrying on
|
|
781
|
+
// every Home visit spent one doomed round trip each time and filled the error log
|
|
782
|
+
// with something nobody can act on. Latch it once and stop asking; on a phone,
|
|
783
|
+
// where the call does work, this never trips.
|
|
784
|
+
if (isFeedSurfaceRefusal(error)) feedSurfaceRefused = true;
|
|
785
|
+
/* otherwise collapse silently, as before */
|
|
786
|
+
}
|
|
746
787
|
})());
|
|
747
788
|
}
|
|
748
789
|
await Promise.all(jobs);
|
|
@@ -893,6 +934,7 @@ function baseState(): State {
|
|
|
893
934
|
* let a stale failure clobber a newer success (returning `undefined` keeps the
|
|
894
935
|
* current service state; see JSRuntimeBootstrap.applyNext). */
|
|
895
936
|
let refreshGen = 0;
|
|
937
|
+
|
|
896
938
|
/** Last successful featured list — catch paths read this when the action's
|
|
897
939
|
* `state` snapshot was captured before a racing refresh painted products. */
|
|
898
940
|
let lastFeaturedProducts: ProductFeature[] = [];
|
|
@@ -20,6 +20,39 @@ import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-save
|
|
|
20
20
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
21
21
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
22
22
|
|
|
23
|
+
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
24
|
+
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
25
|
+
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
26
|
+
let feedSurfaceRefused = false;
|
|
27
|
+
|
|
28
|
+
/** True for the one refusal that can never change while the app keeps running: the web
|
|
29
|
+
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
30
|
+
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
31
|
+
* this typed refusal is permanent. */
|
|
32
|
+
function isFeedSurfaceRefusal(error: unknown): boolean {
|
|
33
|
+
return /webwix_owner_only/.test(String((error as Error)?.message ?? error));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** In-flight feed reads, keyed by the container they are for.
|
|
37
|
+
*
|
|
38
|
+
* The latch alone still let ONE duplicate through: two Home refreshes that overlap both read
|
|
39
|
+
* `feedSurfaceRefused === false` before the first rejection reaches the catch. Sharing the
|
|
40
|
+
* request closes that window — the second refresh awaits the first instead of sending its own,
|
|
41
|
+
* and both see the same rejection, so the latch is set exactly once.
|
|
42
|
+
*
|
|
43
|
+
* Keyed by container, not a single slot: `active` is the most recently active group, recomputed
|
|
44
|
+
* per refresh from a live `queryGroups`, so two overlapping refreshes can legitimately want
|
|
45
|
+
* DIFFERENT containers. A single shared promise would hand the second one the first one's feed. */
|
|
46
|
+
const feedInFlight = new Map<string, Promise<Awaited<ReturnType<typeof listFeedItems>>>>();
|
|
47
|
+
|
|
48
|
+
function feedFor(containerId: string, limit: number): Promise<Awaited<ReturnType<typeof listFeedItems>>> {
|
|
49
|
+
const pending = feedInFlight.get(containerId);
|
|
50
|
+
if (pending) return pending;
|
|
51
|
+
const started = listFeedItems(containerId, limit).finally(() => { feedInFlight.delete(containerId); });
|
|
52
|
+
feedInFlight.set(containerId, started);
|
|
53
|
+
return started;
|
|
54
|
+
}
|
|
55
|
+
|
|
23
56
|
interface ProductFeature {
|
|
24
57
|
id: string;
|
|
25
58
|
name: string;
|
|
@@ -714,10 +747,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
714
747
|
const response = await queryGroups({ paging: { limit: 12 } });
|
|
715
748
|
const groups = (response.groups ?? []).filter((group) => group.id);
|
|
716
749
|
if (verticals.includes("groups")) extras.groupCards = groups.slice(0, 6).map(groupCard);
|
|
717
|
-
if (verticals.includes("feed") && groups.length) {
|
|
750
|
+
if (verticals.includes("feed") && groups.length && !feedSurfaceRefused) {
|
|
718
751
|
const active = groups.slice().sort((a, b) =>
|
|
719
752
|
new Date(b.lastActivityDate ?? 0).getTime() - new Date(a.lastActivityDate ?? 0).getTime())[0];
|
|
720
|
-
const feed = await
|
|
753
|
+
const feed = await feedFor(active.id, 8);
|
|
721
754
|
const profiles = feed.profiles ?? [];
|
|
722
755
|
const items = (feed.feedItems ?? []).filter((item) => item.feedItemId);
|
|
723
756
|
extras.feedHighlights = items.slice(0, 5).map((item) => {
|
|
@@ -742,7 +775,15 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
742
775
|
}))
|
|
743
776
|
.slice(0, 12);
|
|
744
777
|
}
|
|
745
|
-
} catch {
|
|
778
|
+
} catch (error) {
|
|
779
|
+
// This particular refusal is PERMANENT, not a blip: in a browser the member feed's
|
|
780
|
+
// host cannot be reached at all, so asking again can only fail again. Retrying on
|
|
781
|
+
// every Home visit spent one doomed round trip each time and filled the error log
|
|
782
|
+
// with something nobody can act on. Latch it once and stop asking; on a phone,
|
|
783
|
+
// where the call does work, this never trips.
|
|
784
|
+
if (isFeedSurfaceRefusal(error)) feedSurfaceRefused = true;
|
|
785
|
+
/* otherwise collapse silently, as before */
|
|
786
|
+
}
|
|
746
787
|
})());
|
|
747
788
|
}
|
|
748
789
|
await Promise.all(jobs);
|
|
@@ -893,6 +934,7 @@ function baseState(): State {
|
|
|
893
934
|
* let a stale failure clobber a newer success (returning `undefined` keeps the
|
|
894
935
|
* current service state; see JSRuntimeBootstrap.applyNext). */
|
|
895
936
|
let refreshGen = 0;
|
|
937
|
+
|
|
896
938
|
/** Last successful featured list — catch paths read this when the action's
|
|
897
939
|
* `state` snapshot was captured before a racing refresh painted products. */
|
|
898
940
|
let lastFeaturedProducts: ProductFeature[] = [];
|