@useinsider/guido 3.24.0-beta.0abeefe → 3.24.0-beta.0c16173
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 +7 -2
- package/dist/@types/config/schemas.js +40 -40
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +81 -85
- package/dist/composables/useActionsApi.js +2 -2
- package/dist/composables/useBlocksConfig.js +20 -31
- package/dist/composables/useEditorTrackingIds.js +49 -0
- package/dist/composables/useHtmlCompiler.js +2 -0
- package/dist/composables/useModuleRepair.js +14 -12
- package/dist/composables/useStripo.js +70 -70
- package/dist/composables/useTranslations.js +1 -2
- package/dist/config/compiler/htmlCompilerRules.js +14 -6
- package/dist/config/compiler/utils/itemsCompilerUtils.js +42 -43
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -67
- package/dist/config/migrator/index.js +16 -15
- package/dist/config/migrator/itemsPriceFormatMigrator.js +20 -0
- package/dist/enums/academy.js +0 -1
- package/dist/extensions/Blocks/Items/block.js +115 -77
- package/dist/extensions/Blocks/Items/constants/currency.js +59 -14
- package/dist/extensions/Blocks/Items/controls/blockBackground/index.js +11 -0
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +34 -23
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +62 -51
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +18 -17
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -31
- package/dist/extensions/Blocks/Items/controls/priceFormat.js +135 -0
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +141 -120
- package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
- package/dist/extensions/Blocks/Items/extension.js +15 -13
- package/dist/extensions/Blocks/Items/items.css.js +19 -0
- package/dist/extensions/Blocks/Items/settingsPanel.js +35 -25
- package/dist/extensions/Blocks/Items/template.js +250 -212
- package/dist/extensions/Blocks/Items/utils/priceFormatOps.js +185 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -8
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +28 -24
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +23 -22
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +1 -0
- package/dist/extensions/Blocks/controlFactories.js +104 -104
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
- package/dist/node_modules/valibot/dist/index.js +261 -297
- package/dist/package.json.js +6 -6
- package/dist/services/templateLibraryApi.js +39 -36
- package/dist/src/@types/config/schemas.d.ts +4 -4
- package/dist/src/composables/useConfig.d.ts +2 -2
- package/dist/src/composables/useEditorTrackingIds.d.ts +7 -0
- package/dist/src/composables/useStripo.d.ts +1 -1
- package/dist/src/config/migrator/index.d.ts +4 -1
- package/dist/src/config/migrator/itemsPriceFormatMigrator.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +6 -9
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +32 -0
- package/dist/src/extensions/Blocks/Items/controls/blockBackground/index.d.ts +15 -0
- package/dist/src/extensions/Blocks/Items/controls/priceFormat.d.ts +24 -0
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +1 -0
- package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +4 -1
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/utils/priceFormatOps.d.ts +66 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/priceFormatter.d.ts +12 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -1
- package/dist/src/stores/config.d.ts +20 -167
- package/dist/src/utils/itemsCurrencyRepair.d.ts +5 -1
- package/dist/src/utils/linkTrackingIds.d.ts +24 -22
- package/dist/src/utils/trimHrefWhitespace.d.ts +5 -0
- package/dist/stores/config.js +6 -13
- package/dist/utils/itemsCurrencyRepair.js +29 -24
- package/dist/utils/linkTrackingIds.js +72 -72
- package/dist/utils/pairProductVariables.js +119 -100
- package/dist/utils/templatePreparation.js +59 -72
- package/dist/utils/trimHrefWhitespace.js +10 -0
- package/package.json +1 -1
- package/dist/@types/display-condition.js +0 -25
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -17
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -41
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -81
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue.js +0 -17
- package/dist/components/organisms/display-conditions/DisplayConditionListState.vue2.js +0 -45
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -36
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -63
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
- package/dist/composables/useDisplayConditions.js +0 -117
- package/dist/enums/display-condition.js +0 -12
- package/dist/extensions/DisplayConditions/bridge.js +0 -25
- package/dist/extensions/DisplayConditions/constants.js +0 -26
- package/dist/extensions/DisplayConditions/control.js +0 -215
- package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -226
- package/dist/extensions/DisplayConditions/extension.js +0 -28
- package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
- package/dist/extensions/DisplayConditions/library.js +0 -30
- package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
- package/dist/extensions/LinkTracking/extension.js +0 -17
- package/dist/extensions/LinkTracking/writer.js +0 -41
- package/dist/services/displayConditionApi.js +0 -39
- package/dist/src/@types/display-condition.d.ts +0 -60
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
- package/dist/src/components/organisms/display-conditions/DisplayConditionListState.vue.d.ts +0 -18
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
- package/dist/src/composables/useDisplayConditions.d.ts +0 -18
- package/dist/src/enums/display-condition.d.ts +0 -15
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -7
- package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -23
- package/dist/src/extensions/DisplayConditions/control.d.ts +0 -25
- package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
- package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
- package/dist/src/extensions/LinkTracking/extension.d.ts +0 -2
- package/dist/src/extensions/LinkTracking/writer.d.ts +0 -13
- package/dist/src/mock/api/display-conditions.d.ts +0 -2
- package/dist/src/services/displayConditionApi.d.ts +0 -8
- package/dist/src/stores/display-condition.d.ts +0 -84
- package/dist/src/utils/displayCondition.d.ts +0 -11
- package/dist/src/utils/protectTableText.d.ts +0 -2
- package/dist/stores/display-condition.js +0 -29
- package/dist/utils/displayCondition.js +0 -26
- package/dist/utils/protectTableText.js +0 -22
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
version:
|
|
3
|
-
guido:
|
|
1
|
+
const o = "3.24.0-beta.0c16173", s = { stripo: { version: "2.83.1" } }, t = {
|
|
2
|
+
version: o,
|
|
3
|
+
guido: s
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
t as default,
|
|
7
|
+
s as guido,
|
|
8
|
+
o as version
|
|
9
9
|
};
|
|
@@ -1,60 +1,63 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as A } from "../composables/useActionsApi.js";
|
|
2
2
|
import { useConfig as S } from "../composables/useConfig.js";
|
|
3
|
-
import { useHttp as
|
|
3
|
+
import { useHttp as E } from "../composables/useHttp.js";
|
|
4
4
|
import { useToaster as x } from "../composables/useToaster.js";
|
|
5
|
-
import { useTranslations as
|
|
6
|
-
import { useHtmlDocumentCountValidator as
|
|
5
|
+
import { useTranslations as P } from "../composables/useTranslations.js";
|
|
6
|
+
import { useHtmlDocumentCountValidator as L } from "../composables/validators/useHtmlDocumentCountValidator.js";
|
|
7
7
|
import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
|
|
8
8
|
import { EditorType as H } from "../enums/defaults.js";
|
|
9
|
-
import { ToasterTypeOptions as
|
|
9
|
+
import { ToasterTypeOptions as T } from "../enums/toaster.js";
|
|
10
10
|
import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
-
import { useSaveAsTemplateStore as
|
|
11
|
+
import { useSaveAsTemplateStore as q } from "../stores/save-as-template.js";
|
|
12
12
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
13
|
-
import { isPlainObject as
|
|
13
|
+
import { isPlainObject as w } from "../utils/genericUtil.js";
|
|
14
14
|
import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
|
|
15
15
|
const Z = () => {
|
|
16
|
-
const { get:
|
|
16
|
+
const { get: l, post: c } = E(), { handleError: o, showToaster: i } = x(), { config: p, isFeatureEnabled: u } = S(), { validateLiquidSyntax: b } = N(), { validateSingleHtmlDocument: C } = L(), { getTemplateData: h } = A(), n = P();
|
|
17
17
|
return {
|
|
18
18
|
getCategories: async () => {
|
|
19
19
|
try {
|
|
20
|
-
const { data: e
|
|
21
|
-
return e
|
|
20
|
+
const { data: e } = await l("/newsletter/template-library/get-template-categories");
|
|
21
|
+
return Array.isArray(e) ? e : ((!w(e) || e.type !== "alert") && console.error("[TEMPLATE_LIBRARY_API] Unexpected get-template-categories response", e), i({
|
|
22
|
+
message: n("newsletter.template-library-service-error"),
|
|
23
|
+
type: T.Error
|
|
24
|
+
}), []);
|
|
22
25
|
} catch (e) {
|
|
23
|
-
return
|
|
26
|
+
return o(e, "Failed to fetch template categories"), [];
|
|
24
27
|
}
|
|
25
28
|
},
|
|
26
29
|
checkTemplateNameAvailability: async (e) => {
|
|
27
|
-
const { data: { status: t = !1 } } = await
|
|
30
|
+
const { data: { status: t = !1 } } = await l(
|
|
28
31
|
`/newsletter/template-library/template-name-exists?name=${e}`
|
|
29
32
|
);
|
|
30
33
|
return !t;
|
|
31
34
|
},
|
|
32
35
|
createCategory: async (e) => {
|
|
33
36
|
try {
|
|
34
|
-
const { data: { id: t } } = await
|
|
37
|
+
const { data: { id: t } } = await c(
|
|
35
38
|
"/newsletter/template-library/create-category",
|
|
36
39
|
{ name: e }
|
|
37
40
|
);
|
|
38
41
|
return t.toString();
|
|
39
42
|
} catch (t) {
|
|
40
|
-
return
|
|
43
|
+
return o(t, "Failed to create category"), "";
|
|
41
44
|
}
|
|
42
45
|
},
|
|
43
46
|
createTemplate: async () => {
|
|
44
47
|
var e, t, d, y;
|
|
45
48
|
try {
|
|
46
|
-
const { prepareTemplateDetails:
|
|
47
|
-
if (!
|
|
49
|
+
const { prepareTemplateDetails: m } = F(), s = q(), g = await h();
|
|
50
|
+
if (!C(g.html))
|
|
48
51
|
return !1;
|
|
49
|
-
const a = await
|
|
50
|
-
if (
|
|
52
|
+
const a = await m(g);
|
|
53
|
+
if (u("liquidSyntax") && !await b(a.compiledHtml))
|
|
51
54
|
return !1;
|
|
52
|
-
const
|
|
53
|
-
name:
|
|
54
|
-
categories:
|
|
55
|
-
productId: ((t = (e =
|
|
55
|
+
const v = {
|
|
56
|
+
name: s.getTemplateName,
|
|
57
|
+
categories: s.getSelectedCategoryIds,
|
|
58
|
+
productId: ((t = (e = p.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
56
59
|
editorType: H,
|
|
57
|
-
messageType: ((y = (d =
|
|
60
|
+
messageType: ((y = (d = p.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
|
|
58
61
|
content: r(a.compiledHtml),
|
|
59
62
|
css: r(a.css),
|
|
60
63
|
unsubscriptionPreferencePageStatus: !1,
|
|
@@ -65,34 +68,34 @@ const Z = () => {
|
|
|
65
68
|
recommendationConfigs: r({}),
|
|
66
69
|
isGuido: !0,
|
|
67
70
|
// eslint-disable-next-line camelcase
|
|
68
|
-
template_engine:
|
|
71
|
+
template_engine: u("liquidSyntax") ? 1 : 0,
|
|
69
72
|
stripoConfig: r({
|
|
70
73
|
editor: "stripo",
|
|
71
74
|
html: a.rawHtml,
|
|
72
75
|
css: a.css,
|
|
73
76
|
dynamicContentList: a.dynamicContentList
|
|
74
77
|
})
|
|
75
|
-
}, { data: f } = await
|
|
78
|
+
}, { data: f } = await c(
|
|
76
79
|
"/newsletter/template-library/create-template",
|
|
77
|
-
|
|
80
|
+
v
|
|
78
81
|
);
|
|
79
|
-
if (!
|
|
82
|
+
if (!w(f))
|
|
80
83
|
throw new Error("Unexpected create-template response");
|
|
81
|
-
return f.type === "alert" ? (
|
|
82
|
-
message:
|
|
84
|
+
return f.type === "alert" ? (i({
|
|
85
|
+
message: n(
|
|
83
86
|
"newsletter.template-library-save-alert",
|
|
84
|
-
{ templateName:
|
|
87
|
+
{ templateName: s.getTemplateName }
|
|
85
88
|
),
|
|
86
|
-
type:
|
|
87
|
-
}), !1) : (
|
|
88
|
-
message:
|
|
89
|
+
type: T.Error
|
|
90
|
+
}), !1) : (i({
|
|
91
|
+
message: n(
|
|
89
92
|
"newsletter.template-library-save-success",
|
|
90
|
-
{ templateName:
|
|
93
|
+
{ templateName: s.getTemplateName }
|
|
91
94
|
),
|
|
92
95
|
type: "success"
|
|
93
96
|
}), !0);
|
|
94
|
-
} catch (
|
|
95
|
-
return
|
|
97
|
+
} catch (m) {
|
|
98
|
+
return o(m, "Failed to create template"), !1;
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
};
|
|
@@ -384,8 +384,6 @@ export declare const UISchema: v.ObjectSchema<{
|
|
|
384
384
|
readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
385
385
|
/** Custom label for back button (if shown) */
|
|
386
386
|
readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
387
|
-
/** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
|
|
388
|
-
readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
389
387
|
}, undefined>;
|
|
390
388
|
/**
|
|
391
389
|
* Features configuration - enable/disable editor features
|
|
@@ -417,6 +415,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
417
415
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
418
416
|
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
419
417
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
418
|
+
/** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
|
|
419
|
+
readonly itemsPriceFormatting: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
420
420
|
}, undefined>;
|
|
421
421
|
/**
|
|
422
422
|
* Default block types available in Stripo
|
|
@@ -807,8 +807,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
807
807
|
readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
808
808
|
/** Custom label for back button (if shown) */
|
|
809
809
|
readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
810
|
-
/** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
|
|
811
|
-
readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
812
810
|
}, undefined>, {}>;
|
|
813
811
|
/** Feature toggles */
|
|
814
812
|
readonly features: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -838,6 +836,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
838
836
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
839
837
|
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
840
838
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
839
|
+
/** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
|
|
840
|
+
readonly itemsPriceFormatting: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
841
841
|
}, undefined>, {}>;
|
|
842
842
|
/** Block configuration */
|
|
843
843
|
readonly blocks: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -89,7 +89,6 @@ export declare const useConfig: () => {
|
|
|
89
89
|
ui: {
|
|
90
90
|
showHeader: boolean;
|
|
91
91
|
backButtonLabel?: string | undefined;
|
|
92
|
-
externalDisplayConditions: boolean;
|
|
93
92
|
};
|
|
94
93
|
features: {
|
|
95
94
|
dynamicContent: boolean;
|
|
@@ -106,6 +105,7 @@ export declare const useConfig: () => {
|
|
|
106
105
|
linkTrackingIds: boolean;
|
|
107
106
|
allowSaveWithErrors: boolean;
|
|
108
107
|
reusableRecommendationStrategy: boolean;
|
|
108
|
+
itemsPriceFormatting: boolean;
|
|
109
109
|
};
|
|
110
110
|
blocks: {
|
|
111
111
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -230,7 +230,6 @@ export declare const useConfig: () => {
|
|
|
230
230
|
ui: import("vue").ComputedRef<{
|
|
231
231
|
showHeader: boolean;
|
|
232
232
|
backButtonLabel?: string | undefined;
|
|
233
|
-
externalDisplayConditions: boolean;
|
|
234
233
|
} | null>;
|
|
235
234
|
features: import("vue").ComputedRef<{
|
|
236
235
|
dynamicContent: boolean;
|
|
@@ -247,6 +246,7 @@ export declare const useConfig: () => {
|
|
|
247
246
|
linkTrackingIds: boolean;
|
|
248
247
|
allowSaveWithErrors: boolean;
|
|
249
248
|
reusableRecommendationStrategy: boolean;
|
|
249
|
+
itemsPriceFormatting: boolean;
|
|
250
250
|
} | null>;
|
|
251
251
|
blocks: import("vue").ComputedRef<{
|
|
252
252
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditorOpenMetrics } from '@@/Composables/useEditorOpenMetrics';
|
|
2
2
|
import type { Metadata, Options, Template } from '@@/Types/stripo';
|
|
3
3
|
export declare const useStripo: (openMetrics: EditorOpenMetrics) => {
|
|
4
|
-
initPlugin: (template: Template, metadata: Metadata, options: Options) => Promise<void>;
|
|
4
|
+
initPlugin: (template: Template, metadata: Metadata, options: Options, htmlChanged?: boolean) => Promise<void>;
|
|
5
5
|
preloadRuntime: () => void;
|
|
6
6
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import type { LegacyRecommendationConfig } from '@@/Types/config';
|
|
2
2
|
import { type PartnerScopeMigrationOptions } from './recommendationPartnerMigrator';
|
|
3
|
-
export
|
|
3
|
+
export interface MigrationFeatureFlags {
|
|
4
|
+
itemsPriceFormatting?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>, partnerScope?: PartnerScopeMigrationOptions, features?: MigrationFeatureFlags) => Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function migrateItemsPriceFormat(html: string): string;
|
|
@@ -8,7 +8,6 @@ export declare const ACADEMY_LINKS: {
|
|
|
8
8
|
readonly EMAIL_EDITOR: "https://academy.insiderone.com/docs/email-drag-and-drop-editor";
|
|
9
9
|
readonly GLOBAL_UNSUBSCRIBE: "https://academy.insiderone.com/docs/global-unsubscribe-preference-center";
|
|
10
10
|
readonly AMP_FOR_EMAILS: "https://academy.insiderone.com/docs/amp-for-emails";
|
|
11
|
-
readonly EMAIL_DISPLAY_CONDITIONS: "https://academy.insiderone.com/docs/new-editor-add-display-conditions-to-an-email";
|
|
12
11
|
readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
|
|
13
12
|
};
|
|
14
13
|
export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
|
|
@@ -71,15 +71,12 @@ export declare class ItemsBlock extends Block {
|
|
|
71
71
|
*/
|
|
72
72
|
private _resolveInstanceId;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* Config is the source of truth — never derive from visible text.
|
|
77
|
-
*
|
|
78
|
-
* Authority split lives in `currencyAttrTargets` (SD-147588) — position only when a location
|
|
79
|
-
* is recorded, symbol only when customized — so this heal and the module-drop repair can't drift.
|
|
80
|
-
*
|
|
81
|
-
* Returns true only when an attr actually changed, so the caller can skip an empty apply that
|
|
82
|
-
* would otherwise re-trigger onDocumentChanged and loop.
|
|
74
|
+
* Single self-heal slot: the flag only decides whether a legacy root is converted; a root
|
|
75
|
+
* already in the new format is reconciled from config regardless. Returns whether anything was queued.
|
|
83
76
|
*/
|
|
84
77
|
private _reconcileCurrencyDomAttributes;
|
|
78
|
+
/** Legacy `<p>` contract via `currencyAttrTargets`: position when recorded, symbol only when custom. */
|
|
79
|
+
private _reconcileLegacyCurrencyAttributes;
|
|
80
|
+
private _priceParagraphs;
|
|
81
|
+
private _isPriceFormattingEnabled;
|
|
85
82
|
}
|
|
@@ -41,3 +41,35 @@ export declare function currencyAttrTargets(config: {
|
|
|
41
41
|
priceCurrencyLocation?: string;
|
|
42
42
|
priceCurrencySymbol?: string;
|
|
43
43
|
}): CurrencyAttrTargets;
|
|
44
|
+
export declare const ITEMS_PRICE_FORMAT_ATTR: {
|
|
45
|
+
readonly SYMBOL: "currency-symbol";
|
|
46
|
+
readonly ALIGNMENT: "currency-alignment";
|
|
47
|
+
readonly THOUSAND_SEPARATOR: "currency-thousand-separator";
|
|
48
|
+
readonly DECIMAL_SEPARATOR: "currency-decimal-separator";
|
|
49
|
+
readonly DECIMAL_COUNT: "currency-decimal-count";
|
|
50
|
+
readonly SINGLE_PRICE: "data-single_price";
|
|
51
|
+
};
|
|
52
|
+
/** Price `<p>` attrs of the legacy model; a new-format block carries none of them. */
|
|
53
|
+
export declare const LEGACY_PRICE_PARAGRAPH_ATTRS: readonly ["data-formated", "data-single_price", "data-curency", "data-currency_symbol"];
|
|
54
|
+
export declare const PRICE_FORMAT_CONFIG_KEYS: readonly ["priceThousandSeparator", "priceDecimalSeparator", "priceDecimalCount"];
|
|
55
|
+
export interface ItemsPriceFormat {
|
|
56
|
+
thousandSeparator: string;
|
|
57
|
+
decimalSeparator: string;
|
|
58
|
+
decimalCount: number;
|
|
59
|
+
}
|
|
60
|
+
/** en-US, the shape the legacy pre-formatted price tags produced. */
|
|
61
|
+
export declare const DEFAULT_ITEMS_PRICE_FORMAT: ItemsPriceFormat;
|
|
62
|
+
export interface PriceFormatConfigSlice {
|
|
63
|
+
priceThousandSeparator?: string;
|
|
64
|
+
priceDecimalSeparator?: string;
|
|
65
|
+
priceDecimalCount?: number;
|
|
66
|
+
}
|
|
67
|
+
export declare function normalizeDecimalCount(value: unknown): number;
|
|
68
|
+
/** Config → format, defaulting each missing key independently. */
|
|
69
|
+
export declare function priceFormatFromConfig(config: PriceFormatConfigSlice | null | undefined): ItemsPriceFormat;
|
|
70
|
+
export declare function isNewPriceFormatConfig(config: PriceFormatConfigSlice | null | undefined): boolean;
|
|
71
|
+
export interface AttributeReader {
|
|
72
|
+
getAttribute(name: string): string | null | undefined;
|
|
73
|
+
}
|
|
74
|
+
/** The export/control switch: a root carrying `currency-decimal-count` is in the new format. */
|
|
75
|
+
export declare function isNewPriceFormatRoot(root: AttributeReader | null | undefined): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const ItemsBlockBackgroundControl: {
|
|
2
|
+
new (): {
|
|
3
|
+
getId(): string;
|
|
4
|
+
getLabels(): {
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
8
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
9
|
+
getParentControlId(): string;
|
|
10
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
11
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
12
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
13
|
+
getElementLockCategory(): import("@stripoinc/ui-editor-extensions").ElementLockCategory | undefined;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ControlApi, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
import { CommonControl } from '../../common-control';
|
|
3
|
+
import { ItemsBlockControlId } from '../enums/controlEnums';
|
|
4
|
+
import { type ItemsBlockConfig } from '../utils/nodeConfigUtils';
|
|
5
|
+
export declare const CONTROL_BLOCK_ID = ItemsBlockControlId.PRICE_FORMAT;
|
|
6
|
+
export declare function isNewPriceFormatBlock(currentNode: ImmutableHtmlNode | undefined): boolean;
|
|
7
|
+
/** One apply: the config patch, the root attrs the export reads, and both price texts re-rendered. */
|
|
8
|
+
export declare function applyPriceFormatChange(currentNode: ImmutableHtmlNode | undefined, api: ControlApi, patch: Partial<ItemsBlockConfig>, description: string): void;
|
|
9
|
+
export declare class ItemsBlockPriceFormatControl extends CommonControl {
|
|
10
|
+
private lastWritten;
|
|
11
|
+
getId(): string;
|
|
12
|
+
getTemplate(): string;
|
|
13
|
+
onRender(): void;
|
|
14
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
15
|
+
onDestroy(): void;
|
|
16
|
+
_onThousandSeparatorChange(value: string): void;
|
|
17
|
+
_onDecimalSeparatorChange(value: string): void;
|
|
18
|
+
_onDecimalCountChange(value: string): void;
|
|
19
|
+
private _currentFormat;
|
|
20
|
+
private _write;
|
|
21
|
+
private _setSelectItems;
|
|
22
|
+
private _formValues;
|
|
23
|
+
private _getSelectRow;
|
|
24
|
+
}
|
|
@@ -35,6 +35,7 @@ export declare class ItemsBlockControl extends CommonControl {
|
|
|
35
35
|
_reFillTemplate(itemsType?: ProductType): void;
|
|
36
36
|
_recalculateTrimming(): void;
|
|
37
37
|
private _getParagraphFromBlock;
|
|
38
|
+
private _replacePriceText;
|
|
38
39
|
private _escapeRegex;
|
|
39
40
|
private _removeCurrencySymbol;
|
|
40
41
|
private _replacePriceNumber;
|
|
@@ -46,6 +46,8 @@ export declare enum ItemsBlockControlId {
|
|
|
46
46
|
PRICE_CURRENCY_SYMBOL = "items-block-price-currency-symbol-control",
|
|
47
47
|
PRICE_CURRENCY_LOCATION = "items-block-price-currency-location-control",
|
|
48
48
|
PRICE_ORIENTATION = "items-block-price-orientation-control",
|
|
49
|
+
PRICE_FORMAT = "items-block-price-format-control",
|
|
50
|
+
BLOCK_BACKGROUND = "items-block-background-color-control",
|
|
49
51
|
NAME_ALIGN = "items-block-name-align-control",
|
|
50
52
|
NAME_COLOR = "items-block-name-color-control",
|
|
51
53
|
NAME_SIZE = "items-block-name-size-control",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ItemsPriceFormat } from './constants/currency';
|
|
1
2
|
import { type ItemsBlockConfig } from './utils/nodeConfigUtils';
|
|
2
3
|
declare const migrationTemplate = "ADD YOUR MIGRATION HERE";
|
|
3
4
|
type ProductType = 'CART_ITEMS' | 'BROWSED_ITEMS' | 'PURCHASED_ITEMS';
|
|
@@ -36,6 +37,8 @@ type TemplateParameters = {
|
|
|
36
37
|
quantityStyles?: string;
|
|
37
38
|
/** Price orientation within the card ('vertical' = stacked, 'horizontal' = side-by-side) */
|
|
38
39
|
priceOrientation?: PriceOrientationType;
|
|
40
|
+
/** New price model (itemsPriceFormatting): root attrs + raw dummy amounts; absent = legacy output. */
|
|
41
|
+
priceFormat?: ItemsPriceFormat;
|
|
39
42
|
};
|
|
40
43
|
/**
|
|
41
44
|
* Applies price orientation styles to the generated HTML template.
|
|
@@ -67,5 +70,5 @@ export declare const applyPriceOrientationStyles: (html: string, layoutOrientati
|
|
|
67
70
|
* @param params.formattedPrice - Whether to use formatted price display
|
|
68
71
|
* @returns HTML template string for the Items Block
|
|
69
72
|
*/
|
|
70
|
-
export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, migrate, formattedPrice, configBlockAttributes, nodeConfig, nameStyles, buttonStyles, priceStyles, originalPriceStyles, quantityStyles, priceOrientation, }: TemplateParameters): string;
|
|
73
|
+
export declare function getDefaultTemplate({ orientation, itemsType, itemId, currencySymbol, currencyLocation, migrate, formattedPrice, configBlockAttributes, nodeConfig, nameStyles, buttonStyles, priceStyles, originalPriceStyles, quantityStyles, priceOrientation, priceFormat, }: TemplateParameters): string;
|
|
71
74
|
export default migrationTemplate;
|
|
@@ -18,6 +18,9 @@ export interface ItemsBlockConfig {
|
|
|
18
18
|
priceCurrencySymbol: string;
|
|
19
19
|
priceCurrencyLocation: string;
|
|
20
20
|
priceOrientation: 'vertical' | 'horizontal';
|
|
21
|
+
priceThousandSeparator?: string;
|
|
22
|
+
priceDecimalSeparator?: string;
|
|
23
|
+
priceDecimalCount?: number;
|
|
21
24
|
quantityControlEnabled: boolean;
|
|
22
25
|
buttonLink: string;
|
|
23
26
|
imageLink: string;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type ItemsPriceFormat } from '../constants/currency';
|
|
2
|
+
import { type ItemsBlockConfig } from './nodeConfigUtils';
|
|
3
|
+
export type PriceParagraphKind = 'price' | 'originalPrice';
|
|
4
|
+
export declare const PRICE_PARAGRAPH_SELECTOR = "p[product-attr=\"price\"], p[product-attr=\"originalPrice\"]";
|
|
5
|
+
type AttrMap = Record<string, string | null | undefined>;
|
|
6
|
+
export interface PriceParagraphSnapshot {
|
|
7
|
+
kind: PriceParagraphKind;
|
|
8
|
+
attrs: AttrMap;
|
|
9
|
+
text: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PriceFormatSnapshot {
|
|
12
|
+
rootAttrs: AttrMap;
|
|
13
|
+
paragraphs: PriceParagraphSnapshot[];
|
|
14
|
+
config: Partial<ItemsBlockConfig> | null;
|
|
15
|
+
}
|
|
16
|
+
export interface PriceTexts {
|
|
17
|
+
price: string;
|
|
18
|
+
originalPrice: string;
|
|
19
|
+
}
|
|
20
|
+
export interface PriceFormatOps {
|
|
21
|
+
rootSet: Record<string, string>;
|
|
22
|
+
paragraphRemove: string[];
|
|
23
|
+
configPatch: Partial<ItemsBlockConfig> | null;
|
|
24
|
+
texts: PriceTexts | null;
|
|
25
|
+
changed: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface PlanPriceFormatOptions {
|
|
28
|
+
convertLegacy: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface FormatDummyPriceInput {
|
|
31
|
+
amount: string | number;
|
|
32
|
+
format: ItemsPriceFormat;
|
|
33
|
+
symbol: string | null | undefined;
|
|
34
|
+
alignment: string | null | undefined;
|
|
35
|
+
}
|
|
36
|
+
export declare function paragraphKindOf(productAttr: string | null | undefined): PriceParagraphKind | null;
|
|
37
|
+
export declare function resolvePriceDummyAmounts(config: Pick<Partial<ItemsBlockConfig>, 'type' | 'priceSinglePrice'> | null | undefined): PriceTexts;
|
|
38
|
+
export declare function formatItemsDummyPrice({ amount, format, symbol, alignment }: FormatDummyPriceInput): string;
|
|
39
|
+
export declare function priceTextsFromConfig(config: Partial<ItemsBlockConfig> | null | undefined): PriceTexts;
|
|
40
|
+
/** `text` is decoded DOM text, `html` the rendered markup text (entities allowed). */
|
|
41
|
+
export declare function samePriceText(text: string | null | undefined, html: string | null | undefined): boolean;
|
|
42
|
+
/** Swaps the whole price text inside the paragraph markup, keeping the style wrappers around it. */
|
|
43
|
+
export declare function replacePriceText(innerHtml: string, currentText: string, newText: string): string;
|
|
44
|
+
export declare function planPriceFormatOps(snapshot: PriceFormatSnapshot, options: {
|
|
45
|
+
convertLegacy: true;
|
|
46
|
+
}): PriceFormatOps & {
|
|
47
|
+
texts: PriceTexts;
|
|
48
|
+
};
|
|
49
|
+
export declare function planPriceFormatOps(snapshot: PriceFormatSnapshot, options: PlanPriceFormatOptions): PriceFormatOps;
|
|
50
|
+
export interface PriceParagraphSource {
|
|
51
|
+
kind: PriceParagraphKind;
|
|
52
|
+
attr(name: string): string | null | undefined;
|
|
53
|
+
text: string;
|
|
54
|
+
}
|
|
55
|
+
export interface PriceFormatSnapshotSource {
|
|
56
|
+
rootAttr(name: string): string | null | undefined;
|
|
57
|
+
paragraphs: PriceParagraphSource[];
|
|
58
|
+
config: Partial<ItemsBlockConfig> | null;
|
|
59
|
+
}
|
|
60
|
+
/** Shared snapshot builder so DOM (migrator, repair) and Stripo-node callers read the same attrs. */
|
|
61
|
+
export declare function buildPriceFormatSnapshot(source: PriceFormatSnapshotSource): PriceFormatSnapshot;
|
|
62
|
+
export declare function readPersistedConfigAttribute(root: Element): Partial<ItemsBlockConfig> | null;
|
|
63
|
+
export declare function snapshotPriceFormatFromElement(root: Element): PriceFormatSnapshot;
|
|
64
|
+
/** DOM applier for parsed HTML (migrator, module repair). Returns whether anything was written. */
|
|
65
|
+
export declare function applyPriceFormatOpsToElement(root: Element, ops: PriceFormatOps): boolean;
|
|
66
|
+
export {};
|
|
@@ -57,6 +57,7 @@ interface PerBlockState {
|
|
|
57
57
|
legacyConversionLoading: boolean;
|
|
58
58
|
configVersion: number;
|
|
59
59
|
adoptedSizeVersion: number;
|
|
60
|
+
drawnProducts: RecommendationProduct[] | null;
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
|
|
@@ -491,6 +492,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
491
492
|
* (SD-149916).
|
|
492
493
|
*/
|
|
493
494
|
cloneBlockState(sourceId: number, newId: number): void;
|
|
495
|
+
markProductsDrawn(id: number, products: RecommendationProduct[]): void;
|
|
494
496
|
/**
|
|
495
497
|
* Marks a block as initialized (initial API data has been fetched).
|
|
496
498
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
@@ -14,6 +14,18 @@ export interface FormatPriceOptions {
|
|
|
14
14
|
/** Currency configuration */
|
|
15
15
|
currency: CurrencyConfig;
|
|
16
16
|
}
|
|
17
|
+
export interface FormatNumberOptions {
|
|
18
|
+
thousandSeparator: string;
|
|
19
|
+
decimalSeparator: string;
|
|
20
|
+
decimalCount: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Formats a number with custom thousand and decimal separators
|
|
24
|
+
* @param value - The numeric value to format
|
|
25
|
+
* @param options - Formatting options
|
|
26
|
+
* @returns Formatted number string
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatNumber(value: number, options: FormatNumberOptions): string;
|
|
17
29
|
/**
|
|
18
30
|
* Formats a numeric price according to currency settings
|
|
19
31
|
* @example
|
|
@@ -135,7 +135,7 @@ export declare function createTextBackgroundColorControl(controlId: string, targ
|
|
|
135
135
|
* next edit. We write inline `background-color` + `bgcolor` on the block `<td>` instead — surviving
|
|
136
136
|
* regeneration and reaching Outlook, matching the migrator's convention.
|
|
137
137
|
*/
|
|
138
|
-
export declare function createBlockBackgroundColorControl(controlId: string, blockRootSelector?: string): {
|
|
138
|
+
export declare function createBlockBackgroundColorControl(controlId: string, blockRootSelector?: string, title?: string): {
|
|
139
139
|
new (): {
|
|
140
140
|
getId(): string;
|
|
141
141
|
/** The parent control renders its own generic title; restore the block-level wording. */
|