@useinsider/guido 3.3.0-beta.d5c796a → 3.3.0-beta.ddabd14

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 (39) hide show
  1. package/dist/components/Guido.vue.js +1 -1
  2. package/dist/components/Guido.vue2.js +103 -91
  3. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +9 -11
  4. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +70 -35
  5. package/dist/components/organisms/header/MiddleSlot.vue.js +1 -1
  6. package/dist/components/organisms/header/MiddleSlot.vue2.js +7 -8
  7. package/dist/composables/useCortexBlueprintBridge.js +36 -61
  8. package/dist/composables/useHtmlValidator.js +41 -36
  9. package/dist/composables/useRecommendation.js +2 -2
  10. package/dist/composables/useStripo.js +66 -62
  11. package/dist/config/migrator/index.js +21 -10
  12. package/dist/config/migrator/radioButtonMigrator.js +73 -48
  13. package/dist/enums/extensions/recommendationBlock.js +101 -46
  14. package/dist/enums/unsubscribe.js +25 -24
  15. package/dist/extensions/Blocks/Checkbox/control.js +23 -23
  16. package/dist/extensions/Blocks/RadioButton/control.js +15 -15
  17. package/dist/extensions/Blocks/RadioButton/template.js +6 -6
  18. package/dist/extensions/Blocks/Recommendation/block.js +43 -36
  19. package/dist/extensions/Blocks/Recommendation/services/configService.js +33 -26
  20. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +35 -26
  21. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +25 -12
  22. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +33 -0
  23. package/dist/guido.css +1 -1
  24. package/dist/services/unsubscribeApi.js +6 -6
  25. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -5
  26. package/dist/src/enums/extensions/recommendationBlock.d.ts +6 -1
  27. package/dist/src/enums/unsubscribe.d.ts +8 -3
  28. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  29. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +11 -3
  30. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -1
  31. package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +2 -0
  32. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +21 -0
  33. package/dist/utils/templatePreparation.js +57 -50
  34. package/package.json +1 -1
  35. package/dist/components/organisms/header/AiStatusPill.vue.js +0 -18
  36. package/dist/components/organisms/header/AiStatusPill.vue2.js +0 -13
  37. package/dist/src/components/organisms/header/AiStatusPill.vue.d.ts +0 -2
  38. package/dist/src/stores/ai-status.d.ts +0 -41
  39. package/dist/stores/ai-status.js +0 -25
@@ -1,29 +1,29 @@
1
- import { useActionsApi as T } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
3
- import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
- import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
- import { DATA_ATTRIBUTES as y } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { parsePageList as P } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
- import { useDynamicContentStore as D } from "../stores/dynamic-content.js";
8
- import { useUnsubscribeStore as E } from "../stores/unsubscribe.js";
9
- function U(i, r) {
10
- const s = new DOMParser().parseFromString(i, "text/html").querySelectorAll(`[${y.PAGE_LIST}]`), c = [];
11
- return s.forEach((t) => {
12
- const o = t.getAttribute(y.PAGE_LIST);
13
- o && c.push(...P(o));
1
+ import { useActionsApi as R } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as U } from "../composables/useHtmlCompiler.js";
3
+ import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as i } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
+ import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { DATA_ATTRIBUTES as T } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
+ import { parsePageList as F } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
+ import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
8
+ import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
9
+ function x(m, r) {
10
+ const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${T.PAGE_LIST}]`), c = [];
11
+ return n.forEach((t) => {
12
+ const o = t.getAttribute(T.PAGE_LIST);
13
+ o && c.push(...F(o));
14
14
  }), r.filter((t) => c.includes(t));
15
15
  }
16
- function F(i) {
17
- const m = new DOMParser().parseFromString(i, "text/html").querySelectorAll(".recommendation-block-v2");
18
- if (m.length === 0)
16
+ function z(m) {
17
+ const l = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
18
+ if (l.length === 0)
19
19
  return;
20
- const d = b();
21
- m.forEach((s) => {
22
- var g, f, u, n, S;
23
- const c = s.getAttribute("recommendation-id"), t = c ? Number(c) : NaN;
20
+ const p = A();
21
+ l.forEach((n) => {
22
+ var g, f, a, s, S;
23
+ const c = n.getAttribute("recommendation-id"), t = c ? Number(c) : NaN;
24
24
  if (!Number.isFinite(t))
25
25
  return;
26
- const o = s.getAttribute("esd-ext-config");
26
+ const o = n.getAttribute("esd-ext-config");
27
27
  if (!o)
28
28
  return;
29
29
  let e;
@@ -34,60 +34,67 @@ function F(i) {
34
34
  }
35
35
  if (!e || typeof e != "object" || Array.isArray(e))
36
36
  return;
37
- const p = {
38
- strategy: e.strategy ?? a.strategy,
39
- language: e.language ?? a.language,
40
- size: e.size ?? a.size,
37
+ const u = {
38
+ strategy: e.strategy ?? i.strategy,
39
+ language: e.language ?? i.language,
40
+ size: e.size ?? i.size,
41
41
  // Spread the default arrays so each block gets a fresh reference
42
42
  // instead of sharing the singleton in DEFAULT_NODE_CONFIG.
43
- productIds: e.productIds ?? [...a.productIds],
44
- filters: e.filters ?? [...a.filters],
45
- shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
46
- currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? l.code,
47
- currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? l.alignment,
48
- currencyDecimalCount: ((u = e.currency) == null ? void 0 : u.decimalCount) ?? l.decimalCount,
49
- currencyDecimalSeparator: ((n = e.currency) == null ? void 0 : n.decimalSeparator) ?? l.decimalSeparator,
50
- currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? l.thousandSeparator
43
+ productIds: e.productIds ?? [...i.productIds],
44
+ filters: e.filters ?? [...i.filters],
45
+ shuffleProducts: e.shuffleProducts ?? i.shuffleProducts,
46
+ currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
47
+ currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
48
+ currencyDecimalCount: ((a = e.currency) == null ? void 0 : a.decimalCount) ?? d.decimalCount,
49
+ currencyDecimalSeparator: ((s = e.currency) == null ? void 0 : s.decimalSeparator) ?? d.decimalSeparator,
50
+ currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? d.thousandSeparator
51
51
  };
52
- d.seedBlockUrlConfig(t, p);
52
+ p.seedBlockUrlConfig(t, u);
53
53
  });
54
54
  }
55
- const _ = () => {
56
- const i = D(), r = E(), { getCompiledEmail: m, getTemplateData: d } = T(), { compileHtml: s } = C();
55
+ const G = () => {
56
+ const m = H(), r = w(), { getCompiledEmail: l, getTemplateData: p } = R(), { compileHtml: n } = U();
57
57
  return {
58
58
  prepareTemplateDetails: async () => {
59
- const { html: t, ampHtml: o = "", ampErrors: e = [] } = await m({
59
+ const { html: t, ampHtml: o = "", ampErrors: e = [] } = await l({
60
60
  minimize: !0,
61
61
  resetDataSavedFlag: !1
62
- }), { html: p, css: g, syncModulesIds: f = [] } = await d();
63
- r.selectedUnsubscribePages.length && await r.fetchTemplates(), F(p);
64
- const { compiledHtml: u, stats: n, appliedRules: S } = s(t), h = i.getSelectedDynamicContentList, A = b();
62
+ }), { html: u, css: g, syncModulesIds: f = [] } = await p();
63
+ r.selectedUnsubscribePages.length && await r.fetchTemplates(), z(u);
64
+ const { compiledHtml: a, stats: s, appliedRules: S } = n(t), C = m.getSelectedDynamicContentList, P = A(), b = (D) => (D.match(/<td[^>]*radio-button-v2[^>]*>/gi) ?? []).map((E) => {
65
+ var h;
66
+ const y = (((h = E.match(/class="([^"]*)"/)) == null ? void 0 : h[1]) ?? "").split(/\s+/).filter(Boolean);
67
+ return { hasBlock: y.includes("radio-button-block"), classes: y };
68
+ });
65
69
  return console.debug("HTML Compilation Stats:", {
66
- originalSize: n.originalSize,
67
- compiledSize: n.compiledSize,
68
- reduction: `${n.reductionPercentage.toFixed(2)}%`,
70
+ originalSize: s.originalSize,
71
+ compiledSize: s.compiledSize,
72
+ reduction: `${s.reductionPercentage.toFixed(2)}%`,
69
73
  appliedRules: S,
70
- executionTime: `${n.executionTime.toFixed(2)}ms`
74
+ executionTime: `${s.executionTime.toFixed(2)}ms`
75
+ }), console.debug("[guido:radio-migrator] template-prep", {
76
+ rawHtmlRadioTds: b(u),
77
+ compiledHtmlRadioTds: b(a)
71
78
  }), {
72
- dynamicContentList: h,
73
- compiledHtml: u,
74
- rawHtml: p,
79
+ dynamicContentList: C,
80
+ compiledHtml: a,
81
+ rawHtml: u,
75
82
  css: g,
76
83
  ampHtml: o,
77
84
  ampErrors: e,
78
85
  modules: f.map(Number),
79
86
  recommendation: {
80
- campaignUrls: A.recommendationCampaignUrls,
87
+ campaignUrls: P.recommendationCampaignUrls,
81
88
  configs: {}
82
89
  },
83
90
  unsubscribe: {
84
91
  status: r.unsubscribePagesStatus,
85
- config: U(u, r.selectedUnsubscribePages)
92
+ config: x(a, r.selectedUnsubscribePages)
86
93
  }
87
94
  };
88
95
  }
89
96
  };
90
97
  };
91
98
  export {
92
- _ as useTemplatePreparation
99
+ G as useTemplatePreparation
93
100
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.3.0-beta.d5c796a",
3
+ "version": "3.3.0-beta.ddabd14",
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",
@@ -1,18 +0,0 @@
1
- import l from "./AiStatusPill.vue2.js";
2
- /* empty css */
3
- import e from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var i = function() {
5
- var s = this, t = s._self._c, a = s._self._setupProxy;
6
- return a.showStatusPill ? t("div", { staticClass: "ai-status-pill", attrs: { "aria-live": "polite", role: "status" } }, [t("span", { staticClass: "ai-status-pill__dot" }), t("span", { staticClass: "ai-status-pill__label" }, [s._v(s._s(a.statusLabel))])]) : s._e();
7
- }, _ = [], r = /* @__PURE__ */ e(
8
- l,
9
- i,
10
- _,
11
- !1,
12
- null,
13
- "dea97ab5"
14
- );
15
- const c = r.exports;
16
- export {
17
- c as default
18
- };
@@ -1,13 +0,0 @@
1
- import { defineComponent as e } from "vue";
2
- import { useAiStatusStore as r } from "../../../stores/ai-status.js";
3
- import { storeToRefs as a } from "pinia";
4
- const f = /* @__PURE__ */ e({
5
- __name: "AiStatusPill",
6
- setup(i) {
7
- const t = r(), { showStatusPill: s, statusLabel: o } = a(t);
8
- return { __sfc: !0, aiStatus: t, showStatusPill: s, statusLabel: o };
9
- }
10
- });
11
- export {
12
- f as default
13
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
- export default _default;
@@ -1,41 +0,0 @@
1
- /**
2
- * Lightweight read-only store the cortex-fe blueprint bridge writes into and
3
- * the editor toolbar reads from to show the "AI is generating…" pill while a
4
- * tool call is in flight. State + getters only — per architecture invariant
5
- * the bridge mutates state directly via `$patch`, no actions live here.
6
- */
7
- export declare const useAiStatusStore: import("pinia").StoreDefinition<"guidoAiStatus", {
8
- /** A tool is currently running on the agent side. */
9
- isWorking: boolean;
10
- /** Tool name the agent is currently invoking, e.g. `tool__qmechanics__compile_template`. */
11
- currentTool: string;
12
- /** Last user-facing error message from the stream, cleared on the next tool_call. */
13
- lastError: string;
14
- }, {
15
- /** Show the toolbar pill iff a tool is running AND no error overrides it. */
16
- showStatusPill: (state: {
17
- isWorking: boolean;
18
- currentTool: string;
19
- lastError: string;
20
- } & import("pinia").PiniaCustomStateProperties<{
21
- /** A tool is currently running on the agent side. */
22
- isWorking: boolean;
23
- /** Tool name the agent is currently invoking, e.g. `tool__qmechanics__compile_template`. */
24
- currentTool: string;
25
- /** Last user-facing error message from the stream, cleared on the next tool_call. */
26
- lastError: string;
27
- }>) => boolean;
28
- /** Display label for the pill — short, suitable for inline UI. */
29
- statusLabel: (state: {
30
- isWorking: boolean;
31
- currentTool: string;
32
- lastError: string;
33
- } & import("pinia").PiniaCustomStateProperties<{
34
- /** A tool is currently running on the agent side. */
35
- isWorking: boolean;
36
- /** Tool name the agent is currently invoking, e.g. `tool__qmechanics__compile_template`. */
37
- currentTool: string;
38
- /** Last user-facing error message from the stream, cleared on the next tool_call. */
39
- lastError: string;
40
- }>) => string;
41
- }, {}>;
@@ -1,25 +0,0 @@
1
- import { defineStore as o } from "pinia";
2
- const i = o("guidoAiStatus", {
3
- state: () => ({
4
- /** A tool is currently running on the agent side. */
5
- isWorking: !1,
6
- /** Tool name the agent is currently invoking, e.g. `tool__qmechanics__compile_template`. */
7
- currentTool: "",
8
- /** Last user-facing error message from the stream, cleared on the next tool_call. */
9
- lastError: ""
10
- }),
11
- getters: {
12
- /** Show the toolbar pill iff a tool is running AND no error overrides it. */
13
- showStatusPill: (r) => r.isWorking && r.lastError === "",
14
- /** Display label for the pill — short, suitable for inline UI. */
15
- statusLabel: (r) => {
16
- if (!r.isWorking)
17
- return "";
18
- const t = r.currentTool.replace(/^tool__[^_]+__/, "");
19
- return t ? `AI: ${t}…` : "AI is generating…";
20
- }
21
- }
22
- });
23
- export {
24
- i as useAiStatusStore
25
- };