@useinsider/guido 3.13.1-beta.a813d24 → 3.13.1-beta.de07673
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/config/migrator/index.js +9 -8
- package/dist/config/migrator/productNameLinkMigrator.js +27 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +16 -16
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +36 -35
- package/dist/extensions/Blocks/Items/template.js +228 -263
- package/dist/extensions/Blocks/Items/utils/nameNode.js +4 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +12 -12
- package/dist/package.json.js +1 -1
- package/dist/src/config/migrator/productNameLinkMigrator.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/utils/nameNode.d.ts +9 -0
- package/dist/src/utils/unwrapProductNameLink.d.ts +15 -0
- package/dist/utils/pairProductVariables.js +27 -24
- package/dist/utils/unwrapProductNameLink.js +37 -0
- package/package.json +3 -3
|
@@ -41,9 +41,9 @@ ${s.map((o) => ` - ${o}`).join(`
|
|
|
41
41
|
};
|
|
42
42
|
v.validatedClasses = /* @__PURE__ */ new Set();
|
|
43
43
|
v.validationErrors = /* @__PURE__ */ new Map();
|
|
44
|
-
var i = v, z = /* @__PURE__ */ ((e) => (e.BLOCK = "BLOCK", e.CONTAINER = "CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e))(z || {}), P = class
|
|
44
|
+
var i = v, z = /* @__PURE__ */ ((e) => (e.BLOCK = "BLOCK", e.CONTAINER = "CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e))(z || {}), P = class c extends i {
|
|
45
45
|
constructor() {
|
|
46
|
-
super(
|
|
46
|
+
super(c.REQUIRED_METHODS, c);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Determines if the block should be available for use in the editor.
|
|
@@ -222,9 +222,9 @@ var i = v, z = /* @__PURE__ */ ((e) => (e.BLOCK = "BLOCK", e.CONTAINER = "CONTAI
|
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
P.REQUIRED_METHODS = ["getId", "getTemplate", "getIcon", "getName", "getDescription"];
|
|
225
|
-
var qe = P, Z = class
|
|
225
|
+
var qe = P, Z = class T extends i {
|
|
226
226
|
constructor() {
|
|
227
|
-
super(
|
|
227
|
+
super(T.REQUIRED_METHODS, T);
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* @deprecated - use {@link getPreviewInnerHtml} instead
|
|
@@ -339,12 +339,12 @@ var j = {
|
|
|
339
339
|
height: "height"
|
|
340
340
|
}, Je = {
|
|
341
341
|
BLOCK_IMAGE: j
|
|
342
|
-
}, U = "esd-block-button", w = "esd-block-text", K = "esd-block-image", J = "esd-structure", ee = "esd-block-video", te = "esd-block-social", re = "esd-block-banner", ae = "esd-block-timer", ne = "esd-block-menu", se = "esd-block-html", ie = "esd-block-spacer", le = "esd-container-frame", Ee = "esd-stripe", oe = "esd-amp-form", I = ((e) => (e.BUTTON = `.${U}`, e.TEXT = `.${w}`, e.IMAGE = `.${K}`, e.STRUCTURE = `.${J}`, e.VIDEO = `.${ee}`, e.SOCIAL = `.${te}`, e.BANNER = `.${re}`, e.TIMER = `.${ae}`, e.MENU = `.${ne}`, e.HTML = `.${se}`, e.SPACER = `.${ie}`, e.CONTAINER = `.${le}`, e.STRIPE = `.${Ee}`, e.FORM = `.${oe}`, e))(I || {}), de = /* @__PURE__ */ ((e) => (e.BLOCK_IMAGE = "BLOCK_IMAGE", e.BLOCK_TEXT = "BLOCK_TEXT", e.BLOCK_BUTTON = "BLOCK_BUTTON", e.BLOCK_SPACER = "BLOCK_SPACER", e.BLOCK_VIDEO = "BLOCK_VIDEO", e.BLOCK_SOCIAL = "BLOCK_SOCIAL", e.BLOCK_BANNER = "BLOCK_BANNER", e.BLOCK_TIMER = "BLOCK_TIMER", e.BLOCK_MENU = "BLOCK_MENU", e.BLOCK_MENU_ITEM = "BLOCK_MENU_ITEM", e.BLOCK_HTML = "BLOCK_HTML", e.BLOCK_AMP_CAROUSEL = "BLOCK_AMP_CAROUSEL", e.BLOCK_AMP_ACCORDION = "BLOCK_AMP_ACCORDION", e.BLOCK_AMP_FORM = "BLOCK_AMP_FORM", e.CONTAINER = "CONTAINER", e.FORM_CONTAINER = "FORM_CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e.EMPTY_CONTAINER = "EMPTY_CONTAINER", e.CUSTOM_BLOCK_LINK = "CUSTOM_BLOCK_LINK", e.CUSTOM_BLOCK_IMAGE = "CUSTOM_BLOCK_IMAGE", e.CUSTOM_BLOCK_TEXT = "CUSTOM_BLOCK_TEXT", e))(de || {}), F = /* @__PURE__ */ ((e) => (e.ANCHOR_LINK_CONTAINER = "anchorLinkFormContainer", e.APPLY_CONDITION = "applyCondition", e.APPLY_CONDITION_SWITCHER = "applyConditionSwitcher", e.BACKGROUND_COLOR = "backgroundColor", e.BACKGROUND_IMAGE = "generalImageContainer", e.TEXT_COLOR = "textColor", e.TEXT_STYLE = "textStyle", e.TEXT_SIZE = "textSize", e.TEXT_LINE_SPACING = "textLineSpacing", e.TEXT_ALIGN = "textAlign", e.FIXED_HEIGHT_SWITCHER = "fixedHeightSwitcherForm", e.HIDDEN_NODE = "hiddenNode", e.SMART_BLOCK = "smartBlock", e.SYNCHRONIZED_MODULE = "synchronizedModuleForm", e.FONT_FAMILY = "generalFontFamilyForm", e.BLOCK_INTERNAL_INDENTS = "generalBlockInternalIndents", e.STRUCTURE_INTERNAL_INDENTS = "generalStructureInternalIndents", e))(F || {}), H = /* @__PURE__ */ ((e) => (e.ADJUST_TO_WIDTH = "adjustToWidth", e.ALIGNMENT = "buttonAlignment", e.BORDER = "buttonBorder", e.BORDER_RADIUS = "buttonBorderRadius", e.COLOR = "buttonColor", e.BUTTON_BLOCK_BACKGROUND_COLOR = "buttonBlockBackgroundColor", e.EXTERNAL_INDENTS = "buttonExternalIndents", e.FIXED_HEIGHT = "buttonFixedHeightForm", e.FONT_COLOR = "buttonFontColor", e.FONT_FAMILY = "buttonFontFamily", e.FONT_SIZE = "buttonFontSize", e.
|
|
342
|
+
}, U = "esd-block-button", w = "esd-block-text", K = "esd-block-image", J = "esd-structure", ee = "esd-block-video", te = "esd-block-social", re = "esd-block-banner", ae = "esd-block-timer", ne = "esd-block-menu", se = "esd-block-html", ie = "esd-block-spacer", le = "esd-container-frame", Ee = "esd-stripe", oe = "esd-amp-form", I = ((e) => (e.BUTTON = `.${U}`, e.TEXT = `.${w}`, e.IMAGE = `.${K}`, e.STRUCTURE = `.${J}`, e.VIDEO = `.${ee}`, e.SOCIAL = `.${te}`, e.BANNER = `.${re}`, e.TIMER = `.${ae}`, e.MENU = `.${ne}`, e.HTML = `.${se}`, e.SPACER = `.${ie}`, e.CONTAINER = `.${le}`, e.STRIPE = `.${Ee}`, e.FORM = `.${oe}`, e))(I || {}), de = /* @__PURE__ */ ((e) => (e.BLOCK_IMAGE = "BLOCK_IMAGE", e.BLOCK_TEXT = "BLOCK_TEXT", e.BLOCK_BUTTON = "BLOCK_BUTTON", e.BLOCK_SPACER = "BLOCK_SPACER", e.BLOCK_VIDEO = "BLOCK_VIDEO", e.BLOCK_SOCIAL = "BLOCK_SOCIAL", e.BLOCK_BANNER = "BLOCK_BANNER", e.BLOCK_TIMER = "BLOCK_TIMER", e.BLOCK_MENU = "BLOCK_MENU", e.BLOCK_MENU_ITEM = "BLOCK_MENU_ITEM", e.BLOCK_HTML = "BLOCK_HTML", e.BLOCK_AMP_CAROUSEL = "BLOCK_AMP_CAROUSEL", e.BLOCK_AMP_ACCORDION = "BLOCK_AMP_ACCORDION", e.BLOCK_AMP_FORM = "BLOCK_AMP_FORM", e.CONTAINER = "CONTAINER", e.FORM_CONTAINER = "FORM_CONTAINER", e.STRUCTURE = "STRUCTURE", e.STRIPE = "STRIPE", e.EMPTY_CONTAINER = "EMPTY_CONTAINER", e.CUSTOM_BLOCK_LINK = "CUSTOM_BLOCK_LINK", e.CUSTOM_BLOCK_IMAGE = "CUSTOM_BLOCK_IMAGE", e.CUSTOM_BLOCK_TEXT = "CUSTOM_BLOCK_TEXT", e))(de || {}), F = /* @__PURE__ */ ((e) => (e.ANCHOR_LINK_CONTAINER = "anchorLinkFormContainer", e.APPLY_CONDITION = "applyCondition", e.APPLY_CONDITION_SWITCHER = "applyConditionSwitcher", e.BACKGROUND_COLOR = "backgroundColor", e.BACKGROUND_IMAGE = "generalImageContainer", e.TEXT_COLOR = "textColor", e.TEXT_STYLE = "textStyle", e.TEXT_SIZE = "textSize", e.TEXT_LINE_SPACING = "textLineSpacing", e.TEXT_ALIGN = "textAlign", e.FIXED_HEIGHT_SWITCHER = "fixedHeightSwitcherForm", e.HIDDEN_NODE = "hiddenNode", e.SMART_BLOCK = "smartBlock", e.SYNCHRONIZED_MODULE = "synchronizedModuleForm", e.FONT_FAMILY = "generalFontFamilyForm", e.BLOCK_INTERNAL_INDENTS = "generalBlockInternalIndents", e.STRUCTURE_INTERNAL_INDENTS = "generalStructureInternalIndents", e))(F || {}), H = /* @__PURE__ */ ((e) => (e.ADJUST_TO_WIDTH = "adjustToWidth", e.ALIGNMENT = "buttonAlignment", e.BORDER = "buttonBorder", e.BORDER_RADIUS = "buttonBorderRadius", e.COLOR = "buttonColor", e.BUTTON_BLOCK_BACKGROUND_COLOR = "buttonBlockBackgroundColor", e.EXTERNAL_INDENTS = "buttonExternalIndents", e.FIXED_HEIGHT = "buttonFixedHeightForm", e.FONT_COLOR = "buttonFontColor", e.FONT_FAMILY = "buttonFontFamily", e.FONT_SIZE = "buttonFontSize", e.ICON = "buttonIconContainer", e.ICON_ALIGN = "buttonIconAlign", e.ICON_INDENT = "buttonIconIndent", e.ICON_WIDTH = "buttonIconWidth", e.IMAGE = "buttonImageForm", e.INTERNAL_INDENTS = "buttonInternalIndents", e.LINK = "buttonLink", e.MIME_TYPE = "buttonMimeTypeForm", e.SWITCHER_HOVERED_STYLES = "buttonSwitcherHoveredStylesForm", e.TEXT = "buttonText", e.TEXT_STYLE_AND_COLOR = "buttonTextStyleAndColorForm", e.HOVERED_BORDER_COLOR = "hoveredStyleBorderButtonForm", e.HOVERED_COLOR = "hoveredButtonColorForm", e.HOVERED_TEXT_COLOR = "hoveredButtonTextColorForm", e))(H || {}), k = /* @__PURE__ */ ((e) => (e.HIDDEN_NODE = "hiddenNodeText", e.PARAGRAPH_STYLE = "paragraphStyleForm", e.ALIGN = "textAlignmentForm", e.ANCHOR_CONTAINER = "textAnchorForm", e.FONT_BACKGROUND_COLOR = "textBlockFontBackgroundColor", e.TEXT_BLOCK_BACKGROUND_COLOR = "textBlockBackgroundColor", e.FONT_COLOR = "textBlockFontColor", e.TEXT_BLOCK_FONT_FAMILY = "textBlockFontFamily", e.FONT_FAMILY = "textFontFamily", e.FONT_SIZE = "textBlockFontSize", e.FONT_WEIGHT = "textBlockFontWeight", e.DIRECTION = "textBlockDirectionForm", e.INSERT_FORM = "textBlockInsertForm", e.LINK_DATA = "textBlockLinkDataForm", e.FORMAT = "textBlockTextFormatForm", e.FIXED_HEIGHT = "textFixedHeightForm", e.INTERNAL_INDENTS = "textInternalIndents", e.LINE_HEIGHT = "textLineHeightForm", e.MIME_TYPE = "textMimeTypeForm", e.NO_LINE_WRAPS = "textNoLineWrapsForm", e))(k || {}), p = /* @__PURE__ */ ((e) => (e.ALT_TEXT = "altText", e.LINK = "blockLink", e.ALIGNMENT = "imageAlignment", e.ANCHOR_LINK_CONTAINER = "imageAnchorLinkContainerForm", e.BORDER_RADIUS = "imageBorderRadiusForm", e.IMAGE = "imageImageForm", e.EXTERNAL_INDENTS = "imageExternalIndents", e.MIME_TYPE = "imageMimeTypeForm", e.RESPONSIVE = "imageResponsive", e.ROLLOVER_IMAGE = "imageRolloverImageForm", e.ROLLOVER_SWITCHER = "imageRolloverSwitcherForm", e.SIZE = "imageSizeContainer", e))(p || {}), ue = /* @__PURE__ */ ((e) => (e.BACKGROUND_COLOR = "containerBackgroundColorForm", e.BORDER_FORM = "containerBorderForm", e.BORDER_RADIUS = "containerBorderRadiusForm", e.EXTERNAL_INDENTS = "containerExternalIndentsForm", e.IMAGE_CONTAINER = "containerImageContainerForm", e.MIME_TYPE = "containerMimeTypeForm", e.DISPLAY_CONDITIONS = "displayConditions", e.HIDDEN_NODE = "containerHiddenNodeForm", e))(ue || {}), n = {
|
|
343
343
|
BLOCK_BUTTON: H,
|
|
344
344
|
BLOCK_TEXT: k,
|
|
345
345
|
BLOCK_IMAGE: p,
|
|
346
346
|
GENERAL: F
|
|
347
|
-
}, Ie = /* @__PURE__ */ ((e) => (e.SAVE_AS_MODULE = "saveAsModule", e.IMPROVE_WITH_AI = "improveWithAI", e.MOVE = "move", e.COPY = "copy", e.REMOVE = "remove", e.CLEAR_CONTAINER = "clearContainer", e.EXTERNAL_DISPLAY_CONDITION = "externalDisplayCondition", e))(Ie || {}),
|
|
347
|
+
}, Ie = /* @__PURE__ */ ((e) => (e.SAVE_AS_MODULE = "saveAsModule", e.IMPROVE_WITH_AI = "improveWithAI", e.MOVE = "move", e.COPY = "copy", e.REMOVE = "remove", e.CLEAR_CONTAINER = "clearContainer", e.EXTERNAL_DISPLAY_CONDITION = "externalDisplayCondition", e))(Ie || {}), ce = /* @__PURE__ */ ((e) => (e.previewDeviceMode = "previewDeviceMode", e.panelPosition = "panelPosition", e.themeMode = "themeMode", e))(ce || {}), Te = /* @__PURE__ */ ((e) => (e.DESKTOP = "DESKTOP", e.MOBILE = "MOBILE", e))(Te || {}), be = /* @__PURE__ */ ((e) => (e.SETTINGS = "settings", e.STYLES = "styles", e.DATA = "data", e))(be || {}), a = {
|
|
348
348
|
name: "name",
|
|
349
349
|
disabled: "disabled"
|
|
350
350
|
}, he = {
|
|
@@ -619,7 +619,7 @@ var j = {
|
|
|
619
619
|
}
|
|
620
620
|
};
|
|
621
621
|
G.REQUIRED_METHODS = ["getId", "getTemplate"];
|
|
622
|
-
var
|
|
622
|
+
var ct = G, Xe = class m extends i {
|
|
623
623
|
constructor() {
|
|
624
624
|
super(m.REQUIRED_METHODS, m);
|
|
625
625
|
}
|
|
@@ -694,7 +694,7 @@ var V = class extends x {
|
|
|
694
694
|
const t = e.querySelectorAll(I.IMAGE), r = e.asElement().hasClass(K) ? [e] : [];
|
|
695
695
|
return t.length ? t : r;
|
|
696
696
|
}
|
|
697
|
-
},
|
|
697
|
+
}, Tt = class extends V {
|
|
698
698
|
getParentControlId() {
|
|
699
699
|
return n.BLOCK_IMAGE.EXTERNAL_INDENTS;
|
|
700
700
|
}
|
|
@@ -1215,17 +1215,17 @@ export {
|
|
|
1215
1215
|
It as ButtonTextStyleAndFontColorBuiltInControl,
|
|
1216
1216
|
ue as ContainerControls,
|
|
1217
1217
|
Ie as ContextActionType,
|
|
1218
|
-
|
|
1219
|
-
|
|
1218
|
+
ct as Control,
|
|
1219
|
+
ce as EditorStatePropertyType,
|
|
1220
1220
|
Ve as Extension,
|
|
1221
1221
|
Nt as ExtensionBuilder,
|
|
1222
1222
|
F as GeneralControls,
|
|
1223
1223
|
Dt as IconsRegistry,
|
|
1224
1224
|
p as ImageControls,
|
|
1225
|
-
|
|
1225
|
+
Tt as ImageMarginsBuiltInControl,
|
|
1226
1226
|
bt as ImageSizeBuiltInControl,
|
|
1227
1227
|
St as ModificationDescription,
|
|
1228
|
-
|
|
1228
|
+
Te as PreviewDeviceMode,
|
|
1229
1229
|
ht as SettingsPanelRegistry,
|
|
1230
1230
|
mt as SettingsPanelTab,
|
|
1231
1231
|
be as SettingsTab,
|
package/dist/package.json.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function migrateProductNameLink(html: string): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the element carrying the product name text.
|
|
4
|
+
*
|
|
5
|
+
* New blocks put `product-attr="name"` on the `<p>`; blocks saved before SD-147616 still
|
|
6
|
+
* carry it on the inner `<a>`, and the oldest ones have no attribute at all — hence the
|
|
7
|
+
* `p > a` fallback. Without it, trimming silently no-ops on legacy blocks.
|
|
8
|
+
*/
|
|
9
|
+
export declare const findNameTextNode: (container?: ImmutableHtmlNode) => ImmutableHtmlElementNode | undefined;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unwraps the `<a>` around an Items-block product name so the name compiles as plain text.
|
|
3
|
+
*
|
|
4
|
+
* Outlook's Word engine ignores `color: inherit` on an `<a>` and paints its own blue link
|
|
5
|
+
* color (SD-147616). New blocks no longer emit the anchor, but templates saved before the
|
|
6
|
+
* fix still carry it in their stored HTML — this heals them at compile time.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Removes the product-name link from every `.ins-product-td` in the document, in place.
|
|
10
|
+
*
|
|
11
|
+
* Scoped like `pairProductVariables` so partner or legacy recommendation markup outside a
|
|
12
|
+
* product cell is never touched. Idempotent.
|
|
13
|
+
* @param doc - Parsed template document, mutated in place
|
|
14
|
+
*/
|
|
15
|
+
export declare function unwrapProductNameLinks(doc: Document): void;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { productPairs as
|
|
1
|
+
import { productPairs as q } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
2
2
|
import { DefaultConfigValues as O } from "../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
3
|
-
import { preserveTextStyles as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { preserveTextStyles as y } from "./preserveTextStyles.js";
|
|
4
|
+
import { unwrapProductNameLinks as U } from "./unwrapProductNameLink.js";
|
|
5
|
+
function Y(L) {
|
|
6
|
+
const H = L.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), T = new DOMParser().parseFromString(H, "text/html");
|
|
7
|
+
U(T);
|
|
8
|
+
const C = q.PAIRS_FOR_EXTENSION;
|
|
9
|
+
Object.entries(C).forEach(([r, f]) => {
|
|
10
|
+
T.querySelectorAll(".ins-product-td").forEach((c) => {
|
|
11
|
+
const A = c.getAttribute("data-number") || "1", m = c.getAttribute("data-type") || "CART_ITEMS";
|
|
9
12
|
c.querySelectorAll(`[product-attr="${r}"]`).forEach((t) => {
|
|
10
13
|
var F, I, w;
|
|
11
|
-
const
|
|
14
|
+
const $ = t.getAttribute("data-type") || m, u = t.getAttribute("data-number") || A, d = f[$];
|
|
12
15
|
if (d)
|
|
13
16
|
switch (r) {
|
|
14
17
|
case "imageSrc": {
|
|
@@ -19,13 +22,13 @@ function V(L) {
|
|
|
19
22
|
if (a && e.src) {
|
|
20
23
|
const o = e.src;
|
|
21
24
|
a.some((h) => {
|
|
22
|
-
const l = h.split("/").pop() || "",
|
|
23
|
-
return o.includes(h) || o.includes(l) ||
|
|
25
|
+
const l = h.split("/").pop() || "", b = o.split("/").pop() || "";
|
|
26
|
+
return o.includes(h) || o.includes(l) || b === l;
|
|
24
27
|
}) && (e.src = `{{${s}_${u}}}`);
|
|
25
28
|
}
|
|
26
|
-
const n = (I = (F =
|
|
29
|
+
const n = (I = (F = C.name) == null ? void 0 : F[$]) == null ? void 0 : I.ATTR;
|
|
27
30
|
if (n && e.setAttribute("alt", `{{${n}_${u}}}`), i) {
|
|
28
|
-
const o = (w =
|
|
31
|
+
const o = (w = C.itemLink) == null ? void 0 : w[$];
|
|
29
32
|
if (o) {
|
|
30
33
|
const E = o.HREF, h = o.DEFAULT_HREF || "#!", l = i.href;
|
|
31
34
|
(l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${u}}}`);
|
|
@@ -35,7 +38,7 @@ function V(L) {
|
|
|
35
38
|
}
|
|
36
39
|
case "name": {
|
|
37
40
|
const e = d, i = e.ATTR, a = e.DEFAULT_HREF || "#!", s = e.HREF;
|
|
38
|
-
t.textContent && (t.innerHTML =
|
|
41
|
+
t.textContent && (t.innerHTML = y(t, `{{${i}_${u}}}`));
|
|
39
42
|
const n = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
40
43
|
if (n && s) {
|
|
41
44
|
const o = n.href, E = `${window.location.href}${a}`;
|
|
@@ -50,14 +53,14 @@ function V(L) {
|
|
|
50
53
|
n ? E = s ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : E = s ? e.PRICE_FORMATTED : e.PRICE;
|
|
51
54
|
const h = e.CURRENCY;
|
|
52
55
|
let l = `{{${E}_${u}}}`;
|
|
53
|
-
const
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
+
const b = (t.getAttribute("data-currency_symbol") || "").trim(), N = b !== "" && b !== O.productPriceCurrencySymbolControlValue;
|
|
57
|
+
let g = "";
|
|
58
|
+
N ? g = b : h && (g = `{{${h}_${u}}}`), g && (l = o === "after" ? `${l} ${g}` : `${g} ${l}`), t.innerHTML = y(t, l);
|
|
56
59
|
break;
|
|
57
60
|
}
|
|
58
61
|
case "quantity": {
|
|
59
62
|
const e = d, i = e.ATTR, a = e.DEFAULT;
|
|
60
|
-
t.textContent && t.textContent.trim() === a && (t.innerHTML =
|
|
63
|
+
t.textContent && t.textContent.trim() === a && (t.innerHTML = y(t, `{{${i}_${u}}}`));
|
|
61
64
|
break;
|
|
62
65
|
}
|
|
63
66
|
case "button": {
|
|
@@ -79,7 +82,7 @@ function V(L) {
|
|
|
79
82
|
default: {
|
|
80
83
|
if ("ATTR" in d) {
|
|
81
84
|
const e = d.ATTR;
|
|
82
|
-
t.textContent && (t.innerHTML =
|
|
85
|
+
t.textContent && (t.innerHTML = y(t, `{{${e}_${u}}}`));
|
|
83
86
|
}
|
|
84
87
|
break;
|
|
85
88
|
}
|
|
@@ -88,7 +91,7 @@ function V(L) {
|
|
|
88
91
|
});
|
|
89
92
|
});
|
|
90
93
|
const k = H.match(/<!DOCTYPE[^>]*>/i), P = k ? `${k[0]}
|
|
91
|
-
` : "", D =
|
|
94
|
+
` : "", D = T.querySelectorAll(".ins-product-td"), M = [];
|
|
92
95
|
D.forEach((r) => {
|
|
93
96
|
const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", c = r.getAttribute("data-nodup"), A = r.outerHTML;
|
|
94
97
|
M.push({
|
|
@@ -99,7 +102,7 @@ function V(L) {
|
|
|
99
102
|
nodup: c || void 0
|
|
100
103
|
});
|
|
101
104
|
});
|
|
102
|
-
let _ = P +
|
|
105
|
+
let _ = P + T.documentElement.outerHTML;
|
|
103
106
|
M.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
|
|
104
107
|
let c = "";
|
|
105
108
|
switch (f) {
|
|
@@ -114,11 +117,11 @@ function V(L) {
|
|
|
114
117
|
break;
|
|
115
118
|
}
|
|
116
119
|
if (c) {
|
|
117
|
-
const
|
|
118
|
-
_ = _.replace(r,
|
|
120
|
+
const m = parseInt(p) - 1, $ = `${`{% if ${c} > ${m} %}`}${r}{% endif %}`;
|
|
121
|
+
_ = _.replace(r, $);
|
|
119
122
|
}
|
|
120
123
|
});
|
|
121
|
-
const x =
|
|
124
|
+
const x = T.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
|
|
122
125
|
return x.forEach((r) => {
|
|
123
126
|
const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
|
|
124
127
|
if (!f || p !== "CART_ITEMS")
|
|
@@ -137,5 +140,5 @@ function V(L) {
|
|
|
137
140
|
}), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
138
141
|
}
|
|
139
142
|
export {
|
|
140
|
-
|
|
143
|
+
Y as pairProductVariables
|
|
141
144
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const f = "text-decoration", A = /(?:[^;"'()]|"[^"]*"|'[^']*'|\([^)]*\))+/g, c = (e) => (e.match(A) || []).map((r) => r.trim()).filter(Boolean), l = (e) => e.slice(0, e.indexOf(":")).trim().toLowerCase(), m = (e) => e.slice(e.indexOf(":") + 1).trim().toLowerCase(), u = (e, r) => {
|
|
2
|
+
const s = e.getAttribute("style");
|
|
3
|
+
if (!s)
|
|
4
|
+
return;
|
|
5
|
+
const t = c(r.getAttribute("style") || ""), i = new Set(t.map(l)), o = c(s).filter((n) => {
|
|
6
|
+
const a = l(n);
|
|
7
|
+
return !a || i.has(a) ? !1 : !a.startsWith(f) && m(n) !== "inherit";
|
|
8
|
+
});
|
|
9
|
+
o.length && r.setAttribute("style", [...t, ...o].join("; "));
|
|
10
|
+
}, y = ["product-attr", "data-type", "data-number", "data-slot-2"], p = (e, r) => {
|
|
11
|
+
y.forEach((s) => {
|
|
12
|
+
const t = e.getAttribute(s);
|
|
13
|
+
t !== null && !r.hasAttribute(s) && r.setAttribute(s, t);
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
function E(e) {
|
|
17
|
+
e.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
18
|
+
const s = /* @__PURE__ */ new Set();
|
|
19
|
+
r.querySelectorAll('[product-attr="name"]').forEach((t) => {
|
|
20
|
+
const i = t.closest("a");
|
|
21
|
+
i && r.contains(i) && s.add(i);
|
|
22
|
+
}), s.forEach((t) => {
|
|
23
|
+
if (t.querySelector("img") || Array.from(t.querySelectorAll("[product-attr]")).some((a) => a.getAttribute("product-attr") !== "name"))
|
|
24
|
+
return;
|
|
25
|
+
const o = t.closest("p");
|
|
26
|
+
if (o && r.contains(o)) {
|
|
27
|
+
p(t, o), u(t, o), t.replaceWith(...Array.from(t.childNodes));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const n = e.createElement("span");
|
|
31
|
+
p(t, n), u(t, n), n.append(...Array.from(t.childNodes)), t.replaceWith(n);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
E as unwrapProductNameLinks
|
|
37
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.13.1-beta.
|
|
3
|
+
"version": "3.13.1-beta.de07673",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"author": "",
|
|
44
44
|
"license": "ISC",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@stripoinc/ui-editor-extensions": "3.
|
|
46
|
+
"@stripoinc/ui-editor-extensions": "3.8.0",
|
|
47
47
|
"@useinsider/design-system-vue": "1.3.0",
|
|
48
48
|
"@vueuse/core": "11.3.0",
|
|
49
49
|
"lodash-es": "4.17.21",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
"guido": {
|
|
115
115
|
"stripo": {
|
|
116
|
-
"version": "2.
|
|
116
|
+
"version": "2.69.1"
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|