@useinsider/guido 3.30.0-beta.a94eba0 → 3.30.0-beta.b189780

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.
@@ -2,19 +2,22 @@ import { useHttp as m } from "../composables/useHttp.js";
2
2
  import { useToaster as y } from "../composables/useToaster.js";
3
3
  import { MAX_DEFAULT_TEMPLATE_ID as f } from "../enums/defaults.js";
4
4
  import { useBlankTemplate as g } from "./blankTemplate.js";
5
- const l = () => ({
5
+ const p = () => ({
6
6
  id: 0,
7
7
  stripoId: 0,
8
8
  unsubscriptionPreferencePages: []
9
- }), D = () => {
10
- const { get: s, post: u } = m(), { handleError: r } = y(), { getBlankTemplate: n } = g();
9
+ }), E = () => {
10
+ const { get: s, post: i } = m(), { handleError: r } = y(), { getBlankTemplate: a } = g();
11
11
  return {
12
12
  getToken: async () => {
13
+ var t;
13
14
  try {
14
- const { data: t } = await s("/stripo/get-user-token");
15
- return t.body.token;
16
- } catch (t) {
17
- return r(t, "Failed to fetch token"), "";
15
+ const { data: e } = await s("/stripo/get-user-token"), n = (t = e == null ? void 0 : e.body) == null ? void 0 : t.token;
16
+ if (!n)
17
+ throw new Error("Response carries no token");
18
+ return n;
19
+ } catch (e) {
20
+ return r(e, "Failed to fetch token"), "";
18
21
  }
19
22
  },
20
23
  getCustomFonts: async () => {
@@ -30,13 +33,13 @@ const l = () => ({
30
33
  },
31
34
  getDefaultTemplate: async () => {
32
35
  try {
33
- const t = new URLSearchParams(window.location.search), e = t.get("default-template"), p = t.get("master"), o = e ? parseInt(e) : 0, i = o >= 1 && o <= f ? o : 0;
34
- if (!i && !p)
35
- return await n();
36
- const d = `/stripo/default-template/${i}`, { data: c } = await s(d), a = typeof c == "string" ? JSON.parse(c) : c;
37
- return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? await n() : a;
36
+ const t = new URLSearchParams(window.location.search), e = t.get("default-template"), n = t.get("master"), c = e ? parseInt(e) : 0, l = c >= 1 && c <= f ? c : 0;
37
+ if (!l && !n)
38
+ return await a();
39
+ const d = `/stripo/default-template/${l}`, { data: u } = await s(d), o = typeof u == "string" ? JSON.parse(u) : u;
40
+ return !o || typeof o != "object" || !("html" in o) || !("css" in o) ? await a() : o;
38
41
  } catch (t) {
39
- return r(t, "Failed to fetch default template"), n();
42
+ return r(t, "Failed to fetch default template"), a();
40
43
  }
41
44
  },
42
45
  getSyncModulesStatus: async () => {
@@ -49,7 +52,7 @@ const l = () => ({
49
52
  },
50
53
  updateSyncModule: async (t) => {
51
54
  try {
52
- return await u(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
55
+ return await i(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
53
56
  } catch (e) {
54
57
  return r(e, "Failed to update sync module"), !1;
55
58
  }
@@ -57,16 +60,16 @@ const l = () => ({
57
60
  getSyncModule: async (t) => {
58
61
  try {
59
62
  const { data: e } = await s(`/stripo/stripo-modules/${t}/get`);
60
- return Array.isArray(e == null ? void 0 : e.unsubscriptionPreferencePages) ? e : l();
63
+ return Array.isArray(e == null ? void 0 : e.unsubscriptionPreferencePages) ? e : p();
61
64
  } catch (e) {
62
- return r(e, "Failed to get sync module"), l();
65
+ return r(e, "Failed to get sync module"), p();
63
66
  }
64
67
  },
65
68
  setSyncModuleUnsubscriptionPages: async (t) => {
66
69
  if (t.length === 0)
67
70
  return !0;
68
71
  try {
69
- return await u("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
72
+ return await i("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
70
73
  } catch (e) {
71
74
  return r(e, "Failed to set unsubscription preference pages"), !1;
72
75
  }
@@ -74,5 +77,5 @@ const l = () => ({
74
77
  };
75
78
  };
76
79
  export {
77
- D as useStripoApi
80
+ E as useStripoApi
78
81
  };
@@ -4,7 +4,7 @@ import { type DynamicContentConversionResult } from '@@/Utils/dynamicContentConv
4
4
  export declare const UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY = "dynamic-content.unresolved-attributes-on-drop";
5
5
  export declare const registerUsedAttributes: (html: string, candidates: DynamicContentCandidate[]) => void;
6
6
  /**
7
- * Repairs dropped/copied saved modules (items currency, unsubscribe → text block,
7
+ * Repairs dropped/copied saved modules (items currency, linkless legacy unsubscribe → text block,
8
8
  * dynamic-content labels → tokens) in one write-back; wired via Stripo's `onModuleAdd` (see `useStripo`).
9
9
  */
10
10
  export declare const useModuleRepair: () => {
@@ -11,6 +11,5 @@ export declare const ACADEMY_LINKS: {
11
11
  readonly EMAIL_DISPLAY_CONDITIONS: "https://academy.insiderone.com/docs/new-editor-add-display-conditions-to-an-email";
12
12
  readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
13
13
  readonly LEGACY_UNSUBSCRIBE_MODULE: "https://academy.insiderone.com/docs/new-editor-add-unsubscribe-pages-into-emails";
14
- readonly SFMC_RELAY: "https://academy.insiderone.com/docs/sfmc-relay";
15
14
  };
16
15
  export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
@@ -1,4 +1,8 @@
1
1
  import type { ColorVisionDeficiency } from '@@/Types/api/accessibility-api';
2
+ type EditorReadiness = {
3
+ loadingStatus: boolean;
4
+ isStripoInitialized: boolean;
5
+ };
2
6
  export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEditor", {
3
7
  loadingStatus: boolean;
4
8
  isCodeEditorOpen: boolean;
@@ -13,12 +17,11 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
13
17
  changeSeq: number;
14
18
  isStripoInitialized: boolean;
15
19
  isLegacyUnsubscribeModalRequested: boolean;
16
- isSfmcUnsubscribeModalRequested: boolean;
17
- isUnsubscribeConvertedOnLoad: boolean;
18
20
  templateId: string;
19
21
  syncModulesEnabled: boolean;
20
22
  trackIdSessionFloor: number;
21
23
  }, {
24
+ isEditorUnavailable: (state: EditorReadiness) => boolean;
22
25
  isEditorToolbarVisible: (state: {
23
26
  loadingStatus: boolean;
24
27
  isCodeEditorOpen: boolean;
@@ -33,8 +36,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
33
36
  changeSeq: number;
34
37
  isStripoInitialized: boolean;
35
38
  isLegacyUnsubscribeModalRequested: boolean;
36
- isSfmcUnsubscribeModalRequested: boolean;
37
- isUnsubscribeConvertedOnLoad: boolean;
38
39
  templateId: string;
39
40
  syncModulesEnabled: boolean;
40
41
  trackIdSessionFloor: number;
@@ -52,8 +53,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
52
53
  changeSeq: number;
53
54
  isStripoInitialized: boolean;
54
55
  isLegacyUnsubscribeModalRequested: boolean;
55
- isSfmcUnsubscribeModalRequested: boolean;
56
- isUnsubscribeConvertedOnLoad: boolean;
57
56
  templateId: string;
58
57
  syncModulesEnabled: boolean;
59
58
  trackIdSessionFloor: number;
@@ -72,8 +71,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
72
71
  changeSeq: number;
73
72
  isStripoInitialized: boolean;
74
73
  isLegacyUnsubscribeModalRequested: boolean;
75
- isSfmcUnsubscribeModalRequested: boolean;
76
- isUnsubscribeConvertedOnLoad: boolean;
77
74
  templateId: string;
78
75
  syncModulesEnabled: boolean;
79
76
  trackIdSessionFloor: number;
@@ -91,8 +88,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
91
88
  changeSeq: number;
92
89
  isStripoInitialized: boolean;
93
90
  isLegacyUnsubscribeModalRequested: boolean;
94
- isSfmcUnsubscribeModalRequested: boolean;
95
- isUnsubscribeConvertedOnLoad: boolean;
96
91
  templateId: string;
97
92
  syncModulesEnabled: boolean;
98
93
  trackIdSessionFloor: number;
@@ -111,8 +106,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
111
106
  changeSeq: number;
112
107
  isStripoInitialized: boolean;
113
108
  isLegacyUnsubscribeModalRequested: boolean;
114
- isSfmcUnsubscribeModalRequested: boolean;
115
- isUnsubscribeConvertedOnLoad: boolean;
116
109
  templateId: string;
117
110
  syncModulesEnabled: boolean;
118
111
  trackIdSessionFloor: number;
@@ -130,8 +123,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
130
123
  changeSeq: number;
131
124
  isStripoInitialized: boolean;
132
125
  isLegacyUnsubscribeModalRequested: boolean;
133
- isSfmcUnsubscribeModalRequested: boolean;
134
- isUnsubscribeConvertedOnLoad: boolean;
135
126
  templateId: string;
136
127
  syncModulesEnabled: boolean;
137
128
  trackIdSessionFloor: number;
@@ -150,8 +141,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
150
141
  changeSeq: number;
151
142
  isStripoInitialized: boolean;
152
143
  isLegacyUnsubscribeModalRequested: boolean;
153
- isSfmcUnsubscribeModalRequested: boolean;
154
- isUnsubscribeConvertedOnLoad: boolean;
155
144
  templateId: string;
156
145
  syncModulesEnabled: boolean;
157
146
  trackIdSessionFloor: number;
@@ -169,8 +158,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
169
158
  changeSeq: number;
170
159
  isStripoInitialized: boolean;
171
160
  isLegacyUnsubscribeModalRequested: boolean;
172
- isSfmcUnsubscribeModalRequested: boolean;
173
- isUnsubscribeConvertedOnLoad: boolean;
174
161
  templateId: string;
175
162
  syncModulesEnabled: boolean;
176
163
  trackIdSessionFloor: number;
@@ -189,8 +176,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
189
176
  changeSeq: number;
190
177
  isStripoInitialized: boolean;
191
178
  isLegacyUnsubscribeModalRequested: boolean;
192
- isSfmcUnsubscribeModalRequested: boolean;
193
- isUnsubscribeConvertedOnLoad: boolean;
194
179
  templateId: string;
195
180
  syncModulesEnabled: boolean;
196
181
  trackIdSessionFloor: number;
@@ -208,8 +193,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
208
193
  changeSeq: number;
209
194
  isStripoInitialized: boolean;
210
195
  isLegacyUnsubscribeModalRequested: boolean;
211
- isSfmcUnsubscribeModalRequested: boolean;
212
- isUnsubscribeConvertedOnLoad: boolean;
213
196
  templateId: string;
214
197
  syncModulesEnabled: boolean;
215
198
  trackIdSessionFloor: number;
@@ -228,8 +211,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
228
211
  changeSeq: number;
229
212
  isStripoInitialized: boolean;
230
213
  isLegacyUnsubscribeModalRequested: boolean;
231
- isSfmcUnsubscribeModalRequested: boolean;
232
- isUnsubscribeConvertedOnLoad: boolean;
233
214
  templateId: string;
234
215
  syncModulesEnabled: boolean;
235
216
  trackIdSessionFloor: number;
@@ -247,8 +228,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
247
228
  changeSeq: number;
248
229
  isStripoInitialized: boolean;
249
230
  isLegacyUnsubscribeModalRequested: boolean;
250
- isSfmcUnsubscribeModalRequested: boolean;
251
- isUnsubscribeConvertedOnLoad: boolean;
252
231
  templateId: string;
253
232
  syncModulesEnabled: boolean;
254
233
  trackIdSessionFloor: number;
@@ -267,8 +246,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
267
246
  changeSeq: number;
268
247
  isStripoInitialized: boolean;
269
248
  isLegacyUnsubscribeModalRequested: boolean;
270
- isSfmcUnsubscribeModalRequested: boolean;
271
- isUnsubscribeConvertedOnLoad: boolean;
272
249
  templateId: string;
273
250
  syncModulesEnabled: boolean;
274
251
  trackIdSessionFloor: number;
@@ -286,8 +263,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
286
263
  changeSeq: number;
287
264
  isStripoInitialized: boolean;
288
265
  isLegacyUnsubscribeModalRequested: boolean;
289
- isSfmcUnsubscribeModalRequested: boolean;
290
- isUnsubscribeConvertedOnLoad: boolean;
291
266
  templateId: string;
292
267
  syncModulesEnabled: boolean;
293
268
  trackIdSessionFloor: number;
@@ -306,8 +281,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
306
281
  changeSeq: number;
307
282
  isStripoInitialized: boolean;
308
283
  isLegacyUnsubscribeModalRequested: boolean;
309
- isSfmcUnsubscribeModalRequested: boolean;
310
- isUnsubscribeConvertedOnLoad: boolean;
311
284
  templateId: string;
312
285
  syncModulesEnabled: boolean;
313
286
  trackIdSessionFloor: number;
@@ -325,8 +298,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
325
298
  changeSeq: number;
326
299
  isStripoInitialized: boolean;
327
300
  isLegacyUnsubscribeModalRequested: boolean;
328
- isSfmcUnsubscribeModalRequested: boolean;
329
- isUnsubscribeConvertedOnLoad: boolean;
330
301
  templateId: string;
331
302
  syncModulesEnabled: boolean;
332
303
  trackIdSessionFloor: number;
@@ -345,8 +316,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
345
316
  changeSeq: number;
346
317
  isStripoInitialized: boolean;
347
318
  isLegacyUnsubscribeModalRequested: boolean;
348
- isSfmcUnsubscribeModalRequested: boolean;
349
- isUnsubscribeConvertedOnLoad: boolean;
350
319
  templateId: string;
351
320
  syncModulesEnabled: boolean;
352
321
  trackIdSessionFloor: number;
@@ -364,8 +333,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
364
333
  changeSeq: number;
365
334
  isStripoInitialized: boolean;
366
335
  isLegacyUnsubscribeModalRequested: boolean;
367
- isSfmcUnsubscribeModalRequested: boolean;
368
- isUnsubscribeConvertedOnLoad: boolean;
369
336
  templateId: string;
370
337
  syncModulesEnabled: boolean;
371
338
  trackIdSessionFloor: number;
@@ -384,8 +351,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
384
351
  changeSeq: number;
385
352
  isStripoInitialized: boolean;
386
353
  isLegacyUnsubscribeModalRequested: boolean;
387
- isSfmcUnsubscribeModalRequested: boolean;
388
- isUnsubscribeConvertedOnLoad: boolean;
389
354
  templateId: string;
390
355
  syncModulesEnabled: boolean;
391
356
  trackIdSessionFloor: number;
@@ -403,8 +368,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
403
368
  changeSeq: number;
404
369
  isStripoInitialized: boolean;
405
370
  isLegacyUnsubscribeModalRequested: boolean;
406
- isSfmcUnsubscribeModalRequested: boolean;
407
- isUnsubscribeConvertedOnLoad: boolean;
408
371
  templateId: string;
409
372
  syncModulesEnabled: boolean;
410
373
  trackIdSessionFloor: number;
@@ -423,8 +386,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
423
386
  changeSeq: number;
424
387
  isStripoInitialized: boolean;
425
388
  isLegacyUnsubscribeModalRequested: boolean;
426
- isSfmcUnsubscribeModalRequested: boolean;
427
- isUnsubscribeConvertedOnLoad: boolean;
428
389
  templateId: string;
429
390
  syncModulesEnabled: boolean;
430
391
  trackIdSessionFloor: number;
@@ -442,8 +403,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
442
403
  changeSeq: number;
443
404
  isStripoInitialized: boolean;
444
405
  isLegacyUnsubscribeModalRequested: boolean;
445
- isSfmcUnsubscribeModalRequested: boolean;
446
- isUnsubscribeConvertedOnLoad: boolean;
447
406
  templateId: string;
448
407
  syncModulesEnabled: boolean;
449
408
  trackIdSessionFloor: number;
@@ -462,8 +421,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
462
421
  changeSeq: number;
463
422
  isStripoInitialized: boolean;
464
423
  isLegacyUnsubscribeModalRequested: boolean;
465
- isSfmcUnsubscribeModalRequested: boolean;
466
- isUnsubscribeConvertedOnLoad: boolean;
467
424
  templateId: string;
468
425
  syncModulesEnabled: boolean;
469
426
  trackIdSessionFloor: number;
@@ -481,8 +438,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
481
438
  changeSeq: number;
482
439
  isStripoInitialized: boolean;
483
440
  isLegacyUnsubscribeModalRequested: boolean;
484
- isSfmcUnsubscribeModalRequested: boolean;
485
- isUnsubscribeConvertedOnLoad: boolean;
486
441
  templateId: string;
487
442
  syncModulesEnabled: boolean;
488
443
  trackIdSessionFloor: number;
@@ -501,8 +456,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
501
456
  changeSeq: number;
502
457
  isStripoInitialized: boolean;
503
458
  isLegacyUnsubscribeModalRequested: boolean;
504
- isSfmcUnsubscribeModalRequested: boolean;
505
- isUnsubscribeConvertedOnLoad: boolean;
506
459
  templateId: string;
507
460
  syncModulesEnabled: boolean;
508
461
  trackIdSessionFloor: number;
@@ -520,10 +473,9 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
520
473
  changeSeq: number;
521
474
  isStripoInitialized: boolean;
522
475
  isLegacyUnsubscribeModalRequested: boolean;
523
- isSfmcUnsubscribeModalRequested: boolean;
524
- isUnsubscribeConvertedOnLoad: boolean;
525
476
  templateId: string;
526
477
  syncModulesEnabled: boolean;
527
478
  trackIdSessionFloor: number;
528
479
  }>) => boolean;
529
480
  }, {}>;
481
+ export {};
@@ -5,9 +5,6 @@ export interface LegacyUnsubscribeConversionResult {
5
5
  converted: boolean;
6
6
  }
7
7
  export declare const hasLegacyUnsubscribeClass: (html: string) => boolean;
8
- export declare const hasAnyUnsubscribeClass: (html: string) => boolean;
9
8
  export declare const convertLinklessLegacyUnsubscribeBlocks: (root: ParentNode) => number;
10
9
  export declare const convertLegacyUnsubscribeInModuleHtml: (html: string) => LegacyUnsubscribeConversionResult;
11
10
  export declare const convertLegacyUnsubscribeInDocumentHtml: (html: string) => LegacyUnsubscribeConversionResult;
12
- export declare const convertAllUnsubscribeInModuleHtml: (html: string) => LegacyUnsubscribeConversionResult;
13
- export declare const convertAllUnsubscribeInDocumentHtml: (html: string) => LegacyUnsubscribeConversionResult;
@@ -1,5 +1,5 @@
1
- import { defineStore as e } from "pinia";
2
- const o = e("guidoEditor", {
1
+ import { defineStore as s } from "pinia";
2
+ const e = (i) => i.loadingStatus || !i.isStripoInitialized, n = s("guidoEditor", {
3
3
  state: () => ({
4
4
  loadingStatus: !0,
5
5
  isCodeEditorOpen: !1,
@@ -17,8 +17,6 @@ const o = e("guidoEditor", {
17
17
  changeSeq: 0,
18
18
  isStripoInitialized: !1,
19
19
  isLegacyUnsubscribeModalRequested: !1,
20
- isSfmcUnsubscribeModalRequested: !1,
21
- isUnsubscribeConvertedOnLoad: !1,
22
20
  templateId: "",
23
21
  syncModulesEnabled: !1,
24
22
  // In-session id high-water mark; floors tracking-id minting so ids
@@ -26,25 +24,26 @@ const o = e("guidoEditor", {
26
24
  trackIdSessionFloor: 0
27
25
  }),
28
26
  getters: {
27
+ isEditorUnavailable: e,
29
28
  // Middle Slot
30
29
  isEditorToolbarVisible: (i) => !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isAccessibilityTestingOpen,
31
- isUndoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
32
- isRedoButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
33
- isCodeEditorButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
34
- isPreviewButtonDisabled: (i) => i.loadingStatus,
35
- isViewOptionsDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
30
+ isUndoButtonDisabled: (i) => e(i) || i.isPreviewModeOpen,
31
+ isRedoButtonDisabled: (i) => e(i) || i.isPreviewModeOpen,
32
+ isCodeEditorButtonDisabled: (i) => e(i) || i.isPreviewModeOpen,
33
+ isPreviewButtonDisabled: (i) => e(i),
34
+ isViewOptionsDisabled: (i) => e(i) || i.isPreviewModeOpen,
36
35
  // Right Slot
37
36
  isNormalMode: (i) => !i.isVersionHistoryOpen && !i.isAccessibilityTestingOpen,
38
- isVersionHistoryButtonDisabled: (i) => i.loadingStatus || i.isPreviewModeOpen,
39
- isExportButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
40
- isSaveAsButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
41
- isTestButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen,
42
- isSaveButtonDisabled: (i) => i.loadingStatus || i.isVersionHistoryOpen || i.isPreviewModeOpen || i.isAccessibilityTestingOpen,
37
+ isVersionHistoryButtonDisabled: (i) => e(i) || i.isPreviewModeOpen,
38
+ isExportButtonDisabled: (i) => e(i) || i.isVersionHistoryOpen,
39
+ isSaveAsButtonDisabled: (i) => e(i) || i.isVersionHistoryOpen,
40
+ isTestButtonDisabled: (i) => e(i) || i.isVersionHistoryOpen,
41
+ isSaveButtonDisabled: (i) => e(i) || i.isVersionHistoryOpen || i.isPreviewModeOpen || i.isAccessibilityTestingOpen,
43
42
  // Accessibility Test is absent on purpose: it only simulates, but its Apply / Auto-tune
44
43
  // edit the document, so pausing autosave there would lose those fixes.
45
- isInSaveableState: (i) => !i.loadingStatus && !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isCodeEditorOpen
44
+ isInSaveableState: (i) => !e(i) && !i.isVersionHistoryOpen && !i.isPreviewModeOpen && !i.isCodeEditorOpen
46
45
  }
47
46
  });
48
47
  export {
49
- o as useEditorStore
48
+ n as useEditorStore
50
49
  };
@@ -1,90 +1,49 @@
1
- import { hasInsiderUnsubscribeCode as f } from "../composables/validators/useUnsubscribeBlockValidator.js";
2
- import { UNSUBSCRIBE_LINK_SELECTOR as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
3
- import { protectLiquid as C, restoreLiquid as _ } from "./liquidProtection.js";
4
- const u = "td.unsubscribe-block", p = ["a.unsubscribe-link", 'a[href*="unsubscribe"]'], v = `${u}, .unsubscribe-block-v2`, y = "esd-block-text", U = [
1
+ import { protectLiquid as a, restoreLiquid as u } from "./liquidProtection.js";
2
+ const b = "td.unsubscribe-block", l = ["a.unsubscribe-link", 'a[href*="unsubscribe"]'], d = "esd-block-text", m = [
5
3
  "unsubscribe-block",
6
4
  "esd-extension",
7
5
  "esd-extension-block",
8
6
  "esd-unsubscribe-block",
9
7
  "esd-block-unsubscribe"
10
- ], h = "unsubscribe-block-v2", T = "esd-extension-block-id", l = "data-unsubscribe-", g = "unsubscribe-link", k = "address,article,aside,blockquote,center,details,dialog,dir,div,dd,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,listing,main,menu,nav,ol,p,plaintext,pre,search,section,summary,table,ul,xmp", I = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?![\\w-])`, "i"), N = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?:-v2)?(?![\\w-])`, "i"), R = (e) => typeof e == "string" && I.test(e), B = (e) => p.some((t) => e.querySelector(t) !== null), b = (e) => {
11
- e.classList.remove(...U), e.classList.add(y), e.removeAttribute(T), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(l)).forEach(({ name: t }) => e.removeAttribute(t)), e.querySelector(k) || (e.innerHTML = `<p path="1">${e.innerHTML}</p>`);
12
- }, O = (e) => {
13
- const t = e.getAttribute("href") ?? "";
14
- return f(t) || t.trim() === "" && e.matches(A);
15
- }, M = (e) => {
16
- e.classList.remove(g), e.classList.length === 0 && e.removeAttribute("class"), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(l)).forEach(({ name: t }) => e.removeAttribute(t));
17
- }, x = (e) => {
18
- Array.from(e.querySelectorAll("a")).forEach((t) => {
19
- if (O(t)) {
20
- t.replaceWith(...Array.from(t.childNodes));
21
- return;
22
- }
23
- M(t);
24
- });
25
- }, q = (e) => typeof e == "string" && N.test(e), D = (e) => {
26
- const t = Array.from(e.querySelectorAll(v));
27
- return t.forEach((r) => {
28
- r.classList.remove(h), x(r), b(r);
29
- }), t.length;
30
- }, H = (e) => {
31
- const t = Array.from(e.querySelectorAll(u)).filter((r) => !B(r));
32
- return t.forEach(b), t.length;
33
- }, a = (e) => {
8
+ ], L = "esd-extension-block-id", S = "data-unsubscribe-", E = "address,article,aside,blockquote,center,details,dialog,dir,div,dd,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,li,listing,main,menu,nav,ol,p,plaintext,pre,search,section,summary,table,ul,xmp", f = new RegExp(`class\\s*=\\s*(?:["'][^"']*)?(?<![\\w-])unsubscribe-block(?![\\w-])`, "i"), p = (e) => typeof e == "string" && f.test(e), y = (e) => l.some((t) => e.querySelector(t) !== null), g = (e) => {
9
+ e.classList.remove(...m), e.classList.add(d), e.removeAttribute(L), Array.from(e.attributes).filter(({ name: t }) => t.startsWith(S)).forEach(({ name: t }) => e.removeAttribute(t)), e.querySelector(E) || (e.innerHTML = `<p path="1">${e.innerHTML}</p>`);
10
+ }, h = (e) => {
11
+ const t = Array.from(e.querySelectorAll(b)).filter((r) => !y(r));
12
+ return t.forEach(g), t.length;
13
+ }, v = (e) => {
34
14
  const t = e.trimStart(), r = new DOMParser();
35
15
  return /^<t[dh][\s>]/i.test(t) ? r.parseFromString(`<table><tbody><tr>${e}</tr></tbody></table>`, "text/html").querySelector("tr") : /^<tr[\s>]/i.test(t) ? r.parseFromString(`<table><tbody>${e}</tbody></table>`, "text/html").querySelector("tbody") : /^<table[\s>]/i.test(t) ? r.parseFromString(e, "text/html").body : (console.debug("[LegacyUnsubscribeConversion] Skipped module with a non-table root"), null);
36
- }, d = (e) => {
16
+ }, c = (e) => {
37
17
  const t = e.search(/<html[\s>]/i), r = [...e.matchAll(/<\/html\s*>/gi)].at(-1), s = (r == null ? void 0 : r.index) === void 0 ? -1 : r.index + r[0].length;
38
18
  return t < 0 || s <= t ? { head: "", root: e, tail: "" } : { head: e.slice(0, t), root: e.slice(t, s), tail: e.slice(s) };
39
- }, K = {
40
- detect: R,
41
- convertCells: H
42
- }, S = {
43
- detect: q,
44
- convertCells: D
45
- }, n = (e, t, r, s, i = K) => {
46
- if (!i.detect(e))
19
+ }, i = (e, t, r, s) => {
20
+ if (!p(e))
47
21
  return { html: e, converted: !1 };
48
22
  try {
49
- const o = C(e), c = t(o);
50
- return !c || i.convertCells(c) === 0 ? { html: e, converted: !1 } : { html: _(r(c, o)), converted: !0 };
23
+ const o = a(e), n = t(o);
24
+ return !n || h(n) === 0 ? { html: e, converted: !1 } : { html: u(r(n, o)), converted: !0 };
51
25
  } catch (o) {
52
26
  return console.error(`Failed to convert legacy unsubscribe blocks in ${s}:`, o), { html: e, converted: !1 };
53
27
  }
54
- }, m = (e) => e.innerHTML, E = (e) => new DOMParser().parseFromString(d(e).root, "text/html"), L = (e, t) => {
55
- const { head: r, tail: s } = d(t);
56
- return `${r}${e.documentElement.outerHTML}${s}`;
57
- }, F = (e) => n(
28
+ }, C = (e) => i(
58
29
  e,
59
- a,
60
- m,
30
+ v,
31
+ (t) => t.innerHTML,
61
32
  "module"
62
- ), G = (e) => n(
33
+ ), _ = (e) => i(
63
34
  e,
64
- E,
65
- L,
35
+ (t) => new DOMParser().parseFromString(c(t).root, "text/html"),
36
+ (t, r) => {
37
+ const { head: s, tail: o } = c(r);
38
+ return `${s}${t.documentElement.outerHTML}${o}`;
39
+ },
66
40
  "document"
67
- ), P = (e) => n(
68
- e,
69
- a,
70
- m,
71
- "module",
72
- S
73
- ), V = (e) => n(
74
- e,
75
- E,
76
- L,
77
- "document",
78
- S
79
41
  );
80
42
  export {
81
- p as LEGACY_UNSUBSCRIBE_LINK_SELECTORS,
82
- u as LEGACY_UNSUBSCRIBE_SELECTOR,
83
- V as convertAllUnsubscribeInDocumentHtml,
84
- P as convertAllUnsubscribeInModuleHtml,
85
- G as convertLegacyUnsubscribeInDocumentHtml,
86
- F as convertLegacyUnsubscribeInModuleHtml,
87
- H as convertLinklessLegacyUnsubscribeBlocks,
88
- q as hasAnyUnsubscribeClass,
89
- R as hasLegacyUnsubscribeClass
43
+ l as LEGACY_UNSUBSCRIBE_LINK_SELECTORS,
44
+ b as LEGACY_UNSUBSCRIBE_SELECTOR,
45
+ _ as convertLegacyUnsubscribeInDocumentHtml,
46
+ C as convertLegacyUnsubscribeInModuleHtml,
47
+ h as convertLinklessLegacyUnsubscribeBlocks,
48
+ p as hasLegacyUnsubscribeClass
90
49
  };