ouisys-engine 3.0.3 → 3.0.5

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 (195) hide show
  1. package/.babelrc +4 -8
  2. package/.eslintrc.js +1 -1
  3. package/.husky/pre-commit +4 -0
  4. package/.nvmrc +1 -1
  5. package/.prettierignore +2 -1
  6. package/.vscode/settings.json +1 -1
  7. package/README.md +2 -4
  8. package/dist/api/index.d.ts +5 -5
  9. package/dist/api/index.js +76 -76
  10. package/dist/common-types/AppThunk.d.ts +11 -12
  11. package/dist/common-types/IOptInFlowName.d.ts +1 -1
  12. package/dist/common-types/ITracker.js +1 -2
  13. package/dist/common-types/RemoteDataState.d.ts +4 -4
  14. package/dist/common-types/RemoteDataState.js +17 -17
  15. package/dist/flows/click2smsFlow.d.ts +2 -2
  16. package/dist/flows/moFlow.d.ts +2 -2
  17. package/dist/flows/moRedirFlow.d.ts +2 -2
  18. package/dist/flows/oneClickFlow.d.ts +2 -2
  19. package/dist/flows/pinFlow.d.ts +2 -2
  20. package/dist/flows/pinFlow.js +2 -0
  21. package/dist/flows/strategy.d.ts +8 -8
  22. package/dist/flows/ussdFlow.d.ts +2 -2
  23. package/dist/ips/tryGetIPRangeName.d.ts +1 -1
  24. package/dist/ips/tryGetIPRangeName.js +7 -5
  25. package/dist/jest.config.js +1 -1
  26. package/dist/pacman/index.d.ts +2 -2
  27. package/dist/pacman/index.js +41 -41
  28. package/dist/pacman/queryString.js +11 -9
  29. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
  30. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
  31. package/dist/reducers/click2smsFlow/index.d.ts +2 -2
  32. package/dist/reducers/click2smsFlow/index.js +24 -24
  33. package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
  34. package/dist/reducers/click2smsFlow/utils.js +30 -30
  35. package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
  36. package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
  37. package/dist/reducers/moFlow/index.d.ts +3 -3
  38. package/dist/reducers/moFlow/index.js +27 -27
  39. package/dist/reducers/moFlow/utils.d.ts +1 -2
  40. package/dist/reducers/moFlow/utils.js +28 -26
  41. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
  42. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
  43. package/dist/reducers/moRedirFlow/index.d.ts +3 -3
  44. package/dist/reducers/moRedirFlow/index.js +27 -27
  45. package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
  46. package/dist/reducers/moRedirFlow/utils.js +17 -17
  47. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
  48. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
  49. package/dist/reducers/oneClickFlow/index.d.ts +3 -3
  50. package/dist/reducers/oneClickFlow/index.js +75 -68
  51. package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
  52. package/dist/reducers/oneClickFlow/utils.js +38 -38
  53. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  54. package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
  55. package/dist/reducers/pinFlow/index.d.ts +3 -3
  56. package/dist/reducers/pinFlow/index.js +76 -76
  57. package/dist/reducers/pinFlow/utils.d.ts +1 -1
  58. package/dist/reducers/pinFlow/utils.js +61 -65
  59. package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
  60. package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
  61. package/dist/reducers/strategy/index.d.ts +2 -2
  62. package/dist/reducers/strategy/index.js +99 -99
  63. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +2 -2
  64. package/dist/reducers/strategy/strategies/ask_mobile_number.js +78 -78
  65. package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
  66. package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
  67. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
  68. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
  69. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
  70. package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
  71. package/dist/reducers/strategy/utils.d.ts +3 -3
  72. package/dist/reducers/strategy/utils.js +115 -111
  73. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
  74. package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
  75. package/dist/reducers/ussdFlow/index.d.ts +3 -3
  76. package/dist/reducers/ussdFlow/index.js +27 -27
  77. package/dist/reducers/ussdFlow/utils.d.ts +1 -2
  78. package/dist/reducers/ussdFlow/utils.js +19 -17
  79. package/dist/store/index.d.ts +8 -8
  80. package/dist/store/index.js +87 -83
  81. package/dist/store/reducers.d.ts +7 -7
  82. package/dist/store/reducers.js +4 -4
  83. package/dist/utilities/handleSubmitNumber.d.ts +7 -3
  84. package/dist/utilities/handleSubmitNumber.js +15 -18
  85. package/dist/utilities/index.d.ts +1 -1
  86. package/dist/utilities/index.js +13 -11
  87. package/dist/utilities/loadScriptInnerHtml.js +0 -1
  88. package/index.html +21 -28
  89. package/mockData/config.json +1 -1
  90. package/package.json +23 -15
  91. package/setupJest.js +1 -1
  92. package/tsconfig.json +2 -2
  93. package/dist/api/click2sms.js +0 -357
  94. package/dist/api/mo.js +0 -274
  95. package/dist/api/moRedir.js +0 -186
  96. package/dist/api/oneClick.js +0 -366
  97. package/dist/api/pin.js +0 -493
  98. package/dist/api/strategies.js +0 -704
  99. package/dist/api/ussd.js +0 -1
  100. package/dist/app/store.js +0 -35
  101. package/dist/features/strategies/categories/askMobileNumber.js +0 -395
  102. package/dist/features/strategies/categories/askOperator.js +0 -311
  103. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
  104. package/dist/features/strategies/categories/headerEnrichment.js +0 -670
  105. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
  106. package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
  107. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
  108. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
  109. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
  110. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
  111. package/dist/features/strategies/click2smsFlowSlice.js +0 -172
  112. package/dist/features/strategies/identifySlice.js +0 -455
  113. package/dist/features/strategies/moFlowSlice.js +0 -196
  114. package/dist/features/strategies/moRedirFlowSlice.js +0 -190
  115. package/dist/features/strategies/oneClickFlowSlice.js +0 -277
  116. package/dist/features/strategies/pinFlowSlice.js +0 -313
  117. package/dist/features/strategies/ussdFlowSlice.js +0 -1
  118. package/dist/flows/tpayHeFlow.d.ts +0 -7
  119. package/dist/flows/tpayHeFlow.js +0 -23
  120. package/dist/mockServer/browser.js +0 -48
  121. package/dist/mockServer/handlers.js +0 -22
  122. package/dist/mockServer/server.js +0 -48
  123. package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
  124. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  125. package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
  126. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  127. package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
  128. package/dist/reducers/tpayHeFlow/index.js +0 -331
  129. package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
  130. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  131. package/dist/test/setup.js +0 -24
  132. package/dist/test/test-utils.js +0 -51
  133. package/prettier.config.js +0 -7
  134. package/src/@types/react-tracker.d.ts +0 -16
  135. package/src/@types/redux-cli-logger.d.ts +0 -1
  136. package/src/@types/tiny-async-pool.d.ts +0 -3
  137. package/src/@types/window.d.ts +0 -74
  138. package/src/api/index.ts +0 -225
  139. package/src/common-types/AppThunk.ts +0 -19
  140. package/src/common-types/Either.ts +0 -3
  141. package/src/common-types/IError.ts +0 -5
  142. package/src/common-types/IOptInFlowName.ts +0 -1
  143. package/src/common-types/ITracker.ts +0 -10
  144. package/src/common-types/IVisitor.ts +0 -16
  145. package/src/common-types/RemoteDataState.ts +0 -88
  146. package/src/flows/click2smsFlow.ts +0 -18
  147. package/src/flows/moFlow.ts +0 -20
  148. package/src/flows/moRedirFlow.ts +0 -20
  149. package/src/flows/oneClickFlow.ts +0 -20
  150. package/src/flows/pinFlow.ts +0 -25
  151. package/src/flows/strategy.ts +0 -51
  152. package/src/flows/ussdFlow.ts +0 -20
  153. package/src/index.ts +0 -3
  154. package/src/ips/tryGetIPRangeName.ts +0 -22
  155. package/src/jest.config.js +0 -194
  156. package/src/pacman/index.ts +0 -71
  157. package/src/pacman/queryString.ts +0 -24
  158. package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
  159. package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
  160. package/src/reducers/click2smsFlow/index.ts +0 -105
  161. package/src/reducers/click2smsFlow/utils.ts +0 -126
  162. package/src/reducers/moFlow/IMoConstants.ts +0 -7
  163. package/src/reducers/moFlow/MoTypes.ts +0 -125
  164. package/src/reducers/moFlow/index.ts +0 -150
  165. package/src/reducers/moFlow/utils.ts +0 -135
  166. package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
  167. package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
  168. package/src/reducers/moRedirFlow/index.ts +0 -137
  169. package/src/reducers/moRedirFlow/utils.ts +0 -78
  170. package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
  171. package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
  172. package/src/reducers/oneClickFlow/index.ts +0 -268
  173. package/src/reducers/oneClickFlow/utils.ts +0 -219
  174. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  175. package/src/reducers/pinFlow/PinTypes.ts +0 -190
  176. package/src/reducers/pinFlow/index.ts +0 -331
  177. package/src/reducers/pinFlow/utils.ts +0 -232
  178. package/src/reducers/strategy/IStategyActionContants.ts +0 -17
  179. package/src/reducers/strategy/StrategyTypes.ts +0 -376
  180. package/src/reducers/strategy/index.ts +0 -322
  181. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -366
  182. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  183. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  184. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  185. package/src/reducers/strategy/utils.ts +0 -357
  186. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  187. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  188. package/src/reducers/ussdFlow/index.ts +0 -146
  189. package/src/reducers/ussdFlow/utils.ts +0 -88
  190. package/src/store/index.ts +0 -150
  191. package/src/store/reducers.ts +0 -37
  192. package/src/utilities/handleSubmitNumber.ts +0 -65
  193. package/src/utilities/index.ts +0 -114
  194. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  195. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -1,366 +0,0 @@
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.from");
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.array.slice");
22
-
23
- require("core-js/modules/es.function.name");
24
-
25
- require("core-js/modules/es.object.get-own-property-descriptor");
26
-
27
- require("core-js/modules/es.object.keys");
28
-
29
- require("core-js/modules/es.object.to-string");
30
-
31
- require("core-js/modules/es.promise");
32
-
33
- require("core-js/modules/es.regexp.exec");
34
-
35
- require("core-js/modules/es.regexp.to-string");
36
-
37
- require("core-js/modules/es.string.iterator");
38
-
39
- require("core-js/modules/es.string.search");
40
-
41
- require("core-js/modules/es.string.split");
42
-
43
- require("core-js/modules/es.weak-map");
44
-
45
- require("core-js/modules/web.dom-collections.iterator");
46
-
47
- Object.defineProperty(exports, "__esModule", {
48
- value: true
49
- });
50
- exports.subscribe = exports.mockedSubscribeAjaxState = exports.mockedRedirectUrlSuccessState = exports.getRedirectUrlBupperWay = exports.getRedirectUrl = exports.additionalQueryString = void 0;
51
-
52
- require("regenerator-runtime/runtime");
53
-
54
- var RDS = _interopRequireWildcard(require("../common-types/RemoteDataState"));
55
-
56
- 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); }
57
-
58
- 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; }
59
-
60
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
61
-
62
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
63
-
64
- 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); }
65
-
66
- 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; }
67
-
68
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
69
-
70
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
71
-
72
- 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); } }
73
-
74
- 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); }); }; }
75
-
76
- var additionalQueryString = "msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N";
77
- exports.additionalQueryString = additionalQueryString;
78
-
79
- var fetchJsonp = function fetchJsonp(_url) {
80
- var url = _url;
81
- var ouisys_callback_function = "ouisys_callback_function".concat(Math.floor(Math.random() * 10000));
82
- return new Promise(function (resolve, reject) {
83
- // @ts-ignore
84
- window[ouisys_callback_function] = function (arg) {
85
- resolve(arg);
86
- };
87
-
88
- url += url.indexOf('?') === -1 ? '?' : '&';
89
- url += "jsonp=".concat(ouisys_callback_function);
90
- var script = document.createElement('script');
91
- script.src = url;
92
- script.id = ouisys_callback_function;
93
- document.body.appendChild(script); // Caught if got 404/500
94
-
95
- script.onerror = function () {
96
- reject(new Error("JSONP request to ".concat(_url, " failed")));
97
- };
98
- });
99
- };
100
-
101
- var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML) {
102
- var script = document.createElement('script');
103
- script.type = 'text/javascript';
104
- script.innerHTML = innerHTML;
105
- document.body.appendChild(script);
106
- console.log('loadScript');
107
- };
108
-
109
- var getRedirectUrl = /*#__PURE__*/function () {
110
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(window, maybeConfig, extraParams) {
111
- var host, country, slug, queryString, apiAction, bupperizeCountry, offer, s, search, extraParamsQs, rockmanId, _url2, result, identifyError, _url3, _result, _identifyError, _url4, _result2, _identifyError2;
112
-
113
- return regeneratorRuntime.wrap(function _callee$(_context) {
114
- while (1) {
115
- switch (_context.prev = _context.next) {
116
- case 0:
117
- if (!(typeof window === 'undefined')) {
118
- _context.next = 4;
119
- break;
120
- }
121
-
122
- throw "javascript: console.error('SSR'); void 6";
123
-
124
- case 4:
125
- host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString, apiAction = maybeConfig.apiAction;
126
-
127
- bupperizeCountry = function bupperizeCountry(c) {
128
- return c == 'gb' ? 'uk' : c;
129
- };
130
-
131
- offer = window.pac_analytics.visitor.offer;
132
- s = window.location.search.substr(1);
133
- search = (!!s && s.length > 0 ? [s] : []).concat((queryString || []).map(function (_ref2) {
134
- var _ref3 = _slicedToArray(_ref2, 2),
135
- k = _ref3[0],
136
- v = _ref3[1];
137
-
138
- return "".concat(k, "=").concat(v);
139
- })).join('&');
140
- extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
141
- return "".concat(k, "=").concat(extraParams[k]);
142
- }).join('&'));
143
- rockmanId = window.pac_analytics.visitor.rockmanId;
144
-
145
- if (!(apiAction == 'identify-user')) {
146
- _context.next = 25;
147
- break;
148
- }
149
-
150
- _url2 = "https://de.tallymans.com/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
151
- _context.next = 15;
152
- return fetchJsonp(_url2);
153
-
154
- case 15:
155
- result = _context.sent;
156
-
157
- if (!(result.success === false)) {
158
- _context.next = 22;
159
- break;
160
- }
161
-
162
- identifyError = new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message));
163
- identifyError.type = 'NotOn3g';
164
- throw identifyError;
165
-
166
- case 22:
167
- return _context.abrupt("return", {
168
- subscriptionUrl: result.subscription_url || result.redirect_url,
169
- action: function action() {
170
- return subscribe(result.subscription_url);
171
- }
172
- });
173
-
174
- case 23:
175
- _context.next = 51;
176
- break;
177
-
178
- case 25:
179
- if (!(apiAction == 'he')) {
180
- _context.next = 40;
181
- break;
182
- }
183
-
184
- _url3 = "https://de.tallymans.com/tallyman/v1/?action=he&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
185
- _context.next = 29;
186
- return fetch(_url3).then(function (x) {
187
- return x.json();
188
- });
189
-
190
- case 29:
191
- _result = _context.sent;
192
-
193
- if (!(_result.success === false)) {
194
- _context.next = 36;
195
- break;
196
- }
197
-
198
- _identifyError = new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result.message));
199
- _identifyError.type = 'NotOn3g';
200
- throw _identifyError;
201
-
202
- case 36:
203
- loadScriptInnerHtml(_result.source);
204
- return _context.abrupt("return", {
205
- redirectUrl: _result.redirectUrlWithReplacedUniqid
206
- });
207
-
208
- case 38:
209
- _context.next = 51;
210
- break;
211
-
212
- case 40:
213
- _url4 = "https://de.tallymans.com/tallyman/v1/?action=redirect&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
214
- _context.next = 43;
215
- return fetch(_url4).then(function (x) {
216
- return x.json();
217
- });
218
-
219
- case 43:
220
- _result2 = _context.sent;
221
-
222
- if (!(_result2.success === false)) {
223
- _context.next = 50;
224
- break;
225
- }
226
-
227
- _identifyError2 = new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result2.message));
228
- _identifyError2.type = 'NotOn3g';
229
- throw _identifyError2;
230
-
231
- case 50:
232
- return _context.abrupt("return", {
233
- redirectUrl: _result2.redirect_url
234
- });
235
-
236
- case 51:
237
- case "end":
238
- return _context.stop();
239
- }
240
- }
241
- }, _callee);
242
- }));
243
-
244
- return function getRedirectUrl(_x, _x2, _x3) {
245
- return _ref.apply(this, arguments);
246
- };
247
- }();
248
-
249
- exports.getRedirectUrl = getRedirectUrl;
250
-
251
- var subscribe = /*#__PURE__*/function () {
252
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(url, extraParams) {
253
- var extraParamsQs, result, subscribeError;
254
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
255
- while (1) {
256
- switch (_context2.prev = _context2.next) {
257
- case 0:
258
- extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
259
- return "".concat(k, "=").concat(extraParams[k]);
260
- }).join('&'));
261
- _context2.next = 3;
262
- return fetch(url + extraParamsQs).then(function (x) {
263
- return x.json();
264
- });
265
-
266
- case 3:
267
- result = _context2.sent;
268
-
269
- if (!(result.success === false)) {
270
- _context2.next = 11;
271
- break;
272
- }
273
-
274
- subscribeError = new Error("Error in subscribe() one-click-subscribe action:\n".concat(result.message));
275
- subscribeError.type = result.message == 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'SubscriptionError';
276
- subscribeError.productUrl = result.product_url ? result.product_url : '';
277
- throw subscribeError;
278
-
279
- case 11:
280
- return _context2.abrupt("return", result.product_url || result.redirect_url);
281
-
282
- case 12:
283
- case "end":
284
- return _context2.stop();
285
- }
286
- }
287
- }, _callee2);
288
- }));
289
-
290
- return function subscribe(_x4, _x5) {
291
- return _ref4.apply(this, arguments);
292
- };
293
- }();
294
-
295
- exports.subscribe = subscribe;
296
-
297
- var getRedirectUrlBupperWay = /*#__PURE__*/function () {
298
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, maybeConfig, extraParams) {
299
- var host, country, slug, queryString, bupperizeCountry, offer, s, search, extraParamsQs, xcid;
300
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
301
- while (1) {
302
- switch (_context3.prev = _context3.next) {
303
- case 0:
304
- if (!(typeof window === 'undefined')) {
305
- _context3.next = 2;
306
- break;
307
- }
308
-
309
- return _context3.abrupt("return", "javascript: console.error('SSR'); void 6");
310
-
311
- case 2:
312
- host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString;
313
-
314
- bupperizeCountry = function bupperizeCountry(c) {
315
- return c == 'gb' ? 'uk' : c;
316
- };
317
-
318
- offer = window.pac_analytics.visitor.offer;
319
- s = window.location.search.substr(1);
320
- search = (!!s && s.length > 0 ? [s] : []).concat((queryString || []).map(function (_ref6) {
321
- var _ref7 = _slicedToArray(_ref6, 2),
322
- k = _ref7[0],
323
- v = _ref7[1];
324
-
325
- return "".concat(k, "=").concat(v);
326
- })).join('&');
327
- extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
328
- return "".concat(k, "=").concat(extraParams[k]);
329
- }).join('&'));
330
- console.log('extraParamsQs', extraParamsQs); // one click flow must use http not https
331
-
332
- xcid = window.location.href.split('/')[3].split('?')[0];
333
- return _context3.abrupt("return", "http://".concat(host, "/").concat(bupperizeCountry(country), "/").concat(slug, "?offer=").concat(offer, "&atmobirun=1&rockman_id=").concat(window.pac_analytics.visitor.rockmanId, "&redirPixels=").concat(window.location.host, "&x-xcid=").concat(xcid).concat(extraParamsQs, "&").concat(search, "&"));
334
-
335
- case 11:
336
- case "end":
337
- return _context3.stop();
338
- }
339
- }
340
- }, _callee3);
341
- }));
342
-
343
- return function getRedirectUrlBupperWay(_x6, _x7, _x8) {
344
- return _ref5.apply(this, arguments);
345
- };
346
- }();
347
-
348
- exports.getRedirectUrlBupperWay = getRedirectUrlBupperWay;
349
- var mockedRedirectUrlSuccessState = {
350
- currentState: {
351
- type: 'GET_REDIRECT_URL',
352
- // @ts-ignore
353
- result: RDS.Success({
354
- redirectUrl: 'https://www.yahoo.com/'
355
- })
356
- }
357
- };
358
- exports.mockedRedirectUrlSuccessState = mockedRedirectUrlSuccessState;
359
- var mockedSubscribeAjaxState = {
360
- currentState: {
361
- type: 'SUBCRIBE_AJAX',
362
- // @ts-ignore
363
- result: RDS.NothingYet()
364
- }
365
- };
366
- exports.mockedSubscribeAjaxState = mockedSubscribeAjaxState;