ouisys-engine 2.1.21 → 2.1.26

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 (68) hide show
  1. package/dist/api/click2sms.js +357 -0
  2. package/dist/api/index.d.ts +0 -2
  3. package/dist/api/index.js +88 -164
  4. package/dist/api/mo.js +274 -0
  5. package/dist/api/moRedir.js +186 -0
  6. package/dist/api/oneClick.js +366 -0
  7. package/dist/api/pin.js +493 -0
  8. package/dist/api/strategies.js +704 -0
  9. package/dist/api/ussd.js +1 -0
  10. package/dist/app/store.js +35 -0
  11. package/dist/common-types/AppThunk.d.ts +1 -2
  12. package/dist/features/strategies/categories/askMobileNumber.js +395 -0
  13. package/dist/features/strategies/categories/askOperator.js +311 -0
  14. package/dist/features/strategies/categories/detectOperatorByIp.js +606 -0
  15. package/dist/features/strategies/categories/headerEnrichment.js +670 -0
  16. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +12 -0
  17. package/dist/features/strategies/categories/typings/identifySliceTypes.js +22 -0
  18. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +22 -0
  19. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +21 -0
  20. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +13 -0
  21. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +13 -0
  22. package/dist/features/strategies/click2smsFlowSlice.js +172 -0
  23. package/dist/features/strategies/identifySlice.js +455 -0
  24. package/dist/features/strategies/moFlowSlice.js +196 -0
  25. package/dist/features/strategies/moRedirFlowSlice.js +190 -0
  26. package/dist/features/strategies/oneClickFlowSlice.js +277 -0
  27. package/dist/features/strategies/pinFlowSlice.js +313 -0
  28. package/dist/features/strategies/ussdFlowSlice.js +1 -0
  29. package/dist/flows/strategy.d.ts +1 -2
  30. package/dist/flows/strategy.js +1 -5
  31. package/dist/ips/tryGetIPRangeName.js +14 -13
  32. package/dist/mockServer/browser.js +48 -0
  33. package/dist/mockServer/handlers.js +22 -0
  34. package/dist/mockServer/server.js +48 -0
  35. package/dist/pacman/index.js +0 -1
  36. package/dist/reducers/click2smsFlow/utils.js +1 -3
  37. package/dist/reducers/moRedirFlow/utils.js +1 -1
  38. package/dist/reducers/oneClickFlow/utils.js +47 -19
  39. package/dist/reducers/pinFlow/utils.js +7 -12
  40. package/dist/reducers/strategy/utils.js +12 -13
  41. package/dist/reducers/tpayHeFlow/utils.js +1 -1
  42. package/dist/store/index.d.ts +1 -2
  43. package/dist/store/reducers.d.ts +0 -2
  44. package/dist/store/reducers.js +1 -4
  45. package/dist/test/setup.js +24 -0
  46. package/dist/test/test-utils.js +51 -0
  47. package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
  48. package/dist/utilities/loadScriptInnerHtml.js +18 -0
  49. package/package.json +1 -1
  50. package/src/api/index.ts +4 -37
  51. package/src/common-types/AppThunk.ts +1 -2
  52. package/src/flows/strategy.ts +1 -5
  53. package/src/ips/tryGetIPRangeName.ts +3 -2
  54. package/src/pacman/index.ts +1 -1
  55. package/src/reducers/click2smsFlow/utils.ts +0 -3
  56. package/src/reducers/moRedirFlow/utils.ts +1 -1
  57. package/src/reducers/oneClickFlow/utils.ts +77 -11
  58. package/src/reducers/pinFlow/utils.ts +2 -9
  59. package/src/reducers/strategy/utils.ts +2 -3
  60. package/src/store/index.ts +1 -2
  61. package/src/store/reducers.ts +1 -5
  62. package/src/utilities/loadScriptInnerHtml.ts +10 -0
  63. package/yarn.lock +5204 -0
  64. package/src/flows/tpayHeFlow.ts +0 -20
  65. package/src/reducers/tpayHeFlow/ITpayHeConstants.ts +0 -7
  66. package/src/reducers/tpayHeFlow/TpayHeTypes.ts +0 -135
  67. package/src/reducers/tpayHeFlow/index.ts +0 -207
  68. package/src/reducers/tpayHeFlow/utils.ts +0 -311
@@ -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
+ }
@@ -3,7 +3,6 @@ import { IMSISDNSubmissionResult as IMoRedirMSISDNSubmissionResult } from "../re
3
3
  import { IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducers/moFlow/MoTypes";
4
4
  import { IIdentifyResult } from "../reducers/strategy/StrategyTypes";
5
5
  import { IFetchResult } from "../reducers/click2smsFlow/Click2smsTypes";
6
- import { ITpayConsentResult } from "../reducers/TpayHeFlow/TpayHeTypes";
7
6
  export interface ITallyman {
8
7
  identify: (host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string) => Promise<IIdentifyResult>;
9
8
  triggerPin: (host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string, uniqid?: string) => Promise<IMSISDNSubmissionResult>;
@@ -14,7 +13,6 @@ export interface ITallyman {
14
13
  redirect: (host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, ip_range_name: string, search: string, extraParamsQs: string) => Promise<IMoRedirMSISDNSubmissionResult>;
15
14
  ussd: (host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, search: string, extraParamsQs: string) => Promise<IMoMSISDNSubmissionResult>;
16
15
  oc2sms: (host: string, country: string, slug: string, offer: number, rockmanId: string, keyword: string, operator: string, search: string) => Promise<IFetchResult>;
17
- tpayConsentConfig: (host: string, country: string, slug: string, device: string, offer: number, rockmanId: string, search: string) => Promise<ITpayConsentResult>;
18
16
  mcpShield: (host: string, country: string, slug: string, device: string, offer: number, rockmanId: string, operator?: string, uniqid?: string) => Promise<IMcpShieldResult>;
19
17
  }
20
18
  export declare const MockTallyman: ITallyman;