@useinsider/guido 3.19.0-beta.f0d5980 → 3.19.0-beta.f328a8a
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/composables/useAutoSave.js +11 -11
- package/dist/config/migrator/itemsBlockMigrator.js +236 -248
- package/dist/config/migrator/recommendationMigrator.js +28 -21
- package/dist/config/migrator/recommendationPartnerMigrator.js +36 -30
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
- package/dist/extensions/Blocks/Items/template.js +219 -204
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +246 -203
- package/dist/src/composables/useGuidoActions.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +8 -0
- package/dist/src/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/pairProductVariables.js +71 -71
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single owner for the Items card orientation-dependent layout contract (SD-149368).
|
|
3
|
+
*
|
|
4
|
+
* Two things depend on a card's orientation and are written across several layers:
|
|
5
|
+
*
|
|
6
|
+
* 1. Name column width — a horizontal card lays the name in a narrow side-by-side
|
|
7
|
+
* column, so it is capped; a vertical card gives it a full-width row.
|
|
8
|
+
* 2. Block-cell padding — the collapsible price / original-price block-cell carries its
|
|
9
|
+
* own inter-cell spacing (horizontal cards pad left/right, vertical cards pad
|
|
10
|
+
* top/bottom) so a hidden element removes its own spacing instead of leaving a gap.
|
|
11
|
+
*
|
|
12
|
+
* Every layer that writes these — template render, layouts/horizontal.html,
|
|
13
|
+
* NameTrimmingControl (trimming toggle) and settingsControl (orientation change) — MUST
|
|
14
|
+
* derive them here, or a migrated / re-toggled card silently drifts out of sync with
|
|
15
|
+
* freshly generated markup (convention B1: cross-layer literals live in one module).
|
|
16
|
+
*/
|
|
17
|
+
export declare const NAME_HORIZONTAL_MAX_WIDTH = "130px";
|
|
18
|
+
export declare const NAME_VERTICAL_MAX_WIDTH = "100%";
|
|
19
|
+
/** Name max-width for a card orientation. Non-horizontal (incl. undefined) → full width. */
|
|
20
|
+
export declare const nameMaxWidthFor: (orientation?: string) => string;
|
|
21
|
+
/** Orientation-dependent inter-cell padding classes for a collapsible block-cell. */
|
|
22
|
+
export declare const BLOCK_CELL_PADDING: {
|
|
23
|
+
readonly VERTICAL: "es-p5b es-p5t";
|
|
24
|
+
readonly HORIZONTAL: "es-p5l es-p5r";
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Attribute the block-cell carries to mark its LAYOUT-owned padding orientation ('v'|'h').
|
|
28
|
+
* The orientation toggle keys off this marker so it only ever rewrites the padding the
|
|
29
|
+
* layout itself baked — a user's own es-p* padding classes are never matched or clobbered
|
|
30
|
+
* (SD-149368 F1), and a cell without the marker is left untouched rather than mis-swapped.
|
|
31
|
+
*/
|
|
32
|
+
export declare const BLOCK_CELL_PAD_ATTR = "data-items-cell-pad";
|
|
33
|
+
/** Marker attribute (`data-items-cell-pad="v|h"`) for a block-cell in the given orientation. */
|
|
34
|
+
export declare const blockCellPadMarker: (isVertical: boolean) => string;
|
|
35
|
+
/** Padding classes (leading space included) for a block-cell in the given orientation. */
|
|
36
|
+
export declare const blockCellPaddingFor: (isVertical: boolean) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Rewrites a block-cell's LAYOUT-owned padding classes to the target orientation, keyed off
|
|
39
|
+
* the BLOCK_CELL_PAD_ATTR marker. The orientation-change rebuild re-injects existing cells
|
|
40
|
+
* via getOuterHTML(), which still carry the previous orientation's padding — swap only the
|
|
41
|
+
* layout pair (and flip the marker) so price/original-price cells stay padded after a toggle
|
|
42
|
+
* (SD-149368 F3), while a user's own padding and any unmarked cell are left alone (F1).
|
|
43
|
+
*/
|
|
44
|
+
export declare const reorientBlockCellPadding: (html: string, toVertical: boolean) => string;
|
|
@@ -39,14 +39,17 @@ export declare const productPairs: {
|
|
|
39
39
|
CART_ITEMS: {
|
|
40
40
|
ATTR: string;
|
|
41
41
|
DEFAULT: string;
|
|
42
|
+
LEGACY_DEFAULTS: readonly string[];
|
|
42
43
|
};
|
|
43
44
|
BROWSED_ITEMS: {
|
|
44
45
|
ATTR: string;
|
|
45
46
|
DEFAULT: string;
|
|
47
|
+
LEGACY_DEFAULTS: readonly string[];
|
|
46
48
|
};
|
|
47
49
|
PURCHASED_ITEMS: {
|
|
48
50
|
ATTR: string;
|
|
49
51
|
DEFAULT: string;
|
|
52
|
+
LEGACY_DEFAULTS: readonly string[];
|
|
50
53
|
};
|
|
51
54
|
};
|
|
52
55
|
price: {
|
|
@@ -37,6 +37,25 @@ type TemplateParameters = {
|
|
|
37
37
|
/** Price orientation within the card ('vertical' = stacked, 'horizontal' = side-by-side) */
|
|
38
38
|
priceOrientation?: PriceOrientationType;
|
|
39
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Applies price orientation styles to the generated HTML template.
|
|
42
|
+
*
|
|
43
|
+
* For Vertical Layout:
|
|
44
|
+
* - vertical price orientation: both cells 100% (stacked)
|
|
45
|
+
* - horizontal price orientation with both visible: both cells 50% (side-by-side)
|
|
46
|
+
* - horizontal price orientation with one hidden: visible cell 100%
|
|
47
|
+
*
|
|
48
|
+
* For Horizontal Layout:
|
|
49
|
+
* - horizontal price orientation: .horizontal-price visible, .vertical-price hidden
|
|
50
|
+
* - vertical price orientation: .horizontal-price hidden, .vertical-price visible
|
|
51
|
+
* @param html - The HTML template string with placeholders replaced
|
|
52
|
+
* @param layoutOrientation - The card layout orientation ('vertical' or 'horizontal')
|
|
53
|
+
* @param priceOrientation - The price orientation within the card ('vertical' or 'horizontal')
|
|
54
|
+
* @param isPriceVisible - Whether the price element is visible
|
|
55
|
+
* @param isOriginalPriceVisible - Whether the original price element is visible
|
|
56
|
+
* @returns HTML string with price orientation styles applied
|
|
57
|
+
*/
|
|
58
|
+
export declare const applyPriceOrientationStyles: (html: string, layoutOrientation: OrientationType, priceOrientation: PriceOrientationType, isPriceVisible?: boolean, isOriginalPriceVisible?: boolean) => string;
|
|
40
59
|
/**
|
|
41
60
|
* Generates the default template for the Items Block.
|
|
42
61
|
* @param params - Template parameters including orientation, items type, item ID, and formatting options
|
|
@@ -22,6 +22,9 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
22
22
|
private storeUnsubscription;
|
|
23
23
|
private pendingNodeConfigWrite;
|
|
24
24
|
private pendingConfigFlushTimer;
|
|
25
|
+
private seenConfigVersion;
|
|
26
|
+
private fetchedConfigVersion;
|
|
27
|
+
private hasUnappliedConfigChange;
|
|
25
28
|
private algorithmControl;
|
|
26
29
|
private localeControl;
|
|
27
30
|
private currencyControl;
|
|
@@ -127,6 +130,11 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
127
130
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
128
131
|
*/
|
|
129
132
|
private _debouncedFetchProducts;
|
|
133
|
+
/**
|
|
134
|
+
* Fetches and renders the block's products without the panel, carrying the
|
|
135
|
+
* deferred config write so both still land as one undo entry.
|
|
136
|
+
*/
|
|
137
|
+
private _refreshProductsOutsidePanel;
|
|
130
138
|
/**
|
|
131
139
|
* Debounced content update when products arrive from API.
|
|
132
140
|
*
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev-harness stand-in for the cortex-fe MFE's shared `chat` store.
|
|
3
|
+
*
|
|
4
|
+
* `useCortexBlueprintBridge` resolves that store by id off the host's pinia at
|
|
5
|
+
* Guido's setup time, so a store registered after mount is never seen. Installing
|
|
6
|
+
* it here — before `<Guido>` renders — lets e2e drive the bridge through its real
|
|
7
|
+
* registration path instead of re-invoking the composable by hand.
|
|
8
|
+
*
|
|
9
|
+
* Activated with `?chatStore=true`; the instance is exposed on `window` so a test
|
|
10
|
+
* can push agent messages into it.
|
|
11
|
+
*/
|
|
12
|
+
export declare const installMockChatStore: () => void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { OnboardingCardConfig, OnboardingType, OnboardingStoreState } from '@@/Types/onboarding';
|
|
2
2
|
export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoOnboarding", OnboardingStoreState, {
|
|
3
|
+
/** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
3
4
|
getOnboarding: (state: {
|
|
4
5
|
onboardings: {
|
|
5
6
|
newVersionPopup: {
|
|
@@ -390,6 +391,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
|
|
|
390
391
|
};
|
|
391
392
|
isFetched: boolean;
|
|
392
393
|
} & import("pinia").PiniaCustomStateProperties<OnboardingStoreState>) => (type: OnboardingType) => boolean;
|
|
394
|
+
/** @deprecated Components use getGenericCurrentCard / getTextBlockCurrentCard. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
393
395
|
getCurrentCard: (state: {
|
|
394
396
|
onboardings: {
|
|
395
397
|
newVersionPopup: {
|
|
@@ -2190,6 +2192,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
|
|
|
2190
2192
|
close(type: OnboardingType): Promise<void>;
|
|
2191
2193
|
next(type: OnboardingType): void;
|
|
2192
2194
|
previous(type: OnboardingType): void;
|
|
2195
|
+
/** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
2193
2196
|
updateCardPosition(type: OnboardingType, cardIndex: number, position: {
|
|
2194
2197
|
top: string;
|
|
2195
2198
|
position: string;
|
|
@@ -2198,6 +2201,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
|
|
|
2198
2201
|
onDiscoverNowClicked(): Promise<void>;
|
|
2199
2202
|
onRemindMeLater(): void;
|
|
2200
2203
|
onNewVersionPopupClose(): Promise<void>;
|
|
2204
|
+
/** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
2201
2205
|
isOnboardingActive(): boolean;
|
|
2202
2206
|
fetchUserModalState(): Promise<void>;
|
|
2203
2207
|
setUserModalState(modal: string, state: string, page: string): Promise<void>;
|
|
@@ -6,5 +6,10 @@ type RecommendationConfig = {
|
|
|
6
6
|
interface StoreState {
|
|
7
7
|
recommendationConfigs: RecommendationConfig[];
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated recommendationConfigs has no writer in src/, so the store is
|
|
11
|
+
* permanently empty and its only readers (useHtmlValidator.ts:496-497) are a
|
|
12
|
+
* no-op. Slated for deletion, see the SD-667788 dead-code ledger.
|
|
13
|
+
*/
|
|
9
14
|
export declare const useRecommendationStore: import("pinia").StoreDefinition<"guidoRecommendation", StoreState, {}, {}>;
|
|
10
15
|
export {};
|
|
@@ -3,12 +3,22 @@
|
|
|
3
3
|
* en-US -> MM/DD/YYYY
|
|
4
4
|
* en-GB -> DD/MM/YYYY
|
|
5
5
|
* tr-TR -> DD.MM.YYYY
|
|
6
|
+
*
|
|
7
|
+
* The non-string branches below are unreachable: the only caller chain is
|
|
8
|
+
* formatShortDate -> AssignStrategyDrawer.vue:74, which passes a non-empty string.
|
|
9
|
+
* The function itself is live — do not delete it with them.
|
|
6
10
|
*/
|
|
7
11
|
export declare const convertToDateObject: (date: string | number | Date | null | undefined) => Date;
|
|
8
12
|
export declare const locale: () => string;
|
|
9
13
|
export declare const localTz: string;
|
|
10
14
|
export declare const timezone: () => string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
|
|
17
|
+
*/
|
|
11
18
|
export declare const hour12: () => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
|
|
21
|
+
*/
|
|
12
22
|
export declare const dateFormat: () => string;
|
|
13
23
|
/**
|
|
14
24
|
* @example 04/22/2024
|
|
@@ -24,6 +24,9 @@ export declare const getCsrfToken: () => string;
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const getUrlParams: () => URLSearchParams;
|
|
26
26
|
export declare const getUrlParam: (paramName: string, defaultValue?: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger.
|
|
29
|
+
*/
|
|
27
30
|
export declare const replaceString: (string?: string, values?: Record<string, string | number>, isRemoveEmptyValues?: boolean) => string;
|
|
28
31
|
/**
|
|
29
32
|
* Narrows an unknown API value to a printable string; anything that is neither
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = `.patch-session-container {
|
|
2
2
|
row-gap: 16px;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -28,11 +28,7 @@ ue-vh-patch.selected .patch-wrapper {
|
|
|
28
28
|
.change-history-panel-wrapper .control-panel-header {
|
|
29
29
|
padding: 16px 0 16px 16px;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
.change-history-panel-wrapper .header-control-panel-label {
|
|
33
|
-
grid-area: 1 / 1 / 2 / 12;
|
|
34
|
-
}
|
|
35
31
|
`;
|
|
36
32
|
export {
|
|
37
|
-
|
|
33
|
+
r as default
|
|
38
34
|
};
|
|
@@ -20,8 +20,10 @@ const t = () => ({
|
|
|
20
20
|
}), c = s("guidoOnboarding", {
|
|
21
21
|
state: () => a(),
|
|
22
22
|
getters: {
|
|
23
|
+
/** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
23
24
|
getOnboarding: (n) => (o) => n.onboardings[o],
|
|
24
25
|
isActive: (n) => (o) => n.onboardings[o].isActive,
|
|
26
|
+
/** @deprecated Components use getGenericCurrentCard / getTextBlockCurrentCard. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
25
27
|
getCurrentCard: (n) => (o) => {
|
|
26
28
|
const i = n.onboardings[o];
|
|
27
29
|
return i.config[i.cardIndex];
|
|
@@ -81,6 +83,7 @@ const t = () => ({
|
|
|
81
83
|
previous(n) {
|
|
82
84
|
this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
|
|
83
85
|
},
|
|
86
|
+
/** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
84
87
|
updateCardPosition(n, o, i) {
|
|
85
88
|
const r = this.onboardings[n].config[o];
|
|
86
89
|
r && (r.top = i.top, r.position = i.position);
|
|
@@ -97,6 +100,7 @@ const t = () => ({
|
|
|
97
100
|
async onNewVersionPopupClose() {
|
|
98
101
|
await this.setUserModalState("newVersionPopup", "true", "Guido");
|
|
99
102
|
},
|
|
103
|
+
/** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
100
104
|
isOnboardingActive() {
|
|
101
105
|
return Object.values(this.onboardings).some((n) => n.isActive);
|
|
102
106
|
},
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as
|
|
2
|
-
import { productPairs as
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
3
|
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
4
|
+
import { preserveTextStyles as P } from "./preserveTextStyles.js";
|
|
5
|
+
import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
|
|
6
|
+
const O = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function
|
|
10
|
+
}, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function B(S, y, b) {
|
|
12
12
|
let h = y;
|
|
13
13
|
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
14
14
|
h -= 1;
|
|
15
15
|
return b.some((I) => S.endsWith(I, h));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const y =
|
|
19
|
-
|
|
20
|
-
const h =
|
|
17
|
+
function Z(S) {
|
|
18
|
+
const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
|
|
19
|
+
v(b);
|
|
20
|
+
const h = w.PAIRS_FOR_EXTENSION;
|
|
21
21
|
Object.entries(h).forEach(([n, d]) => {
|
|
22
22
|
b.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
23
23
|
const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
|
|
24
24
|
r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
|
|
25
|
-
var $,
|
|
26
|
-
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E,
|
|
27
|
-
if (
|
|
25
|
+
var $, F, D, N;
|
|
26
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
|
|
27
|
+
if (f)
|
|
28
28
|
switch (n) {
|
|
29
29
|
case "imageSrc": {
|
|
30
|
-
let e = null,
|
|
31
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
30
|
+
let e = null, a = null;
|
|
31
|
+
if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
|
|
32
32
|
break;
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
}) && (e.src = `{{${
|
|
33
|
+
const l = f.DEFAULT, c = f.ATTR;
|
|
34
|
+
if (l && e.src) {
|
|
35
|
+
const s = e.src;
|
|
36
|
+
l.some((R) => {
|
|
37
|
+
const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
|
|
38
|
+
return s.includes(R) || s.includes(u) || H === u;
|
|
39
|
+
}) && (e.src = `{{${c}_${o}}}`);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
(
|
|
41
|
+
const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
|
|
42
|
+
if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
|
|
43
|
+
const s = (D = h.itemLink) == null ? void 0 : D[g];
|
|
44
|
+
if (s) {
|
|
45
|
+
const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
|
|
46
|
+
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
case "name": {
|
|
52
|
-
const e =
|
|
53
|
-
t.textContent && (t.innerHTML =
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
(
|
|
52
|
+
const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
|
|
53
|
+
t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
54
|
+
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
|
+
if (i && c) {
|
|
56
|
+
const s = i.href, _ = `${window.location.href}${l}`;
|
|
57
|
+
(s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
|
|
58
58
|
}
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "price":
|
|
62
62
|
case "originalPrice": {
|
|
63
|
-
const e =
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
const
|
|
63
|
+
const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
|
|
64
|
+
let _;
|
|
65
|
+
i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
66
|
+
const R = e.CURRENCY;
|
|
67
|
+
let u = `{{${_}_${o}}}`;
|
|
68
|
+
const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
|
|
69
69
|
let C = "";
|
|
70
|
-
|
|
70
|
+
G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
case "quantity": {
|
|
74
|
-
const e =
|
|
75
|
-
|
|
74
|
+
const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
|
|
75
|
+
c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "button": {
|
|
79
|
-
const e =
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
(
|
|
79
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
|
+
if (c) {
|
|
81
|
+
const i = c.href || "", s = `${window.location.href}${l}`;
|
|
82
|
+
(i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
|
|
83
83
|
}
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
case "itemLink": {
|
|
87
|
-
const e =
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
(
|
|
87
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
88
|
+
if (c.href) {
|
|
89
|
+
const i = c.href, s = `${window.location.href}${l}`;
|
|
90
|
+
(i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
|
|
91
91
|
}
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
default: {
|
|
95
|
-
if ("ATTR" in
|
|
96
|
-
const e =
|
|
97
|
-
t.textContent && (t.innerHTML =
|
|
95
|
+
if ("ATTR" in f) {
|
|
96
|
+
const e = f.ATTR;
|
|
97
|
+
t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
@@ -102,9 +102,9 @@ function K(S) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
const I = y.match(/<!DOCTYPE[^>]*>/i),
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
105
|
+
const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
|
|
106
|
+
` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
|
|
107
|
+
W.forEach((n) => {
|
|
108
108
|
const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
|
|
109
109
|
M.push({
|
|
110
110
|
element: n,
|
|
@@ -113,38 +113,38 @@ function K(S) {
|
|
|
113
113
|
number: p
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
let A =
|
|
116
|
+
let A = U + b.documentElement.outerHTML;
|
|
117
117
|
M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
|
|
118
|
-
const r =
|
|
118
|
+
const r = O[d], E = r ? `${r}_total_product_kind` : "";
|
|
119
119
|
if (E) {
|
|
120
120
|
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
121
121
|
A = A.replace(n, X(o));
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const
|
|
125
|
-
return
|
|
124
|
+
const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
|
|
125
|
+
return V.forEach((n) => {
|
|
126
126
|
var t;
|
|
127
127
|
const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
|
|
128
|
-
if (!d || !
|
|
128
|
+
if (!d || !O[p])
|
|
129
129
|
return;
|
|
130
130
|
const r = n.closest(".product-original-price-class");
|
|
131
131
|
if (!r || k.has(r))
|
|
132
132
|
return;
|
|
133
133
|
k.add(r);
|
|
134
|
-
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T =
|
|
135
|
-
T.wrap.push(m !== "false"),
|
|
136
|
-
}),
|
|
134
|
+
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
|
|
135
|
+
T.wrap.push(m !== "false"), L.set(E, T);
|
|
136
|
+
}), L.forEach(({ number: n, type: d, wrap: p }, r) => {
|
|
137
137
|
if (r.includes("{% if") || !p.some(Boolean))
|
|
138
138
|
return;
|
|
139
|
-
const E =
|
|
140
|
-
let g = "", o = 0,
|
|
139
|
+
const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
|
|
140
|
+
let g = "", o = 0, f = 0, $ = A.indexOf(r);
|
|
141
141
|
for (; $ !== -1; ) {
|
|
142
|
-
const
|
|
143
|
-
g += A.slice(o, $) + (
|
|
142
|
+
const F = p[f] === !0 && !B(A, $, t);
|
|
143
|
+
g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
|
|
144
144
|
}
|
|
145
145
|
A = g + A.slice(o);
|
|
146
146
|
}), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
147
|
}
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
Z as pairProductVariables
|
|
150
150
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.19.0-beta.
|
|
3
|
+
"version": "3.19.0-beta.f328a8a",
|
|
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",
|