@useinsider/guido 3.18.1 → 3.18.2-beta.32d291d

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 +21 -3
  2. package/dist/@types/config/schemas.js +59 -51
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +55 -53
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +82 -57
  7. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
  8. package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
  9. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
  10. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
  11. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
  12. package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
  13. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  14. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
  15. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  16. package/dist/composables/useCustomInterfaceAppearance.js +46 -42
  17. package/dist/composables/useHttp.js +24 -22
  18. package/dist/composables/useLegacyStrategyConversion.js +61 -0
  19. package/dist/enums/extensions/recommendationBlock.js +40 -31
  20. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +91 -84
  21. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -28
  22. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
  23. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -58
  24. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
  25. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
  26. package/dist/guido.css +1 -1
  27. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +29 -28
  28. package/dist/package.json.js +1 -1
  29. package/dist/services/recommendationApi.js +46 -37
  30. package/dist/services/templateLibraryApi.js +17 -14
  31. package/dist/src/@types/config/schemas.d.ts +16 -0
  32. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  33. package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
  34. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  35. package/dist/src/composables/useConfig.d.ts +4 -0
  36. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  37. package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
  38. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
  41. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +82 -1
  42. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
  43. package/dist/src/services/recommendationApi.d.ts +2 -1
  44. package/dist/src/stores/config.d.ts +322 -0
  45. package/dist/src/stores/onboarding.d.ts +808 -10
  46. package/dist/src/utils/genericUtil.d.ts +6 -0
  47. package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
  48. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  49. package/dist/static/assets/icons/line-info.svg.js +5 -0
  50. package/dist/static/styles/components/recommendation-strategy.css.js +70 -5
  51. package/dist/stores/config.js +74 -60
  52. package/dist/stores/onboarding.js +46 -36
  53. package/dist/utils/genericUtil.js +63 -54
  54. package/dist/utils/liquidDynamicContent.js +15 -0
  55. package/dist/utils/templatePreparation.js +54 -52
  56. package/package.json +3 -3
@@ -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
+ };
@@ -1,30 +1,31 @@
1
1
  import { useActionsApi as k } from "../composables/useActionsApi.js";
2
2
  import { useConfig as U } from "../composables/useConfig.js";
3
3
  import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
4
- import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
- import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
+ import { DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as n } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
+ import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
6
  import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
7
- import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
7
+ import { DATA_ATTRIBUTES as T } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
8
8
  import { parsePageList as R } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
9
9
  import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
10
10
  import { useEditorStore as z } from "../stores/editor.js";
11
- import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
11
+ import { useUnsubscribeStore as O } from "../stores/unsubscribe.js";
12
+ import { isPlainObject as _ } from "./genericUtil.js";
12
13
  import { assignTrackingIds as v } from "./linkTrackingIds.js";
13
- function O(m) {
14
- const i = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
15
- return i.forEach((s) => {
16
- const o = s.getAttribute(A.PAGE_LIST);
14
+ function M(l) {
15
+ const i = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${T.PAGE_LIST}]`), t = [];
16
+ return i.forEach((c) => {
17
+ const o = c.getAttribute(T.PAGE_LIST);
17
18
  o && t.push(...R(o));
18
19
  }), [...new Set(t)];
19
20
  }
20
- async function M(m) {
21
- const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
- if (n.length === 0)
21
+ async function q(l) {
22
+ const a = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
23
+ if (a.length === 0)
23
24
  return;
24
- const i = C();
25
- n.forEach((t) => {
26
- var r, l, g, f, c;
27
- const s = t.getAttribute("recommendation-id"), o = s ? Number(s) : NaN;
25
+ const i = A();
26
+ a.forEach((t) => {
27
+ var r, d, g, f, s, y;
28
+ const c = t.getAttribute("recommendation-id"), o = c ? Number(c) : NaN;
28
29
  if (!Number.isFinite(o))
29
30
  return;
30
31
  const p = t.getAttribute("esd-ext-config");
@@ -36,28 +37,29 @@ async function M(m) {
36
37
  } catch {
37
38
  return;
38
39
  }
39
- if (!e || typeof e != "object" || Array.isArray(e))
40
+ if (!_(e))
40
41
  return;
41
- const h = {
42
+ const b = {
42
43
  // Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
43
44
  // already-saved blocks that never re-run the migrator don't emit a
44
45
  // strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
45
- strategy: L(e.strategy) || a.strategy,
46
- strategyId: e.strategyId ?? a.strategyId,
47
- language: e.language ?? a.language,
48
- size: e.size ?? a.size,
46
+ strategy: L(e.strategy) || n.strategy,
47
+ strategyId: e.strategyId ?? n.strategyId,
48
+ language: e.language ?? n.language,
49
+ size: e.size ?? n.size,
49
50
  // Spread the default arrays so each block gets a fresh reference
50
51
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
51
- productIds: e.productIds ?? [...a.productIds],
52
- filters: e.filters ?? [...a.filters],
53
- shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
54
- currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? d.code,
55
- currencyAlignment: ((l = e.currency) == null ? void 0 : l.alignment) ?? d.alignment,
56
- currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? d.decimalCount,
57
- currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? d.decimalSeparator,
58
- currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? d.thousandSeparator
52
+ productIds: e.productIds ?? [...n.productIds],
53
+ filters: e.filters ?? [...n.filters],
54
+ shuffleProducts: e.shuffleProducts ?? n.shuffleProducts,
55
+ currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? m.code,
56
+ currencySymbol: ((d = e.currency) == null ? void 0 : d.symbol) ?? m.symbol,
57
+ currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? m.alignment,
58
+ currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? m.decimalCount,
59
+ currencyDecimalSeparator: ((s = e.currency) == null ? void 0 : s.decimalSeparator) ?? m.decimalSeparator,
60
+ currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? m.thousandSeparator
59
61
  };
60
- i.seedBlockUrlConfig(o, h);
62
+ i.seedBlockUrlConfig(o, b);
61
63
  });
62
64
  try {
63
65
  await i.fetchRecommendationCreateData();
@@ -68,51 +70,51 @@ async function M(m) {
68
70
  );
69
71
  }
70
72
  }
71
- const Z = () => {
72
- const m = N(), u = z(), n = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
73
+ const te = () => {
74
+ const l = N(), u = z(), a = O(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: c } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
73
75
  return {
74
76
  prepareTemplateDetails: async () => {
75
- let { html: r, css: l, syncModulesIds: g = [] } = await t();
77
+ let { html: r, css: d, syncModulesIds: g = [] } = await t();
76
78
  if (e("linkTrackingIds"))
77
79
  try {
78
- const { html: S, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
79
- u.trackIdSessionFloor = H, F && (r = S, await s(S, l));
80
- } catch (S) {
81
- console.error("Tracking-id step failed, saving anyway:", S);
80
+ const { html: h, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
81
+ u.trackIdSessionFloor = H, F && (r = h, await c(h, d));
82
+ } catch (h) {
83
+ console.error("Tracking-id step failed, saving anyway:", h);
82
84
  }
83
- const { html: f, ampHtml: c = "", ampErrors: T = [] } = await i({
85
+ const { html: f, ampHtml: s = "", ampErrors: y = [] } = await i({
84
86
  minimize: !0,
85
87
  resetDataSavedFlag: !1
86
88
  });
87
- n.selectedUnsubscribePages.length && await n.fetchTemplates(), await M(r);
88
- const { compiledHtml: I, stats: y, appliedRules: w } = o(f), D = c && p(c).compiledHtml, E = m.getSelectedDynamicContentList, P = C(), b = O(r);
89
+ a.selectedUnsubscribePages.length && await a.fetchTemplates(), await q(r);
90
+ const { compiledHtml: I, stats: S, appliedRules: w } = o(f), D = s && p(s).compiledHtml, P = l.getSelectedDynamicContentList, E = A(), C = M(r);
89
91
  return console.debug("HTML Compilation Stats:", {
90
- originalSize: y.originalSize,
91
- compiledSize: y.compiledSize,
92
- reduction: `${y.reductionPercentage.toFixed(2)}%`,
92
+ originalSize: S.originalSize,
93
+ compiledSize: S.compiledSize,
94
+ reduction: `${S.reductionPercentage.toFixed(2)}%`,
93
95
  appliedRules: w,
94
- executionTime: `${y.executionTime.toFixed(2)}ms`
96
+ executionTime: `${S.executionTime.toFixed(2)}ms`
95
97
  }), {
96
- dynamicContentList: E,
98
+ dynamicContentList: P,
97
99
  compiledHtml: I,
98
100
  rawHtml: r,
99
- css: l,
101
+ css: d,
100
102
  ampHtml: D,
101
- ampErrors: T,
103
+ ampErrors: y,
102
104
  modules: g.map(Number),
103
105
  recommendation: {
104
- campaignUrls: P.recommendationCampaignUrls,
106
+ campaignUrls: E.recommendationCampaignUrls,
105
107
  configs: {}
106
108
  },
107
109
  unsubscribe: {
108
- status: b.length > 0,
109
- config: b
110
+ status: C.length > 0,
111
+ config: C
110
112
  }
111
113
  };
112
114
  }
113
115
  };
114
116
  };
115
117
  export {
116
- O as getHtmlReferencedUnsubscribePages,
117
- Z as useTemplatePreparation
118
+ M as getHtmlReferencedUnsubscribePages,
119
+ te as useTemplatePreparation
118
120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.18.1",
3
+ "version": "3.18.2-beta.32d291d",
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",
@@ -47,7 +47,7 @@
47
47
  "author": "",
48
48
  "license": "ISC",
49
49
  "dependencies": {
50
- "@stripoinc/ui-editor-extensions": "3.9.0",
50
+ "@stripoinc/ui-editor-extensions": "3.10.0",
51
51
  "@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
52
52
  "@useinsider/design-system-vue": "1.5.0",
53
53
  "@vueuse/core": "11.3.0",
@@ -118,7 +118,7 @@
118
118
  },
119
119
  "guido": {
120
120
  "stripo": {
121
- "version": "2.73.0"
121
+ "version": "2.76.0"
122
122
  }
123
123
  }
124
124
  }