@useinsider/guido 2.1.0-beta.67fc452 → 2.1.0-beta.e13d291
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 +17 -17
- package/dist/config/migrator/recommendationMigrator.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +40 -6
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +64 -0
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +20 -0
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +19 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/index.js +64 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +80 -0
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +232 -0
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +19 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +96 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +110 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +204 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +54 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +205 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +74 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +118 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +71 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/index.js +46 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +76 -0
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextAfterControl.js → omnibusDiscount/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusDiscountTextBeforeControl.js → omnibusDiscount/textBefore.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/index.js +48 -0
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextAfterControl.js → omnibusPrice/textAfter.js} +16 -14
- package/dist/extensions/Blocks/Recommendation/controls/{omnibusPriceTextBeforeControl.js → omnibusPrice/textBefore.js} +14 -12
- package/dist/extensions/Blocks/Recommendation/controls/price/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +222 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +40 -17
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +19 -3
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +13 -4
- package/dist/extensions/Blocks/Recommendation/services/configService.js +239 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +21 -10
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +41 -36
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +233 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +251 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +69 -0
- package/dist/extensions/Blocks/Recommendation/templates/index.js +12 -0
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +174 -0
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +73 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +121 -0
- package/dist/extensions/Blocks/Recommendation/types/nodeConfig.js +6 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +9 -9
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +27 -16
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +29 -0
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +46 -0
- package/dist/extensions/Blocks/controlFactories.js +125 -93
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +223 -169
- package/dist/services/recommendationApi.js +10 -9
- package/dist/src/@types/config/schemas.d.ts +2 -2
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/{constants.d.ts → constants/controlIds.d.ts} +0 -24
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +49 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +143 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardBackground/index.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/{cardCompositionControl.d.ts → controls/cardComposition/index.d.ts} +23 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +21 -589
- package/dist/src/extensions/Blocks/Recommendation/controls/layout/index.d.ts +37 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/algorithm.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +45 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/filters.d.ts +22 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +57 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/locale.d.ts +24 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +42 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/shuffle.d.ts +23 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +214 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +97 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +100 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +95 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +83 -0
- package/dist/src/extensions/Blocks/Recommendation/extension.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +151 -0
- package/dist/src/extensions/Blocks/Recommendation/services/index.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +17 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +20 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/{migrationTemplate.d.ts → grid/migration.d.ts} +11 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +39 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/migration.d.ts +25 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +18 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +54 -0
- package/dist/src/extensions/Blocks/Recommendation/types/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +154 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +77 -0
- package/dist/static/styles/customEditorStyle.css.js +25 -2
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -187
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -13
- package/dist/extensions/Blocks/Recommendation/control.js +0 -336
- package/dist/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.js +0 -68
- package/dist/extensions/Blocks/Recommendation/controls/index.js +0 -245
- package/dist/extensions/Blocks/Recommendation/controls/nameTextTrimControl.js +0 -74
- package/dist/extensions/Blocks/Recommendation/controls/spacingControl.js +0 -188
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -181
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -189
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -209
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -38
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -52
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { object as o, number as b, optional as e, string as t, pipe as u, picklist as n, custom as d, boolean as c, array as a, minLength as p, literal as r, variant as
|
|
1
|
+
import { object as o, number as b, optional as e, string as t, pipe as u, picklist as n, custom as d, boolean as c, array as a, minLength as p, literal as r, variant as k } from "../../node_modules/valibot/dist/index.js";
|
|
2
2
|
const m = {
|
|
3
3
|
/** Promotional/marketing emails */
|
|
4
4
|
PROMOTIONAL: 1,
|
|
@@ -11,7 +11,7 @@ const m = {
|
|
|
11
11
|
ARCHITECT: 49,
|
|
12
12
|
/** Unsubscribe page builder */
|
|
13
13
|
UNSUBSCRIBE_PAGES: 97
|
|
14
|
-
},
|
|
14
|
+
}, S = o({
|
|
15
15
|
/** Unique identifier for the template being edited */
|
|
16
16
|
templateId: u(
|
|
17
17
|
t(),
|
|
@@ -24,7 +24,7 @@ const m = {
|
|
|
24
24
|
),
|
|
25
25
|
/** Optional variation ID for A/B testing */
|
|
26
26
|
variationId: e(t())
|
|
27
|
-
}),
|
|
27
|
+
}), h = o({
|
|
28
28
|
/** Partner/organization name (required) */
|
|
29
29
|
name: u(
|
|
30
30
|
t(),
|
|
@@ -83,7 +83,7 @@ const m = {
|
|
|
83
83
|
/** Locale for the editor UI */
|
|
84
84
|
locale: e(t(), "en"),
|
|
85
85
|
/** Path to translations object */
|
|
86
|
-
translationsPath: e(t(), "window.trans.
|
|
86
|
+
translationsPath: e(t(), "window.trans[Object.keys(window.trans)[0]]"),
|
|
87
87
|
/** Migration date for template compatibility */
|
|
88
88
|
migrationDate: e(b(), 1759696858),
|
|
89
89
|
/** Email header settings */
|
|
@@ -130,7 +130,7 @@ const m = {
|
|
|
130
130
|
"unsubscribe-block",
|
|
131
131
|
"coupon-block",
|
|
132
132
|
"items-block"
|
|
133
|
-
]),
|
|
133
|
+
]), O = o({
|
|
134
134
|
/** Default blocks to exclude from the editor */
|
|
135
135
|
excludeDefaults: e(
|
|
136
136
|
a(A),
|
|
@@ -148,7 +148,7 @@ const m = {
|
|
|
148
148
|
description: e(t()),
|
|
149
149
|
/** Priority for rule ordering (lower = earlier) */
|
|
150
150
|
priority: b()
|
|
151
|
-
}),
|
|
151
|
+
}), E = o({
|
|
152
152
|
...l.entries,
|
|
153
153
|
type: r("replace"),
|
|
154
154
|
/** String to search for */
|
|
@@ -157,7 +157,7 @@ const m = {
|
|
|
157
157
|
replacement: t(),
|
|
158
158
|
/** Replace all occurrences (default: false) */
|
|
159
159
|
replaceAll: e(c())
|
|
160
|
-
}),
|
|
160
|
+
}), N = o({
|
|
161
161
|
...l.entries,
|
|
162
162
|
type: r("regex"),
|
|
163
163
|
/** Regex pattern string */
|
|
@@ -179,9 +179,9 @@ const m = {
|
|
|
179
179
|
(i) => typeof i == "function",
|
|
180
180
|
"processor must be a function"
|
|
181
181
|
)
|
|
182
|
-
}), x =
|
|
182
|
+
}), x = k("type", [
|
|
183
|
+
E,
|
|
183
184
|
N,
|
|
184
|
-
O,
|
|
185
185
|
L,
|
|
186
186
|
v
|
|
187
187
|
]), B = o({
|
|
@@ -203,9 +203,9 @@ const m = {
|
|
|
203
203
|
}), D = o({
|
|
204
204
|
// Required sections
|
|
205
205
|
/** Identity configuration (required) */
|
|
206
|
-
identity:
|
|
206
|
+
identity: S,
|
|
207
207
|
/** Partner configuration (required) */
|
|
208
|
-
partner:
|
|
208
|
+
partner: h,
|
|
209
209
|
// Optional sections (with defaults)
|
|
210
210
|
/** Template content and presets */
|
|
211
211
|
template: e(R, {}),
|
|
@@ -216,14 +216,14 @@ const m = {
|
|
|
216
216
|
/** Feature toggles */
|
|
217
217
|
features: e(T, {}),
|
|
218
218
|
/** Block configuration */
|
|
219
|
-
blocks: e(
|
|
219
|
+
blocks: e(O, {}),
|
|
220
220
|
/** Compiler configuration */
|
|
221
221
|
compiler: e(B, {}),
|
|
222
222
|
/** Callbacks and event handlers */
|
|
223
223
|
callbacks: e(P, {})
|
|
224
224
|
});
|
|
225
225
|
export {
|
|
226
|
-
|
|
226
|
+
O as BlocksSchema,
|
|
227
227
|
P as CallbacksSchema,
|
|
228
228
|
x as CompilerRuleSchema,
|
|
229
229
|
B as CompilerSchema,
|
|
@@ -235,13 +235,13 @@ export {
|
|
|
235
235
|
f as EmailHeaderSchema,
|
|
236
236
|
T as FeaturesSchema,
|
|
237
237
|
D as GuidoConfigSchema,
|
|
238
|
-
|
|
238
|
+
S as IdentitySchema,
|
|
239
239
|
m as MessageType,
|
|
240
|
-
|
|
240
|
+
h as PartnerSchema,
|
|
241
241
|
s as ProductType,
|
|
242
|
-
|
|
242
|
+
N as RegexRuleSchema,
|
|
243
243
|
L as RemoveRuleSchema,
|
|
244
|
-
|
|
244
|
+
E as ReplaceRuleSchema,
|
|
245
245
|
R as TemplateSchema,
|
|
246
246
|
I as UISchema
|
|
247
247
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var h = Object.defineProperty;
|
|
2
2
|
var T = (A, e, t) => e in A ? h(A, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : A[e] = t;
|
|
3
3
|
var m = (A, e, t) => T(A, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/
|
|
5
|
-
import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/
|
|
4
|
+
import P, { prepareProductRows as S } from "../../extensions/Blocks/Recommendation/templates/grid/migration.js";
|
|
5
|
+
import { getDefaultProducts as q } from "../../extensions/Blocks/Recommendation/templates/utils.js";
|
|
6
6
|
class w {
|
|
7
7
|
constructor() {
|
|
8
8
|
m(this, "parser");
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Block as
|
|
2
|
-
import {
|
|
1
|
+
import { Block as o, BlockCompositionType as i } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RecommendationConfigService as t } from "./services/configService.js";
|
|
3
|
+
import { getDefaultTemplate as r } from "./templates/grid/template.js";
|
|
3
4
|
const n = "recommendation-block";
|
|
4
|
-
class
|
|
5
|
+
class g extends o {
|
|
5
6
|
constructor() {
|
|
6
7
|
super();
|
|
7
8
|
}
|
|
@@ -12,7 +13,7 @@ class m extends e {
|
|
|
12
13
|
return "recommendation-icon";
|
|
13
14
|
}
|
|
14
15
|
getBlockCompositionType() {
|
|
15
|
-
return
|
|
16
|
+
return i.CONTAINER;
|
|
16
17
|
}
|
|
17
18
|
getName() {
|
|
18
19
|
return this.api.translate("Recommendation Block");
|
|
@@ -21,10 +22,43 @@ class m extends e {
|
|
|
21
22
|
return this.api.translate("Recommendation Block Title Description");
|
|
22
23
|
}
|
|
23
24
|
getTemplate() {
|
|
24
|
-
return
|
|
25
|
+
return r();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Called when a new block is dropped into the template
|
|
29
|
+
*
|
|
30
|
+
* Initializes the block with default configuration stored via node config.
|
|
31
|
+
* This ensures the configuration persists with the template.
|
|
32
|
+
* @param node - The newly created block node
|
|
33
|
+
*/
|
|
34
|
+
onCreated(e) {
|
|
35
|
+
t.initializeConfig(this.api, e);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Called when the document changes or template is loaded
|
|
39
|
+
*
|
|
40
|
+
* Handles migration from legacy templates that don't have node config.
|
|
41
|
+
* Also handles config version upgrades for future migrations.
|
|
42
|
+
* @param node - The block node that may need migration
|
|
43
|
+
*/
|
|
44
|
+
onDocumentChanged(e) {
|
|
45
|
+
!e || !("getNodeConfig" in e) || t.needsMigration(e) && this._migrateFromLegacy(e);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Migrate configuration from legacy format
|
|
49
|
+
*
|
|
50
|
+
* Legacy templates may store configuration in:
|
|
51
|
+
* - data-attributes (data-layout, data-card-composition, etc.)
|
|
52
|
+
* - Pinia store (lost on reload - this is what we're fixing)
|
|
53
|
+
*
|
|
54
|
+
* This method reads what we can from the DOM and initializes proper node config.
|
|
55
|
+
* @param node - The block node to migrate
|
|
56
|
+
*/
|
|
57
|
+
_migrateFromLegacy(e) {
|
|
58
|
+
t.migrateFromDataAttributes(this.api, e);
|
|
25
59
|
}
|
|
26
60
|
}
|
|
27
61
|
export {
|
|
28
62
|
n as BLOCK_ID,
|
|
29
|
-
|
|
63
|
+
g as RecommendationBlock
|
|
30
64
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var b = /* @__PURE__ */ ((r) => (r.BUTTON = "recommendation-block-button", r.NAME = "recommendation-block-name", r.PRICE = "recommendation-block-price", r.OLD_PRICE = "recommendation-block-old-price", r.OMNIBUS_PRICE = "recommendation-block-omnibus-price", r.OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount", r.IMAGE = "recommendation-block-image", r))(b || {});
|
|
2
|
+
export {
|
|
3
|
+
b as RecommendationBlockId
|
|
4
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var o = /* @__PURE__ */ ((c) => (c.BUTTON_ALIGN = "recommendation-block-button-align-control", c.BUTTON_BORDER = "recommendation-block-button-border-control", c.BUTTON_BORDER_RADIUS = "recommendation-block-button-border-radius-control", c.BUTTON_COLOR = "recommendation-block-button-color-control", c.BUTTON_FIT_TO_CONTENT = "recommendation-block-button-fit-to-content-control", c.BUTTON_FONT_FAMILY = "recommendation-block-button-font-family-control", c.BUTTON_MARGINS = "recommendation-block-button-margins-control", c.BUTTON_PADDINGS = "recommendation-block-button-paddings-control", c.BUTTON_TEXT = "recommendation-block-button-text-control", c.BUTTON_TEXT_SIZE = "recommendation-block-button-text-size-control", c.BUTTON_TEXT_STYLE_AND_FONT_COLOR = "recommendation-block-button-text-style-and-font-color-control", c.NAME_ALIGN = "recommendation-block-name-align-control", c.NAME_BACKGROUND = "recommendation-block-name-background-control", c.NAME_COLOR = "recommendation-block-name-color-control", c.NAME_FONT_FAMILY = "recommendation-block-name-font-family-control", c.NAME_PADDINGS = "recommendation-block-name-paddings-control", c.NAME_SIZE = "recommendation-block-name-size-control", c.NAME_STYLE = "recommendation-block-name-style-control", c.NAME_TEXT_TRIM = "recommendation-block-name-text-trim-control", c.PRICE_ALIGN = "recommendation-block-price-align-control", c.PRICE_BACKGROUND = "recommendation-block-price-background-control", c.PRICE_COLOR = "recommendation-block-price-color-control", c.PRICE_FONT_FAMILY = "recommendation-block-price-font-family-control", c.PRICE_PADDINGS = "recommendation-block-price-paddings-control", c.PRICE_SIZE = "recommendation-block-price-size-control", c.PRICE_STYLE = "recommendation-block-price-style-control", c.OLD_PRICE_ALIGN = "recommendation-block-old-price-align-control", c.OLD_PRICE_BACKGROUND = "recommendation-block-old-price-background-control", c.OLD_PRICE_COLOR = "recommendation-block-old-price-color-control", c.OLD_PRICE_FONT_FAMILY = "recommendation-block-old-price-font-family-control", c.OLD_PRICE_PADDINGS = "recommendation-block-old-price-paddings-control", c.OLD_PRICE_SIZE = "recommendation-block-old-price-size-control", c.OLD_PRICE_STYLE = "recommendation-block-old-price-style-control", c.OMNIBUS_PRICE_ALIGN = "recommendation-block-omnibus-price-align-control", c.OMNIBUS_PRICE_BACKGROUND = "recommendation-block-omnibus-price-background-control", c.OMNIBUS_PRICE_COLOR = "recommendation-block-omnibus-price-color-control", c.OMNIBUS_PRICE_FONT_FAMILY = "recommendation-block-omnibus-price-font-family-control", c.OMNIBUS_PRICE_PADDINGS = "recommendation-block-omnibus-price-paddings-control", c.OMNIBUS_PRICE_SIZE = "recommendation-block-omnibus-price-size-control", c.OMNIBUS_PRICE_STYLE = "recommendation-block-omnibus-price-style-control", c.OMNIBUS_PRICE_TEXT_BEFORE = "recommendation-block-omnibus-price-text-before-control", c.OMNIBUS_PRICE_TEXT_AFTER = "recommendation-block-omnibus-price-text-after-control", c.OMNIBUS_DISCOUNT_ALIGN = "recommendation-block-omnibus-discount-align-control", c.OMNIBUS_DISCOUNT_BACKGROUND = "recommendation-block-omnibus-discount-background-control", c.OMNIBUS_DISCOUNT_COLOR = "recommendation-block-omnibus-discount-color-control", c.OMNIBUS_DISCOUNT_FONT_FAMILY = "recommendation-block-omnibus-discount-font-family-control", c.OMNIBUS_DISCOUNT_PADDINGS = "recommendation-block-omnibus-discount-paddings-control", c.OMNIBUS_DISCOUNT_SIZE = "recommendation-block-omnibus-discount-size-control", c.OMNIBUS_DISCOUNT_STYLE = "recommendation-block-omnibus-discount-style-control", c.OMNIBUS_DISCOUNT_TEXT_BEFORE = "recommendation-block-omnibus-discount-text-before-control", c.OMNIBUS_DISCOUNT_TEXT_AFTER = "recommendation-block-omnibus-discount-text-after-control", c.IMAGE_SIZE = "recommendation-block-image-size-control", c.IMAGE_MARGINS = "recommendation-block-image-margins-control", c))(o || {});
|
|
2
|
+
export {
|
|
3
|
+
o as RecommendationControlId
|
|
4
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { DEFAULT_ROW_SPACING as s, DEFAULT_COLUMN_SPACING as R, DEFAULT_CARDS_IN_ROW as n } from "./layout.js";
|
|
2
|
+
import { ATTR_PRODUCT_IMAGE as t, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as e, ATTR_PRODUCT_PRICE as o, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as r, ATTR_PRODUCT_BUTTON as U } from "./selectors.js";
|
|
3
|
+
const I = {
|
|
4
|
+
code: "USD",
|
|
5
|
+
symbol: "USD",
|
|
6
|
+
alignment: "after",
|
|
7
|
+
decimalCount: 2,
|
|
8
|
+
decimalSeparator: ".",
|
|
9
|
+
thousandSeparator: ","
|
|
10
|
+
}, O = {
|
|
11
|
+
textBefore: "",
|
|
12
|
+
textAfter: ""
|
|
13
|
+
}, i = {
|
|
14
|
+
textBefore: "",
|
|
15
|
+
textAfter: ""
|
|
16
|
+
}, C = [
|
|
17
|
+
t,
|
|
18
|
+
T,
|
|
19
|
+
e,
|
|
20
|
+
o,
|
|
21
|
+
_,
|
|
22
|
+
r,
|
|
23
|
+
U
|
|
24
|
+
], D = {
|
|
25
|
+
[t]: !0,
|
|
26
|
+
[T]: !0,
|
|
27
|
+
[o]: !0,
|
|
28
|
+
[e]: !0,
|
|
29
|
+
[_]: !1,
|
|
30
|
+
[r]: !1,
|
|
31
|
+
[U]: !0
|
|
32
|
+
}, a = {
|
|
33
|
+
// Settings
|
|
34
|
+
strategy: "mostPopular",
|
|
35
|
+
productIds: [],
|
|
36
|
+
size: "6",
|
|
37
|
+
shuffleProducts: !1,
|
|
38
|
+
language: "en_US",
|
|
39
|
+
currency: I,
|
|
40
|
+
filters: [],
|
|
41
|
+
// Layout
|
|
42
|
+
layout: "grid",
|
|
43
|
+
cardsInRow: n,
|
|
44
|
+
columnSpacing: R,
|
|
45
|
+
rowSpacing: s,
|
|
46
|
+
// Composition
|
|
47
|
+
composition: C,
|
|
48
|
+
visibility: D,
|
|
49
|
+
// Element settings
|
|
50
|
+
omnibusPrice: O,
|
|
51
|
+
omnibusDiscount: i,
|
|
52
|
+
textTrimming: !1,
|
|
53
|
+
// Meta
|
|
54
|
+
configVersion: 1
|
|
55
|
+
}, E = 1;
|
|
56
|
+
export {
|
|
57
|
+
E as CURRENT_CONFIG_VERSION,
|
|
58
|
+
C as DEFAULT_COMPOSITION,
|
|
59
|
+
I as DEFAULT_CURRENCY,
|
|
60
|
+
a as DEFAULT_NODE_CONFIG,
|
|
61
|
+
i as DEFAULT_OMNIBUS_DISCOUNT,
|
|
62
|
+
O as DEFAULT_OMNIBUS_PRICE,
|
|
63
|
+
D as DEFAULT_VISIBILITY
|
|
64
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const _ = {
|
|
2
|
+
GRID: "grid",
|
|
3
|
+
LIST: "list"
|
|
4
|
+
}, o = [
|
|
5
|
+
{ icon: "grid-orientation", value: _.GRID },
|
|
6
|
+
{ icon: "list-orientation", value: _.LIST }
|
|
7
|
+
], t = 3, n = 3, A = 9, T = 4, c = 10, s = 20, O = 0, S = 50, I = 5;
|
|
8
|
+
export {
|
|
9
|
+
n as DEFAULT_CARDS_IN_ROW,
|
|
10
|
+
c as DEFAULT_COLUMN_SPACING,
|
|
11
|
+
t as DEFAULT_PRODUCTS_PER_ROW,
|
|
12
|
+
s as DEFAULT_ROW_SPACING,
|
|
13
|
+
o as LAYOUT_OPTIONS,
|
|
14
|
+
_ as LAYOUT_VALUES,
|
|
15
|
+
T as MAX_PRODUCTS_PER_ROW,
|
|
16
|
+
A as MAX_PRODUCT_COUNT,
|
|
17
|
+
S as MAX_SPACING,
|
|
18
|
+
O as MIN_SPACING,
|
|
19
|
+
I as SPACING_STEP
|
|
20
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const c = ".ins-recommendation-product-container", T = {
|
|
2
|
+
CURRENCY: "currency",
|
|
3
|
+
SYMBOL: "currency-symbol",
|
|
4
|
+
ALIGNMENT: "currency-alignment",
|
|
5
|
+
THOUSAND_SEPARATOR: "currency-thousand-separator",
|
|
6
|
+
DECIMAL_SEPARATOR: "currency-decimal-separator",
|
|
7
|
+
DECIMAL_COUNT: "currency-decimal-count"
|
|
8
|
+
}, r = "productImage", n = "productName", o = "productPrice", t = "productOldPrice", R = "productOmnibusPrice", O = "productOmnibusDiscount", _ = "productButton";
|
|
9
|
+
export {
|
|
10
|
+
_ as ATTR_PRODUCT_BUTTON,
|
|
11
|
+
r as ATTR_PRODUCT_IMAGE,
|
|
12
|
+
n as ATTR_PRODUCT_NAME,
|
|
13
|
+
t as ATTR_PRODUCT_OLD_PRICE,
|
|
14
|
+
O as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
15
|
+
R as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
16
|
+
o as ATTR_PRODUCT_PRICE,
|
|
17
|
+
c as CONTAINER_SELECTOR,
|
|
18
|
+
T as CURRENCY_ATTR
|
|
19
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createButtonFitToContainerControl as T, createButtonTextStyleAndFontColorControl as r, createButtonTextSizeControl as e, createButtonTextControl as B, createButtonPaddingsControl as l, createButtonMarginsControl as C, createButtonFontFamilyControl as O, createButtonColorControl as N, createButtonBorderRadiusControl as i, createButtonBorderControl as a, createButtonAlignControl as c } from "../../../controlFactories.js";
|
|
2
|
+
import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as t } from "../../constants/controlIds.js";
|
|
4
|
+
import { CONTAINER_SELECTOR as n } from "../../constants/selectors.js";
|
|
5
|
+
const U = c(
|
|
6
|
+
t.BUTTON_ALIGN,
|
|
7
|
+
o.BUTTON,
|
|
8
|
+
n
|
|
9
|
+
), d = a(
|
|
10
|
+
t.BUTTON_BORDER,
|
|
11
|
+
o.BUTTON,
|
|
12
|
+
n
|
|
13
|
+
), s = i(
|
|
14
|
+
t.BUTTON_BORDER_RADIUS,
|
|
15
|
+
o.BUTTON,
|
|
16
|
+
n
|
|
17
|
+
), _ = N(
|
|
18
|
+
t.BUTTON_COLOR,
|
|
19
|
+
o.BUTTON,
|
|
20
|
+
n
|
|
21
|
+
), m = O(
|
|
22
|
+
t.BUTTON_FONT_FAMILY,
|
|
23
|
+
o.BUTTON,
|
|
24
|
+
n
|
|
25
|
+
), u = C(
|
|
26
|
+
t.BUTTON_MARGINS,
|
|
27
|
+
o.BUTTON,
|
|
28
|
+
n
|
|
29
|
+
), R = l(
|
|
30
|
+
t.BUTTON_PADDINGS,
|
|
31
|
+
o.BUTTON,
|
|
32
|
+
n
|
|
33
|
+
), F = B(
|
|
34
|
+
t.BUTTON_TEXT,
|
|
35
|
+
o.BUTTON,
|
|
36
|
+
n
|
|
37
|
+
), A = e(
|
|
38
|
+
t.BUTTON_TEXT_SIZE,
|
|
39
|
+
o.BUTTON,
|
|
40
|
+
n
|
|
41
|
+
), S = r(
|
|
42
|
+
t.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
|
|
43
|
+
o.BUTTON,
|
|
44
|
+
n
|
|
45
|
+
), E = T(
|
|
46
|
+
t.BUTTON_FIT_TO_CONTENT,
|
|
47
|
+
o.BUTTON,
|
|
48
|
+
n
|
|
49
|
+
), p = {
|
|
50
|
+
align: U,
|
|
51
|
+
border: d,
|
|
52
|
+
borderRadius: s,
|
|
53
|
+
color: _,
|
|
54
|
+
fontFamily: m,
|
|
55
|
+
margins: u,
|
|
56
|
+
paddings: R,
|
|
57
|
+
text: F,
|
|
58
|
+
textSize: A,
|
|
59
|
+
textStyleAndFontColor: S,
|
|
60
|
+
fitToContent: E
|
|
61
|
+
};
|
|
62
|
+
export {
|
|
63
|
+
p as ButtonControls
|
|
64
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ModificationDescription as d } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as s } from "../../../common-control.js";
|
|
3
|
+
import { getCurrentLayout as l } from "../main/utils.js";
|
|
4
|
+
const u = "recommendation-card-background-color-control", e = {
|
|
5
|
+
CARD_BACKGROUND_COLOR: "cardBackgroundColor"
|
|
6
|
+
}, a = {
|
|
7
|
+
GRID: ".product-card-segment",
|
|
8
|
+
LIST: ".product-card-wrapper"
|
|
9
|
+
};
|
|
10
|
+
class _ extends s {
|
|
11
|
+
getId() {
|
|
12
|
+
return u;
|
|
13
|
+
}
|
|
14
|
+
getTemplate() {
|
|
15
|
+
return `
|
|
16
|
+
<div class="card-bg-control-container">
|
|
17
|
+
${this._GuTwoColumns([
|
|
18
|
+
this._GuLabel({ text: "Card Background Color" }),
|
|
19
|
+
this._GuColorPicker(e.CARD_BACKGROUND_COLOR)
|
|
20
|
+
])}
|
|
21
|
+
</div>
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
onRender() {
|
|
25
|
+
this._setFormValues(), this._listenToFormUpdates();
|
|
26
|
+
}
|
|
27
|
+
onTemplateNodeUpdated(r) {
|
|
28
|
+
super.onTemplateNodeUpdated(r), this._setFormValues();
|
|
29
|
+
}
|
|
30
|
+
_setFormValues() {
|
|
31
|
+
const r = this._getCurrentCardBackgroundColor();
|
|
32
|
+
this.api.updateValues({
|
|
33
|
+
[e.CARD_BACKGROUND_COLOR]: r
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets the appropriate selector based on layout
|
|
38
|
+
* Grid: .product-card-segment (inner table per product cell)
|
|
39
|
+
* List: .product-card-wrapper (table per product row)
|
|
40
|
+
*/
|
|
41
|
+
_getCardSelector() {
|
|
42
|
+
return l(this.currentNode) === "grid" ? a.GRID : a.LIST;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Reads the current background color from the first product card element
|
|
46
|
+
* @returns The background color value or 'transparent' if not found
|
|
47
|
+
*/
|
|
48
|
+
_getCurrentCardBackgroundColor() {
|
|
49
|
+
if (!this.currentNode || !("querySelectorAll" in this.currentNode))
|
|
50
|
+
return "transparent";
|
|
51
|
+
const r = this._getCardSelector(), t = this.currentNode.querySelector(r);
|
|
52
|
+
return !t || !("getStyle" in t) ? "transparent" : t.getStyle("background-color") || "transparent";
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Handles card background color changes
|
|
56
|
+
* Applies the color to all product card elements based on layout
|
|
57
|
+
*/
|
|
58
|
+
_onCardBackgroundColorChange(r) {
|
|
59
|
+
if (!this.currentNode || !("querySelectorAll" in this.currentNode))
|
|
60
|
+
return;
|
|
61
|
+
const t = this._getCardSelector(), o = Array.from(
|
|
62
|
+
this.currentNode.querySelectorAll(t)
|
|
63
|
+
);
|
|
64
|
+
if (o.length === 0)
|
|
65
|
+
return;
|
|
66
|
+
const n = this.api.getDocumentModifier();
|
|
67
|
+
o.forEach((c) => {
|
|
68
|
+
n.modifyHtml(c).setStyle("background-color", r);
|
|
69
|
+
}), n.apply(new d("Update card background color"));
|
|
70
|
+
}
|
|
71
|
+
_listenToFormUpdates() {
|
|
72
|
+
this.api.onValueChanged(e.CARD_BACKGROUND_COLOR, (r) => {
|
|
73
|
+
this._onCardBackgroundColorChange(r);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
u as CARD_BACKGROUND_COLOR_CONTROL_ID,
|
|
79
|
+
_ as CardBackgroundColorControl
|
|
80
|
+
};
|