ouisys-engine 3.0.15 → 3.0.16

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.
@@ -70,7 +70,8 @@ var _default = function _default(window, country, page) {
70
70
 
71
71
  if (!window.pac_analytics) {
72
72
  var rockmanId = (0, _v.default)().replace(/-/g, '');
73
- var campaignId = parseInt((0, _queryString2.default)(window.location.search, 'cid')) || 2;
73
+ var campaignId = parseInt((0, _queryString2.default)(window.location.search, 'cid'), 10) || 2; // eslint-disable-next-line no-param-reassign
74
+
74
75
  window.pac_analytics = {
75
76
  visitor: {
76
77
  rockmanId: rockmanId,
@@ -80,7 +81,7 @@ var _default = function _default(window, country, page) {
80
81
  page: page,
81
82
  xaid: (0, _queryString2.default)(window.location.search, 'xaid'),
82
83
  cid: campaignId,
83
- offer: parseInt((0, _queryString2.default)(window.location.search, 'offer')) || 1 // default to 1 offer id
84
+ offer: parseInt((0, _queryString2.default)(window.location.search, 'offer'), 10) || 1 // default to 1 offer id
84
85
 
85
86
  },
86
87
  startTime: new Date().valueOf(),
@@ -21,7 +21,7 @@ require("core-js/modules/es.string.match.js");
21
21
  require("core-js/modules/es.array.concat.js");
22
22
 
23
23
  var _default = function _default(url, paramName) {
24
- var name = paramName.replace(/[\[\]]/g, '\\$&');
24
+ var name = paramName.replace(/[\]]/g, '\\$&');
25
25
  var regex = new RegExp("[?&]".concat(name, "(=([^&#]*)|&|#|$)"), 'i');
26
26
  var results = regex.exec(url);
27
27
  if (!results) return null;
@@ -35,15 +35,16 @@ function updateUrlParameter(uri, key, value) {
35
35
  // remove the hash part before operating on the uri
36
36
  var i = uri.indexOf('#');
37
37
  var hash = i === -1 ? '' : uri.substr(i);
38
- uri = i === -1 ? uri : uri.substr(0, i);
38
+ var newUri = uri;
39
+ newUri = i === -1 ? newUri : newUri.substr(0, i);
39
40
  var re = new RegExp("([?&])".concat(key, "=.*?(&|$)"), 'i');
40
- var separator = uri.indexOf('?') !== -1 ? '&' : '?';
41
+ var separator = newUri.indexOf('?') !== -1 ? '&' : '?';
41
42
 
42
- if (uri.match(re)) {
43
- uri = uri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
43
+ if (newUri.match(re)) {
44
+ newUri = newUri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
44
45
  } else {
45
- uri = "".concat(uri + separator + key, "=").concat(value);
46
+ newUri = "".concat(newUri + separator + key, "=").concat(value);
46
47
  }
47
48
 
48
- return uri + hash; // finally append the hash as well
49
+ return newUri + hash; // finally append the hash as well
49
50
  }
@@ -48,7 +48,7 @@ export declare type IStrategy = {
48
48
  country: string;
49
49
  strategyConfigs: StrategyConfig;
50
50
  };
51
- export declare type IStrategyNames = 'pin' | 'mo' | 'mo-redir' | 'click2sms' | 'one-click' | 'ussd' | 'tpay-he' | 'tallyman-one-click' | 'pin-mo-ask-operator' | 'pin-mo-ask-mobile-number' | 'pin-one-click-ask-operator' | 'pin-one-click-detect-operator-by-ip' | 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' | 'pin-click2sms-ask-operator' | 'mo-redir-one-click-detect-operator-by-ip' | 'pin-mo-redir-ask-mobile-number' | 'pin-click2sms-ask-mobile-number' | 'mo-one-click-detect-operator-by-ip' | 'click2sms-one-click-detect-operator-by-ip' | 'pin-header-enrichment' | 'pin-msisdn-fowarding-pin-header-enrichment' | 'he-pin-mo-redir-header-enrichment' | 'he-pin-one-click-header-enrichment' | 'he-pin-one-click-ask-operator' | 'click2sms-one-click-ask-operator' | 'pin-mo-detect-operator-by-ip' | 'he-mo-redir-one-click-header-enrichment' | 'pin-combo-ask-mobile-number';
51
+ export declare type IStrategyNames = 'pin' | 'mo' | 'mo-redir' | 'click2sms' | 'one-click' | 'ussd' | 'tpay-he' | 'tallyman-one-click' | 'pin-mo-ask-operator' | 'pin-mo-ask-mobile-number' | 'pin-one-click-ask-operator' | 'pin-one-click-detect-operator-by-ip' | 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' | 'pin-click2sms-ask-operator' | 'mo-redir-one-click-detect-operator-by-ip' | 'pin-mo-redir-ask-mobile-number' | 'pin-click2sms-ask-mobile-number' | 'mo-one-click-detect-operator-by-ip' | 'click2sms-one-click-detect-operator-by-ip' | 'pin-header-enrichment' | 'pin-msisdn-fowarding-pin-header-enrichment' | 'he-pin-mo-redir-header-enrichment' | 'he-pin-one-click-header-enrichment' | 'he-pin-one-click-ask-operator' | 'click2sms-one-click-ask-operator' | 'pin-mo-detect-operator-by-ip' | 'he-mo-redir-one-click-header-enrichment' | 'pin-combo-ask-mobile-number' | 'header-enrichment-script';
52
52
  export interface IHash {
53
53
  [key: string]: string;
54
54
  }
@@ -114,6 +114,8 @@ export declare type IIdentfyFlowByOperatorNextAction = 'submitMSISDNAction' | 'l
114
114
  export declare type IIdentfyFlowByIPOperatorNextAction = 'getRedirectUrlAction' | 'submitMSISDNAction';
115
115
  export declare type IIdenyifyFlowByMsisdnSumbitNextData = {
116
116
  nextAction: IIdentfyFlowByMsisdnNextAction;
117
+ msisdn?: string;
118
+ operator?: string;
117
119
  };
118
120
  export declare type IIdenyifyFlowByMsisdnPayload = {
119
121
  type: 'IDENTIFY_FLOW_BY_MSISDN';
@@ -228,3 +230,9 @@ export interface IMockFlowParams<T> {
228
230
  'mock-flow': IMockFlows;
229
231
  'current-state': T;
230
232
  }
233
+ export interface IScriptHeaderEnrichmentSuccess extends CustomEvent {
234
+ detail: {
235
+ msisdn: string;
236
+ operator_code: string;
237
+ };
238
+ }
@@ -79,6 +79,8 @@ var _detect_operator_by_ip = _interopRequireDefault(require("./strategies/detect
79
79
 
80
80
  var _header_enrichment = _interopRequireDefault(require("./strategies/header_enrichment"));
81
81
 
82
+ var _injectHeaderEnrichmentScript = _interopRequireDefault(require("./strategies/injectHeaderEnrichmentScript"));
83
+
82
84
  var _utils2 = require("./utils");
83
85
 
84
86
  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); }
@@ -177,12 +179,12 @@ function identifyStrategy() {
177
179
  }
178
180
 
179
181
  dispatch(mockStrategyStateByUrlParam());
180
- _context.next = 32;
182
+ _context.next = 31;
181
183
  break;
182
184
 
183
185
  case 7:
184
186
  _context.t0 = strategy;
185
- _context.next = _context.t0 === 'pin-mo-ask-operator' ? 10 : _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 11 : _context.t0 === 'pin-mo-ask-mobile-number' ? 11 : _context.t0 === 'pin-combo-ask-mobile-number' ? 11 : _context.t0 === 'pin-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' ? 12 : _context.t0 === 'mo-redir-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'mo-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'click2sms-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-mo-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-click2sms-ask-operator' ? 13 : _context.t0 === 'he-pin-one-click-ask-operator' ? 13 : _context.t0 === 'click2sms-one-click-ask-operator' ? 13 : _context.t0 === 'pin-one-click-ask-operator' ? 13 : _context.t0 === 'pin-header-enrichment' ? 14 : _context.t0 === 'he-pin-mo-redir-header-enrichment' ? 14 : _context.t0 === 'he-pin-one-click-header-enrichment' ? 14 : _context.t0 === 'he-mo-redir-one-click-header-enrichment' ? 14 : _context.t0 === 'pin' ? 15 : _context.t0 === 'mo' ? 17 : _context.t0 === 'mo-redir' ? 19 : _context.t0 === 'one-click' ? 21 : _context.t0 === 'tallyman-one-click' ? 23 : _context.t0 === 'click2sms' ? 25 : _context.t0 === 'ussd' ? 27 : _context.t0 === 'tpay-he' ? 29 : 31;
187
+ _context.next = _context.t0 === 'pin-mo-ask-operator' ? 10 : _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 11 : _context.t0 === 'pin-mo-ask-mobile-number' ? 11 : _context.t0 === 'pin-combo-ask-mobile-number' ? 11 : _context.t0 === 'pin-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' ? 12 : _context.t0 === 'mo-redir-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'mo-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'click2sms-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-mo-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-click2sms-ask-operator' ? 13 : _context.t0 === 'he-pin-one-click-ask-operator' ? 13 : _context.t0 === 'click2sms-one-click-ask-operator' ? 13 : _context.t0 === 'pin-one-click-ask-operator' ? 13 : _context.t0 === 'pin-header-enrichment' ? 14 : _context.t0 === 'he-pin-mo-redir-header-enrichment' ? 14 : _context.t0 === 'he-pin-one-click-header-enrichment' ? 14 : _context.t0 === 'he-mo-redir-one-click-header-enrichment' ? 14 : _context.t0 === 'header-enrichment-script' ? 15 : _context.t0 === 'pin' ? 16 : _context.t0 === 'mo' ? 18 : _context.t0 === 'mo-redir' ? 20 : _context.t0 === 'one-click' ? 22 : _context.t0 === 'click2sms' ? 24 : _context.t0 === 'ussd' ? 26 : _context.t0 === 'tpay-he' ? 28 : 30;
186
188
  break;
187
189
 
188
190
  case 10:
@@ -201,6 +203,9 @@ function identifyStrategy() {
201
203
  return _context.abrupt("return", dispatch((0, _header_enrichment.default)()));
202
204
 
203
205
  case 15:
206
+ return _context.abrupt("return", dispatch((0, _injectHeaderEnrichmentScript.default)()));
207
+
208
+ case 16:
204
209
  tracker.sendOptInFlowEvent('Pin');
205
210
  return _context.abrupt("return", dispatch({
206
211
  type: 'IDENTIFY_STRATEGY',
@@ -214,7 +219,7 @@ function identifyStrategy() {
214
219
  }
215
220
  }));
216
221
 
217
- case 17:
222
+ case 18:
218
223
  tracker.sendOptInFlowEvent('Msisdn to sms');
219
224
  return _context.abrupt("return", dispatch({
220
225
  type: 'IDENTIFY_STRATEGY',
@@ -227,7 +232,7 @@ function identifyStrategy() {
227
232
  }
228
233
  }));
229
234
 
230
- case 19:
235
+ case 20:
231
236
  tracker.sendOptInFlowEvent('Redirect');
232
237
  return _context.abrupt("return", dispatch({
233
238
  type: 'IDENTIFY_STRATEGY',
@@ -240,7 +245,7 @@ function identifyStrategy() {
240
245
  }
241
246
  }));
242
247
 
243
- case 21:
248
+ case 22:
244
249
  tracker.sendOptInFlowEvent('3G click');
245
250
  return _context.abrupt("return", dispatch({
246
251
  type: 'IDENTIFY_STRATEGY',
@@ -253,20 +258,7 @@ function identifyStrategy() {
253
258
  }
254
259
  }));
255
260
 
256
- case 23:
257
- tracker.sendOptInFlowEvent('3G click');
258
- return _context.abrupt("return", dispatch({
259
- type: 'IDENTIFY_STRATEGY',
260
- payload: {
261
- type: 'TALLYMAN_ONE_CLICK',
262
- result: {
263
- nextAction: 'getRedirectUrlAction',
264
- config: strategyConfigs.default.flowConfig
265
- }
266
- }
267
- }));
268
-
269
- case 25:
261
+ case 24:
270
262
  tracker.sendOptInFlowEvent('Click to sms');
271
263
  return _context.abrupt("return", dispatch({
272
264
  type: 'IDENTIFY_STRATEGY',
@@ -279,7 +271,7 @@ function identifyStrategy() {
279
271
  }
280
272
  }));
281
273
 
282
- case 27:
274
+ case 26:
283
275
  tracker.sendOptInFlowEvent('Msisdn to sms');
284
276
  return _context.abrupt("return", dispatch({
285
277
  type: 'IDENTIFY_STRATEGY',
@@ -292,7 +284,7 @@ function identifyStrategy() {
292
284
  }
293
285
  }));
294
286
 
295
- case 29:
287
+ case 28:
296
288
  tracker.sendOptInFlowEvent('Hybrid Pin');
297
289
  return _context.abrupt("return", dispatch({
298
290
  type: 'IDENTIFY_STRATEGY',
@@ -305,10 +297,10 @@ function identifyStrategy() {
305
297
  }
306
298
  }));
307
299
 
308
- case 31:
300
+ case 30:
309
301
  throw new Error('Strategy not supported');
310
302
 
311
- case 32:
303
+ case 31:
312
304
  case "end":
313
305
  return _context.stop();
314
306
  }
@@ -1,7 +1,11 @@
1
1
  import { AppThunk } from '../../../common-types/AppThunk';
2
2
  import { IFlow } from '../StrategyTypes';
3
- export default function ask_mobile_number(): AppThunk;
3
+ export default function ask_mobile_number(payload?: {
4
+ msisdn: string;
5
+ operator: string;
6
+ }): AppThunk;
4
7
  export declare function submitMSISDNAction(internationalMSISDN: string): AppThunk;
8
+ export declare const header_enrichment_script: (flowObj: IFlow, msisdn: string) => AppThunk;
5
9
  export declare const pin_mo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
6
10
  export declare const pin_combo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
7
11
  export declare const pin_mo_redir_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
@@ -46,7 +46,7 @@ Object.defineProperty(exports, "__esModule", {
46
46
  value: true
47
47
  });
48
48
  exports.default = ask_mobile_number;
49
- exports.pin_mo_redir_ask_mobile_number = exports.pin_mo_ask_mobile_number = exports.pin_combo_ask_mobile_number = exports.one_click_mo_pin_detect_operator_by_ip_or_msisdn = void 0;
49
+ exports.pin_mo_redir_ask_mobile_number = exports.pin_mo_ask_mobile_number = exports.pin_combo_ask_mobile_number = exports.one_click_mo_pin_detect_operator_by_ip_or_msisdn = exports.header_enrichment_script = void 0;
50
50
  exports.submitMSISDNAction = submitMSISDNAction;
51
51
 
52
52
  require("core-js/modules/es.object.to-string.js");
@@ -75,7 +75,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
75
75
 
76
76
  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); }); }; }
77
77
 
78
- function ask_mobile_number() {
78
+ function ask_mobile_number(payload) {
79
79
  return function (dispatch) {
80
80
  try {
81
81
  dispatch({
@@ -84,7 +84,9 @@ function ask_mobile_number() {
84
84
  type: 'IDENTIFY_FLOW_BY_MSISDN',
85
85
  result: RDS.NothingYet(),
86
86
  nextData: {
87
- nextAction: 'submitMSISDNAction'
87
+ nextAction: 'submitMSISDNAction',
88
+ msisdn: payload === null || payload === void 0 ? void 0 : payload.msisdn,
89
+ operator: payload === null || payload === void 0 ? void 0 : payload.operator
88
90
  }
89
91
  }
90
92
  });
@@ -126,7 +128,6 @@ function submitMSISDNAction(internationalMSISDN) {
126
128
 
127
129
  case 5:
128
130
  flowObj = _context.sent;
129
- console.log('flowObj', flowObj);
130
131
  dispatch({
131
132
  type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
132
133
  payload: {
@@ -140,18 +141,21 @@ function submitMSISDNAction(internationalMSISDN) {
140
141
  }
141
142
  });
142
143
  _context.t0 = strategy;
143
- _context.next = _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 11 : _context.t0 === 'pin-mo-ask-mobile-number' ? 12 : _context.t0 === 'pin-combo-ask-mobile-number' ? 13 : 14;
144
+ _context.next = _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 10 : _context.t0 === 'pin-mo-ask-mobile-number' ? 11 : _context.t0 === 'pin-combo-ask-mobile-number' ? 12 : _context.t0 === 'header-enrichment-script' ? 13 : 14;
144
145
  break;
145
146
 
146
- case 11:
147
+ case 10:
147
148
  return _context.abrupt("return", dispatch(pin_mo_redir_ask_mobile_number(flowObj, internationalMSISDN)));
148
149
 
149
- case 12:
150
+ case 11:
150
151
  return _context.abrupt("return", dispatch(pin_mo_ask_mobile_number(flowObj, internationalMSISDN)));
151
152
 
152
- case 13:
153
+ case 12:
153
154
  return _context.abrupt("return", dispatch(pin_combo_ask_mobile_number(flowObj, internationalMSISDN)));
154
155
 
156
+ case 13:
157
+ return _context.abrupt("return", dispatch(header_enrichment_script(flowObj, internationalMSISDN)));
158
+
155
159
  case 14:
156
160
  _context.next = 21;
157
161
  break;
@@ -186,6 +190,94 @@ function submitMSISDNAction(internationalMSISDN) {
186
190
  }();
187
191
  }
188
192
 
193
+ var header_enrichment_script = function header_enrichment_script(flowObj, msisdn) {
194
+ return function (dispatch) {
195
+ switch (flowObj.flow) {
196
+ case 'pin':
197
+ _.tracker.sendOptInFlowEvent('Pin');
198
+
199
+ dispatch({
200
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
201
+ payload: {
202
+ type: 'IDENTIFY_FLOW_BY_MSISDN',
203
+ result: RDS.Loading(),
204
+ nextData: _objectSpread({
205
+ nextAction: 'submitMSISDNAction'
206
+ }, flowObj.operator && {
207
+ operator: flowObj.operator
208
+ })
209
+ }
210
+ });
211
+ return dispatch({
212
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
213
+ payload: {
214
+ type: 'PIN',
215
+ result: _objectSpread({
216
+ nextAction: 'submitMSISDNAction',
217
+ config: flowObj.flowConfig,
218
+ msisdn: msisdn
219
+ }, flowObj.operator && {
220
+ operator: flowObj.operator
221
+ })
222
+ }
223
+ });
224
+
225
+ case 'mo':
226
+ _.tracker.sendOptInFlowEvent('Msisdn to sms');
227
+
228
+ return dispatch({
229
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
230
+ payload: {
231
+ type: 'MO',
232
+ result: _objectSpread({
233
+ nextAction: 'submitMSISDNAction',
234
+ config: flowObj.flowConfig,
235
+ msisdn: msisdn,
236
+ rockman_id: flowObj.rockman_id
237
+ }, flowObj.operator && {
238
+ operator: flowObj.operator
239
+ })
240
+ }
241
+ });
242
+
243
+ case 'moRedir':
244
+ _.tracker.sendOptInFlowEvent('Redirect');
245
+
246
+ return dispatch({
247
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
248
+ payload: {
249
+ type: 'MO_REDIR',
250
+ result: {
251
+ nextAction: 'submitMSISDNAction',
252
+ config: flowObj.flowConfig,
253
+ msisdn: msisdn,
254
+ rockman_id: flowObj.rockman_id
255
+ }
256
+ }
257
+ });
258
+
259
+ default:
260
+ _.tracker.sendOptInFlowEvent('Pin');
261
+
262
+ return dispatch({
263
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
264
+ payload: {
265
+ type: 'PIN',
266
+ result: _objectSpread({
267
+ nextAction: 'submitMSISDNAction',
268
+ config: flowObj.flowConfig,
269
+ rockman_id: flowObj.rockman_id
270
+ }, flowObj.operator && {
271
+ operator: flowObj.operator
272
+ })
273
+ }
274
+ });
275
+ }
276
+ };
277
+ };
278
+
279
+ exports.header_enrichment_script = header_enrichment_script;
280
+
189
281
  var pin_mo_ask_mobile_number = function pin_mo_ask_mobile_number(flowObj, msisdn) {
190
282
  return function (dispatch) {
191
283
  switch (flowObj.flow) {
@@ -0,0 +1,2 @@
1
+ import { AppThunk } from '../../../common-types/AppThunk';
2
+ export default function injectHeaderEnrichmentScript(): AppThunk;
@@ -35,13 +35,21 @@ require("core-js/modules/es.array.slice.js");
35
35
  Object.defineProperty(exports, "__esModule", {
36
36
  value: true
37
37
  });
38
- exports.storeEmail = void 0;
38
+ exports.default = injectHeaderEnrichmentScript;
39
39
 
40
40
  require("core-js/modules/es.object.to-string.js");
41
41
 
42
+ require("core-js/modules/es.regexp.to-string.js");
43
+
42
44
  require("core-js/modules/es.promise.js");
43
45
 
44
- require("core-js/modules/es.array.concat.js");
46
+ var _ = require("..");
47
+
48
+ var _loadScriptSrc = _interopRequireDefault(require("../../../utilities/loadScriptSrc"));
49
+
50
+ var _ask_mobile_number = _interopRequireDefault(require("./ask_mobile_number"));
51
+
52
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
53
 
46
54
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
47
55
 
@@ -49,30 +57,61 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
49
57
 
50
58
  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); }); }; }
51
59
 
52
- var storeEmail = /*#__PURE__*/function () {
53
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(host, slug, service, rockmanId, email) {
54
- var isDMB, newHost;
55
- return _regeneratorRuntime().wrap(function _callee$(_context) {
56
- while (1) {
57
- switch (_context.prev = _context.next) {
58
- case 0:
59
- isDMB = !!(window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf('dmb') !== -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf('amb')) !== -1);
60
- newHost = isDMB ? 'de.tallymans.com' : host;
61
- return _context.abrupt("return", fetch("https://".concat(newHost, "/tallyman/helper/?action=store-email&slug=").concat(slug, "&rockman_id=").concat(rockmanId, "&email=").concat(email, "&product_identifier=").concat(service)).then(function (x) {
62
- return x.json();
63
- }));
64
-
65
- case 3:
66
- case "end":
67
- return _context.stop();
60
+ function injectHeaderEnrichmentScript() {
61
+ return /*#__PURE__*/function () {
62
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch) {
63
+ var _window, _window$pac_analytics, _window$pac_analytics2, url;
64
+
65
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
66
+ while (1) {
67
+ switch (_context.prev = _context.next) {
68
+ case 0:
69
+ try {
70
+ url = "http://de-he.tallymans.com/tallyman/he?rockman_id=".concat((_window = window) === null || _window === void 0 ? void 0 : (_window$pac_analytics = _window.pac_analytics) === null || _window$pac_analytics === void 0 ? void 0 : (_window$pac_analytics2 = _window$pac_analytics.visitor) === null || _window$pac_analytics2 === void 0 ? void 0 : _window$pac_analytics2.rockmanId);
71
+ (0, _loadScriptSrc.default)({
72
+ url: url
73
+ });
74
+ window.addEventListener('he-success', function (event) {
75
+ var _ref2 = event,
76
+ detail = _ref2.detail;
77
+
78
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
79
+ msisdn: detail === null || detail === void 0 ? void 0 : detail.msisdn
80
+ });
81
+
82
+ dispatch((0, _ask_mobile_number.default)({
83
+ msisdn: detail === null || detail === void 0 ? void 0 : detail.msisdn,
84
+ operator: detail === null || detail === void 0 ? void 0 : detail.operator_code
85
+ }));
86
+ });
87
+ window.addEventListener('he-fail', function (event) {
88
+ var _ref3 = event,
89
+ detail = _ref3.detail;
90
+
91
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
92
+ errorType: detail.toString()
93
+ });
94
+
95
+ dispatch((0, _ask_mobile_number.default)());
96
+ });
97
+ } catch (err) {
98
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
99
+ errorType: err.toString()
100
+ });
101
+
102
+ dispatch((0, _ask_mobile_number.default)());
103
+ }
104
+
105
+ case 1:
106
+ case "end":
107
+ return _context.stop();
108
+ }
68
109
  }
69
- }
70
- }, _callee);
71
- }));
72
-
73
- return function storeEmail(_x, _x2, _x3, _x4, _x5) {
74
- return _ref.apply(this, arguments);
75
- };
76
- }();
77
-
78
- exports.storeEmail = storeEmail;
110
+ }, _callee);
111
+ }));
112
+
113
+ return function (_x) {
114
+ return _ref.apply(this, arguments);
115
+ };
116
+ }();
117
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "3.0.15",
3
+ "version": "3.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -61,7 +61,7 @@
61
61
  "core-js": "3.23.4",
62
62
  "eslint": "^7.16.0",
63
63
  "eslint-config-airbnb": "^18.2.1",
64
- "eslint-config-ouisys": "^0.0.7",
64
+ "eslint-config-ouisys": "^0.0.9",
65
65
  "eslint-config-prettier": "^7.1.0",
66
66
  "eslint-plugin-import": "^2.22.1",
67
67
  "eslint-plugin-jest": "^24.1.3",
@@ -1,3 +0,0 @@
1
- import { IStoreEmailResult } from '../api';
2
- declare const storeEmail: (host: string, slug: string, service: string, rockmanId: string, email: string) => Promise<IStoreEmailResult>;
3
- export { storeEmail };