ouisys-engine 3.0.16 → 3.0.17

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.
@@ -3,9 +3,10 @@ import { IFlow } from '../StrategyTypes';
3
3
  export default function ask_mobile_number(payload?: {
4
4
  msisdn: string;
5
5
  operator: string;
6
+ isHeaderEnrichmentSuccess: boolean;
6
7
  }): AppThunk;
7
8
  export declare function submitMSISDNAction(internationalMSISDN: string): AppThunk;
8
- export declare const header_enrichment_script: (flowObj: IFlow, msisdn: string) => AppThunk;
9
+ export declare const header_enrichment_script: (flowObj: IFlow, msisdn: string, isHeaderEnrichmentSuccess: boolean) => AppThunk;
9
10
  export declare const pin_mo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
10
11
  export declare const pin_combo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
11
12
  export declare const pin_mo_redir_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
@@ -86,7 +86,8 @@ function ask_mobile_number(payload) {
86
86
  nextData: {
87
87
  nextAction: 'submitMSISDNAction',
88
88
  msisdn: payload === null || payload === void 0 ? void 0 : payload.msisdn,
89
- operator: payload === null || payload === void 0 ? void 0 : payload.operator
89
+ operator: payload === null || payload === void 0 ? void 0 : payload.operator,
90
+ isHeaderEnrichmentSuccess: (payload === null || payload === void 0 ? void 0 : payload.isHeaderEnrichmentSuccess) || false
90
91
  }
91
92
  }
92
93
  });
@@ -104,14 +105,25 @@ function ask_mobile_number(payload) {
104
105
 
105
106
  function submitMSISDNAction(internationalMSISDN) {
106
107
  return /*#__PURE__*/function () {
107
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch) {
108
- var _getConfig, strategy, flowObj, errorType;
108
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, store) {
109
+ var _state$strategy, _strategyState$result;
110
+
111
+ var state, strategyState, nextData, _getConfig, strategy, flowObj, errorType;
109
112
 
110
113
  return _regeneratorRuntime().wrap(function _callee$(_context) {
111
114
  while (1) {
112
115
  switch (_context.prev = _context.next) {
113
116
  case 0:
114
- _context.prev = 0;
117
+ state = store();
118
+ strategyState = state === null || state === void 0 ? void 0 : (_state$strategy = state.strategy) === null || _state$strategy === void 0 ? void 0 : _state$strategy.currentState; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
119
+ // @ts-ignore
120
+ // eslint-disable-next-line no-console
121
+
122
+ console.log('strategyState', strategyState); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
123
+ // @ts-ignore
124
+
125
+ nextData = strategyState === null || strategyState === void 0 ? void 0 : (_strategyState$result = strategyState.result) === null || _strategyState$result === void 0 ? void 0 : _strategyState$result.nextData;
126
+ _context.prev = 4;
115
127
  dispatch({
116
128
  type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
117
129
  payload: {
@@ -123,10 +135,10 @@ function submitMSISDNAction(internationalMSISDN) {
123
135
  }
124
136
  });
125
137
  _getConfig = (0, _utils.getConfig)(), strategy = _getConfig.strategy;
126
- _context.next = 5;
138
+ _context.next = 9;
127
139
  return (0, _utils.determineFlowByMsidn)(internationalMSISDN);
128
140
 
129
- case 5:
141
+ case 9:
130
142
  flowObj = _context.sent;
131
143
  dispatch({
132
144
  type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
@@ -141,30 +153,30 @@ function submitMSISDNAction(internationalMSISDN) {
141
153
  }
142
154
  });
143
155
  _context.t0 = strategy;
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;
156
+ _context.next = _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 14 : _context.t0 === 'pin-mo-ask-mobile-number' ? 15 : _context.t0 === 'pin-combo-ask-mobile-number' ? 16 : _context.t0 === 'header-enrichment-script' ? 17 : 18;
145
157
  break;
146
158
 
147
- case 10:
159
+ case 14:
148
160
  return _context.abrupt("return", dispatch(pin_mo_redir_ask_mobile_number(flowObj, internationalMSISDN)));
149
161
 
150
- case 11:
162
+ case 15:
151
163
  return _context.abrupt("return", dispatch(pin_mo_ask_mobile_number(flowObj, internationalMSISDN)));
152
164
 
153
- case 12:
165
+ case 16:
154
166
  return _context.abrupt("return", dispatch(pin_combo_ask_mobile_number(flowObj, internationalMSISDN)));
155
167
 
156
- case 13:
157
- return _context.abrupt("return", dispatch(header_enrichment_script(flowObj, internationalMSISDN)));
168
+ case 17:
169
+ return _context.abrupt("return", dispatch(header_enrichment_script(flowObj, internationalMSISDN, (nextData === null || nextData === void 0 ? void 0 : nextData.isHeaderEnrichmentSuccess) || false)));
158
170
 
159
- case 14:
160
- _context.next = 21;
171
+ case 18:
172
+ _context.next = 25;
161
173
  break;
162
174
 
163
- case 16:
164
- _context.prev = 16;
165
- _context.t1 = _context["catch"](0);
175
+ case 20:
176
+ _context.prev = 20;
177
+ _context.t1 = _context["catch"](4);
166
178
  console.warn(_context.t1);
167
- errorType = _context.t1.type === 'SEAlreadySubscribed' ? 'AlreadySubscribed' : _context.t1.type == 'SEInvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
179
+ errorType = _context.t1.type === 'SEAlreadySubscribed' ? 'AlreadySubscribed' : _context.t1.type === 'SEInvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
168
180
  dispatch({
169
181
  type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT_ERROR',
170
182
  payload: {
@@ -176,21 +188,21 @@ function submitMSISDNAction(internationalMSISDN) {
176
188
  }
177
189
  });
178
190
 
179
- case 21:
191
+ case 25:
180
192
  case "end":
181
193
  return _context.stop();
182
194
  }
183
195
  }
184
- }, _callee, null, [[0, 16]]);
196
+ }, _callee, null, [[4, 20]]);
185
197
  }));
186
198
 
187
- return function (_x) {
199
+ return function (_x, _x2) {
188
200
  return _ref.apply(this, arguments);
189
201
  };
190
202
  }();
191
203
  }
192
204
 
193
- var header_enrichment_script = function header_enrichment_script(flowObj, msisdn) {
205
+ var header_enrichment_script = function header_enrichment_script(flowObj, msisdn, isHeaderEnrichmentSuccess) {
194
206
  return function (dispatch) {
195
207
  switch (flowObj.flow) {
196
208
  case 'pin':
@@ -202,7 +214,8 @@ var header_enrichment_script = function header_enrichment_script(flowObj, msisdn
202
214
  type: 'IDENTIFY_FLOW_BY_MSISDN',
203
215
  result: RDS.Loading(),
204
216
  nextData: _objectSpread({
205
- nextAction: 'submitMSISDNAction'
217
+ nextAction: 'submitMSISDNAction',
218
+ isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
206
219
  }, flowObj.operator && {
207
220
  operator: flowObj.operator
208
221
  })
@@ -215,7 +228,8 @@ var header_enrichment_script = function header_enrichment_script(flowObj, msisdn
215
228
  result: _objectSpread({
216
229
  nextAction: 'submitMSISDNAction',
217
230
  config: flowObj.flowConfig,
218
- msisdn: msisdn
231
+ msisdn: msisdn,
232
+ isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
219
233
  }, flowObj.operator && {
220
234
  operator: flowObj.operator
221
235
  })
@@ -233,6 +247,7 @@ var header_enrichment_script = function header_enrichment_script(flowObj, msisdn
233
247
  nextAction: 'submitMSISDNAction',
234
248
  config: flowObj.flowConfig,
235
249
  msisdn: msisdn,
250
+ isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess,
236
251
  rockman_id: flowObj.rockman_id
237
252
  }, flowObj.operator && {
238
253
  operator: flowObj.operator
@@ -251,6 +266,7 @@ var header_enrichment_script = function header_enrichment_script(flowObj, msisdn
251
266
  nextAction: 'submitMSISDNAction',
252
267
  config: flowObj.flowConfig,
253
268
  msisdn: msisdn,
269
+ isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess,
254
270
  rockman_id: flowObj.rockman_id
255
271
  }
256
272
  }
@@ -81,7 +81,8 @@ function injectHeaderEnrichmentScript() {
81
81
 
82
82
  dispatch((0, _ask_mobile_number.default)({
83
83
  msisdn: detail === null || detail === void 0 ? void 0 : detail.msisdn,
84
- operator: detail === null || detail === void 0 ? void 0 : detail.operator_code
84
+ operator: detail === null || detail === void 0 ? void 0 : detail.operator_code,
85
+ isHeaderEnrichmentSuccess: true
85
86
  }));
86
87
  });
87
88
  window.addEventListener('he-fail', function (event) {
@@ -95,8 +96,10 @@ function injectHeaderEnrichmentScript() {
95
96
  dispatch((0, _ask_mobile_number.default)());
96
97
  });
97
98
  } catch (err) {
99
+ console.error(err);
100
+
98
101
  _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
99
- errorType: err.toString()
102
+ errorType: err
100
103
  });
101
104
 
102
105
  dispatch((0, _ask_mobile_number.default)());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "3.0.16",
3
+ "version": "3.0.17",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",