@useinsider/guido 3.18.1-beta.fefef3c → 3.18.2-beta.3e1d9ab

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 (56) hide show
  1. package/README.md +3 -21
  2. package/dist/@types/config/schemas.js +51 -59
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +53 -55
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -82
  7. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +22 -24
  8. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +24 -28
  9. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  10. package/dist/composables/useCustomInterfaceAppearance.js +42 -46
  11. package/dist/composables/useHttp.js +24 -22
  12. package/dist/enums/extensions/recommendationBlock.js +14 -17
  13. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +85 -80
  14. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +28 -72
  15. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -45
  16. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +48 -93
  17. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
  18. package/dist/guido.css +1 -1
  19. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +29 -28
  20. package/dist/package.json.js +1 -1
  21. package/dist/services/recommendationApi.js +84 -93
  22. package/dist/services/templateLibraryApi.js +17 -14
  23. package/dist/src/@types/config/schemas.d.ts +0 -16
  24. package/dist/src/composables/useConfig.d.ts +0 -4
  25. package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -3
  26. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
  27. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -2
  28. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -4
  29. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +13 -54
  30. package/dist/src/services/recommendationApi.d.ts +1 -2
  31. package/dist/src/stores/config.d.ts +0 -322
  32. package/dist/src/stores/onboarding.d.ts +10 -808
  33. package/dist/src/utils/genericUtil.d.ts +6 -0
  34. package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
  35. package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
  36. package/dist/stores/config.js +60 -74
  37. package/dist/stores/onboarding.js +36 -46
  38. package/dist/utils/genericUtil.js +63 -54
  39. package/dist/utils/liquidDynamicContent.js +15 -0
  40. package/dist/utils/templatePreparation.js +54 -52
  41. package/package.json +3 -3
  42. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
  43. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
  44. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +0 -21
  45. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +0 -46
  46. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
  47. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -46
  48. package/dist/composables/useLegacyStrategyConversion.js +0 -61
  49. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -72
  50. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +0 -2
  51. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +0 -2
  52. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
  53. package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
  54. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -44
  55. package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
  56. package/dist/static/assets/icons/line-info.svg.js +0 -5
@@ -30,3 +30,9 @@ export declare const replaceString: (string?: string, values?: Record<string, st
30
30
  * a string nor a number becomes ''.
31
31
  */
32
32
  export declare const asText: (value: unknown) => string;
33
+ /**
34
+ * Narrows an unknown API value to a plain JSON object. Arrays and exotic
35
+ * objects (Blob, Date, FormData) are rejected, so a response body that useHttp
36
+ * parsed as text or blob can never be read as a JSON payload.
37
+ */
38
+ export declare const isPlainObject: <T>(value: T) => value is T & Record<string, unknown>;
@@ -0,0 +1,20 @@
1
+ import type { BaseDynamicContent } from '@@/Types/generic';
2
+ export type DynamicContentFormat = NonNullable<BaseDynamicContent['format']>;
3
+ /** Format key the dynamic-content picker sends for a custom date/time format. */
4
+ export declare const TIME_FORMAT_KEY = "time-format";
5
+ /** Wraps a Liquid filter argument in whichever quote style the value itself does not use. */
6
+ export declare const quoteArgument: (value: string) => string | null;
7
+ /**
8
+ * `{ key: 'time-format', value: '%Y-%m-%d' }` -> `date: "%Y-%m-%d"`.
9
+ *
10
+ * Only a custom date/time strftime pattern has a Liquid equivalent. Anything else returns null so
11
+ * the caller emits a plain tag rather than one that silently lost — or literally printed — its
12
+ * format.
13
+ * @example formatToLiquidFilter({ key: 'time-format', value: '%b %-d, %Y' }) -> date: "%b %-d, %Y"
14
+ */
15
+ export declare const formatToLiquidFilter: (format: DynamicContentFormat) => string | null;
16
+ /**
17
+ * Inverse of `formatToLiquidFilter` — reads the picker format back out of one filter segment, so a
18
+ * reopened tag restores its selection in the host's format dropdown.
19
+ */
20
+ export declare const liquidFilterToFormat: (segment: string) => DynamicContentFormat | null;
@@ -26,40 +26,6 @@ const n = `.strategy-control-header {
26
26
  text-decoration: underline;
27
27
  }
28
28
 
29
- .strategy-control-notice-row {
30
- padding: 0 16px 16px;
31
- }
32
-
33
- .strategy-control-notice {
34
- display: flex;
35
- gap: 8px;
36
- align-items: center;
37
- padding: 12px;
38
- border: 1px solid var(--guido-color-border-onpage-message-info);
39
- border-radius: 4px;
40
- background-color: var(--guido-color-background-onpage-message-info);
41
- }
42
-
43
- .strategy-control-notice::before {
44
- content: '';
45
- flex: none;
46
- width: 24px;
47
- height: 24px;
48
- background-color: var(--guido-color-border-onpage-message-info);
49
- mask-image: var(--guido-icon-line-info);
50
- mask-repeat: no-repeat;
51
- mask-position: center;
52
- mask-size: 24px 24px;
53
- }
54
-
55
- .strategy-control-notice-text {
56
- margin: 0;
57
- padding: 4px 0;
58
- color: var(--guido-color-neutral-700);
59
- font-size: 13px;
60
- line-height: 16px;
61
- }
62
-
63
29
  .recommendation-controls-container .container.strategy-control-cta-row {
64
30
  grid-template-columns: repeat(2, minmax(0, 180px));
65
31
  justify-content: start;
@@ -98,14 +64,6 @@ const n = `.strategy-control-header {
98
64
  background-color: var(--guido-color-gray-0);
99
65
  }
100
66
 
101
- /* Figma gives the legacy band a 59px row: 17.5px above and below its 24px content. */
102
- [data-strategy-legacy-state] .strategy-control-name-band {
103
- gap: 8px;
104
- justify-content: space-between;
105
- min-height: auto;
106
- padding: 17.5px 16px;
107
- }
108
-
109
67
  .strategy-control-name {
110
68
  color: var(--guido-color-gray-800);
111
69
  font-size: 15px;
@@ -159,15 +117,6 @@ const n = `.strategy-control-header {
159
117
  mask-image: var(--guido-icon-line-plus);
160
118
  }
161
119
 
162
- .strategy-control-action--update::before {
163
- mask-image: var(--guido-icon-filled-arrow-rising);
164
- }
165
-
166
- .strategy-control-name-band .strategy-control-action > span {
167
- padding: 0 0 0 8px;
168
- }
169
-
170
- .strategy-control-action--update,
171
120
  .strategy-control-action--change {
172
121
  color: var(--guido-color-primary-500);
173
122
  }
@@ -180,38 +129,24 @@ const n = `.strategy-control-header {
180
129
  text-decoration: underline;
181
130
  }
182
131
 
183
- .strategy-control-action:disabled,
184
- .strategy-control-action:disabled:hover {
185
- color: var(--guido-color-gray-700);
186
- text-decoration: none;
187
- cursor: default;
188
- }
189
-
190
- .recommendation-controls-container:not(.strategy-block):not(.legacy-strategy-block) .strategy-control-container,
132
+ .recommendation-controls-container:not(.strategy-block) .strategy-control-container,
191
133
  .recommendation-controls-container.strategy-block .product-count-control-container,
192
134
  .recommendation-controls-container.strategy-block .algorithm-control-container,
193
135
  .recommendation-controls-container.strategy-block .filters-control-container,
194
- .recommendation-controls-container.strategy-block .shuffle-control-container,
195
- .recommendation-controls-container.legacy-strategy-block .product-count-control-container,
196
- .recommendation-controls-container.legacy-strategy-block .algorithm-control-container,
197
- .recommendation-controls-container.legacy-strategy-block .filters-control-container,
198
- .recommendation-controls-container.legacy-strategy-block .shuffle-control-container {
136
+ .recommendation-controls-container.strategy-block .shuffle-control-container {
199
137
  display: none;
200
138
  }
201
139
 
202
- .recommendation-controls-container.strategy-block,
203
- .recommendation-controls-container.legacy-strategy-block {
140
+ .recommendation-controls-container.strategy-block {
204
141
  display: flex;
205
142
  flex-direction: column;
206
143
  }
207
144
 
208
- .recommendation-controls-container.strategy-block .price-placement-control-container,
209
- .recommendation-controls-container.legacy-strategy-block .price-placement-control-container {
145
+ .recommendation-controls-container.strategy-block .price-placement-control-container {
210
146
  order: 1;
211
147
  }
212
148
 
213
- .recommendation-controls-container.strategy-block .product-layout-control-container,
214
- .recommendation-controls-container.legacy-strategy-block .product-layout-control-container {
149
+ .recommendation-controls-container.strategy-block .product-layout-control-container {
215
150
  order: 2;
216
151
  }
217
152
  `;
@@ -1,8 +1,8 @@
1
1
  import "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
3
  import { parseConfig as o } from "../@types/config/validator.js";
4
- import { defineStore as a } from "pinia";
5
- const s = a("guido-config", {
4
+ import { defineStore as r } from "pinia";
5
+ const f = r("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -11,135 +11,121 @@ const s = a("guido-config", {
11
11
  /**
12
12
  * Get the identity configuration
13
13
  */
14
- identity: (e) => {
15
- var i;
16
- return ((i = e.config) == null ? void 0 : i.identity) ?? null;
14
+ identity: (i) => {
15
+ var e;
16
+ return ((e = i.config) == null ? void 0 : e.identity) ?? null;
17
17
  },
18
18
  /**
19
19
  * Get the partner configuration
20
20
  */
21
- partner: (e) => {
22
- var i;
23
- return ((i = e.config) == null ? void 0 : i.partner) ?? null;
21
+ partner: (i) => {
22
+ var e;
23
+ return ((e = i.config) == null ? void 0 : e.partner) ?? null;
24
24
  },
25
25
  /**
26
26
  * Get the template configuration
27
27
  */
28
- template: (e) => {
29
- var i;
30
- return ((i = e.config) == null ? void 0 : i.template) ?? null;
28
+ template: (i) => {
29
+ var e;
30
+ return ((e = i.config) == null ? void 0 : e.template) ?? null;
31
31
  },
32
32
  /**
33
33
  * Get the editor configuration
34
34
  */
35
- editor: (e) => {
36
- var i;
37
- return ((i = e.config) == null ? void 0 : i.editor) ?? null;
35
+ editor: (i) => {
36
+ var e;
37
+ return ((e = i.config) == null ? void 0 : e.editor) ?? null;
38
38
  },
39
39
  /**
40
40
  * Get the UI configuration
41
41
  */
42
- ui: (e) => {
43
- var i;
44
- return ((i = e.config) == null ? void 0 : i.ui) ?? null;
42
+ ui: (i) => {
43
+ var e;
44
+ return ((e = i.config) == null ? void 0 : e.ui) ?? null;
45
45
  },
46
46
  /**
47
47
  * Get the features configuration
48
48
  */
49
- features: (e) => {
50
- var i;
51
- return ((i = e.config) == null ? void 0 : i.features) ?? null;
49
+ features: (i) => {
50
+ var e;
51
+ return ((e = i.config) == null ? void 0 : e.features) ?? null;
52
52
  },
53
53
  /**
54
54
  * Get the blocks configuration
55
55
  */
56
- blocks: (e) => {
57
- var i;
58
- return ((i = e.config) == null ? void 0 : i.blocks) ?? null;
56
+ blocks: (i) => {
57
+ var e;
58
+ return ((e = i.config) == null ? void 0 : e.blocks) ?? null;
59
59
  },
60
60
  /**
61
61
  * Get the compiler configuration
62
62
  */
63
- compiler: (e) => {
64
- var i;
65
- return ((i = e.config) == null ? void 0 : i.compiler) ?? null;
63
+ compiler: (i) => {
64
+ var e;
65
+ return ((e = i.config) == null ? void 0 : e.compiler) ?? null;
66
66
  },
67
67
  /**
68
68
  * Get the callbacks configuration
69
69
  */
70
- callbacks: (e) => {
71
- var i;
72
- return ((i = e.config) == null ? void 0 : i.callbacks) ?? null;
70
+ callbacks: (i) => {
71
+ var e;
72
+ return ((e = i.config) == null ? void 0 : e.callbacks) ?? null;
73
73
  },
74
74
  /**
75
75
  * Get the template ID
76
76
  */
77
- templateId: (e) => {
78
- var i, t;
79
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateId) ?? "";
77
+ templateId: (i) => {
78
+ var e, n;
79
+ return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.templateId) ?? "";
80
80
  },
81
81
  /**
82
82
  * Get the user ID
83
83
  */
84
- userId: (e) => {
85
- var i, t;
86
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.userId) ?? "";
84
+ userId: (i) => {
85
+ var e, n;
86
+ return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.userId) ?? "";
87
87
  },
88
88
  /**
89
89
  * Get the variation ID
90
90
  */
91
- variationId: (e) => {
92
- var i, t;
93
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.variationId) ?? "";
94
- },
95
- /**
96
- * Get the campaign ID
97
- */
98
- campaignId: (e) => {
99
- var i, t;
100
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.campaignId) ?? "";
101
- },
102
- /**
103
- * Get the template-library ID of the host template
104
- */
105
- templateLibraryId: (e) => {
106
- var i, t;
107
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateLibraryId) ?? "";
91
+ variationId: (i) => {
92
+ var e, n;
93
+ return ((n = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : n.variationId) ?? "";
108
94
  },
109
95
  /**
110
96
  * Get the partner name
111
97
  */
112
- partnerName: (e) => {
113
- var i, t;
114
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.name) ?? "";
98
+ partnerName: (i) => {
99
+ var e, n;
100
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.name) ?? "";
115
101
  },
116
102
  /**
117
103
  * Get the product type
118
104
  */
119
- productType: (e) => {
120
- var i, t;
121
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.productType) ?? 60;
105
+ productType: (i) => {
106
+ var e, n;
107
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.productType) ?? 60;
122
108
  },
123
109
  /**
124
110
  * Get the message type
125
111
  */
126
- messageType: (e) => {
127
- var i, t;
128
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.messageType) ?? 1;
112
+ messageType: (i) => {
113
+ var e, n;
114
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
129
115
  },
130
116
  /**
131
117
  * Get the username
132
118
  */
133
- username: (e) => {
134
- var i, t;
135
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.username) ?? "Guido User";
119
+ username: (i) => {
120
+ var e, n;
121
+ return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.username) ?? "Guido User";
136
122
  },
137
123
  /**
138
124
  * Check if header should be shown
139
125
  */
140
- showHeader: (e) => {
141
- var i, t;
142
- return ((t = (i = e.config) == null ? void 0 : i.ui) == null ? void 0 : t.showHeader) ?? !0;
126
+ showHeader: (i) => {
127
+ var e, n;
128
+ return ((n = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : n.showHeader) ?? !0;
143
129
  },
144
130
  /**
145
131
  * Check if a specific feature is enabled.
@@ -147,18 +133,18 @@ const s = a("guido-config", {
147
133
  * flash on during loading, then disappear once config resolves.
148
134
  */
149
135
  // eslint-disable-next-line @stylistic/max-len
150
- isFeatureEnabled: (e) => (i) => {
151
- var t, n;
152
- return ((n = (t = e.config) == null ? void 0 : t.features) == null ? void 0 : n[i]) ?? !1;
136
+ isFeatureEnabled: (i) => (e) => {
137
+ var n, t;
138
+ return ((t = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : t[e]) ?? !1;
153
139
  }
154
140
  },
155
141
  actions: {
156
142
  /**
157
143
  * Initialize the config store with validated configuration
158
144
  */
159
- init(e) {
160
- const i = o(e);
161
- this.config = i, this.initialized = !0;
145
+ init(i) {
146
+ const e = o(i);
147
+ this.config = e, this.initialized = !0;
162
148
  },
163
149
  /**
164
150
  * Reset the config store
@@ -169,5 +155,5 @@ const s = a("guido-config", {
169
155
  }
170
156
  });
171
157
  export {
172
- s as useConfigStore
158
+ f as useConfigStore
173
159
  };
@@ -1,5 +1,5 @@
1
- import { useOnboardingApi as e } from "../services/onboardingApi.js";
2
- import { defineStore as s } from "pinia";
1
+ import { useOnboardingApi as s } from "../services/onboardingApi.js";
2
+ import { defineStore as e } from "pinia";
3
3
  const t = () => ({
4
4
  cardIndex: 0,
5
5
  isActive: !1,
@@ -11,59 +11,49 @@ const t = () => ({
11
11
  textBlockOnboarding: t(),
12
12
  versionHistoryOnboarding: t(),
13
13
  ampOnboarding: t(),
14
- itemsOnboarding: t(),
15
- recommendationStrategyOnboarding: t(),
16
- recommendationLegacyStrategyOnboarding: t()
14
+ itemsOnboarding: t()
17
15
  },
18
16
  userModalState: {},
19
17
  isFetched: !1
20
- }), c = s("guidoOnboarding", {
18
+ }), c = e("guidoOnboarding", {
21
19
  state: () => a(),
22
20
  getters: {
23
- getOnboarding: (n) => (o) => n.onboardings[o],
24
- isActive: (n) => (o) => n.onboardings[o].isActive,
25
- getCurrentCard: (n) => (o) => {
26
- const i = n.onboardings[o];
27
- return i.config[i.cardIndex];
21
+ getOnboarding: (n) => (i) => n.onboardings[i],
22
+ isActive: (n) => (i) => n.onboardings[i].isActive,
23
+ getCurrentCard: (n) => (i) => {
24
+ const o = n.onboardings[i];
25
+ return o.config[o.cardIndex];
28
26
  },
29
27
  getGenericCurrentCard: (n) => {
30
- const { genericOnboarding: o } = n.onboardings;
31
- return o.config[o.cardIndex];
28
+ const { genericOnboarding: i } = n.onboardings;
29
+ return i.config[i.cardIndex];
32
30
  },
33
31
  getTextBlockCurrentCard: (n) => {
34
- const { textBlockOnboarding: o } = n.onboardings;
35
- return o.config[o.cardIndex];
32
+ const { textBlockOnboarding: i } = n.onboardings;
33
+ return i.config[i.cardIndex];
36
34
  },
37
35
  getVersionHistoryCurrentCard: (n) => {
38
- const { versionHistoryOnboarding: o } = n.onboardings;
39
- return o.config[o.cardIndex];
36
+ const { versionHistoryOnboarding: i } = n.onboardings;
37
+ return i.config[i.cardIndex];
40
38
  },
41
39
  getAmpCurrentCard: (n) => {
42
- const { ampOnboarding: o } = n.onboardings;
43
- return o.config[o.cardIndex];
40
+ const { ampOnboarding: i } = n.onboardings;
41
+ return i.config[i.cardIndex];
44
42
  },
45
43
  getItemsCurrentCard: (n) => {
46
- const { itemsOnboarding: o } = n.onboardings;
47
- return o.config[o.cardIndex];
48
- },
49
- getRecommendationStrategyCurrentCard: (n) => {
50
- const { recommendationStrategyOnboarding: o } = n.onboardings;
51
- return o.config[o.cardIndex];
52
- },
53
- getRecommendationLegacyStrategyCurrentCard: (n) => {
54
- const { recommendationLegacyStrategyOnboarding: o } = n.onboardings;
55
- return o.config[o.cardIndex];
44
+ const { itemsOnboarding: i } = n.onboardings;
45
+ return i.config[i.cardIndex];
56
46
  },
57
- shouldShowOnboarding: (n) => (o) => {
58
- const i = n.userModalState.Guido;
59
- return o === "newVersionPopup" && (i != null && i.genericOnboarding) ? !1 : i ? !i[o] : !0;
47
+ shouldShowOnboarding: (n) => (i) => {
48
+ const o = n.userModalState.Guido;
49
+ return i === "newVersionPopup" && (o != null && o.genericOnboarding) ? !1 : o ? !o[i] : !0;
60
50
  }
61
51
  },
62
52
  actions: {
63
53
  closeOtherOnboardings(n) {
64
- Object.keys(this.onboardings).forEach((o) => {
65
- const i = o;
66
- i !== n && this.onboardings[i].isActive && (this.onboardings[i].isActive = !1, this.onboardings[i].cardIndex = 0, this.onboardings[i].config = []);
54
+ Object.keys(this.onboardings).forEach((i) => {
55
+ const o = i;
56
+ o !== n && this.onboardings[o].isActive && (this.onboardings[o].isActive = !1, this.onboardings[o].cardIndex = 0, this.onboardings[o].config = []);
67
57
  });
68
58
  },
69
59
  start(n) {
@@ -81,12 +71,12 @@ const t = () => ({
81
71
  previous(n) {
82
72
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
83
73
  },
84
- updateCardPosition(n, o, i) {
85
- const r = this.onboardings[n].config[o];
86
- r && (r.top = i.top, r.position = i.position);
74
+ updateCardPosition(n, i, o) {
75
+ const r = this.onboardings[n].config[i];
76
+ r && (r.top = o.top, r.position = o.position);
87
77
  },
88
- setConfig(n, o) {
89
- this.onboardings[n].config = o ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
78
+ setConfig(n, i) {
79
+ this.onboardings[n].config = i ?? [], this.onboardings[n].cardIndex >= this.onboardings[n].config.length && (this.onboardings[n].cardIndex = 0);
90
80
  },
91
81
  async onDiscoverNowClicked() {
92
82
  await this.setUserModalState("newVersionPopup", "true", "Guido"), await this.setUserModalState("genericOnboarding", "true", "Guido"), this.start("genericOnboarding");
@@ -103,16 +93,16 @@ const t = () => ({
103
93
  async fetchUserModalState() {
104
94
  if (this.isFetched)
105
95
  return;
106
- const { fetchUserModalState: n } = e();
96
+ const { fetchUserModalState: n } = s();
107
97
  try {
108
- const o = await n();
109
- this.userModalState = o, this.isFetched = !0;
98
+ const i = await n();
99
+ this.userModalState = i, this.isFetched = !0;
110
100
  } catch {
111
101
  }
112
102
  },
113
- async setUserModalState(n, o, i) {
114
- const { setUserModalState: r } = e();
115
- await r(n, o, i), this.isFetched = !1, await this.fetchUserModalState();
103
+ async setUserModalState(n, i, o) {
104
+ const { setUserModalState: r } = s();
105
+ await r(n, i, o), this.isFetched = !1, await this.fetchUserModalState();
116
106
  }
117
107
  }
118
108
  });
@@ -1,69 +1,78 @@
1
- const o = (t) => {
2
- const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [s] = a, r = {
1
+ import { formatToLiquidFilter as b, quoteArgument as y, liquidFilterToFormat as h } from "./liquidDynamicContent.js";
2
+ const g = (t) => {
3
+ if (!t.includes("="))
4
+ return null;
5
+ const [r, e] = t.split("=");
6
+ return { key: r.trim(), value: e.trim() };
7
+ }, c = "default:", f = (t) => {
8
+ if (!t.startsWith(c))
9
+ return t;
10
+ const r = t.slice(c.length).trim(), e = (l) => r.length >= 2 && r.startsWith(l) && r.endsWith(l);
11
+ return e('"') || e("'") ? r.slice(1, -1) : r;
12
+ }, k = (t) => {
13
+ const e = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((a) => a.trim()), [l] = e, s = {
3
14
  text: t.label,
4
- value: s || ""
15
+ value: l || ""
5
16
  };
6
- if (a.length >= 2) {
7
- const [, l, e] = a;
8
- if (l.startsWith("default:")) {
9
- let n = l.slice(8).trim();
10
- n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
11
- } else {
12
- const n = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
13
- n ? r.format = n : e || (r.fallback = l), e && (r.fallback = e);
17
+ if (e.length >= 2) {
18
+ const [, a, n] = e;
19
+ if (a.startsWith(c))
20
+ s.fallback = f(a);
21
+ else {
22
+ const o = h(a) ?? g(a);
23
+ o ? s.format = o : n || (s.fallback = a), n && (s.fallback = f(n));
14
24
  }
15
25
  }
16
- return r;
17
- }, f = (t, c = !1) => t.map((a) => {
18
- if (a.format)
19
- return {
20
- label: `${a.text} | ${a.format.key}=${a.format.value}`,
21
- value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
22
- };
23
- if (c) {
24
- if (!a.fallback)
25
- return {
26
- label: a.text,
27
- value: `{{ ${a.value} }}`
28
- };
29
- const r = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
30
- return {
31
- label: `${a.text} | ${a.fallback}`,
32
- value: `{{ ${a.value} | default: ${r} }}`
33
- };
34
- }
26
+ return s;
27
+ }, p = (t) => {
28
+ const e = !Number.isNaN(Number(t)) && t.trim() !== "" ? t : y(t);
29
+ return e === null ? null : `${c} ${e}`;
30
+ }, v = (t) => {
31
+ const r = t.format ? b(t.format) : null, e = t.fallback ? p(t.fallback) : null, l = [t.value, r, e].filter(Boolean);
35
32
  return {
36
- label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
37
- value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
33
+ label: [t.text, r, e && t.fallback].filter(Boolean).join(" | "),
34
+ value: `{{ ${l.join(" | ")} }}`
38
35
  };
39
- }), b = (t) => {
40
- const c = [], a = /* @__PURE__ */ new Set(), s = (l) => {
41
- Array.isArray(l) && l.forEach((e) => {
42
- const n = [...e.children ?? [], ...e.select_items ?? []];
43
- if (n.length > 0) {
44
- s(n);
36
+ }, i = (t, r = !1) => t.map((e) => r ? v(e) : e.format ? {
37
+ label: `${e.text} | ${e.format.key}=${e.format.value}`,
38
+ value: `{{${e.value}|${e.format.key}=${e.format.value}}}`
39
+ } : {
40
+ label: e.fallback ? `${e.text} | ${e.fallback}` : e.text,
41
+ value: e.fallback ? `{{${e.value}|${e.fallback}}}` : `{{${e.value}}}`
42
+ }), $ = (t) => {
43
+ const r = [], e = /* @__PURE__ */ new Set(), l = (a) => {
44
+ Array.isArray(a) && a.forEach((n) => {
45
+ const o = [...n.children ?? [], ...n.select_items ?? []];
46
+ if (o.length > 0) {
47
+ l(o);
45
48
  return;
46
49
  }
47
- const u = e.text || e.tag_text;
48
- u && e.value && !a.has(e.value) && (a.add(e.value), c.push({ text: u, value: e.value }));
50
+ const u = n.text || n.tag_text;
51
+ u && n.value && !e.has(n.value) && (e.add(n.value), r.push({ text: u, value: n.value }));
49
52
  });
50
- }, [r] = Object.values(t ?? {});
51
- return s(r), c;
52
- }, i = (t, c, a = !1) => {
53
- const s = new Set(t.map((l) => l.value)), r = c.filter((l) => s.has(l.value) ? !1 : (s.add(l.value), !0));
53
+ }, [s] = Object.values(t ?? {});
54
+ return l(s), r;
55
+ }, d = (t, r, e = !1) => {
56
+ const l = new Set(t.map((a) => a.value)), s = r.filter((a) => l.has(a.value) ? !1 : (l.add(a.value), !0));
54
57
  return [
55
- ...f(t, a),
56
- ...f(r, a)
58
+ ...i(t, e),
59
+ ...i(s, e)
57
60
  ];
58
- }, v = () => {
61
+ }, F = () => {
59
62
  var t;
60
63
  return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
61
- }, k = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
64
+ }, T = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "", x = (t) => {
65
+ if (t === null || typeof t != "object" || Array.isArray(t))
66
+ return !1;
67
+ const r = Object.getPrototypeOf(t);
68
+ return r === Object.prototype || r === null;
69
+ };
62
70
  export {
63
- k as asText,
64
- i as buildMergeTagEntries,
65
- f as dynamicContentToMergeTags,
66
- b as flattenDynamicContentList,
67
- v as getCsrfToken,
68
- o as mergeTagToDynamicContent
71
+ T as asText,
72
+ d as buildMergeTagEntries,
73
+ i as dynamicContentToMergeTags,
74
+ $ as flattenDynamicContentList,
75
+ F as getCsrfToken,
76
+ x as isPlainObject,
77
+ k as mergeTagToDynamicContent
69
78
  };
@@ -0,0 +1,15 @@
1
+ const E = "time-format", r = "date", u = new RegExp(`^${r}\\s*:\\s*(?:"([^"]*)"|'([^']*)')$`), s = /%[-_0^#]?\d*[a-zA-Z%]/, c = new RegExp(s, "g"), l = /\b(?:Y{2,4}|M{2,4}|D{1,4}|d{3,4}|H{2}|h{2}|m{2}|s{2}|S{1,3}|A|a)\b/, T = (t) => t.includes('"') ? t.includes("'") ? null : `'${t}'` : `"${t}"`, i = (t) => s.test(t) && !l.test(t.replace(c, "")), R = (t) => {
2
+ if (t.key !== E || !i(t.value ?? ""))
3
+ return null;
4
+ const n = T(t.value);
5
+ return n === null ? null : `${r}: ${n}`;
6
+ }, _ = (t) => {
7
+ const [, n, o] = t.match(u) ?? [], e = n ?? o;
8
+ return e ? { key: E, value: e } : null;
9
+ };
10
+ export {
11
+ E as TIME_FORMAT_KEY,
12
+ R as formatToLiquidFilter,
13
+ _ as liquidFilterToFormat,
14
+ T as quoteArgument
15
+ };