@useinsider/guido 1.0.0-beta.b79463f → 1.0.0-beta.b7d755a

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 CHANGED
@@ -14,10 +14,7 @@ Guido is a Vue 2 + TypeScript wrapper for the Stripo Email Editor plugin. Easily
14
14
  ```bash
15
15
  npm install @useinsider/guido
16
16
  ```
17
- ### Prerequisites
18
- 🍍 Your project should have `pinia`
19
17
 
20
- ---
21
18
  ## 🚀 Usage
22
19
 
23
20
  ### Basic Usage
@@ -26,11 +23,9 @@ npm install @useinsider/guido
26
23
  <template>
27
24
  <div>
28
25
  <Guido
29
- ref="guidoEditor"
30
26
  :email-id="emailId"
31
27
  :user-id="userId"
32
28
  :guido-config="guidoConfig"
33
- @dynamic-content:open="handleDynamicContentOpen"
34
29
  />
35
30
  </div>
36
31
  </template>
@@ -49,29 +44,7 @@ export default {
49
44
  guidoConfig: {
50
45
  translationsPath: 'window.trans.en'
51
46
  }
52
- dynamicContentModalVisible: false
53
47
  };
54
- },
55
-
56
- methods: {
57
- handleDynamicContentOpen() {
58
- this.dynamicContentModalVisible = true;
59
- }
60
- // ⚠️ Your own Dynamic Content Modal should have this id: #guido-dynamic-content-modal
61
- handleDynamicContentInsert() {
62
- this.$ref.guidoEditor?.dynamicContent.insert({
63
- text: 'Text',
64
- value: 'Value',
65
- fallback: 'Fallback'
66
- });
67
-
68
- this.dynamicContentModalVisible = false;
69
- },
70
- // ⚠️ It's mandatory. There is no way to understand if user closes the modal without selection.
71
- handleDynamicContentClose() {
72
- this.$ref.guidoEditor?.dynamicContent.close();
73
- }
74
-
75
48
  }
76
49
  };
77
50
  </script>
@@ -90,13 +63,7 @@ export default {
90
63
  | `productType` | `string` | ⚪ | Getting from URL path | Unique identifier for the product draft |
91
64
  | `guidoConfig` | `GuidoConfig` | ✅ | - | Configuration object for the editor |
92
65
 
93
- ### Guido Exposed Methods
94
- ```typescript
95
- dynamicContent.insert(DynamicContent);
96
- dynamicContent.close();
97
- ```
98
-
99
- ### Guido Interfaces
66
+ ### GuidoConfig Interface
100
67
 
101
68
  ```typescript
102
69
  interface GuidoConfig {
@@ -108,20 +75,6 @@ interface GuidoConfig {
108
75
  |----------|------|---------|-------------|
109
76
  | `translationsPath` | `string` | `'window.trans.en'` | JavaScript path to the translations object |
110
77
 
111
- ```typescript
112
- interface DynamicContent {
113
- value: string;
114
- text: string;
115
- fallback?: string;
116
- }
117
- ```
118
-
119
- | Property | Type | Default | Description |
120
- |----------|------|---------|-------------|
121
- | `value` | `string` | '' | Value of the dynamic content |
122
- | `text` | `string` | '' | Visible value of the dynamic content |
123
- | `fallback?` | `string` | '' | Fallback value of the dynamic content. Optional |
124
-
125
78
  ### TypeScript Types
126
79
 
127
80
  The library exports the following TypeScript types:
@@ -135,6 +88,19 @@ import type { GuidoConfig } from '@useinsider/guido';
135
88
  import type { StripoEventType } from '@useinsider/guido';
136
89
  ```
137
90
 
91
+ ### StripoEventType
92
+
93
+ ```typescript
94
+ type StripoEventType =
95
+ | 'save'
96
+ | 'export'
97
+ | 'close'
98
+ | 'autosave'
99
+ | 'publish'
100
+ | 'export:requested'
101
+ | 'export:ready';
102
+ ```
103
+
138
104
  ---
139
105
 
140
106
  ## 🔧 Development
@@ -204,34 +170,6 @@ const trans = useTranslations();
204
170
  trans('foo.bar')
205
171
  ```
206
172
 
207
- ## 📦 Local Building (Recommended)
208
-
209
- Run this commands if you want to test the package on your local before sending to NPM.
210
- ```sh
211
- bun run build
212
- ```
213
-
214
- Since bun does not have packaging yet, use npm here: 🥲
215
- ```sh
216
- npm pack
217
- ```
218
-
219
- It'll crate like `useinsider-guido-1.0.0.tgz` file.
220
-
221
- Move this file to your project path like: `email-fe` via:
222
- ```sh
223
- cp useinsider-guido-1.0.0.tgz ../email-fe
224
- ```
225
-
226
- Install the file to your project:
227
- ```sh
228
- npm i ./useinsider-guido-1.0.0.tgz
229
- ```
230
-
231
- Then you just need to rebuild to your project or restart the Container. 🎉
232
-
233
- For Future, we can create a shell script for it. Feel free to help 🙃
234
-
235
173
  ## 📦 Build Output
236
174
 
237
175
  The library builds to multiple formats:
@@ -8,10 +8,7 @@ type __VLS_Props = {
8
8
  guidoConfig: GuidoConfig;
9
9
  };
10
10
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
11
- dynamicContent: {
12
- insert: (data: DynamicContent) => void;
13
- close: () => void;
14
- };
11
+ applyDynamicContent: (data: DynamicContent) => void;
15
12
  }, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
16
13
  "dynamic-content:open": (detail: DynamicContent | null) => void;
17
14
  }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
@@ -10,7 +10,7 @@ var s = function() {
10
10
  _,
11
11
  !1,
12
12
  null,
13
- "89423288"
13
+ "1d1d2b7c"
14
14
  );
15
15
  const f = a.exports;
16
16
  export {
@@ -1,10 +1,10 @@
1
- import { defineComponent as v, onMounted as w } from "vue";
2
- import { usePartner as h } from "../composables/usePartner.js";
3
- import { useStripo as D } from "../composables/useStripo.js";
4
- import { useTemplates as E } from "../composables/useTemplates.js";
5
- import { DefaultUsername as _, DefaultGuidoConfig as b } from "../enums/defaults.js";
6
- import T from "./organisms/header/HeaderWrapper.vue.js";
7
- const W = /* @__PURE__ */ v({
1
+ import { defineComponent as C, onMounted as w } from "vue";
2
+ import { usePartner as _ } from "../composables/usePartner.js";
3
+ import { useStripo as T } from "../composables/useStripo.js";
4
+ import { useTemplates as b } from "../composables/useTemplates.js";
5
+ import { DefaultUsername as h, DefaultGuidoConfig as v } from "../enums/defaults.js";
6
+ import D from "./organisms/header/HeaderWrapper.vue.js";
7
+ const x = /* @__PURE__ */ C({
8
8
  __name: "Guido",
9
9
  props: {
10
10
  emailId: null,
@@ -15,28 +15,28 @@ const W = /* @__PURE__ */ v({
15
15
  guidoConfig: null
16
16
  },
17
17
  emits: ["dynamic-content:open"],
18
- setup(g, { expose: C, emit: n }) {
19
- const t = g, { getPartnerName: o, getProductType: c } = h(), {
18
+ setup(g, { expose: y, emit: n }) {
19
+ const o = g, { getPartnerName: t, getProductType: r } = _(), {
20
20
  emailId: i,
21
21
  userId: a,
22
- guidoConfig: r,
23
- partnerName: s = o(),
24
- productType: d = c(),
25
- username: u = _
26
- } = t;
22
+ guidoConfig: c,
23
+ partnerName: s = t(),
24
+ productType: u = r(),
25
+ username: d = h
26
+ } = o;
27
27
  window.GuidoConfig = {
28
- ...b,
29
- ...r
28
+ ...v,
29
+ ...c
30
30
  };
31
- const { initPlugin: m } = D({ emailId: i, userId: a, username: u, partnerName: s, productType: d }), { getDefaultTemplate: l } = E(), p = (e) => {
32
- console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
33
- }, y = () => {
34
- console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
31
+ const { initPlugin: m } = T({ emailId: i, userId: a, username: d, partnerName: s, productType: u }), { getDefaultTemplate: p } = b(), l = (e) => {
32
+ console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", {
33
+ detail: e
34
+ }));
35
35
  };
36
36
  return w(async () => {
37
37
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
38
38
  try {
39
- const e = await l();
39
+ const e = await p();
40
40
  await m(e);
41
41
  } catch (e) {
42
42
  console.error("Failed to initialize Stripo editor:", e);
@@ -45,14 +45,11 @@ const W = /* @__PURE__ */ v({
45
45
  const f = e;
46
46
  console.debug("dynamic-content:open", f.detail), n("dynamic-content:open", f.detail);
47
47
  });
48
- }), C({
49
- dynamicContent: {
50
- insert: p,
51
- close: y
52
- }
53
- }), { __sfc: !0, props: t, getPartnerName: o, getProductType: c, emailId: i, userId: a, guidoConfig: r, partnerName: s, productType: d, username: u, emit: n, initPlugin: m, getDefaultTemplate: l, insertDynamicContent: p, closeDynamicContent: y, HeaderWrapper: T };
48
+ }), y({
49
+ applyDynamicContent: l
50
+ }), { __sfc: !0, props: o, getPartnerName: t, getProductType: r, emailId: i, userId: a, guidoConfig: c, partnerName: s, productType: u, username: d, emit: n, initPlugin: m, getDefaultTemplate: p, applyDynamicContent: l, HeaderWrapper: D };
54
51
  }
55
52
  });
56
53
  export {
57
- W as default
54
+ x as default
58
55
  };
@@ -1,27 +1,27 @@
1
1
  var i = Object.defineProperty;
2
- var d = (t, e, n) => e in t ? i(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var a = (t, e, n) => d(t, typeof e != "symbol" ? e + "" : e, n);
4
- class y {
2
+ var d = (e, t, n) => t in e ? i(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var a = (e, t, n) => d(e, typeof t != "symbol" ? t + "" : t, n);
4
+ class u {
5
5
  constructor() {
6
6
  a(this, "selectedDynamicContent", null);
7
7
  a(this, "dataSelectCallback", () => {
8
8
  });
9
9
  }
10
- openMergeTagsLibrary(e, n) {
11
- this.dataSelectCallback = n, this.selectedDynamicContent = e;
12
- const s = new CustomEvent("dynamic-content:open", {
10
+ openMergeTagsLibrary(t, n) {
11
+ this.dataSelectCallback = n, this.selectedDynamicContent = t;
12
+ const o = new CustomEvent("dynamic-content:open", {
13
13
  detail: {
14
- attribute: e
14
+ attribute: t
15
15
  }
16
16
  });
17
- document.dispatchEvent(s);
18
- const o = (l) => {
19
- const c = l.detail;
20
- this.selectedDynamicContent = c, c.text && c.value && this.dataSelectCallback(c), document.removeEventListener("dynamic-content:close", o);
17
+ document.dispatchEvent(o);
18
+ const l = (s) => {
19
+ const c = s.detail;
20
+ this.selectedDynamicContent = c || null, c && this.dataSelectCallback(c), document.removeEventListener("dynamic-content:close", l);
21
21
  };
22
- document.addEventListener("dynamic-content:close", o);
22
+ document.addEventListener("dynamic-content:close", l);
23
23
  }
24
24
  }
25
25
  export {
26
- y as ExternalMergeTagsLibrary
26
+ u as ExternalMergeTagsLibrary
27
27
  };
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-89423288],.guido-editor__container[data-v-89423288]{width:100%;height:calc(100vh - 75px)}
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-1d1d2b7c],.guido-editor__container[data-v-1d1d2b7c]{width:100%;height:calc(100vh - 75px)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.0-beta.b79463f",
3
+ "version": "1.0.0-beta.b7d755a",
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",