@gobizweb/core 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +56 -0
- package/assets/icons/arrow_left.svg +1 -0
- package/assets/icons/right_pointing.svg +1 -0
- package/assets/icons/thumb-up.svg +1 -0
- package/assets/images/server_error_dino.svg +1 -0
- package/assets/images/spot_hero_empty_list.svg +1 -0
- package/lib/bootstrap.js +39 -0
- package/lib/components/AccordionSelect/AccordionSelect.component.js +131 -0
- package/lib/components/AccordionSelect/AccordionSelect.styled.js +18 -0
- package/lib/components/AccordionSelect/index.js +13 -0
- package/lib/components/AlertBox/AlertBox.component.js +54 -0
- package/lib/components/AlertBox/AlertBox.styled.js +32 -0
- package/lib/components/AlertBox/index.js +13 -0
- package/lib/components/AlertDialog/AlertDialog.js +66 -0
- package/lib/components/AlertDialog/AlertDialog.styled.js +13 -0
- package/lib/components/AlertDialog/index.js +13 -0
- package/lib/components/Asphalt/Input.component.js +59 -0
- package/lib/components/Asphalt/index.js +13 -0
- package/lib/components/AsphaltPolyfill/AsphaltPolyfill.component.js +26 -0
- package/lib/components/AsphaltPolyfill/AsphaltPolyfill.loader.js +8 -0
- package/lib/components/AsphaltPolyfill/index.js +13 -0
- package/lib/components/Box/index.js +51 -0
- package/lib/components/Breakpoint/Breakpoint.component.js +63 -0
- package/lib/components/Breakpoint/index.js +13 -0
- package/lib/components/Button/Button.js +109 -0
- package/lib/components/Button/index.js +13 -0
- package/lib/components/Card/Card.js +75 -0
- package/lib/components/Card/Card.styled.js +60 -0
- package/lib/components/Card/index.js +13 -0
- package/lib/components/CardList/CardList.component.js +55 -0
- package/lib/components/CardList/index.js +13 -0
- package/lib/components/Checkbox/Checkbox.js +60 -0
- package/lib/components/Checkbox/index.js +13 -0
- package/lib/components/Container/Container.js +74 -0
- package/lib/components/Container/index.js +13 -0
- package/lib/components/DatePicker/Datepicker.component.js +57 -0
- package/lib/components/DatePicker/index.js +13 -0
- package/lib/components/Dropdown/Dropdown.component.js +63 -0
- package/lib/components/Dropdown/index.js +13 -0
- package/lib/components/EmptyState/EmptyState.component.js +47 -0
- package/lib/components/EmptyState/index.js +13 -0
- package/lib/components/ErrorModal/ErrorModal.component.js +41 -0
- package/lib/components/ErrorModal/ErrorModal.store.js +43 -0
- package/lib/components/ErrorModal/index.js +14 -0
- package/lib/components/ErrorScreen/ErrorScreen.js +19 -0
- package/lib/components/ErrorScreen/index.js +13 -0
- package/lib/components/FilterModal/FilterModal.js +41 -0
- package/lib/components/FilterModal/FilterModal.state.js +139 -0
- package/lib/components/FilterModal/index.js +13 -0
- package/lib/components/GlobalFilter/GlobalFilter.component.js +32 -0
- package/lib/components/GlobalFilter/GlobalFilter.component.state.js +116 -0
- package/lib/components/GlobalFilter/GlobalFilter.constant.js +17 -0
- package/lib/components/GlobalFilter/GlobalFilter.date.component.js +34 -0
- package/lib/components/GlobalFilter/GlobalFilter.interface.js +2 -0
- package/lib/components/GlobalFilter/GlobalFilter.provider.js +169 -0
- package/lib/components/GlobalFilter/GlobalFilter.styled.js +16 -0
- package/lib/components/GlobalFilter/index.js +16 -0
- package/lib/components/Guard/Guard.component.js +18 -0
- package/lib/components/Guard/index.js +13 -0
- package/lib/components/IframeLoader/IframeLoader.js +47 -0
- package/lib/components/IframeLoader/index.js +13 -0
- package/lib/components/Input/Input.component.js +167 -0
- package/lib/components/Input/index.js +13 -0
- package/lib/components/LanguageSwitcher/LanguageSwitcher.component.js +78 -0
- package/lib/components/LanguageSwitcher/LanguageSwitcher.state.js +20 -0
- package/lib/components/LanguageSwitcher/LanguageSwitcher.styled.js +40 -0
- package/lib/components/LanguageSwitcher/index.js +13 -0
- package/lib/components/List/List.js +46 -0
- package/lib/components/List/index.js +13 -0
- package/lib/components/ListSelector/ListSelector.component.js +22 -0
- package/lib/components/ListSelector/ListSelector.state.js +11 -0
- package/lib/components/ListSelector/ListSelector.styled.js +15 -0
- package/lib/components/ListSelector/index.js +13 -0
- package/lib/components/Loading/Loading.js +52 -0
- package/lib/components/Loading/Loading.styled.js +45 -0
- package/lib/components/Loading/index.js +13 -0
- package/lib/components/LoadingModule/LoadingModule.component.js +49 -0
- package/lib/components/LoadingModule/index.js +13 -0
- package/lib/components/MobileAppBar/MobileAppBar.js +90 -0
- package/lib/components/MobileAppBar/MobileAppBar.styled.js +36 -0
- package/lib/components/MobileAppBar/WithMobileAppBar.js +43 -0
- package/lib/components/MobileAppBar/index.js +14 -0
- package/lib/components/Modal/Modal.js +149 -0
- package/lib/components/Modal/ModalManager.context.js +6 -0
- package/lib/components/Modal/ModalManager.js +118 -0
- package/lib/components/Modal/index.js +15 -0
- package/lib/components/Navigation/Navigation.component.js +25 -0
- package/lib/components/Navigation/Navigation.provider.js +69 -0
- package/lib/components/Navigation/Navigation.styled.js +33 -0
- package/lib/components/Navigation/index.js +14 -0
- package/lib/components/PageTitle/PageTitle.component.js +47 -0
- package/lib/components/PageTitle/index.js +13 -0
- package/lib/components/Pagination/Pagination.component.js +49 -0
- package/lib/components/Pagination/index.js +13 -0
- package/lib/components/Radio/Radio.component.js +69 -0
- package/lib/components/Radio/Radio.styled.js +44 -0
- package/lib/components/Radio/RadioGroup.component.js +24 -0
- package/lib/components/Radio/RadioGroup.context.js +6 -0
- package/lib/components/Radio/index.js +15 -0
- package/lib/components/Separator/Separator.component.js +59 -0
- package/lib/components/Separator/index.js +13 -0
- package/lib/components/Skeleton/SkeletonApp.component.js +90 -0
- package/lib/components/Skeleton/SkeletonTable.component.js +36 -0
- package/lib/components/Skeleton/SkeletonText.component.js +62 -0
- package/lib/components/Skeleton/SkeletonWrapper.component.js +46 -0
- package/lib/components/Skeleton/index.js +16 -0
- package/lib/components/Stepper/Stepper.component.js +126 -0
- package/lib/components/Stepper/WithStepper.js +65 -0
- package/lib/components/Stepper/index.js +16 -0
- package/lib/components/Table/Table.component.js +71 -0
- package/lib/components/Table/Table.styled.js +51 -0
- package/lib/components/Table/index.js +13 -0
- package/lib/components/TableContainer/TableContainer.js +32 -0
- package/lib/components/TableContainer/index.js +13 -0
- package/lib/components/Text/Text.component.js +90 -0
- package/lib/components/Text/index.js +13 -0
- package/lib/components/Toast/Toast.component.js +65 -0
- package/lib/components/Toast/Toast.interface.js +2 -0
- package/lib/components/Toast/Toast.manager.js +61 -0
- package/lib/components/Toast/Toast.provider.js +85 -0
- package/lib/components/Toast/Toast.styled.js +18 -0
- package/lib/components/Toast/index.js +15 -0
- package/lib/components/Tours/index.js +100 -0
- package/lib/components/index.js +51 -0
- package/lib/constants/AndroidVersions.js +6 -0
- package/lib/constants/AppNames.js +10 -0
- package/lib/constants/AsphaltTheme.js +43 -0
- package/lib/constants/GobizApp.js +11 -0
- package/lib/constants/MediaQueries.js +30 -0
- package/lib/constants/PostalCodes.js +8382 -0
- package/lib/constants/PubsubEvents.js +12 -0
- package/lib/constants/TnCFiles.js +77 -0
- package/lib/constants/ValidationRegex.js +6 -0
- package/lib/constants/cookies.js +38 -0
- package/lib/constants/datetime.js +103 -0
- package/lib/constants/index.js +24 -0
- package/lib/constants/roles.js +17 -0
- package/lib/contexts/AppTheme.js +221 -0
- package/lib/decorators/utility-classes.js +78 -0
- package/lib/decorators/withStyles.js +73 -0
- package/lib/helpers/BrowserEnvironment.js +22 -0
- package/lib/helpers/ESQuery.js +98 -0
- package/lib/helpers/chart.js +251 -0
- package/lib/helpers/cleanObject.js +15 -0
- package/lib/helpers/conversion.js +4 -0
- package/lib/helpers/cookies.js +54 -0
- package/lib/helpers/copywrite.js +15 -0
- package/lib/helpers/currency.js +73 -0
- package/lib/helpers/dateFormat.js +47 -0
- package/lib/helpers/datePresets.js +77 -0
- package/lib/helpers/debounce.js +31 -0
- package/lib/helpers/deepMerge.js +81 -0
- package/lib/helpers/downloadURL.js +11 -0
- package/lib/helpers/enumReverseMap.js +12 -0
- package/lib/helpers/env.js +18 -0
- package/lib/helpers/fileDownloader.js +33 -0
- package/lib/helpers/formatNumber.js +10 -0
- package/lib/helpers/formatPercentage.js +13 -0
- package/lib/helpers/gobizApp.js +27 -0
- package/lib/helpers/identityValidator.js +6 -0
- package/lib/helpers/index.js +50 -0
- package/lib/helpers/json.js +17 -0
- package/lib/helpers/logger.js +93 -0
- package/lib/helpers/maskAccount.js +26 -0
- package/lib/helpers/numbers.js +6 -0
- package/lib/helpers/path.js +27 -0
- package/lib/helpers/paymentTypeHuman.js +62 -0
- package/lib/helpers/refreshConfig.js +12 -0
- package/lib/helpers/refreshToken.js +108 -0
- package/lib/helpers/safeParse.js +31 -0
- package/lib/helpers/scrollToTop.js +9 -0
- package/lib/helpers/shortID.js +17 -0
- package/lib/helpers/textParser.js +10 -0
- package/lib/helpers/time.js +54 -0
- package/lib/helpers/tour.js +38 -0
- package/lib/helpers/transform.js +24 -0
- package/lib/helpers/url.js +30 -0
- package/lib/helpers/wildcardToRegEx.js +15 -0
- package/lib/hooks/index.js +26 -0
- package/lib/hooks/useBreakpoint.js +35 -0
- package/lib/hooks/useCurrency.js +27 -0
- package/lib/hooks/useDatesFromTimeRange.js +40 -0
- package/lib/hooks/useEventListener.js +24 -0
- package/lib/hooks/useFormValidator.js +38 -0
- package/lib/hooks/useHttpOptions.js +104 -0
- package/lib/hooks/useLogger.js +57 -0
- package/lib/hooks/useNavigation.js +16 -0
- package/lib/hooks/usePhone.js +14 -0
- package/lib/hooks/useQueryInit.js +21 -0
- package/lib/hooks/useQueryParams.js +95 -0
- package/lib/hooks/useShowGlobalFilter.js +101 -0
- package/lib/hooks/useWebview.js +48 -0
- package/lib/hooks/useWindow.js +19 -0
- package/lib/models/AuthUser.model.js +159 -0
- package/lib/models/Outlet.model.js +274 -0
- package/lib/models/User.model.js +106 -0
- package/lib/models/index.js +15 -0
- package/lib/providers/Alert.provider.js +65 -0
- package/lib/providers/AppTheme.provider.js +75 -0
- package/lib/providers/Auth.provider.js +239 -0
- package/lib/providers/Clevertap.provider.js +117 -0
- package/lib/providers/GoogleAnalytics.provider.js +113 -0
- package/lib/providers/Host.provider.js +71 -0
- package/lib/providers/Language.provider.js +127 -0
- package/lib/providers/Logger.provider.js +32 -0
- package/lib/providers/MicroApp.provider.js +63 -0
- package/lib/providers/Outlets.provider.js +180 -0
- package/lib/providers/Token.provider.js +101 -0
- package/lib/providers/Translation.provider.js +56 -0
- package/lib/providers/index.js +24 -0
- package/package.json +47 -0
@@ -0,0 +1,274 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.Outlet = exports.OutletPoP = exports.normaliseBusinessType = void 0;
|
7
|
+
var moment_1 = __importDefault(require("moment"));
|
8
|
+
var helpers_1 = require("../helpers");
|
9
|
+
var maskAccount_1 = require("../helpers/maskAccount");
|
10
|
+
exports.normaliseBusinessType = function (businessType) {
|
11
|
+
var isIndividual = ["individual", "personal", "individu"].find(function (pattern) {
|
12
|
+
return new RegExp("" + pattern, "i").test(businessType);
|
13
|
+
});
|
14
|
+
if (!!isIndividual) {
|
15
|
+
return "individual";
|
16
|
+
}
|
17
|
+
var isCorporate = [
|
18
|
+
"corporate",
|
19
|
+
"company",
|
20
|
+
"smb",
|
21
|
+
'"corporate"',
|
22
|
+
].find(function (pattern) { return new RegExp("" + pattern, "i").test(businessType); });
|
23
|
+
if (!!isCorporate) {
|
24
|
+
return "corporate";
|
25
|
+
}
|
26
|
+
return businessType;
|
27
|
+
};
|
28
|
+
var OutletPoP = /** @class */ (function () {
|
29
|
+
function OutletPoP() {
|
30
|
+
this.id = "";
|
31
|
+
this.name = "";
|
32
|
+
this.receiverId = "";
|
33
|
+
this.active = false;
|
34
|
+
this.gopayQRString = "";
|
35
|
+
this.aspiQRString = "";
|
36
|
+
this.type = "static";
|
37
|
+
this.terminalId = "";
|
38
|
+
}
|
39
|
+
Object.defineProperty(OutletPoP.prototype, "isQRISPop", {
|
40
|
+
get: function () {
|
41
|
+
return !!this.aspiQRString;
|
42
|
+
},
|
43
|
+
enumerable: false,
|
44
|
+
configurable: true
|
45
|
+
});
|
46
|
+
Object.defineProperty(OutletPoP.prototype, "isQrisEnabled", {
|
47
|
+
get: function () {
|
48
|
+
return (this.active && this.gopayQRString !== null && this.aspiQRString !== null);
|
49
|
+
},
|
50
|
+
enumerable: false,
|
51
|
+
configurable: true
|
52
|
+
});
|
53
|
+
OutletPoP.fromJSON = function (json) {
|
54
|
+
var pop = new OutletPoP();
|
55
|
+
pop.id = json.pop_id;
|
56
|
+
pop.name = json.name;
|
57
|
+
pop.active = json.gopay.status === "active";
|
58
|
+
pop.type = json.gopay.gopay_pop_type;
|
59
|
+
pop.aspiQRString = json.gopay.aspi_qr_string || null;
|
60
|
+
pop.gopayQRString = json.gopay.gopay_qr_string || null;
|
61
|
+
pop.receiverId = json.gopay.gopay_receiver_id;
|
62
|
+
pop.terminalId = json.gopay.aspi_terminal_id
|
63
|
+
? json.gopay.aspi_terminal_id.substring(4)
|
64
|
+
: "";
|
65
|
+
return pop;
|
66
|
+
};
|
67
|
+
return OutletPoP;
|
68
|
+
}());
|
69
|
+
exports.OutletPoP = OutletPoP;
|
70
|
+
var Outlet = /** @class */ (function () {
|
71
|
+
function Outlet() {
|
72
|
+
this.id = "";
|
73
|
+
this.idType = "";
|
74
|
+
this.name = "";
|
75
|
+
this.outletAddress = "";
|
76
|
+
this.outletCity = "";
|
77
|
+
this.businessType = "";
|
78
|
+
this.phone = "";
|
79
|
+
this.email = "";
|
80
|
+
this.bankAccountNumber = "";
|
81
|
+
this.bankAccountName = "";
|
82
|
+
this.bankName = "";
|
83
|
+
this.bankCode = "";
|
84
|
+
this.branchName = "";
|
85
|
+
this.featureTypes = [];
|
86
|
+
this.metadata = {};
|
87
|
+
this.json = {};
|
88
|
+
this.pops = [];
|
89
|
+
this.merchantType = "";
|
90
|
+
this.merchantName = "";
|
91
|
+
}
|
92
|
+
Object.defineProperty(Outlet.prototype, "isIndividualMerchant", {
|
93
|
+
get: function () {
|
94
|
+
return this.businessType === "individual";
|
95
|
+
},
|
96
|
+
enumerable: false,
|
97
|
+
configurable: true
|
98
|
+
});
|
99
|
+
Object.defineProperty(Outlet.prototype, "isCorporateMerchant", {
|
100
|
+
get: function () {
|
101
|
+
return this.businessType === "corporate";
|
102
|
+
},
|
103
|
+
enumerable: false,
|
104
|
+
configurable: true
|
105
|
+
});
|
106
|
+
Object.defineProperty(Outlet.prototype, "bankAccountLast4Digits", {
|
107
|
+
get: function () {
|
108
|
+
return (this.bankAccountNumber &&
|
109
|
+
this.bankAccountNumber.slice(this.bankAccountNumber.length - 4, this.bankAccountNumber.length));
|
110
|
+
},
|
111
|
+
enumerable: false,
|
112
|
+
configurable: true
|
113
|
+
});
|
114
|
+
Object.defineProperty(Outlet.prototype, "isEnterprise", {
|
115
|
+
get: function () {
|
116
|
+
return this.merchantType === "enterprise";
|
117
|
+
},
|
118
|
+
enumerable: false,
|
119
|
+
configurable: true
|
120
|
+
});
|
121
|
+
Object.defineProperty(Outlet.prototype, "isSmbKeyAccount", {
|
122
|
+
get: function () {
|
123
|
+
return this.merchantType === "smb_key_accounts";
|
124
|
+
},
|
125
|
+
enumerable: false,
|
126
|
+
configurable: true
|
127
|
+
});
|
128
|
+
Object.defineProperty(Outlet.prototype, "maskedBankAccountNumber", {
|
129
|
+
get: function () {
|
130
|
+
return maskAccount_1.maskBankAccountNumber(this.bankAccountNumber);
|
131
|
+
},
|
132
|
+
enumerable: false,
|
133
|
+
configurable: true
|
134
|
+
});
|
135
|
+
Object.defineProperty(Outlet.prototype, "maskedBankAccountName", {
|
136
|
+
get: function () {
|
137
|
+
return maskAccount_1.maskBankAccountName(this.bankAccountName);
|
138
|
+
},
|
139
|
+
enumerable: false,
|
140
|
+
configurable: true
|
141
|
+
});
|
142
|
+
Object.defineProperty(Outlet.prototype, "hasFeature", {
|
143
|
+
get: function () {
|
144
|
+
var featureTypes = {
|
145
|
+
MANUAL_PAYOUT: this.findFeatureTypes("manual_payout"),
|
146
|
+
KRONOS: this.findFeatureTypes("kronos"),
|
147
|
+
NEW_BILLING: this.findFeatureTypes("new_billing"),
|
148
|
+
ONLINE_PAYOUT: this.findFeatureTypes("online_payout"),
|
149
|
+
REFUND: this.findFeatureTypes("refund"),
|
150
|
+
SNAP: this.findFeatureTypes("snap"),
|
151
|
+
SPLIT_PAYOUT: this.findFeatureTypes("split_payout"),
|
152
|
+
};
|
153
|
+
return featureTypes;
|
154
|
+
},
|
155
|
+
enumerable: false,
|
156
|
+
configurable: true
|
157
|
+
});
|
158
|
+
Outlet.prototype.findFeatureTypes = function (input) {
|
159
|
+
return this.featureTypes.some(function (featureType) { return featureType.toLowerCase() === input.toLowerCase(); });
|
160
|
+
};
|
161
|
+
Object.defineProperty(Outlet.prototype, "isGoRestoActive", {
|
162
|
+
get: function () {
|
163
|
+
var currentTime = moment_1.default();
|
164
|
+
var statusIsNotSuspended = helpers_1.JSONTry(this.json, "applications.goresto.status") !== "suspended";
|
165
|
+
var activateAt = moment_1.default(helpers_1.JSONTry(this.json, "applications.goresto.activate_at"));
|
166
|
+
var deactivateAt = moment_1.default(helpers_1.JSONTry(this.json, "applications.goresto.deactivate_at"));
|
167
|
+
var activationDateIsValid = activateAt.isBefore(currentTime) && deactivateAt.isAfter(currentTime);
|
168
|
+
return statusIsNotSuspended && activationDateIsValid;
|
169
|
+
},
|
170
|
+
enumerable: false,
|
171
|
+
configurable: true
|
172
|
+
});
|
173
|
+
Object.defineProperty(Outlet.prototype, "enabledProducts", {
|
174
|
+
get: function () {
|
175
|
+
var products = {
|
176
|
+
GORESTO: this.isGoRestoActive,
|
177
|
+
GOPAY: helpers_1.JSONTry(this.json, "applications.gopay.status") === "active",
|
178
|
+
POS: helpers_1.JSONTry(this.json, "applications.pos.active") === "active",
|
179
|
+
MIDTRANS: helpers_1.JSONTry(this.json, "applications.midtrans.onboard_at"),
|
180
|
+
GOMART: helpers_1.JSONTry(this.json, "applications.gomart.status") === "active",
|
181
|
+
LOMBOK: helpers_1.JSONTry(this.json, "applications.lombok.onboard_at"),
|
182
|
+
};
|
183
|
+
return (Object.keys(products).filter(function (p) { return products[p]; }) || []);
|
184
|
+
},
|
185
|
+
enumerable: false,
|
186
|
+
configurable: true
|
187
|
+
});
|
188
|
+
Object.defineProperty(Outlet.prototype, "productsLabel", {
|
189
|
+
get: function () {
|
190
|
+
return this.enabledProducts
|
191
|
+
.sort(function (a, b) { return a.localeCompare(b); })
|
192
|
+
.join("+")
|
193
|
+
.toLowerCase();
|
194
|
+
},
|
195
|
+
enumerable: false,
|
196
|
+
configurable: true
|
197
|
+
});
|
198
|
+
Object.defineProperty(Outlet.prototype, "isPosMerchant", {
|
199
|
+
get: function () {
|
200
|
+
return this.enabledProducts.includes("POS");
|
201
|
+
},
|
202
|
+
enumerable: false,
|
203
|
+
configurable: true
|
204
|
+
});
|
205
|
+
Object.defineProperty(Outlet.prototype, "isLombokMerchant", {
|
206
|
+
get: function () {
|
207
|
+
return this.enabledProducts.includes("LOMBOK");
|
208
|
+
},
|
209
|
+
enumerable: false,
|
210
|
+
configurable: true
|
211
|
+
});
|
212
|
+
Object.defineProperty(Outlet.prototype, "isFoodMerchant", {
|
213
|
+
get: function () {
|
214
|
+
return this.enabledProducts.includes("GORESTO");
|
215
|
+
},
|
216
|
+
enumerable: false,
|
217
|
+
configurable: true
|
218
|
+
});
|
219
|
+
Object.defineProperty(Outlet.prototype, "isMidtransMerchant", {
|
220
|
+
get: function () {
|
221
|
+
return this.enabledProducts.includes("MIDTRANS");
|
222
|
+
},
|
223
|
+
enumerable: false,
|
224
|
+
configurable: true
|
225
|
+
});
|
226
|
+
Object.defineProperty(Outlet.prototype, "isMidtransOnly", {
|
227
|
+
get: function () {
|
228
|
+
return (this.enabledProducts.length === 1 &&
|
229
|
+
this.enabledProducts[0] === "MIDTRANS");
|
230
|
+
},
|
231
|
+
enumerable: false,
|
232
|
+
configurable: true
|
233
|
+
});
|
234
|
+
Object.defineProperty(Outlet.prototype, "canAccessReporting", {
|
235
|
+
get: function () {
|
236
|
+
return this.isPosMerchant || this.isFoodMerchant || this.isLombokMerchant;
|
237
|
+
},
|
238
|
+
enumerable: false,
|
239
|
+
configurable: true
|
240
|
+
});
|
241
|
+
Outlet.fromJSON = function (json, ignoreJSON) {
|
242
|
+
var _a, _b, _c, _d, _e;
|
243
|
+
if (ignoreJSON === void 0) { ignoreJSON = false; }
|
244
|
+
var outlet = new Outlet();
|
245
|
+
if (!ignoreJSON) {
|
246
|
+
outlet.json = json;
|
247
|
+
}
|
248
|
+
outlet.name = json.outlet_name;
|
249
|
+
outlet.outletAddress = json.outlet_address;
|
250
|
+
outlet.outletCity = json.outlet_city;
|
251
|
+
outlet.businessType = exports.normaliseBusinessType(json.business_type);
|
252
|
+
outlet.bankAccountNumber = ((_a = json.bank_account) === null || _a === void 0 ? void 0 : _a.account_no) || "";
|
253
|
+
outlet.bankAccountName = ((_b = json.bank_account) === null || _b === void 0 ? void 0 : _b.account_name) || "";
|
254
|
+
outlet.bankName = ((_c = json.bank_account) === null || _c === void 0 ? void 0 : _c.bank_name) || "";
|
255
|
+
outlet.bankCode = ((_d = json.bank_account) === null || _d === void 0 ? void 0 : _d.bank_code) || "";
|
256
|
+
outlet.branchName = ((_e = json.bank_account) === null || _e === void 0 ? void 0 : _e.branch_name) || "";
|
257
|
+
outlet.phone = json.phone;
|
258
|
+
outlet.email = json.email;
|
259
|
+
outlet.idType =
|
260
|
+
outlet.businessType === "individual"
|
261
|
+
? "KTP"
|
262
|
+
: (json.id_type && json.id_type.toUpperCase()) || "SIUP";
|
263
|
+
outlet.id = json.id;
|
264
|
+
outlet.metadata = json.metadata || {};
|
265
|
+
outlet.aspi = json.aspi;
|
266
|
+
outlet.featureTypes = json.feature_types || [];
|
267
|
+
outlet.merchantName = json.merchant_name;
|
268
|
+
outlet.pops = helpers_1.safeParse("array", json.pops).map(OutletPoP.fromJSON);
|
269
|
+
outlet.merchantType = json.merchant_type;
|
270
|
+
return outlet;
|
271
|
+
};
|
272
|
+
return Outlet;
|
273
|
+
}());
|
274
|
+
exports.Outlet = Outlet;
|
@@ -0,0 +1,106 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __spreadArrays = (this && this.__spreadArrays) || function () {
|
3
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
4
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
5
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
6
|
+
r[k] = a[j];
|
7
|
+
return r;
|
8
|
+
};
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
+
exports.User = void 0;
|
11
|
+
var constants_1 = require("../constants");
|
12
|
+
var User = /** @class */ (function () {
|
13
|
+
function User() {
|
14
|
+
this.merchantId = "";
|
15
|
+
this.email = "";
|
16
|
+
this.phone = "";
|
17
|
+
this.roles = new Array();
|
18
|
+
this.fullName = "";
|
19
|
+
this.brand = null;
|
20
|
+
this.country = "";
|
21
|
+
}
|
22
|
+
Object.defineProperty(User.prototype, "isAdmin", {
|
23
|
+
get: function () {
|
24
|
+
var _a, _b;
|
25
|
+
return (((_a = this.roles) === null || _a === void 0 ? void 0 : _a.includes(constants_1.ROLES.ADMIN)) || ((_b = this.roles) === null || _b === void 0 ? void 0 : _b.includes(constants_1.ROLES.OWNER)));
|
26
|
+
},
|
27
|
+
enumerable: false,
|
28
|
+
configurable: true
|
29
|
+
});
|
30
|
+
Object.defineProperty(User.prototype, "isOwner", {
|
31
|
+
get: function () {
|
32
|
+
var _a;
|
33
|
+
return (_a = this.roles) === null || _a === void 0 ? void 0 : _a.includes(constants_1.ROLES.OWNER);
|
34
|
+
},
|
35
|
+
enumerable: false,
|
36
|
+
configurable: true
|
37
|
+
});
|
38
|
+
Object.defineProperty(User.prototype, "isManager", {
|
39
|
+
get: function () {
|
40
|
+
return this.roles.includes(constants_1.ROLES.MANAGER);
|
41
|
+
},
|
42
|
+
enumerable: false,
|
43
|
+
configurable: true
|
44
|
+
});
|
45
|
+
Object.defineProperty(User.prototype, "isCashier", {
|
46
|
+
get: function () {
|
47
|
+
return this.roles.includes(constants_1.ROLES.CASHIER);
|
48
|
+
},
|
49
|
+
enumerable: false,
|
50
|
+
configurable: true
|
51
|
+
});
|
52
|
+
Object.defineProperty(User.prototype, "isTemp", {
|
53
|
+
get: function () {
|
54
|
+
return this.roles.includes(constants_1.ROLES.TEMP);
|
55
|
+
},
|
56
|
+
enumerable: false,
|
57
|
+
configurable: true
|
58
|
+
});
|
59
|
+
Object.defineProperty(User.prototype, "hasTags", {
|
60
|
+
get: function () {
|
61
|
+
return this.tagsHumanized.length !== 0;
|
62
|
+
},
|
63
|
+
enumerable: false,
|
64
|
+
configurable: true
|
65
|
+
});
|
66
|
+
User.prototype.tagsToArrayOfStrings = function (tags, stringTags) {
|
67
|
+
var _this = this;
|
68
|
+
if (stringTags === void 0) { stringTags = []; }
|
69
|
+
if (!tags) {
|
70
|
+
return [];
|
71
|
+
}
|
72
|
+
var reduced = Object.keys(tags).reduce(function (all, current) {
|
73
|
+
if (["and", "or"].includes(current)) {
|
74
|
+
var _mapped = tags[current].map(function (_current) {
|
75
|
+
return _this.tagsToArrayOfStrings(_current, all);
|
76
|
+
});
|
77
|
+
return __spreadArrays(all, _mapped);
|
78
|
+
}
|
79
|
+
return __spreadArrays(all, [tags[current]]);
|
80
|
+
}, []);
|
81
|
+
return __spreadArrays(stringTags, reduced).flat();
|
82
|
+
};
|
83
|
+
Object.defineProperty(User.prototype, "tagsHumanized", {
|
84
|
+
get: function () {
|
85
|
+
return this.tagsToArrayOfStrings(this.tags);
|
86
|
+
},
|
87
|
+
enumerable: false,
|
88
|
+
configurable: true
|
89
|
+
});
|
90
|
+
User.fromJSON = function (json) {
|
91
|
+
var user = new User();
|
92
|
+
user.id = json.id;
|
93
|
+
user.json = json;
|
94
|
+
user.email = json.email;
|
95
|
+
user.phone = json.phone;
|
96
|
+
user.merchantId = json.merchant_id;
|
97
|
+
user.roles = json.roles;
|
98
|
+
user.fullName = json.full_name;
|
99
|
+
user.brand = json.brand;
|
100
|
+
user.tags = json.tags;
|
101
|
+
user.country = json.country || "";
|
102
|
+
return user;
|
103
|
+
};
|
104
|
+
return User;
|
105
|
+
}());
|
106
|
+
exports.User = User;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
5
|
+
}) : (function(o, m, k, k2) {
|
6
|
+
if (k2 === undefined) k2 = k;
|
7
|
+
o[k2] = m[k];
|
8
|
+
}));
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
11
|
+
};
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
13
|
+
__exportStar(require("./AuthUser.model"), exports);
|
14
|
+
__exportStar(require("./Outlet.model"), exports);
|
15
|
+
__exportStar(require("./User.model"), exports);
|
@@ -0,0 +1,65 @@
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
+
if (k2 === undefined) k2 = k;
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
16
|
+
}) : (function(o, m, k, k2) {
|
17
|
+
if (k2 === undefined) k2 = k;
|
18
|
+
o[k2] = m[k];
|
19
|
+
}));
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
22
|
+
}) : function(o, v) {
|
23
|
+
o["default"] = v;
|
24
|
+
});
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
26
|
+
if (mod && mod.__esModule) return mod;
|
27
|
+
var result = {};
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
29
|
+
__setModuleDefault(result, mod);
|
30
|
+
return result;
|
31
|
+
};
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
33
|
+
exports.AlertProvider = exports.useAlert = exports.AlertContext = void 0;
|
34
|
+
var react_1 = __importStar(require("react"));
|
35
|
+
exports.AlertContext = react_1.createContext({});
|
36
|
+
exports.useAlert = function () { return react_1.useContext(exports.AlertContext); };
|
37
|
+
exports.AlertProvider = function (props) {
|
38
|
+
var _a = react_1.useState({
|
39
|
+
title: "",
|
40
|
+
type: "success",
|
41
|
+
prompt: false,
|
42
|
+
canIgnore: true,
|
43
|
+
}), content = _a[0], setContent = _a[1];
|
44
|
+
var _b = react_1.useState(false), show = _b[0], setShow = _b[1];
|
45
|
+
var reset = function () {
|
46
|
+
setShow(false);
|
47
|
+
setContent({ title: "", type: "success" });
|
48
|
+
};
|
49
|
+
var showAlert = function (content) {
|
50
|
+
setContent(content);
|
51
|
+
setShow(true);
|
52
|
+
};
|
53
|
+
var closeAlert = function () {
|
54
|
+
var _a;
|
55
|
+
(_a = content.onIgnore) === null || _a === void 0 ? void 0 : _a.call(content);
|
56
|
+
reset();
|
57
|
+
};
|
58
|
+
var context = {
|
59
|
+
show: show,
|
60
|
+
content: content,
|
61
|
+
showAlert: showAlert,
|
62
|
+
closeAlert: closeAlert,
|
63
|
+
};
|
64
|
+
return react_1.default.createElement(exports.AlertContext.Provider, __assign({ value: context }, props));
|
65
|
+
};
|
@@ -0,0 +1,75 @@
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
+
if (k2 === undefined) k2 = k;
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
16
|
+
}) : (function(o, m, k, k2) {
|
17
|
+
if (k2 === undefined) k2 = k;
|
18
|
+
o[k2] = m[k];
|
19
|
+
}));
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
22
|
+
}) : function(o, v) {
|
23
|
+
o["default"] = v;
|
24
|
+
});
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
26
|
+
if (mod && mod.__esModule) return mod;
|
27
|
+
var result = {};
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
29
|
+
__setModuleDefault(result, mod);
|
30
|
+
return result;
|
31
|
+
};
|
32
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
33
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
34
|
+
};
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
36
|
+
exports.AppThemeProvider = exports.useAppThemeContext = exports.AppThemeContext = exports.ThemeMap = void 0;
|
37
|
+
var react_1 = __importStar(require("react"));
|
38
|
+
var AsphaltTheme_1 = require("../constants/AsphaltTheme");
|
39
|
+
var AppTheme_1 = require("../contexts/AppTheme");
|
40
|
+
var AsphaltPolyfill_1 = require("../components/AsphaltPolyfill");
|
41
|
+
var styled_components_1 = require("styled-components");
|
42
|
+
var stylis_plugin_extra_scope_1 = __importDefault(require("stylis-plugin-extra-scope"));
|
43
|
+
var theme_provider_1 = __importDefault(require("@asphalt-react/theme-provider"));
|
44
|
+
var useWindow_1 = require("../hooks/useWindow");
|
45
|
+
require("../../assets/styles/index.scss");
|
46
|
+
var Outlets_provider_1 = require("./Outlets.provider");
|
47
|
+
exports.ThemeMap = {
|
48
|
+
gobiz: {
|
49
|
+
asphalt: AsphaltTheme_1.GOBIZ_ASPHALT_THEME,
|
50
|
+
styled: AppTheme_1.APP_THEME,
|
51
|
+
},
|
52
|
+
midtrans: {
|
53
|
+
asphalt: AsphaltTheme_1.MIDTRANS_ASPHALT_THEME,
|
54
|
+
styled: AppTheme_1.MIDTRANS_APP_THEME,
|
55
|
+
},
|
56
|
+
};
|
57
|
+
exports.AppThemeContext = react_1.createContext("gobiz");
|
58
|
+
exports.useAppThemeContext = function () { return react_1.useContext(exports.AppThemeContext); };
|
59
|
+
exports.AppThemeProvider = function (_a) {
|
60
|
+
var theme = _a.theme, scope = _a.scope, children = _a.children;
|
61
|
+
var innerHeight = useWindow_1.useWindow().innerHeight;
|
62
|
+
var outlet = Outlets_provider_1.useOutlets().outlet;
|
63
|
+
//set the default theme
|
64
|
+
if (!theme) {
|
65
|
+
(outlet === null || outlet === void 0 ? void 0 : outlet.isMidtransOnly) ? (theme = "midtrans") : (theme = "gobiz");
|
66
|
+
}
|
67
|
+
var selectedTheme = exports.ThemeMap[theme];
|
68
|
+
var stylisPlugins = scope ? [stylis_plugin_extra_scope_1.default("#" + scope)] : [];
|
69
|
+
var styledThemeWithHeight = __assign(__assign({}, selectedTheme.styled), { viewHeight: innerHeight + "px" });
|
70
|
+
return (react_1.default.createElement(exports.AppThemeContext.Provider, { value: theme },
|
71
|
+
react_1.default.createElement(theme_provider_1.default, { theme: selectedTheme.asphalt },
|
72
|
+
react_1.default.createElement(AsphaltPolyfill_1.AsphaltPolyfill, null),
|
73
|
+
react_1.default.createElement(styled_components_1.StyleSheetManager, { stylisPlugins: stylisPlugins }, scope ? (react_1.default.createElement("div", { id: scope },
|
74
|
+
react_1.default.createElement(styled_components_1.ThemeProvider, { theme: styledThemeWithHeight }, children))) : (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: styledThemeWithHeight }, children))))));
|
75
|
+
};
|