@useinsider/guido 1.0.0-beta.9fd1b14 → 1.0.0-beta.a0d6eee

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.
Files changed (37) hide show
  1. package/README.md +133 -21
  2. package/dist/@types/generic.d.ts +10 -1
  3. package/dist/components/Guido.vue.d.ts +11 -1
  4. package/dist/components/Guido.vue.js +1 -1
  5. package/dist/components/Guido.vue2.js +70 -33
  6. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  7. package/dist/components/organisms/header/LeftSlot.vue2.js +10 -8
  8. package/dist/components/organisms/header/MiddleSlot.vue2.js +6 -6
  9. package/dist/components/organisms/header/RightSlot.vue.js +4 -4
  10. package/dist/components/organisms/header/RightSlot.vue2.js +29 -15
  11. package/dist/components/organisms/header/ViewOptions.vue.js +1 -1
  12. package/dist/components/organisms/header/ViewOptions.vue2.js +29 -10
  13. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +3 -3
  14. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +34 -16
  15. package/dist/composables/useGuidoActions.d.ts +46 -0
  16. package/dist/composables/useGuidoActions.js +37 -0
  17. package/dist/composables/useProvideInject.d.ts +14 -0
  18. package/dist/composables/useProvideInject.js +17 -0
  19. package/dist/composables/useStripo.js +27 -20
  20. package/dist/extensions/DynamicContent/dynamic-content.js +13 -15
  21. package/dist/guido.css +1 -1
  22. package/dist/mock/api/default-template.d.ts +2 -0
  23. package/dist/services/stripoApi.d.ts +2 -1
  24. package/dist/services/stripoApi.js +27 -7
  25. package/dist/stores/dynamic-content.d.ts +27 -0
  26. package/dist/stores/dynamic-content.js +23 -0
  27. package/dist/utils/arrayUtil.d.ts +1 -0
  28. package/dist/utils/arrayUtil.js +10 -0
  29. package/dist/utils/genericUtil.d.ts +2 -0
  30. package/dist/utils/genericUtil.js +7 -0
  31. package/dist/utils/tooltipUtils.d.ts +1 -1
  32. package/dist/utils/tooltipUtils.js +8 -6
  33. package/package.json +1 -1
  34. package/dist/composables/useTemplates.d.ts +0 -5
  35. package/dist/composables/useTemplates.js +0 -27
  36. package/dist/static/templates/default/index.html.js +0 -5
  37. package/dist/static/templates/default/style.css.js +0 -119
package/README.md CHANGED
@@ -27,10 +27,15 @@ npm install @useinsider/guido
27
27
  <div>
28
28
  <Guido
29
29
  ref="guidoEditor"
30
- :email-id="emailId"
30
+ :template-id="templateId"
31
31
  :user-id="userId"
32
32
  :guido-config="guidoConfig"
33
+ :html="initialHtml"
34
+ :css="initialCss"
33
35
  @dynamic-content:open="handleDynamicContentOpen"
36
+ @back="handleBack"
37
+ @save:start="handleSaveStart"
38
+ @save:complete="handleSaveComplete"
34
39
  />
35
40
  </div>
36
41
  </template>
@@ -44,36 +49,55 @@ export default {
44
49
  },
45
50
  data() {
46
51
  return {
47
- emailId: 'abc123',
48
- userId: '12345',
52
+ templateId: 'template-123',
53
+ userId: 'user-456',
54
+ initialHtml: '<p>Initial HTML content</p>',
55
+ initialCss: 'p { color: #333; }',
49
56
  guidoConfig: {
50
57
  translationsPath: 'window.trans.en',
51
58
  htmlCompilerRules: [],
52
59
  ignoreDefaultHtmlCompilerRules: false,
53
- }
60
+ },
54
61
  dynamicContentModalVisible: false
55
62
  };
56
63
  },
57
64
 
58
65
  methods: {
59
- handleDynamicContentOpen() {
66
+ handleDynamicContentOpen(detail) {
67
+ console.log('Dynamic content requested:', detail);
60
68
  this.dynamicContentModalVisible = true;
61
- }
69
+ },
70
+
71
+ handleBack() {
72
+ console.log('User clicked back button');
73
+ // Handle navigation back
74
+ },
75
+
76
+ handleSaveStart() {
77
+ console.log('Save process started');
78
+ // Show loading indicator
79
+ },
80
+
81
+ handleSaveComplete(template) {
82
+ console.log('Save completed:', template);
83
+ // Handle saved template data
84
+ },
85
+
62
86
  // ⚠️ Your own Dynamic Content Modal should have this id: #guido-dynamic-content-modal
63
87
  handleDynamicContentInsert() {
64
- this.$ref.guidoEditor?.dynamicContent.insert({
65
- text: 'Text',
66
- value: 'Value',
67
- fallback: 'Fallback'
88
+ this.$refs.guidoEditor?.dynamicContent.insert({
89
+ text: 'Display Text',
90
+ value: 'actual-value',
91
+ fallback: 'Fallback Text'
68
92
  });
69
93
 
70
94
  this.dynamicContentModalVisible = false;
71
95
  },
96
+
72
97
  // ⚠️ It's mandatory. There is no way to understand if user closes the modal without selection.
73
98
  handleDynamicContentClose() {
74
- this.$ref.guidoEditor?.dynamicContent.close();
99
+ this.$refs.guidoEditor?.dynamicContent.close();
75
100
  }
76
-
77
101
  }
78
102
  };
79
103
  </script>
@@ -85,12 +109,23 @@ export default {
85
109
 
86
110
  | Prop | Type | Required | Default | Description |
87
111
  |------|------|----------|---------|-------------|
88
- | `emailId` | `string` | ✅ | - | Unique identifier for the email draft |
89
- | `userId` | `string` | ✅ | - | Unique identifier for the user draft |
90
- | `username` | `string` | ⚪ | Guido User | User name |
91
- | `partnerName` | `string` | ⚪ | Getting from URL host | Unique identifier for the partner draft |
92
- | `productType` | `string` | ⚪ | Getting from URL path | Unique identifier for the product draft |
112
+ | `templateId` | `string` | ✅ | - | Unique identifier for the email template |
113
+ | `userId` | `string` | ✅ | - | Unique identifier for the user |
93
114
  | `guidoConfig` | `GuidoConfig` | ✅ | - | Configuration object for the editor |
115
+ | `partnerName` | `string` | ⚪ | From URL host | Partner identifier |
116
+ | `productType` | `string` | ⚪ | From URL path | Product type identifier |
117
+ | `username` | `string` | ⚪ | `'Guido User'` | Display name for the user |
118
+ | `html` | `string` | ⚪ | `''` | Initial HTML content for the template |
119
+ | `css` | `string` | ⚪ | `''` | Initial CSS styles for the template |
120
+
121
+ ### Guido Component Events
122
+
123
+ | Event | Payload | Description |
124
+ |-------|---------|-------------|
125
+ | `dynamic-content:open` | `DynamicContent \| null` | Fired when user requests to insert dynamic content |
126
+ | `back` | - | Fired when user clicks the back button |
127
+ | `save:start` | - | Fired when the save process begins |
128
+ | `save:complete` | `Omit<Template, 'forceRecreate'>` | Fired when template is successfully saved |
94
129
 
95
130
  ### Guido Exposed Methods
96
131
  ```typescript
@@ -377,6 +412,87 @@ src/
377
412
  └── library.ts # Main export
378
413
  ```
379
414
 
415
+ ## 🔌 Provide/Inject Utilities
416
+
417
+ Guido includes type-safe utilities for Vue's provide/inject system to facilitate dependency injection between components.
418
+
419
+ ### useProvideInject
420
+
421
+ The `useProvideInject` composable provides two helper functions for type-safe dependency injection:
422
+
423
+ #### Basic Usage
424
+
425
+ ```typescript
426
+ // Parent component
427
+ import { provideValue } from '@useinsider/guido';
428
+ import { InjectionKey } from 'vue';
429
+
430
+ // Define a typed injection key
431
+ const MyServiceKey: InjectionKey<MyService> = Symbol('MyService');
432
+
433
+ // Provide the value
434
+ const myService = new MyService();
435
+ provideValue(MyServiceKey, myService);
436
+
437
+ // Child component
438
+ import { useInjectedValue } from '@useinsider/guido';
439
+
440
+ // Inject the value with type safety
441
+ const myService = useInjectedValue(MyServiceKey);
442
+ ```
443
+
444
+ #### With Default Value
445
+
446
+ ```typescript
447
+ // Inject with a fallback value
448
+ const myService = useInjectedValue(MyServiceKey, new DefaultService());
449
+ ```
450
+
451
+ #### Error Handling
452
+
453
+ The `useInjectedValue` function will throw a descriptive error if no provider is found and no default value is provided:
454
+
455
+ ```typescript
456
+ // This will throw an error if no provider exists
457
+ try {
458
+ const myService = useInjectedValue(MyServiceKey);
459
+ } catch (error) {
460
+ console.error('No provider found for MyService');
461
+ }
462
+ ```
463
+
464
+ ### API Reference
465
+
466
+ #### `provideValue`
467
+
468
+ ```typescript
469
+ provideValue<T>(key: InjectionKey<T>, value: T): void
470
+ ```
471
+
472
+ Provides a value using Vue's provide system with type safety.
473
+
474
+ | Parameter | Type | Description |
475
+ |-----------|------|-------------|
476
+ | `key` | `InjectionKey<T>` | The typed injection key |
477
+ | `value` | `T` | The value to provide |
478
+
479
+ #### `useInjectedValue`
480
+
481
+ ```typescript
482
+ useInjectedValue<T>(key: InjectionKey<T>, defaultValue?: T): T
483
+ ```
484
+
485
+ Injects a value using Vue's inject system with type safety and error handling.
486
+
487
+ | Parameter | Type | Required | Description |
488
+ |-----------|------|----------|-------------|
489
+ | `key` | `InjectionKey<T>` | ✅ | The typed injection key |
490
+ | `defaultValue` | `T` | ⚪ | Optional fallback value |
491
+
492
+ **Returns:** `T` - The injected value
493
+
494
+ **Throws:** `Error` - When no provider is found and no default value is provided
495
+
380
496
  ## 🌐 i18n
381
497
  Before running the project, it sends to request to inone.useinsider.com/translations and writes the JSON file into - [trans.json](src/mock/responses/trans.json).
382
498
  It allows to use production or local translations on your code. 🚀
@@ -463,8 +579,4 @@ ISC License
463
579
  - Master Version Generator should be fixed.
464
580
  - Playwright integration
465
581
  - Commitlint & Precommit Hooks integration
466
- - We need to emit save event and we should return template config to it
467
- - Default template should be same with production
468
- - Open Guido with saved template
469
- - Get User ID, Email and Unique Template ID as dynamic from props
470
582
  - Get Pre-built display conditions from API
@@ -12,6 +12,15 @@ export type DynamicContent = {
12
12
  export interface TooltipOptions {
13
13
  id: string;
14
14
  dynamicPosition: boolean;
15
- staticPosition: string;
15
+ staticPosition: 'top center' | 'top left' | 'top right' | 'bottom center' | 'bottom left' | 'bottom right' | 'right center' | 'right top' | 'right bottom' | 'left center' | 'left top' | 'left bottom';
16
16
  iconStatus: boolean;
17
+ offset?: {
18
+ x: number;
19
+ y: number;
20
+ };
21
+ preventXss?: boolean;
17
22
  }
23
+ export type MergeTag = {
24
+ label: string;
25
+ value: string;
26
+ };
@@ -1,10 +1,14 @@
1
1
  import type { DynamicContent, GuidoConfig } from '@@/Types/generic';
2
+ import type { Template } from '@@/Types/stripo';
2
3
  type __VLS_Props = {
3
- emailId: string;
4
+ templateId: string;
4
5
  userId: string;
5
6
  partnerName?: string;
6
7
  productType?: string;
7
8
  username?: string;
9
+ html?: string;
10
+ css?: string;
11
+ preselectedDynamicContentList: DynamicContent[];
8
12
  guidoConfig: GuidoConfig;
9
13
  };
10
14
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
@@ -14,6 +18,12 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
14
18
  };
15
19
  }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
16
20
  "dynamic-content:open": (detail: DynamicContent | null) => void;
21
+ back: () => void;
22
+ "save:start": () => void;
23
+ "save:complete": (data: {
24
+ template: Omit<Template, "forceRecreate">;
25
+ dynamicContentList: DynamicContent[];
26
+ }) => void;
17
27
  }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
18
28
  export default _default;
19
29
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -10,7 +10,7 @@ var s = function() {
10
10
  _,
11
11
  !1,
12
12
  null,
13
- "89423288"
13
+ "f9fbdc93"
14
14
  );
15
15
  const f = a.exports;
16
16
  export {
@@ -1,58 +1,95 @@
1
- import { defineComponent as v, onMounted as w } from "vue";
2
- import { usePartner as h } from "../composables/usePartner.js";
3
- import { useStripo as D } from "../composables/useStripo.js";
4
- import { useTemplates as E } from "../composables/useTemplates.js";
5
- import { DefaultUsername as _, DefaultGuidoConfig as b } from "../enums/defaults.js";
6
- import T from "./organisms/header/HeaderWrapper.vue.js";
7
- const W = /* @__PURE__ */ v({
1
+ import { defineComponent as h, onMounted as L } from "vue";
2
+ import { provideGuidoActions as w } from "../composables/useGuidoActions.js";
3
+ import { usePartner as E } from "../composables/usePartner.js";
4
+ import { useStripo as _ } from "../composables/useStripo.js";
5
+ import { DefaultUsername as G, DefaultGuidoConfig as I } from "../enums/defaults.js";
6
+ import k from "./organisms/header/HeaderWrapper.vue.js";
7
+ import { useStripoApi as P } from "../services/stripoApi.js";
8
+ import { useDynamicContentStore as T } from "../stores/dynamic-content.js";
9
+ const K = /* @__PURE__ */ h({
8
10
  __name: "Guido",
9
11
  props: {
10
- emailId: null,
12
+ templateId: null,
11
13
  userId: null,
12
14
  partnerName: null,
13
15
  productType: null,
14
16
  username: null,
17
+ html: null,
18
+ css: null,
19
+ preselectedDynamicContentList: null,
15
20
  guidoConfig: null
16
21
  },
17
- emits: ["dynamic-content:open"],
18
- setup(g, { expose: C, emit: n }) {
19
- const t = g, { getPartnerName: o, getProductType: c } = h(), {
20
- emailId: i,
21
- userId: a,
22
- guidoConfig: r,
23
- partnerName: s = o(),
24
- productType: d = c(),
25
- username: u = _
26
- } = t;
22
+ emits: ["dynamic-content:open", "back", "save:start", "save:complete"],
23
+ setup(b, { expose: S, emit: t }) {
24
+ const o = b, n = T(), c = o.preselectedDynamicContentList || [], { getPartnerName: i, getProductType: s } = E(), {
25
+ templateId: a,
26
+ userId: r,
27
+ guidoConfig: l,
28
+ html: d = "",
29
+ css: m = "",
30
+ partnerName: u = i(),
31
+ productType: p = s(),
32
+ username: y = G
33
+ } = o;
27
34
  window.GuidoConfig = {
28
- ...b,
29
- ...r
35
+ ...I,
36
+ ...l
30
37
  };
31
- const { initPlugin: m } = D({ emailId: i, userId: a, username: u, partnerName: s, productType: d }), { getDefaultTemplate: l } = E(), p = (e) => {
32
- console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
33
- }, y = () => {
38
+ const { initPlugin: g } = _({
39
+ emailId: a,
40
+ userId: r,
41
+ username: y,
42
+ partnerName: u,
43
+ productType: p,
44
+ preselectedDynamicContentList: c
45
+ }), { getDefaultTemplate: C } = P();
46
+ w({
47
+ onBack: () => {
48
+ console.debug("guido:back"), t("back");
49
+ },
50
+ onSaveStart: () => {
51
+ console.debug("guido:save:start"), t("save:start");
52
+ },
53
+ onSaveComplete: (e) => {
54
+ console.debug("guido:save:complete", {
55
+ template: e,
56
+ dynamicContentList: n.getSelectedDynamicContentList
57
+ }), t("save:complete", {
58
+ template: e,
59
+ dynamicContentList: n.getSelectedDynamicContentList
60
+ });
61
+ }
62
+ });
63
+ const f = (e) => {
64
+ console.debug("dynamic-content:close", e), n.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
65
+ }, v = () => {
34
66
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
35
67
  };
36
- return w(async () => {
68
+ return L(async () => {
37
69
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
38
70
  try {
39
- const e = await l();
40
- await m(e);
71
+ let e = {
72
+ html: d,
73
+ css: m,
74
+ forceRecreate: !0
75
+ // TODO: It should be false for old templates. We will communicate with Stripo
76
+ };
77
+ e.html || (e = await C()), await g(e), n.selectedDynamicContentList = c;
41
78
  } catch (e) {
42
79
  console.error("Failed to initialize Stripo editor:", e);
43
80
  }
44
81
  document.addEventListener("dynamic-content:open", (e) => {
45
- const f = e;
46
- console.debug("dynamic-content:open", f.detail), n("dynamic-content:open", f.detail);
82
+ const D = e;
83
+ console.debug("dynamic-content:open", D.detail), t("dynamic-content:open", D.detail);
47
84
  });
48
- }), C({
85
+ }), S({
49
86
  dynamicContent: {
50
- insert: p,
51
- close: y
87
+ insert: f,
88
+ close: v
52
89
  }
53
- }), { __sfc: !0, props: t, getPartnerName: o, getProductType: c, emailId: i, userId: a, guidoConfig: r, partnerName: s, productType: d, username: u, emit: n, initPlugin: m, getDefaultTemplate: l, insertDynamicContent: p, closeDynamicContent: y, HeaderWrapper: T };
90
+ }), { __sfc: !0, dynamicContentStore: n, props: o, preselectedDynamicContentList: c, getPartnerName: i, getProductType: s, templateId: a, userId: r, guidoConfig: l, html: d, css: m, partnerName: u, productType: p, username: y, emit: t, initPlugin: g, getDefaultTemplate: C, insertDynamicContent: f, closeDynamicContent: v, HeaderWrapper: k };
54
91
  }
55
92
  });
56
93
  export {
57
- W as default
94
+ K as default
58
95
  };
@@ -1,11 +1,11 @@
1
- import r from "./LeftSlot.vue2.js";
1
+ import n from "./LeftSlot.vue2.js";
2
2
  import o from "../../../_virtual/_plugin-vue2_normalizer.js";
3
- var n = function() {
4
- var t = this, e = t._self._c, s = t._self._setupProxy;
5
- return e("div", { staticClass: "d-f a-i-c" }, [e(s.InButtonV2, { staticClass: "p-2", attrs: { id: "guido__back-button", "label-text": "Back", "left-icon": "line-arrow-left", styling: "text", type: "secondary" } }), s.editorStore.isVersionHistoryOpen ? e(s.RestoreButton, { staticClass: "ml-3" }) : t._e()], 1);
3
+ var r = function() {
4
+ var e = this, s = e._self._c, t = e._self._setupProxy;
5
+ return s("div", { staticClass: "d-f a-i-c" }, [s(t.InButtonV2, { staticClass: "p-2", attrs: { id: "guido__back-button", "label-text": "Back", "left-icon": "line-arrow-left", styling: "text", type: "secondary" }, on: { click: t.handleBack } }), t.editorStore.isVersionHistoryOpen ? s(t.RestoreButton, { staticClass: "ml-3" }) : e._e()], 1);
6
6
  }, a = [], i = /* @__PURE__ */ o(
7
- r,
8
7
  n,
8
+ r,
9
9
  a,
10
10
  !1,
11
11
  null,
@@ -1,13 +1,15 @@
1
- import { defineComponent as t } from "vue";
2
- import { useEditorStore as o } from "../../../stores/editor.js";
3
- import { InButtonV2 as r } from "@useinsider/design-system-vue";
4
- import e from "./version-history/RestoreButton.vue.js";
5
- const _ = /* @__PURE__ */ t({
1
+ import { defineComponent as r } from "vue";
2
+ import { useBack as e } from "../../../composables/useGuidoActions.js";
3
+ import { useEditorStore as m } from "../../../stores/editor.js";
4
+ import { InButtonV2 as n } from "@useinsider/design-system-vue";
5
+ import s from "./version-history/RestoreButton.vue.js";
6
+ const c = /* @__PURE__ */ r({
6
7
  __name: "LeftSlot",
7
- setup(m) {
8
- return { __sfc: !0, editorStore: o(), InButtonV2: r, RestoreButton: e };
8
+ setup(f) {
9
+ const o = m(), t = e();
10
+ return { __sfc: !0, editorStore: o, handleBack: t, InButtonV2: n, RestoreButton: s };
9
11
  }
10
12
  });
11
13
  export {
12
- _ as default
14
+ c as default
13
15
  };
@@ -1,18 +1,18 @@
1
1
  import { defineComponent as s, computed as t } from "vue";
2
- import { getTooltipOptions as n } from "../../../utils/tooltipUtils.js";
3
- import { InButtonV2 as p } from "@useinsider/design-system-vue";
4
- import { useTranslations as m } from "../../../composables/useTranslations.js";
5
- import { useEditorStore as l } from "../../../stores/editor.js";
2
+ import { useTranslations as n } from "../../../composables/useTranslations.js";
3
+ import { useEditorStore as p } from "../../../stores/editor.js";
4
+ import { getTooltipOptions as m } from "../../../utils/tooltipUtils.js";
5
+ import { InButtonV2 as l } from "@useinsider/design-system-vue";
6
6
  import d from "./version-history/VersionHistory.vue.js";
7
7
  import w from "./version-history/ViewOptions.vue.js";
8
8
  import c from "./ViewOptions.vue.js";
9
9
  const M = /* @__PURE__ */ s({
10
10
  __name: "MiddleSlot",
11
11
  setup(f) {
12
- const e = l(), o = m(), r = t(() => e.isCodeEditorOpen ? o("newsletter.close-html-editor") : o("newsletter.html-editor")), i = t(() => e.isPreviewModeOpen ? o("newsletter.close-email-preview") : o("newsletter.email-preview"));
12
+ const e = p(), o = n(), r = t(() => e.isCodeEditorOpen ? o("newsletter.close-html-editor") : o("newsletter.html-editor")), i = t(() => e.isPreviewModeOpen ? o("newsletter.close-email-preview") : o("newsletter.email-preview"));
13
13
  return { __sfc: !0, editorStore: e, trans: o, codeEditorTooltipText: r, previewTooltipText: i, handlePreview: () => {
14
14
  e.isPreviewModeOpen = !e.isPreviewModeOpen;
15
- }, getTooltipOptions: n, InButtonV2: p, VersionHistory: d, VersionHistoryViewOptions: w, ViewOptions: c };
15
+ }, getTooltipOptions: m, InButtonV2: l, VersionHistory: d, VersionHistoryViewOptions: w, ViewOptions: c };
16
16
  }
17
17
  });
18
18
  export {
@@ -1,8 +1,8 @@
1
1
  import s from "./RightSlot.vue2.js";
2
2
  import i from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var n = function() {
4
- var e = this, o = e._self._c, t = e._self._setupProxy;
5
- return o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }), o(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.exportHtml } }), o(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") } }), o(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button"), "tooltip-text": t.trans("newsletter.test-email") } }), o(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": t.editorStore.isVersionHistoryOpen } })], 1);
4
+ var o = this, e = o._self._c, t = o._self._setupProxy;
5
+ return e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.exportHtml } }), e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") } }), e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "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.editorStore.isVersionHistoryOpen }, on: { click: t.handleSave } })], 1);
6
6
  }, r = [], l = /* @__PURE__ */ i(
7
7
  s,
8
8
  n,
@@ -11,7 +11,7 @@ var n = function() {
11
11
  null,
12
12
  null
13
13
  );
14
- const d = l.exports;
14
+ const u = l.exports;
15
15
  export {
16
- d as default
16
+ u as default
17
17
  };
@@ -1,23 +1,37 @@
1
- import { defineComponent as p, computed as m } from "vue";
2
- import { getTooltipOptions as c } from "../../../utils/tooltipUtils.js";
3
- import { InButtonV2 as f } from "@useinsider/design-system-vue";
4
- import { useExport as l } from "../../../composables/useExport.js";
5
- import { useTranslations as u } from "../../../composables/useTranslations.js";
6
- import { useVersionHistoryApi as y } from "../../../composables/useVersionHistoryApi.js";
7
- import { useEditorStore as a } from "../../../stores/editor.js";
8
- const O = /* @__PURE__ */ p({
1
+ import { defineComponent as l, computed as f } from "vue";
2
+ import { useActionsApi as u } from "../../../composables/useActionsApi.js";
3
+ import { useExport as d } from "../../../composables/useExport.js";
4
+ import { useSaveStart as y, useSaveComplete as v } from "../../../composables/useGuidoActions.js";
5
+ import { useTranslations as h } from "../../../composables/useTranslations.js";
6
+ import { useVersionHistoryApi as S } from "../../../composables/useVersionHistoryApi.js";
7
+ import { useEditorStore as H } from "../../../stores/editor.js";
8
+ import { getTooltipOptions as _ } from "../../../utils/tooltipUtils.js";
9
+ import { InButtonV2 as V } from "@useinsider/design-system-vue";
10
+ const R = /* @__PURE__ */ l({
9
11
  __name: "RightSlot",
10
- setup(H) {
11
- const { exportHtml: e } = l(), { openVersionHistory: r, closeVersionHistory: s } = y(), o = a(), t = u(), i = () => {
12
+ setup(g) {
13
+ const { exportHtml: p } = d(), { getCompiledEmail: r } = u(), s = y(), i = v(), { openVersionHistory: n, closeVersionHistory: m } = S(), o = H(), t = h(), a = () => {
12
14
  if (o.isVersionHistoryOpen) {
13
- s();
15
+ m();
14
16
  return;
15
17
  }
16
- r();
17
- }, n = m(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history"));
18
- return { __sfc: !0, exportHtml: e, openVersionHistory: r, closeVersionHistory: s, editorStore: o, trans: t, handleVersionHistory: i, versionHistoryTooltipText: n, getTooltipOptions: c, InButtonV2: f };
18
+ n();
19
+ }, c = f(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history"));
20
+ return { __sfc: !0, exportHtml: p, getCompiledEmail: r, saveStart: s, saveComplete: i, openVersionHistory: n, closeVersionHistory: m, editorStore: o, trans: t, handleVersionHistory: a, versionHistoryTooltipText: c, handleSave: async () => {
21
+ s();
22
+ try {
23
+ const { html: e } = await r();
24
+ i({
25
+ html: e || "",
26
+ css: ""
27
+ // CSS is embedded in HTML from Stripo
28
+ });
29
+ } catch (e) {
30
+ console.error("Failed to get template data for save:", e);
31
+ }
32
+ }, getTooltipOptions: _, InButtonV2: V };
19
33
  }
20
34
  });
21
35
  export {
22
- O as default
36
+ R as default
23
37
  };
@@ -10,7 +10,7 @@ var n = function() {
10
10
  i,
11
11
  !1,
12
12
  null,
13
- "0fff376c"
13
+ "93dadc5a"
14
14
  );
15
15
  const l = _.exports;
16
16
  export {
@@ -1,15 +1,34 @@
1
- import { defineComponent as e } from "vue";
2
- import { useEditorStore as t } from "../../../stores/editor.js";
3
- import { InSegments as o } from "@useinsider/design-system-vue";
4
- const u = /* @__PURE__ */ e({
1
+ import { defineComponent as n } from "vue";
2
+ import { useTranslations as p } from "../../../composables/useTranslations.js";
3
+ import { useEditorStore as s } from "../../../stores/editor.js";
4
+ import { getTooltipOptions as o } from "../../../utils/tooltipUtils.js";
5
+ import { InSegments as r } from "@useinsider/design-system-vue";
6
+ const d = /* @__PURE__ */ n({
5
7
  __name: "ViewOptions",
6
- setup(n) {
7
- return { __sfc: !0, editorStore: t(), segmentList: [
8
- { text: "", icon: "line-desktop", value: "desktop" },
9
- { text: "", icon: "line-menu-mobileapp", value: "mobile" }
10
- ], InSegments: o };
8
+ setup(m) {
9
+ const e = s(), t = p(), i = [
10
+ {
11
+ text: "",
12
+ icon: "line-desktop",
13
+ value: "desktop",
14
+ position: "bottom",
15
+ align: "center",
16
+ tooltipText: t("newsletter.desktop"),
17
+ tooltipOptions: o("guido__view-option-desktop")
18
+ },
19
+ {
20
+ text: "",
21
+ icon: "line-menu-mobileapp",
22
+ value: "mobile",
23
+ position: "bottom",
24
+ align: "center",
25
+ tooltipText: t("newsletter.mobile"),
26
+ tooltipOptions: o("guido__view-option-mobile")
27
+ }
28
+ ];
29
+ return { __sfc: !0, editorStore: e, trans: t, segmentList: i, InSegments: r };
11
30
  }
12
31
  });
13
32
  export {
14
- u as default
33
+ d as default
15
34
  };
@@ -10,9 +10,9 @@ var r = function() {
10
10
  n,
11
11
  !1,
12
12
  null,
13
- "6a2bde67"
13
+ "421ffc13"
14
14
  );
15
- const d = _.exports;
15
+ const f = _.exports;
16
16
  export {
17
- d as default
17
+ f as default
18
18
  };