@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,649 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, Component, Input, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
3
+ import * as i1 from '@angular/router';
4
+ import * as i2 from '@angular/common/http';
5
+ import { trigger, transition, style, animate } from '@angular/animations';
6
+ import * as i4 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+
9
+ function _window() {
10
+ return window;
11
+ }
12
+ class WindowRef {
13
+ get nativeWindow() {
14
+ return _window();
15
+ }
16
+ }
17
+ WindowRef.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WindowRef, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
18
+ WindowRef.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WindowRef, providedIn: 'root' });
19
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: WindowRef, decorators: [{
20
+ type: Injectable,
21
+ args: [{
22
+ providedIn: 'root'
23
+ }]
24
+ }] });
25
+
26
+ class AppSwitcherService {
27
+ constructor(router, _http, windowRef) {
28
+ this.router = router;
29
+ this._http = _http;
30
+ this.windowRef = windowRef;
31
+ this.SR_CONSTANTS = {
32
+ QuickWebBaseUrl: window.location.host == 'app.shiprocket.in'
33
+ ? 'https://quick.shiprocket.in/'
34
+ : 'https://sr-quick-courier-qa-1-web.kartrocket.com/',
35
+ EngageWebBaseUrl: window.location.host == 'app.shiprocket.in'
36
+ ? 'https://app-engage.shiprocket.in/'
37
+ : 'https://sr-engage-web-stage.kartrocket.com/',
38
+ CheckoutWebBaseUrl: 'https://checkout-app.shiprocket.in/',
39
+ SrfWebBaseUrl: 'https://srf-app.shiprocket.in/',
40
+ FulfillmentWebBaseUrl: 'https://fulfillment.shiprocket.in',
41
+ WigzoWebBaseUrl: 'https://convert.shiprocket.in/wigzo/lite/auth/shiprocket/login',
42
+ PickrrWebBaseUrl: window.location.host == 'app.shiprocket.in'
43
+ ? 'https://dashboard.pickrr.com/'
44
+ : 'https://shiprocket-to-pickrr.netlify.app/',
45
+ EngagePlusWebBaseURL: window.location.host == 'app.shiprocket.in' ? 'https://app-engage.shiprocket.in/' : 'https://sr-engage-web-qa-3.kartrocket.com/'
46
+ };
47
+ this.userData = JSON.parse(localStorage.getItem('ngStorage-USER') || '{}');
48
+ this.isDesktop = false;
49
+ this.appSwitchList = [
50
+ {
51
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Whatsapp-Solutions.png',
52
+ appName: 'engage',
53
+ checkKey: 'allow_engage',
54
+ displayName: 'Whatsapp Solutions (Engage360)'
55
+ },
56
+ {
57
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Checkout.png',
58
+ appName: 'checkout',
59
+ checkKey: 'allow_checkout',
60
+ displayName: 'Checkout'
61
+ },
62
+ {
63
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Warehousing.png',
64
+ appName: 'fullfilment',
65
+ checkKey: 'allow_fbs',
66
+ displayName: 'Warehousing (SR Fulfilment)'
67
+ },
68
+ {
69
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Cargo.png',
70
+ appName: 'rocketbox',
71
+ checkKey: 'allow_rocketbox',
72
+ displayName: 'Cargo'
73
+ },
74
+ {
75
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Instant-deliveries.png',
76
+ appName: 'openInApp',
77
+ checkKey: 'openInApp',
78
+ displayName: 'Open In App'
79
+ },
80
+ {
81
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Omnichannel.png',
82
+ appName: 'omuni',
83
+ checkKey: 'allow_omuni',
84
+ displayName: 'Omuni'
85
+ },
86
+ {
87
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/trends.png',
88
+ appName: 'trends',
89
+ checkKey: 'allow_trends',
90
+ displayName: 'Trends'
91
+ },
92
+ ];
93
+ }
94
+ isCheckoutAllowed(companyId) {
95
+ const 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
96
+ ];
97
+ const isAllowedCompany = companies.includes(companyId);
98
+ return isAllowedCompany;
99
+ }
100
+ showAppSwitchListToDiffUser() {
101
+ this.appSwitchList = this.appSwitchList.filter((res) => {
102
+ var _a, _b, _c, _d, _e, _f;
103
+ if (this.userData.allow_engage && res.checkKey === 'allow_engage') {
104
+ return true;
105
+ }
106
+ else if ((this.isCheckoutAllowed((_a = this.userData) === null || _a === void 0 ? void 0 : _a.company_id) ||
107
+ this.userData.allow_checkout) &&
108
+ res.checkKey === 'allow_checkout') {
109
+ return true;
110
+ }
111
+ else if (this.userData.allow_fbs && res.checkKey === 'allow_fbs') {
112
+ return true;
113
+ }
114
+ else if ((this.userData.allow_rb_panel || this.userData.is_rb_user) &&
115
+ res.checkKey === 'allow_rocketbox') {
116
+ return true;
117
+ }
118
+ else if (((_b = this.userData) === null || _b === void 0 ? void 0 : _b.allow_sr_convert) &&
119
+ !((_c = this.userData) === null || _c === void 0 ? void 0 : _c.allow_engage) &&
120
+ res.checkKey === 'allow_sr_convert') {
121
+ return true;
122
+ }
123
+ else if ((res === null || res === void 0 ? void 0 : res.checkKey) === 'allow_one_impression') {
124
+ return true;
125
+ }
126
+ 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)) {
127
+ return true;
128
+ }
129
+ 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)) {
130
+ return true;
131
+ }
132
+ 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) {
133
+ return true;
134
+ }
135
+ else {
136
+ return false;
137
+ }
138
+ });
139
+ }
140
+ appSwitch(app, kyc_status) {
141
+ var _a, _b, _c;
142
+ this.sendGaEvent(app);
143
+ if (this.userData.allow_engage && app === 'engage') {
144
+ window.open(`${this.SR_CONSTANTS.EngageWebBaseUrl}gate-keeper?token=${this.userData.token}`, '_blank');
145
+ }
146
+ else if (app === 'checkout') {
147
+ let 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}`;
148
+ url = `${url}&token=${this.userData.token}`;
149
+ window.open(url, '_blank');
150
+ // if ((this.isCheckoutAllowed(this.userData?.company_id) || this.userData.allow_checkout)) {
151
+ // url = `${url}&token=${this.userData.token}`
152
+ // window.open(url, '_blank');
153
+ // }else{
154
+ // window.open("https://checkout.shiprocket.in/", '_blank');
155
+ // }
156
+ }
157
+ else if (this.userData.allow_fbs && app === 'fullfilment') {
158
+ window.open(`${this.SR_CONSTANTS.SrfWebBaseUrl}login?token=${this.userData.token}`, '_blank');
159
+ }
160
+ else if (!this.userData.allow_fbs && app === 'fullfilment') {
161
+ 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');
162
+ }
163
+ else if (app === 'rocketbox') {
164
+ if (this.userData.allow_rb_panel || this.userData.is_rb_user) {
165
+ window.location.href = window.location.origin + '/rocketbox';
166
+ }
167
+ else {
168
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
169
+ }
170
+ }
171
+ else if (((_a = this.userData) === null || _a === void 0 ? void 0 : _a.allow_sr_convert) &&
172
+ !((_b = this.userData) === null || _b === void 0 ? void 0 : _b.allow_engage) &&
173
+ app === 'sr_convert') {
174
+ window.open(`${this.SR_CONSTANTS.WigzoWebBaseUrl}/${this.userData.token}`, '_blank');
175
+ }
176
+ else if (app === 'sr_genie') {
177
+ window.open(`https://ai-test.kartrocket.com/login?token=${this.userData.token}`, '_blank');
178
+ }
179
+ else if (app === 'one_impression') {
180
+ // Calling one-impression and redirecting to new tab
181
+ this.fetchOneImpressionLoginLink();
182
+ }
183
+ else if (app === 'openInApp') {
184
+ this.fetchOpenInAppLink();
185
+ }
186
+ else if (app === 'wigzo') {
187
+ window.open(`https://app.wigzo.com/auth/shiprocket/login/${this.userData.token}`, '_blank');
188
+ }
189
+ else if (app === 'omuni') {
190
+ window.open(`https://omuni.com/`, '_blank');
191
+ // if (this.userData?.is_omuni2_user == 1) {
192
+ // this.httpService.get('omuni/switch').subscribe(
193
+ // (res) => {
194
+ // const redirect_uri = res?.redirect_uri;
195
+ // if (!redirect_uri) {
196
+ // this.toastr.error('Something Went Wrong');
197
+ // }
198
+ // window.open(redirect_uri, '_blank');
199
+ // },
200
+ // (err) => {
201
+ // this.toastr.error(err.message);
202
+ // }
203
+ // );
204
+ // } else {
205
+ // this.router.navigate(['/home'])
206
+ // }
207
+ }
208
+ else if (app === 'trends') {
209
+ window.open(`https://trends.shiprocket.in/`, '_blank');
210
+ }
211
+ else if (app === 'creditScore') {
212
+ if ((_c = this.userData) === null || _c === void 0 ? void 0 : _c.is_crif_enabled) {
213
+ 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');
214
+ }
215
+ else {
216
+ window.open(`https://www.shiprocket.in/capital/`, '_blank');
217
+ }
218
+ }
219
+ else if (app === 'capital') {
220
+ 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');
221
+ }
222
+ else if (app === 'marketing') {
223
+ window.location.href = window.location.origin + '/seller' + '/home';
224
+ }
225
+ else if (app === 'whatsapp_solutions') {
226
+ if (this.userData.allow_engage) {
227
+ window.open(`${this.SR_CONSTANTS.EngageWebBaseUrl}gate-keeper?token=${this.userData.token}`, '_blank');
228
+ }
229
+ else {
230
+ window.open(`https://app-engage.shiprocket.in/auth/register`, '_blank');
231
+ }
232
+ }
233
+ else if (app === 'internationalParcels') {
234
+ if (kyc_status == 0 || kyc_status == 1 || kyc_status == 2 || kyc_status == 4) {
235
+ window.location.href = window.location.origin + '/seller' + '/internationalDashboard/overview';
236
+ }
237
+ else {
238
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
239
+ }
240
+ }
241
+ else if (app === 'i_rocketbox') {
242
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
243
+ }
244
+ else if (app === 'brand_launch') {
245
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
246
+ }
247
+ else if (app === 'express_parcel') {
248
+ window.location.href = window.location.origin + '/seller' + '/home';
249
+ }
250
+ else if (app === 'instant_deliveries') {
251
+ window.open(`${this.SR_CONSTANTS.QuickWebBaseUrl}gate-keeper?token=${this.userData.token}`, '_blank');
252
+ return;
253
+ }
254
+ else if (app === 'warehousing') {
255
+ window.open(`https://fulfillment.shiprocket.in/`, '_blank');
256
+ }
257
+ else if (app == 'srocketbox') {
258
+ window.location.href = window.location.origin + '/seller' + '/settings/internationalsettings/internationalkyc';
259
+ }
260
+ else if (app == 'somuni') {
261
+ window.location.href = window.location.origin + '/seller' + '/home';
262
+ }
263
+ }
264
+ sendGaEvent(event) {
265
+ let category = '';
266
+ let eventName = '';
267
+ let label = '';
268
+ switch (event) {
269
+ case 'addorder':
270
+ category = 'Rvmp_Header - Quick Actions';
271
+ eventName = 'Clicked on "Add an Order"';
272
+ label = '';
273
+ break;
274
+ case 'quickshipment':
275
+ category = 'Rvmp_Header - Quick Actions';
276
+ eventName = 'Clicked on "Create a quick shipemnt';
277
+ label = '';
278
+ break;
279
+ case 'ratecalculator':
280
+ category = 'Rvmp_Header - Quick Actions';
281
+ eventName = 'Clicked on "Rate Calculator"';
282
+ label = '';
283
+ break;
284
+ case 'createticket':
285
+ category = 'Rvmp_Header - Quick Actions';
286
+ eventName = 'Clicked on "Create a Ticket"';
287
+ label = '';
288
+ break;
289
+ case 'trackshipment':
290
+ category = 'Rvmp_Header - Quick Actions';
291
+ eventName = 'Clicked on "Track Shipments"';
292
+ label = '';
293
+ break;
294
+ case 'profilename':
295
+ category = 'Rvmp_Header - Profile Icon';
296
+ eventName = 'Clicked on "User Profile"';
297
+ label = '';
298
+ break;
299
+ case 'currentplan':
300
+ category = 'Rvmp_Header - Profile Icon';
301
+ eventName = 'Clicked on "Current Plan"';
302
+ label = '';
303
+ break;
304
+ case 'refer':
305
+ category = 'Rvmp_Header - Profile Icon';
306
+ eventName = 'Clicked on "Refer & Earn"';
307
+ label = '';
308
+ break;
309
+ case 'rateus':
310
+ category = 'Rvmp_Header - Profile Icon';
311
+ eventName = 'Clicked on "Rate Us"';
312
+ label = '';
313
+ break;
314
+ case 'tnc':
315
+ category = 'Rvmp_Header - Profile Icon';
316
+ eventName = 'Clicked on "T&C"';
317
+ label = '';
318
+ break;
319
+ case 'changepassword':
320
+ category = 'Rvmp_Header - Profile Icon';
321
+ eventName = 'Clicked on "Change Password"';
322
+ label = '';
323
+ break;
324
+ case 'logout':
325
+ category = 'Rvmp_Header - Profile Icon';
326
+ eventName = 'Clicked on "Logout"';
327
+ label = '';
328
+ break;
329
+ case 'recharge':
330
+ category = 'Rvmp_Header';
331
+ eventName = 'Clicked on "Recharge Wallet"';
332
+ label = '';
333
+ break;
334
+ case 'profileicon':
335
+ category = 'Rvmp_Header';
336
+ eventName = 'Clicked on "Profile Icon"';
337
+ label = '';
338
+ break;
339
+ case 'fullfilment':
340
+ category = 'Rvmp_Header - App Switcher';
341
+ eventName = 'Clicked on "SR Fulfilment"';
342
+ label = '';
343
+ break;
344
+ case 'switchtooldversion':
345
+ category = 'Rvmp_Header - Switch to old version';
346
+ eventName = 'Clicked on "Switch to old version"';
347
+ label = 'company_id:' + this.userData.company_id;
348
+ break;
349
+ case 'engage':
350
+ category = 'Rvmp_Header - App Switcher';
351
+ eventName = 'Clicked on "SR Engage"';
352
+ label = '';
353
+ }
354
+ this.send(category, eventName, label);
355
+ }
356
+ send(eventCategory, eventAction, eventLabel) {
357
+ var _a;
358
+ const source = ((_a = document.cookie
359
+ .split('; ')
360
+ .find(row => row.startsWith('UTM='))) === null || _a === void 0 ? void 0 : _a.split('=')[1]) || '';
361
+ this.windowRef.nativeWindow.ga('send', 'event', {
362
+ eventCategory: eventCategory,
363
+ eventAction: eventAction,
364
+ eventLabel: eventLabel ? eventLabel : source,
365
+ });
366
+ this.windowRef.nativeWindow.gtag_g4('event', eventAction, {
367
+ event_category: eventCategory,
368
+ event_label: eventLabel ? eventLabel : source,
369
+ });
370
+ }
371
+ fetchOpenInAppLink() {
372
+ this._http.get('oneimpression/open-app-redirection_url')
373
+ .subscribe((res) => {
374
+ if (res && (res === null || res === void 0 ? void 0 : res.url)) {
375
+ window.open(res === null || res === void 0 ? void 0 : res.url, '_blank');
376
+ }
377
+ });
378
+ }
379
+ fetchOneImpressionLoginLink() {
380
+ this._http.get(this._getURL() + 'oneimpression/get-login-link').subscribe((res) => {
381
+ if (res && (res === null || res === void 0 ? void 0 : res.url)) {
382
+ window.open(res === null || res === void 0 ? void 0 : res.url, '_blank');
383
+ }
384
+ else if ((res === null || res === void 0 ? void 0 : res.status) == 'fail') {
385
+ // this.toastr.error(res?.message)
386
+ }
387
+ }),
388
+ (error) => {
389
+ };
390
+ }
391
+ _getURL() {
392
+ return `https://apiv2.shiprocket.in/v1/`;
393
+ }
394
+ }
395
+ AppSwitcherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AppSwitcherService, deps: [{ token: i1.Router }, { token: i2.HttpClient }, { token: WindowRef }], target: i0.ɵɵFactoryTarget.Injectable });
396
+ AppSwitcherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AppSwitcherService, providedIn: 'root' });
397
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: AppSwitcherService, decorators: [{
398
+ type: Injectable,
399
+ args: [{
400
+ providedIn: 'root'
401
+ }]
402
+ }], ctorParameters: function () { return [{ type: i1.Router }, { type: i2.HttpClient }, { type: WindowRef }]; } });
403
+
404
+ const user = JSON.parse(localStorage.getItem('ngStorage-USER') || '{}');
405
+ class SwitcherComponent {
406
+ constructor(appSwitcherService, _http, windowRef) {
407
+ this.appSwitcherService = appSwitcherService;
408
+ this._http = _http;
409
+ this.windowRef = windowRef;
410
+ this.data = '';
411
+ this.isModalOpen = false;
412
+ this.isDesktop = false;
413
+ this.company_id = '';
414
+ this.userData = user;
415
+ this.appSwitcherApps = {
416
+ shipping_fulfilment_india: [
417
+ {
418
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Express-Parcel.png',
419
+ appName: 'express_parcel',
420
+ checkKey: 'Domestic Shipping',
421
+ displayName: 'Domestic Shipping',
422
+ subText: 'Multiple couriers, SDD/NDD, widest reach'
423
+ }, {
424
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Instant-deliveries.png',
425
+ appName: 'instant_deliveries',
426
+ checkKey: 'Instant deliveries',
427
+ displayName: 'Instant deliveries',
428
+ subText: 'Multiple couriers, Hyperlocal, Intracity'
429
+ }, {
430
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Warehousing.png',
431
+ appName: 'fullfilment',
432
+ checkKey: 'Warehousing',
433
+ displayName: 'Warehousing',
434
+ subText: 'End-to-end brand fulfilment '
435
+ },
436
+ {
437
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Cargo.png',
438
+ appName: 'rocketbox',
439
+ checkKey: 'allow_rocketbox',
440
+ displayName: 'Cargo',
441
+ subText: 'Heavy shipments, FTL & PTL '
442
+ },
443
+ ],
444
+ cross_border_commerce: [{
445
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/International-Parcels.png',
446
+ appName: 'internationalParcels',
447
+ checkKey: 'internationalParcels',
448
+ displayName: 'International Parcels',
449
+ subText: 'Ship to 220+ countries'
450
+ }, {
451
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/International-Cargo.png',
452
+ appName: 'i_rocketbox',
453
+ checkKey: 'i_allow_rocketbox',
454
+ displayName: 'International Cargo',
455
+ subText: 'Air & Ocean freight'
456
+ }, {
457
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Brand-Launch.png',
458
+ appName: 'brand_launch',
459
+ checkKey: 'brand_launch',
460
+ displayName: 'Brand Launch',
461
+ subText: 'Expand your brand globally '
462
+ }],
463
+ growth_marketing_solutions: [{
464
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Checkout.png',
465
+ appName: 'checkout',
466
+ checkKey: 'allow_checkout',
467
+ displayName: 'Checkout',
468
+ subText: 'Simplified one-click checkout'
469
+ }, {
470
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Whatsapp-Solutions.png',
471
+ appName: 'whatsapp_solutions',
472
+ checkKey: 'whatsapp_solutions',
473
+ displayName: 'Whatsapp Solutions',
474
+ subText: 'Marketing, commerce, chatbot - ',
475
+ nextLineLabel: ''
476
+ }, {
477
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Marketing.png',
478
+ appName: 'marketing',
479
+ checkKey: 'marketing',
480
+ displayName: 'Marketing',
481
+ subText: 'Digital and influencer marketing & more '
482
+ }, {
483
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/trends.png',
484
+ appName: 'trends',
485
+ checkKey: 'allow_trends',
486
+ displayName: 'Trends',
487
+ subText: 'E-commerce analytics for Bharat'
488
+ }],
489
+ financial_servicea: [{
490
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Capital.png',
491
+ appName: 'capital',
492
+ checkKey: 'Capital',
493
+ displayName: 'Business Loan',
494
+ subText: 'Flexible Business loan up to ₹20 Lakhs'
495
+ }, {
496
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Credit-Score.png',
497
+ appName: 'creditScore',
498
+ checkKey: 'Credit Score',
499
+ displayName: 'Credit Score',
500
+ subText: 'Check your credit score for free '
501
+ }],
502
+ other_services: [{
503
+ appLogo: 'https://sr-cdn-1.shiprocket.in/img/Web_New/Omnichannel.png',
504
+ appName: 'omuni',
505
+ checkKey: 'allow_omuni',
506
+ displayName: 'Omnichannel',
507
+ subText: 'Manage all sales channels - online + offline at one place'
508
+ }]
509
+ };
510
+ this.isMobileView = false;
511
+ this.MOBILE_BREAKPOINT = 768;
512
+ this.user = user;
513
+ this.appSwitchList = [];
514
+ console.log(this.data);
515
+ this.resizeListener = () => {
516
+ // Clear the timeout if it exists
517
+ if (this.resizeTimeout) {
518
+ clearTimeout(this.resizeTimeout);
519
+ }
520
+ // Set a new timeout
521
+ this.resizeTimeout = setTimeout(() => {
522
+ this.checkScreenSize();
523
+ }, 150);
524
+ };
525
+ this.checkScreenSize();
526
+ this.windowRef.nativeWindow.addEventListener('resize', this.resizeListener);
527
+ this.appSwitcherService.showAppSwitchListToDiffUser();
528
+ this.appSwitchList = this.appSwitcherService.appSwitchList;
529
+ }
530
+ openModal() {
531
+ this.isModalOpen = true;
532
+ const sidebar = document.querySelector('app-sidebar');
533
+ if (sidebar) {
534
+ sidebar.setAttribute('style', 'display: none');
535
+ }
536
+ }
537
+ closeModal() {
538
+ this.isModalOpen = false;
539
+ const sidebar = document.querySelector('app-sidebar');
540
+ if (sidebar) {
541
+ sidebar.setAttribute('style', 'display: block');
542
+ }
543
+ }
544
+ ngOnInit() {
545
+ this.userJson = localStorage.getItem('ngStorage-USER');
546
+ this.company_id = this.userJson != null ? JSON.parse(this.userJson).company_id : '';
547
+ // Filter out apps based on input data
548
+ if (this.data) {
549
+ const appsToRemove = this.data.split(',').map(app => app.trim());
550
+ // Filter each category in appSwitcherApps
551
+ Object.keys(this.appSwitcherApps).forEach((category) => {
552
+ this.appSwitcherApps[category] = this.appSwitcherApps[category].filter((app) => !appsToRemove.includes(app.appName));
553
+ });
554
+ }
555
+ this.getKYCData();
556
+ }
557
+ ngOnDestroy() {
558
+ this.windowRef.nativeWindow.removeEventListener('resize', this.resizeListener);
559
+ if (this.resizeTimeout) {
560
+ clearTimeout(this.resizeTimeout);
561
+ }
562
+ }
563
+ checkScreenSize() {
564
+ this.isMobileView = this.windowRef.nativeWindow.innerWidth < this.MOBILE_BREAKPOINT;
565
+ this.isDesktop = this.windowRef.nativeWindow.innerWidth >= 768;
566
+ }
567
+ getKYCData() {
568
+ this._http.get(`settings/international/kyc/details?company_id=${this.userData.company_id}`).subscribe((res) => {
569
+ const data = res.data;
570
+ if (data.kyc_status != null) {
571
+ this.kycStatus = data.kyc_status;
572
+ }
573
+ }, (error) => {
574
+ });
575
+ }
576
+ callEvent(type, id) {
577
+ this.appSwitcherService.appSwitch(type, this.kycStatus);
578
+ this.appSwitcherService.send('Swithcer Service Selection', id, 'Company Id : ' + this.company_id);
579
+ }
580
+ appSwitch(app) {
581
+ this.appSwitcherService.appSwitch(app);
582
+ }
583
+ }
584
+ SwitcherComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SwitcherComponent, deps: [{ token: AppSwitcherService }, { token: i2.HttpClient }, { token: WindowRef }], target: i0.ɵɵFactoryTarget.Component });
585
+ SwitcherComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: SwitcherComponent, selector: "lib-switcher", inputs: { data: "data" }, ngImport: i0, 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.NgIf, selector: "[ngIf]" }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]" }], animations: [
586
+ trigger('modalAnimation', [
587
+ transition(':enter', [
588
+ style({ opacity: 0, transform: 'scale(0.8)' }),
589
+ animate('200ms ease-out', style({ opacity: 1, transform: 'scale(1)' }))
590
+ ]),
591
+ transition(':leave', [
592
+ animate('200ms ease-in', style({ opacity: 0, transform: 'scale(0.8)' }))
593
+ ])
594
+ ])
595
+ ] });
596
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SwitcherComponent, decorators: [{
597
+ type: Component,
598
+ args: [{
599
+ selector: 'lib-switcher',
600
+ templateUrl: './switcher.component.html',
601
+ styleUrls: ['./switcher.component.css'],
602
+ animations: [
603
+ trigger('modalAnimation', [
604
+ transition(':enter', [
605
+ style({ opacity: 0, transform: 'scale(0.8)' }),
606
+ animate('200ms ease-out', style({ opacity: 1, transform: 'scale(1)' }))
607
+ ]),
608
+ transition(':leave', [
609
+ animate('200ms ease-in', style({ opacity: 0, transform: 'scale(0.8)' }))
610
+ ])
611
+ ])
612
+ ]
613
+ }]
614
+ }], ctorParameters: function () { return [{ type: AppSwitcherService }, { type: i2.HttpClient }, { type: WindowRef }]; }, propDecorators: { data: [{
615
+ type: Input
616
+ }] } });
617
+
618
+ class SwitcherModule {
619
+ }
620
+ SwitcherModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SwitcherModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
621
+ SwitcherModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SwitcherModule, declarations: [SwitcherComponent], imports: [CommonModule], exports: [SwitcherComponent] });
622
+ SwitcherModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SwitcherModule, providers: [
623
+ WindowRef,
624
+ AppSwitcherService
625
+ ], imports: [[CommonModule]] });
626
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: SwitcherModule, decorators: [{
627
+ type: NgModule,
628
+ args: [{
629
+ declarations: [SwitcherComponent],
630
+ imports: [CommonModule],
631
+ exports: [SwitcherComponent],
632
+ schemas: [CUSTOM_ELEMENTS_SCHEMA],
633
+ providers: [
634
+ WindowRef,
635
+ AppSwitcherService
636
+ ]
637
+ }]
638
+ }] });
639
+
640
+ /*
641
+ * Public API Surface of switcher
642
+ */
643
+
644
+ /**
645
+ * Generated bundle index. Do not edit.
646
+ */
647
+
648
+ export { AppSwitcherService, SwitcherComponent, SwitcherModule };
649
+ //# sourceMappingURL=global.engg-switcher-lib.js.map