@useinsider/guido 1.0.3-beta.b722a77 → 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/dist/{src/@types → @types}/generic.d.ts +4 -0
- package/dist/components/Guido.vue.js +7 -7
- package/dist/components/Guido.vue2.js +36 -35
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +19 -0
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +28 -0
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +38 -0
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +37 -0
- package/dist/components/organisms/extensions/recommendation/Filters.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +44 -0
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.d.ts +16 -0
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +27 -0
- 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 +37 -36
- 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/extensions/recommendationBlock.d.ts +16 -0
- package/dist/enums/extensions/recommendationBlock.js +80 -0
- package/dist/extensions/Blocks/RadioButton/template.js +6 -6
- package/dist/extensions/Blocks/Recommendation/block.d.ts +11 -0
- package/dist/extensions/Blocks/Recommendation/block.js +30 -0
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +65 -0
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +335 -0
- package/dist/extensions/Blocks/Recommendation/control.d.ts +35 -0
- package/dist/extensions/Blocks/Recommendation/control.js +305 -0
- 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 +29 -0
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.d.ts +4 -0
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +51 -0
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +19 -0
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +72 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.d.ts +555 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +266 -0
- package/dist/extensions/Blocks/Recommendation/template.d.ts +43 -0
- package/dist/extensions/Blocks/Recommendation/template.js +314 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +7 -0
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +28 -0
- package/dist/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +4 -0
- package/dist/extensions/Blocks/common-control.d.ts +87 -0
- package/dist/extensions/Blocks/common-control.js +184 -0
- package/dist/extensions/DynamicContent/extension.d.ts +2 -0
- package/dist/guido.css +1 -1
- package/dist/mock/api/validator.d.ts +2 -0
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +293 -97
- package/dist/services/recommendationApi.d.ts +6 -0
- package/dist/services/recommendationApi.js +43 -0
- package/dist/{src/stores → stores}/editor.d.ts +21 -0
- package/dist/stores/editor.js +2 -1
- package/dist/{src/utils → utils}/genericUtil.d.ts +1 -0
- package/dist/utils/genericUtil.js +8 -7
- package/package.json +3 -8
- package/dist/package.json.js +0 -7
- /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}/Guido.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/organisms/header/LeftSlot.vue.d.ts → components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/header/MiddleSlot.vue.d.ts → components/organisms/extensions/recommendation/Filters.vue.d.ts} +0 -0
- /package/dist/{src/components → components}/organisms/header/HeaderWrapper.vue.d.ts +0 -0
- /package/dist/{src/components/organisms/header/ViewOptions.vue.d.ts → components/organisms/header/LeftSlot.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/header/version-history/RestoreButton.vue.d.ts → 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/organisms/header/version-history → components/organisms/header}/ViewOptions.vue.d.ts +0 -0
- /package/dist/{src/components/organisms/onboarding/AMPOnboarding.vue.d.ts → 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/organisms/onboarding/GenericOnboarding.vue.d.ts → components/organisms/header/version-history/ViewOptions.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/onboarding/NewVersionPopup.vue.d.ts → components/organisms/onboarding/AMPOnboarding.vue.d.ts} +0 -0
- /package/dist/{src/components/organisms/onboarding/OnboardingWrapper.vue.d.ts → 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}/html-validator.d.ts +0 -0
- /package/dist/{src/enums → enums}/onboarding.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/Blocks/Unsubscribe → extensions/Blocks/Recommendation}/extension.d.ts +0 -0
- /package/dist/{src/extensions/Blocks/Unsubscribe → extensions/Blocks/Recommendation}/settingsPanel.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/Blocks/_Boilerplate → extensions/Blocks/Unsubscribe}/extension.d.ts +0 -0
- /package/dist/{src/extensions → extensions}/Blocks/Unsubscribe/iconsRegistry.d.ts +0 -0
- /package/dist/{src/extensions/Blocks/_Boilerplate → 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/DynamicContent → 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/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/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/api/template-library.d.ts → mock/api/recommendation.d.ts} +0 -0
- /package/dist/{src/mock/api/unsubscribe.d.ts → mock/api/template-library.d.ts} +0 -0
- /package/dist/{src/mock/api/user-modal-state.d.ts → mock/api/unsubscribe.d.ts} +0 -0
- /package/dist/{src/mock/api/validator.d.ts → mock/api/user-modal-state.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}/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}/config.d.ts +0 -0
- /package/dist/{src/stores → stores}/dynamic-content.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}/dateUtil.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,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
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CommonControl } from '../common-control';
|
|
2
|
+
export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
|
|
3
|
+
export declare class RecommendationBlockControl extends CommonControl {
|
|
4
|
+
private store;
|
|
5
|
+
private storeUnsubscription;
|
|
6
|
+
private addFilterListener;
|
|
7
|
+
private addFilterButton;
|
|
8
|
+
getId(): string;
|
|
9
|
+
getTemplate(): string;
|
|
10
|
+
onRender(): Promise<void>;
|
|
11
|
+
onDestroy(): void;
|
|
12
|
+
_setFormValues(): void;
|
|
13
|
+
_initializeSelectItems(): void;
|
|
14
|
+
_getAlgorithms(): string;
|
|
15
|
+
_getLanguages(): string;
|
|
16
|
+
_getCurrency(): string;
|
|
17
|
+
_getProductLayout(): string;
|
|
18
|
+
_getFilterStatus(): string;
|
|
19
|
+
_getShuffleProducts(): string;
|
|
20
|
+
_getResponsive(): string;
|
|
21
|
+
_onFilterChange(value: boolean): void;
|
|
22
|
+
_onFilterSelectClick(): void;
|
|
23
|
+
_onDataChange(item: string, value: string | number | string[]): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get the current card composition from block data attribute or use default
|
|
26
|
+
*/
|
|
27
|
+
_getCardComposition(): string[];
|
|
28
|
+
_regenerateProductRows(): void;
|
|
29
|
+
_debouncedRegenerateProductRows: import("@vueuse/shared").PromisifyFn<() => void>;
|
|
30
|
+
_onCurrencyConfigChange(item: string, value: string | number): void;
|
|
31
|
+
_onCurrencyChange(value: string): void;
|
|
32
|
+
_setProductIdsVisibility(): void;
|
|
33
|
+
_listenToFormUpdates(): void;
|
|
34
|
+
_listenStateUpdates(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var R = (s, n, e) => n in s ? _(s, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[n] = e;
|
|
3
|
+
var r = (s, n, e) => R(s, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { currencyDecimalCounts as l, currencyOperators as c, currencyLocationMaps as h } from "../../../enums/extensions/recommendationBlock.js";
|
|
5
|
+
import { UEAttr as m, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as g } from "../common-control.js";
|
|
7
|
+
import { useRecommendationExtensionStore as O } from "./store/recommendation.js";
|
|
8
|
+
import { DEFAULT_CARD_COMPOSITION as C, getDefaultProducts as p, prepareProductRows as E } from "./template.js";
|
|
9
|
+
import { useDebounceFn as U } from "../../../node_modules/@vueuse/shared/index.js";
|
|
10
|
+
const L = "ui-elements-recommendation-block", t = {
|
|
11
|
+
ALGORITHM: "strategy",
|
|
12
|
+
PRODUCT_IDS: "productIds",
|
|
13
|
+
LOCALE: "language",
|
|
14
|
+
CURRENCY: "value",
|
|
15
|
+
CURRENCY_LOCATION: "alignment",
|
|
16
|
+
CURRENCY_SYMBOL: "symbol",
|
|
17
|
+
CURRENCY_THOUSAND_SEPARATOR: "thousandSeparator",
|
|
18
|
+
CURRENCY_DECIMAL_SEPARATOR: "decimalSeparator",
|
|
19
|
+
CURRENCY_DECIMAL_COUNT: "decimalCount",
|
|
20
|
+
FILTERS: "filterStatus",
|
|
21
|
+
PRODUCT_COUNT: "size",
|
|
22
|
+
PRODUCT_IN_ROW: "cardsInRow",
|
|
23
|
+
SHUFFLE_PRODUCTS: "shuffleProducts",
|
|
24
|
+
RESPONSIVE: "unresponsive"
|
|
25
|
+
};
|
|
26
|
+
class y extends g {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
r(this, "store", O());
|
|
30
|
+
r(this, "storeUnsubscription", () => {
|
|
31
|
+
});
|
|
32
|
+
r(this, "addFilterListener", () => {
|
|
33
|
+
});
|
|
34
|
+
r(this, "addFilterButton", null);
|
|
35
|
+
r(this, "_debouncedRegenerateProductRows", U(() => {
|
|
36
|
+
this._regenerateProductRows();
|
|
37
|
+
}, 500));
|
|
38
|
+
}
|
|
39
|
+
getId() {
|
|
40
|
+
return L;
|
|
41
|
+
}
|
|
42
|
+
getTemplate() {
|
|
43
|
+
return `
|
|
44
|
+
<div class="recommendation-controls-container">
|
|
45
|
+
${this._getAlgorithms()}
|
|
46
|
+
${this._getLanguages()}
|
|
47
|
+
${this._getCurrency()}
|
|
48
|
+
${this._getFilterStatus()}
|
|
49
|
+
${this._getProductLayout()}
|
|
50
|
+
${this._getShuffleProducts()}
|
|
51
|
+
${this._getResponsive()}
|
|
52
|
+
</div>
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
async onRender() {
|
|
56
|
+
await Promise.all([
|
|
57
|
+
this.store.fetchRecommendationFilters(),
|
|
58
|
+
this.store.fetchRecommendationCreateData(),
|
|
59
|
+
this.store.fetchRecommendationProducts()
|
|
60
|
+
// TODO: We need to change the location. It's just for testing
|
|
61
|
+
]), this._listenStateUpdates(), this._initializeSelectItems(), this._setFormValues(), this._listenToFormUpdates();
|
|
62
|
+
}
|
|
63
|
+
onDestroy() {
|
|
64
|
+
var e;
|
|
65
|
+
(e = this.addFilterButton) == null || e.removeEventListener("click", this.addFilterListener), this.storeUnsubscription();
|
|
66
|
+
}
|
|
67
|
+
_setFormValues() {
|
|
68
|
+
const e = this.store.recommendationConfigs;
|
|
69
|
+
this._setProductIdsVisibility(), this.api.updateValues({
|
|
70
|
+
[t.ALGORITHM]: e.strategy,
|
|
71
|
+
[t.PRODUCT_IDS]: e.productIds.join(","),
|
|
72
|
+
[t.CURRENCY]: e.currencySettings.value,
|
|
73
|
+
[t.LOCALE]: e.language,
|
|
74
|
+
[t.CURRENCY_LOCATION]: e.currencySettings.alignment,
|
|
75
|
+
[t.CURRENCY_SYMBOL]: e.currencySettings.symbol,
|
|
76
|
+
[t.CURRENCY_THOUSAND_SEPARATOR]: e.currencySettings.thousandSeparator,
|
|
77
|
+
[t.CURRENCY_DECIMAL_SEPARATOR]: e.currencySettings.decimalSeparator,
|
|
78
|
+
[t.CURRENCY_DECIMAL_COUNT]: e.currencySettings.decimalCount,
|
|
79
|
+
[t.PRODUCT_COUNT]: e.size,
|
|
80
|
+
[t.PRODUCT_IN_ROW]: e.cardsInRow,
|
|
81
|
+
[t.SHUFFLE_PRODUCTS]: e.shuffleProducts,
|
|
82
|
+
[t.RESPONSIVE]: !e.unresponsive
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
_initializeSelectItems() {
|
|
86
|
+
const { store: e } = this, o = e.getActivePredictiveAlgorithms, i = e.getLanguages, a = {
|
|
87
|
+
[t.ALGORITHM]: o,
|
|
88
|
+
[t.LOCALE]: i,
|
|
89
|
+
[t.CURRENCY]: e.currencyList,
|
|
90
|
+
[t.CURRENCY_LOCATION]: h,
|
|
91
|
+
[t.CURRENCY_SYMBOL]: e.getCurrencySymbolList,
|
|
92
|
+
[t.CURRENCY_THOUSAND_SEPARATOR]: c,
|
|
93
|
+
[t.CURRENCY_DECIMAL_SEPARATOR]: c,
|
|
94
|
+
[t.CURRENCY_DECIMAL_COUNT]: l,
|
|
95
|
+
[t.PRODUCT_COUNT]: Number(e.recommendationConfigs.size),
|
|
96
|
+
[t.PRODUCT_IN_ROW]: e.recommendationConfigs.cardsInRow,
|
|
97
|
+
[t.SHUFFLE_PRODUCTS]: e.recommendationConfigs.shuffleProducts,
|
|
98
|
+
[t.RESPONSIVE]: !e.recommendationConfigs.unresponsive
|
|
99
|
+
};
|
|
100
|
+
Object.entries(a).forEach(([u, d]) => {
|
|
101
|
+
this.api.setUIEAttribute(u, m.SELECTPICKER.items, d);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
_getAlgorithms() {
|
|
105
|
+
return `
|
|
106
|
+
${this._GuTwoColumns([
|
|
107
|
+
this._GuLabel({ text: "Recommendation Algorithm" }),
|
|
108
|
+
this._GuSelect({
|
|
109
|
+
name: t.ALGORITHM,
|
|
110
|
+
placeholder: "Select Recommendation Algorithm",
|
|
111
|
+
options: this.store.getActivePredictiveAlgorithms
|
|
112
|
+
}),
|
|
113
|
+
this._GuLabel({ text: "Product Ids", name: `${t.PRODUCT_IDS}_label` }),
|
|
114
|
+
this._GuTextInput({
|
|
115
|
+
name: t.PRODUCT_IDS,
|
|
116
|
+
placeholder: "Enter Product Ids",
|
|
117
|
+
className: "es-180w"
|
|
118
|
+
})
|
|
119
|
+
])}
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
_getLanguages() {
|
|
123
|
+
return `
|
|
124
|
+
${this._GuTwoColumns([
|
|
125
|
+
this._GuLabel({ text: "Recommendation Locale" }),
|
|
126
|
+
this._GuSelect({
|
|
127
|
+
name: t.LOCALE,
|
|
128
|
+
placeholder: "Select Recommendation Locale",
|
|
129
|
+
options: this.store.getLanguages
|
|
130
|
+
})
|
|
131
|
+
])}
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
_getCurrency() {
|
|
135
|
+
return `
|
|
136
|
+
${this._GuTwoColumns([
|
|
137
|
+
this._GuLabel({ text: "Currency" }),
|
|
138
|
+
this._GuSelect({
|
|
139
|
+
name: t.CURRENCY,
|
|
140
|
+
placeholder: "Select Currency",
|
|
141
|
+
options: this.store.currencyList
|
|
142
|
+
}),
|
|
143
|
+
this._GuLabel({ text: "Currency Location" }),
|
|
144
|
+
this._GuSelect({
|
|
145
|
+
name: t.CURRENCY_LOCATION,
|
|
146
|
+
placeholder: "Select Currency Location",
|
|
147
|
+
options: h
|
|
148
|
+
}),
|
|
149
|
+
this._GuLabel({ text: "Currency Symbol" }),
|
|
150
|
+
this._GuSelect({
|
|
151
|
+
name: t.CURRENCY_SYMBOL,
|
|
152
|
+
placeholder: "Select Currency Symbol",
|
|
153
|
+
options: this.store.getCurrencySymbolList
|
|
154
|
+
}),
|
|
155
|
+
this._GuLabel({ text: "Thousand Separator" }),
|
|
156
|
+
this._GuSelect({
|
|
157
|
+
name: t.CURRENCY_THOUSAND_SEPARATOR,
|
|
158
|
+
placeholder: "Select Thousand Separator",
|
|
159
|
+
options: c
|
|
160
|
+
}),
|
|
161
|
+
this._GuLabel({ text: "Decimal Separator" }),
|
|
162
|
+
this._GuSelect({
|
|
163
|
+
name: t.CURRENCY_DECIMAL_SEPARATOR,
|
|
164
|
+
placeholder: "Select Decimal Separator",
|
|
165
|
+
options: c
|
|
166
|
+
}),
|
|
167
|
+
this._GuLabel({ text: "Decimal Count" }),
|
|
168
|
+
this._GuSelect({
|
|
169
|
+
name: t.CURRENCY_DECIMAL_COUNT,
|
|
170
|
+
placeholder: "Select Decimal Count",
|
|
171
|
+
options: l
|
|
172
|
+
})
|
|
173
|
+
])}
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
_getProductLayout() {
|
|
177
|
+
return `
|
|
178
|
+
${this._GuTwoColumns([
|
|
179
|
+
this._GuLabel({ text: "Number of Products" }),
|
|
180
|
+
this._GuCounter({ name: t.PRODUCT_COUNT, maxValue: 9 }),
|
|
181
|
+
this._GuLabel({ text: "Products in One Row" }),
|
|
182
|
+
this._GuCounter({ name: t.PRODUCT_IN_ROW, maxValue: 4 })
|
|
183
|
+
])}
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
_getFilterStatus() {
|
|
187
|
+
return `
|
|
188
|
+
${this._GuTwoColumns([
|
|
189
|
+
this._GuLabel({ text: "Filters" }),
|
|
190
|
+
this._GuButton({
|
|
191
|
+
name: t.FILTERS,
|
|
192
|
+
label: "Add Filter",
|
|
193
|
+
id: "guido__btn-add-filter"
|
|
194
|
+
})
|
|
195
|
+
])}
|
|
196
|
+
`;
|
|
197
|
+
}
|
|
198
|
+
_getShuffleProducts() {
|
|
199
|
+
return `
|
|
200
|
+
${this._GuTwoColumns([
|
|
201
|
+
this._GuLabel({ text: "Shuffle Recommended Products" }),
|
|
202
|
+
this._GuToggle(t.SHUFFLE_PRODUCTS)
|
|
203
|
+
])}
|
|
204
|
+
`;
|
|
205
|
+
}
|
|
206
|
+
_getResponsive() {
|
|
207
|
+
return `
|
|
208
|
+
${this._GuTwoColumns([
|
|
209
|
+
this._GuLabel({ text: "Responsive Block" }),
|
|
210
|
+
this._GuToggle(t.RESPONSIVE)
|
|
211
|
+
])}
|
|
212
|
+
`;
|
|
213
|
+
}
|
|
214
|
+
_onFilterChange(e) {
|
|
215
|
+
this.currentNode && this.store.$patch({
|
|
216
|
+
filterStatus: e,
|
|
217
|
+
filterSelectionDrawerStatus: e
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
_onFilterSelectClick() {
|
|
221
|
+
this.store.$patch({
|
|
222
|
+
filterSelectionDrawerStatus: !0
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
_onDataChange(e, o) {
|
|
226
|
+
this.currentNode && (this.store.$patch({
|
|
227
|
+
recommendationConfigs: {
|
|
228
|
+
[e]: o
|
|
229
|
+
}
|
|
230
|
+
}), this._debouncedRegenerateProductRows());
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Get the current card composition from block data attribute or use default
|
|
234
|
+
*/
|
|
235
|
+
_getCardComposition() {
|
|
236
|
+
if (!this.currentNode)
|
|
237
|
+
return C;
|
|
238
|
+
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
239
|
+
if (!e || !("getAttribute" in e))
|
|
240
|
+
return C;
|
|
241
|
+
const o = e.getAttribute("data-card-composition");
|
|
242
|
+
return o ? o.split(",").filter(Boolean) : C;
|
|
243
|
+
}
|
|
244
|
+
_regenerateProductRows() {
|
|
245
|
+
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
246
|
+
return;
|
|
247
|
+
const e = this.currentNode.querySelector(".ins-recommendation-product-container");
|
|
248
|
+
if (!e) {
|
|
249
|
+
console.error("Could not find container table for product rows");
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const o = this.store.recommendationProducts.length > 0 ? this.store.recommendationProducts : p(), { cardsInRow: i } = this.store.recommendationConfigs, a = this._getCardComposition(), u = E(o, i, a);
|
|
253
|
+
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(u).apply(new S("Updated product"));
|
|
254
|
+
}
|
|
255
|
+
_onCurrencyConfigChange(e, o) {
|
|
256
|
+
this.currentNode && this.store.$patch({
|
|
257
|
+
recommendationConfigs: {
|
|
258
|
+
currencySettings: {
|
|
259
|
+
[e]: o
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
_onCurrencyChange(e) {
|
|
265
|
+
const [, o] = e.split(".");
|
|
266
|
+
this.store.$patch({
|
|
267
|
+
recommendationConfigs: {
|
|
268
|
+
currencySettings: {
|
|
269
|
+
name: o,
|
|
270
|
+
value: o
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
_setProductIdsVisibility() {
|
|
276
|
+
const { recommendationConfigs: e } = this.store, o = e.strategy === "manualMerchandising";
|
|
277
|
+
this.api.setVisibility(t.PRODUCT_IDS, o), this.api.setVisibility(`${t.PRODUCT_IDS}_label`, o);
|
|
278
|
+
}
|
|
279
|
+
_listenToFormUpdates() {
|
|
280
|
+
var o;
|
|
281
|
+
this.api.onValueChanged(t.ALGORITHM, (i) => {
|
|
282
|
+
this._onDataChange(t.ALGORITHM, i), this._setProductIdsVisibility();
|
|
283
|
+
}), this.api.onValueChanged(t.PRODUCT_IDS, (i) => this._onDataChange(t.PRODUCT_IDS, i.split(",") || [])), this.api.onValueChanged(t.LOCALE, (i) => this._onDataChange(t.LOCALE, i)), this.api.onValueChanged(t.CURRENCY, (i) => this._onCurrencyChange(i)), [
|
|
284
|
+
t.CURRENCY_LOCATION,
|
|
285
|
+
t.CURRENCY_SYMBOL,
|
|
286
|
+
t.CURRENCY_THOUSAND_SEPARATOR,
|
|
287
|
+
t.CURRENCY_DECIMAL_SEPARATOR,
|
|
288
|
+
t.CURRENCY_DECIMAL_COUNT
|
|
289
|
+
].forEach((i) => {
|
|
290
|
+
this.api.onValueChanged(i, (a) => this._onCurrencyConfigChange(i, a));
|
|
291
|
+
}), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => this._onDataChange(t.PRODUCT_COUNT, i.toString())), this.api.onValueChanged(t.PRODUCT_IN_ROW, (i) => this._onDataChange(t.PRODUCT_IN_ROW, i)), this.api.onValueChanged(t.SHUFFLE_PRODUCTS, (i) => this._onDataChange(t.SHUFFLE_PRODUCTS, i)), this.api.onValueChanged(t.RESPONSIVE, (i) => this._onDataChange(t.RESPONSIVE, i)), this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (o = this.addFilterButton) == null || o.addEventListener("click", this.addFilterListener);
|
|
292
|
+
}
|
|
293
|
+
_listenStateUpdates() {
|
|
294
|
+
this.storeUnsubscription = this.store.$subscribe((e) => {
|
|
295
|
+
if ("payload" in e) {
|
|
296
|
+
const o = e.payload.recommendationConfigs;
|
|
297
|
+
o && (this.api.updateValues(o), this.store.fetchRecommendationProducts());
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
export {
|
|
303
|
+
L as CONTROL_BLOCK_ID,
|
|
304
|
+
y as RecommendationBlockControl
|
|
305
|
+
};
|