manage-app-sdk 0.0.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 +2 -0
- package/dist/Constants/Home.js +85 -0
- package/dist/assets/AppConstant.js +293 -0
- package/dist/assets/androidResources/Connectivity.java +52 -0
- package/dist/assets/androidResources/ConnectivityPackage.java +25 -0
- package/dist/assets/fonts/VoltePlay-Bold.ttf +0 -0
- package/dist/assets/fonts/VoltePlay-Light.ttf +0 -0
- package/dist/assets/fonts/VoltePlay-Medium.ttf +0 -0
- package/dist/assets/fonts/VoltePlay-Regular.ttf +0 -0
- package/dist/assets/fonts/VoltePlay-SemiBold.ttf +0 -0
- package/dist/assets/gif/loader.gif +0 -0
- package/dist/assets/images/PartnerLogosSmall.png +0 -0
- package/dist/assets/images/Union.png +0 -0
- package/dist/assets/images/appIcon.png +0 -0
- package/dist/assets/images/desktop-alert.png +0 -0
- package/dist/assets/images/desktop-cross.png +0 -0
- package/dist/assets/images/mobile-bg.png +0 -0
- package/dist/assets/images/stepper-one-small.png +0 -0
- package/dist/assets/images/stepper-one.png +0 -0
- package/dist/assets/images/stepper-two-small.png +0 -0
- package/dist/assets/images/stepper-two.png +0 -0
- package/dist/assets/images/tablet-bg.png +0 -0
- package/dist/assets/png/Tataplay-Binge.png +0 -0
- package/dist/assets/png/arrowBack.png +0 -0
- package/dist/assets/png/backArrowPng.png +0 -0
- package/dist/assets/svg/BingeLogoSvg.js +44 -0
- package/dist/assets/svg/CrossSvg.js +32 -0
- package/dist/assets/svg/OfferSvg.js +31 -0
- package/dist/assets/svg/PlansSvg.js +75 -0
- package/dist/assets/svg/TickSvg.js +28 -0
- package/dist/assets/svg/arrowBack.js +27 -0
- package/dist/assets/svg/arrowSvg.js +31 -0
- package/dist/components/AppIcon/AppIcon.js +70 -0
- package/dist/components/AppleBanner/AppleMusicBanner.js +36 -0
- package/dist/components/AppleBanner/AppleMusicBannerStyles.js +32 -0
- package/dist/components/AppleBanner/AppleMusicBlackBanner.js +66 -0
- package/dist/components/AppsContainer/AppsContainer.js +112 -0
- package/dist/components/BottomSheet/BottomSheet.js +173 -0
- package/dist/components/BottomSheet/BottomSheetStyles.js +48 -0
- package/dist/components/Buttons/PrimaryButton/PrimaryButton.js +50 -0
- package/dist/components/Buttons/RadioButton/RadioButton.js +24 -0
- package/dist/components/Buttons/TextButton/TextButton.js +44 -0
- package/dist/components/CheckButton/CheckButton.js +36 -0
- package/dist/components/CommonModal/CommonModel.js +79 -0
- package/dist/components/CommonModal/ModalTypes.js +10 -0
- package/dist/components/Confetti/ConfettiBurst.js +120 -0
- package/dist/components/Confetti/FallingConfetti.js +190 -0
- package/dist/components/Confetti/MultiConfettiBurst.js +73 -0
- package/dist/components/Coupon/CouponCard.js +47 -0
- package/dist/components/Coupon/CouponStyles.js +54 -0
- package/dist/components/Footer/Footer.js +177 -0
- package/dist/components/Footer/MServiceFooter/MServiceFooter.js +103 -0
- package/dist/components/Footer/OnButtonFooter/OneButtonFooter.js +65 -0
- package/dist/components/Footer/PlanSummaryFooter/SummaryFooter.js +180 -0
- package/dist/components/Footer/PrimeAoFooter/PrimeAoFooter.js +193 -0
- package/dist/components/Footer/UpgradeFooter/UpgradeFooter.js +89 -0
- package/dist/components/Footer/UpgradeFooter/styles.js +73 -0
- package/dist/components/GradientBorderContainer/GradientBorderContainer.js +79 -0
- package/dist/components/GradientText/GradientText.js +60 -0
- package/dist/components/Header/ManageAppHeader.js +71 -0
- package/dist/components/HighlightedText/HighlightedText.js +53 -0
- package/dist/components/Input/OtpInput.js +105 -0
- package/dist/components/Loader/Loader.js +39 -0
- package/dist/components/MServicePaymentMethod/MServicePaymentMethod.js +395 -0
- package/dist/components/MicroDrama/MicroDramaBanner.js +67 -0
- package/dist/components/MicroDrama/MicroDramaCard.js +33 -0
- package/dist/components/MicroDrama/styles.js +29 -0
- package/dist/components/OfferCard/OfferCard.js +100 -0
- package/dist/components/PaymentMethod/PaymentMethod.js +370 -0
- package/dist/components/Plan/CurrentPlanCard.js +138 -0
- package/dist/components/Plan/PlanCard.js +268 -0
- package/dist/components/Plan/PlanCardStyles.js +371 -0
- package/dist/components/Plan/RenderAppIcons.js +115 -0
- package/dist/components/Plan/SpecialPlanCard.js +272 -0
- package/dist/components/PopUps/CancelPopUp/CancelPopUp.js +190 -0
- package/dist/components/PopUps/ConfettiAnimation.js +172 -0
- package/dist/components/PopUps/ConfettiBurst.js +142 -0
- package/dist/components/PopUps/CouponPopUp/CouponPopUp.js +185 -0
- package/dist/components/PopUps/ErrorMsgPopup/ErrorMsgPopup.js +104 -0
- package/dist/components/PopUps/InternetErrorPopUp/InternetErrorPopUp.js +122 -0
- package/dist/components/PopUps/MServicePopUp/MServicePopUp.js +155 -0
- package/dist/components/PopUps/MpinPopUp/MpinPopUp.js +193 -0
- package/dist/components/PopUps/OtpPopup/OtpPopup.js +345 -0
- package/dist/components/PopUps/PlanCancelledPopUp/PlanCancelledPopUp.js +183 -0
- package/dist/components/PopUps/PlanDetailPopup/PlanDetailPopup.js +121 -0
- package/dist/components/PopUps/PopUp/PopUp.js +171 -0
- package/dist/components/PrimeAddOn/PrimeAddOn.js +72 -0
- package/dist/components/PrimeAddOn/PrimeAddOnStyles.js +79 -0
- package/dist/components/PrimeAddOn/SummaryPage/PrimeAddOnBanner.js +109 -0
- package/dist/components/PrimeBanner/PrimeBanner.js +27 -0
- package/dist/components/PrimeBanner/PrimeBannerStyles.js +36 -0
- package/dist/components/SectionItem/SectionItem.js +42 -0
- package/dist/components/Toast/Toast.js +71 -0
- package/dist/components/Toast/ToastStyle.js +62 -0
- package/dist/navigation/Routes.js +84 -0
- package/dist/navigation/RoutesConstants.js +18 -0
- package/dist/screens/AppDiscontinue/ChooseApp.js +325 -0
- package/dist/screens/AppDiscontinue/styles.js +89 -0
- package/dist/screens/AppsReplacement/AppsReplacement.js +359 -0
- package/dist/screens/AppsReplacement/styles.js +92 -0
- package/dist/screens/ChooseYourPlan/ChooseYourPlan.js +596 -0
- package/dist/screens/ChooseYourPlan/ChooseYourPlanStyles.js +28 -0
- package/dist/screens/ChooseYourPlan/OffersCarousel.js +146 -0
- package/dist/screens/CreateSession/CreateSession.js +620 -0
- package/dist/screens/MyPlan/MyPlan.js +429 -0
- package/dist/screens/MyPlan/MyPlanStyles.js +227 -0
- package/dist/screens/PaymentStatus/PaymentStatus.js +492 -0
- package/dist/screens/PaymentStatus/styles.js +68 -0
- package/dist/screens/PlanCancellation/CancelPlan.js +127 -0
- package/dist/screens/PlanCancellation/InfiniteAutoScroll.js +67 -0
- package/dist/screens/PlanCancellation/styles.js +83 -0
- package/dist/screens/PlanSummary/PlanSummary.js +748 -0
- package/dist/screens/PlanSummary/PlanSummaryStyles.js +385 -0
- package/dist/screens/PrimePlanSummary/PrimePlanSummary.js +252 -0
- package/dist/screens/PrimePlanSummary/PrimePlanSummaryStyles.js +102 -0
- package/dist/screens/SelectApps/SelectApps.js +513 -0
- package/dist/screens/SelectApps/SelectAppsStyles.js +165 -0
- package/dist/screens/SplashScreen/SplashScreen.js +82 -0
- package/dist/services/apiCall/action.js +718 -0
- package/dist/services/apiCall/apiServiceUtils.js +136 -0
- package/dist/services/apiCall/constants.js +42 -0
- package/dist/services/apiCall/parser.js +92 -0
- package/dist/services/apiCall/reducer.js +591 -0
- package/dist/services/global/action.js +111 -0
- package/dist/services/global/commonReducer.js +97 -0
- package/dist/services/global/constants.js +22 -0
- package/dist/services/serviceCommonHandler.js +220 -0
- package/dist/store/configureStore.js +13 -0
- package/dist/store/rootReducer.js +14 -0
- package/dist/utils/commonUtils.js +381 -0
- package/dist/utils/fontUtils.js +13 -0
- package/dist/utils/string.js +101 -0
- package/package.json +53 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
const INITIAL_STATE = {
|
|
9
|
+
isLoading: false,
|
|
10
|
+
showToastMsg: false,
|
|
11
|
+
toastMessage: "",
|
|
12
|
+
openModal: false,
|
|
13
|
+
modalParameter: {},
|
|
14
|
+
unauthorizedPopUpKey: false,
|
|
15
|
+
errorCode: false,
|
|
16
|
+
evdErrorCode: null,
|
|
17
|
+
apiErrorMessasge: "",
|
|
18
|
+
openBottomSheet: false,
|
|
19
|
+
sheetParameters: {}
|
|
20
|
+
};
|
|
21
|
+
var _default = (state = INITIAL_STATE, action) => {
|
|
22
|
+
switch (action.type) {
|
|
23
|
+
case _constants.SHOW_TOAST:
|
|
24
|
+
return {
|
|
25
|
+
...state,
|
|
26
|
+
showToastMsg: true,
|
|
27
|
+
toastMessage: action.payload
|
|
28
|
+
};
|
|
29
|
+
case _constants.HIDE_TOAST:
|
|
30
|
+
return {
|
|
31
|
+
...state,
|
|
32
|
+
showToastMsg: false,
|
|
33
|
+
toastMessage: ""
|
|
34
|
+
};
|
|
35
|
+
case _constants.SHOW_MODAL:
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
openModal: true,
|
|
39
|
+
modalParameter: action.payload
|
|
40
|
+
};
|
|
41
|
+
case _constants.HIDE_MODAL:
|
|
42
|
+
return {
|
|
43
|
+
...state,
|
|
44
|
+
openModal: false,
|
|
45
|
+
modalParameter: {}
|
|
46
|
+
};
|
|
47
|
+
case _constants.SET_API_ERROR:
|
|
48
|
+
const {
|
|
49
|
+
errorMessage,
|
|
50
|
+
evdErrorCode,
|
|
51
|
+
errorCode
|
|
52
|
+
} = action.payload;
|
|
53
|
+
return {
|
|
54
|
+
...state,
|
|
55
|
+
apiErrorMessasge: errorMessage,
|
|
56
|
+
evdErrorCode: evdErrorCode,
|
|
57
|
+
errorCode
|
|
58
|
+
};
|
|
59
|
+
case _constants.REMOVE_API_ERROR:
|
|
60
|
+
return {
|
|
61
|
+
...state,
|
|
62
|
+
apiErrorMessasge: "",
|
|
63
|
+
errorCode: false,
|
|
64
|
+
evdErrorCode: null
|
|
65
|
+
};
|
|
66
|
+
case _constants.SHOW_LOADER:
|
|
67
|
+
return {
|
|
68
|
+
...state,
|
|
69
|
+
isLoading: true
|
|
70
|
+
};
|
|
71
|
+
case _constants.HIDE_LOADER:
|
|
72
|
+
return {
|
|
73
|
+
...state,
|
|
74
|
+
isLoading: false
|
|
75
|
+
};
|
|
76
|
+
case _constants.UNAUTHORIZED_POPUP_ACCESS:
|
|
77
|
+
return {
|
|
78
|
+
...state,
|
|
79
|
+
unauthorizedPopUpKey: true
|
|
80
|
+
};
|
|
81
|
+
case _constants.SHOW_BOTTOM_SHEET:
|
|
82
|
+
return {
|
|
83
|
+
...state,
|
|
84
|
+
openBottomSheet: true,
|
|
85
|
+
sheetParameters: action.payload
|
|
86
|
+
};
|
|
87
|
+
case _constants.HIDE_BOTTOM_SHEET:
|
|
88
|
+
return {
|
|
89
|
+
...state,
|
|
90
|
+
openBottomSheet: false,
|
|
91
|
+
sheetParameters: {}
|
|
92
|
+
};
|
|
93
|
+
default:
|
|
94
|
+
return state;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
exports.default = _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.UNAUTHORIZED_POPUP_ACCESS = exports.TIMEOUT_ERROR = exports.SHOW_TOAST = exports.SHOW_MODAL = exports.SHOW_LOADER = exports.SHOW_BOTTOM_SHEET = exports.SET_API_ERROR = exports.SERVICE_SUCCESS = exports.SERVICE_INPROGRESS = exports.SERVICE_FAIL = exports.REMOVE_API_ERROR = exports.NET_STATE = exports.HIDE_TOAST = exports.HIDE_MODAL = exports.HIDE_LOADER = exports.HIDE_BOTTOM_SHEET = void 0;
|
|
7
|
+
const NET_STATE = exports.NET_STATE = "NET_STATE";
|
|
8
|
+
const TIMEOUT_ERROR = exports.TIMEOUT_ERROR = "TIMEOUT_ERROR";
|
|
9
|
+
const SERVICE_SUCCESS = exports.SERVICE_SUCCESS = "SERVICE_SUCCESS";
|
|
10
|
+
const SERVICE_INPROGRESS = exports.SERVICE_INPROGRESS = "SERVICE_INPROGRESS";
|
|
11
|
+
const SERVICE_FAIL = exports.SERVICE_FAIL = "SERVICE_FAIL";
|
|
12
|
+
const SHOW_TOAST = exports.SHOW_TOAST = "SHOW_TOAST";
|
|
13
|
+
const HIDE_TOAST = exports.HIDE_TOAST = "HIDE_TOAST";
|
|
14
|
+
const SET_API_ERROR = exports.SET_API_ERROR = "SET_API_ERROR";
|
|
15
|
+
const REMOVE_API_ERROR = exports.REMOVE_API_ERROR = "REMOVE_API_ERROR";
|
|
16
|
+
const UNAUTHORIZED_POPUP_ACCESS = exports.UNAUTHORIZED_POPUP_ACCESS = "UNAUTHORIZED_POPUP_ACCESS";
|
|
17
|
+
const SHOW_MODAL = exports.SHOW_MODAL = "SHOW_MODAL";
|
|
18
|
+
const HIDE_MODAL = exports.HIDE_MODAL = "HIDE_MODAL";
|
|
19
|
+
const SHOW_BOTTOM_SHEET = exports.SHOW_BOTTOM_SHEET = "SHOW_BOTTOM_SHEET";
|
|
20
|
+
const HIDE_BOTTOM_SHEET = exports.HIDE_BOTTOM_SHEET = "HIDE_BOTTOM_SHEET";
|
|
21
|
+
const SHOW_LOADER = exports.SHOW_LOADER = "SHOW_LOADER";
|
|
22
|
+
const HIDE_LOADER = exports.HIDE_LOADER = "HIDE_LOADER";
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FetchAllSettledApi = FetchAllSettledApi;
|
|
7
|
+
exports.FetchApi = FetchApi;
|
|
8
|
+
exports.IsJsonString = IsJsonString;
|
|
9
|
+
exports.ServiceError = void 0;
|
|
10
|
+
exports.SortByDate = SortByDate;
|
|
11
|
+
exports.SortByName = SortByName;
|
|
12
|
+
exports.SortByNumber = SortByNumber;
|
|
13
|
+
exports.serviceConsts = void 0;
|
|
14
|
+
var _AppConstant = require("../assets/AppConstant");
|
|
15
|
+
var _string = require("../utils/string");
|
|
16
|
+
const serviceConsts = exports.serviceConsts = {
|
|
17
|
+
baseUrls: {
|
|
18
|
+
baseUrl: "https://uatmanageapps.tataplaybinge.com/",
|
|
19
|
+
auth: "manage-app-auth/",
|
|
20
|
+
readContent: "manage-app-read/",
|
|
21
|
+
writeContent: "manage-app-write/",
|
|
22
|
+
imageBaseUrl: "https://uatmanageapps.tataplay.com/cms-assets/images/",
|
|
23
|
+
drupalApi: "https://uatmanageapps.tataplaybinge.com/cms-assets/v1/app-data/",
|
|
24
|
+
showPlanImage: value => `https://uatmanageapps.tataplaybinge.com/cms-assets/images/myopS${value}.png`
|
|
25
|
+
},
|
|
26
|
+
endPoints: {
|
|
27
|
+
authToken: "v1/BINGE_OTT/access",
|
|
28
|
+
createSession: "v1/createSession",
|
|
29
|
+
packList: "v1/<source>/<type>/getPacks",
|
|
30
|
+
savePacks: "v1/<source>/savePacks",
|
|
31
|
+
pageRedirection: "v1/<source>/pageRedirection",
|
|
32
|
+
pageSummary: "v1/<source>/getSummaryPage/",
|
|
33
|
+
validateCoupon: "v1/<source>/validateCoupon",
|
|
34
|
+
manifestJson: "manifest.json?v=59.0",
|
|
35
|
+
chooseYourPlan: "choose_your_plan.json?v=53.0",
|
|
36
|
+
chooseAppsDrupal: "select_apps.json?v=53.0",
|
|
37
|
+
planSummaryDrupal: "plan_summary.json?v=53.0",
|
|
38
|
+
drupalOtherInfo: "pick_your_price.json?v=10.0",
|
|
39
|
+
drupalOtherInfo2: "choose_your_tenure.json?v=10.0"
|
|
40
|
+
},
|
|
41
|
+
method: {
|
|
42
|
+
get: "GET",
|
|
43
|
+
post: "POST",
|
|
44
|
+
put: "PUT",
|
|
45
|
+
delete: "DELETE",
|
|
46
|
+
patch: "PATCH"
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function SortByDate(dateA, dateB) {
|
|
50
|
+
// let dateA1 = dateA && dateA != "" ? dateA : "";
|
|
51
|
+
// let dateB1 = dateB && dateB != "" ? dateB : "";
|
|
52
|
+
// return dateA1 == "" || dateB1 == "" ? true : moment(dateA1, 'YYYY-MM-DD').toDate() - moment(dateB1, 'YYYY-MM-DD').toDate();
|
|
53
|
+
|
|
54
|
+
return dateA == null || dateB == null ? true : dateA - dateB;
|
|
55
|
+
}
|
|
56
|
+
function SortByNumber(countA, countB) {
|
|
57
|
+
// let dateA1 = dateA && dateA != "" ? dateA : "";
|
|
58
|
+
// let dateB1 = dateB && dateB != "" ? dateB : "";
|
|
59
|
+
// return dateA1 == "" || dateB1 == "" ? true : moment(dateA1, 'YYYY-MM-DD').toDate() - moment(dateB1, 'YYYY-MM-DD').toDate();
|
|
60
|
+
|
|
61
|
+
return countA == null || countB == null ? true : countA - countB;
|
|
62
|
+
}
|
|
63
|
+
function SortByName(nameA, nameB) {
|
|
64
|
+
var nameA1 = nameA === null || nameA === void 0 ? void 0 : nameA.toLowerCase(); // ignore upper and lowercase
|
|
65
|
+
var nameB1 = nameB === null || nameB === void 0 ? void 0 : nameB.toLowerCase(); // ignore upper and lowercase
|
|
66
|
+
if (nameA1 < nameB1) {
|
|
67
|
+
// console.log('value-1');
|
|
68
|
+
return -1;
|
|
69
|
+
}
|
|
70
|
+
if (nameA1 > nameB1) {
|
|
71
|
+
// console.log('value1');
|
|
72
|
+
return 1;
|
|
73
|
+
}
|
|
74
|
+
// console.log('value0');
|
|
75
|
+
// names must be equal
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
class ServiceError extends Error {
|
|
79
|
+
constructor(status, message, apiResponse = {}) {
|
|
80
|
+
super();
|
|
81
|
+
this.status = status;
|
|
82
|
+
this.message = message;
|
|
83
|
+
this.apiResponse = apiResponse;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
//Status code meaning
|
|
88
|
+
// https://restfulapi.net/http-status-codes/
|
|
89
|
+
exports.ServiceError = ServiceError;
|
|
90
|
+
async function FetchApi(url, apiOptions, timeout = 25000) {
|
|
91
|
+
const options = (0, _string.jsonCopy)(apiOptions);
|
|
92
|
+
// Caller can set options.ignoreStatusFalse = true to allow HTTP 200
|
|
93
|
+
// responses where the JSON body contains { status: false } to be
|
|
94
|
+
// treated as a successful response (i.e. not rejected by FetchApi).
|
|
95
|
+
const ignoreStatusFalse = (options === null || options === void 0 ? void 0 : options.ignoreStatusFalse) ?? false;
|
|
96
|
+
_AppConstant.AppConstant.showConsoleLog("------------------------------service start-----------------------");
|
|
97
|
+
_AppConstant.AppConstant.showConsoleLog("url:", url);
|
|
98
|
+
_AppConstant.AppConstant.showConsoleLog("options:", options);
|
|
99
|
+
_AppConstant.AppConstant.showConsoleLog("-----------------------------service end1-----------------------");
|
|
100
|
+
const controller = new AbortController();
|
|
101
|
+
const signal = controller.signal;
|
|
102
|
+
return Promise.race([new Promise((resolve, reject) => {
|
|
103
|
+
fetch(url, {
|
|
104
|
+
...options,
|
|
105
|
+
signal: signal
|
|
106
|
+
}).then(async res => {
|
|
107
|
+
const data = await res.text();
|
|
108
|
+
_AppConstant.AppConstant.showConsoleLog("--------------------data:", res);
|
|
109
|
+
if (IsJsonString(data)) {
|
|
110
|
+
let values = [JSON.parse(data), res];
|
|
111
|
+
if (values[1].status != 200) {
|
|
112
|
+
var _values$, _values$2, _values$3;
|
|
113
|
+
_AppConstant.AppConstant.showConsoleLog("--------------------error2:", values);
|
|
114
|
+
// reject( new ServiceError(values[1].status, values[0].message))
|
|
115
|
+
let msg = ((_values$ = values[0]) === null || _values$ === void 0 ? void 0 : _values$.message) || "";
|
|
116
|
+
if ((_values$2 = values[0]) !== null && _values$2 !== void 0 && _values$2.errors && typeof ((_values$3 = values[0]) === null || _values$3 === void 0 ? void 0 : _values$3.errors) != "string") {
|
|
117
|
+
var _values$4;
|
|
118
|
+
msg = (_values$4 = values[0]) === null || _values$4 === void 0 || (_values$4 = _values$4.errors[0]) === null || _values$4 === void 0 ? void 0 : _values$4.message;
|
|
119
|
+
}
|
|
120
|
+
// if (values[0]?.errors && typeof values[0]?.errors != 'string') {
|
|
121
|
+
// msg = values[0]?.errors[0]?.message;
|
|
122
|
+
// }
|
|
123
|
+
reject(new ServiceError(values[1].status, msg, values[0]));
|
|
124
|
+
// reject new Error('msg');
|
|
125
|
+
} else {
|
|
126
|
+
var _values$5, _values$6, _values$7, _values$8, _values$9;
|
|
127
|
+
_AppConstant.AppConstant.showConsoleLog("------service success response--->>", url, values[0]);
|
|
128
|
+
|
|
129
|
+
// If caller opted-in to ignore 'status: false' in JSON, skip
|
|
130
|
+
// treating that as an error. Otherwise preserve the existing
|
|
131
|
+
// behaviour which rejects when values[0].status === false
|
|
132
|
+
// or when statusCode indicates a non-200 result.
|
|
133
|
+
if (!ignoreStatusFalse && (((_values$5 = values[0]) === null || _values$5 === void 0 ? void 0 : _values$5.status) != null && !((_values$6 = values[0]) !== null && _values$6 !== void 0 && _values$6.status) || (_values$7 = values[0]) !== null && _values$7 !== void 0 && _values$7.statusCode && (((_values$8 = values[0]) === null || _values$8 === void 0 ? void 0 : _values$8.statusCode) != 200 || !((_values$9 = values[0]) !== null && _values$9 !== void 0 && _values$9.status)))) {
|
|
134
|
+
var _values$0, _values$1, _values$10, _values$11, _values$14, _values$15;
|
|
135
|
+
_AppConstant.AppConstant.showConsoleLog("--------------------error in success2:", values);
|
|
136
|
+
// reject( new ServiceError(values[1].status, values[0].message))
|
|
137
|
+
let msg = ((_values$0 = values[0]) === null || _values$0 === void 0 ? void 0 : _values$0.message) || "";
|
|
138
|
+
if ((_values$1 = values[0]) !== null && _values$1 !== void 0 && _values$1.errors && typeof ((_values$10 = values[0]) === null || _values$10 === void 0 ? void 0 : _values$10.errors) != "string" && ((_values$11 = values[0]) === null || _values$11 === void 0 || (_values$11 = _values$11.errors) === null || _values$11 === void 0 ? void 0 : _values$11.length) > 0) {
|
|
139
|
+
var _values$12;
|
|
140
|
+
msg = (_values$12 = values[0]) === null || _values$12 === void 0 || (_values$12 = _values$12.errors[0]) === null || _values$12 === void 0 ? void 0 : _values$12.message;
|
|
141
|
+
} else if (msg == "") {
|
|
142
|
+
var _values$13;
|
|
143
|
+
msg = ((_values$13 = values[0]) === null || _values$13 === void 0 ? void 0 : _values$13.status) || "";
|
|
144
|
+
}
|
|
145
|
+
_AppConstant.AppConstant.showConsoleLog("--------------------error in success21:", ((_values$14 = values[0]) === null || _values$14 === void 0 ? void 0 : _values$14.statusCode) ?? 400, msg, JSON.stringify(values[0]));
|
|
146
|
+
reject(new ServiceError(((_values$15 = values[0]) === null || _values$15 === void 0 ? void 0 : _values$15.statusCode) ?? 400, msg, values[0]));
|
|
147
|
+
} else {
|
|
148
|
+
let response = values[0];
|
|
149
|
+
resolve(response);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// AppConstant.showConsoleLog('----------res json:', values);
|
|
153
|
+
} else {
|
|
154
|
+
_AppConstant.AppConstant.showConsoleLog("----------res text:", data);
|
|
155
|
+
_AppConstant.AppConstant.showConsoleLog("----------res text:", res);
|
|
156
|
+
if (res.status == 404) {
|
|
157
|
+
reject(new ServiceError(res.status, "not found", res));
|
|
158
|
+
} else if (res.status == 400) {
|
|
159
|
+
reject(new ServiceError(res.status, "not found", res));
|
|
160
|
+
} else if (res.status != 200 && res.status != 201) {
|
|
161
|
+
reject(new ServiceError(res.status, "Please try again. Something wrong!", res));
|
|
162
|
+
} else {
|
|
163
|
+
resolve(data);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}).catch(async err => {
|
|
167
|
+
_AppConstant.AppConstant.showConsoleLog("----------err:", err);
|
|
168
|
+
_AppConstant.AppConstant.checkInternet(isConnected => {
|
|
169
|
+
if (!isConnected) {
|
|
170
|
+
reject(new ServiceError(11111, "No internet connection", err));
|
|
171
|
+
} else {
|
|
172
|
+
reject(new ServiceError(90902, err.message, err));
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}), new Promise((_, reject) => setTimeout(async () => {
|
|
177
|
+
controller.abort();
|
|
178
|
+
reject(new ServiceError(408, "timeout", {
|
|
179
|
+
status: 408,
|
|
180
|
+
msg: "timeout"
|
|
181
|
+
}));
|
|
182
|
+
// reject(new Error('timeout'))
|
|
183
|
+
}, timeout))]);
|
|
184
|
+
}
|
|
185
|
+
async function FetchAllSettledApi(iterators = []) {
|
|
186
|
+
return new Promise((resolve, reject) => {
|
|
187
|
+
const arrayValue = new Array(iterators.length).fill(null);
|
|
188
|
+
iterators === null || iterators === void 0 || iterators.map((item, index) => {
|
|
189
|
+
setTimeout(async () => {
|
|
190
|
+
try {
|
|
191
|
+
const res = await item;
|
|
192
|
+
arrayValue[index] = {
|
|
193
|
+
value: res,
|
|
194
|
+
status: true
|
|
195
|
+
};
|
|
196
|
+
} catch (error) {
|
|
197
|
+
// AppConstant.showConsoleLog('error main:', item, error)
|
|
198
|
+
arrayValue[index] = {
|
|
199
|
+
value: null,
|
|
200
|
+
error,
|
|
201
|
+
status: false
|
|
202
|
+
};
|
|
203
|
+
} finally {
|
|
204
|
+
_AppConstant.AppConstant.showConsoleLog("arrayValue:", arrayValue);
|
|
205
|
+
if (!arrayValue.includes(null)) {
|
|
206
|
+
resolve(arrayValue);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}, 0);
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function IsJsonString(str) {
|
|
214
|
+
try {
|
|
215
|
+
JSON.parse(str);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _redux = require("redux");
|
|
9
|
+
var _reduxThunk = require("redux-thunk");
|
|
10
|
+
var _rootReducer = _interopRequireDefault(require("./rootReducer"));
|
|
11
|
+
const enhancer = (0, _redux.compose)((0, _redux.applyMiddleware)(_reduxThunk.thunk));
|
|
12
|
+
const store = (0, _redux.legacy_createStore)(_rootReducer.default, {}, enhancer);
|
|
13
|
+
var _default = exports.default = store; // <-- default export
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _redux = require("redux");
|
|
9
|
+
var _reducer = _interopRequireDefault(require("../services/apiCall/reducer"));
|
|
10
|
+
var _commonReducer = _interopRequireDefault(require("./../services/global/commonReducer"));
|
|
11
|
+
var _default = exports.default = (0, _redux.combineReducers)({
|
|
12
|
+
manageAppReducer: _reducer.default,
|
|
13
|
+
commonReducer: _commonReducer.default
|
|
14
|
+
});
|