@useinsider/guido 1.0.0-beta.53042a3 → 1.0.0-beta.57ed29f
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 +17 -124
- package/dist/components/Guido.vue.d.ts +0 -4
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +31 -46
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +8 -10
- package/dist/components/organisms/header/RightSlot.vue.js +1 -1
- package/dist/components/organisms/header/RightSlot.vue2.js +14 -28
- package/dist/composables/useStripo.js +15 -15
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +2 -6
- package/package.json +1 -1
- package/dist/composables/useGuidoActions.d.ts +0 -46
- package/dist/composables/useGuidoActions.js +0 -37
- package/dist/composables/useProvideInject.d.ts +0 -14
- 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
|
-
:
|
|
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
|
-
|
|
53
|
-
userId: '
|
|
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(
|
|
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.$
|
|
89
|
-
text: '
|
|
90
|
-
value: '
|
|
91
|
-
fallback: 'Fallback
|
|
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.$
|
|
74
|
+
this.$ref.guidoEditor?.dynamicContent.close();
|
|
100
75
|
}
|
|
76
|
+
|
|
101
77
|
}
|
|
102
78
|
};
|
|
103
79
|
</script>
|
|
@@ -109,14 +85,12 @@ export default {
|
|
|
109
85
|
|
|
110
86
|
| Prop | Type | Required | Default | Description |
|
|
111
87
|
|------|------|----------|---------|-------------|
|
|
112
|
-
| `
|
|
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
94
|
|
|
121
95
|
### Guido Exposed Methods
|
|
122
96
|
```typescript
|
|
@@ -403,87 +377,6 @@ src/
|
|
|
403
377
|
└── library.ts # Main export
|
|
404
378
|
```
|
|
405
379
|
|
|
406
|
-
## 🔌 Provide/Inject Utilities
|
|
407
|
-
|
|
408
|
-
Guido includes type-safe utilities for Vue's provide/inject system to facilitate dependency injection between components.
|
|
409
|
-
|
|
410
|
-
### useProvideInject
|
|
411
|
-
|
|
412
|
-
The `useProvideInject` composable provides two helper functions for type-safe dependency injection:
|
|
413
|
-
|
|
414
|
-
#### Basic Usage
|
|
415
|
-
|
|
416
|
-
```typescript
|
|
417
|
-
// Parent component
|
|
418
|
-
import { provideValue } from '@useinsider/guido';
|
|
419
|
-
import { InjectionKey } from 'vue';
|
|
420
|
-
|
|
421
|
-
// Define a typed injection key
|
|
422
|
-
const MyServiceKey: InjectionKey<MyService> = Symbol('MyService');
|
|
423
|
-
|
|
424
|
-
// Provide the value
|
|
425
|
-
const myService = new MyService();
|
|
426
|
-
provideValue(MyServiceKey, myService);
|
|
427
|
-
|
|
428
|
-
// Child component
|
|
429
|
-
import { useInjectedValue } from '@useinsider/guido';
|
|
430
|
-
|
|
431
|
-
// Inject the value with type safety
|
|
432
|
-
const myService = useInjectedValue(MyServiceKey);
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
#### With Default Value
|
|
436
|
-
|
|
437
|
-
```typescript
|
|
438
|
-
// Inject with a fallback value
|
|
439
|
-
const myService = useInjectedValue(MyServiceKey, new DefaultService());
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
#### Error Handling
|
|
443
|
-
|
|
444
|
-
The `useInjectedValue` function will throw a descriptive error if no provider is found and no default value is provided:
|
|
445
|
-
|
|
446
|
-
```typescript
|
|
447
|
-
// This will throw an error if no provider exists
|
|
448
|
-
try {
|
|
449
|
-
const myService = useInjectedValue(MyServiceKey);
|
|
450
|
-
} catch (error) {
|
|
451
|
-
console.error('No provider found for MyService');
|
|
452
|
-
}
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
### API Reference
|
|
456
|
-
|
|
457
|
-
#### `provideValue`
|
|
458
|
-
|
|
459
|
-
```typescript
|
|
460
|
-
provideValue<T>(key: InjectionKey<T>, value: T): void
|
|
461
|
-
```
|
|
462
|
-
|
|
463
|
-
Provides a value using Vue's provide system with type safety.
|
|
464
|
-
|
|
465
|
-
| Parameter | Type | Description |
|
|
466
|
-
|-----------|------|-------------|
|
|
467
|
-
| `key` | `InjectionKey<T>` | The typed injection key |
|
|
468
|
-
| `value` | `T` | The value to provide |
|
|
469
|
-
|
|
470
|
-
#### `useInjectedValue`
|
|
471
|
-
|
|
472
|
-
```typescript
|
|
473
|
-
useInjectedValue<T>(key: InjectionKey<T>, defaultValue?: T): T
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
Injects a value using Vue's inject system with type safety and error handling.
|
|
477
|
-
|
|
478
|
-
| Parameter | Type | Required | Description |
|
|
479
|
-
|-----------|------|----------|-------------|
|
|
480
|
-
| `key` | `InjectionKey<T>` | ✅ | The typed injection key |
|
|
481
|
-
| `defaultValue` | `T` | ⚪ | Optional fallback value |
|
|
482
|
-
|
|
483
|
-
**Returns:** `T` - The injected value
|
|
484
|
-
|
|
485
|
-
**Throws:** `Error` - When no provider is found and no default value is provided
|
|
486
|
-
|
|
487
380
|
## 🌐 i18n
|
|
488
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).
|
|
489
382
|
It allows to use production or local translations on your code. 🚀
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { DynamicContent, GuidoConfig } from '@@/Types/generic';
|
|
2
|
-
import type { Template } from '@@/Types/stripo';
|
|
3
2
|
type __VLS_Props = {
|
|
4
3
|
templateId: string;
|
|
5
4
|
userId: string;
|
|
@@ -17,9 +16,6 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
|
|
|
17
16
|
};
|
|
18
17
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
19
18
|
"dynamic-content:open": (detail: DynamicContent | null) => void;
|
|
20
|
-
back: () => void;
|
|
21
|
-
"save:start": () => void;
|
|
22
|
-
"save:complete": (template: Omit<Template, "forceRecreate">) => void;
|
|
23
19
|
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
24
20
|
export default _default;
|
|
25
21
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { provideGuidoActions as D } from "../composables/useGuidoActions.js";
|
|
1
|
+
import { defineComponent as w, onMounted as D } from "vue";
|
|
3
2
|
import { usePartner as E } from "../composables/usePartner.js";
|
|
4
|
-
import { useStripo as
|
|
5
|
-
import { DefaultUsername as
|
|
6
|
-
import
|
|
7
|
-
import { useStripoApi as
|
|
8
|
-
const
|
|
3
|
+
import { useStripo as _ } from "../composables/useStripo.js";
|
|
4
|
+
import { DefaultUsername as b, DefaultGuidoConfig as I } from "../enums/defaults.js";
|
|
5
|
+
import G from "./organisms/header/HeaderWrapper.vue.js";
|
|
6
|
+
import { useStripoApi as P } from "../services/stripoApi.js";
|
|
7
|
+
const A = /* @__PURE__ */ w({
|
|
9
8
|
__name: "Guido",
|
|
10
9
|
props: {
|
|
11
10
|
templateId: null,
|
|
@@ -17,64 +16,50 @@ const B = /* @__PURE__ */ h({
|
|
|
17
16
|
css: null,
|
|
18
17
|
guidoConfig: null
|
|
19
18
|
},
|
|
20
|
-
emits: ["dynamic-content:open"
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
19
|
+
emits: ["dynamic-content:open"],
|
|
20
|
+
setup(h, { expose: v, emit: t }) {
|
|
21
|
+
const n = h, { getPartnerName: o, getProductType: i } = E(), {
|
|
23
22
|
templateId: c,
|
|
24
|
-
userId:
|
|
25
|
-
guidoConfig:
|
|
26
|
-
html:
|
|
23
|
+
userId: a,
|
|
24
|
+
guidoConfig: r,
|
|
25
|
+
html: s = "",
|
|
27
26
|
css: l = "",
|
|
28
|
-
partnerName: d =
|
|
29
|
-
productType:
|
|
30
|
-
username:
|
|
31
|
-
} =
|
|
27
|
+
partnerName: d = o(),
|
|
28
|
+
productType: m = i(),
|
|
29
|
+
username: u = b
|
|
30
|
+
} = n;
|
|
32
31
|
window.GuidoConfig = {
|
|
33
|
-
...
|
|
34
|
-
...
|
|
32
|
+
...I,
|
|
33
|
+
...r
|
|
35
34
|
};
|
|
36
|
-
const { initPlugin: p } =
|
|
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) => {
|
|
35
|
+
const { initPlugin: p } = _({ emailId: c, userId: a, username: u, partnerName: d, productType: m }), { getDefaultTemplate: f } = P(), y = (e) => {
|
|
49
36
|
console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
|
|
50
|
-
},
|
|
37
|
+
}, g = () => {
|
|
51
38
|
console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
|
|
52
39
|
};
|
|
53
|
-
return
|
|
40
|
+
return D(async () => {
|
|
54
41
|
console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
|
|
55
42
|
try {
|
|
56
43
|
let e = {
|
|
57
|
-
html:
|
|
58
|
-
css: l
|
|
59
|
-
forceRecreate: !0
|
|
60
|
-
// TODO: It should be false for old templates. We will communicate with Stripo
|
|
44
|
+
html: s,
|
|
45
|
+
css: l
|
|
61
46
|
};
|
|
62
|
-
e.html || (e = await
|
|
47
|
+
e.html || (e = await f()), await p(e);
|
|
63
48
|
} catch (e) {
|
|
64
49
|
console.error("Failed to initialize Stripo editor:", e);
|
|
65
50
|
}
|
|
66
51
|
document.addEventListener("dynamic-content:open", (e) => {
|
|
67
|
-
const
|
|
68
|
-
console.debug("dynamic-content:open",
|
|
52
|
+
const C = e;
|
|
53
|
+
console.debug("dynamic-content:open", C.detail), t("dynamic-content:open", C.detail);
|
|
69
54
|
});
|
|
70
|
-
}),
|
|
55
|
+
}), v({
|
|
71
56
|
dynamicContent: {
|
|
72
|
-
insert:
|
|
73
|
-
close:
|
|
57
|
+
insert: y,
|
|
58
|
+
close: g
|
|
74
59
|
}
|
|
75
|
-
}), { __sfc: !0, props:
|
|
60
|
+
}), { __sfc: !0, props: n, getPartnerName: o, getProductType: i, templateId: c, userId: a, guidoConfig: r, html: s, css: l, partnerName: d, productType: m, username: u, emit: t, initPlugin: p, getDefaultTemplate: f, insertDynamicContent: y, closeDynamicContent: g, HeaderWrapper: G };
|
|
76
61
|
}
|
|
77
62
|
});
|
|
78
63
|
export {
|
|
79
|
-
|
|
64
|
+
A as default
|
|
80
65
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from "./LeftSlot.vue2.js";
|
|
2
2
|
import o from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
return
|
|
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);
|
|
6
6
|
}, a = [], i = /* @__PURE__ */ o(
|
|
7
|
-
n,
|
|
8
7
|
r,
|
|
8
|
+
n,
|
|
9
9
|
a,
|
|
10
10
|
!1,
|
|
11
11
|
null,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const c = /* @__PURE__ */ r({
|
|
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({
|
|
7
6
|
__name: "LeftSlot",
|
|
8
|
-
setup(
|
|
9
|
-
|
|
10
|
-
return { __sfc: !0, editorStore: o, handleBack: t, InButtonV2: n, RestoreButton: s };
|
|
7
|
+
setup(m) {
|
|
8
|
+
return { __sfc: !0, editorStore: o(), InButtonV2: r, RestoreButton: e };
|
|
11
9
|
}
|
|
12
10
|
});
|
|
13
11
|
export {
|
|
14
|
-
|
|
12
|
+
_ as default
|
|
15
13
|
};
|
|
@@ -2,7 +2,7 @@ import o from "./RightSlot.vue2.js";
|
|
|
2
2
|
import i from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var n = function() {
|
|
4
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 } }), 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 }
|
|
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 } }), 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 } })], 1);
|
|
6
6
|
}, r = [], a = /* @__PURE__ */ i(
|
|
7
7
|
o,
|
|
8
8
|
n,
|
|
@@ -1,35 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { InButtonV2 as S } from "@useinsider/design-system-vue";
|
|
8
|
-
const E = /* @__PURE__ */ m({
|
|
1
|
+
import { defineComponent as s } from "vue";
|
|
2
|
+
import { useExport as i } from "../../../composables/useExport.js";
|
|
3
|
+
import { useVersionHistoryApi as n } from "../../../composables/useVersionHistoryApi.js";
|
|
4
|
+
import { useEditorStore as p } from "../../../stores/editor.js";
|
|
5
|
+
import { InButtonV2 as m } from "@useinsider/design-system-vue";
|
|
6
|
+
const d = /* @__PURE__ */ s({
|
|
9
7
|
__name: "RightSlot",
|
|
10
|
-
setup(
|
|
11
|
-
const { exportHtml:
|
|
12
|
-
return { __sfc: !0, exportHtml:
|
|
13
|
-
if (
|
|
14
|
-
|
|
8
|
+
setup(f) {
|
|
9
|
+
const { exportHtml: e } = i(), { openVersionHistory: o, closeVersionHistory: r } = n(), t = p();
|
|
10
|
+
return { __sfc: !0, exportHtml: e, openVersionHistory: o, closeVersionHistory: r, editorStore: t, handleVersionHistory: () => {
|
|
11
|
+
if (t.isVersionHistoryOpen) {
|
|
12
|
+
r();
|
|
15
13
|
return;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
e();
|
|
20
|
-
try {
|
|
21
|
-
const { html: o } = await t();
|
|
22
|
-
r({
|
|
23
|
-
html: o || "",
|
|
24
|
-
css: ""
|
|
25
|
-
// CSS is embedded in HTML from Stripo
|
|
26
|
-
});
|
|
27
|
-
} catch (o) {
|
|
28
|
-
console.error("Failed to get template data for save:", o);
|
|
29
|
-
}
|
|
30
|
-
}, InButtonV2: S };
|
|
15
|
+
o();
|
|
16
|
+
}, InButtonV2: m };
|
|
31
17
|
}
|
|
32
18
|
});
|
|
33
19
|
export {
|
|
34
|
-
|
|
20
|
+
d as default
|
|
35
21
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useCustomInterfaceAppearance as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { displayConditions as
|
|
5
|
-
import
|
|
6
|
-
import { useStripoApi as
|
|
7
|
-
import { useEditorStore as
|
|
8
|
-
const
|
|
9
|
-
const { handleError: d } =
|
|
10
|
-
const i =
|
|
1
|
+
import { useActionsApi as m } from "./useActionsApi.js";
|
|
2
|
+
import { useCustomInterfaceAppearance as g } from "./useCustomInterfaceAppearance.js";
|
|
3
|
+
import { useToaster as f } from "./useToaster.js";
|
|
4
|
+
import { displayConditions as E } from "../enums/displayConditions.js";
|
|
5
|
+
import S from "../extensions/DynamicContent/extension.js";
|
|
6
|
+
import { useStripoApi as y } from "../services/stripoApi.js";
|
|
7
|
+
import { useEditorStore as C } from "../stores/editor.js";
|
|
8
|
+
const x = (a) => {
|
|
9
|
+
const { handleError: d } = f(), { getToken: c, getCustomFonts: u } = y(), l = (e, r = []) => {
|
|
10
|
+
const i = C(), { html: t, css: s } = e;
|
|
11
11
|
window.UIEditor.initEditor(
|
|
12
12
|
document.querySelector("#guido-editor"),
|
|
13
13
|
{
|
|
14
14
|
metadata: a,
|
|
15
15
|
html: t,
|
|
16
16
|
css: s,
|
|
17
|
-
forceRecreate:
|
|
17
|
+
forceRecreate: !0,
|
|
18
18
|
locale: "en",
|
|
19
19
|
undoButtonSelector: "#guido__undo-button",
|
|
20
20
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,7 +30,7 @@ const A = (a) => {
|
|
|
30
30
|
`,
|
|
31
31
|
conditionsEnabled: !0,
|
|
32
32
|
customConditionsEnabled: !0,
|
|
33
|
-
conditionCategories:
|
|
33
|
+
conditionCategories: E,
|
|
34
34
|
messageSettingsEnabled: !1,
|
|
35
35
|
editorFonts: {
|
|
36
36
|
showDefaultStandardFonts: !0,
|
|
@@ -47,7 +47,7 @@ const A = (a) => {
|
|
|
47
47
|
},
|
|
48
48
|
onTemplateLoaded() {
|
|
49
49
|
try {
|
|
50
|
-
const { importCss: o } =
|
|
50
|
+
const { importCss: o } = g(), { activateCustomViewStyles: n } = m();
|
|
51
51
|
o(), n();
|
|
52
52
|
} catch (o) {
|
|
53
53
|
d(o, "Failed to load custom interface appearance");
|
|
@@ -63,7 +63,7 @@ const A = (a) => {
|
|
|
63
63
|
i.isVersionHistoryOpen = o;
|
|
64
64
|
},
|
|
65
65
|
ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
|
|
66
|
-
extensions: [
|
|
66
|
+
extensions: [S]
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
69
|
}, p = (e) => new Promise((r, i) => {
|
|
@@ -87,5 +87,5 @@ const A = (a) => {
|
|
|
87
87
|
} };
|
|
88
88
|
};
|
|
89
89
|
export {
|
|
90
|
-
|
|
90
|
+
x as useStripo
|
|
91
91
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}[data-v-6a2bde67] .guido__verion-history-view-option-selection-desktop svg,[data-v-6a2bde67] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6a2bde67] .in-segments-wrapper__button_selected,[data-v-6a2bde67] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-0fff376c] .guido__view-option-selection-desktop svg,[data-v-0fff376c] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-0fff376c] .in-segments-wrapper__button_selected,[data-v-0fff376c] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.guido-editor__wrapper[data-v-
|
|
1
|
+
.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}[data-v-6a2bde67] .guido__verion-history-view-option-selection-desktop svg,[data-v-6a2bde67] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6a2bde67] .in-segments-wrapper__button_selected,[data-v-6a2bde67] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-0fff376c] .guido__view-option-selection-desktop svg,[data-v-0fff376c] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-0fff376c] .in-segments-wrapper__button_selected,[data-v-0fff376c] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.guido-editor__wrapper[data-v-f7e1afcb],.guido-editor__container[data-v-f7e1afcb]{width:100%;height:calc(100vh - 75px)}
|
|
@@ -25,16 +25,12 @@ const m = () => {
|
|
|
25
25
|
getDefaultTemplate: async () => {
|
|
26
26
|
const t = {
|
|
27
27
|
html: "",
|
|
28
|
-
css: ""
|
|
29
|
-
forceRecreate: !0
|
|
28
|
+
css: ""
|
|
30
29
|
};
|
|
31
30
|
try {
|
|
32
31
|
const { data: e } = await r("/stripo/default-template");
|
|
33
32
|
try {
|
|
34
|
-
return
|
|
35
|
-
...JSON.parse(e),
|
|
36
|
-
forceRecreate: !0
|
|
37
|
-
};
|
|
33
|
+
return JSON.parse(e);
|
|
38
34
|
} catch {
|
|
39
35
|
return t;
|
|
40
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.57ed29f",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Template } from '@@/Types/stripo';
|
|
2
|
-
import type { InjectionKey } from 'vue';
|
|
3
|
-
export type BackHandler = () => void;
|
|
4
|
-
export type SaveStartHandler = () => void;
|
|
5
|
-
export type SaveCompleteHandler = (template: Omit<Template, 'forceRecreate'>) => void;
|
|
6
|
-
export declare const BACK_KEY: InjectionKey<BackHandler>;
|
|
7
|
-
export declare const SAVE_START_KEY: InjectionKey<SaveStartHandler>;
|
|
8
|
-
export declare const SAVE_COMPLETE_KEY: InjectionKey<SaveCompleteHandler>;
|
|
9
|
-
/**
|
|
10
|
-
* Provides Guido action handlers to child components
|
|
11
|
-
*/
|
|
12
|
-
export declare const provideGuidoActions: (actions: {
|
|
13
|
-
onBack: BackHandler;
|
|
14
|
-
onSaveStart: SaveStartHandler;
|
|
15
|
-
onSaveComplete: SaveCompleteHandler;
|
|
16
|
-
}) => void;
|
|
17
|
-
/**
|
|
18
|
-
* Provides individual Guido action handlers
|
|
19
|
-
*/
|
|
20
|
-
export declare const provideBackHandler: (handler: BackHandler) => void;
|
|
21
|
-
export declare const provideSaveStartHandler: (handler: SaveStartHandler) => void;
|
|
22
|
-
export declare const provideSaveCompleteHandler: (handler: SaveCompleteHandler) => void;
|
|
23
|
-
/**
|
|
24
|
-
* Hook to use the back navigation handler
|
|
25
|
-
* @returns Back navigation function
|
|
26
|
-
*/
|
|
27
|
-
export declare const useBack: () => BackHandler;
|
|
28
|
-
/**
|
|
29
|
-
* Hook to use the save start handler
|
|
30
|
-
* @returns Save start function
|
|
31
|
-
*/
|
|
32
|
-
export declare const useSaveStart: () => SaveStartHandler;
|
|
33
|
-
/**
|
|
34
|
-
* Hook to use the save complete handler
|
|
35
|
-
* @returns Save complete function
|
|
36
|
-
*/
|
|
37
|
-
export declare const useSaveComplete: () => SaveCompleteHandler;
|
|
38
|
-
/**
|
|
39
|
-
* Convenience hook to get all Guido actions
|
|
40
|
-
* @returns Object containing all action handlers
|
|
41
|
-
*/
|
|
42
|
-
export declare const useGuidoActions: () => {
|
|
43
|
-
back: BackHandler;
|
|
44
|
-
saveStart: SaveStartHandler;
|
|
45
|
-
saveComplete: SaveCompleteHandler;
|
|
46
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { provideValue as o, useInjectedValue as t } from "./useProvideInject.js";
|
|
2
|
-
const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"), a = Symbol.for("guido.save.complete"), s = (e) => {
|
|
3
|
-
o(r, e.onBack), o(n, e.onSaveStart), o(a, e.onSaveComplete);
|
|
4
|
-
}, u = () => {
|
|
5
|
-
try {
|
|
6
|
-
return t(r);
|
|
7
|
-
} catch {
|
|
8
|
-
throw new Error(
|
|
9
|
-
"useBack: No back handler provided. Make sure Guido component is in the component tree."
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
}, d = () => {
|
|
13
|
-
try {
|
|
14
|
-
return t(n);
|
|
15
|
-
} catch {
|
|
16
|
-
throw new Error(
|
|
17
|
-
"useSaveStart: No save start handler provided. Make sure Guido component is in the component tree."
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
}, i = () => {
|
|
21
|
-
try {
|
|
22
|
-
return t(a);
|
|
23
|
-
} catch {
|
|
24
|
-
throw new Error(
|
|
25
|
-
"useSaveComplete: No save complete handler provided. Make sure Guido component is in the component tree."
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
export {
|
|
30
|
-
r as BACK_KEY,
|
|
31
|
-
a as SAVE_COMPLETE_KEY,
|
|
32
|
-
n as SAVE_START_KEY,
|
|
33
|
-
s as provideGuidoActions,
|
|
34
|
-
u as useBack,
|
|
35
|
-
i as useSaveComplete,
|
|
36
|
-
d as useSaveStart
|
|
37
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type InjectionKey } from 'vue';
|
|
2
|
-
/**
|
|
3
|
-
* Provides a value using Vue's provide/inject system
|
|
4
|
-
* @param key - The injection key
|
|
5
|
-
* @param value - The value to provide
|
|
6
|
-
*/
|
|
7
|
-
export declare const provideValue: <T>(key: InjectionKey<T>, value: T) => void;
|
|
8
|
-
/**
|
|
9
|
-
* Injects a value using Vue's provide/inject system
|
|
10
|
-
* @param key - The injection key
|
|
11
|
-
* @param defaultValue - Optional default value if injection fails
|
|
12
|
-
* @returns The injected value
|
|
13
|
-
*/
|
|
14
|
-
export declare const useInjectedValue: <T>(key: InjectionKey<T>, defaultValue?: T) => T;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { provide as t, inject as i } from "vue";
|
|
2
|
-
const d = (e, o) => {
|
|
3
|
-
t(e, o);
|
|
4
|
-
}, s = (e, o) => {
|
|
5
|
-
const r = i(e, o);
|
|
6
|
-
if (r === void 0 && o === void 0) {
|
|
7
|
-
const n = e.description || String(e);
|
|
8
|
-
throw new Error(
|
|
9
|
-
`useInjectedValue: No provider found for key "${n}". Make sure a parent component provides this value.`
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
return r;
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
d as provideValue,
|
|
16
|
-
s as useInjectedValue
|
|
17
|
-
};
|