@useinsider/guido 1.0.3-beta.901ea7e → 1.0.3-beta.90a7855

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/README.md +3 -0
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
  4. package/dist/components/organisms/header/RightSlot.vue2.js +13 -13
  5. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +92 -0
  6. package/dist/extensions/Blocks/Items/controls/settingsControl.js +36 -36
  7. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  8. package/dist/extensions/Blocks/Items/enums/productEnums.js +3 -2
  9. package/dist/extensions/Blocks/Items/extension.js +7 -6
  10. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +2 -2
  11. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +17 -5
  12. package/dist/extensions/Blocks/Items/settingsPanel.js +25 -24
  13. package/dist/extensions/Blocks/Items/store/items-block.js +7 -3
  14. package/dist/extensions/Blocks/Items/template.js +32 -30
  15. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +35 -26
  16. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +29 -27
  17. package/dist/extensions/Blocks/Unsubscribe/block.js +34 -30
  18. package/dist/guido.css +1 -1
  19. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +15 -0
  20. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +1 -0
  21. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +1 -0
  22. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +2 -0
  23. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +6 -0
  24. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +3 -4
  25. package/package.json +3 -1
@@ -1,13 +1,13 @@
1
- import { SettingsPanelRegistry as O, SettingsPanelTab as T, SettingsTab as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { BLOCK_ID as S } from "./block.js";
3
- import { COMPOSITION_CONTROL_BLOCK_ID as R } from "./controls/cardComposition.js";
1
+ import { SettingsPanelRegistry as O, SettingsPanelTab as T, SettingsTab as N } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { BLOCK_ID as R } from "./block.js";
3
+ import { COMPOSITION_CONTROL_BLOCK_ID as S } from "./controls/cardComposition.js";
4
4
  import { CONTROL_BLOCK_ID as A } from "./controls/settingsControl.js";
5
5
  import { ItemsBlockId as E, ItemsBlockControlId as I } from "./enums/controlEnums.js";
6
6
  class U extends O {
7
- registerBlockControls(N) {
8
- N[S] = [
7
+ registerBlockControls(_) {
8
+ _[R] = [
9
9
  new T(
10
- _.SETTINGS,
10
+ N.SETTINGS,
11
11
  [
12
12
  A
13
13
  ]
@@ -15,12 +15,12 @@ class U extends O {
15
15
  new T(
16
16
  "Card Composition",
17
17
  [
18
- R
18
+ S
19
19
  ]
20
20
  ).withLabel("Card Composition")
21
- ], N[E.ORIGINAL_PRICE] = [
21
+ ], _[E.ORIGINAL_PRICE] = [
22
22
  new T(
23
- _.SETTINGS,
23
+ N.SETTINGS,
24
24
  [
25
25
  I.ORIGINAL_PRICE_STYLE,
26
26
  I.ORIGINAL_PRICE_ALIGN,
@@ -28,16 +28,16 @@ class U extends O {
28
28
  ]
29
29
  ),
30
30
  new T(
31
- _.STYLES,
31
+ N.STYLES,
32
32
  [
33
33
  I.ORIGINAL_PRICE_COLOR,
34
34
  I.ORIGINAL_PRICE_FONT_FAMILY,
35
35
  I.ORIGINAL_PRICE_SIZE
36
36
  ]
37
37
  )
38
- ], N[E.PRICE] = [
38
+ ], _[E.PRICE] = [
39
39
  new T(
40
- _.SETTINGS,
40
+ N.SETTINGS,
41
41
  [
42
42
  I.PRICE_STYLE,
43
43
  I.PRICE_ALIGN,
@@ -45,20 +45,21 @@ class U extends O {
45
45
  I.PRICE_FORMATTED_PRICE,
46
46
  I.PRICE_CURRENCY_SYMBOL,
47
47
  I.PRICE_CURRENCY_LOCATION,
48
+ I.PRICE_ORIENTATION,
48
49
  I.PRICE_PADDINGS
49
50
  ]
50
51
  ),
51
52
  new T(
52
- _.STYLES,
53
+ N.STYLES,
53
54
  [
54
55
  I.PRICE_COLOR,
55
56
  I.PRICE_FONT_FAMILY,
56
57
  I.PRICE_SIZE
57
58
  ]
58
59
  )
59
- ], N[E.NAME] = [
60
+ ], _[E.NAME] = [
60
61
  new T(
61
- _.SETTINGS,
62
+ N.SETTINGS,
62
63
  [
63
64
  I.NAME_STYLE,
64
65
  I.NAME_ALIGN,
@@ -67,23 +68,23 @@ class U extends O {
67
68
  ]
68
69
  ),
69
70
  new T(
70
- _.STYLES,
71
+ N.STYLES,
71
72
  [
72
73
  I.NAME_FONT_FAMILY,
73
74
  I.NAME_SIZE,
74
75
  I.NAME_COLOR
75
76
  ]
76
77
  )
77
- ], N[E.QUANTITY] = [
78
+ ], _[E.QUANTITY] = [
78
79
  new T(
79
- _.SETTINGS,
80
+ N.SETTINGS,
80
81
  [
81
82
  I.QUANTITY_FONT_FAMILY,
82
83
  I.QUANTITY_STYLE
83
84
  ]
84
85
  ),
85
86
  new T(
86
- _.STYLES,
87
+ N.STYLES,
87
88
  [
88
89
  I.QUANTITY_ALIGN,
89
90
  I.QUANTITY_SIZE,
@@ -91,18 +92,18 @@ class U extends O {
91
92
  I.QUANTITY_PADDINGS
92
93
  ]
93
94
  )
94
- ], N[E.IMAGE] = [
95
+ ], _[E.IMAGE] = [
95
96
  new T(
96
- _.SETTINGS,
97
+ N.SETTINGS,
97
98
  [
98
99
  I.IMAGE_LINK,
99
100
  I.IMAGE_SIZE,
100
101
  I.IMAGE_MARGINS
101
102
  ]
102
103
  )
103
- ], N[E.BUTTON] = [
104
+ ], _[E.BUTTON] = [
104
105
  new T(
105
- _.SETTINGS,
106
+ N.SETTINGS,
106
107
  [
107
108
  I.BUTTON_LINK,
108
109
  I.BUTTON_TEXT,
@@ -112,7 +113,7 @@ class U extends O {
112
113
  ]
113
114
  ),
114
115
  new T(
115
- _.STYLES,
116
+ N.STYLES,
116
117
  [
117
118
  I.BUTTON_COLOR,
118
119
  I.BUTTON_FONT_FAMILY,
@@ -1,4 +1,4 @@
1
- import { defineStore as s } from "pinia";
1
+ import { defineStore as r } from "pinia";
2
2
  import { DefaultConfigValues as e } from "../enums/settingsEnums.js";
3
3
  const n = (t) => t.replace(/Url\}/, "Image}"), o = (t) => t.replace(/Image\}/, "Url}"), i = () => {
4
4
  const t = e.cartItemsSelectControlValue;
@@ -13,6 +13,7 @@ const n = (t) => t.replace(/Url\}/, "Image}"), o = (t) => t.replace(/Image\}/, "
13
13
  currencySymbol: "USD",
14
14
  currencyLocation: "0",
15
15
  formattedPrice: !0,
16
+ priceOrientation: "horizontal",
16
17
  templateData: {
17
18
  imageSrc: "",
18
19
  name: "",
@@ -22,7 +23,7 @@ const n = (t) => t.replace(/Url\}/, "Image}"), o = (t) => t.replace(/Image\}/, "
22
23
  button: ""
23
24
  }
24
25
  };
25
- }, a = s("guidoItemsBlock", {
26
+ }, m = r("guidoItemsBlock", {
26
27
  state: () => i(),
27
28
  actions: {
28
29
  setItemsType(t) {
@@ -55,6 +56,9 @@ const n = (t) => t.replace(/Url\}/, "Image}"), o = (t) => t.replace(/Image\}/, "
55
56
  setFormattedPrice(t) {
56
57
  this.formattedPrice = t;
57
58
  },
59
+ setPriceOrientation(t) {
60
+ this.priceOrientation = t;
61
+ },
58
62
  setTemplateData(t) {
59
63
  this.templateData = t;
60
64
  },
@@ -67,5 +71,5 @@ const n = (t) => t.replace(/Url\}/, "Image}"), o = (t) => t.replace(/Image\}/, "
67
71
  }
68
72
  });
69
73
  export {
70
- a as useItemsBlockStore
74
+ m as useItemsBlockStore
71
75
  };
@@ -1,23 +1,23 @@
1
1
  import { BlockType as l, BlockAttr as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { ItemsBlockId as T } from "./enums/controlEnums.js";
3
3
  import { productPairs as i, templateFirstLine as N } from "./enums/productEnums.js";
4
- import { ItemInCartOptions as P, SETTINGS_ENUMS as O, DefaultConfigValues as f } from "./enums/settingsEnums.js";
4
+ import { ItemInCartOptions as f, SETTINGS_ENUMS as O, DefaultConfigValues as P } from "./enums/settingsEnums.js";
5
5
  import B from "./layouts/horizontal.html.js";
6
6
  import g from "./layouts/vertical.html.js";
7
7
  let [C] = i.PAIRS_FOR_EXTENSION.imageSrc.CART_ITEMS.DEFAULT, [A] = i.PAIRS_FOR_EXTENSION.name.CART_ITEMS.DEFAULT, [p] = i.PAIRS_FOR_EXTENSION.price.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [I] = i.PAIRS_FOR_EXTENSION.originalPrice.CART_ITEMS.DEFAULT_PRICE_FORMATTED, [u] = i.PAIRS_FOR_EXTENSION.quantity.CART_ITEMS.DEFAULT;
8
- const F = (a, t) => `
8
+ const h = (a, t) => `
9
9
  <${l.BLOCK_IMAGE}
10
10
  ${_.BLOCK_IMAGE.src}="${C}"
11
11
  ${_.BLOCK_IMAGE.alt}="${A}"
12
12
  ${_.BLOCK_IMAGE.href}="#!"
13
- ${_.BLOCK_IMAGE.width}=${f.productImageWidth}
13
+ ${_.BLOCK_IMAGE.width}=${P.productImageWidth}
14
14
  esd-extension-block-id="${T.IMAGE}"
15
15
  data-slot-1
16
16
  product-attr="imageSrc"
17
17
  data-type="${a}"
18
18
  data-number="${t}"
19
19
  />
20
- `, S = (a) => `
20
+ `, F = (a) => `
21
21
  <${l.BLOCK_TEXT}
22
22
  width="100%"
23
23
  align="center"
@@ -39,6 +39,8 @@ const F = (a, t) => `
39
39
  word-wrap:break-word;
40
40
  white-space: nowrap;
41
41
  width: 520px;
42
+ overflow: hidden;
43
+ text-overflow: ellipsis;
42
44
  "
43
45
  product-attr="name"
44
46
  data-slot-2
@@ -47,13 +49,13 @@ const F = (a, t) => `
47
49
  </a>
48
50
  </p>
49
51
  </${l.BLOCK_TEXT}>
50
- `, h = (a, t, n, e, c) => {
51
- let o = p;
52
+ `, S = (a, t, o, e, c) => {
53
+ let n = p;
52
54
  if (e && e.trim()) {
53
55
  const E = `&nbsp;${e.trim()}&nbsp;`;
54
- o = (c || "0") === "1" ? `${p}${E}` : `${E}${p}`;
56
+ n = (c || "0") === "1" ? `${p}${E}` : `${E}${p}`;
55
57
  }
56
- const r = c === "1" ? "after" : "before", d = `data-formated="${n ? "true" : "false"}"`, s = `data-curency="${r}"`;
58
+ const r = c === "1" ? "after" : "before", d = `data-formated="${o ? "true" : "false"}"`, s = `data-curency="${r}"`;
57
59
  return `
58
60
  <${l.BLOCK_TEXT}
59
61
  esd-extension-block-id="${T.PRICE}"
@@ -71,17 +73,17 @@ const F = (a, t) => `
71
73
  ${s}
72
74
  ${e ? `data-currency_symbol="${e}"` : ""}
73
75
  >
74
- ${o}
76
+ ${n}
75
77
  </p>
76
78
  </${l.BLOCK_TEXT}>
77
79
  `;
78
- }, L = (a, t, n, e, c) => {
79
- let o = I;
80
+ }, L = (a, t, o, e, c) => {
81
+ let n = I;
80
82
  if (e && e.trim()) {
81
83
  const E = `&nbsp;${e.trim()}&nbsp;`;
82
- o = (c || "0") === "1" ? `${I}${E}` : `${E}${I}`;
84
+ n = (c || "0") === "1" ? `${I}${E}` : `${E}${I}`;
83
85
  }
84
- const r = c === "1" ? "after" : "before", d = `data-formated="${n ? "true" : "false"}"`, s = `data-curency="${r}"`;
86
+ const r = c === "1" ? "after" : "before", d = `data-formated="${o ? "true" : "false"}"`, s = `data-curency="${r}"`;
85
87
  return `
86
88
  <${l.BLOCK_TEXT}
87
89
  class="items-block-price"
@@ -100,7 +102,7 @@ const F = (a, t) => `
100
102
  ${s}
101
103
  ${e ? `data-currency_symbol="${e}"` : ""}
102
104
  >
103
- <s>${o}</s>
105
+ <s>${n}</s>
104
106
  </p>
105
107
  </${l.BLOCK_TEXT}>
106
108
  `;
@@ -135,47 +137,47 @@ const F = (a, t) => `
135
137
  </${l.BLOCK_BUTTON}>
136
138
  `, D = () => `
137
139
  <esd-config-block style="display: none;"></esd-config-block>
138
- `, R = (a, t, n, e, c, o, r, d) => {
139
- const $ = `${`data-type="${t}" data-number="${n}"`} data-orientation="${e}"`;
140
+ `, R = (a, t, o, e, c, n, r, d) => {
141
+ const $ = `${`data-type="${t}" data-number="${o}"`} data-orientation="${e}"`;
140
142
  return a.replace(
141
143
  /<td([^>]*class="[^"]*ins-product-td[^"]*"[^>]*)>/,
142
144
  `<td$1 ${$}>`
143
- ).replace("{-{-TEMPLATE_FIRST_LINE-}-}", N).replace("{-{-PRODUCT_IMAGE-}-}", F(t, n)).replace("{-{-PRODUCT_NAME-}-}", S(t)).replace(
145
+ ).replace("{-{-TEMPLATE_FIRST_LINE-}-}", N).replace("{-{-PRODUCT_IMAGE-}-}", h(t, o)).replace("{-{-PRODUCT_NAME-}-}", F(t)).replaceAll(
144
146
  "{-{-PRODUCT_PRICE-}-}",
145
- h(t, n, c, o, r)
146
- ).replace(
147
+ S(t, o, c, n, r)
148
+ ).replaceAll(
147
149
  "{-{-PRODUCT_ORIGINAL_PRICE-}-}",
148
150
  L(
149
151
  t,
150
- n,
151
- c,
152
152
  o,
153
+ c,
154
+ n,
153
155
  r
154
156
  )
155
- ).replace("{-{-PRODUCT_QUANTITY-}-}", b()).replace("{-{-PRODUCT_BUTTON-}-}", U(t, n)).replace("{-{-CONFIG_BLOCK-}-}", D());
157
+ ).replace("{-{-PRODUCT_QUANTITY-}-}", b()).replace("{-{-PRODUCT_BUTTON-}-}", U(t, o)).replace("{-{-CONFIG_BLOCK-}-}", D());
156
158
  };
157
159
  function G({
158
160
  orientation: a,
159
161
  itemsType: t = O.ITEMS_TYPE.CART_ITEMS,
160
- itemId: n,
162
+ itemId: o,
161
163
  currencySymbol: e,
162
164
  currencyLocation: c,
163
- formattedPrice: o = !0
165
+ formattedPrice: n = !0
164
166
  }) {
165
- const r = P[t].findIndex((s) => s.value === n);
167
+ const r = f[t].findIndex((s) => s.value === o);
166
168
  let d = "1";
167
169
  if (r >= 0)
168
170
  d = String(r + 1);
169
- else if (n) {
170
- const s = n.match(/\((\d+)\)/);
171
+ else if (o) {
172
+ const s = o.match(/\((\d+)\)/);
171
173
  s && s[1] && ([, d] = s);
172
174
  }
173
- return C = i.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[r >= 0 ? r : 0], A = i.PAIRS_FOR_EXTENSION.name[t].DEFAULT[r >= 0 ? r : 0], p = o ? i.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE_FORMATTED : i.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE, I = o ? i.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE_FORMATTED : i.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE, u = i.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT, a === O.ORIENTATION.VERTICAL ? R(
175
+ return C = i.PAIRS_FOR_EXTENSION.imageSrc[t].DEFAULT[r >= 0 ? r : 0], A = i.PAIRS_FOR_EXTENSION.name[t].DEFAULT[r >= 0 ? r : 0], p = n ? i.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE_FORMATTED : i.PAIRS_FOR_EXTENSION.price[t].DEFAULT_PRICE, I = n ? i.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE_FORMATTED : i.PAIRS_FOR_EXTENSION.originalPrice[t].DEFAULT_PRICE, u = i.PAIRS_FOR_EXTENSION.quantity[t].DEFAULT, a === O.ORIENTATION.VERTICAL ? R(
174
176
  g,
175
177
  t,
176
178
  d,
177
179
  a,
178
- o,
180
+ n,
179
181
  e,
180
182
  c
181
183
  ) : R(
@@ -183,7 +185,7 @@ function G({
183
185
  t,
184
186
  d,
185
187
  a,
186
- o,
188
+ n,
187
189
  e,
188
190
  c
189
191
  );
@@ -1,67 +1,76 @@
1
- import { useItemsBlockStore as s } from "../store/items-block.js";
2
- import { syncAttributeFromConfigBlock as e, createBooleanSyncConfig as i, createStringSyncConfig as r } from "./syncAttributeFromConfigBlock.js";
3
- function C(t) {
4
- const o = s(), n = i(
1
+ import { useItemsBlockStore as e } from "../store/items-block.js";
2
+ import { syncAttributeFromConfigBlock as r, createBooleanSyncConfig as i, createStringSyncConfig as s } from "./syncAttributeFromConfigBlock.js";
3
+ function m(t) {
4
+ const o = e(), n = i(
5
5
  "PRODUCT_NAME_TRIMMING",
6
6
  (c) => o.setNameTrimming(c),
7
7
  !1
8
8
  );
9
- e(t, n);
9
+ r(t, n);
10
10
  }
11
11
  function f(t) {
12
- const o = s(), n = i(
12
+ const o = e(), n = i(
13
13
  "PRODUCT_PRICE_HIDE_DISCOUNT",
14
14
  (c) => o.setHideDiscount(c),
15
15
  !1
16
16
  );
17
- e(t, n);
17
+ r(t, n);
18
18
  }
19
19
  function R(t) {
20
- const o = s(), n = i(
20
+ const o = e(), n = i(
21
21
  "PRODUCT_PRICE_FORMATTED",
22
22
  (c) => o.setFormattedPrice(c),
23
23
  !0
24
24
  );
25
- e(t, n);
25
+ r(t, n);
26
26
  }
27
- function _(t) {
28
- const o = s(), n = r(
27
+ function O(t) {
28
+ const o = e(), n = s(
29
29
  "PRODUCT_PRICE_CURRENCY_SYMBOL",
30
30
  (c) => o.setCurrencySymbol(c),
31
31
  ""
32
32
  );
33
- e(t, n);
33
+ r(t, n);
34
34
  }
35
- function y(t) {
36
- const o = s(), n = r(
35
+ function _(t) {
36
+ const o = e(), n = s(
37
37
  "PRODUCT_PRICE_CURRENCY_LOCATION",
38
38
  (c) => o.setCurrencyLocation(c),
39
39
  "0"
40
40
  );
41
- e(t, n);
41
+ r(t, n);
42
42
  }
43
- function T(t) {
44
- const o = s(), n = r(
43
+ function I(t) {
44
+ const o = e(), n = s(
45
45
  "PRODUCT_BUTTON_LINK",
46
46
  (c) => o.setButtonLink(c),
47
47
  ""
48
48
  );
49
- e(t, n);
49
+ r(t, n);
50
50
  }
51
- function g(t) {
52
- const o = s(), n = r(
51
+ function T(t) {
52
+ const o = e(), n = s(
53
53
  "PRODUCT_IMAGE_LINK",
54
54
  (c) => o.setImageLink(c),
55
55
  ""
56
56
  );
57
- e(t, n);
57
+ r(t, n);
58
+ }
59
+ function y(t) {
60
+ const o = e(), n = s(
61
+ "PRODUCT_ORIGINAL_PRICE_CONTROL_ORIENTATION",
62
+ (c) => o.setPriceOrientation(c),
63
+ "horizontal"
64
+ );
65
+ r(t, n);
58
66
  }
59
67
  export {
60
- T as syncButtonLinkFromAttributes,
61
- y as syncCurrencyLocationFromAttributes,
62
- _ as syncCurrencySymbolFromAttributes,
68
+ I as syncButtonLinkFromAttributes,
69
+ _ as syncCurrencyLocationFromAttributes,
70
+ O as syncCurrencySymbolFromAttributes,
63
71
  R as syncFormattedPriceFromAttributes,
64
72
  f as syncHideDiscountFromAttributes,
65
- g as syncImageLinkFromAttributes,
66
- C as syncNameTrimmingFromAttributes
73
+ T as syncImageLinkFromAttributes,
74
+ m as syncNameTrimmingFromAttributes,
75
+ y as syncPriceOrientationFromAttributes
67
76
  };
@@ -1,44 +1,46 @@
1
- import { ModificationDescription as D } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as p } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { configAttributes as t } from "../enums/productEnums.js";
3
- import { DefaultConfigValues as e } from "../enums/settingsEnums.js";
4
- import { useItemsBlockStore as l } from "../store/items-block.js";
5
- import { getConfigBlock as p } from "./configBlockUtils.js";
6
- function b(n, c) {
7
- const i = p(n);
8
- if (!i)
3
+ import { DefaultConfigValues as i } from "../enums/settingsEnums.js";
4
+ import { useItemsBlockStore as s } from "../store/items-block.js";
5
+ import { getConfigBlock as P } from "./configBlockUtils.js";
6
+ function M(n, O) {
7
+ const e = P(n);
8
+ if (!e)
9
9
  return;
10
- const C = l(), {
10
+ const c = s(), {
11
11
  itemsType: r,
12
- itemIds: E,
12
+ itemIds: C,
13
13
  orientation: T,
14
14
  nameTrimming: _,
15
- hideDiscount: O,
16
- formattedPrice: m,
17
- currencySymbol: R,
18
- currencyLocation: N,
15
+ hideDiscount: E,
16
+ formattedPrice: R,
17
+ currencySymbol: N,
18
+ currencyLocation: m,
19
+ priceOrientation: I,
19
20
  buttonLink: a,
20
21
  imageLink: f
21
- } = C, u = {
22
+ } = c, u = {
22
23
  "data-source": r,
23
24
  [t.TYPE]: r,
24
- [t.ITEMS_INDEX_SELECT_CONTROL_VALUE]: E,
25
+ [t.ITEMS_INDEX_SELECT_CONTROL_VALUE]: C,
25
26
  [t.ORIENTATION]: T,
26
27
  [t.PRODUCT_NAME_TRIMMING]: _ ? "1" : "0",
27
- [t.PRODUCT_PRICE_HIDE_DISCOUNT]: O ? "1" : "0",
28
- [t.PRODUCT_PRICE_FORMATTED]: m ? "1" : "0",
29
- [t.PRODUCT_PRICE_CURRENCY_SYMBOL]: R || "",
30
- [t.PRODUCT_PRICE_CURRENCY_LOCATION]: N || "0",
28
+ [t.PRODUCT_PRICE_HIDE_DISCOUNT]: E ? "1" : "0",
29
+ [t.PRODUCT_PRICE_FORMATTED]: R ? "1" : "0",
30
+ [t.PRODUCT_PRICE_CURRENCY_SYMBOL]: N || "",
31
+ [t.PRODUCT_PRICE_CURRENCY_LOCATION]: m || "0",
32
+ [t.PRODUCT_ORIGINAL_PRICE_CONTROL_ORIENTATION]: I || "horizontal",
31
33
  [t.PRODUCT_BUTTON_LINK]: a || "",
32
34
  [t.PRODUCT_IMAGE_LINK]: f || "",
33
- [t.NAME_CONTROL_ENABLED]: e.productNameControlEnabled,
34
- [t.QUANTITY_CONTROL_ENABLED]: e.productQuantityControlEnabled,
35
- [t.PRICE_CONTROL_OPENED]: e.productPriceControlOpened
35
+ [t.NAME_CONTROL_ENABLED]: i.productNameControlEnabled,
36
+ [t.QUANTITY_CONTROL_ENABLED]: i.productQuantityControlEnabled,
37
+ [t.PRICE_CONTROL_OPENED]: i.productPriceControlOpened
36
38
  };
37
- let o = c.getDocumentModifier().modifyHtml(i);
38
- Object.entries(u).forEach(([I, s]) => {
39
- o = o.setAttribute(I, s);
40
- }), o.apply(new D("Update config block attributes from control"));
39
+ let o = O.getDocumentModifier().modifyHtml(e);
40
+ Object.entries(u).forEach(([D, l]) => {
41
+ o = o.setAttribute(D, l);
42
+ }), o.apply(new p("Update config block attributes from control"));
41
43
  }
42
44
  export {
43
- b as updateConfigBlockAttributes
45
+ M as updateConfigBlockAttributes
44
46
  };
@@ -1,17 +1,17 @@
1
- var _ = Object.defineProperty;
2
- var S = (n, i, e) => i in n ? _(n, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[i] = e;
3
- var u = (n, i, e) => S(n, typeof i != "symbol" ? i + "" : i, e);
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);
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 d, BlockCompositionType as L, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- import { getDefaultTemplate as h } from "./template.js";
6
+ import { Block as h, BlockCompositionType as S, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ import { getDefaultTemplate as L } from "./template.js";
8
8
  import { UNSUBSCRIBE_EVENTS as a, DATA_ATTRIBUTES as o } from "./utils/constants.js";
9
- import { parsePageList as m } from "./utils/utils.js";
10
- const v = "unsubscribe-block", g = 'a[data-unsubscribe-link="true"]', T = ".unsubscribe-block-v2", f = "{{ins-unsubscribe-link}}", B = {
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 = {
11
11
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
12
12
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
13
13
  };
14
- class D extends d {
14
+ class R extends h {
15
15
  constructor() {
16
16
  super();
17
17
  u(this, "selectEventListener", null);
@@ -19,13 +19,13 @@ class D extends d {
19
19
  u(this, "currentNode");
20
20
  }
21
21
  getId() {
22
- return v;
22
+ return g;
23
23
  }
24
24
  getIcon() {
25
25
  return "unsubscribe-icon";
26
26
  }
27
27
  getBlockCompositionType() {
28
- return L.BLOCK;
28
+ return S.BLOCK;
29
29
  }
30
30
  getName() {
31
31
  return this.api.translate("Unsubscribe Block");
@@ -34,13 +34,10 @@ class D extends d {
34
34
  return this.api.translate("Unsubscribe Block Description");
35
35
  }
36
36
  getTemplate() {
37
- return h();
38
- }
39
- onCreated(e) {
40
- "getOuterHTML" in e && !e.getOuterHTML() || "getAttribute" in e && e.getAttribute("data-migration") || (this.currentNode = e, this._resetStoreState(), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
37
+ return L();
41
38
  }
42
39
  onSelect(e) {
43
- this.currentNode = e, this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener();
40
+ this.currentNode = e, !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
44
41
  }
45
42
  onDelete(e) {
46
43
  this._removeEventListeners(), this._removeBlockTemplatesFromStore(e), this._resetStoreState();
@@ -66,7 +63,13 @@ class D extends d {
66
63
  this.cancelEventListener && (document.removeEventListener(a.CANCEL, this.cancelEventListener), this.cancelEventListener = null);
67
64
  }
68
65
  _handleCancel() {
69
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).delete().apply(new b("Removed unsubscribe block due to cancel"));
66
+ try {
67
+ if (!this.currentNode)
68
+ return;
69
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).delete().apply(new b("Removed unsubscribe block due to cancel"));
70
+ } catch (e) {
71
+ console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
72
+ }
70
73
  }
71
74
  _removeEventListeners() {
72
75
  this._removeSelectEventListener(), this._removeCancelEventListener();
@@ -74,26 +77,27 @@ class D extends d {
74
77
  _updateBlock(e, s) {
75
78
  if (!this.currentNode || !("querySelector" in this.currentNode))
76
79
  return;
77
- const t = this.currentNode.querySelector(g);
80
+ const t = this.currentNode.querySelector(v);
78
81
  if (!t)
79
82
  return;
80
83
  const r = this._getMergeTag(e);
81
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"));
82
85
  }
83
86
  _getMergeTag(e) {
84
- return B[e] ?? f;
87
+ return T[e] ?? B;
85
88
  }
86
89
  _openDrawer() {
87
- try {
88
- const e = c();
89
- e.typeSelectionDrawerStatus = !0;
90
- } catch (e) {
91
- console.error("[UnsubscribeBlock] Failed to open drawer:", e);
92
- }
90
+ if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
91
+ try {
92
+ const e = c();
93
+ e.typeSelectionDrawerStatus = !0;
94
+ } catch (e) {
95
+ console.error("[UnsubscribeBlock] Failed to open drawer:", e);
96
+ }
93
97
  }
94
98
  _checkExistingBlocks() {
95
99
  const e = c();
96
- e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(T).forEach((t) => {
100
+ e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((t) => {
97
101
  if ("getAttribute" in t) {
98
102
  const r = t.getAttribute(o.PAGE_TYPE);
99
103
  if (r) {
@@ -109,8 +113,8 @@ class D extends d {
109
113
  const s = e.getAttribute(o.PAGE_TYPE), t = e.getAttribute(o.PAGE_LIST);
110
114
  if (!s || !t)
111
115
  return;
112
- const r = c(), l = Number(s), p = m(t);
113
- r.setCollectionWithoutAutoSelection(l), r.loadSelectedTemplates(p);
116
+ const r = c(), l = Number(s), m = p(t);
117
+ r.setCollectionWithoutAutoSelection(l), r.loadSelectedTemplates(m);
114
118
  }
115
119
  _resetStoreState() {
116
120
  c().$reset();
@@ -121,11 +125,11 @@ class D extends d {
121
125
  const s = e.getAttribute(o.PAGE_LIST);
122
126
  if (!s)
123
127
  return;
124
- const t = c(), r = m(s);
128
+ const t = c(), r = p(s);
125
129
  t.removeUnsubscribePages(r);
126
130
  }
127
131
  }
128
132
  export {
129
- v as UNSUBSCRIBE_BLOCK_ID,
130
- D as UnsubscribeBlock
133
+ g as UNSUBSCRIBE_BLOCK_ID,
134
+ R as UnsubscribeBlock
131
135
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.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}.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}.guido-loading__wrapper[data-v-dced5582]{height:100%;top:75px}.guido-editor__wrapper[data-v-23c413c9],.guido-editor__container[data-v-23c413c9]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-23c413c9]{height:calc(100vh - 75px)}[data-v-70835920] .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-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[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-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.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}.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}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-98181b5a]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-98181b5a]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-98181b5a]{height:calc(100vh - 75px)}[data-v-70835920] .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-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[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}