ouisys-engine 2.1.21 → 2.1.22

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.
Files changed (43) hide show
  1. package/dist/api/click2sms.js +357 -0
  2. package/dist/api/index.js +3 -3
  3. package/dist/api/mo.js +274 -0
  4. package/dist/api/moRedir.js +186 -0
  5. package/dist/api/oneClick.js +366 -0
  6. package/dist/api/pin.js +493 -0
  7. package/dist/api/strategies.js +704 -0
  8. package/dist/api/ussd.js +1 -0
  9. package/dist/app/store.js +35 -0
  10. package/dist/features/strategies/categories/askMobileNumber.js +395 -0
  11. package/dist/features/strategies/categories/askOperator.js +311 -0
  12. package/dist/features/strategies/categories/detectOperatorByIp.js +606 -0
  13. package/dist/features/strategies/categories/headerEnrichment.js +670 -0
  14. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +12 -0
  15. package/dist/features/strategies/categories/typings/identifySliceTypes.js +22 -0
  16. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +22 -0
  17. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +21 -0
  18. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +13 -0
  19. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +13 -0
  20. package/dist/features/strategies/click2smsFlowSlice.js +172 -0
  21. package/dist/features/strategies/identifySlice.js +455 -0
  22. package/dist/features/strategies/moFlowSlice.js +196 -0
  23. package/dist/features/strategies/moRedirFlowSlice.js +190 -0
  24. package/dist/features/strategies/oneClickFlowSlice.js +277 -0
  25. package/dist/features/strategies/pinFlowSlice.js +313 -0
  26. package/dist/features/strategies/ussdFlowSlice.js +1 -0
  27. package/dist/ips/tryGetIPRangeName.js +14 -13
  28. package/dist/mockServer/browser.js +48 -0
  29. package/dist/mockServer/handlers.js +22 -0
  30. package/dist/mockServer/server.js +48 -0
  31. package/dist/pacman/index.js +0 -1
  32. package/dist/reducers/click2smsFlow/utils.js +1 -3
  33. package/dist/reducers/strategy/utils.js +11 -12
  34. package/dist/reducers/tpayHeFlow/utils.js +1 -1
  35. package/dist/test/setup.js +24 -0
  36. package/dist/test/test-utils.js +51 -0
  37. package/package.json +1 -1
  38. package/src/api/index.ts +3 -3
  39. package/src/ips/tryGetIPRangeName.ts +3 -2
  40. package/src/pacman/index.ts +1 -1
  41. package/src/reducers/click2smsFlow/utils.ts +0 -3
  42. package/src/reducers/strategy/utils.ts +1 -2
  43. package/src/reducers/tpayHeFlow/utils.ts +1 -1
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol");
4
+
5
+ require("core-js/modules/es.array.concat");
6
+
7
+ require("core-js/modules/es.array.filter");
8
+
9
+ require("core-js/modules/es.array.iterator");
10
+
11
+ require("core-js/modules/es.array.map");
12
+
13
+ require("core-js/modules/es.object.get-own-property-descriptor");
14
+
15
+ require("core-js/modules/es.object.get-own-property-descriptors");
16
+
17
+ require("core-js/modules/es.object.keys");
18
+
19
+ require("core-js/modules/es.object.to-string");
20
+
21
+ require("core-js/modules/es.promise");
22
+
23
+ require("core-js/modules/es.regexp.exec");
24
+
25
+ require("core-js/modules/es.string.iterator");
26
+
27
+ require("core-js/modules/es.string.search");
28
+
29
+ require("core-js/modules/web.dom-collections.for-each");
30
+
31
+ require("core-js/modules/web.dom-collections.iterator");
32
+
33
+ Object.defineProperty(exports, "__esModule", {
34
+ value: true
35
+ });
36
+ exports.checkSubscription = checkSubscription;
37
+ exports.default = load;
38
+ exports.load1 = load1;
39
+
40
+ require("regenerator-runtime/runtime");
41
+
42
+ var _strategies = require("./strategies");
43
+
44
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
45
+
46
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
47
+
48
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
49
+
50
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
51
+
52
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
53
+
54
+ function loadOnce(_x, _x2, _x3, _x4, _x5) {
55
+ return _loadOnce.apply(this, arguments);
56
+ }
57
+
58
+ function _loadOnce() {
59
+ _loadOnce = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(window, maybeConfig, operator, keyword, shortcode) {
60
+ var _keyword, _shortcode, offer, config, host, country, slug, rockmanId, search, result;
61
+
62
+ return regeneratorRuntime.wrap(function _callee$(_context) {
63
+ while (1) {
64
+ switch (_context.prev = _context.next) {
65
+ case 0:
66
+ if (!(!!maybeConfig && maybeConfig.tag == 'keywordAndShortCode')) {
67
+ _context.next = 3;
68
+ break;
69
+ }
70
+
71
+ _keyword = maybeConfig.keyword, _shortcode = maybeConfig.shortcode;
72
+ return _context.abrupt("return", _objectSpread({
73
+ type: 'SingleSubmissionResult'
74
+ }, {
75
+ keyword: _keyword,
76
+ shortcode: _shortcode
77
+ }));
78
+
79
+ case 3:
80
+ offer = window.pac_analytics.visitor.offer;
81
+ config = _objectSpread({
82
+ offer: window.pac_analytics.visitor.offer
83
+ }, maybeConfig);
84
+ host = config.host, country = config.country, slug = config.slug;
85
+ rockmanId = window.pac_analytics.visitor.rockmanId;
86
+ search = window.location.search.substr(1) || '';
87
+ _context.next = 10;
88
+ return window.tallymanApi.oc2sms(host, country, slug, offer, rockmanId, keyword, operator, search);
89
+
90
+ case 10:
91
+ result = _context.sent;
92
+
93
+ if (result.success) {
94
+ _context.next = 15;
95
+ break;
96
+ }
97
+
98
+ throw result.message;
99
+
100
+ case 15:
101
+ return _context.abrupt("return", _objectSpread({
102
+ type: 'SingleSubmissionResult'
103
+ }, {
104
+ keyword: "".concat(keyword || result.displayKeyword).concat(result.uid ? " ".concat(result.uid) : ''),
105
+ shortcode: result.shortcode
106
+ }));
107
+
108
+ case 16:
109
+ case "end":
110
+ return _context.stop();
111
+ }
112
+ }
113
+ }, _callee);
114
+ }));
115
+ return _loadOnce.apply(this, arguments);
116
+ }
117
+
118
+ function right(r) {
119
+ return {
120
+ type: 'right',
121
+ value: r
122
+ };
123
+ }
124
+
125
+ function left(l) {
126
+ return {
127
+ type: 'left',
128
+ value: l
129
+ };
130
+ }
131
+
132
+ function foldEither(left, right, either) {
133
+ return either.type == 'left' ? left(either.value) : right(either.value);
134
+ }
135
+
136
+ function loadForMultipleOperators(_x6, _x7, _x8, _x9, _x10) {
137
+ return _loadForMultipleOperators.apply(this, arguments);
138
+ }
139
+
140
+ function _loadForMultipleOperators() {
141
+ _loadForMultipleOperators = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, maybeConfig, operators, keyword, shortcode) {
142
+ var results, finalResults, arrResult;
143
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
144
+ while (1) {
145
+ switch (_context3.prev = _context3.next) {
146
+ case 0:
147
+ results = Promise.all(operators.map( /*#__PURE__*/function () {
148
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(o) {
149
+ var singleResult;
150
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
151
+ while (1) {
152
+ switch (_context2.prev = _context2.next) {
153
+ case 0:
154
+ _context2.prev = 0;
155
+ _context2.next = 3;
156
+ return loadOnce(window, maybeConfig, o, keyword, shortcode);
157
+
158
+ case 3:
159
+ singleResult = _context2.sent;
160
+ return _context2.abrupt("return", right(_objectSpread(_objectSpread({}, singleResult), {}, {
161
+ operator: o
162
+ })));
163
+
164
+ case 7:
165
+ _context2.prev = 7;
166
+ _context2.t0 = _context2["catch"](0);
167
+ return _context2.abrupt("return", left(_context2.t0));
168
+
169
+ case 10:
170
+ case "end":
171
+ return _context2.stop();
172
+ }
173
+ }
174
+ }, _callee2, null, [[0, 7]]);
175
+ }));
176
+
177
+ return function (_x21) {
178
+ return _ref.apply(this, arguments);
179
+ };
180
+ }()));
181
+ _context3.next = 3;
182
+ return Promise.resolve(results);
183
+
184
+ case 3:
185
+ finalResults = _context3.sent;
186
+
187
+ if (!finalResults.every(function (r) {
188
+ return r.type == 'left';
189
+ })) {
190
+ _context3.next = 8;
191
+ break;
192
+ }
193
+
194
+ throw finalResults[0].value;
195
+
196
+ case 8:
197
+ arrResult = [];
198
+ finalResults.map(function (obj) {
199
+ if (obj.type == 'right') {
200
+ var _ref2 = obj.value,
201
+ _keyword2 = _ref2.keyword,
202
+ _shortcode2 = _ref2.shortcode,
203
+ operator = _ref2.operator;
204
+ arrResult.push({
205
+ keyword: _keyword2,
206
+ shortcode: _shortcode2,
207
+ operator: operator
208
+ });
209
+ }
210
+ });
211
+ return _context3.abrupt("return", {
212
+ type: 'MultiOperatorSubmissionResult',
213
+ data: arrResult
214
+ });
215
+
216
+ case 11:
217
+ case "end":
218
+ return _context3.stop();
219
+ }
220
+ }
221
+ }, _callee3);
222
+ }));
223
+ return _loadForMultipleOperators.apply(this, arguments);
224
+ }
225
+
226
+ function load(_x11, _x12, _x13, _x14) {
227
+ return _load.apply(this, arguments);
228
+ }
229
+
230
+ function _load() {
231
+ _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(window, maybeConfig, keyword, shortcode) {
232
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
233
+ while (1) {
234
+ switch (_context4.prev = _context4.next) {
235
+ case 0:
236
+ if (!(!!maybeConfig && maybeConfig.tag == 'keywordAndShortCode')) {
237
+ _context4.next = 2;
238
+ break;
239
+ }
240
+
241
+ return _context4.abrupt("return", _objectSpread({
242
+ type: 'SingleSubmissionResult'
243
+ }, {
244
+ keyword: maybeConfig.keyword,
245
+ shortcode: maybeConfig.shortcode
246
+ }));
247
+
248
+ case 2:
249
+ if (!(!!maybeConfig && maybeConfig.tag == 'keyword')) {
250
+ _context4.next = 4;
251
+ break;
252
+ }
253
+
254
+ return _context4.abrupt("return", load1(window, maybeConfig, keyword, shortcode));
255
+
256
+ case 4:
257
+ return _context4.abrupt("return", load1(window, maybeConfig, null, null));
258
+
259
+ case 5:
260
+ case "end":
261
+ return _context4.stop();
262
+ }
263
+ }
264
+ }, _callee4);
265
+ }));
266
+ return _load.apply(this, arguments);
267
+ }
268
+
269
+ function load1(_x15, _x16, _x17, _x18) {
270
+ return _load2.apply(this, arguments);
271
+ }
272
+
273
+ function _load2() {
274
+ _load2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(window, maybeConfig, keyword, shortcode) {
275
+ var config, singleOperator;
276
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
277
+ while (1) {
278
+ switch (_context5.prev = _context5.next) {
279
+ case 0:
280
+ config = _objectSpread({
281
+ offer: window.pac_analytics.visitor.offer
282
+ }, maybeConfig);
283
+
284
+ if (!(config.automaticallySubmitAllOperators == true && !!config.operators && config.operators.length > 0)) {
285
+ _context5.next = 3;
286
+ break;
287
+ }
288
+
289
+ return _context5.abrupt("return", loadForMultipleOperators(window, maybeConfig, config.operators, keyword, shortcode));
290
+
291
+ case 3:
292
+ singleOperator = maybeConfig.operators && maybeConfig.operators.length > 0 ? maybeConfig.operators[0] : null;
293
+ return _context5.abrupt("return", loadOnce(window, maybeConfig, singleOperator, keyword, shortcode));
294
+
295
+ case 5:
296
+ case "end":
297
+ return _context5.stop();
298
+ }
299
+ }
300
+ }, _callee5);
301
+ }));
302
+ return _load2.apply(this, arguments);
303
+ }
304
+
305
+ function checkSubscription(_x19, _x20) {
306
+ return _checkSubscription.apply(this, arguments);
307
+ } // {"success":true,"uid":"*5QADM","shortcode":"1901","keyword":"TIPS"}%
308
+ // curl "http://w1.mozzi.com/spa-api/?country=gh&device=smart&slug=18plus-oc2sms&action=oc2sms"
309
+
310
+
311
+ function _checkSubscription() {
312
+ _checkSubscription = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(window, maybeConfig) {
313
+ var config, host, rockmanId, check, checkResult, error;
314
+ return regeneratorRuntime.wrap(function _callee6$(_context6) {
315
+ while (1) {
316
+ switch (_context6.prev = _context6.next) {
317
+ case 0:
318
+ config = _objectSpread({
319
+ offer: window.pac_analytics.visitor.offer
320
+ }, maybeConfig);
321
+ host = config.host;
322
+ rockmanId = window.pac_analytics.visitor.rockmanId;
323
+
324
+ check = function check() {
325
+ return window.tallymanApi.checkSubscriptionByRockmanIdOnly(host, rockmanId);
326
+ };
327
+
328
+ _context6.next = 6;
329
+ return (0, _strategies.loop)(check, 60, function (r) {
330
+ return r.success;
331
+ }, 0);
332
+
333
+ case 6:
334
+ checkResult = _context6.sent;
335
+
336
+ if (!(checkResult.success === true)) {
337
+ _context6.next = 10;
338
+ break;
339
+ }
340
+
341
+ window.location.href = checkResult.product_url;
342
+ return _context6.abrupt("return", checkResult.product_url || null);
343
+
344
+ case 10:
345
+ error = new Error('SubscriptionFailed'.concat(":\n", checkResult.message));
346
+ error.type = 'SubscriptionFailed';
347
+ throw error;
348
+
349
+ case 13:
350
+ case "end":
351
+ return _context6.stop();
352
+ }
353
+ }
354
+ }, _callee6);
355
+ }));
356
+ return _checkSubscription.apply(this, arguments);
357
+ }
package/dist/api/index.js CHANGED
@@ -305,9 +305,9 @@ var MockTallyman = {
305
305
  "prodSku": "gamelords",
306
306
  "lang": "ar",
307
307
  "country": "eg",
308
- "subscription_url": "http:\/\/n.vidflixz.com\/tallyman\/v1\/?action=one-click-subscribe&device=smart&slug=tpay-he-vidflixz&country=eg&offerId=1&rockman_id=13643b4780fb40bb8adf2feb2a400d7f&",
308
+ "subscription_url": "http:\/\/de.tallymans.com\/tallyman\/v1\/?action=one-click-subscribe&device=smart&slug=tpay-he-vidflixz&country=eg&offerId=1&rockman_id=13643b4780fb40bb8adf2feb2a400d7f&",
309
309
  "config": {
310
- "product_url": "http:\/\/eg.game-lords.com\/#\/?uid=fdf098fcc6",
310
+ "product_url": "http:\/\/de.tallymans.com\/#\/?uid=fdf098fcc6",
311
311
  "subscription_plan_id": 829,
312
312
  "public": "HFyenUyCJCxl1QTgtVCA",
313
313
  "private": "vazlmVhGFyxKLOav6DvW",
@@ -318,7 +318,7 @@ var MockTallyman = {
318
318
  "60203": "gamelords_etst"
319
319
  }
320
320
  },
321
- "redirectUrl": "http:\/\/n.game-lords.com\/eg\/animal-game?country=eg&handle=animal-game&offer=1&device=smart&_extracted=957ad26679cd47a09d4efe28d4a4af72&operator=#operator#&msisdnSubmitted=Y&network_type=mobile_data&atmobirun=true&force_mcb_page=true&skipTrigger=true",
321
+ "redirectUrl": "http:\/\/de.tallymans.com\/eg\/animal-game?country=eg&handle=animal-game&offer=1&device=smart&_extracted=957ad26679cd47a09d4efe28d4a4af72&operator=#operator#&msisdnSubmitted=Y&network_type=mobile_data&atmobirun=true&force_mcb_page=true&skipTrigger=true",
322
322
  "rid": "957ad26679cd47a09d4efe28d4a4af72",
323
323
  "success": true
324
324
  });
package/dist/api/mo.js ADDED
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ require("core-js/modules/es.symbol");
6
+
7
+ require("core-js/modules/es.symbol.description");
8
+
9
+ require("core-js/modules/es.symbol.iterator");
10
+
11
+ require("core-js/modules/es.array.concat");
12
+
13
+ require("core-js/modules/es.array.filter");
14
+
15
+ require("core-js/modules/es.array.iterator");
16
+
17
+ require("core-js/modules/es.array.join");
18
+
19
+ require("core-js/modules/es.array.map");
20
+
21
+ require("core-js/modules/es.object.get-own-property-descriptor");
22
+
23
+ require("core-js/modules/es.object.get-own-property-descriptors");
24
+
25
+ require("core-js/modules/es.object.keys");
26
+
27
+ require("core-js/modules/es.object.to-string");
28
+
29
+ require("core-js/modules/es.promise");
30
+
31
+ require("core-js/modules/es.regexp.exec");
32
+
33
+ require("core-js/modules/es.string.iterator");
34
+
35
+ require("core-js/modules/es.string.match");
36
+
37
+ require("core-js/modules/es.string.search");
38
+
39
+ require("core-js/modules/es.weak-map");
40
+
41
+ require("core-js/modules/web.dom-collections.for-each");
42
+
43
+ require("core-js/modules/web.dom-collections.iterator");
44
+
45
+ Object.defineProperty(exports, "__esModule", {
46
+ value: true
47
+ });
48
+ exports.checkSubscription = checkSubscription;
49
+ exports.default = submitMSISDN;
50
+ exports.mockedMSISDNEntrySuccess = exports.mockedMSISDNEntryFailure = exports.formatSMSLink = void 0;
51
+ exports.submitMSISDNWithConfig = submitMSISDNWithConfig;
52
+
53
+ require("regenerator-runtime/runtime");
54
+
55
+ var RDS = _interopRequireWildcard(require("../common-types/RemoteDataState"));
56
+
57
+ var _moFlowSliceTypes = require("../features/strategies/categories/typings/moFlowSliceTypes");
58
+
59
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
60
+
61
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
62
+
63
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
64
+
65
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
66
+
67
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
68
+
69
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
70
+
71
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
72
+
73
+ var wait = function wait(ms) {
74
+ return (// @ts-ignore
75
+ new Promise(function (resolve) {
76
+ return setTimeout(function () {
77
+ return resolve();
78
+ }, ms);
79
+ })
80
+ );
81
+ };
82
+
83
+ var loop = /*#__PURE__*/function () {
84
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(f, max, stop, i) {
85
+ var r;
86
+ return regeneratorRuntime.wrap(function _callee$(_context) {
87
+ while (1) {
88
+ switch (_context.prev = _context.next) {
89
+ case 0:
90
+ _context.next = 2;
91
+ return f();
92
+
93
+ case 2:
94
+ r = _context.sent;
95
+
96
+ if (!(stop(r) || i >= max)) {
97
+ _context.next = 5;
98
+ break;
99
+ }
100
+
101
+ return _context.abrupt("return", r);
102
+
103
+ case 5:
104
+ _context.next = 7;
105
+ return wait(1000);
106
+
107
+ case 7:
108
+ return _context.abrupt("return", loop(f, max, stop, i + 1));
109
+
110
+ case 8:
111
+ case "end":
112
+ return _context.stop();
113
+ }
114
+ }
115
+ }, _callee);
116
+ }));
117
+
118
+ return function loop(_x, _x2, _x3, _x4) {
119
+ return _ref.apply(this, arguments);
120
+ };
121
+ }();
122
+
123
+ function submitMSISDN(_x5, _x6, _x7, _x8) {
124
+ return _submitMSISDN.apply(this, arguments);
125
+ }
126
+
127
+ function _submitMSISDN() {
128
+ _submitMSISDN = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(window, maybeConfig, internationalMSISDN, extraParams) {
129
+ var config;
130
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
131
+ while (1) {
132
+ switch (_context2.prev = _context2.next) {
133
+ case 0:
134
+ config = _objectSpread({
135
+ offer: window.pac_analytics.visitor.offer
136
+ }, maybeConfig || {});
137
+ return _context2.abrupt("return", submitMSISDNWithConfig(window, config, internationalMSISDN, extraParams));
138
+
139
+ case 2:
140
+ case "end":
141
+ return _context2.stop();
142
+ }
143
+ }
144
+ }, _callee2);
145
+ }));
146
+ return _submitMSISDN.apply(this, arguments);
147
+ }
148
+
149
+ function submitMSISDNWithConfig(_x9, _x10, _x11, _x12) {
150
+ return _submitMSISDNWithConfig.apply(this, arguments);
151
+ }
152
+
153
+ function _submitMSISDNWithConfig() {
154
+ _submitMSISDNWithConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, config, internationalMSISDN, extraParams) {
155
+ var slug, country, device, offer, host, search, extraParamsQs, msisdn, rockmanId, result, type, error;
156
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
157
+ while (1) {
158
+ switch (_context3.prev = _context3.next) {
159
+ case 0:
160
+ slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
161
+ search = window.location.search.substr(1) || '';
162
+ extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
163
+ return "".concat(k, "=").concat(extraParams[k]);
164
+ }).join('&'));
165
+ msisdn = internationalMSISDN.match(/\d+/gi).join('');
166
+ rockmanId = window.pac_analytics.visitor.rockmanId;
167
+ _context3.next = 7;
168
+ return window.tallymanApi.triggerMessage(host, slug, country, msisdn, device, offer, rockmanId, search, extraParamsQs);
169
+
170
+ case 7:
171
+ result = _context3.sent;
172
+
173
+ if (!(result.success === false)) {
174
+ _context3.next = 17;
175
+ break;
176
+ }
177
+
178
+ type = result.message == 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
179
+ error = new Error("".concat(type, ":\n").concat(result.message));
180
+ error.type = type;
181
+ error.productUrl = result.product_url ? result.product_url : '';
182
+ console.error(error);
183
+ throw error;
184
+
185
+ case 17:
186
+ return _context3.abrupt("return", result);
187
+
188
+ case 18:
189
+ case "end":
190
+ return _context3.stop();
191
+ }
192
+ }
193
+ }, _callee3);
194
+ }));
195
+ return _submitMSISDNWithConfig.apply(this, arguments);
196
+ }
197
+
198
+ function checkSubscription(_x13, _x14) {
199
+ return _checkSubscription.apply(this, arguments);
200
+ }
201
+
202
+ function _checkSubscription() {
203
+ _checkSubscription = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(window, maybeConfig) {
204
+ var config, host, rockmanId, check, checkResult, error;
205
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
206
+ while (1) {
207
+ switch (_context4.prev = _context4.next) {
208
+ case 0:
209
+ config = _objectSpread({
210
+ offer: window.pac_analytics.visitor.offer
211
+ }, maybeConfig || {});
212
+ host = config.host;
213
+ rockmanId = window.pac_analytics.visitor.rockmanId;
214
+
215
+ check = function check() {
216
+ return window.tallymanApi.checkSubscriptionByRockmanIdOnly(host, rockmanId);
217
+ };
218
+
219
+ _context4.next = 6;
220
+ return loop(check, 60, function (r) {
221
+ return r.success;
222
+ }, 0);
223
+
224
+ case 6:
225
+ checkResult = _context4.sent;
226
+
227
+ if (!(checkResult.success === true)) {
228
+ _context4.next = 10;
229
+ break;
230
+ }
231
+
232
+ window.location.href = checkResult.product_url;
233
+ return _context4.abrupt("return", checkResult.product_url || null);
234
+
235
+ case 10:
236
+ error = new Error('SubscriptionFailed'.concat(":\n", checkResult.message));
237
+ error.type = 'SubscriptionFailed';
238
+ throw error;
239
+
240
+ case 13:
241
+ case "end":
242
+ return _context4.stop();
243
+ }
244
+ }
245
+ }, _callee4);
246
+ }));
247
+ return _checkSubscription.apply(this, arguments);
248
+ }
249
+
250
+ var formatSMSLink = function formatSMSLink(keywordAndShortcode) {
251
+ return !!window.pac_analytics.visitor['x-requested-with'] && window.pac_analytics.visitor['x-requested-with'] !== null && window.pac_analytics.visitor['x-requested-with'].indexOf('com.facebook') !== -1 ? "sms://".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword) : typeof navigator !== 'undefined' && (/iPhone/i.test(navigator.userAgent) || /Mac OS/i.test(navigator.userAgent)) ? "sms:".concat(keywordAndShortcode.shortcode, "&body=").concat(keywordAndShortcode.keyword) : "sms:".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword);
252
+ };
253
+
254
+ exports.formatSMSLink = formatSMSLink;
255
+ var mockedMSISDNEntrySuccess = {
256
+ currentState: {
257
+ type: _moFlowSliceTypes.MoStates.MSISDNEntry,
258
+ result: RDS.Success({
259
+ keyword: 'TEST OK',
260
+ shortcode: '666'
261
+ })
262
+ }
263
+ };
264
+ exports.mockedMSISDNEntrySuccess = mockedMSISDNEntrySuccess;
265
+ var mockedMSISDNEntryFailure = {
266
+ currentState: {
267
+ type: _moFlowSliceTypes.MoStates.MSISDNEntry,
268
+ result: RDS.Failure({
269
+ errorType: _moFlowSliceTypes.MSISDNEntryErrorTypes.InvalidMSISDN,
270
+ error: 'Invalid Mobile Number'
271
+ })
272
+ }
273
+ };
274
+ exports.mockedMSISDNEntryFailure = mockedMSISDNEntryFailure;