@useinsider/guido 3.7.0-beta.9fddd7d → 3.7.0-beta.a1aaf44
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/@types/config/schemas.js +66 -70
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +37 -34
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +54 -51
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
- package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Recommendation/block.js +39 -58
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +72 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +66 -68
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
- package/dist/extensions/Blocks/Unsubscribe/block.js +74 -60
- package/dist/extensions/Blocks/Unsubscribe/control.js +33 -24
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +6 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/stores/config.d.ts +0 -36
- package/dist/src/stores/unsubscribe.d.ts +11 -1
- package/dist/stores/unsubscribe.js +8 -7
- package/package.json +1 -1
- package/dist/composables/useRecommendationPreview.js +0 -100
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
var m = Object.defineProperty;
|
|
2
|
-
var p = (i, o, e) => o in i ? m(i, o, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[o] = e;
|
|
3
|
-
var d = (i, o, e) => p(i, typeof o != "symbol" ? o + "" : o, e);
|
|
4
|
-
import { UEAttr as u, ModificationDescription as h } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
import { CommonControl as f } from "../../../common-control.js";
|
|
6
|
-
import { ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OLD_PRICE as I } from "../../constants/selectors.js";
|
|
7
|
-
import { RecommendationConfigService as n } from "../../services/configService.js";
|
|
8
|
-
import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
|
|
9
|
-
import { getBlockElement as l, regenerateProductRowsWithStyles as g } from "./utils.js";
|
|
10
|
-
const E = "recommendation-price-placement-control", N = "hide-price", r = {
|
|
11
|
-
ORIENTATION: "priceOrientation",
|
|
12
|
-
HIDE_IF_SAME: "priceHideIfSameAsDiscounted"
|
|
13
|
-
}, A = [
|
|
14
|
-
{ icon: "vertical-orientation", value: "vertical" },
|
|
15
|
-
{ icon: "horizontal-orientation", value: "horizontal" }
|
|
16
|
-
], C = (i) => i ? "vertical" : "horizontal";
|
|
17
|
-
class P extends f {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
d(this, "store", T());
|
|
21
|
-
}
|
|
22
|
-
getId() {
|
|
23
|
-
return E;
|
|
24
|
-
}
|
|
25
|
-
getTemplate() {
|
|
26
|
-
return `
|
|
27
|
-
<div class="price-placement-control-container" style="border-bottom: 1px solid #e0e0e0;">
|
|
28
|
-
${this._GuTwoColumns([
|
|
29
|
-
this._GuLabel({ text: this.api.translate("Product Price Orientation") }),
|
|
30
|
-
this._GuRadioButton({
|
|
31
|
-
name: r.ORIENTATION,
|
|
32
|
-
buttons: A
|
|
33
|
-
})
|
|
34
|
-
])}
|
|
35
|
-
${this._GuTwoColumns([
|
|
36
|
-
this._GuLabel({ text: this.api.translate("Hide if same as discounted") }),
|
|
37
|
-
this._GuToggle(r.HIDE_IF_SAME)
|
|
38
|
-
])}
|
|
39
|
-
</div>
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
42
|
-
onRender() {
|
|
43
|
-
const e = n.getConfig(this.currentNode);
|
|
44
|
-
this._initializeHideToggle(e), this._setFormValues(e), this._updateOrientationDisabled(), this._listenToFormUpdates();
|
|
45
|
-
}
|
|
46
|
-
onTemplateNodeUpdated(e) {
|
|
47
|
-
super.onTemplateNodeUpdated(e), this._setFormValues(n.getConfig(this.currentNode)), this._updateOrientationDisabled();
|
|
48
|
-
}
|
|
49
|
-
_setFormValues(e) {
|
|
50
|
-
this.api.updateValues({
|
|
51
|
-
[r.ORIENTATION]: C(e.priceMovedToNextLine),
|
|
52
|
-
[r.HIDE_IF_SAME]: e.priceHideIfSameAsDiscounted
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
_initializeHideToggle(e) {
|
|
56
|
-
this.api.setUIEAttribute(
|
|
57
|
-
r.HIDE_IF_SAME,
|
|
58
|
-
u.SELECTPICKER.items,
|
|
59
|
-
e.priceHideIfSameAsDiscounted
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Disables the orientation radio when a price element is hidden via Card
|
|
64
|
-
* Composition — orientation is meaningless without both prices visible.
|
|
65
|
-
* Visibility lives on the attribute rows' `data-visibility` (set by the Card
|
|
66
|
-
* Composition control). Inline mode has no standalone original-price row, so
|
|
67
|
-
* the merged "Product Prices" entry (the price row) governs.
|
|
68
|
-
*/
|
|
69
|
-
_updateOrientationDisabled() {
|
|
70
|
-
const e = l(this.currentNode);
|
|
71
|
-
if (!e || !("querySelectorAll" in e))
|
|
72
|
-
return;
|
|
73
|
-
const s = Array.from(
|
|
74
|
-
e.querySelectorAll(".recommendation-attribute-row[data-attribute-type]")
|
|
75
|
-
).some((a) => {
|
|
76
|
-
const c = a.getAttribute("data-attribute-type");
|
|
77
|
-
return (c === _ || c === I) && a.getAttribute("data-visibility") === "0";
|
|
78
|
-
});
|
|
79
|
-
this.api.setUIEAttribute(
|
|
80
|
-
r.ORIENTATION,
|
|
81
|
-
u.RADIO_BUTTONS.disabled,
|
|
82
|
-
s ? "true" : "false"
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
_onOrientationChange(e) {
|
|
86
|
-
if (!this.currentNode)
|
|
87
|
-
return;
|
|
88
|
-
const t = e === "vertical";
|
|
89
|
-
n.getConfig(this.currentNode).priceMovedToNextLine !== t && (n.updateConfig(
|
|
90
|
-
this.api,
|
|
91
|
-
this.currentNode,
|
|
92
|
-
{ priceMovedToNextLine: t },
|
|
93
|
-
`${t ? "Stacked" : "Inlined"} recommendation prices`
|
|
94
|
-
), this.store.patchCurrentBlockConfig({ priceMovedToNextLine: t }), this._regenerate());
|
|
95
|
-
}
|
|
96
|
-
_onHideIfSameChange(e) {
|
|
97
|
-
!this.currentNode || n.getConfig(this.currentNode).priceHideIfSameAsDiscounted === e || (n.updateConfig(
|
|
98
|
-
this.api,
|
|
99
|
-
this.currentNode,
|
|
100
|
-
{ priceHideIfSameAsDiscounted: e },
|
|
101
|
-
`${e ? "Enabled" : "Disabled"} hide-if-same price`
|
|
102
|
-
), this.store.patchCurrentBlockConfig({ priceHideIfSameAsDiscounted: e }), this._stampHideIfSameAttr(e));
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Mirrors the hide-if-same flag onto the durable `hide-price` block attribute
|
|
106
|
-
* read by email-service at send time.
|
|
107
|
-
*/
|
|
108
|
-
_stampHideIfSameAttr(e) {
|
|
109
|
-
const t = l(this.currentNode);
|
|
110
|
-
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute(N, String(e)).apply(new h("Update hide-if-same price flag"));
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Rebuilds the product rows so the renderer re-reads the inline/stacked
|
|
114
|
-
* layout flag from the store. Used by the orientation change only.
|
|
115
|
-
*/
|
|
116
|
-
_regenerate() {
|
|
117
|
-
this.currentNode && g({
|
|
118
|
-
currentNode: this.currentNode,
|
|
119
|
-
documentModifier: this.api.getDocumentModifier()
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
_listenToFormUpdates() {
|
|
123
|
-
this.api.onValueChanged(r.ORIENTATION, (e) => {
|
|
124
|
-
(e === "vertical" || e === "horizontal") && this._onOrientationChange(e);
|
|
125
|
-
}), this.api.onValueChanged(r.HIDE_IF_SAME, (e) => {
|
|
126
|
-
this._onHideIfSameChange(!!e);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
export {
|
|
131
|
-
E as PRICE_PLACEMENT_CONTROL_ID,
|
|
132
|
-
P as PricePlacementControl
|
|
133
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Substitutes recommendation product variables in compiled preview HTML with the
|
|
3
|
-
* blocks' fetched sample products, then simulates the email-service hide rule by
|
|
4
|
-
* emptying the original-price cell (DOM kept) for slots with no real discount.
|
|
5
|
-
* Returns the input unchanged when there are no reco blocks or no products.
|
|
6
|
-
*/
|
|
7
|
-
export declare function substituteRecommendationPreview(html: string): string;
|
|
8
|
-
export declare const useRecommendationPreview: () => {
|
|
9
|
-
substituteRecommendationPreview: typeof substituteRecommendationPreview;
|
|
10
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Price Placement Control
|
|
3
|
-
*
|
|
4
|
-
* Two block-level price settings ported from the legacy product block, shown
|
|
5
|
-
* above the Currency control in the main Settings tab:
|
|
6
|
-
*
|
|
7
|
-
* - "Product Price Orientation" (`priceMovedToNextLine`): a vertical/horizontal
|
|
8
|
-
* icon radio (mirrors the Items block control). `vertical` (default) keeps the
|
|
9
|
-
* price and original price on separate stacked rows (current Guido look);
|
|
10
|
-
* `horizontal` renders them inline on the same line and Card Composition
|
|
11
|
-
* collapses them into a single "Product Prices" entry.
|
|
12
|
-
* - "Hide if same as discounted" (`priceHideIfSameAsDiscounted`): a toggle.
|
|
13
|
-
* When ON, email-service blanks the redundant original price at send time when
|
|
14
|
-
* it equals the sale price (see the `hide-price` block attribute below).
|
|
15
|
-
*
|
|
16
|
-
* Orientation re-renders the rows (it changes the saved template layout).
|
|
17
|
-
* Hide-if-same NEVER touches the template — it only persists config + stamps the
|
|
18
|
-
* `hide-price` attribute; the visual hide is simulated in the preview and applied
|
|
19
|
-
* for real server-side by email-service.
|
|
20
|
-
*/
|
|
21
|
-
import type { RecommendationNodeConfig } from '../../types/nodeConfig';
|
|
22
|
-
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
23
|
-
import { CommonControl } from '../../../common-control';
|
|
24
|
-
export declare const PRICE_PLACEMENT_CONTROL_ID = "recommendation-price-placement-control";
|
|
25
|
-
type Orientation = 'vertical' | 'horizontal';
|
|
26
|
-
/**
|
|
27
|
-
* Control for the block-level price orientation radio + hide-if-same toggle.
|
|
28
|
-
*/
|
|
29
|
-
export declare class PricePlacementControl extends CommonControl {
|
|
30
|
-
private store;
|
|
31
|
-
getId(): string;
|
|
32
|
-
getTemplate(): string;
|
|
33
|
-
onRender(): void;
|
|
34
|
-
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
35
|
-
_setFormValues(config: RecommendationNodeConfig): void;
|
|
36
|
-
_initializeHideToggle(config: RecommendationNodeConfig): void;
|
|
37
|
-
/**
|
|
38
|
-
* Disables the orientation radio when a price element is hidden via Card
|
|
39
|
-
* Composition — orientation is meaningless without both prices visible.
|
|
40
|
-
* Visibility lives on the attribute rows' `data-visibility` (set by the Card
|
|
41
|
-
* Composition control). Inline mode has no standalone original-price row, so
|
|
42
|
-
* the merged "Product Prices" entry (the price row) governs.
|
|
43
|
-
*/
|
|
44
|
-
_updateOrientationDisabled(): void;
|
|
45
|
-
_onOrientationChange(orientation: Orientation): void;
|
|
46
|
-
_onHideIfSameChange(value: boolean): void;
|
|
47
|
-
/**
|
|
48
|
-
* Mirrors the hide-if-same flag onto the durable `hide-price` block attribute
|
|
49
|
-
* read by email-service at send time.
|
|
50
|
-
*/
|
|
51
|
-
_stampHideIfSameAttr(value: boolean): void;
|
|
52
|
-
/**
|
|
53
|
-
* Rebuilds the product rows so the renderer re-reads the inline/stacked
|
|
54
|
-
* layout flag from the store. Used by the orientation change only.
|
|
55
|
-
*/
|
|
56
|
-
_regenerate(): void;
|
|
57
|
-
_listenToFormUpdates(): void;
|
|
58
|
-
}
|
|
59
|
-
export {};
|