ouisys-engine 2.1.67 → 2.1.70

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.
package/.eslintrc.js ADDED
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+
3
+ extends: ['eslint-config-ouisys'],
4
+
5
+ };
@@ -0,0 +1,3 @@
1
+ build/
2
+ storybook-static/
3
+ stats.json
@@ -0,0 +1,6 @@
1
+ {
2
+ "eslint.format.enable": true,
3
+ "editor.codeActionsOnSave": {
4
+ "source.fixAll.eslint": true
5
+ }
6
+ }
@@ -59,6 +59,8 @@ var _utilities = require("../../utilities");
59
59
 
60
60
  var _loadScriptInnerHtml = _interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));
61
61
 
62
+ var _utils = require("../strategy/utils");
63
+
62
64
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
63
65
 
64
66
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
@@ -170,24 +172,33 @@ function _submitMSISDNWithConfig() {
170
172
  }
171
173
 
172
174
  var startEvinaAgency = function startEvinaAgency(config) {
173
- var host = config.host;
174
- var newHost = (0, _utilities.getHost)({
175
- host: host
176
- });
177
- var rockmanId = window.pac_analytics.visitor.rockmanId;
178
- var url = "https://".concat(newHost, "/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=").concat(rockmanId);
179
- fetch(url).then(function (x) {
180
- return x.text();
181
- }).then(function (txt) {
182
- return (0, _loadScriptInnerHtml.default)(txt);
183
- }).then(function () {
184
- console.log('Ev ready');
185
- var event = new Event('DCBProtectRun');
186
-
187
- if (typeof window != "undefined") {
188
- document.dispatchEvent(event);
189
- }
190
- });
175
+ try {
176
+ var configs = (0, _utils.getConfig)();
177
+ var defaultFlowConfig = configs.strategyConfigs.default;
178
+
179
+ var _ref = !!config ? config : defaultFlowConfig.flowConfig,
180
+ host = _ref.host;
181
+
182
+ var newHost = (0, _utilities.getHost)({
183
+ host: host
184
+ });
185
+ var rockmanId = window.pac_analytics.visitor.rockmanId;
186
+ var url = "https://".concat(newHost, "/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=").concat(rockmanId);
187
+ fetch(url).then(function (x) {
188
+ return x.text();
189
+ }).then(function (txt) {
190
+ return (0, _loadScriptInnerHtml.default)(txt);
191
+ }).then(function () {
192
+ console.log('Ev ready');
193
+ var event = new Event('DCBProtectRun');
194
+
195
+ if (typeof window != "undefined") {
196
+ document.dispatchEvent(event);
197
+ }
198
+ });
199
+ } catch (err) {
200
+ console.error("startEvinaAgency ERROR", err);
201
+ }
191
202
  };
192
203
 
193
204
  exports.startEvinaAgency = startEvinaAgency;
@@ -178,7 +178,7 @@ function submitMSISDNOnce(_x7, _x8, _x9, _x10) {
178
178
 
179
179
  function _submitMSISDNOnce() {
180
180
  _submitMSISDNOnce = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, config, internationalMSISDN, extraParams) {
181
- var submissionError, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, kwCodesWithMcpShied, mcpShieldResult;
181
+ var submissionError, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, codesWithMcpShied, mcpShieldResult;
182
182
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
183
183
  while (1) {
184
184
  switch (_context3.prev = _context3.next) {
@@ -246,16 +246,22 @@ function _submitMSISDNOnce() {
246
246
  throw error;
247
247
 
248
248
  case 27:
249
- kwCodesWithMcpShied = {
249
+ codesWithMcpShied = {
250
250
  kw: {
251
251
  kw_viva: "kw_viva"
252
252
  },
253
253
  k2: {
254
254
  k2_viva: "k2_viva"
255
+ },
256
+ sa: {
257
+ sa_zain: "sa_zain",
258
+ sa_mobily: "sa_mobily",
259
+ sa_virgin: "sa_virgin",
260
+ sa_stc: "sa_stc"
255
261
  }
256
262
  };
257
263
 
258
- if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() == "iq"))) {
264
+ if (!(country && result.operator && (codesWithMcpShied[country.toLowerCase()] && codesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() == "iq"))) {
259
265
  _context3.next = 39;
260
266
  break;
261
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "2.1.67",
3
+ "version": "2.1.70",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ "semi": true,
3
+ "trailingComma": "none",
4
+ "singleQuote": true,
5
+ "printWidth": 120,
6
+ "tabWidth": 2
7
+ };
@@ -5,6 +5,7 @@ import * as RDS from "../../common-types/RemoteDataState";
5
5
  import loadScriptSrc from "../../utilities/loadScriptSrc";
6
6
  import { getHost, isDMBCheck } from "../../utilities";
7
7
  import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
8
+ import { getConfig } from "../strategy/utils";
8
9
 
9
10
 
10
11
  export default async function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: {[key: string]: string}): Promise<string> {
@@ -37,18 +38,26 @@ export async function submitMSISDNWithConfig(window: Window, config: IConfig, in
37
38
  }
38
39
 
39
40
  export const startEvinaAgency = (config: IConfig)=>{
40
- const { host } = config
41
- const newHost = getHost({host});
42
- const rockmanId = window.pac_analytics.visitor.rockmanId;
43
- const url = `https://${newHost}/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=${rockmanId}`;
41
+ try{
42
+ const configs = getConfig();
43
+ const defaultFlowConfig = configs.strategyConfigs.default;
44
+
45
+ const { host } = !!config ? config : defaultFlowConfig.flowConfig;
46
+ const newHost = getHost({host});
47
+ const rockmanId = window.pac_analytics.visitor.rockmanId;
48
+ const url = `https://${newHost}/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=${rockmanId}`;
49
+
50
+ fetch(url).then((x)=>x.text()).then((txt)=>loadScriptInnerHtml(txt)).then(()=>{
51
+ console.log('Ev ready');
52
+ let event = new Event('DCBProtectRun');
53
+ if(typeof window != "undefined"){
54
+ document.dispatchEvent(event);
55
+ }
56
+ });
57
+ }catch(err){
58
+ console.error("startEvinaAgency ERROR", err)
59
+ }
44
60
 
45
- fetch(url).then((x)=>x.text()).then((txt)=>loadScriptInnerHtml(txt)).then(()=>{
46
- console.log('Ev ready');
47
- let event = new Event('DCBProtectRun');
48
- if(typeof window != "undefined"){
49
- document.dispatchEvent(event);
50
- }
51
- });
52
61
  }
53
62
 
54
63
  export const mockedMSISDNEntrySuccess : IMoRedirFlowReducerState = {
@@ -87,16 +87,22 @@ async function submitMSISDNOnce(window: Window, config: IConfig, internationalMS
87
87
  throw error
88
88
  } else {
89
89
 
90
- const kwCodesWithMcpShied:{[key:string]:{[key:string]:string}} = {
90
+ const codesWithMcpShied:{[key:string]:{[key:string]:string}} = {
91
91
  kw:{
92
92
  kw_viva:"kw_viva"
93
93
  },
94
94
  k2:{
95
95
  k2_viva:"k2_viva"
96
+ },
97
+ sa:{
98
+ sa_zain:"sa_zain",
99
+ sa_mobily: "sa_mobily",
100
+ sa_virgin: "sa_virgin",
101
+ sa_stc: "sa_stc"
96
102
  }
97
103
  }
98
104
  if(country && result.operator && (
99
- (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]) ||
105
+ (codesWithMcpShied[country.toLowerCase()] && codesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]) ||
100
106
  country.toLowerCase() == "iq"
101
107
  )
102
108
  ){