@everymatrix/temporary-consents 1.24.7 → 1.26.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.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-51051de1.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
- const SUPPORTED_LANGUAGES = ['en'];
8
+ const SUPPORTED_LANGUAGES = ['en', 'hr'];
9
9
  let TRANSLATIONS = {
10
10
  en: {
11
11
  title: 'Participation conditions',
@@ -13,6 +13,13 @@ let TRANSLATIONS = {
13
13
  declineButton: 'Decline and log out',
14
14
  acceptButton: 'Accept',
15
15
  loading: 'Please wait, loading...'
16
+ },
17
+ hr: {
18
+ title: 'Uvjeti sudjelovanja',
19
+ description: 'Važno: Potrebna je potpuna verifikacija kako biste mogli koristiti našu cjelokupnu ponudu. Ako potvrda nije dovršena, nije moguće podići i račun za klađenje bit će zaključan za {daysUntilLockout} dana.',
20
+ declineButton: 'Odbijte i odjavite se',
21
+ acceptButton: 'Prihvatiti',
22
+ loading: 'Molimo pričekajte, učitavanje...'
16
23
  }
17
24
  };
18
25
  const getTranslations = (url) => {
@@ -1,5 +1,5 @@
1
1
  const DEFAULT_LANGUAGE = 'en';
2
- const SUPPORTED_LANGUAGES = ['en'];
2
+ const SUPPORTED_LANGUAGES = ['en', 'hr'];
3
3
  let TRANSLATIONS = {
4
4
  en: {
5
5
  title: 'Participation conditions',
@@ -7,6 +7,13 @@ let TRANSLATIONS = {
7
7
  declineButton: 'Decline and log out',
8
8
  acceptButton: 'Accept',
9
9
  loading: 'Please wait, loading...'
10
+ },
11
+ hr: {
12
+ title: 'Uvjeti sudjelovanja',
13
+ description: 'Važno: Potrebna je potpuna verifikacija kako biste mogli koristiti našu cjelokupnu ponudu. Ako potvrda nije dovršena, nije moguće podići i račun za klađenje bit će zaključan za {daysUntilLockout} dana.',
14
+ declineButton: 'Odbijte i odjavite se',
15
+ acceptButton: 'Prihvatiti',
16
+ loading: 'Molimo pričekajte, učitavanje...'
10
17
  }
11
18
  };
12
19
  export const getTranslations = (url) => {
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
- const SUPPORTED_LANGUAGES = ['en'];
4
+ const SUPPORTED_LANGUAGES = ['en', 'hr'];
5
5
  let TRANSLATIONS = {
6
6
  en: {
7
7
  title: 'Participation conditions',
@@ -9,6 +9,13 @@ let TRANSLATIONS = {
9
9
  declineButton: 'Decline and log out',
10
10
  acceptButton: 'Accept',
11
11
  loading: 'Please wait, loading...'
12
+ },
13
+ hr: {
14
+ title: 'Uvjeti sudjelovanja',
15
+ description: 'Važno: Potrebna je potpuna verifikacija kako biste mogli koristiti našu cjelokupnu ponudu. Ako potvrda nije dovršena, nije moguće podići i račun za klađenje bit će zaključan za {daysUntilLockout} dana.',
16
+ declineButton: 'Odbijte i odjavite se',
17
+ acceptButton: 'Prihvatiti',
18
+ loading: 'Molimo pričekajte, učitavanje...'
12
19
  }
13
20
  };
14
21
  const getTranslations = (url) => {
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, h } from './index-0f95c245.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
- const SUPPORTED_LANGUAGES = ['en'];
4
+ const SUPPORTED_LANGUAGES = ['en', 'hr'];
5
5
  let TRANSLATIONS = {
6
6
  en: {
7
7
  title: 'Participation conditions',
@@ -9,6 +9,13 @@ let TRANSLATIONS = {
9
9
  declineButton: 'Decline and log out',
10
10
  acceptButton: 'Accept',
11
11
  loading: 'Please wait, loading...'
12
+ },
13
+ hr: {
14
+ title: 'Uvjeti sudjelovanja',
15
+ description: 'Važno: Potrebna je potpuna verifikacija kako biste mogli koristiti našu cjelokupnu ponudu. Ako potvrda nije dovršena, nije moguće podići i račun za klađenje bit će zaključan za {daysUntilLockout} dana.',
16
+ declineButton: 'Odbijte i odjavite se',
17
+ acceptButton: 'Prihvatiti',
18
+ loading: 'Molimo pričekajte, učitavanje...'
12
19
  }
13
20
  };
14
21
  const getTranslations = (url) => {
@@ -0,0 +1 @@
1
+ import{r as t,h as e}from"./p-c8fa79f6.js";const o=["en","hr"];let n={en:{title:"Participation conditions",description:"Important: Full verification is required in order to be able to use our entire offer. If verification is not completed, it is not possible to withdraw and the betting account will be locked in {daysUntilLockout} days.",declineButton:"Decline and log out",acceptButton:"Accept",loading:"Please wait, loading..."},hr:{title:"Uvjeti sudjelovanja",description:"Važno: Potrebna je potpuna verifikacija kako biste mogli koristiti našu cjelokupnu ponudu. Ako potvrda nije dovršena, nije moguće podići i račun za klađenje bit će zaključan za {daysUntilLockout} dana.",declineButton:"Odbijte i odjavite se",acceptButton:"Prihvatiti",loading:"Molimo pričekajte, učitavanje..."}};const i=(t,e,i)=>{const s=e;let r=n[void 0!==s&&o.includes(s)?s:"en"][t];if(void 0!==i)for(const[t,e]of Object.entries(i.values)){const o=new RegExp(`{${t}}`,"g");r=r.replace(o,e)}return r},s=class{constructor(e){t(this,e),this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.stylingAppends=!1,this.isLoading=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{e.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(e)}),1)})).catch((t=>{console.log("error ",t)}))}}componentWillLoad(){const t=[];if(this.endpoint&&this.userId){const e=this.getConsents().then((t=>{this.temporaryAccountConsent=t.consents.some((t=>"temporaryaccountconsent"==t.tagCode))}));t.push(e)}if(this.translationUrl){const o=(e=this.translationUrl,new Promise((t=>{fetch(e).then((t=>t.json())).then((e=>{Object.keys(e).forEach((t=>{for(let o in e[t])n[t][o]=e[t][o]})),t(!0)}))})));t.push(o)}var e;return Promise.all(t)}componentDidRender(){!this.stylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}getConsents(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),e=new Headers;e.append("X-SessionId",this.sessionId),e.append("Accept","application/json");const o={method:"GET",headers:e};return new Promise(((e,n)=>{this.isLoading=!0,fetch(t.href,o).then((t=>t.json())).then((t=>{e(t)})).catch((t=>{console.error(t),n(t)})).finally((()=>{this.isLoading=!1}))}))}setConsents(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),e=new Headers;e.append("X-SessionId",this.sessionId),e.append("Accept","application/json"),e.append("Content-Type","application/json");const o={method:"POST",headers:e,body:JSON.stringify({consents:[{tagCode:"temporaryaccountconsent",note:"",status:1}]})};return new Promise(((e,n)=>{this.isLoading=!0,fetch(t.href,o).then((t=>t.json())).then((t=>{e(t)})).catch((t=>{console.error(t),n(t)})).finally((()=>{this.isLoading=!1}))}))}handleDecline(){window.postMessage({type:"TemporaryConsentsDeclined"},window.location.href)}handleAccept(){this.setConsents(),window.postMessage({type:"TemporaryConsentsAccepted"},window.location.href)}render(){if(this.temporaryAccountConsent)return this.isLoading?e("p",null,i("loading",this.lang)):e("div",{class:"TemporaryConsents",ref:t=>this.stylingContainer=t},e("h2",{class:"TemporaryConsentsTitle"}," ",i("title",this.lang)," "),e("p",{class:"TemporaryConsentsText"}," ",i("description",this.lang,{values:{daysUntilLockout:this.daysUntilLockout}})," "),e("div",{class:"TemporaryConsentsButtonsWrapper"},e("button",{class:"TemporaryConsentsButton TemporaryConsentsButtonDecline",onClick:()=>this.handleDecline()},i("declineButton",this.lang)),e("button",{class:"TemporaryConsentsButton TemporaryConsentsButtonAccept",onClick:this.handleAccept},i("acceptButton",this.lang))))}};s.style="*,*::after,*::before{box-sizing:border-box;padding:0;margin:0}:host{display:block}.TemporaryConsents{max-width:500px;display:flex;gap:35px;flex-direction:column;box-shadow:0px 1px 5px 1px rgba(0, 0, 0, 0.1);padding:20px;font-family:sans-serif}.TemporaryConsentsTitle{text-align:left;font-family:inherit;color:#000;font-weight:400;font-size:18px;display:block;border-bottom:1px solid #000;padding-bottom:10px}.TemporaryConsentsText{font-family:inherit;font-weight:300;font-size:16px}.TemporaryConsentsButtonsWrapper{display:flex;justify-content:space-evenly;gap:50px}.TemporaryConsentsButton{font-family:inherit;font-weight:300;font-size:14px;border:none;padding:10px;min-width:150px;border-radius:4px}.TemporaryConsentsButtonDecline{background-color:transparent;border:1px solid #000}.TemporaryConsentsButtonAccept{color:white;background-color:#000}";export{s as temporary_consents}
@@ -1 +1 @@
1
- import{p as n,b as t}from"./p-c8fa79f6.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),n(s)})().then((n=>t([["p-c2ffe442",[[1,"temporary-consents",{endpoint:[513],userId:[513,"user-id"],sessionId:[513,"session-id"],daysUntilLockout:[513,"days-until-lockout"],lang:[513],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],stylingAppends:[32]}]]]],n)));
1
+ import{p as n,b as t}from"./p-c8fa79f6.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),n(s)})().then((n=>t([["p-a55f0a66",[[1,"temporary-consents",{endpoint:[513],userId:[513,"user-id"],sessionId:[513,"session-id"],daysUntilLockout:[513,"days-until-lockout"],lang:[513],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],stylingAppends:[32]}]]]],n)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/temporary-consents",
3
- "version": "1.24.7",
3
+ "version": "1.26.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as t,h as e}from"./p-c8fa79f6.js";const o=["en"];let n={en:{title:"Participation conditions",description:"Important: Full verification is required in order to be able to use our entire offer. If verification is not completed, it is not possible to withdraw and the betting account will be locked in {daysUntilLockout} days.",declineButton:"Decline and log out",acceptButton:"Accept",loading:"Please wait, loading..."}};const s=(t,e,s)=>{const i=e;let r=n[void 0!==i&&o.includes(i)?i:"en"][t];if(void 0!==s)for(const[t,e]of Object.entries(s.values)){const o=new RegExp(`{${t}}`,"g");r=r.replace(o,e)}return r},i=class{constructor(e){t(this,e),this.clientStyling="",this.clientStylingUrl="",this.translationUrl="",this.stylingAppends=!1,this.isLoading=!1,this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),e=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{e.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(e)}),1)})).catch((t=>{console.log("error ",t)}))}}componentWillLoad(){const t=[];if(this.endpoint&&this.userId){const e=this.getConsents().then((t=>{this.temporaryAccountConsent=t.consents.some((t=>"temporaryaccountconsent"==t.tagCode))}));t.push(e)}if(this.translationUrl){const o=(e=this.translationUrl,new Promise((t=>{fetch(e).then((t=>t.json())).then((e=>{Object.keys(e).forEach((t=>{for(let o in e[t])n[t][o]=e[t][o]})),t(!0)}))})));t.push(o)}var e;return Promise.all(t)}componentDidRender(){!this.stylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.stylingAppends=!0)}getConsents(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),e=new Headers;e.append("X-SessionId",this.sessionId),e.append("Accept","application/json");const o={method:"GET",headers:e};return new Promise(((e,n)=>{this.isLoading=!0,fetch(t.href,o).then((t=>t.json())).then((t=>{e(t)})).catch((t=>{console.error(t),n(t)})).finally((()=>{this.isLoading=!1}))}))}setConsents(){const t=new URL(`${this.endpoint}/v1/player/${this.userId}/legislation/consents`),e=new Headers;e.append("X-SessionId",this.sessionId),e.append("Accept","application/json"),e.append("Content-Type","application/json");const o={method:"POST",headers:e,body:JSON.stringify({consents:[{tagCode:"temporaryaccountconsent",note:"",status:1}]})};return new Promise(((e,n)=>{this.isLoading=!0,fetch(t.href,o).then((t=>t.json())).then((t=>{e(t)})).catch((t=>{console.error(t),n(t)})).finally((()=>{this.isLoading=!1}))}))}handleDecline(){window.postMessage({type:"TemporaryConsentsDeclined"},window.location.href)}handleAccept(){this.setConsents(),window.postMessage({type:"TemporaryConsentsAccepted"},window.location.href)}render(){if(this.temporaryAccountConsent)return this.isLoading?e("p",null,s("loading",this.lang)):e("div",{class:"TemporaryConsents",ref:t=>this.stylingContainer=t},e("h2",{class:"TemporaryConsentsTitle"}," ",s("title",this.lang)," "),e("p",{class:"TemporaryConsentsText"}," ",s("description",this.lang,{values:{daysUntilLockout:this.daysUntilLockout}})," "),e("div",{class:"TemporaryConsentsButtonsWrapper"},e("button",{class:"TemporaryConsentsButton TemporaryConsentsButtonDecline",onClick:()=>this.handleDecline()},s("declineButton",this.lang)),e("button",{class:"TemporaryConsentsButton TemporaryConsentsButtonAccept",onClick:this.handleAccept},s("acceptButton",this.lang))))}};i.style="*,*::after,*::before{box-sizing:border-box;padding:0;margin:0}:host{display:block}.TemporaryConsents{max-width:500px;display:flex;gap:35px;flex-direction:column;box-shadow:0px 1px 5px 1px rgba(0, 0, 0, 0.1);padding:20px;font-family:sans-serif}.TemporaryConsentsTitle{text-align:left;font-family:inherit;color:#000;font-weight:400;font-size:18px;display:block;border-bottom:1px solid #000;padding-bottom:10px}.TemporaryConsentsText{font-family:inherit;font-weight:300;font-size:16px}.TemporaryConsentsButtonsWrapper{display:flex;justify-content:space-evenly;gap:50px}.TemporaryConsentsButton{font-family:inherit;font-weight:300;font-size:14px;border:none;padding:10px;min-width:150px;border-radius:4px}.TemporaryConsentsButtonDecline{background-color:transparent;border:1px solid #000}.TemporaryConsentsButtonAccept{color:white;background-color:#000}";export{i as temporary_consents}