@useinsider/guido 1.0.0-beta.92389b1 → 1.0.0-beta.9980c81

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 (57) hide show
  1. package/README.md +133 -21
  2. package/dist/@types/generic.d.ts +4 -6
  3. package/dist/components/Guido.vue.d.ts +11 -1
  4. package/dist/components/Guido.vue.js +8 -8
  5. package/dist/components/Guido.vue2.js +74 -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.vue.js +7 -7
  9. package/dist/components/organisms/header/MiddleSlot.vue2.js +17 -19
  10. package/dist/components/organisms/header/RightSlot.vue.js +8 -8
  11. package/dist/components/organisms/header/RightSlot.vue2.js +28 -16
  12. package/dist/components/organisms/save-template/SaveTemplateModal.vue.d.ts +16 -0
  13. package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +20 -0
  14. package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +78 -0
  15. package/dist/components/wrappers/ModalWrapper.vue.d.ts +72 -0
  16. package/dist/components/wrappers/ModalWrapper.vue.js +19 -0
  17. package/dist/components/wrappers/ModalWrapper.vue2.js +43 -0
  18. package/dist/composables/useActionsApi.d.ts +2 -1
  19. package/dist/composables/useActionsApi.js +45 -35
  20. package/dist/composables/useGuidoActions.d.ts +46 -0
  21. package/dist/composables/useGuidoActions.js +37 -0
  22. package/dist/composables/useHttp.js +23 -21
  23. package/dist/composables/useProvideInject.d.ts +14 -0
  24. package/dist/composables/useProvideInject.js +17 -0
  25. package/dist/composables/useSaveAsTemplate.d.ts +7 -0
  26. package/dist/composables/useSaveAsTemplate.js +52 -0
  27. package/dist/composables/useStripo.js +27 -20
  28. package/dist/composables/useTemplateNameValidation.d.ts +7 -0
  29. package/dist/composables/useTemplateNameValidation.js +33 -0
  30. package/dist/extensions/DynamicContent/dynamic-content.js +13 -15
  31. package/dist/guido.css +1 -1
  32. package/dist/mock/api/default-template.d.ts +2 -0
  33. package/dist/mock/api/template-library.d.ts +2 -0
  34. package/dist/services/stripoApi.d.ts +2 -1
  35. package/dist/services/stripoApi.js +27 -7
  36. package/dist/stores/dynamic-content.d.ts +27 -0
  37. package/dist/stores/dynamic-content.js +23 -0
  38. package/dist/stores/editor.d.ts +1 -1
  39. package/dist/stores/editor.js +4 -4
  40. package/dist/stores/template-categories.d.ts +41 -0
  41. package/dist/stores/template-categories.js +91 -0
  42. package/dist/utils/arrayUtil.d.ts +1 -0
  43. package/dist/utils/arrayUtil.js +10 -0
  44. package/dist/utils/base64.d.ts +2 -0
  45. package/dist/utils/base64.js +14 -0
  46. package/dist/utils/generic.d.ts +1 -0
  47. package/dist/utils/generic.js +7 -0
  48. package/dist/utils/genericUtil.d.ts +2 -0
  49. package/dist/utils/genericUtil.js +7 -0
  50. package/dist/utils/textUtil.d.ts +2 -0
  51. package/package.json +1 -3
  52. package/dist/composables/useTemplates.d.ts +0 -5
  53. package/dist/composables/useTemplates.js +0 -27
  54. package/dist/static/templates/default/index.html.js +0 -5
  55. package/dist/static/templates/default/style.css.js +0 -119
  56. package/dist/utils/tooltipUtils.d.ts +0 -2
  57. package/dist/utils/tooltipUtils.js +0 -9
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
@@ -9,9 +9,7 @@ export type DynamicContent = {
9
9
  text: string;
10
10
  fallback?: string;
11
11
  };
12
- export interface TooltipOptions {
13
- id: string;
14
- dynamicPosition: boolean;
15
- staticPosition: string;
16
- iconStatus: boolean;
17
- }
12
+ export type MergeTag = {
13
+ label: string;
14
+ value: string;
15
+ };
@@ -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;
@@ -1,18 +1,18 @@
1
1
  import o from "./Guido.vue2.js";
2
2
  /* empty css */
3
- import i from "../_virtual/_plugin-vue2_normalizer.js";
3
+ import a from "../_virtual/_plugin-vue2_normalizer.js";
4
4
  var s = function() {
5
- var e = this, r = e._self._c, t = e._self._setupProxy;
6
- return r("div", { staticClass: "guido-editor__wrapper" }, [r(t.HeaderWrapper), r("div", { staticClass: "guido-editor__container", attrs: { id: "guido-editor" } })], 1);
7
- }, _ = [], a = /* @__PURE__ */ i(
5
+ var t = this, e = t._self._c, r = t._self._setupProxy;
6
+ return e("div", { staticClass: "guido-editor__wrapper" }, [e(r.HeaderWrapper), e("div", { staticClass: "guido-editor__container", attrs: { id: "guido-editor" } }), e(r.SaveTemplateModal, { attrs: { "is-open": r.editorStore.isSaveTemplateModalOpen }, on: { close: r.handleCloseSaveTemplateModal } })], 1);
7
+ }, i = [], d = /* @__PURE__ */ a(
8
8
  o,
9
9
  s,
10
- _,
10
+ i,
11
11
  !1,
12
12
  null,
13
- "89423288"
13
+ "2d18ab9c"
14
14
  );
15
- const f = a.exports;
15
+ const c = d.exports;
16
16
  export {
17
- f as default
17
+ c as default
18
18
  };
@@ -1,58 +1,99 @@
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 w, onMounted as E } from "vue";
2
+ import { provideGuidoActions as T } from "../composables/useGuidoActions.js";
3
+ import { usePartner as _ } from "../composables/usePartner.js";
4
+ import { useStripo as G } from "../composables/useStripo.js";
5
+ import { DefaultUsername as I, DefaultGuidoConfig as k } from "../enums/defaults.js";
6
+ import M from "./organisms/header/HeaderWrapper.vue.js";
7
+ import P from "./organisms/save-template/SaveTemplateModal.vue.js";
8
+ import { useStripoApi as N } from "../services/stripoApi.js";
9
+ import { useEditorStore as x } from "../stores/editor.js";
10
+ import { useDynamicContentStore as A } from "../stores/dynamic-content.js";
11
+ const q = /* @__PURE__ */ w({
8
12
  __name: "Guido",
9
13
  props: {
10
- emailId: null,
14
+ templateId: null,
11
15
  userId: null,
12
16
  partnerName: null,
13
17
  productType: null,
14
18
  username: null,
19
+ html: null,
20
+ css: null,
21
+ preselectedDynamicContentList: null,
15
22
  guidoConfig: null
16
23
  },
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;
24
+ emits: ["dynamic-content:open", "back", "save:start", "save:complete"],
25
+ setup(b, { expose: h, emit: t }) {
26
+ const o = b, n = A(), c = o.preselectedDynamicContentList || [], { getPartnerName: a, getProductType: i } = _(), {
27
+ templateId: s,
28
+ userId: r,
29
+ guidoConfig: l,
30
+ html: d = "",
31
+ css: m = "",
32
+ partnerName: u = a(),
33
+ productType: p = i(),
34
+ username: y = I
35
+ } = o;
27
36
  window.GuidoConfig = {
28
- ...b,
29
- ...r
37
+ ...k,
38
+ ...l
30
39
  };
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 = () => {
40
+ const { initPlugin: f } = G({
41
+ emailId: s,
42
+ userId: r,
43
+ username: y,
44
+ partnerName: u,
45
+ productType: p,
46
+ preselectedDynamicContentList: c
47
+ }), { getDefaultTemplate: g } = N();
48
+ T({
49
+ onBack: () => {
50
+ console.debug("guido:back"), t("back");
51
+ },
52
+ onSaveStart: () => {
53
+ console.debug("guido:save:start"), t("save:start");
54
+ },
55
+ onSaveComplete: (e) => {
56
+ console.debug("guido:save:complete", {
57
+ template: e,
58
+ dynamicContentList: n.getSelectedDynamicContentList
59
+ }), t("save:complete", {
60
+ template: e,
61
+ dynamicContentList: n.getSelectedDynamicContentList
62
+ });
63
+ }
64
+ });
65
+ const C = x(), L = () => {
66
+ C.isSaveTemplateModalOpen = !1;
67
+ }, v = (e) => {
68
+ console.debug("dynamic-content:close", e), n.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
69
+ }, S = () => {
34
70
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
35
71
  };
36
- return w(async () => {
72
+ return E(async () => {
37
73
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
38
74
  try {
39
- const e = await l();
40
- await m(e);
75
+ let e = {
76
+ html: d,
77
+ css: m,
78
+ forceRecreate: !0
79
+ // TODO: It should be false for old templates. We will communicate with Stripo
80
+ };
81
+ e.html || (e = await g()), await f(e), n.selectedDynamicContentList = c;
41
82
  } catch (e) {
42
83
  console.error("Failed to initialize Stripo editor:", e);
43
84
  }
44
85
  document.addEventListener("dynamic-content:open", (e) => {
45
- const f = e;
46
- console.debug("dynamic-content:open", f.detail), n("dynamic-content:open", f.detail);
86
+ const D = e;
87
+ console.debug("dynamic-content:open", D.detail), t("dynamic-content:open", D.detail);
47
88
  });
48
- }), C({
89
+ }), h({
49
90
  dynamicContent: {
50
- insert: p,
51
- close: y
91
+ insert: v,
92
+ close: S
52
93
  }
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 };
94
+ }), { __sfc: !0, dynamicContentStore: n, props: o, preselectedDynamicContentList: c, getPartnerName: a, getProductType: i, templateId: s, userId: r, guidoConfig: l, html: d, css: m, partnerName: u, productType: p, username: y, emit: t, initPlugin: f, getDefaultTemplate: g, editorStore: C, handleCloseSaveTemplateModal: L, insertDynamicContent: v, closeDynamicContent: S, HeaderWrapper: M, SaveTemplateModal: P };
54
95
  }
55
96
  });
56
97
  export {
57
- W as default
98
+ q as default
58
99
  };
@@ -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,17 +1,17 @@
1
- import i from "./MiddleSlot.vue2.js";
2
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
1
+ import s from "./MiddleSlot.vue2.js";
2
+ import i from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var n = function() {
4
4
  var e = this, o = e._self._c, t = e._self._setupProxy;
5
- return t.editorStore.isVersionHistoryOpen ? o("div", { staticClass: "d-f" }, [o(t.VersionHistory), o(t.VersionHistoryViewOptions)], 1) : o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__undo-button"), "tooltip-text": t.trans("action-builder.undo") } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__redo-button"), "tooltip-text": t.trans("action-builder.redo") } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button"), "tooltip-text": t.codeEditorTooltipText } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isPreviewModeOpen, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.previewTooltipText }, on: { click: t.handlePreview } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
6
- }, l = [], r = /* @__PURE__ */ s(
7
- i,
5
+ return t.editorStore.isVersionHistoryOpen ? o("div", { staticClass: "d-f" }, [o(t.VersionHistory), o(t.VersionHistoryViewOptions)], 1) : o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", "tooltip-text": "Code Editor", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button") } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.trans("newsletter.email-preview") } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
6
+ }, l = [], r = /* @__PURE__ */ i(
7
+ s,
8
8
  n,
9
9
  l,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const u = r.exports;
14
+ const p = r.exports;
15
15
  export {
16
- u as default
16
+ p as default
17
17
  };
@@ -1,24 +1,22 @@
1
- import { defineComponent as s, computed as t } from "vue";
2
- import { useTranslations as n } from "../../../composables/useTranslations.js";
3
- import { useEditorStore as p } from "../../../stores/editor.js";
4
- import { InButtonV2 as m } from "@useinsider/design-system-vue";
5
- import { getTooltipOptions as l } from "../../../utils/tooltipUtils.js";
6
- import d from "./version-history/VersionHistory.vue.js";
7
- import w from "./version-history/ViewOptions.vue.js";
8
- import c from "./ViewOptions.vue.js";
9
- const M = /* @__PURE__ */ s({
1
+ import { defineComponent as r } from "vue";
2
+ import { useTranslations as s } from "../../../composables/useTranslations.js";
3
+ import { useEditorStore as n } from "../../../stores/editor.js";
4
+ import { InButtonV2 as e } from "@useinsider/design-system-vue";
5
+ import m from "./version-history/VersionHistory.vue.js";
6
+ import p from "./version-history/ViewOptions.vue.js";
7
+ import f from "./ViewOptions.vue.js";
8
+ const y = /* @__PURE__ */ r({
10
9
  __name: "MiddleSlot",
11
- setup(f) {
12
- const e = p(), o = n(), r = t(
13
- () => e.isCodeEditorOpen ? o("newsletter.close-html-editor") : o("newsletter.html-editor")
14
- ), i = t(
15
- () => e.isPreviewModeOpen ? o("newsletter.close-email-preview") : o("newsletter.email-preview")
16
- );
17
- return { __sfc: !0, editorStore: e, trans: o, codeEditorTooltipText: r, previewTooltipText: i, handlePreview: () => {
18
- e.isPreviewModeOpen = !e.isPreviewModeOpen;
19
- }, InButtonV2: m, getTooltipOptions: l, VersionHistory: d, VersionHistoryViewOptions: w, ViewOptions: c };
10
+ setup(a) {
11
+ const o = n(), t = s();
12
+ return { __sfc: !0, editorStore: o, trans: t, getTooltipOptions: (i) => ({
13
+ id: `${i}-tooltip`,
14
+ dynamicPosition: !1,
15
+ staticPosition: "bottom center",
16
+ iconStatus: !1
17
+ }), InButtonV2: e, VersionHistory: m, VersionHistoryViewOptions: p, ViewOptions: f };
20
18
  }
21
19
  });
22
20
  export {
23
- M as default
21
+ y as default
24
22
  };
@@ -1,17 +1,17 @@
1
- import s from "./RightSlot.vue2.js";
1
+ import o 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);
6
- }, r = [], l = /* @__PURE__ */ i(
7
- s,
4
+ var s = this, e = s._self._c, t = s._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 }, 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 }, 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 }, on: { click: t.handleSaveAsTemplate } }), 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 } }), 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
+ }, a = [], r = /* @__PURE__ */ i(
7
+ o,
8
8
  n,
9
- r,
9
+ a,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const d = l.exports;
14
+ const u = r.exports;
15
15
  export {
16
- d as default
16
+ u as default
17
17
  };
@@ -1,25 +1,37 @@
1
- import { defineComponent as p, computed as m } from "vue";
2
- import { useTranslations as c } from "../../../composables/useTranslations.js";
3
- import { useExport as f } from "../../../composables/useExport.js";
4
- import { useVersionHistoryApi as l } from "../../../composables/useVersionHistoryApi.js";
1
+ import { defineComponent as m } from "vue";
2
+ import { useActionsApi as p } from "../../../composables/useActionsApi.js";
3
+ import { useExport as l } from "../../../composables/useExport.js";
4
+ import { useSaveStart as c, useSaveComplete as d } from "../../../composables/useGuidoActions.js";
5
+ import { useVersionHistoryApi as f } from "../../../composables/useVersionHistoryApi.js";
5
6
  import { useEditorStore as u } from "../../../stores/editor.js";
6
- import { InButtonV2 as y } from "@useinsider/design-system-vue";
7
- import { getTooltipOptions as a } from "../../../utils/tooltipUtils.js";
8
- const O = /* @__PURE__ */ p({
7
+ import { InButtonV2 as S } from "@useinsider/design-system-vue";
8
+ const T = /* @__PURE__ */ m({
9
9
  __name: "RightSlot",
10
- setup(H) {
11
- const { exportHtml: e } = f(), { openVersionHistory: r, closeVersionHistory: s } = l(), o = u(), t = c(), i = () => {
12
- if (o.isVersionHistoryOpen) {
13
- s();
10
+ setup(h) {
11
+ const { exportHtml: i } = l(), { getCompiledEmail: o } = p(), r = c(), s = d(), { openVersionHistory: n, closeVersionHistory: a } = f(), e = u();
12
+ return { __sfc: !0, exportHtml: i, getCompiledEmail: o, saveStart: r, saveComplete: s, openVersionHistory: n, closeVersionHistory: a, editorStore: e, handleVersionHistory: () => {
13
+ if (e.isVersionHistoryOpen) {
14
+ a();
14
15
  return;
15
16
  }
17
+ n();
18
+ }, handleSaveAsTemplate: async () => {
19
+ e.isSaveTemplateModalOpen = !0;
20
+ }, handleSave: async () => {
16
21
  r();
17
- }, n = m(
18
- () => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")
19
- );
20
- return { __sfc: !0, exportHtml: e, openVersionHistory: r, closeVersionHistory: s, editorStore: o, trans: t, handleVersionHistory: i, versionHistoryTooltipText: n, InButtonV2: y, getTooltipOptions: a };
22
+ try {
23
+ const { html: t } = await o();
24
+ s({
25
+ html: t || "",
26
+ css: ""
27
+ // CSS is embedded in HTML from Stripo
28
+ });
29
+ } catch (t) {
30
+ console.error("Failed to get template data for save:", t);
31
+ }
32
+ }, InButtonV2: S };
21
33
  }
22
34
  });
23
35
  export {
24
- O as default
36
+ T as default
25
37
  };
@@ -0,0 +1,16 @@
1
+ interface Props {
2
+ isOpen: boolean;
3
+ }
4
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
5
+ close: () => void;
6
+ }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>>, {}>;
7
+ export default _default;
8
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
9
+ type __VLS_TypePropsToOption<T> = {
10
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
11
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
12
+ } : {
13
+ type: import('vue').PropType<T[K]>;
14
+ required: true;
15
+ };
16
+ };