ouisys-engine 2.1.20 → 2.1.25

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 (66) hide show
  1. package/dist/api/click2sms.js +357 -0
  2. package/dist/api/index.d.ts +1 -3
  3. package/dist/api/index.js +97 -173
  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 +9 -8
  39. package/dist/reducers/pinFlow/utils.js +17 -16
  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/package.json +1 -1
  48. package/src/@types/window.d.ts +1 -0
  49. package/src/api/index.ts +8 -41
  50. package/src/common-types/AppThunk.ts +1 -2
  51. package/src/flows/strategy.ts +1 -5
  52. package/src/ips/tryGetIPRangeName.ts +3 -2
  53. package/src/pacman/index.ts +1 -1
  54. package/src/reducers/click2smsFlow/utils.ts +0 -3
  55. package/src/reducers/moRedirFlow/utils.ts +1 -1
  56. package/src/reducers/oneClickFlow/utils.ts +4 -3
  57. package/src/reducers/pinFlow/utils.ts +4 -2
  58. package/src/reducers/strategy/utils.ts +2 -3
  59. package/src/store/index.ts +1 -2
  60. package/src/store/reducers.ts +1 -5
  61. package/yarn.lock +5204 -0
  62. package/src/flows/tpayHeFlow.ts +0 -20
  63. package/src/reducers/tpayHeFlow/ITpayHeConstants.ts +0 -7
  64. package/src/reducers/tpayHeFlow/TpayHeTypes.ts +0 -135
  65. package/src/reducers/tpayHeFlow/index.ts +0 -207
  66. package/src/reducers/tpayHeFlow/utils.ts +0 -311
@@ -0,0 +1,313 @@
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.filter");
12
+
13
+ require("core-js/modules/es.array.iterator");
14
+
15
+ require("core-js/modules/es.object.get-own-property-descriptor");
16
+
17
+ require("core-js/modules/es.object.get-own-property-descriptors");
18
+
19
+ require("core-js/modules/es.object.keys");
20
+
21
+ require("core-js/modules/es.object.to-string");
22
+
23
+ require("core-js/modules/es.promise");
24
+
25
+ require("core-js/modules/es.string.iterator");
26
+
27
+ require("core-js/modules/es.weak-map");
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.submitPinAction = exports.submitMSISDNAction = exports.default = exports.backToStart = void 0;
37
+
38
+ require("regenerator-runtime/runtime");
39
+
40
+ var _toolkit = require("@reduxjs/toolkit");
41
+
42
+ var _pin = _interopRequireWildcard(require("../../api/pin"));
43
+
44
+ var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
45
+
46
+ var _pinFlowSliceTypes = require("./categories/typings/pinFlowSliceTypes");
47
+
48
+ var _identifySlice = require("./identifySlice");
49
+
50
+ 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); }
51
+
52
+ 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; }
53
+
54
+ 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; }
55
+
56
+ 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; }
57
+
58
+ 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; }
59
+
60
+ 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); } }
61
+
62
+ 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); }); }; }
63
+
64
+ var submitMSISDNAction = (0, _toolkit.createAsyncThunk)('pinFlow/submitMSISDNAction',
65
+ /*#__PURE__*/
66
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
67
+ // @ts-ignore
68
+ function () {
69
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(payload, thunkApi) {
70
+ var strategyState, currentState, config, pinMaxLengthByOp, msisdn, extraParams, msisdnSubmissionResult, operator, errorType;
71
+ return regeneratorRuntime.wrap(function _callee$(_context) {
72
+ while (1) {
73
+ switch (_context.prev = _context.next) {
74
+ case 0:
75
+ strategyState = thunkApi.getState().strategy.currentState;
76
+ currentState = thunkApi.getState().pinFlow.currentState; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
77
+ // @ts-ignore
78
+
79
+ config = strategyState.nextData.config || payload.configs;
80
+ pinMaxLengthByOp = {
81
+ SA_MOBILY: 6,
82
+ SA_STC: 4,
83
+ SA_ZAIN: 6
84
+ };
85
+ msisdn = payload.msisdn, extraParams = payload.extraParams;
86
+ _context.prev = 5;
87
+
88
+ _identifySlice.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submitted', {
89
+ msisdn: msisdn
90
+ });
91
+
92
+ _context.next = 9;
93
+ return (0, _pin.default)(window, config, msisdn, extraParams);
94
+
95
+ case 9:
96
+ msisdnSubmissionResult = _context.sent;
97
+
98
+ _identifySlice.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submission-success', {
99
+ msisdn: msisdn
100
+ });
101
+
102
+ operator = msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.operator : '';
103
+ return _context.abrupt("return", {
104
+ type: _pinFlowSliceTypes.PinStates.PINEntry,
105
+ result: {
106
+ actualPIN: msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null,
107
+ msisdn: msisdn,
108
+ operator: operator,
109
+ pinMaxLength: operator !== '' && pinMaxLengthByOp[operator] ? pinMaxLengthByOp[operator] : null
110
+ }
111
+ });
112
+
113
+ case 15:
114
+ _context.prev = 15;
115
+ _context.t0 = _context["catch"](5);
116
+ console.warn(_context.t0);
117
+ errorType = _context.t0.type;
118
+
119
+ _identifySlice.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
120
+ msisdn: msisdn,
121
+ errorType: errorType || 'UnknownError'
122
+ });
123
+
124
+ return _context.abrupt("return", thunkApi.rejectWithValue(_objectSpread(_objectSpread({}, currentState), {}, {
125
+ type: _pinFlowSliceTypes.PinStates.MSISDNEntry,
126
+ result: {
127
+ errorType: errorType,
128
+ error: _context.t0,
129
+ productUrl: _context.t0.productUrl
130
+ }
131
+ })));
132
+
133
+ case 21:
134
+ case "end":
135
+ return _context.stop();
136
+ }
137
+ }
138
+ }, _callee, null, [[5, 15]]);
139
+ }));
140
+
141
+ return function (_x, _x2) {
142
+ return _ref.apply(this, arguments);
143
+ };
144
+ }());
145
+ exports.submitMSISDNAction = submitMSISDNAction;
146
+ var submitPinAction = (0, _toolkit.createAsyncThunk)('pinFlow/submitPinAction',
147
+ /*#__PURE__*/
148
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
149
+ // @ts-ignore
150
+ function () {
151
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(payload, thunkApi) {
152
+ var strategyState, currentState, config, msisdn, pin, extraParams, result, errorType;
153
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
154
+ while (1) {
155
+ switch (_context2.prev = _context2.next) {
156
+ case 0:
157
+ strategyState = thunkApi.getState().strategy.currentState;
158
+ currentState = thunkApi.getState().pinFlow.currentState; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
159
+ // @ts-ignore
160
+
161
+ config = strategyState.nextData.config || payload.configs;
162
+ msisdn = payload.msisdn, pin = payload.pin, extraParams = payload.extraParams;
163
+ _context2.prev = 4;
164
+
165
+ _identifySlice.tracker.advancedInFlow('tallyman.v1-pin', 'pin-submitted', {
166
+ msisdn: msisdn,
167
+ pin: pin
168
+ });
169
+
170
+ _context2.next = 8;
171
+ return (0, _pin.submitPIN)(window, pin, config, extraParams);
172
+
173
+ case 8:
174
+ result = _context2.sent;
175
+
176
+ _identifySlice.tracker.advancedInFlow('tallyman.v1-pin', 'pin-submission-success', {
177
+ msisdn: msisdn,
178
+ pin: pin,
179
+ finalUrl: result
180
+ });
181
+
182
+ return _context2.abrupt("return", _objectSpread(_objectSpread({}, currentState), {}, {
183
+ type: _pinFlowSliceTypes.PinStates.PINEntry,
184
+ result: {
185
+ finalUrl: result.productUrl,
186
+ isAlreadySubscribed: result.isAlreadySubscribed || false
187
+ }
188
+ }));
189
+
190
+ case 13:
191
+ _context2.prev = 13;
192
+ _context2.t0 = _context2["catch"](4);
193
+ console.error(_context2.t0);
194
+ errorType = _context2.t0.type === 'InvalidPIN' ? 'InvalidPIN' : 'UnknownError';
195
+
196
+ _identifySlice.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-failure', {
197
+ msisdn: msisdn,
198
+ pin: pin
199
+ });
200
+
201
+ return _context2.abrupt("return", thunkApi.rejectWithValue(_objectSpread(_objectSpread({}, currentState), {}, {
202
+ type: _pinFlowSliceTypes.PinStates.PINEntry,
203
+ result: {
204
+ errorType: errorType
205
+ }
206
+ })));
207
+
208
+ case 19:
209
+ case "end":
210
+ return _context2.stop();
211
+ }
212
+ }
213
+ }, _callee2, null, [[4, 13]]);
214
+ }));
215
+
216
+ return function (_x3, _x4) {
217
+ return _ref2.apply(this, arguments);
218
+ };
219
+ }());
220
+ exports.submitPinAction = submitPinAction;
221
+
222
+ var handleSubmitMSISDNAction = function handleSubmitMSISDNAction(builder) {
223
+ builder.addCase(submitMSISDNAction.pending, function (state) {
224
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
225
+ // @ts-ignore
226
+ state.currentState = {
227
+ type: _pinFlowSliceTypes.PinStates.MSISDNEntry,
228
+ result: RDS.Loading()
229
+ };
230
+ });
231
+ builder.addCase(submitMSISDNAction.fulfilled, function (state, _ref3) {
232
+ var payload = _ref3.payload;
233
+ state.currentState = {
234
+ type: _pinFlowSliceTypes.PinStates.PINEntry,
235
+ result: RDS.NothingYet(),
236
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
237
+ // @ts-ignore
238
+ data: payload.result
239
+ };
240
+ });
241
+ builder.addCase(submitMSISDNAction.rejected, function (state, _ref4) {
242
+ var payload = _ref4.payload;
243
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
244
+ // @ts-ignore
245
+ state.currentState = {
246
+ type: _pinFlowSliceTypes.PinStates.MSISDNEntry,
247
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
248
+ // @ts-ignore
249
+ result: RDS.Failure(payload.result)
250
+ };
251
+ });
252
+ };
253
+
254
+ var handleSubmitPinAction = function handleSubmitPinAction(builder) {
255
+ builder.addCase(submitPinAction.pending, function (state) {
256
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
257
+ // @ts-ignore
258
+ state.currentState = {
259
+ type: _pinFlowSliceTypes.PinStates.PINEntry,
260
+ result: RDS.Loading()
261
+ };
262
+ });
263
+ builder.addCase(submitPinAction.fulfilled, function (state, _ref5) {
264
+ var payload = _ref5.payload;
265
+ state.currentState = {
266
+ type: _pinFlowSliceTypes.PinStates.PINEntry,
267
+ result: RDS.NothingYet(),
268
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
269
+ // @ts-ignore
270
+ data: payload.result
271
+ };
272
+ });
273
+ builder.addCase(submitPinAction.rejected, function (state, _ref6) {
274
+ var payload = _ref6.payload;
275
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
276
+ // @ts-ignore
277
+ state.currentState = {
278
+ type: _pinFlowSliceTypes.PinStates.PINEntry,
279
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
280
+ // @ts-ignore
281
+ result: RDS.Failure(payload.result)
282
+ };
283
+ });
284
+ };
285
+
286
+ var initialState = {
287
+ currentState: {
288
+ type: _pinFlowSliceTypes.PinStates.MSISDNEntry,
289
+ result: RDS.NothingYet()
290
+ }
291
+ };
292
+ var pinFlowSlice = (0, _toolkit.createSlice)({
293
+ name: 'pinFlow',
294
+ initialState: initialState,
295
+ reducers: {
296
+ backToStart: function backToStart(state) {
297
+ _identifySlice.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-backtostart', 'requested to change phone number');
298
+
299
+ state.currentState = {
300
+ type: _pinFlowSliceTypes.PinStates.MSISDNEntry,
301
+ result: RDS.NothingYet()
302
+ };
303
+ }
304
+ },
305
+ extraReducers: function extraReducers(builder) {
306
+ handleSubmitMSISDNAction(builder);
307
+ handleSubmitPinAction(builder);
308
+ }
309
+ });
310
+ var backToStart = pinFlowSlice.actions.backToStart;
311
+ exports.backToStart = backToStart;
312
+ var _default = pinFlowSlice.reducer;
313
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,6 +1,6 @@
1
1
  import * as RDS from "../common-types/RemoteDataState";
2
2
  import { OPERATORSelectFlowIdentifySuccess, IStrategyCurrentState, IIdenyifyFlowByMsisdnSumbitNextData, IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess, IdentifyFlowOptionsResult } from '../reducers/strategy/StrategyTypes';
3
- declare function strategy<R>({ identifyFlowByOperatorSelect, identifyFlowByMsisdn, pinFlow, moFlow, moRedirFlow, oneClickFlow, click2smsFlow, ussdFlow, tpayHeFlow }: {
3
+ declare function strategy<R>({ identifyFlowByOperatorSelect, identifyFlowByMsisdn, pinFlow, moFlow, moRedirFlow, oneClickFlow, click2smsFlow, ussdFlow }: {
4
4
  identifyFlowByOperatorSelect: (data: OPERATORSelectFlowIdentifySuccess) => R;
5
5
  identifyFlowByMsisdn: (rds: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>, nextData: IIdenyifyFlowByMsisdnSumbitNextData) => R;
6
6
  pinFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R;
@@ -9,6 +9,5 @@ declare function strategy<R>({ identifyFlowByOperatorSelect, identifyFlowByMsisd
9
9
  oneClickFlow: (data: IdentifyFlowOptionsResult<"getRedirectUrlAction">) => R;
10
10
  click2smsFlow: (data: IdentifyFlowOptionsResult<"loadOc2sms">) => R;
11
11
  ussdFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R;
12
- tpayHeFlow: (data: IdentifyFlowOptionsResult<"loadTpayAction">) => R;
13
12
  }): (state: IStrategyCurrentState) => R;
14
13
  export default strategy;
@@ -13,8 +13,7 @@ function strategy(_ref) {
13
13
  moRedirFlow = _ref.moRedirFlow,
14
14
  oneClickFlow = _ref.oneClickFlow,
15
15
  click2smsFlow = _ref.click2smsFlow,
16
- ussdFlow = _ref.ussdFlow,
17
- tpayHeFlow = _ref.tpayHeFlow;
16
+ ussdFlow = _ref.ussdFlow;
18
17
  return function (state) {
19
18
  switch (state.type) {
20
19
  case 'IDENTIFY_FLOW_BY_OPERATOR_SELECT':
@@ -40,9 +39,6 @@ function strategy(_ref) {
40
39
 
41
40
  case 'USSD':
42
41
  return ussdFlow(state.result);
43
-
44
- case 'TPAY_HE':
45
- return tpayHeFlow(state.result);
46
42
  }
47
43
  };
48
44
  }
@@ -25,7 +25,7 @@ function tryGetIPRangeName(_x) {
25
25
 
26
26
  function _tryGetIPRangeName() {
27
27
  _tryGetIPRangeName = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(visitor) {
28
- var mockip, res;
28
+ var mockip, host, res;
29
29
  return regeneratorRuntime.wrap(function _callee$(_context) {
30
30
  while (1) {
31
31
  switch (_context.prev = _context.next) {
@@ -33,42 +33,43 @@ function _tryGetIPRangeName() {
33
33
  mockip = (0, _queryString.default)(window.location.href, "mock-ip") || process.env.mock_ip;
34
34
  console.log("mockip", mockip);
35
35
 
36
- if (visitor.ip) {
37
- _context.next = 17;
36
+ if (!(!visitor.ip && typeof window != "undefined")) {
37
+ _context.next = 18;
38
38
  break;
39
39
  }
40
40
 
41
41
  _context.prev = 3;
42
- _context.next = 6;
43
- return fetch('https://c1.ouisys.com/api/v1/ip' + (!!mockip ? "?mock-ip=".concat(mockip) : "")).then(function (x) {
42
+ host = window.location.host;
43
+ _context.next = 7;
44
+ return fetch("https://".concat(host, "/api/v1/ip") + (!!mockip ? "?mock-ip=".concat(mockip) : "")).then(function (x) {
44
45
  return x.json();
45
46
  });
46
47
 
47
- case 6:
48
+ case 7:
48
49
  res = _context.sent;
49
50
  // return isIPInRange('37.200.146.28')
50
51
  visitor.ip = res.ip;
51
52
  visitor.ip_range_name = res.ip_range_name;
52
53
  return _context.abrupt("return", res.ip_range_name);
53
54
 
54
- case 12:
55
- _context.prev = 12;
55
+ case 13:
56
+ _context.prev = 13;
56
57
  _context.t0 = _context["catch"](3);
57
58
  console.warn("IP Lookup failed", _context.t0);
58
59
 
59
- case 15:
60
- _context.next = 18;
60
+ case 16:
61
+ _context.next = 19;
61
62
  break;
62
63
 
63
- case 17:
64
+ case 18:
64
65
  return _context.abrupt("return", visitor.ip_range_name);
65
66
 
66
- case 18:
67
+ case 19:
67
68
  case "end":
68
69
  return _context.stop();
69
70
  }
70
71
  }
71
- }, _callee, null, [[3, 12]]);
72
+ }, _callee, null, [[3, 13]]);
72
73
  }));
73
74
  return _tryGetIPRangeName.apply(this, arguments);
74
75
  }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol");
4
+
5
+ require("core-js/modules/es.symbol.description");
6
+
7
+ require("core-js/modules/es.symbol.iterator");
8
+
9
+ require("core-js/modules/es.array.from");
10
+
11
+ require("core-js/modules/es.array.iterator");
12
+
13
+ require("core-js/modules/es.array.slice");
14
+
15
+ require("core-js/modules/es.function.name");
16
+
17
+ require("core-js/modules/es.object.to-string");
18
+
19
+ require("core-js/modules/es.regexp.to-string");
20
+
21
+ require("core-js/modules/es.string.iterator");
22
+
23
+ require("core-js/modules/web.dom-collections.iterator");
24
+
25
+ Object.defineProperty(exports, "__esModule", {
26
+ value: true
27
+ });
28
+ exports.worker = void 0;
29
+
30
+ var _msw = require("msw");
31
+
32
+ var _handlers = require("./handlers");
33
+
34
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
35
+
36
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37
+
38
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39
+
40
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
41
+
42
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
43
+
44
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
45
+
46
+ var worker = _msw.setupWorker.apply(void 0, _toConsumableArray(_handlers.handlers));
47
+
48
+ exports.worker = worker;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handlers = void 0;
7
+
8
+ var _msw = require("msw");
9
+
10
+ var handlers = [_msw.rest.get('http://127.0.0.1:8080/sockjs-node/info/*', function (_, res, ctx) {
11
+ return res(ctx.json({
12
+ websocket: true,
13
+ origins: ['*:*'],
14
+ cookie_needed: false,
15
+ entropy: 1975621412
16
+ }));
17
+ }), _msw.rest.get('https://stats.g.doubleclick.net/j/collect/*', function (_, res, ctx) {
18
+ return res(ctx.json({}));
19
+ }), _msw.rest.get('https://de-pacman.analytickz.com/api/v2/mstore/*', function (_, res, ctx) {
20
+ return res(ctx.json({}));
21
+ })];
22
+ exports.handlers = handlers;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol");
4
+
5
+ require("core-js/modules/es.symbol.description");
6
+
7
+ require("core-js/modules/es.symbol.iterator");
8
+
9
+ require("core-js/modules/es.array.from");
10
+
11
+ require("core-js/modules/es.array.iterator");
12
+
13
+ require("core-js/modules/es.array.slice");
14
+
15
+ require("core-js/modules/es.function.name");
16
+
17
+ require("core-js/modules/es.object.to-string");
18
+
19
+ require("core-js/modules/es.regexp.to-string");
20
+
21
+ require("core-js/modules/es.string.iterator");
22
+
23
+ require("core-js/modules/web.dom-collections.iterator");
24
+
25
+ Object.defineProperty(exports, "__esModule", {
26
+ value: true
27
+ });
28
+ exports.server = void 0;
29
+
30
+ var _node = require("msw/node");
31
+
32
+ var _handlers = require("./handlers");
33
+
34
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
35
+
36
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37
+
38
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39
+
40
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
41
+
42
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
43
+
44
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
45
+
46
+ var server = _node.setupServer.apply(void 0, _toConsumableArray(_handlers.handlers));
47
+
48
+ exports.server = server;
@@ -94,7 +94,6 @@ var _default = function _default(window, country, page) {
94
94
  var pacmanClient = (0, _pacmanClient.default)({
95
95
  rockmanId: window.pac_analytics.visitor.rockmanId,
96
96
  serverUrl: process.env.pacman_server,
97
- // check webpack.config.common.js //"https://de-pacman.sam-media.com/api/v2/mstore",
98
97
  impressionNumber: 1,
99
98
  signalInterval: 1000 // in milliseconds
100
99
 
@@ -304,9 +304,7 @@ function _load2() {
304
304
 
305
305
  function checkSubscription(_x19, _x20) {
306
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
-
307
+ }
310
308
 
311
309
  function _checkSubscription() {
312
310
  _checkSubscription = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(window, maybeConfig) {
@@ -169,7 +169,7 @@ var mockedMSISDNEntrySuccess = {
169
169
  currentState: {
170
170
  type: "MSISDNEntry",
171
171
  result: RDS.Success({
172
- href: 'https://www.yahoo.com/'
172
+ href: '/mock-product-url'
173
173
  })
174
174
  }
175
175
  };
@@ -250,24 +250,25 @@ exports.getRedirectUrl = getRedirectUrl;
250
250
 
251
251
  var subscribe = /*#__PURE__*/function () {
252
252
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(url, extraParams) {
253
- var extraParamsQs, result, subscribeError;
253
+ var evinaTid, extraParamsQs, result, subscribeError;
254
254
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
255
255
  while (1) {
256
256
  switch (_context2.prev = _context2.next) {
257
257
  case 0:
258
+ evinaTid = typeof window != "undefined" && window.tid ? window.tid : "";
258
259
  extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
259
260
  return "".concat(k, "=").concat(extraParams[k]);
260
261
  }).join('&');
261
- _context2.next = 3;
262
- return fetch(url + extraParamsQs).then(function (x) {
262
+ _context2.next = 4;
263
+ return fetch("".concat(url, "&sam_evina_tid=").concat(evinaTid).concat(extraParamsQs)).then(function (x) {
263
264
  return x.json();
264
265
  });
265
266
 
266
- case 3:
267
+ case 4:
267
268
  result = _context2.sent;
268
269
 
269
270
  if (!(false === result.success)) {
270
- _context2.next = 11;
271
+ _context2.next = 12;
271
272
  break;
272
273
  }
273
274
 
@@ -276,10 +277,10 @@ var subscribe = /*#__PURE__*/function () {
276
277
  subscribeError['productUrl'] = result.product_url ? result.product_url : "";
277
278
  throw subscribeError;
278
279
 
279
- case 11:
280
+ case 12:
280
281
  return _context2.abrupt("return", result.product_url || result.redirect_url);
281
282
 
282
- case 12:
283
+ case 13:
283
284
  case "end":
284
285
  return _context2.stop();
285
286
  }
@@ -351,7 +352,7 @@ var mockedRedirectUrlSuccessState = {
351
352
  type: "GET_REDIRECT_URL",
352
353
  //@ts-ignore
353
354
  result: RDS.Success({
354
- redirectUrl: 'https://www.yahoo.com/'
355
+ redirectUrl: '/mock-product-url'
355
356
  })
356
357
  }
357
358
  };