@useinsider/guido 3.16.0-beta.1fe8cea → 3.16.0-beta.2b04988
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.
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +76 -78
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +43 -74
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +23 -46
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useHtmlValidator.js +0 -1
- package/dist/composables/useRecommendation.js +20 -19
- package/dist/composables/useSave.js +41 -84
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- package/dist/config/migrator/itemsBlockMigrator.js +1 -1
- package/dist/enums/recommendation.js +17 -17
- package/dist/extensions/Blocks/Items/block.js +98 -49
- package/dist/extensions/Blocks/Items/constants/currency.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
- package/dist/extensions/Blocks/Items/template.js +153 -152
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +21 -21
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +26 -32
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- package/dist/src/composables/useHtmlValidator.d.ts +0 -14
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- package/dist/src/extensions/Blocks/Items/block.d.ts +21 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
- package/dist/src/stores/config.d.ts +0 -5
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/stores/config.js +6 -13
- package/dist/utils/pairProductVariables.js +60 -59
- package/dist/utils/templatePreparation.js +25 -28
- package/package.json +1 -1
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
- package/dist/composables/useSaveValidation.js +0 -276
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single owner for the Items price currency export contract (SD-147588).
|
|
3
|
+
*
|
|
4
|
+
* `data-curency` is deliberately misspelled (one `r`) — it is the attribute the
|
|
5
|
+
* server-side export transform (pairProductVariables) actually reads, so every
|
|
6
|
+
* layer that writes it and the live reader (template, controls, block self-heal,
|
|
7
|
+
* pairProductVariables) MUST go through these constants. A typo fix or mapping change
|
|
8
|
+
* in one of them would otherwise silently break sync with the others and ship the wrong
|
|
9
|
+
* currency position/token to the inbox. Mirrors the Recommendation block's `CURRENCY_ATTR`.
|
|
10
|
+
*
|
|
11
|
+
* Exception: the legacy migrator reads the raw misspelled string on purpose — it parses
|
|
12
|
+
* old templates frozen with that exact attr name, so it must NOT follow a future rename here.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ITEMS_CURRENCY_ATTR: {
|
|
15
|
+
readonly POSITION: "data-curency";
|
|
16
|
+
readonly SYMBOL: "data-currency_symbol";
|
|
17
|
+
};
|
|
18
|
+
/** Currency location select value `'1'` = after (price then symbol), anything else = before. */
|
|
19
|
+
export declare function currencyPositionFromLocation(location: string | undefined): 'after' | 'before';
|
|
@@ -286,11 +286,6 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
286
286
|
* every block's recommendationConfigs across user edits.
|
|
287
287
|
*/
|
|
288
288
|
hasInvalidBlock(): boolean;
|
|
289
|
-
/**
|
|
290
|
-
* Per-instance counterpart to `hasInvalidBlock`: the ids of every block
|
|
291
|
-
* that fails required-field validation, one drawer row each (SD-147430).
|
|
292
|
-
*/
|
|
293
|
-
invalidBlockIds(): string[];
|
|
294
289
|
fetchRecommendationProducts(): Promise<void>;
|
|
295
290
|
_doFetchProducts(): Promise<void>;
|
|
296
291
|
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the request/URL `productId` value from raw product ID segments.
|
|
3
|
+
* Trimming happens here — NOT on input change — so the user's in-progress
|
|
4
|
+
* text (trailing commas, spaces) is never rewritten under the caret (SD-147111).
|
|
5
|
+
*/
|
|
6
|
+
export declare function sanitizeProductIds(ids: readonly (string | number | null | undefined)[]): string;
|
|
@@ -2106,11 +2106,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2106
2106
|
};
|
|
2107
2107
|
} | null;
|
|
2108
2108
|
} & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
|
|
2109
|
-
/**
|
|
2110
|
-
* Transactional campaigns keep the hard save block. Reactive getter, so
|
|
2111
|
-
* consumers stay safe in setup where a raw config read snapshots null (SD-147945).
|
|
2112
|
-
*/
|
|
2113
|
-
isTransactional(): boolean;
|
|
2114
2109
|
/**
|
|
2115
2110
|
* Get the username
|
|
2116
2111
|
*/
|
|
@@ -15,36 +15,6 @@ import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
|
15
15
|
* same source), so it is reliably present regardless of how the block was added.
|
|
16
16
|
*/
|
|
17
17
|
export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
|
|
18
|
-
/**
|
|
19
|
-
* Hydrates the recommendation extension store from the persisted `esd-ext-config`
|
|
20
|
-
* JSON blob on each `.recommendation-block-v2` element in the raw editor HTML.
|
|
21
|
-
*
|
|
22
|
-
* Why this runs before `compileHtml`:
|
|
23
|
-
* The HTML compiler's `prepareRecommendationBlocks` rule asks
|
|
24
|
-
* `useRecommendation.buildCampaignUrl(id)` to assemble each block's API URL
|
|
25
|
-
* from `blockStates[id].recommendationConfigs`. That Pinia entry is normally
|
|
26
|
-
* populated by `RecommendationBlockControl._syncNodeConfigToStore`, which
|
|
27
|
-
* only fires when the user *selects* the block. Saving without ever
|
|
28
|
-
* selecting a migrated block would otherwise build the URL from empty/
|
|
29
|
-
* default state and the campaign URL would not be saved.
|
|
30
|
-
*
|
|
31
|
-
* Why we read raw HTML, not compiled HTML:
|
|
32
|
-
* Stripo's `compileEmail()` strips editor-only attributes (`esd-*`) from the
|
|
33
|
-
* compiled output, so `esd-ext-config` is gone by the time the compiler
|
|
34
|
-
* pipeline sees the HTML. The raw HTML from `getTemplateData()` preserves
|
|
35
|
-
* the attribute as the migrator wrote it.
|
|
36
|
-
*
|
|
37
|
-
* Reference data pre-load:
|
|
38
|
-
* When the template has recommendation blocks, this also pre-loads the
|
|
39
|
-
* shared reference data (languages / currency list) so the save-time
|
|
40
|
-
* required-fields validator can check each block's locale and currency
|
|
41
|
-
* against the partner's real options. Best-effort — on a fetch failure the
|
|
42
|
-
* validator degrades to its empty-list guard (`requiredFields.ts`) instead
|
|
43
|
-
* of blocking the save or stranding the Save button.
|
|
44
|
-
*/
|
|
45
|
-
declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
|
|
46
18
|
export declare const useTemplatePreparation: () => {
|
|
47
19
|
prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
48
|
-
hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
|
|
49
20
|
};
|
|
50
|
-
export {};
|
package/dist/stores/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../@types/config/schemas.js";
|
|
2
2
|
import "../@types/config/defaults.js";
|
|
3
|
-
import { parseConfig as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
const
|
|
3
|
+
import { parseConfig as o } from "../@types/config/validator.js";
|
|
4
|
+
import { defineStore as r } from "pinia";
|
|
5
|
+
const f = r("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -113,13 +113,6 @@ const g = a("guido-config", {
|
|
|
113
113
|
var e, n;
|
|
114
114
|
return ((n = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : n.messageType) ?? 1;
|
|
115
115
|
},
|
|
116
|
-
/**
|
|
117
|
-
* Transactional campaigns keep the hard save block. Reactive getter, so
|
|
118
|
-
* consumers stay safe in setup where a raw config read snapshots null (SD-147945).
|
|
119
|
-
*/
|
|
120
|
-
isTransactional() {
|
|
121
|
-
return this.messageType === o.TRANSACTIONAL;
|
|
122
|
-
},
|
|
123
116
|
/**
|
|
124
117
|
* Get the username
|
|
125
118
|
*/
|
|
@@ -150,7 +143,7 @@ const g = a("guido-config", {
|
|
|
150
143
|
* Initialize the config store with validated configuration
|
|
151
144
|
*/
|
|
152
145
|
init(i) {
|
|
153
|
-
const e =
|
|
146
|
+
const e = o(i);
|
|
154
147
|
this.config = e, this.initialized = !0;
|
|
155
148
|
},
|
|
156
149
|
/**
|
|
@@ -162,5 +155,5 @@ const g = a("guido-config", {
|
|
|
162
155
|
}
|
|
163
156
|
});
|
|
164
157
|
export {
|
|
165
|
-
|
|
158
|
+
f as useConfigStore
|
|
166
159
|
};
|
|
@@ -1,82 +1,83 @@
|
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as N } from "../extensions/Blocks/Items/constants/currency.js";
|
|
1
2
|
import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
|
-
import { DefaultConfigValues as
|
|
3
|
-
import { escapeReplacement as
|
|
3
|
+
import { DefaultConfigValues as G } from "../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
4
|
+
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
5
|
import { preserveTextStyles as F } from "./preserveTextStyles.js";
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
+
import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
|
|
6
7
|
const x = {
|
|
7
8
|
CART_ITEMS: "ins_apr",
|
|
8
9
|
BROWSED_ITEMS: "browsed_item",
|
|
9
10
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function v(S,
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
11
|
+
}, O = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
12
|
+
function v(S, I, b) {
|
|
13
|
+
let h = I;
|
|
14
|
+
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
15
|
+
h -= 1;
|
|
16
|
+
return b.some((P) => S.endsWith(P, h));
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
Object.entries(
|
|
22
|
-
|
|
18
|
+
function Z(S) {
|
|
19
|
+
const I = O(S), b = new DOMParser().parseFromString(I, "text/html");
|
|
20
|
+
Y(b);
|
|
21
|
+
const h = L.PAIRS_FOR_EXTENSION;
|
|
22
|
+
Object.entries(h).forEach(([n, d]) => {
|
|
23
|
+
b.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
23
24
|
const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
|
|
24
25
|
r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
|
|
25
|
-
var
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
26
|
+
var $, H, D;
|
|
27
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, u = d[g];
|
|
28
|
+
if (u)
|
|
28
29
|
switch (n) {
|
|
29
30
|
case "imageSrc": {
|
|
30
31
|
let e = null, s = null;
|
|
31
32
|
if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
|
|
32
33
|
break;
|
|
33
|
-
const a =
|
|
34
|
+
const a = u.DEFAULT, l = u.ATTR;
|
|
34
35
|
if (a && e.src) {
|
|
35
36
|
const i = e.src;
|
|
36
|
-
a.some((
|
|
37
|
-
const
|
|
38
|
-
return i.includes(
|
|
37
|
+
a.some((_) => {
|
|
38
|
+
const f = _.split("/").pop() || "", C = i.split("/").pop() || "";
|
|
39
|
+
return i.includes(_) || i.includes(f) || C === f;
|
|
39
40
|
}) && (e.src = `{{${l}_${o}}}`);
|
|
40
41
|
}
|
|
41
|
-
const c = (
|
|
42
|
+
const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
|
|
42
43
|
if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
|
|
43
|
-
const i = (D =
|
|
44
|
+
const i = (D = h.itemLink) == null ? void 0 : D[g];
|
|
44
45
|
if (i) {
|
|
45
|
-
const
|
|
46
|
-
(
|
|
46
|
+
const R = i.HREF, _ = i.DEFAULT_HREF || "#!", f = s.href;
|
|
47
|
+
(f === "#" || f === "" || f.endsWith("#!") || f.endsWith(_) || f === `${window.location.href}${_}` || !f || f === window.location.href) && (s.href = `{{${R}_${o}}}`);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
break;
|
|
50
51
|
}
|
|
51
52
|
case "name": {
|
|
52
|
-
const e =
|
|
53
|
+
const e = u, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
|
|
53
54
|
t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
|
|
54
55
|
const c = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
56
|
if (c && l) {
|
|
56
|
-
const i = c.href,
|
|
57
|
-
(i ===
|
|
57
|
+
const i = c.href, R = `${window.location.href}${a}`;
|
|
58
|
+
(i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
|
|
58
59
|
}
|
|
59
60
|
break;
|
|
60
61
|
}
|
|
61
62
|
case "price":
|
|
62
63
|
case "originalPrice": {
|
|
63
|
-
const e =
|
|
64
|
-
let
|
|
65
|
-
c ?
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
const
|
|
69
|
-
let
|
|
70
|
-
|
|
64
|
+
const e = u, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute(N.POSITION) || "before";
|
|
65
|
+
let R;
|
|
66
|
+
c ? R = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : R = l ? e.PRICE_FORMATTED : e.PRICE;
|
|
67
|
+
const _ = e.CURRENCY;
|
|
68
|
+
let f = `{{${R}_${o}}}`;
|
|
69
|
+
const C = (t.getAttribute(N.SYMBOL) || "").trim(), V = C !== "" && C !== G.productPriceCurrencySymbolControlValue;
|
|
70
|
+
let y = "";
|
|
71
|
+
V ? y = C : _ && (y = `{{${_}_${o}}}`), y && (f = i === "after" ? `${f} ${y}` : `${y} ${f}`), t.innerHTML = F(t, f);
|
|
71
72
|
break;
|
|
72
73
|
}
|
|
73
74
|
case "quantity": {
|
|
74
|
-
const e =
|
|
75
|
+
const e = u, s = e.ATTR, a = e.DEFAULT;
|
|
75
76
|
t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
|
|
76
77
|
break;
|
|
77
78
|
}
|
|
78
79
|
case "button": {
|
|
79
|
-
const e =
|
|
80
|
+
const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
81
|
if (l) {
|
|
81
82
|
const c = l.href || "", i = `${window.location.href}${a}`;
|
|
82
83
|
(c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
|
|
@@ -84,7 +85,7 @@ function J(S) {
|
|
|
84
85
|
break;
|
|
85
86
|
}
|
|
86
87
|
case "itemLink": {
|
|
87
|
-
const e =
|
|
88
|
+
const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
|
|
88
89
|
if (l.href) {
|
|
89
90
|
const c = l.href, i = `${window.location.href}${a}`;
|
|
90
91
|
(c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
|
|
@@ -92,8 +93,8 @@ function J(S) {
|
|
|
92
93
|
break;
|
|
93
94
|
}
|
|
94
95
|
default: {
|
|
95
|
-
if ("ATTR" in
|
|
96
|
-
const e =
|
|
96
|
+
if ("ATTR" in u) {
|
|
97
|
+
const e = u.ATTR;
|
|
97
98
|
t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
|
|
98
99
|
}
|
|
99
100
|
break;
|
|
@@ -102,9 +103,9 @@ function J(S) {
|
|
|
102
103
|
});
|
|
103
104
|
});
|
|
104
105
|
});
|
|
105
|
-
const
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
106
|
+
const P = I.match(/<!DOCTYPE[^>]*>/i), q = P ? `${P[0]}
|
|
107
|
+
` : "", U = b.querySelectorAll(".ins-product-td"), M = [];
|
|
108
|
+
U.forEach((n) => {
|
|
108
109
|
const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
|
|
109
110
|
M.push({
|
|
110
111
|
element: n,
|
|
@@ -113,16 +114,16 @@ function J(S) {
|
|
|
113
114
|
number: p
|
|
114
115
|
});
|
|
115
116
|
});
|
|
116
|
-
let A =
|
|
117
|
+
let A = q + b.documentElement.outerHTML;
|
|
117
118
|
M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
|
|
118
119
|
const r = x[d], E = r ? `${r}_total_product_kind` : "";
|
|
119
120
|
if (E) {
|
|
120
|
-
const
|
|
121
|
-
A = A.replace(n,
|
|
121
|
+
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
122
|
+
A = A.replace(n, X(o));
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
|
-
const
|
|
125
|
-
return
|
|
125
|
+
const W = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
|
|
126
|
+
return W.forEach((n) => {
|
|
126
127
|
var t;
|
|
127
128
|
const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
|
|
128
129
|
if (!d || !x[p])
|
|
@@ -131,20 +132,20 @@ function J(S) {
|
|
|
131
132
|
if (!r || k.has(r))
|
|
132
133
|
return;
|
|
133
134
|
k.add(r);
|
|
134
|
-
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"),
|
|
135
|
-
|
|
135
|
+
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = w.get(E) ?? { number: d, type: p, wrap: [] };
|
|
136
|
+
T.wrap.push(m !== "false"), w.set(E, T);
|
|
136
137
|
}), w.forEach(({ number: n, type: d, wrap: p }, r) => {
|
|
137
138
|
if (r.includes("{% if") || !p.some(Boolean))
|
|
138
139
|
return;
|
|
139
|
-
const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE,
|
|
140
|
-
let
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
|
|
140
|
+
const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, O(T)];
|
|
141
|
+
let g = "", o = 0, u = 0, $ = A.indexOf(r);
|
|
142
|
+
for (; $ !== -1; ) {
|
|
143
|
+
const H = p[u] === !0 && !v(A, $, t);
|
|
144
|
+
g += A.slice(o, $) + (H ? `${T}${r}{% endif %}` : r), o = $ + r.length, u += 1, $ = A.indexOf(r, o);
|
|
144
145
|
}
|
|
145
|
-
A =
|
|
146
|
+
A = g + A.slice(o);
|
|
146
147
|
}), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
148
|
}
|
|
148
149
|
export {
|
|
149
|
-
|
|
150
|
+
Z as pairProductVariables
|
|
150
151
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
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
4
|
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as s } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
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";
|
|
8
|
-
import { parsePageList as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
11
|
-
import { useUnsubscribeStore as
|
|
12
|
-
import { assignTrackingIds as
|
|
13
|
-
function
|
|
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 _ } from "../stores/unsubscribe.js";
|
|
12
|
+
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
13
|
+
function O(m) {
|
|
14
14
|
const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
15
15
|
return n.forEach((i) => {
|
|
16
16
|
const o = i.getAttribute(A.PAGE_LIST);
|
|
17
|
-
o && t.push(...
|
|
17
|
+
o && t.push(...R(o));
|
|
18
18
|
}), [...new Set(t)];
|
|
19
19
|
}
|
|
20
|
-
async function
|
|
20
|
+
async function M(m) {
|
|
21
21
|
const a = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
22
|
if (a.length === 0)
|
|
23
23
|
return;
|
|
24
|
-
const n =
|
|
24
|
+
const n = C();
|
|
25
25
|
a.forEach((t) => {
|
|
26
26
|
var r, l, g, f, c;
|
|
27
27
|
const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
|
|
@@ -68,39 +68,39 @@ async function C(m) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
const Z = () => {
|
|
71
|
-
const m =
|
|
71
|
+
const m = N(), u = z(), a = _(), { getCompiledEmail: n, getTemplateData: t, updateHtmlAndCss: i } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
|
|
72
72
|
return {
|
|
73
73
|
prepareTemplateDetails: async () => {
|
|
74
74
|
let { html: r, css: l, syncModulesIds: g = [] } = await t();
|
|
75
75
|
if (e("linkTrackingIds"))
|
|
76
76
|
try {
|
|
77
|
-
const { html: y, changed:
|
|
78
|
-
u.trackIdSessionFloor =
|
|
77
|
+
const { html: y, changed: H, nextSeq: I } = v(r, u.trackIdSessionFloor);
|
|
78
|
+
u.trackIdSessionFloor = I, H && (r = y, await i(y, l));
|
|
79
79
|
} catch (y) {
|
|
80
80
|
console.error("Tracking-id step failed, saving anyway:", y);
|
|
81
81
|
}
|
|
82
|
-
const { html: f, ampHtml: c = "", ampErrors:
|
|
82
|
+
const { html: f, ampHtml: c = "", ampErrors: T = [] } = await n({
|
|
83
83
|
minimize: !0,
|
|
84
84
|
resetDataSavedFlag: !1
|
|
85
85
|
});
|
|
86
|
-
a.selectedUnsubscribePages.length && await a.fetchTemplates(), await
|
|
87
|
-
const { compiledHtml:
|
|
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);
|
|
88
88
|
return console.debug("HTML Compilation Stats:", {
|
|
89
89
|
originalSize: S.originalSize,
|
|
90
90
|
compiledSize: S.compiledSize,
|
|
91
91
|
reduction: `${S.reductionPercentage.toFixed(2)}%`,
|
|
92
|
-
appliedRules:
|
|
92
|
+
appliedRules: D,
|
|
93
93
|
executionTime: `${S.executionTime.toFixed(2)}ms`
|
|
94
94
|
}), {
|
|
95
|
-
dynamicContentList:
|
|
96
|
-
compiledHtml:
|
|
95
|
+
dynamicContentList: P,
|
|
96
|
+
compiledHtml: w,
|
|
97
97
|
rawHtml: r,
|
|
98
98
|
css: l,
|
|
99
|
-
ampHtml:
|
|
100
|
-
ampErrors:
|
|
99
|
+
ampHtml: E,
|
|
100
|
+
ampErrors: T,
|
|
101
101
|
modules: g.map(Number),
|
|
102
102
|
recommendation: {
|
|
103
|
-
campaignUrls:
|
|
103
|
+
campaignUrls: F.recommendationCampaignUrls,
|
|
104
104
|
configs: {}
|
|
105
105
|
},
|
|
106
106
|
unsubscribe: {
|
|
@@ -108,13 +108,10 @@ const Z = () => {
|
|
|
108
108
|
config: b
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
|
-
}
|
|
112
|
-
// Exposed so the back/test validate-only path can seed the reco store the
|
|
113
|
-
// same way a full save does (required-field findings depend on it).
|
|
114
|
-
hydrateRecommendationStore: C
|
|
111
|
+
}
|
|
115
112
|
};
|
|
116
113
|
};
|
|
117
114
|
export {
|
|
118
|
-
|
|
115
|
+
O as getHtmlReferencedUnsubscribePages,
|
|
119
116
|
Z as useTemplatePreparation
|
|
120
117
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.16.0-beta.
|
|
3
|
+
"version": "3.16.0-beta.2b04988",
|
|
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,20 +0,0 @@
|
|
|
1
|
-
import a from "./ValidationErrorDrawer.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var i = function() {
|
|
5
|
-
var r = this, o = r._self._c, t = r._self._setupProxy;
|
|
6
|
-
return o(t.WpDrawer, { attrs: { id: "guido__validation-error-drawer", size: "small", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isDrawerOpen, "title-text": t.titleText }, on: { onCloseEvent: t.handleClose, primaryButtonEvent: t.handleClose, secondaryButtonEvent: t.handleSaveAndContinue } }, [o("div", { staticClass: "d-f f-d-c validation-error-list" }, r._l(t.rows, function(e, n) {
|
|
7
|
-
return o("div", { key: n, staticClass: "d-f a-i-c validation-error-row" }, [o(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), o("span", { staticClass: "validation-error-row__text" }, [r._v(r._s(e))])], 1);
|
|
8
|
-
}), 0)]);
|
|
9
|
-
}, l = [], _ = /* @__PURE__ */ s(
|
|
10
|
-
a,
|
|
11
|
-
i,
|
|
12
|
-
l,
|
|
13
|
-
!1,
|
|
14
|
-
null,
|
|
15
|
-
"cdf0f8c8"
|
|
16
|
-
);
|
|
17
|
-
const p = _.exports;
|
|
18
|
-
export {
|
|
19
|
-
p as default
|
|
20
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { defineComponent as m, ref as p, computed as s } from "vue";
|
|
2
|
-
import f from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
-
import { useSave as S } from "../../../composables/useSave.js";
|
|
4
|
-
import { useTranslations as v } from "../../../composables/useTranslations.js";
|
|
5
|
-
import { useConfigStore as g } from "../../../stores/config.js";
|
|
6
|
-
import { useEditorStore as y } from "../../../stores/editor.js";
|
|
7
|
-
import { useSaveValidationStore as _ } from "../../../stores/save-validation.js";
|
|
8
|
-
import { InIcons as C } from "@useinsider/design-system-vue";
|
|
9
|
-
const O = /* @__PURE__ */ m({
|
|
10
|
-
__name: "ValidationErrorDrawer",
|
|
11
|
-
setup(h) {
|
|
12
|
-
const r = v(), t = _(), n = y(), a = g(), { saveWithErrors: i } = S(), o = p(!1), l = s(() => `${r("email-editor.validation-errors")} (${t.errorCount})`), u = s(() => {
|
|
13
|
-
const e = {
|
|
14
|
-
primaryButton: {
|
|
15
|
-
styling: "solid",
|
|
16
|
-
type: "primary",
|
|
17
|
-
labelText: r("email-editor.update-design")
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
return !a.isTransactional && t.intent !== "test" && (e.secondaryButton = {
|
|
21
|
-
styling: "solid",
|
|
22
|
-
type: "subtle-primary",
|
|
23
|
-
labelText: r("email-editor.save-and-continue"),
|
|
24
|
-
loadingStatus: o.value
|
|
25
|
-
}), e;
|
|
26
|
-
}), d = s(() => t.errors.map((e) => {
|
|
27
|
-
const c = e.detail ? ` (${e.detail})` : "";
|
|
28
|
-
return `${e.message}${c}`;
|
|
29
|
-
}));
|
|
30
|
-
return { __sfc: !0, trans: r, store: t, editorStore: n, configStore: a, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
|
|
31
|
-
t.isDrawerOpen && t.close();
|
|
32
|
-
}, handleSaveAndContinue: async () => {
|
|
33
|
-
if (!o.value) {
|
|
34
|
-
o.value = !0, n.loadingStatus = !0;
|
|
35
|
-
try {
|
|
36
|
-
await i() ? t.close() : n.loadingStatus = !1;
|
|
37
|
-
} catch {
|
|
38
|
-
n.loadingStatus = !1;
|
|
39
|
-
} finally {
|
|
40
|
-
o.value = !1;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}, WpDrawer: f, InIcons: C };
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
export {
|
|
47
|
-
O as default
|
|
48
|
-
};
|