tf-checkout-react 1.2.25 → 1.2.26
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/api/index.d.ts +1 -8
- package/dist/tf-checkout-react.cjs.development.js +26 -28
- 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 +26 -28
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/setConfigs.d.ts +12 -1
- package/package.json +1 -1
- package/src/api/index.ts +2 -21
- package/src/components/billing-info-container/index.tsx +9 -10
- package/src/utils/setConfigs.ts +23 -4
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/common/dist/PhoneNumberField.js +0 -96
package/dist/api/index.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface IPublicRequest extends AxiosInstance {
|
|
3
|
-
setGuestToken: (token: string) => void;
|
|
4
|
-
setAccessToken: (token: string) => void;
|
|
5
|
-
setBaseUrl: (baseUrl: string) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const publicRequest: IPublicRequest;
|
|
8
|
-
export declare const setXSourceOrigin: (sourceOrigin: string) => void;
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
9
2
|
export declare const setCustomHeader: (response: any) => void;
|
|
10
3
|
export declare const handleSetAccessToken: (token: string) => void;
|
|
11
4
|
export declare function getEvent(id: string | number, pk?: string): Promise<AxiosResponse<any, any>>;
|
|
@@ -911,7 +911,18 @@ try {
|
|
|
911
911
|
}
|
|
912
912
|
});
|
|
913
913
|
|
|
914
|
+
var ttfHeaders = {
|
|
915
|
+
Accept: 'application/vnd.api+json',
|
|
916
|
+
'Content-Type': 'application/vnd.api+json'
|
|
917
|
+
};
|
|
914
918
|
var CONFIGS = {};
|
|
919
|
+
var publicRequest = /*#__PURE__*/axios.create({
|
|
920
|
+
baseURL: CONFIGS.BASE_URL || "https://www.ticketfairy.com/api",
|
|
921
|
+
headers: ttfHeaders
|
|
922
|
+
});
|
|
923
|
+
var setXSourceOrigin = function setXSourceOrigin(sourceOrigin) {
|
|
924
|
+
ttfHeaders['X-Source-Origin'] = sourceOrigin;
|
|
925
|
+
};
|
|
915
926
|
var setConfigs = function setConfigs(configs) {
|
|
916
927
|
_forEach(configs, function (value, key) {
|
|
917
928
|
CONFIGS[key] = value;
|
|
@@ -1168,19 +1179,11 @@ var createCheckoutDataBodyWithDefaultHolder = function createCheckoutDataBodyWit
|
|
|
1168
1179
|
|
|
1169
1180
|
var isWindowDefined = typeof window !== 'undefined';
|
|
1170
1181
|
var isDocumentDefined = typeof document !== 'undefined';
|
|
1171
|
-
var ttfHeaders = {
|
|
1172
|
-
Accept: 'application/vnd.api+json',
|
|
1173
|
-
'Content-Type': 'application/vnd.api+json'
|
|
1174
|
-
};
|
|
1175
1182
|
|
|
1176
1183
|
if (isWindowDefined && localStorage.getItem('auth_guest_token')) {
|
|
1177
1184
|
ttfHeaders['Authorization-Guest'] = /*#__PURE__*/localStorage.getItem('auth_guest_token');
|
|
1178
1185
|
}
|
|
1179
1186
|
|
|
1180
|
-
var publicRequest = /*#__PURE__*/axios.create({
|
|
1181
|
-
baseURL: CONFIGS.BASE_URL || "https://www.ticketfairy.com/api",
|
|
1182
|
-
headers: ttfHeaders
|
|
1183
|
-
});
|
|
1184
1187
|
publicRequest.interceptors.response.use(function (response) {
|
|
1185
1188
|
var authGuestToken = _get(response, 'headers.authorization-guest');
|
|
1186
1189
|
|
|
@@ -1287,9 +1290,6 @@ publicRequest.setAccessToken = function (token) {
|
|
|
1287
1290
|
return publicRequest.defaults.headers.common.Authorization = token;
|
|
1288
1291
|
};
|
|
1289
1292
|
|
|
1290
|
-
var setXSourceOrigin = function setXSourceOrigin(sourceOrigin) {
|
|
1291
|
-
ttfHeaders['X-Source-Origin'] = sourceOrigin;
|
|
1292
|
-
};
|
|
1293
1293
|
var setCustomHeader = function setCustomHeader(response) {
|
|
1294
1294
|
var guestHeaderResponseValue = _get(response, 'headers.authorization-guest');
|
|
1295
1295
|
|
|
@@ -3241,7 +3241,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
|
|
|
3241
3241
|
enableReinitialize: false,
|
|
3242
3242
|
onSubmit: function () {
|
|
3243
3243
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(values, formikHelpers) {
|
|
3244
|
-
var
|
|
3244
|
+
var _checkoutBody, _res, updatedUserData, _profileSpecifiedData, _profileDataObj, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, accessToken, refreshToken, userProfile, _e$response, _e$response$data, _error, profileData, profileSpecifiedData, profileDataObj, checkoutBody, res, _e$response2, _e$response3;
|
|
3245
3245
|
|
|
3246
3246
|
return runtime_1.wrap(function _callee6$(_context6) {
|
|
3247
3247
|
while (1) {
|
|
@@ -3254,31 +3254,29 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref3) {
|
|
|
3254
3254
|
break;
|
|
3255
3255
|
}
|
|
3256
3256
|
|
|
3257
|
-
|
|
3258
|
-
|
|
3257
|
+
_checkoutBody = collectCheckoutBody(values, userData);
|
|
3258
|
+
_context6.next = 5;
|
|
3259
|
+
return postOnCheckout(_checkoutBody, access_token);
|
|
3260
|
+
|
|
3261
|
+
case 5:
|
|
3262
|
+
_res = _context6.sent;
|
|
3263
|
+
removeReferralKey(); // After checkout is successful recover updated profile and store it on local storage if needed
|
|
3264
|
+
|
|
3265
|
+
if (!isWindowDefined) {
|
|
3266
|
+
_context6.next = 14;
|
|
3259
3267
|
break;
|
|
3260
3268
|
}
|
|
3261
3269
|
|
|
3262
|
-
_context6.next =
|
|
3270
|
+
_context6.next = 10;
|
|
3263
3271
|
return getProfileData(access_token);
|
|
3264
3272
|
|
|
3265
|
-
case
|
|
3273
|
+
case 10:
|
|
3266
3274
|
updatedUserData = _context6.sent;
|
|
3267
3275
|
_profileSpecifiedData = _get(updatedUserData, 'data.data');
|
|
3268
3276
|
_profileDataObj = setLoggedUserData$1(_profileSpecifiedData);
|
|
3277
|
+
window.localStorage.setItem('user_data', JSON.stringify(_profileDataObj));
|
|
3269
3278
|
|
|
3270
|
-
|
|
3271
|
-
window.localStorage.setItem('user_data', JSON.stringify(_profileDataObj));
|
|
3272
|
-
}
|
|
3273
|
-
|
|
3274
|
-
case 9:
|
|
3275
|
-
_checkoutBody = collectCheckoutBody(values, userData);
|
|
3276
|
-
_context6.next = 12;
|
|
3277
|
-
return postOnCheckout(_checkoutBody, access_token);
|
|
3278
|
-
|
|
3279
|
-
case 12:
|
|
3280
|
-
_res = _context6.sent;
|
|
3281
|
-
removeReferralKey();
|
|
3279
|
+
case 14:
|
|
3282
3280
|
handleSubmit(values, formikHelpers, eventId, _res);
|
|
3283
3281
|
return _context6.abrupt("return");
|
|
3284
3282
|
|