@useinsider/guido 3.11.0-beta.ed60c66 → 3.11.0-beta.f2b79f2
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 +49 -40
- package/dist/components/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +41 -41
- package/dist/components/organisms/onboarding/AMPOnboarding.vue.js +10 -11
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +6 -6
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +23 -20
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +11 -12
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue.js +7 -8
- package/dist/composables/useModuleDynamicContentRepair.js +36 -0
- package/dist/composables/useStripo.js +62 -59
- package/dist/enums/academy.js +1 -1
- package/dist/enums/date.js +4 -3
- package/dist/enums/onboarding.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +36 -0
- package/dist/src/composables/useConfig.d.ts +18 -0
- package/dist/src/composables/useModuleDynamicContentRepair.d.ts +18 -0
- package/dist/src/enums/academy.d.ts +3 -3
- package/dist/src/enums/onboarding.d.ts +0 -3
- package/dist/src/stores/config.d.ts +162 -0
- package/dist/src/utils/dynamicContentConverter.d.ts +27 -0
- package/dist/src/utils/genericUtil.d.ts +7 -0
- package/dist/stores/onboarding.js +11 -14
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/dynamicContentConverter.js +31 -0
- package/dist/utils/genericUtil.js +26 -19
- package/package.json +1 -1
|
@@ -39,6 +39,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
39
39
|
value: string;
|
|
40
40
|
} | undefined;
|
|
41
41
|
}[];
|
|
42
|
+
availableDynamicContent: {
|
|
43
|
+
text: string;
|
|
44
|
+
value: string;
|
|
45
|
+
fallback?: string | undefined;
|
|
46
|
+
format?: {
|
|
47
|
+
key: string;
|
|
48
|
+
value: string;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}[];
|
|
42
51
|
customFieldAttributes: string[];
|
|
43
52
|
selectedUnsubscribePages: number[];
|
|
44
53
|
forceRecreate: boolean;
|
|
@@ -173,6 +182,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
173
182
|
value: string;
|
|
174
183
|
} | undefined;
|
|
175
184
|
}[];
|
|
185
|
+
availableDynamicContent: {
|
|
186
|
+
text: string;
|
|
187
|
+
value: string;
|
|
188
|
+
fallback?: string | undefined;
|
|
189
|
+
format?: {
|
|
190
|
+
key: string;
|
|
191
|
+
value: string;
|
|
192
|
+
} | undefined;
|
|
193
|
+
}[];
|
|
176
194
|
customFieldAttributes: string[];
|
|
177
195
|
selectedUnsubscribePages: number[];
|
|
178
196
|
forceRecreate: boolean;
|
|
@@ -307,6 +325,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
307
325
|
value: string;
|
|
308
326
|
} | undefined;
|
|
309
327
|
}[];
|
|
328
|
+
availableDynamicContent: {
|
|
329
|
+
text: string;
|
|
330
|
+
value: string;
|
|
331
|
+
fallback?: string | undefined;
|
|
332
|
+
format?: {
|
|
333
|
+
key: string;
|
|
334
|
+
value: string;
|
|
335
|
+
} | undefined;
|
|
336
|
+
}[];
|
|
310
337
|
customFieldAttributes: string[];
|
|
311
338
|
selectedUnsubscribePages: number[];
|
|
312
339
|
forceRecreate: boolean;
|
|
@@ -441,6 +468,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
441
468
|
value: string;
|
|
442
469
|
} | undefined;
|
|
443
470
|
}[];
|
|
471
|
+
availableDynamicContent: {
|
|
472
|
+
text: string;
|
|
473
|
+
value: string;
|
|
474
|
+
fallback?: string | undefined;
|
|
475
|
+
format?: {
|
|
476
|
+
key: string;
|
|
477
|
+
value: string;
|
|
478
|
+
} | undefined;
|
|
479
|
+
}[];
|
|
444
480
|
customFieldAttributes: string[];
|
|
445
481
|
selectedUnsubscribePages: number[];
|
|
446
482
|
forceRecreate: boolean;
|
|
@@ -575,6 +611,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
575
611
|
value: string;
|
|
576
612
|
} | undefined;
|
|
577
613
|
}[];
|
|
614
|
+
availableDynamicContent: {
|
|
615
|
+
text: string;
|
|
616
|
+
value: string;
|
|
617
|
+
fallback?: string | undefined;
|
|
618
|
+
format?: {
|
|
619
|
+
key: string;
|
|
620
|
+
value: string;
|
|
621
|
+
} | undefined;
|
|
622
|
+
}[];
|
|
578
623
|
customFieldAttributes: string[];
|
|
579
624
|
selectedUnsubscribePages: number[];
|
|
580
625
|
forceRecreate: boolean;
|
|
@@ -709,6 +754,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
709
754
|
value: string;
|
|
710
755
|
} | undefined;
|
|
711
756
|
}[];
|
|
757
|
+
availableDynamicContent: {
|
|
758
|
+
text: string;
|
|
759
|
+
value: string;
|
|
760
|
+
fallback?: string | undefined;
|
|
761
|
+
format?: {
|
|
762
|
+
key: string;
|
|
763
|
+
value: string;
|
|
764
|
+
} | undefined;
|
|
765
|
+
}[];
|
|
712
766
|
customFieldAttributes: string[];
|
|
713
767
|
selectedUnsubscribePages: number[];
|
|
714
768
|
forceRecreate: boolean;
|
|
@@ -843,6 +897,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
843
897
|
value: string;
|
|
844
898
|
} | undefined;
|
|
845
899
|
}[];
|
|
900
|
+
availableDynamicContent: {
|
|
901
|
+
text: string;
|
|
902
|
+
value: string;
|
|
903
|
+
fallback?: string | undefined;
|
|
904
|
+
format?: {
|
|
905
|
+
key: string;
|
|
906
|
+
value: string;
|
|
907
|
+
} | undefined;
|
|
908
|
+
}[];
|
|
846
909
|
customFieldAttributes: string[];
|
|
847
910
|
selectedUnsubscribePages: number[];
|
|
848
911
|
forceRecreate: boolean;
|
|
@@ -977,6 +1040,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
977
1040
|
value: string;
|
|
978
1041
|
} | undefined;
|
|
979
1042
|
}[];
|
|
1043
|
+
availableDynamicContent: {
|
|
1044
|
+
text: string;
|
|
1045
|
+
value: string;
|
|
1046
|
+
fallback?: string | undefined;
|
|
1047
|
+
format?: {
|
|
1048
|
+
key: string;
|
|
1049
|
+
value: string;
|
|
1050
|
+
} | undefined;
|
|
1051
|
+
}[];
|
|
980
1052
|
customFieldAttributes: string[];
|
|
981
1053
|
selectedUnsubscribePages: number[];
|
|
982
1054
|
forceRecreate: boolean;
|
|
@@ -1111,6 +1183,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1111
1183
|
value: string;
|
|
1112
1184
|
} | undefined;
|
|
1113
1185
|
}[];
|
|
1186
|
+
availableDynamicContent: {
|
|
1187
|
+
text: string;
|
|
1188
|
+
value: string;
|
|
1189
|
+
fallback?: string | undefined;
|
|
1190
|
+
format?: {
|
|
1191
|
+
key: string;
|
|
1192
|
+
value: string;
|
|
1193
|
+
} | undefined;
|
|
1194
|
+
}[];
|
|
1114
1195
|
customFieldAttributes: string[];
|
|
1115
1196
|
selectedUnsubscribePages: number[];
|
|
1116
1197
|
forceRecreate: boolean;
|
|
@@ -1245,6 +1326,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1245
1326
|
value: string;
|
|
1246
1327
|
} | undefined;
|
|
1247
1328
|
}[];
|
|
1329
|
+
availableDynamicContent: {
|
|
1330
|
+
text: string;
|
|
1331
|
+
value: string;
|
|
1332
|
+
fallback?: string | undefined;
|
|
1333
|
+
format?: {
|
|
1334
|
+
key: string;
|
|
1335
|
+
value: string;
|
|
1336
|
+
} | undefined;
|
|
1337
|
+
}[];
|
|
1248
1338
|
customFieldAttributes: string[];
|
|
1249
1339
|
selectedUnsubscribePages: number[];
|
|
1250
1340
|
forceRecreate: boolean;
|
|
@@ -1379,6 +1469,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1379
1469
|
value: string;
|
|
1380
1470
|
} | undefined;
|
|
1381
1471
|
}[];
|
|
1472
|
+
availableDynamicContent: {
|
|
1473
|
+
text: string;
|
|
1474
|
+
value: string;
|
|
1475
|
+
fallback?: string | undefined;
|
|
1476
|
+
format?: {
|
|
1477
|
+
key: string;
|
|
1478
|
+
value: string;
|
|
1479
|
+
} | undefined;
|
|
1480
|
+
}[];
|
|
1382
1481
|
customFieldAttributes: string[];
|
|
1383
1482
|
selectedUnsubscribePages: number[];
|
|
1384
1483
|
forceRecreate: boolean;
|
|
@@ -1513,6 +1612,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1513
1612
|
value: string;
|
|
1514
1613
|
} | undefined;
|
|
1515
1614
|
}[];
|
|
1615
|
+
availableDynamicContent: {
|
|
1616
|
+
text: string;
|
|
1617
|
+
value: string;
|
|
1618
|
+
fallback?: string | undefined;
|
|
1619
|
+
format?: {
|
|
1620
|
+
key: string;
|
|
1621
|
+
value: string;
|
|
1622
|
+
} | undefined;
|
|
1623
|
+
}[];
|
|
1516
1624
|
customFieldAttributes: string[];
|
|
1517
1625
|
selectedUnsubscribePages: number[];
|
|
1518
1626
|
forceRecreate: boolean;
|
|
@@ -1647,6 +1755,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1647
1755
|
value: string;
|
|
1648
1756
|
} | undefined;
|
|
1649
1757
|
}[];
|
|
1758
|
+
availableDynamicContent: {
|
|
1759
|
+
text: string;
|
|
1760
|
+
value: string;
|
|
1761
|
+
fallback?: string | undefined;
|
|
1762
|
+
format?: {
|
|
1763
|
+
key: string;
|
|
1764
|
+
value: string;
|
|
1765
|
+
} | undefined;
|
|
1766
|
+
}[];
|
|
1650
1767
|
customFieldAttributes: string[];
|
|
1651
1768
|
selectedUnsubscribePages: number[];
|
|
1652
1769
|
forceRecreate: boolean;
|
|
@@ -1781,6 +1898,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1781
1898
|
value: string;
|
|
1782
1899
|
} | undefined;
|
|
1783
1900
|
}[];
|
|
1901
|
+
availableDynamicContent: {
|
|
1902
|
+
text: string;
|
|
1903
|
+
value: string;
|
|
1904
|
+
fallback?: string | undefined;
|
|
1905
|
+
format?: {
|
|
1906
|
+
key: string;
|
|
1907
|
+
value: string;
|
|
1908
|
+
} | undefined;
|
|
1909
|
+
}[];
|
|
1784
1910
|
customFieldAttributes: string[];
|
|
1785
1911
|
selectedUnsubscribePages: number[];
|
|
1786
1912
|
forceRecreate: boolean;
|
|
@@ -1915,6 +2041,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1915
2041
|
value: string;
|
|
1916
2042
|
} | undefined;
|
|
1917
2043
|
}[];
|
|
2044
|
+
availableDynamicContent: {
|
|
2045
|
+
text: string;
|
|
2046
|
+
value: string;
|
|
2047
|
+
fallback?: string | undefined;
|
|
2048
|
+
format?: {
|
|
2049
|
+
key: string;
|
|
2050
|
+
value: string;
|
|
2051
|
+
} | undefined;
|
|
2052
|
+
}[];
|
|
1918
2053
|
customFieldAttributes: string[];
|
|
1919
2054
|
selectedUnsubscribePages: number[];
|
|
1920
2055
|
forceRecreate: boolean;
|
|
@@ -2049,6 +2184,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2049
2184
|
value: string;
|
|
2050
2185
|
} | undefined;
|
|
2051
2186
|
}[];
|
|
2187
|
+
availableDynamicContent: {
|
|
2188
|
+
text: string;
|
|
2189
|
+
value: string;
|
|
2190
|
+
fallback?: string | undefined;
|
|
2191
|
+
format?: {
|
|
2192
|
+
key: string;
|
|
2193
|
+
value: string;
|
|
2194
|
+
} | undefined;
|
|
2195
|
+
}[];
|
|
2052
2196
|
customFieldAttributes: string[];
|
|
2053
2197
|
selectedUnsubscribePages: number[];
|
|
2054
2198
|
forceRecreate: boolean;
|
|
@@ -2183,6 +2327,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2183
2327
|
value: string;
|
|
2184
2328
|
} | undefined;
|
|
2185
2329
|
}[];
|
|
2330
|
+
availableDynamicContent: {
|
|
2331
|
+
text: string;
|
|
2332
|
+
value: string;
|
|
2333
|
+
fallback?: string | undefined;
|
|
2334
|
+
format?: {
|
|
2335
|
+
key: string;
|
|
2336
|
+
value: string;
|
|
2337
|
+
} | undefined;
|
|
2338
|
+
}[];
|
|
2186
2339
|
customFieldAttributes: string[];
|
|
2187
2340
|
selectedUnsubscribePages: number[];
|
|
2188
2341
|
forceRecreate: boolean;
|
|
@@ -2317,6 +2470,15 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2317
2470
|
value: string;
|
|
2318
2471
|
} | undefined;
|
|
2319
2472
|
}[];
|
|
2473
|
+
availableDynamicContent: {
|
|
2474
|
+
text: string;
|
|
2475
|
+
value: string;
|
|
2476
|
+
fallback?: string | undefined;
|
|
2477
|
+
format?: {
|
|
2478
|
+
key: string;
|
|
2479
|
+
value: string;
|
|
2480
|
+
} | undefined;
|
|
2481
|
+
}[];
|
|
2320
2482
|
customFieldAttributes: string[];
|
|
2321
2483
|
selectedUnsubscribePages: number[];
|
|
2322
2484
|
forceRecreate: boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DynamicContent } from '@@/Types/generic';
|
|
2
|
+
export interface DynamicContentConversionResult {
|
|
3
|
+
html: string;
|
|
4
|
+
/** Distinct tokens that matched neither a known value nor a known label (reported to the user). */
|
|
5
|
+
unresolved: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Builds a label→item lookup from one or more dynamic-content lists, keyed by
|
|
9
|
+
* normalized label (trimmed, lowercased). When lists overlap, a later list wins
|
|
10
|
+
* for a shared key.
|
|
11
|
+
*/
|
|
12
|
+
export declare const buildDynamicContentLookup: (...lists: DynamicContent[][]) => Map<string, DynamicContent>;
|
|
13
|
+
/**
|
|
14
|
+
* Repairs dynamic-content tokens in a dropped module's HTML, using `lookup`
|
|
15
|
+
* (label→item) built from the account's full dynamic-content list. Returns the
|
|
16
|
+
* rewritten HTML plus the tokens it could not resolve.
|
|
17
|
+
*
|
|
18
|
+
* A token is rewritten to its canonical `{{value}}` form when its name matches a
|
|
19
|
+
* display label (`{{ Phone Number }}` → `{{phone_number}}`). Left untouched: an
|
|
20
|
+
* exact canonical value (already correct — this also stops a valid token being
|
|
21
|
+
* rewritten just because it coincides with an unrelated label), Liquid nested
|
|
22
|
+
* tokens (dotted, e.g. `coupon.code`), recommendation-block variables
|
|
23
|
+
* (`123_0_attr`), allowed system tokens, and `data-*` product tags. The account
|
|
24
|
+
* list is exhaustive, so any remaining token matching neither a value nor a label
|
|
25
|
+
* is reported in `unresolved`; the text itself is always left in place.
|
|
26
|
+
*/
|
|
27
|
+
export declare const convertModuleDynamicContent: (html: string, lookup: Map<string, DynamicContent>, liquidSyntax: boolean) => DynamicContentConversionResult;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { DynamicContent, 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
|
+
* Builds the editor merge-tag entries from the template's preselected list plus
|
|
6
|
+
* the account's full available list, deduped by token value (preselected wins so
|
|
7
|
+
* its fallback/format is kept). Registering the full list lets every recognized
|
|
8
|
+
* token — including ones repaired on module drop — render as a chip.
|
|
9
|
+
*/
|
|
10
|
+
export declare const buildMergeTagEntries: (preselected: DynamicContent[], available: DynamicContent[], liquidSyntax?: boolean) => MergeTag[];
|
|
4
11
|
export declare const getCsrfToken: () => string;
|
|
5
12
|
/**
|
|
6
13
|
* URL Parameter utilities
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { defineStore as d } from "pinia";
|
|
1
|
+
import { useOnboardingApi as r } from "../services/onboardingApi.js";
|
|
2
|
+
import { defineStore as e } from "pinia";
|
|
4
3
|
const t = () => ({
|
|
5
4
|
cardIndex: 0,
|
|
6
5
|
isActive: !1,
|
|
7
6
|
config: []
|
|
8
|
-
}),
|
|
7
|
+
}), a = () => ({
|
|
9
8
|
onboardings: {
|
|
10
9
|
newVersionPopup: t(),
|
|
11
10
|
genericOnboarding: t(),
|
|
@@ -16,8 +15,8 @@ const t = () => ({
|
|
|
16
15
|
},
|
|
17
16
|
userModalState: {},
|
|
18
17
|
isFetched: !1
|
|
19
|
-
}),
|
|
20
|
-
state: () =>
|
|
18
|
+
}), c = e("guidoOnboarding", {
|
|
19
|
+
state: () => a(),
|
|
21
20
|
getters: {
|
|
22
21
|
getOnboarding: (n) => (i) => n.onboardings[i],
|
|
23
22
|
isActive: (n) => (i) => n.onboardings[i].isActive,
|
|
@@ -46,8 +45,6 @@ const t = () => ({
|
|
|
46
45
|
return i.config[i.cardIndex];
|
|
47
46
|
},
|
|
48
47
|
shouldShowOnboarding: (n) => (i) => {
|
|
49
|
-
if (e && a.includes(i))
|
|
50
|
-
return !0;
|
|
51
48
|
const o = n.userModalState.Guido;
|
|
52
49
|
return i === "newVersionPopup" && (o != null && o.genericOnboarding) ? !1 : o ? !o[i] : !0;
|
|
53
50
|
}
|
|
@@ -75,8 +72,8 @@ const t = () => ({
|
|
|
75
72
|
this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
|
|
76
73
|
},
|
|
77
74
|
updateCardPosition(n, i, o) {
|
|
78
|
-
const
|
|
79
|
-
|
|
75
|
+
const s = this.onboardings[n].config[i];
|
|
76
|
+
s && (s.top = o.top, s.position = o.position);
|
|
80
77
|
},
|
|
81
78
|
setConfig(n, i) {
|
|
82
79
|
this.onboardings[n].config = i ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
|
|
@@ -96,15 +93,15 @@ const t = () => ({
|
|
|
96
93
|
async fetchUserModalState() {
|
|
97
94
|
if (this.isFetched)
|
|
98
95
|
return;
|
|
99
|
-
const { fetchUserModalState: n } =
|
|
96
|
+
const { fetchUserModalState: n } = r(), i = await n();
|
|
100
97
|
this.userModalState = i, this.isFetched = !0;
|
|
101
98
|
},
|
|
102
99
|
async setUserModalState(n, i, o) {
|
|
103
|
-
const { setUserModalState:
|
|
104
|
-
await
|
|
100
|
+
const { setUserModalState: s } = r();
|
|
101
|
+
await s(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
104
|
});
|
|
108
105
|
export {
|
|
109
|
-
|
|
106
|
+
c as useOnboardingStore
|
|
110
107
|
};
|
package/dist/utils/dateUtil.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { DEFAULT_LOCALE as r, DEFAULT as
|
|
2
|
-
const
|
|
1
|
+
import { DEFAULT_LOCALE as r, DEFAULT as a, DEFAULT_TZ as c } from "../enums/date.js";
|
|
2
|
+
const m = (t) => t ? t instanceof Date ? t : typeof t == "string" ? t.length === 10 ? new Date(Number(t) * 1e3) : new Date(t) : typeof t == "number" ? t.toString().length === 10 ? new Date(t * 1e3) : new Date(t) : /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(), s = () => {
|
|
3
3
|
const t = window.l10n;
|
|
4
|
-
return (t == null ? void 0 : t.locale) ===
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
return (t == null ? void 0 : t.locale) === a ? r : (t == null ? void 0 : t.locale) || r;
|
|
5
|
+
}, u = new Intl.DateTimeFormat().resolvedOptions().timeZone, f = () => {
|
|
6
|
+
const t = window.l10n;
|
|
7
|
+
return (t == null ? void 0 : t.timezone) || u || c;
|
|
8
|
+
}, D = (t, e = s(), n = f()) => {
|
|
9
|
+
const o = {
|
|
10
|
+
year: "numeric",
|
|
11
|
+
month: "2-digit",
|
|
12
|
+
day: "2-digit",
|
|
13
|
+
timeZone: n
|
|
14
|
+
}, i = m(t);
|
|
15
|
+
return new Intl.DateTimeFormat(e, o).format(i);
|
|
16
|
+
}, T = (t) => {
|
|
8
17
|
if (!t)
|
|
9
18
|
return "";
|
|
10
19
|
const e = new Date(t);
|
|
@@ -16,9 +25,13 @@ const i = (t) => {
|
|
|
16
25
|
second: "2-digit",
|
|
17
26
|
hour12: !1
|
|
18
27
|
}).format(e);
|
|
19
|
-
},
|
|
28
|
+
}, h = (t) => t ? Math.floor(Date.now() / 1e3) >= t : !1;
|
|
20
29
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
m as convertToDateObject,
|
|
31
|
+
T as formatPatchDate,
|
|
32
|
+
D as formatShortDate,
|
|
33
|
+
h as isAfterDate,
|
|
34
|
+
u as localTz,
|
|
35
|
+
s as locale,
|
|
36
|
+
f as timezone
|
|
24
37
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DATA_ATTRIBUTE_REGEX as A, DYNAMIC_CONTENT_TAG_REGEX as m, ALLOWED_DYNAMIC_SYSTEM_TOKENS as D } from "../enums/html-validator.js";
|
|
2
|
+
import { dynamicContentToMergeTags as T } from "./genericUtil.js";
|
|
3
|
+
const p = "guidoDataMask", M = "EndDataMask", f = /guidoDataMask(\d+)EndDataMask/g, h = /^\d+_\d+_.+$/, E = (o) => o.trim().toLowerCase(), I = (...o) => {
|
|
4
|
+
const r = /* @__PURE__ */ new Map();
|
|
5
|
+
return o.forEach((i) => {
|
|
6
|
+
i.forEach((s) => {
|
|
7
|
+
const a = E(s.text);
|
|
8
|
+
a && r.set(a, s);
|
|
9
|
+
});
|
|
10
|
+
}), r;
|
|
11
|
+
}, w = (o, r, i) => {
|
|
12
|
+
const s = /* @__PURE__ */ new Set(), a = new Set([...r.values()].map((e) => e.value)), u = [];
|
|
13
|
+
return { html: o.replace(A, (e) => (u.push(e), `${p}${u.length - 1}${M}`)).replace(m, (e) => {
|
|
14
|
+
const n = e.slice(2, -2), c = n.indexOf("|"), l = c === -1 ? n : n.slice(0, c), t = l.trim();
|
|
15
|
+
if (t === "" || D.includes(t) || t.includes(".") || h.test(t) || a.has(t))
|
|
16
|
+
return e;
|
|
17
|
+
const d = r.get(E(t));
|
|
18
|
+
if (d) {
|
|
19
|
+
if (c !== -1) {
|
|
20
|
+
const _ = n.slice(c);
|
|
21
|
+
return `{{${l.replace(t, () => d.value)}${_}}}`;
|
|
22
|
+
}
|
|
23
|
+
return T([d], i)[0].value;
|
|
24
|
+
}
|
|
25
|
+
return s.add(t), e;
|
|
26
|
+
}).replace(f, (e, n) => u[Number(n)]), unresolved: [...s] };
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
I as buildDynamicContentLookup,
|
|
30
|
+
w as convertModuleDynamicContent
|
|
31
|
+
};
|
|
@@ -1,47 +1,54 @@
|
|
|
1
|
-
const
|
|
2
|
-
const a =
|
|
3
|
-
text:
|
|
1
|
+
const u = (t) => {
|
|
2
|
+
const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [n] = a, e = {
|
|
3
|
+
text: t.label,
|
|
4
4
|
value: n || ""
|
|
5
5
|
};
|
|
6
6
|
if (a.length >= 2) {
|
|
7
|
-
const [, l,
|
|
7
|
+
const [, l, f] = a;
|
|
8
8
|
if (l.startsWith("default:")) {
|
|
9
|
-
let
|
|
10
|
-
|
|
9
|
+
let r = l.slice(8).trim();
|
|
10
|
+
r.startsWith('"') && r.endsWith('"') && (r = r.slice(1, -1)), e.fallback = r;
|
|
11
11
|
} else {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const r = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
|
|
13
|
+
r ? e.format = r : f || (e.fallback = l), f && (e.fallback = f);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
return
|
|
17
|
-
},
|
|
16
|
+
return e;
|
|
17
|
+
}, s = (t, c = !1) => t.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 (c) {
|
|
24
24
|
if (!a.fallback)
|
|
25
25
|
return {
|
|
26
26
|
label: a.text,
|
|
27
27
|
value: `{{ ${a.value} }}`
|
|
28
28
|
};
|
|
29
|
-
const
|
|
29
|
+
const e = !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: ${e} }}`
|
|
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
|
-
}), o = () => {
|
|
40
|
-
|
|
41
|
-
return
|
|
39
|
+
}), o = (t, c, a = !1) => {
|
|
40
|
+
const n = new Set(t.map((l) => l.value)), e = c.filter((l) => n.has(l.value) ? !1 : (n.add(l.value), !0));
|
|
41
|
+
return [
|
|
42
|
+
...s(t, a),
|
|
43
|
+
...s(e, a)
|
|
44
|
+
];
|
|
45
|
+
}, b = () => {
|
|
46
|
+
var t;
|
|
47
|
+
return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
|
|
42
48
|
};
|
|
43
49
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
o as buildMergeTagEntries,
|
|
51
|
+
s as dynamicContentToMergeTags,
|
|
52
|
+
b as getCsrfToken,
|
|
53
|
+
u as mergeTagToDynamicContent
|
|
47
54
|
};
|
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.f2b79f2",
|
|
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",
|