@global.engg/switcher-lib 0.0.32

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.
@@ -0,0 +1,692 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('@angular/common/http'), require('@angular/animations'), require('@angular/common')) :
3
+ typeof define === 'function' && define.amd ? define('@global.engg/switcher-lib', ['exports', '@angular/core', '@angular/router', '@angular/common/http', '@angular/animations', '@angular/common'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.global = global.global || {}, global.global.engg = global.global.engg || {}, global.global.engg["switcher-lib"] = {}), global.ng.core, global.ng.router, global.ng.common.http, global.ng.animations, global.ng.common));
5
+ })(this, (function (exports, i0, i1, i2, animations, i4) { 'use strict';
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n["default"] = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
+ var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
27
+ var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
28
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
29
+
30
+ function _window() {
31
+ return window;
32
+ }
33
+ var WindowRef = /** @class */ (function () {
34
+ function WindowRef() {
35
+ }
36
+ Object.defineProperty(WindowRef.prototype, "nativeWindow", {
37
+ get: function () {
38
+ return _window();
39
+ },
40
+ enumerable: false,
41
+ configurable: true
42
+ });
43
+ return WindowRef;
44
+ }());
45
+ WindowRef.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WindowRef, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
46
+ WindowRef.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WindowRef, providedIn: 'root' });
47
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: WindowRef, decorators: [{
48
+ type: i0.Injectable,
49
+ args: [{
50
+ providedIn: 'root'
51
+ }]
52
+ }] });
53
+
54
+ var AppSwitcherService = /** @class */ (function () {
55
+ function AppSwitcherService(router, _http, windowRef) {
56
+ this.router = router;
57
+ this._http = _http;
58
+ this.windowRef = windowRef;
59
+ this.SR_CONSTANTS = {
60
+ QuickWebBaseUrl: window.location.host == 'app.shiprocket.in'
61
+ ? 'https://quick.shiprocket.in/'
62
+ : 'https://sr-quick-courier-qa-1-web.kartrocket.com/',
63
+ EngageWebBaseUrl: window.location.host == 'app.shiprocket.in'
64
+ ? 'https://app-engage.shiprocket.in/'
65
+ : 'https://sr-engage-web-stage.kartrocket.com/',
66
+ CheckoutWebBaseUrl: 'https://checkout-app.shiprocket.in/',
67
+ SrfWebBaseUrl: 'https://srf-app.shiprocket.in/',
68
+ FulfillmentWebBaseUrl: 'https://fulfillment.shiprocket.in',
69
+ WigzoWebBaseUrl: 'https://convert.shiprocket.in/wigzo/lite/auth/shiprocket/login',
70
+ PickrrWebBaseUrl: window.location.host == 'app.shiprocket.in'
71
+ ? 'https://dashboard.pickrr.com/'
72
+ : 'https://shiprocket-to-pickrr.netlify.app/',
73
+ EngagePlusWebBaseURL: window.location.host == 'app.shiprocket.in' ? 'https://app-engage.shiprocket.in/' : 'https://sr-engage-web-qa-3.kartrocket.com/'
74
+ };
75
+ this.userData = JSON.parse(localStorage.getItem('ngStorage-USER') || '{}');
76
+ this.isDesktop = false;
77
+ this.appSwitchList = [
78
+ {
79
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Whatsapp-Solutions.png',
80
+ appName: 'engage',
81
+ checkKey: 'allow_engage',
82
+ displayName: 'Whatsapp Solutions (Engage360)'
83
+ },
84
+ {
85
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Checkout.png',
86
+ appName: 'checkout',
87
+ checkKey: 'allow_checkout',
88
+ displayName: 'Checkout'
89
+ },
90
+ {
91
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Warehousing.png',
92
+ appName: 'fullfilment',
93
+ checkKey: 'allow_fbs',
94
+ displayName: 'Warehousing (SR Fulfilment)'
95
+ },
96
+ {
97
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Cargo.png',
98
+ appName: 'rocketbox',
99
+ checkKey: 'allow_rocketbox',
100
+ displayName: 'Cargo'
101
+ },
102
+ {
103
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Instant-deliveries.png',
104
+ appName: 'openInApp',
105
+ checkKey: 'openInApp',
106
+ displayName: 'Open In App'
107
+ },
108
+ {
109
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Omnichannel.png',
110
+ appName: 'omuni',
111
+ checkKey: 'allow_omuni',
112
+ displayName: 'Omuni'
113
+ },
114
+ {
115
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/trends.png',
116
+ appName: 'trends',
117
+ checkKey: 'allow_trends',
118
+ displayName: 'Trends'
119
+ },
120
+ ];
121
+ }
122
+ AppSwitcherService.prototype.isCheckoutAllowed = function (companyId) {
123
+ var companies = [3619232, 3322144, 2630080, 1219154, 3723110, 2486122, 1424320, 735819, 3868367, 466488, 1187211, 355135, 3372742, 2153217, 2659051, 12190, 3285700, 2942236, 1853655, 466332, 3474860, 2071835, 2809225, 77836, 4363328, 3870510, 320289, 2354051, 1538934, 451814, 216243, 3246257, 4104707, 932406, 3447462, 2233565, 4040499, 2687352, 377748, 64142, 3622166, 344345, 627070, 2223298, 75317, 30998, 406125, 141604, 1207559, 1044491, 1097031, 3354026, 528679, 917075, 282372, 513487, 340318, 3350, 420144, 1446678, 3831929, 4004306, 793143, 65024, 4022429, 951452, 206052, 468669, 2054855, 4280735, 4022331, 537542, 3505499, 4239125, 981859, 502106, 2279505, 2889533, 1207678, 2993584, 1278688, 4231781, 61696, 948703, 1220143, 4447207, 377831, 4263698, 492761, 354046, 835031, 444332, 146042, 3778635, 4352642, 33998, 4244698, 3699357, 379559, 3335748, 2777986, 27877, 1001872, 1984134, 4404528, 567791, 75237, 486331, 4053332, 1489760, 2032364, 371704, 3941047, 3600970, 125490, 2967660, 1157119, 876879, 288812, 941678, 466059, 4054535, 134619, 3867552, 1563779, 195793, 1323291, 4115809, 1454656, 930557, 482600, 1589740, 4089391, 235881, 562058, 3535852, 1564529, 385296, 130730, 3505428, 458306, 4216054, 145403, 1859049, 380185, 3468261, 701936, 1450350, 937507, 35448, 4380825, 1838326, 2434291, 4375587, 1726791, 2704736, 3430137, 791432, 871200, 2673928, 3501380, 548185, 1755248, 176850, 924185, 477613, 19892, 755629, 2622857, 1150763, 1054413, 712521, 430958, 225038, 4145753, 2025467, 896750, 415164, 531736, 583216, 103391, 1478414, 3189465, 3122097, 1735799, 1722604, 2125044, 692005, 3653188, 3189556, 3490164, 471096, 1612625, 197857, 430466, 2539492, 234220, 192173, 3468964, 1015543, 3139638, 221975, 2487565, 3568028, 83262, 2277661, 3377930, 206271, 577858
124
+ ];
125
+ var isAllowedCompany = companies.includes(companyId);
126
+ return isAllowedCompany;
127
+ };
128
+ AppSwitcherService.prototype.showAppSwitchListToDiffUser = function () {
129
+ var _this = this;
130
+ this.appSwitchList = this.appSwitchList.filter(function (res) {
131
+ var _a, _b, _c, _d, _e, _f;
132
+ if (_this.userData.allow_engage && res.checkKey === 'allow_engage') {
133
+ return true;
134
+ }
135
+ else if ((_this.isCheckoutAllowed((_a = _this.userData) === null || _a === void 0 ? void 0 : _a.company_id) ||
136
+ _this.userData.allow_checkout) &&
137
+ res.checkKey === 'allow_checkout') {
138
+ return true;
139
+ }
140
+ else if (_this.userData.allow_fbs && res.checkKey === 'allow_fbs') {
141
+ return true;
142
+ }
143
+ else if ((_this.userData.allow_rb_panel || _this.userData.is_rb_user) &&
144
+ res.checkKey === 'allow_rocketbox') {
145
+ return true;
146
+ }
147
+ else if (((_b = _this.userData) === null || _b === void 0 ? void 0 : _b.allow_sr_convert) &&
148
+ !((_c = _this.userData) === null || _c === void 0 ? void 0 : _c.allow_engage) &&
149
+ res.checkKey === 'allow_sr_convert') {
150
+ return true;
151
+ }
152
+ else if ((res === null || res === void 0 ? void 0 : res.checkKey) === 'allow_one_impression') {
153
+ return true;
154
+ }
155
+ else if ((res === null || res === void 0 ? void 0 : res.checkKey) === 'openInApp' && ((_d = _this.userData) === null || _d === void 0 ? void 0 : _d.open_app_user)) {
156
+ return true;
157
+ }
158
+ else if ((res === null || res === void 0 ? void 0 : res.checkKey) === 'allow_wigzo' && ((_e = _this.userData) === null || _e === void 0 ? void 0 : _e.allow_wigzo)) {
159
+ return true;
160
+ }
161
+ else if ((res === null || res === void 0 ? void 0 : res.appName) === 'omuni' && ((_f = _this.userData) === null || _f === void 0 ? void 0 : _f.is_omuni2_user) == 1) {
162
+ return true;
163
+ }
164
+ else {
165
+ return false;
166
+ }
167
+ });
168
+ };
169
+ AppSwitcherService.prototype.appSwitch = function (app, kyc_status) {
170
+ var _a, _b, _c;
171
+ this.sendGaEvent(app);
172
+ if (this.userData.allow_engage && app === 'engage') {
173
+ window.open(this.SR_CONSTANTS.EngageWebBaseUrl + "gate-keeper?token=" + this.userData.token, '_blank');
174
+ }
175
+ else if (app === 'checkout') {
176
+ var url = "https://fastrr-dashboard.pickrr.com/dashboard?utm_source=sr_dashboard&utm_medium=appswitcher&utm_campaign=appswitcher01&utm_content=appswitcher01&cid=" + this.userData.company_id;
177
+ url = url + "&token=" + this.userData.token;
178
+ window.open(url, '_blank');
179
+ // if ((this.isCheckoutAllowed(this.userData?.company_id) || this.userData.allow_checkout)) {
180
+ // url = `${url}&token=${this.userData.token}`
181
+ // window.open(url, '_blank');
182
+ // }else{
183
+ // window.open("https://checkout.shiprocket.in/", '_blank');
184
+ // }
185
+ }
186
+ else if (this.userData.allow_fbs && app === 'fullfilment') {
187
+ window.open(this.SR_CONSTANTS.SrfWebBaseUrl + "login?token=" + this.userData.token, '_blank');
188
+ }
189
+ else if (!this.userData.allow_fbs && app === 'fullfilment') {
190
+ window.open(this.SR_CONSTANTS.FulfillmentWebBaseUrl + "?utm_source=panel&utm_medium=app_switcher&utm_campaign=SR-Panel-non-srf-switcher&token=" + this.userData.token, '_blank');
191
+ }
192
+ else if (app === 'rocketbox') {
193
+ if (this.userData.allow_rb_panel || this.userData.is_rb_user) {
194
+ window.location.href = window.location.origin + '/rocketbox';
195
+ }
196
+ else {
197
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
198
+ }
199
+ }
200
+ else if (((_a = this.userData) === null || _a === void 0 ? void 0 : _a.allow_sr_convert) &&
201
+ !((_b = this.userData) === null || _b === void 0 ? void 0 : _b.allow_engage) &&
202
+ app === 'sr_convert') {
203
+ window.open(this.SR_CONSTANTS.WigzoWebBaseUrl + "/" + this.userData.token, '_blank');
204
+ }
205
+ else if (app === 'sr_genie') {
206
+ window.open("https://ai-test.kartrocket.com/login?token=" + this.userData.token, '_blank');
207
+ }
208
+ else if (app === 'one_impression') {
209
+ // Calling one-impression and redirecting to new tab
210
+ this.fetchOneImpressionLoginLink();
211
+ }
212
+ else if (app === 'openInApp') {
213
+ this.fetchOpenInAppLink();
214
+ }
215
+ else if (app === 'wigzo') {
216
+ window.open("https://app.wigzo.com/auth/shiprocket/login/" + this.userData.token, '_blank');
217
+ }
218
+ else if (app === 'omuni') {
219
+ window.open("https://omuni.com/", '_blank');
220
+ // if (this.userData?.is_omuni2_user == 1) {
221
+ // this.httpService.get('omuni/switch').subscribe(
222
+ // (res) => {
223
+ // const redirect_uri = res?.redirect_uri;
224
+ // if (!redirect_uri) {
225
+ // this.toastr.error('Something Went Wrong');
226
+ // }
227
+ // window.open(redirect_uri, '_blank');
228
+ // },
229
+ // (err) => {
230
+ // this.toastr.error(err.message);
231
+ // }
232
+ // );
233
+ // } else {
234
+ // this.router.navigate(['/home'])
235
+ // }
236
+ }
237
+ else if (app === 'trends') {
238
+ window.open("https://trends.shiprocket.in/", '_blank');
239
+ }
240
+ else if (app === 'creditScore') {
241
+ if ((_c = this.userData) === null || _c === void 0 ? void 0 : _c.is_crif_enabled) {
242
+ window.open("https://app.shiprocket.in/capital/crif-home/?utm_source=App-Switcher&utm_medium=Manual-Adhoc&utm_content=crif_credit_score&utm_term=app_switcher_click", '_blank');
243
+ }
244
+ else {
245
+ window.open("https://www.shiprocket.in/capital/", '_blank');
246
+ }
247
+ }
248
+ else if (app === 'capital') {
249
+ window.open("https://app.shiprocket.in/capital/home/?utm_source=App-Switcher&utm_medium=Manual-Adhoc&utm_content=capital&utm_term=flexi_business_loan", '_blank');
250
+ }
251
+ else if (app === 'marketing') {
252
+ window.location.href = window.location.origin + '/seller' + '/home';
253
+ }
254
+ else if (app === 'whatsapp_solutions') {
255
+ if (this.userData.allow_engage) {
256
+ window.open(this.SR_CONSTANTS.EngageWebBaseUrl + "gate-keeper?token=" + this.userData.token, '_blank');
257
+ }
258
+ else {
259
+ window.open("https://app-engage.shiprocket.in/auth/register", '_blank');
260
+ }
261
+ }
262
+ else if (app === 'internationalParcels') {
263
+ if (kyc_status == 0 || kyc_status == 1 || kyc_status == 2 || kyc_status == 4) {
264
+ window.location.href = window.location.origin + '/seller' + '/internationalDashboard/overview';
265
+ }
266
+ else {
267
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
268
+ }
269
+ }
270
+ else if (app === 'i_rocketbox') {
271
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
272
+ }
273
+ else if (app === 'brand_launch') {
274
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
275
+ }
276
+ else if (app === 'express_parcel') {
277
+ window.location.href = window.location.origin + '/seller' + '/home';
278
+ }
279
+ else if (app === 'instant_deliveries') {
280
+ window.open(this.SR_CONSTANTS.QuickWebBaseUrl + "gate-keeper?token=" + this.userData.token, '_blank');
281
+ return;
282
+ }
283
+ else if (app === 'warehousing') {
284
+ window.open("https://fulfillment.shiprocket.in/", '_blank');
285
+ }
286
+ else if (app == 'srocketbox') {
287
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
288
+ }
289
+ else if (app == 'somuni') {
290
+ window.location.href = window.location.origin + '/seller' + '/home';
291
+ }
292
+ };
293
+ AppSwitcherService.prototype.sendGaEvent = function (event) {
294
+ var category = '';
295
+ var eventName = '';
296
+ var label = '';
297
+ switch (event) {
298
+ case 'addorder':
299
+ category = 'Rvmp_Header - Quick Actions';
300
+ eventName = 'Clicked on "Add an Order"';
301
+ label = '';
302
+ break;
303
+ case 'quickshipment':
304
+ category = 'Rvmp_Header - Quick Actions';
305
+ eventName = 'Clicked on "Create a quick shipemnt';
306
+ label = '';
307
+ break;
308
+ case 'ratecalculator':
309
+ category = 'Rvmp_Header - Quick Actions';
310
+ eventName = 'Clicked on "Rate Calculator"';
311
+ label = '';
312
+ break;
313
+ case 'createticket':
314
+ category = 'Rvmp_Header - Quick Actions';
315
+ eventName = 'Clicked on "Create a Ticket"';
316
+ label = '';
317
+ break;
318
+ case 'trackshipment':
319
+ category = 'Rvmp_Header - Quick Actions';
320
+ eventName = 'Clicked on "Track Shipments"';
321
+ label = '';
322
+ break;
323
+ case 'profilename':
324
+ category = 'Rvmp_Header - Profile Icon';
325
+ eventName = 'Clicked on "User Profile"';
326
+ label = '';
327
+ break;
328
+ case 'currentplan':
329
+ category = 'Rvmp_Header - Profile Icon';
330
+ eventName = 'Clicked on "Current Plan"';
331
+ label = '';
332
+ break;
333
+ case 'refer':
334
+ category = 'Rvmp_Header - Profile Icon';
335
+ eventName = 'Clicked on "Refer & Earn"';
336
+ label = '';
337
+ break;
338
+ case 'rateus':
339
+ category = 'Rvmp_Header - Profile Icon';
340
+ eventName = 'Clicked on "Rate Us"';
341
+ label = '';
342
+ break;
343
+ case 'tnc':
344
+ category = 'Rvmp_Header - Profile Icon';
345
+ eventName = 'Clicked on "T&C"';
346
+ label = '';
347
+ break;
348
+ case 'changepassword':
349
+ category = 'Rvmp_Header - Profile Icon';
350
+ eventName = 'Clicked on "Change Password"';
351
+ label = '';
352
+ break;
353
+ case 'logout':
354
+ category = 'Rvmp_Header - Profile Icon';
355
+ eventName = 'Clicked on "Logout"';
356
+ label = '';
357
+ break;
358
+ case 'recharge':
359
+ category = 'Rvmp_Header';
360
+ eventName = 'Clicked on "Recharge Wallet"';
361
+ label = '';
362
+ break;
363
+ case 'profileicon':
364
+ category = 'Rvmp_Header';
365
+ eventName = 'Clicked on "Profile Icon"';
366
+ label = '';
367
+ break;
368
+ case 'fullfilment':
369
+ category = 'Rvmp_Header - App Switcher';
370
+ eventName = 'Clicked on "SR Fulfilment"';
371
+ label = '';
372
+ break;
373
+ case 'switchtooldversion':
374
+ category = 'Rvmp_Header - Switch to old version';
375
+ eventName = 'Clicked on "Switch to old version"';
376
+ label = 'company_id:' + this.userData.company_id;
377
+ break;
378
+ case 'engage':
379
+ category = 'Rvmp_Header - App Switcher';
380
+ eventName = 'Clicked on "SR Engage"';
381
+ label = '';
382
+ }
383
+ this.send(category, eventName, label);
384
+ };
385
+ AppSwitcherService.prototype.send = function (eventCategory, eventAction, eventLabel) {
386
+ var _a;
387
+ var source = ((_a = document.cookie
388
+ .split('; ')
389
+ .find(function (row) { return row.startsWith('UTM='); })) === null || _a === void 0 ? void 0 : _a.split('=')[1]) || '';
390
+ this.windowRef.nativeWindow.ga('send', 'event', {
391
+ eventCategory: eventCategory,
392
+ eventAction: eventAction,
393
+ eventLabel: eventLabel ? eventLabel : source,
394
+ });
395
+ this.windowRef.nativeWindow.gtag_g4('event', eventAction, {
396
+ event_category: eventCategory,
397
+ event_label: eventLabel ? eventLabel : source,
398
+ });
399
+ };
400
+ AppSwitcherService.prototype.fetchOpenInAppLink = function () {
401
+ this._http.get('oneimpression/open-app-redirection_url')
402
+ .subscribe(function (res) {
403
+ if (res && (res === null || res === void 0 ? void 0 : res.url)) {
404
+ window.open(res === null || res === void 0 ? void 0 : res.url, '_blank');
405
+ }
406
+ });
407
+ };
408
+ AppSwitcherService.prototype.fetchOneImpressionLoginLink = function () {
409
+ this._http.get(this._getURL() + 'oneimpression/get-login-link').subscribe(function (res) {
410
+ if (res && (res === null || res === void 0 ? void 0 : res.url)) {
411
+ window.open(res === null || res === void 0 ? void 0 : res.url, '_blank');
412
+ }
413
+ else if ((res === null || res === void 0 ? void 0 : res.status) == 'fail') {
414
+ // this.toastr.error(res?.message)
415
+ }
416
+ }),
417
+ function (error) {
418
+ };
419
+ };
420
+ AppSwitcherService.prototype._getURL = function () {
421
+ return "https://apiv2.shiprocket.in/v1/";
422
+ };
423
+ return AppSwitcherService;
424
+ }());
425
+ AppSwitcherService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AppSwitcherService, deps: [{ token: i1__namespace.Router }, { token: i2__namespace.HttpClient }, { token: WindowRef }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
426
+ AppSwitcherService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AppSwitcherService, providedIn: 'root' });
427
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: AppSwitcherService, decorators: [{
428
+ type: i0.Injectable,
429
+ args: [{
430
+ providedIn: 'root'
431
+ }]
432
+ }], ctorParameters: function () { return [{ type: i1__namespace.Router }, { type: i2__namespace.HttpClient }, { type: WindowRef }]; } });
433
+
434
+ var user = JSON.parse(localStorage.getItem('ngStorage-USER') || '{}');
435
+ var SwitcherComponent = /** @class */ (function () {
436
+ function SwitcherComponent(appSwitcherService, _http, windowRef) {
437
+ var _this = this;
438
+ this.appSwitcherService = appSwitcherService;
439
+ this._http = _http;
440
+ this.windowRef = windowRef;
441
+ this.data = '';
442
+ this.isModalOpen = false;
443
+ this.isDesktop = false;
444
+ this.company_id = '';
445
+ this.userData = user;
446
+ this.appSwitcherApps = {
447
+ shipping_fulfilment_india: [
448
+ {
449
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Express-Parcel.png',
450
+ appName: 'express_parcel',
451
+ checkKey: 'Domestic Shipping',
452
+ displayName: 'Domestic Shipping',
453
+ subText: 'Multiple couriers, SDD/NDD, widest reach'
454
+ }, {
455
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Instant-deliveries.png',
456
+ appName: 'instant_deliveries',
457
+ checkKey: 'Instant deliveries',
458
+ displayName: 'Instant deliveries',
459
+ subText: 'Multiple couriers, Hyperlocal, Intracity'
460
+ }, {
461
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Warehousing.png',
462
+ appName: 'fullfilment',
463
+ checkKey: 'Warehousing',
464
+ displayName: 'Warehousing',
465
+ subText: 'End-to-end brand fulfilment '
466
+ },
467
+ {
468
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Cargo.png',
469
+ appName: 'rocketbox',
470
+ checkKey: 'allow_rocketbox',
471
+ displayName: 'Cargo',
472
+ subText: 'Heavy shipments, FTL & PTL '
473
+ },
474
+ ],
475
+ cross_border_commerce: [{
476
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/International-Parcels.png',
477
+ appName: 'internationalParcels',
478
+ checkKey: 'internationalParcels',
479
+ displayName: 'International Parcels',
480
+ subText: 'Ship to 220+ countries'
481
+ }, {
482
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/International-Cargo.png',
483
+ appName: 'i_rocketbox',
484
+ checkKey: 'i_allow_rocketbox',
485
+ displayName: 'International Cargo',
486
+ subText: 'Air & Ocean freight'
487
+ }, {
488
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Brand-Launch.png',
489
+ appName: 'brand_launch',
490
+ checkKey: 'brand_launch',
491
+ displayName: 'Brand Launch',
492
+ subText: 'Expand your brand globally '
493
+ }],
494
+ growth_marketing_solutions: [{
495
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Checkout.png',
496
+ appName: 'checkout',
497
+ checkKey: 'allow_checkout',
498
+ displayName: 'Checkout',
499
+ subText: 'Simplified one-click checkout'
500
+ }, {
501
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Whatsapp-Solutions.png',
502
+ appName: 'whatsapp_solutions',
503
+ checkKey: 'whatsapp_solutions',
504
+ displayName: 'Whatsapp Solutions',
505
+ subText: 'Marketing, commerce, chatbot - ',
506
+ nextLineLabel: ''
507
+ }, {
508
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Marketing.png',
509
+ appName: 'marketing',
510
+ checkKey: 'marketing',
511
+ displayName: 'Marketing',
512
+ subText: 'Digital and influencer marketing & more '
513
+ }, {
514
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/trends.png',
515
+ appName: 'trends',
516
+ checkKey: 'allow_trends',
517
+ displayName: 'Trends',
518
+ subText: 'E-commerce analytics for Bharat'
519
+ }],
520
+ financial_servicea: [{
521
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Capital.png',
522
+ appName: 'capital',
523
+ checkKey: 'Capital',
524
+ displayName: 'Business Loan',
525
+ subText: 'Flexible Business loan up to ₹20 Lakhs'
526
+ }, {
527
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Credit-Score.png',
528
+ appName: 'creditScore',
529
+ checkKey: 'Credit Score',
530
+ displayName: 'Credit Score',
531
+ subText: 'Check your credit score for free '
532
+ }],
533
+ other_services: [{
534
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Omnichannel.png',
535
+ appName: 'omuni',
536
+ checkKey: 'allow_omuni',
537
+ displayName: 'Omnichannel',
538
+ subText: 'Manage all sales channels - online + offline at one place'
539
+ }]
540
+ };
541
+ this.isMobileView = false;
542
+ this.MOBILE_BREAKPOINT = 768;
543
+ this.user = user;
544
+ this.appSwitchList = [];
545
+ console.log(this.data);
546
+ this.resizeListener = function () {
547
+ // Clear the timeout if it exists
548
+ if (_this.resizeTimeout) {
549
+ clearTimeout(_this.resizeTimeout);
550
+ }
551
+ // Set a new timeout
552
+ _this.resizeTimeout = setTimeout(function () {
553
+ _this.checkScreenSize();
554
+ }, 150);
555
+ };
556
+ this.checkScreenSize();
557
+ this.windowRef.nativeWindow.addEventListener('resize', this.resizeListener);
558
+ this.appSwitcherService.showAppSwitchListToDiffUser();
559
+ this.appSwitchList = this.appSwitcherService.appSwitchList;
560
+ }
561
+ SwitcherComponent.prototype.openModal = function () {
562
+ this.isModalOpen = true;
563
+ var sidebar = document.querySelector('app-sidebar');
564
+ if (sidebar) {
565
+ sidebar.setAttribute('style', 'display: none');
566
+ }
567
+ };
568
+ SwitcherComponent.prototype.closeModal = function () {
569
+ this.isModalOpen = false;
570
+ var sidebar = document.querySelector('app-sidebar');
571
+ if (sidebar) {
572
+ sidebar.setAttribute('style', 'display: block');
573
+ }
574
+ };
575
+ SwitcherComponent.prototype.ngOnInit = function () {
576
+ var _this = this;
577
+ this.userJson = localStorage.getItem('ngStorage-USER');
578
+ this.company_id = this.userJson != null ? JSON.parse(this.userJson).company_id : '';
579
+ // Filter out apps based on input data
580
+ if (this.data) {
581
+ var appsToRemove_1 = this.data.split(',').map(function (app) { return app.trim(); });
582
+ // Filter each category in appSwitcherApps
583
+ Object.keys(this.appSwitcherApps).forEach(function (category) {
584
+ _this.appSwitcherApps[category] = _this.appSwitcherApps[category].filter(function (app) { return !appsToRemove_1.includes(app.appName); });
585
+ });
586
+ }
587
+ this.getKYCData();
588
+ };
589
+ SwitcherComponent.prototype.ngOnDestroy = function () {
590
+ this.windowRef.nativeWindow.removeEventListener('resize', this.resizeListener);
591
+ if (this.resizeTimeout) {
592
+ clearTimeout(this.resizeTimeout);
593
+ }
594
+ };
595
+ SwitcherComponent.prototype.checkScreenSize = function () {
596
+ this.isMobileView = this.windowRef.nativeWindow.innerWidth < this.MOBILE_BREAKPOINT;
597
+ this.isDesktop = this.windowRef.nativeWindow.innerWidth >= 768;
598
+ };
599
+ SwitcherComponent.prototype.getKYCData = function () {
600
+ var _this = this;
601
+ this._http.get("settings/international/kyc/details?company_id=" + this.userData.company_id).subscribe(function (res) {
602
+ var data = res.data;
603
+ if (data.kyc_status != null) {
604
+ _this.kycStatus = data.kyc_status;
605
+ }
606
+ }, function (error) {
607
+ });
608
+ };
609
+ SwitcherComponent.prototype.callEvent = function (type, id) {
610
+ this.appSwitcherService.appSwitch(type, this.kycStatus);
611
+ this.appSwitcherService.send('Swithcer Service Selection', id, 'Company Id : ' + this.company_id);
612
+ };
613
+ SwitcherComponent.prototype.appSwitch = function (app) {
614
+ this.appSwitcherService.appSwitch(app);
615
+ };
616
+ return SwitcherComponent;
617
+ }());
618
+ SwitcherComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SwitcherComponent, deps: [{ token: AppSwitcherService }, { token: i2__namespace.HttpClient }, { token: WindowRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
619
+ SwitcherComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SwitcherComponent, selector: "lib-switcher", inputs: { data: "data" }, ngImport: i0__namespace, template: "<div class=\"\" [style.display]=\"!isMobileView ? 'block' : 'none'\">\n <button class=\"p-0 me-2 appSwitcherBtn\" (click)=\"openModal()\" *ngIf=\"userData.allow_checkout || userData.allow_engage || userData.allow_fbs || !userData.allow_fbs\">\n <div class=\"appSwitcherTxt\">\n ALL PRODUCTS\n <img class=\"ml-2 position-relative w-15\" style=\"top: -1px\" src=\"https://sr-sidebar.shiprocket.in/assets/svg/apps.svg\" />\n </div>\n </button>\n</div>\n\n<div [style.display]=\"isMobileView ? 'block' : 'none'\">\n <button\n (click)=\"openModal()\"\n class=\"switcher_icon\"\n >\n <img\n src=\"https://sr-sidebar.shiprocket.in/assets/svg/apps.svg\"\n alt=\"apps\"\n class=\"logo\"\n />\n </button>\n</div>\n\n<div *ngIf=\"isModalOpen\" class=\"modal\" [@modalAnimation]>\n <div class=\"modal-content_new\">\n <span class=\"close\" (click)=\"closeModal()\"><img src=\"https://sr-sidebar.shiprocket.in/assets/svg/cross-dark.svg\" /></span>\n \n <!-- ------------------------------------------------------------------------------------------------- -->\n\n\n <div class=\"mobileScreen\">\n\n\n <div class=\"Topheader\">\n <h1>Select the product you would like to experience </h1>\n <p>Elevate your business with our industry-leading products.</p>\n </div>\n\n\n <ng-container *ngIf=\"appSwitchList && appSwitchList.length\">\n <h5 class=\"section_heading\">Featured Products</h5>\n <div class=\"d-flex gap-4 flex-wrap\">\n <div class=\"box_section featured_section mob_box_section\" (click)=\"appSwitch(item.appName)\" *ngFor=\"let item of appSwitchList; let i = index\">\n <img class=\"icon\" [src]=\"item.appLogo\" />\n <h6>{{item.displayName}}</h6>\n <span class=\"getstarted mob_getstarted\">Get Started <img src=\"https://app.shiprocket.in/seller/assets/images/arrow-small-left.svg\" /></span>\n </div>\n </div>\n </ng-container>\n \n <!-- ------------------------------------------------------------------------------------------------- -->\n \n\n\n \n <h5 class=\"section_heading\">Shipping & Fulfilment in India</h5>\n <div class=\"d-flex flex-wrap gap-4\" >\n <div class=\"box_section\" *ngFor=\"let app of appSwitcherApps.shipping_fulfilment_india\" (click)=\"callEvent(app.appName, app.displayName)\">\n <img class=\"icon\" [src]=\"app.appLogo\"/>\n <h6>{{app.displayName}}</h6>\n <p>{{app.subText}}</p>\n <span class=\"getstarted\">Get Started <img src=\"https://app.shiprocket.in/seller/assets/images/arrow-small-left.svg\"/></span>\n </div>\n </div>\n \n \n \n <h5 class=\"section_heading\">Cross Border Commerce</h5>\n <div class=\"d-flex flex-wrap gap-4\">\n <div class=\"box_section\" *ngFor=\"let app of appSwitcherApps.cross_border_commerce\" (click)=\"callEvent(app.appName, app.displayName)\">\n <img class=\"icon\" [src]=\"app.appLogo\"/>\n <h6>{{app.displayName}}</h6>\n <p>{{app.subText}}</p>\n <span class=\"getstarted\">Get Started <img src=\"https://app.shiprocket.in/seller/assets/images/arrow-small-left.svg\"/></span>\n </div>\n \n </div>\n \n \n \n <h5 class=\"section_heading\">Growth & Marketing Solutions</h5>\n <div class=\"d-flex flex-wrap gap-4\">\n <div class=\"box_section\" *ngFor=\"let app of appSwitcherApps.growth_marketing_solutions\" (click)=\"callEvent(app.appName, app.displayName)\">\n <img class=\"icon\" [src]=\"app.appLogo\"/>\n <h6>{{app.displayName}}</h6>\n <p>{{app.subText}} <span *ngIf=\"app.nextLineLabel\"><br>{{app.nextLineLabel}} </span></p>\n <span class=\"getstarted\">Get Started <img src=\"https://app.shiprocket.in/seller/assets/images/arrow-small-left.svg\"/></span>\n </div>\n </div>\n \n \n <h5 class=\"section_heading\">Financial Services</h5>\n <div class=\"d-flex flex-wrap gap-4\">\n <div class=\"box_section\" *ngFor=\"let app of appSwitcherApps.financial_servicea\" (click)=\"callEvent(app.appName, app.displayName)\">\n <span class=\"newtag\" *ngIf=\"app.appName === 'capital' || (app.appName === 'creditScore' && userData.is_crif_enabled)\"><em>New</em></span>\n <span class=\"newtag\" *ngIf=\"app.appName === 'creditScore' && !userData.is_crif_enabled\"><em>Coming Soon</em></span>\n <img class=\"icon\" [src]=\"app.appLogo\"/>\n <h6>{{app.displayName}}</h6>\n <p>{{app.subText}}</p>\n <span class=\"getstarted\">Get Started <img src=\"https://app.shiprocket.in/seller/assets/images/arrow-small-left.svg\"/></span>\n </div>\n </div>\n <h5 class=\"section_heading\">Other services</h5>\n <div class=\"d-flex flex-wrap gap-4\">\n <div class=\"box_section other_ser\" *ngFor=\"let app of appSwitcherApps.other_services\" (click)=\"callEvent(app.appName, app.displayName)\">\n <img class=\"icon\" src=\"https://sr-cdn-1.shiprocket.in/img/Web_New/Omnichannel.png\"/>\n <h6>Omnichannel</h6>\n <p style=\"text-wrap: wrap;\">Manage all sales channels - online + offline at one place</p>\n <span class=\"getstarted\" style=\"bottom: 5px;\">Get Started <img src=\"https://app.shiprocket.in/seller/assets/images/arrow-small-left.svg\"/></span>\n </div>\n </div>\n </div>\n\n \n\n\n </div>\n</div> ", styles: ["@import\"https://fonts.cdnfonts.com/css/sf-pro-display\";.modal{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;z-index:1000;display:flex;justify-content:center;align-items:center}.modal-content_new{position:relative;width:100%;height:100%;background-color:#f7f5fb;overflow-y:scroll}.close{position:absolute;top:20px;right:20px;font-size:24px;cursor:pointer;z-index:1001}::ng-deep .ad-padding-b{min-height:0!important}.d-flex{display:flex;flex-wrap:wrap}.gap-4{grid-gap:16px;gap:16px}.mobileScreen{background:#F7F5FB;padding:80px;background-image:url(https://sr-cdn-1.shiprocket.in/img/Web/Bg-Pattern.svg);background-repeat:no-repeat;background-size:contain;background-position:top right}.Topheader{margin-bottom:35px}.Topheader h1{color:#1d1d1d;font-size:36px!important;line-height:32px!important;letter-spacing:-.48px;margin-top:0;font-family:\"SF Pro Display\",sans-serif;font-weight:500}.Topheader h1 span{color:#745be7}.Topheader p{color:#757575;font-size:18px;line-height:normal;margin-top:10px}.section_heading{color:#676767;font-size:20px!important;text-transform:uppercase;margin-bottom:0;margin-top:60px}.featured_section{width:225px!important}.box_section{height:242px;padding:12px;border-radius:16px;background:#FBFBFB;box-shadow:0 5px 20px #1b1f440d;cursor:pointer;margin-top:16px;margin-bottom:0;position:relative;width:268px}.box_section img.icon{width:100%;border-radius:10px}.box_section h6{color:#1d1d1d;font-size:18px!important;margin-top:14px;font-family:\"SF Pro Display\",sans-serif;font-weight:500;margin-bottom:8px;text-transform:capitalize;line-height:22px!important;text-wrap:wrap}.box_section p{color:#828488;font-size:14px;line-height:18px;margin-bottom:0;font-family:\"SF Pro Display\",sans-serif;font-weight:400}.box_section span.getstarted{color:#745be7;font-size:16px;position:absolute;bottom:18px;font-family:\"SF Pro Display\",sans-serif;font-weight:500}.box_section span img{margin-left:5px}.box_section .newtag{position:absolute;right:5px;padding:3px 8px 1px;background:#DDFFE8;top:5px;border-radius:30px}.box_section .newtag em{position:relative;border-radius:4px;padding:1px 8px;color:#3fc06a;font-size:10px;top:-1px;font-style:normal;text-align:center;width:100%;display:block;left:0px;line-height:20px}.appSwitcherBtn{border-radius:4px;border:0;cursor:pointer;line-height:12px;color:#1d1d1d;font-size:12px;background:linear-gradient(169deg,#12c2e999 40.8%,#12c2e999 45%,#c471ed99 60%);font-weight:400;transition:background-color .3s}.appSwitcherBtn:hover{background-color:#fff}.appSwitcherTxt{background:linear-gradient(150.38deg,#fefefe -5.2%,#e7f9fd 7.94%,#f9f1fd 40.98%);padding:8px 12px 6px;border-radius:4px;margin:1px;transition:background-color .5s}.appSwitcherTxt:hover{background-color:#f9f8fe!important}.appSwitcherTxt:hover{background-color:#f9f8fe!important;transition:.5s}@media only screen and (max-width:362px){.box_section h6{font-size:12px!important}.box_section p,.box_section span.getstarted{font-size:11px}}@media (min-width: 768px) and (max-width: 1059px){.box_section h6{font-size:16px!important}.box_section p{font-size:13px!important}.box_section{height:206px!important;width:188px!important}.box_section span.getstarted{font-size:12px!important}.section_heading{font-size:16px!important}}@media (max-width: 767px){.mob_box_section{width:100%!important;padding:12px!important;border-radius:16px!important;background:#FBFBFB!important;box-shadow:0 5px 20px #1b1f440d!important;cursor:pointer!important;margin-top:16px!important;margin-bottom:0!important;position:relative!important;line-height:18px!important;min-height:160px!important}.mob_box_section img.mob_icon{width:100%!important;border-radius:6px!important}.mob_box_section h6{color:#1b1f44!important;font-size:14px!important;margin-top:10px!important;font-family:\"SF Pro Display\",sans-serif!important;margin-bottom:5px!important;text-transform:capitalize!important;min-height:34px!important;font-weight:500!important;line-height:20px!important}.mob_getstarted{color:#745be7!important}.switcher_icon{border:none;background:#fff;position:relative;top:0px;box-shadow:0 -1px 4px #0000000f;padding:11px 7px}.mobileScreen{padding:40px}.box_section{flex:0 0 calc(50% - 16px);box-sizing:border-box}.box_section span.getstarted{bottom:10px;font-size:14px}.box_section{padding:10px;margin-top:0;height:auto}.box_section h6{font-size:14px;margin-top:10px}.box_section p{font-size:12px;line-height:1.3;max-height:70px;min-height:55px}.other_ser p{min-height:65px!important}.box_section .icon{height:auto}.getstarted{font-size:12px}.Topheader h1{font-size:25px!important;line-height:30px!important}.Topheader p{font-size:14px}.section_heading{font-size:16px!important;margin:45px 0 10px}}\n"], directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]" }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]" }], animations: [
620
+ animations.trigger('modalAnimation', [
621
+ animations.transition(':enter', [
622
+ animations.style({ opacity: 0, transform: 'scale(0.8)' }),
623
+ animations.animate('200ms ease-out', animations.style({ opacity: 1, transform: 'scale(1)' }))
624
+ ]),
625
+ animations.transition(':leave', [
626
+ animations.animate('200ms ease-in', animations.style({ opacity: 0, transform: 'scale(0.8)' }))
627
+ ])
628
+ ])
629
+ ] });
630
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SwitcherComponent, decorators: [{
631
+ type: i0.Component,
632
+ args: [{
633
+ selector: 'lib-switcher',
634
+ templateUrl: './switcher.component.html',
635
+ styleUrls: ['./switcher.component.css'],
636
+ animations: [
637
+ animations.trigger('modalAnimation', [
638
+ animations.transition(':enter', [
639
+ animations.style({ opacity: 0, transform: 'scale(0.8)' }),
640
+ animations.animate('200ms ease-out', animations.style({ opacity: 1, transform: 'scale(1)' }))
641
+ ]),
642
+ animations.transition(':leave', [
643
+ animations.animate('200ms ease-in', animations.style({ opacity: 0, transform: 'scale(0.8)' }))
644
+ ])
645
+ ])
646
+ ]
647
+ }]
648
+ }], ctorParameters: function () { return [{ type: AppSwitcherService }, { type: i2__namespace.HttpClient }, { type: WindowRef }]; }, propDecorators: { data: [{
649
+ type: i0.Input
650
+ }] } });
651
+
652
+ var SwitcherModule = /** @class */ (function () {
653
+ function SwitcherModule() {
654
+ }
655
+ return SwitcherModule;
656
+ }());
657
+ SwitcherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SwitcherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
658
+ SwitcherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SwitcherModule, declarations: [SwitcherComponent], imports: [i4.CommonModule], exports: [SwitcherComponent] });
659
+ SwitcherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SwitcherModule, providers: [
660
+ WindowRef,
661
+ AppSwitcherService
662
+ ], imports: [[i4.CommonModule]] });
663
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SwitcherModule, decorators: [{
664
+ type: i0.NgModule,
665
+ args: [{
666
+ declarations: [SwitcherComponent],
667
+ imports: [i4.CommonModule],
668
+ exports: [SwitcherComponent],
669
+ schemas: [i0.CUSTOM_ELEMENTS_SCHEMA],
670
+ providers: [
671
+ WindowRef,
672
+ AppSwitcherService
673
+ ]
674
+ }]
675
+ }] });
676
+
677
+ /*
678
+ * Public API Surface of switcher
679
+ */
680
+
681
+ /**
682
+ * Generated bundle index. Do not edit.
683
+ */
684
+
685
+ exports.AppSwitcherService = AppSwitcherService;
686
+ exports.SwitcherComponent = SwitcherComponent;
687
+ exports.SwitcherModule = SwitcherModule;
688
+
689
+ Object.defineProperty(exports, '__esModule', { value: true });
690
+
691
+ }));
692
+ //# sourceMappingURL=global.engg-switcher-lib.umd.js.map