@useinsider/guido 3.24.0-beta.82c2d5e → 3.24.0-beta.89982ef

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 (84) hide show
  1. package/README.md +1 -9
  2. package/dist/@types/config/schemas.js +37 -37
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +4 -4
  5. package/dist/components/Guido.vue2.js +82 -80
  6. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +17 -0
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +41 -0
  8. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +81 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +17 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +45 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +36 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +63 -0
  14. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  15. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  16. package/dist/composables/useBlocksConfig.js +31 -20
  17. package/dist/composables/useDisplayConditions.js +117 -0
  18. package/dist/composables/useModuleRepair.js +23 -32
  19. package/dist/composables/useTranslations.js +2 -1
  20. package/dist/config/compiler/utils/itemsCompilerUtils.js +43 -42
  21. package/dist/config/compiler/utils/recommendationCompilerUtils.js +67 -64
  22. package/dist/config/migrator/index.js +9 -10
  23. package/dist/enums/academy.js +2 -2
  24. package/dist/enums/display-condition.js +12 -0
  25. package/dist/extensions/DisplayConditions/bridge.js +25 -0
  26. package/dist/extensions/DisplayConditions/constants.js +26 -0
  27. package/dist/extensions/DisplayConditions/control.js +215 -0
  28. package/dist/extensions/DisplayConditions/display-conditions.css.js +226 -0
  29. package/dist/extensions/DisplayConditions/extension.js +28 -0
  30. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  31. package/dist/extensions/DisplayConditions/library.js +30 -0
  32. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  33. package/dist/extensions/LinkTracking/extension.js +17 -0
  34. package/dist/extensions/LinkTracking/writer.js +41 -0
  35. package/dist/guido.css +1 -1
  36. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  37. package/dist/node_modules/valibot/dist/index.js +297 -261
  38. package/dist/package.json.js +1 -1
  39. package/dist/services/displayConditionApi.js +39 -0
  40. package/dist/src/@types/config/schemas.d.ts +4 -4
  41. package/dist/src/@types/display-condition.d.ts +61 -0
  42. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  43. package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +18 -0
  44. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  45. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  46. package/dist/src/composables/useConfig.d.ts +2 -2
  47. package/dist/src/composables/useDisplayConditions.d.ts +18 -0
  48. package/dist/src/composables/useModuleRepair.d.ts +11 -2
  49. package/dist/src/enums/academy.d.ts +1 -1
  50. package/dist/src/enums/display-condition.d.ts +15 -0
  51. package/dist/src/extensions/DisplayConditions/bridge.d.ts +7 -0
  52. package/dist/src/extensions/DisplayConditions/constants.d.ts +23 -0
  53. package/dist/src/extensions/DisplayConditions/control.d.ts +25 -0
  54. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  55. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  56. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  57. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  58. package/dist/src/extensions/LinkTracking/extension.d.ts +2 -0
  59. package/dist/src/extensions/LinkTracking/writer.d.ts +13 -0
  60. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  61. package/dist/src/services/displayConditionApi.d.ts +8 -0
  62. package/dist/src/stores/config.d.ts +167 -20
  63. package/dist/src/stores/display-condition.d.ts +86 -0
  64. package/dist/src/stores/editor.d.ts +0 -27
  65. package/dist/src/utils/displayCondition.d.ts +11 -0
  66. package/dist/src/utils/linkTrackingIds.d.ts +22 -5
  67. package/dist/src/utils/protectTableText.d.ts +2 -0
  68. package/dist/static/styles/variables.css.js +1 -0
  69. package/dist/stores/config.js +13 -6
  70. package/dist/stores/display-condition.js +29 -0
  71. package/dist/stores/editor.js +0 -1
  72. package/dist/utils/displayCondition.js +29 -0
  73. package/dist/utils/linkTrackingIds.js +82 -48
  74. package/dist/utils/pairProductVariables.js +30 -29
  75. package/dist/utils/protectTableText.js +22 -0
  76. package/dist/utils/templatePreparation.js +67 -57
  77. package/package.json +1 -1
  78. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +0 -17
  79. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +0 -30
  80. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +0 -16
  81. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +0 -1
  82. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +0 -10
  83. package/dist/utils/legacyUnsubscribeConversion.js +0 -49
  84. /package/dist/src/components/organisms/{unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts → display-conditions/DisplayConditionCreateDrawer.vue.d.ts} +0 -0
@@ -12,7 +12,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
12
12
  hasChanges: boolean;
13
13
  changeSeq: number;
14
14
  isStripoInitialized: boolean;
15
- isLegacyUnsubscribeModalRequested: boolean;
16
15
  templateId: string;
17
16
  syncModulesEnabled: boolean;
18
17
  trackIdSessionFloor: number;
@@ -30,7 +29,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
30
29
  hasChanges: boolean;
31
30
  changeSeq: number;
32
31
  isStripoInitialized: boolean;
33
- isLegacyUnsubscribeModalRequested: boolean;
34
32
  templateId: string;
35
33
  syncModulesEnabled: boolean;
36
34
  trackIdSessionFloor: number;
@@ -47,7 +45,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
47
45
  hasChanges: boolean;
48
46
  changeSeq: number;
49
47
  isStripoInitialized: boolean;
50
- isLegacyUnsubscribeModalRequested: boolean;
51
48
  templateId: string;
52
49
  syncModulesEnabled: boolean;
53
50
  trackIdSessionFloor: number;
@@ -65,7 +62,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
65
62
  hasChanges: boolean;
66
63
  changeSeq: number;
67
64
  isStripoInitialized: boolean;
68
- isLegacyUnsubscribeModalRequested: boolean;
69
65
  templateId: string;
70
66
  syncModulesEnabled: boolean;
71
67
  trackIdSessionFloor: number;
@@ -82,7 +78,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
82
78
  hasChanges: boolean;
83
79
  changeSeq: number;
84
80
  isStripoInitialized: boolean;
85
- isLegacyUnsubscribeModalRequested: boolean;
86
81
  templateId: string;
87
82
  syncModulesEnabled: boolean;
88
83
  trackIdSessionFloor: number;
@@ -100,7 +95,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
100
95
  hasChanges: boolean;
101
96
  changeSeq: number;
102
97
  isStripoInitialized: boolean;
103
- isLegacyUnsubscribeModalRequested: boolean;
104
98
  templateId: string;
105
99
  syncModulesEnabled: boolean;
106
100
  trackIdSessionFloor: number;
@@ -117,7 +111,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
117
111
  hasChanges: boolean;
118
112
  changeSeq: number;
119
113
  isStripoInitialized: boolean;
120
- isLegacyUnsubscribeModalRequested: boolean;
121
114
  templateId: string;
122
115
  syncModulesEnabled: boolean;
123
116
  trackIdSessionFloor: number;
@@ -135,7 +128,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
135
128
  hasChanges: boolean;
136
129
  changeSeq: number;
137
130
  isStripoInitialized: boolean;
138
- isLegacyUnsubscribeModalRequested: boolean;
139
131
  templateId: string;
140
132
  syncModulesEnabled: boolean;
141
133
  trackIdSessionFloor: number;
@@ -152,7 +144,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
152
144
  hasChanges: boolean;
153
145
  changeSeq: number;
154
146
  isStripoInitialized: boolean;
155
- isLegacyUnsubscribeModalRequested: boolean;
156
147
  templateId: string;
157
148
  syncModulesEnabled: boolean;
158
149
  trackIdSessionFloor: number;
@@ -170,7 +161,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
170
161
  hasChanges: boolean;
171
162
  changeSeq: number;
172
163
  isStripoInitialized: boolean;
173
- isLegacyUnsubscribeModalRequested: boolean;
174
164
  templateId: string;
175
165
  syncModulesEnabled: boolean;
176
166
  trackIdSessionFloor: number;
@@ -187,7 +177,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
187
177
  hasChanges: boolean;
188
178
  changeSeq: number;
189
179
  isStripoInitialized: boolean;
190
- isLegacyUnsubscribeModalRequested: boolean;
191
180
  templateId: string;
192
181
  syncModulesEnabled: boolean;
193
182
  trackIdSessionFloor: number;
@@ -205,7 +194,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
205
194
  hasChanges: boolean;
206
195
  changeSeq: number;
207
196
  isStripoInitialized: boolean;
208
- isLegacyUnsubscribeModalRequested: boolean;
209
197
  templateId: string;
210
198
  syncModulesEnabled: boolean;
211
199
  trackIdSessionFloor: number;
@@ -222,7 +210,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
222
210
  hasChanges: boolean;
223
211
  changeSeq: number;
224
212
  isStripoInitialized: boolean;
225
- isLegacyUnsubscribeModalRequested: boolean;
226
213
  templateId: string;
227
214
  syncModulesEnabled: boolean;
228
215
  trackIdSessionFloor: number;
@@ -240,7 +227,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
240
227
  hasChanges: boolean;
241
228
  changeSeq: number;
242
229
  isStripoInitialized: boolean;
243
- isLegacyUnsubscribeModalRequested: boolean;
244
230
  templateId: string;
245
231
  syncModulesEnabled: boolean;
246
232
  trackIdSessionFloor: number;
@@ -257,7 +243,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
257
243
  hasChanges: boolean;
258
244
  changeSeq: number;
259
245
  isStripoInitialized: boolean;
260
- isLegacyUnsubscribeModalRequested: boolean;
261
246
  templateId: string;
262
247
  syncModulesEnabled: boolean;
263
248
  trackIdSessionFloor: number;
@@ -275,7 +260,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
275
260
  hasChanges: boolean;
276
261
  changeSeq: number;
277
262
  isStripoInitialized: boolean;
278
- isLegacyUnsubscribeModalRequested: boolean;
279
263
  templateId: string;
280
264
  syncModulesEnabled: boolean;
281
265
  trackIdSessionFloor: number;
@@ -292,7 +276,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
292
276
  hasChanges: boolean;
293
277
  changeSeq: number;
294
278
  isStripoInitialized: boolean;
295
- isLegacyUnsubscribeModalRequested: boolean;
296
279
  templateId: string;
297
280
  syncModulesEnabled: boolean;
298
281
  trackIdSessionFloor: number;
@@ -310,7 +293,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
310
293
  hasChanges: boolean;
311
294
  changeSeq: number;
312
295
  isStripoInitialized: boolean;
313
- isLegacyUnsubscribeModalRequested: boolean;
314
296
  templateId: string;
315
297
  syncModulesEnabled: boolean;
316
298
  trackIdSessionFloor: number;
@@ -327,7 +309,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
327
309
  hasChanges: boolean;
328
310
  changeSeq: number;
329
311
  isStripoInitialized: boolean;
330
- isLegacyUnsubscribeModalRequested: boolean;
331
312
  templateId: string;
332
313
  syncModulesEnabled: boolean;
333
314
  trackIdSessionFloor: number;
@@ -345,7 +326,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
345
326
  hasChanges: boolean;
346
327
  changeSeq: number;
347
328
  isStripoInitialized: boolean;
348
- isLegacyUnsubscribeModalRequested: boolean;
349
329
  templateId: string;
350
330
  syncModulesEnabled: boolean;
351
331
  trackIdSessionFloor: number;
@@ -362,7 +342,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
362
342
  hasChanges: boolean;
363
343
  changeSeq: number;
364
344
  isStripoInitialized: boolean;
365
- isLegacyUnsubscribeModalRequested: boolean;
366
345
  templateId: string;
367
346
  syncModulesEnabled: boolean;
368
347
  trackIdSessionFloor: number;
@@ -380,7 +359,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
380
359
  hasChanges: boolean;
381
360
  changeSeq: number;
382
361
  isStripoInitialized: boolean;
383
- isLegacyUnsubscribeModalRequested: boolean;
384
362
  templateId: string;
385
363
  syncModulesEnabled: boolean;
386
364
  trackIdSessionFloor: number;
@@ -397,7 +375,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
397
375
  hasChanges: boolean;
398
376
  changeSeq: number;
399
377
  isStripoInitialized: boolean;
400
- isLegacyUnsubscribeModalRequested: boolean;
401
378
  templateId: string;
402
379
  syncModulesEnabled: boolean;
403
380
  trackIdSessionFloor: number;
@@ -415,7 +392,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
415
392
  hasChanges: boolean;
416
393
  changeSeq: number;
417
394
  isStripoInitialized: boolean;
418
- isLegacyUnsubscribeModalRequested: boolean;
419
395
  templateId: string;
420
396
  syncModulesEnabled: boolean;
421
397
  trackIdSessionFloor: number;
@@ -432,7 +408,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
432
408
  hasChanges: boolean;
433
409
  changeSeq: number;
434
410
  isStripoInitialized: boolean;
435
- isLegacyUnsubscribeModalRequested: boolean;
436
411
  templateId: string;
437
412
  syncModulesEnabled: boolean;
438
413
  trackIdSessionFloor: number;
@@ -450,7 +425,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
450
425
  hasChanges: boolean;
451
426
  changeSeq: number;
452
427
  isStripoInitialized: boolean;
453
- isLegacyUnsubscribeModalRequested: boolean;
454
428
  templateId: string;
455
429
  syncModulesEnabled: boolean;
456
430
  trackIdSessionFloor: number;
@@ -467,7 +441,6 @@ export declare const useEditorStore: import("pinia").StoreDefinition<"guidoEdito
467
441
  hasChanges: boolean;
468
442
  changeSeq: number;
469
443
  isStripoInitialized: boolean;
470
- isLegacyUnsubscribeModalRequested: boolean;
471
444
  templateId: string;
472
445
  syncModulesEnabled: boolean;
473
446
  trackIdSessionFloor: number;
@@ -0,0 +1,11 @@
1
+ import type { AppliedDisplayCondition, DisplayConditionSyntax } from '@@/Types/display-condition';
2
+ import { DisplayConditionSourceType } from '@@/Enums/display-condition';
3
+ export declare const parseSource: (condition: AppliedDisplayCondition | null | undefined) => DisplayConditionSourceType | null;
4
+ type ConditionLike = Omit<AppliedDisplayCondition, 'description'> & {
5
+ description?: string | null;
6
+ };
7
+ export declare const toAppliedCondition: (condition: ConditionLike | null | undefined) => AppliedDisplayCondition | null;
8
+ export declare const nextConditionId: () => number;
9
+ export type CodeField = 'codeBefore' | 'codeAfter';
10
+ export declare const findInvalidCodeFields: (codeBefore: string, codeAfter: string, syntax?: DisplayConditionSyntax) => CodeField[];
11
+ export {};
@@ -10,6 +10,13 @@ export interface TrackingIdResult {
10
10
  changed: boolean;
11
11
  nextSeq: number;
12
12
  }
13
+ export interface TrackingIdPlan {
14
+ /** Anchor index in document order → id to write. Anchors keeping their id are absent. */
15
+ assignments: Map<number, number>;
16
+ nextSeq: number;
17
+ seqChanged: boolean;
18
+ changed: boolean;
19
+ }
13
20
  /**
14
21
  * Reads the persisted id high-water mark: <body> attr, then <html> attr,
15
22
  * then the leading comment fallback. Returns 0 when absent.
@@ -21,10 +28,20 @@ export declare function readTrackSeq(html: string): number;
21
28
  */
22
29
  export declare function readTrackFloor(html: string, persistedCounter?: number): number;
23
30
  /**
24
- * Ensures every <a> opening tag carries a unique positive-integer id and the
25
- * document records the id high-water mark. Ids are minted above
26
- * max(persisted seq, max id in document, floor) so deleted ids are never
27
- * reused — even after a version restore or paste-over (floor = session floor).
28
- * Idempotent: a document already normalized returns changed=false.
31
+ * Mints ids above max(persisted seq, max id seen, floor) so a deleted id is never reused;
32
+ * invalid or duplicate values are reassigned, the first duplicate in document order keeps its id.
29
33
  */
34
+ export declare function planTrackingIds(rawIds: (string | null)[], persistedSeq: number, floor?: number): TrackingIdPlan;
35
+ export interface DocumentTrackingIdPlan {
36
+ /** data-ins-track-id per anchor in document order; '' when absent. */
37
+ anchorIds: string[];
38
+ /** Per anchor: inside an HTML comment (e.g. Stripo's `<!--[if mso]>` button copy), absent from the node tree. */
39
+ inComment: boolean[];
40
+ plan: TrackingIdPlan;
41
+ }
42
+ /** Plans the ids for an HTML document without rewriting it. */
43
+ export declare function planDocumentTrackingIds(html: string, floor?: number): DocumentTrackingIdPlan;
44
+ /** Writes a plan into the HTML string: anchor ids by document order, then the seq host. */
45
+ export declare function renderTrackingIdPlan(html: string, { plan }: DocumentTrackingIdPlan): string;
46
+ /** Gives every <a> a unique positive-integer id and records the high-water mark; idempotent. */
30
47
  export declare function assignTrackingIds(html: string, floor?: number): TrackingIdResult;
@@ -0,0 +1,2 @@
1
+ export declare function protectTableText(html: string): string;
2
+ export declare const restoreTableText: (html: string) => string;
@@ -12,6 +12,7 @@ const o = `:host {
12
12
  --guido-color-gray-100: #F5F5F5;
13
13
  --guido-color-gray-1: #F0F0F0;
14
14
  --guido-color-gray-0: #F9F9F9;
15
+ --guido-color-neutral-900: #0A0F19;
15
16
  --guido-color-neutral-800: #222938;
16
17
  --guido-color-neutral-700: #2C3546;
17
18
  --guido-color-neutral-500: #5D6980;
@@ -1,8 +1,8 @@
1
- import { MessageType as r } from "../@types/config/schemas.js";
1
+ import { MessageType as a } from "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
- import { parseConfig as a } from "../@types/config/validator.js";
4
- import { defineStore as o } from "pinia";
5
- const g = o("guido-config", {
3
+ import { parseConfig as o } from "../@types/config/validator.js";
4
+ import { defineStore as l } from "pinia";
5
+ const g = l("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -132,7 +132,7 @@ const g = o("guido-config", {
132
132
  * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
133
133
  */
134
134
  isTransactional() {
135
- return this.messageType === r.TRANSACTIONAL;
135
+ return this.messageType === a.TRANSACTIONAL;
136
136
  },
137
137
  /**
138
138
  * Soft-save policy: may the editor persist a template with validation errors?
@@ -158,6 +158,13 @@ const g = o("guido-config", {
158
158
  var e, t;
159
159
  return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
160
160
  },
161
+ /**
162
+ * Check if the Insider display-condition UI replaces Stripo's
163
+ */
164
+ externalDisplayConditions: (i) => {
165
+ var e, t, n, r;
166
+ return (((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.externalDisplayConditions) ?? !1) && (((r = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : r.displayConditions) ?? !0);
167
+ },
161
168
  /**
162
169
  * Check if a specific feature is enabled.
163
170
  * Returns false before init (config null) so header controls don't
@@ -174,7 +181,7 @@ const g = o("guido-config", {
174
181
  * Initialize the config store with validated configuration
175
182
  */
176
183
  init(i) {
177
- const e = a(i);
184
+ const e = o(i);
178
185
  this.config = e, this.initialized = !0;
179
186
  },
180
187
  /**
@@ -0,0 +1,29 @@
1
+ import { defineStore as t } from "pinia";
2
+ const n = t("guidoDisplayCondition", {
3
+ state: () => ({
4
+ view: "none",
5
+ editing: null,
6
+ list: [],
7
+ listStatus: "idle",
8
+ listRequest: 0,
9
+ pendingDelete: null
10
+ }),
11
+ getters: {
12
+ isCreateOpen: (e) => e.view === "create",
13
+ isSelectOpen: (e) => e.view === "select"
14
+ },
15
+ actions: {
16
+ openCreate(e = null) {
17
+ this.editing = e, this.view = "create";
18
+ },
19
+ openSelect() {
20
+ this.editing = null, this.view = "select";
21
+ },
22
+ close() {
23
+ this.view = "none", this.pendingDelete = null;
24
+ }
25
+ }
26
+ });
27
+ export {
28
+ n as useDisplayConditionStore
29
+ };
@@ -16,7 +16,6 @@ const o = e("guidoEditor", {
16
16
  // that need every change (the outbound state bridge) watch this instead.
17
17
  changeSeq: 0,
18
18
  isStripoInitialized: !1,
19
- isLegacyUnsubscribeModalRequested: !1,
20
19
  templateId: "",
21
20
  syncModulesEnabled: !1,
22
21
  // In-session id high-water mark; floors tracking-id minting so ids
@@ -0,0 +1,29 @@
1
+ import { DisplayConditionSourceType as n } from "../enums/display-condition.js";
2
+ const p = "PREDEFINED", I = (e) => {
3
+ if (!e)
4
+ return null;
5
+ if (e.type === p)
6
+ return n.SAVED;
7
+ try {
8
+ const t = JSON.parse(e.extraData || "{}");
9
+ return (t == null ? void 0 : t.source) === n.SAVED ? n.SAVED : n.INLINE;
10
+ } catch {
11
+ return n.INLINE;
12
+ }
13
+ }, m = (e) => !e || !(e.name || e.beforeScript || e.afterScript) ? null : { ...e, description: e.description ?? "" };
14
+ let l = 0;
15
+ const _ = () => (l = Math.max(Date.now(), l + 1), l), E = /{%-?\s*(\w+)[\s\S]*?-?%}/g, S = /{%[\s\S]*?%}|{{[\s\S]*?}}/g, u = /{%-?\s*(comment|raw)\s*-?%}[\s\S]*?{%-?\s*end\1\s*-?%}/g, A = /{#[\s\S]*?#}/g, f = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "tablerow", "comment"]), T = /* @__PURE__ */ new Set(["else", "elsif", "elif", "when"]), h = (e) => /{%|{{/.test(e.replace(S, "")), C = (e, t, d = "liquid") => {
16
+ const r = /* @__PURE__ */ new Set(), o = [];
17
+ return [["codeBefore", e], ["codeAfter", t]].forEach(([c, a]) => {
18
+ const i = (d === "pongo" ? a.replace(A, "") : a).replace(u, "");
19
+ h(i) && r.add(c), Array.from(i.matchAll(E), (s) => s[1]).forEach((s) => {
20
+ f.has(s) ? o.push(s) : s.startsWith("end") && f.has(s.slice(3)) ? o.pop() !== s.slice(3) && r.add(c) : T.has(s) && !o.length && r.add(c);
21
+ });
22
+ }), o.length && r.add("codeAfter"), [...r];
23
+ };
24
+ export {
25
+ C as findInvalidCodeFields,
26
+ _ as nextConditionId,
27
+ I as parseSource,
28
+ m as toAppliedCondition
29
+ };
@@ -1,56 +1,90 @@
1
- const g = "data-ins-track-id", $ = "data-ins-track-seq", E = `(?:[^>"']|"[^"]*"|'[^']*')*`, f = new RegExp(`<a\\b${E}>`, "gi"), b = new RegExp(`<body\\b${E}>`, "i"), N = new RegExp(`<html\\b${E}>`, "i"), I = new RegExp(`\\b${g}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"), S = new RegExp(`\\b${$}\\s*=\\s*(?:"(\\d+)"|'(\\d+)'|(\\d+))`, "i"), p = "ins-track-seq", _ = new RegExp(`<!--\\s*${p}:(\\d+)\\s*-->`, "i"), w = /^[1-9][0-9]{0,14}$/, k = 999999999999999;
2
- function m(e) {
3
- const n = Number(e);
4
- return Number.isSafeInteger(n) && n > 0 ? n : 0;
5
- }
6
- function M(e) {
7
- var a;
8
- const n = (s) => {
1
+ const A = "data-ins-track-id", E = "data-ins-track-seq", g = `(?:[^>"']|"[^"]*"|'[^']*')*`, R = new RegExp(`<a\\b${g}>`, "gi"), _ = new RegExp(`<body\\b${g}>`, "i"), l = new RegExp(`<html\\b${g}>`, "i"), m = new RegExp(`\\b${A}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i"), f = new RegExp(`\\b${E}\\s*=\\s*(?:"(\\d+)"|'(\\d+)'|(\\d+))`, "i"), p = "ins-track-seq", d = new RegExp(`<!--\\s*${p}:(\\d+)\\s*-->`, "i"), I = /^[1-9][0-9]{0,14}$/, S = 999999999999999;
2
+ function $(e) {
3
+ const t = m.exec(e), n = t ? t[1] ?? t[2] ?? t[3] ?? "" : "";
4
+ return { attrMatch: t, rawValue: n };
5
+ }
6
+ function k(e) {
7
+ const t = Number(e);
8
+ return Number.isSafeInteger(t) && t > 0 ? t : 0;
9
+ }
10
+ function N(e) {
11
+ var s;
12
+ const t = (o) => {
9
13
  var r;
10
- const o = (r = s.exec(e)) == null ? void 0 : r[0];
11
- return o ? S.exec(o) : null;
12
- }, t = n(b) ?? n(N), c = (t == null ? void 0 : t[1]) ?? (t == null ? void 0 : t[2]) ?? (t == null ? void 0 : t[3]) ?? ((a = _.exec(e)) == null ? void 0 : a[1]) ?? "";
13
- return m(c);
14
- }
15
- function P(e, n = 0) {
16
- let t = 0;
17
- [...e.matchAll(f)].forEach(([a]) => {
18
- const s = I.exec(a), o = s ? s[1] ?? s[2] ?? s[3] ?? "" : "";
19
- w.test(o) && (t = Math.max(t, Number(o)));
14
+ const a = (r = o.exec(e)) == null ? void 0 : r[0];
15
+ return a ? f.exec(a) : null;
16
+ }, n = t(_) ?? t(l), c = (n == null ? void 0 : n[1]) ?? (n == null ? void 0 : n[2]) ?? (n == null ? void 0 : n[3]) ?? ((s = d.exec(e)) == null ? void 0 : s[1]) ?? "";
17
+ return k(c);
18
+ }
19
+ function K(e, t = 0) {
20
+ let n = 0;
21
+ [...e.matchAll(R)].forEach(([s]) => {
22
+ const { rawValue: o } = $(s);
23
+ I.test(o) && (n = Math.max(n, Number(o)));
20
24
  });
21
- const c = Number.isSafeInteger(n) && n > 0 ? n : 0;
22
- return Math.max(M(e), t, c);
25
+ const c = Number.isSafeInteger(t) && t > 0 ? t : 0;
26
+ return Math.max(N(e), n, c);
23
27
  }
24
- function q(e, n) {
25
- const t = `${$}="${n}"`, c = b.exec(e) ?? N.exec(e);
28
+ function M(e, t) {
29
+ const n = `${E}="${t}"`, c = _.exec(e) ?? l.exec(e);
26
30
  if (c) {
27
- const [s] = c, o = S.exec(s), r = o ? s.replace(o[0], t) : s.replace(/\/?>$/, (T) => ` ${t}${T}`);
28
- return e.slice(0, c.index) + r + e.slice(c.index + s.length);
31
+ const [o] = c, a = f.exec(o), r = a ? o.replace(a[0], n) : o.replace(/\/?>$/, (i) => ` ${n}${i}`);
32
+ return e.slice(0, c.index) + r + e.slice(c.index + o.length);
29
33
  }
30
- const a = `<!--${p}:${n}-->`;
31
- return _.test(e) ? e.replace(_, a) : `${a}${e}`;
32
- }
33
- function D(e, n, t) {
34
- const c = `${g}="${t}"`;
35
- return n ? e.replace(n[0], c) : e.replace(/^<a\b/i, (a) => `${a} ${c}`);
36
- }
37
- function C(e, n = 0) {
38
- const t = /* @__PURE__ */ new Set();
39
- let c = 0;
40
- const a = [...e.matchAll(f)].map((i) => {
41
- const [l] = i, u = I.exec(l), R = u ? u[1] ?? u[2] ?? u[3] ?? "" : "";
42
- let x = null;
43
- return w.test(R) && !t.has(Number(R)) && (x = Number(R), t.add(x), c = Math.max(c, x)), { index: i.index, tag: l, attrMatch: u, id: x };
44
- }), s = M(e), o = Number.isSafeInteger(n) && n > 0 && n < k ? n : 0;
45
- let r = Math.max(s, c, o), T = "", d = 0, A = !1;
46
- return a.forEach((i) => {
47
- T += e.slice(d, i.index), i.id === null ? (r += 1, T += D(i.tag, i.attrMatch, r), A = !0) : T += i.tag, d = i.index + i.tag.length;
48
- }), T += e.slice(d), r > 0 && s !== r && (T = q(T, r), A = !0), { html: T, changed: A, nextSeq: r };
34
+ const s = `<!--${p}:${t}-->`;
35
+ return d.test(e) ? e.replace(d, s) : `${s}${e}`;
36
+ }
37
+ function q(e, t, n) {
38
+ const c = `${A}="${n}"`;
39
+ return t ? e.replace(t[0], c) : e.replace(/^<a\b/i, (s) => `${s} ${c}`);
40
+ }
41
+ function w(e, t, n = 0) {
42
+ const c = /* @__PURE__ */ new Set();
43
+ let s = 0;
44
+ const o = e.map((u) => {
45
+ if (u !== null && I.test(u) && !c.has(Number(u))) {
46
+ const T = Number(u);
47
+ return c.add(T), s = Math.max(s, T), T;
48
+ }
49
+ return null;
50
+ }), a = Number.isSafeInteger(n) && n > 0 && n < S ? n : 0;
51
+ let r = Math.max(t, s, a);
52
+ const i = /* @__PURE__ */ new Map();
53
+ o.forEach((u, T) => {
54
+ u === null && (r += 1, i.set(T, r));
55
+ });
56
+ const x = r > 0 && t !== r;
57
+ return { assignments: i, nextSeq: r, seqChanged: x, changed: i.size > 0 || x };
58
+ }
59
+ function b(e) {
60
+ return [...e.matchAll(R)].map((t) => {
61
+ const [n] = t;
62
+ return { index: t.index, tag: n, ...$(n) };
63
+ });
64
+ }
65
+ const C = /<!--[\s\S]*?-->/g;
66
+ function P(e, t = 0) {
67
+ const n = b(e), c = n.map((a) => a.rawValue), s = [...e.matchAll(C)].map((a) => [a.index, a.index + a[0].length]), o = n.map(({ index: a }) => s.some(([r, i]) => a > r && a < i));
68
+ return { anchorIds: c, inComment: o, plan: w(c, N(e), t) };
69
+ }
70
+ function D(e, { plan: t }) {
71
+ let n = "", c = 0;
72
+ return b(e).forEach((s, o) => {
73
+ const a = t.assignments.get(o);
74
+ n += e.slice(c, s.index), n += a === void 0 ? s.tag : q(s.tag, s.attrMatch, a), c = s.index + s.tag.length;
75
+ }), n += e.slice(c), t.seqChanged ? M(n, t.nextSeq) : n;
76
+ }
77
+ function O(e, t = 0) {
78
+ const n = P(e, t), { changed: c, nextSeq: s } = n.plan;
79
+ return { html: c ? D(e, n) : e, changed: c, nextSeq: s };
49
80
  }
50
81
  export {
51
- g as TRACK_ID_ATTRIBUTE,
52
- $ as TRACK_SEQ_ATTRIBUTE,
53
- C as assignTrackingIds,
54
- P as readTrackFloor,
55
- M as readTrackSeq
82
+ A as TRACK_ID_ATTRIBUTE,
83
+ E as TRACK_SEQ_ATTRIBUTE,
84
+ O as assignTrackingIds,
85
+ P as planDocumentTrackingIds,
86
+ w as planTrackingIds,
87
+ K as readTrackFloor,
88
+ N as readTrackSeq,
89
+ D as renderTrackingIdPlan
56
90
  };