@useinsider/guido 2.1.0-beta.bcfc012 → 2.1.0-beta.bd5d1ea
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 +41 -2
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +66 -66
- package/dist/components/organisms/base/Toaster.vue.js +4 -4
- package/dist/components/organisms/base/Toaster.vue2.js +12 -9
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +5 -5
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue.js +10 -12
- package/dist/components/organisms/header/EditorActions.vue2.js +31 -41
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +66 -62
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +45 -0
- package/dist/config/i18n/en/labels.json.js +3 -8
- package/dist/config/migrator/itemsBlockMigrator.js +138 -139
- package/dist/config/migrator/recommendationMigrator.js +40 -42
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/extensions/Blocks/Items/block.js +25 -45
- package/dist/extensions/Blocks/Items/iconsRegistry.js +5 -40
- package/dist/extensions/Blocks/Items/items.css.js +0 -48
- package/dist/extensions/Blocks/Recommendation/block.js +29 -49
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +2 -37
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +0 -48
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/extensions/Blocks/common-control.js +4 -12
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +55 -19
- package/dist/src/@types/config/schemas.d.ts +1 -1
- package/dist/src/@types/events.d.ts +38 -2
- package/dist/src/components/Guido.vue.d.ts +2 -2
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
- package/dist/src/composables/useGuidoActions.d.ts +1 -1
- package/dist/src/composables/useSave.d.ts +2 -2
- package/dist/src/composables/useStripo.d.ts +2 -2
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -5
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/utils/templatePreparation.d.ts +1 -1
- package/dist/stores/editor.js +2 -1
- package/dist/stores/unsubscribe.js +37 -34
- package/dist/utils/templatePreparation.js +1 -1
- package/package.json +2 -2
- package/dist/components/organisms/header/MigrationConfirmModal.vue.js +0 -21
- package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +0 -38
- package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +0 -5
- package/dist/src/stores/template.d.ts +0 -3
- package/dist/stores/template.js +0 -9
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
2
|
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
-
const
|
|
3
|
+
const _ = {
|
|
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
|
-
},
|
|
12
|
-
UNSUBSCRIBE_URL: `https://mail.${
|
|
13
|
-
PREFERENCES_URL: `https://mail.${
|
|
14
|
-
},
|
|
11
|
+
}, n = R(), r = {
|
|
12
|
+
UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
|
|
13
|
+
PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
|
|
14
|
+
}, B = "iid", i = {
|
|
15
15
|
name: "Global Unsubscribe",
|
|
16
16
|
sendGridId: "G"
|
|
17
17
|
}, C = "/email/unsubscribe-pages", E = {
|
|
@@ -20,6 +20,9 @@ const I = {
|
|
|
20
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
22
|
RESUBSCRIBE: 5
|
|
23
|
+
}, U = {
|
|
24
|
+
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
23
26
|
}, t = {
|
|
24
27
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
25
28
|
E.GLOBAL_UNSUBSCRIBE,
|
|
@@ -30,29 +33,30 @@ const I = {
|
|
|
30
33
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
31
34
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
32
35
|
]
|
|
33
|
-
},
|
|
34
|
-
const
|
|
36
|
+
}, c = () => {
|
|
37
|
+
const s = e();
|
|
35
38
|
return {
|
|
36
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
37
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
38
|
-
[E.RESUBSCRIBE]:
|
|
39
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
40
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
39
|
+
[E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
|
|
40
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
41
|
+
[E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
|
|
42
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
|
|
43
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
41
44
|
};
|
|
42
|
-
},
|
|
45
|
+
}, o = {
|
|
43
46
|
default: "{{ins-unsubscribe-link}}",
|
|
44
47
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
45
48
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
46
49
|
};
|
|
47
50
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
i as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
52
|
+
B as INSIDER_ID,
|
|
53
|
+
I as LINK_REGEXES,
|
|
54
|
+
_ as LINK_TYPES,
|
|
55
|
+
o as MERGE_TAGS,
|
|
53
56
|
E as PAGE_TYPES,
|
|
54
57
|
t as TYPE_COLLECTIONS,
|
|
55
58
|
C as UNSUBSCRIBE_PAGES_LINK,
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
U as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
60
|
+
r as URLS,
|
|
61
|
+
c as getTypeTranslations
|
|
58
62
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { useOnboardingStore as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class M extends u {
|
|
1
|
+
import { useOnboardingStore as d } from "../../../stores/onboarding.js";
|
|
2
|
+
import { Block as g, BlockCompositionType as f, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
import { SETTINGS_ENUMS as c, DefaultConfigValues as i } from "./enums/settingsEnums.js";
|
|
4
|
+
import { getDefaultTemplate as p } from "./template.js";
|
|
5
|
+
import { getItemsBlockContainer as u, getItemsBlockConfig as C, getDefaultItemsBlockConfig as I } from "./utils/nodeConfigUtils.js";
|
|
6
|
+
const y = "items-block";
|
|
7
|
+
class B extends g {
|
|
9
8
|
getId() {
|
|
10
|
-
return
|
|
9
|
+
return y;
|
|
11
10
|
}
|
|
12
11
|
getIcon() {
|
|
13
12
|
return "items-icon";
|
|
14
13
|
}
|
|
15
14
|
getBlockCompositionType() {
|
|
16
|
-
return
|
|
15
|
+
return f.CONTAINER;
|
|
17
16
|
}
|
|
18
17
|
getName() {
|
|
19
18
|
return this.api.translate("Items");
|
|
@@ -21,54 +20,35 @@ class M extends u {
|
|
|
21
20
|
getDescription() {
|
|
22
21
|
return this.api.translate("Items lets you display personalized products based on user behavior.");
|
|
23
22
|
}
|
|
24
|
-
getSettingsPanelTitleHtml() {
|
|
25
|
-
if (f().migrations[m] === 0)
|
|
26
|
-
return "";
|
|
27
|
-
const n = this.api.translate("Items"), o = this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.");
|
|
28
|
-
return `<div>
|
|
29
|
-
<div style="display: flex; align-items: center;">
|
|
30
|
-
<span>${n}</span>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="items-migration-info">
|
|
33
|
-
<${c.ICON}
|
|
34
|
-
${C.ICON.src}="migration-info-icon"
|
|
35
|
-
class="items-migration-info__icon">
|
|
36
|
-
</${c.ICON}>
|
|
37
|
-
<p class="items-migration-info__text">
|
|
38
|
-
${o}
|
|
39
|
-
</p>
|
|
40
|
-
</div>
|
|
41
|
-
</div>`;
|
|
42
|
-
}
|
|
43
23
|
getTemplate() {
|
|
44
|
-
return
|
|
45
|
-
orientation:
|
|
46
|
-
itemsType:
|
|
24
|
+
return p({
|
|
25
|
+
orientation: c.ORIENTATION.VERTICAL,
|
|
26
|
+
itemsType: c.ITEMS_TYPE.CART_ITEMS,
|
|
47
27
|
itemId: "{{Abandoned Cart Item (1) Url}}",
|
|
48
|
-
currencySymbol:
|
|
49
|
-
currencyLocation:
|
|
50
|
-
formattedPrice:
|
|
28
|
+
currencySymbol: i.productPriceCurrencySymbolControlValue,
|
|
29
|
+
currencyLocation: i.productPriceCurrencyLocationControlValue,
|
|
30
|
+
formattedPrice: i.productPriceFormattedControlValue === "1"
|
|
51
31
|
});
|
|
52
32
|
}
|
|
53
33
|
allowInnerBlocksDND() {
|
|
54
34
|
return !1;
|
|
55
35
|
}
|
|
56
|
-
onCreated(
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const e =
|
|
36
|
+
onCreated(n) {
|
|
37
|
+
const s = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
|
|
38
|
+
r.querySelector('[product-attr="imageSrc"] img') || s.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
39
|
+
const e = u(n);
|
|
60
40
|
if (!e)
|
|
61
41
|
return;
|
|
62
|
-
const a = e.getNodeConfig(),
|
|
42
|
+
const a = e.getNodeConfig(), l = a && Object.keys(a).length > 0, t = C(n);
|
|
63
43
|
if (t != null && t.initialized)
|
|
64
|
-
|
|
44
|
+
l ? t.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...t, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(t).apply(new o("Migrate legacy config to nodeConfig"));
|
|
65
45
|
else {
|
|
66
|
-
const
|
|
67
|
-
this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(
|
|
46
|
+
const m = I();
|
|
47
|
+
this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(m).apply(new o("Initialize Items block with default configuration")), d().startOnboarding("itemsOnboarding");
|
|
68
48
|
}
|
|
69
49
|
}
|
|
70
50
|
}
|
|
71
51
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
y as BLOCK_ID,
|
|
53
|
+
B as ItemsBlock
|
|
74
54
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IconsRegistry as
|
|
2
|
-
class
|
|
1
|
+
import { IconsRegistry as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
class i extends o {
|
|
3
3
|
registerIconsSvg(t) {
|
|
4
4
|
t["items-icon"] = `
|
|
5
5
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -19,49 +19,14 @@ class e extends C {
|
|
|
19
19
|
</svg>
|
|
20
20
|
`, t["horizontal-orientation"] = `
|
|
21
21
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
22
|
-
<path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
|
|
22
|
+
<path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
|
|
23
23
|
stroke-width="2" fill="none"/>
|
|
24
|
-
<path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
|
|
24
|
+
<path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
|
|
25
25
|
stroke-width="2" fill="none"/>
|
|
26
26
|
</svg>
|
|
27
|
-
`, t["migration-info-icon"] = `
|
|
28
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
29
|
-
<g transform="translate(3, 2.5)">
|
|
30
|
-
<path d="M6.87812 0.141942C10.7873 -0.580665 14.6797 1.51065 16.201 5.16436C17.7344
|
|
31
|
-
8.84685 16.432 13.0909 13.0906 15.3015C9.77511 17.4946 5.36819 17.08 2.52785
|
|
32
|
-
14.3193L2.46105 14.2536C0.882709 12.6854 -0.00259777 10.5591 5.72603e-06
|
|
33
|
-
8.34301L0.000643642 8.24974C0.0491816 4.30543 2.87651 0.926565 6.78576
|
|
34
|
-
0.159555L6.87812 0.141942ZM14.5911 5.82406C13.3749 2.90345 10.2486 1.24158 7.12372
|
|
35
|
-
1.85468C3.99888 2.46779 1.74568 5.18516 1.74194 8.34505C1.73988 10.1027 2.44203
|
|
36
|
-
11.789 3.69379 13.0328C5.94435 15.269 9.4739 15.617 12.1241 13.8638C14.7742 12.1106
|
|
37
|
-
15.8071 8.74458 14.5911 5.82406Z" fill="#258DDE"/>
|
|
38
|
-
<path d="M12.5195 13.5806C12.8537 13.2479 13.3933 13.2417 13.7351 13.5628L13.7512
|
|
39
|
-
13.5783L17.7437 17.5239C18.0845 17.8607 18.0856 18.4077 17.7461 18.7458C17.4066
|
|
40
|
-
19.0838 16.8551 19.0849 16.5143 18.7481L12.5218 14.8025L12.5061 14.7866C12.1811
|
|
41
|
-
14.4487 12.1853 13.9134 12.5195 13.5806Z" fill="#258DDE"/>
|
|
42
|
-
<path d="M6.71262 5.42913C6.37248 5.09172 5.82105 5.09172 5.48092 5.42913C5.14079
|
|
43
|
-
5.76655 5.14079 6.3136 5.48092 6.65104L6.71262 5.42913ZM7.80353 8.95504C8.14367
|
|
44
|
-
9.29246 8.69506 9.29246 9.0352 8.95504C9.37534 8.61762 9.37534 8.07053 9.0352
|
|
45
|
-
7.73311L7.80353 8.95504ZM9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353
|
|
46
|
-
7.73311C7.46339 8.07053 7.46339 8.61762 7.80353 8.95504L9.0352 7.73311ZM10.1261
|
|
47
|
-
11.259C10.4663 11.5965 11.0176 11.5965 11.3578 11.259C11.6979 10.9216 11.6979
|
|
48
|
-
10.3745 11.3578 10.0371L10.1261 11.259ZM9.0352 8.95504C9.37534 8.61762 9.37534
|
|
49
|
-
8.07053 9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353 7.73311L9.0352
|
|
50
|
-
8.95504ZM5.48092 10.0371C5.14079 10.3745 5.14079 10.9216 5.48092 11.259C5.82105
|
|
51
|
-
11.5965 6.37248 11.5965 6.71262 11.259L5.48092 10.0371ZM7.80353 7.73311C7.46339
|
|
52
|
-
8.07053 7.46339 8.61762 7.80353 8.95504C8.14367 9.29246 8.69506 9.29246 9.0352
|
|
53
|
-
8.95504L7.80353 7.73311ZM11.3578 6.65104C11.6979 6.3136 11.6979 5.76655 11.3578
|
|
54
|
-
5.42913C11.0176 5.09172 10.4663 5.09172 10.1261 5.42913L11.3578 6.65104ZM5.48092
|
|
55
|
-
6.65104L7.80353 8.95504L9.0352 7.73311L6.71262 5.42913L5.48092 6.65104ZM7.80353
|
|
56
|
-
8.95504L10.1261 11.259L11.3578 10.0371L9.0352 7.73311L7.80353 8.95504ZM7.80353
|
|
57
|
-
7.73311L5.48092 10.0371L6.71262 11.259L9.0352 8.95504L7.80353 7.73311ZM9.0352
|
|
58
|
-
8.95504L11.3578 6.65104L10.1261 5.42913L7.80353 7.73311L9.0352 8.95504Z"
|
|
59
|
-
fill="#258DDE"/>
|
|
60
|
-
</g>
|
|
61
|
-
</svg>
|
|
62
27
|
`;
|
|
63
28
|
}
|
|
64
29
|
}
|
|
65
30
|
export {
|
|
66
|
-
|
|
31
|
+
i as ItemsIconsRegistry
|
|
67
32
|
};
|
|
@@ -17,54 +17,6 @@ const n = `/* Utils */
|
|
|
17
17
|
.container:has(.items-controls-container) {
|
|
18
18
|
padding: 0
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
/* ─── Migration Info Box ─────────────────────────────────────────────── */
|
|
22
|
-
/* Shown in the settings panel title when a block was migrated from legacy */
|
|
23
|
-
|
|
24
|
-
/* Layout variables for positioning the absolutely-placed info box */
|
|
25
|
-
:host {
|
|
26
|
-
--items-migration-padding: 16px;
|
|
27
|
-
--items-migration-title-height: 61px;
|
|
28
|
-
--items-migration-box-height: 98px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/* Push tabs down when info box is present inside the control panel header */
|
|
32
|
-
.control-panel-header:has(.items-migration-info) {
|
|
33
|
-
position: relative;
|
|
34
|
-
margin-bottom: calc(2 * var(--items-migration-padding) + var(--items-migration-box-height));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/* Info box container */
|
|
38
|
-
.items-migration-info {
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: flex-start;
|
|
41
|
-
gap: 8px;
|
|
42
|
-
padding: 12px;
|
|
43
|
-
background: var(--guido-color-background-onpage-message-info);
|
|
44
|
-
border: 1px solid var(--guido-color-border-onpage-message-info);
|
|
45
|
-
border-radius: 4px;
|
|
46
|
-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
47
|
-
position: absolute;
|
|
48
|
-
left: var(--items-migration-padding);
|
|
49
|
-
right: var(--items-migration-padding);
|
|
50
|
-
top: calc(var(--items-migration-padding) + var(--items-migration-title-height));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/* Icon — 18x19 icon inside a 24x24 bounding box (matches Figma) */
|
|
54
|
-
.items-migration-info__icon {
|
|
55
|
-
flex-shrink: 0;
|
|
56
|
-
width: 24px;
|
|
57
|
-
height: 24px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* Text content */
|
|
61
|
-
.items-migration-info__text {
|
|
62
|
-
margin: 4px 0;
|
|
63
|
-
white-space: normal;
|
|
64
|
-
font-size: 13px;
|
|
65
|
-
font-weight: 400;
|
|
66
|
-
line-height: 16px;
|
|
67
|
-
}
|
|
68
20
|
`;
|
|
69
21
|
export {
|
|
70
22
|
n as default
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (r, o, t) =>
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ensureMobileCssRulesExist as u } from "./controls/mobileLayout/cssRules.js";
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var f = (r, o, t) => o in r ? p(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
|
|
3
|
+
var g = (r, o, t) => f(r, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { Block as h, BlockCompositionType as I, ModificationDescription as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { ensureMobileCssRulesExist as d } from "./controls/mobileLayout/cssRules.js";
|
|
7
6
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { getDefaultTemplate as
|
|
10
|
-
const
|
|
11
|
-
class
|
|
7
|
+
import { useRecommendationExtensionStore as u } from "./store/recommendation.js";
|
|
8
|
+
import { getDefaultTemplate as k } from "./templates/grid/template.js";
|
|
9
|
+
const B = "recommendation-block", c = "ins-recommendation-v3-block-v2", a = "recommendation-id";
|
|
10
|
+
class y extends h {
|
|
12
11
|
constructor() {
|
|
13
12
|
super();
|
|
14
13
|
/**
|
|
@@ -18,13 +17,13 @@ class E extends _ {
|
|
|
18
17
|
g(this, "_pendingBlockId", null);
|
|
19
18
|
}
|
|
20
19
|
getId() {
|
|
21
|
-
return
|
|
20
|
+
return B;
|
|
22
21
|
}
|
|
23
22
|
getIcon() {
|
|
24
23
|
return "recommendation-icon";
|
|
25
24
|
}
|
|
26
25
|
getBlockCompositionType() {
|
|
27
|
-
return
|
|
26
|
+
return I.CONTAINER;
|
|
28
27
|
}
|
|
29
28
|
getName() {
|
|
30
29
|
return this.api.translate("Recommendation Block");
|
|
@@ -32,25 +31,6 @@ class E extends _ {
|
|
|
32
31
|
getDescription() {
|
|
33
32
|
return this.api.translate("Recommendation Block Title Description");
|
|
34
33
|
}
|
|
35
|
-
getSettingsPanelTitleHtml() {
|
|
36
|
-
if (k().migrations[f] === 0)
|
|
37
|
-
return "";
|
|
38
|
-
const e = this.api.translate("Recommendation Block"), i = this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.");
|
|
39
|
-
return `<div>
|
|
40
|
-
<div style="display: flex; align-items: center;">
|
|
41
|
-
<span>${e}</span>
|
|
42
|
-
</div>
|
|
43
|
-
<div class="recommendation-migration-info">
|
|
44
|
-
<${d.ICON}
|
|
45
|
-
${C.ICON.src}="migration-info-icon"
|
|
46
|
-
class="recommendation-migration-info__icon">
|
|
47
|
-
</${d.ICON}>
|
|
48
|
-
<p class="recommendation-migration-info__text">
|
|
49
|
-
${i}
|
|
50
|
-
</p>
|
|
51
|
-
</div>
|
|
52
|
-
</div>`;
|
|
53
|
-
}
|
|
54
34
|
/**
|
|
55
35
|
* Returns the template HTML for a new recommendation block.
|
|
56
36
|
* Generates a unique recommendation ID and embeds the instance class
|
|
@@ -60,7 +40,7 @@ class E extends _ {
|
|
|
60
40
|
*/
|
|
61
41
|
getTemplate() {
|
|
62
42
|
const t = this._generateNextId();
|
|
63
|
-
return this._pendingBlockId = t,
|
|
43
|
+
return this._pendingBlockId = t, k(t);
|
|
64
44
|
}
|
|
65
45
|
/**
|
|
66
46
|
* Called when a new block is dropped into the template
|
|
@@ -72,8 +52,8 @@ class E extends _ {
|
|
|
72
52
|
onCreated(t) {
|
|
73
53
|
const e = this._pendingBlockId ?? this._generateNextId();
|
|
74
54
|
this._pendingBlockId = null, this._assignRecommendationId(t, e);
|
|
75
|
-
const
|
|
76
|
-
|
|
55
|
+
const n = s.initializeConfig(this.api, t, { recommendationId: e }), i = u();
|
|
56
|
+
i.setCurrentBlock(e), d(this.api), i.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
|
|
77
57
|
}
|
|
78
58
|
/**
|
|
79
59
|
* Called when the document changes or template is loaded
|
|
@@ -93,7 +73,7 @@ class E extends _ {
|
|
|
93
73
|
"Assign recommendation ID to legacy block"
|
|
94
74
|
);
|
|
95
75
|
}
|
|
96
|
-
s.needsMigration(t) && this._migrateFromLegacy(t),
|
|
76
|
+
s.needsMigration(t) && this._migrateFromLegacy(t), d(this.api);
|
|
97
77
|
}
|
|
98
78
|
}
|
|
99
79
|
/**
|
|
@@ -104,7 +84,7 @@ class E extends _ {
|
|
|
104
84
|
*/
|
|
105
85
|
onDelete(t) {
|
|
106
86
|
const e = this._getRecommendationId(t);
|
|
107
|
-
e &&
|
|
87
|
+
e && u().removeBlockState(e);
|
|
108
88
|
}
|
|
109
89
|
/**
|
|
110
90
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
@@ -114,9 +94,9 @@ class E extends _ {
|
|
|
114
94
|
let t = 0;
|
|
115
95
|
try {
|
|
116
96
|
const e = this.api.getDocumentRoot();
|
|
117
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((
|
|
118
|
-
if ("getAttribute" in
|
|
119
|
-
const m =
|
|
97
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((i) => {
|
|
98
|
+
if ("getAttribute" in i) {
|
|
99
|
+
const m = i.getAttribute(a), l = m ? parseInt(m) : 0;
|
|
120
100
|
l > t && (t = l);
|
|
121
101
|
}
|
|
122
102
|
});
|
|
@@ -131,11 +111,11 @@ class E extends _ {
|
|
|
131
111
|
* added classes via setAttribute.
|
|
132
112
|
*/
|
|
133
113
|
_assignRecommendationId(t, e) {
|
|
134
|
-
const
|
|
135
|
-
if (!
|
|
114
|
+
const n = this._getBlockElement(t);
|
|
115
|
+
if (!n)
|
|
136
116
|
return;
|
|
137
|
-
const
|
|
138
|
-
|
|
117
|
+
const i = this.api.getDocumentModifier();
|
|
118
|
+
i.modifyHtml(n).setAttribute(a, e.toString()), i.apply(new _(`Assign recommendation ID ${e}`));
|
|
139
119
|
}
|
|
140
120
|
/**
|
|
141
121
|
* Gets the recommendation-id from a block node
|
|
@@ -144,11 +124,11 @@ class E extends _ {
|
|
|
144
124
|
const e = this._getBlockElement(t);
|
|
145
125
|
if (!e || !("getAttribute" in e))
|
|
146
126
|
return null;
|
|
147
|
-
const
|
|
148
|
-
if (!
|
|
127
|
+
const n = e.getAttribute(a);
|
|
128
|
+
if (!n)
|
|
149
129
|
return null;
|
|
150
|
-
const
|
|
151
|
-
return Number.isNaN(
|
|
130
|
+
const i = parseInt(n);
|
|
131
|
+
return Number.isNaN(i) ? null : i;
|
|
152
132
|
}
|
|
153
133
|
/**
|
|
154
134
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -169,6 +149,6 @@ class E extends _ {
|
|
|
169
149
|
}
|
|
170
150
|
}
|
|
171
151
|
export {
|
|
172
|
-
|
|
173
|
-
|
|
152
|
+
B as BLOCK_ID,
|
|
153
|
+
y as RecommendationBlock
|
|
174
154
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IconsRegistry as
|
|
2
|
-
class o extends
|
|
1
|
+
import { IconsRegistry as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
class o extends r {
|
|
3
3
|
registerIconsSvg(C) {
|
|
4
4
|
C["recommendation-icon"] = `
|
|
5
5
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
@@ -59,41 +59,6 @@ class o extends t {
|
|
|
59
59
|
<circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
|
|
60
60
|
<rect x="7" y="15" width="11" height="2" rx="1"/>
|
|
61
61
|
</svg>
|
|
62
|
-
`, C["migration-info-icon"] = `
|
|
63
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
64
|
-
<g transform="translate(3, 2.5)">
|
|
65
|
-
<path d="M6.87812 0.141942C10.7873 -0.580665 14.6797 1.51065 16.201 5.16436C17.7344
|
|
66
|
-
8.84685 16.432 13.0909 13.0906 15.3015C9.77511 17.4946 5.36819 17.08 2.52785
|
|
67
|
-
14.3193L2.46105 14.2536C0.882709 12.6854 -0.00259777 10.5591 5.72603e-06
|
|
68
|
-
8.34301L0.000643642 8.24974C0.0491816 4.30543 2.87651 0.926565 6.78576
|
|
69
|
-
0.159555L6.87812 0.141942ZM14.5911 5.82406C13.3749 2.90345 10.2486 1.24158 7.12372
|
|
70
|
-
1.85468C3.99888 2.46779 1.74568 5.18516 1.74194 8.34505C1.73988 10.1027 2.44203
|
|
71
|
-
11.789 3.69379 13.0328C5.94435 15.269 9.4739 15.617 12.1241 13.8638C14.7742 12.1106
|
|
72
|
-
15.8071 8.74458 14.5911 5.82406Z" fill="#258DDE"/>
|
|
73
|
-
<path d="M12.5195 13.5806C12.8537 13.2479 13.3933 13.2417 13.7351 13.5628L13.7512
|
|
74
|
-
13.5783L17.7437 17.5239C18.0845 17.8607 18.0856 18.4077 17.7461 18.7458C17.4066
|
|
75
|
-
19.0838 16.8551 19.0849 16.5143 18.7481L12.5218 14.8025L12.5061 14.7866C12.1811
|
|
76
|
-
14.4487 12.1853 13.9134 12.5195 13.5806Z" fill="#258DDE"/>
|
|
77
|
-
<path d="M6.71262 5.42913C6.37248 5.09172 5.82105 5.09172 5.48092 5.42913C5.14079
|
|
78
|
-
5.76655 5.14079 6.3136 5.48092 6.65104L6.71262 5.42913ZM7.80353 8.95504C8.14367
|
|
79
|
-
9.29246 8.69506 9.29246 9.0352 8.95504C9.37534 8.61762 9.37534 8.07053 9.0352
|
|
80
|
-
7.73311L7.80353 8.95504ZM9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353
|
|
81
|
-
7.73311C7.46339 8.07053 7.46339 8.61762 7.80353 8.95504L9.0352 7.73311ZM10.1261
|
|
82
|
-
11.259C10.4663 11.5965 11.0176 11.5965 11.3578 11.259C11.6979 10.9216 11.6979
|
|
83
|
-
10.3745 11.3578 10.0371L10.1261 11.259ZM9.0352 8.95504C9.37534 8.61762 9.37534
|
|
84
|
-
8.07053 9.0352 7.73311C8.69506 7.39569 8.14367 7.39569 7.80353 7.73311L9.0352
|
|
85
|
-
8.95504ZM5.48092 10.0371C5.14079 10.3745 5.14079 10.9216 5.48092 11.259C5.82105
|
|
86
|
-
11.5965 6.37248 11.5965 6.71262 11.259L5.48092 10.0371ZM7.80353 7.73311C7.46339
|
|
87
|
-
8.07053 7.46339 8.61762 7.80353 8.95504C8.14367 9.29246 8.69506 9.29246 9.0352
|
|
88
|
-
8.95504L7.80353 7.73311ZM11.3578 6.65104C11.6979 6.3136 11.6979 5.76655 11.3578
|
|
89
|
-
5.42913C11.0176 5.09172 10.4663 5.09172 10.1261 5.42913L11.3578 6.65104ZM5.48092
|
|
90
|
-
6.65104L7.80353 8.95504L9.0352 7.73311L6.71262 5.42913L5.48092 6.65104ZM7.80353
|
|
91
|
-
8.95504L10.1261 11.259L11.3578 10.0371L9.0352 7.73311L7.80353 8.95504ZM7.80353
|
|
92
|
-
7.73311L5.48092 10.0371L6.71262 11.259L9.0352 8.95504L7.80353 7.73311ZM9.0352
|
|
93
|
-
8.95504L11.3578 6.65104L10.1261 5.42913L7.80353 7.73311L9.0352 8.95504Z"
|
|
94
|
-
fill="#258DDE"/>
|
|
95
|
-
</g>
|
|
96
|
-
</svg>
|
|
97
62
|
`;
|
|
98
63
|
}
|
|
99
64
|
}
|
|
@@ -22,54 +22,6 @@ const n = `/* Utils */
|
|
|
22
22
|
ue-orderable.orderable-disabled .droppable-icon {
|
|
23
23
|
display: none;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
/* ─── Migration Info Box ─────────────────────────────────────────────── */
|
|
27
|
-
/* Shown in the settings panel title when a block was migrated from legacy */
|
|
28
|
-
|
|
29
|
-
/* Layout variables for positioning the absolutely-placed info box */
|
|
30
|
-
:host {
|
|
31
|
-
--rec-migration-padding: 16px;
|
|
32
|
-
--rec-migration-title-height: 61px;
|
|
33
|
-
--rec-migration-box-height: 98px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* Push tabs down when info box is present inside the control panel header */
|
|
37
|
-
.control-panel-header:has(.recommendation-migration-info) {
|
|
38
|
-
position: relative;
|
|
39
|
-
margin-bottom: calc(2 * var(--rec-migration-padding) + var(--rec-migration-box-height));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* Info box container */
|
|
43
|
-
.recommendation-migration-info {
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: flex-start;
|
|
46
|
-
gap: 8px;
|
|
47
|
-
padding: 12px;
|
|
48
|
-
background: var(--guido-color-background-onpage-message-info);
|
|
49
|
-
border: 1px solid var(--guido-color-border-onpage-message-info);
|
|
50
|
-
border-radius: 4px;
|
|
51
|
-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
52
|
-
position: absolute;
|
|
53
|
-
left: var(--rec-migration-padding);
|
|
54
|
-
right: var(--rec-migration-padding);
|
|
55
|
-
top: calc(var(--rec-migration-padding) + var(--rec-migration-title-height));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/* Icon — 18x19 icon inside a 24x24 bounding box (matches Figma) */
|
|
59
|
-
.recommendation-migration-info__icon {
|
|
60
|
-
flex-shrink: 0;
|
|
61
|
-
width: 24px;
|
|
62
|
-
height: 24px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/* Text content */
|
|
66
|
-
.recommendation-migration-info__text {
|
|
67
|
-
margin: 4px 0;
|
|
68
|
-
white-space: normal;
|
|
69
|
-
font-size: 13px;
|
|
70
|
-
font-weight: 400;
|
|
71
|
-
line-height: 16px;
|
|
72
|
-
}
|
|
73
25
|
`;
|
|
74
26
|
export {
|
|
75
27
|
n as default
|