@tet/tet-components 1.3.146-testing → 1.3.147-testing

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 (155) hide show
  1. package/dist/cjs/index-f559cb2e.js +24 -36
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{tet-notification.cjs.entry.js → tet-accordion_2.cjs.entry.js} +131 -0
  4. package/dist/cjs/tet-address-offers-filters-products_2.cjs.entry.js +1 -1
  5. package/dist/cjs/{tet-autocomplete_2.cjs.entry.js → tet-autocomplete.cjs.entry.js} +0 -65
  6. package/dist/cjs/tet-b2b-check-out-form_5.cjs.entry.js +647 -0
  7. package/dist/cjs/tet-b2b-configurator.cjs.entry.js +536 -0
  8. package/dist/cjs/tet-b2b-service-calculator.cjs.entry.js +1 -1
  9. package/dist/cjs/tet-border-radius.cjs.entry.js +1 -1
  10. package/dist/cjs/tet-business-lines.cjs.entry.js +1 -1
  11. package/dist/cjs/tet-colors.cjs.entry.js +4 -4
  12. package/dist/cjs/tet-compare-card-v2.cjs.entry.js +1 -1
  13. package/dist/cjs/tet-components.cjs.js +1 -1
  14. package/dist/cjs/tet-font-weight.cjs.entry.js +1 -1
  15. package/dist/cjs/tet-fonts.cjs.entry.js +1 -1
  16. package/dist/cjs/tet-grid.cjs.entry.js +1 -1
  17. package/dist/cjs/tet-layout.cjs.entry.js +1 -1
  18. package/dist/cjs/tet-link.cjs.entry.js +1 -1
  19. package/dist/cjs/tet-spacing.cjs.entry.js +1 -1
  20. package/dist/cjs/tet-spinner.cjs.entry.js +71 -0
  21. package/dist/cjs/tet-text-list.cjs.entry.js +1 -1
  22. package/dist/collection/collection-manifest.json +1 -0
  23. package/dist/collection/components/advanced/cards/tet-b2b-compare-card/test/tet-b2b-compare-card.spec.js +0 -1
  24. package/dist/collection/components/advanced/cards/tet-b2b-compare-card/tet-b2b-compare-card.js +8 -8
  25. package/dist/collection/components/advanced/cards/tet-business-summary-card/tet-business-summary-card.css +7 -0
  26. package/dist/collection/components/advanced/cards/tet-business-summary-card/tet-business-summary-card.js +31 -7
  27. package/dist/collection/components/advanced/cards/tet-compare-card/tet-compare-card.css +1 -0
  28. package/dist/collection/components/advanced/cards/tet-compare-card-v2/tet-compare-card-v2.css +1 -0
  29. package/dist/collection/components/advanced/forms/tet-b2b-check-out-form/tet-b2b-check-out-form.css +0 -2
  30. package/dist/collection/components/advanced/forms/tet-b2b-check-out-form/tet-b2b-check-out-form.js +24 -4
  31. package/dist/collection/components/simple/lists/tet-text-list/tet-text-list.css +1 -0
  32. package/dist/collection/components/simple/menu/tet-business-navigation/tet-business-navigation.css +15 -5
  33. package/dist/collection/components/simple/structural/tet-accordion/tet-accordion.css +4 -2
  34. package/dist/collection/components/simple/structural/tet-accordion/tet-accordion.js +27 -5
  35. package/dist/collection/components/views/tet-b2b-configurator/b2b-configurator.store.js +47 -0
  36. package/dist/collection/components/views/tet-b2b-configurator/partials/tet-b2b-configurator-cart/test/tet-b2b-configurator-cart.spec.js +10 -1
  37. package/dist/collection/components/views/tet-b2b-configurator/partials/tet-b2b-configurator-cart/tet-b2b-configurator-cart.css +54 -9
  38. package/dist/collection/components/views/tet-b2b-configurator/partials/tet-b2b-configurator-cart/tet-b2b-configurator-cart.js +106 -8
  39. package/dist/collection/components/views/tet-b2b-configurator/tet-b2b-configurator.css +472 -0
  40. package/dist/collection/components/views/tet-b2b-configurator/tet-b2b-configurator.js +612 -0
  41. package/dist/collection/components/views/tet-b2b-service-calculator/tet-b2b-service-calculator.js +1 -1
  42. package/dist/collection/components/views/tet-business-lines/tet-business-lines.js +1 -1
  43. package/dist/collection/docs/styling/border-radius/tet-border-radius.js +1 -1
  44. package/dist/collection/docs/styling/colors/tet-colors.js +4 -4
  45. package/dist/collection/docs/styling/font-weight/tet-font-weight.js +1 -1
  46. package/dist/collection/docs/styling/fonts/tet-fonts.js +1 -1
  47. package/dist/collection/docs/styling/layout/tet-layout.js +1 -1
  48. package/dist/collection/docs/styling/link/tet-link.js +1 -1
  49. package/dist/collection/docs/styling/spacing/tet-spacing.js +1 -1
  50. package/dist/collection/docs/styling/tet-grid/tet-grid.js +1 -1
  51. package/dist/collection/services/utils/minimum-duration-time.js +14 -0
  52. package/dist/components/index.js +2 -0
  53. package/dist/components/{p-08cb8e8b.js → p-401be6d8.js} +8 -6
  54. package/dist/components/{p-b3266df2.js → p-42c3311c.js} +1 -1
  55. package/dist/components/{p-c15aec6f.js → p-4a4c9b2c.js} +1 -1
  56. package/dist/{esm/tet-business-navigation.entry.js → components/p-5541195e.js} +35 -8
  57. package/dist/components/{p-e735af9c.js → p-8dd212bd.js} +1 -1
  58. package/dist/{esm/tet-b2b-compare-card.entry.js → components/p-922171da.js} +68 -20
  59. package/dist/{esm/tet-b2b-check-out-form.entry.js → components/p-b74f5470.js} +69 -16
  60. package/dist/components/p-cbf2c238.js +227 -0
  61. package/dist/components/{p-18778346.js → p-e72ea31d.js} +1 -1
  62. package/dist/{esm/tet-business-summary-card.entry.js → components/p-f68a8deb.js} +66 -14
  63. package/dist/components/tet-accordion.js +1 -1
  64. package/dist/components/tet-address-offers-view.js +2 -2
  65. package/dist/components/tet-address-offers.js +1 -1
  66. package/dist/components/tet-b2b-check-out-form.js +1 -207
  67. package/dist/components/tet-b2b-compare-card.js +1 -206
  68. package/dist/components/tet-b2b-configurator-cart.js +1 -167
  69. package/dist/components/tet-b2b-configurator.d.ts +11 -0
  70. package/dist/components/tet-b2b-configurator.js +661 -0
  71. package/dist/components/tet-b2b-service-calculator.js +1 -1
  72. package/dist/components/tet-border-radius.js +1 -1
  73. package/dist/components/tet-business-compare-card.js +1 -1
  74. package/dist/components/tet-business-lines.js +1 -1
  75. package/dist/components/tet-business-navigation.js +1 -103
  76. package/dist/components/tet-business-summary-card.js +1 -116
  77. package/dist/components/tet-colors.js +4 -4
  78. package/dist/components/tet-compare-card-v2.js +1 -1
  79. package/dist/components/tet-compare-card.js +1 -1
  80. package/dist/components/tet-compare-cards-tab.js +2 -2
  81. package/dist/components/tet-compare-cards.js +1 -1
  82. package/dist/components/tet-font-weight.js +1 -1
  83. package/dist/components/tet-fonts.js +1 -1
  84. package/dist/components/tet-grid.js +1 -1
  85. package/dist/components/tet-layout.js +1 -1
  86. package/dist/components/tet-link.js +1 -1
  87. package/dist/components/tet-spacing.js +1 -1
  88. package/dist/components/tet-text-list.js +1 -1
  89. package/dist/esm/index-7f1e2a22.js +24 -36
  90. package/dist/esm/loader.js +1 -1
  91. package/dist/esm/{tet-notification.entry.js → tet-accordion_2.entry.js} +132 -2
  92. package/dist/esm/tet-address-offers-filters-products_2.entry.js +1 -1
  93. package/dist/esm/{tet-autocomplete_2.entry.js → tet-autocomplete.entry.js} +1 -65
  94. package/dist/esm/tet-b2b-check-out-form_5.entry.js +639 -0
  95. package/dist/esm/tet-b2b-configurator.entry.js +532 -0
  96. package/dist/esm/tet-b2b-service-calculator.entry.js +1 -1
  97. package/dist/esm/tet-border-radius.entry.js +1 -1
  98. package/dist/esm/tet-business-lines.entry.js +1 -1
  99. package/dist/esm/tet-colors.entry.js +4 -4
  100. package/dist/esm/tet-compare-card-v2.entry.js +1 -1
  101. package/dist/esm/tet-components.js +1 -1
  102. package/dist/esm/tet-font-weight.entry.js +1 -1
  103. package/dist/esm/tet-fonts.entry.js +1 -1
  104. package/dist/esm/tet-grid.entry.js +1 -1
  105. package/dist/esm/tet-layout.entry.js +1 -1
  106. package/dist/esm/tet-link.entry.js +1 -1
  107. package/dist/esm/tet-spacing.entry.js +1 -1
  108. package/dist/esm/tet-spinner.entry.js +67 -0
  109. package/dist/esm/tet-text-list.entry.js +1 -1
  110. package/dist/tet-components/{p-0121cef5.entry.js → p-067c2f1b.entry.js} +1 -1
  111. package/dist/tet-components/{p-bb6387c6.entry.js → p-0738afc0.entry.js} +1 -1
  112. package/dist/tet-components/{p-f476f61c.entry.js → p-07aee8d0.entry.js} +1 -1
  113. package/dist/tet-components/p-0d818b7e.entry.js +1 -0
  114. package/dist/tet-components/{p-56460d2d.entry.js → p-4c9e742f.entry.js} +1 -1
  115. package/dist/tet-components/{p-9c274191.entry.js → p-4e0a24ba.entry.js} +1 -1
  116. package/dist/tet-components/p-4ea127f4.entry.js +1 -0
  117. package/dist/tet-components/{p-9bfcf2cc.entry.js → p-62eb4fe0.entry.js} +1 -1
  118. package/dist/tet-components/{p-38c3b247.entry.js → p-662d9457.entry.js} +1 -1
  119. package/dist/tet-components/{p-1ddb9e3c.entry.js → p-677b8bf7.entry.js} +1 -1
  120. package/dist/tet-components/{p-7f00f463.entry.js → p-6a4a979c.entry.js} +1 -1
  121. package/dist/tet-components/p-6d2c4b16.entry.js +1 -0
  122. package/dist/tet-components/{p-6782340f.entry.js → p-9513c8f6.entry.js} +1 -1
  123. package/dist/tet-components/p-af917a8f.entry.js +1 -0
  124. package/dist/tet-components/{p-597e234a.entry.js → p-dcb66405.entry.js} +1 -1
  125. package/dist/tet-components/{p-4838a00a.entry.js → p-e311eb7d.entry.js} +1 -1
  126. package/dist/tet-components/p-ed67bd52.entry.js +1 -0
  127. package/dist/tet-components/{p-bd8a0449.entry.js → p-eed6163a.entry.js} +1 -1
  128. package/dist/tet-components/tet-components.css +1 -1
  129. package/dist/tet-components/tet-components.esm.js +1 -1
  130. package/dist/types/components/advanced/cards/tet-business-summary-card/tet-business-summary-card.d.ts +4 -2
  131. package/dist/types/components/advanced/forms/tet-b2b-check-out-form/tet-b2b-check-out-form.d.ts +2 -1
  132. package/dist/types/components/simple/structural/tet-accordion/tet-accordion.d.ts +5 -0
  133. package/dist/types/components/views/tet-b2b-configurator/b2b-configurator.store.d.ts +22 -0
  134. package/dist/types/components.d.ts +100 -4
  135. package/dist/types/services/api/interfaces/property.interface.d.ts +2 -2
  136. package/dist/types/services/api/services/b2b-configurator/b2b-configurator.d.ts +4 -4
  137. package/dist/types/services/utils/minimum-duration-time.d.ts +9 -0
  138. package/package.json +1 -1
  139. package/dist/cjs/tet-accordion.cjs.entry.js +0 -136
  140. package/dist/cjs/tet-b2b-check-out-form.cjs.entry.js +0 -164
  141. package/dist/cjs/tet-b2b-compare-card.cjs.entry.js +0 -164
  142. package/dist/cjs/tet-b2b-configurator-cart.cjs.entry.js +0 -129
  143. package/dist/cjs/tet-business-navigation.cjs.entry.js +0 -82
  144. package/dist/cjs/tet-business-summary-card.cjs.entry.js +0 -77
  145. package/dist/esm/tet-accordion.entry.js +0 -132
  146. package/dist/esm/tet-b2b-configurator-cart.entry.js +0 -125
  147. package/dist/tet-components/p-05fc6443.entry.js +0 -1
  148. package/dist/tet-components/p-319c29e9.entry.js +0 -1
  149. package/dist/tet-components/p-47618056.entry.js +0 -1
  150. package/dist/tet-components/p-4eb386f5.entry.js +0 -1
  151. package/dist/tet-components/p-62419a1f.entry.js +0 -1
  152. package/dist/tet-components/p-a9499bbb.entry.js +0 -1
  153. package/dist/tet-components/p-d0d39e88.entry.js +0 -1
  154. package/dist/tet-components/p-ff5dba0e.entry.js +0 -1
  155. package/dist/types/components/views/tet-b2b-configurator/partials/tet-b2b-configurator-cart/tet-b2b-configurator-cart.d.ts +0 -67
@@ -0,0 +1,532 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-7f1e2a22.js';
2
+ import { e as endpoints, A as ApiRequest } from './http-codes-7faa9f6e.js';
3
+ import { c as createStore } from './index-1bf36cb9.js';
4
+ import { t as translate } from './translations-eff34607.js';
5
+ import './typecheck-31fd6c02.js';
6
+
7
+ const b2bConfigurator = () => {
8
+ let apiUrl;
9
+ try {
10
+ apiUrl = new URL(endpoints.b2bConfigurator).href;
11
+ }
12
+ catch (error) {
13
+ console.error(error);
14
+ return Promise.reject('B2B configurator endpoint URL generation failed.');
15
+ }
16
+ const request = new ApiRequest()
17
+ .setUrl(apiUrl)
18
+ .setErrorFallbackValue([]);
19
+ return request.execute();
20
+ };
21
+
22
+ /**
23
+ * Ensures an asynchronous operation (Promise or async function) takes at least
24
+ * a specified minimum duration to resolve.
25
+ * @param callback The Promise to await, or an asynchronous function that returns a Promise.
26
+ * @param minDurationMs The minimum time, in milliseconds, the resulting Promise should take to resolve.
27
+ * @returns A Promise that resolves with the result of the callback, but only after
28
+ * both the callback and the minDurationMs delay have completed.
29
+ */
30
+ const ensureMinDuration = async (callback, minDurationMs) => {
31
+ const responsePromise = typeof callback === 'function' ? callback() : callback;
32
+ const delayPromise = new Promise((resolve) => setTimeout(resolve, minDurationMs));
33
+ const [result] = await Promise.all([responsePromise, delayPromise]);
34
+ return result;
35
+ };
36
+
37
+ const { state, set, get } = createStore({
38
+ data: [],
39
+ cart: new Map(),
40
+ productDetails: new Map()
41
+ });
42
+ const initData = (data) => {
43
+ set('data', data);
44
+ const productDetails = new Map();
45
+ for (const category of data) {
46
+ for (const product of category.products) {
47
+ const { type: categoryType, name: categoryName, id: categoryId } = category;
48
+ const { name: { lv: name }, description: { lv: description }, amount, b2bConfiguratorProduct } = product;
49
+ productDetails.set(product.productCode, {
50
+ name,
51
+ description,
52
+ amount,
53
+ discountAmount: b2bConfiguratorProduct.discountAmount,
54
+ categoryType,
55
+ categoryName,
56
+ categoryId,
57
+ b2bConfiguratorProduct
58
+ });
59
+ }
60
+ }
61
+ set('productDetails', productDetails);
62
+ };
63
+ const addToCart = (product, count) => {
64
+ if (count < 0) {
65
+ return;
66
+ }
67
+ const newCart = new Map(state.cart);
68
+ newCart.set(product, count);
69
+ set('cart', newCart);
70
+ };
71
+ const removeFromCart = (product) => {
72
+ const newCart = new Map(state.cart);
73
+ newCart.delete(product);
74
+ set('cart', newCart);
75
+ };
76
+ const resetCart = () => {
77
+ set('cart', new Map());
78
+ };
79
+ const getCart = () => {
80
+ return Object.fromEntries(get('cart'));
81
+ };
82
+
83
+ const tetB2bConfiguratorCss = "@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Semibold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Semibold.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:700;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Bold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Bold.woff\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Inter-Regular.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Regular.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Inter-Medium.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Medium.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Inter-SemiBold.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-SemiBold.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Semibold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Semibold.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:700;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Bold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Bold.woff\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Inter-Regular.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Regular.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Inter-Medium.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Medium.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Inter-SemiBold.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-SemiBold.woff?v=3.19\") format(\"woff\")}:host{--font-family-fallback:Gilroy, Arial, sans-serif;--font-family-headline:Gilroy;--font-family-content:Inter, var(--font-family-fallback);font-family:var(--font-family-content)}:root{--tet-link-color:var(--tc-text-primary);--tet-link-color-hover:var(--tc-text-secondary);--tet-link-color-active:var(--tc-text-tertiary);--tet-link-color-focus:var(--tc-blue-40);--tet-link-color-disabled:var(--tc-button-text-inverse-disabled);--tet-link-secondary-color:var(--tc-text-secondary);--tet-link-secondary-color-hover:var(--tc-text-primary)}.tet-link,.tet-link__arrow{text-decoration:underline;color:var(--tet-link-color);position:relative;line-height:1.5rem;cursor:pointer}.tet-link.dark,.tet-link__arrow.dark{--tet-link-color:var(--tc-text-primary-dark);--tet-link-color-hover:var(--tc-text-secondary-dark);--tet-link-color-active:var(--tc-text-tertiary-dark);--tet-link-color-focus:var(--tc-blue-40-dark);--tet-link-color-disabled:var(--tc-button-text-inverse-disabled-dark);--tet-link-secondary-color:var(--tc-text-secondary-dark);--tet-link-secondary-color-hover:var(--tc-text-primary-dark)}.tet-link.tet-link--secondary,.tet-link__arrow.tet-link--secondary{--tet-link-color:var(--tet-link-secondary-color);--tet-link-color-hover:var(--tet-link-secondary-color-hover)}.tet-link tet-icon,.tet-link__arrow tet-icon{--icon-color:var(--tet-link-color)}.tet-link:hover,.tet-link__arrow:hover{color:var(--tet-link-color-hover)}.tet-link:hover tet-icon,.tet-link__arrow:hover tet-icon{--icon-color:var(--tet-link-color-hover)}.tet-link:active,.tet-link__arrow:active{color:var(--tet-link-color-active)}.tet-link:active tet-icon,.tet-link__arrow:active tet-icon{--icon-color:var(--tet-link-color-active)}.tet-link:focus-visible,.tet-link__arrow:focus-visible{outline:0.125rem solid var(--tc-blue-40);outline-offset:0.125rem;transition:outline 0s;outline-color:var(--tet-link-color-focus);border-radius:0.125rem}.tet-link.disabled,.tet-link__arrow.disabled{color:var(--tet-link-color-disabled);pointer-events:none;cursor:auto}.tet-link.disabled tet-icon,.tet-link__arrow.disabled tet-icon{--icon-color:var(--tet-link-color-disabled)}.tet-link.disabled:focus-visible,.tet-link__arrow.disabled:focus-visible{outline:none}.tet-link tet-icon,.tet-link__arrow tet-icon{padding-left:0.25rem;padding-right:0.25rem;--icon-container-display:inline-block}.tet-link__arrow{padding-right:1.5rem}.tet-link__arrow::after{content:\"-->\";position:absolute;white-space:nowrap;display:inline-block;text-decoration:none;padding-left:0.25rem;letter-spacing:initial;transition:all 0.15s ease-in}.tet-link__arrow:hover::after{padding-left:0.375rem}:host{display:block;--b2b-cart-offset-top:0px}.light{--b2b-text-color:var(--tc-text-primary);--b2b-text-color-secondary:var(--tc-text-secondary);--b2b-background-color:var(--tc-layer-primary);--b2b-icon-background-color:var(--tc-layer-secondary);--b2b-icon-pressed-background-color:var(--tc-layer-quaternary);--b2b-box-shadow:var(--tc-elevation-one);--b2b-border-color:var(--tc-border-quaternary);--b2b-summary-block-color:var(--tc-layer-secondary);--b2b-summary-accent-color:var(--tc-yellow-20);--b2b-confirmation-dialog-icon-color:var(--tc-yellow-40);--b2b-success-dialog-icon-color:var(--tc-green-40)}.dark{--b2b-text-color:var(--tc-text-primary-dark);--b2b-text-color-secondary:var(--tc-text-secondary-dark);--b2b-background-color:var(--tc-layer-primary-dark);--b2b-icon-background-color:var(--tc-layer-secondary-dark);--b2b-icon-pressed-background-color:var(--tc-layer-quaternary-dark);--b2b-box-shadow:var(--tc-elevation-one-dark);--b2b-border-color:var(--tc-border-quaternary-dark);--b2b-summary-block-color:var(--tc-layer-secondary-dark);--b2b-summary-accent-color:var(--tc-grey-20-dark);--b2b-confirmation-dialog-icon-color:var(--tc-yellow-40-dark);--b2b-success-dialog-icon-color:var(--tc-green-40-dark)}button.button-reset{background:none;border:none;padding:0;font:inherit;color:inherit;text-align:inherit}.placeholder{--placeholder-animation-speed:5s}.configurator{display:flex;gap:1rem;flex-direction:column;color:var(--b2b-text-color)}@media screen and (min-width: 64rem){.configurator{gap:1.5rem;flex-direction:row;align-items:flex-start}}.offer{border-radius:1rem;height:fit-content;flex:0 0 calc(70% - 0.75rem);background-color:var(--b2b-background-color);box-shadow:var(--b2b-box-shadow)}.offer__block{--accordion-header-padding:1rem;--accordion-header-mobile-padding:1rem;--accordion-header-font:600 1.25rem/1.5rem Gilroy, Gilroy, Arial, sans-serif;--accordion-header-mobile-font:600 1.25rem/1.5rem Gilroy, Gilroy, Arial, sans-serif}.offer__block:first-child{--accordion-border-radius:1rem 1rem 0 0;--accordion-outer-border:var(--b2b-border-color)}.offer__block:last-child{--accordion-border-radius:0 0 1rem 1rem;--accordion-border-bottom-width:0}@media screen and (min-width: 64rem){.offer__block{--accordion-header-padding:1.5rem;--accordion-header-font:600 1.75rem/2rem Gilroy, Gilroy, Arial, sans-serif}}.offer__content{overflow:hidden;padding:1.5rem 1rem;display:flex;flex-direction:column;gap:0.75rem;border-color:var(--b2b-border-color);border-top-style:solid;border-top-width:0.0625rem}@media screen and (min-width: 48rem){.offer__content{padding:1.5rem}}@media screen and (min-width: 64rem){.offer__content{flex-direction:row;gap:1.5rem;padding-bottom:2.5rem}}.offer__navigation{margin:0 -1.5rem;flex:0 0 30%}@media screen and (min-width: 64rem){.offer__navigation{max-width:20.5rem;margin:0}}.offer__cards{flex:1 1 0%}.offer__cards-header{padding:0.5rem 0 0.75rem 0;display:flex;gap:0.5rem;justify-content:space-between;align-items:center}@media screen and (min-width: 64rem){.offer__cards-header{padding:1rem 0}}.offer__cards-list{display:flex;flex-direction:column;gap:1rem}.offer__cards-title{flex:auto;font:600 1rem/1.5rem \"Inter\", \"Gilroy, Arial, sans-serif\"}@media screen and (min-width: 64rem){.offer__cards-title{font:600 1.25rem/1.5rem \"Gilroy\", \"Gilroy, Arial, sans-serif\"}}.compare__button{border-radius:50%;overflow:hidden}@media screen and (min-width: 64rem){.compare__button{border-radius:0.125rem}}.compare__button:focus-visible{outline:0.125rem solid var(--tc-blue-40);outline-offset:0.125rem;transition:outline 0s}.compare__button.dark:focus-visible{outline:0.125rem solid var(--tc-blue-40);outline:0.125rem solid var(--tc-blue-40-dark);outline-offset:0.125rem;transition:outline 0s}.compare__button:active{--b2b-icon-background-color:var(--b2b-icon-pressed-background-color)}.compare__text{font:400 1rem/1.5rem \"Inter\", \"Gilroy, Arial, sans-serif\";display:none}@media screen and (min-width: 64rem){.compare__text{display:initial}}.compare__icon-wrapper{width:2.75rem;height:2.75rem;display:flex;justify-content:center;align-items:center;background-color:var(--b2b-icon-background-color);cursor:pointer}@media screen and (min-width: 64rem){.compare__icon-wrapper{display:none}}.compare__icon{--icon-size:1.5rem}.cart{flex:0 0 calc(30% - 0.75rem);position:sticky}.cart--edit{bottom:-1px;top:calc(var(--b2b-cart-sticky-top) + var(--b2b-cart-offset-top))}.cart--empty{display:none}@media screen and (min-width: 64rem){.cart--empty{display:flex}}.cart__card-list{padding:0 1rem 1rem;display:flex;flex-direction:column;gap:0.5rem}.cart__cta{display:block;align-self:center}@media screen and (min-width: 48rem){.cart__cta{align-self:flex-end}}.action-dialog{display:flex;flex-direction:column;gap:0.5rem;align-items:center;margin-bottom:1.5rem}.action-dialog--loading{--dialog-footer-border-color:transparent}.action-dialog__title{text-align:center;font:600 1.5rem/1.75rem \"Gilroy\", \"Gilroy, Arial, sans-serif\"}.action-dialog__description{font:400 1rem/1.5rem \"Inter\", \"Gilroy, Arial, sans-serif\"}.action-dialog__icon{--icon-size:3rem}.action-dialog__attention-icon{--icon-color:var(--b2b-confirmation-dialog-icon-color)}.action-dialog__success-icon{--icon-color:var(--b2b-success-dialog-icon-color)}.action-dialog__footer{display:flex;justify-content:space-between;flex:auto}.action-dialog__button-text{white-space:nowrap}";
84
+ const TetB2bConfiguratorStyle0 = tetB2bConfiguratorCss;
85
+
86
+ /** Constant with value X, that will be used to show skeleton fox >=X ms amount of time. */
87
+ const MIN_LOAD_TIME = 500;
88
+ /** Constant to use in desktop resolution checker. Should be same as one used in SCSS media query */
89
+ const DESKTOP_BREAKPOINT = 1024;
90
+ const TetB2bConfigurator = class {
91
+ constructor(hostRef) {
92
+ registerInstance(this, hostRef);
93
+ this.compareLinkClick = createEvent(this, "compareLinkClick", 7);
94
+ this.b2bConfiguratorSubmit = createEvent(this, "b2bConfiguratorSubmit", 7);
95
+ this.successCloseClick = createEvent(this, "successCloseClick", 7);
96
+ /** @private The suffix for the price displayed - "€/mēn."). */
97
+ this.priceSuffix = '€/mēn.';
98
+ /** Syncs desktop resolution with state variable */
99
+ this.checkDesktopResolution = () => {
100
+ this.isDesktopResolution = window.innerWidth >= DESKTOP_BREAKPOINT;
101
+ };
102
+ /** Fetches the data and passes it to Stencil store */
103
+ this.fetchData = async () => {
104
+ const data = await b2bConfigurator();
105
+ initData(data);
106
+ };
107
+ /** Renders the placeholdes/skeleton */
108
+ this.renderPlaceholder = () => {
109
+ const darkTheme = this.theme === 'dark';
110
+ return [
111
+ h("div", { class: "offer placeholder" }, h("div", { style: { padding: this.isDesktopResolution ? '1.5rem' : '1rem' } }, h("tet-placeholder", { class: "placeholder", height: this.isDesktopResolution ? '2rem' : '1.5rem', darkTheme: darkTheme })), h("div", { class: "offer__content" }, h("tet-placeholder", { class: "placeholder offer__navigation", height: this.isDesktopResolution ? '48rem' : ' 2.25rem', darkTheme: darkTheme, style: { margin: '0' } }), h("div", { class: "offer__cards" }, h("div", { class: "offer__cards-list" }, h("tet-placeholder", { class: "placeholder", height: "3rem", darkTheme: darkTheme }), h("tet-placeholder", { class: "placeholder", height: "10.25rem", darkTheme: darkTheme }), h("tet-placeholder", { class: "placeholder", height: "10.25rem", darkTheme: darkTheme }), h("tet-placeholder", { class: "placeholder", height: "10.25rem", darkTheme: darkTheme }), h("tet-placeholder", { class: "placeholder", height: "10.25rem", darkTheme: darkTheme }))))),
112
+ h("div", { class: "cart cart--empty", style: {
113
+ 'padding': '1.5rem 1rem 1rem',
114
+ 'background-color': `var(--b2b-background-color)`
115
+ } }, h("tet-placeholder", { class: "placeholder", height: "12.75rem", darkTheme: darkTheme }))
116
+ ];
117
+ };
118
+ /**
119
+ * Handles event form navigation and sets currently active categories
120
+ * @param e
121
+ * @returns
122
+ */
123
+ this.categoryClickHandler = (e) => {
124
+ const { id } = e.detail;
125
+ const category = this.getCategoryById(id);
126
+ if (!category) {
127
+ return;
128
+ }
129
+ if (category.type === 'primary') {
130
+ this.activePrimaryCategoryId = id;
131
+ }
132
+ else {
133
+ this.activeSecondaryCategoryId = id;
134
+ }
135
+ };
136
+ /** Renders the offer section */
137
+ this.renderOffer = () => {
138
+ const blocks = [
139
+ { name: translate('components-b2b-offer-primary-title'), type: 'primary' },
140
+ { name: translate('components-b2b-offer-secondary-title'), type: 'secondary' }
141
+ ];
142
+ return (h("div", { class: { offer: true, [`offer--${this.theme}`]: true } }, blocks.map((block) => {
143
+ const menuItems = state.data
144
+ .filter((item) => item.type === block.type)
145
+ .map((category) => {
146
+ const { id, name, icon } = category;
147
+ const selected = id === this.activePrimaryCategoryId || id === this.activeSecondaryCategoryId;
148
+ return { id, name, icon, selected };
149
+ });
150
+ const accRefCallback = (el) => {
151
+ if (block.type === 'primary') {
152
+ this.primaryAccordionEl = el;
153
+ }
154
+ else {
155
+ this.secondaryAccordionEl = el;
156
+ }
157
+ };
158
+ const navRefCallback = (el) => {
159
+ if (block.type === 'primary') {
160
+ this.primaryNavEl = el;
161
+ }
162
+ else {
163
+ this.secondaryNavEl = el;
164
+ }
165
+ };
166
+ return (h("tet-accordion", { ref: accRefCallback, key: block.type, class: "offer__block", isOpen: block.type === 'primary', header: block.name, withBorder: true, theme: this.theme, transparentBackground: true }, h("div", { class: "offer__content" }, h("div", { class: "offer__navigation" }, h("tet-business-navigation", { ref: navRefCallback, menuItems: menuItems, theme: this.theme, "onMenu-click-event": this.categoryClickHandler })), this.renderCards(block.type))));
167
+ })));
168
+ };
169
+ /**
170
+ * Finds category by id. Returns category or undefined.
171
+ * @param categoryId
172
+ * @returns
173
+ */
174
+ this.getCategoryById = (categoryId) => {
175
+ return state.data.find((category) => category.id === categoryId);
176
+ };
177
+ /**
178
+ * Event, emitted on compare link click with the relevant modal Id
179
+ * @param categoryId
180
+ * @returns
181
+ */
182
+ this.onCompareLinkClick = (categoryId) => {
183
+ const category = this.getCategoryById(categoryId);
184
+ if (!category || !category.modalScreenId) {
185
+ return;
186
+ }
187
+ this.compareLinkClick.emit(category.modalScreenId);
188
+ };
189
+ /**
190
+ * Handles card selection (aka. oepen state). Checks for single|multi choice
191
+ * @param cardId
192
+ * @param categoryId
193
+ * @returns
194
+ */
195
+ this.handleCardSelected = (cardId, categoryId) => {
196
+ const category = this.getCategoryById(categoryId);
197
+ if (!category) {
198
+ return;
199
+ }
200
+ const { type, allowMultipleChoice } = category;
201
+ if (type === 'primary') {
202
+ if (this.selectedPrimaryCards.includes(cardId)) {
203
+ return;
204
+ }
205
+ this.selectedPrimaryCards = allowMultipleChoice ? [...this.selectedPrimaryCards, cardId] : [cardId];
206
+ }
207
+ else {
208
+ if (this.selectedSecondaryCards.includes(cardId)) {
209
+ return;
210
+ }
211
+ this.selectedSecondaryCards = allowMultipleChoice ? [...this.selectedSecondaryCards, cardId] : [cardId];
212
+ }
213
+ };
214
+ /**
215
+ * Updates product in cart (add, edit, remove)
216
+ * In desktop mode - changes state of summary cart's accordions
217
+ * @param e
218
+ * @param categoryId
219
+ */
220
+ this.handleProductCountChanged = async (e, categoryId) => {
221
+ const { cardId, count } = e.detail;
222
+ const productCategory = this.getCategoryById(categoryId);
223
+ if (!productCategory || state.cart.get(cardId) === count) {
224
+ return;
225
+ }
226
+ if (!count) {
227
+ this.itemToRemove = cardId;
228
+ this.confirmationDialogEl.open();
229
+ return;
230
+ }
231
+ if (!productCategory.allowMultipleChoice) {
232
+ productCategory.products.forEach((product) => product.productCode !== cardId && removeFromCart(product.productCode));
233
+ }
234
+ addToCart(cardId, count);
235
+ if (this.isDesktopResolution) {
236
+ this.cartEl.changeBlockState(productCategory.type, 'open');
237
+ this.cartEl.changeBlockState(productCategory.type === 'primary' ? 'secondary' : 'primary', 'close');
238
+ }
239
+ };
240
+ /** Resets itemId to be removed when confirmation dialog is closed */
241
+ this.onConfirmationClose = () => {
242
+ this.itemToRemove = null;
243
+ };
244
+ /** Renders confirmation dialog, shown on product removal action */
245
+ this.renderConfirmationDialog = () => {
246
+ return (h("tet-dialog", { ref: (el) => (this.confirmationDialogEl = el), class: this.theme, closeOnOverlayClick: false, onCloseDialog: this.onConfirmationClose, theme: this.theme }, h("div", { class: "action-dialog" }, h("tet-icon", { class: "action-dialog__icon action-dialog__attention-icon", name: "attention" }), h("div", { class: "action-dialog__title" }, translate('components-b2b-item-remove-confirmation-title'))), h("div", { slot: "footer", class: "action-dialog__footer" }, h("tet-button", { type: "secondary", theme: this.theme, size: "large", onClick: () => this.confirmationDialogEl.close() }, translate('components-b2b-item-remove-confirmation-decline')), h("tet-button", { type: "primary", theme: this.theme, size: "large", iconName: "tc-trash", iconPosition: "left", onClick: () => {
247
+ removeFromCart(this.itemToRemove);
248
+ this.confirmationDialogEl.close();
249
+ } }, translate('components-b2b-item-remove-confirmation-accept')))));
250
+ };
251
+ /** Performs action to start again */
252
+ this.resetState = () => {
253
+ resetCart();
254
+ this.checkoutAttempted = false;
255
+ this.primaryAccordionEl.open();
256
+ this.secondaryAccordionEl.close();
257
+ };
258
+ /** Renders dialog, shown after form submit */
259
+ this.renderSubmissionStateDialog = () => {
260
+ const isFormSubmitLoading = this.formState === 'loading';
261
+ const successClose = () => {
262
+ this.resetState();
263
+ this.successCloseClick.emit();
264
+ this.submissionStateDialogEl.close();
265
+ };
266
+ const content = isFormSubmitLoading ? (h("div", { class: "action-dialog" }, h("tet-spinner", { theme: this.theme }), h("div", { class: "action-dialog__title" }, translate('components-b2b-loading-dialog-title')), h("div", { class: "action-dialog__description" }, translate('components-b2b-loading-dialog-description')))) : ([
267
+ h("div", { class: "action-dialog" }, h("tet-icon", { class: "action-dialog__icon action-dialog__success-icon", name: "tc-check-circle" }), h("div", { class: "action-dialog__title" }, translate('components-b2b-success-dialog-title')), h("div", { class: "action-dialog__description" }, translate('components-b2b-success-dialog-description'))),
268
+ h("div", { slot: "footer", class: "action-dialog__footer" }, h("tet-button", { type: "secondary", theme: this.theme, size: "large", onClick: successClose }, h("div", { class: "action-dialog__button-text" }, translate('components-b2b-success-dialog-close'))), h("tet-button", { type: "primary", theme: this.theme, size: "large", onClick: () => {
269
+ this.resetState();
270
+ this.submissionStateDialogEl.close();
271
+ } }, h("div", { class: "action-dialog__button-text" }, translate('components-b2b-success-dialog-start-again'))))
272
+ ]);
273
+ return (h("tet-dialog", { ref: (el) => (this.submissionStateDialogEl = el), class: { [this.theme]: true, 'action-dialog--loading': isFormSubmitLoading }, closeOnOverlayClick: false, closeOnEscape: !isFormSubmitLoading, hideCloseButton: isFormSubmitLoading, theme: this.theme, onCloseDialog: this.formState === 'success' ? successClose : this.submissionStateDialogEl.close }, content));
274
+ };
275
+ /**
276
+ * Renders offer section cards for the given category type
277
+ * @param categoryType The type of category block to render
278
+ * @returns
279
+ */
280
+ this.renderCards = (categoryType) => {
281
+ var _a;
282
+ const activeCategoryId = categoryType === 'primary' ? this.activePrimaryCategoryId : this.activeSecondaryCategoryId;
283
+ const selectedCards = categoryType === 'primary' ? this.selectedPrimaryCards : this.selectedSecondaryCards;
284
+ const products = ((_a = this.getCategoryById(activeCategoryId)) === null || _a === void 0 ? void 0 : _a.products) || [];
285
+ const cards = products.map((product) => {
286
+ var _a, _b;
287
+ const { productCode: id, name: { lv: title }, description: { lv: subtitle }, amount: price, b2bConfiguratorProduct: { discountAmount: discountPrice, selectionType, defaultValue, minValue, maxValue, translationKey: label }, benefits: { lv: benefits }, contracts } = product;
288
+ const isBestChoice = !!((_a = product.attributes.find((attribute) => attribute.key === 'isBestChoice')) === null || _a === void 0 ? void 0 : _a.value);
289
+ const counterOptions = selectionType === 'single'
290
+ ? undefined
291
+ : {
292
+ defaultValue,
293
+ minValue,
294
+ maxValue,
295
+ label
296
+ };
297
+ const options = {
298
+ id,
299
+ title,
300
+ subtitle,
301
+ isBestChoice,
302
+ price,
303
+ discountPrice,
304
+ benefits: benefits.split('\n'),
305
+ contract: (_b = contracts[0]) === null || _b === void 0 ? void 0 : _b.contract,
306
+ counterOptions
307
+ };
308
+ const isSelected = selectedCards.includes(id);
309
+ return (h("tet-b2b-compare-card", { options: options, theme: this.theme, key: id, isSelected: isSelected, onSelectedChange: () => this.handleCardSelected(id, activeCategoryId), count: state.cart.get(id), onCountChange: (e) => this.handleProductCountChanged(e, activeCategoryId) }));
310
+ });
311
+ return (h("div", { class: "offer__cards" }, h("div", { class: "offer__cards-header" }, h("div", { class: "offer__cards-title" }, translate('components-b2b-offer-product-list-title')), h("button", { class: { 'button-reset': true, 'compare__button': true, [`${this.theme}`]: true }, onClick: () => {
312
+ this.onCompareLinkClick(activeCategoryId);
313
+ } }, h("span", { class: { 'compare__text': true, 'tet-link': true, [`${this.theme}`]: true } }, translate('components-b2b-offer-compare-link-text')), h("div", { class: "compare__icon-wrapper" }, h("tet-icon", { class: "compare__icon", name: "tc-info-circle-outline", theme: this.theme })))), h("div", { class: "offer__cards-list" }, cards)));
314
+ };
315
+ /**
316
+ * Translates Cart "count change" event and uses in the general "count change" handler
317
+ * @param cardId
318
+ * @param count
319
+ * @param categoryId
320
+ */
321
+ this.handleCartProductCountChange = (cardId, count, categoryId) => {
322
+ const updateEvent = { detail: { cardId, count } };
323
+ this.handleProductCountChanged(updateEvent, categoryId);
324
+ };
325
+ /**
326
+ * Navigates user in offer section by opening accordion and selecting the specific product which was clicked in cart component
327
+ * @param categoryId
328
+ * @param productCode
329
+ * @returns
330
+ */
331
+ this.goToProduct = async (categoryId, productCode) => {
332
+ const category = this.getCategoryById(categoryId);
333
+ if (!category) {
334
+ return;
335
+ }
336
+ if (category.type === 'primary') {
337
+ await this.primaryAccordionEl.open();
338
+ await this.primaryNavEl.selectMenuItem(categoryId);
339
+ this.primaryAccordionEl.scrollIntoView({ behavior: 'smooth' });
340
+ }
341
+ else if (category.type === 'secondary') {
342
+ await this.secondaryAccordionEl.open();
343
+ await this.secondaryNavEl.selectMenuItem(categoryId);
344
+ this.secondaryAccordionEl.scrollIntoView({ behavior: 'smooth' });
345
+ }
346
+ setTimeout(() => {
347
+ this.handleCardSelected(productCode, categoryId);
348
+ }, 0);
349
+ };
350
+ /**
351
+ * Renders list of Cards in Cart depending on context
352
+ * @param context
353
+ * @returns
354
+ */
355
+ this.renderCartCardsList = (context) => {
356
+ const categoryTypes = ['primary', 'secondary'];
357
+ const productCodeToSummaryCard = (productCode) => {
358
+ const count = state.cart.get(productCode);
359
+ const details = state.productDetails.get(productCode);
360
+ if (count === undefined || !details) {
361
+ return null;
362
+ }
363
+ const { name, amount, description, discountAmount, categoryName, categoryType, categoryId, b2bConfiguratorProduct } = details;
364
+ const productDescription = categoryType === 'primary' ? description : categoryName;
365
+ const { selectionType, term, minValue, maxValue, translationKey } = b2bConfiguratorProduct;
366
+ const activeCategoryId = categoryType === 'primary' ? this.activePrimaryCategoryId : this.activeSecondaryCategoryId;
367
+ return (h("tet-business-summary-card", { key: productCode, productName: name, price: amount, productDescription: productDescription, discountPrice: discountAmount, currency: this.priceSuffix, contractTerm: term, theme: this.theme, withStepper: selectionType === 'number', value: count, minValue: minValue, maxValue: maxValue, stepperLabel: translate(translationKey || ''), context: context, onAmountChange: (e) => this.handleCartProductCountChange(productCode, e.detail, activeCategoryId), onDeleteButtonClick: () => this.handleCartProductCountChange(productCode, 0, activeCategoryId), onEditButtonClick: () => this.goToProduct(categoryId, productCode) }));
368
+ };
369
+ return categoryTypes.map((type) => {
370
+ const summaryCards = [...state.cart]
371
+ .filter(([productCode]) => {
372
+ const details = state.productDetails.get(productCode);
373
+ return details && details.categoryType === type;
374
+ })
375
+ .map(([productCode]) => productCodeToSummaryCard(productCode));
376
+ return summaryCards.length ? (h("div", { class: "cart__card-list", slot: type }, summaryCards)) : null;
377
+ });
378
+ };
379
+ /** Adjusts the top position variable for the sticky cart element */
380
+ this.positionStickyCartEl = () => {
381
+ if (this.referenceElement) {
382
+ if (this.isDesktopResolution) {
383
+ this.hostElement.style.setProperty('--b2b-cart-sticky-top', `${this.referenceElement.offsetTop}px`);
384
+ }
385
+ else {
386
+ this.hostElement.style.removeProperty('--b2b-cart-sticky-top');
387
+ }
388
+ }
389
+ };
390
+ /**
391
+ * Renders Cart content depending on context
392
+ * @param context
393
+ * @returns
394
+ */
395
+ this.renderCart = (context = 'edit') => {
396
+ var _a;
397
+ const isCartEmpty = !state.cart.size;
398
+ let summaryAmounts = { primary: 0, secondary: 0 };
399
+ let summaryCounts = { primary: 0, secondary: 0 };
400
+ let summaryWouldBeAmount = 0;
401
+ for (const [key, count] of state.cart) {
402
+ const details = state.productDetails.get(key);
403
+ if (!details) {
404
+ continue;
405
+ }
406
+ summaryAmounts[details.categoryType] += ((_a = details.discountAmount) !== null && _a !== void 0 ? _a : details.amount) * count;
407
+ summaryCounts[details.categoryType] += 1;
408
+ summaryWouldBeAmount += details.amount * count;
409
+ }
410
+ const { primary: primaryAmount, secondary: secondaryAmount } = summaryAmounts;
411
+ const summaryAmount = primaryAmount + secondaryAmount;
412
+ const summarySavings = summaryWouldBeAmount - summaryAmount;
413
+ const { primary, secondary } = this.areProductsAddedToCart();
414
+ const hasPrimaryNotification = context === 'edit' && this.checkoutAttempted && !primary;
415
+ const hasSecondaryNotification = context === 'edit' && this.checkoutAttempted && !secondary;
416
+ const data = {
417
+ summaryAmount: summaryAmount.toFixed(2),
418
+ primaryAmount: primaryAmount.toFixed(2),
419
+ secondaryAmount: secondaryAmount.toFixed(2),
420
+ primaryCount: summaryCounts.primary,
421
+ secondaryCount: summaryCounts.secondary,
422
+ summarySavings: summarySavings.toFixed(2),
423
+ hasPrimaryNotification,
424
+ hasSecondaryNotification
425
+ };
426
+ const ctaButton = context === 'edit' ? (h("tet-button", { onClick: this.checkout, slot: "cta", class: "cart__cta", type: "primary", size: this.isDesktopResolution ? 'large' : 'medium', theme: this.theme }, translate('components-b2b-cart-cta-button-title'))) : null;
427
+ return (h("tet-b2b-configurator-cart", { ref: (el) => (context === 'edit' ? (this.cartEl = el) : null), context: context, class: { 'cart': true, 'cart--empty': isCartEmpty, [`cart--${context}`]: true }, data: data, theme: this.theme, isCartEmpty: isCartEmpty, isDesktopResolution: this.isDesktopResolution }, this.renderCartCardsList(context), ctaButton));
428
+ };
429
+ /** Checks if both primary and secondary products are currently in cart */
430
+ this.areProductsAddedToCart = () => {
431
+ const productsInCart = { primary: false, secondary: false };
432
+ for (const [key, _] of state.cart) {
433
+ const details = state.productDetails.get(key);
434
+ if (!details) {
435
+ continue;
436
+ }
437
+ productsInCart[details.categoryType] = true;
438
+ }
439
+ return productsInCart;
440
+ };
441
+ /** Cart checkout handler. Opens Checkout component*/
442
+ this.checkout = () => {
443
+ this.checkoutAttempted = true;
444
+ const { primary, secondary } = this.areProductsAddedToCart();
445
+ if (primary && secondary) {
446
+ this.checkoutFormEl.open();
447
+ }
448
+ };
449
+ /**
450
+ * Catches emitted checkout form data
451
+ * Combines with cart data and re-emits
452
+ * @param e
453
+ */
454
+ this.submit = ({ detail }) => {
455
+ const data = {
456
+ cart: getCart(),
457
+ contactInfo: detail
458
+ };
459
+ this.formState = 'loading';
460
+ this.b2bConfiguratorSubmit.emit(data);
461
+ this.checkoutFormEl.close();
462
+ this.submissionStateDialogEl.open();
463
+ };
464
+ this.renderCheckoutForm = () => {
465
+ return (h("tet-b2b-check-out-form", { ref: (el) => (this.checkoutFormEl = el), theme: this.theme, "onSubmit-check-out-form": this.submit }, h("div", { slot: "cart" }, this.renderCart('checkout'))));
466
+ };
467
+ this.referenceElement = undefined;
468
+ this.isLoading = true;
469
+ this.itemToRemove = null;
470
+ this.checkoutAttempted = false;
471
+ this.formState = 'success';
472
+ this.activePrimaryCategoryId = null;
473
+ this.activeSecondaryCategoryId = null;
474
+ this.selectedPrimaryCards = [];
475
+ this.selectedSecondaryCards = [];
476
+ this.isDesktopResolution = undefined;
477
+ this.theme = 'light';
478
+ this.stickyRefEl = '';
479
+ }
480
+ /** Resets selected (open) primary cards on category change */
481
+ resetSelectedPrimaryCards() {
482
+ this.selectedPrimaryCards = [];
483
+ }
484
+ /** Resets selected (open) secondary cards on category change */
485
+ resetSelectedSecondaryCards() {
486
+ this.selectedSecondaryCards = [];
487
+ }
488
+ /** Checks for desktop resolution and intializes the sticky element's reference using the provided prop or the host's parent */
489
+ async componentWillLoad() {
490
+ this.checkDesktopResolution();
491
+ this.referenceElement = this.stickyRefEl
492
+ ? document.querySelector(this.stickyRefEl)
493
+ : this.hostElement.parentElement;
494
+ }
495
+ /**
496
+ * Initiates:
497
+ * - data (with minimum load time to reduce flickering)
498
+ * - selected categories for each type
499
+ * - sticky elements position
500
+ */
501
+ async componentDidLoad() {
502
+ var _a, _b;
503
+ this.isLoading = true;
504
+ await ensureMinDuration(this.fetchData, MIN_LOAD_TIME);
505
+ this.isLoading = false;
506
+ this.activePrimaryCategoryId = ((_a = state.data.find((category) => category.type === 'primary')) === null || _a === void 0 ? void 0 : _a.id) || null;
507
+ this.activeSecondaryCategoryId = ((_b = state.data.find((category) => category.type === 'secondary')) === null || _b === void 0 ? void 0 : _b.id) || null;
508
+ this.positionStickyCartEl();
509
+ }
510
+ /**
511
+ * Initiates desktop resolution listener and sticky adjustement on window resize
512
+ */
513
+ onResize() {
514
+ this.checkDesktopResolution();
515
+ this.positionStickyCartEl();
516
+ }
517
+ /** Sets the value of form submission status*/
518
+ async setSubmitFormState(value) {
519
+ this.formState = value;
520
+ }
521
+ render() {
522
+ return (h(Host, { key: 'e7d2ab1d76e8ad347393bde30d0d71a7425ca2f7' }, h("div", { key: 'af251291fbb1cdf8c6eb1c3928f1fcd99181fa25', class: { configurator: true, [`${this.theme}`]: true } }, this.isLoading ? this.renderPlaceholder() : state.data && [this.renderOffer(), this.renderCart()]), this.renderCheckoutForm(), this.renderConfirmationDialog(), this.renderSubmissionStateDialog()));
523
+ }
524
+ get hostElement() { return getElement(this); }
525
+ static get watchers() { return {
526
+ "activePrimaryCategoryId": ["resetSelectedPrimaryCards"],
527
+ "activeSecondaryCategoryId": ["resetSelectedSecondaryCards"]
528
+ }; }
529
+ };
530
+ TetB2bConfigurator.style = TetB2bConfiguratorStyle0;
531
+
532
+ export { TetB2bConfigurator as tet_b2b_configurator };
@@ -58,7 +58,7 @@ const TetB2bServiceCalculator = class {
58
58
  processTranslations('tet-components', this.language).then(() => forceUpdate(this));
59
59
  }
60
60
  render() {
61
- return (h("section", { key: '7249b0c2f37af39e860637cfe416182c5227c6d2', class: "container" }, h("div", { key: '89565a9f35411aa6a542582b77df0b9b9da03e0e', class: "title-block" }, translate('components-b2b-calculator-title')), h("div", { key: '433eff5a8e863475880f8cf0216d1f604b7f74ce', class: "calculator-block" }, h("p", { key: '1b81e92aa9b7c58543257ea906c2177108b5c3e5', class: "slider-title" }, translate('components-b2b-calculator-computer-count')), h("tet-range-slider", { key: 'c5ce8ce5c73329b07f9df3b22aa2f243c56ca1e9', class: "slider", size: "large", type: "primary", defaultValue: 75, maxValue: 100, withControls: false, withInput: false, dataPoints: [1, 20, 40, 60, 80, 100], displayDataPoints: [1, 20, 40, 60, 80, 100], lockToDataPoint: false }), h("div", { key: '69d35eac4899ba24153253d1a70984c60de6ee4f', class: "control-container" }, h("div", { key: '53f8d6355652051ca9e455769a32b1ee127a1a7d', class: "control" }, h("tet-checkbox", { key: 'adfd75a801a68e6ba794d27735d595dddfc9c901', class: "it-admin-checkbox", checked: this.withItAdmin, onCheck: this.handleWithItAdminValueChange }, translate('components-b2b-calculator-it-admin-checkbox-label'))), h("div", { key: '000d314c262c7688e1ca5aed97dc84d0c72955e2', class: "control" }, h("tet-switch", { key: '8a423a478675117419a6c2ce02dd37962d4741e0', class: "in-person-support-switch", checked: this.withInPersonServiceSupport, onCheck: this.handleInPersonServiceSupportValueChange }, translate('components-b2b-calculator-in-person-support-switch-label')))), h("div", { key: '9d869285131a855b2b9caf6d8ffe6100ab09df8f', class: "monthly-payment-block" }, h("p", { key: '08248a6283d71227e0350b4c0ff092993c86aa56', class: "title" }, translate('components-b2b-calculator-potential-monthly-payment')), h("p", { key: 'cf137d3eed20a677c934f1dacdf8624bce437d70' }, h("span", { key: '070d5c3458a67c444c779e62fe522f3cda3dbb2a', class: "price" }, this.totalPrice), h("span", { key: 'f176b1e11123c143f0c63267256ec1484df38eec', class: "currency" }, translate('components-euro-per-month')))))));
61
+ return (h("section", { key: '326aaa3f71423e90e2b453e5cc8b1df96689a8bc', class: "container" }, h("div", { key: 'f51769d2182670107b7a43467781160486c0f029', class: "title-block" }, translate('components-b2b-calculator-title')), h("div", { key: 'b4ff5d39a203c91ade560be83be338166d8b9ff0', class: "calculator-block" }, h("p", { key: 'c1e8ac5d2b37d8a324acf7b3da046c29e1383c75', class: "slider-title" }, translate('components-b2b-calculator-computer-count')), h("tet-range-slider", { key: '81d57baa4df911bbeceb6ba2a6c67bcd07a09a90', class: "slider", size: "large", type: "primary", defaultValue: 75, maxValue: 100, withControls: false, withInput: false, dataPoints: [1, 20, 40, 60, 80, 100], displayDataPoints: [1, 20, 40, 60, 80, 100], lockToDataPoint: false }), h("div", { key: '410efdef7d65e976e94dd7040c4d7faa1d52e32b', class: "control-container" }, h("div", { key: '931c43b16c415ab0075a9fbc9f4710210ed0a5f4', class: "control" }, h("tet-checkbox", { key: '6df1d34cb7670a01213ee83f8c3d33529f13bef6', class: "it-admin-checkbox", checked: this.withItAdmin, onCheck: this.handleWithItAdminValueChange }, translate('components-b2b-calculator-it-admin-checkbox-label'))), h("div", { key: '1584213b5b9f61d97be033f37e1e0d82dafedc78', class: "control" }, h("tet-switch", { key: 'd02d94c371e55119eceea25d187346cb13cd2071', class: "in-person-support-switch", checked: this.withInPersonServiceSupport, onCheck: this.handleInPersonServiceSupportValueChange }, translate('components-b2b-calculator-in-person-support-switch-label')))), h("div", { key: '4a2b3bd7bdc6f893e644480e4d234f140df41931', class: "monthly-payment-block" }, h("p", { key: '390d38acfbc980da72a405639ff1c5b14bc6402a', class: "title" }, translate('components-b2b-calculator-potential-monthly-payment')), h("p", { key: '5c159aef3379a1c4c321959c9512dc733d509ebd' }, h("span", { key: 'd84fc849ac203fc4fe0199759263ee39959a594d', class: "price" }, this.totalPrice), h("span", { key: 'a8cf396d4fa1ea083833dd276fb45b0c6d73e7c2', class: "currency" }, translate('components-euro-per-month')))))));
62
62
  }
63
63
  static get watchers() { return {
64
64
  "language": ["onLanguageChange"],
@@ -8,7 +8,7 @@ const TetBorderRadius = class {
8
8
  registerInstance(this, hostRef);
9
9
  }
10
10
  render() {
11
- return (h(Host, { key: '824695af0bdc8618a5e13312583d930394edc062' }, h("div", { key: '4e31fd7b1c02f20521dcaa12e4865d7c24396901', class: "variable-container" }, h("div", { key: 'e0d904db4a4c55f1a1d3bd7f38e85978b649335d', class: "container-title main" }, "Border r\u0101diusa klase"), h("div", { key: 'c47184e263ee3c30b9610706ec6c01f57fd1652f', class: "container-section" }, h("div", { key: '180d3bd4ee52825beae42d95f940dc274eb2aad9', class: "variable-name" }, h("div", { key: '562879900d54b23f887693c42d117f00e2ae7875', class: "variable-part" }, "tet"), h("div", { key: '292ca9d4d99a3b25627f32d6e9b2faae80c677eb', class: "variable-part" }, "-border"), h("div", { key: '5039dae824531f3bcfd7445e703184be18652fd4', class: "variable-part variable variable-type" }, "-radius"), h("div", { key: '109b76eb35e05e3ff8f6dab3624e4e60d46d959b', class: "variable-part variable variable-size" }, "--md")))), h("div", { key: '74579cdac69de91f4046335008b3b713ebfc133e', class: "tet-fonts-container" }, h("div", { key: 'f220407e26557e647534797a68fadc222289cb22', class: "container-title" }, "R\u0101diusa izm\u0113ri"), h("div", { key: 'f35b2dc9ac52b8d3a57e97604c0b738de16bb804', class: "section" }, h("div", { key: '6f8db5b529707d796f13d1bcaff5790ba81ce1fd', class: "section-variable" }, h("div", { key: '8a2a872d7d70b63ba56e8d73f0e5e7933689c1e5', class: "border tet-border-radius--xs" }), h("div", { key: 'bf83b4833fe57bb5dd482aa0675a076935899207', class: "section-font-class" }, "klase: tet-border-radius--xs"), h("div", { key: '4af7748836ce92d5e036cdb8fc7299d3af1d1660', class: "section-font-size" }, "border radius: 0.25rem / 4px")), h("div", { key: '1b56a0e9bb9af0fe97ef722e9b9f6c3dd76ad07a', class: "section-variable" }, h("div", { key: '5306079890e8227554c7ba9786f5f43dd66049d7', class: "border tet-border-radius--sm" }), h("div", { key: 'f127eceacf5c5f9e1deab915633c974ea3de290b', class: "section-font-class" }, "klase: tet-border-radius--sm"), h("div", { key: 'cea678272d74df702dea10996a800d521feaede7', class: "section-font-size" }, "border radius: 0.5rem / 8px")), h("div", { key: '1f97acd42cac01d8fb04fc4a2c67cbfd4035b585', class: "section-variable" }, h("div", { key: '052b51da4fa0ef6be8c32f8a530c473260807f4b', class: "border tet-border-radius--md" }), h("div", { key: 'd7090e283161c6b6a038afe526913fa4f0dd26da', class: "section-font-class" }, "klase: tet-border-radius--md"), h("div", { key: 'c481386916cb419d593fbfa7550b3606e9148902', class: "section-font-size" }, "border radius: 1rem / 16px")), h("div", { key: 'e970f004eb83f1834d59f1fda7646b90cf7dcad9', class: "section-variable" }, h("div", { key: 'c0bea393cff284d5809e8121cd1a815050622deb', class: "border tet-border-radius--lg" }), h("div", { key: '77ace4611d911356a5d0a33c0e51c392f369665c', class: "section-font-class" }, "klase: tet-border-radius--lg"), h("div", { key: 'e97f9d8e7f79ec085259b4f9614a730557e3ea13', class: "section-font-size" }, "border radius: 1.5rem / 24px"), h("div", { key: '01940f7bbadc90c5ab5257cc0a297ce726303642', class: "section-font-size" })), h("div", { key: '3493b74fe5050e5c8fda7e2eec7d5debdfde295c', class: "section-variable" }, h("div", { key: '130f8eb3c9f40b0fa7f314658f15309b58d7ffc7', class: "border tet-border-radius--xl" }), h("div", { key: '94aba6bdcf8bea0942efa3d123c59a7b58eaac8a', class: "section-font-class" }, "klase: tet-border-radius--xl"), h("div", { key: '5cab0eecd699064182b7ebf755ff82ceff103a97', class: "section-font-size" }, "border radius: 2rem / 32px"))))));
11
+ return (h(Host, { key: '0c5eb1c84e6e12c139d336156876f885e8e1898a' }, h("div", { key: '9248d0401161eebfcfd10501d8dd6f6ceabe175a', class: "variable-container" }, h("div", { key: '61bd6a861a441a8aadde002186e9457d914ba865', class: "container-title main" }, "Border r\u0101diusa klase"), h("div", { key: '043c430f505327a438222f84b4f73a91756334ee', class: "container-section" }, h("div", { key: 'ae0be152784b0e8a9e26ed5e673a9b30e60399ad', class: "variable-name" }, h("div", { key: '23fd45b7c6613a18bc6506424a2f13996292847d', class: "variable-part" }, "tet"), h("div", { key: 'cda3e2cbf73ac3566d4b4964b228e3e48896ce3c', class: "variable-part" }, "-border"), h("div", { key: '27f6b71a88fa0b11b0c4685b4b18c43473423d01', class: "variable-part variable variable-type" }, "-radius"), h("div", { key: 'e5aa2b931e3c1d6dd34fd1519f458f4e41c5fa7d', class: "variable-part variable variable-size" }, "--md")))), h("div", { key: 'fad020daf0f44bd1efd666e5ae411ec011d27c59', class: "tet-fonts-container" }, h("div", { key: 'a88e76bdc8b5d9fa04a0e0573c45b737c6b5f8f2', class: "container-title" }, "R\u0101diusa izm\u0113ri"), h("div", { key: 'ccfbcefd5f05695551d9cf457cc79ef3d369088e', class: "section" }, h("div", { key: 'a1973d56c4750d9092ab90e116d63cc5cf220f81', class: "section-variable" }, h("div", { key: '236333eaf96e2b5fb5fecf0ad19b061c33e6aa52', class: "border tet-border-radius--xs" }), h("div", { key: 'a92a1a73f2fd5064085739390bc0db07f87f5fc9', class: "section-font-class" }, "klase: tet-border-radius--xs"), h("div", { key: 'e0d3ff6dcda4c447af035ba3fb002fae6f0273e5', class: "section-font-size" }, "border radius: 0.25rem / 4px")), h("div", { key: '5420af14d7b7108aef3623b466f64891917d9c39', class: "section-variable" }, h("div", { key: 'b2e230c6db68fa056d978d73b29af7af84e5d3eb', class: "border tet-border-radius--sm" }), h("div", { key: 'bc9e400dcabe3ea2762214ace88460c7d002353f', class: "section-font-class" }, "klase: tet-border-radius--sm"), h("div", { key: 'd879a43edf304ea81966abc095d288615e0ecdf3', class: "section-font-size" }, "border radius: 0.5rem / 8px")), h("div", { key: '2d8b7886bb4fd1b485d3410d821d5d044f29ea23', class: "section-variable" }, h("div", { key: 'cc11f623e5961d2db0add84c09cdec8df723faaa', class: "border tet-border-radius--md" }), h("div", { key: '6ffb3fedefffceeb5c33248590e8fc960b531173', class: "section-font-class" }, "klase: tet-border-radius--md"), h("div", { key: '9416af782ca35536e6307cb447bb86088b510577', class: "section-font-size" }, "border radius: 1rem / 16px")), h("div", { key: 'f8b41b2d8b853234822373f27f7a4d33be1dac27', class: "section-variable" }, h("div", { key: 'ba086e73096f88b012543f050301088d83d08d4a', class: "border tet-border-radius--lg" }), h("div", { key: '8cf744af670b89da06d651fe9015fb7c49b022ad', class: "section-font-class" }, "klase: tet-border-radius--lg"), h("div", { key: 'f798358f8ddeeb92cb36fe1d4f4b54a2855d8bc8', class: "section-font-size" }, "border radius: 1.5rem / 24px"), h("div", { key: 'eeed99048ab43f86ba0ae5c059bc3f1de84be8a8', class: "section-font-size" })), h("div", { key: '3f984951f3deeac4522ce3284dd795697e92835d', class: "section-variable" }, h("div", { key: '500eaa605db810378b1cd42595721a992010f94f', class: "border tet-border-radius--xl" }), h("div", { key: 'c6066d4b0c9f9a5fba13cfbf67cca06c3d8b228d', class: "section-font-class" }, "klase: tet-border-radius--xl"), h("div", { key: 'dd02e958c143326db12a5e0268d9133e8c7b6ecc', class: "section-font-size" }, "border radius: 2rem / 32px"))))));
12
12
  }
13
13
  };
14
14
  TetBorderRadius.style = TetBorderRadiusStyle0;
@@ -66,7 +66,7 @@ const TetBusinessLines = class {
66
66
  }
67
67
  render() {
68
68
  var _a;
69
- return (h("div", { key: '662ada195159db350c1c297f8c07a0e344d45cb2', class: "container" }, this.showHeadings && this.renderHeadings(), h("div", { key: 'ae66eb988b9c4f8b78ca265bb30b853cda6b6993', class: "business-line-wrapper" }, (_a = this.businessLines) === null || _a === void 0 ? void 0 : _a.map(this.renderBusinessLineItem))));
69
+ return (h("div", { key: '373ee3335a2e897763556faedda0720e437f5894', class: "container" }, this.showHeadings && this.renderHeadings(), h("div", { key: '1d4b289bcec43264aa7f12d2bd82aa300638b0de', class: "business-line-wrapper" }, (_a = this.businessLines) === null || _a === void 0 ? void 0 : _a.map(this.renderBusinessLineItem))));
70
70
  }
71
71
  static get watchers() { return {
72
72
  "language": ["onLanguageChange"],