krl-alfred 2.24.10 → 2.24.12
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/AddressCard/AddressCard.d.ts +1 -1
- package/dist/components/AddressCard/AddressCard.js +2 -2
- package/dist/components/AddressCard/AddressCard.styled.d.ts +1 -0
- package/dist/components/AddressCard/AddressCard.styled.js +5 -4
- package/dist/components/AddressCard/AddressCard.test.d.ts +1 -0
- package/dist/components/AddressCard/AddressCard.test.js +148 -0
- package/dist/components/AddressCard/props.d.ts +4 -0
- package/dist/components/AddressCard/props.js +1 -0
- package/dist/components/AddressCard/stories/AddressCard.stories.d.ts +21 -0
- package/dist/components/AddressCard/stories/AddressCard.stories.js +5 -1
- package/dist/components/Input/stories/Input.stories.d.ts +37 -0
- package/dist/components/Input/stories/Input.stories.js +7 -1
- package/dist/components/QuantitySelector/QuantitySelector.js +3 -1
- package/dist/components/QuantitySelector/QuantitySelector.test.js +21 -0
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.js +1 -1
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.styled.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { AddressCardProps } from "./props";
|
|
3
|
-
declare const AddressCard: ({ title, description, content, handleUpdate, onChange, checked, isShowEditBtn, id, minHeight, name, value, disabled, hasBlockDescription }: AddressCardProps) => React.JSX.Element;
|
|
3
|
+
declare const AddressCard: ({ title, description, content, handleUpdate, onChange, checked, isShowEditBtn, id, minHeight, name, value, disabled, hasBlockDescription, notice }: AddressCardProps) => React.JSX.Element;
|
|
4
4
|
export default AddressCard;
|
|
@@ -21,8 +21,8 @@ var RadioButton_1 = __importDefault(require("../RadioButton"));
|
|
|
21
21
|
var TextLink_1 = __importDefault(require("../TextLink"));
|
|
22
22
|
var react_i18next_1 = require("react-i18next");
|
|
23
23
|
var AddressCard = function (_a) {
|
|
24
|
-
var _b = _a.title, title = _b === void 0 ? props_1.AddressCardDefault.title : _b, _c = _a.description, description = _c === void 0 ? props_1.AddressCardDefault.description : _c, _d = _a.content, content = _d === void 0 ? props_1.AddressCardDefault.content : _d, _e = _a.handleUpdate, handleUpdate = _e === void 0 ? props_1.AddressCardDefault.handleUpdate : _e, _f = _a.onChange, onChange = _f === void 0 ? props_1.AddressCardDefault.onChange : _f, _g = _a.checked, checked = _g === void 0 ? props_1.AddressCardDefault.checked : _g, _h = _a.isShowEditBtn, isShowEditBtn = _h === void 0 ? props_1.AddressCardDefault.isShowEditBtn : _h, _j = _a.id, id = _j === void 0 ? props_1.AddressCardDefault.id : _j, _k = _a.minHeight, minHeight = _k === void 0 ? props_1.AddressCardDefault.minHeight : _k, _l = _a.name, name = _l === void 0 ? props_1.AddressCardDefault.name : _l, _m = _a.value, value = _m === void 0 ? props_1.AddressCardDefault.value : _m, _o = _a.disabled, disabled = _o === void 0 ? props_1.AddressCardDefault.disabled : _o, _p = _a.hasBlockDescription, hasBlockDescription = _p === void 0 ? props_1.AddressCardDefault.hasBlockDescription : _p;
|
|
24
|
+
var _b = _a.title, title = _b === void 0 ? props_1.AddressCardDefault.title : _b, _c = _a.description, description = _c === void 0 ? props_1.AddressCardDefault.description : _c, _d = _a.content, content = _d === void 0 ? props_1.AddressCardDefault.content : _d, _e = _a.handleUpdate, handleUpdate = _e === void 0 ? props_1.AddressCardDefault.handleUpdate : _e, _f = _a.onChange, onChange = _f === void 0 ? props_1.AddressCardDefault.onChange : _f, _g = _a.checked, checked = _g === void 0 ? props_1.AddressCardDefault.checked : _g, _h = _a.isShowEditBtn, isShowEditBtn = _h === void 0 ? props_1.AddressCardDefault.isShowEditBtn : _h, _j = _a.id, id = _j === void 0 ? props_1.AddressCardDefault.id : _j, _k = _a.minHeight, minHeight = _k === void 0 ? props_1.AddressCardDefault.minHeight : _k, _l = _a.name, name = _l === void 0 ? props_1.AddressCardDefault.name : _l, _m = _a.value, value = _m === void 0 ? props_1.AddressCardDefault.value : _m, _o = _a.disabled, disabled = _o === void 0 ? props_1.AddressCardDefault.disabled : _o, _p = _a.hasBlockDescription, hasBlockDescription = _p === void 0 ? props_1.AddressCardDefault.hasBlockDescription : _p, _q = _a.notice, notice = _q === void 0 ? props_1.AddressCardDefault.notice : _q;
|
|
25
25
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(AddressCard_styled_1.AddressCardStyled, __assign({ htmlFor: id, checked: checked, "$minHeight": minHeight, "$hasBlockDescription": hasBlockDescription }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "head" }, { children: [(0, jsx_runtime_1.jsx)(RadioButton_1.default, { id: id, onChange: onChange, checked: checked, isWrapText: false, layout: "basic", size: "small", label: title, name: name, value: value, disabled: disabled, textSize: "large" }), isShowEditBtn && ((0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: "xxxxx", className: "editBtn" }, { children: (0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({ onClick: handleUpdate }, { children: t("edit") })) })))] })), description && (0, jsx_runtime_1.
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(AddressCard_styled_1.AddressCardStyled, __assign({ htmlFor: id, checked: checked, "$minHeight": minHeight, "$hasBlockDescription": hasBlockDescription, "$disabled": disabled, "$hasNotice": Boolean(notice) }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "head" }, { children: [(0, jsx_runtime_1.jsx)(RadioButton_1.default, { id: id, onChange: onChange, checked: checked, isWrapText: false, layout: "basic", size: "small", label: title, name: name, value: value, disabled: disabled, textSize: "large" }), isShowEditBtn && ((0, jsx_runtime_1.jsx)("label", __assign({ htmlFor: "xxxxx", className: "editBtn" }, { children: (0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({ onClick: handleUpdate }, { children: t("edit") })) })))] })), (description || notice) && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "description" }, { children: [description, notice ? (0, jsx_runtime_1.jsx)(AddressCard_styled_1.Notice, { children: notice }) : null] }))), checked && content != null && ((0, jsx_runtime_1.jsx)(AddressCard_styled_1.Content, { children: content }))] })));
|
|
27
27
|
};
|
|
28
28
|
exports.default = AddressCard;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AddressCardStyledProps } from "./props";
|
|
3
3
|
export declare const AddressCardStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, keyof AddressCardStyledProps> & AddressCardStyledProps, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, keyof AddressCardStyledProps> & AddressCardStyledProps, never>>> & string;
|
|
4
|
+
export declare const Notice: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
4
5
|
export declare const Content: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
@@ -7,9 +7,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.Content = exports.AddressCardStyled = void 0;
|
|
10
|
+
exports.Content = exports.Notice = exports.AddressCardStyled = void 0;
|
|
11
11
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
12
|
var devices_1 = require("../../constants/devices");
|
|
13
|
-
exports.AddressCardStyled = styled_components_1.default.label(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: 0.5rem;\n border: 1px solid var(--border);\n background: var(--bg);\n padding: 1rem;\n cursor:
|
|
14
|
-
exports.
|
|
15
|
-
|
|
13
|
+
exports.AddressCardStyled = styled_components_1.default.label(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: 0.5rem;\n border: 1px solid var(--border);\n background: var(--bg);\n padding: 1rem;\n cursor: ", ";\n display: block;\n position: relative;\n box-sizing: border-box;\n\n &:before {\n content: \"\";\n position: absolute;\n inset: -1px;\n border: 2px solid var(--primary);\n opacity: ", ";\n user-select: none;\n pointer-events: none;\n border-radius: inherit;\n }\n\n ", "\n\n ", "\n .head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: inherit;\n\n .editBtn {\n font: var(--body-bold-14-17);\n margin-left: 1rem;\n display: block;\n\n * {\n display: block;\n }\n }\n }\n\n .description {\n margin-top: 1.5rem;\n -webkit-line-clamp: 4;\n -webkit-box-orient: vertical;\n overflow: hidden;\n word-break: break-word;\n font: var(--body-regular-14-17);\n color: ", ";\n height: ", ";\n cursor: inherit;\n display: ", ";\n -webkit-line-clamp: ", ";\n -webkit-box-orient: ", ";\n vertical-align: ", ";\n ", "\n }\n"], ["\n border-radius: 0.5rem;\n border: 1px solid var(--border);\n background: var(--bg);\n padding: 1rem;\n cursor: ", ";\n display: block;\n position: relative;\n box-sizing: border-box;\n\n &:before {\n content: \"\";\n position: absolute;\n inset: -1px;\n border: 2px solid var(--primary);\n opacity: ", ";\n user-select: none;\n pointer-events: none;\n border-radius: inherit;\n }\n\n ", "\n\n ", "\n .head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: inherit;\n\n .editBtn {\n font: var(--body-bold-14-17);\n margin-left: 1rem;\n display: block;\n\n * {\n display: block;\n }\n }\n }\n\n .description {\n margin-top: 1.5rem;\n -webkit-line-clamp: 4;\n -webkit-box-orient: vertical;\n overflow: hidden;\n word-break: break-word;\n font: var(--body-regular-14-17);\n color: ", ";\n height: ", ";\n cursor: inherit;\n display: ", ";\n -webkit-line-clamp: ", ";\n -webkit-box-orient: ", ";\n vertical-align: ", ";\n ", "\n }\n"])), function (props) { return props.$disabled ? 'not-allowed' : 'pointer'; }, function (props) { return props.checked ? '1' : '0'; }, function (props) { return props.$disabled && "\n .head > label:first-child,\n .head > label:first-child * {\n color: var(--text-disabled);\n }\n "; }, function (props) { return !props.checked && !props.$disabled && "\n @media only screen and ".concat(devices_1.devices.mdUp, " {\n &:hover {\n &:before{\n border: 1px solid var(--primary);\n opacity: 1;\n } \n }\n }\n &:active {\n &:before{\n border: 1px solid var(--primary);\n opacity: 1;\n } \n }\n "); }, function (props) { return props.$disabled ? 'var(--text-disabled)' : 'var(--text)'; }, function (props) { return props.$minHeight ? props.$minHeight : '68px'; }, function (props) { return props.$hasBlockDescription || props.$hasNotice ? 'block' : '-webkit-inline-box'; }, function (props) { return props.$hasBlockDescription || props.$hasNotice ? 'unset' : '4'; }, function (props) { return props.$hasBlockDescription || props.$hasNotice ? 'unset' : 'vertical'; }, function (props) { return props.$hasBlockDescription || props.$hasNotice ? 'unset' : 'middle'; }, function (props) { return props.$hasNotice && "\n height: auto;\n overflow: visible;\n "; });
|
|
14
|
+
exports.Notice = styled_components_1.default.span(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: block;\n margin-top: 0.25rem;\n font: var(--body-medium-13-16);\n color: var(--text-soft);\n"], ["\n display: block;\n margin-top: 0.25rem;\n font: var(--body-medium-13-16);\n color: var(--text-soft);\n"])));
|
|
15
|
+
exports.Content = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin-top: 1rem;\n cursor: default;\n"], ["\n margin-top: 1rem;\n cursor: default;\n"])));
|
|
16
|
+
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
|
+
var react_1 = require("@testing-library/react");
|
|
55
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
56
|
+
var AddressCard_1 = __importDefault(require("./AddressCard"));
|
|
57
|
+
var props_1 = require("./props");
|
|
58
|
+
jest.mock('react-i18next', function () { return ({
|
|
59
|
+
useTranslation: function () { return ({
|
|
60
|
+
t: function (key) { return key; },
|
|
61
|
+
}); },
|
|
62
|
+
}); });
|
|
63
|
+
var renderCard = function (props) {
|
|
64
|
+
if (props === void 0) { props = {}; }
|
|
65
|
+
return (0, react_1.render)((0, jsx_runtime_1.jsx)(AddressCard_1.default, __assign({}, props_1.AddressCardDefault, { id: "address-1", name: "address", value: "home", title: "Ev", description: "Ba\u011Fdat Cad. No:12", onChange: jest.fn(), handleUpdate: jest.fn() }, props)));
|
|
66
|
+
};
|
|
67
|
+
describe('AddressCard', function () {
|
|
68
|
+
it('renders title and description', function () {
|
|
69
|
+
renderCard();
|
|
70
|
+
expect(react_1.screen.getByText('Ev')).toBeInTheDocument();
|
|
71
|
+
expect(react_1.screen.getByText('Bağdat Cad. No:12')).toBeInTheDocument();
|
|
72
|
+
});
|
|
73
|
+
it('calls onChange when the radio is selected', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var onChange;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
onChange = jest.fn();
|
|
79
|
+
renderCard({ onChange: onChange });
|
|
80
|
+
return [4 /*yield*/, user_event_1.default.click(react_1.screen.getByRole('radio'))];
|
|
81
|
+
case 1:
|
|
82
|
+
_a.sent();
|
|
83
|
+
expect(onChange).toHaveBeenCalledTimes(1);
|
|
84
|
+
return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}); });
|
|
88
|
+
it('calls handleUpdate when edit is clicked', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
+
var handleUpdate;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
handleUpdate = jest.fn();
|
|
94
|
+
renderCard({ handleUpdate: handleUpdate });
|
|
95
|
+
return [4 /*yield*/, user_event_1.default.click(react_1.screen.getByText('edit'))];
|
|
96
|
+
case 1:
|
|
97
|
+
_a.sent();
|
|
98
|
+
expect(handleUpdate).toHaveBeenCalledTimes(1);
|
|
99
|
+
return [2 /*return*/];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}); });
|
|
103
|
+
it('shows extra content only when checked', function () {
|
|
104
|
+
var rerender = renderCard({ checked: false, content: (0, jsx_runtime_1.jsx)("span", { children: "Ek i\u00E7erik" }) }).rerender;
|
|
105
|
+
expect(react_1.screen.queryByText('Ek içerik')).not.toBeInTheDocument();
|
|
106
|
+
rerender((0, jsx_runtime_1.jsx)(AddressCard_1.default, __assign({}, props_1.AddressCardDefault, { id: "address-1", title: "Ev", checked: true, content: (0, jsx_runtime_1.jsx)("span", { children: "Ek i\u00E7erik" }) })));
|
|
107
|
+
expect(react_1.screen.getByText('Ek içerik')).toBeInTheDocument();
|
|
108
|
+
});
|
|
109
|
+
it('does not call onChange when disabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
110
|
+
var onChange;
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0:
|
|
114
|
+
onChange = jest.fn();
|
|
115
|
+
renderCard({ disabled: true, onChange: onChange });
|
|
116
|
+
return [4 /*yield*/, user_event_1.default.click(react_1.screen.getByRole('radio'))];
|
|
117
|
+
case 1:
|
|
118
|
+
_a.sent();
|
|
119
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
120
|
+
return [2 /*return*/];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}); });
|
|
124
|
+
it('dims the title and address when disabled', function () {
|
|
125
|
+
renderCard({ disabled: true });
|
|
126
|
+
expect(react_1.screen.getByText('Ev')).toHaveStyle({ color: 'var(--text-disabled)' });
|
|
127
|
+
expect(react_1.screen.getByText('Bağdat Cad. No:12')).toHaveStyle({ color: 'var(--text-disabled)' });
|
|
128
|
+
});
|
|
129
|
+
it('renders the unavailable notice under the address', function () {
|
|
130
|
+
var container = renderCard({
|
|
131
|
+
disabled: true,
|
|
132
|
+
notice: 'Bu bölgeye teslimat yapılmıyor',
|
|
133
|
+
}).container;
|
|
134
|
+
var notice = react_1.screen.getByText('Bu bölgeye teslimat yapılmıyor');
|
|
135
|
+
expect(notice).toHaveStyle({ color: 'var(--text-soft)' });
|
|
136
|
+
expect(container.firstChild).toHaveStyle({ cursor: 'not-allowed' });
|
|
137
|
+
});
|
|
138
|
+
it('renders unsafe title, description and notice as text', function () {
|
|
139
|
+
var payload = '<script>alert(1)</script>';
|
|
140
|
+
var container = renderCard({
|
|
141
|
+
title: payload,
|
|
142
|
+
description: payload,
|
|
143
|
+
notice: payload,
|
|
144
|
+
}).container;
|
|
145
|
+
expect(container.querySelector('script')).not.toBeInTheDocument();
|
|
146
|
+
expect(container.textContent).toContain(payload);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
@@ -13,11 +13,15 @@ export interface AddressCard {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
hasBlockDescription?: boolean;
|
|
16
|
+
/** Adres satırının altında, örn. teslimat yapılamayan bölge notu. */
|
|
17
|
+
notice?: string;
|
|
16
18
|
}
|
|
17
19
|
export interface AddressCardStyledProps {
|
|
18
20
|
checked?: boolean;
|
|
19
21
|
$minHeight?: string;
|
|
20
22
|
$hasBlockDescription?: boolean;
|
|
23
|
+
$disabled?: boolean;
|
|
24
|
+
$hasNotice?: boolean;
|
|
21
25
|
}
|
|
22
26
|
export declare const AddressCardDefault: AddressCard;
|
|
23
27
|
export type AddressCardProps = typeof AddressCardDefault;
|
|
@@ -23,6 +23,9 @@ declare const _default: {
|
|
|
23
23
|
hasBlockDescription: {
|
|
24
24
|
control: string;
|
|
25
25
|
};
|
|
26
|
+
notice: {
|
|
27
|
+
control: string;
|
|
28
|
+
};
|
|
26
29
|
minHeight: {
|
|
27
30
|
control: string;
|
|
28
31
|
};
|
|
@@ -134,6 +137,24 @@ export declare const Disabled: {
|
|
|
134
137
|
content: any;
|
|
135
138
|
};
|
|
136
139
|
};
|
|
140
|
+
export declare const Unavailable: {
|
|
141
|
+
args: {
|
|
142
|
+
title: string;
|
|
143
|
+
description: string;
|
|
144
|
+
id: string;
|
|
145
|
+
value: string;
|
|
146
|
+
disabled: boolean;
|
|
147
|
+
isShowEditBtn: boolean;
|
|
148
|
+
minHeight: string;
|
|
149
|
+
notice: string;
|
|
150
|
+
handleUpdate: () => void;
|
|
151
|
+
onChange: () => void;
|
|
152
|
+
name: string;
|
|
153
|
+
checked: boolean;
|
|
154
|
+
hasBlockDescription: boolean;
|
|
155
|
+
content: any;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
137
158
|
export declare const DisabledChecked: {
|
|
138
159
|
args: {
|
|
139
160
|
title: string;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Complete = exports.AddressList = exports.BlockDescriptionChecked = exports.BlockDescription = exports.WithContentAndEdit = exports.WithContentOpen = exports.WithContent = exports.CustomMinHeight = exports.LongDescription = exports.ShortDescription = exports.DisabledWithoutEditButton = exports.DisabledChecked = exports.Disabled = exports.WithoutDescription = exports.WithoutEditButtonChecked = exports.WithoutEditButton = exports.Checked = exports.Default = void 0;
|
|
17
|
+
exports.Complete = exports.AddressList = exports.BlockDescriptionChecked = exports.BlockDescription = exports.WithContentAndEdit = exports.WithContentOpen = exports.WithContent = exports.CustomMinHeight = exports.LongDescription = exports.ShortDescription = exports.DisabledWithoutEditButton = exports.DisabledChecked = exports.Unavailable = exports.Disabled = exports.WithoutDescription = exports.WithoutEditButtonChecked = exports.WithoutEditButton = exports.Checked = exports.Default = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = __importDefault(require("react"));
|
|
20
20
|
var AddressCard_1 = __importDefault(require("../AddressCard"));
|
|
@@ -86,6 +86,7 @@ exports.default = {
|
|
|
86
86
|
disabled: { control: "boolean" },
|
|
87
87
|
isShowEditBtn: { control: "boolean" },
|
|
88
88
|
hasBlockDescription: { control: "boolean" },
|
|
89
|
+
notice: { control: "text" },
|
|
89
90
|
minHeight: { control: "text" },
|
|
90
91
|
content: { control: false },
|
|
91
92
|
},
|
|
@@ -108,6 +109,9 @@ exports.WithoutDescription = {
|
|
|
108
109
|
exports.Disabled = {
|
|
109
110
|
args: __assign(__assign({}, baseArgs), { title: "Disabled Address", id: "addressCard_5", value: "address_5", disabled: true }),
|
|
110
111
|
};
|
|
112
|
+
exports.Unavailable = {
|
|
113
|
+
args: __assign(__assign({}, baseArgs), { title: "Ev", description: "Bağdat Cad. No:12, Kadıköy / İstanbul", id: "addressCard_unavailable", value: "address_unavailable", disabled: true, isShowEditBtn: false, minHeight: "auto", notice: "Bu bölgeye teslimat yapılmıyor" }),
|
|
114
|
+
};
|
|
111
115
|
exports.DisabledChecked = {
|
|
112
116
|
args: __assign(__assign({}, baseArgs), { title: "Disabled Selected Address", id: "addressCard_6", value: "address_6", checked: true, disabled: true }),
|
|
113
117
|
};
|
|
@@ -268,6 +268,43 @@ export declare const DateWithMinMax: {
|
|
|
268
268
|
onChange: (e: any) => void;
|
|
269
269
|
};
|
|
270
270
|
};
|
|
271
|
+
export declare const Time: {
|
|
272
|
+
args: {
|
|
273
|
+
label: string;
|
|
274
|
+
placeholder: string;
|
|
275
|
+
format: string;
|
|
276
|
+
mask: string;
|
|
277
|
+
allowEmptyFormatting: boolean;
|
|
278
|
+
id: string;
|
|
279
|
+
hasError: boolean;
|
|
280
|
+
disabled: boolean;
|
|
281
|
+
readOnly: boolean;
|
|
282
|
+
isClearable: boolean;
|
|
283
|
+
type: string;
|
|
284
|
+
infoText: any;
|
|
285
|
+
tooltipText: any;
|
|
286
|
+
onChange: (e: any) => void;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
export declare const TimeWithValue: {
|
|
290
|
+
args: {
|
|
291
|
+
label: string;
|
|
292
|
+
placeholder: string;
|
|
293
|
+
format: string;
|
|
294
|
+
mask: string;
|
|
295
|
+
allowEmptyFormatting: boolean;
|
|
296
|
+
value: string;
|
|
297
|
+
id: string;
|
|
298
|
+
hasError: boolean;
|
|
299
|
+
disabled: boolean;
|
|
300
|
+
readOnly: boolean;
|
|
301
|
+
isClearable: boolean;
|
|
302
|
+
type: string;
|
|
303
|
+
infoText: any;
|
|
304
|
+
tooltipText: any;
|
|
305
|
+
onChange: (e: any) => void;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
271
308
|
export declare const WithCopyButton: {
|
|
272
309
|
args: {
|
|
273
310
|
placeholder: string;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Interactive = exports.PercentageMaskWithValue = exports.PercentageMask = exports.WithMaxLengthAndDescription = exports.ErrorWithCustomLink = exports.Complete = exports.CustomWidth = exports.Number = exports.Tel = exports.Email = exports.PatternFormatWithValue = exports.PatternFormat = exports.PriceFormat = exports.NumericFormat = exports.WithTooltip = exports.WithInfoText = exports.Clearable = exports.WithCopyButton = exports.DateWithMinMax = exports.DateInline = exports.DateInput = exports.PasswordWithValue = exports.Password = exports.WithCustomLink = exports.ReadOnly = exports.Disabled = exports.WithError = exports.WithLabel = exports.WithValue = exports.Empty = exports.Default = void 0;
|
|
17
|
+
exports.Interactive = exports.PercentageMaskWithValue = exports.PercentageMask = exports.WithMaxLengthAndDescription = exports.ErrorWithCustomLink = exports.Complete = exports.CustomWidth = exports.Number = exports.Tel = exports.Email = exports.PatternFormatWithValue = exports.PatternFormat = exports.PriceFormat = exports.NumericFormat = exports.WithTooltip = exports.WithInfoText = exports.Clearable = exports.WithCopyButton = exports.TimeWithValue = exports.Time = exports.DateWithMinMax = exports.DateInline = exports.DateInput = exports.PasswordWithValue = exports.Password = exports.WithCustomLink = exports.ReadOnly = exports.Disabled = exports.WithError = exports.WithLabel = exports.WithValue = exports.Empty = exports.Default = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = __importDefault(require("react"));
|
|
20
20
|
var Input_1 = __importDefault(require("../Input"));
|
|
@@ -244,6 +244,12 @@ exports.DateWithMinMax = {
|
|
|
244
244
|
}
|
|
245
245
|
},
|
|
246
246
|
};
|
|
247
|
+
exports.Time = {
|
|
248
|
+
args: __assign(__assign({}, baseArgs), { label: "Saat", placeholder: "Örn: 07:00", format: "##:##", mask: "_", allowEmptyFormatting: false, id: "input_time" }),
|
|
249
|
+
};
|
|
250
|
+
exports.TimeWithValue = {
|
|
251
|
+
args: __assign(__assign({}, baseArgs), { label: "Saat", placeholder: "Örn: 10:30", format: "##:##", mask: "_", allowEmptyFormatting: false, value: "14:30", id: "input_time_value" }),
|
|
252
|
+
};
|
|
247
253
|
exports.WithCopyButton = {
|
|
248
254
|
args: {
|
|
249
255
|
placeholder: "Copy this text",
|
|
@@ -26,6 +26,8 @@ var QuantitySelector = function (_a) {
|
|
|
26
26
|
$hasDisableActions: hasDisableActions,
|
|
27
27
|
};
|
|
28
28
|
var decrementButton = hasRemove ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", disabled: hasLoading, onClick: onRemove }, styledProps, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", disabled: hasLoading, onClick: onDecrement }, styledProps, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "NegativeSmall" }) })));
|
|
29
|
-
|
|
29
|
+
var incrementButton = ((0, jsx_runtime_1.jsxs)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", disabled: hasLoading || hasError || hasDisableIncrement, onClick: onIncrement }, styledProps, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }), hasError && ((0, jsx_runtime_1.jsx)("div", { className: "popup", dangerouslySetInnerHTML: { __html: errorText } }))] })));
|
|
30
|
+
var isHorizontal = orientation === 'horizontal';
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(QuantitySelector_styled_1.Container, { children: [label && (0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.Label, __assign({ htmlFor: id }, { children: label })), (0, jsx_runtime_1.jsxs)(QuantitySelector_styled_1.Controls, __assign({}, styledProps, { children: [!hasDisableActions && (isHorizontal ? decrementButton : incrementButton), (0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.QuantityValue, __assign({}, styledProps, { children: hasLoading ? (0, jsx_runtime_1.jsx)(Loader_1.default, { variant: "primary", width: "16px", height: "16px" }) : quantity })), !hasDisableActions && (isHorizontal ? incrementButton : decrementButton)] }))] }));
|
|
30
32
|
};
|
|
31
33
|
exports.default = QuantitySelector;
|
|
@@ -84,6 +84,27 @@ describe('QuantitySelector', function () {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}); });
|
|
87
|
+
it('places decrement before increment when horizontal', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
+
var onIncrement, onDecrement, _a, first, second;
|
|
89
|
+
return __generator(this, function (_b) {
|
|
90
|
+
switch (_b.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
onIncrement = jest.fn();
|
|
93
|
+
onDecrement = jest.fn();
|
|
94
|
+
renderSelector({ orientation: 'horizontal', onIncrement: onIncrement, onDecrement: onDecrement });
|
|
95
|
+
_a = react_1.screen.getAllByRole('button'), first = _a[0], second = _a[1];
|
|
96
|
+
return [4 /*yield*/, user_event_1.default.click(first)];
|
|
97
|
+
case 1:
|
|
98
|
+
_b.sent();
|
|
99
|
+
return [4 /*yield*/, user_event_1.default.click(second)];
|
|
100
|
+
case 2:
|
|
101
|
+
_b.sent();
|
|
102
|
+
expect(onDecrement).toHaveBeenCalledTimes(1);
|
|
103
|
+
expect(onIncrement).toHaveBeenCalledTimes(1);
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); });
|
|
87
108
|
it('does not call onIncrement when increment is disabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
88
109
|
var onIncrement;
|
|
89
110
|
return __generator(this, function (_a) {
|
|
@@ -63,6 +63,6 @@ var ShoppingCartProduct = function (_a) {
|
|
|
63
63
|
e.preventDefault();
|
|
64
64
|
e.stopPropagation();
|
|
65
65
|
onCampaignCountClick === null || onCampaignCountClick === void 0 ? void 0 : onCampaignCountClick();
|
|
66
|
-
} }, { children: ["+", extraCampaignCount] })))] }))] }), (0, jsx_runtime_1.jsx)(QuantitySelector_1.default, { orientation: "vertical", quantity: quantity, onIncrement: onIncrement, onDecrement: onDecrement, onRemove: onRemove, hasRemove: hasRemove, hasLoading: hasLoading, hasError: hasError, errorText: errorText, hasDisableActions: hasDisableActions, hasDisableIncrement: hasDisableIncrement })] }), hasInsurance && insuranceType === 1 && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceSection, __assign({ "$hasInsurance": hasInsurancePointer }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceImage, __assign({ onClick: !hasLoading ? toggleInsuranceLogo : undefined }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: "Tamamlarsin", width: "80px", height: "9.14px" }) })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceContent, __assign({ onClick: !hasLoading ? toggleInsurance : undefined }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceText, { children: [insuranceText, insurancePrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePrice, { children: hasInsuranceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePriceValue, { dangerouslySetInnerHTML: { __html: insurancePrice } }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceQuantity, { children: insuranceQuantity })] })) }))] }), hasInsuranceActions && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceActions, { children: hasInsuranceTooltip ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", hasClickAction: hasInsuranceTooltipClickAction, popupWidth: insuranceTooltipWidth, position: "bottomRight" }, { children: insuranceTooltipText }))) : (hasInsurancePriceAdded ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }) })))) }))] }))] }))), hasInsurance && insuranceType === 2 && !hasLoading && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Wrapper, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 1 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 1, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(1); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption1Title }), insuranceOption1TooltipText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2TooltipWrapper, __assign({ ref: tooltipWrapperRef, htmlFor: "insurance-option-1-tooltip", onClick: handleTooltipWrapperClick, onMouseDown: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", popupWidth: "302px", position: "bottomRight", iconWidth: "24px", iconHeight: "24px", title: insuranceOption1TooltipTitle, popupSize: "medium", hasClickAction: hasInsuranceTooltipClickAction }, { children: insuranceOption1TooltipText })) })))] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption1Description }), (insuranceOption1Price || hasInsuranceOption1PriceLoading) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Price, { children: hasInsuranceOption1PriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2PriceValue, { children: insuranceOption1Price }), insuranceOption1PricePeriod && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2PricePeriod, { children: [" ", insuranceOption1PricePeriod] }))] })) }))] })] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 2 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 2, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(2); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption2Title })] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption2Description }) })] }))] })), hasInsurance && insuranceType === 3 && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonWrapper, { children: (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonCard, __assign({ htmlFor: upfrontAddonId }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonHeader, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonCheckboxWrapper, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { id: upfrontAddonId, size: "medium", checked: upfrontAddonChecked, onChange: onUpfrontAddonChange }) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonTitle, { children: upfrontAddonTitle }), upfrontAddonDiscountBadge && ((0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "light", title: upfrontAddonDiscountBadge }))] }), (upfrontAddonSummaryText || upfrontAddonPrice) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonPriceBlock, { children: hasUpfrontAddonDiscount ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText,
|
|
66
|
+
} }, { children: ["+", extraCampaignCount] })))] }))] }), (0, jsx_runtime_1.jsx)(QuantitySelector_1.default, { orientation: "vertical", quantity: quantity, onIncrement: onIncrement, onDecrement: onDecrement, onRemove: onRemove, hasRemove: hasRemove, hasLoading: hasLoading, hasError: hasError, errorText: errorText, hasDisableActions: hasDisableActions, hasDisableIncrement: hasDisableIncrement })] }), hasInsurance && insuranceType === 1 && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceSection, __assign({ "$hasInsurance": hasInsurancePointer }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceImage, __assign({ onClick: !hasLoading ? toggleInsuranceLogo : undefined }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: "Tamamlarsin", width: "80px", height: "9.14px" }) })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceContent, __assign({ onClick: !hasLoading ? toggleInsurance : undefined }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceText, { children: [insuranceText, insurancePrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePrice, { children: hasInsuranceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePriceValue, { dangerouslySetInnerHTML: { __html: insurancePrice } }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceQuantity, { children: insuranceQuantity })] })) }))] }), hasInsuranceActions && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceActions, { children: hasInsuranceTooltip ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", hasClickAction: hasInsuranceTooltipClickAction, popupWidth: insuranceTooltipWidth, position: "bottomRight" }, { children: insuranceTooltipText }))) : (hasInsurancePriceAdded ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }) })))) }))] }))] }))), hasInsurance && insuranceType === 2 && !hasLoading && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Wrapper, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 1 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 1, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(1); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption1Title }), insuranceOption1TooltipText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2TooltipWrapper, __assign({ ref: tooltipWrapperRef, htmlFor: "insurance-option-1-tooltip", onClick: handleTooltipWrapperClick, onMouseDown: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", popupWidth: "302px", position: "bottomRight", iconWidth: "24px", iconHeight: "24px", title: insuranceOption1TooltipTitle, popupSize: "medium", hasClickAction: hasInsuranceTooltipClickAction }, { children: insuranceOption1TooltipText })) })))] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption1Description }), (insuranceOption1Price || hasInsuranceOption1PriceLoading) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Price, { children: hasInsuranceOption1PriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2PriceValue, { children: insuranceOption1Price }), insuranceOption1PricePeriod && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2PricePeriod, { children: [" ", insuranceOption1PricePeriod] }))] })) }))] })] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 2 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 2, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(2); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption2Title })] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption2Description }) })] }))] })), hasInsurance && insuranceType === 3 && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonWrapper, { children: (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonCard, __assign({ htmlFor: upfrontAddonId }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonHeader, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonCheckboxWrapper, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { id: upfrontAddonId, size: "medium", checked: upfrontAddonChecked, onChange: onUpfrontAddonChange }) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonTitle, { children: upfrontAddonTitle }), upfrontAddonDiscountBadge && ((0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "light", title: upfrontAddonDiscountBadge }))] }), (upfrontAddonSummaryText || upfrontAddonPrice) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonPriceBlock, { children: hasUpfrontAddonDiscount ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonOldPrice, { children: upfrontAddonOldPrice })] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: ["yerine \u015Fimdi", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice })] })] })) : ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, upfrontAddonPrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice }))] })) }))] })) }))] }));
|
|
67
67
|
};
|
|
68
68
|
exports.default = ShoppingCartProduct;
|
|
@@ -59,7 +59,7 @@ exports.UpfrontAddonCheckboxWrapper = styled_components_1.default.div(templateOb
|
|
|
59
59
|
exports.UpfrontAddonTitle = styled_components_1.default.span(templateObject_43 || (templateObject_43 = __makeTemplateObject(["\n font: var(--body-extra-bold-13-16);\n color: var(--text);\n flex: 1;\n min-width: 0;\n"], ["\n font: var(--body-extra-bold-13-16);\n color: var(--text);\n flex: 1;\n min-width: 0;\n"])));
|
|
60
60
|
exports.UpfrontAddonHeader = styled_components_1.default.div(templateObject_44 || (templateObject_44 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n gap: 1rem;\n width: 100%;\n"], ["\n display: flex;\n align-items: center;\n gap: 1rem;\n width: 100%;\n"])));
|
|
61
61
|
exports.UpfrontAddonPriceBlock = styled_components_1.default.div(templateObject_45 || (templateObject_45 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n margin-top: auto;\n padding-left: 2.5rem;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n margin-top: auto;\n padding-left: 2.5rem;\n"])));
|
|
62
|
-
exports.UpfrontAddonPriceLine = styled_components_1.default.p(templateObject_46 || (templateObject_46 = __makeTemplateObject(["\n margin: 0;\n font: var(--caption-regular-11-13);\n color: var(--text-soft);\n"], ["\n margin: 0;\n font: var(--caption-regular-11-13);\n color: var(--text-soft);\n"])));
|
|
62
|
+
exports.UpfrontAddonPriceLine = styled_components_1.default.p(templateObject_46 || (templateObject_46 = __makeTemplateObject(["\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n font: var(--caption-regular-11-13);\n color: var(--text-soft);\n"], ["\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0;\n font: var(--caption-regular-11-13);\n color: var(--text-soft);\n"])));
|
|
63
63
|
exports.UpfrontAddonOldPrice = styled_components_1.default.span(templateObject_47 || (templateObject_47 = __makeTemplateObject(["\n text-decoration: line-through;\n color: var(--text-disabled);\n font: var(--caption-semi-bold-12-15);\n"], ["\n text-decoration: line-through;\n color: var(--text-disabled);\n font: var(--caption-semi-bold-12-15);\n"])));
|
|
64
64
|
exports.UpfrontAddonDiscountedPrice = styled_components_1.default.span(templateObject_48 || (templateObject_48 = __makeTemplateObject(["\n font: var(--body-extra-bold-13-16);\n color: var(--text);\n"], ["\n font: var(--body-extra-bold-13-16);\n color: var(--text);\n"])));
|
|
65
65
|
exports.UpfrontAddonCard = styled_components_1.default.label(templateObject_49 || (templateObject_49 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 1rem;\n background: var(--primary-opacity-5);\n border-radius: 0.5rem;\n cursor: pointer;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 1rem;\n background: var(--primary-opacity-5);\n border-radius: 0.5rem;\n cursor: pointer;\n"])));
|