@useinsider/guido 1.0.3-beta.b702168 → 1.0.3-beta.b8dcb37
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 +0 -4
- package/dist/{src/@types → @types}/generic.d.ts +0 -6
- package/dist/{src/components → components}/Guido.vue.d.ts +0 -1
- package/dist/components/Guido.vue.js +9 -11
- package/dist/components/Guido.vue2.js +14 -14
- package/dist/components/organisms/onboarding/NewVersionPopup.vue.js +9 -9
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +17 -30
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue.js +10 -12
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -19
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +2 -0
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +2 -0
- package/dist/composables/useStripo.js +30 -31
- package/dist/config/migrator/index.js +7 -6
- package/dist/config/migrator/recommendationMigrator.d.ts +1 -0
- package/dist/config/migrator/recommendationMigrator.js +203 -0
- package/dist/enums/defaults.js +3 -4
- package/dist/enums/onboarding.d.ts +1 -0
- package/dist/enums/onboarding.js +1 -2
- package/dist/{src/extensions → extensions}/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/extensions/Blocks/Recommendation/block.js +5 -2
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +65 -0
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +335 -0
- package/dist/{src/extensions → extensions}/Blocks/Recommendation/control.d.ts +6 -0
- package/dist/extensions/Blocks/Recommendation/control.js +68 -40
- package/dist/extensions/Blocks/Recommendation/controls/button/align.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/align.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/border.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/border.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/color.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/color.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/text.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/text.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/align.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/align.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/background.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/background.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/color.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/color.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/size.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/size.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/style.d.ts +5 -0
- package/dist/extensions/Blocks/Recommendation/controls/name/style.js +12 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +25 -6
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +58 -18
- package/dist/extensions/Blocks/Recommendation/template.d.ts +43 -0
- package/dist/extensions/Blocks/Recommendation/template.js +265 -151
- package/dist/{src/extensions → extensions}/Blocks/common-control.d.ts +21 -0
- package/dist/extensions/Blocks/common-control.js +125 -43
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +289 -104
- package/dist/{src/stores → stores}/config.d.ts +0 -1
- package/dist/utils/dateUtil.d.ts +1 -0
- package/dist/utils/dateUtil.js +3 -24
- package/package.json +2 -7
- package/dist/enums/date.js +0 -6
- package/dist/package.json.js +0 -7
- package/dist/src/components/organisms/onboarding/NewVersionPopup.vue.d.ts +0 -4
- package/dist/src/components/organisms/onboarding/OnboardingWrapper.vue.d.ts +0 -4
- package/dist/src/enums/date.d.ts +0 -4
- package/dist/src/enums/onboarding.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/template.d.ts +0 -6
- package/dist/src/utils/dateUtil.d.ts +0 -22
- /package/dist/{src/@types → @types}/events.d.ts +0 -0
- /package/dist/{src/@types → @types}/save-as-template.d.ts +0 -0
- /package/dist/{src/App.vue.d.ts → App.vue.d.ts} +0 -0
- /package/dist/{src/components → components}/organisms/LoadingWrapper.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/base/Toaster.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/PreviewContainer.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/amp/AmpErrorModal.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/amp/AmpToggle.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/desktop-preview/DesktopPreview.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/mobile-preview/ContentView.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/mobile-preview/InboxView.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/email-preview/mobile-preview/MobilePreview.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/extensions/recommendation/FilterItem.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/extensions/recommendation/FilterSelectionDrawer.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/extensions/recommendation/Filters.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/extensions/recommendation/LogicAdapter.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/HeaderWrapper.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/LeftSlot.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/MiddleSlot.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/RightSlot.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/ViewOptions.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/version-history/RestoreButton.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/version-history/VersionHistory.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/version-history/VersionHistoryItem.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/header/version-history/ViewOptions.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/onboarding/AMPOnboarding.vue.d.ts +0 -0
- /package/dist/{src/components → components}/organisms/onboarding/GenericOnboarding.vue.d.ts +0 -0
- /package/dist/{src/components/organisms/onboarding/TextBlockOnboarding.vue.d.ts → components/organisms/onboarding/NewVersionPopup.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/onboarding/VersionHistoryOnboarding.vue.d.ts → components/organisms/onboarding/OnboardingWrapper.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/save-as-template/SaveAsTemplateDrawer.vue.d.ts → components/organisms/onboarding/TextBlockOnboarding.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts → components/organisms/onboarding/VersionHistoryOnboarding.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts → components/organisms/save-as-template/SaveAsTemplateDrawer.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts → components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts → components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts} +0 -0
- /package/dist/{src/components → components}/wrappers/WpDrawer.vue.d.ts +0 -0
- /package/dist/{src/components → components}/wrappers/WpModal.vue.d.ts +0 -0
- /package/dist/{src/composables → composables}/useActionsApi.d.ts +0 -0
- /package/dist/{src/composables → composables}/useApiExample.d.ts +0 -0
- /package/dist/{src/composables → composables}/useCodeEditorApi.d.ts +0 -0
- /package/dist/{src/composables → composables}/useConfig.d.ts +0 -0
- /package/dist/{src/composables → composables}/useCustomInterfaceAppearance.d.ts +0 -0
- /package/dist/{src/composables → composables}/useDebounce.d.ts +0 -0
- /package/dist/{src/composables → composables}/useExport.d.ts +0 -0
- /package/dist/{src/composables → composables}/useGuidoActions.d.ts +0 -0
- /package/dist/{src/composables → composables}/useHtmlCompiler.d.ts +0 -0
- /package/dist/{src/composables → composables}/useHtmlValidator.d.ts +0 -0
- /package/dist/{src/composables → composables}/useHttp.d.ts +0 -0
- /package/dist/{src/composables → composables}/usePartner.d.ts +0 -0
- /package/dist/{src/composables → composables}/usePreviewMode.d.ts +0 -0
- /package/dist/{src/composables → composables}/useProvideInject.d.ts +0 -0
- /package/dist/{src/composables → composables}/useRecommendation.d.ts +0 -0
- /package/dist/{src/composables → composables}/useResponsivePreview.d.ts +0 -0
- /package/dist/{src/composables → composables}/useSave.d.ts +0 -0
- /package/dist/{src/composables → composables}/useStripo.d.ts +0 -0
- /package/dist/{src/composables → composables}/useStripoEventHandler.d.ts +0 -0
- /package/dist/{src/composables → composables}/useToaster.d.ts +0 -0
- /package/dist/{src/composables → composables}/useTranslations.d.ts +0 -0
- /package/dist/{src/composables → composables}/useValidation.d.ts +0 -0
- /package/dist/{src/composables → composables}/useVersionHistoryApi.d.ts +0 -0
- /package/dist/{src/composables → composables}/validators/saveAsTemplate.d.ts +0 -0
- /package/dist/{src/config → config}/compiler/htmlCompilerRules.d.ts +0 -0
- /package/dist/{src/config → config}/compiler/outlookCompilerRules.d.ts +0 -0
- /package/dist/{src/config → config}/compiler/recommendationCompilerRules.d.ts +0 -0
- /package/dist/{src/config → config}/compiler/socialCompilerRules.d.ts +0 -0
- /package/dist/{src/config → config}/compiler/unsubscribeCompilerRules.d.ts +0 -0
- /package/dist/{src/config → config}/migrator/checkboxMigrator.d.ts +0 -0
- /package/dist/{src/config → config}/migrator/couponBlockMigrator.d.ts +0 -0
- /package/dist/{src/config → config}/migrator/index.d.ts +0 -0
- /package/dist/{src/config → config}/migrator/radioButtonMigrator.d.ts +0 -0
- /package/dist/{src/config → config}/migrator/unsubscribeMigrator.d.ts +0 -0
- /package/dist/{src/enums → enums}/defaults.d.ts +0 -0
- /package/dist/{src/enums → enums}/displayConditions.d.ts +0 -0
- /package/dist/{src/enums → enums}/extensions/recommendationBlock.d.ts +0 -0
- /package/dist/{src/enums → enums}/html-validator.d.ts +0 -0
- /package/dist/{src/enums → enums}/preview.d.ts +0 -0
- /package/dist/{src/enums → enums}/recommendation.d.ts +0 -0
- /package/dist/{src/enums → enums}/toaster.d.ts +0 -0
- /package/dist/{src/enums → enums}/unsubscribe.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Checkbox/block.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Checkbox/control.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Checkbox/extension.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Checkbox/iconsRegistry.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Checkbox/settingsPanel.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Checkbox/template.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/CouponBlock/block.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/CouponBlock/extension.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/CouponBlock/iconsRegistry.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/CouponBlock/settingsPanel.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/CouponBlock/template.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/RadioButton/block.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/RadioButton/control.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/RadioButton/extension.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/RadioButton/iconsRegistry.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/RadioButton/settingsPanel.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/RadioButton/template.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Recommendation/extension.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Recommendation/iconsRegistry.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Recommendation/settingsPanel.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Recommendation/store/recommendation.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Recommendation/utils/filterUtil.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/block.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/control.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/elements/preview.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/extension.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/iconsRegistry.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/settingsPanel.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/tagRegistry.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/template.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/utils/constants.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/utils/utils.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/_Boilerplate/block.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/_Boilerplate/control.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/_Boilerplate/extension.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/_Boilerplate/iconsRegistry.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/_Boilerplate/settingsPanel.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/_Boilerplate/template.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/DynamicContent/dynamic-content-modal.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/DynamicContent/dynamic-content.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/DynamicContent/extension.d.ts +0 -0
- /package/dist/{src/library.d.ts → library.d.ts} +0 -0
- /package/dist/{src/main.d.ts → main.d.ts} +0 -0
- /package/dist/{src/mock → mock}/api/auth.d.ts +0 -0
- /package/dist/{src/mock → mock}/api/custom-fonts.d.ts +0 -0
- /package/dist/{src/mock → mock}/api/default-template.d.ts +0 -0
- /package/dist/{src/mock → mock}/api/recommendation.d.ts +0 -0
- /package/dist/{src/mock → mock}/api/template-library.d.ts +0 -0
- /package/dist/{src/mock → mock}/api/unsubscribe.d.ts +0 -0
- /package/dist/{src/mock → mock}/api/user-modal-state.d.ts +0 -0
- /package/dist/{src/mock → mock}/api/validator.d.ts +0 -0
- /package/dist/{src/mock → mock}/browser.d.ts +0 -0
- /package/dist/{src/mock → mock}/handlers.d.ts +0 -0
- /package/dist/{src/services → services}/onboardingApi.d.ts +0 -0
- /package/dist/{src/services → services}/recommendationApi.d.ts +0 -0
- /package/dist/{src/services → services}/stripoApi.d.ts +0 -0
- /package/dist/{src/services → services}/templateLibraryApi.d.ts +0 -0
- /package/dist/{src/services → services}/unsubscribeApi.d.ts +0 -0
- /package/dist/{src/stores → stores}/dynamic-content.d.ts +0 -0
- /package/dist/{src/stores → stores}/editor.d.ts +0 -0
- /package/dist/{src/stores → stores}/onboarding.d.ts +0 -0
- /package/dist/{src/stores → stores}/preview.d.ts +0 -0
- /package/dist/{src/stores → stores}/recommendation.d.ts +0 -0
- /package/dist/{src/stores → stores}/save-as-template.d.ts +0 -0
- /package/dist/{src/stores → stores}/toaster.d.ts +0 -0
- /package/dist/{src/stores → stores}/unsubscribe.d.ts +0 -0
- /package/dist/{src/stores → stores}/version-history.d.ts +0 -0
- /package/dist/{src/utils → utils}/arrayUtil.d.ts +0 -0
- /package/dist/{src/utils → utils}/base64.d.ts +0 -0
- /package/dist/{src/utils → utils}/genericUtil.d.ts +0 -0
- /package/dist/{src/utils → utils}/htmlCompiler.d.ts +0 -0
- /package/dist/{src/utils → utils}/templatePreparation.d.ts +0 -0
- /package/dist/{src/utils → utils}/tooltipUtils.d.ts +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
var b = Object.defineProperty;
|
|
2
|
+
var y = (i, e, t) => e in i ? b(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
|
|
3
|
+
var p = (i, e, t) => y(i, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import h, { getDefaultProducts as x, prepareProductRows as C } from "../../extensions/Blocks/Recommendation/template.js";
|
|
5
|
+
class w {
|
|
6
|
+
constructor() {
|
|
7
|
+
p(this, "parser");
|
|
8
|
+
this.parser = new DOMParser();
|
|
9
|
+
}
|
|
10
|
+
migrate(e) {
|
|
11
|
+
try {
|
|
12
|
+
const t = this.parser.parseFromString(e, "text/html"), r = t.querySelectorAll(
|
|
13
|
+
'td.ins-recommendation-v3-block-1, td.product-block[esd-handler-name*="EmailRecommendationV3"]'
|
|
14
|
+
);
|
|
15
|
+
return r.length === 0 ? e : (r.forEach((o) => {
|
|
16
|
+
const n = o.getAttribute("id"), s = this.extractBgColor(o), c = this.extractTitle(o), a = this.extractProductRows(o), u = h.replace("{-{-TITLE-}-}", c).replace("{-{-PRODUCT_ROWS-}-}", a), l = this.parser.parseFromString(
|
|
17
|
+
`<table id="tempDoc"><tbody><tr>${u}</tr></tbody></table>`,
|
|
18
|
+
"text/html"
|
|
19
|
+
).querySelector(".ins-recommendation-v3-block-v2");
|
|
20
|
+
l && o.parentNode && (n && l.setAttribute("id", n), console.debug("BG Color", s), s && l.setAttribute("bgcolor", s), o.parentNode.replaceChild(l, o));
|
|
21
|
+
}), t.documentElement.outerHTML);
|
|
22
|
+
} catch (t) {
|
|
23
|
+
return console.error("RecommendationMigrator failed:", t), e;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Extracts background color from old block
|
|
28
|
+
*
|
|
29
|
+
* Checks for background color in the following priority order:
|
|
30
|
+
* 1. bgcolor attribute: `<td bgcolor="#f9f9f9">`
|
|
31
|
+
* 2. style attribute: `<td style="background-color: #f9f9f9;">`
|
|
32
|
+
* @example
|
|
33
|
+
* // From bgcolor attribute
|
|
34
|
+
* <td bgcolor="#ffffff"> → "#ffffff"
|
|
35
|
+
*
|
|
36
|
+
* // From style attribute
|
|
37
|
+
* <td style="background-color: rgb(255, 255, 255);"> → "rgb(255, 255, 255)"
|
|
38
|
+
*
|
|
39
|
+
* // No background color
|
|
40
|
+
* <td> → ""
|
|
41
|
+
* @param block - The old recommendation block element
|
|
42
|
+
* @returns The background color value (hex, rgb, rgba, named color) or empty string
|
|
43
|
+
*/
|
|
44
|
+
extractBgColor(e) {
|
|
45
|
+
const t = e.getAttribute("bgcolor");
|
|
46
|
+
if (console.debug("bg block", e), console.debug("bg attr", t), t)
|
|
47
|
+
return t.trim();
|
|
48
|
+
const r = e.getAttribute("style");
|
|
49
|
+
if (console.debug("bg style", r), r) {
|
|
50
|
+
const o = r.match(/background-color\s*:\s*([^;]+)/i);
|
|
51
|
+
if (o && o[1])
|
|
52
|
+
return o[1].trim();
|
|
53
|
+
}
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Extracts title from old block
|
|
58
|
+
*
|
|
59
|
+
* Old structure:
|
|
60
|
+
* <td class="ext-recommendation-title" align="right">
|
|
61
|
+
* <p style="color: #93c47d; font-weight: bold; font-style: italic; font-size: 28px;">
|
|
62
|
+
* This is amazing recommendation
|
|
63
|
+
* </p>
|
|
64
|
+
* </td>
|
|
65
|
+
*
|
|
66
|
+
* New structure (output):
|
|
67
|
+
* <td class="esd-block-text es-p10t es-p10b es-p20l es-p20r" align="center">
|
|
68
|
+
* <p path="1" style="font-size: 28px; color: #333333;">
|
|
69
|
+
* <strong path="1,0">Title Text</strong>
|
|
70
|
+
* </p>
|
|
71
|
+
* </td>
|
|
72
|
+
*/
|
|
73
|
+
extractTitle(e) {
|
|
74
|
+
var l, d;
|
|
75
|
+
const t = e.querySelector(".ext-recommendation-title");
|
|
76
|
+
if (!t)
|
|
77
|
+
return this.buildTitleBlock({
|
|
78
|
+
text: "You May Also Like!",
|
|
79
|
+
isBold: !0,
|
|
80
|
+
isItalic: !1,
|
|
81
|
+
align: "center",
|
|
82
|
+
styles: "font-size: 28px; color: #333333;"
|
|
83
|
+
});
|
|
84
|
+
const r = t.querySelector("p");
|
|
85
|
+
if (!r) {
|
|
86
|
+
const m = ((l = t.textContent) == null ? void 0 : l.trim()) || "You May Also Like!", f = t.getAttribute("align") || "center";
|
|
87
|
+
return this.buildTitleBlock({
|
|
88
|
+
text: m,
|
|
89
|
+
isBold: !0,
|
|
90
|
+
isItalic: !1,
|
|
91
|
+
align: f,
|
|
92
|
+
styles: "font-size: 28px; color: #333333;"
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const o = ((d = r.textContent) == null ? void 0 : d.trim()) || "You May Also Like!", n = t.getAttribute("align") || r.getAttribute("align") || "center", s = r.getAttribute("style") || "", c = /font-weight\s*:\s*bold/i.test(s) || !!r.querySelector("b, strong"), a = /font-style\s*:\s*italic/i.test(s) || !!r.querySelector("i, em"), u = this.removeStyleProperties(s, ["font-weight", "font-style"]), g = this.convertInlineToBlock(u);
|
|
96
|
+
return this.buildTitleBlock({
|
|
97
|
+
text: o,
|
|
98
|
+
isBold: c,
|
|
99
|
+
isItalic: a,
|
|
100
|
+
align: n,
|
|
101
|
+
styles: g
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Extracts product configuration from old block and generates new product rows
|
|
106
|
+
*
|
|
107
|
+
* Strategy:
|
|
108
|
+
* 1. Extract product count and layout configuration from old block
|
|
109
|
+
* 2. Use prepareProductRows() to generate new HTML structure with default product data
|
|
110
|
+
*
|
|
111
|
+
* The migrator uses default/placeholder product data from getDefaultProducts()
|
|
112
|
+
* to populate the new block structure.
|
|
113
|
+
*/
|
|
114
|
+
extractProductRows(e) {
|
|
115
|
+
const t = this.extractProductConfig(e);
|
|
116
|
+
if (!t)
|
|
117
|
+
return console.warn("[RecommendationMigrator] No product config found, using defaults"), this.generateProductRows(6, 3);
|
|
118
|
+
const { totalCount: r, rowCount: o } = t;
|
|
119
|
+
return this.generateProductRows(r, o);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Extracts product configuration from old block
|
|
123
|
+
*
|
|
124
|
+
* Parses esd-dev-product-config attribute:
|
|
125
|
+
* {"rowCount":3,"totalCount":6,"orientation":"vertical",...}
|
|
126
|
+
*/
|
|
127
|
+
extractProductConfig(e) {
|
|
128
|
+
const t = e.getAttribute("esd-dev-product-config");
|
|
129
|
+
if (!t)
|
|
130
|
+
return null;
|
|
131
|
+
try {
|
|
132
|
+
const r = t.replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), o = JSON.parse(r);
|
|
133
|
+
return {
|
|
134
|
+
totalCount: o.totalCount ?? 6,
|
|
135
|
+
rowCount: o.rowCount ?? 3
|
|
136
|
+
};
|
|
137
|
+
} catch (r) {
|
|
138
|
+
return console.error("[RecommendationMigrator] Failed to parse product config:", r), null;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Generates product rows using prepareProductRows with default product data
|
|
143
|
+
*
|
|
144
|
+
* Process:
|
|
145
|
+
* 1. Get default products from getDefaultProducts()
|
|
146
|
+
* 2. Create array of products (repeat defaults if needed to reach totalCount)
|
|
147
|
+
* 3. Call prepareProductRows() to generate HTML structure
|
|
148
|
+
*
|
|
149
|
+
* The generated HTML will contain placeholder/default product data
|
|
150
|
+
* which can be replaced with real data at runtime.
|
|
151
|
+
* @param totalCount - Total number of products (e.g., 6)
|
|
152
|
+
* @param productsPerRow - Products per row (e.g., 3)
|
|
153
|
+
*/
|
|
154
|
+
generateProductRows(e, t) {
|
|
155
|
+
const r = x(), o = [];
|
|
156
|
+
for (let n = 0; n < e; n++) {
|
|
157
|
+
const s = r[n % r.length];
|
|
158
|
+
o.push({ ...s });
|
|
159
|
+
}
|
|
160
|
+
return C(o, t);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Builds title block with proper structure
|
|
164
|
+
*/
|
|
165
|
+
buildTitleBlock(e) {
|
|
166
|
+
let t = e.text;
|
|
167
|
+
e.isBold && e.isItalic ? t = `<strong path="1,0"><em path="1,0,0">${t}</em></strong>` : e.isBold ? t = `<strong path="1,0">${t}</strong>` : e.isItalic && (t = `<em path="1,0">${t}</em>`);
|
|
168
|
+
const r = e.align ? ` align="${e.align}"` : "", o = e.styles ? ` style="${e.styles}"` : "";
|
|
169
|
+
return `
|
|
170
|
+
<td class="esd-block-text es-p10t es-p10b es-p20l es-p20r"${r}>
|
|
171
|
+
<p path="1"${o}>
|
|
172
|
+
${t}
|
|
173
|
+
</p>
|
|
174
|
+
</td>
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Removes specified style properties from a style string
|
|
179
|
+
* Helper from CheckboxMigrator
|
|
180
|
+
*/
|
|
181
|
+
removeStyleProperties(e, t) {
|
|
182
|
+
return e ? t.reduce((o, n) => {
|
|
183
|
+
const s = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
|
|
184
|
+
return o.replace(s, "");
|
|
185
|
+
}, e).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Converts inline display to block display
|
|
189
|
+
* Helper from CheckboxMigrator
|
|
190
|
+
*/
|
|
191
|
+
convertInlineToBlock(e) {
|
|
192
|
+
if (!e)
|
|
193
|
+
return "";
|
|
194
|
+
let t = e.replace(/display\s*:\s*inline/gi, "display: block");
|
|
195
|
+
return /display\s*:/i.test(t) || (t = t ? `${t}; display: block` : "display: block"), t.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function P(i) {
|
|
199
|
+
return new w().migrate(i);
|
|
200
|
+
}
|
|
201
|
+
export {
|
|
202
|
+
P as migrateRecommendation
|
|
203
|
+
};
|
package/dist/enums/defaults.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const a = {
|
|
2
2
|
translationsPath: "window.trans.en",
|
|
3
|
-
migrationDate: 1759696858,
|
|
4
3
|
emailHeader: {
|
|
5
4
|
senderName: "",
|
|
6
5
|
subject: ""
|
|
@@ -17,7 +16,7 @@ const a = {
|
|
|
17
16
|
}, t = {
|
|
18
17
|
promotional: 1,
|
|
19
18
|
transactional: 2
|
|
20
|
-
}, e = "email", o = "Guido User", n = t.promotional,
|
|
19
|
+
}, e = "email", o = "Guido User", n = t.promotional, s = 2, i = {
|
|
21
20
|
email: 60,
|
|
22
21
|
architect: 49
|
|
23
22
|
}, u = [
|
|
@@ -57,8 +56,8 @@ export {
|
|
|
57
56
|
n as DefaultMessageType,
|
|
58
57
|
e as DefaultProductType,
|
|
59
58
|
o as DefaultUsername,
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
s as EditorType,
|
|
60
|
+
i as ProductIds,
|
|
62
61
|
u as TEST_PARTNER_LIST,
|
|
63
62
|
t as TemplateTypes
|
|
64
63
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SERVICE_HOVER_SELECTORS: string[];
|
package/dist/enums/onboarding.js
CHANGED
|
@@ -2,8 +2,7 @@ const e = [
|
|
|
2
2
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-0.ng-star-inserted",
|
|
3
3
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-1.ng-star-inserted",
|
|
4
4
|
".service-element.stacked-panel-item.ng-tns-c1014751574-3.level-bottom-2.ng-star-inserted"
|
|
5
|
-
]
|
|
5
|
+
];
|
|
6
6
|
export {
|
|
7
|
-
t as ACADEMY_LINK,
|
|
8
7
|
e as SERVICE_HOVER_SELECTORS
|
|
9
8
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Block, BlockCompositionType } from '@stripoinc/ui-editor-extensions';
|
|
2
2
|
export declare const BLOCK_ID = "recommendation-block";
|
|
3
3
|
export declare class RecommendationBlock extends Block {
|
|
4
|
+
constructor();
|
|
4
5
|
getId(): string;
|
|
5
6
|
getIcon(): string;
|
|
6
7
|
getBlockCompositionType(): BlockCompositionType;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { getDefaultTemplate as o } from "./template.js";
|
|
3
3
|
const n = "recommendation-block";
|
|
4
|
-
class
|
|
4
|
+
class m extends e {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
}
|
|
5
8
|
getId() {
|
|
6
9
|
return n;
|
|
7
10
|
}
|
|
@@ -23,5 +26,5 @@ class c extends e {
|
|
|
23
26
|
}
|
|
24
27
|
export {
|
|
25
28
|
n as BLOCK_ID,
|
|
26
|
-
|
|
29
|
+
m as RecommendationBlock
|
|
27
30
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
import { CommonControl } from '../common-control';
|
|
3
|
+
export declare const COMPOSITION_CONTROL_BLOCK_ID = "ui-elements-recommendation-card-composition";
|
|
4
|
+
export interface CardCompositionItem {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class RecommendationCardCompositionControl extends CommonControl {
|
|
9
|
+
private currentComposition;
|
|
10
|
+
private currentStyling;
|
|
11
|
+
getId(): string;
|
|
12
|
+
getTemplate(): string;
|
|
13
|
+
_getTextColor(label: string, name: string): string;
|
|
14
|
+
_getFontFamily(label: string, name: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Generate styling controls for Product Name element
|
|
17
|
+
*/
|
|
18
|
+
private _getProductNameStylingControls;
|
|
19
|
+
/**
|
|
20
|
+
* Generate styling controls for Product Price element
|
|
21
|
+
*/
|
|
22
|
+
private _getProductPriceStylingControls;
|
|
23
|
+
/**
|
|
24
|
+
* Generate styling controls for Product Original Price element
|
|
25
|
+
*/
|
|
26
|
+
private _getProductOriginalPriceStylingControls;
|
|
27
|
+
/**
|
|
28
|
+
* Generate styling controls for Product Button element
|
|
29
|
+
*/
|
|
30
|
+
private _getProductButtonStylingControls;
|
|
31
|
+
onRender(): void;
|
|
32
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the composition order from the block or use defaults
|
|
35
|
+
*/
|
|
36
|
+
private _initializeComposition;
|
|
37
|
+
/**
|
|
38
|
+
* Apply the reordered composition to the block's HTML structure
|
|
39
|
+
*/
|
|
40
|
+
private _applyCompositionToBlock;
|
|
41
|
+
/**
|
|
42
|
+
* Initialize styling from stored block attributes
|
|
43
|
+
*/
|
|
44
|
+
private _initializeStyling;
|
|
45
|
+
/**
|
|
46
|
+
* Load default styling values and populate controls
|
|
47
|
+
*/
|
|
48
|
+
private _loadDefaultStyling;
|
|
49
|
+
/**
|
|
50
|
+
* Populate control values with current styling
|
|
51
|
+
*/
|
|
52
|
+
private _populateControlsWithStyling;
|
|
53
|
+
/**
|
|
54
|
+
* Update styling object for a specific element and property
|
|
55
|
+
*/
|
|
56
|
+
private _updateElementStyling;
|
|
57
|
+
/**
|
|
58
|
+
* Persist current styling to block attributes
|
|
59
|
+
*/
|
|
60
|
+
private _persistStyling;
|
|
61
|
+
/**
|
|
62
|
+
* Apply styling to a specific element in the DOM
|
|
63
|
+
*/
|
|
64
|
+
private _applyStylingToElement;
|
|
65
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var f = (c, l, t) => l in c ? h(c, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[l] = t;
|
|
3
|
+
var u = (c, l, t) => f(c, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
+
import { ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as y } from "../common-control.js";
|
|
6
|
+
const m = "ui-elements-recommendation-card-composition", d = [
|
|
7
|
+
{ key: "productImage", label: "Product Image" },
|
|
8
|
+
{ key: "productName", label: "Product Name" },
|
|
9
|
+
{ key: "productPrice", label: "Product Price" },
|
|
10
|
+
{ key: "productOriginalPrice", label: "Product Original Price" },
|
|
11
|
+
{ key: "productButton", label: "Product Button" }
|
|
12
|
+
];
|
|
13
|
+
class b extends y {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
u(this, "currentComposition", []);
|
|
17
|
+
u(this, "currentStyling", {});
|
|
18
|
+
}
|
|
19
|
+
getId() {
|
|
20
|
+
return m;
|
|
21
|
+
}
|
|
22
|
+
getTemplate() {
|
|
23
|
+
const t = d.map((e) => {
|
|
24
|
+
let i = "";
|
|
25
|
+
return e.key === "productName" ? i = this._getProductNameStylingControls() : e.key === "productPrice" ? i = this._getProductPriceStylingControls() : e.key === "productOriginalPrice" ? i = this._getProductOriginalPriceStylingControls() : e.key === "productButton" && (i = this._getProductButtonStylingControls()), {
|
|
26
|
+
key: e.key,
|
|
27
|
+
label: e.label,
|
|
28
|
+
content: i ? this._GuExpandable(e.label, i) : ""
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
return console.debug("orderable", this._GuOrderable("cardComposition", t)), `
|
|
32
|
+
<div class="container">
|
|
33
|
+
${this._GuLabel({ text: "Card Element Order" })}
|
|
34
|
+
${this._GuOrderable("cardComposition", t)}
|
|
35
|
+
</div>
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
_getTextColor(t, e) {
|
|
39
|
+
return `
|
|
40
|
+
${this._GuTwoColumns([
|
|
41
|
+
this._GuLabel({ text: t }),
|
|
42
|
+
this._GuColorPicker(e)
|
|
43
|
+
])}
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
_getFontFamily(t, e) {
|
|
47
|
+
return `
|
|
48
|
+
${this._GuTwoColumns([
|
|
49
|
+
this._GuLabel({ text: t }),
|
|
50
|
+
this._GuFontFamily(e, "Select Font")
|
|
51
|
+
])}
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate styling controls for Product Name element
|
|
56
|
+
*/
|
|
57
|
+
_getProductNameStylingControls() {
|
|
58
|
+
return `
|
|
59
|
+
${this._getTextColor("Text Color", "productName.color")}
|
|
60
|
+
|
|
61
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
62
|
+
${this._GuLabel({ text: "Text Alignment" })}
|
|
63
|
+
${this._GuRadioButtons("productName.textAlign", [
|
|
64
|
+
{ text: "Left", value: "left" },
|
|
65
|
+
{ text: "Center", value: "center" },
|
|
66
|
+
{ text: "Right", value: "right" },
|
|
67
|
+
{ text: "Justify", value: "justify" }
|
|
68
|
+
])}
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
${this._getFontFamily("Font Family", "productName.fontFamily")}
|
|
72
|
+
|
|
73
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
74
|
+
${this._GuLabel({ text: "Font Size (px)" })}
|
|
75
|
+
${this._GuCounter({ name: "productName.fontSize", minValue: 8, maxValue: 72, step: 1 })}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
79
|
+
${this._GuLabel({ text: "Text Style" })}
|
|
80
|
+
<div style="display: flex; flex-direction: column; gap: 8px; margin-top: 8px;">
|
|
81
|
+
${this._GuCheckbox("productName.fontWeight", "Bold")}
|
|
82
|
+
${this._GuCheckbox("productName.fontStyle", "Italic")}
|
|
83
|
+
${this._GuCheckbox("productName.textDecoration", "Underline")}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate styling controls for Product Price element
|
|
90
|
+
*/
|
|
91
|
+
_getProductPriceStylingControls() {
|
|
92
|
+
return `
|
|
93
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
94
|
+
${this._GuLabel({ text: "Text Color" })}
|
|
95
|
+
${this._GuColorPicker("productPrice.color")}
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
99
|
+
${this._GuLabel({ text: "Text Alignment" })}
|
|
100
|
+
${this._GuRadioButtons("productPrice.textAlign", [
|
|
101
|
+
{ text: "Left", value: "left" },
|
|
102
|
+
{ text: "Center", value: "center" },
|
|
103
|
+
{ text: "Right", value: "right" }
|
|
104
|
+
])}
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
108
|
+
${this._GuLabel({ text: "Font Size (px)" })}
|
|
109
|
+
${this._GuCounter({ name: "productPrice.fontSize", minValue: 8, maxValue: 48, step: 1 })}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
113
|
+
${this._GuCheckbox("productPrice.fontWeight", "Bold")}
|
|
114
|
+
</div>
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Generate styling controls for Product Original Price element
|
|
119
|
+
*/
|
|
120
|
+
_getProductOriginalPriceStylingControls() {
|
|
121
|
+
return `
|
|
122
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
123
|
+
${this._GuLabel({ text: "Text Color" })}
|
|
124
|
+
${this._GuColorPicker("productOriginalPrice.color")}
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
128
|
+
${this._GuLabel({ text: "Font Size (px)" })}
|
|
129
|
+
${this._GuCounter({ name: "productOriginalPrice.fontSize", minValue: 8, maxValue: 48, step: 1 })}
|
|
130
|
+
</div>
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Generate styling controls for Product Button element
|
|
135
|
+
*/
|
|
136
|
+
_getProductButtonStylingControls() {
|
|
137
|
+
return `
|
|
138
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
139
|
+
${this._GuLabel({ text: "Button Text Color" })}
|
|
140
|
+
${this._GuColorPicker("productButton.color")}
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
144
|
+
${this._GuLabel({ text: "Font Size (px)" })}
|
|
145
|
+
${this._GuCounter({ name: "productButton.fontSize", minValue: 10, maxValue: 32, step: 1 })}
|
|
146
|
+
</div>
|
|
147
|
+
|
|
148
|
+
<div class="control-group" style="padding: 10px 0;">
|
|
149
|
+
${this._GuCheckbox("productButton.fontWeight", "Bold")}
|
|
150
|
+
</div>
|
|
151
|
+
`;
|
|
152
|
+
}
|
|
153
|
+
onRender() {
|
|
154
|
+
this._initializeComposition(), this._initializeStyling(), this.api.onValueChanged("cardComposition", (t) => {
|
|
155
|
+
this.currentComposition = t, console.debug("Card composition reordered:", t), this._applyCompositionToBlock(t);
|
|
156
|
+
}), this.api.onValueChanged("productName.color", (t) => {
|
|
157
|
+
this._updateElementStyling("productName", "color", t), this._applyStylingToElement("productName");
|
|
158
|
+
}), this.api.onValueChanged("productName.textAlign", (t) => {
|
|
159
|
+
this._updateElementStyling("productName", "textAlign", t), this._applyStylingToElement("productName");
|
|
160
|
+
}), this.api.onValueChanged("productName.fontFamily", (t) => {
|
|
161
|
+
this._updateElementStyling("productName", "fontFamily", t), this._applyStylingToElement("productName");
|
|
162
|
+
}), this.api.onValueChanged("productName.fontSize", (t) => {
|
|
163
|
+
this._updateElementStyling("productName", "fontSize", t), this._applyStylingToElement("productName");
|
|
164
|
+
}), this.api.onValueChanged("productName.fontWeight", (t) => {
|
|
165
|
+
this._updateElementStyling("productName", "fontWeight", t), this._applyStylingToElement("productName");
|
|
166
|
+
}), this.api.onValueChanged("productName.fontStyle", (t) => {
|
|
167
|
+
this._updateElementStyling("productName", "fontStyle", t), this._applyStylingToElement("productName");
|
|
168
|
+
}), this.api.onValueChanged("productName.textDecoration", (t) => {
|
|
169
|
+
this._updateElementStyling("productName", "textDecoration", t), this._applyStylingToElement("productName");
|
|
170
|
+
}), this.api.onValueChanged("productPrice.color", (t) => {
|
|
171
|
+
this._updateElementStyling("productPrice", "color", t), this._applyStylingToElement("productPrice");
|
|
172
|
+
}), this.api.onValueChanged("productPrice.textAlign", (t) => {
|
|
173
|
+
this._updateElementStyling("productPrice", "textAlign", t), this._applyStylingToElement("productPrice");
|
|
174
|
+
}), this.api.onValueChanged("productPrice.fontSize", (t) => {
|
|
175
|
+
this._updateElementStyling("productPrice", "fontSize", t), this._applyStylingToElement("productPrice");
|
|
176
|
+
}), this.api.onValueChanged("productPrice.fontWeight", (t) => {
|
|
177
|
+
this._updateElementStyling("productPrice", "fontWeight", t), this._applyStylingToElement("productPrice");
|
|
178
|
+
}), this.api.onValueChanged("productOriginalPrice.color", (t) => {
|
|
179
|
+
this._updateElementStyling("productOriginalPrice", "color", t), this._applyStylingToElement("productOriginalPrice");
|
|
180
|
+
}), this.api.onValueChanged("productOriginalPrice.fontSize", (t) => {
|
|
181
|
+
this._updateElementStyling("productOriginalPrice", "fontSize", t), this._applyStylingToElement("productOriginalPrice");
|
|
182
|
+
}), this.api.onValueChanged("productButton.color", (t) => {
|
|
183
|
+
this._updateElementStyling("productButton", "color", t), this._applyStylingToElement("productButton");
|
|
184
|
+
}), this.api.onValueChanged("productButton.fontSize", (t) => {
|
|
185
|
+
this._updateElementStyling("productButton", "fontSize", t), this._applyStylingToElement("productButton");
|
|
186
|
+
}), this.api.onValueChanged("productButton.fontWeight", (t) => {
|
|
187
|
+
this._updateElementStyling("productButton", "fontWeight", t), this._applyStylingToElement("productButton");
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
onTemplateNodeUpdated(t) {
|
|
191
|
+
super.onTemplateNodeUpdated(t), this._initializeComposition();
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Initialize the composition order from the block or use defaults
|
|
195
|
+
*/
|
|
196
|
+
_initializeComposition() {
|
|
197
|
+
var i;
|
|
198
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(".ins-recommendation-v3-block-v2");
|
|
199
|
+
let e = null;
|
|
200
|
+
if (t && "getAttribute" in t && (e = t.getAttribute("data-card-composition")), e) {
|
|
201
|
+
const o = e.split(",").filter(Boolean), s = d.map((n) => n.key);
|
|
202
|
+
o.every((n) => s.includes(n)) && o.length > 0 ? this.currentComposition = o : this.currentComposition = s;
|
|
203
|
+
} else
|
|
204
|
+
this.currentComposition = d.map((o) => o.key);
|
|
205
|
+
this.api.updateValues({
|
|
206
|
+
cardComposition: this.currentComposition
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Apply the reordered composition to the block's HTML structure
|
|
211
|
+
*/
|
|
212
|
+
_applyCompositionToBlock(t) {
|
|
213
|
+
if (!this.currentNode)
|
|
214
|
+
return;
|
|
215
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
216
|
+
e && this.api.getDocumentModifier().modifyHtml(e).setAttribute("data-card-composition", t.join(",")).apply(new p("Stored card composition order")), console.debug("Card composition updated:", t);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Initialize styling from stored block attributes
|
|
220
|
+
*/
|
|
221
|
+
_initializeStyling() {
|
|
222
|
+
var i;
|
|
223
|
+
const t = (i = this.currentNode) == null ? void 0 : i.querySelector(".ins-recommendation-v3-block-v2");
|
|
224
|
+
if (!t || !("getAttribute" in t)) {
|
|
225
|
+
this._loadDefaultStyling();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const e = t.getAttribute("data-card-styling");
|
|
229
|
+
if (e)
|
|
230
|
+
try {
|
|
231
|
+
this.currentStyling = JSON.parse(e), this._populateControlsWithStyling();
|
|
232
|
+
} catch (o) {
|
|
233
|
+
console.error("Failed to parse stored styling:", o), this._loadDefaultStyling();
|
|
234
|
+
}
|
|
235
|
+
else
|
|
236
|
+
this._loadDefaultStyling();
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Load default styling values and populate controls
|
|
240
|
+
*/
|
|
241
|
+
_loadDefaultStyling() {
|
|
242
|
+
this.currentStyling = {
|
|
243
|
+
productName: {
|
|
244
|
+
color: "#333333",
|
|
245
|
+
textAlign: "center",
|
|
246
|
+
fontSize: 16,
|
|
247
|
+
fontWeight: !0
|
|
248
|
+
},
|
|
249
|
+
productPrice: {
|
|
250
|
+
color: "#333333",
|
|
251
|
+
textAlign: "center",
|
|
252
|
+
fontSize: 16,
|
|
253
|
+
fontWeight: !0
|
|
254
|
+
},
|
|
255
|
+
productOriginalPrice: {
|
|
256
|
+
color: "#999999",
|
|
257
|
+
fontSize: 14
|
|
258
|
+
},
|
|
259
|
+
productButton: {
|
|
260
|
+
color: "#333333",
|
|
261
|
+
fontSize: 16
|
|
262
|
+
}
|
|
263
|
+
}, this._populateControlsWithStyling();
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Populate control values with current styling
|
|
267
|
+
*/
|
|
268
|
+
_populateControlsWithStyling() {
|
|
269
|
+
const t = {};
|
|
270
|
+
if (this.currentStyling.productName) {
|
|
271
|
+
const e = this.currentStyling.productName;
|
|
272
|
+
e.color && (t["productName.color"] = e.color), e.textAlign && (t["productName.textAlign"] = e.textAlign), e.fontFamily && (t["productName.fontFamily"] = e.fontFamily), e.fontSize && (t["productName.fontSize"] = e.fontSize), e.fontWeight !== void 0 && (t["productName.fontWeight"] = e.fontWeight), e.fontStyle !== void 0 && (t["productName.fontStyle"] = e.fontStyle), e.textDecoration !== void 0 && (t["productName.textDecoration"] = e.textDecoration);
|
|
273
|
+
}
|
|
274
|
+
if (this.currentStyling.productPrice) {
|
|
275
|
+
const e = this.currentStyling.productPrice;
|
|
276
|
+
e.color && (t["productPrice.color"] = e.color), e.textAlign && (t["productPrice.textAlign"] = e.textAlign), e.fontSize && (t["productPrice.fontSize"] = e.fontSize), e.fontWeight !== void 0 && (t["productPrice.fontWeight"] = e.fontWeight);
|
|
277
|
+
}
|
|
278
|
+
if (this.currentStyling.productOriginalPrice) {
|
|
279
|
+
const e = this.currentStyling.productOriginalPrice;
|
|
280
|
+
e.color && (t["productOriginalPrice.color"] = e.color), e.fontSize && (t["productOriginalPrice.fontSize"] = e.fontSize);
|
|
281
|
+
}
|
|
282
|
+
if (this.currentStyling.productButton) {
|
|
283
|
+
const e = this.currentStyling.productButton;
|
|
284
|
+
e.color && (t["productButton.color"] = e.color), e.fontSize && (t["productButton.fontSize"] = e.fontSize), e.fontWeight !== void 0 && (t["productButton.fontWeight"] = e.fontWeight);
|
|
285
|
+
}
|
|
286
|
+
this.api.updateValues(t);
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Update styling object for a specific element and property
|
|
290
|
+
*/
|
|
291
|
+
_updateElementStyling(t, e, i) {
|
|
292
|
+
this.currentStyling[t] || (this.currentStyling[t] = {});
|
|
293
|
+
const o = this.currentStyling[t];
|
|
294
|
+
o && (e === "color" && typeof i == "string" ? o.color = i : e === "textAlign" && typeof i == "string" ? o.textAlign = i : e === "fontFamily" && typeof i == "string" ? o.fontFamily = i : e === "fontSize" && typeof i == "number" ? o.fontSize = i : e === "fontWeight" && typeof i == "boolean" ? o.fontWeight = i : e === "fontStyle" && typeof i == "boolean" ? o.fontStyle = i : e === "textDecoration" && typeof i == "boolean" && (o.textDecoration = i)), this._persistStyling();
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Persist current styling to block attributes
|
|
298
|
+
*/
|
|
299
|
+
_persistStyling() {
|
|
300
|
+
if (!this.currentNode)
|
|
301
|
+
return;
|
|
302
|
+
const t = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
303
|
+
t && this.api.getDocumentModifier().modifyHtml(t).setAttribute("data-card-styling", JSON.stringify(this.currentStyling)).apply(new p("Updated card element styling"));
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Apply styling to a specific element in the DOM
|
|
307
|
+
*/
|
|
308
|
+
_applyStylingToElement(t) {
|
|
309
|
+
if (!this.currentNode)
|
|
310
|
+
return;
|
|
311
|
+
const e = this.currentStyling[t];
|
|
312
|
+
if (!e)
|
|
313
|
+
return;
|
|
314
|
+
const o = {
|
|
315
|
+
productName: ".product-name-cell",
|
|
316
|
+
productPrice: ".price-cell .current-price",
|
|
317
|
+
productOriginalPrice: ".price-cell .old-price",
|
|
318
|
+
productButton: ".buy-button"
|
|
319
|
+
}[t];
|
|
320
|
+
if (!o)
|
|
321
|
+
return;
|
|
322
|
+
this.currentNode.querySelectorAll(o).forEach((a) => {
|
|
323
|
+
if (!a || !("style" in a))
|
|
324
|
+
return;
|
|
325
|
+
const n = [];
|
|
326
|
+
e.color && n.push(`color: ${e.color}`), e.textAlign && n.push(`text-align: ${e.textAlign}`), e.fontFamily && n.push(`font-family: ${e.fontFamily}`), e.fontSize && n.push(`font-size: ${e.fontSize}px`), e.fontWeight ? n.push("font-weight: bold") : e.fontWeight === !1 && n.push("font-weight: normal"), e.fontStyle ? n.push("font-style: italic") : e.fontStyle === !1 && n.push("font-style: normal"), e.textDecoration ? n.push("text-decoration: underline") : e.textDecoration === !1 && n.push("text-decoration: none");
|
|
327
|
+
const g = [...(("getAttribute" in a ? a.getAttribute("style") : null) || "").split(";").map((r) => r.trim()).filter((r) => r && !r.startsWith("color:") && !r.startsWith("text-align:") && !r.startsWith("font-family:") && !r.startsWith("font-size:") && !r.startsWith("font-weight:") && !r.startsWith("font-style:") && !r.startsWith("text-decoration:")), ...n].join("; ");
|
|
328
|
+
this.api.getDocumentModifier().modifyHtml(a).setAttribute("style", g).apply(new p(`Applied ${t} styling`));
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
export {
|
|
333
|
+
m as COMPOSITION_CONTROL_BLOCK_ID,
|
|
334
|
+
b as RecommendationCardCompositionControl
|
|
335
|
+
};
|