@useinsider/guido 3.17.0-beta.3a4c221 → 3.17.0-beta.3cd7f07

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 (98) hide show
  1. package/README.md +6 -5
  2. package/dist/@types/config/schemas.js +7 -6
  3. package/dist/components/Guido.vue.js +10 -10
  4. package/dist/components/Guido.vue2.js +86 -78
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +131 -0
  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.vue.js +17 -0
  10. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
  11. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
  12. package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
  13. package/dist/composables/useCustomInterfaceAppearance.js +56 -38
  14. package/dist/composables/useLegacyStrategyConversion.js +52 -0
  15. package/dist/composables/useRecommendation.js +41 -34
  16. package/dist/composables/useStripo.js +14 -14
  17. package/dist/config/i18n/en/labels.json.js +1 -1
  18. package/dist/config/migrator/index.js +9 -8
  19. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  20. package/dist/config/migrator/recommendation/extractors.js +29 -24
  21. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  22. package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
  23. package/dist/config/migrator/recommendationMigrator.js +31 -25
  24. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  25. package/dist/enums/academy.js +2 -1
  26. package/dist/enums/date.js +5 -3
  27. package/dist/enums/extensions/recommendationBlock.js +4 -1
  28. package/dist/extensions/Blocks/Recommendation/block.js +35 -29
  29. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  30. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  31. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +29 -27
  32. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
  33. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
  34. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +242 -180
  35. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +159 -0
  36. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  37. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  38. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  39. package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
  40. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  41. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +217 -80
  42. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  43. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  44. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  45. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +58 -0
  46. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
  47. package/dist/extensions/Blocks/common-control.js +22 -19
  48. package/dist/guido.css +1 -1
  49. package/dist/services/recommendationApi.js +81 -33
  50. package/dist/src/@types/config/schemas.d.ts +2 -0
  51. package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
  52. package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
  53. package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
  54. package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
  55. package/dist/src/composables/useConfig.d.ts +2 -0
  56. package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
  57. package/dist/src/composables/useRecommendation.d.ts +1 -0
  58. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  59. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  60. package/dist/src/enums/academy.d.ts +1 -0
  61. package/dist/src/enums/date.d.ts +1 -0
  62. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  63. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  64. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  65. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +3 -6
  66. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  67. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
  68. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
  69. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
  71. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +17 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  73. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  74. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
  75. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +229 -10
  76. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  77. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
  78. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +39 -0
  79. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
  80. package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
  81. package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
  82. package/dist/src/services/recommendationApi.d.ts +5 -1
  83. package/dist/src/stores/config.d.ts +18 -0
  84. package/dist/src/stores/save-as-template.d.ts +4 -3
  85. package/dist/src/utils/genericUtil.d.ts +5 -0
  86. package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
  87. package/dist/static/assets/icons/line-change.svg.js +5 -0
  88. package/dist/static/assets/icons/line-delete.svg.js +5 -0
  89. package/dist/static/assets/icons/line-info.svg.js +5 -0
  90. package/dist/static/assets/icons/line-plus.svg.js +5 -0
  91. package/dist/static/styles/components/recommendation-strategy.css.js +220 -0
  92. package/dist/static/styles/customEditorStyle.css.js +3 -1
  93. package/dist/utils/dateUtil.js +23 -10
  94. package/dist/utils/genericUtil.js +54 -44
  95. package/dist/utils/templatePreparation.js +35 -34
  96. package/package.json +3 -2
  97. package/dist/src/utils/dynamicContentFormat.d.ts +0 -26
  98. package/dist/utils/dynamicContentFormat.js +0 -37
@@ -1,7 +1,7 @@
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 s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
+ import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
5
5
  import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
6
6
  import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
7
7
  import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
@@ -11,20 +11,20 @@ import { useEditorStore as z } from "../stores/editor.js";
11
11
  import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
12
12
  import { assignTrackingIds as v } from "./linkTrackingIds.js";
13
13
  function O(m) {
14
- const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
15
- return n.forEach((i) => {
16
- const o = i.getAttribute(A.PAGE_LIST);
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);
17
17
  o && t.push(...R(o));
18
18
  }), [...new Set(t)];
19
19
  }
20
20
  async function M(m) {
21
- const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
- if (a.length === 0)
21
+ const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
22
+ if (n.length === 0)
23
23
  return;
24
- const n = C();
25
- a.forEach((t) => {
24
+ const i = C();
25
+ n.forEach((t) => {
26
26
  var r, l, g, f, c;
27
- const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
27
+ const s = t.getAttribute("recommendation-id"), o = s ? Number(s) : NaN;
28
28
  if (!Number.isFinite(o))
29
29
  return;
30
30
  const p = t.getAttribute("esd-ext-config");
@@ -42,24 +42,25 @@ async function M(m) {
42
42
  // Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
43
43
  // already-saved blocks that never re-run the migrator don't emit a
44
44
  // strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
45
- strategy: L(e.strategy) || s.strategy,
46
- language: e.language ?? s.language,
47
- size: e.size ?? s.size,
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,
48
49
  // Spread the default arrays so each block gets a fresh reference
49
50
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
50
- productIds: e.productIds ?? [...s.productIds],
51
- filters: e.filters ?? [...s.filters],
52
- shuffleProducts: e.shuffleProducts ?? s.shuffleProducts,
51
+ productIds: e.productIds ?? [...a.productIds],
52
+ filters: e.filters ?? [...a.filters],
53
+ shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
53
54
  currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? d.code,
54
55
  currencyAlignment: ((l = e.currency) == null ? void 0 : l.alignment) ?? d.alignment,
55
56
  currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? d.decimalCount,
56
57
  currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? d.decimalSeparator,
57
58
  currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? d.thousandSeparator
58
59
  };
59
- n.seedBlockUrlConfig(o, h);
60
+ i.seedBlockUrlConfig(o, h);
60
61
  });
61
62
  try {
62
- await n.fetchRecommendationCreateData();
63
+ await i.fetchRecommendationCreateData();
63
64
  } catch (t) {
64
65
  console.warn(
65
66
  "Recommendation reference data pre-load failed; validator will skip the availability check.",
@@ -68,39 +69,39 @@ async function M(m) {
68
69
  }
69
70
  }
70
71
  const Z = () => {
71
- const m = N(), u = z(), a = _(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
72
+ const m = N(), u = z(), n = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
72
73
  return {
73
74
  prepareTemplateDetails: async () => {
74
75
  let { html: r, css: l, syncModulesIds: g = [] } = await t();
75
76
  if (e("linkTrackingIds"))
76
77
  try {
77
- const { html: y, changed: H, nextSeq: I } = v(r, u.trackIdSessionFloor);
78
- u.trackIdSessionFloor = I, H && (r = y, await i(y, l));
79
- } catch (y) {
80
- console.error("Tracking-id step failed, saving anyway:", y);
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);
81
82
  }
82
- const { html: f, ampHtml: c = "", ampErrors: T = [] } = await n({
83
+ const { html: f, ampHtml: c = "", ampErrors: T = [] } = await i({
83
84
  minimize: !0,
84
85
  resetDataSavedFlag: !1
85
86
  });
86
- a.selectedUnsubscribePages.length && await a.fetchTemplates(), await M(r);
87
- const { compiledHtml: w, stats: S, appliedRules: D } = o(f), E = c && p(c).compiledHtml, P = m.getSelectedDynamicContentList, F = C(), b = O(r);
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);
88
89
  return console.debug("HTML Compilation Stats:", {
89
- originalSize: S.originalSize,
90
- compiledSize: S.compiledSize,
91
- reduction: `${S.reductionPercentage.toFixed(2)}%`,
92
- appliedRules: D,
93
- executionTime: `${S.executionTime.toFixed(2)}ms`
90
+ originalSize: y.originalSize,
91
+ compiledSize: y.compiledSize,
92
+ reduction: `${y.reductionPercentage.toFixed(2)}%`,
93
+ appliedRules: w,
94
+ executionTime: `${y.executionTime.toFixed(2)}ms`
94
95
  }), {
95
- dynamicContentList: P,
96
- compiledHtml: w,
96
+ dynamicContentList: E,
97
+ compiledHtml: I,
97
98
  rawHtml: r,
98
99
  css: l,
99
- ampHtml: E,
100
+ ampHtml: D,
100
101
  ampErrors: T,
101
102
  modules: g.map(Number),
102
103
  recommendation: {
103
- campaignUrls: F.recommendationCampaignUrls,
104
+ campaignUrls: P.recommendationCampaignUrls,
104
105
  configs: {}
105
106
  },
106
107
  unsubscribe: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.17.0-beta.3a4c221",
3
+ "version": "3.17.0-beta.3cd7f07",
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",
@@ -25,7 +25,7 @@
25
25
  "start": "vite",
26
26
  "build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
27
27
  "preview": "vite preview",
28
- "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && bun run type-check",
28
+ "lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && npm run type-check",
29
29
  "lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
30
30
  "lint:e2e-quality": "node scripts/lint-e2e-quality.mjs",
31
31
  "lint:e2e-quality:ci": "node scripts/lint-e2e-quality.mjs --ci",
@@ -48,6 +48,7 @@
48
48
  "license": "ISC",
49
49
  "dependencies": {
50
50
  "@stripoinc/ui-editor-extensions": "3.9.0",
51
+ "@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
51
52
  "@useinsider/design-system-vue": "1.5.0",
52
53
  "@vueuse/core": "11.3.0",
53
54
  "lodash-es": "4.17.21",
@@ -1,26 +0,0 @@
1
- import type { BaseDynamicContent } from '@@/Types/generic';
2
- /** Format key the dynamic-content picker sends for a custom date/time format. */
3
- export declare const TIME_FORMAT_KEY = "time-format";
4
- /** Liquid filter that renders a date/time value in a custom pattern. */
5
- export declare const TIME_FORMAT_FILTER = "time_format";
6
- /** Liquid filter that renders a fallback when the value is empty. */
7
- export declare const DEFAULT_FILTER = "default";
8
- export type DynamicContentFormat = NonNullable<BaseDynamicContent['format']>;
9
- /** Unwraps a quoted Liquid literal — the exact inverse of `toLiquidLiteral`. */
10
- export declare const stripQuotes: (literal: string) => string;
11
- /** Liquid string literal — numbers stay unquoted so `default: 0` keeps its type. */
12
- export declare const toLiquidLiteral: (value: string) => string;
13
- /** `{ key: 'time-format', value: 'YYYY-MM-DD' }` → `time_format: "YYYY-MM-DD"`, or null when the format has no Liquid filter. */
14
- export declare const formatToLiquidFilter: (format: DynamicContentFormat | undefined) => string | null;
15
- /** Inverse of `formatToLiquidFilter` — reads the picker format back out of one filter segment. */
16
- export declare const liquidFilterToFormat: (segment: string) => DynamicContentFormat | null;
17
- /**
18
- * `{{ signup_date | time_format: "YYYY-MM-DD" | default: "-" }}`. Returns null when
19
- * the format has no Liquid filter, so the caller keeps the legacy tag instead of
20
- * emitting a tag that silently lost its format.
21
- */
22
- export declare const buildLiquidTag: ({ value, format, fallback }: BaseDynamicContent) => string | null;
23
- /** Whether one `{{ … }}` segment is a `default:` filter. */
24
- export declare const isLiquidDefaultFilter: (segment: string) => boolean;
25
- /** Reads the fallback out of a `default: "…"` filter segment. */
26
- export declare const readLiquidDefault: (segment: string) => string;
@@ -1,37 +0,0 @@
1
- const l = "time-format", _ = "time_format", s = "default", u = {
2
- [l]: _
3
- }, F = Object.fromEntries(
4
- Object.entries(u).map(([t, e]) => [e, t])
5
- ), L = /^([a-z_]+)\s*:\s*(.+)$/, r = (t) => {
6
- const e = t.slice(0, 1);
7
- return (e === '"' || e === "'") && t.endsWith(e) && t.length > 1 ? t.slice(1, -1).replace(/\\(["'\\])/g, "$1") : t;
8
- }, o = (t) => !Number.isNaN(Number(t)) && t.trim() !== "" ? t : `"${t.replace(/(["\\])/g, "\\$1")}"`, T = (t) => {
9
- const e = t != null && t.key ? u[t.key] : void 0;
10
- return !e || !(t != null && t.value) ? null : `${e}: ${o(t.value)}`;
11
- }, E = (t) => {
12
- const e = t.trim().match(L);
13
- if (!e)
14
- return null;
15
- const i = F[e[1]];
16
- return i ? { key: i, value: r(e[2].trim()) } : null;
17
- }, d = ({ value: t, format: e, fallback: i }) => {
18
- const n = T(e);
19
- if (e && !n)
20
- return null;
21
- const c = [n];
22
- return i && c.push(`${s}: ${o(i)}`), `{{ ${[t, ...c.filter(Boolean)].join(" | ")} }}`;
23
- }, I = (t) => t.startsWith(`${s}:`), $ = (t) => r(
24
- t.slice(`${s}:`.length).trim()
25
- );
26
- export {
27
- s as DEFAULT_FILTER,
28
- _ as TIME_FORMAT_FILTER,
29
- l as TIME_FORMAT_KEY,
30
- d as buildLiquidTag,
31
- T as formatToLiquidFilter,
32
- I as isLiquidDefaultFilter,
33
- E as liquidFilterToFormat,
34
- $ as readLiquidDefault,
35
- r as stripQuotes,
36
- o as toLiquidLiteral
37
- };