@useinsider/guido 1.0.3-beta.cdff8ce → 1.0.3-beta.ce3ed00

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 (177) hide show
  1. package/README.md +32 -6
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +73 -79
  4. package/dist/components/organisms/LoadingWrapper.vue.js +1 -1
  5. package/dist/components/organisms/header/RightSlot.vue.js +1 -1
  6. package/dist/components/organisms/header/RightSlot.vue2.js +20 -21
  7. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
  8. package/dist/composables/useActionsApi.js +1 -1
  9. package/dist/composables/useGuidoActions.js +9 -19
  10. package/dist/composables/useHtmlCompiler.js +13 -15
  11. package/dist/composables/useHtmlValidator.js +35 -36
  12. package/dist/composables/useStripo.js +41 -47
  13. package/dist/config/compiler/unsubscribeCompilerRules.js +28 -33
  14. package/dist/enums/defaults.js +1 -2
  15. package/dist/enums/onboarding.js +3 -7
  16. package/dist/enums/unsubscribe.js +25 -27
  17. package/dist/extensions/Blocks/Checkbox/control.js +14 -15
  18. package/dist/extensions/Blocks/Checkbox/template.js +9 -14
  19. package/dist/extensions/Blocks/Items/block.js +43 -40
  20. package/dist/extensions/Blocks/Items/controls/button/link.js +17 -25
  21. package/dist/extensions/Blocks/Items/controls/cardComposition.js +57 -151
  22. package/dist/extensions/Blocks/Items/controls/image/link.js +20 -28
  23. package/dist/extensions/Blocks/Items/controls/name/trimming.js +22 -29
  24. package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +18 -25
  25. package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +8 -18
  26. package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +30 -37
  27. package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +14 -37
  28. package/dist/extensions/Blocks/Items/controls/settingsControl.js +130 -167
  29. package/dist/extensions/Blocks/Items/enums/controlEnums.js +2 -2
  30. package/dist/extensions/Blocks/Items/enums/productEnums.js +5 -98
  31. package/dist/extensions/Blocks/Items/enums/settingsEnums.js +7 -21
  32. package/dist/extensions/Blocks/Items/extension.js +8 -9
  33. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +59 -57
  34. package/dist/extensions/Blocks/Items/layouts/vertical.html.js +61 -67
  35. package/dist/extensions/Blocks/Items/settingsPanel.js +43 -69
  36. package/dist/extensions/Blocks/Items/store/items-block.js +4 -12
  37. package/dist/extensions/Blocks/Items/template.js +63 -150
  38. package/dist/extensions/Blocks/RadioButton/control.js +17 -18
  39. package/dist/extensions/Blocks/RadioButton/template.js +9 -18
  40. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -1
  41. package/dist/extensions/Blocks/Unsubscribe/block.js +41 -45
  42. package/dist/extensions/Blocks/common-control.js +125 -164
  43. package/dist/extensions/DynamicContent/dynamic-content-modal.js +19 -25
  44. package/dist/extensions/DynamicContent/dynamic-content.js +33 -128
  45. package/dist/guido.css +1 -1
  46. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +2 -12
  47. package/dist/node_modules/lodash-es/_arrayLikeKeys.js +12 -13
  48. package/dist/node_modules/lodash-es/keysIn.js +3 -3
  49. package/dist/package.json.js +1 -1
  50. package/dist/src/@types/generic.d.ts +6 -27
  51. package/dist/src/components/Guido.vue.d.ts +2 -3
  52. package/dist/src/composables/useGuidoActions.d.ts +0 -9
  53. package/dist/src/enums/onboarding.d.ts +0 -4
  54. package/dist/src/extensions/Blocks/Checkbox/template.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -15
  56. package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +7 -20
  57. package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
  58. package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +1 -5
  59. package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +2 -8
  60. package/dist/src/extensions/Blocks/Items/enums/controlEnums.d.ts +0 -1
  61. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +0 -20
  62. package/dist/src/extensions/Blocks/Items/enums/settingsEnums.d.ts +0 -15
  63. package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +1 -5
  64. package/dist/src/extensions/Blocks/Items/template.d.ts +1 -9
  65. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  66. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -1
  67. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +4 -3
  68. package/dist/src/extensions/Blocks/common-control.d.ts +2 -25
  69. package/dist/src/extensions/DynamicContent/dynamic-content-modal.d.ts +2 -9
  70. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +2 -52
  71. package/dist/src/stores/config.d.ts +2 -3
  72. package/dist/src/stores/dynamic-content.d.ts +3 -3
  73. package/dist/src/stores/editor.d.ts +1 -1
  74. package/dist/src/stores/onboarding.d.ts +1 -335
  75. package/dist/src/stores/preview.d.ts +1 -1
  76. package/dist/src/stores/recommendation.d.ts +1 -1
  77. package/dist/src/stores/save-as-template.d.ts +1 -1
  78. package/dist/src/stores/toaster.d.ts +1 -1
  79. package/dist/src/stores/unsubscribe.d.ts +1 -1
  80. package/dist/src/stores/version-history.d.ts +1 -1
  81. package/dist/src/utils/genericUtil.d.ts +0 -1
  82. package/dist/stores/config.js +5 -5
  83. package/dist/stores/dynamic-content.js +2 -2
  84. package/dist/stores/editor.js +1 -1
  85. package/dist/stores/onboarding.js +36 -44
  86. package/dist/stores/preview.js +1 -1
  87. package/dist/stores/recommendation.js +3 -3
  88. package/dist/stores/save-as-template.js +2 -2
  89. package/dist/stores/toaster.js +1 -1
  90. package/dist/stores/unsubscribe.js +1 -1
  91. package/dist/stores/version-history.js +4 -4
  92. package/dist/utils/genericUtil.js +6 -17
  93. package/package.json +12 -7
  94. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +0 -21
  95. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +0 -99
  96. package/dist/config/compiler/itemsCompilerRules.js +0 -14
  97. package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +0 -92
  98. package/dist/extensions/Blocks/Items/utils/configBlockUtils.js +0 -17
  99. package/dist/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.js +0 -28
  100. package/dist/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.js +0 -76
  101. package/dist/extensions/Blocks/Items/utils/updateAttributes.js +0 -46
  102. package/dist/node_modules/lodash-es/_DataView.js +0 -6
  103. package/dist/node_modules/lodash-es/_Promise.js +0 -6
  104. package/dist/node_modules/lodash-es/_Set.js +0 -6
  105. package/dist/node_modules/lodash-es/_SetCache.js +0 -13
  106. package/dist/node_modules/lodash-es/_WeakMap.js +0 -6
  107. package/dist/node_modules/lodash-es/_arrayFilter.js +0 -10
  108. package/dist/node_modules/lodash-es/_arrayMap.js +0 -8
  109. package/dist/node_modules/lodash-es/_arrayPush.js +0 -8
  110. package/dist/node_modules/lodash-es/_arraySome.js +0 -9
  111. package/dist/node_modules/lodash-es/_baseEach.js +0 -6
  112. package/dist/node_modules/lodash-es/_baseFlatten.js +0 -13
  113. package/dist/node_modules/lodash-es/_baseForOwn.js +0 -8
  114. package/dist/node_modules/lodash-es/_baseGet.js +0 -11
  115. package/dist/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  116. package/dist/node_modules/lodash-es/_baseHasIn.js +0 -6
  117. package/dist/node_modules/lodash-es/_baseIsEqual.js +0 -8
  118. package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +0 -32
  119. package/dist/node_modules/lodash-es/_baseIsMatch.js +0 -29
  120. package/dist/node_modules/lodash-es/_baseIteratee.js +0 -11
  121. package/dist/node_modules/lodash-es/_baseKeys.js +0 -14
  122. package/dist/node_modules/lodash-es/_baseMap.js +0 -11
  123. package/dist/node_modules/lodash-es/_baseMatches.js +0 -12
  124. package/dist/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  125. package/dist/node_modules/lodash-es/_baseProperty.js +0 -8
  126. package/dist/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  127. package/dist/node_modules/lodash-es/_baseRange.js +0 -9
  128. package/dist/node_modules/lodash-es/_baseToString.js +0 -18
  129. package/dist/node_modules/lodash-es/_baseTrim.js +0 -8
  130. package/dist/node_modules/lodash-es/_cacheHas.js +0 -6
  131. package/dist/node_modules/lodash-es/_castPath.js +0 -10
  132. package/dist/node_modules/lodash-es/_createBaseEach.js +0 -15
  133. package/dist/node_modules/lodash-es/_createRange.js +0 -11
  134. package/dist/node_modules/lodash-es/_equalArrays.js +0 -40
  135. package/dist/node_modules/lodash-es/_equalByTag.js +0 -45
  136. package/dist/node_modules/lodash-es/_equalObjects.js +0 -36
  137. package/dist/node_modules/lodash-es/_getAllKeys.js +0 -9
  138. package/dist/node_modules/lodash-es/_getMatchData.js +0 -12
  139. package/dist/node_modules/lodash-es/_getSymbols.js +0 -10
  140. package/dist/node_modules/lodash-es/_getTag.js +0 -28
  141. package/dist/node_modules/lodash-es/_hasPath.js +0 -19
  142. package/dist/node_modules/lodash-es/_isFlattenable.js +0 -10
  143. package/dist/node_modules/lodash-es/_isKey.js +0 -12
  144. package/dist/node_modules/lodash-es/_isStrictComparable.js +0 -7
  145. package/dist/node_modules/lodash-es/_mapToArray.js +0 -9
  146. package/dist/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  147. package/dist/node_modules/lodash-es/_memoizeCapped.js +0 -11
  148. package/dist/node_modules/lodash-es/_nativeKeys.js +0 -5
  149. package/dist/node_modules/lodash-es/_setCacheAdd.js +0 -7
  150. package/dist/node_modules/lodash-es/_setCacheHas.js +0 -6
  151. package/dist/node_modules/lodash-es/_setToArray.js +0 -9
  152. package/dist/node_modules/lodash-es/_stringToPath.js +0 -10
  153. package/dist/node_modules/lodash-es/_toKey.js +0 -10
  154. package/dist/node_modules/lodash-es/_trimmedEndIndex.js +0 -9
  155. package/dist/node_modules/lodash-es/flatMap.js +0 -8
  156. package/dist/node_modules/lodash-es/get.js +0 -8
  157. package/dist/node_modules/lodash-es/hasIn.js +0 -8
  158. package/dist/node_modules/lodash-es/isSymbol.js +0 -9
  159. package/dist/node_modules/lodash-es/keys.js +0 -9
  160. package/dist/node_modules/lodash-es/map.js +0 -11
  161. package/dist/node_modules/lodash-es/property.js +0 -10
  162. package/dist/node_modules/lodash-es/range.js +0 -5
  163. package/dist/node_modules/lodash-es/stubArray.js +0 -6
  164. package/dist/node_modules/lodash-es/toFinite.js +0 -14
  165. package/dist/node_modules/lodash-es/toNumber.js +0 -22
  166. package/dist/node_modules/lodash-es/toString.js +0 -7
  167. package/dist/src/components/organisms/onboarding/ItemsOnboarding.vue.d.ts +0 -2
  168. package/dist/src/config/compiler/itemsCompilerRules.d.ts +0 -2
  169. package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -15
  170. package/dist/src/extensions/Blocks/Items/utils/configBlockUtils.d.ts +0 -23
  171. package/dist/src/extensions/Blocks/Items/utils/syncAttributeFromConfigBlock.d.ts +0 -32
  172. package/dist/src/extensions/Blocks/Items/utils/syncAttributesFromConfigBlock.d.ts +0 -50
  173. package/dist/src/extensions/Blocks/Items/utils/updateAttributes.d.ts +0 -8
  174. package/dist/src/utils/environmentUtil.d.ts +0 -5
  175. package/dist/src/utils/pairProductVariables.d.ts +0 -7
  176. package/dist/utils/environmentUtil.js +0 -4
  177. package/dist/utils/pairProductVariables.js +0 -136
@@ -1,10 +0,0 @@
1
- import o from "./_Symbol.js";
2
- import e from "./isArguments.js";
3
- import i from "./isArray.js";
4
- var t = o ? o.isConcatSpreadable : void 0;
5
- function s(r) {
6
- return i(r) || e(r) || !!(t && r && r[t]);
7
- }
8
- export {
9
- s as default
10
- };
@@ -1,12 +0,0 @@
1
- import o from "./isArray.js";
2
- import n from "./isSymbol.js";
3
- var i = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, s = /^\w*$/;
4
- function m(r, e) {
5
- if (o(r))
6
- return !1;
7
- var t = typeof r;
8
- return t == "number" || t == "symbol" || t == "boolean" || r == null || n(r) ? !0 : s.test(r) || !i.test(r) || e != null && r in Object(e);
9
- }
10
- export {
11
- m as default
12
- };
@@ -1,7 +0,0 @@
1
- import r from "./isObject.js";
2
- function o(t) {
3
- return t === t && !r(t);
4
- }
5
- export {
6
- o as default
7
- };
@@ -1,9 +0,0 @@
1
- function o(r) {
2
- var e = -1, a = Array(r.size);
3
- return r.forEach(function(n, t) {
4
- a[++e] = [t, n];
5
- }), a;
6
- }
7
- export {
8
- o as default
9
- };
@@ -1,8 +0,0 @@
1
- function e(t, r) {
2
- return function(n) {
3
- return n == null ? !1 : n[t] === r && (r !== void 0 || t in Object(n));
4
- };
5
- }
6
- export {
7
- e as default
8
- };
@@ -1,11 +0,0 @@
1
- import c from "./memoize.js";
2
- var i = 500;
3
- function m(a) {
4
- var e = c(a, function(t) {
5
- return r.size === i && r.clear(), t;
6
- }), r = e.cache;
7
- return e;
8
- }
9
- export {
10
- m as default
11
- };
@@ -1,5 +0,0 @@
1
- import e from "./_overArg.js";
2
- var t = e(Object.keys, Object);
3
- export {
4
- t as default
5
- };
@@ -1,7 +0,0 @@
1
- var t = "__lodash_hash_undefined__";
2
- function a(_) {
3
- return this.__data__.set(_, t), this;
4
- }
5
- export {
6
- a as default
7
- };
@@ -1,6 +0,0 @@
1
- function t(a) {
2
- return this.__data__.has(a);
3
- }
4
- export {
5
- t as default
6
- };
@@ -1,9 +0,0 @@
1
- function t(r) {
2
- var e = -1, a = Array(r.size);
3
- return r.forEach(function(n) {
4
- a[++e] = n;
5
- }), a;
6
- }
7
- export {
8
- t as default
9
- };
@@ -1,10 +0,0 @@
1
- import u from "./_memoizeCapped.js";
2
- var c = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, d = /\\(\\)?/g, h = u(function(e) {
3
- var r = [];
4
- return e.charCodeAt(0) === 46 && r.push(""), e.replace(c, function(a, p, o, t) {
5
- r.push(o ? t.replace(d, "$1") : p || a);
6
- }), r;
7
- });
8
- export {
9
- h as default
10
- };
@@ -1,10 +0,0 @@
1
- import i from "./isSymbol.js";
2
- function o(t) {
3
- if (typeof t == "string" || i(t))
4
- return t;
5
- var r = t + "";
6
- return r == "0" && 1 / t == -1 / 0 ? "-0" : r;
7
- }
8
- export {
9
- o as default
10
- };
@@ -1,9 +0,0 @@
1
- var r = /\s/;
2
- function a(t) {
3
- for (var e = t.length; e-- && r.test(t.charAt(e)); )
4
- ;
5
- return e;
6
- }
7
- export {
8
- a as default
9
- };
@@ -1,8 +0,0 @@
1
- import r from "./_baseFlatten.js";
2
- import o from "./map.js";
3
- function m(t, a) {
4
- return r(o(t, a));
5
- }
6
- export {
7
- m as default
8
- };
@@ -1,8 +0,0 @@
1
- import u from "./_baseGet.js";
2
- function f(e, r, t) {
3
- var n = e == null ? void 0 : u(e, r);
4
- return n === void 0 ? t : n;
5
- }
6
- export {
7
- f as default
8
- };
@@ -1,8 +0,0 @@
1
- import n from "./_baseHasIn.js";
2
- import t from "./_hasPath.js";
3
- function f(a, r) {
4
- return a != null && t(a, r, n);
5
- }
6
- export {
7
- f as default
8
- };
@@ -1,9 +0,0 @@
1
- import t from "./_baseGetTag.js";
2
- import m from "./isObjectLike.js";
3
- var r = "[object Symbol]";
4
- function i(o) {
5
- return typeof o == "symbol" || m(o) && t(o) == r;
6
- }
7
- export {
8
- i as default
9
- };
@@ -1,9 +0,0 @@
1
- import e from "./_arrayLikeKeys.js";
2
- import i from "./_baseKeys.js";
3
- import a from "./isArrayLike.js";
4
- function f(r) {
5
- return a(r) ? e(r) : i(r);
6
- }
7
- export {
8
- f as default
9
- };
@@ -1,11 +0,0 @@
1
- import t from "./_arrayMap.js";
2
- import o from "./_baseIteratee.js";
3
- import p from "./_baseMap.js";
4
- import e from "./isArray.js";
5
- function n(r, a) {
6
- var m = e(r) ? t : p;
7
- return m(r, o(a));
8
- }
9
- export {
10
- n as default
11
- };
@@ -1,10 +0,0 @@
1
- import o from "./_baseProperty.js";
2
- import e from "./_basePropertyDeep.js";
3
- import t from "./_isKey.js";
4
- import m from "./_toKey.js";
5
- function s(r) {
6
- return t(r) ? o(m(r)) : e(r);
7
- }
8
- export {
9
- s as default
10
- };
@@ -1,5 +0,0 @@
1
- import a from "./_createRange.js";
2
- var r = a();
3
- export {
4
- r as default
5
- };
@@ -1,6 +0,0 @@
1
- function r() {
2
- return [];
3
- }
4
- export {
5
- r as default
6
- };
@@ -1,14 +0,0 @@
1
- import n from "./toNumber.js";
2
- var t = 1 / 0, o = 17976931348623157e292;
3
- function I(r) {
4
- if (!r)
5
- return r === 0 ? r : 0;
6
- if (r = n(r), r === t || r === -t) {
7
- var i = r < 0 ? -1 : 1;
8
- return i * o;
9
- }
10
- return r === r ? r : 0;
11
- }
12
- export {
13
- I as default
14
- };
@@ -1,22 +0,0 @@
1
- import n from "./_baseTrim.js";
2
- import f from "./isObject.js";
3
- import o from "./isSymbol.js";
4
- var s = NaN, m = /^[-+]0x[0-9a-f]+$/i, p = /^0b[01]+$/i, e = /^0o[0-7]+$/i, b = parseInt;
5
- function O(r) {
6
- if (typeof r == "number")
7
- return r;
8
- if (o(r))
9
- return s;
10
- if (f(r)) {
11
- var t = typeof r.valueOf == "function" ? r.valueOf() : r;
12
- r = f(t) ? t + "" : t;
13
- }
14
- if (typeof r != "string")
15
- return r === 0 ? r : +r;
16
- r = n(r);
17
- var i = p.test(r);
18
- return i || e.test(r) ? b(r.slice(2), i ? 2 : 8) : m.test(r) ? s : +r;
19
- }
20
- export {
21
- O as default
22
- };
@@ -1,7 +0,0 @@
1
- import r from "./_baseToString.js";
2
- function o(t) {
3
- return t == null ? "" : r(t);
4
- }
5
- export {
6
- o as default
7
- };
@@ -1,2 +0,0 @@
1
- declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
- export default _default;
@@ -1,2 +0,0 @@
1
- import type { CompilerRule } from '@@/Types/html-compiler';
2
- export declare const itemsCompilerRules: CompilerRule[];
@@ -1,15 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- import { CommonControl } from '../../../common-control';
3
- import { ItemsBlockControlId } from '../../enums/controlEnums';
4
- export declare const CONTROL_BLOCK_ID = ItemsBlockControlId.PRICE_ORIENTATION;
5
- export declare class PriceOrientationControl extends CommonControl {
6
- private store;
7
- getId(): string;
8
- getTemplate(): string;
9
- onRender(): void;
10
- onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
11
- _onPriceOrientationChange(value: string): void;
12
- private _updateHorizontalLayout;
13
- private _updateVerticalLayout;
14
- _getPriceOrientation(): string;
15
- }
@@ -1,23 +0,0 @@
1
- import { ImmutableHtmlElementNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Gets the esd-config-block element from the current node.
4
- * Searches within the closest .items-block-v2 container.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- * @returns The config block element or null if not found
7
- */
8
- export declare function getConfigBlock(currentNode: ImmutableHtmlNode | undefined): ImmutableHtmlElementNode | null;
9
- /**
10
- * Converts an attribute value to a boolean.
11
- * Handles string values '1', 'true', and null/undefined cases.
12
- * @param value - The attribute value (string or null)
13
- * @param defaultValue - Default value to return if value is null/undefined (default: false)
14
- * @returns The boolean value
15
- */
16
- export declare function attributeToBoolean(value: string | null, defaultValue?: boolean): boolean;
17
- /**
18
- * Gets a string attribute value with a default fallback.
19
- * @param value - The attribute value (string or null)
20
- * @param defaultValue - Default value to return if value is null/undefined (default: '')
21
- * @returns The string value or default
22
- */
23
- export declare function attributeToString(value: string | null, defaultValue?: string): string;
@@ -1,32 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- import { configAttributes } from '../enums/productEnums';
3
- type StoreSetter<T> = (value: T) => void;
4
- interface SyncConfig<T> {
5
- attributeName: keyof typeof configAttributes;
6
- storeSetter: StoreSetter<T>;
7
- converter: (value: string | null) => T;
8
- }
9
- /**
10
- * Generic utility to sync an attribute value from esd-config-block to the store.
11
- * This makes attribute values mutable by syncing them from the DOM.
12
- * @param currentNode - The current node from the control (usually this.currentNode)
13
- * @param config - Configuration object with attribute name, store setter, and value converter
14
- */
15
- export declare function syncAttributeFromConfigBlock<T>(currentNode: ImmutableHtmlNode | undefined, config: SyncConfig<T>): void;
16
- /**
17
- * Helper to create a sync config for boolean attributes.
18
- * @param attributeName - The attribute name from configAttributes
19
- * @param storeSetter - The store setter function
20
- * @param defaultValue - Default value if attribute is not set (default: false)
21
- * @returns Sync configuration object
22
- */
23
- export declare function createBooleanSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<boolean>, defaultValue?: boolean): SyncConfig<boolean>;
24
- /**
25
- * Helper to create a sync config for string attributes.
26
- * @param attributeName - The attribute name from configAttributes
27
- * @param storeSetter - The store setter function
28
- * @param defaultValue - Default value if attribute is not set (default: '')
29
- * @returns Sync configuration object
30
- */
31
- export declare function createStringSyncConfig(attributeName: keyof typeof configAttributes, storeSetter: StoreSetter<string>, defaultValue?: string): SyncConfig<string>;
32
- export {};
@@ -1,50 +0,0 @@
1
- import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Reads name trimming value from esd-config-block attribute and updates the store.
4
- * This makes the trimming value mutable by syncing it from the DOM.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- */
7
- export declare function syncNameTrimmingFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
8
- /**
9
- * Reads hide discount value from esd-config-block attribute and updates the store.
10
- * This makes the hide discount value mutable by syncing it from the DOM.
11
- * @param currentNode - The current node from the control (usually this.currentNode)
12
- */
13
- export declare function syncHideDiscountFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
14
- /**
15
- * Reads formatted price value from esd-config-block attribute and updates the store.
16
- * This makes the formatted price value mutable by syncing it from the DOM.
17
- * Defaults to true if not set, since formatted is the default.
18
- * @param currentNode - The current node from the control (usually this.currentNode)
19
- */
20
- export declare function syncFormattedPriceFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
21
- /**
22
- * Reads currency symbol value from esd-config-block attribute and updates the store.
23
- * This makes the currency symbol value mutable by syncing it from the DOM.
24
- * @param currentNode - The current node from the control (usually this.currentNode)
25
- */
26
- export declare function syncCurrencySymbolFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
27
- /**
28
- * Reads currency location value from esd-config-block attribute and updates the store.
29
- * This makes the currency location value mutable by syncing it from the DOM.
30
- * @param currentNode - The current node from the control (usually this.currentNode)
31
- */
32
- export declare function syncCurrencyLocationFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
33
- /**
34
- * Reads button link value from esd-config-block attribute and updates the store.
35
- * This makes the button link value mutable by syncing it from the DOM.
36
- * @param currentNode - The current node from the control (usually this.currentNode)
37
- */
38
- export declare function syncButtonLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
39
- /**
40
- * Reads image link value from esd-config-block attribute and updates the store.
41
- * This makes the image link value mutable by syncing it from the DOM.
42
- * @param currentNode - The current node from the control (usually this.currentNode)
43
- */
44
- export declare function syncImageLinkFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
45
- /**
46
- * Reads price orientation value from esd-config-block attribute and updates the store.
47
- * This makes the price orientation value mutable by syncing it from the DOM.
48
- * @param currentNode - The current node from the control (usually this.currentNode)
49
- */
50
- export declare function syncPriceOrientationFromAttributes(currentNode: ImmutableHtmlNode | undefined): void;
@@ -1,8 +0,0 @@
1
- import { ImmutableHtmlNode, ControlApi } from '@stripoinc/ui-editor-extensions';
2
- /**
3
- * Updates attributes on the esd-config-block element based on current store state.
4
- * This utility can be called from controls whenever they change values that affect attributes.
5
- * @param currentNode - The current node from the control (usually this.currentNode)
6
- * @param api - The API object from the control (usually this.api)
7
- */
8
- export declare function updateConfigBlockAttributes(currentNode: ImmutableHtmlNode | undefined, api: ControlApi): void;
@@ -1,5 +0,0 @@
1
- /**
2
- * Gets the appropriate environment prefix by parsing from current hostname
3
- * Extracts environment prefix from domains by splitting hostname
4
- */
5
- export declare const getEnvironmentPrefix: () => string;
@@ -1,7 +0,0 @@
1
- /**
2
- * Transforms product-related HTML elements from default/dummy values to template variables.
3
- * This method is called before saving email templates to ensure product data is properly templated.
4
- * @param html - The HTML string containing product elements
5
- * @returns The transformed HTML with template variables
6
- */
7
- export declare function pairProductVariables(html: string): string;
@@ -1,4 +0,0 @@
1
- const n = () => window.location.hostname.split(".")[2];
2
- export {
3
- n as getEnvironmentPrefix
4
- };
@@ -1,136 +0,0 @@
1
- import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
2
- function M(H) {
3
- const m = H.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), $ = new DOMParser().parseFromString(m, "text/html"), C = w.PAIRS_FOR_EXTENSION;
4
- Object.entries(C).forEach(([n, d]) => {
5
- $.querySelectorAll(".ins-product-td").forEach((o) => {
6
- const h = o.getAttribute("data-number") || "1", _ = o.getAttribute("data-type") || "CART_ITEMS";
7
- o.querySelectorAll(`[product-attr="${n}"]`).forEach((e) => {
8
- var y;
9
- const b = e.getAttribute("data-type") || _, u = e.getAttribute("data-number") || h, p = d[b];
10
- if (p)
11
- switch (n) {
12
- case "imageSrc": {
13
- let t = null, i = null;
14
- if (e.tagName === "IMG" ? (t = e, i = t.closest("a")) : (t = e.querySelector("img"), i = e.querySelector("a") || e.closest("a")), !t)
15
- break;
16
- const c = p.DEFAULT, a = p.ATTR;
17
- if (c && t.src) {
18
- const r = t.src;
19
- c.some((l) => {
20
- const s = l.split("/").pop() || "", F = r.split("/").pop() || "";
21
- return r.includes(l) || r.includes(s) || F === s;
22
- }) && (t.src = `{{${a}_${u}}}`);
23
- }
24
- if (i) {
25
- const r = (y = C.itemLink) == null ? void 0 : y[b];
26
- if (r) {
27
- const f = r.HREF, l = r.DEFAULT_HREF || "#!", s = i.href;
28
- (s === "#" || s === "" || s.endsWith("#!") || s.endsWith(l) || s === `${window.location.href}${l}` || !s || s === window.location.href) && (i.href = `{{${f}_${u}}}`);
29
- }
30
- }
31
- break;
32
- }
33
- case "name": {
34
- const t = p, i = t.ATTR, c = t.DEFAULT_HREF || "#!", a = t.HREF;
35
- e.textContent && (e.textContent = `{{${i}_${u}}}`);
36
- const r = e.closest("a") || (e.tagName === "A" ? e : null);
37
- if (r && a) {
38
- const f = r.href, l = `${window.location.href}${c}`;
39
- (f === l || f.endsWith(c)) && (r.href = `{{${a}_${u}}}`);
40
- }
41
- break;
42
- }
43
- case "price":
44
- case "originalPrice": {
45
- const t = p, c = e.getAttribute("data-formated") === "true", a = e.getAttribute("data-curency") || "before", r = c ? t.PRICE_FORMATTED : t.PRICE, f = t.CURRENCY;
46
- let l = `{{${r}_${u}}}`;
47
- if (f) {
48
- const s = `{{${f}_${u}}}`;
49
- l = a === "after" ? `${l} ${s}` : `${s} ${l}`;
50
- }
51
- e.textContent = l;
52
- break;
53
- }
54
- case "quantity": {
55
- const t = p, i = t.ATTR, c = t.DEFAULT;
56
- e.textContent && e.textContent.trim() === c && (e.textContent = `{{${i}_${u}}}`);
57
- break;
58
- }
59
- case "button": {
60
- const t = p, i = t.HREF, c = t.DEFAULT_HREF || "#!", a = e.tagName === "A" ? e : e.querySelector("a");
61
- if (a) {
62
- const r = a.href || "", f = `${window.location.href}${c}`;
63
- (r === "" || r === "#" || r === f || r.endsWith(c) || r.endsWith("#!") || r === window.location.href) && (a.href = `{{${i}_${u}}}`);
64
- }
65
- break;
66
- }
67
- case "itemLink": {
68
- const t = p, i = t.HREF, c = t.DEFAULT_HREF || "#!", a = e;
69
- if (a.href) {
70
- const r = a.href, f = `${window.location.href}${c}`;
71
- (r === f || r.endsWith(c)) && (a.href = `{{${i}_${u}}}`);
72
- }
73
- break;
74
- }
75
- default: {
76
- if ("ATTR" in p) {
77
- const t = p.ATTR;
78
- e.textContent && (e.textContent = `{{${t}_${u}}}`);
79
- }
80
- break;
81
- }
82
- }
83
- });
84
- });
85
- });
86
- const S = $.querySelectorAll(".ins-product-td"), R = [];
87
- S.forEach((n) => {
88
- const d = n.getAttribute("data-type") || "CART_ITEMS", A = n.getAttribute("data-number") || "1", o = n.getAttribute("data-nodup"), h = n.outerHTML;
89
- R.push({
90
- element: n,
91
- outerHtml: h,
92
- type: d,
93
- number: A,
94
- nodup: o || void 0
95
- });
96
- });
97
- let E = $.body.innerHTML;
98
- R.reverse().forEach(({ outerHtml: n, type: d, number: A }) => {
99
- let o = "";
100
- switch (d) {
101
- case "CART_ITEMS":
102
- o = "ins_apr_total_product_kind";
103
- break;
104
- case "BROWSED_ITEMS":
105
- o = "browsed_item_total_product_kind";
106
- break;
107
- case "PURCHASED_ITEMS":
108
- o = "purchased_item_total_product_kind";
109
- break;
110
- }
111
- if (o) {
112
- const _ = parseInt(A) - 1, b = `${`{% if ${o} > ${_} %}`}${n}{% endif %}`;
113
- E = E.replace(n, b);
114
- }
115
- });
116
- const k = $.querySelectorAll('[product-attr="originalPrice"][data-type="CART_ITEMS"]'), T = [];
117
- return k.forEach((n) => {
118
- const d = n.getAttribute("data-number"), A = n.getAttribute("data-type");
119
- if (!d || A !== "CART_ITEMS")
120
- return;
121
- const o = n.closest(".product-original-price-class");
122
- if (o) {
123
- const h = o.outerHTML;
124
- T.some((g) => g.tdOuterHtml === h) || T.push({ tdOuterHtml: h, number: d });
125
- }
126
- }), T.reverse().forEach(({ tdOuterHtml: n, number: d }) => {
127
- const A = `{% if ins_apr_price_${d} != ins_apr_originalprice_${d} %}`;
128
- if (!E.includes(A) && !n.includes("{% if")) {
129
- const h = `${A}${n}{% endif %}`;
130
- E = E.replace(n, h);
131
- }
132
- }), E.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
133
- }
134
- export {
135
- M as pairProductVariables
136
- };