ouisys-engine 2.1.50 → 2.1.53

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.
@@ -54,8 +54,6 @@ require("regenerator-runtime/runtime");
54
54
 
55
55
  var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
56
56
 
57
- var _loadScriptInnerHtml = _interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));
58
-
59
57
  var _loadScriptSrc = _interopRequireDefault(require("../../utilities/loadScriptSrc"));
60
58
 
61
59
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -177,11 +175,10 @@ var getGoogleReCaptchaConfig = /*#__PURE__*/function () {
177
175
 
178
176
  if (result.success === true) {
179
177
  srcUrl = "https://www.google.com/recaptcha/api.js?render=".concat(result.site_key);
180
- (0, _loadScriptSrc.default)(srcUrl);
181
- setTimeout(function () {
182
- var script = "\n grecaptcha.ready(function() {\n grecaptcha.execute(\"".concat(result.site_key, "\", {action: 'submit'}).then(function(token) {\n // To be used by tallyman\n window.reCaptchaToken = token;\n console.log(\"-------\" + token);\n });\n });\n ");
183
- (0, _loadScriptInnerHtml.default)(script, true);
184
- }, 0);
178
+ (0, _loadScriptSrc.default)({
179
+ url: srcUrl,
180
+ key: result.site_key
181
+ });
185
182
  }
186
183
 
187
184
  return _context2.abrupt("return", result);
@@ -205,7 +205,9 @@ function getRedirectUrlAction(_ref) {
205
205
  redirect_url: _redirect_url
206
206
  });
207
207
 
208
- window.location.href = _redirect_url;
208
+ setTimeout(function () {
209
+ window.location.href = _redirect_url;
210
+ }, 3000);
209
211
  } else {
210
212
  dispatch({
211
213
  type: "GET_REDIRECT_URL",
@@ -1,2 +1,5 @@
1
- declare const loadScriptSrc: (src: string) => void;
1
+ declare const loadScriptSrc: ({ url, key }: {
2
+ url: string;
3
+ key: string;
4
+ }) => void;
2
5
  export default loadScriptSrc;
@@ -5,13 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var loadScriptSrc = function loadScriptSrc(src) {
8
+ var _loadScriptInnerHtml = _interopRequireDefault(require("./loadScriptInnerHtml"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var loadScriptSrc = function loadScriptSrc(_ref) {
13
+ var url = _ref.url,
14
+ key = _ref.key;
9
15
  var script = document.createElement('script');
10
16
  script.type = 'text/javascript';
11
- script.src = src;
17
+ script.src = url;
12
18
  var headElem = document.getElementsByTagName('head')[0];
13
19
  headElem.insertBefore(script, headElem.firstChild);
14
20
  console.log('loadScript');
21
+
22
+ script.onload = function () {
23
+ var scriptInner = "\n grecaptcha.ready(function() {\n grecaptcha.execute(\"".concat(key, "\", {action: 'submit'}).then(function(token) {\n // To be used by tallyman\n window.reCaptchaToken = token;\n console.log(\"-------\" + token);\n });\n });\n ");
24
+ (0, _loadScriptInnerHtml.default)(scriptInner, true);
25
+ };
15
26
  };
16
27
 
17
28
  var _default = loadScriptSrc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "2.1.50",
3
+ "version": "2.1.53",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -48,19 +48,7 @@ export const getGoogleReCaptchaConfig = async ({ slug, country, device, host }:I
48
48
  const result: IGoogleReCaptcha = await window.tallymanApi.getGoogleCaptcha(host, country, slug, device, domain);
49
49
  if(result.success === true){
50
50
  const srcUrl = `https://www.google.com/recaptcha/api.js?render=${result.site_key}`;
51
- loadScriptSrc(srcUrl);
52
- setTimeout(() => {
53
- const script = `
54
- grecaptcha.ready(function() {
55
- grecaptcha.execute("${result.site_key}", {action: 'submit'}).then(function(token) {
56
- // To be used by tallyman
57
- window.reCaptchaToken = token;
58
- console.log("-------" + token);
59
- });
60
- });
61
- `;
62
- loadScriptInnerHtml(script, true);
63
- }, 0);
51
+ loadScriptSrc({url:srcUrl, key: result.site_key});
64
52
  }
65
53
  return result;
66
54
  }
@@ -12,7 +12,6 @@ import { IHash } from "../strategy/StrategyTypes";
12
12
 
13
13
  //ACTION CREATORS
14
14
  export function getRedirectUrlAction({extraParams, autoRedirect = false, isGetRedirectBupperWay = false}:{extraParams?:ILinkExtraParams, autoRedirect?:boolean, isGetRedirectBupperWay?:boolean}):AppThunk{
15
-
16
15
  return async (dispatch, store)=>{
17
16
  const {currentState} = store().strategy
18
17
  if(currentState.type === "ONE_CLICK"){
@@ -103,7 +102,9 @@ export function getRedirectUrlAction({extraParams, autoRedirect = false, isGetRe
103
102
  if(autoRedirect == true || window.isAutoFraudScreener === true){
104
103
  tracker.advancedInFlow('tallyman.v1-one-click', 'click-redirect-url', {redirect_url});
105
104
 
106
- window.location.href = redirect_url;
105
+ setTimeout(() => {
106
+ window.location.href = redirect_url;
107
+ }, 3000);
107
108
  }else{
108
109
  dispatch({
109
110
  type: "GET_REDIRECT_URL",
@@ -1,10 +1,23 @@
1
- const loadScriptSrc = (src:string)=>{
1
+ import loadScriptInnerHtml from "./loadScriptInnerHtml";
2
+
3
+ const loadScriptSrc = ({url, key}:{url:string, key:string})=>{
2
4
  var script = document.createElement('script');
3
5
  script.type = 'text/javascript';
4
- script.src = src;
6
+ script.src = url;
5
7
  var headElem = document.getElementsByTagName('head')[0];
6
8
  headElem.insertBefore(script, headElem.firstChild)
7
- console.log('loadScript');
9
+ script.onload = () => {
10
+ const scriptInner = `
11
+ grecaptcha.ready(function() {
12
+ grecaptcha.execute("${key}", {action: 'submit'}).then(function(token) {
13
+ // To be used by tallyman
14
+ window.reCaptchaToken = token;
15
+ console.log("-------" + token);
16
+ });
17
+ });
18
+ `;
19
+ loadScriptInnerHtml(scriptInner, true);
20
+ }
8
21
  }
9
22
 
10
23
  export default loadScriptSrc;