@useinsider/guido 3.1.1-beta.86350e0 → 3.1.1-beta.8c78cda

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/dist/composables/useFullStoryBridge.js +17 -0
  2. package/dist/composables/useStripo.js +33 -32
  3. package/dist/extensions/Blocks/Recommendation/block.js +1 -1
  4. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  5. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  6. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
  7. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
  8. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
  9. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  10. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  11. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
  12. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
  13. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  14. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  15. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
  16. package/dist/src/@types/generic.d.ts +1 -0
  17. package/dist/src/composables/useFullStoryBridge.d.ts +10 -0
  18. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  19. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  20. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  21. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  22. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  23. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  24. package/dist/utils/tooltipUtils.js +5 -4
  25. package/package.json +2 -2
@@ -0,0 +1,17 @@
1
+ const o = (s, t) => {
2
+ const n = window[s];
3
+ return typeof n == "string" ? n : t;
4
+ }, f = () => ({ injectFullStory: () => {
5
+ var i;
6
+ const t = o("_fs_org", "");
7
+ if (!t)
8
+ return;
9
+ const e = document.querySelector("ui-editor"), n = (i = e == null ? void 0 : e.shadowRoot) == null ? void 0 : i.querySelector("iframe");
10
+ if (!(n != null && n.contentDocument))
11
+ return;
12
+ const r = o("_fs_host", "fullstory.com"), g = o("_fs_script", "edge.fullstory.com/s/fs.js"), u = o("_fs_namespace", "FS"), c = n.contentDocument.createElement("script");
13
+ c.textContent = `window['_fs_run_in_iframe']=true;window['_fs_host']='${r}';window['_fs_script']='${g}';window['_fs_org']='${t}';window['_fs_namespace']='${u}';(function(m,n,e,t,l,o,g,y){if(e in m){if(m.console&&m.console.log){m.console.log('FullStory namespace conflict.');}return;}g=m[e]=function(a,b,s){g.q?g.q.push([a,b,s]):g._api(a,b,s);};g.q=[];o=n.createElement(t);o.async=1;o.crossOrigin='anonymous';o.src='https://'+_fs_script;y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);g.identify=function(i,v,s){g(l,{uid:i},s);if(v)g(l,v,s)};g.setUserVars=function(v,s){g(l,v,s)};g.event=function(i,v,s){g('event',{n:i,p:v},s)};g.anonymize=function(){g.identify(!!0)};g.shutdown=function(){g("rec",!1)};g.restart=function(){g("rec",!0)};g.log=function(a,b){g("log",[a,b])};g.consent=function(a){g("consent",!arguments.length||a)};g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};g.clearUserCookie=function(){};g.setVars=function(n,p){g('setVars',[n,p])};g._w={};y='XMLHttpRequest';g._w[y]=m[y];y='fetch';g._w[y]=m[y];if(m[y])m[y]=function(){return g._api(y,arguments)};g._v="1.3.0";})(window,document,window['_fs_namespace'],'script','user');`, n.contentDocument.head.appendChild(c);
14
+ } });
15
+ export {
16
+ f as useFullStoryBridge
17
+ };
@@ -1,20 +1,21 @@
1
1
  import { useActionsApi as A } from "./useActionsApi.js";
2
- import { useBlocksConfig as F } from "./useBlocksConfig.js";
3
- import { useConfig as D } from "./useConfig.js";
4
- import { useCustomInterfaceAppearance as I } from "./useCustomInterfaceAppearance.js";
5
- import { useStripoEventHandler as P } from "./useStripoEventHandler.js";
6
- import { useToaster as U } from "./useToaster.js";
7
- import { localePatch as R } from "../config/i18n/index.js";
8
- import { displayConditions as H } from "../enums/displayConditions.js";
9
- import { useStripoApi as O } from "../services/stripoApi.js";
10
- import q from "../static/styles/customEditorStyle.css.js";
2
+ import { useBlocksConfig as D } from "./useBlocksConfig.js";
3
+ import { useConfig as I } from "./useConfig.js";
4
+ import { useCustomInterfaceAppearance as P } from "./useCustomInterfaceAppearance.js";
5
+ import { useFullStoryBridge as U } from "./useFullStoryBridge.js";
6
+ import { useStripoEventHandler as R } from "./useStripoEventHandler.js";
7
+ import { useToaster as H } from "./useToaster.js";
8
+ import { localePatch as O } from "../config/i18n/index.js";
9
+ import { displayConditions as j } from "../enums/displayConditions.js";
10
+ import { useStripoApi as q } from "../services/stripoApi.js";
11
+ import x from "../static/styles/customEditorStyle.css.js";
11
12
  import { useEditorStore as S } from "../stores/editor.js";
12
- import { dynamicContentToMergeTags as x } from "../utils/genericUtil.js";
13
- import L from "../package.json.js";
14
- const oe = (C, c) => {
15
- const { features: l, template: E } = D(), { handleError: u } = U(), { getToken: h, getCustomFonts: w, getSyncModulesStatus: b } = O(), { handleEvent: k } = P(), { getStripoBlocksConfig: T } = F(), V = async (i, n = [], r = !1) => {
13
+ import { dynamicContentToMergeTags as L } from "../utils/genericUtil.js";
14
+ import $ from "../package.json.js";
15
+ const ne = (C, c) => {
16
+ const { features: l, template: E } = I(), { handleError: u } = H(), { getToken: h, getCustomFonts: w, getSyncModulesStatus: b } = q(), { handleEvent: k } = R(), { getStripoBlocksConfig: B } = D(), T = async (i, r = [], n = !1) => {
16
17
  var f, g, y;
17
- const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await T(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, B = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, v = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
+ const e = S(), { html: m, css: a } = i, { baseBlocks: o, extensions: d } = await B(), p = ((f = l.value) == null ? void 0 : f.displayConditions) ?? !0, _ = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, v = ((y = E.value) == null ? void 0 : y.forceRecreate) ?? !1;
18
19
  window.UIEditor.initEditor(
19
20
  document.querySelector("#guido-editor"),
20
21
  {
@@ -31,13 +32,13 @@ const oe = (C, c) => {
31
32
  customAppearanceMergetags: !0,
32
33
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
34
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: q,
35
+ customViewStyles: x,
35
36
  conditionsEnabled: p,
36
37
  customConditionsEnabled: p,
37
- conditionCategories: H,
38
+ conditionCategories: j,
38
39
  enableXSSSecurity: !0,
39
- modulesDisabled: B,
40
- syncModulesEnabled: r,
40
+ modulesDisabled: _,
41
+ syncModulesEnabled: n,
41
42
  messageSettingsEnabled: !0,
42
43
  displayGmailAnnotations: !0,
43
44
  displayHiddenPreheader: !1,
@@ -48,11 +49,11 @@ const oe = (C, c) => {
48
49
  editorFonts: {
49
50
  showDefaultStandardFonts: !0,
50
51
  showDefaultNotStandardFonts: !0,
51
- customFonts: n
52
+ customFonts: r
52
53
  },
53
54
  mergeTags: [
54
55
  {
55
- entries: x(c.preselectedDynamicContentList)
56
+ entries: L(c.preselectedDynamicContentList)
56
57
  }
57
58
  ],
58
59
  async onTokenRefreshRequest(t) {
@@ -65,8 +66,8 @@ const oe = (C, c) => {
65
66
  },
66
67
  onTemplateLoaded() {
67
68
  try {
68
- const { importCss: t } = I(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: M } = A();
69
- t(), s(), M(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
69
+ const { importCss: t } = P(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: F } = A(), { injectFullStory: M } = U();
70
+ t(), s(), M(), F(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
70
71
  e.hasChanges = !1;
71
72
  }, 1e3);
72
73
  } catch (t) {
@@ -92,32 +93,32 @@ const oe = (C, c) => {
92
93
  ".in-drawer__container"
93
94
  ],
94
95
  extensions: d,
95
- localePatch: R
96
+ localePatch: O
96
97
  }
97
98
  );
98
- }, _ = (i) => new Promise((n, r) => {
99
+ }, V = (i) => new Promise((r, n) => {
99
100
  var d;
100
101
  if (document.getElementById("UiEditorScript")) {
101
- i(), n();
102
+ i(), r();
102
103
  return;
103
104
  }
104
- const e = L.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
105
+ const e = $.guido, a = `https://email-static.useinsider.com/guido/${(d = e == null ? void 0 : e.stripo) == null ? void 0 : d.version}/UIEditor.js`, o = document.createElement("script");
105
106
  o.id = "UiEditorScript", o.type = "module", o.src = a, o.onload = () => {
106
- i(), n();
107
+ i(), r();
107
108
  }, o.onerror = () => {
108
- r(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
109
+ n(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
109
110
  }, document.body.appendChild(o);
110
111
  });
111
112
  return { initPlugin: async (i) => {
112
- await _(async () => {
113
- const n = S(), [r, e] = await Promise.all([
113
+ await V(async () => {
114
+ const r = S(), [n, e] = await Promise.all([
114
115
  w(),
115
116
  b()
116
117
  ]);
117
- n.syncModulesEnabled = e, await V(i, r, e);
118
+ r.syncModulesEnabled = e, await T(i, n, e);
118
119
  });
119
120
  } };
120
121
  };
121
122
  export {
122
- oe as useStripo
123
+ ne as useStripo
123
124
  };
@@ -169,7 +169,7 @@ class q extends b {
169
169
  if (e && e.includes(a))
170
170
  return t;
171
171
  }
172
- return "querySelector" in t ? t.querySelector(`.${a}`) : null;
172
+ return "querySelector" in t ? t.querySelector(`.${a}`) ?? null : null;
173
173
  }
174
174
  /**
175
175
  * Migrate configuration from legacy format
@@ -1,26 +1,42 @@
1
- const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", t = ".ins-recommendation-mobile-container", n = ".ins-recommendation-mobile-row", R = {
1
+ const T = ".recommendation-block-v2", c = ".ins-recommendation-product-container", o = ".ins-recommendation-desktop-container", n = ".ins-recommendation-mobile-container", t = ".ins-recommendation-mobile-row", r = {
2
2
  CURRENCY: "currency",
3
3
  SYMBOL: "currency-symbol",
4
4
  ALIGNMENT: "currency-alignment",
5
5
  THOUSAND_SEPARATOR: "currency-thousand-separator",
6
6
  DECIMAL_SEPARATOR: "currency-decimal-separator",
7
7
  DECIMAL_COUNT: "currency-decimal-count"
8
- }, r = "productImage", O = "productName", _ = "productPrice", e = "productOldPrice", s = "productOmnibusPrice", C = "productOmnibusDiscount", E = "productButton", A = "customAttr:", i = "data-custom-attributes", u = "product-attr";
8
+ }, R = "productImage", _ = "productName", e = "productPrice", O = "productOldPrice", s = "productOmnibusPrice", i = "productOmnibusDiscount", E = "productButton", A = "customAttr:", C = "data-custom-attributes", u = "product-attr", m = /* @__PURE__ */ new Set([
9
+ "name",
10
+ // productName
11
+ "price",
12
+ // productPrice
13
+ "original_price",
14
+ // productOldPrice
15
+ "image_url",
16
+ // productImage
17
+ "url",
18
+ // productButton
19
+ "omnibus_price",
20
+ // productOmnibusPrice
21
+ "omnibus_discount"
22
+ // productOmnibusDiscount
23
+ ]);
9
24
  export {
10
25
  A as ATTR_CUSTOM_PREFIX,
11
- i as ATTR_DATA_CUSTOM_ATTRIBUTES,
26
+ C as ATTR_DATA_CUSTOM_ATTRIBUTES,
12
27
  u as ATTR_PRODUCT_ATTR,
13
28
  E as ATTR_PRODUCT_BUTTON,
14
- r as ATTR_PRODUCT_IMAGE,
15
- O as ATTR_PRODUCT_NAME,
16
- e as ATTR_PRODUCT_OLD_PRICE,
17
- C as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
29
+ R as ATTR_PRODUCT_IMAGE,
30
+ _ as ATTR_PRODUCT_NAME,
31
+ O as ATTR_PRODUCT_OLD_PRICE,
32
+ i as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
18
33
  s as ATTR_PRODUCT_OMNIBUS_PRICE,
19
- _ as ATTR_PRODUCT_PRICE,
34
+ e as ATTR_PRODUCT_PRICE,
20
35
  T as BLOCK_ROOT_SELECTOR,
36
+ m as BUILT_IN_DEFAULT_ATTRIBUTES,
21
37
  c as CONTAINER_SELECTOR,
22
- R as CURRENCY_ATTR,
38
+ r as CURRENCY_ATTR,
23
39
  o as DESKTOP_CONTAINER_SELECTOR,
24
- t as MOBILE_CONTAINER_SELECTOR,
25
- n as MOBILE_ROW_SELECTOR
40
+ n as MOBILE_CONTAINER_SELECTOR,
41
+ t as MOBILE_ROW_SELECTOR
26
42
  };