@orangelogic/design-system 2.106.0 → 2.107.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.106.0",
4
+ "version": "2.107.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -0,0 +1,6 @@
1
+ export type CxGalleryLightboxHideEvent = CustomEvent<Record<PropertyKey, unknown>>;
2
+ declare global {
3
+ interface GlobalEventHandlersEventMap {
4
+ 'cx-gallery-lightbox-hide': CxGalleryLightboxHideEvent;
5
+ }
6
+ }
@@ -0,0 +1,6 @@
1
+ export type CxGalleryLightboxShowEvent = CustomEvent<Record<PropertyKey, unknown>>;
2
+ declare global {
3
+ interface GlobalEventHandlersEventMap {
4
+ 'cx-gallery-lightbox-show': CxGalleryLightboxShowEvent;
5
+ }
6
+ }
@@ -84,6 +84,8 @@ export * from './cx-gallery-item-move-left';
84
84
  export * from './cx-gallery-item-move-right';
85
85
  export * from './cx-gallery-item-open-config';
86
86
  export * from './cx-gallery-item-select';
87
+ export * from './cx-gallery-lightbox-hide';
88
+ export * from './cx-gallery-lightbox-show';
87
89
  export * from './cx-hide';
88
90
  export * from './cx-hover';
89
91
  export * from './cx-hub-connection-disconnected';
@@ -30,6 +30,7 @@ export default class CxAssetDataDisplay extends CortexElement {
30
30
  position: AssetDataDisplayPosition;
31
31
  fetchMode: AssetDataDisplayFetchMode;
32
32
  token: string;
33
+ cms5Token: string;
33
34
  recordId: string;
34
35
  headerSourceField: string;
35
36
  detailsSourceField: string;
@@ -269,6 +269,7 @@ export default class CxConfigForm extends CortexElement {
269
269
  showTemplateTab: boolean;
270
270
  dialogTitle: string;
271
271
  skipShowCheck: boolean;
272
+ enableAssetFormatControls: boolean;
272
273
  /**
273
274
  * The currently selected tab in the configuration manager.
274
275
  * This is used to switch between different tabs in the configuration manager.
@@ -4,6 +4,7 @@ import { LocalizeController } from '../../../../utils/src/custom-element/i18n';
4
4
  import { Component, ComponentDefinition, ComponentView, ComponentViewDefinition, Editor } from 'grapesjs';
5
5
 
6
6
  export type EditorPluginOptions = {
7
+ enableAssetFormatControls?: boolean;
7
8
  localize: LocalizeController;
8
9
  multiLanguage?: boolean;
9
10
  toolbarConfigs?: ToolbarConfiguration;
@@ -128,6 +128,7 @@ export default class StyleController {
128
128
  accepts?: string[];
129
129
  multiple?: boolean;
130
130
  nameKey?: string;
131
+ recordIdKey?: string;
131
132
  representativeKey?: string;
132
133
  };
133
134
  radioGroupConfigs?: {
@@ -27,7 +27,7 @@ export declare const SEARCH_FIELDS: {
27
27
  ORIGINAL_VIEW_SIZE: string;
28
28
  };
29
29
  export declare function resolveAssetExtraFilters(selectedFacets?: Record<string, string[]>): Record<string, string[]>;
30
- export declare function apiSearchAssets({ countPerPage, fields, getPermanentAssetsPaths, pageNumber, query, siteUrl, sort, token, useSession, }: SearchAssetsParams): Promise<SearchAssetsResponse>;
30
+ export declare function apiSearchAssets({ cms5Token, countPerPage, fields, getPermanentAssetsPaths, pageNumber, query, siteUrl, sort, token, useSession, }: SearchAssetsParams): Promise<SearchAssetsResponse>;
31
31
  export declare function apiGetTransformAssetLink({ assetId, extension, format, siteUrl, token, transformations, useSession, }: {
32
32
  assetId: string;
33
33
  extension?: string;
@@ -37,8 +37,8 @@ export declare function apiGetTransformAssetLink({ assetId, extension, format, s
37
37
  transformations?: string;
38
38
  useSession?: string;
39
39
  }): Promise<GetTransformAssetLinkResponse | null>;
40
- export declare function apiGetAssets({ extraFields, getPermanentAssetsPaths, recordIds, token, }: GetAssetsRequest): Promise<GetAssetsResponse>;
41
- export declare function apiGetAssetsInFolder({ countPerPage, extraFields, getPermanentAssetsPaths, limitedDocTypes, pageNumber, parentFolderIdentifier, searchTerm, sortOrder, token, }: GetAssetsInFolderRequest): Promise<GetAssetsInFolderResponse>;
40
+ export declare function apiGetAssets({ cms5Token, extraFields, getPermanentAssetsPaths, recordIds, token, }: GetAssetsRequest): Promise<GetAssetsResponse>;
41
+ export declare function apiGetAssetsInFolder({ cms5Token, countPerPage, extraFields, getPermanentAssetsPaths, limitedDocTypes, pageNumber, parentFolderIdentifier, searchTerm, sortOrder, token, }: GetAssetsInFolderRequest): Promise<GetAssetsInFolderResponse>;
42
42
  export declare function apiGetCropFocusMode({ autoCropMode, cropHeight, cropWidth, imageUrl, useSession, }: GetCropZoneSuggestionRequest): Promise<GetCropZoneSuggestionResponse | null>;
43
43
  export declare function apiGetAvailableProxies({ assetRecordId, siteUrl, token, useSession, }: {
44
44
  assetRecordId: string;
@@ -4,7 +4,8 @@ export declare class FetchAssetController implements ReactiveController {
4
4
  private readonly host;
5
5
  private data;
6
6
  constructor(host: ReactiveElement);
7
- fetchAssetByID({ extraFields, recordId, token, }: {
7
+ fetchAssetByID({ cms5Token, extraFields, recordId, token, }: {
8
+ cms5Token?: string;
8
9
  extraFields?: string[];
9
10
  recordId: string;
10
11
  token?: string;
@@ -6,6 +6,7 @@ export type ExtendedGalleryItem = GalleryItem & {
6
6
  [key: string]: string | undefined;
7
7
  };
8
8
  type FetchImageControllerOptions = {
9
+ cms5Token?: string;
9
10
  maxEnd?: number;
10
11
  pageSize?: number;
11
12
  token?: string;
@@ -21,6 +22,7 @@ export declare class FetchImageController implements ReactiveController {
21
22
  private maxEnd;
22
23
  private pageSize;
23
24
  private readonly authToken;
25
+ private readonly cms5Token;
24
26
  constructor(host: ReactiveElement, options?: FetchImageControllerOptions);
25
27
  get totalDataCount(): number;
26
28
  fetchImages({ end, extraFields, format, start, transformations, }: {
@@ -136,7 +136,10 @@ export type PropertyConfig<T = Record<string, any>> = Omit<TraitProperties, 'opt
136
136
  pickerConfigs?: {
137
137
  accepts?: string[];
138
138
  multiple?: boolean;
139
+ /** The block-attribute key that stores the asset name. Defaults to 'name'. */
139
140
  nameKey?: string;
141
+ /** The block-attribute key that stores the selected asset's record ID. Defaults to 'record-id'. */
142
+ recordIdKey?: string;
140
143
  representativeKey?: string;
141
144
  };
142
145
  placeholder?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.106.0",
4
+ "version": "2.107.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -1,437 +0,0 @@
1
- import { h as l, S as B, A as w, a as K, b as $ } from "./endpoints.DBlquU2-.js";
2
- import { M as R } from "./asset-link-format.B0c92pSs.js";
3
- import "./debounce.CIEhztrj.js";
4
- import "./lit-element.jLBm65_O.js";
5
- import "./form.Ch1cwYzO.js";
6
- import "./i18n.DmmFsjwP.js";
7
- import { a as q } from "./string.DUgD4c9f.js";
8
- import "./content-builder.B-bd8FaV.js";
9
- import "./unsafe-html.Dff7-rCx.js";
10
- import { b as V } from "./_baseUniq.HFKneygy.js";
11
- function Z(e) {
12
- return e && e.length ? V(e) : [];
13
- }
14
- function X(e) {
15
- return typeof e == "object" && e !== null && "URI" in e;
16
- }
17
- const z = {
18
- artist: "Artist",
19
- color: "Color",
20
- createDate: "CreateDate",
21
- docSubType: "DocSubType",
22
- docType: "DocType",
23
- editDate: "EditDate",
24
- fileExtension: "Fileextension",
25
- keyword: "Keyword",
26
- mediaDate: "MediaDate",
27
- mediaNumber: "MediaNumber",
28
- nativeKeyword: "NativeKeyword",
29
- orientation: "Orientation",
30
- parentFolderIdentifier: "ParentFolderIdentifier",
31
- path: "Path",
32
- photographer: "Photographer",
33
- purpose: "Purpose",
34
- recordId: "RecordID",
35
- systemIdentifier: "SystemIdentifier",
36
- text: "Text",
37
- title: "Title"
38
- }, Y = /* @__PURE__ */ new Set(["mediaDate", "createDate", "editDate"]);
39
- function Q(e) {
40
- return !/[\s&+/*"\\:(),'<>~|[\]{}]/.test(e) && !/^(?:OR|AND|NOT)$/.test(e) ? e : `"${e.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
41
- }
42
- function O(e, t) {
43
- const o = (Array.isArray(t) ? t : [t]).map((s) => `${e}:${Q(s)}`);
44
- return o.length > 1 ? `(${o.join(" OR ")})` : o[0] ?? "";
45
- }
46
- function J(e, t) {
47
- return (Array.isArray(t) ? t : [t]).map((o) => `${e}${o.operator}${o.value}`).join(" AND ");
48
- }
49
- function ee(e) {
50
- const t = [];
51
- for (const r of Object.keys(e)) {
52
- const o = r, s = e[o];
53
- if (s == null)
54
- continue;
55
- if (o === "custom") {
56
- for (const [a, p] of Object.entries(
57
- s
58
- ))
59
- t.push(O(a, p));
60
- continue;
61
- }
62
- const u = z[o];
63
- if (u) {
64
- if (Y.has(o)) {
65
- t.push(
66
- J(u, s)
67
- );
68
- continue;
69
- }
70
- if (o === "color") {
71
- t.push(`${u}:${s}`);
72
- continue;
73
- }
74
- t.push(O(u, s));
75
- }
76
- }
77
- return t.join(" AND ");
78
- }
79
- function _(e) {
80
- if ("and" in e)
81
- return e.and.map(_).filter(Boolean).join(" AND ");
82
- if ("or" in e) {
83
- const t = e.or.map(_).filter(Boolean);
84
- return t.length > 1 ? `(${t.join(" OR ")})` : t[0] ?? "";
85
- }
86
- if ("not" in e) {
87
- const t = _(e.not);
88
- return t ? `NOT (${t})` : "";
89
- }
90
- return ee(e);
91
- }
92
- const L = "CoreField.LargeSizePreview", P = "CoreField.DocType", te = "Document.Title", re = "Document.CaptionLong", b = "Document.FileExtension", G = "CoreField.FileSize", M = "CoreField.Identifier", U = "CoreField.Keywords", j = "CoreField.MaxHeight", v = "CoreField.MaxWidth", D = "Document.RecordID", W = "CoreField.DocSubType", H = "CoreField.TitleWithFallback", T = "CoreField.OriginalFileName", y = "CoreField.UpdatedFileName", E = "CoreField.OriginalPreview", F = {
93
- DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
94
- FIELD_TITLE_WITH_FALLBACK: "Document.TitleWithFallback",
95
- ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
96
- }, k = {
97
- [L]: F.DEFAULT_VIEW_SIZE,
98
- [H]: F.FIELD_TITLE_WITH_FALLBACK,
99
- [E]: F.ORIGINAL_VIEW_SIZE
100
- }, oe = Object.fromEntries(
101
- Object.entries(k).map(([e, t]) => [
102
- t,
103
- e
104
- ])
105
- );
106
- function ne(e) {
107
- return k[e] ?? e;
108
- }
109
- function se(e) {
110
- const t = {};
111
- for (const [r, o] of Object.entries(e)) {
112
- const s = oe[r] ?? r;
113
- t[s] = o;
114
- }
115
- return t;
116
- }
117
- async function x({
118
- countPerPage: e,
119
- fields: t,
120
- getPermanentAssetsPaths: r,
121
- pageNumber: o,
122
- query: s,
123
- siteUrl: u,
124
- sort: a,
125
- token: p,
126
- useSession: m
127
- }) {
128
- const I = t?.map(ne);
129
- try {
130
- return (await l.request({
131
- baseURL: u,
132
- method: "GET",
133
- params: {
134
- CountPerPage: e,
135
- Fields: Z(I),
136
- Format: "json",
137
- GetPermanentAssetsPaths: r || void 0,
138
- PageNumber: o,
139
- Query: _(s),
140
- Sort: a || void 0,
141
- Token: p || void 0,
142
- UseSession: m || void 0
143
- },
144
- paramsSerializer: { indexes: null },
145
- responseType: "json",
146
- transformResponse: [
147
- ...Array.isArray(l.defaults.transformResponse) ? l.defaults.transformResponse : [],
148
- (n) => ({
149
- items: (n.APIResponse?.Items ?? []).map(se),
150
- sort: n.APIResponse?.GlobalInfo?.Sort ?? "",
151
- totalCount: n.APIResponse?.GlobalInfo?.TotalCount ?? 0
152
- })
153
- ],
154
- url: B["4.0"]
155
- })).data;
156
- } catch {
157
- return { items: [], sort: "", totalCount: 0 };
158
- }
159
- }
160
- async function _e({
161
- assetId: e,
162
- extension: t,
163
- format: r,
164
- siteUrl: o,
165
- token: s,
166
- transformations: u,
167
- useSession: a
168
- }) {
169
- try {
170
- return (await l.request({
171
- baseURL: o,
172
- method: "GET",
173
- params: {
174
- SourceAssetFormat: r,
175
- SourceAssetRecordID: e,
176
- TargetExtension: q(t),
177
- Token: s || void 0,
178
- Transformations: u,
179
- UseSession: a || void 0
180
- },
181
- /**
182
- * https://link.orangelogic.com/Tasks/41S1XH
183
- */
184
- timeout: 3e5,
185
- // 5 minutes
186
- url: w.GET_TRANSFORM_ASSET_LINK
187
- })).data;
188
- } catch {
189
- return null;
190
- }
191
- }
192
- const ae = 50;
193
- function ie(e, t) {
194
- const r = [];
195
- for (let o = 0; o < e.length; o += t)
196
- r.push(e.slice(o, o + t));
197
- return r;
198
- }
199
- async function De({
200
- extraFields: e,
201
- getPermanentAssetsPaths: t,
202
- recordIds: r,
203
- token: o
204
- }) {
205
- if (!Array.isArray(r) || r.length === 0)
206
- return { facets: [], items: [], totalCount: 0 };
207
- const s = e?.filter((n) => n && typeof n == "string") ?? [], u = [
208
- ...s,
209
- E,
210
- y,
211
- T,
212
- te,
213
- re,
214
- D
215
- ], a = ie(r, ae), p = await Promise.all(
216
- a.map(
217
- (n) => x({
218
- countPerPage: n.length,
219
- fields: u,
220
- getPermanentAssetsPaths: t,
221
- pageNumber: 1,
222
- query: { recordId: n },
223
- token: o
224
- })
225
- )
226
- ), m = new Map(r.map((n, d) => [n, d])), I = p.flatMap((n) => n.items).map((n) => {
227
- let d = c(n, y);
228
- return d === "" && (d = c(n, T)), {
229
- name: d,
230
- originalUrl: c(n, E),
231
- recordId: c(n, D),
232
- ...s.reduce(
233
- (i, f) => (i[f] = c(n, f), i),
234
- {}
235
- )
236
- };
237
- }).sort(
238
- (n, d) => (m.get(n.recordId) ?? 1 / 0) - (m.get(d.recordId) ?? 1 / 0)
239
- ), A = p.reduce(
240
- (n, d) => n + d.totalCount,
241
- 0
242
- );
243
- return { facets: [], items: I, totalCount: A };
244
- }
245
- function c(e, t) {
246
- const r = e[t];
247
- return r == null ? "" : typeof r == "string" ? r : typeof r == "number" || typeof r == "boolean" ? String(r) : X(r) ? r.URI : "";
248
- }
249
- async function Te({
250
- countPerPage: e,
251
- extraFields: t,
252
- getPermanentAssetsPaths: r,
253
- limitedDocTypes: o,
254
- pageNumber: s,
255
- parentFolderIdentifier: u,
256
- searchTerm: a,
257
- sortOrder: p,
258
- token: m
259
- }) {
260
- if (!u)
261
- return { facets: [], items: [], totalCount: 0 };
262
- const I = (t?.filter((i) => i && typeof i == "string") ?? []).map((i) => i.replace("%20", " ")), A = {
263
- parentFolderIdentifier: u,
264
- ...o.length > 0 ? { docType: [R.Image, R.Audio] } : {}
265
- }, n = await x({
266
- countPerPage: e,
267
- fields: [
268
- ...I,
269
- H,
270
- L,
271
- E,
272
- U,
273
- v,
274
- j,
275
- G,
276
- P,
277
- W,
278
- M,
279
- b,
280
- D,
281
- T,
282
- y
283
- ],
284
- getPermanentAssetsPaths: r,
285
- pageNumber: s,
286
- query: A,
287
- sort: void 0,
288
- token: m
289
- }), d = n.items.map((i) => {
290
- let f = c(i, b), h = c(i, y), S = c(i, L);
291
- f && !f.startsWith(".") && (f = "." + f), h === "" && (h = c(i, T)), f.toLowerCase() === ".gif" && (S = c(i, E));
292
- const C = c(i, D);
293
- return {
294
- docSubType: c(i, W),
295
- docType: c(i, P) || "",
296
- extension: f,
297
- height: c(i, j) || "0",
298
- id: C,
299
- identifier: c(i, M),
300
- imageUrl: S,
301
- name: h,
302
- originalUrl: c(i, E),
303
- recordId: C,
304
- size: c(i, G) || "0 MB",
305
- tags: c(i, U),
306
- width: c(i, v) || "0",
307
- ...I.reduce(
308
- (g, N) => (g[N] = c(i, N), g),
309
- {}
310
- )
311
- };
312
- });
313
- return {
314
- facets: [],
315
- items: d,
316
- totalCount: n.totalCount
317
- };
318
- }
319
- async function ye({
320
- autoCropMode: e,
321
- cropHeight: t,
322
- cropWidth: r,
323
- imageUrl: o,
324
- useSession: s
325
- }) {
326
- try {
327
- return (await l.request({
328
- method: "GET",
329
- params: {
330
- AutoCropMode: e,
331
- CropHeight: t,
332
- CropWidth: r,
333
- ImageUrl: o && new URL(o, window.location.origin).href,
334
- UseSession: s || void 0
335
- },
336
- responseType: "json",
337
- timeout: 3e5,
338
- // 5 minutes
339
- transformResponse: [
340
- ...Array.isArray(l.defaults.transformResponse) ? l.defaults.transformResponse : [],
341
- (a) => ({
342
- height: a.cropHeight,
343
- width: a.cropWidth,
344
- x: a.cropX,
345
- y: a.cropY
346
- })
347
- ],
348
- url: w.GET_CROP_ZONE_SUGGESTION
349
- })).data;
350
- } catch {
351
- return null;
352
- }
353
- }
354
- async function he({
355
- assetRecordId: e,
356
- siteUrl: t,
357
- token: r,
358
- useSession: o
359
- }) {
360
- try {
361
- return (await l.request({
362
- baseURL: t,
363
- method: "GET",
364
- params: {
365
- RecordId: e,
366
- Token: r,
367
- UseSession: o || void 0
368
- },
369
- responseType: "json",
370
- transformResponse: [
371
- ...Array.isArray(l.defaults.transformResponse) ? l.defaults.transformResponse : [],
372
- (u) => !u || typeof u != "object" ? [] : u.proxies?.map((a) => ({
373
- cdnName: a.cdnName,
374
- extension: a.extension,
375
- formatHeight: a.formatHeight,
376
- formatWidth: a.formatWidth,
377
- height: a.height,
378
- permanentLink: a.permanentLink,
379
- proxyLabel: a.proxyLabel,
380
- proxyName: a.proxyName,
381
- width: a.width
382
- })) ?? []
383
- ],
384
- url: $
385
- })).data;
386
- } catch {
387
- return [];
388
- }
389
- }
390
- async function Fe({
391
- siteUrl: e
392
- } = {}) {
393
- try {
394
- return (await l.request({
395
- baseURL: e,
396
- method: "GET",
397
- responseType: "json",
398
- transformResponse: [
399
- ...Array.isArray(l.defaults.transformResponse) ? l.defaults.transformResponse : [],
400
- (r) => !r || typeof r != "object" ? {
401
- formatsByDocType: {
402
- Audio: {},
403
- Image: {},
404
- Multimedia: {},
405
- Video: {}
406
- }
407
- } : {
408
- formatsByDocType: r.formatsByDocType ?? {}
409
- }
410
- ],
411
- url: K
412
- })).data;
413
- } catch {
414
- return { formatsByDocType: {} };
415
- }
416
- }
417
- export {
418
- L as D,
419
- D as F,
420
- E as O,
421
- De as a,
422
- _e as b,
423
- ye as c,
424
- Fe as d,
425
- x as e,
426
- Te as f,
427
- j as g,
428
- v as h,
429
- X as i,
430
- P as j,
431
- b as k,
432
- M as l,
433
- he as m,
434
- G as n,
435
- W as o,
436
- Z as u
437
- };