@useinsider/guido 3.10.0-beta.37c2e49 → 3.10.0-beta.53eb239

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.
@@ -12,6 +12,8 @@ function r(e) {
12
12
  return "mostValuableOfPartner";
13
13
  case "topSellers":
14
14
  return "mostPurchased";
15
+ case "mostViewed":
16
+ return "mostPopular";
15
17
  default:
16
18
  return e;
17
19
  }
@@ -26,7 +26,7 @@ const u = (e) => new Promise((t) => {
26
26
  } catch (o) {
27
27
  console.error(`Failed to fetch blank template (attempt ${r}/${a}):`, o), r < a && await u(r * f);
28
28
  }
29
- return e({ type: p.Error, message: t("errors-pages.undefined-response") }), { html: "", css: "" };
29
+ return e({ type: p.Alert, message: t("errors-pages.undefined-response") }), { html: "", css: "" };
30
30
  } };
31
31
  };
32
32
  export {
@@ -4,12 +4,11 @@ import { useToaster as C } from "../composables/useToaster.js";
4
4
  import { useTranslations as h } from "../composables/useTranslations.js";
5
5
  import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
6
6
  import { EditorType as v } from "../enums/defaults.js";
7
- import { ToasterTypeOptions as N } from "../enums/toaster.js";
8
- import { useRecommendationExtensionStore as x } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { useSaveAsTemplateStore as E } from "../stores/save-as-template.js";
7
+ import { useRecommendationExtensionStore as N } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
+ import { useSaveAsTemplateStore as x } from "../stores/save-as-template.js";
10
9
  import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
11
10
  import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
12
- const j = () => {
11
+ const $ = () => {
13
12
  const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = h();
14
13
  return {
15
14
  getCategories: async () => {
@@ -40,7 +39,7 @@ const j = () => {
40
39
  createTemplate: async () => {
41
40
  var e, t, d, y;
42
41
  try {
43
- const { prepareTemplateDetails: i } = A(), s = E(), a = await i();
42
+ const { prepareTemplateDetails: i } = A(), s = x(), a = await i();
44
43
  if (p("liquidSyntax") && !await g(a.compiledHtml))
45
44
  return !1;
46
45
  const f = {
@@ -54,7 +53,7 @@ const j = () => {
54
53
  unsubscriptionPreferencePageStatus: !1,
55
54
  unsubscriptionPreferencePages: [],
56
55
  recommendationCampaignUrls: r(
57
- x().recommendationCampaignUrls
56
+ N().recommendationCampaignUrls
58
57
  ),
59
58
  recommendationConfigs: r({}),
60
59
  isGuido: !0,
@@ -75,7 +74,7 @@ const j = () => {
75
74
  "newsletter.template-library-save-alert",
76
75
  { templateName: s.getTemplateName }
77
76
  ),
78
- type: N.Error
77
+ type: "alert"
79
78
  }), !1) : (l({
80
79
  message: u(
81
80
  "newsletter.template-library-save-success",
@@ -90,5 +89,5 @@ const j = () => {
90
89
  };
91
90
  };
92
91
  export {
93
- j as useTemplateLibraryApi
92
+ $ as useTemplateLibraryApi
94
93
  };
@@ -1,6 +1,6 @@
1
1
  export declare enum ToasterTypeOptions {
2
2
  Success = "success",
3
3
  Warning = "warning",
4
- Error = "error",
5
- Info = "information"
4
+ Alert = "alert",
5
+ Dark = "dark"
6
6
  }
@@ -8,6 +8,7 @@
8
8
  * - `trending` → `trendingProducts` (id 40, path `trending`)
9
9
  * - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
10
10
  * - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
11
+ * - `mostViewed` → `mostPopular` (id 61, path `most-popular`)
11
12
  *
12
13
  * Used at two boundaries:
13
14
  * 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
@@ -4,14 +4,15 @@ export declare const useToasterStore: import("pinia").StoreDefinition<"guidoToas
4
4
  status: boolean;
5
5
  type: import("@@/Types/toaster").ToasterType;
6
6
  text: string;
7
+ icon: string;
8
+ withIcon: boolean;
7
9
  withoutLeftMargin: boolean;
8
- autoHide: boolean;
9
10
  actionButton?: {
10
11
  text: string;
11
12
  onClick: () => void;
12
13
  } | undefined;
13
14
  } & import("pinia").PiniaCustomStateProperties<ToasterState>) => boolean;
14
15
  }, {
15
- showToaster(this: ToasterState, { type, message, actionButton, autoHide }: ToasterOptions): void;
16
+ showToaster(this: ToasterState, { type, message, actionButton }: ToasterOptions): void;
16
17
  hideToaster(this: ToasterState): void;
17
18
  }>;
@@ -0,0 +1,74 @@
1
+ const n = `ue-notifications-container {
2
+ left: 96px;
3
+ margin: 0;
4
+ bottom: 32px;
5
+ top: unset;
6
+ width: unset;
7
+ position: fixed;
8
+ }
9
+
10
+ ue-notifications-container ue-message + ue-message {
11
+ margin-bottom: 24px;
12
+ }
13
+
14
+ ue-notifications-container .alert-message-wrapper {
15
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
16
+ border: none;
17
+ padding: 16px 24px;
18
+ }
19
+
20
+ ue-notifications-container .alert-message-wrapper.info,
21
+ ue-notifications-container .alert-message-wrapper.loader {
22
+ background-color: var(--guido-color-background-toaster-info) !important;
23
+ color: inherit;
24
+ }
25
+
26
+ .alert-message-wrapper .alert-message-main {
27
+ align-items: center;
28
+ }
29
+
30
+ ue-notifications-container ue-caption .caption {
31
+ color: var(--guido-color-white) !important;
32
+ }
33
+
34
+ ue-block-thumb-hint {
35
+ text-align: left;
36
+ }
37
+
38
+ ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-content {
39
+ width: calc(100% - 64px);
40
+ }
41
+
42
+ ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-text {
43
+ font-size: 15px;
44
+ font-weight: 600;
45
+ }
46
+
47
+ ue-notifications-container .alert-message-text,
48
+ ue-notifications-container .alert-message-wrapper ue-icon-component.icon,
49
+ ue-notifications-container .alert-message-wrapper ue-icon-component.icon-button {
50
+ color: var(--guido-color-white);
51
+ }
52
+
53
+ ue-notifications-container ue-message ue-button.close {
54
+ margin: 0 0 0 16px;
55
+ }
56
+
57
+ ue-notifications-container .alert-message-wrapper.success {
58
+ background: var(--guido-color-background-toaster-success);
59
+ color: inherit;
60
+ }
61
+
62
+ ue-notifications-container .alert-message-wrapper.error {
63
+ background: var(--guido-color-background-toaster-error);
64
+ color: inherit;
65
+ }
66
+
67
+ ue-notifications-container .alert-message-wrapper.warn {
68
+ background: var(--guido-color-background-toaster-warn);
69
+ color: inherit;
70
+ }
71
+ `;
72
+ export {
73
+ n as default
74
+ };
@@ -1,21 +1,21 @@
1
1
  import { ToasterTypeOptions as e } from "../enums/toaster.js";
2
- import { defineStore as a } from "pinia";
3
- const u = () => ({
2
+ import { defineStore as i } from "pinia";
3
+ const a = () => ({
4
4
  status: !1,
5
5
  type: e.Success,
6
6
  text: "",
7
+ icon: "",
8
+ withIcon: !0,
7
9
  withoutLeftMargin: !1,
8
- autoHide: !0,
9
10
  actionButton: void 0
10
- }), h = a("guidoToaster", {
11
- state: () => u(),
11
+ }), n = i("guidoToaster", {
12
+ state: () => a(),
12
13
  getters: {
13
- // A toast without auto-hide (e.g. Stripo `loader`) stays until hideToaster.
14
- shouldAutoHide: (t) => t.status && !!t.text && t.autoHide
14
+ shouldAutoHide: (t) => t.status && !!t.text
15
15
  },
16
16
  actions: {
17
- showToaster({ type: t = e.Success, message: s, actionButton: o, autoHide: i = !0 }) {
18
- this.status = !0, this.text = s, this.type = t, this.actionButton = o, this.autoHide = i;
17
+ showToaster({ type: t = e.Success, message: s, actionButton: o }) {
18
+ this.status = !0, this.text = s, this.type = t, this.actionButton = o;
19
19
  },
20
20
  hideToaster() {
21
21
  this.status = !1;
@@ -23,5 +23,5 @@ const u = () => ({
23
23
  }
24
24
  });
25
25
  export {
26
- h as useToasterStore
26
+ n as useToasterStore
27
27
  };
@@ -2,15 +2,16 @@ import { useActionsApi as P } from "../composables/useActionsApi.js";
2
2
  import { useHtmlCompiler as w } from "../composables/useHtmlCompiler.js";
3
3
  import { DEFAULT_CURRENCY as l, DEFAULT_NODE_CONFIG as i } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
4
4
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
5
+ import { mapLegacyStrategy as E } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
5
6
  import { DATA_ATTRIBUTES as h } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
6
- import { parsePageList as E } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
7
- import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
8
- import { useUnsubscribeStore as U } from "../stores/unsubscribe.js";
9
- function F(s) {
7
+ import { parsePageList as H } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
8
+ import { useDynamicContentStore as U } from "../stores/dynamic-content.js";
9
+ import { useUnsubscribeStore as F } from "../stores/unsubscribe.js";
10
+ function L(s) {
10
11
  const o = new DOMParser().parseFromString(s, "text/html").querySelectorAll(`[${h.PAGE_LIST}]`), t = [];
11
- return o.forEach((n) => {
12
- const a = n.getAttribute(h.PAGE_LIST);
13
- a && t.push(...E(a));
12
+ return o.forEach((a) => {
13
+ const n = a.getAttribute(h.PAGE_LIST);
14
+ n && t.push(...H(n));
14
15
  }), [...new Set(t)];
15
16
  }
16
17
  async function R(s) {
@@ -20,8 +21,8 @@ async function R(s) {
20
21
  const o = b();
21
22
  m.forEach((t) => {
22
23
  var c, p, g, f, r;
23
- const n = t.getAttribute("recommendation-id"), a = n ? Number(n) : NaN;
24
- if (!Number.isFinite(a))
24
+ const a = t.getAttribute("recommendation-id"), n = a ? Number(a) : NaN;
25
+ if (!Number.isFinite(n))
25
26
  return;
26
27
  const d = t.getAttribute("esd-ext-config");
27
28
  if (!d)
@@ -35,7 +36,10 @@ async function R(s) {
35
36
  if (!e || typeof e != "object" || Array.isArray(e))
36
37
  return;
37
38
  const y = {
38
- strategy: e.strategy ?? i.strategy,
39
+ // Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
40
+ // already-saved blocks that never re-run the migrator don't emit a
41
+ // strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
42
+ strategy: E(e.strategy) || i.strategy,
39
43
  language: e.language ?? i.language,
40
44
  size: e.size ?? i.size,
41
45
  // Spread the default arrays so each block gets a fresh reference
@@ -49,7 +53,7 @@ async function R(s) {
49
53
  currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? l.decimalSeparator,
50
54
  currencyThousandSeparator: ((r = e.currency) == null ? void 0 : r.thousandSeparator) ?? l.thousandSeparator
51
55
  };
52
- o.seedBlockUrlConfig(a, y);
56
+ o.seedBlockUrlConfig(n, y);
53
57
  });
54
58
  try {
55
59
  await o.fetchRecommendationCreateData();
@@ -60,8 +64,8 @@ async function R(s) {
60
64
  );
61
65
  }
62
66
  }
63
- const v = () => {
64
- const s = H(), u = U(), { getCompiledEmail: m, getTemplateData: o } = P(), { compileHtml: t, compileAmpHtml: n } = w();
67
+ const G = () => {
68
+ const s = U(), u = F(), { getCompiledEmail: m, getTemplateData: o } = P(), { compileHtml: t, compileAmpHtml: a } = w();
65
69
  return {
66
70
  prepareTemplateDetails: async () => {
67
71
  const { html: d, ampHtml: e = "", ampErrors: y = [] } = await m({
@@ -69,7 +73,7 @@ const v = () => {
69
73
  resetDataSavedFlag: !1
70
74
  }), { html: c, css: p, syncModulesIds: g = [] } = await o();
71
75
  u.selectedUnsubscribePages.length && await u.fetchTemplates(), await R(c);
72
- const { compiledHtml: f, stats: r, appliedRules: A } = t(d), C = e && n(e).compiledHtml, T = s.getSelectedDynamicContentList, D = b(), S = F(c);
76
+ const { compiledHtml: f, stats: r, appliedRules: A } = t(d), C = e && a(e).compiledHtml, T = s.getSelectedDynamicContentList, D = b(), S = L(c);
73
77
  return console.debug("HTML Compilation Stats:", {
74
78
  originalSize: r.originalSize,
75
79
  compiledSize: r.compiledSize,
@@ -97,6 +101,6 @@ const v = () => {
97
101
  };
98
102
  };
99
103
  export {
100
- F as getHtmlReferencedUnsubscribePages,
101
- v as useTemplatePreparation
104
+ L as getHtmlReferencedUnsubscribePages,
105
+ G as useTemplatePreparation
102
106
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.10.0-beta.37c2e49",
3
+ "version": "3.10.0-beta.53eb239",
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",
@@ -37,7 +37,7 @@
37
37
  "license": "ISC",
38
38
  "dependencies": {
39
39
  "@stripoinc/ui-editor-extensions": "3.8.0",
40
- "@useinsider/design-system-vue": "1.3.0",
40
+ "@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
41
41
  "@vueuse/core": "11.3.0",
42
42
  "lodash-es": "4.17.21",
43
43
  "pinia": "2.3.1",
@@ -1,26 +0,0 @@
1
- import { useToaster as d } from "./useToaster.js";
2
- import { ToasterTypeOptions as c } from "../enums/toaster.js";
3
- const g = () => {
4
- const { showToaster: s, hideToaster: u } = d();
5
- let r = null;
6
- const n = (o, t, i, e, f = !0) => {
7
- r = i;
8
- const l = e != null && e.action ? { text: e.action.label, onClick: e.action.func } : void 0;
9
- s({ type: o, message: t, actionButton: l, autoHide: (e == null ? void 0 : e.autoClose) ?? f });
10
- };
11
- return { getStripoNotifications: () => ({
12
- info: (o, t, i) => n(c.Info, o, t, i),
13
- success: (o, t, i) => n(c.Success, o, t, i),
14
- warn: (o, t, i) => n(c.Warning, o, t, i),
15
- error: (o, t, i) => n(c.Error, o, t, i),
16
- // A loader marks an in-progress operation; Stripo dismisses it via hide(id)
17
- // when finished, so it must not auto-hide.
18
- loader: (o, t, i) => n(c.Info, o, t, i, !1),
19
- hide: (o) => {
20
- r === o && (u(), r = null);
21
- }
22
- }) };
23
- };
24
- export {
25
- g as useStripoNotifications
26
- };
@@ -1,10 +0,0 @@
1
- import type { StripoNotifications } from '@@/Types/stripo';
2
- /**
3
- * Adapter that routes Stripo's in-editor notifications through Guido's own
4
- * InToasts-based toaster, so the editor only ever shows one toaster style.
5
- * Passed to `initEditor` as the `notifications` config (Stripo then delegates
6
- * rendering to us instead of drawing its native <ue-notifications-container>).
7
- */
8
- export declare const useStripoNotifications: () => {
9
- getStripoNotifications: () => StripoNotifications;
10
- };