@wix/himalaya-cli 0.1646.0 → 0.1648.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +6 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/blog-v3/src/extensions.d.ts +21 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/media/src/rendition.d.ts +6 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-blog.mjs +8 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-events.mjs +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-media.mjs +22 -4
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members.mjs +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-rich-content.mjs +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores-collections.mjs +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores.mjs +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-video.mjs +4 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{155f61519885c85d61a39fa595197071a3ca07680da56055ccb1dcff2e709cd1.bin → 4ef4d326496b4d7809746936207067b4c921f5db9878ecc7030aa3a9e4d2aaeb.bin} +1 -1
- package/dist/browser-plane/sw.js +5 -5
- package/dist/cli.mjs +4100 -3355
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +2 -0
- package/guides/designing-himi-screens.md +4 -0
- package/guides/himi-skill.md +6 -0
- package/guides/image-preview.md +92 -0
- package/guides/index.json +7 -0
- package/guides/release-notes.md +6 -0
- package/guides/sdk-reference.json +42 -3
- package/package.json +2 -2
- package/templates/beauty-salon/config.ts +1 -1
- package/templates/beauty-salon/dev/index.ts +2773 -2969
- package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/beauty-salon/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/beauty-salon/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/beauty-salon/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/beauty-salon/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/beauty-salon/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/beauty-salon-owner/dev/index.ts +7 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/branded-lite/config.ts +1 -1
- package/templates/branded-lite/dev/index.ts +2741 -2937
- package/templates/branded-lite/l10n/en.json +12 -12
- package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/branded-lite/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/branded-lite/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/branded-lite/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/branded-lite/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/branded-lite/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/community-club/config.ts +1 -1
- package/templates/community-club/dev/index.ts +2799 -2995
- package/templates/community-club/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/community-club/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/community-club/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/community-club/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/community-club/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/community-club/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/community-club-owner/dev/index.ts +7 -0
- package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/conference/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/events-meetups/config.ts +1 -1
- package/templates/events-meetups/dev/index.ts +2859 -3055
- package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/events-meetups/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/events-meetups/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/events-meetups/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/events-meetups/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/events-meetups/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/events-meetups-owner/dev/index.ts +7 -0
- package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/gym-fitness/config.ts +1 -1
- package/templates/gym-fitness/dev/index.ts +2733 -2929
- package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/gym-fitness/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/gym-fitness/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/gym-fitness/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/gym-fitness/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/gym-fitness/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/gym-fitness-owner/dev/index.ts +7 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/nonprofit-cause/config.ts +1 -1
- package/templates/nonprofit-cause/dev/index.ts +2813 -3009
- package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/nonprofit-cause/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/nonprofit-cause/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/nonprofit-cause/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/nonprofit-cause/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/nonprofit-cause/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/nonprofit-cause-owner/dev/index.ts +7 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/owner-lite/dev/index.ts +7 -0
- package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/podcast-creator/config.ts +1 -1
- package/templates/podcast-creator/dev/index.ts +2862 -3058
- package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/podcast-creator/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/podcast-creator/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/podcast-creator/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/podcast-creator/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/podcast-creator/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/podcast-creator-owner/dev/index.ts +7 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/portfolio-creative/config.ts +1 -1
- package/templates/portfolio-creative/dev/index.ts +2803 -2999
- package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/portfolio-creative/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/portfolio-creative/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/portfolio-creative/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/portfolio-creative/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/portfolio-creative/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/portfolio-creative-owner/dev/index.ts +7 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/restaurant/config.ts +1 -1
- package/templates/restaurant/dev/index.ts +2845 -3041
- package/templates/restaurant/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/restaurant/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/restaurant/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/restaurant/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/restaurant/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/restaurant/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/restaurant-owner/dev/index.ts +7 -0
- package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/retail-store/config.ts +1 -1
- package/templates/retail-store/dev/index.ts +2809 -3005
- package/templates/retail-store/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/retail-store/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/retail-store/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/retail-store/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/retail-store/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/retail-store/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/retail-store-owner/dev/index.ts +7 -0
- package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/salon-spa/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/yoga-studio/config.ts +1 -1
- package/templates/yoga-studio/dev/index.ts +2752 -2948
- package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/yoga-studio/tier5-src/_shared/himi-blog-post-row.ts +210 -0
- package/templates/yoga-studio/tier5-src/_shared/himi-blog-saved.ts +0 -10
- package/templates/yoga-studio/tier5-src/himi-blog-feed/index.ts +220 -95
- package/templates/yoga-studio/tier5-src/himi-blog-post/index.ts +436 -140
- package/templates/yoga-studio/tier5-src/himi-blog-saved/index.ts +97 -39
- package/templates/yoga-studio-owner/dev/index.ts +7 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +0 -1
- package/templates/beauty-salon/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/branded-lite/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/community-club/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/events-meetups/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/gym-fitness/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/nonprofit-cause/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/podcast-creator/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/portfolio-creative/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/restaurant/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/retail-store/tier5-src/_shared/himi-blog-collection.ts +0 -7
- package/templates/yoga-studio/tier5-src/_shared/himi-blog-collection.ts +0 -7
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Tier-5 bundle: Himi Blog saved posts - member-local/device-local saved IDs.
|
|
2
2
|
import { defineService } from "@himalaya/state";
|
|
3
|
+
import { snackbar } from "@himalaya/ui";
|
|
3
4
|
import { getPost, type WixPost } from "@himalaya/wix-blog";
|
|
4
5
|
import { get, type DbEntity } from "@himalaya/local-db";
|
|
5
6
|
import { readSavedIds, writeSavedIds } from "../_shared/himi-blog-saved";
|
|
6
7
|
import { readHiddenIds } from "../_shared/himi-blog-hidden";
|
|
7
8
|
import { stashCopy, copyParam } from "../_shared/himi-copy.js";
|
|
8
|
-
import {
|
|
9
|
+
import { BLOG_THUMB_IMAGE, coverOf, dateOf, legacyRowFixes, resolveAuthors, cachedCover, type BlogPostShape } from "../_shared/himi-blog-post-row.js";
|
|
9
10
|
|
|
10
11
|
// Offline-first (data-offline): the saved list is a public read-through — the saved
|
|
11
12
|
// IDs stay in the himalaya.storage KV (left as-is), but each post is resolved live
|
|
@@ -20,12 +21,14 @@ async function readCachedPost(id: string): Promise<DbEntity | null> {
|
|
|
20
21
|
function rowFromCached(row: DbEntity): SavedRow {
|
|
21
22
|
const id = String(row.id ?? "");
|
|
22
23
|
const title = String(row.title ?? "") || "Untitled post";
|
|
23
|
-
const cover =
|
|
24
|
+
const cover = cachedCover(row, BLOG_THUMB_IMAGE);
|
|
24
25
|
return {
|
|
25
26
|
id,
|
|
26
27
|
title,
|
|
27
|
-
excerpt: String(row.excerpt ??
|
|
28
|
-
|
|
28
|
+
excerpt: String(legacyRowFixes(row).excerpt ?? row.excerpt ?? "").trim(),
|
|
29
|
+
// The feed caches the author it showed; an older cached row has none and shows the date alone.
|
|
30
|
+
// A row cached by an older build has no `date`, only a `meta` of "date · N min read": its date alone.
|
|
31
|
+
meta: metaFor(typeof row.authorName === "string" ? row.authorName : "", String(row.date ?? String(row.meta ?? "").split(" · ")[0] ?? "")),
|
|
29
32
|
initial: String(row.initial ?? "") || (title[0] || "#").toUpperCase(),
|
|
30
33
|
detailScreenId: String(row.detailScreenId ?? `himi_blog_post_${id}`),
|
|
31
34
|
// The cover trio the live path derives (see rowFromPost) — a cached row carries the
|
|
@@ -43,6 +46,7 @@ interface SavedRow {
|
|
|
43
46
|
id: string;
|
|
44
47
|
title: string;
|
|
45
48
|
excerpt: string;
|
|
49
|
+
/** "Shay Cohen · Jul 30, 2026": the author (when known) and the publish date. */
|
|
46
50
|
meta: string;
|
|
47
51
|
initial: string;
|
|
48
52
|
/** Cover thumbnail (getPost returns it; previously discarded — the row
|
|
@@ -56,6 +60,11 @@ interface SavedRow {
|
|
|
56
60
|
interface S {
|
|
57
61
|
status: "loading" | "ready" | "error";
|
|
58
62
|
posts: SavedRow[];
|
|
63
|
+
/** The last removed post and where it was, for the snackbar's Undo ("" = nothing to undo). */
|
|
64
|
+
removedId: string;
|
|
65
|
+
removedIndex: number;
|
|
66
|
+
/** The removed post's row, so Undo puts it back without a reload. */
|
|
67
|
+
removedRow: SavedRow | null;
|
|
59
68
|
emptyText: string;
|
|
60
69
|
errorText: string;
|
|
61
70
|
isLoading: boolean;
|
|
@@ -73,38 +82,16 @@ function idOf(arg: unknown): string {
|
|
|
73
82
|
return a?.id ?? a?.postId ?? "";
|
|
74
83
|
}
|
|
75
84
|
|
|
76
|
-
|
|
77
|
-
const bits: string[] = [];
|
|
78
|
-
if (post.firstPublishedDate) {
|
|
79
|
-
bits.push(formatDateMedium(new Date(post.firstPublishedDate)));
|
|
80
|
-
}
|
|
81
|
-
if (post.minutesToRead) bits.push(`${post.minutesToRead} min read`);
|
|
82
|
-
return bits.join(" · ");
|
|
83
|
-
}
|
|
85
|
+
const metaFor = (author: string, date: string): string => [author, date].filter(Boolean).join(" · ");
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
function coverUrl(post: WixPost): string {
|
|
87
|
-
const raw = post as WixPost & {
|
|
88
|
-
media?: { wixMedia?: { image?: { url?: string } }; embedMedia?: { thumbnail?: { url?: string } } };
|
|
89
|
-
coverImage?: { image?: { url?: string }; url?: string };
|
|
90
|
-
};
|
|
91
|
-
return (
|
|
92
|
-
raw.media?.wixMedia?.image?.url ??
|
|
93
|
-
raw.media?.embedMedia?.thumbnail?.url ??
|
|
94
|
-
raw.coverImage?.image?.url ??
|
|
95
|
-
raw.coverImage?.url ??
|
|
96
|
-
""
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function rowFromPost(post: WixPost): SavedRow {
|
|
87
|
+
function rowFromPost(post: WixPost, author: string): SavedRow {
|
|
101
88
|
const title = post.title || "Untitled post";
|
|
102
|
-
const cover =
|
|
89
|
+
const cover = coverOf(post as WixPost & BlogPostShape, BLOG_THUMB_IMAGE);
|
|
103
90
|
return {
|
|
104
91
|
id: post.id,
|
|
105
92
|
title,
|
|
106
|
-
excerpt: (post.excerpt
|
|
107
|
-
meta:
|
|
93
|
+
excerpt: (post.excerpt ?? "").trim(),
|
|
94
|
+
meta: metaFor(author, dateOf(post as WixPost & BlogPostShape)),
|
|
108
95
|
initial: (title[0] || "#").toUpperCase(),
|
|
109
96
|
cover,
|
|
110
97
|
hasCover: !!cover,
|
|
@@ -133,6 +120,9 @@ function derive(s: S): S {
|
|
|
133
120
|
const baseState: S = derive({
|
|
134
121
|
status: "loading",
|
|
135
122
|
posts: [],
|
|
123
|
+
removedId: "",
|
|
124
|
+
removedIndex: -1,
|
|
125
|
+
removedRow: null,
|
|
136
126
|
emptyText: "",
|
|
137
127
|
errorText: "",
|
|
138
128
|
isLoading: true,
|
|
@@ -144,7 +134,40 @@ const baseState: S = derive({
|
|
|
144
134
|
blogScreenId: "himi_blog",
|
|
145
135
|
});
|
|
146
136
|
|
|
137
|
+
/** The state as it is now (set once the service exists), and a count of the removes and undos so far.
|
|
138
|
+
* A read that awaited the network checks both: a remove or Undo tapped meanwhile is kept, not undone. */
|
|
139
|
+
let committed: () => S | undefined = () => undefined;
|
|
140
|
+
let edits = 0;
|
|
141
|
+
|
|
142
|
+
/** A finished read, applied to what the reader did while it ran: only ids still saved are listed (a row
|
|
143
|
+
* an Undo put back keeps its place), and the last removal's Undo stays. */
|
|
144
|
+
function landed(read: S, editsAtStart: number): S {
|
|
145
|
+
if (editsAtStart === edits) return read;
|
|
146
|
+
// A runtime that reports no state keeps the read's own rows, message and Undo.
|
|
147
|
+
const now = committed() ?? read;
|
|
148
|
+
const order = readSavedIds();
|
|
149
|
+
// A post hidden meanwhile stays out too (it stays saved, as readSavedState keeps it).
|
|
150
|
+
const hidden = new Set(readHiddenIds());
|
|
151
|
+
const readIds = new Set(read.posts.map((post) => post.id));
|
|
152
|
+
const posts = [...read.posts, ...now.posts.filter((post) => !readIds.has(post.id))]
|
|
153
|
+
.filter((post) => order.includes(post.id) && !hidden.has(post.id))
|
|
154
|
+
.sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id));
|
|
155
|
+
return derive({
|
|
156
|
+
...read,
|
|
157
|
+
posts,
|
|
158
|
+
emptyText: posts.length ? read.emptyText : copyParam("saved.emptyText", "No saved posts yet."),
|
|
159
|
+
removedId: now.removedId,
|
|
160
|
+
removedIndex: now.removedIndex,
|
|
161
|
+
removedRow: now.removedRow,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
147
165
|
async function loadSavedState(s: S): Promise<S> {
|
|
166
|
+
const editsAtStart = edits;
|
|
167
|
+
return landed(await readSavedState(s), editsAtStart);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function readSavedState(s: S): Promise<S> {
|
|
148
171
|
// A saved post this device's reader also hid stays in the saved list (Undo brings it back) but is not shown.
|
|
149
172
|
const hidden = new Set(readHiddenIds());
|
|
150
173
|
const ids = readSavedIds().filter((id) => !hidden.has(id));
|
|
@@ -152,16 +175,17 @@ async function loadSavedState(s: S): Promise<S> {
|
|
|
152
175
|
return derive({ ...s, status: "ready", posts: [], emptyText: copyParam("saved.emptyText", "No saved posts yet.") });
|
|
153
176
|
}
|
|
154
177
|
try {
|
|
155
|
-
const results = await Promise.allSettled(ids.map((id) => getPost(id)));
|
|
178
|
+
const results = await Promise.allSettled(ids.map((id) => getPost(id, { fieldsets: [] })));
|
|
156
179
|
// Resolve each saved id: live post first, else the last-synced cached row (offline).
|
|
180
|
+
const live = results.map((result) => result.status === "fulfilled"
|
|
181
|
+
? ((result.value as unknown as { post?: WixPost }).post ?? (result.value as unknown as WixPost))
|
|
182
|
+
: null);
|
|
183
|
+
const authors = await resolveAuthors(live.map((post) => (post as (WixPost & BlogPostShape) | null)?.memberId));
|
|
157
184
|
const posts: SavedRow[] = [];
|
|
158
185
|
for (let i = 0; i < ids.length; i++) {
|
|
159
|
-
const
|
|
160
|
-
const post = result.status === "fulfilled"
|
|
161
|
-
? ((result.value as unknown as { post?: WixPost }).post ?? (result.value as unknown as WixPost))
|
|
162
|
-
: null;
|
|
186
|
+
const post = live[i];
|
|
163
187
|
if (post?.id) {
|
|
164
|
-
posts.push(rowFromPost(post));
|
|
188
|
+
posts.push(rowFromPost(post, authors.get((post as WixPost & BlogPostShape).memberId ?? "")?.name ?? ""));
|
|
165
189
|
} else {
|
|
166
190
|
const cached = await readCachedPost(ids[i]);
|
|
167
191
|
if (cached?.id) posts.push(rowFromCached(cached));
|
|
@@ -184,20 +208,54 @@ const svc = defineService<S, {
|
|
|
184
208
|
refresh: (s: S, arg?: unknown) => Promise<S>;
|
|
185
209
|
retry: (s: S) => Promise<S>;
|
|
186
210
|
remove: (s: S, arg?: unknown) => S;
|
|
211
|
+
/** The snackbar's Undo: the last removed post goes back where it was. */
|
|
212
|
+
undoRemove: (s: S) => S;
|
|
187
213
|
}>("himiBlogSaved", {
|
|
188
214
|
state: baseState,
|
|
189
215
|
actions: {
|
|
190
216
|
load: (s, arg) => { stashCopy(arg); return loadSavedState(s); },
|
|
217
|
+
// The last removal stays undoable across a visit: its snackbar (native, over every screen) can
|
|
218
|
+
// still be up when the screen opens again. The next removal replaces it; Undo clears it.
|
|
191
219
|
refresh: (s, arg) => { stashCopy(arg); return loadSavedState({ ...s, status: "loading" }); },
|
|
192
220
|
retry: (s) => loadSavedState({ ...s, status: "loading", errorText: "" }),
|
|
193
221
|
remove: (s, arg) => {
|
|
194
222
|
const id = idOf(arg);
|
|
195
223
|
if (!id) return s;
|
|
196
|
-
|
|
197
|
-
|
|
224
|
+
const savedIds = readSavedIds();
|
|
225
|
+
// A second tap on a row already removed changes nothing: its Undo stays the one offered.
|
|
226
|
+
if (!savedIds.includes(id)) return s;
|
|
227
|
+
edits++;
|
|
228
|
+
writeSavedIds(savedIds.filter((savedId) => savedId !== id));
|
|
229
|
+
// The app's snackbar, its button Undo. A newer removal's snackbar replaces this one, so only
|
|
230
|
+
// the last removal's Undo can be tapped. A host with no snackbar presenter shows nothing.
|
|
231
|
+
void snackbar({ message: copyParam("saved.removedMessage", "Removed from saved"), action: { label: copyParam("blogCommon.undoCta", "Undo"), actionId: "tier5.himiBlogSaved.undoRemove" } })
|
|
232
|
+
.catch(() => undefined);
|
|
233
|
+
return derive({
|
|
234
|
+
...s,
|
|
235
|
+
posts: s.posts.filter((post) => post.id !== id),
|
|
236
|
+
removedRow: s.posts.find((post) => post.id === id) ?? null,
|
|
237
|
+
removedId: id,
|
|
238
|
+
removedIndex: savedIds.indexOf(id),
|
|
239
|
+
emptyText: copyParam("saved.emptyText", "No saved posts yet."),
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
undoRemove: (s) => {
|
|
243
|
+
const id = s.removedId;
|
|
244
|
+
if (!id) return s;
|
|
245
|
+
edits++;
|
|
246
|
+
const savedIds = readSavedIds().filter((savedId) => savedId !== id);
|
|
247
|
+
const at = s.removedIndex < 0 ? 0 : Math.min(s.removedIndex, savedIds.length);
|
|
248
|
+
writeSavedIds([...savedIds.slice(0, at), id, ...savedIds.slice(at)]);
|
|
249
|
+
const order = readSavedIds();
|
|
250
|
+
const row = s.removedRow;
|
|
251
|
+
const posts = row && !s.posts.some((post) => post.id === row.id)
|
|
252
|
+
? [...s.posts, row].sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id))
|
|
253
|
+
: s.posts;
|
|
254
|
+
return derive({ ...s, posts, removedId: "", removedIndex: -1, removedRow: null });
|
|
198
255
|
},
|
|
199
256
|
},
|
|
200
257
|
});
|
|
201
258
|
|
|
259
|
+
committed = () => (svc as { getState?: () => S }).getState?.();
|
|
202
260
|
svc.load();
|
|
203
261
|
export { svc };
|
|
@@ -58995,6 +58995,7 @@ const SCREENS = runtimeSetting({
|
|
|
58995
58995
|
}
|
|
58996
58996
|
},
|
|
58997
58997
|
"modifiers": {
|
|
58998
|
+
"imagePreview": "off",
|
|
58998
58999
|
"hiddenPath": "$service:himiOwnerLiteAria.widget.optionsGridHidden"
|
|
58999
59000
|
}
|
|
59000
59001
|
},
|
|
@@ -60476,6 +60477,9 @@ const SCREENS = runtimeSetting({
|
|
|
60476
60477
|
}
|
|
60477
60478
|
]
|
|
60478
60479
|
}
|
|
60480
|
+
},
|
|
60481
|
+
"modifiers": {
|
|
60482
|
+
"imagePreview": "on"
|
|
60479
60483
|
}
|
|
60480
60484
|
},
|
|
60481
60485
|
"accessibilityAnnouncement": "$service:himiOwnerLiteAria.widget.text"
|
|
@@ -63104,6 +63108,7 @@ const SCREENS = runtimeSetting({
|
|
|
63104
63108
|
}
|
|
63105
63109
|
},
|
|
63106
63110
|
"modifiers": {
|
|
63111
|
+
"imagePreview": "view",
|
|
63107
63112
|
"hiddenPath": "$item.thumbHidden"
|
|
63108
63113
|
}
|
|
63109
63114
|
},
|
|
@@ -76317,6 +76322,7 @@ const SCREENS = runtimeSetting({
|
|
|
76317
76322
|
},
|
|
76318
76323
|
"modifiers": {
|
|
76319
76324
|
"cornerRadius": 8,
|
|
76325
|
+
"imagePreview": "view",
|
|
76320
76326
|
"hiddenPath": "$service:himiOwnerLitePostForm.noCover"
|
|
76321
76327
|
}
|
|
76322
76328
|
}
|
|
@@ -77158,6 +77164,7 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
77158
77164
|
},
|
|
77159
77165
|
"modifiers": {
|
|
77160
77166
|
"cornerRadius": 8,
|
|
77167
|
+
"imagePreview": "view",
|
|
77161
77168
|
"hiddenPath": "$service:himiOwnerLitePostForm.noCover"
|
|
77162
77169
|
}
|
|
77163
77170
|
}
|
|
@@ -82,7 +82,6 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
82
82
|
defaultFilter: 'value:Upcoming', searchPlaceholder: 'Search by booking ID', countNoun: ['booking', 'bookings'], filterValues: ['Upcoming', 'Past', 'Cancelled'],
|
|
83
83
|
sortLabels: { default: 'Soonest', az: 'Oldest', za: 'Latest' } },
|
|
84
84
|
himiEvents: { rows: 'results', title: 'title', subtitle: 'dateLine', image: 'image', dateBadge: { text: 'dateBadge', hidden: 'noDateBadge' }, gridColumns: 1, view: 'grid', backendQuery: true, defaultFilter: 'value:Upcoming', searchPlaceholder: 'Search events', countNoun: ['event', 'events'], filterValues: ['Upcoming', 'Past'], sortLabels: { default: 'Date', az: 'Title A–Z', za: 'Title Z–A' }, primaryVerb: { label: 'Register', labelPath: 'actionLabel', hiddenPath: 'noAction' }, shareAction: 'share', endedWhen: 'isPast' },
|
|
85
|
-
himiBlogFeed: { rows: 'posts', title: 'title', subtitle: 'excerpt', image: 'image', filter: 'category', filterValuesFrom: 'categories', view: 'grid', narrowedBy: 'selectedCategoryId' },
|
|
86
85
|
himiOwnerLiteProducts: { rows: 'products', title: 'name', subtitle: 'price', image: 'image', view: 'grid', backendQuery: true, countNoun: ['product', 'products'] },
|
|
87
86
|
himiOwnerModules: { instanceInput: 'module', rows: 'rows', title: 'title', subtitle: 'subtitle', image: 'image', filter: 'statusLabel', view: 'list', paged: true, reviewAction: 'prepareRecord', reviewSelectedAction: 'prepareSelected' },
|
|
88
87
|
himiOwnerLiteServices: { rows: 'services', title: 'name', subtitle: 'subtitle', view: 'list', backendQuery: true, searchPlaceholder: 'Service name starts with…' },
|
|
@@ -82,7 +82,6 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
82
82
|
defaultFilter: 'value:Upcoming', searchPlaceholder: 'Search by booking ID', countNoun: ['booking', 'bookings'], filterValues: ['Upcoming', 'Past', 'Cancelled'],
|
|
83
83
|
sortLabels: { default: 'Soonest', az: 'Oldest', za: 'Latest' } },
|
|
84
84
|
himiEvents: { rows: 'results', title: 'title', subtitle: 'dateLine', image: 'image', dateBadge: { text: 'dateBadge', hidden: 'noDateBadge' }, gridColumns: 1, view: 'grid', backendQuery: true, defaultFilter: 'value:Upcoming', searchPlaceholder: 'Search events', countNoun: ['event', 'events'], filterValues: ['Upcoming', 'Past'], sortLabels: { default: 'Date', az: 'Title A–Z', za: 'Title Z–A' }, primaryVerb: { label: 'Register', labelPath: 'actionLabel', hiddenPath: 'noAction' }, shareAction: 'share', endedWhen: 'isPast' },
|
|
85
|
-
himiBlogFeed: { rows: 'posts', title: 'title', subtitle: 'excerpt', image: 'image', filter: 'category', filterValuesFrom: 'categories', view: 'grid', narrowedBy: 'selectedCategoryId' },
|
|
86
85
|
himiOwnerLiteProducts: { rows: 'products', title: 'name', subtitle: 'price', image: 'image', view: 'grid', backendQuery: true, countNoun: ['product', 'products'] },
|
|
87
86
|
himiOwnerModules: { instanceInput: 'module', rows: 'rows', title: 'title', subtitle: 'subtitle', image: 'image', filter: 'statusLabel', view: 'list', paged: true, reviewAction: 'prepareRecord', reviewSelectedAction: 'prepareSelected' },
|
|
88
87
|
himiOwnerLiteServices: { rows: 'services', title: 'name', subtitle: 'subtitle', view: 'list', backendQuery: true, searchPlaceholder: 'Service name starts with…' },
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["push","share","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","wix_cashier"],
|
|
40
|
+
capabilities: ["push","share","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","ui","wix_cashier"],
|
|
41
41
|
cache: {
|
|
42
42
|
"rules": [
|
|
43
43
|
{
|