@useinsider/guido 3.19.0 → 3.20.0-beta.0849ec7
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 +22 -3
- package/dist/@types/config/schemas.js +76 -53
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +102 -86
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
- package/dist/components/organisms/header/EditorActions.vue.js +5 -5
- package/dist/components/organisms/header/EditorActions.vue2.js +90 -57
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +49 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useActionsApi.js +52 -47
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useAutoSave.js +11 -11
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useCustomInterfaceAppearance.js +65 -51
- package/dist/composables/useEmailTemplateApplier.js +111 -50
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +89 -82
- package/dist/composables/useHttp.js +64 -54
- package/dist/composables/useLegacyStrategyConversion.js +65 -0
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useSave.js +90 -45
- package/dist/composables/useSaveValidation.js +282 -0
- package/dist/composables/useSaveValidationRollout.js +9 -0
- package/dist/composables/useStripo.js +43 -39
- package/dist/composables/useToaster.js +18 -22
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/itemsBlockMigrator.js +236 -248
- package/dist/config/migrator/recommendationMigrator.js +28 -21
- package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
- package/dist/enums/extensions/recommendationBlock.js +51 -34
- package/dist/enums/save-validation.js +4 -0
- 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/block.js +65 -45
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -90
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +150 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +274 -92
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/productIds.js +5 -3
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +46 -37
- package/dist/src/@types/config/schemas.d.ts +36 -0
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useConfig.d.ts +8 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
- package/dist/src/composables/useGuidoActions.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +21 -0
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
- package/dist/src/enums/save-validation.d.ts +27 -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/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +374 -0
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/stores/onboarding.d.ts +812 -10
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +113 -9
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/config.js +55 -24
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/onboarding.js +50 -36
- package/dist/stores/save-validation.js +30 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +54 -51
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockId as f } from "../../enums/block.js";
|
|
2
|
-
import { DEFAULT_NODE_CONFIG as
|
|
3
|
-
import { ATTR_RECOMMENDATION_TITLE as
|
|
2
|
+
import { DEFAULT_NODE_CONFIG as y } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
3
|
+
import { ATTR_RECOMMENDATION_TITLE as b } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
4
|
import { useTemplateStore as T } from "../../stores/template.js";
|
|
5
5
|
import { mapComposition as v } from "./recommendation/compositionMapper.js";
|
|
6
6
|
import { extractCurrencyFromBlock as C, extractTitleText as M, hasVisibleTitle as R, extractCardBgColor as S, isPartnerManagedBlock as h } from "./recommendation/extractors.js";
|
|
@@ -8,28 +8,28 @@ import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
|
|
|
8
8
|
import { parseRecommendationId as x, parseLegacyConfig as E } from "./recommendation/parseLegacyConfig.js";
|
|
9
9
|
import { mapSettings as A } from "./recommendation/settingsMapper.js";
|
|
10
10
|
const H = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
|
|
11
|
-
function B(n, t,
|
|
11
|
+
function B(n, t, c) {
|
|
12
12
|
var l;
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
13
|
+
const r = x(t);
|
|
14
|
+
if (r === null)
|
|
15
15
|
return console.warn(
|
|
16
16
|
"[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
|
|
17
17
|
), !1;
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
18
|
+
const o = E(t);
|
|
19
|
+
if (!o)
|
|
20
20
|
return console.warn(
|
|
21
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
21
|
+
`[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
22
22
|
), !1;
|
|
23
|
-
const
|
|
23
|
+
const a = c[String(r)] ?? {
|
|
24
24
|
currencySettings: C(t)
|
|
25
|
-
},
|
|
26
|
-
e.titleVariable || (e.visibility[
|
|
25
|
+
}, i = A(a, o, r), e = v((l = o.composition) == null ? void 0 : l.variables), d = M(t);
|
|
26
|
+
e.titleVariable || (e.visibility[b] = R(t));
|
|
27
27
|
const p = S(t), g = {
|
|
28
|
-
...
|
|
28
|
+
...i,
|
|
29
29
|
strategyId: "",
|
|
30
30
|
composition: e.composition,
|
|
31
31
|
visibility: e.visibility,
|
|
32
|
-
previousTitleHtml:
|
|
32
|
+
previousTitleHtml: y.previousTitleHtml,
|
|
33
33
|
textTrimming: e.anyTextTrimming
|
|
34
34
|
}, m = h(t), u = `
|
|
35
35
|
<table>
|
|
@@ -56,30 +56,37 @@ function B(n, t, a) {
|
|
|
56
56
|
</table>
|
|
57
57
|
`, s = n.parseFromString(u, "text/html").querySelector("td.esd-structure");
|
|
58
58
|
return !s || !t.parentNode ? (console.warn(
|
|
59
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
59
|
+
`[RecommendationMigrator] Aborting block id=${r} — failed to construct new HTML element`
|
|
60
60
|
), !1) : (t.parentNode.replaceChild(s, t), !0);
|
|
61
61
|
}
|
|
62
62
|
function G(n, t = {}) {
|
|
63
|
-
const
|
|
63
|
+
const c = new DOMParser();
|
|
64
|
+
let r;
|
|
65
|
+
try {
|
|
66
|
+
r = c.parseFromString(n, "text/html");
|
|
67
|
+
} catch (i) {
|
|
68
|
+
return console.error("[RecommendationMigrator] Failed to parse template:", i), n;
|
|
69
|
+
}
|
|
70
|
+
const o = Array.from(r.querySelectorAll(H));
|
|
64
71
|
try {
|
|
65
72
|
T().$patch((e) => {
|
|
66
73
|
e.migrations = {
|
|
67
74
|
...e.migrations,
|
|
68
|
-
[f.Recommendation]:
|
|
75
|
+
[f.Recommendation]: o.length
|
|
69
76
|
};
|
|
70
77
|
});
|
|
71
78
|
} catch {
|
|
72
79
|
}
|
|
73
|
-
if (
|
|
80
|
+
if (o.length === 0)
|
|
74
81
|
return n;
|
|
75
|
-
let
|
|
76
|
-
return
|
|
82
|
+
let a = 0;
|
|
83
|
+
return o.forEach((i) => {
|
|
77
84
|
try {
|
|
78
|
-
B(
|
|
85
|
+
B(c, i, t) && (a += 1);
|
|
79
86
|
} catch (e) {
|
|
80
87
|
console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
|
|
81
88
|
}
|
|
82
|
-
}),
|
|
89
|
+
}), a > 0 && console.info(`[RecommendationMigrator] Migrated ${a} legacy Recommendation block(s)`), r.documentElement.outerHTML;
|
|
83
90
|
}
|
|
84
91
|
export {
|
|
85
92
|
G as migrateRecommendation
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { RECOMMENDATION_ID_ATTR as a, SELECTOR_ATTRIBUTE_ROW as f, ATTR_DATA_ATTRIBUTE_TYPE as _, ATTR_CUSTOM_PREFIX as g, ATTR_DATA_CARD_COMPOSITION as m, ATTR_DATA_CUSTOM_ATTRIBUTES as R } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
2
|
+
import { carriesForeignPartnerConfig as O, canJudgeUnstampedBlock as d, withoutCustomAttributes as l } from "../../extensions/Blocks/Recommendation/utils/partnerScope.js";
|
|
3
|
+
const E = ".recommendation-block-v2[esd-ext-config]", T = "esd-ext-config";
|
|
4
|
+
function S(t) {
|
|
5
|
+
const r = t.getAttribute(T);
|
|
6
|
+
if (!r)
|
|
7
|
+
return null;
|
|
8
|
+
try {
|
|
9
|
+
const e = JSON.parse(r);
|
|
10
|
+
return e && typeof e == "object" && !Array.isArray(e) ? e : null;
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function p(t, r, e) {
|
|
16
|
+
const s = l(r.composition ?? []);
|
|
17
|
+
t.querySelectorAll(f).forEach((o) => {
|
|
18
|
+
var u;
|
|
19
|
+
(u = o.getAttribute(_)) != null && u.startsWith(g) && o.remove();
|
|
20
|
+
}), t.setAttribute(m, s.join(",")), t.setAttribute(R, "[]"), t.setAttribute(T, JSON.stringify({
|
|
21
|
+
...r,
|
|
22
|
+
strategyId: "",
|
|
23
|
+
strategy: "",
|
|
24
|
+
filters: [],
|
|
25
|
+
productIds: [],
|
|
26
|
+
composition: s,
|
|
27
|
+
partnerName: e
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
function I(t, { partnerName: r, campaignUrls: e, rrsEnabled: s }) {
|
|
31
|
+
if (!r)
|
|
32
|
+
return t;
|
|
33
|
+
let o;
|
|
34
|
+
try {
|
|
35
|
+
o = new DOMParser().parseFromString(t, "text/html");
|
|
36
|
+
} catch (n) {
|
|
37
|
+
return console.error("[RecommendationPartnerMigrator] Failed to parse template:", n), t;
|
|
38
|
+
}
|
|
39
|
+
const u = Array.from(o.querySelectorAll(E));
|
|
40
|
+
if (u.length === 0)
|
|
41
|
+
return t;
|
|
42
|
+
let c = 0;
|
|
43
|
+
return u.forEach((n) => {
|
|
44
|
+
const i = S(n), A = Number(n.getAttribute(a));
|
|
45
|
+
if (!(!i || !Number.isFinite(A))) {
|
|
46
|
+
if (O({ config: i, blockId: A, partnerName: r, campaignUrls: e, rrsEnabled: s })) {
|
|
47
|
+
p(n, i, r), c += 1;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
i.partnerName || !d({ config: i, campaignUrls: e, rrsEnabled: s }) || (n.setAttribute(T, JSON.stringify({ ...i, partnerName: r })), c += 1);
|
|
51
|
+
}
|
|
52
|
+
}), c > 0 ? o.documentElement.outerHTML : t;
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
I as migrateRecommendationPartnerScope
|
|
56
|
+
};
|
|
@@ -1,14 +1,28 @@
|
|
|
1
|
-
import { useTranslations as
|
|
2
|
-
const
|
|
1
|
+
import { useTranslations as s } from "../../composables/useTranslations.js";
|
|
2
|
+
const t = {
|
|
3
3
|
RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
|
|
4
4
|
// Relative path → same-origin as the embedding inone dashboard.
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
|
|
6
6
|
RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
|
|
7
|
-
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
|
|
8
|
+
NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations",
|
|
9
|
+
MIGRATE_STRATEGIES_PATH: "/newsletter/recommendations/migrate-strategies",
|
|
10
|
+
// The template route narrows the recommendations resource before the action: the id
|
|
11
|
+
// travels in the body, not the path.
|
|
12
|
+
TEMPLATE_MIGRATE_STRATEGIES_PATH: "/newsletter/recommendations/template/migrate-strategies"
|
|
10
13
|
}, d = () => {
|
|
11
|
-
const e =
|
|
14
|
+
const { RECOMMENDATION_STRATEGIES_PANEL_PATH: e } = t;
|
|
15
|
+
return `${e}/create`;
|
|
16
|
+
}, m = (e) => {
|
|
17
|
+
const { RECOMMENDATION_STRATEGIES_PANEL_PATH: n } = t;
|
|
18
|
+
return `${n}/${e}/edit`;
|
|
19
|
+
}, T = {
|
|
20
|
+
campaign: t.MIGRATE_STRATEGIES_PATH,
|
|
21
|
+
template: t.TEMPLATE_MIGRATE_STRATEGIES_PATH
|
|
22
|
+
}, p = {
|
|
23
|
+
CLIENT_ID: "clientId"
|
|
24
|
+
}, E = () => {
|
|
25
|
+
const e = s();
|
|
12
26
|
return [
|
|
13
27
|
{
|
|
14
28
|
id: 11,
|
|
@@ -71,10 +85,10 @@ const l = {
|
|
|
71
85
|
path: "top-sellers"
|
|
72
86
|
}
|
|
73
87
|
];
|
|
74
|
-
},
|
|
88
|
+
}, A = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], v = [
|
|
75
89
|
{ text: "before the amount", value: "0" },
|
|
76
90
|
{ text: "after the amount", value: "1" }
|
|
77
|
-
],
|
|
91
|
+
], _ = [
|
|
78
92
|
{ text: "dot(.)", value: "." },
|
|
79
93
|
{ text: "comma(,)", value: "," },
|
|
80
94
|
{ text: "space( )", value: " " }
|
|
@@ -85,59 +99,62 @@ const l = {
|
|
|
85
99
|
{ text: "3", value: "3" },
|
|
86
100
|
{ text: "4", value: "4" },
|
|
87
101
|
{ text: "5", value: "5" }
|
|
88
|
-
],
|
|
102
|
+
], r = "||", a = [
|
|
89
103
|
{ text: "is exactly", value: "=" },
|
|
90
104
|
{ text: "contains", value: "~" },
|
|
91
105
|
{ text: "does not contain", value: "!~" },
|
|
92
|
-
{ text: "any of", value:
|
|
93
|
-
],
|
|
106
|
+
{ text: "any of", value: r }
|
|
107
|
+
], o = [
|
|
94
108
|
{ text: "is exactly", value: "=" },
|
|
95
109
|
{ text: "is not exactly", value: "!==" },
|
|
96
110
|
{ text: "contains", value: "~" },
|
|
97
111
|
{ text: "does not contain", value: "!~" },
|
|
98
|
-
{ text: "any of", value:
|
|
99
|
-
],
|
|
112
|
+
{ text: "any of", value: r }
|
|
113
|
+
], i = [
|
|
100
114
|
{ text: "is equal to", value: "=" },
|
|
101
115
|
{ text: "is greater than", value: ">" },
|
|
102
116
|
{ text: "is less than", value: "<" }
|
|
103
|
-
],
|
|
117
|
+
], u = [
|
|
104
118
|
{ text: "is equal to", value: "=" },
|
|
105
119
|
{ text: "after", value: ">" },
|
|
106
120
|
{ text: "before", value: "<" }
|
|
107
|
-
],
|
|
121
|
+
], c = [
|
|
108
122
|
{ text: "true", value: "==" },
|
|
109
123
|
{ text: "false", value: "!=" }
|
|
110
124
|
], x = (e) => {
|
|
111
125
|
if (!e)
|
|
112
|
-
return
|
|
126
|
+
return a;
|
|
113
127
|
switch (e) {
|
|
114
128
|
case "Boolean":
|
|
115
|
-
return
|
|
129
|
+
return c;
|
|
116
130
|
case "Date":
|
|
117
|
-
return
|
|
131
|
+
return u;
|
|
118
132
|
case "Number":
|
|
119
|
-
return
|
|
133
|
+
return i;
|
|
120
134
|
case "String":
|
|
121
|
-
return
|
|
135
|
+
return a;
|
|
122
136
|
case "Strings":
|
|
123
|
-
return
|
|
137
|
+
return o;
|
|
124
138
|
default:
|
|
125
|
-
return
|
|
139
|
+
return a;
|
|
126
140
|
}
|
|
127
141
|
};
|
|
128
142
|
export {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
T as MIGRATION_PATHS,
|
|
144
|
+
r as OP_ANY_OF,
|
|
145
|
+
A as PriceAttributes,
|
|
146
|
+
p as QUERY_PARAMS,
|
|
147
|
+
t as URLS,
|
|
133
148
|
h as currencyDecimalCounts,
|
|
134
|
-
|
|
135
|
-
|
|
149
|
+
v as currencyLocationMaps,
|
|
150
|
+
_ as currencyOperators,
|
|
136
151
|
x as getOperatorOptions,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
152
|
+
E as getRecommendationFeedSourceMaps,
|
|
153
|
+
o as operatorOptionsForArrayOfStrings,
|
|
154
|
+
c as operatorOptionsForBooleans,
|
|
155
|
+
u as operatorOptionsForDates,
|
|
156
|
+
i as operatorOptionsForNumbers,
|
|
157
|
+
a as operatorOptionsForStrings,
|
|
158
|
+
d as strategyCreatePath,
|
|
159
|
+
m as strategyEditPath
|
|
143
160
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s))(n || {});
|
|
2
|
+
export {
|
|
3
|
+
n as SaveValidationRule
|
|
4
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SETTINGS_ENUMS as r } from "../enums/settingsEnums.js";
|
|
2
|
+
const I = "130px", L = "100%", R = (e) => e === r.ORIENTATION.HORIZONTAL ? I : L, n = {
|
|
3
|
+
VERTICAL: "es-p5b es-p5t",
|
|
4
|
+
HORIZONTAL: "es-p5l es-p5r"
|
|
5
|
+
}, o = "data-items-cell-pad", d = (e) => `${o}="${e ? "v" : "h"}"`, t = (e) => e ? ` ${n.VERTICAL}` : ` ${n.HORIZONTAL}`, E = (e, A) => {
|
|
6
|
+
if (!e.includes(o))
|
|
7
|
+
return e;
|
|
8
|
+
const T = A ? n.HORIZONTAL : n.VERTICAL, s = A ? n.VERTICAL : n.HORIZONTAL, c = A ? "v" : "h";
|
|
9
|
+
return e.includes(T) ? e.replace(T, s).replace(new RegExp(`${o}="[hv]"`), `${o}="${c}"`) : e;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
n as BLOCK_CELL_PADDING,
|
|
13
|
+
o as BLOCK_CELL_PAD_ATTR,
|
|
14
|
+
I as NAME_HORIZONTAL_MAX_WIDTH,
|
|
15
|
+
L as NAME_VERTICAL_MAX_WIDTH,
|
|
16
|
+
d as blockCellPadMarker,
|
|
17
|
+
t as blockCellPaddingFor,
|
|
18
|
+
R as nameMaxWidthFor,
|
|
19
|
+
E as reorientBlockCellPadding
|
|
20
|
+
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { CommonControl as
|
|
1
|
+
import { ModificationDescription as d, UIElementType as s, UEAttr as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { CommonControl as T } from "../../../common-control.js";
|
|
3
|
+
import { nameMaxWidthFor as h } from "../../constants/cardLayout.js";
|
|
3
4
|
import { ItemsBlockControlId as a } from "../../enums/controlEnums.js";
|
|
4
|
-
import { findNameTextNode as
|
|
5
|
-
import { getItemsBlockConfig as r, setItemsBlockConfig as
|
|
6
|
-
const
|
|
5
|
+
import { findNameTextNode as c } from "../../utils/nameNode.js";
|
|
6
|
+
import { getItemsBlockConfig as r, setItemsBlockConfig as g } from "../../utils/nodeConfigUtils.js";
|
|
7
|
+
const I = a.NAME_TRIMMING, n = {
|
|
7
8
|
TRIMMING: "trimming"
|
|
8
9
|
};
|
|
9
|
-
class
|
|
10
|
+
class E extends T {
|
|
10
11
|
getId() {
|
|
11
|
-
return
|
|
12
|
+
return I;
|
|
12
13
|
}
|
|
13
14
|
getTemplate() {
|
|
14
15
|
return `
|
|
@@ -19,39 +20,39 @@ class y extends p {
|
|
|
19
20
|
}
|
|
20
21
|
onRender() {
|
|
21
22
|
const e = r(this.currentNode);
|
|
22
|
-
this.api.updateValues({ [
|
|
23
|
+
this.api.updateValues({ [n.TRIMMING]: (e == null ? void 0 : e.nameTrimming) ?? !0 }), this.api.onValueChanged(n.TRIMMING, (t) => {
|
|
23
24
|
this._onTrimmingChange(t);
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
onTemplateNodeUpdated(e) {
|
|
27
28
|
super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
|
|
28
29
|
const t = r(this.currentNode);
|
|
29
|
-
this.api.updateValues({ [
|
|
30
|
+
this.api.updateValues({ [n.TRIMMING]: (t == null ? void 0 : t.nameTrimming) ?? !0 });
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
_onTrimmingChange(e) {
|
|
33
|
-
|
|
34
|
+
g(this.currentNode, this.api, { nameTrimming: e }), this.api.updateValues({ [n.TRIMMING]: e }), this._applyTrimmingStyles(e);
|
|
34
35
|
}
|
|
35
36
|
_applyTrimmingStyles(e) {
|
|
36
|
-
const t =
|
|
37
|
+
const t = c(this.currentNode);
|
|
37
38
|
if (!t)
|
|
38
39
|
return;
|
|
39
|
-
const
|
|
40
|
-
m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width",
|
|
40
|
+
const i = r(this.currentNode), m = e !== void 0 ? e : (i == null ? void 0 : i.nameTrimming) ?? !0, l = h(i == null ? void 0 : i.orientation), o = this.api.getDocumentModifier().modifyHtml(t);
|
|
41
|
+
m ? o.setStyle("white-space", "nowrap").setStyle("overflow", "hidden").setStyle("text-overflow", "ellipsis") : o.removeStyle("white-space").removeStyle("overflow").removeStyle("text-overflow"), o.setStyle("max-width", l).apply(new d(`Text Trimming ${m ? "Enabled" : "Disabled"}`));
|
|
41
42
|
}
|
|
42
43
|
_getTextTrimming() {
|
|
43
44
|
return `
|
|
44
45
|
<div class="display-flex align-items-center justify-content-between">
|
|
45
46
|
<${s.LABEL}
|
|
46
|
-
${
|
|
47
|
+
${p.LABEL.text}="${this.api.translate("Text Trimming")}"
|
|
47
48
|
>
|
|
48
49
|
</${s.LABEL}>
|
|
49
|
-
${this._GuToggle(
|
|
50
|
+
${this._GuToggle(n.TRIMMING)}
|
|
50
51
|
</div>
|
|
51
52
|
`;
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
I as CONTROL_BLOCK_ID,
|
|
57
|
+
E as NameTrimmingControl
|
|
57
58
|
};
|