@useinsider/guido 2.0.0-beta.e68b206 → 2.0.0-beta.ecd6540

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.
@@ -1,40 +1,38 @@
1
1
  import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { DefaultConfigValues as r, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
2
+ import { DefaultConfigValues as i, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
3
3
  function d() {
4
4
  return String(Date.now() + Math.floor(Math.random() * 1e3));
5
5
  }
6
- function f() {
6
+ function E() {
7
7
  return {
8
8
  initialized: !0,
9
9
  blockInstanceId: d(),
10
10
  source: n.ITEMS_TYPE.CART_ITEMS,
11
11
  type: n.ITEMS_TYPE.CART_ITEMS,
12
- itemsSelectValue: r.cartItemsSelectControlValue,
12
+ itemsSelectValue: i.cartItemsSelectControlValue,
13
13
  orientation: n.ORIENTATION.VERTICAL,
14
- nameTrimming: r.productNameTrimmingControlValue === "1",
15
- nameControlEnabled: r.productNameControlEnabled === "1",
16
- priceHideDiscount: r.productPriceHideDiscountControlValue === "1",
17
- priceFormatted: r.productPriceFormattedControlValue === "1",
14
+ nameTrimming: i.productNameTrimmingControlValue === "1",
15
+ priceHideDiscount: i.productPriceHideDiscountControlValue === "1",
16
+ priceFormatted: i.productPriceFormattedControlValue === "1",
18
17
  priceSinglePrice: !1,
19
- priceCurrencySymbol: r.productPriceCurrencySymbolControlValue,
20
- priceCurrencyLocation: r.productPriceCurrencyLocationControlValue,
21
- priceControlOpened: r.productPriceControlOpened === "1",
18
+ priceCurrencySymbol: i.productPriceCurrencySymbolControlValue,
19
+ priceCurrencyLocation: i.productPriceCurrencyLocationControlValue,
22
20
  priceOrientation: "horizontal",
23
- quantityControlEnabled: r.productQuantityControlEnabled === "1",
24
- buttonLink: r.productButtonLinkControlValue,
25
- imageLink: r.productImageLinkControlValue,
21
+ quantityControlEnabled: i.productQuantityControlEnabled === "1",
22
+ buttonLink: i.productButtonLinkControlValue,
23
+ imageLink: i.productImageLinkControlValue,
26
24
  buttonLabel: "Buy",
27
25
  buttonFullWidth: !0,
28
26
  // Default to full width (es-fw class)
29
- imageVisible: r.productImageVisible === "1",
30
- nameVisible: r.productNameVisible === "1",
31
- quantityVisible: r.productQuantityVisible === "1",
32
- priceVisible: r.productPriceVisible === "1",
33
- originalPriceVisible: r.productOriginalPriceVisible === "1",
34
- buttonVisible: r.productButtonVisible === "1"
27
+ imageVisible: i.productImageVisible === "1",
28
+ nameVisible: i.productNameVisible === "1",
29
+ quantityVisible: i.productQuantityVisible === "1",
30
+ priceVisible: i.productPriceVisible === "1",
31
+ originalPriceVisible: i.productOriginalPriceVisible === "1",
32
+ buttonVisible: i.productButtonVisible === "1"
35
33
  };
36
34
  }
37
- function p(o) {
35
+ function s(o) {
38
36
  if (!o)
39
37
  return null;
40
38
  const t = o.closest(".items-block-v2");
@@ -51,41 +49,37 @@ function m(o) {
51
49
  PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
52
50
  }[o] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
53
51
  }
54
- function C(o, t) {
52
+ function I(o, t) {
55
53
  if (!o)
56
- return r.cartItemsSelectControlValue;
54
+ return i.cartItemsSelectControlValue;
57
55
  if (o.includes("{{"))
58
56
  return o;
59
57
  if (/^\d+$/.test(o)) {
60
- const e = parseInt(o) - 1, i = g[t];
61
- if (i && i[e])
62
- return i[e].value;
58
+ const e = parseInt(o) - 1, r = g[t];
59
+ if (r && r[e])
60
+ return r[e].value;
63
61
  }
64
- return r.cartItemsSelectControlValue;
62
+ return i.cartItemsSelectControlValue;
65
63
  }
66
- function I(o) {
64
+ function C(o) {
67
65
  const t = o.querySelector("esd-config-block");
68
66
  if (!t)
69
67
  return null;
70
- const e = (c, a) => c == null ? a : c === "1" || c === "true", i = (c, a) => c || a, l = t.getAttribute("data-type"), u = m(l), s = t.getAttribute("data-cart_items_select_control_value"), _ = C(s, u);
68
+ const e = (c, a) => c == null ? a : c === "1" || c === "true", r = (c, a) => c || a, l = t.getAttribute("data-type"), u = m(l), _ = t.getAttribute("data-cart_items_select_control_value"), p = I(_, u);
71
69
  return {
72
70
  initialized: e(t.getAttribute("data-initialized"), !1),
73
- blockInstanceId: i(
71
+ blockInstanceId: r(
74
72
  t.getAttribute("data-block-instance-id"),
75
73
  d()
76
74
  ),
77
75
  source: u,
78
76
  type: u,
79
- itemsSelectValue: _,
77
+ itemsSelectValue: p,
80
78
  orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
81
79
  nameTrimming: e(
82
80
  t.getAttribute("data-product_name_control_trim"),
83
81
  !0
84
82
  ),
85
- nameControlEnabled: e(
86
- t.getAttribute("data-product_name_control_enabled"),
87
- !0
88
- ),
89
83
  priceHideDiscount: e(
90
84
  t.getAttribute("data-product_price_control_nodup"),
91
85
  !0
@@ -98,32 +92,28 @@ function I(o) {
98
92
  t.getAttribute("data-product_price_control_single_price"),
99
93
  !1
100
94
  ),
101
- priceCurrencySymbol: i(
95
+ priceCurrencySymbol: r(
102
96
  t.getAttribute("data-product_price_currency_symbol"),
103
- r.productPriceCurrencySymbolControlValue
97
+ i.productPriceCurrencySymbolControlValue
104
98
  ),
105
- priceCurrencyLocation: i(
99
+ priceCurrencyLocation: r(
106
100
  t.getAttribute("data-product_price_currency_location"),
107
- r.productPriceCurrencyLocationControlValue
108
- ),
109
- priceControlOpened: e(
110
- t.getAttribute("data-product_price_control_opened"),
111
- !0
101
+ i.productPriceCurrencyLocationControlValue
112
102
  ),
113
103
  priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
114
104
  quantityControlEnabled: e(
115
105
  t.getAttribute("data-product_quantity_control_enabled"),
116
106
  !0
117
107
  ),
118
- buttonLink: i(
108
+ buttonLink: r(
119
109
  t.getAttribute("data-product_button_link"),
120
- r.productButtonLinkControlValue
110
+ i.productButtonLinkControlValue
121
111
  ),
122
- imageLink: i(
112
+ imageLink: r(
123
113
  t.getAttribute("data-product_image_link"),
124
- r.productImageLinkControlValue
114
+ i.productImageLinkControlValue
125
115
  ),
126
- buttonLabel: i(
116
+ buttonLabel: r(
127
117
  t.getAttribute("data-product_button_control_label"),
128
118
  "Buy"
129
119
  ),
@@ -141,11 +131,11 @@ function I(o) {
141
131
  !0
142
132
  ),
143
133
  quantityVisible: e(
144
- t.getAttribute("data-product_quantity_visible"),
134
+ t.getAttribute("data-product_quantity_control_enabled"),
145
135
  !0
146
136
  ),
147
137
  priceVisible: e(
148
- t.getAttribute("data-product_price_visible"),
138
+ t.getAttribute("data-product_price_control_enabled"),
149
139
  !0
150
140
  ),
151
141
  originalPriceVisible: e(
@@ -153,32 +143,32 @@ function I(o) {
153
143
  !0
154
144
  ),
155
145
  buttonVisible: e(
156
- t.getAttribute("data-product_button_visible"),
146
+ t.getAttribute("data-product_button_control_enabled"),
157
147
  !0
158
148
  )
159
149
  };
160
150
  }
161
151
  function S(o) {
162
- const t = p(o);
152
+ const t = s(o);
163
153
  if (!t)
164
154
  return null;
165
155
  const e = t.getNodeConfig();
166
156
  if (e && e.initialized)
167
157
  return e;
168
- const i = I(t);
169
- return i || null;
158
+ const r = C(t);
159
+ return r || null;
170
160
  }
171
- function A(o, t, e) {
172
- const i = p(o);
173
- if (!i)
161
+ function y(o, t, e) {
162
+ const r = s(o);
163
+ if (!r)
174
164
  return;
175
- const u = { ...i.getNodeConfig() || {}, ...e };
176
- t.getDocumentModifier().modifyHtml(i).setNodeConfig(u).apply(new b("Update Items block configuration"));
165
+ const u = { ...r.getNodeConfig() || {}, ...e };
166
+ t.getDocumentModifier().modifyHtml(r).setNodeConfig(u).apply(new b("Update Items block configuration"));
177
167
  }
178
168
  export {
179
169
  d as generateBlockInstanceId,
180
- f as getDefaultItemsBlockConfig,
170
+ E as getDefaultItemsBlockConfig,
181
171
  S as getItemsBlockConfig,
182
- p as getItemsBlockContainer,
183
- A as setItemsBlockConfig
172
+ s as getItemsBlockContainer,
173
+ y as setItemsBlockConfig
184
174
  };
@@ -29,11 +29,9 @@ export declare const DefaultConfigValues: {
29
29
  productPriceCurrencyLocationControlValue: string;
30
30
  productButtonLinkControlValue: string;
31
31
  productImageLinkControlValue: string;
32
- productNameControlEnabled: string;
33
32
  productQuantityControlOpened: string;
34
33
  productNameControlTrim: string;
35
34
  productQuantityControlEnabled: string;
36
- productPriceControlOpened: string;
37
35
  productImageVisible: string;
38
36
  productNameVisible: string;
39
37
  productQuantityVisible: string;
@@ -12,13 +12,11 @@ export interface ItemsBlockConfig {
12
12
  itemsSelectValue: string;
13
13
  orientation: OrientationType;
14
14
  nameTrimming: boolean;
15
- nameControlEnabled: boolean;
16
15
  priceHideDiscount: boolean;
17
16
  priceFormatted: boolean;
18
17
  priceSinglePrice: boolean;
19
18
  priceCurrencySymbol: string;
20
19
  priceCurrencyLocation: string;
21
- priceControlOpened: boolean;
22
20
  priceOrientation: 'vertical' | 'horizontal';
23
21
  quantityControlEnabled: boolean;
24
22
  buttonLink: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "2.0.0-beta.e68b206",
3
+ "version": "2.0.0-beta.ecd6540",
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",