@telia/teddy 0.7.71 → 0.7.72
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.
- package/dist/components/input/input-group.cjs +10 -10
- package/dist/components/input/input-group.js +10 -10
- package/dist/components/shopping-cart/shopping-cart-item.cjs +121 -102
- package/dist/components/shopping-cart/shopping-cart-item.js +121 -102
- package/dist/teddy.css +1 -1
- package/package.json +1 -1
|
@@ -7,17 +7,17 @@ require("../../assets/sprite.e6f9b678-teddy.svg");
|
|
|
7
7
|
const components_icon_icon = require("../icon/icon.cjs");
|
|
8
8
|
const components_spinner_spinner = require("../spinner/spinner.cjs");
|
|
9
9
|
const utils_composeRefs = require("../../utils/composeRefs.cjs");
|
|
10
|
-
const fadeInAnimation = "
|
|
11
|
-
const scaleInAnimation = "
|
|
10
|
+
const fadeInAnimation = "_fadeInAnimation_1feet_1";
|
|
11
|
+
const scaleInAnimation = "_scaleInAnimation_1feet_1";
|
|
12
12
|
const styles = {
|
|
13
|
-
"teddy-input__input": "_teddy-
|
|
14
|
-
"teddy-input": "_teddy-
|
|
15
|
-
"teddy-input__frame": "_teddy-
|
|
16
|
-
"teddy-input__clear-button": "_teddy-input__clear-
|
|
17
|
-
"teddy-input__input--valid": "_teddy-input__input--
|
|
18
|
-
"teddy-input__input--invalid": "_teddy-input__input--
|
|
19
|
-
"teddy-input__indicator": "_teddy-
|
|
20
|
-
"teddy-input__input--error": "_teddy-input__input--
|
|
13
|
+
"teddy-input__input": "_teddy-input__input_1feet_17",
|
|
14
|
+
"teddy-input": "_teddy-input_1feet_17",
|
|
15
|
+
"teddy-input__frame": "_teddy-input__frame_1feet_33",
|
|
16
|
+
"teddy-input__clear-button": "_teddy-input__clear-button_1feet_41",
|
|
17
|
+
"teddy-input__input--valid": "_teddy-input__input--valid_1feet_84",
|
|
18
|
+
"teddy-input__input--invalid": "_teddy-input__input--invalid_1feet_84",
|
|
19
|
+
"teddy-input__indicator": "_teddy-input__indicator_1feet_90",
|
|
20
|
+
"teddy-input__input--error": "_teddy-input__input--error_1feet_93",
|
|
21
21
|
fadeInAnimation,
|
|
22
22
|
scaleInAnimation
|
|
23
23
|
};
|
|
@@ -5,17 +5,17 @@ import "../../assets/sprite.e6f9b678-teddy.svg";
|
|
|
5
5
|
import { Icon } from "../icon/icon.js";
|
|
6
6
|
import { Spinner } from "../spinner/spinner.js";
|
|
7
7
|
import { useComposedRefs } from "../../utils/composeRefs.js";
|
|
8
|
-
const fadeInAnimation = "
|
|
9
|
-
const scaleInAnimation = "
|
|
8
|
+
const fadeInAnimation = "_fadeInAnimation_1feet_1";
|
|
9
|
+
const scaleInAnimation = "_scaleInAnimation_1feet_1";
|
|
10
10
|
const styles = {
|
|
11
|
-
"teddy-input__input": "_teddy-
|
|
12
|
-
"teddy-input": "_teddy-
|
|
13
|
-
"teddy-input__frame": "_teddy-
|
|
14
|
-
"teddy-input__clear-button": "_teddy-input__clear-
|
|
15
|
-
"teddy-input__input--valid": "_teddy-input__input--
|
|
16
|
-
"teddy-input__input--invalid": "_teddy-input__input--
|
|
17
|
-
"teddy-input__indicator": "_teddy-
|
|
18
|
-
"teddy-input__input--error": "_teddy-input__input--
|
|
11
|
+
"teddy-input__input": "_teddy-input__input_1feet_17",
|
|
12
|
+
"teddy-input": "_teddy-input_1feet_17",
|
|
13
|
+
"teddy-input__frame": "_teddy-input__frame_1feet_33",
|
|
14
|
+
"teddy-input__clear-button": "_teddy-input__clear-button_1feet_41",
|
|
15
|
+
"teddy-input__input--valid": "_teddy-input__input--valid_1feet_84",
|
|
16
|
+
"teddy-input__input--invalid": "_teddy-input__input--invalid_1feet_84",
|
|
17
|
+
"teddy-input__indicator": "_teddy-input__indicator_1feet_90",
|
|
18
|
+
"teddy-input__input--error": "_teddy-input__input--error_1feet_93",
|
|
19
19
|
fadeInAnimation,
|
|
20
20
|
scaleInAnimation
|
|
21
21
|
};
|
|
@@ -14,38 +14,39 @@ const components_tooltip_index = require("../tooltip/index.cjs");
|
|
|
14
14
|
const components_shoppingCart_types = require("./types.cjs");
|
|
15
15
|
const components_shoppingCart_shoppingCartContext = require("./shopping-cart-context.cjs");
|
|
16
16
|
const components_shoppingCart_utils = require("./utils.cjs");
|
|
17
|
-
const item = "
|
|
18
|
-
const breakageFeeInfo = "
|
|
19
|
-
const nameWrapper = "
|
|
20
|
-
const link = "
|
|
21
|
-
const cartLink = "
|
|
22
|
-
const discountDescription = "
|
|
23
|
-
const name = "
|
|
24
|
-
const nameContainer = "
|
|
25
|
-
const
|
|
26
|
-
const subtitleRow = "
|
|
27
|
-
const subtitlePriceInfo = "
|
|
28
|
-
const quantityPickerWrapper = "
|
|
29
|
-
const pricePer = "
|
|
30
|
-
const quantityPicker = "
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
17
|
+
const item = "_item_15muv_1";
|
|
18
|
+
const breakageFeeInfo = "_breakageFeeInfo_15muv_7";
|
|
19
|
+
const nameWrapper = "_nameWrapper_15muv_26";
|
|
20
|
+
const link = "_link_15muv_33";
|
|
21
|
+
const cartLink = "_cartLink_15muv_51";
|
|
22
|
+
const discountDescription = "_discountDescription_15muv_59";
|
|
23
|
+
const name = "_name_15muv_26";
|
|
24
|
+
const nameContainer = "_nameContainer_15muv_72";
|
|
25
|
+
const quantityWrapper = "_quantityWrapper_15muv_76";
|
|
26
|
+
const subtitleRow = "_subtitleRow_15muv_84";
|
|
27
|
+
const subtitlePriceInfo = "_subtitlePriceInfo_15muv_91";
|
|
28
|
+
const quantityPickerWrapper = "_quantityPickerWrapper_15muv_97";
|
|
29
|
+
const pricePer = "_pricePer_15muv_104";
|
|
30
|
+
const quantityPicker = "_quantityPicker_15muv_97";
|
|
31
|
+
const characteristics = "_characteristics_15muv_116";
|
|
32
|
+
const price = "_price_15muv_104";
|
|
33
|
+
const quantityContainer = "_quantityContainer_15muv_126";
|
|
34
|
+
const priceCost = "_priceCost_15muv_133";
|
|
35
|
+
const priceLabel = "_priceLabel_15muv_141";
|
|
36
|
+
const priceLinethrough = "_priceLinethrough_15muv_146";
|
|
37
|
+
const priceLinethroughDisclaimer = "_priceLinethroughDisclaimer_15muv_156";
|
|
38
|
+
const imageContainer = "_imageContainer_15muv_165";
|
|
39
|
+
const noImageContainer = "_noImageContainer_15muv_177";
|
|
40
|
+
const image = "_image_15muv_165";
|
|
41
|
+
const iconImage = "_iconImage_15muv_190";
|
|
42
|
+
const deleteButtonContainer = "_deleteButtonContainer_15muv_196";
|
|
43
|
+
const uniqueDiscount = "_uniqueDiscount_15muv_223";
|
|
44
|
+
const uniqueDiscountLabel = "_uniqueDiscountLabel_15muv_230";
|
|
45
|
+
const uniqueDiscountPrice = "_uniqueDiscountPrice_15muv_236";
|
|
46
|
+
const onlyInShops = "_onlyInShops_15muv_241";
|
|
47
|
+
const onlyInShopsLabel = "_onlyInShopsLabel_15muv_248";
|
|
48
|
+
const tooltipTrigger = "_tooltipTrigger_15muv_267";
|
|
49
|
+
const priceWrapper = "_priceWrapper_15muv_275";
|
|
49
50
|
const styles = {
|
|
50
51
|
item,
|
|
51
52
|
breakageFeeInfo,
|
|
@@ -55,14 +56,15 @@ const styles = {
|
|
|
55
56
|
discountDescription,
|
|
56
57
|
name,
|
|
57
58
|
nameContainer,
|
|
58
|
-
|
|
59
|
+
quantityWrapper,
|
|
59
60
|
subtitleRow,
|
|
60
61
|
subtitlePriceInfo,
|
|
61
62
|
quantityPickerWrapper,
|
|
62
63
|
pricePer,
|
|
63
64
|
quantityPicker,
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
characteristics,
|
|
66
|
+
price,
|
|
67
|
+
quantityContainer,
|
|
66
68
|
priceCost,
|
|
67
69
|
priceLabel,
|
|
68
70
|
priceLinethrough,
|
|
@@ -86,7 +88,7 @@ const QuantityPicker = ({
|
|
|
86
88
|
cartItem,
|
|
87
89
|
shouldShowPricePerUnit,
|
|
88
90
|
isQuantityModifiable,
|
|
89
|
-
price,
|
|
91
|
+
price: price2,
|
|
90
92
|
discountValueUpfront,
|
|
91
93
|
discountValueMonthly,
|
|
92
94
|
hasPaid
|
|
@@ -125,7 +127,7 @@ const QuantityPicker = ({
|
|
|
125
127
|
] }),
|
|
126
128
|
shouldShowPricePerUnit && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.pricePer, children: [
|
|
127
129
|
quantity > 1 && !isQuantityModifiable && `${quantity} x `,
|
|
128
|
-
`${components_shoppingCart_utils.getPrice(components_shoppingCart_utils.defaultFormatPrice,
|
|
130
|
+
`${components_shoppingCart_utils.getPrice(components_shoppingCart_utils.defaultFormatPrice, price2, discountValueUpfront, discountValueMonthly, 1)}/stk`
|
|
129
131
|
] })
|
|
130
132
|
] });
|
|
131
133
|
};
|
|
@@ -145,69 +147,35 @@ const CartItemImage = ({ cartItem }) => {
|
|
|
145
147
|
};
|
|
146
148
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.imageContainer, children: cartItem.href ? /* @__PURE__ */ jsxRuntime.jsx(components_link_link.Link, { href: cartItem.href, "aria-label": cartItem.name, variant: "navigation", className: styles.cartLink, children: renderImage() }) : renderImage() });
|
|
147
149
|
};
|
|
148
|
-
const
|
|
149
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
150
|
+
const CartItemDetails = ({ cartItem, hasPaid, onChangeQuantity }) => {
|
|
151
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
150
152
|
const { formatPrice, readonly } = components_shoppingCart_shoppingCartContext.useShoppingCart();
|
|
151
153
|
const quantity = ((_a = cartItem.quantity) == null ? void 0 : _a.value) ?? 1;
|
|
152
154
|
const isQuantityModifiable = !!((_b = cartItem.quantity) == null ? void 0 : _b.modifiable);
|
|
153
155
|
const shouldShowPricePerUnit = (!!cartItem.price.upfront || !!cartItem.price.firstInvoice) && quantity > 1;
|
|
154
156
|
const isManualDiscount = (_c = cartItem.discount) == null ? void 0 : _c.isManualDiscount;
|
|
155
157
|
const discountValueUpfront = isManualDiscount ? 0 : ((_e = (_d = cartItem.discount) == null ? void 0 : _d.value) == null ? void 0 : _e.upfront) || 0;
|
|
156
|
-
const
|
|
157
|
-
const hasSubscription = !!((_f = cartItem.items) == null ? void 0 : _f.find((item2) => item2.type.includes("SUBSCRIPTION")));
|
|
158
|
-
const discountValueMonthly = ((_h = (_g = cartItem.discount) == null ? void 0 : _g.value) == null ? void 0 : _h.monthly) || 0;
|
|
159
|
-
const discountPrice = components_shoppingCart_utils.getDiscountPrice(cartItem.price, quantity) || "";
|
|
160
|
-
const price = components_shoppingCart_utils.getPrice(formatPrice, cartItem.price, discountValueUpfront, discountValueMonthly, quantity);
|
|
161
|
-
const discountPriceText = ((_i = cartItem.discount) == null ? void 0 : _i.handsetDiscountText) || "";
|
|
158
|
+
const discountValueMonthly = ((_g = (_f = cartItem.discount) == null ? void 0 : _f.value) == null ? void 0 : _g.monthly) || 0;
|
|
162
159
|
const subtitles = (Array.isArray(cartItem.subtitle) ? cartItem.subtitle : [cartItem.subtitle]).filter(Boolean);
|
|
163
160
|
const suppressSubtitles = cartItem.type === components_shoppingCart_types.CART_ITEM_TYPE.SUBSCRIPTION ? true : void 0;
|
|
164
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
165
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.
|
|
166
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.
|
|
167
|
-
/* @__PURE__ */ jsxRuntime.
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
quantity,
|
|
183
|
-
onChangeQuantity,
|
|
184
|
-
cartItem,
|
|
185
|
-
shouldShowPricePerUnit,
|
|
186
|
-
isQuantityModifiable,
|
|
187
|
-
price: cartItem.price,
|
|
188
|
-
discountValueUpfront,
|
|
189
|
-
discountValueMonthly,
|
|
190
|
-
hasPaid
|
|
191
|
-
}
|
|
192
|
-
)
|
|
193
|
-
] }),
|
|
194
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.priceCost, children: [
|
|
195
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.priceWrapper, children: [
|
|
196
|
-
discountPriceText && /* @__PURE__ */ jsxRuntime.jsxs(components_tooltip_index.Tooltip, { defaultOpen: true, children: [
|
|
197
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Trigger, { className: styles.tooltipTrigger }),
|
|
198
|
-
/* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "paragraph-100", dangerouslySetInnerHTML: { __html: discountPriceText } }) })
|
|
199
|
-
] }),
|
|
200
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.priceLabel, children: [
|
|
201
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: isLease && !hasSubscription && "fra " }),
|
|
202
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: price }),
|
|
203
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: cartItem.price.monthly ? "/md." : "" })
|
|
204
|
-
] })
|
|
205
|
-
] }),
|
|
206
|
-
discountPrice && formatPrice(discountPrice) !== price && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
207
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.priceLinethroughDisclaimer, children: "ord. pris:" }),
|
|
208
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.priceLinethrough, children: cartItem.price.monthly ? formatPrice(discountPrice) + "/md." : formatPrice(discountPrice) })
|
|
209
|
-
] })
|
|
210
|
-
] }) })
|
|
161
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
162
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.quantityContainer, children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.quantityWrapper, children: [
|
|
164
|
+
quantity > 1 && !shouldShowPricePerUnit && /* @__PURE__ */ jsxRuntime.jsx("span", { children: `${quantity} stk` }),
|
|
165
|
+
isQuantityModifiable && !readonly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
+
QuantityPicker,
|
|
167
|
+
{
|
|
168
|
+
quantity,
|
|
169
|
+
onChangeQuantity,
|
|
170
|
+
cartItem,
|
|
171
|
+
shouldShowPricePerUnit,
|
|
172
|
+
isQuantityModifiable,
|
|
173
|
+
price: cartItem.price,
|
|
174
|
+
discountValueUpfront,
|
|
175
|
+
discountValueMonthly,
|
|
176
|
+
hasPaid
|
|
177
|
+
}
|
|
178
|
+
)
|
|
211
179
|
] }),
|
|
212
180
|
subtitles.slice(1).map((sub, index) => {
|
|
213
181
|
const description = typeof sub === "string" ? sub : sub.description;
|
|
@@ -233,7 +201,7 @@ const CartItemPriceDisplay = ({ cartItem, hasPaid, onChangeQuantity }) => {
|
|
|
233
201
|
/* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "paragraph-100", children: "Varen må hentes i butikk. Kan ikke kombineres med varer som ikke finnes i samme butikk." }) })
|
|
234
202
|
] })
|
|
235
203
|
] }),
|
|
236
|
-
((
|
|
204
|
+
((_h = cartItem.discount) == null ? void 0 : _h.isManualDiscount) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.uniqueDiscount, children: [
|
|
237
205
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.uniqueDiscountLabel, children: cartItem.discount.name }),
|
|
238
206
|
(cartItem.discount.value.upfront || 0) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.uniqueDiscountPrice, children: [
|
|
239
207
|
"-",
|
|
@@ -256,8 +224,8 @@ const CartItemDiscountBadges = ({ cartItem }) => {
|
|
|
256
224
|
`${discount.id}-${index}`
|
|
257
225
|
)) });
|
|
258
226
|
};
|
|
259
|
-
const CartItemName = ({ cartItem }) =>
|
|
260
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.nameWrapper, children: [
|
|
227
|
+
const CartItemName = ({ cartItem }) => {
|
|
228
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.nameWrapper, children: [
|
|
261
229
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.link, children: [
|
|
262
230
|
cartItem.lineThrough && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.priceLinethrough, children: cartItem.lineThrough }),
|
|
263
231
|
cartItem.href ? /* @__PURE__ */ jsxRuntime.jsx(components_link_link.Link, { href: cartItem.href, variant: "navigation", className: styles.cartLink, children: cartItem.name }) : cartItem.name,
|
|
@@ -267,22 +235,36 @@ const CartItemName = ({ cartItem }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntim
|
|
|
267
235
|
] })
|
|
268
236
|
] }),
|
|
269
237
|
/* @__PURE__ */ jsxRuntime.jsx(CartItemDiscountBadges, { cartItem })
|
|
270
|
-
] })
|
|
271
|
-
|
|
272
|
-
cartItem.color,
|
|
273
|
-
cartItem.modelSize ? ", " + cartItem.modelSize : ""
|
|
274
|
-
] })
|
|
275
|
-
] });
|
|
238
|
+
] });
|
|
239
|
+
};
|
|
276
240
|
const Item = ({ cartItem, onChangeQuantity, onRemoveItem, className }) => {
|
|
277
241
|
var _a;
|
|
278
242
|
const { hasPaid, isAllowedToDelete, readonly } = components_shoppingCart_shoppingCartContext.useShoppingCart();
|
|
279
243
|
const isRemovable = !!((_a = cartItem.quantity) == null ? void 0 : _a.removable);
|
|
244
|
+
const subtitles = (Array.isArray(cartItem.subtitle) ? cartItem.subtitle : [cartItem.subtitle]).filter(Boolean);
|
|
245
|
+
const suppressSubtitles = cartItem.type === components_shoppingCart_types.CART_ITEM_TYPE.SUBSCRIPTION ? true : void 0;
|
|
280
246
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx.clsx(styles.item, className), children: [
|
|
281
247
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.nameContainer, children: [
|
|
282
248
|
/* @__PURE__ */ jsxRuntime.jsx(CartItemImage, { cartItem }),
|
|
283
249
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.name, children: [
|
|
284
250
|
/* @__PURE__ */ jsxRuntime.jsx(CartItemName, { cartItem }),
|
|
285
|
-
/* @__PURE__ */ jsxRuntime.
|
|
251
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.characteristics, children: [
|
|
252
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
253
|
+
/* @__PURE__ */ jsxRuntime.jsx(Characteristics, { cartItem }),
|
|
254
|
+
subtitles.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
+
"div",
|
|
256
|
+
{
|
|
257
|
+
"data-hj-suppress": suppressSubtitles,
|
|
258
|
+
className: styles.subtitle,
|
|
259
|
+
dangerouslySetInnerHTML: {
|
|
260
|
+
__html: typeof subtitles[0] === "string" ? subtitles[0] : subtitles[0].description
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("span", {})
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ jsxRuntime.jsx(Price, { cartItem })
|
|
266
|
+
] }),
|
|
267
|
+
/* @__PURE__ */ jsxRuntime.jsx(CartItemDetails, { cartItem, onChangeQuantity, hasPaid })
|
|
286
268
|
] })
|
|
287
269
|
] }),
|
|
288
270
|
isRemovable && isAllowedToDelete && !readonly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -297,5 +279,42 @@ const Item = ({ cartItem, onChangeQuantity, onRemoveItem, className }) => {
|
|
|
297
279
|
)
|
|
298
280
|
] });
|
|
299
281
|
};
|
|
282
|
+
const Price = ({ cartItem }) => {
|
|
283
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
284
|
+
const { formatPrice } = components_shoppingCart_shoppingCartContext.useShoppingCart();
|
|
285
|
+
const quantity = ((_a = cartItem.quantity) == null ? void 0 : _a.value) ?? 1;
|
|
286
|
+
const isLease = cartItem.leaseMonths === 0 || !!cartItem.leaseMonths;
|
|
287
|
+
const hasSubscription = !!((_b = cartItem.items) == null ? void 0 : _b.find((item2) => item2.type.includes("SUBSCRIPTION")));
|
|
288
|
+
const isManualDiscount = (_c = cartItem.discount) == null ? void 0 : _c.isManualDiscount;
|
|
289
|
+
const discountValueMonthly = ((_e = (_d = cartItem.discount) == null ? void 0 : _d.value) == null ? void 0 : _e.monthly) || 0;
|
|
290
|
+
const discountValueUpfront = isManualDiscount ? 0 : ((_g = (_f = cartItem.discount) == null ? void 0 : _f.value) == null ? void 0 : _g.upfront) || 0;
|
|
291
|
+
const discountPrice = components_shoppingCart_utils.getDiscountPrice(cartItem.price, quantity) || "";
|
|
292
|
+
const price2 = components_shoppingCart_utils.getPrice(formatPrice, cartItem.price, discountValueUpfront, discountValueMonthly, quantity);
|
|
293
|
+
const discountPriceText = ((_h = cartItem.discount) == null ? void 0 : _h.handsetDiscountText) || "";
|
|
294
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles.price, children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.priceCost, children: [
|
|
295
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles.priceWrapper, children: [
|
|
296
|
+
discountPriceText && /* @__PURE__ */ jsxRuntime.jsxs(components_tooltip_index.Tooltip, { defaultOpen: true, children: [
|
|
297
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Trigger, { className: styles.tooltipTrigger }),
|
|
298
|
+
/* @__PURE__ */ jsxRuntime.jsx(components_tooltip_index.Tooltip.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(components_text_text.Text, { variant: "paragraph-100", dangerouslySetInnerHTML: { __html: discountPriceText } }) })
|
|
299
|
+
] }),
|
|
300
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles.priceLabel, children: [
|
|
301
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: isLease && !hasSubscription && "fra " }),
|
|
302
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: price2 }),
|
|
303
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: cartItem.price.monthly ? "/md." : "" })
|
|
304
|
+
] })
|
|
305
|
+
] }),
|
|
306
|
+
discountPrice && formatPrice(discountPrice) !== price2 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
307
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.priceLinethroughDisclaimer, children: "ord. pris:" }),
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.priceLinethrough, children: cartItem.price.monthly ? formatPrice(discountPrice) + "/md." : formatPrice(discountPrice) })
|
|
309
|
+
] })
|
|
310
|
+
] }) });
|
|
311
|
+
};
|
|
312
|
+
const Characteristics = ({ cartItem }) => {
|
|
313
|
+
if (!cartItem.color) return null;
|
|
314
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(components_text_text.Text, { variant: "paragraph-100", mb: "100", children: [
|
|
315
|
+
cartItem.color,
|
|
316
|
+
cartItem.modelSize ? ", " + cartItem.modelSize : ""
|
|
317
|
+
] });
|
|
318
|
+
};
|
|
300
319
|
Item.displayName = "Item";
|
|
301
320
|
exports.Item = Item;
|