tf-checkout-react 1.0.99 → 1.0.100-beta.2
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/README.md +278 -1
- package/dist/api/index.d.ts +31 -26
- package/dist/components/account-settings/index.d.ts +3 -0
- package/dist/components/billing-info-container/index.d.ts +5 -5
- package/dist/components/billing-info-container/utils.d.ts +1 -0
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/components/common/DatePickerField.d.ts +14 -0
- package/dist/components/common/RedirectModal.d.ts +7 -0
- package/dist/components/common/SnackbarAlert.d.ts +13 -0
- package/dist/components/confirmationContainer/index.d.ts +2 -1
- package/dist/components/countdown/index.d.ts +4 -1
- package/dist/components/myTicketsContainer/tableConfig.d.ts +0 -1
- package/dist/components/orderDetailsContainer/index.d.ts +5 -1
- package/dist/components/orderDetailsContainer/ticketsTable.d.ts +4 -1
- package/dist/components/paymentContainer/index.d.ts +3 -1
- package/dist/components/rsvpContainer/index.d.ts +7 -0
- package/dist/components/stripePayment/index.d.ts +2 -1
- package/dist/components/ticketResale/index.d.ts +5 -3
- package/dist/components/ticketsContainer/AccessCodeSection.d.ts +7 -0
- package/dist/components/ticketsContainer/PromoCodeSection.d.ts +6 -9
- package/dist/components/ticketsContainer/TicketsSection.d.ts +5 -3
- package/dist/components/ticketsContainer/index.d.ts +13 -2
- package/dist/components/timerWidget/index.d.ts +3 -3
- package/dist/env.d.ts +1 -0
- package/dist/images/cross.svg +44 -0
- package/dist/images/done.svg +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/tf-checkout-react.cjs.development.js +1400 -575
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +1409 -586
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/tf-checkout-styles.css +1 -1
- package/dist/utils/cookies.d.ts +3 -0
- package/dist/utils/createCheckoutDataBodyWithDefaultHolder.d.ts +6 -1
- package/dist/utils/downloadPDF.d.ts +1 -1
- package/dist/utils/getDomain.d.ts +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/package.json +89 -89
- package/src/.DS_Store +0 -0
- package/src/.d.ts +2 -2
- package/src/api/index.ts +313 -278
- package/src/assets/images/cross.svg +44 -0
- package/src/assets/images/done.svg +3 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/account-settings/index.tsx +161 -0
- package/src/components/account-settings/style.css +200 -0
- package/src/components/billing-info-container/index.tsx +821 -777
- package/src/components/billing-info-container/style.css +106 -106
- package/src/components/billing-info-container/utils.ts +233 -223
- package/src/components/common/CheckboxField.tsx +41 -41
- package/src/components/common/CustomField.tsx +87 -84
- package/src/components/common/DatePickerField.tsx +98 -0
- package/src/components/common/FormikPhoneNumberField.tsx +51 -51
- package/src/components/common/Loader.tsx +9 -9
- package/src/components/common/RadioField.tsx +35 -35
- package/src/components/common/RedirectModal.tsx +43 -0
- package/src/components/common/SelectField.tsx +80 -80
- package/src/components/common/SnackbarAlert.tsx +54 -0
- package/src/components/common/dist/PhoneNumberField.js +96 -0
- package/src/components/common/index.tsx +4 -4
- package/src/components/confirmModal/index.tsx +51 -51
- package/src/components/confirmModal/style.css +21 -21
- package/src/components/confirmationContainer/config.ts +72 -72
- package/src/components/confirmationContainer/index.tsx +197 -194
- package/src/components/confirmationContainer/social-buttons.tsx +94 -94
- package/src/components/confirmationContainer/style.css +202 -202
- package/src/components/countdown/index.tsx +100 -89
- package/src/components/countdown/style.css +9 -9
- package/src/components/index.ts +7 -7
- package/src/components/loginModal/index.tsx +171 -209
- package/src/components/loginModal/style.css +71 -71
- package/src/components/myTicketsContainer/index.tsx +201 -137
- package/src/components/myTicketsContainer/row.tsx +41 -41
- package/src/components/myTicketsContainer/style.css +40 -40
- package/src/components/myTicketsContainer/tableConfig.tsx +32 -34
- package/src/components/orderDetailsContainer/index.tsx +289 -249
- package/src/components/orderDetailsContainer/style.css +73 -73
- package/src/components/orderDetailsContainer/ticketsTable.tsx +177 -124
- package/src/components/paymentContainer/index.tsx +352 -284
- package/src/components/registerModal/index.tsx +183 -190
- package/src/components/rsvpContainer/index.tsx +126 -0
- package/src/components/stripePayment/index.tsx +258 -253
- package/src/components/stripePayment/style.css +60 -60
- package/src/components/ticketResale/index.tsx +74 -56
- package/src/components/ticketResaleModal/index.tsx +213 -210
- package/src/components/ticketResaleModal/style.css +28 -28
- package/src/components/ticketsContainer/AccessCodeSection.tsx +50 -0
- package/src/components/ticketsContainer/PromoCodeSection.tsx +89 -99
- package/src/components/ticketsContainer/ReferralLogic.tsx +31 -33
- package/src/components/ticketsContainer/TicketRow.tsx +89 -83
- package/src/components/ticketsContainer/TicketsSection.tsx +87 -81
- package/src/components/ticketsContainer/index.tsx +506 -409
- package/src/components/ticketsContainer/style.css +181 -181
- package/src/components/ticketsContainer/utils.ts +11 -11
- package/src/components/timerWidget/index.tsx +87 -70
- package/src/components/timerWidget/style.css +34 -26
- package/src/components/waitingList/index.tsx +178 -178
- package/src/components/waitingList/style.css +26 -26
- package/src/env.ts +20 -19
- package/src/index.ts +15 -13
- package/src/normalizers/index.ts +45 -45
- package/src/types/billing-info-data.ts +37 -37
- package/src/types/payment-field.ts +7 -7
- package/src/types/referral-promotion.ts +7 -7
- package/src/utils/cookies.ts +42 -0
- package/src/utils/createCheckoutDataBodyWithDefaultHolder.ts +71 -59
- package/src/utils/downloadPDF.tsx +52 -30
- package/src/utils/formikErrorFocus.ts +24 -24
- package/src/utils/getDomain.ts +15 -0
- package/src/utils/getImage.ts +14 -14
- package/src/utils/getQueryVariable.ts +13 -13
- package/src/utils/index.ts +7 -5
- package/src/utils/setConfigs.ts +26 -26
- package/src/utils/showZero.tsx +10 -10
- package/src/validators/index.ts +20 -20
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Select from '@mui/material/Select'
|
|
3
|
-
import _map from 'lodash/map'
|
|
4
|
-
import _get from 'lodash/get'
|
|
5
|
-
|
|
6
|
-
import { FieldInputProps, FormikProps } from 'formik'
|
|
7
|
-
import { FormControl, InputLabel, FormHelperText } from '@mui/material'
|
|
8
|
-
import { useTheme } from '@mui/styles'
|
|
9
|
-
|
|
10
|
-
export interface ISelectOption {
|
|
11
|
-
label: string | number;
|
|
12
|
-
value?: string | number;
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface ISelectField {
|
|
17
|
-
label: string;
|
|
18
|
-
|
|
19
|
-
field: FieldInputProps<any>;
|
|
20
|
-
form: FormikProps<any>;
|
|
21
|
-
theme: 'dark' | 'light';
|
|
22
|
-
|
|
23
|
-
// optional
|
|
24
|
-
type?: string;
|
|
25
|
-
selectOptions?: ISelectOption[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface IOtherProps {
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const SelectField = ({
|
|
33
|
-
label,
|
|
34
|
-
type = 'text',
|
|
35
|
-
field,
|
|
36
|
-
selectOptions = [] as ISelectOption[],
|
|
37
|
-
form: { touched, errors },
|
|
38
|
-
theme,
|
|
39
|
-
}: ISelectField & IOtherProps) => {
|
|
40
|
-
const isTouched = Boolean(_get(touched, field.name))
|
|
41
|
-
const error = _get(errors, field.name)
|
|
42
|
-
|
|
43
|
-
const customTheme: any = useTheme()
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<FormControl fullWidth={true}>
|
|
47
|
-
<InputLabel style={customTheme?.input} htmlFor={field.name} error={!!error && isTouched} shrink={true}>
|
|
48
|
-
{label}
|
|
49
|
-
</InputLabel>
|
|
50
|
-
<Select
|
|
51
|
-
id={field.name}
|
|
52
|
-
label={label}
|
|
53
|
-
type={type}
|
|
54
|
-
fullWidth={true}
|
|
55
|
-
error={!!error && isTouched}
|
|
56
|
-
inputProps={{
|
|
57
|
-
id: field.name,
|
|
58
|
-
}}
|
|
59
|
-
native={true}
|
|
60
|
-
className={theme}
|
|
61
|
-
MenuProps={{ className: theme }}
|
|
62
|
-
{...field}
|
|
63
|
-
style={customTheme?.input}
|
|
64
|
-
>
|
|
65
|
-
{_map(selectOptions, option => (
|
|
66
|
-
<option
|
|
67
|
-
key={option.value}
|
|
68
|
-
value={option.value}
|
|
69
|
-
disabled={option.disabled}
|
|
70
|
-
>
|
|
71
|
-
{option.label}
|
|
72
|
-
</option>
|
|
73
|
-
))}
|
|
74
|
-
</Select>
|
|
75
|
-
{isTouched && error ? (
|
|
76
|
-
<FormHelperText error={!!error && isTouched}>{error}</FormHelperText>
|
|
77
|
-
) : null}
|
|
78
|
-
</FormControl>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Select from '@mui/material/Select'
|
|
3
|
+
import _map from 'lodash/map'
|
|
4
|
+
import _get from 'lodash/get'
|
|
5
|
+
|
|
6
|
+
import { FieldInputProps, FormikProps } from 'formik'
|
|
7
|
+
import { FormControl, InputLabel, FormHelperText } from '@mui/material'
|
|
8
|
+
import { useTheme } from '@mui/styles'
|
|
9
|
+
|
|
10
|
+
export interface ISelectOption {
|
|
11
|
+
label: string | number;
|
|
12
|
+
value?: string | number;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ISelectField {
|
|
17
|
+
label: string;
|
|
18
|
+
|
|
19
|
+
field: FieldInputProps<any>;
|
|
20
|
+
form: FormikProps<any>;
|
|
21
|
+
theme: 'dark' | 'light';
|
|
22
|
+
|
|
23
|
+
// optional
|
|
24
|
+
type?: string;
|
|
25
|
+
selectOptions?: ISelectOption[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface IOtherProps {
|
|
29
|
+
[key: string]: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const SelectField = ({
|
|
33
|
+
label,
|
|
34
|
+
type = 'text',
|
|
35
|
+
field,
|
|
36
|
+
selectOptions = [] as ISelectOption[],
|
|
37
|
+
form: { touched, errors },
|
|
38
|
+
theme,
|
|
39
|
+
}: ISelectField & IOtherProps) => {
|
|
40
|
+
const isTouched = Boolean(_get(touched, field.name))
|
|
41
|
+
const error = _get(errors, field.name)
|
|
42
|
+
|
|
43
|
+
const customTheme: any = useTheme()
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<FormControl fullWidth={true}>
|
|
47
|
+
<InputLabel style={customTheme?.input} htmlFor={field.name} error={!!error && isTouched} shrink={true}>
|
|
48
|
+
{label}
|
|
49
|
+
</InputLabel>
|
|
50
|
+
<Select
|
|
51
|
+
id={field.name}
|
|
52
|
+
label={label}
|
|
53
|
+
type={type}
|
|
54
|
+
fullWidth={true}
|
|
55
|
+
error={!!error && isTouched}
|
|
56
|
+
inputProps={{
|
|
57
|
+
id: field.name,
|
|
58
|
+
}}
|
|
59
|
+
native={true}
|
|
60
|
+
className={theme}
|
|
61
|
+
MenuProps={{ className: theme }}
|
|
62
|
+
{...field}
|
|
63
|
+
style={customTheme?.input}
|
|
64
|
+
>
|
|
65
|
+
{_map(selectOptions, option => (
|
|
66
|
+
<option
|
|
67
|
+
key={option.value}
|
|
68
|
+
value={option.value}
|
|
69
|
+
disabled={option.disabled}
|
|
70
|
+
>
|
|
71
|
+
{option.label}
|
|
72
|
+
</option>
|
|
73
|
+
))}
|
|
74
|
+
</Select>
|
|
75
|
+
{isTouched && error ? (
|
|
76
|
+
<FormHelperText error={!!error && isTouched}>{error}</FormHelperText>
|
|
77
|
+
) : null}
|
|
78
|
+
</FormControl>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Alert, AlertColor, Snackbar, SnackbarOrigin } from '@mui/material'
|
|
3
|
+
|
|
4
|
+
interface ISnackbarAlertProps {
|
|
5
|
+
isOpen: boolean
|
|
6
|
+
message: string
|
|
7
|
+
type: AlertColor
|
|
8
|
+
position?: SnackbarOrigin
|
|
9
|
+
autoHideDuration?: number
|
|
10
|
+
variant?: 'filled' | 'standard' | 'outlined'
|
|
11
|
+
|
|
12
|
+
onClose: () => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const SnackbarAlert = ({
|
|
16
|
+
isOpen,
|
|
17
|
+
message,
|
|
18
|
+
type,
|
|
19
|
+
position,
|
|
20
|
+
autoHideDuration = 3000,
|
|
21
|
+
variant,
|
|
22
|
+
onClose,
|
|
23
|
+
}: ISnackbarAlertProps) => {
|
|
24
|
+
return (
|
|
25
|
+
<div className="snackbar-alert-container">
|
|
26
|
+
<Snackbar
|
|
27
|
+
autoHideDuration={autoHideDuration}
|
|
28
|
+
open={isOpen}
|
|
29
|
+
anchorOrigin={position || { vertical: 'top', horizontal: 'center' }}
|
|
30
|
+
onClose={onClose}
|
|
31
|
+
classes={{
|
|
32
|
+
root: 'snackbar-alert-snackbar-root',
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
<Alert
|
|
36
|
+
severity={type}
|
|
37
|
+
onClose={onClose}
|
|
38
|
+
variant={variant || 'filled'}
|
|
39
|
+
classes={{
|
|
40
|
+
icon: 'snackbar-alert-icon',
|
|
41
|
+
root: 'snackbar-alert-alert-root',
|
|
42
|
+
action: 'snackbar-alert-action',
|
|
43
|
+
message: 'snackbar-alert-message',
|
|
44
|
+
filled: 'snackbar-alert-filled',
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
{message}
|
|
48
|
+
</Alert>
|
|
49
|
+
</Snackbar>
|
|
50
|
+
</div>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default SnackbarAlert
|
|
@@ -0,0 +1,96 @@
|
|
|
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 (_) 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
|
+
exports.__esModule = true;
|
|
50
|
+
exports.PhoneNumberField = void 0;
|
|
51
|
+
var TextField_1 = require("@mui/material/TextField");
|
|
52
|
+
var debounce_1 = require("lodash/debounce");
|
|
53
|
+
var get_1 = require("lodash/get");
|
|
54
|
+
var react_1 = require("react");
|
|
55
|
+
var api_1 = require("../../api");
|
|
56
|
+
exports.PhoneNumberField = function (_a) {
|
|
57
|
+
var label = _a.label, _b = _a.type, type = _b === void 0 ? 'text' : _b, field = _a.field, _c = _a.form, errors = _c.errors, setFieldError = _c.setFieldError, setStatus = _c.setStatus;
|
|
58
|
+
var error = get_1["default"](errors, field.name);
|
|
59
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
+
var debounceCb = react_1.useCallback(debounce_1["default"](function (cb) { return void cb(); }, 1000), []);
|
|
61
|
+
react_1.useEffect(function () {
|
|
62
|
+
var _a;
|
|
63
|
+
if (field.value) {
|
|
64
|
+
setStatus((_a = {}, _a[field.name] = true, _a));
|
|
65
|
+
}
|
|
66
|
+
debounceCb(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var error_1, message;
|
|
68
|
+
var _a;
|
|
69
|
+
return __generator(this, function (_b) {
|
|
70
|
+
switch (_b.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
_b.trys.push([0, 3, 4, 5]);
|
|
73
|
+
if (!field.value) return [3 /*break*/, 2];
|
|
74
|
+
return [4 /*yield*/, api_1.validatePhoneNumber(field.value)];
|
|
75
|
+
case 1:
|
|
76
|
+
_b.sent();
|
|
77
|
+
_b.label = 2;
|
|
78
|
+
case 2:
|
|
79
|
+
setFieldError(field.name, '');
|
|
80
|
+
return [3 /*break*/, 5];
|
|
81
|
+
case 3:
|
|
82
|
+
error_1 = _b.sent();
|
|
83
|
+
message = get_1["default"](error_1, 'response.data.message', 'Invalid phone number');
|
|
84
|
+
setFieldError(field.name, message);
|
|
85
|
+
return [3 /*break*/, 5];
|
|
86
|
+
case 4:
|
|
87
|
+
setStatus((_a = {}, _a[field.name] = false, _a));
|
|
88
|
+
return [7 /*endfinally*/];
|
|
89
|
+
case 5: return [2 /*return*/];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}); });
|
|
93
|
+
// eslint-disable-next-line
|
|
94
|
+
}, [field.value]);
|
|
95
|
+
return (react_1["default"].createElement(TextField_1["default"], __assign({}, field, { id: field.name, label: label, type: type, fullWidth: true, error: !!error, helperText: error, value: field.value || '', inputProps: { pattern: '[+0-9]/d+' } })));
|
|
96
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { CheckboxField } from './CheckboxField'
|
|
2
|
-
export { CustomField } from './CustomField'
|
|
3
|
-
export { FormikPhoneNumberField } from './FormikPhoneNumberField'
|
|
4
|
-
export { Loader } from './Loader'
|
|
1
|
+
export { CheckboxField } from './CheckboxField'
|
|
2
|
+
export { CustomField } from './CustomField'
|
|
3
|
+
export { FormikPhoneNumberField } from './FormikPhoneNumberField'
|
|
4
|
+
export { Loader } from './Loader'
|
|
5
5
|
export { SelectField } from './SelectField'
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import React, { FC } from 'react'
|
|
2
|
-
import Modal from '@mui/material/Modal'
|
|
3
|
-
import Box from '@mui/material/Box'
|
|
4
|
-
import Button from '@mui/material/Button';
|
|
5
|
-
import './style.css'
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
message: string;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
onConfirm: () => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const style: React.CSSProperties = {
|
|
14
|
-
position: 'absolute',
|
|
15
|
-
top: '50%',
|
|
16
|
-
left: '50%',
|
|
17
|
-
transform: 'translate(-50%, -50%)',
|
|
18
|
-
minWidth: 480,
|
|
19
|
-
backgroundColor: '#e3e3e3',
|
|
20
|
-
border: '1px solid white',
|
|
21
|
-
outline: 'none',
|
|
22
|
-
padding: '14px',
|
|
23
|
-
maxHeight: '85vh',
|
|
24
|
-
overflow: 'auto'
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const ConfirmModal: FC<Props> = ({
|
|
28
|
-
message = '',
|
|
29
|
-
onClose = () => {},
|
|
30
|
-
onConfirm = () => {},
|
|
31
|
-
}) => {
|
|
32
|
-
return (
|
|
33
|
-
<Modal
|
|
34
|
-
open={true}
|
|
35
|
-
onClose={onClose}
|
|
36
|
-
aria-labelledby="modal-modal-title"
|
|
37
|
-
aria-describedby="modal-modal-description"
|
|
38
|
-
className='confirm-modal'
|
|
39
|
-
>
|
|
40
|
-
<Box style={style}>
|
|
41
|
-
<p>{message}</p>
|
|
42
|
-
<div className='footer'>
|
|
43
|
-
<Button onClick={onClose}>Cancel</Button>
|
|
44
|
-
<Button onClick={onConfirm}>OK</Button>
|
|
45
|
-
</div>
|
|
46
|
-
</Box>
|
|
47
|
-
</Modal>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export default ConfirmModal
|
|
1
|
+
import React, { FC } from 'react'
|
|
2
|
+
import Modal from '@mui/material/Modal'
|
|
3
|
+
import Box from '@mui/material/Box'
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import './style.css'
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
message: string;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
onConfirm: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const style: React.CSSProperties = {
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
top: '50%',
|
|
16
|
+
left: '50%',
|
|
17
|
+
transform: 'translate(-50%, -50%)',
|
|
18
|
+
minWidth: 480,
|
|
19
|
+
backgroundColor: '#e3e3e3',
|
|
20
|
+
border: '1px solid white',
|
|
21
|
+
outline: 'none',
|
|
22
|
+
padding: '14px',
|
|
23
|
+
maxHeight: '85vh',
|
|
24
|
+
overflow: 'auto'
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const ConfirmModal: FC<Props> = ({
|
|
28
|
+
message = '',
|
|
29
|
+
onClose = () => {},
|
|
30
|
+
onConfirm = () => {},
|
|
31
|
+
}) => {
|
|
32
|
+
return (
|
|
33
|
+
<Modal
|
|
34
|
+
open={true}
|
|
35
|
+
onClose={onClose}
|
|
36
|
+
aria-labelledby="modal-modal-title"
|
|
37
|
+
aria-describedby="modal-modal-description"
|
|
38
|
+
className='confirm-modal'
|
|
39
|
+
>
|
|
40
|
+
<Box style={style}>
|
|
41
|
+
<p>{message}</p>
|
|
42
|
+
<div className='footer'>
|
|
43
|
+
<Button onClick={onClose}>Cancel</Button>
|
|
44
|
+
<Button onClick={onConfirm}>OK</Button>
|
|
45
|
+
</div>
|
|
46
|
+
</Box>
|
|
47
|
+
</Modal>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default ConfirmModal
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
.confirm-modal .footer {
|
|
2
|
-
display: flex;
|
|
3
|
-
gap: 10px;
|
|
4
|
-
justify-content: flex-end;
|
|
5
|
-
border-top: 1px solid rgb(192, 191, 191);
|
|
6
|
-
}
|
|
7
|
-
.confirm-modal .footer button {
|
|
8
|
-
width: max-content;
|
|
9
|
-
padding: 12px 8px;
|
|
10
|
-
font-size: 12px;
|
|
11
|
-
min-height: unset;
|
|
12
|
-
text-transform: unset;
|
|
13
|
-
}
|
|
14
|
-
.confirm-modal .footer button:hover {
|
|
15
|
-
width: max-content;
|
|
16
|
-
padding: 12px 8px;
|
|
17
|
-
font-size: 12px;
|
|
18
|
-
background: #505050;
|
|
19
|
-
min-height: unset;
|
|
20
|
-
text-transform: unset;
|
|
21
|
-
}
|
|
1
|
+
.confirm-modal .footer {
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: 10px;
|
|
4
|
+
justify-content: flex-end;
|
|
5
|
+
border-top: 1px solid rgb(192, 191, 191);
|
|
6
|
+
}
|
|
7
|
+
.confirm-modal .footer button {
|
|
8
|
+
width: max-content;
|
|
9
|
+
padding: 12px 8px;
|
|
10
|
+
font-size: 12px;
|
|
11
|
+
min-height: unset;
|
|
12
|
+
text-transform: unset;
|
|
13
|
+
}
|
|
14
|
+
.confirm-modal .footer button:hover {
|
|
15
|
+
width: max-content;
|
|
16
|
+
padding: 12px 8px;
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
background: #505050;
|
|
19
|
+
min-height: unset;
|
|
20
|
+
text-transform: unset;
|
|
21
|
+
}
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FacebookShareButton,
|
|
3
|
-
FacebookMessengerShareButton,
|
|
4
|
-
TwitterShareButton,
|
|
5
|
-
LinkedinShareButton,
|
|
6
|
-
PinterestShareButton,
|
|
7
|
-
VKShareButton,
|
|
8
|
-
OKShareButton,
|
|
9
|
-
TelegramShareButton,
|
|
10
|
-
WhatsappShareButton,
|
|
11
|
-
RedditShareButton,
|
|
12
|
-
TumblrShareButton,
|
|
13
|
-
MailruShareButton,
|
|
14
|
-
EmailShareButton,
|
|
15
|
-
LivejournalShareButton,
|
|
16
|
-
ViberShareButton,
|
|
17
|
-
WorkplaceShareButton,
|
|
18
|
-
LineShareButton,
|
|
19
|
-
PocketShareButton,
|
|
20
|
-
InstapaperShareButton,
|
|
21
|
-
WeiboShareButton,
|
|
22
|
-
HatenaShareButton,
|
|
23
|
-
FacebookIcon,
|
|
24
|
-
FacebookMessengerIcon,
|
|
25
|
-
TwitterIcon,
|
|
26
|
-
LinkedinIcon,
|
|
27
|
-
PinterestIcon,
|
|
28
|
-
VKIcon,
|
|
29
|
-
OKIcon,
|
|
30
|
-
TelegramIcon,
|
|
31
|
-
WhatsappIcon,
|
|
32
|
-
RedditIcon,
|
|
33
|
-
TumblrIcon,
|
|
34
|
-
MailruIcon,
|
|
35
|
-
EmailIcon,
|
|
36
|
-
LivejournalIcon,
|
|
37
|
-
ViberIcon,
|
|
38
|
-
WorkplaceIcon,
|
|
39
|
-
LineIcon,
|
|
40
|
-
PocketIcon,
|
|
41
|
-
InstapaperIcon,
|
|
42
|
-
WeiboIcon,
|
|
43
|
-
HatenaIcon,
|
|
44
|
-
} from 'react-share'
|
|
45
|
-
|
|
46
|
-
const config: any = {
|
|
47
|
-
facebook: { component: FacebookShareButton, icon: FacebookIcon },
|
|
48
|
-
messenger: { component: FacebookMessengerShareButton, icon: FacebookMessengerIcon },
|
|
49
|
-
twitter: { component: TwitterShareButton, icon: TwitterIcon },
|
|
50
|
-
linkedin: { component: LinkedinShareButton, icon: LinkedinIcon },
|
|
51
|
-
pinterest: { component: PinterestShareButton, icon: PinterestIcon },
|
|
52
|
-
vk: { component: VKShareButton, icon: VKIcon },
|
|
53
|
-
ok: { component: OKShareButton, icon: OKIcon },
|
|
54
|
-
telegram: { component: TelegramShareButton, icon: TelegramIcon },
|
|
55
|
-
whatsapp: { component: WhatsappShareButton, icon: WhatsappIcon },
|
|
56
|
-
reddit: { component: RedditShareButton, icon: RedditIcon },
|
|
57
|
-
tumblr: { component: TumblrShareButton, icon: TumblrIcon },
|
|
58
|
-
mailru: { component: MailruShareButton, icon: MailruIcon },
|
|
59
|
-
email: { component: EmailShareButton, icon: EmailIcon },
|
|
60
|
-
livejournal: { component: LivejournalShareButton, icon: LivejournalIcon },
|
|
61
|
-
viber: { component: ViberShareButton, icon: ViberIcon },
|
|
62
|
-
workplace: { component: WorkplaceShareButton, icon: WorkplaceIcon },
|
|
63
|
-
line: { component: LineShareButton, icon: LineIcon },
|
|
64
|
-
pocket: { component: PocketShareButton, icon: PocketIcon },
|
|
65
|
-
instapaper: { component: InstapaperShareButton, icon: InstapaperIcon },
|
|
66
|
-
weibo: { component: WeiboShareButton, icon: WeiboIcon },
|
|
67
|
-
hatena: { component: HatenaShareButton, icon: HatenaIcon },
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default function (key: string) {
|
|
71
|
-
return config[key]
|
|
72
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
FacebookShareButton,
|
|
3
|
+
FacebookMessengerShareButton,
|
|
4
|
+
TwitterShareButton,
|
|
5
|
+
LinkedinShareButton,
|
|
6
|
+
PinterestShareButton,
|
|
7
|
+
VKShareButton,
|
|
8
|
+
OKShareButton,
|
|
9
|
+
TelegramShareButton,
|
|
10
|
+
WhatsappShareButton,
|
|
11
|
+
RedditShareButton,
|
|
12
|
+
TumblrShareButton,
|
|
13
|
+
MailruShareButton,
|
|
14
|
+
EmailShareButton,
|
|
15
|
+
LivejournalShareButton,
|
|
16
|
+
ViberShareButton,
|
|
17
|
+
WorkplaceShareButton,
|
|
18
|
+
LineShareButton,
|
|
19
|
+
PocketShareButton,
|
|
20
|
+
InstapaperShareButton,
|
|
21
|
+
WeiboShareButton,
|
|
22
|
+
HatenaShareButton,
|
|
23
|
+
FacebookIcon,
|
|
24
|
+
FacebookMessengerIcon,
|
|
25
|
+
TwitterIcon,
|
|
26
|
+
LinkedinIcon,
|
|
27
|
+
PinterestIcon,
|
|
28
|
+
VKIcon,
|
|
29
|
+
OKIcon,
|
|
30
|
+
TelegramIcon,
|
|
31
|
+
WhatsappIcon,
|
|
32
|
+
RedditIcon,
|
|
33
|
+
TumblrIcon,
|
|
34
|
+
MailruIcon,
|
|
35
|
+
EmailIcon,
|
|
36
|
+
LivejournalIcon,
|
|
37
|
+
ViberIcon,
|
|
38
|
+
WorkplaceIcon,
|
|
39
|
+
LineIcon,
|
|
40
|
+
PocketIcon,
|
|
41
|
+
InstapaperIcon,
|
|
42
|
+
WeiboIcon,
|
|
43
|
+
HatenaIcon,
|
|
44
|
+
} from 'react-share'
|
|
45
|
+
|
|
46
|
+
const config: any = {
|
|
47
|
+
facebook: { component: FacebookShareButton, icon: FacebookIcon },
|
|
48
|
+
messenger: { component: FacebookMessengerShareButton, icon: FacebookMessengerIcon },
|
|
49
|
+
twitter: { component: TwitterShareButton, icon: TwitterIcon },
|
|
50
|
+
linkedin: { component: LinkedinShareButton, icon: LinkedinIcon },
|
|
51
|
+
pinterest: { component: PinterestShareButton, icon: PinterestIcon },
|
|
52
|
+
vk: { component: VKShareButton, icon: VKIcon },
|
|
53
|
+
ok: { component: OKShareButton, icon: OKIcon },
|
|
54
|
+
telegram: { component: TelegramShareButton, icon: TelegramIcon },
|
|
55
|
+
whatsapp: { component: WhatsappShareButton, icon: WhatsappIcon },
|
|
56
|
+
reddit: { component: RedditShareButton, icon: RedditIcon },
|
|
57
|
+
tumblr: { component: TumblrShareButton, icon: TumblrIcon },
|
|
58
|
+
mailru: { component: MailruShareButton, icon: MailruIcon },
|
|
59
|
+
email: { component: EmailShareButton, icon: EmailIcon },
|
|
60
|
+
livejournal: { component: LivejournalShareButton, icon: LivejournalIcon },
|
|
61
|
+
viber: { component: ViberShareButton, icon: ViberIcon },
|
|
62
|
+
workplace: { component: WorkplaceShareButton, icon: WorkplaceIcon },
|
|
63
|
+
line: { component: LineShareButton, icon: LineIcon },
|
|
64
|
+
pocket: { component: PocketShareButton, icon: PocketIcon },
|
|
65
|
+
instapaper: { component: InstapaperShareButton, icon: InstapaperIcon },
|
|
66
|
+
weibo: { component: WeiboShareButton, icon: WeiboIcon },
|
|
67
|
+
hatena: { component: HatenaShareButton, icon: HatenaIcon },
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default function (key: string) {
|
|
71
|
+
return config[key]
|
|
72
|
+
}
|