@useinsider/guido 1.4.4 → 2.0.0-beta.015a9b6
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 +295 -664
- package/dist/@types/config/defaults.js +44 -0
- package/dist/@types/config/schemas.js +231 -0
- package/dist/@types/config/validator.js +56 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +64 -86
- package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +7 -7
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue.js +7 -8
- package/dist/components/organisms/email-preview/amp/AmpToggle.vue2.js +4 -3
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +10 -14
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +18 -22
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +3 -3
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +13 -13
- package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue.js +10 -10
- package/dist/components/organisms/email-preview/mobile-preview/MobilePreview.vue2.js +15 -14
- package/dist/components/organisms/header/LeftSlot.vue.js +2 -2
- package/dist/components/organisms/header/LeftSlot.vue2.js +18 -15
- package/dist/components/organisms/header/MiddleSlot.vue.js +1 -1
- package/dist/components/organisms/header/MiddleSlot.vue2.js +14 -13
- package/dist/components/organisms/header/RightSlot.vue.js +12 -12
- package/dist/components/organisms/onboarding/NewVersionPopup.vue2.js +22 -19
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +4 -4
- package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +8 -8
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +17 -17
- package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +10 -10
- package/dist/composables/useActionsApi.js +42 -25
- package/dist/composables/useBlocksConfig.js +23 -20
- package/dist/composables/useConfig.js +51 -5
- package/dist/composables/useHtmlCompiler.js +20 -19
- package/dist/composables/useHtmlValidator.js +41 -41
- package/dist/composables/usePartner.js +19 -9
- package/dist/composables/useStripo.js +51 -50
- package/dist/composables/useTimerClone.js +53 -0
- package/dist/composables/useTranslations.js +3 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +1 -1
- package/dist/enums/defaults.js +4 -67
- package/dist/enums/unsubscribe.js +23 -20
- package/dist/extensions/Blocks/CouponBlock/constants.js +4 -0
- package/dist/extensions/Blocks/CouponBlock/controls/index.js +29 -0
- package/dist/extensions/Blocks/CouponBlock/extension.js +5 -4
- package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +20 -14
- package/dist/extensions/Blocks/CouponBlock/template.js +22 -11
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +12 -11
- package/dist/extensions/Blocks/controlFactories.js +122 -111
- package/dist/guido.css +1 -1
- package/dist/library.js +12 -2
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +57 -52
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +10 -10
- package/dist/node_modules/valibot/dist/index.js +476 -103
- package/dist/services/stripoApi.js +13 -14
- package/dist/services/templateLibraryApi.js +18 -18
- package/dist/src/@types/config/defaults.d.ts +68 -0
- package/dist/src/@types/config/index.d.ts +14 -0
- package/dist/src/@types/config/schemas.d.ts +509 -0
- package/dist/src/@types/config/types.d.ts +142 -0
- package/dist/src/@types/config/validator.d.ts +119 -0
- package/dist/src/@types/generic.d.ts +4 -45
- package/dist/src/components/Guido.vue.d.ts +13 -12
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +186 -2
- package/dist/src/composables/usePartner.d.ts +8 -0
- package/dist/src/composables/useTimerClone.d.ts +6 -0
- package/dist/src/enums/defaults.d.ts +5 -6
- package/dist/src/enums/unsubscribe.d.ts +5 -1
- package/dist/src/extensions/Blocks/CouponBlock/constants.d.ts +14 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +108 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/controlFactories.d.ts +30 -7
- package/dist/src/library.d.ts +3 -1
- package/dist/src/stores/config.d.ts +1564 -102
- package/dist/static/assets/desktop/desktop-mockup-center.svg.js +4 -0
- package/dist/static/assets/desktop/desktop-mockup-left.svg.js +4 -0
- package/dist/static/assets/desktop/desktop-mockup-right.svg.js +4 -0
- package/dist/static/assets/mobile/email-mockup.svg.js +4 -0
- package/dist/static/assets/mobile/inbox-mockup.svg.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +0 -10
- package/dist/stores/config.js +141 -9
- package/package.json +1 -1
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue.js +0 -17
- package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +0 -20
- package/dist/node_modules/lodash-es/_apply.js +0 -16
- package/dist/node_modules/lodash-es/_assignMergeValue.js +0 -8
- package/dist/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/lodash-es/_baseCreate.js +0 -17
- package/dist/node_modules/lodash-es/_baseKeysIn.js +0 -15
- package/dist/node_modules/lodash-es/_baseMerge.js +0 -20
- package/dist/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- package/dist/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/lodash-es/_cloneBuffer.js +0 -9
- package/dist/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/lodash-es/_copyArray.js +0 -9
- package/dist/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/lodash-es/_createAssigner.js +0 -15
- package/dist/node_modules/lodash-es/_defineProperty.js +0 -11
- package/dist/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/lodash-es/_nativeKeysIn.js +0 -10
- package/dist/node_modules/lodash-es/_overRest.js +0 -15
- package/dist/node_modules/lodash-es/_safeGet.js +0 -7
- package/dist/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/lodash-es/_shortOut.js +0 -16
- package/dist/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/lodash-es/isArrayLikeObject.js +0 -8
- package/dist/node_modules/lodash-es/isPlainObject.js +0 -16
- package/dist/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/lodash-es/merge.js +0 -8
- package/dist/node_modules/lodash-es/toPlainObject.js +0 -8
- package/dist/static/assets/inbox-mockup.svg.js +0 -4
- package/dist/static/assets/phone-mockup.svg.js +0 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useActionsApi as f } from "./useActionsApi.js";
|
|
2
|
+
import { useHttp as w } from "./useHttp.js";
|
|
3
|
+
import { useToaster as H } from "./useToaster.js";
|
|
4
|
+
import { useStripoApi as y } from "../services/stripoApi.js";
|
|
5
|
+
const O = () => {
|
|
6
|
+
const { handleError: c } = H(), { getToken: u } = y(), { post: d } = w(), { updateHtmlAndCss: l } = f(), s = (t) => /esd-timer-id="(\d+)"/.test(t), i = async (t, e) => {
|
|
7
|
+
try {
|
|
8
|
+
return (await d(
|
|
9
|
+
"https://plugins.stripo.email/api/v1/timers/clone",
|
|
10
|
+
{ html: t },
|
|
11
|
+
{
|
|
12
|
+
headers: {
|
|
13
|
+
"ES-PLUGIN-AUTH": `Bearer ${e}`,
|
|
14
|
+
"Content-Type": "application/json"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
)).data.html;
|
|
18
|
+
} catch (r) {
|
|
19
|
+
return c(r, "Failed to clone timer IDs"), null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
hasTimerBlocks: s,
|
|
24
|
+
cloneTimersInHtml: i,
|
|
25
|
+
cloneTimersOnSave: async (t) => {
|
|
26
|
+
if (!s(t))
|
|
27
|
+
return t;
|
|
28
|
+
const e = await u();
|
|
29
|
+
return e && await i(t, e) || t;
|
|
30
|
+
},
|
|
31
|
+
updateTimersOnLoad: async (t) => {
|
|
32
|
+
var e, r, o, m;
|
|
33
|
+
try {
|
|
34
|
+
const n = (r = (e = window.UIEditor) == null ? void 0 : e.getHtml) == null ? void 0 : r.call(e);
|
|
35
|
+
if (!n || !s(n))
|
|
36
|
+
return;
|
|
37
|
+
const p = await t();
|
|
38
|
+
if (!p)
|
|
39
|
+
return;
|
|
40
|
+
const a = await i(n, p);
|
|
41
|
+
if (!a || a === n)
|
|
42
|
+
return;
|
|
43
|
+
const T = ((m = (o = window.UIEditor) == null ? void 0 : o.getCss) == null ? void 0 : m.call(o)) || "";
|
|
44
|
+
l(a, T);
|
|
45
|
+
} catch (n) {
|
|
46
|
+
c(n, "Failed to update timer blocks");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
O as useTimerClone
|
|
53
|
+
};
|
|
@@ -2,10 +2,11 @@ import memoize from "../node_modules/lodash-es/memoize.js";
|
|
|
2
2
|
import { ref } from "vue";
|
|
3
3
|
import { useConfig } from "./useConfig.js";
|
|
4
4
|
const useTranslations = () => {
|
|
5
|
-
|
|
5
|
+
var o, e;
|
|
6
|
+
const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || "window.trans.en", translations = ref(eval(translationsPath)), trans = (n, t) => {
|
|
6
7
|
const r = translations.value[n];
|
|
7
8
|
return r ? t ? Object.entries(t).reduce(
|
|
8
|
-
(
|
|
9
|
+
(s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
|
|
9
10
|
r
|
|
10
11
|
) : r : (console.warn(`Translation key not found: ${n}`), n);
|
|
11
12
|
};
|
|
@@ -10,7 +10,7 @@ const D = [
|
|
|
10
10
|
description: "Adding unsubscribe link values",
|
|
11
11
|
type: "custom",
|
|
12
12
|
processor: (t) => {
|
|
13
|
-
const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.
|
|
13
|
+
const { getPartnerName: i } = N(), c = B(), n = y(), u = L(), a = c.variationId;
|
|
14
14
|
if (!a)
|
|
15
15
|
return t;
|
|
16
16
|
let e = t;
|
package/dist/enums/defaults.js
CHANGED
|
@@ -1,71 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
translationsPath: "window.trans.en",
|
|
3
|
-
migrationDate: 1759696858,
|
|
4
|
-
emailHeader: {
|
|
5
|
-
senderName: "",
|
|
6
|
-
subject: ""
|
|
7
|
-
},
|
|
8
|
-
extensions: {
|
|
9
|
-
unsubscribe: !0
|
|
10
|
-
},
|
|
11
|
-
blocks: {
|
|
12
|
-
excludeDefaults: [],
|
|
13
|
-
includeCustoms: []
|
|
14
|
-
},
|
|
15
|
-
features: {
|
|
16
|
-
dynamicContent: !0,
|
|
17
|
-
saveAsTemplate: !0,
|
|
18
|
-
versionHistory: !0,
|
|
19
|
-
testMessage: !0,
|
|
20
|
-
displayConditions: !0
|
|
21
|
-
},
|
|
22
|
-
useHeader: !0
|
|
23
|
-
}, t = {
|
|
24
|
-
promotional: 1,
|
|
1
|
+
const t = {
|
|
25
2
|
transactional: 2
|
|
26
|
-
},
|
|
27
|
-
email: 60,
|
|
28
|
-
architect: 49,
|
|
29
|
-
unsubscribePages: 97
|
|
30
|
-
}, u = [
|
|
31
|
-
"alfredtesting",
|
|
32
|
-
"electio",
|
|
33
|
-
"eurekatest",
|
|
34
|
-
"gachapontestpart",
|
|
35
|
-
"gluautomation1",
|
|
36
|
-
"gluautomation2",
|
|
37
|
-
"gluautomation3",
|
|
38
|
-
"gluautomation4",
|
|
39
|
-
"inone",
|
|
40
|
-
"inshoppingcart",
|
|
41
|
-
"krakentest",
|
|
42
|
-
"leeroy",
|
|
43
|
-
"newsletteruat",
|
|
44
|
-
"ozaspava",
|
|
45
|
-
"piratesquad",
|
|
46
|
-
"qaautomation1",
|
|
47
|
-
"qaautomation2",
|
|
48
|
-
"qaautomation3",
|
|
49
|
-
"qaautomation4",
|
|
50
|
-
"roiautomation",
|
|
51
|
-
"seleniumautomation",
|
|
52
|
-
"seleniumautomation1",
|
|
53
|
-
"seleniumautomation2",
|
|
54
|
-
"seleniumautomation3",
|
|
55
|
-
"shopbagg",
|
|
56
|
-
"shopifytest",
|
|
57
|
-
"singlepageqa",
|
|
58
|
-
"testqa",
|
|
59
|
-
"vikingsankara",
|
|
60
|
-
"stripoeditorlivetest"
|
|
61
|
-
];
|
|
3
|
+
}, o = 2, T = 13;
|
|
62
4
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
a as DefaultProductType,
|
|
66
|
-
o as DefaultUsername,
|
|
67
|
-
n as EditorType,
|
|
68
|
-
i as ProductIds,
|
|
69
|
-
u as TEST_PARTNER_LIST,
|
|
5
|
+
o as EditorType,
|
|
6
|
+
T as MAX_DEFAULT_TEMPLATE_ID,
|
|
70
7
|
t as TemplateTypes
|
|
71
8
|
};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { useTranslations as n } from "../composables/useTranslations.js";
|
|
2
2
|
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
-
const
|
|
3
|
+
const N = {
|
|
4
4
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
5
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
6
|
+
}, I = {
|
|
7
7
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
8
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
9
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
10
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
}, s = R(),
|
|
11
|
+
}, s = R(), i = {
|
|
12
12
|
UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
|
|
13
13
|
PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
|
|
14
|
-
},
|
|
14
|
+
}, _ = "iid", B = {
|
|
15
15
|
name: "Global Unsubscribe",
|
|
16
16
|
sendGridId: "G"
|
|
17
|
-
},
|
|
17
|
+
}, t = "https://academy.useinsider.com/docs/global-unsubscribe-preference-center", C = "/email/unsubscribe-pages", E = {
|
|
18
18
|
GLOBAL_UNSUBSCRIBE: 1,
|
|
19
19
|
GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
|
|
20
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
22
|
RESUBSCRIBE: 5
|
|
23
|
-
},
|
|
23
|
+
}, c = {
|
|
24
24
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
25
25
|
E.GLOBAL_UNSUBSCRIBE,
|
|
26
26
|
E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
|
|
@@ -30,27 +30,30 @@ const e = n(), I = {
|
|
|
30
30
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
31
31
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
32
32
|
]
|
|
33
|
-
}, U = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
}, U = () => {
|
|
34
|
+
const e = n();
|
|
35
|
+
return {
|
|
36
|
+
[E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
|
|
37
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
38
|
+
[E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
|
|
39
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
|
|
40
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
41
|
+
};
|
|
39
42
|
}, o = {
|
|
40
43
|
default: "{{ins-unsubscribe-link}}",
|
|
41
44
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
42
45
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
43
46
|
};
|
|
44
47
|
export {
|
|
45
|
-
|
|
48
|
+
t as ACADEMY_LINK,
|
|
46
49
|
B as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
_ as INSIDER_ID,
|
|
51
|
+
I as LINK_REGEXES,
|
|
52
|
+
N as LINK_TYPES,
|
|
50
53
|
o as MERGE_TAGS,
|
|
51
54
|
E as PAGE_TYPES,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
c as TYPE_COLLECTIONS,
|
|
56
|
+
C as UNSUBSCRIBE_PAGES_LINK,
|
|
57
|
+
i as URLS,
|
|
58
|
+
U as getTypeTranslations
|
|
56
59
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var t = /* @__PURE__ */ ((c) => (c.TEXT_ALIGN = "coupon-block-text-align-control", c.TEXT_COLOR = "coupon-block-text-color-control", c.TEXT_SIZE = "coupon-block-text-size-control", c.TEXT_STYLE = "coupon-block-text-style-control", c.TEXT_FONT_FAMILY = "coupon-block-text-font-family-control", c.TEXT_BACKGROUND = "coupon-block-text-background-control", c.TEXT_PADDINGS = "coupon-block-text-paddings-control", c.TEXT_LINE_SPACING = "coupon-block-text-line-spacing-control", c))(t || {});
|
|
2
|
+
export {
|
|
3
|
+
t as CouponControlId
|
|
4
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createTextAlignControl as t, createTextColorControl as e, createTextSizeControl as n, createTextStyleControl as r, createTextFontFamilyControl as T, createTextBackgroundColorControl as l, createPaddingsControl as C, createTextLineSpacingControl as c } from "../../controlFactories.js";
|
|
2
|
+
import { CouponControlId as o } from "../constants.js";
|
|
3
|
+
const i = t(
|
|
4
|
+
o.TEXT_ALIGN
|
|
5
|
+
), E = e(
|
|
6
|
+
o.TEXT_COLOR
|
|
7
|
+
), s = n(
|
|
8
|
+
o.TEXT_SIZE
|
|
9
|
+
), S = r(
|
|
10
|
+
o.TEXT_STYLE
|
|
11
|
+
), _ = T(
|
|
12
|
+
o.TEXT_FONT_FAMILY
|
|
13
|
+
), g = l(
|
|
14
|
+
o.TEXT_BACKGROUND
|
|
15
|
+
), X = C(
|
|
16
|
+
o.TEXT_PADDINGS
|
|
17
|
+
), d = c(
|
|
18
|
+
o.TEXT_LINE_SPACING
|
|
19
|
+
);
|
|
20
|
+
export {
|
|
21
|
+
i as TextAlignControl,
|
|
22
|
+
g as TextBackgroundControl,
|
|
23
|
+
E as TextColorControl,
|
|
24
|
+
_ as TextFontFamilyControl,
|
|
25
|
+
d as TextLineSpacingControl,
|
|
26
|
+
X as TextPaddingsControl,
|
|
27
|
+
s as TextSizeControl,
|
|
28
|
+
S as TextStyleControl
|
|
29
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { CouponBlock as t } from "./block.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { TextAlignControl as n, TextColorControl as r, TextSizeControl as l, TextStyleControl as d, TextFontFamilyControl as e, TextBackgroundControl as i, TextPaddingsControl as C, TextLineSpacingControl as a } from "./controls/index.js";
|
|
4
|
+
import { CouponIconsRegistry as s } from "./iconsRegistry.js";
|
|
5
|
+
import { CouponBlockSettings as m } from "./settingsPanel.js";
|
|
6
|
+
const u = new o().addBlock(t).withSettingsPanelRegistry(m).addControl(n).addControl(r).addControl(l).addControl(d).addControl(e).addControl(i).addControl(C).addControl(a).withIconsRegistry(s).build();
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
u as default
|
|
8
9
|
};
|
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import { SettingsPanelRegistry as
|
|
2
|
-
import { COUPON_BLOCK_ID as
|
|
3
|
-
|
|
1
|
+
import { SettingsPanelRegistry as n, SettingsPanelTab as o, SettingsTab as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { COUPON_BLOCK_ID as E } from "./block.js";
|
|
3
|
+
import { CouponControlId as T } from "./constants.js";
|
|
4
|
+
class i extends n {
|
|
4
5
|
registerBlockControls(e) {
|
|
5
|
-
e[
|
|
6
|
+
e[E] = [
|
|
6
7
|
new o(
|
|
7
|
-
|
|
8
|
+
t.SETTINGS,
|
|
8
9
|
[
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
T.TEXT_STYLE,
|
|
11
|
+
T.TEXT_ALIGN,
|
|
12
|
+
T.TEXT_PADDINGS
|
|
13
|
+
]
|
|
14
|
+
),
|
|
15
|
+
new o(
|
|
16
|
+
t.STYLES,
|
|
17
|
+
[
|
|
18
|
+
T.TEXT_BACKGROUND,
|
|
19
|
+
T.TEXT_FONT_FAMILY,
|
|
20
|
+
T.TEXT_LINE_SPACING,
|
|
21
|
+
T.TEXT_SIZE,
|
|
22
|
+
T.TEXT_COLOR
|
|
17
23
|
]
|
|
18
24
|
)
|
|
19
25
|
];
|
|
20
26
|
}
|
|
21
27
|
}
|
|
22
28
|
export {
|
|
23
|
-
|
|
29
|
+
i as CouponBlockSettings
|
|
24
30
|
};
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
esd-extension-block-id="
|
|
1
|
+
import { BlockType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { COUPON_BLOCK_ID as e } from "./block.js";
|
|
3
|
+
const t = `
|
|
4
|
+
<${o.BLOCK_TEXT}
|
|
5
|
+
class="coupon-block ins-coupon-code coupon-block-v2 es-p10"
|
|
6
|
+
align="center"
|
|
7
|
+
esd-extension-block-id="${e}">
|
|
8
|
+
<p
|
|
9
|
+
path="1"
|
|
10
|
+
contenteditable="false"
|
|
11
|
+
style="font-size: 16px; color: #333333;">
|
|
12
|
+
<strong path="1,0">{@COUPON_CODE}</strong>
|
|
13
|
+
</p>
|
|
14
|
+
</${o.BLOCK_TEXT}>
|
|
15
|
+
`, l = `
|
|
16
|
+
<td
|
|
17
|
+
class="coupon-block coupon-block-v2 ins-coupon-code esd-block-text esd-extension-block"
|
|
18
|
+
esd-extension-block-id="${e}"
|
|
8
19
|
>
|
|
9
20
|
<p class="ins-title" contenteditable="false">{@COUPON_CODE}</p>
|
|
10
21
|
</td>
|
|
11
22
|
`;
|
|
12
|
-
function
|
|
13
|
-
return
|
|
23
|
+
function s() {
|
|
24
|
+
return t;
|
|
14
25
|
}
|
|
15
26
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
l as default,
|
|
28
|
+
s as getDefaultTemplate
|
|
18
29
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { RecommendationFeedSourceMaps as
|
|
2
|
-
import { useRecommendationApi as
|
|
1
|
+
import { RecommendationFeedSourceMaps as n, PriceAttributes as u } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as l } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as c } from "../../../../stores/config.js";
|
|
3
4
|
import { defineStore as p } from "pinia";
|
|
4
5
|
import { generateCompleteFilterQuery as m } from "../utils/filterUtil.js";
|
|
5
|
-
const a =
|
|
6
|
+
const a = l(), d = () => ({
|
|
6
7
|
recommendationCampaignUrls: {},
|
|
7
8
|
recommendationProducts: [],
|
|
8
9
|
recommendationConfigs: {
|
|
@@ -133,7 +134,7 @@ const a = c(), d = () => ({
|
|
|
133
134
|
filterSelectionDrawerStatus: !1,
|
|
134
135
|
filterList: {},
|
|
135
136
|
filterGroup: 1
|
|
136
|
-
}),
|
|
137
|
+
}), y = p("guidoRecommendationExtension", {
|
|
137
138
|
state: () => d(),
|
|
138
139
|
getters: {
|
|
139
140
|
hasFilters: (e) => !!e.recommendationConfigs.filters.length,
|
|
@@ -144,7 +145,7 @@ const a = c(), d = () => ({
|
|
|
144
145
|
getActivePredictiveAlgorithms: (e) => {
|
|
145
146
|
const t = [];
|
|
146
147
|
return e.activePredictiveAlgorithms.forEach((r) => {
|
|
147
|
-
t.push(...
|
|
148
|
+
t.push(...n.filter((i) => i.id === r));
|
|
148
149
|
}), t.map((r) => ({
|
|
149
150
|
text: r.name,
|
|
150
151
|
value: r.key
|
|
@@ -159,7 +160,7 @@ const a = c(), d = () => ({
|
|
|
159
160
|
value: t.text
|
|
160
161
|
})),
|
|
161
162
|
getFilterList: (e) => Object.values(e.filterList).map((t) => {
|
|
162
|
-
const r = t.type === "defaultAttribute", i =
|
|
163
|
+
const r = t.type === "defaultAttribute", i = u.includes(t.attributeName);
|
|
163
164
|
let o = r ? t.attributeName : `product_attributes.${t.attributeName}`;
|
|
164
165
|
return o = i ? `${o}.${e.recommendationConfigs.currencySettings.value}` : o, {
|
|
165
166
|
text: t.displayName,
|
|
@@ -240,14 +241,14 @@ const a = c(), d = () => ({
|
|
|
240
241
|
return m(this.recommendationConfigs.filters);
|
|
241
242
|
},
|
|
242
243
|
async fetchRecommendationProducts() {
|
|
243
|
-
var
|
|
244
|
-
const e = this.generateFilterQuery(), t = ((
|
|
244
|
+
var o;
|
|
245
|
+
const e = this.generateFilterQuery(), t = ((o = n.find((s) => s.key === this.recommendationConfigs.strategy)) == null ? void 0 : o.path) || "", r = c(), i = await a.fetchRecommendationProducts(
|
|
245
246
|
t,
|
|
246
247
|
{
|
|
247
248
|
// TODO: Here will be optimized and filled carefully
|
|
248
249
|
locale: this.recommendationConfigs.language,
|
|
249
250
|
currency: this.recommendationConfigs.currencySettings.value,
|
|
250
|
-
partnerName:
|
|
251
|
+
partnerName: r.partnerName,
|
|
251
252
|
productId: this.recommendationConfigs.strategy === "manualMerchandising" ? this.recommendationConfigs.productIds.join(",") : "{itemId}",
|
|
252
253
|
size: this.recommendationConfigs.size,
|
|
253
254
|
details: !0,
|
|
@@ -256,11 +257,11 @@ const a = c(), d = () => ({
|
|
|
256
257
|
}
|
|
257
258
|
);
|
|
258
259
|
this.$patch({
|
|
259
|
-
recommendationProducts:
|
|
260
|
+
recommendationProducts: i
|
|
260
261
|
});
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
});
|
|
264
265
|
export {
|
|
265
|
-
|
|
266
|
+
y as useRecommendationExtensionStore
|
|
266
267
|
};
|