@telia/teddy 0.7.37 → 0.7.39

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 (61) hide show
  1. package/dist/components/checkbox-card-group/checkbox-card-group-content.cjs +1 -0
  2. package/dist/components/checkbox-card-group/checkbox-card-group-content.js +1 -0
  3. package/dist/components/checkbox-card-group/checkbox-card-group-indicator.cjs +1 -0
  4. package/dist/components/checkbox-card-group/checkbox-card-group-indicator.js +1 -0
  5. package/dist/components/checkbox-card-group/checkbox-card-group-item-title.cjs +1 -0
  6. package/dist/components/checkbox-card-group/checkbox-card-group-item-title.js +1 -0
  7. package/dist/components/checkbox-card-group/checkbox-card-group-item.cjs +1 -0
  8. package/dist/components/checkbox-card-group/checkbox-card-group-item.js +1 -0
  9. package/dist/components/expandable-card/expandable-card-root.cjs +15 -15
  10. package/dist/components/expandable-card/expandable-card-root.js +15 -15
  11. package/dist/components/index.cjs +4 -0
  12. package/dist/components/index.d.ts +1 -0
  13. package/dist/components/index.js +4 -0
  14. package/dist/components/modal/modal-close.cjs +1 -0
  15. package/dist/components/modal/modal-close.js +1 -0
  16. package/dist/components/navigation-menu/navigation-menu.cjs +1 -0
  17. package/dist/components/navigation-menu/navigation-menu.js +1 -0
  18. package/dist/components/radio-card-group/radio-card-group-content.cjs +1 -0
  19. package/dist/components/radio-card-group/radio-card-group-content.js +1 -0
  20. package/dist/components/radio-card-group/radio-card-group-item-title.cjs +1 -0
  21. package/dist/components/radio-card-group/radio-card-group-item-title.js +1 -0
  22. package/dist/components/radio-card-group/radio-card-group-item.cjs +1 -0
  23. package/dist/components/radio-card-group/radio-card-group-item.js +1 -0
  24. package/dist/components/shopping-cart/index.cjs +21 -0
  25. package/dist/components/shopping-cart/index.d.ts +42 -0
  26. package/dist/components/shopping-cart/index.js +21 -0
  27. package/dist/components/shopping-cart/shopping-cart-context.cjs +13 -0
  28. package/dist/components/shopping-cart/shopping-cart-context.d.ts +8 -0
  29. package/dist/components/shopping-cart/shopping-cart-context.js +13 -0
  30. package/dist/components/shopping-cart/shopping-cart-continue.cjs +9 -0
  31. package/dist/components/shopping-cart/shopping-cart-continue.d.ts +8 -0
  32. package/dist/components/shopping-cart/shopping-cart-continue.js +9 -0
  33. package/dist/components/shopping-cart/shopping-cart-disclaimer.cjs +74 -0
  34. package/dist/components/shopping-cart/shopping-cart-disclaimer.d.ts +10 -0
  35. package/dist/components/shopping-cart/shopping-cart-disclaimer.js +74 -0
  36. package/dist/components/shopping-cart/shopping-cart-item.cjs +268 -0
  37. package/dist/components/shopping-cart/shopping-cart-item.d.ts +11 -0
  38. package/dist/components/shopping-cart/shopping-cart-item.js +268 -0
  39. package/dist/components/shopping-cart/shopping-cart-items.cjs +19 -0
  40. package/dist/components/shopping-cart/shopping-cart-items.d.ts +11 -0
  41. package/dist/components/shopping-cart/shopping-cart-items.js +19 -0
  42. package/dist/components/shopping-cart/shopping-cart-payment.cjs +119 -0
  43. package/dist/components/shopping-cart/shopping-cart-payment.d.ts +19 -0
  44. package/dist/components/shopping-cart/shopping-cart-payment.js +119 -0
  45. package/dist/components/shopping-cart/shopping-cart-root.cjs +14 -0
  46. package/dist/components/shopping-cart/shopping-cart-root.d.ts +10 -0
  47. package/dist/components/shopping-cart/shopping-cart-root.js +14 -0
  48. package/dist/components/shopping-cart/types.cjs +30 -0
  49. package/dist/components/shopping-cart/types.d.ts +193 -0
  50. package/dist/components/shopping-cart/types.js +30 -0
  51. package/dist/components/shopping-cart/utils.cjs +62 -0
  52. package/dist/components/shopping-cart/utils.d.ts +6 -0
  53. package/dist/components/shopping-cart/utils.js +62 -0
  54. package/dist/components/textarea/textarea-group.cjs +12 -12
  55. package/dist/components/textarea/textarea-group.js +12 -12
  56. package/dist/main.cjs +4 -0
  57. package/dist/main.js +4 -0
  58. package/dist/shopping-cart.module-BCoLrcMI.cjs +48 -0
  59. package/dist/shopping-cart.module-DA25l2hr.js +49 -0
  60. package/dist/style.css +995 -510
  61. package/package.json +1 -1
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ require("../../assets/sprite.6511e521-teddy.svg");
5
+ const components_icon_icon = require("../icon/icon.cjs");
6
+ const components_tooltip_index = require("../tooltip/index.cjs");
7
+ const components_progressBar_progressBar = require("../progress-bar/progress-bar.cjs");
8
+ const components_shoppingCart_shoppingCartContext = require("./shopping-cart-context.cjs");
9
+ const shoppingCart_module = require("../../shopping-cart.module-BCoLrcMI.cjs");
10
+ const MonthlyPriceDetailsDisplay = ({ monthlyPriceDetails, totalPriceMonthly }) => {
11
+ const { formatPrice } = components_shoppingCart_shoppingCartContext.useShoppingCart();
12
+ if (!monthlyPriceDetails || monthlyPriceDetails.length === 0) {
13
+ return null;
14
+ }
15
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceMonthlyDetails, children: [
16
+ monthlyPriceDetails.map(({ label, value }, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceRow, children: [
17
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
18
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: value })
19
+ ] }, `price-detail-${index}`)),
20
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${shoppingCart_module.styles.priceRow} ${shoppingCart_module.styles.priceMonthlyDetailsTotal}`, children: [
21
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Totalt pr. md." }),
22
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: shoppingCart_module.styles.labelMedium, children: [
23
+ formatPrice(totalPriceMonthly || 0),
24
+ "/md."
25
+ ] })
26
+ ] })
27
+ ] });
28
+ };
29
+ const Payment = ({
30
+ delivery,
31
+ totalPriceUpfront,
32
+ totalPriceMonthly,
33
+ totalPriceFirstInvoice,
34
+ paymentTooltip,
35
+ monthlyPriceDetails,
36
+ totalVAT,
37
+ totalPriceWithoutVAT
38
+ }) => {
39
+ const { formatPrice, hasPaid } = components_shoppingCart_shoppingCartContext.useShoppingCart();
40
+ const hasDelivery = delivery && Object.keys(delivery).length > 0;
41
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: shoppingCart_module.styles.section, children: [
42
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.sectionInner, children: [
43
+ hasDelivery && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.deliveryContainer, children: [
44
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.deliveryLeft, children: [
45
+ /* @__PURE__ */ jsxRuntime.jsx(components_icon_icon.Icon, { name: delivery.icon || "delivery", className: shoppingCart_module.styles.deliveryIcon }),
46
+ delivery.label || "Levering"
47
+ ] }),
48
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: delivery.value })
49
+ ] }),
50
+ hasDelivery && delivery.progressBar && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.deliveryProgressbar, children: [
51
+ delivery.progressBar.text || /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.deliveryProgressbarText, children: [
52
+ "Du har",
53
+ " ",
54
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: shoppingCart_module.styles.labelMedium, children: [
55
+ Math.ceil(delivery.progressBar.max - delivery.progressBar.progress),
56
+ ",-"
57
+ ] }),
58
+ " ",
59
+ "igjen til ",
60
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: "fri frakt" })
61
+ ] }),
62
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: shoppingCart_module.styles.progressBarWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
63
+ components_progressBar_progressBar.ProgressBar,
64
+ {
65
+ colorTheme: "light",
66
+ progress: delivery.progressBar.max > delivery.progressBar.min ? (delivery.progressBar.progress - delivery.progressBar.min) / (delivery.progressBar.max - delivery.progressBar.min) * 100 : 0
67
+ }
68
+ ) })
69
+ ] }),
70
+ hasDelivery && !!totalPriceMonthly && /* @__PURE__ */ jsxRuntime.jsx("hr", { className: shoppingCart_module.styles.horizontalRule }),
71
+ !!totalPriceMonthly && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceMonthlyContainer, children: [
72
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceRow, children: [
73
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.flexRow, children: [
74
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: "Betale pr md:" }),
75
+ paymentTooltip && /* @__PURE__ */ jsxRuntime.jsxs(components_tooltip_index.Tooltip, { children: [
76
+ /* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Trigger, { className: shoppingCart_module.styles.tooltipTrigger }),
77
+ /* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Content, { className: shoppingCart_module.styles.tooltipContent, children: /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: paymentTooltip } }) })
78
+ ] })
79
+ ] }),
80
+ (!monthlyPriceDetails || monthlyPriceDetails.length === 0) && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: shoppingCart_module.styles.labelMedium, children: [
81
+ formatPrice(totalPriceMonthly),
82
+ "/md."
83
+ ] })
84
+ ] }),
85
+ /* @__PURE__ */ jsxRuntime.jsx(
86
+ MonthlyPriceDetailsDisplay,
87
+ {
88
+ monthlyPriceDetails,
89
+ totalPriceMonthly
90
+ }
91
+ )
92
+ ] })
93
+ ] }),
94
+ (!!totalPriceUpfront || !!totalPriceFirstInvoice) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceUpfrontContainer, children: [
95
+ !!totalPriceWithoutVAT && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceRow, children: [
96
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: "Sum:" }),
97
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: formatPrice(totalPriceWithoutVAT) })
98
+ ] }),
99
+ !!totalVAT && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceRow, children: [
100
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: "MVA:" }),
101
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: formatPrice(totalVAT) })
102
+ ] }),
103
+ !!totalPriceUpfront && !hasPaid && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceRow, children: [
104
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: "Betale nå:" }),
105
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: formatPrice(totalPriceUpfront) })
106
+ ] }),
107
+ !!totalPriceUpfront && hasPaid && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceRow, children: [
108
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: "Betalt:" }),
109
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: formatPrice(totalPriceUpfront) })
110
+ ] }),
111
+ !!totalPriceFirstInvoice && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.priceRow, children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: "Å betale på første faktura:" }),
113
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: shoppingCart_module.styles.labelMedium, children: formatPrice(totalPriceFirstInvoice) })
114
+ ] })
115
+ ] })
116
+ ] });
117
+ };
118
+ Payment.displayName = "Payment";
119
+ exports.Payment = Payment;
@@ -0,0 +1,19 @@
1
+ import { CartDelivery } from './types';
2
+
3
+ export interface PaymentProps {
4
+ delivery?: CartDelivery;
5
+ totalPriceFirstInvoice?: number;
6
+ totalPriceMonthly?: number;
7
+ paymentTooltip?: string;
8
+ monthlyPriceDetails?: {
9
+ label: string;
10
+ value: string;
11
+ }[];
12
+ totalPriceUpfront?: number;
13
+ totalVAT?: number;
14
+ totalPriceWithoutVAT?: number;
15
+ }
16
+ export declare const Payment: {
17
+ ({ delivery, totalPriceUpfront, totalPriceMonthly, totalPriceFirstInvoice, paymentTooltip, monthlyPriceDetails, totalVAT, totalPriceWithoutVAT, }: PaymentProps): import("react/jsx-runtime").JSX.Element;
18
+ displayName: string;
19
+ };
@@ -0,0 +1,119 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import "../../assets/sprite.6511e521-teddy.svg";
3
+ import { Icon } from "../icon/icon.js";
4
+ import { Tooltip } from "../tooltip/index.js";
5
+ import { ProgressBar } from "../progress-bar/progress-bar.js";
6
+ import { useShoppingCart } from "./shopping-cart-context.js";
7
+ import { s as styles } from "../../shopping-cart.module-DA25l2hr.js";
8
+ const MonthlyPriceDetailsDisplay = ({ monthlyPriceDetails, totalPriceMonthly }) => {
9
+ const { formatPrice } = useShoppingCart();
10
+ if (!monthlyPriceDetails || monthlyPriceDetails.length === 0) {
11
+ return null;
12
+ }
13
+ return /* @__PURE__ */ jsxs("div", { className: styles.priceMonthlyDetails, children: [
14
+ monthlyPriceDetails.map(({ label, value }, index) => /* @__PURE__ */ jsxs("div", { className: styles.priceRow, children: [
15
+ /* @__PURE__ */ jsx("span", { children: label }),
16
+ /* @__PURE__ */ jsx("span", { children: value })
17
+ ] }, `price-detail-${index}`)),
18
+ /* @__PURE__ */ jsxs("div", { className: `${styles.priceRow} ${styles.priceMonthlyDetailsTotal}`, children: [
19
+ /* @__PURE__ */ jsx("span", { children: "Totalt pr. md." }),
20
+ /* @__PURE__ */ jsxs("span", { className: styles.labelMedium, children: [
21
+ formatPrice(totalPriceMonthly || 0),
22
+ "/md."
23
+ ] })
24
+ ] })
25
+ ] });
26
+ };
27
+ const Payment = ({
28
+ delivery,
29
+ totalPriceUpfront,
30
+ totalPriceMonthly,
31
+ totalPriceFirstInvoice,
32
+ paymentTooltip,
33
+ monthlyPriceDetails,
34
+ totalVAT,
35
+ totalPriceWithoutVAT
36
+ }) => {
37
+ const { formatPrice, hasPaid } = useShoppingCart();
38
+ const hasDelivery = delivery && Object.keys(delivery).length > 0;
39
+ return /* @__PURE__ */ jsxs("section", { className: styles.section, children: [
40
+ /* @__PURE__ */ jsxs("div", { className: styles.sectionInner, children: [
41
+ hasDelivery && /* @__PURE__ */ jsxs("div", { className: styles.deliveryContainer, children: [
42
+ /* @__PURE__ */ jsxs("div", { className: styles.deliveryLeft, children: [
43
+ /* @__PURE__ */ jsx(Icon, { name: delivery.icon || "delivery", className: styles.deliveryIcon }),
44
+ delivery.label || "Levering"
45
+ ] }),
46
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: delivery.value })
47
+ ] }),
48
+ hasDelivery && delivery.progressBar && /* @__PURE__ */ jsxs("div", { className: styles.deliveryProgressbar, children: [
49
+ delivery.progressBar.text || /* @__PURE__ */ jsxs("div", { className: styles.deliveryProgressbarText, children: [
50
+ "Du har",
51
+ " ",
52
+ /* @__PURE__ */ jsxs("span", { className: styles.labelMedium, children: [
53
+ Math.ceil(delivery.progressBar.max - delivery.progressBar.progress),
54
+ ",-"
55
+ ] }),
56
+ " ",
57
+ "igjen til ",
58
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: "fri frakt" })
59
+ ] }),
60
+ /* @__PURE__ */ jsx("div", { className: styles.progressBarWrapper, children: /* @__PURE__ */ jsx(
61
+ ProgressBar,
62
+ {
63
+ colorTheme: "light",
64
+ progress: delivery.progressBar.max > delivery.progressBar.min ? (delivery.progressBar.progress - delivery.progressBar.min) / (delivery.progressBar.max - delivery.progressBar.min) * 100 : 0
65
+ }
66
+ ) })
67
+ ] }),
68
+ hasDelivery && !!totalPriceMonthly && /* @__PURE__ */ jsx("hr", { className: styles.horizontalRule }),
69
+ !!totalPriceMonthly && /* @__PURE__ */ jsxs("div", { className: styles.priceMonthlyContainer, children: [
70
+ /* @__PURE__ */ jsxs("div", { className: styles.priceRow, children: [
71
+ /* @__PURE__ */ jsxs("div", { className: styles.flexRow, children: [
72
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: "Betale pr md:" }),
73
+ paymentTooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [
74
+ /* @__PURE__ */ jsx(Tooltip.Trigger, { className: styles.tooltipTrigger }),
75
+ /* @__PURE__ */ jsx(Tooltip.Content, { className: styles.tooltipContent, children: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: paymentTooltip } }) })
76
+ ] })
77
+ ] }),
78
+ (!monthlyPriceDetails || monthlyPriceDetails.length === 0) && /* @__PURE__ */ jsxs("span", { className: styles.labelMedium, children: [
79
+ formatPrice(totalPriceMonthly),
80
+ "/md."
81
+ ] })
82
+ ] }),
83
+ /* @__PURE__ */ jsx(
84
+ MonthlyPriceDetailsDisplay,
85
+ {
86
+ monthlyPriceDetails,
87
+ totalPriceMonthly
88
+ }
89
+ )
90
+ ] })
91
+ ] }),
92
+ (!!totalPriceUpfront || !!totalPriceFirstInvoice) && /* @__PURE__ */ jsxs("div", { className: styles.priceUpfrontContainer, children: [
93
+ !!totalPriceWithoutVAT && /* @__PURE__ */ jsxs("div", { className: styles.priceRow, children: [
94
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: "Sum:" }),
95
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: formatPrice(totalPriceWithoutVAT) })
96
+ ] }),
97
+ !!totalVAT && /* @__PURE__ */ jsxs("div", { className: styles.priceRow, children: [
98
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: "MVA:" }),
99
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: formatPrice(totalVAT) })
100
+ ] }),
101
+ !!totalPriceUpfront && !hasPaid && /* @__PURE__ */ jsxs("div", { className: styles.priceRow, children: [
102
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: "Betale nå:" }),
103
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: formatPrice(totalPriceUpfront) })
104
+ ] }),
105
+ !!totalPriceUpfront && hasPaid && /* @__PURE__ */ jsxs("div", { className: styles.priceRow, children: [
106
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: "Betalt:" }),
107
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: formatPrice(totalPriceUpfront) })
108
+ ] }),
109
+ !!totalPriceFirstInvoice && /* @__PURE__ */ jsxs("div", { className: styles.priceRow, children: [
110
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: "Å betale på første faktura:" }),
111
+ /* @__PURE__ */ jsx("span", { className: styles.labelMedium, children: formatPrice(totalPriceFirstInvoice) })
112
+ ] })
113
+ ] })
114
+ ] });
115
+ };
116
+ Payment.displayName = "Payment";
117
+ export {
118
+ Payment
119
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const components_heading_heading = require("../heading/heading.cjs");
5
+ const components_shoppingCart_shoppingCartContext = require("./shopping-cart-context.cjs");
6
+ const shoppingCart_module = require("../../shopping-cart.module-BCoLrcMI.cjs");
7
+ const Root = ({ heading, children, formatPrice, hasPaid, isAllowedToDelete }) => {
8
+ return /* @__PURE__ */ jsxRuntime.jsx(components_shoppingCart_shoppingCartContext.ShoppingCartProvider, { value: { formatPrice, hasPaid, isAllowedToDelete }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: shoppingCart_module.styles.shoppingCart, children: [
9
+ heading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: shoppingCart_module.styles.sectionInner, children: /* @__PURE__ */ jsxRuntime.jsx(components_heading_heading.Heading, { className: shoppingCart_module.styles.heading, as: "h2", variant: "title-100", children: heading }) }),
10
+ children
11
+ ] }) });
12
+ };
13
+ Root.displayName = "Root";
14
+ exports.Root = Root;
@@ -0,0 +1,10 @@
1
+ import { ShoppingCartContextValue } from './shopping-cart-context';
2
+
3
+ export interface RootProps extends ShoppingCartContextValue {
4
+ heading?: string;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const Root: {
8
+ ({ heading, children, formatPrice, hasPaid, isAllowedToDelete }: RootProps): import("react/jsx-runtime").JSX.Element;
9
+ displayName: string;
10
+ };
@@ -0,0 +1,14 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Heading } from "../heading/heading.js";
3
+ import { ShoppingCartProvider } from "./shopping-cart-context.js";
4
+ import { s as styles } from "../../shopping-cart.module-DA25l2hr.js";
5
+ const Root = ({ heading, children, formatPrice, hasPaid, isAllowedToDelete }) => {
6
+ return /* @__PURE__ */ jsx(ShoppingCartProvider, { value: { formatPrice, hasPaid, isAllowedToDelete }, children: /* @__PURE__ */ jsxs("div", { className: styles.shoppingCart, children: [
7
+ heading && /* @__PURE__ */ jsx("div", { className: styles.sectionInner, children: /* @__PURE__ */ jsx(Heading, { className: styles.heading, as: "h2", variant: "title-100", children: heading }) }),
8
+ children
9
+ ] }) });
10
+ };
11
+ Root.displayName = "Root";
12
+ export {
13
+ Root
14
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const CART_ITEM_TYPE = {
4
+ SUBSCRIPTION: "SUBSCRIPTION",
5
+ SUBSCRIPTION_DRAFT: "SUBSCRIPTION_DRAFT",
6
+ HANDSET: "HANDSET",
7
+ "HANDSET-PREOWNED": "HANDSET-PREOWNED",
8
+ MODEM: "MODEM",
9
+ TABLET: "TABLET",
10
+ WEARABLE: "WEARABLE",
11
+ CONNECTED_DEVICE: "CONNECTED_DEVICE",
12
+ ACCESSORY: "ACCESSORY",
13
+ DELIVERY: "DELIVERY",
14
+ WEBDEAL: "WEBDEAL",
15
+ SIM: "SIM",
16
+ ESIM: "ESIM",
17
+ NEW_NUMBER: "NEW_NUMBER",
18
+ BREAKAGE_FEE: "BREAKAGE_FEE",
19
+ SWITCH_BREAKAGE_FEE: "SWITCH_BREAKAGE_FEE",
20
+ SWITCH_REMAINING_COST: "SWITCH_REMAINING_COST",
21
+ IN_SHOP_SERVICE: "IN_SHOP_SERVICE",
22
+ SPECIALPRODUCT: "SPECIALPRODUCT",
23
+ SERVICE: "SERVICE",
24
+ VOUCHER: "VOUCHER",
25
+ RESWITCH_PLACEHOLDER: "RESWITCH_PLACEHOLDER",
26
+ RESWITCH_EXISTING_HARDWARE: "RESWITCH_EXISTING_HARDWARE",
27
+ PREPAID_REFILL: "PREPAID_REFILL",
28
+ TRANSFER: "TRANSFER"
29
+ };
30
+ exports.CART_ITEM_TYPE = CART_ITEM_TYPE;
@@ -0,0 +1,193 @@
1
+ export type CartType = 'SUBSCRIPTION' | 'SUBSCRIPTION_DRAFT' | 'HANDSET' | 'HANDSET-PREOWNED' | 'MODEM' | 'TABLET' | 'WEARABLE' | 'CONNECTED_DEVICE' | 'ACCESSORY' | 'DELIVERY' | 'WEBDEAL' | 'SIM' | 'ESIM' | 'NEW_NUMBER' | 'BREAKAGE_FEE' | 'SWITCH_BREAKAGE_FEE' | 'SWITCH_REMAINING_COST' | 'IN_SHOP_SERVICE' | 'SPECIALPRODUCT' | 'SERVICE' | 'VOUCHER' | 'RESWITCH_PLACEHOLDER' | 'RESWITCH_EXISTING_HARDWARE' | 'PREPAID_REFILL' | 'TRANSFER';
2
+ export declare const CART_ITEM_TYPE: {
3
+ readonly SUBSCRIPTION: "SUBSCRIPTION";
4
+ readonly SUBSCRIPTION_DRAFT: "SUBSCRIPTION_DRAFT";
5
+ readonly HANDSET: "HANDSET";
6
+ readonly 'HANDSET-PREOWNED': "HANDSET-PREOWNED";
7
+ readonly MODEM: "MODEM";
8
+ readonly TABLET: "TABLET";
9
+ readonly WEARABLE: "WEARABLE";
10
+ readonly CONNECTED_DEVICE: "CONNECTED_DEVICE";
11
+ readonly ACCESSORY: "ACCESSORY";
12
+ readonly DELIVERY: "DELIVERY";
13
+ readonly WEBDEAL: "WEBDEAL";
14
+ readonly SIM: "SIM";
15
+ readonly ESIM: "ESIM";
16
+ readonly NEW_NUMBER: "NEW_NUMBER";
17
+ readonly BREAKAGE_FEE: "BREAKAGE_FEE";
18
+ readonly SWITCH_BREAKAGE_FEE: "SWITCH_BREAKAGE_FEE";
19
+ readonly SWITCH_REMAINING_COST: "SWITCH_REMAINING_COST";
20
+ readonly IN_SHOP_SERVICE: "IN_SHOP_SERVICE";
21
+ readonly SPECIALPRODUCT: "SPECIALPRODUCT";
22
+ readonly SERVICE: "SERVICE";
23
+ readonly VOUCHER: "VOUCHER";
24
+ readonly RESWITCH_PLACEHOLDER: "RESWITCH_PLACEHOLDER";
25
+ readonly RESWITCH_EXISTING_HARDWARE: "RESWITCH_EXISTING_HARDWARE";
26
+ readonly PREPAID_REFILL: "PREPAID_REFILL";
27
+ readonly TRANSFER: "TRANSFER";
28
+ };
29
+ export type BadgeVariant = 'attention' | 'special' | 'neutral' | 'information' | 'success' | 'warning' | 'error';
30
+ export interface CartDiscountType {
31
+ id: 'commitment' | 'sameGroup' | 'hardcoded';
32
+ value: number;
33
+ text: string;
34
+ badgeVariant?: BadgeVariant;
35
+ }
36
+ interface CartSize {
37
+ amount: string;
38
+ unit: string;
39
+ }
40
+ interface CartFinancing {
41
+ type: string;
42
+ duration: string | number;
43
+ code: string;
44
+ }
45
+ interface CartSubscriptionPhoneNumberCheck {
46
+ type?: string;
47
+ isAllowedToProceed: boolean;
48
+ }
49
+ interface CartSubscriptionPhoneNumber {
50
+ selectedPhoneNumber: string;
51
+ check: CartSubscriptionPhoneNumberCheck;
52
+ }
53
+ interface CartSubscriptionProductUser {
54
+ firstName: string;
55
+ lastName: string;
56
+ birthDate: string;
57
+ street: string;
58
+ postcode: string;
59
+ city: string;
60
+ email: string;
61
+ }
62
+ interface CartSubscriptionReswitch {
63
+ ban: string;
64
+ imei: string;
65
+ phoneNumber: string;
66
+ ordererPhoneNumber: string;
67
+ missingExistingSwitchHandset: boolean;
68
+ initiatedBy: string;
69
+ handset?: unknown;
70
+ breakageFee?: unknown;
71
+ remainingCost?: number;
72
+ totalRemainingMonths?: number;
73
+ showSubscriptionListOnPdp: boolean;
74
+ }
75
+ interface CartSubscriptionExisting {
76
+ id: string;
77
+ name: string;
78
+ size: CartSize;
79
+ maxAgeAllowed: boolean;
80
+ isDataUnlimited: boolean;
81
+ price: CartSubscriptionPrice;
82
+ }
83
+ interface CartSubscriptionPriceMonthly {
84
+ amountSubscription: number;
85
+ amountBeforeDiscountSubscription: number | null;
86
+ infoHtmlSubscription: number | null;
87
+ }
88
+ interface CartSubscriptionPriceSpecial {
89
+ amountSubscription: number;
90
+ }
91
+ interface CartSubscriptionPrice {
92
+ monthly: CartSubscriptionPriceMonthly;
93
+ special?: CartSubscriptionPriceSpecial;
94
+ }
95
+ export interface CartSubscription {
96
+ type: CartType;
97
+ id: string;
98
+ code: string;
99
+ isLegal: boolean;
100
+ financing?: CartFinancing;
101
+ keepExistingSubscription?: boolean;
102
+ isPrepaidToPostpaid?: boolean;
103
+ isExistingPrepaidKBDSubscription?: boolean;
104
+ isDataUnlimited?: boolean;
105
+ phoneNumber: CartSubscriptionPhoneNumber;
106
+ reswitch?: CartSubscriptionReswitch | null;
107
+ existing?: CartSubscriptionExisting;
108
+ maxAgeAllowed?: number;
109
+ productUser: CartSubscriptionProductUser;
110
+ name: string;
111
+ size: CartSize;
112
+ price: CartSubscriptionPrice;
113
+ }
114
+ export interface CartSubscriptions {
115
+ [key: string]: CartSubscription;
116
+ }
117
+ interface CartItemQuantity {
118
+ modifiable?: boolean;
119
+ removable?: boolean;
120
+ value: number;
121
+ }
122
+ export interface CartItemPrice {
123
+ upfront?: number;
124
+ upfrontWithoutVAT?: number;
125
+ monthly?: number;
126
+ monthlyWithoutVAT?: number;
127
+ firstInvoice?: number;
128
+ originalSalesPrice?: number;
129
+ originalSalesPriceWithoutVAT?: number;
130
+ }
131
+ interface CartItemDiscountValue {
132
+ upfront?: number;
133
+ monthly?: number;
134
+ }
135
+ interface CartItemDiscount {
136
+ value: CartItemDiscountValue;
137
+ description?: string;
138
+ handsetDiscountText?: string;
139
+ types?: CartDiscountType[];
140
+ isManualDiscount?: boolean;
141
+ smartDiscountCode?: string;
142
+ isSmartDiscount?: boolean;
143
+ name?: string;
144
+ }
145
+ export interface CartItemImage {
146
+ url?: string;
147
+ icon?: string;
148
+ }
149
+ export interface CartItem {
150
+ type: CartType;
151
+ subtype?: string;
152
+ id: string;
153
+ code?: string;
154
+ bundleId?: string;
155
+ isLegal?: boolean;
156
+ name: string;
157
+ href?: string;
158
+ lineThrough?: string;
159
+ subtitle?: string | string[];
160
+ brand?: string;
161
+ brandSlug?: string;
162
+ model?: string;
163
+ modelSlug?: string;
164
+ modelSize?: string;
165
+ color?: string;
166
+ quantity: CartItemQuantity;
167
+ price: CartItemPrice;
168
+ discount?: CartItemDiscount;
169
+ image?: CartItemImage;
170
+ leaseMonths?: number | string | null;
171
+ isReSwitch?: boolean;
172
+ isWebDeal?: boolean;
173
+ items?: CartItem[];
174
+ onlyAvailableInShops?: boolean;
175
+ }
176
+ export interface CartDeliveryProgressBar {
177
+ min: number;
178
+ max: number;
179
+ progress: number;
180
+ text?: string;
181
+ }
182
+ export interface CartDelivery {
183
+ icon?: string;
184
+ label: string;
185
+ value: string | number;
186
+ progressBar?: CartDeliveryProgressBar;
187
+ }
188
+ export interface DisclaimerItem {
189
+ name: string;
190
+ total: number;
191
+ description?: string | string[];
192
+ }
193
+ export {};
@@ -0,0 +1,30 @@
1
+ const CART_ITEM_TYPE = {
2
+ SUBSCRIPTION: "SUBSCRIPTION",
3
+ SUBSCRIPTION_DRAFT: "SUBSCRIPTION_DRAFT",
4
+ HANDSET: "HANDSET",
5
+ "HANDSET-PREOWNED": "HANDSET-PREOWNED",
6
+ MODEM: "MODEM",
7
+ TABLET: "TABLET",
8
+ WEARABLE: "WEARABLE",
9
+ CONNECTED_DEVICE: "CONNECTED_DEVICE",
10
+ ACCESSORY: "ACCESSORY",
11
+ DELIVERY: "DELIVERY",
12
+ WEBDEAL: "WEBDEAL",
13
+ SIM: "SIM",
14
+ ESIM: "ESIM",
15
+ NEW_NUMBER: "NEW_NUMBER",
16
+ BREAKAGE_FEE: "BREAKAGE_FEE",
17
+ SWITCH_BREAKAGE_FEE: "SWITCH_BREAKAGE_FEE",
18
+ SWITCH_REMAINING_COST: "SWITCH_REMAINING_COST",
19
+ IN_SHOP_SERVICE: "IN_SHOP_SERVICE",
20
+ SPECIALPRODUCT: "SPECIALPRODUCT",
21
+ SERVICE: "SERVICE",
22
+ VOUCHER: "VOUCHER",
23
+ RESWITCH_PLACEHOLDER: "RESWITCH_PLACEHOLDER",
24
+ RESWITCH_EXISTING_HARDWARE: "RESWITCH_EXISTING_HARDWARE",
25
+ PREPAID_REFILL: "PREPAID_REFILL",
26
+ TRANSFER: "TRANSFER"
27
+ };
28
+ export {
29
+ CART_ITEM_TYPE
30
+ };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const defaultFormatPrice = (price) => {
4
+ if (typeof price === "number") {
5
+ return price % 1 === 0 ? price + ",-" : price + " kr";
6
+ }
7
+ return price;
8
+ };
9
+ const getDiscountPrice = (price, quantity) => {
10
+ if (!price || Object.keys(price).length === 0) {
11
+ return null;
12
+ }
13
+ if (typeof price.monthly === "number") {
14
+ return price.monthly;
15
+ }
16
+ if (typeof price.upfront === "number") {
17
+ return price.upfront * quantity;
18
+ }
19
+ return null;
20
+ };
21
+ const getPrice = (formatPriceFn, price, discountValueUpfront, discountValueMonthly, quantity) => {
22
+ if (!price || Object.keys(price).length === 0) {
23
+ return null;
24
+ }
25
+ if (typeof price.monthly === "number") {
26
+ const discountedMonthly = price.monthly - discountValueMonthly;
27
+ return formatPriceFn(discountedMonthly > 0 ? discountedMonthly : 0);
28
+ }
29
+ if (typeof price.firstInvoice === "number") {
30
+ return formatPriceFn(price.firstInvoice * quantity);
31
+ }
32
+ if (typeof price.upfront === "number") {
33
+ const discountedUpfront = price.upfront - discountValueUpfront;
34
+ const totalUpfront = (discountedUpfront > 0 ? discountedUpfront : 0) * quantity;
35
+ return formatPriceFn(totalUpfront);
36
+ }
37
+ return null;
38
+ };
39
+ const getCartItemPriority = (item) => {
40
+ const cartItemTypes = {
41
+ WEBDEAL: 10,
42
+ HANDSET: 20,
43
+ TABLET: 30,
44
+ MODEM: 40,
45
+ WEARABLE: 50,
46
+ CONNECTED_DEVICE: 60,
47
+ SUBSCRIPTION: 70,
48
+ SUBSCRIPTION_DRAFT: 70,
49
+ SPECIALPRODUCT: 71,
50
+ SIM: 80,
51
+ NEW_NUMBER: 90,
52
+ SERVICE: 100,
53
+ ACCESSORY: 110,
54
+ VOUCHER: 130
55
+ };
56
+ return cartItemTypes[item.type] ?? 999;
57
+ };
58
+ const sortByType = (items) => [...items].sort((a, b) => getCartItemPriority(a) - getCartItemPriority(b));
59
+ exports.defaultFormatPrice = defaultFormatPrice;
60
+ exports.getDiscountPrice = getDiscountPrice;
61
+ exports.getPrice = getPrice;
62
+ exports.sortByType = sortByType;
@@ -0,0 +1,6 @@
1
+ import { CartItem, CartItemPrice } from './types';
2
+
3
+ export declare const defaultFormatPrice: (price: string | number) => string;
4
+ export declare const getDiscountPrice: (price: CartItemPrice, quantity: number) => number | null;
5
+ export declare const getPrice: (formatPriceFn: (price: string | number) => string, price: CartItemPrice, discountValueUpfront: number, discountValueMonthly: number, quantity: number) => string | null;
6
+ export declare const sortByType: <T extends CartItem>(items: T[]) => T[];