@everymatrix/general-player-sms-verification-form 1.0.15 → 1.1.0

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-sms-verification-form",
3
- "version": "1.0.15",
3
+ "version": "1.1.0",
4
4
  "main": "index.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": "0ee1d4bccc4964628711251119148f0a04ba10df"
39
+ "gitHead": "62036ada223f2b4f7b64d99a81ab2229ecba3cf1"
40
40
  }
@@ -10,6 +10,8 @@
10
10
  export let playerid:string = '';
11
11
  export let smstemplate:string = 'Please use this code {0} to activate your accout';
12
12
  export let number:string = '';
13
+ export let clientstyling:string = '';
14
+ export let clientstylingurl:string = '';
13
15
  export let translationUrl:string = '';
14
16
 
15
17
  let smsCode: number;
@@ -17,6 +19,8 @@
17
19
  let smsSendApiFailed:boolean = false;
18
20
  let secondsLeft:number = 60;
19
21
  let timer:any;
22
+ let customStylingContainer:HTMLElement;
23
+ let displayNone:boolean = false;
20
24
 
21
25
  setupI18n({ withLocale: 'en', translations: {}});
22
26
 
@@ -112,12 +116,36 @@
112
116
  }
113
117
  }
114
118
 
119
+ const setClientStyling = ():void => {
120
+ let sheet = document.createElement('style');
121
+ sheet.innerHTML = clientstyling;
122
+ customStylingContainer.appendChild(sheet);
123
+ }
124
+
125
+ const setClientStylingURL = ():void => {
126
+ displayNone = true;
127
+
128
+ let url:URL = new URL(clientstylingurl);
129
+ let cssFile:HTMLElement = document.createElement('style');
130
+
131
+ fetch(url.href)
132
+ .then((res:any) => res.text())
133
+ .then((data:any) => {
134
+ cssFile.innerHTML = data
135
+
136
+ setTimeout(() => { customStylingContainer.appendChild(cssFile) }, 1);
137
+ setTimeout(() => { displayNone = false; }, 500);
138
+ });
139
+ }
140
+
115
141
  $: tokenid && playerid && endpoint;
142
+ $: clientstyling && customStylingContainer && setClientStyling();
143
+ $: clientstylingurl && customStylingContainer && setClientStylingURL();
116
144
  $: translationUrl && setTranslationUrl();
117
145
  </script>
118
146
 
119
147
 
120
- <div class="Container SmsVerificationContainer" part="SmsVerificationContainer">
148
+ <div class="Container SmsVerificationContainer" bind:this={customStylingContainer} part="SmsVerificationContainer">
121
149
  <h3 class="Title" part="Title">
122
150
  {#if isSmsValid}
123
151
  {$_('smsVerification.title')}