@useinsider/guido 2.2.0-beta.eeefcc3 → 2.2.0-beta.fa4cec8

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.
@@ -16,7 +16,7 @@ var o = function() {
16
16
  i,
17
17
  !1,
18
18
  null,
19
- "a86fc486"
19
+ "df672485"
20
20
  );
21
21
  const _ = c.exports;
22
22
  export {
@@ -1,15 +1,15 @@
1
- import { defineComponent as f, ref as y, computed as n, watch as T } from "vue";
2
- import g from "../../wrappers/WpDrawer.vue.js";
3
- import { useToaster as S } from "../../../composables/useToaster.js";
4
- import { useTranslations as v } from "../../../composables/useTranslations.js";
5
- import { ToasterTypeOptions as B } from "../../../enums/toaster.js";
1
+ import { defineComponent as g, ref as y, computed as n, watch as S } from "vue";
2
+ import T from "../../wrappers/WpDrawer.vue.js";
3
+ import { useToaster as v } from "../../../composables/useToaster.js";
4
+ import { useTranslations as B } from "../../../composables/useTranslations.js";
5
+ import { ToasterTypeOptions as C } from "../../../enums/toaster.js";
6
6
  import { useUnsubscribeStore as w } from "../../../stores/unsubscribe.js";
7
- import { InContainer as C } from "@useinsider/design-system-vue";
8
- import h from "./UnsubscribeBreadcrumb.vue.js";
9
- const E = /* @__PURE__ */ f({
7
+ import { InContainer as h } from "@useinsider/design-system-vue";
8
+ import U from "./UnsubscribeBreadcrumb.vue.js";
9
+ const F = /* @__PURE__ */ g({
10
10
  __name: "UnsubscribePageSelection",
11
- setup(_) {
12
- const s = v(), e = w(), { showToaster: a } = S(), o = y(!1), c = n(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), i = n(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), p = n(() => ({
11
+ setup(P) {
12
+ const s = B(), e = w(), { showToaster: a } = v(), o = y(!1), c = n(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), i = n(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), u = n(() => ({
13
13
  primaryButton: {
14
14
  styling: "solid",
15
15
  type: "primary",
@@ -23,28 +23,28 @@ const E = /* @__PURE__ */ f({
23
23
  labelText: i.value,
24
24
  disabledStatus: o.value
25
25
  }
26
- })), u = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", r = (t) => {
26
+ })), p = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", r = (t) => {
27
27
  e.pageSelectionDrawerStatus = !1, t && setTimeout(() => {
28
28
  t();
29
29
  }, 500);
30
- }, m = () => {
30
+ }, d = () => {
31
31
  if (e.isActiveTypeFirstInCollection) {
32
32
  r(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
33
33
  return;
34
34
  }
35
35
  e.setPreviousType();
36
- }, d = () => {
36
+ }, m = () => {
37
37
  if (e.isActiveTypeLastInCollection) {
38
38
  o.value = !0;
39
- const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t);
40
- e.addUnsubscribePages(l), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
39
+ const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t), f = e.getSelectedUnsubscribePagesByCollection(t);
40
+ e.removeUnsubscribePages(f), e.addUnsubscribePages(l), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
41
41
  detail: {
42
42
  collectionType: t,
43
43
  selectedPages: l
44
44
  }
45
45
  })), r(() => {
46
46
  o.value = !1, a({
47
- type: B.Success,
47
+ type: C.Success,
48
48
  message: s("global-unsubscribe.pages-were-attached")
49
49
  });
50
50
  });
@@ -54,11 +54,11 @@ const E = /* @__PURE__ */ f({
54
54
  }, b = (t) => {
55
55
  e.setSelectedTemplate(t);
56
56
  };
57
- return T(() => e.pageSelectionDrawerStatus, (t) => {
57
+ return S(() => e.pageSelectionDrawerStatus, (t) => {
58
58
  t && e.pageSelectionUpdateStatus && e.fetchTemplates();
59
- }), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster: a, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: i, footerButtonGroupOptions: p, getBorderClass: u, closeModal: r, handleBack: m, handleSave: d, selectTemplate: b, WpDrawer: g, InContainer: C, UnsubscribeBreadcrumb: h };
59
+ }), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster: a, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: i, footerButtonGroupOptions: u, getBorderClass: p, closeModal: r, handleBack: d, handleSave: m, selectTemplate: b, WpDrawer: T, InContainer: h, UnsubscribeBreadcrumb: U };
60
60
  }
61
61
  });
62
62
  export {
63
- E as default
63
+ F as default
64
64
  };
@@ -1,17 +1,17 @@
1
1
  var d = Object.defineProperty;
2
- var _ = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
- var u = (n, i, e) => _(n, typeof i != "symbol" ? i + "" : i, e);
2
+ var h = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
+ var u = (n, i, e) => h(n, typeof i != "symbol" ? i + "" : i, e);
4
4
  import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
5
5
  import { useUnsubscribeStore as c } from "../../../stores/unsubscribe.js";
6
- import { Block as h, BlockCompositionType as S, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
+ import { Block as _, BlockCompositionType as S, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
7
  import { getDefaultTemplate as L } from "./template.js";
8
8
  import { UNSUBSCRIBE_EVENTS as a, DATA_ATTRIBUTES as o } from "./utils/constants.js";
9
9
  import { parsePageList as p } from "./utils/utils.js";
10
- const g = "unsubscribe-block", v = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", B = "{{ins-unsubscribe-link}}", T = {
10
+ const v = "unsubscribe-block", g = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", T = "{{ins-unsubscribe-link}}", B = {
11
11
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
12
12
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
13
13
  };
14
- class R extends h {
14
+ class R extends _ {
15
15
  constructor() {
16
16
  super();
17
17
  u(this, "selectEventListener", null);
@@ -19,7 +19,7 @@ class R extends h {
19
19
  u(this, "currentNode");
20
20
  }
21
21
  getId() {
22
- return g;
22
+ return v;
23
23
  }
24
24
  getIcon() {
25
25
  return "unsubscribe-icon";
@@ -47,8 +47,8 @@ class R extends h {
47
47
  }
48
48
  _setupSelectEventListener() {
49
49
  this._removeSelectEventListener(), this.selectEventListener = (e) => {
50
- const s = e, { collectionType: t, selectedPages: r } = s.detail;
51
- this._updateBlock(t, r.join(","));
50
+ const r = e, { collectionType: s, selectedPages: t } = r.detail;
51
+ this._updateBlock(s, t.join(","));
52
52
  }, document.addEventListener(a.SELECT, this.selectEventListener);
53
53
  }
54
54
  _removeSelectEventListener() {
@@ -74,17 +74,17 @@ class R extends h {
74
74
  _removeEventListeners() {
75
75
  this._removeSelectEventListener(), this._removeCancelEventListener();
76
76
  }
77
- _updateBlock(e, s) {
77
+ _updateBlock(e, r) {
78
78
  if (!this.currentNode || !("querySelector" in this.currentNode))
79
79
  return;
80
- const t = this.currentNode.querySelector(v);
81
- if (!t)
80
+ const s = this.currentNode.querySelector(g);
81
+ if (!s)
82
82
  return;
83
- const r = this._getMergeTag(e);
84
- this.api.getDocumentModifier().modifyHtml(t).setAttribute("href", r).apply(new b(`Updated unsubscribe link to ${r}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, s).apply(new b("Updated unsubscribe block metadata"));
83
+ const t = this._getMergeTag(e);
84
+ this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", t).apply(new b(`Updated unsubscribe link to ${t}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
85
85
  }
86
86
  _getMergeTag(e) {
87
- return T[e] ?? B;
87
+ return B[e] ?? T;
88
88
  }
89
89
  _openDrawer() {
90
90
  if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
@@ -97,24 +97,24 @@ class R extends h {
97
97
  }
98
98
  _checkExistingBlocks() {
99
99
  const e = c();
100
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((t) => {
101
- if ("getAttribute" in t) {
102
- const r = t.getAttribute(o.PAGE_TYPE);
103
- if (r) {
104
- const l = Number(r);
100
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((s) => {
101
+ if ("getAttribute" in s) {
102
+ const t = s.getAttribute(o.PAGE_TYPE);
103
+ if (t) {
104
+ const l = Number(t);
105
105
  l === E.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : l === E.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
106
106
  }
107
107
  }
108
108
  });
109
109
  }
110
- _loadBlockState(e) {
110
+ async _loadBlockState(e) {
111
111
  if (!("getAttribute" in e))
112
112
  return;
113
- const s = e.getAttribute(o.PAGE_TYPE), t = e.getAttribute(o.PAGE_LIST);
114
- if (!s || !t)
113
+ const r = e.getAttribute(o.PAGE_TYPE), s = e.getAttribute(o.PAGE_LIST);
114
+ if (!r || !s)
115
115
  return;
116
- const r = c(), l = Number(s), m = p(t);
117
- r.setCollectionWithoutAutoSelection(l), r.loadSelectedTemplates(m);
116
+ const t = c(), l = Number(r), m = p(s);
117
+ await t.fetchTemplates(), t.setCollectionWithoutAutoSelection(l), t.loadSelectedTemplates(m);
118
118
  }
119
119
  _resetStoreState() {
120
120
  c().$reset();
@@ -122,14 +122,14 @@ class R extends h {
122
122
  _removeBlockTemplatesFromStore(e) {
123
123
  if (!("getAttribute" in e))
124
124
  return;
125
- const s = e.getAttribute(o.PAGE_LIST);
126
- if (!s)
125
+ const r = e.getAttribute(o.PAGE_LIST);
126
+ if (!r)
127
127
  return;
128
- const t = c(), r = p(s);
129
- t.removeUnsubscribePages(r);
128
+ const s = c(), t = p(r);
129
+ s.removeUnsubscribePages(t);
130
130
  }
131
131
  }
132
132
  export {
133
- g as UNSUBSCRIBE_BLOCK_ID,
133
+ v as UNSUBSCRIBE_BLOCK_ID,
134
134
  R as UnsubscribeBlock
135
135
  };
@@ -1,18 +1,18 @@
1
- var h = Object.defineProperty;
2
- var d = (a, s, e) => s in a ? h(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
3
- var u = (a, s, e) => d(a, typeof s != "symbol" ? s + "" : s, e);
1
+ var d = Object.defineProperty;
2
+ var h = (a, s, e) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[s] = e;
3
+ var u = (a, s, e) => h(a, typeof s != "symbol" ? s + "" : s, e);
4
4
  import { useUnsubscribeStore as l } from "../../../stores/unsubscribe.js";
5
5
  import { Control as T, UEAttr as i, UIElementType as n } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
6
6
  import { DATA_ATTRIBUTES as p } from "./utils/constants.js";
7
7
  import { parsePageList as _ } from "./utils/utils.js";
8
- const g = "ui-elements-unsubscribe", r = {
8
+ const v = "ui-elements-unsubscribe", r = {
9
9
  SELECT_BUTTON: "selectTemplateButton",
10
10
  PREV_BUTTON: "prevButton",
11
11
  NEXT_BUTTON: "nextButton",
12
12
  COUNTER_TEXT: "counterText",
13
13
  PREVIEW_IMAGE: "previewImage"
14
14
  };
15
- class N extends T {
15
+ class B extends T {
16
16
  constructor() {
17
17
  super(...arguments);
18
18
  u(this, "currentPreviewIndex", 0);
@@ -22,7 +22,7 @@ class N extends T {
22
22
  u(this, "lastParsedAttribute");
23
23
  }
24
24
  getId() {
25
- return g;
25
+ return v;
26
26
  }
27
27
  getTemplate() {
28
28
  return `
@@ -35,7 +35,7 @@ class N extends T {
35
35
  onTemplateNodeUpdated(e) {
36
36
  if (this.currentNode = e, "getAttribute" in this.currentNode) {
37
37
  const t = this.currentNode.getAttribute(p.PAGE_LIST);
38
- t && (t !== this.lastParsedAttribute && (this.currentPages = _(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updatePreview(), this._updateCounter());
38
+ t && (t !== this.lastParsedAttribute && (this.currentPages = _(t), this.lastParsedAttribute = t, this.currentPreviewIndex = 0), this._updateCounter(), this._loadAndUpdatePreview());
39
39
  }
40
40
  }
41
41
  onRender() {
@@ -73,6 +73,9 @@ class N extends T {
73
73
  _onNextClick() {
74
74
  this.currentPreviewIndex < this.totalTemplates - 1 && (this.currentPreviewIndex++, this._updatePreview(), this._updateCounter());
75
75
  }
76
+ async _loadAndUpdatePreview() {
77
+ await l().fetchTemplates(), this._updatePreview(), this._updateCounter();
78
+ }
76
79
  _updatePreview() {
77
80
  var e;
78
81
  if ((e = this.currentPages) != null && e.length)
@@ -162,6 +165,6 @@ class N extends T {
162
165
  }
163
166
  }
164
167
  export {
165
- g as UNSUBSCRIBE_CONTROL_ID,
166
- N as UnsubscribeControl
168
+ v as UNSUBSCRIBE_CONTROL_ID,
169
+ B as UnsubscribeControl
167
170
  };
@@ -1,12 +1,12 @@
1
- var r = Object.defineProperty;
2
- var n = (i, t, e) => t in i ? r(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var s = (i, t, e) => n(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { UIElement as m } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- const E = "unsubscribe-preview", l = "img", c = "Unsubscribe page preview";
6
- class o extends m {
1
+ var n = Object.defineProperty;
2
+ var m = (s, i, e) => i in s ? n(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
3
+ var r = (s, i, e) => m(s, typeof i != "symbol" ? i + "" : i, e);
4
+ import { UIElement as l } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ const E = "unsubscribe-preview", c = "img", a = "Unsubscribe page preview", g = "is-loaded";
6
+ class d extends l {
7
7
  constructor() {
8
8
  super(...arguments);
9
- s(this, "imgElement");
9
+ r(this, "imgElement");
10
10
  }
11
11
  getId() {
12
12
  return E;
@@ -14,19 +14,21 @@ class o extends m {
14
14
  getTemplate() {
15
15
  return `
16
16
  <div class="unsubscribe-preview-image-container">
17
+ <div class="unsubscribe-preview-loader"></div>
17
18
  <img
18
19
  src=""
19
- alt="${c}"
20
+ alt="${a}"
20
21
  class="unsubscribe-preview-image"
21
22
  />
22
23
  </div>
23
24
  `;
24
25
  }
25
26
  onRender(e) {
26
- this.imgElement = e.querySelector(l);
27
+ this.imgElement = e.querySelector(c);
27
28
  }
28
29
  setValue(e) {
29
- this.imgElement && (this.imgElement.src = e);
30
+ var t;
31
+ this.imgElement && (this.imgElement.src = e, (t = this.imgElement.parentElement) == null || t.classList.add(g));
30
32
  }
31
33
  getValue() {
32
34
  var e;
@@ -38,5 +40,5 @@ class o extends m {
38
40
  }
39
41
  export {
40
42
  E as PREVIEW_UI_ELEMENT_ID,
41
- o as PreviewUIElement
43
+ d as PreviewUIElement
42
44
  };
@@ -29,12 +29,42 @@ const n = `/* Unsubscribe Extension Styles */
29
29
  display: flex;
30
30
  align-items: center;
31
31
  justify-content: center;
32
+ position: relative;
32
33
  }
33
34
 
34
- .unsubscribe-preview-image {
35
+ .unsubscribe-preview-image-container .unsubscribe-preview-image {
35
36
  object-fit: cover;
36
37
  width: 100%;
37
38
  height: auto;
39
+ display: none;
40
+ }
41
+
42
+ .unsubscribe-preview-image-container.is-loaded .unsubscribe-preview-image {
43
+ display: block;
44
+ }
45
+
46
+ .unsubscribe-preview-image-container.is-loaded .unsubscribe-preview-loader {
47
+ display: none;
48
+ }
49
+
50
+ /* Loading shimmer */
51
+ .unsubscribe-preview-loader {
52
+ width: 100%;
53
+ height: 200px;
54
+ border-radius: 4px;
55
+ background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
56
+ background-size: 200% 100%;
57
+ animation: unsubscribe-shimmer 1.5s infinite;
58
+ }
59
+
60
+ @keyframes unsubscribe-shimmer {
61
+ 0% {
62
+ background-position: 200% 0;
63
+ }
64
+
65
+ 100% {
66
+ background-position: -200% 0;
67
+ }
38
68
  }
39
69
  `;
40
70
  export {
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-913a3417] .in-progress-wrapper__progress p span:last-child{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.editor-actions[data-v-17dd4d8b]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-16abb398]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-16abb398]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-16abb398]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-913a3417] .in-progress-wrapper__progress p span:last-child{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.editor-actions[data-v-17dd4d8b]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-16abb398]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-16abb398]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-16abb398]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-df672485]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-df672485]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-df672485]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-df672485]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-df672485]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
@@ -17,6 +17,7 @@ export declare class UnsubscribeControl extends Control {
17
17
  private _onButtonClick;
18
18
  private _onPrevClick;
19
19
  private _onNextClick;
20
+ private _loadAndUpdatePreview;
20
21
  private _updatePreview;
21
22
  private _updateCounter;
22
23
  private _getPreview;
@@ -1,39 +1,40 @@
1
- import { TYPE_COLLECTIONS as i, PAGE_TYPES as a } from "../enums/unsubscribe.js";
2
- import { useUnsubscribeApi as r } from "../services/unsubscribeApi.js";
3
- import { defineStore as d } from "pinia";
4
- const p = () => ({
1
+ import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
2
+ import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
+ import { defineStore as h } from "pinia";
4
+ let o = null;
5
+ const r = () => ({
5
6
  templates: [],
6
7
  selectedTemplates: {},
7
8
  selectedUnsubscribePages: [],
8
- selectedCollectionType: a.GLOBAL_UNSUBSCRIBE,
9
- activeType: a.GLOBAL_UNSUBSCRIBE,
9
+ selectedCollectionType: p.GLOBAL_UNSUBSCRIBE,
10
+ activeType: p.GLOBAL_UNSUBSCRIBE,
10
11
  pageSelectionUpdateStatus: !1,
11
12
  pageSelectionDrawerStatus: !1,
12
13
  typeSelectionDrawerStatus: !1,
13
14
  isGlobalUnsubscribeDisabled: !1,
14
15
  isSubscriptionPreferencesCenterDisabled: !1
15
- }), g = d("guidoUnsubscribe", {
16
- state: () => p(),
16
+ }), b = h("guidoUnsubscribe", {
17
+ state: () => r(),
17
18
  getters: {
18
19
  getSelectedCollection: (e) => i[e.selectedCollectionType],
19
20
  getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
20
21
  getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
21
22
  getThumbnailByTemplateId: (e) => (t) => {
22
- var c;
23
- return ((c = e.templates.find((s) => s.id === t)) == null ? void 0 : c.thumbnail) ?? "";
23
+ var l;
24
+ return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
24
25
  },
25
26
  getSelectedUnsubscribePagesByCollection: (e) => (t) => {
26
- const c = i[t];
27
- if (!c)
27
+ const l = i[t];
28
+ if (!l)
28
29
  return [];
29
30
  const s = /* @__PURE__ */ new Map();
30
31
  e.templates.forEach((n) => {
31
32
  s.set(n.id, n.type);
32
33
  });
33
- const l = new Set(c);
34
+ const c = new Set(l);
34
35
  return e.selectedUnsubscribePages.filter((n) => {
35
- const o = s.get(n);
36
- return o !== void 0 && l.has(o);
36
+ const a = s.get(n);
37
+ return a !== void 0 && c.has(a);
37
38
  });
38
39
  },
39
40
  isActiveTypeFirstInCollection: (e) => {
@@ -47,7 +48,7 @@ const p = () => ({
47
48
  hasTemplatesByCollectionType: (e) => {
48
49
  const t = {};
49
50
  return i[e.selectedCollectionType].forEach((s) => {
50
- t[s] = e.templates.some((l) => l.type === s);
51
+ t[s] = e.templates.some((c) => c.type === s);
51
52
  }), t;
52
53
  },
53
54
  unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
@@ -56,29 +57,31 @@ const p = () => ({
56
57
  $reset() {
57
58
  const { templates: e, selectedUnsubscribePages: t } = this;
58
59
  Object.assign(this, {
59
- ...p(),
60
+ ...r(),
60
61
  templates: e,
61
62
  selectedUnsubscribePages: t
62
63
  });
63
64
  },
64
65
  async fetchTemplates() {
65
- if (this.templates.length)
66
- return;
67
- const { getUnsubscribePages: e } = r(), t = await e();
68
- this.templates = t;
66
+ this.templates.length || (o || (o = (async () => {
67
+ const { getUnsubscribePages: e } = d();
68
+ this.templates = await e();
69
+ })().finally(() => {
70
+ o = null;
71
+ })), await o);
69
72
  },
70
73
  setCollection(e) {
71
74
  this.selectedCollectionType = e;
72
75
  const t = i[e];
73
76
  if (t && t.length > 0) {
74
77
  [this.activeType] = t;
75
- const c = { ...this.selectedTemplates };
78
+ const l = { ...this.selectedTemplates };
76
79
  t.forEach((s) => {
77
- if (!c[s]) {
78
- const l = this.templates.find((n) => n.type === s);
79
- l && (c[s] = l.id);
80
+ if (!l[s]) {
81
+ const c = this.templates.find((n) => n.type === s);
82
+ c && (l[s] = c.id);
80
83
  }
81
- }), this.selectedTemplates = c;
84
+ }), this.selectedTemplates = l;
82
85
  }
83
86
  },
84
87
  setCollectionWithoutAutoSelection(e) {
@@ -101,17 +104,17 @@ const p = () => ({
101
104
  t >= 0 && (this.activeType = this.getSelectedCollection[t]);
102
105
  },
103
106
  loadSelectedTemplates(e) {
104
- const t = new Map(this.templates.map((s) => [s.id, s.type])), c = { ...this.selectedTemplates };
107
+ const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
105
108
  e.forEach((s) => {
106
- const l = t.get(s);
107
- l !== void 0 && (c[l] = s);
108
- }), this.selectedTemplates = c;
109
+ const c = t.get(s);
110
+ c !== void 0 && (l[c] = s);
111
+ }), this.selectedTemplates = l;
109
112
  },
110
113
  getSelectedTemplatesByCollection(e) {
111
- const t = i[e], c = [];
114
+ const t = i[e], l = [];
112
115
  return t.forEach((s) => {
113
- this.selectedTemplates[s] && c.push(this.selectedTemplates[s]);
114
- }), c;
116
+ this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
117
+ }), l;
115
118
  },
116
119
  addUnsubscribePages(e) {
117
120
  const t = /* @__PURE__ */ new Set([...this.selectedUnsubscribePages, ...e]);
@@ -125,5 +128,5 @@ const p = () => ({
125
128
  }
126
129
  });
127
130
  export {
128
- g as useUnsubscribeStore
131
+ b as useUnsubscribeStore
129
132
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.2.0-beta.eeefcc3",
3
+ "version": "2.2.0-beta.fa4cec8",
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",