@everymatrix/general-player-login-form 0.0.209 → 0.0.214

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/general-player-login-form",
3
- "version": "0.0.209",
3
+ "version": "0.0.214",
4
4
  "main": "dist/general-player-login-form.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "0cdc5a5de8fee8ead3a559d272a436d01db74a1c"
39
+ "gitHead": "504c889b442d1a70906bdb23ddaef68e256963b6"
40
40
  }
@@ -4,6 +4,12 @@
4
4
  import { onMount } from "svelte";
5
5
  import { isMobile } from 'rvhelper';
6
6
 
7
+ import {
8
+ isNative,
9
+ call as callNative,
10
+ registerEventListener as registerNativeEventListener,
11
+ } from 'js-native-bridge';
12
+
7
13
  export let imagedesktop:string = '';
8
14
  export let captchakey:string = '';
9
15
 
@@ -25,6 +31,13 @@
25
31
  let isPasswordVisible:boolean = false;
26
32
  let isFormDataInvalid:boolean = true;
27
33
 
34
+ let isOnNative:boolean = !!isNative(userAgent);
35
+ let waitingForCredentials:boolean = isOnNative;
36
+
37
+ let nativeCredentials:any = {};
38
+
39
+ const captchaKey = '6Lc7w8YcAAAAAEMHc_VNN9bqfVnILoUOHSHyZ0yn';
40
+
28
41
  const regexValidators = {
29
42
  user: /^(?!(?:.*\d){9})(?=(?:.*[a-zA-Z]){2})^[a-zA-Z\d]*$/,
30
43
  email: /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,
@@ -132,6 +145,32 @@
132
145
  window.addEventListener('message', messageHandler, false);
133
146
  window.postMessage({ type: "LoginRegisterModalActive" }, window.location.href);
134
147
 
148
+ if (isOnNative) {
149
+ registerNativeEventListener(
150
+ 'GET_CREDENTIALS',
151
+ (credentials:any):void => {
152
+ if (waitingForCredentials) {
153
+ if (credentials) {
154
+ const { username, password } = credentials;
155
+
156
+ userValue = username;
157
+ userPassword = password;
158
+
159
+ submitLoginForm();
160
+ } else {
161
+ waitingForCredentials = false;
162
+ }
163
+ }
164
+ }
165
+ );
166
+
167
+ const methodFound = callNative('GET_CREDENTIALS');
168
+
169
+ if (!methodFound) {
170
+ waitingForCredentials = false;
171
+ }
172
+ }
173
+
135
174
  mobileView = isMobile(userAgent);
136
175
 
137
176
  return () => {