tf-checkout-react 1.0.51 → 1.0.52
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/billing-info-container/utils.d.ts +5 -1
- package/dist/components/common/CustomField.d.ts +1 -1
- package/dist/tf-checkout-react.cjs.development.js +34 -26
- 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 +34 -26
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/billing-info-container/index.tsx +7 -1
- package/src/components/billing-info-container/utils.ts +9 -1
- package/src/components/common/CustomField.tsx +2 -4
- package/src/components/common/SelectField.tsx +1 -1
|
@@ -8,7 +8,11 @@ export interface IValues {
|
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
export declare const getInitialValues: (data?: any, propsInitialValues?: IValues, userValues?: any) => IValues;
|
|
11
|
-
export declare const createRegisterFormData: (values
|
|
11
|
+
export declare const createRegisterFormData: (values: IValues | undefined, checkoutBody: {
|
|
12
|
+
attributes: {
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
}) => FormData;
|
|
12
16
|
interface ICheckoutBody {
|
|
13
17
|
attributes: {
|
|
14
18
|
[key: string]: any;
|
|
@@ -16,5 +16,5 @@ export interface ICustomField {
|
|
|
16
16
|
interface IOtherProps {
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
}
|
|
19
|
-
export declare const CustomField: ({ label, type, field, selectOptions, form: { touched, errors }, theme, }: ICustomField & IOtherProps) => JSX.Element;
|
|
19
|
+
export declare const CustomField: ({ label, type, field, selectOptions, form: { touched, errors, submitCount }, theme, }: ICustomField & IOtherProps) => JSX.Element;
|
|
20
20
|
export {};
|
|
@@ -1526,7 +1526,7 @@ var getInitialValues = function getInitialValues(data, propsInitialValues, userV
|
|
|
1526
1526
|
|
|
1527
1527
|
return initialValues;
|
|
1528
1528
|
};
|
|
1529
|
-
var createRegisterFormData = function createRegisterFormData(values) {
|
|
1529
|
+
var createRegisterFormData = function createRegisterFormData(values, checkoutBody) {
|
|
1530
1530
|
if (values === void 0) {
|
|
1531
1531
|
values = {};
|
|
1532
1532
|
}
|
|
@@ -1539,6 +1539,11 @@ var createRegisterFormData = function createRegisterFormData(values) {
|
|
|
1539
1539
|
bodyFormData.append('password_confirmation', values.confirmPassword);
|
|
1540
1540
|
bodyFormData.append('client_id', ENV.CLIENT_ID );
|
|
1541
1541
|
bodyFormData.append('client_secret', ENV.CLIENT_SECRET );
|
|
1542
|
+
|
|
1543
|
+
_forEach(checkoutBody.attributes, function (item, key) {
|
|
1544
|
+
bodyFormData.append(key, item);
|
|
1545
|
+
});
|
|
1546
|
+
|
|
1542
1547
|
return bodyFormData;
|
|
1543
1548
|
};
|
|
1544
1549
|
var setLoggedUserData = function setLoggedUserData(data) {
|
|
@@ -1678,13 +1683,13 @@ var CustomField = function CustomField(_ref) {
|
|
|
1678
1683
|
_ref$form = _ref.form,
|
|
1679
1684
|
touched = _ref$form.touched,
|
|
1680
1685
|
errors = _ref$form.errors,
|
|
1686
|
+
submitCount = _ref$form.submitCount,
|
|
1681
1687
|
theme = _ref.theme;
|
|
1682
1688
|
var isSelectField = type === 'select';
|
|
1683
|
-
var isShrink = Boolean(field.value) || type === 'date' || type === 'select';
|
|
1684
1689
|
|
|
1685
1690
|
var error = _get(errors, field.name);
|
|
1686
1691
|
|
|
1687
|
-
var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error;
|
|
1692
|
+
var isTouched = Boolean(_get(touched, field.name)) || _includes(field.name, 'holder') && !!error && !!submitCount;
|
|
1688
1693
|
var classes = useStyles();
|
|
1689
1694
|
return React__default.createElement(TextField, Object.assign({
|
|
1690
1695
|
id: field.name,
|
|
@@ -1694,9 +1699,6 @@ var CustomField = function CustomField(_ref) {
|
|
|
1694
1699
|
fullWidth: true,
|
|
1695
1700
|
error: !!error && isTouched,
|
|
1696
1701
|
helperText: isTouched && error,
|
|
1697
|
-
InputLabelProps: {
|
|
1698
|
-
shrink: isShrink
|
|
1699
|
-
},
|
|
1700
1702
|
InputProps: {
|
|
1701
1703
|
classes: {
|
|
1702
1704
|
input: classes.input
|
|
@@ -1774,7 +1776,8 @@ var SelectField = function SelectField(_ref) {
|
|
|
1774
1776
|
fullWidth: true
|
|
1775
1777
|
}, React__default.createElement(material.InputLabel, {
|
|
1776
1778
|
htmlFor: field.name,
|
|
1777
|
-
error: !!error && isTouched
|
|
1779
|
+
error: !!error && isTouched,
|
|
1780
|
+
shrink: true
|
|
1778
1781
|
}, label), React__default.createElement(Select, Object.assign({
|
|
1779
1782
|
id: field.name,
|
|
1780
1783
|
label: label,
|
|
@@ -2231,7 +2234,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2231
2234
|
enableReinitialize: true,
|
|
2232
2235
|
onSubmit: function () {
|
|
2233
2236
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(values, formikHelpers) {
|
|
2234
|
-
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, bodyFormData, access_token_register, resRegister, refreshToken, tokens, _e$response, _e$response$data, error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2;
|
|
2237
|
+
var updatedUserData, _profileSpecifiedData, _profileDataObj, _checkoutBody, _res, checkoutBodyForRegistration, bodyFormData, access_token_register, resRegister, refreshToken, tokens, _e$response, _e$response$data, error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2;
|
|
2235
2238
|
|
|
2236
2239
|
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2237
2240
|
while (1) {
|
|
@@ -2276,13 +2279,18 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2276
2279
|
return _context5.abrupt("return");
|
|
2277
2280
|
|
|
2278
2281
|
case 15:
|
|
2279
|
-
|
|
2282
|
+
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2283
|
+
emailLogged: emailLogged,
|
|
2284
|
+
firstNameLogged: firstNameLogged,
|
|
2285
|
+
lastNameLogged: lastNameLogged
|
|
2286
|
+
}, showDOB);
|
|
2287
|
+
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2280
2288
|
access_token_register = null;
|
|
2281
|
-
_context5.prev =
|
|
2282
|
-
_context5.next =
|
|
2289
|
+
_context5.prev = 18;
|
|
2290
|
+
_context5.next = 21;
|
|
2283
2291
|
return register(bodyFormData);
|
|
2284
2292
|
|
|
2285
|
-
case
|
|
2293
|
+
case 21:
|
|
2286
2294
|
resRegister = _context5.sent;
|
|
2287
2295
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2288
2296
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
@@ -2292,12 +2300,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2292
2300
|
refreshToken: refreshToken
|
|
2293
2301
|
};
|
|
2294
2302
|
onRegisterSuccess(tokens);
|
|
2295
|
-
_context5.next =
|
|
2303
|
+
_context5.next = 33;
|
|
2296
2304
|
break;
|
|
2297
2305
|
|
|
2298
|
-
case
|
|
2299
|
-
_context5.prev =
|
|
2300
|
-
_context5.t0 = _context5["catch"](
|
|
2306
|
+
case 29:
|
|
2307
|
+
_context5.prev = 29;
|
|
2308
|
+
_context5.t0 = _context5["catch"](18);
|
|
2301
2309
|
|
|
2302
2310
|
if (axios.isAxiosError(_context5.t0)) {
|
|
2303
2311
|
error = _context5.t0 == null ? void 0 : (_e$response = _context5.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
|
|
@@ -2321,11 +2329,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2321
2329
|
|
|
2322
2330
|
return _context5.abrupt("return");
|
|
2323
2331
|
|
|
2324
|
-
case
|
|
2325
|
-
_context5.next =
|
|
2332
|
+
case 33:
|
|
2333
|
+
_context5.next = 35;
|
|
2326
2334
|
return getProfileData(access_token_register);
|
|
2327
2335
|
|
|
2328
|
-
case
|
|
2336
|
+
case 35:
|
|
2329
2337
|
profileData = _context5.sent;
|
|
2330
2338
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2331
2339
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -2339,17 +2347,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2339
2347
|
firstNameLogged: firstNameLogged,
|
|
2340
2348
|
lastNameLogged: lastNameLogged
|
|
2341
2349
|
}, showDOB);
|
|
2342
|
-
_context5.next =
|
|
2350
|
+
_context5.next = 42;
|
|
2343
2351
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2344
2352
|
|
|
2345
|
-
case
|
|
2353
|
+
case 42:
|
|
2346
2354
|
res = _context5.sent;
|
|
2347
2355
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2348
|
-
_context5.next =
|
|
2356
|
+
_context5.next = 49;
|
|
2349
2357
|
break;
|
|
2350
2358
|
|
|
2351
|
-
case
|
|
2352
|
-
_context5.prev =
|
|
2359
|
+
case 46:
|
|
2360
|
+
_context5.prev = 46;
|
|
2353
2361
|
_context5.t1 = _context5["catch"](0);
|
|
2354
2362
|
|
|
2355
2363
|
if (axios.isAxiosError(_context5.t1)) {
|
|
@@ -2365,12 +2373,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2365
2373
|
onSubmitError(_context5.t1);
|
|
2366
2374
|
}
|
|
2367
2375
|
|
|
2368
|
-
case
|
|
2376
|
+
case 49:
|
|
2369
2377
|
case "end":
|
|
2370
2378
|
return _context5.stop();
|
|
2371
2379
|
}
|
|
2372
2380
|
}
|
|
2373
|
-
}, _callee5, null, [[0,
|
|
2381
|
+
}, _callee5, null, [[0, 46], [18, 29]]);
|
|
2374
2382
|
}));
|
|
2375
2383
|
|
|
2376
2384
|
function onSubmit(_x2, _x3) {
|