@useinsider/guido 1.0.0-beta.eb2a99e → 1.0.0-beta.ef5e504

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 (53) hide show
  1. package/README.md +21 -133
  2. package/dist/@types/generic.d.ts +4 -0
  3. package/dist/components/Guido.vue.d.ts +2 -5
  4. package/dist/components/Guido.vue.js +8 -8
  5. package/dist/components/Guido.vue2.js +38 -50
  6. package/dist/components/organisms/design-preview/DesktopPreview.vue.d.ts +16 -0
  7. package/dist/components/organisms/design-preview/DesktopPreview.vue.js +22 -0
  8. package/dist/components/organisms/design-preview/DesktopPreview.vue2.js +28 -0
  9. package/dist/components/organisms/design-preview/EmailPreview.vue.d.ts +16 -0
  10. package/dist/components/organisms/design-preview/EmailPreview.vue.js +17 -0
  11. package/dist/components/organisms/design-preview/EmailPreview.vue2.js +37 -0
  12. package/dist/components/organisms/design-preview/EmailView.vue.d.ts +18 -0
  13. package/dist/components/organisms/design-preview/EmailView.vue.js +19 -0
  14. package/dist/components/organisms/design-preview/EmailView.vue2.js +24 -0
  15. package/dist/components/organisms/design-preview/InboxView.vue.d.ts +17 -0
  16. package/dist/components/organisms/design-preview/InboxView.vue.js +19 -0
  17. package/dist/components/organisms/design-preview/InboxView.vue2.js +23 -0
  18. package/dist/components/organisms/design-preview/MobilePreview.vue.d.ts +17 -0
  19. package/dist/components/organisms/design-preview/MobilePreview.vue.js +17 -0
  20. package/dist/components/organisms/design-preview/MobilePreview.vue2.js +22 -0
  21. package/dist/components/organisms/header/AmpErrorModal.vue.d.ts +16 -0
  22. package/dist/components/organisms/header/AmpErrorModal.vue.js +21 -0
  23. package/dist/components/organisms/header/AmpErrorModal.vue2.js +27 -0
  24. package/dist/components/organisms/header/AmpToggle.vue.d.ts +2 -0
  25. package/dist/components/organisms/header/AmpToggle.vue.js +19 -0
  26. package/dist/components/organisms/header/AmpToggle.vue2.js +38 -0
  27. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  28. package/dist/components/organisms/header/LeftSlot.vue2.js +8 -10
  29. package/dist/components/organisms/header/MiddleSlot.vue.js +6 -6
  30. package/dist/components/organisms/header/MiddleSlot.vue2.js +17 -13
  31. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  32. package/dist/components/organisms/header/RightSlot.vue2.js +14 -28
  33. package/dist/components/organisms/header/ViewOptions.vue.js +6 -6
  34. package/dist/composables/useDebounce.d.ts +4 -0
  35. package/dist/composables/useDebounce.js +12 -0
  36. package/dist/composables/useMobileGmailFit.d.ts +5 -0
  37. package/dist/composables/useMobileGmailFit.js +69 -0
  38. package/dist/composables/usePreviewMode.d.ts +6 -0
  39. package/dist/composables/usePreviewMode.js +19 -0
  40. package/dist/composables/useStripo.js +15 -15
  41. package/dist/enums/gmailMobilePreview.d.ts +7 -0
  42. package/dist/enums/gmailMobilePreview.js +17 -0
  43. package/dist/guido.css +1 -1
  44. package/dist/inbox-mockup.svg +41 -0
  45. package/dist/phone-mockup.svg +31 -0
  46. package/dist/services/stripoApi.js +2 -6
  47. package/dist/stores/editor.d.ts +4 -0
  48. package/dist/stores/editor.js +7 -3
  49. package/package.json +1 -1
  50. package/dist/composables/useGuidoActions.d.ts +0 -46
  51. package/dist/composables/useGuidoActions.js +0 -37
  52. package/dist/composables/useProvideInject.d.ts +0 -14
  53. package/dist/composables/useProvideInject.js +0 -17
package/README.md CHANGED
@@ -27,15 +27,10 @@ npm install @useinsider/guido
27
27
  <div>
28
28
  <Guido
29
29
  ref="guidoEditor"
30
- :template-id="templateId"
30
+ :email-id="emailId"
31
31
  :user-id="userId"
32
32
  :guido-config="guidoConfig"
33
- :html="initialHtml"
34
- :css="initialCss"
35
33
  @dynamic-content:open="handleDynamicContentOpen"
36
- @back="handleBack"
37
- @save:start="handleSaveStart"
38
- @save:complete="handleSaveComplete"
39
34
  />
40
35
  </div>
41
36
  </template>
@@ -49,55 +44,36 @@ export default {
49
44
  },
50
45
  data() {
51
46
  return {
52
- templateId: 'template-123',
53
- userId: 'user-456',
54
- initialHtml: '<p>Initial HTML content</p>',
55
- initialCss: 'p { color: #333; }',
47
+ emailId: 'abc123',
48
+ userId: '12345',
56
49
  guidoConfig: {
57
50
  translationsPath: 'window.trans.en',
58
51
  htmlCompilerRules: [],
59
52
  ignoreDefaultHtmlCompilerRules: false,
60
- },
53
+ }
61
54
  dynamicContentModalVisible: false
62
55
  };
63
56
  },
64
57
 
65
58
  methods: {
66
- handleDynamicContentOpen(detail) {
67
- console.log('Dynamic content requested:', detail);
59
+ handleDynamicContentOpen() {
68
60
  this.dynamicContentModalVisible = true;
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
-
61
+ }
86
62
  // ⚠️ Your own Dynamic Content Modal should have this id: #guido-dynamic-content-modal
87
63
  handleDynamicContentInsert() {
88
- this.$refs.guidoEditor?.dynamicContent.insert({
89
- text: 'Display Text',
90
- value: 'actual-value',
91
- fallback: 'Fallback Text'
64
+ this.$ref.guidoEditor?.dynamicContent.insert({
65
+ text: 'Text',
66
+ value: 'Value',
67
+ fallback: 'Fallback'
92
68
  });
93
69
 
94
70
  this.dynamicContentModalVisible = false;
95
71
  },
96
-
97
72
  // ⚠️ It's mandatory. There is no way to understand if user closes the modal without selection.
98
73
  handleDynamicContentClose() {
99
- this.$refs.guidoEditor?.dynamicContent.close();
74
+ this.$ref.guidoEditor?.dynamicContent.close();
100
75
  }
76
+
101
77
  }
102
78
  };
103
79
  </script>
@@ -109,23 +85,12 @@ export default {
109
85
 
110
86
  | Prop | Type | Required | Default | Description |
111
87
  |------|------|----------|---------|-------------|
112
- | `templateId` | `string` | ✅ | - | Unique identifier for the email template |
113
- | `userId` | `string` | ✅ | - | Unique identifier for the user |
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 |
114
93
  | `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 |
129
94
 
130
95
  ### Guido Exposed Methods
131
96
  ```typescript
@@ -412,87 +377,6 @@ src/
412
377
  └── library.ts # Main export
413
378
  ```
414
379
 
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
-
496
380
  ## 🌐 i18n
497
381
  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).
498
382
  It allows to use production or local translations on your code. 🚀
@@ -579,4 +463,8 @@ ISC License
579
463
  - Master Version Generator should be fixed.
580
464
  - Playwright integration
581
465
  - 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
582
470
  - Get Pre-built display conditions from API
@@ -9,3 +9,7 @@ export type DynamicContent = {
9
9
  text: string;
10
10
  fallback?: string;
11
11
  };
12
+ export interface EmailData {
13
+ senderName: string;
14
+ subject: string;
15
+ }
@@ -1,5 +1,4 @@
1
- import type { DynamicContent, GuidoConfig } from '@@/Types/generic';
2
- import type { Template } from '@@/Types/stripo';
1
+ import type { DynamicContent, GuidoConfig, EmailData } from '@@/Types/generic';
3
2
  type __VLS_Props = {
4
3
  templateId: string;
5
4
  userId: string;
@@ -9,6 +8,7 @@ type __VLS_Props = {
9
8
  html?: string;
10
9
  css?: string;
11
10
  guidoConfig: GuidoConfig;
11
+ emailData?: EmailData;
12
12
  };
13
13
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
14
14
  dynamicContent: {
@@ -17,9 +17,6 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
17
17
  };
18
18
  }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
19
19
  "dynamic-content:open": (detail: DynamicContent | null) => void;
20
- back: () => void;
21
- "save:start": () => void;
22
- "save:complete": (template: Omit<Template, "forceRecreate">) => void;
23
20
  }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
24
21
  export default _default;
25
22
  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 t 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 i = this, r = i._self._c, e = i._self._setupProxy;
6
+ return r("div", { staticClass: "guido-editor__wrapper" }, [r(e.HeaderWrapper), r(e.EmailPreview, { directives: [{ name: "show", rawName: "v-show", value: e.editorStore.isPreviewModeOpen, expression: "editorStore.isPreviewModeOpen" }], attrs: { "email-data": i.emailData, "is-visible": e.editorStore.isPreviewModeOpen } }), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.editorStore.isPreviewModeOpen, expression: "!editorStore.isPreviewModeOpen" }], staticClass: "guido-editor__container", attrs: { id: "guido-editor" } })], 1);
7
+ }, a = [], d = /* @__PURE__ */ t(
8
8
  o,
9
9
  s,
10
- _,
10
+ a,
11
11
  !1,
12
12
  null,
13
- "89bedf08"
13
+ "f09e89b0"
14
14
  );
15
- const f = a.exports;
15
+ const m = d.exports;
16
16
  export {
17
- f as default
17
+ m as default
18
18
  };
@@ -1,11 +1,12 @@
1
- import { defineComponent as h, onMounted as w } from "vue";
2
- import { provideGuidoActions as D } from "../composables/useGuidoActions.js";
3
- import { usePartner as E } from "../composables/usePartner.js";
4
- import { useStripo as S } from "../composables/useStripo.js";
5
- import { DefaultUsername as _, DefaultGuidoConfig as G } from "../enums/defaults.js";
6
- import I from "./organisms/header/HeaderWrapper.vue.js";
7
- import { useStripoApi as k } from "../services/stripoApi.js";
8
- const B = /* @__PURE__ */ h({
1
+ import { defineComponent as E, onMounted as D } from "vue";
2
+ import { usePartner as _ } from "../composables/usePartner.js";
3
+ import { useStripo as b } from "../composables/useStripo.js";
4
+ import { DefaultUsername as I, DefaultGuidoConfig as P } from "../enums/defaults.js";
5
+ import S from "./organisms/design-preview/EmailPreview.vue.js";
6
+ import G from "./organisms/header/HeaderWrapper.vue.js";
7
+ import { useStripoApi as T } from "../services/stripoApi.js";
8
+ import { useEditorStore as N } from "../stores/editor.js";
9
+ const M = /* @__PURE__ */ E({
9
10
  __name: "Guido",
10
11
  props: {
11
12
  templateId: null,
@@ -15,66 +16,53 @@ const B = /* @__PURE__ */ h({
15
16
  username: null,
16
17
  html: null,
17
18
  css: null,
18
- guidoConfig: null
19
+ guidoConfig: null,
20
+ emailData: null
19
21
  },
20
- emits: ["dynamic-content:open", "back", "save:start", "save:complete"],
21
- setup(C, { expose: b, emit: t }) {
22
- const o = C, { getPartnerName: n, getProductType: a } = E(), {
23
- templateId: c,
24
- userId: s,
25
- guidoConfig: i,
26
- html: r = "",
27
- css: l = "",
28
- partnerName: d = n(),
29
- productType: u = a(),
30
- username: m = _
31
- } = o;
22
+ emits: ["dynamic-content:open"],
23
+ setup(h, { expose: v, emit: t }) {
24
+ const n = h, { getPartnerName: o, getProductType: i } = _(), {
25
+ templateId: r,
26
+ userId: a,
27
+ guidoConfig: c,
28
+ html: l = "",
29
+ css: s = "",
30
+ partnerName: m = o(),
31
+ productType: d = i(),
32
+ username: u = I
33
+ } = n;
32
34
  window.GuidoConfig = {
33
- ...G,
34
- ...i
35
+ ...P,
36
+ ...c
35
37
  };
36
- const { initPlugin: p } = S({ emailId: c, userId: s, username: m, partnerName: d, productType: u }), { getDefaultTemplate: g } = k();
37
- D({
38
- onBack: () => {
39
- console.debug("guido:back"), t("back");
40
- },
41
- onSaveStart: () => {
42
- console.debug("guido:save:start"), t("save:start");
43
- },
44
- onSaveComplete: (e) => {
45
- console.debug("guido:save:complete", e), t("save:complete", e);
46
- }
47
- });
48
- const f = (e) => {
38
+ const { initPlugin: p } = b({ emailId: r, userId: a, username: u, partnerName: m, productType: d }), { getDefaultTemplate: f } = T(), w = N(), y = (e) => {
49
39
  console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
50
- }, y = () => {
40
+ }, g = () => {
51
41
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
52
42
  };
53
- return w(async () => {
43
+ return D(async () => {
54
44
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
55
45
  try {
56
46
  let e = {
57
- html: r,
58
- css: l,
59
- forceRecreate: !0
60
- // TODO: It should be false for old templates. We will communicate with Stripo
47
+ html: l,
48
+ css: s
61
49
  };
62
- e.html || (e = await g()), await p(e);
50
+ e.html || (e = await f()), await p(e);
63
51
  } catch (e) {
64
52
  console.error("Failed to initialize Stripo editor:", e);
65
53
  }
66
54
  document.addEventListener("dynamic-content:open", (e) => {
67
- const v = e;
68
- console.debug("dynamic-content:open", v.detail), t("dynamic-content:open", v.detail);
55
+ const C = e;
56
+ console.debug("dynamic-content:open", C.detail), t("dynamic-content:open", C.detail);
69
57
  });
70
- }), b({
58
+ }), v({
71
59
  dynamicContent: {
72
- insert: f,
73
- close: y
60
+ insert: y,
61
+ close: g
74
62
  }
75
- }), { __sfc: !0, props: o, getPartnerName: n, getProductType: a, templateId: c, userId: s, guidoConfig: i, html: r, css: l, partnerName: d, productType: u, username: m, emit: t, initPlugin: p, getDefaultTemplate: g, insertDynamicContent: f, closeDynamicContent: y, HeaderWrapper: I };
63
+ }), { __sfc: !0, props: n, getPartnerName: o, getProductType: i, templateId: r, userId: a, guidoConfig: c, html: l, css: s, partnerName: m, productType: d, username: u, emit: t, initPlugin: p, getDefaultTemplate: f, editorStore: w, insertDynamicContent: y, closeDynamicContent: g, EmailPreview: S, HeaderWrapper: G };
76
64
  }
77
65
  });
78
66
  export {
79
- B as default
67
+ M as default
80
68
  };
@@ -0,0 +1,16 @@
1
+ import type { EmailData } from '@@/Types/generic';
2
+ interface Props {
3
+ emailHtml: string;
4
+ emailData?: EmailData;
5
+ }
6
+ 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, {}, 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
+ };
@@ -0,0 +1,22 @@
1
+ import a from "./DesktopPreview.vue2.js";
2
+ /* empty css */
3
+ import i from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var r = function() {
5
+ var e = this, s = e._self._c, t = e._self._setupProxy;
6
+ return s(t.InContainer, { staticClass: "s-2 m-b-5", attrs: { "full-width-content-status": "", "header-status": "", "border-radius": "bor-r-1", "container-type": "default", "footer-status": !1 }, scopedSlots: e._u([{ key: "headerLeftSlot", fn: function() {
7
+ return [s("div", { staticClass: "d-f a-i-c j-c-s-b w-1" }, [s("div", { staticClass: "d-f a-i-c" }, [s("div", { staticClass: "b-c-49 bor-r-100 w-5-s h-5-s d-f a-i-c j-c-c" }, [s(t.InIcons, { attrs: { name: "line-menu-profile" } })], 1), s("div", { staticClass: "d-f f-d-c ml-2" }, [s("p", { staticClass: "t-c-53 f-w-600 f-s-1 l-h-1" }, [e._v(" " + e._s(t.senderName) + " ")]), s("p", { staticClass: "t-c-55 f-w-400 f-s-12 l-h-1" }, [e._v(" " + e._s(t.subject) + " ")])])])])];
8
+ }, proxy: !0 }, { key: "headerRightSlot", fn: function() {
9
+ return [s("div", { staticClass: "d-f a-i-c j-c-c" }, [s(t.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: t.emailSize, "max-value": t.MAX_EMAIL_SIZE, type: t.progressType, value: t.progressValue } }), s(t.InTooltip, { staticClass: "d-f ml-1", attrs: { id: "email-size-tooltip", align: "center", position: "bottom", text: t.trans("email.guido-preview.design-size-warning") } })], 1)];
10
+ }, proxy: !0 }]) }, [s("iframe", { staticClass: "email-iframe w-1 h-1 bor-w-0", attrs: { sandbox: "allow-same-origin allow-popups allow-forms allow-scripts", srcdoc: e.emailHtml } })]);
11
+ }, o = [], l = /* @__PURE__ */ i(
12
+ a,
13
+ r,
14
+ o,
15
+ !1,
16
+ null,
17
+ "b07fa463"
18
+ );
19
+ const p = l.exports;
20
+ export {
21
+ p as default
22
+ };
@@ -0,0 +1,28 @@
1
+ import { defineComponent as d, computed as c, ref as a, watch as _ } from "vue";
2
+ import { useTranslations as I } from "../../../composables/useTranslations.js";
3
+ import { InTooltip as S, InProgress as b, InIcons as h, InContainer as v } from "@useinsider/design-system-vue";
4
+ const w = /* @__PURE__ */ d({
5
+ __name: "DesktopPreview",
6
+ props: {
7
+ emailHtml: null,
8
+ emailData: null
9
+ },
10
+ setup(i) {
11
+ const t = i, u = c(() => {
12
+ var e;
13
+ return ((e = t.emailData) == null ? void 0 : e.senderName) || "{Sender Name}";
14
+ }), p = c(() => {
15
+ var e;
16
+ return ((e = t.emailData) == null ? void 0 : e.subject) || "{Subject | Your Subject}";
17
+ }), o = 102, r = a("~-- KB"), l = a(0), s = a("success"), f = I(), m = () => {
18
+ if (!t.emailHtml)
19
+ return;
20
+ const e = new Blob([t.emailHtml]).size, n = Math.round(e / 1024);
21
+ r.value = `~${n} KB`, l.value = Math.min(n, o), n < 102 ? s.value = "success" : s.value = "warning";
22
+ };
23
+ return _(() => t.emailHtml, m, { immediate: !0 }), { __sfc: !0, props: t, senderName: u, subject: p, MAX_EMAIL_SIZE: o, emailSize: r, progressValue: l, progressType: s, trans: f, calculateEmailSize: m, InContainer: v, InIcons: h, InProgress: b, InTooltip: S };
24
+ }
25
+ });
26
+ export {
27
+ w as default
28
+ };
@@ -0,0 +1,16 @@
1
+ import type { EmailData } from '@@/Types/generic';
2
+ interface Props {
3
+ isVisible: boolean;
4
+ emailData?: EmailData;
5
+ }
6
+ 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, {}, 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
+ };
@@ -0,0 +1,17 @@
1
+ import s from "./EmailPreview.vue2.js";
2
+ import i from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var r = function() {
4
+ var a = this, e = a._self._c, t = a._self._setupProxy;
5
+ return a.isVisible ? e("div", { staticClass: "d-f f-d-c h-1 b-c-5 bor-r-2" }, [e("div", { staticClass: "f-g-1 d-f p-5 o-a g-4 min-h-600" }, [e(t.DesktopPreview, { staticClass: "f-g-1 min-w-0", attrs: { "email-data": a.emailData, "email-html": t.currentHtml } }), e(t.MobilePreview, { staticClass: "f-0 min-w-a", attrs: { "email-data": a.emailData, "email-html": t.currentHtml, "is-amp": t.isAmp } })], 1)]) : a._e();
6
+ }, l = [], m = /* @__PURE__ */ i(
7
+ s,
8
+ r,
9
+ l,
10
+ !1,
11
+ null,
12
+ null
13
+ );
14
+ const c = m.exports;
15
+ export {
16
+ c as default
17
+ };
@@ -0,0 +1,37 @@
1
+ import { defineComponent as w, ref as c, computed as p, watch as u, onMounted as b } from "vue";
2
+ import { useDebounce as P } from "../../../composables/useDebounce.js";
3
+ import { usePreviewMode as _ } from "../../../composables/usePreviewMode.js";
4
+ import { useToaster as h } from "../../../composables/useToaster.js";
5
+ import { useEditorStore as V } from "../../../stores/editor.js";
6
+ import y from "./DesktopPreview.vue.js";
7
+ import F from "./MobilePreview.vue.js";
8
+ const x = /* @__PURE__ */ w({
9
+ __name: "EmailPreview",
10
+ props: {
11
+ isVisible: { type: Boolean },
12
+ emailData: null
13
+ },
14
+ setup(d) {
15
+ const o = d, { compile: a } = _(), { debounce: l } = P(), { handleError: m } = h(), e = V(), i = c(""), r = c(!1), f = p(() => e.emailFormat === "amp" && e.ampHtml ? e.ampHtml : i.value), v = p(() => e.emailFormat === "amp"), t = async () => {
16
+ r.value = !0;
17
+ try {
18
+ const s = await a();
19
+ i.value = s.html;
20
+ } catch {
21
+ console.error("Failed to load preview"), m("Failed to load preview", "Preview compilation");
22
+ } finally {
23
+ r.value = !1;
24
+ }
25
+ }, n = () => {
26
+ l(t, 350);
27
+ };
28
+ return u(() => o.isVisible, (s) => s && t()), u(() => e.editorVisualMode, () => {
29
+ o.isVisible && n();
30
+ }), b(() => {
31
+ o.isVisible && t();
32
+ }), { __sfc: !0, props: o, compile: a, debounce: l, handleError: m, editorStore: e, html: i, isLoading: r, currentHtml: f, isAmp: v, loadPreview: t, debouncedReload: n, DesktopPreview: y, MobilePreview: F };
33
+ }
34
+ });
35
+ export {
36
+ x as default
37
+ };
@@ -0,0 +1,18 @@
1
+ interface Props {
2
+ emailHtml: string;
3
+ isAmp?: boolean;
4
+ }
5
+ 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, {
6
+ "back-to-inbox": () => void;
7
+ load: () => void;
8
+ }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>>, {}>;
9
+ export default _default;
10
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
+ type __VLS_TypePropsToOption<T> = {
12
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
13
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
14
+ } : {
15
+ type: import('vue').PropType<T[K]>;
16
+ required: true;
17
+ };
18
+ };
@@ -0,0 +1,19 @@
1
+ import n from "./EmailView.vue2.js";
2
+ import c from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var e = function() {
4
+ var a = this, s = a._self._c, t = a._self._setupProxy;
5
+ return s("div", { staticClass: "w-1 h-1 b-c-4 d-f f-d-c" }, [s("div", { staticClass: "d-f j-c-s-b a-i-c p-2 h-6-s" }, [s("div", { staticClass: "d-f a-i-c cur-p", on: { click: function(r) {
6
+ return a.$emit("back-to-inbox");
7
+ } } }, [s(t.InIcons, { staticClass: "f-s-3 i-c-7", attrs: { name: "line-chevron-left" } }), s("span", { staticClass: "ml-2 f-s-1 f-w-400 l-h-1 t-c-7" }, [a._v(a._s(t.trans("newsletter.inbox")))])], 1), s("div", { staticClass: "d-f a-i-c" }, [s(t.InIcons, { staticClass: "i-c-52", attrs: { name: "line-chevron-down" } }), s(t.InIcons, { staticClass: "ml-1 i-c-52", attrs: { name: "line-chevron-up" } })], 1)]), s("iframe", { ref: "iframeRef", staticClass: "f-g-1 w-1 d-b b-c-4 bor-s-n", attrs: { sandbox: "allow-same-origin allow-popups allow-forms allow-scripts", srcdoc: a.emailHtml }, on: { load: t.onLoad } })]);
8
+ }, i = [], o = /* @__PURE__ */ c(
9
+ n,
10
+ e,
11
+ i,
12
+ !1,
13
+ null,
14
+ null
15
+ );
16
+ const d = o.exports;
17
+ export {
18
+ d as default
19
+ };
@@ -0,0 +1,24 @@
1
+ import { defineComponent as p, ref as c } from "vue";
2
+ import { useMobileGmailFit as u } from "../../../composables/useMobileGmailFit.js";
3
+ import { useTranslations as f } from "../../../composables/useTranslations.js";
4
+ import { InIcons as d } from "@useinsider/design-system-vue";
5
+ const E = /* @__PURE__ */ p({
6
+ __name: "EmailView",
7
+ props: {
8
+ emailHtml: null,
9
+ isAmp: { type: Boolean }
10
+ },
11
+ emits: ["back-to-inbox", "load"],
12
+ setup(l, { emit: t }) {
13
+ const o = l, a = f(), n = c(), { setupMobileGmailFit: m } = u(), s = () => !!o.isAmp && o.emailHtml.includes("@media") && o.emailHtml.includes(".adapt-img"), r = (e) => {
14
+ e.documentElement.style.removeProperty("transform"), e.documentElement.style.removeProperty("transform-origin"), e.documentElement.style.removeProperty("height");
15
+ };
16
+ return { __sfc: !0, props: o, emit: t, trans: a, iframeRef: n, setupMobileGmailFit: m, isAmpResponsive: s, clearAmpTransforms: r, onLoad: () => {
17
+ const e = n.value, i = e == null ? void 0 : e.contentDocument;
18
+ !e || !i || (m(e), s() && setTimeout(() => r(i), 50), t("load"));
19
+ }, InIcons: d };
20
+ }
21
+ });
22
+ export {
23
+ E as default
24
+ };
@@ -0,0 +1,17 @@
1
+ import type { EmailData } from '@@/Types/generic';
2
+ interface Props {
3
+ emailData?: EmailData;
4
+ }
5
+ 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, {
6
+ "open-email": () => void;
7
+ }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<Props>>>, {}>;
8
+ export default _default;
9
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
+ type __VLS_TypePropsToOption<T> = {
11
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
12
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
+ } : {
14
+ type: import('vue').PropType<T[K]>;
15
+ required: true;
16
+ };
17
+ };
@@ -0,0 +1,19 @@
1
+ import a from "./InboxView.vue2.js";
2
+ import e from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var n = function() {
4
+ var s = this, t = s._self._c, c = s._self._setupProxy;
5
+ return t("div", { staticClass: "p-y-13 p-x-3 bor-b-w-1 bor-b-s-s bor-b-c-50 cur-p b-c-4 b-c-h-5 p-3", on: { click: function(l) {
6
+ return s.$emit("open-email");
7
+ } } }, [t("div", { staticClass: "d-f j-c-s-b a-i-c w-1" }, [t("div", { staticClass: "f-g-1 min-w-0-s" }, [t("div", { staticClass: "f-s-1 f-w-600 t-c-53 l-h-1 mb-12" }, [s._v(" " + s._s(c.senderName) + " ")]), t("div", { staticClass: "f-s-12 f-w-400 t-c-55 l-h-1" }, [s._v(" " + s._s(c.subject) + " ")])]), t("div", { staticClass: "f-sh-0 ml-2 f-s-12 f-w-400 t-c-55 l-h-1" }, [s._v(" " + s._s(c.trans("product-catalog.today")) + " ")]), t(c.InIcons, { staticClass: "i-c-52", attrs: { name: "line-chevron-right" } })], 1)]);
8
+ }, r = [], i = /* @__PURE__ */ e(
9
+ a,
10
+ n,
11
+ r,
12
+ !1,
13
+ null,
14
+ null
15
+ );
16
+ const m = i.exports;
17
+ export {
18
+ m as default
19
+ };