@useinsider/guido 3.11.0-beta.f2b79f2 → 3.11.0-beta.f4ab671
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/config/schemas.js +92 -80
- package/dist/composables/useModuleDynamicContentRepair.js +18 -17
- package/dist/composables/useStripo.js +40 -40
- package/dist/node_modules/valibot/dist/index.js +148 -112
- package/dist/src/@types/config/schemas.d.ts +28 -32
- package/dist/src/@types/generic.d.ts +18 -0
- package/dist/src/composables/useConfig.d.ts +6 -18
- package/dist/src/library.d.ts +1 -1
- package/dist/src/stores/config.d.ts +54 -162
- package/dist/src/utils/genericUtil.d.ts +11 -1
- package/dist/utils/genericUtil.js +40 -26
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* All types are inferred from these schemas to ensure single source of truth.
|
|
6
6
|
* @module @types/config/schemas
|
|
7
7
|
*/
|
|
8
|
+
import type { DynamicContentNode } from '../generic';
|
|
8
9
|
import type { SavedTemplateDetails } from '../stripo';
|
|
9
10
|
import * as v from 'valibot';
|
|
10
11
|
/**
|
|
@@ -86,6 +87,21 @@ export declare const DynamicContentSchema: v.ObjectSchema<{
|
|
|
86
87
|
readonly value: v.StringSchema<undefined>;
|
|
87
88
|
}, undefined>, undefined>;
|
|
88
89
|
}, undefined>;
|
|
90
|
+
/**
|
|
91
|
+
* A node in the partner-keyed dynamic-content tree (backend categorized-fields
|
|
92
|
+
* shape). Loose so the many extra backend fields pass through untouched; Guido
|
|
93
|
+
* only reads text/tag_text/value and recurses children/select_items.
|
|
94
|
+
*/
|
|
95
|
+
export declare const DynamicContentNodeSchema: v.GenericSchema<DynamicContentNode>;
|
|
96
|
+
/**
|
|
97
|
+
* Partner-keyed dynamic-content list: `{ [partnerName]: DynamicContentNode[] }`.
|
|
98
|
+
* Architect is multi-partner, so the raw structure is keyed by partner name.
|
|
99
|
+
*
|
|
100
|
+
* Per-entry `fallback`: the raw backend payload may carry non-array metadata
|
|
101
|
+
* keys, so a value that is not a node array degrades to `[]` instead of failing
|
|
102
|
+
* the whole config validation (the repair feature is fail-open).
|
|
103
|
+
*/
|
|
104
|
+
export declare const DynamicContentListSchema: v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithFallback<v.ArraySchema<v.GenericSchema<DynamicContentNode>, undefined>, readonly []>, undefined>;
|
|
89
105
|
/**
|
|
90
106
|
* Legacy recommendation block config (v1 format) keyed by block ID.
|
|
91
107
|
*
|
|
@@ -228,23 +244,13 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
228
244
|
}, undefined>, undefined>;
|
|
229
245
|
}, undefined>, undefined>, readonly []>;
|
|
230
246
|
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* (
|
|
247
|
+
* Partner-keyed set of dynamic-content items the account offers, e.g.
|
|
248
|
+
* `{ [partnerName]: [{ text, value, children }] }`. Guido flattens it
|
|
249
|
+
* (union across partners, leaf attributes only) into the label→token map
|
|
250
|
+
* that repairs label-form placeholders (`{{ Phone Number }}`) in dropped
|
|
251
|
+
* saved modules.
|
|
234
252
|
*/
|
|
235
|
-
readonly
|
|
236
|
-
/** Display text for the dynamic content */
|
|
237
|
-
readonly text: v.StringSchema<undefined>;
|
|
238
|
-
/** Template variable value (e.g., {{username}}) */
|
|
239
|
-
readonly value: v.StringSchema<undefined>;
|
|
240
|
-
/** Fallback value if variable is empty */
|
|
241
|
-
readonly fallback: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
242
|
-
/** Optional formatting options */
|
|
243
|
-
readonly format: v.OptionalSchema<v.ObjectSchema<{
|
|
244
|
-
readonly key: v.StringSchema<undefined>;
|
|
245
|
-
readonly value: v.StringSchema<undefined>;
|
|
246
|
-
}, undefined>, undefined>;
|
|
247
|
-
}, undefined>, undefined>, readonly []>;
|
|
253
|
+
readonly dynamicContentList: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithFallback<v.ArraySchema<v.GenericSchema<DynamicContentNode>, undefined>, readonly []>, undefined>, {}>;
|
|
248
254
|
/** Valid custom field attribute names from the partner's categorized fields */
|
|
249
255
|
readonly customFieldAttributes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
250
256
|
/** Selected unsubscribe page IDs */
|
|
@@ -641,23 +647,13 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
641
647
|
}, undefined>, undefined>;
|
|
642
648
|
}, undefined>, undefined>, readonly []>;
|
|
643
649
|
/**
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
* (
|
|
650
|
+
* Partner-keyed set of dynamic-content items the account offers, e.g.
|
|
651
|
+
* `{ [partnerName]: [{ text, value, children }] }`. Guido flattens it
|
|
652
|
+
* (union across partners, leaf attributes only) into the label→token map
|
|
653
|
+
* that repairs label-form placeholders (`{{ Phone Number }}`) in dropped
|
|
654
|
+
* saved modules.
|
|
647
655
|
*/
|
|
648
|
-
readonly
|
|
649
|
-
/** Display text for the dynamic content */
|
|
650
|
-
readonly text: v.StringSchema<undefined>;
|
|
651
|
-
/** Template variable value (e.g., {{username}}) */
|
|
652
|
-
readonly value: v.StringSchema<undefined>;
|
|
653
|
-
/** Fallback value if variable is empty */
|
|
654
|
-
readonly fallback: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
655
|
-
/** Optional formatting options */
|
|
656
|
-
readonly format: v.OptionalSchema<v.ObjectSchema<{
|
|
657
|
-
readonly key: v.StringSchema<undefined>;
|
|
658
|
-
readonly value: v.StringSchema<undefined>;
|
|
659
|
-
}, undefined>, undefined>;
|
|
660
|
-
}, undefined>, undefined>, readonly []>;
|
|
656
|
+
readonly dynamicContentList: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.SchemaWithFallback<v.ArraySchema<v.GenericSchema<DynamicContentNode>, undefined>, readonly []>, undefined>, {}>;
|
|
661
657
|
/** Valid custom field attribute names from the partner's categorized fields */
|
|
662
658
|
readonly customFieldAttributes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
663
659
|
/** Selected unsubscribe page IDs */
|
|
@@ -13,6 +13,24 @@ export type BaseDynamicContent = {
|
|
|
13
13
|
export type DynamicContent = BaseDynamicContent & {
|
|
14
14
|
text: string;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* A node in the partner-keyed dynamic-content tree (backend categorized-fields
|
|
18
|
+
* shape). Category nodes carry `children`/`select_items`; leaf nodes are the
|
|
19
|
+
* real attributes. Extra backend fields are allowed and ignored.
|
|
20
|
+
*/
|
|
21
|
+
export type DynamicContentNode = {
|
|
22
|
+
text?: string;
|
|
23
|
+
tag_text?: string;
|
|
24
|
+
value?: string;
|
|
25
|
+
children?: DynamicContentNode[];
|
|
26
|
+
select_items?: DynamicContentNode[];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Partner-keyed dynamic-content list. Architect is multi-partner, so the map is
|
|
30
|
+
* keyed by partner name; each entry is that partner's category tree. Guido
|
|
31
|
+
* flattens it (union across partners, leaf attributes only) into a `DynamicContent[]`.
|
|
32
|
+
*/
|
|
33
|
+
export type DynamicContentList = Record<string, DynamicContentNode[]>;
|
|
16
34
|
export type MergeTag = BaseDynamicContent & {
|
|
17
35
|
label: string;
|
|
18
36
|
selStart?: number;
|
|
@@ -34,15 +34,9 @@ export declare const useConfig: () => {
|
|
|
34
34
|
value: string;
|
|
35
35
|
} | undefined;
|
|
36
36
|
}[];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
fallback?: string | undefined;
|
|
41
|
-
format?: {
|
|
42
|
-
key: string;
|
|
43
|
-
value: string;
|
|
44
|
-
} | undefined;
|
|
45
|
-
}[];
|
|
37
|
+
dynamicContentList: {
|
|
38
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
39
|
+
};
|
|
46
40
|
customFieldAttributes: string[];
|
|
47
41
|
selectedUnsubscribePages: number[];
|
|
48
42
|
forceRecreate: boolean;
|
|
@@ -171,15 +165,9 @@ export declare const useConfig: () => {
|
|
|
171
165
|
value: string;
|
|
172
166
|
} | undefined;
|
|
173
167
|
}[];
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
fallback?: string | undefined;
|
|
178
|
-
format?: {
|
|
179
|
-
key: string;
|
|
180
|
-
value: string;
|
|
181
|
-
} | undefined;
|
|
182
|
-
}[];
|
|
168
|
+
dynamicContentList: {
|
|
169
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
170
|
+
};
|
|
183
171
|
customFieldAttributes: string[];
|
|
184
172
|
selectedUnsubscribePages: number[];
|
|
185
173
|
forceRecreate: boolean;
|
package/dist/src/library.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { default as Guido } from './components/Guido.vue';
|
|
|
2
2
|
export type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, TemplateMigrationConfig, LegacyRecommendationConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, DynamicContent, EmailHeader, DefaultBlockType, CustomBlockType, ValidationResult, ValidationError, } from './@types/config';
|
|
3
3
|
export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidationErrors, MessageType, ProductType, } from './@types/config';
|
|
4
4
|
export type { StripoEventType } from './@types/events';
|
|
5
|
-
export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
|
|
5
|
+
export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
|
|
@@ -39,15 +39,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
39
39
|
value: string;
|
|
40
40
|
} | undefined;
|
|
41
41
|
}[];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
fallback?: string | undefined;
|
|
46
|
-
format?: {
|
|
47
|
-
key: string;
|
|
48
|
-
value: string;
|
|
49
|
-
} | undefined;
|
|
50
|
-
}[];
|
|
42
|
+
dynamicContentList: {
|
|
43
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
44
|
+
};
|
|
51
45
|
customFieldAttributes: string[];
|
|
52
46
|
selectedUnsubscribePages: number[];
|
|
53
47
|
forceRecreate: boolean;
|
|
@@ -182,15 +176,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
182
176
|
value: string;
|
|
183
177
|
} | undefined;
|
|
184
178
|
}[];
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
fallback?: string | undefined;
|
|
189
|
-
format?: {
|
|
190
|
-
key: string;
|
|
191
|
-
value: string;
|
|
192
|
-
} | undefined;
|
|
193
|
-
}[];
|
|
179
|
+
dynamicContentList: {
|
|
180
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
181
|
+
};
|
|
194
182
|
customFieldAttributes: string[];
|
|
195
183
|
selectedUnsubscribePages: number[];
|
|
196
184
|
forceRecreate: boolean;
|
|
@@ -325,15 +313,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
325
313
|
value: string;
|
|
326
314
|
} | undefined;
|
|
327
315
|
}[];
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
fallback?: string | undefined;
|
|
332
|
-
format?: {
|
|
333
|
-
key: string;
|
|
334
|
-
value: string;
|
|
335
|
-
} | undefined;
|
|
336
|
-
}[];
|
|
316
|
+
dynamicContentList: {
|
|
317
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
318
|
+
};
|
|
337
319
|
customFieldAttributes: string[];
|
|
338
320
|
selectedUnsubscribePages: number[];
|
|
339
321
|
forceRecreate: boolean;
|
|
@@ -468,15 +450,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
468
450
|
value: string;
|
|
469
451
|
} | undefined;
|
|
470
452
|
}[];
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
fallback?: string | undefined;
|
|
475
|
-
format?: {
|
|
476
|
-
key: string;
|
|
477
|
-
value: string;
|
|
478
|
-
} | undefined;
|
|
479
|
-
}[];
|
|
453
|
+
dynamicContentList: {
|
|
454
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
455
|
+
};
|
|
480
456
|
customFieldAttributes: string[];
|
|
481
457
|
selectedUnsubscribePages: number[];
|
|
482
458
|
forceRecreate: boolean;
|
|
@@ -611,15 +587,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
611
587
|
value: string;
|
|
612
588
|
} | undefined;
|
|
613
589
|
}[];
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
fallback?: string | undefined;
|
|
618
|
-
format?: {
|
|
619
|
-
key: string;
|
|
620
|
-
value: string;
|
|
621
|
-
} | undefined;
|
|
622
|
-
}[];
|
|
590
|
+
dynamicContentList: {
|
|
591
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
592
|
+
};
|
|
623
593
|
customFieldAttributes: string[];
|
|
624
594
|
selectedUnsubscribePages: number[];
|
|
625
595
|
forceRecreate: boolean;
|
|
@@ -754,15 +724,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
754
724
|
value: string;
|
|
755
725
|
} | undefined;
|
|
756
726
|
}[];
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
fallback?: string | undefined;
|
|
761
|
-
format?: {
|
|
762
|
-
key: string;
|
|
763
|
-
value: string;
|
|
764
|
-
} | undefined;
|
|
765
|
-
}[];
|
|
727
|
+
dynamicContentList: {
|
|
728
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
729
|
+
};
|
|
766
730
|
customFieldAttributes: string[];
|
|
767
731
|
selectedUnsubscribePages: number[];
|
|
768
732
|
forceRecreate: boolean;
|
|
@@ -897,15 +861,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
897
861
|
value: string;
|
|
898
862
|
} | undefined;
|
|
899
863
|
}[];
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
fallback?: string | undefined;
|
|
904
|
-
format?: {
|
|
905
|
-
key: string;
|
|
906
|
-
value: string;
|
|
907
|
-
} | undefined;
|
|
908
|
-
}[];
|
|
864
|
+
dynamicContentList: {
|
|
865
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
866
|
+
};
|
|
909
867
|
customFieldAttributes: string[];
|
|
910
868
|
selectedUnsubscribePages: number[];
|
|
911
869
|
forceRecreate: boolean;
|
|
@@ -1040,15 +998,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1040
998
|
value: string;
|
|
1041
999
|
} | undefined;
|
|
1042
1000
|
}[];
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
fallback?: string | undefined;
|
|
1047
|
-
format?: {
|
|
1048
|
-
key: string;
|
|
1049
|
-
value: string;
|
|
1050
|
-
} | undefined;
|
|
1051
|
-
}[];
|
|
1001
|
+
dynamicContentList: {
|
|
1002
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1003
|
+
};
|
|
1052
1004
|
customFieldAttributes: string[];
|
|
1053
1005
|
selectedUnsubscribePages: number[];
|
|
1054
1006
|
forceRecreate: boolean;
|
|
@@ -1183,15 +1135,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1183
1135
|
value: string;
|
|
1184
1136
|
} | undefined;
|
|
1185
1137
|
}[];
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
fallback?: string | undefined;
|
|
1190
|
-
format?: {
|
|
1191
|
-
key: string;
|
|
1192
|
-
value: string;
|
|
1193
|
-
} | undefined;
|
|
1194
|
-
}[];
|
|
1138
|
+
dynamicContentList: {
|
|
1139
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1140
|
+
};
|
|
1195
1141
|
customFieldAttributes: string[];
|
|
1196
1142
|
selectedUnsubscribePages: number[];
|
|
1197
1143
|
forceRecreate: boolean;
|
|
@@ -1326,15 +1272,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1326
1272
|
value: string;
|
|
1327
1273
|
} | undefined;
|
|
1328
1274
|
}[];
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
fallback?: string | undefined;
|
|
1333
|
-
format?: {
|
|
1334
|
-
key: string;
|
|
1335
|
-
value: string;
|
|
1336
|
-
} | undefined;
|
|
1337
|
-
}[];
|
|
1275
|
+
dynamicContentList: {
|
|
1276
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1277
|
+
};
|
|
1338
1278
|
customFieldAttributes: string[];
|
|
1339
1279
|
selectedUnsubscribePages: number[];
|
|
1340
1280
|
forceRecreate: boolean;
|
|
@@ -1469,15 +1409,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1469
1409
|
value: string;
|
|
1470
1410
|
} | undefined;
|
|
1471
1411
|
}[];
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
fallback?: string | undefined;
|
|
1476
|
-
format?: {
|
|
1477
|
-
key: string;
|
|
1478
|
-
value: string;
|
|
1479
|
-
} | undefined;
|
|
1480
|
-
}[];
|
|
1412
|
+
dynamicContentList: {
|
|
1413
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1414
|
+
};
|
|
1481
1415
|
customFieldAttributes: string[];
|
|
1482
1416
|
selectedUnsubscribePages: number[];
|
|
1483
1417
|
forceRecreate: boolean;
|
|
@@ -1612,15 +1546,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1612
1546
|
value: string;
|
|
1613
1547
|
} | undefined;
|
|
1614
1548
|
}[];
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
fallback?: string | undefined;
|
|
1619
|
-
format?: {
|
|
1620
|
-
key: string;
|
|
1621
|
-
value: string;
|
|
1622
|
-
} | undefined;
|
|
1623
|
-
}[];
|
|
1549
|
+
dynamicContentList: {
|
|
1550
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1551
|
+
};
|
|
1624
1552
|
customFieldAttributes: string[];
|
|
1625
1553
|
selectedUnsubscribePages: number[];
|
|
1626
1554
|
forceRecreate: boolean;
|
|
@@ -1755,15 +1683,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1755
1683
|
value: string;
|
|
1756
1684
|
} | undefined;
|
|
1757
1685
|
}[];
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
fallback?: string | undefined;
|
|
1762
|
-
format?: {
|
|
1763
|
-
key: string;
|
|
1764
|
-
value: string;
|
|
1765
|
-
} | undefined;
|
|
1766
|
-
}[];
|
|
1686
|
+
dynamicContentList: {
|
|
1687
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1688
|
+
};
|
|
1767
1689
|
customFieldAttributes: string[];
|
|
1768
1690
|
selectedUnsubscribePages: number[];
|
|
1769
1691
|
forceRecreate: boolean;
|
|
@@ -1898,15 +1820,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1898
1820
|
value: string;
|
|
1899
1821
|
} | undefined;
|
|
1900
1822
|
}[];
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
fallback?: string | undefined;
|
|
1905
|
-
format?: {
|
|
1906
|
-
key: string;
|
|
1907
|
-
value: string;
|
|
1908
|
-
} | undefined;
|
|
1909
|
-
}[];
|
|
1823
|
+
dynamicContentList: {
|
|
1824
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1825
|
+
};
|
|
1910
1826
|
customFieldAttributes: string[];
|
|
1911
1827
|
selectedUnsubscribePages: number[];
|
|
1912
1828
|
forceRecreate: boolean;
|
|
@@ -2041,15 +1957,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2041
1957
|
value: string;
|
|
2042
1958
|
} | undefined;
|
|
2043
1959
|
}[];
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
fallback?: string | undefined;
|
|
2048
|
-
format?: {
|
|
2049
|
-
key: string;
|
|
2050
|
-
value: string;
|
|
2051
|
-
} | undefined;
|
|
2052
|
-
}[];
|
|
1960
|
+
dynamicContentList: {
|
|
1961
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
1962
|
+
};
|
|
2053
1963
|
customFieldAttributes: string[];
|
|
2054
1964
|
selectedUnsubscribePages: number[];
|
|
2055
1965
|
forceRecreate: boolean;
|
|
@@ -2184,15 +2094,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2184
2094
|
value: string;
|
|
2185
2095
|
} | undefined;
|
|
2186
2096
|
}[];
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
fallback?: string | undefined;
|
|
2191
|
-
format?: {
|
|
2192
|
-
key: string;
|
|
2193
|
-
value: string;
|
|
2194
|
-
} | undefined;
|
|
2195
|
-
}[];
|
|
2097
|
+
dynamicContentList: {
|
|
2098
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
2099
|
+
};
|
|
2196
2100
|
customFieldAttributes: string[];
|
|
2197
2101
|
selectedUnsubscribePages: number[];
|
|
2198
2102
|
forceRecreate: boolean;
|
|
@@ -2327,15 +2231,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2327
2231
|
value: string;
|
|
2328
2232
|
} | undefined;
|
|
2329
2233
|
}[];
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
fallback?: string | undefined;
|
|
2334
|
-
format?: {
|
|
2335
|
-
key: string;
|
|
2336
|
-
value: string;
|
|
2337
|
-
} | undefined;
|
|
2338
|
-
}[];
|
|
2234
|
+
dynamicContentList: {
|
|
2235
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
2236
|
+
};
|
|
2339
2237
|
customFieldAttributes: string[];
|
|
2340
2238
|
selectedUnsubscribePages: number[];
|
|
2341
2239
|
forceRecreate: boolean;
|
|
@@ -2470,15 +2368,9 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2470
2368
|
value: string;
|
|
2471
2369
|
} | undefined;
|
|
2472
2370
|
}[];
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
fallback?: string | undefined;
|
|
2477
|
-
format?: {
|
|
2478
|
-
key: string;
|
|
2479
|
-
value: string;
|
|
2480
|
-
} | undefined;
|
|
2481
|
-
}[];
|
|
2371
|
+
dynamicContentList: {
|
|
2372
|
+
[x: string]: import("../library").DynamicContentNode[];
|
|
2373
|
+
};
|
|
2482
2374
|
customFieldAttributes: string[];
|
|
2483
2375
|
selectedUnsubscribePages: number[];
|
|
2484
2376
|
forceRecreate: boolean;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import type { DynamicContent, MergeTag } from '@@/Types/generic';
|
|
1
|
+
import type { DynamicContent, DynamicContentList, MergeTag } from '@@/Types/generic';
|
|
2
2
|
export declare const mergeTagToDynamicContent: (mergeTag: MergeTag) => DynamicContent;
|
|
3
3
|
export declare const dynamicContentToMergeTags: (dynamicContentList: DynamicContent[], liquidSyntax?: boolean) => MergeTag[];
|
|
4
|
+
/**
|
|
5
|
+
* Flattens the partner-keyed dynamic-content tree into a deduped flat list of the
|
|
6
|
+
* ACTIVE partner's leaf attributes. A single editor session targets one partner,
|
|
7
|
+
* so only the FIRST partner entry is used (the sole entry for a single-partner
|
|
8
|
+
* host like email-fe; merging all partners would risk cross-partner label
|
|
9
|
+
* collisions). A node carrying `children`/`select_items` is a category grouping:
|
|
10
|
+
* recursed into but never collected itself — only real leaf attributes
|
|
11
|
+
* (`text`/`tag_text` + `value`) become `{ text, value }` pairs.
|
|
12
|
+
*/
|
|
13
|
+
export declare const flattenDynamicContentList: (list: DynamicContentList | undefined | null) => DynamicContent[];
|
|
4
14
|
/**
|
|
5
15
|
* Builds the editor merge-tag entries from the template's preselected list plus
|
|
6
16
|
* the account's full available list, deduped by token value (preselected wins so
|
|
@@ -1,54 +1,68 @@
|
|
|
1
|
-
const
|
|
2
|
-
const a =
|
|
3
|
-
text:
|
|
4
|
-
value:
|
|
1
|
+
const o = (l) => {
|
|
2
|
+
const a = l.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((t) => t.trim()), [c] = a, r = {
|
|
3
|
+
text: l.label,
|
|
4
|
+
value: c || ""
|
|
5
5
|
};
|
|
6
6
|
if (a.length >= 2) {
|
|
7
|
-
const [,
|
|
8
|
-
if (
|
|
9
|
-
let
|
|
10
|
-
|
|
7
|
+
const [, t, e] = a;
|
|
8
|
+
if (t.startsWith("default:")) {
|
|
9
|
+
let n = t.slice(8).trim();
|
|
10
|
+
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
11
|
} else {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const n = t.includes("=") ? { key: t.split("=")[0].trim(), value: t.split("=")[1].trim() } : null;
|
|
13
|
+
n ? r.format = n : e || (r.fallback = t), e && (r.fallback = e);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
return
|
|
17
|
-
},
|
|
16
|
+
return r;
|
|
17
|
+
}, f = (l, s = !1) => l.map((a) => {
|
|
18
18
|
if (a.format)
|
|
19
19
|
return {
|
|
20
20
|
label: `${a.text} | ${a.format.key}=${a.format.value}`,
|
|
21
21
|
value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
|
|
22
22
|
};
|
|
23
|
-
if (
|
|
23
|
+
if (s) {
|
|
24
24
|
if (!a.fallback)
|
|
25
25
|
return {
|
|
26
26
|
label: a.text,
|
|
27
27
|
value: `{{ ${a.value} }}`
|
|
28
28
|
};
|
|
29
|
-
const
|
|
29
|
+
const r = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
|
|
30
30
|
return {
|
|
31
31
|
label: `${a.text} | ${a.fallback}`,
|
|
32
|
-
value: `{{ ${a.value} | default: ${
|
|
32
|
+
value: `{{ ${a.value} | default: ${r} }}`
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
36
|
label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
|
|
37
37
|
value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
|
|
38
38
|
};
|
|
39
|
-
}),
|
|
40
|
-
const
|
|
39
|
+
}), b = (l) => {
|
|
40
|
+
const s = [], a = /* @__PURE__ */ new Set(), c = (t) => {
|
|
41
|
+
Array.isArray(t) && t.forEach((e) => {
|
|
42
|
+
const n = [...e.children ?? [], ...e.select_items ?? []];
|
|
43
|
+
if (n.length > 0) {
|
|
44
|
+
c(n);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const u = e.text || e.tag_text;
|
|
48
|
+
u && e.value && !a.has(e.value) && (a.add(e.value), s.push({ text: u, value: e.value }));
|
|
49
|
+
});
|
|
50
|
+
}, [r] = Object.values(l ?? {});
|
|
51
|
+
return c(r), s;
|
|
52
|
+
}, v = (l, s, a = !1) => {
|
|
53
|
+
const c = new Set(l.map((t) => t.value)), r = s.filter((t) => c.has(t.value) ? !1 : (c.add(t.value), !0));
|
|
41
54
|
return [
|
|
42
|
-
...
|
|
43
|
-
...
|
|
55
|
+
...f(l, a),
|
|
56
|
+
...f(r, a)
|
|
44
57
|
];
|
|
45
|
-
},
|
|
46
|
-
var
|
|
47
|
-
return ((
|
|
58
|
+
}, i = () => {
|
|
59
|
+
var l;
|
|
60
|
+
return ((l = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : l.getAttribute("content")) ?? "";
|
|
48
61
|
};
|
|
49
62
|
export {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
b as
|
|
53
|
-
|
|
63
|
+
v as buildMergeTagEntries,
|
|
64
|
+
f as dynamicContentToMergeTags,
|
|
65
|
+
b as flattenDynamicContentList,
|
|
66
|
+
i as getCsrfToken,
|
|
67
|
+
o as mergeTagToDynamicContent
|
|
54
68
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.11.0-beta.
|
|
3
|
+
"version": "3.11.0-beta.f4ab671",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|