@wix/himalaya-cli 0.1036.0 → 0.1038.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 (117) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/genie-chat/src/index.d.ts +119 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/portfolio/src/index.d.ts +46 -9
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-genie-chat.mjs +51 -1
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-portfolio.mjs +14 -2
  5. package/dist/cli.mjs +1323 -492
  6. package/dist/preview-assets.generated.bin +0 -0
  7. package/fixtures/wix-canned.json +51 -2
  8. package/guides/headless-loop.md +7 -0
  9. package/guides/himi-test.md +66 -1
  10. package/guides/sdk-reference.json +90 -12
  11. package/guides/trim-a-template.md +5 -0
  12. package/guides/wix-business-context.md +13 -1
  13. package/guides/wix-site-to-himi-app.md +10 -1
  14. package/package.json +2 -2
  15. package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +14 -8
  16. package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +12 -1
  17. package/templates/beauty-salon-owner/dev/index.ts +2148 -1262
  18. package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +338 -26
  19. package/templates/beauty-salon-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  20. package/templates/beauty-salon-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  21. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  22. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  23. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  24. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  25. package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +14 -8
  26. package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +12 -1
  27. package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio/index.ts +2 -2
  28. package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio-project/index.ts +3 -3
  29. package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +12 -1
  30. package/templates/community-club-owner/dev/index.ts +2151 -1265
  31. package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +338 -26
  32. package/templates/community-club-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  33. package/templates/community-club-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  34. package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  35. package/templates/community-club-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  36. package/templates/community-club-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  37. package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +12 -1
  38. package/templates/events-meetups-owner/dev/index.ts +2151 -1265
  39. package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +338 -26
  40. package/templates/events-meetups-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  41. package/templates/events-meetups-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  42. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  43. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  44. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  45. package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +14 -8
  46. package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +12 -1
  47. package/templates/gym-fitness-owner/dev/index.ts +2148 -1262
  48. package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +338 -26
  49. package/templates/gym-fitness-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  50. package/templates/gym-fitness-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  51. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  52. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  53. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  54. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  55. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +12 -1
  56. package/templates/nonprofit-cause-owner/dev/index.ts +2148 -1262
  57. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +338 -26
  58. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  59. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  60. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  61. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  62. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  63. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  64. package/templates/owner-lite/dev/index.ts +2145 -1259
  65. package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +338 -26
  66. package/templates/owner-lite/tier5-src/_shared/aria-mentions.ts +202 -0
  67. package/templates/owner-lite/tier5-src/_shared/owner-module-data.ts +2 -2
  68. package/templates/owner-lite/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  69. package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  70. package/templates/owner-lite/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  71. package/templates/owner-lite/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  72. package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +12 -1
  73. package/templates/podcast-creator-owner/dev/index.ts +2151 -1265
  74. package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +338 -26
  75. package/templates/podcast-creator-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  76. package/templates/podcast-creator-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  77. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  78. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  79. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  80. package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +12 -1
  81. package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio/index.ts +2 -2
  82. package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio-project/index.ts +3 -3
  83. package/templates/portfolio-creative-owner/dev/index.ts +2148 -1262
  84. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +338 -26
  85. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  86. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  87. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  88. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  89. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  90. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  91. package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +12 -1
  92. package/templates/restaurant-owner/dev/index.ts +2148 -1262
  93. package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +338 -26
  94. package/templates/restaurant-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  95. package/templates/restaurant-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  96. package/templates/restaurant-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  97. package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  98. package/templates/restaurant-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  99. package/templates/restaurant-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  100. package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +12 -1
  101. package/templates/retail-store-owner/dev/index.ts +2151 -1265
  102. package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +338 -26
  103. package/templates/retail-store-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  104. package/templates/retail-store-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  105. package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  106. package/templates/retail-store-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  107. package/templates/retail-store-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
  108. package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +14 -8
  109. package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +12 -1
  110. package/templates/yoga-studio-owner/dev/index.ts +2148 -1262
  111. package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +338 -26
  112. package/templates/yoga-studio-owner/tier5-src/_shared/aria-mentions.ts +202 -0
  113. package/templates/yoga-studio-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  114. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  115. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  116. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-ask/index.ts +6 -0
  117. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-manage/index.ts +64 -6
@@ -55,6 +55,12 @@ export interface ConversationMessage {
55
55
  attachments?: Attachment[];
56
56
  /** Client tools this assistant turn asks the CALLER to run — see `FunctionCall`. */
57
57
  functionCalls?: FunctionCall[];
58
+ /** What the owner attached to this turn — a mentioned product, contact,
59
+ * page — stored by the service BESIDE the text rather than inside it. The
60
+ * transcript echoes them back under this key (the `wix.genie.v1` message
61
+ * entity's `references`), which is the only way a reloaded conversation
62
+ * can still say what a turn was about. */
63
+ references?: MessageReference[];
58
64
  }
59
65
  /** A file on a message — the service's `Attachment` entity.
60
66
  *
@@ -112,6 +118,40 @@ export interface FunctionCallResult {
112
118
  /** A JSON-ENCODED object carrying the tool's structured answer. */
113
119
  widgetResponse?: string;
114
120
  }
121
+ /** One reference riding on a user turn (`messageReferences` on the persist
122
+ * call, `references` on the stored message).
123
+ *
124
+ * Field meanings are the chat-service's own, from the
125
+ * `@wix/ambassador-genie-chat-service-v1-no-entity` `MessageReference` type the
126
+ * native Aria app sends: `data` is the context handed to the model, `source`
127
+ * a low-cardinality feature tag, and `type` how a client renders it
128
+ * ("inline" | "global" | "hidden"). Build a mention's with `mentionReference`
129
+ * rather than by hand, so the one shape the service is known to accept is
130
+ * spelled in one place. */
131
+ export interface MessageReference {
132
+ id?: string;
133
+ /** Shown to the owner (a chip label). */
134
+ label?: string;
135
+ /** The context the assistant receives — for a mention, a JSON string
136
+ * `{"id":…,"type":…}` naming the item and its category. */
137
+ data?: string;
138
+ /** Feature tag, e.g. "mention". */
139
+ source?: string;
140
+ /** Render scope, e.g. "global" — a chip above the text, not a token in it. */
141
+ type?: string;
142
+ }
143
+ /** A mention of one item, in the exact shape the native Aria app sends: a
144
+ * `global` reference (a chip, not a token in the text) whose `data` names the
145
+ * item and the category it came from.
146
+ *
147
+ * `category` is the category's ENGLISH label ("Products", "Contacts") — it is
148
+ * what the model reads, so it is not localized. Newlines in the label are
149
+ * folded to spaces; `JSON.stringify` does the escaping the native client does
150
+ * by hand. */
151
+ export declare function mentionReference(item: {
152
+ id: string;
153
+ title: string;
154
+ }, category: string): MessageReference;
115
155
  /** Which assistant the conversation talks to. The real dashboard sends a
116
156
  * `unifiedAssistantReference`; helper `ariaAssistantConfig()` builds it. */
117
157
  export interface AssistantConfig {
@@ -200,6 +240,10 @@ export interface SendMessageOptions {
200
240
  enforceAccountScopedConversations?: boolean;
201
241
  /** Tag the turn with the same origin the conversation was created under. */
202
242
  origin?: string;
243
+ /** References stored WITH the turn (step 1 only — the trigger names a turn
244
+ * that already carries them). Omitted, the persist call sends `[]`, which is
245
+ * what it always sent. */
246
+ messageReferences?: MessageReference[];
203
247
  /** Files already UPLOADED (see `createFileUpload`) to store with the turn.
204
248
  * Rides step 1 only — the trigger names the stored turn, which carries them. */
205
249
  attachments?: Attachment[];
@@ -294,6 +338,81 @@ export declare function genieUploadRef(id: string | undefined): string;
294
338
  export declare function uploadTargetUrl(uploadUrl: string, fileName: string): string;
295
339
  /** Fetch the messages of a conversation (poll after sendMessage). */
296
340
  export declare function getConversationMessages(conversationId: string): Promise<GetConversationMessagesResponse>;
341
+ /** How a provider pages its items. Any other value, or none, means unpaged:
342
+ * `providersOf` reports it as "NONE" and such a provider is asked for one
343
+ * page with no paging block. */
344
+ export type ItemsPaginationMode = "CURSOR" | "OFFSET" | "UNKNOWN_PAGINATION_MODE";
345
+ /** An installed item provider. Only the fields a picker needs are typed. */
346
+ export interface ItemsSelectionProvider {
347
+ /** The handle `queryItems` is addressed by. */
348
+ key?: string;
349
+ appId?: string;
350
+ contentData?: {
351
+ providerName?: string;
352
+ iconKey?: string;
353
+ title?: string;
354
+ };
355
+ paginationMode?: ItemsPaginationMode | string;
356
+ }
357
+ export interface ListInstalledProvidersResponse {
358
+ providers?: ItemsSelectionProvider[];
359
+ }
360
+ /** One item a provider returned. */
361
+ export interface ItemsSelectionItem {
362
+ id?: string;
363
+ name?: string;
364
+ description?: string;
365
+ image?: {
366
+ url?: string;
367
+ };
368
+ /** Additional information, e.g. a price. */
369
+ note?: string;
370
+ }
371
+ export interface QueryItemsResponse {
372
+ items?: ItemsSelectionItem[];
373
+ pagingMetadata?: {
374
+ hasNext?: boolean;
375
+ cursors?: {
376
+ next?: string;
377
+ };
378
+ };
379
+ }
380
+ /** The query `queryItems` sends. Set `cursorPaging` OR `paging` to match the
381
+ * provider's `paginationMode`, or neither for an unpaged provider. */
382
+ export interface ItemsQuery {
383
+ search?: string;
384
+ paging?: {
385
+ limit: number;
386
+ offset?: number;
387
+ };
388
+ cursorPaging?: {
389
+ limit: number;
390
+ cursor?: string;
391
+ };
392
+ }
393
+ /** The item providers installed on the CURRENT site — the categories a mention
394
+ * picker offers. The site is the one whose signed instance authorizes the
395
+ * call, so a caller that can switch business must re-list after a switch. */
396
+ export declare function listInstalledProviders(): Promise<ListInstalledProvidersResponse>;
397
+ /** Query one provider's items. `providerKey` is a provider's `key`, never its
398
+ * display name. */
399
+ export declare function queryItems(providerKey: string, query?: ItemsQuery): Promise<QueryItemsResponse>;
400
+ /** The provider list from a `listInstalledProviders` response, with every
401
+ * entry that has no key or no name dropped — neither can be offered or
402
+ * queried. */
403
+ export declare function providersOf(res: ListInstalledProvidersResponse | null | undefined): Array<{
404
+ key: string;
405
+ name: string;
406
+ paging: "CURSOR" | "OFFSET" | "NONE";
407
+ }>;
408
+ /** The items from a `queryItems` response, with every entry that has no id or
409
+ * no name dropped — an item with neither cannot be referenced or shown. */
410
+ export declare function itemsOf(res: QueryItemsResponse | null | undefined): Array<{
411
+ id: string;
412
+ title: string;
413
+ subtitle: string;
414
+ imageUrl: string;
415
+ }>;
297
416
  /** The transcript from a getConversationMessages response, under either key. */
298
417
  export declare function messagesOf(res: GetConversationMessagesResponse | null | undefined): ConversationMessage[];
299
418
  /** The id of the user turn a send response stored, or "" when the service did
@@ -5,12 +5,36 @@ declare global {
5
5
  };
6
6
  };
7
7
  }
8
+ /** A Wix Portfolio media image — a project / collection cover or a project item's image. */
9
+ export interface WixMediaImage {
10
+ type?: string;
11
+ imageInfo?: {
12
+ id?: string;
13
+ url?: string;
14
+ width?: number;
15
+ height?: number;
16
+ };
17
+ }
18
+ /**
19
+ * The Wix media reference of a Portfolio cover or item image — its `imageInfo.url`, else
20
+ * its `imageInfo.id` — for `wixMediaUrl` to resolve and size. `""` when there is none.
21
+ * A bare string is still accepted, so a cover stored as a url string keeps rendering.
22
+ *
23
+ * @example
24
+ * const image = wixMediaUrl(portfolioCoverRef(project.coverImage));
25
+ */
26
+ export declare function portfolioCoverRef(cover: WixMediaImage | string | null | undefined): string;
8
27
  export interface WixPortfolioProject {
9
28
  id: string;
10
29
  title?: string;
11
30
  description?: string;
12
- /** Project cover. coverImage is a Wix media url/id. */
13
- coverImage?: string;
31
+ /**
32
+ * Project cover. The live wire shape is a media OBJECT
33
+ * (`{type:"WIX_MEDIA", imageInfo:{id,url,width,height}}`), not a url string —
34
+ * read it with {@link portfolioCoverRef}; `wixMediaUrl` returns `""` for the object.
35
+ * A url string is still accepted, for projects constructed by hand.
36
+ */
37
+ coverImage?: WixMediaImage | string;
14
38
  slug?: string;
15
39
  hidden?: boolean;
16
40
  createdDate?: string;
@@ -28,12 +52,6 @@ export interface WixListProjectsResponse {
28
52
  }
29
53
  /** GET /portfolio/v1/projects — list projects (paged). */
30
54
  export declare function listProjects(limit?: number, cursor?: string): Promise<WixListProjectsResponse>;
31
- export interface WixMediaImage {
32
- imageInfo?: {
33
- id?: string;
34
- url?: string;
35
- };
36
- }
37
55
  export interface WixPortfolioCollection {
38
56
  id: string;
39
57
  title?: string;
@@ -72,6 +90,10 @@ export interface WixPortfolioProjectItem {
72
90
  }
73
91
  export interface WixListProjectItemsResponse {
74
92
  items?: WixPortfolioProjectItem[];
93
+ /**
94
+ * Paging, under the name this function always documented. A Wix query reports it as
95
+ * `metadata`; {@link listProjectItems} copies that here when `pagingMetadata` is absent.
96
+ */
75
97
  pagingMetadata?: {
76
98
  count?: number;
77
99
  cursors?: {
@@ -79,6 +101,21 @@ export interface WixListProjectItemsResponse {
79
101
  };
80
102
  hasNext?: boolean;
81
103
  };
104
+ /** The query endpoint's own name for the paging block. */
105
+ metadata?: {
106
+ count?: number;
107
+ cursors?: {
108
+ next?: string;
109
+ };
110
+ hasNext?: boolean;
111
+ };
82
112
  }
83
- /** GET /portfolio/v1/projects/{projectId}/items — list a project's items. */
113
+ /**
114
+ * POST /portfolio/v1/items/query — list a project's items.
115
+ *
116
+ * A first page filters on `projectId` with `paging.limit`. Passing a `cursor` (a previous
117
+ * page's `pagingMetadata.cursors.next`) switches to `cursorPaging` and drops the filter,
118
+ * because a Wix query cursor already carries it. Items come back in the order Wix returns
119
+ * them — sort on `sortOrder` for the author's order.
120
+ */
84
121
  export declare function listProjectItems(projectId: string, limit?: number, cursor?: string): Promise<WixListProjectItemsResponse>;
@@ -23,6 +23,15 @@ function wixCall(method, path, body) {
23
23
  }
24
24
  );
25
25
  }
26
+ function mentionReference(item, category) {
27
+ return {
28
+ id: item.id,
29
+ label: item.title.split(/\r?\n/).join(" ").trim(),
30
+ data: JSON.stringify({ id: item.id, type: category }),
31
+ source: "mention",
32
+ type: "global"
33
+ };
34
+ }
26
35
  function ariaAssistantConfig(unifiedAssistantId = ARIA_UNIFIED_ASSISTANT_ID) {
27
36
  return { unifiedAssistantReference: { type: "unified-assistant", unifiedAssistantId } };
28
37
  }
@@ -37,7 +46,7 @@ function conversationUserMessage(conversationId, content, opts = {}) {
37
46
  if (!conversationId) throw new Error("conversationUserMessage: conversationId is required");
38
47
  return wixCall("POST", `${BASE}/conversation-user-message`, {
39
48
  attachments: opts.attachments ?? [],
40
- messageReferences: [],
49
+ messageReferences: opts.messageReferences ?? [],
41
50
  userMessageContent: content,
42
51
  origin: opts.origin ?? ARIA_ORIGIN,
43
52
  conversationId,
@@ -147,6 +156,42 @@ function getConversationMessages(conversationId) {
147
156
  if (!conversationId) throw new Error("getConversationMessages: conversationId is required");
148
157
  return wixCall("GET", `${BASE}/conversation-messages?conversationId=${encodeURIComponent(conversationId)}`);
149
158
  }
159
+ var ITEMS_SELECTION_BASE = "https://manage.wix.com/_api/items-selection-service/v1/items-selection";
160
+ function listInstalledProviders() {
161
+ return wixCall("GET", `${ITEMS_SELECTION_BASE}/installed-providers`);
162
+ }
163
+ function queryItems(providerKey, query = {}) {
164
+ if (!providerKey) throw new Error("queryItems: providerKey is required");
165
+ return wixCall(
166
+ "POST",
167
+ `${ITEMS_SELECTION_BASE}/${encodeURIComponent(providerKey)}/items`,
168
+ { providerKey, query }
169
+ );
170
+ }
171
+ function providersOf(res) {
172
+ const out = [];
173
+ for (const p of res?.providers ?? []) {
174
+ const key = typeof p?.key === "string" ? p.key.trim() : "";
175
+ const name = typeof p?.contentData?.providerName === "string" ? p.contentData.providerName.trim() : "";
176
+ if (!key || !name) continue;
177
+ const mode = p.paginationMode === "CURSOR" || p.paginationMode === "OFFSET" ? p.paginationMode : "NONE";
178
+ out.push({ key, name, paging: mode });
179
+ }
180
+ return out;
181
+ }
182
+ function itemsOf(res) {
183
+ const out = [];
184
+ for (const it of res?.items ?? []) {
185
+ const id = typeof it?.id === "string" ? it.id.trim() : "";
186
+ const title = typeof it?.name === "string" ? it.name.trim() : "";
187
+ if (!id || !title) continue;
188
+ const description = typeof it.description === "string" ? it.description.trim() : "";
189
+ const note = typeof it.note === "string" ? it.note.trim() : "";
190
+ const imageUrl = typeof it.image?.url === "string" ? it.image.url.trim() : "";
191
+ out.push({ id, title, subtitle: description || note, imageUrl });
192
+ }
193
+ return out;
194
+ }
150
195
  function messagesOf(res) {
151
196
  return res?.messages ?? res?.conversationMessages ?? [];
152
197
  }
@@ -203,9 +248,14 @@ export {
203
248
  getConversationMessages,
204
249
  getConversations,
205
250
  isGenieChatError,
251
+ itemsOf,
206
252
  lastAssistantMessage,
253
+ listInstalledProviders,
254
+ mentionReference,
207
255
  messageText,
208
256
  messagesOf,
257
+ providersOf,
258
+ queryItems,
209
259
  sendFunctionCallResults,
210
260
  sendMessage,
211
261
  triggerAssistantMessage,
@@ -10,6 +10,14 @@ function wixCall(method, path, body) {
10
10
  }
11
11
  return globalThis.himalaya.wixApi.call(method, path, body);
12
12
  }
13
+ function portfolioCoverRef(cover) {
14
+ if (typeof cover === "string") return cover.trim();
15
+ if (!cover || typeof cover !== "object") return "";
16
+ const info = cover.imageInfo;
17
+ const url = typeof info?.url === "string" ? info.url.trim() : "";
18
+ if (url) return url;
19
+ return typeof info?.id === "string" ? info.id.trim() : "";
20
+ }
13
21
  function listProjects(limit = 100, cursor) {
14
22
  return wixCall("GET", `/portfolio/v1/projects?${pagingQuery(limit, cursor)}`);
15
23
  }
@@ -17,11 +25,15 @@ function listCollections(limit = 100, cursor) {
17
25
  return wixCall("GET", `/portfolio/v1/collections?${pagingQuery(limit, cursor)}`);
18
26
  }
19
27
  function listProjectItems(projectId, limit = 100, cursor) {
20
- return wixCall("GET", `/portfolio/v1/projects/${encodeURIComponent(projectId)}/items?${pagingQuery(limit, cursor)}`);
28
+ const query = cursor ? { cursorPaging: { limit, cursor } } : { filter: { projectId }, paging: { limit } };
29
+ return wixCall("POST", "/portfolio/v1/items/query", { query }).then(
30
+ (response) => response && !response.pagingMetadata && response.metadata ? { ...response, pagingMetadata: response.metadata } : response
31
+ );
21
32
  }
22
33
  export {
23
34
  listCollections,
24
35
  listProjectItems,
25
- listProjects
36
+ listProjects,
37
+ portfolioCoverRef
26
38
  };
27
39
  //# sourceMappingURL=wix-portfolio.mjs.map