@useinsider/guido 3.9.1-beta.bde1a34 → 3.9.1-beta.c521c3a

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.
@@ -4,10 +4,7 @@ const e = "Items", o = {
4
4
  "Recommendation Block": "Recommendation",
5
5
  Items: e,
6
6
  "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.",
7
- "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.",
8
- "Pixel Tracking Opt-in": "Pixel Tracking Opt-in",
9
- "OPT-IN SELECTION": "OPT-IN SELECTION",
10
- "UNSUBSCRIBE GROUPS": "UNSUBSCRIBE GROUPS"
7
+ "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.": "This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly."
11
8
  };
12
9
  export {
13
10
  e as Items,
@@ -1,38 +1,35 @@
1
1
  import { useTranslations as R } from "../composables/useTranslations.js";
2
- import { ProductType as s } from "../@types/config/schemas.js";
2
+ import { ProductType as n } from "../@types/config/schemas.js";
3
3
  import "../@types/config/defaults.js";
4
- import { getEnvironmentPrefix as _ } from "../utils/environmentUtil.js";
5
- const B = {
4
+ import { getEnvironmentPrefix as S } from "../utils/environmentUtil.js";
5
+ const i = {
6
6
  UNSUBSCRIBE_LINK_TYPE: 1,
7
7
  PREFERENCES_LINK_TYPE: 3
8
- }, C = {
8
+ }, B = {
9
9
  UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
10
10
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
11
11
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
12
12
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
13
- }, e = _(), U = {
14
- UNSUBSCRIBE_URL: `https://mail.${e}.com/user/v1/unsub`,
15
- PREFERENCES_URL: `https://mail.${e}.com/user/v1/prefs`
16
- }, o = {
17
- [s.EMAIL]: "email",
18
- [s.ARCHITECT]: "journey",
19
- [s.UNSUBSCRIBE_PAGES]: "email"
20
- }, c = "iid", S = "G", N = "P", u = [
21
- S,
22
- N
23
- ], T = () => ({
13
+ }, s = S(), C = {
14
+ UNSUBSCRIBE_URL: `https://mail.${s}.com/user/v1/unsub`,
15
+ PREFERENCES_URL: `https://mail.${s}.com/user/v1/prefs`
16
+ }, U = {
17
+ [n.EMAIL]: "email",
18
+ [n.ARCHITECT]: "journey",
19
+ [n.UNSUBSCRIBE_PAGES]: "email"
20
+ }, o = "iid", r = "G", c = () => ({
24
21
  name: R()("onboarding-center.email-subscribers-global-unsub-card-title"),
25
- sendGridId: S
26
- }), b = "/email/unsubscribe-pages", E = {
22
+ sendGridId: r
23
+ }), u = "/email/unsubscribe-pages", E = {
27
24
  GLOBAL_UNSUBSCRIBE: 1,
28
25
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
29
26
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
30
27
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
31
28
  RESUBSCRIBE: 5
32
- }, P = {
29
+ }, b = {
33
30
  [E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
34
31
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
35
- }, L = {
32
+ }, T = {
36
33
  [E.GLOBAL_UNSUBSCRIBE]: [
37
34
  E.GLOBAL_UNSUBSCRIBE,
38
35
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -42,34 +39,32 @@ const B = {
42
39
  E.SUBSCRIPTION_PREFERENCE_CENTER,
43
40
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
44
41
  ]
45
- }, O = () => {
46
- const n = R();
42
+ }, P = () => {
43
+ const e = R();
47
44
  return {
48
- [E.GLOBAL_UNSUBSCRIBE]: n("unsubscription-preference.type-global-unsubscribe"),
49
- [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: n("unsubscription-preference.type-global-unsubscription-confirmation"),
50
- [E.RESUBSCRIBE]: n("unsubscription-preference.type-resubscribe"),
51
- [E.SUBSCRIPTION_PREFERENCE_CENTER]: n("unsubscription-preference.type-subscription-preferences-center"),
52
- [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: n("unsubscription-preference.type-subscription-preferences-confirmation")
45
+ [E.GLOBAL_UNSUBSCRIBE]: e("unsubscription-preference.type-global-unsubscribe"),
46
+ [E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: e("unsubscription-preference.type-global-unsubscription-confirmation"),
47
+ [E.RESUBSCRIBE]: e("unsubscription-preference.type-resubscribe"),
48
+ [E.SUBSCRIPTION_PREFERENCE_CENTER]: e("unsubscription-preference.type-subscription-preferences-center"),
49
+ [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: e("unsubscription-preference.type-subscription-preferences-confirmation")
53
50
  };
54
- }, p = {
51
+ }, O = {
55
52
  default: "{{ins-unsubscribe-link}}",
56
53
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
57
54
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
58
55
  };
59
56
  export {
60
- S as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
61
- c as INSIDER_ID,
62
- C as LINK_REGEXES,
63
- B as LINK_TYPES,
64
- p as MERGE_TAGS,
57
+ r as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
58
+ o as INSIDER_ID,
59
+ B as LINK_REGEXES,
60
+ i as LINK_TYPES,
61
+ O as MERGE_TAGS,
65
62
  E as PAGE_TYPES,
66
- N as PIXEL_TRACKING_SEND_GRID_ID,
67
- o as PRODUCT_TYPE_URL_SEGMENTS,
68
- L as TYPE_COLLECTIONS,
69
- b as UNSUBSCRIBE_PAGES_LINK,
70
- u as UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS,
71
- P as UNSUBSCRIBE_SYNC_MODULE_TYPES,
72
- U as URLS,
73
- T as getDefaultUnsubscribeGroup,
74
- O as getTypeTranslations
63
+ U as PRODUCT_TYPE_URL_SEGMENTS,
64
+ T as TYPE_COLLECTIONS,
65
+ u as UNSUBSCRIBE_PAGES_LINK,
66
+ b as UNSUBSCRIBE_SYNC_MODULE_TYPES,
67
+ C as URLS,
68
+ c as getDefaultUnsubscribeGroup,
69
+ P as getTypeTranslations
75
70
  };
@@ -1,7 +1,7 @@
1
1
  import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { getDefaultTemplate as o } from "./template.js";
3
3
  const r = "checkbox-block";
4
- class l extends e {
4
+ class s extends e {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -18,9 +18,7 @@ class l extends e {
18
18
  return this.api.translate("Checkbox Block");
19
19
  }
20
20
  getDescription() {
21
- return this.api.translate(
22
- "Checkbox lets you select Unsubscribe and Preference Type for users to manage their opt-in or opt-out preferences."
23
- );
21
+ return this.api.translate("Checkbox Block Description");
24
22
  }
25
23
  getTemplate() {
26
24
  return o();
@@ -31,5 +29,5 @@ class l extends e {
31
29
  }
32
30
  export {
33
31
  r as CHECKBOX_BLOCK_ID,
34
- l as CheckboxBlock
32
+ s as CheckboxBlock
35
33
  };
@@ -1,16 +1,16 @@
1
- var p = Object.defineProperty;
2
- var L = (i, n, e) => n in i ? p(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
- var a = (i, n, e) => L(i, typeof n != "symbol" ? n + "" : n, e);
4
- import { useHttp as h } from "../../../composables/useHttp.js";
5
- import { getDefaultUnsubscribeGroup as T, PIXEL_TRACKING_SEND_GRID_ID as C, UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS as I } from "../../../enums/unsubscribe.js";
6
- import { Control as m, UIElementType as r, UEAttr as t, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const b = "ui-elements-checkbox", E = "select", { get: _ } = h();
8
- class G extends m {
1
+ var E = Object.defineProperty;
2
+ var d = (i, n, e) => n in i ? E(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
+ var o = (i, n, e) => d(i, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useHttp as l } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as h } from "../../../enums/unsubscribe.js";
6
+ import { Control as p, UIElementType as r, UEAttr as t, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-checkbox", u = "select", { get: C } = l();
8
+ class I extends p {
9
9
  constructor() {
10
10
  super(...arguments);
11
- a(this, "currentNode");
12
- a(this, "selectedUnsubGroup");
13
- a(this, "unsubList", []);
11
+ o(this, "currentNode");
12
+ o(this, "selectedUnsubGroup");
13
+ o(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return b;
@@ -19,12 +19,12 @@ class G extends m {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = I.includes(e) ? e : Number(e);
22
+ const s = e === h ? e : Number(e);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
26
26
  this.api.updateValues({
27
- [E]: this.selectedUnsubGroup
27
+ [u]: this.selectedUnsubGroup
28
28
  });
29
29
  }
30
30
  _getLabel(e, s = `${Math.random()}`) {
@@ -46,19 +46,17 @@ class G extends m {
46
46
  return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
47
47
  }
48
48
  getTemplate() {
49
- const e = this.api.translate("Unsubscribe & Preference Center Type"), s = this.api.translate("Select Unsubscribe and Preference Type");
50
49
  return `
51
50
  <div class="checkbox-controls-container">
52
51
  <div class="checkbox-select-container container two-columns stretch">
53
52
  <${r.LABEL}
54
- ${t.LABEL.text}="${e}"
53
+ ${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
55
54
  ${t.LABEL.name}="${Math.random()}">
56
55
  </${r.LABEL}>
57
56
 
58
57
  <${r.SELECTPICKER}
59
- ${t.SELECTPICKER.name}="${E}"
60
- ${t.SELECTPICKER.searchable}="true"
61
- ${t.SELECTPICKER.placeholder}="${s}">
58
+ ${t.SELECTPICKER.name}="${u}"
59
+ ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
62
60
  ${this._getSelect()}
63
61
  </${r.SELECTPICKER}>
64
62
  </div>
@@ -66,42 +64,30 @@ class G extends m {
66
64
  `;
67
65
  }
68
66
  _onSelectChange(e) {
69
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new S(`Updated text to ${e}`));
67
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new m(`Updated text to ${e}`));
70
68
  }
71
69
  _listenToFormUpdates() {
72
- this.api.onValueChanged(E, (e) => this._onSelectChange(e));
70
+ this.api.onValueChanged(u, (e) => this._onSelectChange(e));
73
71
  }
74
72
  onTemplateNodeUpdated(e) {
75
73
  this.currentNode = e, this._setFormValues();
76
74
  }
77
75
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
78
76
  async onRender() {
79
- const e = await _(
77
+ const e = await C(
80
78
  "/unsubscribe-groups/unsubscribe-list"
81
- ), s = {
82
- name: this.api.translate("Pixel Tracking Opt-in"),
83
- sendGridId: C
84
- }, c = [T(), ...e.data], u = (o) => ({
85
- [t.SELECT_ITEM.text]: o.name,
86
- [t.SELECT_ITEM.value]: o.sendGridId
87
- }), l = (o) => ({
88
- [t.SELECT_ITEM.text]: o,
89
- [t.SELECT_ITEM.value]: `header:${o}`,
90
- [t.SELECT_ITEM.disabled]: !0
91
- }), d = [
92
- l(this.api.translate("OPT-IN SELECTION")),
93
- u(s),
94
- l(this.api.translate("UNSUBSCRIBE GROUPS")),
95
- ...c.map(u)
96
- ];
97
- this.unsubList = [s, ...c], this.api.setUIEAttribute(
98
- E,
79
+ ), s = [L(), ...e.data], c = s.map((a) => ({
80
+ [t.SELECT_ITEM.text]: a.name,
81
+ [t.SELECT_ITEM.value]: a.sendGridId
82
+ }));
83
+ this.unsubList = s, this.api.setUIEAttribute(
84
+ u,
99
85
  t.SELECTPICKER.items,
100
- d
86
+ c
101
87
  ), this._setFormValues(), this._listenToFormUpdates();
102
88
  }
103
89
  }
104
90
  export {
105
91
  b as CHECKBOX_CONTROL_BLOCK_ID,
106
- G as CheckboxControl
92
+ I as CheckboxControl
107
93
  };
@@ -53,7 +53,7 @@ class P extends E {
53
53
  if (!m)
54
54
  return;
55
55
  const g = m.getInnerHTML().trim() || "", C = m.getInnerText().trim() || "", _ = this._removeCurrencySymbol(C, o), S = this._buildPriceContent(_, n, l), b = g.replace(C, f(S));
56
- i.modifyHtml(m).setInnerHtml(b);
56
+ i.modifyHtml(m).setInnerHtml(b).setAttribute("data-currency_symbol", n);
57
57
  }), i.apply(new B(
58
58
  `Updated currency symbol to ${n || "removed"}`
59
59
  ));
@@ -1,7 +1,7 @@
1
- import { Block as t, BlockCompositionType as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { getDefaultTemplate as o } from "./template.js";
1
+ import { Block as t, BlockCompositionType as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { getDefaultTemplate as e } from "./template.js";
3
3
  const r = "radio-button-block";
4
- class i extends t {
4
+ class l extends t {
5
5
  constructor() {
6
6
  super();
7
7
  }
@@ -12,18 +12,16 @@ class i extends t {
12
12
  return "radio-button-icon";
13
13
  }
14
14
  getBlockCompositionType() {
15
- return e.CONTAINER;
15
+ return o.CONTAINER;
16
16
  }
17
17
  getName() {
18
18
  return this.api.translate("Radio Button Block");
19
19
  }
20
20
  getDescription() {
21
- return this.api.translate(
22
- "Radio button lets you select Unsubscribe and Preference Type for users to manage their opt-in or opt-out preferences."
23
- );
21
+ return this.api.translate("Radio Button Block Description");
24
22
  }
25
23
  getTemplate() {
26
- return o();
24
+ return e();
27
25
  }
28
26
  allowInnerBlocksDND() {
29
27
  return !1;
@@ -31,5 +29,5 @@ class i extends t {
31
29
  }
32
30
  export {
33
31
  r as BLOCK_ID,
34
- i as RadioButtonCustomBlock
32
+ l as RadioButtonCustomBlock
35
33
  };
@@ -1,107 +1,93 @@
1
- var p = Object.defineProperty;
2
- var L = (i, n, e) => n in i ? p(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
- var a = (i, n, e) => L(i, typeof n != "symbol" ? n + "" : n, e);
4
- import { useHttp as T } from "../../../composables/useHttp.js";
5
- import { getDefaultUnsubscribeGroup as h, PIXEL_TRACKING_SEND_GRID_ID as I, UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS as m } from "../../../enums/unsubscribe.js";
6
- import { Control as C, UIElementType as r, UEAttr as t, ModificationDescription as S } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const b = "ui-elements-radio-button", E = "select", { get: _ } = T();
8
- class G extends C {
1
+ var E = Object.defineProperty;
2
+ var d = (r, n, t) => n in r ? E(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
+ var o = (r, n, t) => d(r, typeof n != "symbol" ? n + "" : n, t);
4
+ import { useHttp as l } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as p } from "../../../enums/unsubscribe.js";
6
+ import { Control as h, UIElementType as i, UEAttr as e, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-radio-button", u = "select", { get: $ } = l();
8
+ class I extends h {
9
9
  constructor() {
10
10
  super(...arguments);
11
- a(this, "currentNode");
12
- a(this, "selectedUnsubGroup");
13
- a(this, "unsubList", []);
11
+ o(this, "currentNode");
12
+ o(this, "selectedUnsubGroup");
13
+ o(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
16
  return b;
17
17
  }
18
18
  _setFormValues() {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
- const e = this.currentNode.getAttribute("id");
21
- if (e) {
22
- const s = m.includes(e) ? e : Number(e);
20
+ const t = this.currentNode.getAttribute("id");
21
+ if (t) {
22
+ const s = t === p ? t : Number(t);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
26
26
  this.api.updateValues({
27
- [E]: this.selectedUnsubGroup
27
+ [u]: this.selectedUnsubGroup
28
28
  });
29
29
  }
30
- _getLabel(e, s = `${Math.random()}`) {
30
+ _getLabel(t, s = `${Math.random()}`) {
31
31
  return `
32
- <${r.LABEL}
33
- ${t.LABEL.text}="${e}"
34
- ${t.LABEL.name}="${s}">
35
- </${r.LABEL}>
32
+ <${i.LABEL}
33
+ ${e.LABEL.text}="${t}"
34
+ ${e.LABEL.name}="${s}">
35
+ </${i.LABEL}>
36
36
  `;
37
37
  }
38
- _getSelectItem(e, s) {
38
+ _getSelectItem(t, s) {
39
39
  return `
40
- <${r.SELECT_ITEM}
41
- ${t.SELECT_ITEM.text}="${e}"
42
- ${t.SELECT_ITEM.value}="${s}">
43
- </${r.SELECT_ITEM}>`;
40
+ <${i.SELECT_ITEM}
41
+ ${e.SELECT_ITEM.text}="${t}"
42
+ ${e.SELECT_ITEM.value}="${s}">
43
+ </${i.SELECT_ITEM}>`;
44
44
  }
45
45
  _getSelect() {
46
- return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
46
+ return this.unsubList.map((t) => this._getSelectItem(t.name, t.sendGridId)).join("");
47
47
  }
48
48
  getTemplate() {
49
- const e = this.api.translate("Unsubscribe & Preference Center Type"), s = this.api.translate("Select Unsubscribe and Preference Type");
50
49
  return `
51
50
  <div class="checkbox-controls-container">
52
51
  <div class="checkbox-select-container container two-columns stretch">
53
- <${r.LABEL}
54
- ${t.LABEL.text}="${e}"
55
- ${t.LABEL.name}="${Math.random()}">
56
- </${r.LABEL}>
52
+ <${i.LABEL}
53
+ ${e.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
54
+ ${e.LABEL.name}="${Math.random()}">
55
+ </${i.LABEL}>
57
56
 
58
- <${r.SELECTPICKER}
59
- ${t.SELECTPICKER.name}="${E}"
60
- ${t.SELECTPICKER.searchable}="true"
61
- ${t.SELECTPICKER.placeholder}="${s}">
57
+ <${i.SELECTPICKER}
58
+ ${e.SELECTPICKER.name}="${u}"
59
+ ${e.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
62
60
  ${this._getSelect()}
63
- </${r.SELECTPICKER}>
61
+ </${i.SELECTPICKER}>
64
62
  </div>
65
63
  </div>
66
64
  `;
67
65
  }
68
- _onSelectChange(e) {
69
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new S(`Updated text to ${e}`));
66
+ _onSelectChange(t) {
67
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new m(`Updated text to ${t}`));
70
68
  }
71
69
  _listenToFormUpdates() {
72
- this.api.onValueChanged(E, (e) => this._onSelectChange(e));
70
+ this.api.onValueChanged(u, (t) => this._onSelectChange(t));
73
71
  }
74
- onTemplateNodeUpdated(e) {
75
- this.currentNode = e, this._setFormValues();
72
+ onTemplateNodeUpdated(t) {
73
+ this.currentNode = t, this._setFormValues();
76
74
  }
77
75
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
78
76
  async onRender() {
79
- const e = await _(
77
+ const t = await $(
80
78
  "/unsubscribe-groups/unsubscribe-list"
81
- ), s = {
82
- name: this.api.translate("Pixel Tracking Opt-in"),
83
- sendGridId: I
84
- }, u = [h(), ...e.data], c = (o) => ({
85
- [t.SELECT_ITEM.text]: o.name,
86
- [t.SELECT_ITEM.value]: o.sendGridId
87
- }), d = (o) => ({
88
- [t.SELECT_ITEM.text]: o,
89
- [t.SELECT_ITEM.value]: `header:${o}`,
90
- [t.SELECT_ITEM.disabled]: !0
91
- }), l = [
92
- d(this.api.translate("OPT-IN SELECTION")),
93
- c(s),
94
- d(this.api.translate("UNSUBSCRIBE GROUPS")),
95
- ...u.map(c)
96
- ];
97
- this.unsubList = [s, ...u], this.api.setUIEAttribute(
98
- E,
99
- t.SELECTPICKER.items,
100
- l
79
+ ), s = [L(), ...t.data], c = s.map((a) => ({
80
+ [e.SELECT_ITEM.text]: a.name,
81
+ [e.SELECT_ITEM.value]: a.sendGridId
82
+ }));
83
+ this.unsubList = s, this.api.setUIEAttribute(
84
+ u,
85
+ e.SELECTPICKER.items,
86
+ c
101
87
  ), this._setFormValues(), this._listenToFormUpdates();
102
88
  }
103
89
  }
104
90
  export {
105
91
  b as CONTROL_BLOCK_ID,
106
- G as RadioButtonControl
92
+ I as RadioButtonControl
107
93
  };
@@ -1,4 +1,4 @@
1
- const u = [
1
+ const l = [
2
2
  {
3
3
  key: "locale",
4
4
  getValue: (e) => e.language,
@@ -7,27 +7,28 @@ const u = [
7
7
  {
8
8
  key: "currency",
9
9
  getValue: (e) => e.currencySettings.value,
10
- getAvailableOptions: (e) => e.currencyList.map((n) => n.text)
10
+ getAvailableOptions: (e) => e.currencyList.map((n) => n.text),
11
+ canBeEmpty: !0
11
12
  }
12
- ], s = "newsletter.recommendation-fill-required-fields";
13
- function l(e, n, o = u) {
14
- return o.filter((t) => {
15
- var a;
13
+ ], o = "newsletter.recommendation-fill-required-fields";
14
+ function c(e, n, i = l) {
15
+ return i.filter((t) => {
16
+ var u;
16
17
  if (t.condition && !t.condition(e))
17
18
  return !1;
18
- const i = t.getValue(e);
19
- if (!i)
20
- return !0;
21
- const r = (a = t.getAvailableOptions) == null ? void 0 : a.call(t, n);
22
- return r !== void 0 && !r.includes(i);
19
+ const r = (u = t.getAvailableOptions) == null ? void 0 : u.call(t, n);
20
+ if (t.canBeEmpty && (r == null ? void 0 : r.length) === 0)
21
+ return !1;
22
+ const a = t.getValue(e);
23
+ return a ? r !== void 0 && !r.includes(a) : !0;
23
24
  }).map((t) => t.key);
24
25
  }
25
- function c(e, n) {
26
- return l(e, n).length === 0;
26
+ function s(e, n) {
27
+ return c(e, n).length === 0;
27
28
  }
28
29
  export {
29
- u as REQUIRED_RECOMMENDATION_FIELDS,
30
- s as RecommendationRequiredFieldsKey,
31
- l as getInvalidFields,
32
- c as isConfigValid
30
+ l as REQUIRED_RECOMMENDATION_FIELDS,
31
+ o as RecommendationRequiredFieldsKey,
32
+ c as getInvalidFields,
33
+ s as isConfigValid
33
34
  };
@@ -19,8 +19,6 @@ export declare const PRODUCT_TYPE_URL_SEGMENTS: {
19
19
  };
20
20
  export declare const INSIDER_ID = "iid";
21
21
  export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
22
- export declare const PIXEL_TRACKING_SEND_GRID_ID = "P";
23
- export declare const UNSUBSCRIBE_SENTINEL_SEND_GRID_IDS: string[];
24
22
  /**
25
23
  * Get the default unsubscribe group lazily so the translated name resolves at access time.
26
24
  * Must be called within a Vue component context or after Pinia is initialized.
@@ -10,6 +10,7 @@ export interface ExtensionStoreSlice {
10
10
  }
11
11
  export interface RequiredField {
12
12
  key: string;
13
+ canBeEmpty?: boolean;
13
14
  getValue: (config: PerBlockConfigs) => string;
14
15
  getAvailableOptions?: (store: ExtensionStoreSlice) => string[];
15
16
  condition?: (config: PerBlockConfigs) => boolean;
@@ -39,18 +39,6 @@ ue-dropdown .service-element.padding-t-3 {
39
39
  color: var(--guido-color-primary-500);
40
40
  }
41
41
 
42
- /*
43
- * SD-145233: the pixel-tracking preference dropdown has no native option groups,
44
- * so its section titles are rendered as disabled items. Present them as
45
- * non-interactive group headers instead of options: no hover/cursor affordance
46
- * and a little extra vertical spacing.
47
- */
48
- .dropdown__menu .dropdown__item.disabled {
49
- padding-top: 14px;
50
- padding-bottom: 8px;
51
- pointer-events: none;
52
- }
53
-
54
42
  .menu {
55
43
  padding: 8px 0px;
56
44
  }
@@ -1,85 +1,84 @@
1
- import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- function q(w) {
3
- const y = w.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), T = new DOMParser().parseFromString(y, "text/html"), C = L.PAIRS_FOR_EXTENSION;
4
- Object.entries(C).forEach(([r, f]) => {
5
- T.querySelectorAll(".ins-product-td").forEach((o) => {
6
- const A = o.getAttribute("data-number") || "1", b = o.getAttribute("data-type") || "CART_ITEMS";
7
- o.querySelectorAll(`[product-attr="${r}"]`).forEach((e) => {
8
- var k, F, I;
9
- const $ = e.getAttribute("data-type") || b, d = e.getAttribute("data-number") || A, u = f[$];
10
- if (u)
1
+ import { productPairs as q } from "../extensions/Blocks/Items/enums/productEnums.js";
2
+ import { DefaultConfigValues as N } from "../extensions/Blocks/Items/enums/settingsEnums.js";
3
+ function W(M) {
4
+ const S = M.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), g = new DOMParser().parseFromString(S, "text/html"), m = q.PAIRS_FOR_EXTENSION;
5
+ Object.entries(m).forEach(([r, f]) => {
6
+ g.querySelectorAll(".ins-product-td").forEach((c) => {
7
+ const A = c.getAttribute("data-number") || "1", C = c.getAttribute("data-type") || "CART_ITEMS";
8
+ c.querySelectorAll(`[product-attr="${r}"]`).forEach((e) => {
9
+ var F, I, w;
10
+ const $ = e.getAttribute("data-type") || C, u = e.getAttribute("data-number") || A, d = f[$];
11
+ if (d)
11
12
  switch (r) {
12
13
  case "imageSrc": {
13
14
  let t = null, i = null;
14
15
  if (e.tagName === "IMG" ? (t = e, i = t.closest("a")) : (t = e.querySelector("img"), i = e.querySelector("a") || e.closest("a")), !t)
15
16
  break;
16
- const a = u.DEFAULT, s = u.ATTR;
17
+ const a = d.DEFAULT, s = d.ATTR;
17
18
  if (a && t.src) {
18
- const c = t.src;
19
+ const o = t.src;
19
20
  a.some((h) => {
20
- const l = h.split("/").pop() || "", g = c.split("/").pop() || "";
21
- return c.includes(h) || c.includes(l) || g === l;
22
- }) && (t.src = `{{${s}_${d}}}`);
21
+ const l = h.split("/").pop() || "", b = o.split("/").pop() || "";
22
+ return o.includes(h) || o.includes(l) || b === l;
23
+ }) && (t.src = `{{${s}_${u}}}`);
23
24
  }
24
- const n = (F = (k = C.name) == null ? void 0 : k[$]) == null ? void 0 : F.ATTR;
25
- if (n && t.setAttribute("alt", `{{${n}_${d}}}`), i) {
26
- const c = (I = C.itemLink) == null ? void 0 : I[$];
27
- if (c) {
28
- const E = c.HREF, h = c.DEFAULT_HREF || "#!", l = i.href;
29
- (l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${d}}}`);
25
+ const n = (I = (F = m.name) == null ? void 0 : F[$]) == null ? void 0 : I.ATTR;
26
+ if (n && t.setAttribute("alt", `{{${n}_${u}}}`), i) {
27
+ const o = (w = m.itemLink) == null ? void 0 : w[$];
28
+ if (o) {
29
+ const E = o.HREF, h = o.DEFAULT_HREF || "#!", l = i.href;
30
+ (l === "#" || l === "" || l.endsWith("#!") || l.endsWith(h) || l === `${window.location.href}${h}` || !l || l === window.location.href) && (i.href = `{{${E}_${u}}}`);
30
31
  }
31
32
  }
32
33
  break;
33
34
  }
34
35
  case "name": {
35
- const t = u, i = t.ATTR, a = t.DEFAULT_HREF || "#!", s = t.HREF;
36
- e.textContent && (e.textContent = `{{${i}_${d}}}`);
36
+ const t = d, i = t.ATTR, a = t.DEFAULT_HREF || "#!", s = t.HREF;
37
+ e.textContent && (e.textContent = `{{${i}_${u}}}`);
37
38
  const n = e.closest("a") || (e.tagName === "A" ? e : null);
38
39
  if (n && s) {
39
- const c = n.href, E = `${window.location.href}${a}`;
40
- (c === E || c.endsWith(a)) && (n.href = `{{${s}_${d}}}`);
40
+ const o = n.href, E = `${window.location.href}${a}`;
41
+ (o === E || o.endsWith(a)) && (n.href = `{{${s}_${u}}}`);
41
42
  }
42
43
  break;
43
44
  }
44
45
  case "price":
45
46
  case "originalPrice": {
46
- const t = u, i = e.getAttribute("data-formated"), a = e.getAttribute("data-single_price"), s = i === "true", n = a === "true", c = e.getAttribute("data-curency") || "before";
47
+ const t = d, i = e.getAttribute("data-formated"), a = e.getAttribute("data-single_price"), s = i === "true", n = a === "true", o = e.getAttribute("data-curency") || "before";
47
48
  let E;
48
49
  n ? E = s ? t.SINGLE_PRICE_FORMATTED : t.SINGLE_PRICE : E = s ? t.PRICE_FORMATTED : t.PRICE;
49
50
  const h = t.CURRENCY;
50
- let l = `{{${E}_${d}}}`;
51
- if (h) {
52
- const g = `{{${h}_${d}}}`;
53
- l = c === "after" ? `${l} ${g}` : `${g} ${l}`;
54
- }
55
- e.textContent = l;
51
+ let l = `{{${E}_${u}}}`;
52
+ const b = (e.getAttribute("data-currency_symbol") || "").trim(), x = b !== "" && b !== N.productPriceCurrencySymbolControlValue;
53
+ let T = "";
54
+ x ? T = b : h && (T = `{{${h}_${u}}}`), T && (l = o === "after" ? `${l} ${T}` : `${T} ${l}`), e.textContent = l;
56
55
  break;
57
56
  }
58
57
  case "quantity": {
59
- const t = u, i = t.ATTR, a = t.DEFAULT;
60
- e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${d}}}`);
58
+ const t = d, i = t.ATTR, a = t.DEFAULT;
59
+ e.textContent && e.textContent.trim() === a && (e.textContent = `{{${i}_${u}}}`);
61
60
  break;
62
61
  }
63
62
  case "button": {
64
- const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e.tagName === "A" ? e : e.querySelector("a");
63
+ const t = d, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e.tagName === "A" ? e : e.querySelector("a");
65
64
  if (s) {
66
- const n = s.href || "", c = `${window.location.href}${a}`;
67
- (n === "" || n === "#" || n === c || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${d}}}`);
65
+ const n = s.href || "", o = `${window.location.href}${a}`;
66
+ (n === "" || n === "#" || n === o || n.endsWith(a) || n.endsWith("#!") || n === window.location.href) && (s.href = `{{${i}_${u}}}`);
68
67
  }
69
68
  break;
70
69
  }
71
70
  case "itemLink": {
72
- const t = u, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e;
71
+ const t = d, i = t.HREF, a = t.DEFAULT_HREF || "#!", s = e;
73
72
  if (s.href) {
74
- const n = s.href, c = `${window.location.href}${a}`;
75
- (n === c || n.endsWith(a)) && (s.href = `{{${i}_${d}}}`);
73
+ const n = s.href, o = `${window.location.href}${a}`;
74
+ (n === o || n.endsWith(a)) && (s.href = `{{${i}_${u}}}`);
76
75
  }
77
76
  break;
78
77
  }
79
78
  default: {
80
- if ("ATTR" in u) {
81
- const t = u.ATTR;
82
- e.textContent && (e.textContent = `{{${t}_${d}}}`);
79
+ if ("ATTR" in d) {
80
+ const t = d.ATTR;
81
+ e.textContent && (e.textContent = `{{${t}_${u}}}`);
83
82
  }
84
83
  break;
85
84
  }
@@ -87,48 +86,48 @@ function q(w) {
87
86
  });
88
87
  });
89
88
  });
90
- const S = y.match(/<!DOCTYPE[^>]*>/i), M = S ? `${S[0]}
91
- ` : "", P = T.querySelectorAll(".ins-product-td"), H = [];
92
- P.forEach((r) => {
93
- const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", o = r.getAttribute("data-nodup"), A = r.outerHTML;
94
- H.push({
89
+ const H = S.match(/<!DOCTYPE[^>]*>/i), P = H ? `${H[0]}
90
+ ` : "", D = g.querySelectorAll(".ins-product-td"), k = [];
91
+ D.forEach((r) => {
92
+ const f = r.getAttribute("data-type") || "CART_ITEMS", p = r.getAttribute("data-number") || "1", c = r.getAttribute("data-nodup"), A = r.outerHTML;
93
+ k.push({
95
94
  element: r,
96
95
  outerHtml: A,
97
96
  type: f,
98
97
  number: p,
99
- nodup: o || void 0
98
+ nodup: c || void 0
100
99
  });
101
100
  });
102
- let _ = M + T.documentElement.outerHTML;
103
- H.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
104
- let o = "";
101
+ let _ = P + g.documentElement.outerHTML;
102
+ k.reverse().forEach(({ outerHtml: r, type: f, number: p }) => {
103
+ let c = "";
105
104
  switch (f) {
106
105
  case "CART_ITEMS":
107
- o = "ins_apr_total_product_kind";
106
+ c = "ins_apr_total_product_kind";
108
107
  break;
109
108
  case "BROWSED_ITEMS":
110
- o = "browsed_item_total_product_kind";
109
+ c = "browsed_item_total_product_kind";
111
110
  break;
112
111
  case "PURCHASED_ITEMS":
113
- o = "purchased_item_total_product_kind";
112
+ c = "purchased_item_total_product_kind";
114
113
  break;
115
114
  }
116
- if (o) {
117
- const b = parseInt(p) - 1, $ = `${`{% if ${o} > ${b} %}`}${r}{% endif %}`;
115
+ if (c) {
116
+ const C = parseInt(p) - 1, $ = `${`{% if ${c} > ${C} %}`}${r}{% endif %}`;
118
117
  _ = _.replace(r, $);
119
118
  }
120
119
  });
121
- const D = T.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), R = [];
122
- return D.forEach((r) => {
120
+ const L = g.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), y = [];
121
+ return L.forEach((r) => {
123
122
  const f = r.getAttribute("data-number"), p = r.getAttribute("data-type");
124
123
  if (!f || p !== "CART_ITEMS")
125
124
  return;
126
- const o = r.closest(".product-original-price-class");
127
- if (o) {
128
- const A = o.outerHTML;
129
- R.some((m) => m.tdOuterHtml === A) || R.push({ tdOuterHtml: A, number: f });
125
+ const c = r.closest(".product-original-price-class");
126
+ if (c) {
127
+ const A = c.outerHTML;
128
+ y.some((R) => R.tdOuterHtml === A) || y.push({ tdOuterHtml: A, number: f });
130
129
  }
131
- }), R.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
130
+ }), y.reverse().forEach(({ tdOuterHtml: r, number: f }) => {
132
131
  const p = `{% if ins_apr_price_${f} != ins_apr_originalprice_${f} %}`;
133
132
  if (!_.includes(p) && !r.includes("{% if")) {
134
133
  const A = `${p}${r}{% endif %}`;
@@ -137,5 +136,5 @@ function q(w) {
137
136
  }), _.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
138
137
  }
139
138
  export {
140
- q as pairProductVariables
139
+ W as pairProductVariables
141
140
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.9.1-beta.bde1a34",
3
+ "version": "3.9.1-beta.c521c3a",
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",