@useinsider/guido 1.0.3-beta.d1ff593 → 1.0.3-beta.d6f4719
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 +126 -0
- package/dist/components/organisms/header/LeftSlot.vue.js +1 -1
- package/dist/components/organisms/header/LeftSlot.vue2.js +16 -15
- package/dist/components/organisms/header/RightSlot.vue.js +5 -5
- package/dist/components/organisms/header/RightSlot.vue2.js +20 -19
- package/dist/composables/useBlocksConfig.js +58 -0
- package/dist/composables/usePartner.js +9 -5
- package/dist/composables/useStripo.js +39 -50
- package/dist/config/migrator/index.js +6 -7
- package/dist/enums/defaults.js +10 -5
- package/dist/extensions/Blocks/Recommendation/block.js +2 -5
- package/dist/extensions/Blocks/Recommendation/control.js +40 -68
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -25
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -58
- package/dist/extensions/Blocks/Recommendation/template.js +151 -265
- package/dist/extensions/Blocks/common-control.js +43 -125
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +104 -289
- package/dist/src/@types/generic.d.ts +7 -0
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useBlocksConfig.d.ts +11 -0
- package/dist/src/composables/usePartner.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/template.d.ts +1 -38
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -21
- package/dist/src/stores/config.d.ts +4 -0
- package/package.json +2 -2
- package/dist/config/migrator/recommendationMigrator.js +0 -203
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -335
- package/dist/extensions/Blocks/Recommendation/controls/button/align.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/border.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/color.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/text.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/name/align.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/name/background.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/name/color.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/name/size.js +0 -12
- package/dist/extensions/Blocks/Recommendation/controls/name/style.js +0 -12
- package/dist/src/config/migrator/recommendationMigrator.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -65
- package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +0 -5
package/README.md
CHANGED
|
@@ -191,6 +191,10 @@ interface GuidoConfig {
|
|
|
191
191
|
saveAsTemplate: boolean;
|
|
192
192
|
versionHistory: boolean;
|
|
193
193
|
};
|
|
194
|
+
blocks?: {
|
|
195
|
+
excludeDefaults?: GuidoBlockType[];
|
|
196
|
+
includeCustoms?: GuidoCustomBlockType[];
|
|
197
|
+
};
|
|
194
198
|
}
|
|
195
199
|
```
|
|
196
200
|
|
|
@@ -204,6 +208,9 @@ interface GuidoConfig {
|
|
|
204
208
|
| `features.dynamicContent` | `boolean` | `true` | Enable dynamic content insertion feature |
|
|
205
209
|
| `features.saveAsTemplate` | `boolean` | `true` | Enable save as template feature |
|
|
206
210
|
| `features.versionHistory` | `boolean` | `true` | Enable version history feature |
|
|
211
|
+
| `blocks` | `BlocksConfig` | `{ excludeDefaults: [], includeCustoms: [] }` | Block configuration for excluding default blocks and including custom blocks. See [Blocks Configuration](#-blocks-configuration) section below |
|
|
212
|
+
| `blocks.excludeDefaults` | `GuidoBlockType[]` | `[]` | Array of default Stripo blocks to exclude from the editor |
|
|
213
|
+
| `blocks.includeCustoms` | `GuidoCustomBlockType[]` | `[]` | Array of custom blocks to include in the editor |
|
|
207
214
|
|
|
208
215
|
```typescript
|
|
209
216
|
interface DynamicContent {
|
|
@@ -220,6 +227,125 @@ interface DynamicContent {
|
|
|
220
227
|
| `text` | `string` | '' | Visible value of the dynamic content |
|
|
221
228
|
| `fallback?` | `string` | '' | Fallback value of the dynamic content. Optional |
|
|
222
229
|
|
|
230
|
+
## 🧱 Blocks Configuration
|
|
231
|
+
|
|
232
|
+
Guido allows you to customize which blocks are available in the editor. You can exclude default Stripo blocks and selectively include custom blocks to create tailored editing experiences for different product types.
|
|
233
|
+
|
|
234
|
+
### Block Types
|
|
235
|
+
|
|
236
|
+
#### Default Blocks (GuidoBlockType)
|
|
237
|
+
|
|
238
|
+
These are the standard Stripo email editor blocks that can be excluded:
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
type GuidoBlockType =
|
|
242
|
+
| 'amp-accordion' // AMP accordion component
|
|
243
|
+
| 'amp-carousel' // AMP image carousel
|
|
244
|
+
| 'amp-form-controls' // AMP form elements
|
|
245
|
+
| 'banner-block' // Banner/hero section
|
|
246
|
+
| 'button-block' // Call-to-action buttons
|
|
247
|
+
| 'html-block' // Custom HTML
|
|
248
|
+
| 'image-block' // Image elements
|
|
249
|
+
| 'menu-block' // Navigation menu
|
|
250
|
+
| 'social-block' // Social media links
|
|
251
|
+
| 'spacer-block' // Vertical spacing
|
|
252
|
+
| 'text-block' // Text content
|
|
253
|
+
| 'timer-block' // Countdown timer
|
|
254
|
+
| 'video-block' // Video embeds
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Custom Blocks (GuidoCustomBlockType)
|
|
258
|
+
|
|
259
|
+
These are custom blocks that can be selectively included:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
type GuidoCustomBlockType =
|
|
263
|
+
| 'dynamic-content' // Dynamic content merge tags
|
|
264
|
+
| 'checkbox-block' // Checkbox form input
|
|
265
|
+
| 'radio-button-block' // Radio button form input
|
|
266
|
+
| 'recommendation-block' // Product recommendations
|
|
267
|
+
| 'unsubscribe-block' // Unsubscribe link
|
|
268
|
+
| 'coupon-block' // Coupon/promo code
|
|
269
|
+
| 'items-block' // Cart items display
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Configuration Examples
|
|
273
|
+
|
|
274
|
+
#### Example 1: Exclude Specific Default Blocks
|
|
275
|
+
|
|
276
|
+
Disable button, image, and video blocks while keeping all custom blocks:
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
const guidoConfig = {
|
|
280
|
+
translationsPath: 'window.trans.en',
|
|
281
|
+
features: {
|
|
282
|
+
dynamicContent: true,
|
|
283
|
+
saveAsTemplate: true,
|
|
284
|
+
versionHistory: true
|
|
285
|
+
},
|
|
286
|
+
blocks: {
|
|
287
|
+
excludeDefaults: ['button-block', 'image-block', 'video-block']
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Result:**
|
|
293
|
+
- Button, Image, Video blocks disabled
|
|
294
|
+
- All other default blocks enabled
|
|
295
|
+
- All custom blocks are disabled.
|
|
296
|
+
|
|
297
|
+
#### Example 2: Include Only Specific Custom Blocks
|
|
298
|
+
|
|
299
|
+
Enable only coupon and recommendation blocks:
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
const guidoConfig = {
|
|
303
|
+
translationsPath: 'window.trans.en',
|
|
304
|
+
features: {
|
|
305
|
+
dynamicContent: true,
|
|
306
|
+
saveAsTemplate: true,
|
|
307
|
+
versionHistory: true
|
|
308
|
+
},
|
|
309
|
+
blocks: {
|
|
310
|
+
includeCustoms: ['coupon-block', 'recommendation-block']
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**Result:**
|
|
316
|
+
- All default blocks enabled
|
|
317
|
+
- Only Coupon and Recommendation extensions enabled.
|
|
318
|
+
- Other custom blocks are disabled
|
|
319
|
+
|
|
320
|
+
### Default Behavior
|
|
321
|
+
|
|
322
|
+
When `blocks` is not provided or is `undefined`:
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
const guidoConfig = {
|
|
326
|
+
translationsPath: 'window.trans.en',
|
|
327
|
+
features: {
|
|
328
|
+
dynamicContent: true,
|
|
329
|
+
saveAsTemplate: true,
|
|
330
|
+
versionHistory: true
|
|
331
|
+
}
|
|
332
|
+
// No blocks config
|
|
333
|
+
};
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**Result:**
|
|
337
|
+
- All 13 default Stripo blocks enabled
|
|
338
|
+
- All custom blocks are disabled.
|
|
339
|
+
|
|
340
|
+
### Block Configuration Interface
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
interface BlocksConfig {
|
|
344
|
+
excludeDefaults?: GuidoBlockType[];
|
|
345
|
+
includeCustoms?: GuidoCustomBlockType[];
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
223
349
|
### TypeScript Types
|
|
224
350
|
|
|
225
351
|
The library exports the following TypeScript types:
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as c, computed as a } from "vue";
|
|
2
2
|
import { useBack as m } from "../../../composables/useGuidoActions.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
3
|
+
import { usePartner as u } from "../../../composables/usePartner.js";
|
|
4
|
+
import { usePreviewMode as p } from "../../../composables/usePreviewMode.js";
|
|
5
|
+
import { useTranslations as f } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useVersionHistoryApi as d } from "../../../composables/useVersionHistoryApi.js";
|
|
7
|
+
import { useEditorStore as l } from "../../../stores/editor.js";
|
|
8
|
+
import { InButtonV2 as k } from "@useinsider/design-system-vue";
|
|
9
|
+
import b from "./version-history/RestoreButton.vue.js";
|
|
10
|
+
const h = /* @__PURE__ */ c({
|
|
10
11
|
__name: "LeftSlot",
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
return { __sfc: !0, editorStore:
|
|
14
|
-
if (
|
|
12
|
+
setup(_) {
|
|
13
|
+
const e = l(), r = m(), { closeVersionHistory: t } = d(), { closePreviewMode: i } = p(), { isUnsubscribePages: s } = u(), o = f(), n = a(() => e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : s() ? o("email-editor.back-to-unsubscribe-pages") : o("email-editor.back-to-design"));
|
|
14
|
+
return { __sfc: !0, editorStore: e, handleBack: r, closeVersionHistory: t, closePreviewMode: i, isUnsubscribePages: s, trans: o, backButtonLabel: n, handleBackClick: () => {
|
|
15
|
+
if (e.isVersionHistoryOpen) {
|
|
15
16
|
t();
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
|
-
if (
|
|
19
|
+
if (e.isPreviewModeOpen) {
|
|
19
20
|
i();
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
23
|
r();
|
|
23
|
-
}, InButtonV2:
|
|
24
|
+
}, InButtonV2: k, RestoreButton: b };
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
27
|
export {
|
|
27
|
-
|
|
28
|
+
h as default
|
|
28
29
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import n from "./RightSlot.vue2.js";
|
|
2
2
|
import a from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var l = function() {
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
return e("div", { staticClass: "d-f" }, [(
|
|
4
|
+
var o, i;
|
|
5
|
+
var s = this, e = s._self._c, t = s._self._setupProxy;
|
|
6
|
+
return e("div", { staticClass: "d-f" }, [(o = t.config.features) != null && o.versionHistory ? e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryButtonDisabled, "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }) : s._e(), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isExportButtonDisabled, "label-text-status": !1, "loading-status": t.isExporting, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.handleExport } }), (i = t.config.features) != null && i.saveAsTemplate ? e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isSaveAsButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") }, on: { click: t.handleSaveAs } }) : s._e(), t.isUnsubscribePages() ? s._e() : e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isTestButtonDisabled, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button"), "tooltip-text": t.trans("newsletter.test-email") } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": !t.isSaving && t.editorStore.isSaveButtonDisabled, "loading-status": t.isSaving }, on: { click: function(p) {
|
|
7
7
|
return t.handleSave(!1);
|
|
8
8
|
} } })], 1);
|
|
9
|
-
}, r = [],
|
|
9
|
+
}, r = [], u = /* @__PURE__ */ a(
|
|
10
10
|
n,
|
|
11
11
|
l,
|
|
12
12
|
r,
|
|
@@ -14,7 +14,7 @@ var l = function() {
|
|
|
14
14
|
null,
|
|
15
15
|
null
|
|
16
16
|
);
|
|
17
|
-
const g =
|
|
17
|
+
const g = u.exports;
|
|
18
18
|
export {
|
|
19
19
|
g as default
|
|
20
20
|
};
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useExport as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { defineComponent as H, ref as l, computed as _ } from "vue";
|
|
2
|
+
import { useConfig as h } from "../../../composables/useConfig.js";
|
|
3
|
+
import { useExport as V } from "../../../composables/useExport.js";
|
|
4
|
+
import { usePartner as x } from "../../../composables/usePartner.js";
|
|
5
|
+
import { useSave as w } from "../../../composables/useSave.js";
|
|
6
|
+
import { useTranslations as T } from "../../../composables/useTranslations.js";
|
|
7
|
+
import { useVersionHistoryApi as E } from "../../../composables/useVersionHistoryApi.js";
|
|
8
|
+
import { useEditorStore as O } from "../../../stores/editor.js";
|
|
9
|
+
import { getTooltipOptions as A } from "../../../utils/tooltipUtils.js";
|
|
10
|
+
import { InButtonV2 as b } from "@useinsider/design-system-vue";
|
|
11
|
+
const F = /* @__PURE__ */ H({
|
|
11
12
|
__name: "RightSlot",
|
|
12
|
-
setup(
|
|
13
|
-
const { config: u } =
|
|
13
|
+
setup(C, { expose: m }) {
|
|
14
|
+
const { config: u } = h(), { exportHtml: r } = V(), { save: n } = w(), { openVersionHistory: i, closeVersionHistory: a } = E(), { isUnsubscribePages: c } = x(), o = O(), t = T(), e = l(!1), s = l(!1), f = () => {
|
|
14
15
|
if (o.isVersionHistoryOpen) {
|
|
15
16
|
a();
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
i();
|
|
19
|
-
},
|
|
20
|
+
}, v = async () => {
|
|
20
21
|
e.value = !0, await r(), e.value = !1;
|
|
21
|
-
},
|
|
22
|
+
}, d = () => {
|
|
22
23
|
o.isSaveAsTemplateDrawerOpen = !0;
|
|
23
|
-
},
|
|
24
|
+
}, y = _(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), p = async (S) => {
|
|
24
25
|
s.value = !0, o.loadingStatus = !0;
|
|
25
|
-
const
|
|
26
|
-
return s.value = !1, o.loadingStatus = !1,
|
|
26
|
+
const g = await n(S);
|
|
27
|
+
return s.value = !1, o.loadingStatus = !1, g;
|
|
27
28
|
};
|
|
28
29
|
return m({
|
|
29
30
|
handleSave: p
|
|
30
|
-
}), { __sfc: !0, config: u, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, handleVersionHistory:
|
|
31
|
+
}), { __sfc: !0, config: u, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, isUnsubscribePages: c, editorStore: o, trans: t, isExporting: e, isSaving: s, handleVersionHistory: f, handleExport: v, handleSaveAs: d, versionHistoryTooltipText: y, handleSave: p, getTooltipOptions: A, InButtonV2: b };
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
34
|
export {
|
|
34
|
-
|
|
35
|
+
F as default
|
|
35
36
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import c from "../extensions/Blocks/Checkbox/extension.js";
|
|
2
|
+
import r from "../extensions/Blocks/CouponBlock/extension.js";
|
|
3
|
+
import i from "../extensions/Blocks/RadioButton/extension.js";
|
|
4
|
+
import l from "../extensions/Blocks/Recommendation/extension.js";
|
|
5
|
+
import s from "../extensions/Blocks/Unsubscribe/extension.js";
|
|
6
|
+
import b from "../extensions/DynamicContent/extension.js";
|
|
7
|
+
const a = {
|
|
8
|
+
"amp-accordion": "ampAccordionEnabled",
|
|
9
|
+
"amp-carousel": "ampCarouselEnabled",
|
|
10
|
+
"amp-form-controls": "ampFormControlsEnabled",
|
|
11
|
+
"banner-block": "bannerEnabled",
|
|
12
|
+
"button-block": "buttonEnabled",
|
|
13
|
+
"html-block": "htmlEnabled",
|
|
14
|
+
"image-block": "imageEnabled",
|
|
15
|
+
"menu-block": "menuEnabled",
|
|
16
|
+
"social-block": "socialNetEnabled",
|
|
17
|
+
"spacer-block": "spacerEnabled",
|
|
18
|
+
"text-block": "textEnabled",
|
|
19
|
+
"timer-block": "timerEnabled",
|
|
20
|
+
"video-block": "videoEnabled"
|
|
21
|
+
}, m = {
|
|
22
|
+
"dynamic-content": b,
|
|
23
|
+
"checkbox-block": c,
|
|
24
|
+
"radio-button-block": i,
|
|
25
|
+
"recommendation-block": l,
|
|
26
|
+
"unsubscribe-block": s,
|
|
27
|
+
"coupon-block": r,
|
|
28
|
+
"items-block": null
|
|
29
|
+
// TODO: Add ItemsBlock extension when available
|
|
30
|
+
}, E = (n) => {
|
|
31
|
+
if (!n || !n.length)
|
|
32
|
+
return {};
|
|
33
|
+
const o = {};
|
|
34
|
+
return n.forEach((e) => {
|
|
35
|
+
const t = a[e];
|
|
36
|
+
t && (o[t] = !1);
|
|
37
|
+
}), o;
|
|
38
|
+
}, d = (n) => {
|
|
39
|
+
if (!n || !n.length)
|
|
40
|
+
return [];
|
|
41
|
+
const o = [];
|
|
42
|
+
return n.forEach((e) => {
|
|
43
|
+
const t = m[e];
|
|
44
|
+
t && o.push(t);
|
|
45
|
+
}), o;
|
|
46
|
+
}, C = () => ({
|
|
47
|
+
getStripoBlocksConfig: () => {
|
|
48
|
+
var e;
|
|
49
|
+
const o = (e = window.GuidoConfig) == null ? void 0 : e.blocks;
|
|
50
|
+
return {
|
|
51
|
+
baseBlocks: E(o == null ? void 0 : o.excludeDefaults),
|
|
52
|
+
extensions: d(o == null ? void 0 : o.includeCustoms)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export {
|
|
57
|
+
C as useBlocksConfig
|
|
58
|
+
};
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
1
|
+
import { ProductIds as n, TEST_PARTNER_LIST as o, DefaultProductType as s } from "../enums/defaults.js";
|
|
2
|
+
const p = () => {
|
|
3
3
|
const e = () => window.location.hostname.split(".")[0] || "";
|
|
4
4
|
return {
|
|
5
5
|
getPartnerName: e,
|
|
6
6
|
getProductType: () => {
|
|
7
|
-
const t = window.location.pathname.split("/").filter(Boolean)[0] ||
|
|
7
|
+
const t = window.location.pathname.split("/").filter(Boolean)[0] || s;
|
|
8
8
|
return n[t] || 0;
|
|
9
9
|
},
|
|
10
10
|
isTestPartner: () => {
|
|
11
11
|
const t = e();
|
|
12
|
-
return
|
|
12
|
+
return o.includes(t);
|
|
13
|
+
},
|
|
14
|
+
isUnsubscribePages: () => {
|
|
15
|
+
var t, r;
|
|
16
|
+
return ((r = (t = window.GuidoConfig) == null ? void 0 : t.partner) == null ? void 0 : r.productType) === n.unsubscribePages;
|
|
13
17
|
}
|
|
14
18
|
};
|
|
15
19
|
};
|
|
16
20
|
export {
|
|
17
|
-
|
|
21
|
+
p as usePartner
|
|
18
22
|
};
|
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import w from "../extensions/Blocks/CouponBlock/extension.js";
|
|
8
|
-
import b from "../extensions/Blocks/RadioButton/extension.js";
|
|
9
|
-
import V from "../extensions/Blocks/Recommendation/extension.js";
|
|
10
|
-
import _ from "../extensions/Blocks/Unsubscribe/extension.js";
|
|
11
|
-
import k from "../extensions/DynamicContent/extension.js";
|
|
1
|
+
import { useActionsApi as E } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as y } from "./useBlocksConfig.js";
|
|
3
|
+
import { useCustomInterfaceAppearance as h } from "./useCustomInterfaceAppearance.js";
|
|
4
|
+
import { useStripoEventHandler as w } from "./useStripoEventHandler.js";
|
|
5
|
+
import { useToaster as b } from "./useToaster.js";
|
|
6
|
+
import { displayConditions as k } from "../enums/displayConditions.js";
|
|
12
7
|
import { useStripoApi as B } from "../services/stripoApi.js";
|
|
13
|
-
import
|
|
14
|
-
import { useEditorStore as
|
|
15
|
-
import { dynamicContentToMergeTags as
|
|
16
|
-
import
|
|
17
|
-
const
|
|
18
|
-
const { handleError:
|
|
19
|
-
const t =
|
|
8
|
+
import V from "../static/styles/customEditorStyle.css.js";
|
|
9
|
+
import { useEditorStore as _ } from "../stores/editor.js";
|
|
10
|
+
import { dynamicContentToMergeTags as F } from "../utils/genericUtil.js";
|
|
11
|
+
import A from "../package.json.js";
|
|
12
|
+
const L = (d) => {
|
|
13
|
+
const { handleError: u } = b(), { getToken: p, getCustomFonts: m } = B(), { handleEvent: g } = w(), { getStripoBlocksConfig: f } = y(), S = (r, i = []) => {
|
|
14
|
+
const t = _(), { html: n, css: l, forceRecreate: a } = r, { baseBlocks: e, extensions: c } = f();
|
|
20
15
|
window.UIEditor.initEditor(
|
|
21
16
|
document.querySelector("#guido-editor"),
|
|
22
17
|
{
|
|
23
|
-
metadata:
|
|
18
|
+
metadata: d,
|
|
24
19
|
html: n,
|
|
25
|
-
css:
|
|
26
|
-
forceRecreate:
|
|
20
|
+
css: l,
|
|
21
|
+
forceRecreate: a,
|
|
27
22
|
locale: "en",
|
|
28
23
|
undoButtonSelector: "#guido__undo-button",
|
|
29
24
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -33,13 +28,14 @@ const G = (a) => {
|
|
|
33
28
|
customAppearanceMergetags: !0,
|
|
34
29
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
35
30
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
36
|
-
customViewStyles:
|
|
31
|
+
customViewStyles: V,
|
|
37
32
|
conditionsEnabled: !0,
|
|
38
33
|
customConditionsEnabled: !0,
|
|
39
|
-
conditionCategories:
|
|
34
|
+
conditionCategories: k,
|
|
40
35
|
enableXSSSecurity: !0,
|
|
41
36
|
messageSettingsEnabled: !1,
|
|
42
37
|
selectBlockAfterDropFromSettingsPanel: !0,
|
|
38
|
+
...e ? { baseBlocks: e } : {},
|
|
43
39
|
editorFonts: {
|
|
44
40
|
showDefaultStandardFonts: !0,
|
|
45
41
|
showDefaultNotStandardFonts: !0,
|
|
@@ -47,25 +43,25 @@ const G = (a) => {
|
|
|
47
43
|
},
|
|
48
44
|
mergeTags: [
|
|
49
45
|
{
|
|
50
|
-
entries:
|
|
46
|
+
entries: F(d.preselectedDynamicContentList)
|
|
51
47
|
}
|
|
52
48
|
],
|
|
53
49
|
async onTokenRefreshRequest(o) {
|
|
54
50
|
try {
|
|
55
|
-
const
|
|
56
|
-
o(
|
|
57
|
-
} catch (
|
|
58
|
-
|
|
51
|
+
const s = await p();
|
|
52
|
+
o(s);
|
|
53
|
+
} catch (s) {
|
|
54
|
+
u(s, "Failed to refresh token");
|
|
59
55
|
}
|
|
60
56
|
},
|
|
61
57
|
onTemplateLoaded() {
|
|
62
58
|
try {
|
|
63
|
-
const { importCss: o } =
|
|
64
|
-
o(),
|
|
59
|
+
const { importCss: o } = h(), { activateCustomViewStyles: s } = E();
|
|
60
|
+
o(), s(), d.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
|
|
65
61
|
t.hasChanges = !1;
|
|
66
62
|
}, 1e3);
|
|
67
63
|
} catch (o) {
|
|
68
|
-
|
|
64
|
+
u(o, "Failed to load custom interface appearance");
|
|
69
65
|
}
|
|
70
66
|
},
|
|
71
67
|
onCodeEditorVisibilityChanged(o) {
|
|
@@ -80,42 +76,35 @@ const G = (a) => {
|
|
|
80
76
|
onDataChanged() {
|
|
81
77
|
t.hasChanges = !0;
|
|
82
78
|
},
|
|
83
|
-
onEvent:
|
|
79
|
+
onEvent: g,
|
|
84
80
|
ignoreClickOutsideSelectors: [
|
|
85
81
|
"#guido-dynamic-content-modal",
|
|
86
82
|
".in-on-board-wrapper",
|
|
87
83
|
".in-drawer__container"
|
|
88
84
|
],
|
|
89
|
-
extensions:
|
|
90
|
-
k,
|
|
91
|
-
h,
|
|
92
|
-
b,
|
|
93
|
-
V,
|
|
94
|
-
_,
|
|
95
|
-
w
|
|
96
|
-
]
|
|
85
|
+
extensions: c
|
|
97
86
|
}
|
|
98
87
|
);
|
|
99
|
-
},
|
|
100
|
-
var
|
|
88
|
+
}, C = (r) => new Promise((i, t) => {
|
|
89
|
+
var c;
|
|
101
90
|
if (document.getElementById("UiEditorScript")) {
|
|
102
91
|
r(), i();
|
|
103
92
|
return;
|
|
104
93
|
}
|
|
105
|
-
const n =
|
|
106
|
-
|
|
94
|
+
const n = A.guido, a = `https://email-static.useinsider.com/guido/${(c = n == null ? void 0 : n.stripo) == null ? void 0 : c.version}/UIEditor.js`, e = document.createElement("script");
|
|
95
|
+
e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
|
|
107
96
|
r(), i();
|
|
108
|
-
},
|
|
109
|
-
t(new Error(`Failed to load Stripo UIEditor script from S3: ${
|
|
110
|
-
}, document.body.appendChild(
|
|
97
|
+
}, e.onerror = () => {
|
|
98
|
+
t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
99
|
+
}, document.body.appendChild(e);
|
|
111
100
|
});
|
|
112
101
|
return { initPlugin: async (r) => {
|
|
113
|
-
await
|
|
102
|
+
await C(async () => {
|
|
114
103
|
const i = await m();
|
|
115
|
-
|
|
104
|
+
S(r, i);
|
|
116
105
|
});
|
|
117
106
|
} };
|
|
118
107
|
};
|
|
119
108
|
export {
|
|
120
|
-
|
|
109
|
+
L as useStripo
|
|
121
110
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
1
|
+
import { migrateCheckbox as o } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateCouponBlock as m } from "./couponBlockMigrator.js";
|
|
3
3
|
import { migrateRadioButton as i } from "./radioButtonMigrator.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const s = async (t) => {
|
|
4
|
+
import { migrateUnsubscribe as e } from "./unsubscribeMigrator.js";
|
|
5
|
+
const c = async (t) => {
|
|
7
6
|
let r = t;
|
|
8
|
-
return r =
|
|
7
|
+
return r = o(r), r = i(r), r = await e(r), r = m(r), r;
|
|
9
8
|
};
|
|
10
9
|
export {
|
|
11
|
-
|
|
10
|
+
c as migrate
|
|
12
11
|
};
|
package/dist/enums/defaults.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = {
|
|
2
2
|
translationsPath: "window.trans.en",
|
|
3
3
|
emailHeader: {
|
|
4
4
|
senderName: "",
|
|
@@ -7,6 +7,10 @@ const a = {
|
|
|
7
7
|
extensions: {
|
|
8
8
|
unsubscribe: !0
|
|
9
9
|
},
|
|
10
|
+
blocks: {
|
|
11
|
+
excludeDefaults: [],
|
|
12
|
+
includeCustoms: []
|
|
13
|
+
},
|
|
10
14
|
features: {
|
|
11
15
|
dynamicContent: !0,
|
|
12
16
|
saveAsTemplate: !0,
|
|
@@ -16,9 +20,10 @@ const a = {
|
|
|
16
20
|
}, t = {
|
|
17
21
|
promotional: 1,
|
|
18
22
|
transactional: 2
|
|
19
|
-
},
|
|
23
|
+
}, a = "email", o = "Guido User", n = t.promotional, s = 2, i = {
|
|
20
24
|
email: 60,
|
|
21
|
-
architect: 49
|
|
25
|
+
architect: 49,
|
|
26
|
+
unsubscribePages: 97
|
|
22
27
|
}, u = [
|
|
23
28
|
"alfredtesting",
|
|
24
29
|
"electio",
|
|
@@ -52,9 +57,9 @@ const a = {
|
|
|
52
57
|
"stripoeditorlivetest"
|
|
53
58
|
];
|
|
54
59
|
export {
|
|
55
|
-
|
|
60
|
+
e as DefaultGuidoConfig,
|
|
56
61
|
n as DefaultMessageType,
|
|
57
|
-
|
|
62
|
+
a as DefaultProductType,
|
|
58
63
|
o as DefaultUsername,
|
|
59
64
|
s as EditorType,
|
|
60
65
|
i as ProductIds,
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { getDefaultTemplate as o } from "./template.js";
|
|
3
3
|
const n = "recommendation-block";
|
|
4
|
-
class
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
|
-
}
|
|
4
|
+
class c extends e {
|
|
8
5
|
getId() {
|
|
9
6
|
return n;
|
|
10
7
|
}
|
|
@@ -26,5 +23,5 @@ class m extends e {
|
|
|
26
23
|
}
|
|
27
24
|
export {
|
|
28
25
|
n as BLOCK_ID,
|
|
29
|
-
|
|
26
|
+
c as RecommendationBlock
|
|
30
27
|
};
|