@useinsider/guido 1.0.0-beta.e415f9e → 1.0.0-beta.e490934
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -21
- package/dist/@types/generic.d.ts +4 -0
- package/dist/components/Guido.vue.d.ts +7 -2
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +49 -31
- package/dist/components/organisms/design-preview/AmpErrorModal.vue.d.ts +16 -0
- package/dist/components/organisms/design-preview/AmpErrorModal.vue.js +21 -0
- package/dist/components/organisms/design-preview/AmpErrorModal.vue2.js +30 -0
- package/dist/components/organisms/design-preview/DesktopPreview.vue.d.ts +16 -0
- package/dist/components/organisms/design-preview/DesktopPreview.vue.js +22 -0
- package/dist/components/organisms/design-preview/DesktopPreview.vue2.js +42 -0
- package/dist/components/organisms/design-preview/EmailPreview.vue.d.ts +16 -0
- package/dist/components/organisms/design-preview/EmailPreview.vue.js +17 -0
- package/dist/components/organisms/design-preview/EmailPreview.vue2.js +33 -0
- package/dist/components/organisms/design-preview/EmailView.vue.d.ts +18 -0
- package/dist/components/organisms/design-preview/EmailView.vue.js +19 -0
- package/dist/components/organisms/design-preview/EmailView.vue2.js +24 -0
- package/dist/components/organisms/design-preview/InboxView.vue.d.ts +17 -0
- package/dist/components/organisms/design-preview/InboxView.vue.js +19 -0
- package/dist/components/organisms/design-preview/InboxView.vue2.js +23 -0
- package/dist/components/organisms/design-preview/MobilePreview.vue.d.ts +17 -0
- package/dist/components/organisms/design-preview/MobilePreview.vue.js +17 -0
- package/dist/components/organisms/design-preview/MobilePreview.vue2.js +24 -0
- package/dist/components/organisms/header/AmpToggle.vue.d.ts +2 -0
- package/dist/components/organisms/header/AmpToggle.vue.js +17 -0
- package/dist/components/organisms/header/AmpToggle.vue2.js +48 -0
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +10 -8
- package/dist/components/organisms/header/MiddleSlot.vue.js +4 -4
- package/dist/components/organisms/header/MiddleSlot.vue2.js +17 -14
- package/dist/components/organisms/header/RightSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue2.js +28 -14
- package/dist/components/organisms/header/ViewOptions.vue.js +6 -6
- package/dist/composables/useActionsApi.d.ts +2 -0
- package/dist/composables/useActionsApi.js +47 -36
- package/dist/composables/useDebounce.d.ts +4 -0
- package/dist/composables/useDebounce.js +12 -0
- package/dist/composables/useGuidoActions.d.ts +46 -0
- package/dist/composables/useGuidoActions.js +37 -0
- package/dist/composables/useMobileGmailFit.d.ts +5 -0
- package/dist/composables/useMobileGmailFit.js +69 -0
- package/dist/composables/useProvideInject.d.ts +14 -0
- package/dist/composables/useProvideInject.js +17 -0
- package/dist/composables/useStripo.js +15 -15
- package/dist/enums/gmailMobilePreview.d.ts +7 -0
- package/dist/enums/gmailMobilePreview.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +26 -17
- package/dist/static/assets/inbox-mockup.svg.js +4 -0
- package/dist/static/assets/phone-mockup.svg.js +4 -0
- package/dist/stores/editor.d.ts +4 -0
- package/dist/stores/editor.js +7 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,10 +27,15 @@ npm install @useinsider/guido
|
|
|
27
27
|
<div>
|
|
28
28
|
<Guido
|
|
29
29
|
ref="guidoEditor"
|
|
30
|
-
:
|
|
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
|
-
|
|
48
|
-
userId: '
|
|
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.$
|
|
65
|
-
text: 'Text',
|
|
66
|
-
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.$
|
|
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
|
-
| `
|
|
89
|
-
| `userId` | `string` | ✅ | - | Unique identifier for the user
|
|
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
|
package/dist/@types/generic.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { DynamicContent, GuidoConfig } from '@@/Types/generic';
|
|
1
|
+
import type { DynamicContent, GuidoConfig, EmailData } from '@@/Types/generic';
|
|
2
|
+
import type { Template } from '@@/Types/stripo';
|
|
2
3
|
type __VLS_Props = {
|
|
3
|
-
|
|
4
|
+
templateId: string;
|
|
4
5
|
userId: string;
|
|
5
6
|
partnerName?: string;
|
|
6
7
|
productType?: string;
|
|
@@ -8,6 +9,7 @@ type __VLS_Props = {
|
|
|
8
9
|
html?: string;
|
|
9
10
|
css?: string;
|
|
10
11
|
guidoConfig: GuidoConfig;
|
|
12
|
+
emailData?: EmailData;
|
|
11
13
|
};
|
|
12
14
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
13
15
|
dynamicContent: {
|
|
@@ -16,6 +18,9 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
|
|
|
16
18
|
};
|
|
17
19
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
18
20
|
"dynamic-content:open": (detail: DynamicContent | null) => void;
|
|
21
|
+
back: () => void;
|
|
22
|
+
"save:start": () => void;
|
|
23
|
+
"save:complete": (template: Omit<Template, "forceRecreate">) => void;
|
|
19
24
|
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
20
25
|
export default _default;
|
|
21
26
|
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
|
|
3
|
+
import t from "../_virtual/_plugin-vue2_normalizer.js";
|
|
4
4
|
var s = function() {
|
|
5
|
-
var
|
|
6
|
-
return r("div", { staticClass: "guido-editor__wrapper" }, [r(
|
|
7
|
-
},
|
|
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
|
-
"
|
|
13
|
+
"7836f831"
|
|
14
14
|
);
|
|
15
|
-
const
|
|
15
|
+
const m = d.exports;
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
m as default
|
|
18
18
|
};
|
|
@@ -1,65 +1,83 @@
|
|
|
1
|
-
import { defineComponent as w, onMounted as
|
|
2
|
-
import {
|
|
1
|
+
import { defineComponent as w, onMounted as E } from "vue";
|
|
2
|
+
import { provideGuidoActions as S } from "../composables/useGuidoActions.js";
|
|
3
|
+
import { usePartner as D } from "../composables/usePartner.js";
|
|
3
4
|
import { useStripo as _ } from "../composables/useStripo.js";
|
|
4
|
-
import { DefaultUsername as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
5
|
+
import { DefaultUsername as G, DefaultGuidoConfig as I } from "../enums/defaults.js";
|
|
6
|
+
import P from "./organisms/design-preview/EmailPreview.vue.js";
|
|
7
|
+
import k from "./organisms/header/HeaderWrapper.vue.js";
|
|
8
|
+
import { useStripoApi as T } from "../services/stripoApi.js";
|
|
9
|
+
import { useEditorStore as N } from "../stores/editor.js";
|
|
10
|
+
const M = /* @__PURE__ */ w({
|
|
8
11
|
__name: "Guido",
|
|
9
12
|
props: {
|
|
10
|
-
|
|
13
|
+
templateId: null,
|
|
11
14
|
userId: null,
|
|
12
15
|
partnerName: null,
|
|
13
16
|
productType: null,
|
|
14
17
|
username: null,
|
|
15
18
|
html: null,
|
|
16
19
|
css: null,
|
|
17
|
-
guidoConfig: null
|
|
20
|
+
guidoConfig: null,
|
|
21
|
+
emailData: null
|
|
18
22
|
},
|
|
19
|
-
emits: ["dynamic-content:open"],
|
|
20
|
-
setup(
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
userId:
|
|
24
|
-
guidoConfig:
|
|
23
|
+
emits: ["dynamic-content:open", "back", "save:start", "save:complete"],
|
|
24
|
+
setup(C, { expose: b, emit: t }) {
|
|
25
|
+
const o = C, { getPartnerName: n, getProductType: a } = D(), {
|
|
26
|
+
templateId: c,
|
|
27
|
+
userId: r,
|
|
28
|
+
guidoConfig: i,
|
|
25
29
|
html: s = "",
|
|
26
30
|
css: l = "",
|
|
27
|
-
partnerName:
|
|
28
|
-
productType:
|
|
29
|
-
username: m =
|
|
30
|
-
} =
|
|
31
|
+
partnerName: d = n(),
|
|
32
|
+
productType: u = a(),
|
|
33
|
+
username: m = G
|
|
34
|
+
} = o;
|
|
31
35
|
window.GuidoConfig = {
|
|
32
|
-
...
|
|
33
|
-
...
|
|
36
|
+
...I,
|
|
37
|
+
...i
|
|
34
38
|
};
|
|
35
|
-
const { initPlugin: p } = _({ emailId: c, userId:
|
|
39
|
+
const { initPlugin: p } = _({ emailId: c, userId: r, username: m, partnerName: d, productType: u }), { getDefaultTemplate: f } = T(), h = N();
|
|
40
|
+
S({
|
|
41
|
+
onBack: () => {
|
|
42
|
+
console.debug("guido:back"), t("back");
|
|
43
|
+
},
|
|
44
|
+
onSaveStart: () => {
|
|
45
|
+
console.debug("guido:save:start"), t("save:start");
|
|
46
|
+
},
|
|
47
|
+
onSaveComplete: (e) => {
|
|
48
|
+
console.debug("guido:save:complete", e), t("save:complete", e);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const g = (e) => {
|
|
36
52
|
console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
37
|
-
},
|
|
53
|
+
}, y = () => {
|
|
38
54
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
39
55
|
};
|
|
40
|
-
return
|
|
56
|
+
return E(async () => {
|
|
41
57
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
42
58
|
try {
|
|
43
59
|
let e = {
|
|
44
60
|
html: s,
|
|
45
|
-
css: l
|
|
61
|
+
css: l,
|
|
62
|
+
forceRecreate: !0
|
|
63
|
+
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
46
64
|
};
|
|
47
65
|
e.html || (e = await f()), await p(e);
|
|
48
66
|
} catch (e) {
|
|
49
67
|
console.error("Failed to initialize Stripo editor:", e);
|
|
50
68
|
}
|
|
51
69
|
document.addEventListener("dynamic-content:open", (e) => {
|
|
52
|
-
const
|
|
53
|
-
console.debug("dynamic-content:open",
|
|
70
|
+
const v = e;
|
|
71
|
+
console.debug("dynamic-content:open", v.detail), t("dynamic-content:open", v.detail);
|
|
54
72
|
});
|
|
55
|
-
}),
|
|
73
|
+
}), b({
|
|
56
74
|
dynamicContent: {
|
|
57
|
-
insert:
|
|
58
|
-
close:
|
|
75
|
+
insert: g,
|
|
76
|
+
close: y
|
|
59
77
|
}
|
|
60
|
-
}), { __sfc: !0, props:
|
|
78
|
+
}), { __sfc: !0, props: o, getPartnerName: n, getProductType: a, templateId: c, userId: r, guidoConfig: i, html: s, css: l, partnerName: d, productType: u, username: m, emit: t, initPlugin: p, getDefaultTemplate: f, editorStore: h, insertDynamicContent: g, closeDynamicContent: y, EmailPreview: P, HeaderWrapper: k };
|
|
61
79
|
}
|
|
62
80
|
});
|
|
63
81
|
export {
|
|
64
|
-
|
|
82
|
+
M as default
|
|
65
83
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
errors: string[];
|
|
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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import n from "./AmpErrorModal.vue2.js";
|
|
2
|
+
import a from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var i = function() {
|
|
4
|
+
var e = this, o = e._self._c, t = e._self._setupProxy;
|
|
5
|
+
return o(t.InModalV2, { attrs: { id: "amp-error-modal", "close-button-status": "", "close-on-outside-click": "", "description-status": "", "footer-status": "", status: "", size: "medium", "description-text": t.trans("email-editor.amp-validation-description"), "footer-button-group-options": t.footerButtonOptions, "title-text": t.trans("email-editor.amp-validation-title") }, on: { cancelOrBackButtonEvent: t.handleClose, onCloseEvent: t.handleClose, primaryButtonEvent: t.handleFixInCodeEditor }, scopedSlots: e._u([{ key: "contentSlot", fn: function() {
|
|
6
|
+
return [o("div", { staticClass: "d-f f-d-c" }, [o("div", { staticClass: "mb-3" }, [o("div", { staticClass: "l-s-5 f-s-1 f-w-600 t-c-55 t-t-u" }, [e._v(" " + e._s(`${t.trans("products.errors")}(${t.errorCount})`) + " ")])]), o("div", { staticClass: "d-f f-d-c g-13 max-h-21-s o-y-a", staticStyle: { gap: "16px" } }, e._l(t.props.errors, function(s, r) {
|
|
7
|
+
return o(t.InOnPageMessage, { key: r, attrs: { icon: "filled-error-box", size: "medium", type: "alert", text: s } });
|
|
8
|
+
}), 1)])];
|
|
9
|
+
}, proxy: !0 }]) });
|
|
10
|
+
}, l = [], d = /* @__PURE__ */ a(
|
|
11
|
+
n,
|
|
12
|
+
i,
|
|
13
|
+
l,
|
|
14
|
+
!1,
|
|
15
|
+
null,
|
|
16
|
+
null
|
|
17
|
+
);
|
|
18
|
+
const f = d.exports;
|
|
19
|
+
export {
|
|
20
|
+
f as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineComponent as m } from "vue";
|
|
2
|
+
import { useToaster as f } from "../../../composables/useToaster.js";
|
|
3
|
+
import { useTranslations as u } from "../../../composables/useTranslations.js";
|
|
4
|
+
import { useEditorStore as E } from "../../../stores/editor.js";
|
|
5
|
+
import { InOnPageMessage as g, InModalV2 as y } from "@useinsider/design-system-vue";
|
|
6
|
+
const x = /* @__PURE__ */ m({
|
|
7
|
+
__name: "AmpErrorModal",
|
|
8
|
+
props: {
|
|
9
|
+
errors: null
|
|
10
|
+
},
|
|
11
|
+
emits: ["close"],
|
|
12
|
+
setup(a, { emit: o }) {
|
|
13
|
+
const r = a, e = u(), t = E(), { showToaster: i } = f(), p = r.errors.length, d = () => {
|
|
14
|
+
o("close");
|
|
15
|
+
}, l = () => {
|
|
16
|
+
var n, s;
|
|
17
|
+
o("close"), t.isPreviewModeOpen = !1, (s = (n = window.StripoEditorApi) == null ? void 0 : n.codeEditorApi) != null && s.openCodeEditor ? window.StripoEditorApi.codeEditorApi.openCodeEditor() : i({
|
|
18
|
+
type: "error",
|
|
19
|
+
message: "StripoEditorApi codeEditorApi not available"
|
|
20
|
+
});
|
|
21
|
+
}, c = {
|
|
22
|
+
primaryButton: { type: "primary", labelText: e("email-editor.amp-validation-fix") },
|
|
23
|
+
cancelOrBackButton: { type: "secondary", labelText: e("campaign-builder.cancel"), styling: "ghost" }
|
|
24
|
+
};
|
|
25
|
+
return { __sfc: !0, props: r, emit: o, trans: e, editorStore: t, showToaster: i, errorCount: p, handleClose: d, handleFixInCodeEditor: l, footerButtonOptions: c, InModalV2: y, InOnPageMessage: g };
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
x as default
|
|
30
|
+
};
|
|
@@ -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 i from "./DesktopPreview.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import a from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var r = function() {
|
|
5
|
+
var e = this, t = e._self._c, s = e._self._setupProxy;
|
|
6
|
+
return t("div", { ref: "containerRef", staticStyle: { "min-height": "720px", height: "80vh" } }, [t(s.InContainer, { staticClass: "s-2 m-b-5 desktop-preview-container", 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 [t("div", { staticClass: "d-f a-i-c j-c-s-b w-1" }, [t("div", { staticClass: "d-f a-i-c" }, [t("div", { staticClass: "b-c-49 bor-r-100 w-5-s h-5-s d-f a-i-c j-c-c" }, [t(s.InIcons, { attrs: { name: "line-menu-profile" } })], 1), t("div", { staticClass: "d-f f-d-c ml-2" }, [t("p", { staticClass: "t-c-53 f-w-600 f-s-1 l-h-1" }, [e._v(" " + e._s(s.senderName) + " ")]), t("p", { staticClass: "t-c-55 f-w-400 f-s-12 l-h-1" }, [e._v(" " + e._s(s.subject) + " ")])])])])];
|
|
8
|
+
}, proxy: !0 }, { key: "headerRightSlot", fn: function() {
|
|
9
|
+
return [t("div", { staticClass: "d-f a-i-c j-c-c" }, [t(s.InProgress, { staticClass: "min-w-15-s", attrs: { id: "email-size-progress", "description-status": "", "description-position": "left", description: s.emailSize, "max-value": s.MAX_EMAIL_WEIGHT, type: s.progressType, value: s.progressValue } }), t(s.InTooltip, { staticClass: "d-f ml-1", attrs: { id: "email-size-tooltip", align: "center", position: "bottom", text: s.trans("email-editor.preview-design-size-tooltip") } })], 1)];
|
|
10
|
+
}, proxy: !0 }]) }, [t("iframe", { staticClass: "email-iframe w-1 bor-w-0", style: { height: s.iframeHeight }, attrs: { sandbox: "allow-same-origin allow-popups allow-forms allow-scripts", srcdoc: e.emailHtml } })])], 1);
|
|
11
|
+
}, o = [], l = /* @__PURE__ */ a(
|
|
12
|
+
i,
|
|
13
|
+
r,
|
|
14
|
+
o,
|
|
15
|
+
!1,
|
|
16
|
+
null,
|
|
17
|
+
"af6f2286"
|
|
18
|
+
);
|
|
19
|
+
const d = l.exports;
|
|
20
|
+
export {
|
|
21
|
+
d as default
|
|
22
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineComponent as I, computed as d, ref as n, onMounted as B, onUnmounted as w, watch as z } from "vue";
|
|
2
|
+
import { useTranslations as E } from "../../../composables/useTranslations.js";
|
|
3
|
+
import { InTooltip as M, InProgress as R, InIcons as y, InContainer as C } from "@useinsider/design-system-vue";
|
|
4
|
+
const j = /* @__PURE__ */ I({
|
|
5
|
+
__name: "DesktopPreview",
|
|
6
|
+
props: {
|
|
7
|
+
emailHtml: null,
|
|
8
|
+
emailData: null
|
|
9
|
+
},
|
|
10
|
+
setup(h) {
|
|
11
|
+
const t = h, r = 102, i = E(), g = d(() => {
|
|
12
|
+
var e;
|
|
13
|
+
return ((e = t.emailData) == null ? void 0 : e.senderName) || `(${i("settings.sender-name")})`;
|
|
14
|
+
}), _ = d(() => {
|
|
15
|
+
var e;
|
|
16
|
+
return ((e = t.emailData) == null ? void 0 : e.subject) || i("newsletter.subject");
|
|
17
|
+
}), u = n("~-- KB"), m = n(0), l = n("success"), s = n(), p = n("400px"), v = () => {
|
|
18
|
+
if (!t.emailHtml)
|
|
19
|
+
return;
|
|
20
|
+
const e = new Blob([t.emailHtml]).size, o = Math.round(e / 1024);
|
|
21
|
+
u.value = `~${o} KB`, m.value = Math.min(o, r), o < r ? l.value = "success" : l.value = "warning";
|
|
22
|
+
}, c = () => {
|
|
23
|
+
if (!s.value)
|
|
24
|
+
return;
|
|
25
|
+
const e = s.value.querySelector(".in-container");
|
|
26
|
+
if (!e)
|
|
27
|
+
return;
|
|
28
|
+
const o = e.getBoundingClientRect(), f = e.querySelector(".in-container__header"), H = f ? f.getBoundingClientRect().height : 0, b = o.height - H;
|
|
29
|
+
p.value = `${b}px`;
|
|
30
|
+
}, a = n();
|
|
31
|
+
return B(() => {
|
|
32
|
+
c(), a.value = new ResizeObserver(() => {
|
|
33
|
+
c();
|
|
34
|
+
}), s.value && a.value.observe(s.value);
|
|
35
|
+
}), w(() => {
|
|
36
|
+
a.value && a.value.disconnect();
|
|
37
|
+
}), z(() => t.emailHtml, v, { immediate: !0 }), { __sfc: !0, MAX_EMAIL_WEIGHT: r, trans: i, props: t, senderName: g, subject: _, emailSize: u, progressValue: m, progressType: l, containerRef: s, iframeHeight: p, calculateEmailSize: v, calculateIframeHeight: c, resizeObserver: a, InContainer: C, InIcons: y, InProgress: R, InTooltip: M };
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
j as default
|
|
42
|
+
};
|
|
@@ -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 i from "./EmailPreview.vue2.js";
|
|
2
|
+
import e from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
+
var r = function() {
|
|
4
|
+
var t = this, s = t._self._c, a = t._self._setupProxy;
|
|
5
|
+
return t.isVisible ? s("div", { staticClass: "d-f f-d-c h-1 b-c-5 bor-r-2 pb-5" }, [s("div", { staticClass: "f-g-1 d-f p-5 o-a g-4 min-h-600" }, [a.isLoading ? [s("div", { staticClass: "d-f a-i-c j-c-c w-1 h-1 f-g-1" }, [s(a.InLoading, { attrs: { "color-class": "i-c-1", size: "32" } })], 1)] : [s(a.DesktopPreview, { staticClass: "f-g-1 min-w-0", attrs: { "email-data": t.emailData, "email-html": a.currentHtml } }), s(a.MobilePreview, { staticClass: "f-0 min-w-a", attrs: { "email-data": t.emailData, "email-html": a.currentHtml, "is-amp": a.isAmp } })]], 2)]) : t._e();
|
|
6
|
+
}, l = [], m = /* @__PURE__ */ e(
|
|
7
|
+
i,
|
|
8
|
+
r,
|
|
9
|
+
l,
|
|
10
|
+
!1,
|
|
11
|
+
null,
|
|
12
|
+
null
|
|
13
|
+
);
|
|
14
|
+
const f = m.exports;
|
|
15
|
+
export {
|
|
16
|
+
f as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent as u, ref as l, computed as n, watch as d, onMounted as v } from "vue";
|
|
2
|
+
import { useActionsApi as w } from "../../../composables/useActionsApi.js";
|
|
3
|
+
import { useToaster as y } from "../../../composables/useToaster.js";
|
|
4
|
+
import { useEditorStore as P } from "../../../stores/editor.js";
|
|
5
|
+
import { InLoading as _ } from "@useinsider/design-system-vue";
|
|
6
|
+
import g from "./DesktopPreview.vue.js";
|
|
7
|
+
import h from "./MobilePreview.vue.js";
|
|
8
|
+
const L = /* @__PURE__ */ u({
|
|
9
|
+
__name: "EmailPreview",
|
|
10
|
+
props: {
|
|
11
|
+
isVisible: { type: Boolean },
|
|
12
|
+
emailData: null
|
|
13
|
+
},
|
|
14
|
+
setup(p) {
|
|
15
|
+
const o = p, { getPreviewData: s } = w(), { showToaster: m } = y(), e = P(), t = l(""), r = l(!1), c = n(() => e.emailFormat === "amp" && e.ampHtml ? e.ampHtml : t.value), f = n(() => e.emailFormat === "amp"), a = async () => {
|
|
16
|
+
r.value = !0;
|
|
17
|
+
try {
|
|
18
|
+
const i = await s();
|
|
19
|
+
t.value = i.html;
|
|
20
|
+
} catch {
|
|
21
|
+
console.error("Failed to load preview"), m({ type: "error", message: "Failed to load email preview. Please try again later." });
|
|
22
|
+
} finally {
|
|
23
|
+
r.value = !1;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return d(() => o.isVisible, (i) => i && a()), v(() => {
|
|
27
|
+
o.isVisible && a();
|
|
28
|
+
}), { __sfc: !0, props: o, getPreviewData: s, showToaster: m, editorStore: e, html: t, isLoading: r, currentHtml: c, isAmp: f, loadPreview: a, InLoading: _, DesktopPreview: g, MobilePreview: h };
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
L as default
|
|
33
|
+
};
|
|
@@ -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
|
+
};
|