@useinsider/guido 3.19.0 → 3.20.0-beta.7b31fec

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