ouisys-engine 2.1.46 → 2.1.49
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/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +143 -84
- package/dist/reducers/moFlow/MoTypes.d.ts +9 -0
- package/dist/reducers/moFlow/utils.d.ts +2 -1
- package/dist/reducers/moFlow/utils.js +74 -27
- package/dist/reducers/oneClickFlow/index.js +2 -2
- package/dist/utilities/loadScriptInnerHtml.d.ts +1 -1
- package/dist/utilities/loadScriptInnerHtml.js +9 -4
- package/dist/utilities/loadScriptSrc.d.ts +2 -0
- package/dist/utilities/loadScriptSrc.js +18 -0
- package/package.json +1 -1
- package/src/@types/window.d.ts +1 -0
- package/src/api/index.ts +22 -6
- package/src/reducers/moFlow/MoTypes.ts +12 -0
- package/src/reducers/moFlow/utils.ts +28 -2
- package/src/reducers/oneClickFlow/index.ts +2 -2
- package/src/utilities/loadScriptInnerHtml.ts +8 -4
- package/src/utilities/loadScriptSrc.ts +10 -0
package/dist/api/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IMSISDNSubmissionResult, IPINSubmissionResult, ICheckSubscriptionResult, IMcpShieldResult } from "../reducers/pinFlow/PinTypes";
|
|
2
2
|
import { IMSISDNSubmissionResult as IMoRedirMSISDNSubmissionResult } from "../reducers/moRedirFlow/MoRedirTypes";
|
|
3
|
-
import { IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducers/moFlow/MoTypes";
|
|
3
|
+
import { IGoogleReCaptcha, IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducers/moFlow/MoTypes";
|
|
4
4
|
import { IIdentifyResult } from "../reducers/strategy/StrategyTypes";
|
|
5
5
|
import { IFetchResult } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
6
6
|
export interface ITallyman {
|
|
@@ -14,6 +14,7 @@ export interface ITallyman {
|
|
|
14
14
|
ussd: (host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, search: string, extraParamsQs: string) => Promise<IMoMSISDNSubmissionResult>;
|
|
15
15
|
oc2sms: (host: string, country: string, slug: string, offer: number, rockmanId: string, keyword: string, operator: string, search: string) => Promise<IFetchResult>;
|
|
16
16
|
mcpShield: (host: string, country: string, slug: string, device: string, offer: number, rockmanId: string, operator?: string, uniqid?: string) => Promise<IMcpShieldResult>;
|
|
17
|
+
getGoogleCaptcha: (host: string, country: string, slug: string, device: string, domain: string) => Promise<IGoogleReCaptcha>;
|
|
17
18
|
}
|
|
18
19
|
export declare const MockTallyman: ITallyman;
|
|
19
20
|
export declare const RealTallyman: ITallyman;
|
package/dist/api/index.js
CHANGED
|
@@ -321,306 +321,334 @@ var MockTallyman = {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
return mcpShield;
|
|
324
|
+
}(),
|
|
325
|
+
getGoogleCaptcha: function () {
|
|
326
|
+
var _getGoogleCaptcha = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(host, country, slug, device, domain) {
|
|
327
|
+
return regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
328
|
+
while (1) {
|
|
329
|
+
switch (_context11.prev = _context11.next) {
|
|
330
|
+
case 0:
|
|
331
|
+
return _context11.abrupt("return", {
|
|
332
|
+
"site_key": "6LfMTS8fAAAAAHw-cibJXMfnsIYNpWh81GatD1lw",
|
|
333
|
+
"secret_key": "6LfMTS8fAAAAAIAET7tvHjrU-tRPGuqSdfCZZX6G",
|
|
334
|
+
"domains": "n.gamiclub.com",
|
|
335
|
+
"success": true
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
case 1:
|
|
339
|
+
case "end":
|
|
340
|
+
return _context11.stop();
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}, _callee11);
|
|
344
|
+
}));
|
|
345
|
+
|
|
346
|
+
function getGoogleCaptcha(_x81, _x82, _x83, _x84, _x85) {
|
|
347
|
+
return _getGoogleCaptcha.apply(this, arguments);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
return getGoogleCaptcha;
|
|
324
351
|
}()
|
|
325
352
|
};
|
|
326
353
|
exports.MockTallyman = MockTallyman;
|
|
327
354
|
var RealTallyman = {
|
|
328
355
|
identify: function () {
|
|
329
|
-
var _identify2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
356
|
+
var _identify2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(host, slug, country, msisdn, device, offer, rockmanId) {
|
|
330
357
|
var isDMB, newHost;
|
|
331
|
-
return regeneratorRuntime.wrap(function
|
|
358
|
+
return regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
332
359
|
while (1) {
|
|
333
|
-
switch (
|
|
360
|
+
switch (_context12.prev = _context12.next) {
|
|
334
361
|
case 0:
|
|
335
362
|
console.log("RealTallyman");
|
|
336
363
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
337
364
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
338
|
-
|
|
365
|
+
_context12.next = 5;
|
|
339
366
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=identify&slug=").concat(slug, "&country=").concat(country, "&msisdn=").concat(msisdn, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId)).then(function (x) {
|
|
340
367
|
return x.json();
|
|
341
368
|
});
|
|
342
369
|
|
|
343
370
|
case 5:
|
|
344
|
-
return
|
|
371
|
+
return _context12.abrupt("return", _context12.sent);
|
|
345
372
|
|
|
346
373
|
case 6:
|
|
347
374
|
case "end":
|
|
348
|
-
return
|
|
375
|
+
return _context12.stop();
|
|
349
376
|
}
|
|
350
377
|
}
|
|
351
|
-
},
|
|
378
|
+
}, _callee12);
|
|
352
379
|
}));
|
|
353
380
|
|
|
354
|
-
function identify(
|
|
381
|
+
function identify(_x86, _x87, _x88, _x89, _x90, _x91, _x92) {
|
|
355
382
|
return _identify2.apply(this, arguments);
|
|
356
383
|
}
|
|
357
384
|
|
|
358
385
|
return identify;
|
|
359
386
|
}(),
|
|
360
387
|
triggerPin: function () {
|
|
361
|
-
var _triggerPin2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
388
|
+
var _triggerPin2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid) {
|
|
362
389
|
var isDMB, newHost, isCleanTraffic;
|
|
363
|
-
return regeneratorRuntime.wrap(function
|
|
390
|
+
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
364
391
|
while (1) {
|
|
365
|
-
switch (
|
|
392
|
+
switch (_context13.prev = _context13.next) {
|
|
366
393
|
case 0:
|
|
367
394
|
console.log("RealTallyman");
|
|
368
395
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
369
396
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
370
397
|
isCleanTraffic = country.toLowerCase() === "be" ? typeof window != "undefined" && window.shouldBlock === true ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
|
|
371
|
-
|
|
398
|
+
_context13.next = 6;
|
|
372
399
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=trigger-pin&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&msisdn=").concat(msisdn, "&rockman_id=").concat(rockmanId).concat(uniqid).concat(isCleanTraffic).concat(extraParamsQs, "&").concat(search)).then(function (x) {
|
|
373
400
|
return x.json();
|
|
374
401
|
});
|
|
375
402
|
|
|
376
403
|
case 6:
|
|
377
|
-
return
|
|
404
|
+
return _context13.abrupt("return", _context13.sent);
|
|
378
405
|
|
|
379
406
|
case 7:
|
|
380
407
|
case "end":
|
|
381
|
-
return
|
|
408
|
+
return _context13.stop();
|
|
382
409
|
}
|
|
383
410
|
}
|
|
384
|
-
},
|
|
411
|
+
}, _callee13);
|
|
385
412
|
}));
|
|
386
413
|
|
|
387
|
-
function triggerPin(
|
|
414
|
+
function triggerPin(_x93, _x94, _x95, _x96, _x97, _x98, _x99, _x100, _x101, _x102) {
|
|
388
415
|
return _triggerPin2.apply(this, arguments);
|
|
389
416
|
}
|
|
390
417
|
|
|
391
418
|
return triggerPin;
|
|
392
419
|
}(),
|
|
393
420
|
verifyPin: function () {
|
|
394
|
-
var _verifyPin2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
421
|
+
var _verifyPin2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid) {
|
|
395
422
|
var isDMB, newHost, isCleanTraffic;
|
|
396
|
-
return regeneratorRuntime.wrap(function
|
|
423
|
+
return regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
397
424
|
while (1) {
|
|
398
|
-
switch (
|
|
425
|
+
switch (_context14.prev = _context14.next) {
|
|
399
426
|
case 0:
|
|
400
427
|
console.log("RealTallyman");
|
|
401
428
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
402
429
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
403
430
|
isCleanTraffic = country.toLowerCase() === "be" ? typeof window != "undefined" && window.shouldBlock === true ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
|
|
404
|
-
|
|
431
|
+
_context14.next = 6;
|
|
405
432
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=verify-pin&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&pin=").concat(pin).concat(uniqid, "&sam_evina_tid=").concat(evinaTid).concat(isCleanTraffic).concat(extraParamsQs)).then(function (x) {
|
|
406
433
|
return x.json();
|
|
407
434
|
});
|
|
408
435
|
|
|
409
436
|
case 6:
|
|
410
|
-
return
|
|
437
|
+
return _context14.abrupt("return", _context14.sent);
|
|
411
438
|
|
|
412
439
|
case 7:
|
|
413
440
|
case "end":
|
|
414
|
-
return
|
|
441
|
+
return _context14.stop();
|
|
415
442
|
}
|
|
416
443
|
}
|
|
417
|
-
},
|
|
444
|
+
}, _callee14);
|
|
418
445
|
}));
|
|
419
446
|
|
|
420
|
-
function verifyPin(
|
|
447
|
+
function verifyPin(_x103, _x104, _x105, _x106, _x107, _x108, _x109, _x110, _x111, _x112) {
|
|
421
448
|
return _verifyPin2.apply(this, arguments);
|
|
422
449
|
}
|
|
423
450
|
|
|
424
451
|
return verifyPin;
|
|
425
452
|
}(),
|
|
426
453
|
checkSubscription: function () {
|
|
427
|
-
var _checkSubscription2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
454
|
+
var _checkSubscription2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(host, country, slug, device, offer, rockmanId, pin, extraParamsQs) {
|
|
428
455
|
var isDMB, newHost;
|
|
429
|
-
return regeneratorRuntime.wrap(function
|
|
456
|
+
return regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
430
457
|
while (1) {
|
|
431
|
-
switch (
|
|
458
|
+
switch (_context15.prev = _context15.next) {
|
|
432
459
|
case 0:
|
|
433
460
|
console.log("RealTallyman");
|
|
434
461
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
435
462
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
436
|
-
|
|
463
|
+
_context15.next = 5;
|
|
437
464
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=check-subscription&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId)).then(function (x) {
|
|
438
465
|
return x.json();
|
|
439
466
|
});
|
|
440
467
|
|
|
441
468
|
case 5:
|
|
442
|
-
return
|
|
469
|
+
return _context15.abrupt("return", _context15.sent);
|
|
443
470
|
|
|
444
471
|
case 6:
|
|
445
472
|
case "end":
|
|
446
|
-
return
|
|
473
|
+
return _context15.stop();
|
|
447
474
|
}
|
|
448
475
|
}
|
|
449
|
-
},
|
|
476
|
+
}, _callee15);
|
|
450
477
|
}));
|
|
451
478
|
|
|
452
|
-
function checkSubscription(
|
|
479
|
+
function checkSubscription(_x113, _x114, _x115, _x116, _x117, _x118, _x119, _x120) {
|
|
453
480
|
return _checkSubscription2.apply(this, arguments);
|
|
454
481
|
}
|
|
455
482
|
|
|
456
483
|
return checkSubscription;
|
|
457
484
|
}(),
|
|
458
485
|
checkSubscriptionByRockmanIdOnly: function () {
|
|
459
|
-
var _checkSubscriptionByRockmanIdOnly2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
486
|
+
var _checkSubscriptionByRockmanIdOnly2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(host, rockmanId) {
|
|
460
487
|
var isDMB, newHost;
|
|
461
|
-
return regeneratorRuntime.wrap(function
|
|
488
|
+
return regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
462
489
|
while (1) {
|
|
463
|
-
switch (
|
|
490
|
+
switch (_context16.prev = _context16.next) {
|
|
464
491
|
case 0:
|
|
465
492
|
console.log("RealTallyman");
|
|
466
493
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
467
494
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
468
|
-
|
|
495
|
+
_context16.next = 5;
|
|
469
496
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=check-subscription&rockman_id=").concat(rockmanId)).then(function (x) {
|
|
470
497
|
return x.json();
|
|
471
498
|
});
|
|
472
499
|
|
|
473
500
|
case 5:
|
|
474
|
-
return
|
|
501
|
+
return _context16.abrupt("return", _context16.sent);
|
|
475
502
|
|
|
476
503
|
case 6:
|
|
477
504
|
case "end":
|
|
478
|
-
return
|
|
505
|
+
return _context16.stop();
|
|
479
506
|
}
|
|
480
507
|
}
|
|
481
|
-
},
|
|
508
|
+
}, _callee16);
|
|
482
509
|
}));
|
|
483
510
|
|
|
484
|
-
function checkSubscriptionByRockmanIdOnly(
|
|
511
|
+
function checkSubscriptionByRockmanIdOnly(_x121, _x122) {
|
|
485
512
|
return _checkSubscriptionByRockmanIdOnly2.apply(this, arguments);
|
|
486
513
|
}
|
|
487
514
|
|
|
488
515
|
return checkSubscriptionByRockmanIdOnly;
|
|
489
516
|
}(),
|
|
490
517
|
redirect: function () {
|
|
491
|
-
var _redirect2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
518
|
+
var _redirect2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(host, slug, country, msisdn, device, offer, rockmanId, ip_range_name, search, extraParamsQs) {
|
|
492
519
|
var isDMB, newHost;
|
|
493
|
-
return regeneratorRuntime.wrap(function
|
|
520
|
+
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
494
521
|
while (1) {
|
|
495
|
-
switch (
|
|
522
|
+
switch (_context17.prev = _context17.next) {
|
|
496
523
|
case 0:
|
|
497
524
|
console.log("RealTallyman");
|
|
498
525
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
499
526
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
500
|
-
|
|
527
|
+
_context17.next = 5;
|
|
501
528
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=redirect&slug=").concat(slug, "&country=").concat(country, "&msisdn=").concat(msisdn, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&network_type=").concat(!ip_range_name ? "wifi" : "", "&").concat(search).concat(extraParamsQs)).then(function (x) {
|
|
502
529
|
return x.json();
|
|
503
530
|
});
|
|
504
531
|
|
|
505
532
|
case 5:
|
|
506
|
-
return
|
|
533
|
+
return _context17.abrupt("return", _context17.sent);
|
|
507
534
|
|
|
508
535
|
case 6:
|
|
509
536
|
case "end":
|
|
510
|
-
return
|
|
537
|
+
return _context17.stop();
|
|
511
538
|
}
|
|
512
539
|
}
|
|
513
|
-
},
|
|
540
|
+
}, _callee17);
|
|
514
541
|
}));
|
|
515
542
|
|
|
516
|
-
function redirect(
|
|
543
|
+
function redirect(_x123, _x124, _x125, _x126, _x127, _x128, _x129, _x130, _x131, _x132) {
|
|
517
544
|
return _redirect2.apply(this, arguments);
|
|
518
545
|
}
|
|
519
546
|
|
|
520
547
|
return redirect;
|
|
521
548
|
}(),
|
|
522
549
|
triggerMessage: function () {
|
|
523
|
-
var _triggerMessage2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
524
|
-
var isDMB, newHost;
|
|
525
|
-
return regeneratorRuntime.wrap(function
|
|
550
|
+
var _triggerMessage2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(host, slug, country, msisdn, device, offer, rockmanId, search, extraParamsQs) {
|
|
551
|
+
var isDMB, newHost, samGtoken;
|
|
552
|
+
return regeneratorRuntime.wrap(function _callee18$(_context18) {
|
|
526
553
|
while (1) {
|
|
527
|
-
switch (
|
|
554
|
+
switch (_context18.prev = _context18.next) {
|
|
528
555
|
case 0:
|
|
529
556
|
console.log("RealTallyman");
|
|
530
557
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
531
558
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
532
|
-
|
|
533
|
-
|
|
559
|
+
samGtoken = window.reCaptchaToken ? "sam-g-token=".concat(window.reCaptchaToken) : '';
|
|
560
|
+
_context18.next = 6;
|
|
561
|
+
return fetch("https://".concat(newHost, "/tallyman/v1/?action=trigger-message&slug=").concat(slug, "&country=").concat(country, "&msisdn=").concat(msisdn, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&").concat(samGtoken).concat(search).concat(extraParamsQs)).then(function (x) {
|
|
534
562
|
return x.json();
|
|
535
563
|
});
|
|
536
564
|
|
|
537
|
-
case 5:
|
|
538
|
-
return _context17.abrupt("return", _context17.sent);
|
|
539
|
-
|
|
540
565
|
case 6:
|
|
566
|
+
return _context18.abrupt("return", _context18.sent);
|
|
567
|
+
|
|
568
|
+
case 7:
|
|
541
569
|
case "end":
|
|
542
|
-
return
|
|
570
|
+
return _context18.stop();
|
|
543
571
|
}
|
|
544
572
|
}
|
|
545
|
-
},
|
|
573
|
+
}, _callee18);
|
|
546
574
|
}));
|
|
547
575
|
|
|
548
|
-
function triggerMessage(
|
|
576
|
+
function triggerMessage(_x133, _x134, _x135, _x136, _x137, _x138, _x139, _x140, _x141) {
|
|
549
577
|
return _triggerMessage2.apply(this, arguments);
|
|
550
578
|
}
|
|
551
579
|
|
|
552
580
|
return triggerMessage;
|
|
553
581
|
}(),
|
|
554
582
|
ussd: function () {
|
|
555
|
-
var _ussd2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
583
|
+
var _ussd2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(host, slug, country, msisdn, device, offer, rockmanId, search, extraParamsQs) {
|
|
556
584
|
var isDMB, newHost;
|
|
557
|
-
return regeneratorRuntime.wrap(function
|
|
585
|
+
return regeneratorRuntime.wrap(function _callee19$(_context19) {
|
|
558
586
|
while (1) {
|
|
559
|
-
switch (
|
|
587
|
+
switch (_context19.prev = _context19.next) {
|
|
560
588
|
case 0:
|
|
561
589
|
console.log("RealTallyman");
|
|
562
590
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
563
591
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
564
|
-
|
|
592
|
+
_context19.next = 5;
|
|
565
593
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=ussd&slug=").concat(slug, "&country=").concat(country, "&msisdn=").concat(msisdn, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&").concat(search).concat(extraParamsQs)).then(function (x) {
|
|
566
594
|
return x.json();
|
|
567
595
|
});
|
|
568
596
|
|
|
569
597
|
case 5:
|
|
570
|
-
return
|
|
598
|
+
return _context19.abrupt("return", _context19.sent);
|
|
571
599
|
|
|
572
600
|
case 6:
|
|
573
601
|
case "end":
|
|
574
|
-
return
|
|
602
|
+
return _context19.stop();
|
|
575
603
|
}
|
|
576
604
|
}
|
|
577
|
-
},
|
|
605
|
+
}, _callee19);
|
|
578
606
|
}));
|
|
579
607
|
|
|
580
|
-
function ussd(
|
|
608
|
+
function ussd(_x142, _x143, _x144, _x145, _x146, _x147, _x148, _x149, _x150) {
|
|
581
609
|
return _ussd2.apply(this, arguments);
|
|
582
610
|
}
|
|
583
611
|
|
|
584
612
|
return ussd;
|
|
585
613
|
}(),
|
|
586
614
|
oc2sms: function () {
|
|
587
|
-
var _oc2sms2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
615
|
+
var _oc2sms2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(host, country, slug, offer, rockmanId, keyword, operator, search) {
|
|
588
616
|
var isDMB, newHost;
|
|
589
|
-
return regeneratorRuntime.wrap(function
|
|
617
|
+
return regeneratorRuntime.wrap(function _callee20$(_context20) {
|
|
590
618
|
while (1) {
|
|
591
|
-
switch (
|
|
619
|
+
switch (_context20.prev = _context20.next) {
|
|
592
620
|
case 0:
|
|
593
621
|
console.log("RealTallyman");
|
|
594
622
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
595
623
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
596
|
-
|
|
624
|
+
_context20.next = 5;
|
|
597
625
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=oc2sms&country=").concat(country, "&slug=").concat(slug, "&offerId=").concat(offer).concat(!!keyword ? '&keyword=' + keyword : '', "&device=smart&rockman_id=").concat(rockmanId).concat(!!operator ? '&operator=' + operator : '', "&").concat(search)).then(function (x) {
|
|
598
626
|
return x.json();
|
|
599
627
|
});
|
|
600
628
|
|
|
601
629
|
case 5:
|
|
602
|
-
return
|
|
630
|
+
return _context20.abrupt("return", _context20.sent);
|
|
603
631
|
|
|
604
632
|
case 6:
|
|
605
633
|
case "end":
|
|
606
|
-
return
|
|
634
|
+
return _context20.stop();
|
|
607
635
|
}
|
|
608
636
|
}
|
|
609
|
-
},
|
|
637
|
+
}, _callee20);
|
|
610
638
|
}));
|
|
611
639
|
|
|
612
|
-
function oc2sms(
|
|
640
|
+
function oc2sms(_x151, _x152, _x153, _x154, _x155, _x156, _x157, _x158) {
|
|
613
641
|
return _oc2sms2.apply(this, arguments);
|
|
614
642
|
}
|
|
615
643
|
|
|
616
644
|
return oc2sms;
|
|
617
645
|
}(),
|
|
618
646
|
mcpShield: function () {
|
|
619
|
-
var _mcpShield2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
647
|
+
var _mcpShield2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21(host, country, slug, device, offer, rockmanId, operator, uniqid) {
|
|
620
648
|
var isDMB, newHost, pageUrl, ipAdd, userIp;
|
|
621
|
-
return regeneratorRuntime.wrap(function
|
|
649
|
+
return regeneratorRuntime.wrap(function _callee21$(_context21) {
|
|
622
650
|
while (1) {
|
|
623
|
-
switch (
|
|
651
|
+
switch (_context21.prev = _context21.next) {
|
|
624
652
|
case 0:
|
|
625
653
|
console.log("RealTallyman");
|
|
626
654
|
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
@@ -628,27 +656,58 @@ var RealTallyman = {
|
|
|
628
656
|
pageUrl = window.location.href;
|
|
629
657
|
ipAdd = window.pac_analytics.visitor.ip;
|
|
630
658
|
userIp = ipAdd ? "&client_ip=".concat(ipAdd) : '';
|
|
631
|
-
|
|
659
|
+
_context21.next = 8;
|
|
632
660
|
return fetch("https://".concat(newHost, "/tallyman/v1/?action=mcp-shield&country=").concat(country, "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&operator=").concat(operator || '', "&rockman_id=").concat(rockmanId, "&client_lpu=").concat(pageUrl).concat(userIp).concat(uniqid || '')).then(function (x) {
|
|
633
661
|
return x.json();
|
|
634
662
|
});
|
|
635
663
|
|
|
636
664
|
case 8:
|
|
637
|
-
return
|
|
665
|
+
return _context21.abrupt("return", _context21.sent);
|
|
638
666
|
|
|
639
667
|
case 9:
|
|
640
668
|
case "end":
|
|
641
|
-
return
|
|
669
|
+
return _context21.stop();
|
|
642
670
|
}
|
|
643
671
|
}
|
|
644
|
-
},
|
|
672
|
+
}, _callee21);
|
|
645
673
|
}));
|
|
646
674
|
|
|
647
|
-
function mcpShield(
|
|
675
|
+
function mcpShield(_x159, _x160, _x161, _x162, _x163, _x164, _x165, _x166) {
|
|
648
676
|
return _mcpShield2.apply(this, arguments);
|
|
649
677
|
}
|
|
650
678
|
|
|
651
679
|
return mcpShield;
|
|
680
|
+
}(),
|
|
681
|
+
getGoogleCaptcha: function () {
|
|
682
|
+
var _getGoogleCaptcha2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(host, country, slug, device, domain) {
|
|
683
|
+
var isDMB, newHost;
|
|
684
|
+
return regeneratorRuntime.wrap(function _callee22$(_context22) {
|
|
685
|
+
while (1) {
|
|
686
|
+
switch (_context22.prev = _context22.next) {
|
|
687
|
+
case 0:
|
|
688
|
+
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1 ? true : false;
|
|
689
|
+
newHost = isDMB ? "de.tallymans.com" : host;
|
|
690
|
+
_context22.next = 4;
|
|
691
|
+
return fetch("https://".concat(newHost, "/tallyman/helper/?action=google-captcha-v3-config&country=").concat(country, "&slug=").concat(slug, "&device=").concat(device, "&domain=n.gamiclub.com")).then(function (x) {
|
|
692
|
+
return x.json();
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
case 4:
|
|
696
|
+
return _context22.abrupt("return", _context22.sent);
|
|
697
|
+
|
|
698
|
+
case 5:
|
|
699
|
+
case "end":
|
|
700
|
+
return _context22.stop();
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}, _callee22);
|
|
704
|
+
}));
|
|
705
|
+
|
|
706
|
+
function getGoogleCaptcha(_x167, _x168, _x169, _x170, _x171) {
|
|
707
|
+
return _getGoogleCaptcha2.apply(this, arguments);
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
return getGoogleCaptcha;
|
|
652
711
|
}()
|
|
653
712
|
};
|
|
654
713
|
exports.RealTallyman = RealTallyman;
|
|
@@ -76,3 +76,12 @@ export declare type IMoFlowActionMaps = {
|
|
|
76
76
|
submitMSISDNAction: (msisdn: string) => AppThunk;
|
|
77
77
|
};
|
|
78
78
|
export declare type IMockMoFlowStates = "msisdn-entry-success-state" | "msisdn-entry-failure-state";
|
|
79
|
+
export declare type IGoogleReCaptcha = {
|
|
80
|
+
site_key: string;
|
|
81
|
+
secret_key: string;
|
|
82
|
+
domains: string;
|
|
83
|
+
success: true;
|
|
84
|
+
} | {
|
|
85
|
+
message: string;
|
|
86
|
+
success: false;
|
|
87
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IConfig, IMoFlowReducerState } from "./MoTypes";
|
|
1
|
+
import { IConfig, IMoFlowReducerState, IGoogleReCaptcha } from "./MoTypes";
|
|
2
2
|
import { IKeywordShortcode } from "./MoTypes";
|
|
3
3
|
export default function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: {
|
|
4
4
|
[key: string]: string;
|
|
5
5
|
}): Promise<IKeywordShortcode>;
|
|
6
|
+
export declare const getGoogleReCaptchaConfig: ({ slug, country, device, host }: IConfig) => Promise<IGoogleReCaptcha>;
|
|
6
7
|
export declare function submitMSISDNWithConfig(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: {
|
|
7
8
|
[key: string]: string;
|
|
8
9
|
}): Promise<IKeywordShortcode>;
|
|
@@ -48,12 +48,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
48
48
|
exports.default = submitMSISDN;
|
|
49
49
|
exports.submitMSISDNWithConfig = submitMSISDNWithConfig;
|
|
50
50
|
exports.checkSubscription = checkSubscription;
|
|
51
|
-
exports.mockedMSISDNEntryFailure = exports.mockedMSISDNEntrySuccess = exports.formatSMSLink = void 0;
|
|
51
|
+
exports.mockedMSISDNEntryFailure = exports.mockedMSISDNEntrySuccess = exports.formatSMSLink = exports.getGoogleReCaptchaConfig = void 0;
|
|
52
52
|
|
|
53
53
|
require("regenerator-runtime/runtime");
|
|
54
54
|
|
|
55
55
|
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
56
56
|
|
|
57
|
+
var _loadScriptInnerHtml = _interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));
|
|
58
|
+
|
|
59
|
+
var _loadScriptSrc = _interopRequireDefault(require("../../utilities/loadScriptSrc"));
|
|
60
|
+
|
|
61
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
62
|
+
|
|
57
63
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
58
64
|
|
|
59
65
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -133,37 +139,78 @@ function submitMSISDN(_x5, _x6, _x7, _x8) {
|
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
function _submitMSISDN() {
|
|
136
|
-
_submitMSISDN = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
142
|
+
_submitMSISDN = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, maybeConfig, internationalMSISDN, extraParams) {
|
|
137
143
|
var config;
|
|
138
|
-
return regeneratorRuntime.wrap(function
|
|
144
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
139
145
|
while (1) {
|
|
140
|
-
switch (
|
|
146
|
+
switch (_context3.prev = _context3.next) {
|
|
141
147
|
case 0:
|
|
142
148
|
config = _objectSpread({
|
|
143
149
|
offer: window.pac_analytics.visitor.offer
|
|
144
150
|
}, maybeConfig || {});
|
|
145
|
-
return
|
|
151
|
+
return _context3.abrupt("return", submitMSISDNWithConfig(window, config, internationalMSISDN, extraParams));
|
|
146
152
|
|
|
147
153
|
case 2:
|
|
148
154
|
case "end":
|
|
149
|
-
return
|
|
155
|
+
return _context3.stop();
|
|
150
156
|
}
|
|
151
157
|
}
|
|
152
|
-
},
|
|
158
|
+
}, _callee3);
|
|
153
159
|
}));
|
|
154
160
|
return _submitMSISDN.apply(this, arguments);
|
|
155
161
|
}
|
|
156
162
|
|
|
157
|
-
|
|
163
|
+
var getGoogleReCaptchaConfig = /*#__PURE__*/function () {
|
|
164
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref2) {
|
|
165
|
+
var slug, country, device, host, domain, result, srcUrl;
|
|
166
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
167
|
+
while (1) {
|
|
168
|
+
switch (_context2.prev = _context2.next) {
|
|
169
|
+
case 0:
|
|
170
|
+
slug = _ref2.slug, country = _ref2.country, device = _ref2.device, host = _ref2.host;
|
|
171
|
+
domain = window.location.hostname;
|
|
172
|
+
_context2.next = 4;
|
|
173
|
+
return window.tallymanApi.getGoogleCaptcha(host, country, slug, device, domain);
|
|
174
|
+
|
|
175
|
+
case 4:
|
|
176
|
+
result = _context2.sent;
|
|
177
|
+
|
|
178
|
+
if (result.success === true) {
|
|
179
|
+
srcUrl = "https://www.google.com/recaptcha/api.js?render=".concat(result.site_key);
|
|
180
|
+
(0, _loadScriptSrc.default)(srcUrl);
|
|
181
|
+
setTimeout(function () {
|
|
182
|
+
var script = "\n grecaptcha.ready(function() {\n grecaptcha.execute(\"".concat(result.site_key, "\", {action: 'submit'}).then(function(token) {\n // To be used by tallyman\n window.reCaptchaToken = token;\n console.log(\"-------\" + token);\n });\n });\n ");
|
|
183
|
+
(0, _loadScriptInnerHtml.default)(script, true);
|
|
184
|
+
}, 0);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return _context2.abrupt("return", result);
|
|
188
|
+
|
|
189
|
+
case 7:
|
|
190
|
+
case "end":
|
|
191
|
+
return _context2.stop();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}, _callee2);
|
|
195
|
+
}));
|
|
196
|
+
|
|
197
|
+
return function getGoogleReCaptchaConfig(_x9) {
|
|
198
|
+
return _ref3.apply(this, arguments);
|
|
199
|
+
};
|
|
200
|
+
}();
|
|
201
|
+
|
|
202
|
+
exports.getGoogleReCaptchaConfig = getGoogleReCaptchaConfig;
|
|
203
|
+
|
|
204
|
+
function submitMSISDNWithConfig(_x10, _x11, _x12, _x13) {
|
|
158
205
|
return _submitMSISDNWithConfig.apply(this, arguments);
|
|
159
206
|
}
|
|
160
207
|
|
|
161
208
|
function _submitMSISDNWithConfig() {
|
|
162
|
-
_submitMSISDNWithConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
209
|
+
_submitMSISDNWithConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(window, config, internationalMSISDN, extraParams) {
|
|
163
210
|
var slug, country, device, offer, host, search, extraParamsQs, msisdn, rockmanId, result, type, error;
|
|
164
|
-
return regeneratorRuntime.wrap(function
|
|
211
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
165
212
|
while (1) {
|
|
166
|
-
switch (
|
|
213
|
+
switch (_context4.prev = _context4.next) {
|
|
167
214
|
case 0:
|
|
168
215
|
slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
|
|
169
216
|
search = window.location.search.substr(1) || '';
|
|
@@ -172,14 +219,14 @@ function _submitMSISDNWithConfig() {
|
|
|
172
219
|
}).join('&');
|
|
173
220
|
msisdn = internationalMSISDN.match(/\d+/gi).join('');
|
|
174
221
|
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
175
|
-
|
|
222
|
+
_context4.next = 7;
|
|
176
223
|
return window.tallymanApi.triggerMessage(host, slug, country, msisdn, device, offer, rockmanId, search, extraParamsQs);
|
|
177
224
|
|
|
178
225
|
case 7:
|
|
179
|
-
result =
|
|
226
|
+
result = _context4.sent;
|
|
180
227
|
|
|
181
228
|
if (!(false === result.success)) {
|
|
182
|
-
|
|
229
|
+
_context4.next = 17;
|
|
183
230
|
break;
|
|
184
231
|
}
|
|
185
232
|
|
|
@@ -191,28 +238,28 @@ function _submitMSISDNWithConfig() {
|
|
|
191
238
|
throw error;
|
|
192
239
|
|
|
193
240
|
case 17:
|
|
194
|
-
return
|
|
241
|
+
return _context4.abrupt("return", result);
|
|
195
242
|
|
|
196
243
|
case 18:
|
|
197
244
|
case "end":
|
|
198
|
-
return
|
|
245
|
+
return _context4.stop();
|
|
199
246
|
}
|
|
200
247
|
}
|
|
201
|
-
},
|
|
248
|
+
}, _callee4);
|
|
202
249
|
}));
|
|
203
250
|
return _submitMSISDNWithConfig.apply(this, arguments);
|
|
204
251
|
}
|
|
205
252
|
|
|
206
|
-
function checkSubscription(
|
|
253
|
+
function checkSubscription(_x14, _x15) {
|
|
207
254
|
return _checkSubscription.apply(this, arguments);
|
|
208
255
|
}
|
|
209
256
|
|
|
210
257
|
function _checkSubscription() {
|
|
211
|
-
_checkSubscription = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function
|
|
258
|
+
_checkSubscription = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(window, maybeConfig) {
|
|
212
259
|
var config, host, rockmanId, check, checkResult, error;
|
|
213
|
-
return regeneratorRuntime.wrap(function
|
|
260
|
+
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
214
261
|
while (1) {
|
|
215
|
-
switch (
|
|
262
|
+
switch (_context5.prev = _context5.next) {
|
|
216
263
|
case 0:
|
|
217
264
|
config = _objectSpread({
|
|
218
265
|
offer: window.pac_analytics.visitor.offer
|
|
@@ -224,21 +271,21 @@ function _checkSubscription() {
|
|
|
224
271
|
return window.tallymanApi.checkSubscriptionByRockmanIdOnly(host, rockmanId);
|
|
225
272
|
};
|
|
226
273
|
|
|
227
|
-
|
|
274
|
+
_context5.next = 6;
|
|
228
275
|
return loop(check, 60, function (r) {
|
|
229
276
|
return r.success;
|
|
230
277
|
}, 0);
|
|
231
278
|
|
|
232
279
|
case 6:
|
|
233
|
-
checkResult =
|
|
280
|
+
checkResult = _context5.sent;
|
|
234
281
|
|
|
235
282
|
if (!(true === checkResult.success)) {
|
|
236
|
-
|
|
283
|
+
_context5.next = 12;
|
|
237
284
|
break;
|
|
238
285
|
}
|
|
239
286
|
|
|
240
287
|
window.location.href = checkResult.product_url;
|
|
241
|
-
return
|
|
288
|
+
return _context5.abrupt("return", checkResult.product_url || null);
|
|
242
289
|
|
|
243
290
|
case 12:
|
|
244
291
|
error = new Error("SubscriptionFailed".concat(":\n", checkResult.message));
|
|
@@ -247,10 +294,10 @@ function _checkSubscription() {
|
|
|
247
294
|
|
|
248
295
|
case 15:
|
|
249
296
|
case "end":
|
|
250
|
-
return
|
|
297
|
+
return _context5.stop();
|
|
251
298
|
}
|
|
252
299
|
}
|
|
253
|
-
},
|
|
300
|
+
}, _callee5);
|
|
254
301
|
}));
|
|
255
302
|
return _checkSubscription.apply(this, arguments);
|
|
256
303
|
}
|
|
@@ -125,9 +125,9 @@ function getRedirectUrlAction(_ref) {
|
|
|
125
125
|
|
|
126
126
|
setTimeout(function () {
|
|
127
127
|
window.location.href = redirectUrl;
|
|
128
|
-
},
|
|
128
|
+
}, 1000);
|
|
129
129
|
}
|
|
130
|
-
},
|
|
130
|
+
}, 500);
|
|
131
131
|
} else {
|
|
132
132
|
_strategy.tracker.advancedInFlow('tallyman.v1-one-click', 'click-redirect-url', {
|
|
133
133
|
redirect_url: redirectUrl
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const loadScriptInnerHtml: (innerHTML: string) => void;
|
|
1
|
+
declare const loadScriptInnerHtml: (innerHTML: string, isBody?: boolean) => void;
|
|
2
2
|
export default loadScriptInnerHtml;
|
|
@@ -5,13 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML) {
|
|
8
|
+
var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML, isBody) {
|
|
9
9
|
var script = document.createElement('script');
|
|
10
10
|
script.type = 'text/javascript';
|
|
11
11
|
script.innerHTML = innerHTML;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
|
|
13
|
+
if (isBody) {
|
|
14
|
+
document.getElementsByTagName('body')[0].appendChild(script);
|
|
15
|
+
} else {
|
|
16
|
+
var headElem = document.getElementsByTagName('head')[0];
|
|
17
|
+
headElem.insertBefore(script, headElem.firstChild);
|
|
18
|
+
console.log('loadScript');
|
|
19
|
+
}
|
|
15
20
|
};
|
|
16
21
|
|
|
17
22
|
var _default = loadScriptInnerHtml;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var loadScriptSrc = function loadScriptSrc(src) {
|
|
9
|
+
var script = document.createElement('script');
|
|
10
|
+
script.type = 'text/javascript';
|
|
11
|
+
script.src = src;
|
|
12
|
+
var headElem = document.getElementsByTagName('head')[0];
|
|
13
|
+
headElem.insertBefore(script, headElem.firstChild);
|
|
14
|
+
console.log('loadScript');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var _default = loadScriptSrc;
|
|
18
|
+
exports.default = _default;
|
package/package.json
CHANGED
package/src/@types/window.d.ts
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IHash, IConfig, IMSISDNSubmissionResult, IPINSubmissionResult, ICheckSubscriptionResult, IMcpShieldResult } from "../reducers/pinFlow/PinTypes"
|
|
2
2
|
import { IMSISDNSubmissionResult as IMoRedirMSISDNSubmissionResult } from "../reducers/moRedirFlow/MoRedirTypes"
|
|
3
|
-
import { IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducers/moFlow/MoTypes"
|
|
3
|
+
import { IGoogleReCaptcha, IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducers/moFlow/MoTypes"
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
import IError from "../common-types/IError";
|
|
@@ -20,8 +20,8 @@ export interface ITallyman {
|
|
|
20
20
|
ussd:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string)=>Promise<IMoMSISDNSubmissionResult>;
|
|
21
21
|
oc2sms:(host: string, country:string, slug:string, offer:number, rockmanId:string, keyword:string, operator:string, search:string)=>Promise<IFetchResult>;
|
|
22
22
|
mcpShield:(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string, uniqid?:string)=>Promise<IMcpShieldResult>;
|
|
23
|
+
getGoogleCaptcha:(host: string, country: string, slug: string, device:string, domain: string)=>Promise<IGoogleReCaptcha>;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
25
|
function sleep(milliseconds:number) {
|
|
26
26
|
const date = Date.now();
|
|
27
27
|
let currentDate = null;
|
|
@@ -132,6 +132,14 @@ export const MockTallyman:ITallyman = {
|
|
|
132
132
|
"success": true,
|
|
133
133
|
"rockman_id": "d66ac1a3ee6d40c289c23322ecd9aa79"
|
|
134
134
|
}
|
|
135
|
+
},
|
|
136
|
+
getGoogleCaptcha:async(host: string, country: string, slug: string, device:string, domain: string):Promise<IGoogleReCaptcha>=>{
|
|
137
|
+
return {
|
|
138
|
+
"site_key": "6LfMTS8fAAAAAHw-cibJXMfnsIYNpWh81GatD1lw",
|
|
139
|
+
"secret_key": "6LfMTS8fAAAAAIAET7tvHjrU-tRPGuqSdfCZZX6G",
|
|
140
|
+
"domains": "n.gamiclub.com",
|
|
141
|
+
"success": true
|
|
142
|
+
}
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
145
|
|
|
@@ -147,7 +155,7 @@ export const RealTallyman:ITallyman = {
|
|
|
147
155
|
console.log("RealTallyman")
|
|
148
156
|
const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
|
|
149
157
|
const newHost = isDMB ? "de.tallymans.com" : host;
|
|
150
|
-
const isCleanTraffic = country.toLowerCase() === "be" ? (typeof window != "undefined" && window.shouldBlock === true) ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
|
|
158
|
+
const isCleanTraffic = (country.toLowerCase() === "be") ? (typeof window != "undefined" && window.shouldBlock === true) ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
|
|
151
159
|
|
|
152
160
|
return await fetch(`https://${newHost}/tallyman/v1/?action=trigger-pin&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&msisdn=${msisdn}&rockman_id=${rockmanId}${uniqid}${isCleanTraffic}${extraParamsQs}&${search}`).then(x => x.json());
|
|
153
161
|
},
|
|
@@ -155,7 +163,7 @@ export const RealTallyman:ITallyman = {
|
|
|
155
163
|
console.log("RealTallyman");
|
|
156
164
|
const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
|
|
157
165
|
const newHost = isDMB ? "de.tallymans.com" : host;
|
|
158
|
-
const isCleanTraffic = country.toLowerCase() === "be" ? (typeof window != "undefined" && window.shouldBlock === true) ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
|
|
166
|
+
const isCleanTraffic = (country.toLowerCase() === "be") ? (typeof window != "undefined" && window.shouldBlock === true) ? '&is-clean-traffic=false' : '&is-clean-traffic=true' : '';
|
|
159
167
|
|
|
160
168
|
return await fetch(`https://${newHost}/tallyman/v1/?action=verify-pin&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&pin=${pin}${uniqid}&sam_evina_tid=${evinaTid}${isCleanTraffic}${extraParamsQs}`).then(x => x.json())
|
|
161
169
|
},
|
|
@@ -181,7 +189,9 @@ export const RealTallyman:ITallyman = {
|
|
|
181
189
|
console.log("RealTallyman")
|
|
182
190
|
const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
|
|
183
191
|
const newHost = isDMB ? "de.tallymans.com" : host;
|
|
184
|
-
|
|
192
|
+
const samGtoken = window.reCaptchaToken ? `sam-g-token=${window.reCaptchaToken}` : ''
|
|
193
|
+
|
|
194
|
+
return await fetch(`https://${newHost}/tallyman/v1/?action=trigger-message&slug=${slug}&country=${country}&msisdn=${msisdn}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&${samGtoken}${search}${extraParamsQs}`).then(x => x.json());
|
|
185
195
|
},
|
|
186
196
|
ussd:async(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, search: string, extraParamsQs: string): Promise<IMoMSISDNSubmissionResult> =>{
|
|
187
197
|
console.log("RealTallyman")
|
|
@@ -203,5 +213,11 @@ export const RealTallyman:ITallyman = {
|
|
|
203
213
|
const ipAdd = window.pac_analytics.visitor.ip;
|
|
204
214
|
const userIp = ipAdd ? `&client_ip=${ipAdd}` : '';
|
|
205
215
|
return await fetch(`https://${newHost}/tallyman/v1/?action=mcp-shield&country=${country}&slug=${slug}&device=${device}&offerId=${offer}&operator=${operator || ''}&rockman_id=${rockmanId}&client_lpu=${pageUrl}${userIp}${uniqid || ''}`).then(x => x.json())
|
|
216
|
+
},
|
|
217
|
+
getGoogleCaptcha:async(host: string, country: string, slug: string, device:string, domain: string):Promise<IGoogleReCaptcha>=>{
|
|
218
|
+
const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
|
|
219
|
+
const newHost = isDMB ? "de.tallymans.com" : host;
|
|
220
|
+
return await fetch(`https://${newHost}/tallyman/helper/?action=google-captcha-v3-config&country=${country}&slug=${slug}&device=${device}&domain=n.gamiclub.com`).then(x => x.json())
|
|
221
|
+
|
|
206
222
|
}
|
|
207
|
-
}
|
|
223
|
+
}
|
|
@@ -111,3 +111,15 @@ export type IMoFlowActionMaps = {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
export type IMockMoFlowStates = "msisdn-entry-success-state" | "msisdn-entry-failure-state"
|
|
114
|
+
|
|
115
|
+
export type IGoogleReCaptcha = {
|
|
116
|
+
site_key: string;
|
|
117
|
+
secret_key: string;
|
|
118
|
+
domains: string;
|
|
119
|
+
success: true;
|
|
120
|
+
} | {
|
|
121
|
+
message: string;
|
|
122
|
+
success: false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { IConfig, IMSISDNSubmissionResult, ICheckSubscriptionResult, IMoFlowReducerState, MSISDNEntryFailure, MSISDNEntrySuccess } from "./MoTypes";
|
|
1
|
+
import { IConfig, IMSISDNSubmissionResult, ICheckSubscriptionResult, IMoFlowReducerState, MSISDNEntryFailure, MSISDNEntrySuccess, IGoogleReCaptcha } from "./MoTypes";
|
|
2
2
|
import IError from "../../common-types/IError";
|
|
3
3
|
import { IKeywordShortcode } from "./MoTypes";
|
|
4
4
|
import * as RDS from "../../common-types/RemoteDataState";
|
|
5
|
+
import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
|
|
6
|
+
import loadScriptSrc from "../../utilities/loadScriptSrc";
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
const wait = (ms: number) =>
|
|
@@ -41,15 +43,39 @@ export default async function submitMSISDN(window: Window, maybeConfig: IConfig,
|
|
|
41
43
|
return submitMSISDNWithConfig(window, config, internationalMSISDN, extraParams)
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
export const getGoogleReCaptchaConfig = async ({ slug, country, device, host }:IConfig):Promise<IGoogleReCaptcha>=>{
|
|
47
|
+
const domain = window.location.hostname;
|
|
48
|
+
const result: IGoogleReCaptcha = await window.tallymanApi.getGoogleCaptcha(host, country, slug, device, domain);
|
|
49
|
+
if(result.success === true){
|
|
50
|
+
const srcUrl = `https://www.google.com/recaptcha/api.js?render=${result.site_key}`;
|
|
51
|
+
loadScriptSrc(srcUrl);
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
const script = `
|
|
54
|
+
grecaptcha.ready(function() {
|
|
55
|
+
grecaptcha.execute("${result.site_key}", {action: 'submit'}).then(function(token) {
|
|
56
|
+
// To be used by tallyman
|
|
57
|
+
window.reCaptchaToken = token;
|
|
58
|
+
console.log("-------" + token);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
`;
|
|
62
|
+
loadScriptInnerHtml(script, true);
|
|
63
|
+
}, 0);
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
|
|
44
68
|
export async function submitMSISDNWithConfig(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: { [key: string]: string }): Promise<IKeywordShortcode> {
|
|
45
69
|
|
|
46
70
|
const { slug, country, device, offer, host } = config
|
|
47
71
|
const search = window.location.search.substr(1) || ''
|
|
48
72
|
const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
|
|
49
73
|
const msisdn = internationalMSISDN.match(/\d+/gi).join('')
|
|
50
|
-
const rockmanId = window.pac_analytics.visitor.rockmanId
|
|
74
|
+
const rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
75
|
+
|
|
51
76
|
const result: IMSISDNSubmissionResult = await window.tallymanApi.triggerMessage(host, slug, country, msisdn, device, offer, rockmanId, search, extraParamsQs)
|
|
52
77
|
|
|
78
|
+
|
|
53
79
|
if (false === result.success) {
|
|
54
80
|
const type = result.message == 'ALREADY SUBSCRIBED' ? "AlreadySubscribed" : "InvalidMSISDN";
|
|
55
81
|
const error = new Error(`${type}:\n${result.message}`) as IError & {type:string; productUrl:string;}
|
|
@@ -46,9 +46,9 @@ export function getRedirectUrlAction({extraParams, autoRedirect = false, isGetRe
|
|
|
46
46
|
tracker.advancedInFlow('tallyman.v1-one-click', 'click-redirect-url', {redirect_url:redirectUrl});
|
|
47
47
|
setTimeout(() => {
|
|
48
48
|
window.location.href = redirectUrl;
|
|
49
|
-
},
|
|
49
|
+
}, 1000);
|
|
50
50
|
}
|
|
51
|
-
},
|
|
51
|
+
}, 500);
|
|
52
52
|
}else{
|
|
53
53
|
tracker.advancedInFlow('tallyman.v1-one-click', 'click-redirect-url', {redirect_url:redirectUrl});
|
|
54
54
|
setTimeout(() => {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
const loadScriptInnerHtml = (innerHTML:string)=>{
|
|
1
|
+
const loadScriptInnerHtml = (innerHTML:string, isBody?:boolean)=>{
|
|
2
2
|
var script = document.createElement('script');
|
|
3
3
|
script.type = 'text/javascript';
|
|
4
4
|
script.innerHTML = innerHTML;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
if(isBody){
|
|
6
|
+
document.getElementsByTagName('body')[0].appendChild(script);
|
|
7
|
+
}else{
|
|
8
|
+
var headElem = document.getElementsByTagName('head')[0];
|
|
9
|
+
headElem.insertBefore(script, headElem.firstChild)
|
|
10
|
+
console.log('loadScript');
|
|
11
|
+
}
|
|
8
12
|
}
|
|
9
13
|
|
|
10
14
|
export default loadScriptInnerHtml;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const loadScriptSrc = (src:string)=>{
|
|
2
|
+
var script = document.createElement('script');
|
|
3
|
+
script.type = 'text/javascript';
|
|
4
|
+
script.src = src;
|
|
5
|
+
var headElem = document.getElementsByTagName('head')[0];
|
|
6
|
+
headElem.insertBefore(script, headElem.firstChild)
|
|
7
|
+
console.log('loadScript');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default loadScriptSrc;
|