@useinsider/guido 2.2.0-beta.eeefcc3 → 3.0.0-beta.fd7cee3
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/README.md +41 -2
- package/dist/@types/config/schemas.js +1 -1
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +66 -66
- package/dist/components/organisms/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +7 -5
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
- package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +48 -36
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +11 -9
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useRecommendation.js +9 -9
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +66 -62
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +45 -0
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +1 -1
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -33
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +16 -14
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +41 -29
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +30 -32
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +194 -104
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +46 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +16 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +291 -217
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +10 -10
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +5 -5
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +14 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +9 -9
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +13 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +223 -99
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +172 -85
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +2 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +1 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +2 -2
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +32 -32
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +55 -19
- package/dist/src/@types/config/schemas.d.ts +1 -1
- package/dist/src/@types/events.d.ts +38 -2
- package/dist/src/components/Guido.vue.d.ts +2 -2
- package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
- package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useGuidoActions.d.ts +1 -1
- package/dist/src/composables/useSave.d.ts +2 -2
- package/dist/src/composables/useStripo.d.ts +2 -2
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +38 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +27 -14
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +50 -17
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +19 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/utils/templatePreparation.d.ts +1 -1
- package/dist/static/styles/customEditorStyle.css.js +50 -23
- package/dist/stores/editor.js +2 -1
- package/dist/stores/unsubscribe.js +37 -34
- package/dist/utils/templatePreparation.js +1 -1
- package/package.json +2 -2
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { EditorStatePropertyType as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { MAX_PRODUCT_COUNT as
|
|
7
|
-
import { RecommendationConfigService as
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var _ = (n, r, t) => r in n ? u(n, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[r] = t;
|
|
3
|
+
var a = (n, r, t) => _(n, typeof r != "symbol" ? r + "" : r, t);
|
|
4
|
+
import { EditorStatePropertyType as c, PreviewDeviceMode as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as R } from "../../../common-control.js";
|
|
6
|
+
import { MAX_PRODUCT_COUNT as h, MAX_PRODUCTS_PER_ROW as p, MAX_MOBILE_PRODUCTS_PER_ROW as g, DEFAULT_COLUMN_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as O } from "../../constants/layout.js";
|
|
7
|
+
import { RecommendationConfigService as i } from "../../services/configService.js";
|
|
8
8
|
import { useRecommendationExtensionStore as l } from "../../store/recommendation.js";
|
|
9
|
-
import { ensureMobileCssRulesExist as
|
|
10
|
-
import { getCurrentLayout as
|
|
11
|
-
import { useDebounceFn as
|
|
12
|
-
const
|
|
9
|
+
import { ensureMobileCssRulesExist as I } from "../mobileLayout/cssRules.js";
|
|
10
|
+
import { getCurrentLayout as N, regenerateMobileProductRows as f, adjustProductsToSize as b, regenerateProductRowsWithStyles as P } from "./utils.js";
|
|
11
|
+
import { useDebounceFn as L } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
12
|
+
const M = "recommendation-product-layout-control", e = {
|
|
13
13
|
PRODUCT_COUNT: "size",
|
|
14
14
|
PRODUCT_IN_ROW: "cardsInRow",
|
|
15
15
|
PRODUCT_IN_ROW_LABEL: "cardsInRowLabel",
|
|
16
16
|
MOBILE_CARDS_IN_ROW: "mobileCardsInRow",
|
|
17
17
|
MOBILE_CARDS_IN_ROW_LABEL: "mobileCardsInRowLabel"
|
|
18
18
|
};
|
|
19
|
-
class
|
|
19
|
+
class V extends R {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
22
|
// Store is used for backward compatibility with product fetching and regeneration
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
a(this, "store", l());
|
|
24
|
+
a(this, "storeUnsubscription", () => {
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
a(this, "_debouncedRegenerateProductRows", L(() => {
|
|
27
27
|
this._regenerateProductRows();
|
|
28
28
|
}, 500));
|
|
29
29
|
}
|
|
30
30
|
getId() {
|
|
31
|
-
return
|
|
31
|
+
return M;
|
|
32
32
|
}
|
|
33
33
|
getTemplate() {
|
|
34
34
|
return `
|
|
35
35
|
<div class="product-layout-control-container">
|
|
36
36
|
${this._GuTwoColumns([
|
|
37
37
|
this._GuLabel({ text: "Number of Products" }),
|
|
38
|
-
this._GuCounter({ name: e.PRODUCT_COUNT, maxValue:
|
|
38
|
+
this._GuCounter({ name: e.PRODUCT_COUNT, maxValue: h }),
|
|
39
39
|
this._GuLabel({
|
|
40
40
|
text: "Products in One Row on Desktop",
|
|
41
41
|
name: e.PRODUCT_IN_ROW_LABEL
|
|
@@ -47,7 +47,7 @@ class S extends h {
|
|
|
47
47
|
}),
|
|
48
48
|
this._GuCounter({
|
|
49
49
|
name: e.MOBILE_CARDS_IN_ROW,
|
|
50
|
-
maxValue:
|
|
50
|
+
maxValue: g
|
|
51
51
|
})
|
|
52
52
|
])}
|
|
53
53
|
</div>
|
|
@@ -63,7 +63,7 @@ class S extends h {
|
|
|
63
63
|
this.storeUnsubscription();
|
|
64
64
|
}
|
|
65
65
|
_setFormValues() {
|
|
66
|
-
const t =
|
|
66
|
+
const t = i.getConfig(this.currentNode);
|
|
67
67
|
this.api.updateValues({
|
|
68
68
|
[e.PRODUCT_COUNT]: t.size,
|
|
69
69
|
[e.PRODUCT_IN_ROW]: t.cardsInRow,
|
|
@@ -75,7 +75,7 @@ class S extends h {
|
|
|
75
75
|
* using Stripo's EditorStatePropertyType API.
|
|
76
76
|
*/
|
|
77
77
|
_isMobileMode() {
|
|
78
|
-
return this.api.getEditorState()[
|
|
78
|
+
return this.api.getEditorState()[c.previewDeviceMode] === C.MOBILE;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Updates counter visibility based on layout orientation and editor mode.
|
|
@@ -84,8 +84,8 @@ class S extends h {
|
|
|
84
84
|
* - Grid + mobile mode: show mobile counter, hide desktop counter
|
|
85
85
|
*/
|
|
86
86
|
_updateProductsInRowVisibility() {
|
|
87
|
-
const
|
|
88
|
-
this.api.setVisibility(e.PRODUCT_IN_ROW,
|
|
87
|
+
const o = (i.getConfig(this.currentNode).layout || N(this.currentNode)) === "grid", d = this._isMobileMode();
|
|
88
|
+
this.api.setVisibility(e.PRODUCT_IN_ROW, o && !d), this.api.setVisibility(e.PRODUCT_IN_ROW_LABEL, o && !d), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW, o && d), this.api.setVisibility(e.MOBILE_CARDS_IN_ROW_LABEL, o && d);
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Subscribes to editor preview mode changes via Stripo API.
|
|
@@ -94,43 +94,51 @@ class S extends h {
|
|
|
94
94
|
*/
|
|
95
95
|
_subscribeToEditorModeChanges() {
|
|
96
96
|
this.api.onEditorStatePropUpdated(
|
|
97
|
-
|
|
97
|
+
c.previewDeviceMode,
|
|
98
98
|
() => {
|
|
99
99
|
this._updateProductsInRowVisibility();
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
_onProductCountChange(t) {
|
|
104
|
-
this.currentNode
|
|
104
|
+
!this.currentNode || i.getConfig(this.currentNode).size === t || (i.updateConfig(
|
|
105
105
|
this.api,
|
|
106
106
|
this.currentNode,
|
|
107
107
|
{ size: t },
|
|
108
108
|
`Changed product count to ${t}`
|
|
109
|
-
), this.store.patchCurrentBlockConfig({ size: t })
|
|
109
|
+
), this.store.patchCurrentBlockConfig({ size: t }));
|
|
110
110
|
}
|
|
111
111
|
_onProductsInRowChange(t) {
|
|
112
|
-
this.currentNode
|
|
112
|
+
if (!this.currentNode || i.getConfig(this.currentNode).cardsInRow === t)
|
|
113
|
+
return;
|
|
114
|
+
const o = t === 1 ? 0 : m;
|
|
115
|
+
i.updateConfig(
|
|
113
116
|
this.api,
|
|
114
117
|
this.currentNode,
|
|
115
|
-
{ cardsInRow: t },
|
|
118
|
+
{ cardsInRow: t, columnSpacing: o },
|
|
116
119
|
`Changed products per row to ${t}`
|
|
117
|
-
), this.store.patchCurrentBlockConfig({ cardsInRow: t }), this._debouncedRegenerateProductRows()
|
|
120
|
+
), this.store.patchCurrentBlockConfig({ cardsInRow: t }, { triggerRefetch: !1 }), this._debouncedRegenerateProductRows();
|
|
118
121
|
}
|
|
119
122
|
_onMobileCardsInRowChange(t) {
|
|
120
|
-
this.currentNode
|
|
123
|
+
if (!this.currentNode || i.getConfig(this.currentNode).mobileCardsInRow === t)
|
|
124
|
+
return;
|
|
125
|
+
const o = t === 1 ? 0 : O;
|
|
126
|
+
i.updateConfig(
|
|
121
127
|
this.api,
|
|
122
128
|
this.currentNode,
|
|
123
|
-
{ mobileCardsInRow: t },
|
|
129
|
+
{ mobileCardsInRow: t, mobileColumnSpacing: o },
|
|
124
130
|
`Changed mobile products per row to ${t}`
|
|
125
|
-
),
|
|
131
|
+
), I(this.api), f({
|
|
126
132
|
currentNode: this.currentNode,
|
|
127
133
|
documentModifier: this.api.getDocumentModifier()
|
|
128
|
-
})
|
|
134
|
+
});
|
|
129
135
|
}
|
|
130
136
|
_regenerateProductRows() {
|
|
131
|
-
b(
|
|
137
|
+
const t = i.getConfig(this.currentNode), s = parseInt(t.size) || 6, o = b(this.store.recommendationProducts, s);
|
|
138
|
+
P({
|
|
132
139
|
currentNode: this.currentNode,
|
|
133
|
-
documentModifier: this.api.getDocumentModifier()
|
|
140
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
141
|
+
products: o
|
|
134
142
|
});
|
|
135
143
|
}
|
|
136
144
|
_listenToFormUpdates() {
|
|
@@ -149,12 +157,12 @@ class S extends h {
|
|
|
149
157
|
_listenStateUpdates() {
|
|
150
158
|
let t = this.store.recommendationConfigs.orientation;
|
|
151
159
|
this.storeUnsubscription = this.store.$subscribe(() => {
|
|
152
|
-
const
|
|
153
|
-
|
|
160
|
+
const s = this.store.recommendationConfigs.orientation;
|
|
161
|
+
s !== t && (t = s, this._updateProductsInRowVisibility());
|
|
154
162
|
});
|
|
155
163
|
}
|
|
156
164
|
}
|
|
157
165
|
export {
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
M as PRODUCT_LAYOUT_CONTROL_ID,
|
|
167
|
+
V as ProductLayoutControl
|
|
160
168
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var r = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var n = (o, t, e) =>
|
|
4
|
-
import { UEAttr as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import { RecommendationConfigService as
|
|
2
|
+
var f = (o, t, e) => t in o ? r(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var n = (o, t, e) => f(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { UEAttr as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as l } from "../../../common-control.js";
|
|
6
|
+
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as d } from "../../store/recommendation.js";
|
|
8
|
-
const h = "recommendation-shuffle-control",
|
|
8
|
+
const h = "recommendation-shuffle-control", i = {
|
|
9
9
|
SHUFFLE_PRODUCTS: "shuffleProducts"
|
|
10
10
|
};
|
|
11
|
-
class
|
|
11
|
+
class S extends l {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
14
14
|
// Store is used for backward compatibility with product fetching
|
|
@@ -22,7 +22,7 @@ class g extends f {
|
|
|
22
22
|
<div class="shuffle-control-container">
|
|
23
23
|
${this._GuTwoColumns([
|
|
24
24
|
this._GuLabel({ text: "Shuffle Recommended Products" }),
|
|
25
|
-
this._GuToggle(
|
|
25
|
+
this._GuToggle(i.SHUFFLE_PRODUCTS)
|
|
26
26
|
])}
|
|
27
27
|
</div>
|
|
28
28
|
`;
|
|
@@ -34,21 +34,21 @@ class g extends f {
|
|
|
34
34
|
super.onTemplateNodeUpdated(e), this._setFormValues();
|
|
35
35
|
}
|
|
36
36
|
_setFormValues() {
|
|
37
|
-
const e =
|
|
37
|
+
const e = s.getConfig(this.currentNode);
|
|
38
38
|
this.api.updateValues({
|
|
39
|
-
[
|
|
39
|
+
[i.SHUFFLE_PRODUCTS]: e.shuffleProducts
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
_initializeToggle() {
|
|
43
|
-
const e =
|
|
43
|
+
const e = s.getConfig(this.currentNode);
|
|
44
44
|
this.api.setUIEAttribute(
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
i.SHUFFLE_PRODUCTS,
|
|
46
|
+
u.SELECTPICKER.items,
|
|
47
47
|
e.shuffleProducts
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
_onShuffleChange(e) {
|
|
51
|
-
this.currentNode
|
|
51
|
+
!this.currentNode || s.getConfig(this.currentNode).shuffleProducts === e || (s.updateConfig(
|
|
52
52
|
this.api,
|
|
53
53
|
this.currentNode,
|
|
54
54
|
{ shuffleProducts: e },
|
|
@@ -56,12 +56,12 @@ class g extends f {
|
|
|
56
56
|
), this.store.patchCurrentBlockConfig({ shuffleProducts: e }));
|
|
57
57
|
}
|
|
58
58
|
_listenToFormUpdates() {
|
|
59
|
-
this.api.onValueChanged(
|
|
59
|
+
this.api.onValueChanged(i.SHUFFLE_PRODUCTS, (e) => {
|
|
60
60
|
this._onShuffleChange(!!e);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
export {
|
|
65
65
|
h as SHUFFLE_CONTROL_ID,
|
|
66
|
-
|
|
66
|
+
S as ShuffleControl
|
|
67
67
|
};
|