@global.engg/switcher-lib 0.1.16 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/global.engg-switcher-lib.umd.js +75 -33
- package/bundles/global.engg-switcher-lib.umd.js.map +1 -1
- package/esm2015/lib/switcher.component.js +9 -4
- package/esm2015/lib/switcher.service.js +67 -31
- package/fesm2015/global.engg-switcher-lib.js +74 -33
- package/fesm2015/global.engg-switcher-lib.js.map +1 -1
- package/lib/switcher.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -173,16 +173,27 @@
|
|
|
173
173
|
});
|
|
174
174
|
};
|
|
175
175
|
AppSwitcherService.prototype.appSwitch = function (app, kyc_status) {
|
|
176
|
-
var _a, _b
|
|
176
|
+
var _a, _b;
|
|
177
177
|
this.sendGaEvent(app);
|
|
178
|
-
|
|
178
|
+
// moengage event
|
|
179
|
+
(_b = (_a = this.windowRef.nativeWindow) === null || _a === void 0 ? void 0 : _a.Moengage) === null || _b === void 0 ? void 0 : _b.track_event("product_navigation_icon_clicked", { icon_name: app, company_id: this.userData.company_id });
|
|
180
|
+
// Store window reference BEFORE delay to prevent popup blocking
|
|
181
|
+
var windowRef = this.windowRef.nativeWindow;
|
|
182
|
+
// Add delay after MoEngage tracking
|
|
183
|
+
// setTimeout(() => {
|
|
184
|
+
// }, 500); // 500ms delay
|
|
185
|
+
this.executeAppSwitch(app, kyc_status, windowRef);
|
|
186
|
+
};
|
|
187
|
+
AppSwitcherService.prototype.executeAppSwitch = function (app, kyc_status, windowRef) {
|
|
188
|
+
var _this = this;
|
|
189
|
+
var _a, _b, _c;
|
|
179
190
|
if (this.userData.allow_engage && app === 'engage') {
|
|
180
|
-
|
|
191
|
+
windowRef.open(this.SR_CONSTANTS.EngageWebBaseUrl + "gate-keeper?token=" + this.userData.token, '_blank');
|
|
181
192
|
}
|
|
182
193
|
else if (app === 'checkout') {
|
|
183
194
|
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;
|
|
184
195
|
url = url + "&token=" + this.userData.token;
|
|
185
|
-
|
|
196
|
+
windowRef.open(url, '_blank');
|
|
186
197
|
// if ((this.isCheckoutAllowed(this.userData?.company_id) || this.userData.allow_checkout)) {
|
|
187
198
|
// url = `${url}&token=${this.userData.token}`
|
|
188
199
|
// window.open(url, '_blank');
|
|
@@ -191,26 +202,31 @@
|
|
|
191
202
|
// }
|
|
192
203
|
}
|
|
193
204
|
else if (this.userData.allow_fbs && app === 'fullfilment') {
|
|
194
|
-
|
|
205
|
+
windowRef.open(this.SR_CONSTANTS.SrfWebBaseUrl + "login?token=" + this.userData.token, '_blank');
|
|
195
206
|
}
|
|
196
207
|
else if (!this.userData.allow_fbs && app === 'fullfilment') {
|
|
197
|
-
|
|
208
|
+
windowRef.open(this.SR_CONSTANTS.FulfillmentWebBaseUrl + "?utm_source=panel&utm_medium=app_switcher&utm_campaign=SR-Panel-non-srf-switcher&token=" + this.userData.token, '_blank');
|
|
198
209
|
}
|
|
199
210
|
else if (app === 'rocketbox') {
|
|
200
211
|
if (this.userData.allow_rb_panel || this.userData.is_rb_user) {
|
|
201
|
-
window.location.href
|
|
212
|
+
// Use setTimeout for window.location.href redirects
|
|
213
|
+
setTimeout(function () {
|
|
214
|
+
window.location.href = _this.DOMAIN + "/rocketbox";
|
|
215
|
+
}, 500);
|
|
202
216
|
}
|
|
203
217
|
else {
|
|
204
|
-
|
|
218
|
+
setTimeout(function () {
|
|
219
|
+
window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
|
|
220
|
+
}, 500);
|
|
205
221
|
}
|
|
206
222
|
}
|
|
207
223
|
else if (((_a = this.userData) === null || _a === void 0 ? void 0 : _a.allow_sr_convert) &&
|
|
208
224
|
!((_b = this.userData) === null || _b === void 0 ? void 0 : _b.allow_engage) &&
|
|
209
225
|
app === 'sr_convert') {
|
|
210
|
-
|
|
226
|
+
windowRef.open(this.SR_CONSTANTS.WigzoWebBaseUrl + "/" + this.userData.token, '_blank');
|
|
211
227
|
}
|
|
212
228
|
else if (app === 'sr_genie') {
|
|
213
|
-
|
|
229
|
+
windowRef.open("https://ai-test.kartrocket.com/login?token=" + this.userData.token, '_blank');
|
|
214
230
|
}
|
|
215
231
|
else if (app === 'one_impression') {
|
|
216
232
|
// Calling one-impression and redirecting to new tab
|
|
@@ -220,10 +236,10 @@
|
|
|
220
236
|
this.fetchOpenInAppLink();
|
|
221
237
|
}
|
|
222
238
|
else if (app === 'wigzo') {
|
|
223
|
-
|
|
239
|
+
windowRef.open("https://app.wigzo.com/auth/shiprocket/login/" + this.userData.token, '_blank');
|
|
224
240
|
}
|
|
225
241
|
else if (app === 'omuni') {
|
|
226
|
-
|
|
242
|
+
windowRef.open("https://omuni.com/", '_blank');
|
|
227
243
|
// if (this.userData?.is_omuni2_user == 1) {
|
|
228
244
|
// this.httpService.get('omuni/switch').subscribe(
|
|
229
245
|
// (res) => {
|
|
@@ -242,59 +258,82 @@
|
|
|
242
258
|
// }
|
|
243
259
|
}
|
|
244
260
|
else if (app === 'trends') {
|
|
245
|
-
|
|
261
|
+
windowRef.open("https://trends.shiprocket.in/", '_blank');
|
|
246
262
|
}
|
|
247
263
|
else if (app === 'creditScore') {
|
|
248
264
|
if ((_c = this.userData) === null || _c === void 0 ? void 0 : _c.is_crif_enabled) {
|
|
249
|
-
|
|
265
|
+
windowRef.open("https://capital-web.shiprocket.in/crif-home/?utm_source=App-Switcher&utm_medium=Manual-Adhoc&utm_content=crif_credit_score&utm_term=app_switcher_click&authToken=" + this.userData.token, '_blank');
|
|
250
266
|
}
|
|
251
267
|
else {
|
|
252
|
-
|
|
268
|
+
windowRef.open("https://www.shiprocket.in/capital/", '_blank');
|
|
253
269
|
}
|
|
254
270
|
}
|
|
255
271
|
else if (app === 'capital') {
|
|
256
|
-
|
|
272
|
+
windowRef.open("https://capital-web.shiprocket.in/home/?utm_source=App-Switcher&utm_medium=Manual-Adhoc&utm_content=capital&utm_term=flexi_business_loan&authToken=" + this.userData.token, '_blank');
|
|
257
273
|
}
|
|
258
274
|
else if (app === 'marketing') {
|
|
259
|
-
window.location.href
|
|
275
|
+
// Use setTimeout for window.location.href redirects
|
|
276
|
+
setTimeout(function () {
|
|
277
|
+
window.location.href = _this.DOMAIN + "/seller/home";
|
|
278
|
+
}, 500);
|
|
260
279
|
}
|
|
261
280
|
else if (app === 'whatsapp_solutions') {
|
|
262
281
|
if (this.userData.allow_engage) {
|
|
263
|
-
|
|
282
|
+
windowRef.open(this.SR_CONSTANTS.EngageWebBaseUrl + "gate-keeper?token=" + this.userData.token, '_blank');
|
|
264
283
|
}
|
|
265
284
|
else {
|
|
266
|
-
|
|
285
|
+
windowRef.open("https://app-engage.shiprocket.in/auth/register", '_blank');
|
|
267
286
|
}
|
|
268
287
|
}
|
|
269
288
|
else if (app === 'internationalParcels') {
|
|
270
289
|
if (kyc_status == 0 || kyc_status == 1 || kyc_status == 2 || kyc_status == 4) {
|
|
271
|
-
window.location.href
|
|
290
|
+
// Use setTimeout for window.location.href redirects
|
|
291
|
+
setTimeout(function () {
|
|
292
|
+
window.location.href = _this.DOMAIN + "/seller/internationalDashboard/overview";
|
|
293
|
+
}, 500);
|
|
272
294
|
}
|
|
273
295
|
else {
|
|
274
|
-
|
|
296
|
+
setTimeout(function () {
|
|
297
|
+
window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
|
|
298
|
+
}, 500);
|
|
275
299
|
}
|
|
276
300
|
}
|
|
277
301
|
else if (app === 'i_rocketbox') {
|
|
278
|
-
window.location.href
|
|
302
|
+
// Use setTimeout for window.location.href redirects
|
|
303
|
+
setTimeout(function () {
|
|
304
|
+
window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
|
|
305
|
+
}, 500);
|
|
279
306
|
}
|
|
280
307
|
else if (app === 'brand_launch') {
|
|
281
|
-
window.location.href
|
|
308
|
+
// Use setTimeout for window.location.href redirects
|
|
309
|
+
setTimeout(function () {
|
|
310
|
+
window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
|
|
311
|
+
}, 500);
|
|
282
312
|
}
|
|
283
313
|
else if (app === 'express_parcel') {
|
|
284
|
-
window.location.href
|
|
314
|
+
// Use setTimeout for window.location.href redirects
|
|
315
|
+
setTimeout(function () {
|
|
316
|
+
window.location.href = _this.DOMAIN + "/seller/home";
|
|
317
|
+
}, 500);
|
|
285
318
|
}
|
|
286
319
|
else if (app === 'instant_deliveries') {
|
|
287
|
-
|
|
320
|
+
windowRef.open(this.SR_CONSTANTS.QuickWebBaseUrl + "gate-keeper?token=" + this.userData.token, '_blank');
|
|
288
321
|
return;
|
|
289
322
|
}
|
|
290
323
|
else if (app === 'warehousing') {
|
|
291
|
-
|
|
324
|
+
windowRef.open("https://fulfillment.shiprocket.in/", '_blank');
|
|
292
325
|
}
|
|
293
326
|
else if (app == 'srocketbox') {
|
|
294
|
-
window.location.href
|
|
327
|
+
// Use setTimeout for window.location.href redirects
|
|
328
|
+
setTimeout(function () {
|
|
329
|
+
window.location.href = _this.DOMAIN + "/seller/settings/internationalsettings/internationalkyc";
|
|
330
|
+
}, 500);
|
|
295
331
|
}
|
|
296
332
|
else if (app == 'somuni') {
|
|
297
|
-
window.location.href
|
|
333
|
+
// Use setTimeout for window.location.href redirects
|
|
334
|
+
setTimeout(function () {
|
|
335
|
+
window.location.href = _this.DOMAIN + "/seller/home";
|
|
336
|
+
}, 500);
|
|
298
337
|
}
|
|
299
338
|
};
|
|
300
339
|
AppSwitcherService.prototype.sendGaEvent = function (event) {
|
|
@@ -390,8 +429,6 @@
|
|
|
390
429
|
this.send(category, eventName, label);
|
|
391
430
|
};
|
|
392
431
|
AppSwitcherService.prototype.moengageEvent = function (event) {
|
|
393
|
-
var _a, _b;
|
|
394
|
-
(_b = (_a = this.windowRef.nativeWindow) === null || _a === void 0 ? void 0 : _a.Moengage) === null || _b === void 0 ? void 0 : _b.track_event("product_navigation_icon_clicked", { icon_name: event, company_id: this.userData.company_id });
|
|
395
432
|
};
|
|
396
433
|
AppSwitcherService.prototype.send = function (eventCategory, eventAction, eventLabel) {
|
|
397
434
|
var _a, _b, _c;
|
|
@@ -727,8 +764,13 @@
|
|
|
727
764
|
}
|
|
728
765
|
SwitcherComponent.prototype.openModal = function (param) {
|
|
729
766
|
var _this = this;
|
|
730
|
-
var _a;
|
|
731
|
-
|
|
767
|
+
var _a, _b, _c, _d, _e;
|
|
768
|
+
if (param == 'mobile') {
|
|
769
|
+
(_b = (_a = this.windowRef.nativeWindow) === null || _a === void 0 ? void 0 : _a.Moengage) === null || _b === void 0 ? void 0 : _b.track_event("bottom_navigation_clicked", { "company_id": this.company_id, "button_name": 'Switcher' });
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
(_d = (_c = this.windowRef.nativeWindow) === null || _c === void 0 ? void 0 : _c.Moengage) === null || _d === void 0 ? void 0 : _d.track_event("button_clicked", { "company_id": this.company_id, "button_name": 'Switcher' });
|
|
773
|
+
}
|
|
732
774
|
this.isModalOpen = true;
|
|
733
775
|
this.showProducts = false;
|
|
734
776
|
this.modalHasBeenOpened = true; // Mark that modal has been opened
|
|
@@ -750,7 +792,7 @@
|
|
|
750
792
|
}, 200);
|
|
751
793
|
if (param == 'mobile') {
|
|
752
794
|
this.userJson = JSON.parse(localStorage.getItem('ngStorage-USER') || localStorage.getItem('_userData') || '{}');
|
|
753
|
-
this.company_id = this.userJson != null ? (
|
|
795
|
+
this.company_id = this.userJson != null ? (_e = this.userJson) === null || _e === void 0 ? void 0 : _e.company_id : '';
|
|
754
796
|
this.appSwitcherService.send('All Products', 'All Products Mobile', 'Company Id: ' + this.company_id);
|
|
755
797
|
}
|
|
756
798
|
else if (param == 'desktop') {
|