@phygitallabs/phygital-consent 1.0.26 → 1.0.28
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/bun.lock +31 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/src/components/PolicyPopup.tsx +10 -8
package/bun.lock
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"": {
|
|
6
6
|
"name": "@phygitallabs/phygital-consent",
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@phygitallabs/helpers": "latest",
|
|
8
9
|
"axios": "^1.8.4",
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
@@ -91,6 +92,8 @@
|
|
|
91
92
|
|
|
92
93
|
"@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
|
|
93
94
|
|
|
95
|
+
"@phygitallabs/helpers": ["@phygitallabs/helpers@4.3.0", "", { "dependencies": { "clsx": "^2.1.1", "html-react-parser": "^4.0.0", "tailwind-merge": "^2.3.0" }, "peerDependencies": { "react": ">=18.2" } }, "sha512-e/pr01JtDMkHBivZlWinb7H9oPcCwfbkWJBBuL/+P112k9IoyldUdEyVg28z0vl607+QGxHD+0QJswJHmJBbqA=="],
|
|
96
|
+
|
|
94
97
|
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.57.0", "", { "os": "android", "cpu": "arm" }, "sha512-tPgXB6cDTndIe1ah7u6amCI1T0SsnlOuKgg10Xh3uizJk4e5M1JGaUMk7J4ciuAUcFpbOiNhm2XIjP9ON0dUqA=="],
|
|
95
98
|
|
|
96
99
|
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.57.0", "", { "os": "android", "cpu": "arm64" }, "sha512-sa4LyseLLXr1onr97StkU1Nb7fWcg6niokTwEVNOO7awaKaoRObQ54+V/hrF/BP1noMEaaAW6Fg2d/CfLiq3Mg=="],
|
|
@@ -213,6 +216,8 @@
|
|
|
213
216
|
|
|
214
217
|
"cliui": ["cliui@8.0.1", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
|
|
215
218
|
|
|
219
|
+
"clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
|
|
220
|
+
|
|
216
221
|
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
|
|
217
222
|
|
|
218
223
|
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
|
|
@@ -235,12 +240,22 @@
|
|
|
235
240
|
|
|
236
241
|
"detect-libc": ["detect-libc@2.1.2", "", {}, "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ=="],
|
|
237
242
|
|
|
243
|
+
"dom-serializer": ["dom-serializer@2.0.0", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.2", "entities": "^4.2.0" } }, "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg=="],
|
|
244
|
+
|
|
245
|
+
"domelementtype": ["domelementtype@2.3.0", "", {}, "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw=="],
|
|
246
|
+
|
|
247
|
+
"domhandler": ["domhandler@5.0.3", "", { "dependencies": { "domelementtype": "^2.3.0" } }, "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w=="],
|
|
248
|
+
|
|
249
|
+
"domutils": ["domutils@3.2.2", "", { "dependencies": { "dom-serializer": "^2.0.0", "domelementtype": "^2.3.0", "domhandler": "^5.0.3" } }, "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw=="],
|
|
250
|
+
|
|
238
251
|
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
|
239
252
|
|
|
240
253
|
"emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
|
|
241
254
|
|
|
242
255
|
"enhanced-resolve": ["enhanced-resolve@5.18.4", "", { "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" } }, "sha512-LgQMM4WXU3QI+SYgEc2liRgznaD5ojbmY3sb8LxyguVkIg5FxdpTkvk72te2R38/TGKxH634oLxXRGY6d7AP+Q=="],
|
|
243
256
|
|
|
257
|
+
"entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="],
|
|
258
|
+
|
|
244
259
|
"es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
|
|
245
260
|
|
|
246
261
|
"es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
|
|
@@ -287,6 +302,14 @@
|
|
|
287
302
|
|
|
288
303
|
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
|
|
289
304
|
|
|
305
|
+
"html-dom-parser": ["html-dom-parser@5.0.3", "", { "dependencies": { "domhandler": "5.0.3", "htmlparser2": "9.0.0" } }, "sha512-slsc6ipw88OUZjAayRs5NTmfOQCwcUa3hNyk6AdsbQxY09H5Lr1Y3CZ4ZlconMKql3Ga6sWg3HMoUzo7KSItaQ=="],
|
|
306
|
+
|
|
307
|
+
"html-react-parser": ["html-react-parser@4.2.10", "", { "dependencies": { "domhandler": "5.0.3", "html-dom-parser": "5.0.3", "react-property": "2.0.2", "style-to-js": "1.1.8" }, "peerDependencies": { "react": "0.14 || 15 || 16 || 17 || 18" } }, "sha512-JyKZVQ+kQ8PdycISwkuLbEEvV/k4hWhU6cb6TT7yGaYwdqA7cPt4VRYXkCZcix2vlQtgDBSMJUmPI2jpNjPGvg=="],
|
|
308
|
+
|
|
309
|
+
"htmlparser2": ["htmlparser2@9.0.0", "", { "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", "domutils": "^3.1.0", "entities": "^4.5.0" } }, "sha512-uxbSI98wmFT/G4P2zXx4OVx04qWUmyFPrD2/CNepa2Zo3GPNaCaaxElDgwUrwYWkK1nr9fft0Ya8dws8coDLLQ=="],
|
|
310
|
+
|
|
311
|
+
"inline-style-parser": ["inline-style-parser@0.2.2", "", {}, "sha512-EcKzdTHVe8wFVOGEYXiW9WmJXPjqi1T+234YpJr98RiFYKHV3cdy1+3mkTE+KHTHxFFLH51SfaGOoUdW+v7ViQ=="],
|
|
312
|
+
|
|
290
313
|
"is-binary-path": ["is-binary-path@2.1.0", "", { "dependencies": { "binary-extensions": "^2.0.0" } }, "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw=="],
|
|
291
314
|
|
|
292
315
|
"is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],
|
|
@@ -381,6 +404,8 @@
|
|
|
381
404
|
|
|
382
405
|
"react-dom": ["react-dom@19.2.4", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],
|
|
383
406
|
|
|
407
|
+
"react-property": ["react-property@2.0.2", "", {}, "sha512-+PbtI3VuDV0l6CleQMsx2gtK0JZbZKbpdu5ynr+lbsuvtmgbNcS3VM0tuY2QjFNOcWxvXeHjDpy42RO+4U2rug=="],
|
|
408
|
+
|
|
384
409
|
"read-cache": ["read-cache@1.0.0", "", { "dependencies": { "pify": "^2.3.0" } }, "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA=="],
|
|
385
410
|
|
|
386
411
|
"readdirp": ["readdirp@3.6.0", "", { "dependencies": { "picomatch": "^2.2.1" } }, "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA=="],
|
|
@@ -403,8 +428,14 @@
|
|
|
403
428
|
|
|
404
429
|
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
|
|
405
430
|
|
|
431
|
+
"style-to-js": ["style-to-js@1.1.8", "", { "dependencies": { "style-to-object": "1.0.3" } }, "sha512-bPSspCXkkhETLXnEgDbaoWRWyv3lF2bj32YIc8IElok2IIMHUlZtQUrxYmAkKUNxpluhH0qnKWrmuoXUyTY12g=="],
|
|
432
|
+
|
|
433
|
+
"style-to-object": ["style-to-object@1.0.3", "", { "dependencies": { "inline-style-parser": "0.2.2" } }, "sha512-xOpx7S53E0V3DpVsvt7ySvoiumRpfXiC99PUXLqGB3wiAnN9ybEIpuzlZ8LAZg+h1sl9JkEUwtSQXxcCgFqbbg=="],
|
|
434
|
+
|
|
406
435
|
"sucrase": ["sucrase@3.35.1", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.2", "commander": "^4.0.0", "lines-and-columns": "^1.1.6", "mz": "^2.7.0", "pirates": "^4.0.1", "tinyglobby": "^0.2.11", "ts-interface-checker": "^0.1.9" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw=="],
|
|
407
436
|
|
|
437
|
+
"tailwind-merge": ["tailwind-merge@2.6.1", "", {}, "sha512-Oo6tHdpZsGpkKG88HJ8RR1rg/RdnEkQEfMoEk2x1XRI3F1AxeU+ijRXpiVUF4UbLfcxxRGw6TbUINKYdWVsQTQ=="],
|
|
438
|
+
|
|
408
439
|
"tailwindcss": ["tailwindcss@4.1.18", "", {}, "sha512-4+Z+0yiYyEtUVCScyfHCxOYP06L5Ne+JiHhY2IjR2KWMIWhJOYZKLSGZaP5HkZ8+bY0cxfzwDE5uOmzFXyIwxw=="],
|
|
409
440
|
|
|
410
441
|
"tapable": ["tapable@2.3.0", "", {}, "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg=="],
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
"use strict";var ge=Object.create;var H=Object.defineProperty;var Ce=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var ye=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty;var xe=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of he(t))!be.call(e,s)&&s!==n&&H(e,s,{get:()=>t[s],enumerable:!(o=Ce(t,s))||o.enumerable});return e};var ve=(e,t,n)=>(n=e!=null?ge(ye(e)):{},ne(t||!e||!e.__esModule?H(n,"default",{value:e,enumerable:!0}):n,e)),Pe=e=>ne(H({},"__esModule",{value:!0}),e);var Qe={};xe(Qe,{COOKIE_CONSENT_NAME:()=>V,CookieConsentBanner:()=>Z,EntityStatus:()=>se,MediaType:()=>oe,PhygitalConsentProvider:()=>qe,PolicyPopup:()=>Me,consentQueryKeys:()=>h,consentService:()=>P,getConsentPreferenceCookie:()=>O,getCookie:()=>re,isAdvertisingAllowed:()=>ee,isAnalyticsAllowed:()=>z,policyQueryKeys:()=>X,setConsentPreferenceCookie:()=>$,setCookie:()=>ie,sha256:()=>T,useConsentById:()=>Te,useCreateDeviceCookieConsent:()=>J,useCreateUserConsent:()=>Y,useHealth:()=>Ue,useIsAnalyticsAllowed:()=>We,useLatestConsentByUserId:()=>Be,useLatestCookieConsentByDeviceId:()=>Ne,useManyConsents:()=>_e,usePhygitalConsent:()=>W,usePolicies:()=>q});module.exports=Pe(Qe);var oe=(n=>(n.IMAGE="image",n.VIDEO="video",n))(oe||{}),se=(n=>(n.ACTIVE="Active",n.INACTIVE="Inactive",n))(se||{});var S=require("react");var D=require("react");var V="phygital_cookie_consent";function re(e){if(typeof document>"u")return null;let t=document.cookie.match(new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)"));return t?decodeURIComponent(t[1]):null}function ie(e,t,n={}){if(typeof document>"u")return;let{maxAge:o=31536e3,path:s="/",sameSite:c="Lax",secure:d=!1}=n,u=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=${s}; max-age=${o}; SameSite=${c}`;d&&(u+="; Secure"),document.cookie=u}function O(){let e=re(V);if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t=="object"&&"deviceId"in t&&"selected_preferences"in t&&typeof t.deviceId=="string"&&Array.isArray(t.selected_preferences))return t}catch{}return null}function $(e,t,n){ie(V,JSON.stringify({deviceId:e,selected_preferences:t}),{maxAge:31536e3,path:"/",sameSite:"Lax",...n})}var v=require("@tanstack/react-query");var _="",P=e=>({getHealth:async()=>{let{data:t}=await e.get("/health");return t},getManyConsents:async t=>{let{data:n}=await e.get(`${_}/consent`,{params:t?{type:t.type}:void 0});return n},getConsentById:async({id:t})=>{let{data:n}=await e.get(`${_}/consent/${t}`);return n},getPolicies:async t=>{let{data:n}=await e.get(`${_}/policy`,{params:t??void 0});return n},getLatestConsentByUserId:async({user_id:t})=>{let{data:n}=await e.get(`${_}/user-id`,{params:{user_id:t}});return n},createUserConsent:async t=>{let{data:n}=await e.post(`${_}/user-id`,t);return n},getLatestCookieConsentByDeviceId:async({device_id:t})=>{let{data:n}=await e.get(`${_}/cookies/device-id`,{params:{device_id:t}});return n},createDeviceCookieConsent:async t=>{let{data:n}=await e.post(`${_}/cookies/device-id`,t);return n}});function Re(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("").toLowerCase()}async function ke(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Re(n)}function we(e){let t=Se(e),n=Ie(),o=Ae(),s=new Uint32Array(64),c=t.length>>6;for(let u=0;u<c;u++){let p=u<<6;for(let l=0;l<16;l++){let b=p+(l<<2);s[l]=t[b]<<24|t[b+1]<<16|t[b+2]<<8|t[b+3]}for(let l=16;l<64;l++){let b=k(s[l-15],7)^k(s[l-15],18)^s[l-15]>>>3,U=k(s[l-2],17)^k(s[l-2],19)^s[l-2]>>>10;s[l]=s[l-16]+b+s[l-7]+U>>>0}let a=o[0],I=o[1],x=o[2],N=o[3],m=o[4],R=o[5],A=o[6],y=o[7];for(let l=0;l<64;l++){let b=k(m,6)^k(m,11)^k(m,25),U=m&R^~m&A,g=y+b+U+n[l]+s[l]>>>0,L=k(a,2)^k(a,13)^k(a,22),F=a&I^a&x^I&x,i=L+F>>>0;y=A,A=R,R=m,m=N+g>>>0,N=x,x=I,I=a,a=g+i>>>0}o[0]=o[0]+a>>>0,o[1]=o[1]+I>>>0,o[2]=o[2]+x>>>0,o[3]=o[3]+N>>>0,o[4]=o[4]+m>>>0,o[5]=o[5]+R>>>0,o[6]=o[6]+A>>>0,o[7]=o[7]+y>>>0}let d="";for(let u=0;u<8;u++){let p=o[u];d+=(p>>>28).toString(16)+(p>>>24&15).toString(16)+(p>>>20&15).toString(16)+(p>>>16&15).toString(16)+(p>>>12&15).toString(16)+(p>>>8&15).toString(16)+(p>>>4&15).toString(16)+(p&15).toString(16)}return d.toLowerCase()}function k(e,t){return e>>>t|e<<32-t}function Se(e){let t=e.length,n=[];for(let p=0;p<t;p++){let a=e.charCodeAt(p);a<128?n.push(a):a<2048?n.push(192|a>>6,128|a&63):a<55296||a>=57344?n.push(224|a>>12,128|a>>6&63,128|a&63):(a=65536+((a&1023)<<10|e.charCodeAt(++p)&1023),n.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|a&63))}let o=n.length,s=(64-(o+9)%64)%64,c=o+9+s,d=new Uint8Array(c);d.set(n),d[o]=128;let u=new DataView(d.buffer,d.byteOffset,d.byteLength);return u.setUint32(c-8,0,!1),u.setUint32(c-4,o*8>>>0,!1),d}function Ie(){let e=[];return"428a2f98 71374491 b5c0fbcf e9b5dba5 3956c25b 59f111f1 923f82a4 ab1c5ed5 d807aa98 12835b01 243185be 550c7dc3 72be5d74 80deb1fe 9bdc06a7 c19bf174 e49b69c1 efbe4786 0fc19dc6 240ca1cc 2de92c6f 4a7484aa 5cb0a9dc 76f988da 983e5152 a831c66d b00327c8 bf597fc7 c6e00bf3 d5a79147 06ca6351 14292967 27b70a85 2e1b2138 4d2c6dfc 53380d13 650a7354 766a0abb 81c2c92e 92722c85 a2bfe8a1 a81a664b c24b8b70 c76c51a3 d192e819 d6990624 f40e3585 106aa070 19a4c116 1e376c08 2748774c 34b0bcb5 391c0cb3 4ed8aa4a 5b9cca4f 682e6ff3 748f82ee 78a5636f 84c87814 8cc70208 90befffa a4506ceb bef9a3f7 c67178f2".split(" ").forEach(n=>e.push(parseInt(n,16))),e}function Ae(){return[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]}function Ee(){return!(typeof crypto>"u"||!crypto.subtle)}async function T(e){return typeof e!="string"||e.length===0?e:Ee()?ke(e):Promise.resolve(we(e))}var K=require("@tanstack/react-query"),ce=ve(require("axios")),B=require("react"),j=require("react/jsx-runtime"),ae=(0,B.createContext)(void 0),De=({baseURL:e="",axiosConfig:t={},requestInterceptors:n={},responseInterceptors:o={}})=>{let s=ce.default.create({baseURL:e,...t});return s.interceptors.request.use(n.onFulfilled,n.onRejected),s.interceptors.response.use(o.onFulfilled,o.onRejected),{consentApi:s,updateHeaders:d=>{Object.entries(d).forEach(([u,p])=>{s.defaults.headers.common[u]=p})}}},de=({children:e,baseURL:t="",axiosConfig:n={},queryClient:o,queryClientConfig:s={},requestInterceptors:c={},responseInterceptors:d={}})=>{let u=(0,B.useMemo)(()=>o||new K.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,...s?.defaultOptions?.queries},mutations:{...s?.defaultOptions?.mutations}},queryCache:s?.queryCache,mutationCache:s?.mutationCache}),[o]),p=(0,B.useMemo)(()=>{let a=De({baseURL:t,axiosConfig:n,requestInterceptors:c,responseInterceptors:d});return{consentApi:a.consentApi,updateHeaders:a.updateHeaders,queryClient:u}},[t,u,n,c,d]);return(0,j.jsx)(ae.Provider,{value:p,children:(0,j.jsx)(K.QueryClientProvider,{client:u,children:e})})},w=()=>{let e=(0,B.useContext)(ae);if(!e)throw new Error("useConsentService must be used within a ConsentServiceProvider");return e};var h={all:["consent"],health:()=>[...h.all,"health"],list:e=>[...h.all,"list",e],detail:e=>[...h.all,"detail",e],latestByUserId:e=>[...h.all,"user-id",e],latestCookieByDeviceId:e=>[...h.all,"cookies","device-id",e]},Ue=e=>{let{consentApi:t}=w(),n=P(t);return(0,v.useQuery)({queryKey:h.health(),queryFn:()=>n.getHealth(),...e})},_e=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.list(e),queryFn:()=>o.getManyConsents(e),...t})},Te=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.detail(e.id),queryFn:()=>o.getConsentById(e),enabled:!!e.id,...t})},Be=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.latestByUserId(e.user_id),queryFn:async()=>{let s=await T(e.user_id);return o.getLatestConsentByUserId({user_id:s})},enabled:!!e.user_id,...t})},Ne=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.latestCookieByDeviceId(e.device_id),queryFn:async()=>{let s=await T(e.device_id);return o.getLatestCookieConsentByDeviceId({device_id:s})},enabled:!!e.device_id,...t})},Y=e=>{let{consentApi:t}=w(),n=(0,v.useQueryClient)(),o=P(t);return(0,v.useMutation)({mutationFn:async s=>{let c={...s};return s.user_id!=null&&s.user_id!==""&&(c.user_id=await T(s.user_id)),s.device_id!=null&&s.device_id!==""&&(c.device_id=await T(s.device_id)),o.createUserConsent(c)},onSuccess:(s,c)=>{c.user_id&&n.invalidateQueries({queryKey:h.latestByUserId(c.user_id)}),n.invalidateQueries({queryKey:h.list()})},...e})},J=e=>{let{consentApi:t}=w(),n=(0,v.useQueryClient)(),o=P(t);return(0,v.useMutation)({mutationFn:async s=>{let c={...s,device_id:await T(s.device_id)};return o.createDeviceCookieConsent(c)},onSuccess:(s,c)=>{n.invalidateQueries({queryKey:h.latestCookieByDeviceId(c.device_id)}),n.invalidateQueries({queryKey:h.list()})},...e})};var le=require("@tanstack/react-query");var X={all:["policy"],list:e=>[...X.all,"list",e]},q=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,le.useQuery)({queryKey:X.list(e),queryFn:()=>o.getPolicies(e),...t})};var r=require("react/jsx-runtime");function Z({onSubmitted:e,onDismiss:t,className:n=""}){let[o,s]=(0,D.useState)(!1),[c,d]=(0,D.useState)(!1),[u,p]=(0,D.useState)(null),[a,I]=(0,D.useState)({}),{data:x}=q({type:"COOKIE_PREFERENCE",status:"ACTIVE"}),m=(0,D.useMemo)(()=>x?.data?x?.data?.find(i=>i.type==="COOKIE_PREFERENCE"&&i.status==="ACTIVE")??x?.data?.[0]:null,[x])?.preferences??[],R=(0,D.useMemo)(()=>({...Object.fromEntries(m.map(C=>[C.id??"",!0]).filter(([C])=>!!C)),...a}),[m,a]),{deviceId:A}=W(),y=J({onSuccess:(i,C)=>{$(A,C.selected_preferences??[]),e?.(),t?.(),s(!0),d(!1)}}),l=()=>m.map(i=>i.id).filter(i=>!!i).filter(i=>R[i]),b=(i,C)=>({device_id:A,status:i,selected_preferences:C,page_url:typeof window<"u"?window.location.href:void 0,user_agent:typeof navigator<"u"?navigator.userAgent:void 0}),U=i=>{m.find(E=>E.id===i)?.is_mandatory||I(E=>({...E,[i]:!R[i]}))},g=()=>{y.mutate(b("REJECTED",[]))},L=()=>{let i=m.map(C=>C.id).filter(C=>!!C);y.mutate(b("ACCEPTED",i.length>0?i:[]))},F=()=>{let i=l();y.mutate(b("ACCEPTED",i.length>0?i:["essential"]))};return o?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{role:"dialog","aria-label":"Th\xF4ng b\xE1o v\u1EC1 cookie",className:`consent:fixed consent:bottom-0 consent:left-0 consent:right-0 consent:z-50 consent:flex consent:flex-col consent:gap-4 consent:rounded-t-xl consent:border consent:border-b-0 consent:border-gray-200 consent:bg-white consent:p-4 consent:shadow-lg consent:md:left-4 consent:md:right-auto consent:md:bottom-4 consent:md:max-w-md consent:md:rounded-xl consent:md:border consent:md:border-gray-200 ${n}`,style:{position:"fixed",bottom:0,left:0,right:0,zIndex:50,display:"flex",flexDirection:"column",gap:"1rem",borderRadius:"0.75rem 0.75rem 0 0",borderWidth:"1px 1px 0 1px",borderColor:"#e5e7eb",backgroundColor:"#fff",padding:"1rem",boxShadow:"0 -4px 6px -1px rgb(0 0 0 / 0.1)"},children:[(0,r.jsx)("h2",{className:"consent:text-lg consent:font-semibold consent:text-gray-900",style:{fontSize:"1.125rem",fontWeight:600,color:"#111827"},children:"Th\xF4ng b\xE1o v\u1EC1 cookie"}),(0,r.jsxs)("div",{className:"consent:text-sm consent:text-gray-600",style:{fontSize:"0.875rem",color:"#4b5563",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,r.jsx)("p",{children:"TapQuest s\u1EED d\u1EE5ng tr\xECnh theo d\xF5i (nh\u01B0 Cookie ho\u1EB7c SDK) cho:"}),(0,r.jsx)("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:m.map(i=>(0,r.jsx)("li",{children:i.name??i.id??""},i.id??i.name))}),(0,r.jsx)("p",{children:"Tr\u01B0\u1EDBc khi b\u1EA1n \u0111\u1ED3ng \xFD, ch\u1EC9 nh\u1EEFng tr\xECnh theo d\xF5i ho\xE0n to\xE0n c\u1EA7n thi\u1EBFt m\u1EDBi \u0111\u01B0\u1EE3c tri\u1EC3n khai."}),(0,r.jsx)("p",{children:"N\u1EBFu b\u1EA1n ch\u1ECDn Ch\u1EA5p nh\u1EADn t\u1EA5t c\u1EA3, b\u1EA1n \u0111\u1ED3ng \xFD s\u1EED d\u1EE5ng t\u1EA5t c\u1EA3 tr\xECnh theo d\xF5i c\u1EE7a ch\xFAng t\xF4i."}),(0,r.jsx)("p",{children:"N\u1EBFu b\u1EA1n ch\u1ECDn T\u1EEB ch\u1ED1i t\u1EA5t c\u1EA3, b\u1EA1n t\u1EEB ch\u1ED1i nh\u1EEFng tr\xECnh theo d\xF5i y\xEAu c\u1EA7u s\u1EF1 \u0111\u1ED3ng \xFD c\u1EE7a b\u1EA1n v\xE0 s\u1EBD kh\xF4ng c\xF3 quy\u1EC1n truy c\u1EADp v\xE0o c\xE1c \u0111\u1EC1 ngh\u1ECB ho\u1EB7c n\u1ED9i dung \u0111\u01B0\u1EE3c c\xE1 nh\xE2n h\xF3a."}),(0,r.jsx)("p",{children:"N\u1EBFu b\u1EA1n ch\u1ECDn T\xF9y ch\u1ECDn, b\u1EA1n c\xF3 th\u1EC3 ch\u1ECDn xem b\u1EA1n c\xF3 \u0111\u1ED3ng \xFD s\u1EED d\u1EE5ng tr\xECnh theo d\xF5i tr\xEAn \u1EE9ng d\u1EE5ng c\u1EE7a ch\xFAng t\xF4i hay kh\xF4ng v\xE0 \u1EDF m\u1EE9c \u0111\u1ED9 n\xE0o."}),(0,r.jsxs)("p",{children:["B\u1EA1n c\xF3 th\u1EC3 r\xFAt l\u1EA1i s\u1EF1 \u0111\u1ED3ng \xFD c\u1EE7a m\xECnh b\u1EA5t k\u1EF3 l\xFAc n\xE0o b\u1EB1ng c\xE1ch nh\u1EA5p v\xE0o li\xEAn k\u1EBFt trong"," ","Ch\xEDnh s\xE1ch cookie"," ","c\u1EE7a ch\xFAng t\xF4i."]})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 flex-wrap",children:[(0,r.jsx)("button",{type:"button",onClick:()=>d(!0),className:"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",border:"1px solid #111827",background:"#fff",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#111827",cursor:"pointer"},children:"T\xF9y ch\u1ECDn"}),(0,r.jsx)("button",{type:"button",onClick:g,disabled:y.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",background:"#111827",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer"},children:"T\u1EEB ch\u1ED1i t\u1EA5t c\u1EA3"}),(0,r.jsx)("button",{type:"button",onClick:L,disabled:y.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",background:"#111827",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer"},children:"Ch\u1EA5p nh\u1EADn t\u1EA5t c\u1EA3"})]}),y.isError&&(0,r.jsx)("p",{className:"consent:text-sm consent:text-red-600",style:{fontSize:"0.875rem",color:"#dc2626"},children:"\u0110\xE3 x\u1EA3y ra l\u1ED7i. Vui l\xF2ng th\u1EED l\u1EA1i."})]}),c&&(0,r.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Trung t\xE2m tu\u1EF3 ch\u1ECDn b\u1EA3o m\u1EADt",style:{position:"fixed",inset:0,zIndex:60,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)",padding:"1rem"},onClick:i=>i.target===i.currentTarget&&d(!1),children:(0,r.jsxs)("div",{className:"consent:bg-white consent:rounded-xl consent:border consent:border-gray-200 consent:shadow-lg consent:max-h-[90vh] consent:overflow-y-auto",style:{backgroundColor:"#fff",borderRadius:"0.75rem",border:"1px solid #e5e7eb",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)",maxWidth:"28rem",width:"100%",maxHeight:"90vh",overflowY:"auto",padding:"1.25rem",position:"relative"},onClick:i=>i.stopPropagation(),children:[(0,r.jsx)("button",{type:"button",onClick:()=>d(!1),"aria-label":"\u0110\xF3ng",style:{position:"absolute",top:"1rem",right:"1rem",width:"2rem",height:"2rem",borderRadius:"0.25rem",border:"none",background:"transparent",cursor:"pointer",fontSize:"1.25rem",lineHeight:1,color:"#6b7280"},children:"\xD7"}),(0,r.jsx)("h2",{className:"consent:text-lg consent:font-semibold consent:text-gray-900",style:{fontSize:"1.125rem",fontWeight:600,color:"#111827",marginBottom:"0.75rem",paddingRight:"2rem"},children:"Trung t\xE2m tu\u1EF3 ch\u1ECDn b\u1EA3o m\u1EADt"}),(0,r.jsxs)("div",{className:"consent:text-sm consent:text-gray-600",style:{fontSize:"0.875rem",color:"#4b5563",marginBottom:"1rem"},children:[(0,r.jsx)("p",{style:{marginBottom:"0.5rem"},children:"Khi b\u1EA1n truy c\u1EADp b\u1EA5t k\u1EF3 trang web n\xE0o, trang web \u0111\xF3 c\xF3 th\u1EC3 l\u01B0u tr\u1EEF ho\u1EB7c truy xu\u1EA5t th\xF4ng tin tr\xEAn tr\xECnh duy\u1EC7t c\u1EE7a b\u1EA1n, ch\u1EE7 y\u1EBFu d\u01B0\u1EDBi d\u1EA1ng cookie. Th\xF4ng tin n\xE0y c\xF3 th\u1EC3 li\xEAn quan \u0111\u1EBFn b\u1EA1n, t\xF9y ch\u1ECDn c\u1EE7a b\u1EA1n ho\u1EB7c thi\u1EBFt b\u1ECB c\u1EE7a b\u1EA1n, v\xE0 ch\u1EE7 y\u1EBFu \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u0111\u1EC3 trang web ho\u1EA1t \u0111\u1ED9ng nh\u01B0 mong \u0111\u1EE3i."}),(0,r.jsx)("p",{style:{marginBottom:"0.5rem"},children:"Th\xF4ng tin n\xE0y th\u01B0\u1EDDng kh\xF4ng tr\u1EF1c ti\u1EBFp x\xE1c \u0111\u1ECBnh b\u1EA1n nh\u01B0ng c\xF3 th\u1EC3 mang l\u1EA1i tr\u1EA3i nghi\u1EC7m web \u0111\u01B0\u1EE3c c\xE1 nh\xE2n h\xF3a h\u01A1n. Ch\xFAng t\xF4i t\xF4n tr\u1ECDng quy\u1EC1n ri\xEAng t\u01B0 c\u1EE7a b\u1EA1n; b\u1EA1n c\xF3 th\u1EC3 ch\u1ECDn kh\xF4ng cho ph\xE9p m\u1ED9t s\u1ED1 lo\u1EA1i cookie. Nh\u1EA5p v\xE0o ti\xEAu \u0111\u1EC1 t\u1EEBng danh m\u1EE5c \u0111\u1EC3 t\xECm hi\u1EC3u th\xEAm v\xE0 thay \u0111\u1ED5i c\xE0i \u0111\u1EB7t m\u1EB7c \u0111\u1ECBnh. Vi\u1EC7c ch\u1EB7n m\u1ED9t s\u1ED1 cookie c\xF3 th\u1EC3 \u1EA3nh h\u01B0\u1EDFng \u0111\u1EBFn tr\u1EA3i nghi\u1EC7m c\u1EE7a b\u1EA1n v\u1EDBi trang web v\xE0 c\xE1c d\u1ECBch v\u1EE5 \u0111\u01B0\u1EE3c cung c\u1EA5p."}),(0,r.jsx)("p",{style:{marginBottom:"0.5rem"},children:'N\u1EBFu ch\u1ECDn "Kh\xF4ng theo d\xF5i" khi l\u1EA7n \u0111\u1EA7u s\u1EED d\u1EE5ng TapQuest, ch\u1EC9 cookie ho\xE0n to\xE0n c\u1EA7n thi\u1EBFt m\u1EDBi \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng.'}),(0,r.jsx)("span",{style:{color:"#2563eb",textDecoration:"underline"},children:"Th\xF4ng tin kh\xE1c"})]}),(0,r.jsx)("h3",{className:"consent:text-sm consent:font-semibold consent:text-gray-900",style:{fontSize:"0.875rem",fontWeight:600,color:"#111827",marginBottom:"0.75rem"},children:"Qu\u1EA3n l\xFD tu\u1EF3 ch\u1ECDn \u0111\u1ED3ng \xFD"}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",marginBottom:"1.25rem"},children:m.map(i=>{let C=i.id??i.name??"",E=R[C],M=u===C,Q=i.is_mandatory===!0;return(0,r.jsxs)("div",{style:{border:"1px solid #e5e7eb",borderRadius:"0.5rem",overflow:"hidden"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.75rem",cursor:"pointer",backgroundColor:M?"#f9fafb":"transparent"},onClick:()=>p(M?null:C),children:[(0,r.jsx)("span",{style:{flexShrink:0,width:"1.25rem",height:"1.25rem",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1rem",color:"#6b7280",transform:M?"rotate(45deg)":"none",transition:"transform 0.2s"},children:"+"}),(0,r.jsx)("span",{className:"consent:font-medium consent:text-gray-900",style:{flex:1,fontSize:"0.875rem",fontWeight:500,color:"#111827"},children:i.name??C}),(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":E,"aria-label":`${i.name??C} ${E?"b\u1EADt":"t\u1EAFt"}`,disabled:Q,onClick:me=>{me.stopPropagation(),U(C)},style:{flexShrink:0,width:44,height:24,borderRadius:12,border:"none",padding:0,cursor:Q?"default":"pointer",backgroundColor:Q?"#e5e7eb":E?"#111827":"#d1d5db",opacity:Q?.7:1,transition:"background-color 0.2s"},children:(0,r.jsx)("span",{style:{display:"block",width:20,height:20,borderRadius:"50%",backgroundColor:"#fff",marginLeft:E?22:2,marginTop:2,transition:"margin-left 0.2s",boxShadow:"0 1px 2px rgb(0 0 0 / 0.2)"}})})]}),M&&(0,r.jsx)("div",{className:"consent:text-sm consent:text-gray-600",style:{fontSize:"0.875rem",color:"#4b5563",padding:"0.75rem 0.75rem 0.75rem 2.5rem",borderTop:"1px solid #e5e7eb"},children:i.description??""})]},C)})}),(0,r.jsx)("button",{type:"button",onClick:F,disabled:y.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50 consent:w-full",style:{borderRadius:"0.5rem",background:"#111827",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer",width:"100%"},children:"X\xE1c nh\u1EADn l\u1EF1a ch\u1ECDn c\u1EE7a t\xF4i"})]})})]})}var Oe="analytics",Ge="advertising";function z(){let e=O();return e?.selected_preferences?e.selected_preferences.includes(Oe):!1}function ee(){let e=O();return e?.selected_preferences?e.selected_preferences.includes(Ge):!1}var G=require("react/jsx-runtime"),fe=(0,S.createContext)(void 0);function Le({children:e,deviceId:t,showBannerWhenNoPreference:n=!0}){let[o,s]=(0,S.useState)(!1),c=(0,S.useCallback)(()=>{let u=O();s(!!u)},[]);(0,S.useEffect)(()=>{c()},[c]);let d={deviceId:t,hasConsentPreference:o,isAnalyticsAllowed:z(),isAdvertisingAllowed:ee(),refreshConsentPreference:c};return(0,G.jsxs)(fe.Provider,{value:d,children:[e,n&&!o&&(0,G.jsx)(Z,{onSubmitted:c})]})}function qe(e){let{children:t,deviceId:n,showBannerWhenNoPreference:o=!0,...s}=e;return(0,G.jsx)(de,{...s,children:(0,G.jsx)(Le,{deviceId:n,showBannerWhenNoPreference:o,children:t})})}function W(){let e=(0,S.useContext)(fe);if(!e)throw new Error("usePhygitalConsent must be used within a PhygitalConsentProvider");return e}function We(){return W(),z()}var te=require("react");var f=require("react/jsx-runtime"),ze="V\xEC b\u1EA1n kh\xF4ng \u0111\u1ED3ng \xFD v\u1EDBi th\u1ECFa thu\u1EADn n\xE0y. Ch\xFAng t\xF4i s\u1EBD x\xF3a t\xE0i kho\u1EA3n trong v\xF2ng x ng\xE0y. Nh\u1EA5n n\xFAt '\u0110\u1ED3ng \xFD' \u0111\u1EC3 ti\u1EBFp t\u1EE5c";function Me({open:e,onClose:t,onReject:n,userId:o,onAgreeSuccess:s}){let[c,d]=(0,te.useState)(!1),[u,p]=(0,te.useState)(!1),{data:a}=q({type:"ACCOUNT_REGISTER"}),I=g=>{try{return JSON.parse(g||"")}catch{return{htmlContent:""}}},x=a?.data?.[0]?.documents?.find(g=>g.id==="privacy-policy"),N=I(x?.content),m=Y({onSuccess:(g,L)=>{L.status==="ACCEPTED"&&s?.(),R()}}),R=()=>{d(!1),p(!1),t()},A=()=>{p(!0)},y=()=>{p(!1)},l=g=>({user_id:o,status:g,page_url:typeof window<"u"?window.location.href:void 0,user_agent:typeof navigator<"u"?navigator.userAgent:void 0}),b=()=>{m.mutate(l("REJECTED")),n?.()},U=()=>{c&&m.mutate(l("ACCEPTED"))};return e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:(0,f.jsxs)("div",{className:"consent:bg-white consent:border consent:border-gray-200 consent:shadow-lg consent:max-h-[90vh] consent:overflow-hidden consent:flex consent:flex-col",style:{backgroundColor:"#fff",borderRadius:"0.75rem",border:"1px solid #e5e7eb",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)",maxWidth:"28rem",width:"100%",maxHeight:"90vh",overflow:"hidden",display:"flex",flexDirection:"column",position:"relative"},onClick:g=>g.stopPropagation(),children:[(0,f.jsx)("h2",{style:{fontSize:"18px",fontWeight:600,color:"#000",padding:"20px 2.5rem 12px 20px"},children:"Ch\xEDnh s\xE1ch b\u1EA3o m\u1EADt"}),(0,f.jsx)("div",{style:{flex:1,overflowY:"auto",padding:"1rem 1.25rem",fontSize:"0.875rem",color:"#111827",lineHeight:1.6},children:(0,f.jsx)("p",{style:{margin:0,whiteSpace:"pre-wrap"},children:N?.htmlContent})}),(0,f.jsxs)("div",{style:{padding:"1rem 1.25rem 1.25rem 1.25rem",display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:"#111827",cursor:"pointer"},children:[(0,f.jsx)("input",{type:"checkbox",checked:c,onChange:g=>d(g.target.checked),style:{width:"1rem",height:"1rem",accentColor:"#111827"},"aria-label":"T\xF4i \u0111\u1ED3ng \xFD v\u1EDBi ch\xEDnh s\xE1ch b\u1EA3o m\u1EADt tr\xEAn"}),(0,f.jsx)("span",{children:"T\xF4i \u0111\u1ED3ng \xFD v\u1EDBi ch\xEDnh s\xE1ch b\u1EA3o m\u1EADt tr\xEAn"})]}),(0,f.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[(0,f.jsx)("button",{type:"button",onClick:A,disabled:m.isPending,className:"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50",style:{flex:1,borderRadius:"0.5rem",border:"1px solid #111827",background:"#fff",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#111827",cursor:"pointer"},children:"T\u1EEB ch\u1ED1i"}),(0,f.jsx)("button",{type:"button",onClick:U,disabled:!c||m.isPending,className:"consent:rounded-lg consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:shadow-sm disabled:consent:opacity-50 disabled:consent:cursor-not-allowed",style:{flex:1,minWidth:0,borderRadius:"0.5rem",background:c?"#111827":"#e5e7eb",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:c?"#fff":"#9ca3af",border:"none",cursor:c?"pointer":"not-allowed"},children:"Ti\u1EBFp t\u1EE5c"})]}),m.isError&&(0,f.jsx)("p",{className:"consent:text-sm consent:text-red-600",style:{fontSize:"0.875rem",color:"#dc2626",margin:0},children:"\u0110\xE3 x\u1EA3y ra l\u1ED7i. Vui l\xF2ng th\u1EED l\u1EA1i."})]})]})}),u&&(0,f.jsx)("div",{role:"alertdialog","aria-modal":"true","aria-label":"Th\xF4ng b\xE1o t\u1EEB ch\u1ED1i",style:{position:"fixed",inset:0,zIndex:70,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)",padding:"1rem"},onClick:g=>g.target===g.currentTarget&&y(),children:(0,f.jsxs)("div",{className:"consent:bg-white consent:rounded-xl consent:border consent:border-gray-200 consent:shadow-lg",style:{backgroundColor:"#fff",borderRadius:"0.75rem",border:"1px solid #e5e7eb",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)",maxWidth:"22rem",width:"100%",padding:"1.25rem"},onClick:g=>g.stopPropagation(),children:[(0,f.jsx)("p",{className:"consent:text-sm consent:text-gray-700",style:{fontSize:"0.875rem",color:"#374151",margin:"0 0 1rem 0",lineHeight:1.5},children:ze}),(0,f.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[(0,f.jsx)("button",{type:"button",onClick:y,className:"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50",style:{flex:1,borderRadius:"0.5rem",border:"1px solid #111827",background:"#fff",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#111827",cursor:"pointer"},children:"Tr\u1EDF l\u1EA1i"}),(0,f.jsx)("button",{type:"button",onClick:b,disabled:m.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm disabled:consent:opacity-50 consent:flex-1",style:{flex:1,minWidth:0,borderRadius:"0.5rem",background:"#a71f24",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer"},children:"\u0110\u1ED3ng \xFD"})]}),m.isError&&(0,f.jsx)("p",{className:"consent:text-sm consent:text-red-600",style:{fontSize:"0.875rem",color:"#dc2626",margin:"0.5rem 0 0 0"},children:"\u0110\xE3 x\u1EA3y ra l\u1ED7i. Vui l\xF2ng th\u1EED l\u1EA1i."})]})})]}):null}0&&(module.exports={COOKIE_CONSENT_NAME,CookieConsentBanner,EntityStatus,MediaType,PhygitalConsentProvider,PolicyPopup,consentQueryKeys,consentService,getConsentPreferenceCookie,getCookie,isAdvertisingAllowed,isAnalyticsAllowed,policyQueryKeys,setConsentPreferenceCookie,setCookie,sha256,useConsentById,useCreateDeviceCookieConsent,useCreateUserConsent,useHealth,useIsAnalyticsAllowed,useLatestConsentByUserId,useLatestCookieConsentByDeviceId,useManyConsents,usePhygitalConsent,usePolicies});
|
|
2
|
+
"use strict";var Ce=Object.create;var H=Object.defineProperty;var he=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var be=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty;var ve=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},ne=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ye(t))!xe.call(e,s)&&s!==n&&H(e,s,{get:()=>t[s],enumerable:!(o=he(t,s))||o.enumerable});return e};var Pe=(e,t,n)=>(n=e!=null?Ce(be(e)):{},ne(t||!e||!e.__esModule?H(n,"default",{value:e,enumerable:!0}):n,e)),ke=e=>ne(H({},"__esModule",{value:!0}),e);var He={};ve(He,{COOKIE_CONSENT_NAME:()=>V,CookieConsentBanner:()=>Z,EntityStatus:()=>se,MediaType:()=>oe,PhygitalConsentProvider:()=>We,PolicyPopup:()=>Qe,consentQueryKeys:()=>h,consentService:()=>P,getConsentPreferenceCookie:()=>O,getCookie:()=>re,isAdvertisingAllowed:()=>ee,isAnalyticsAllowed:()=>z,policyQueryKeys:()=>X,setConsentPreferenceCookie:()=>$,setCookie:()=>ie,sha256:()=>T,useConsentById:()=>Be,useCreateDeviceCookieConsent:()=>J,useCreateUserConsent:()=>Y,useHealth:()=>_e,useIsAnalyticsAllowed:()=>ze,useLatestConsentByUserId:()=>Ne,useLatestCookieConsentByDeviceId:()=>Oe,useManyConsents:()=>Te,usePhygitalConsent:()=>W,usePolicies:()=>q});module.exports=ke(He);var oe=(n=>(n.IMAGE="image",n.VIDEO="video",n))(oe||{}),se=(n=>(n.ACTIVE="Active",n.INACTIVE="Inactive",n))(se||{});var S=require("react");var D=require("react");var V="phygital_cookie_consent";function re(e){if(typeof document>"u")return null;let t=document.cookie.match(new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)"));return t?decodeURIComponent(t[1]):null}function ie(e,t,n={}){if(typeof document>"u")return;let{maxAge:o=31536e3,path:s="/",sameSite:c="Lax",secure:d=!1}=n,u=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; path=${s}; max-age=${o}; SameSite=${c}`;d&&(u+="; Secure"),document.cookie=u}function O(){let e=re(V);if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t=="object"&&"deviceId"in t&&"selected_preferences"in t&&typeof t.deviceId=="string"&&Array.isArray(t.selected_preferences))return t}catch{}return null}function $(e,t,n){ie(V,JSON.stringify({deviceId:e,selected_preferences:t}),{maxAge:31536e3,path:"/",sameSite:"Lax",...n})}var v=require("@tanstack/react-query");var _="",P=e=>({getHealth:async()=>{let{data:t}=await e.get("/health");return t},getManyConsents:async t=>{let{data:n}=await e.get(`${_}/consent`,{params:t?{type:t.type}:void 0});return n},getConsentById:async({id:t})=>{let{data:n}=await e.get(`${_}/consent/${t}`);return n},getPolicies:async t=>{let{data:n}=await e.get(`${_}/policy`,{params:t??void 0});return n},getLatestConsentByUserId:async({user_id:t})=>{let{data:n}=await e.get(`${_}/user-id`,{params:{user_id:t}});return n},createUserConsent:async t=>{let{data:n}=await e.post(`${_}/user-id`,t);return n},getLatestCookieConsentByDeviceId:async({device_id:t})=>{let{data:n}=await e.get(`${_}/cookies/device-id`,{params:{device_id:t}});return n},createDeviceCookieConsent:async t=>{let{data:n}=await e.post(`${_}/cookies/device-id`,t);return n}});function Re(e){return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("").toLowerCase()}async function we(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Re(n)}function Se(e){let t=Ie(e),n=Ae(),o=Ee(),s=new Uint32Array(64),c=t.length>>6;for(let u=0;u<c;u++){let p=u<<6;for(let l=0;l<16;l++){let b=p+(l<<2);s[l]=t[b]<<24|t[b+1]<<16|t[b+2]<<8|t[b+3]}for(let l=16;l<64;l++){let b=R(s[l-15],7)^R(s[l-15],18)^s[l-15]>>>3,U=R(s[l-2],17)^R(s[l-2],19)^s[l-2]>>>10;s[l]=s[l-16]+b+s[l-7]+U>>>0}let a=o[0],I=o[1],x=o[2],N=o[3],m=o[4],k=o[5],A=o[6],y=o[7];for(let l=0;l<64;l++){let b=R(m,6)^R(m,11)^R(m,25),U=m&k^~m&A,g=y+b+U+n[l]+s[l]>>>0,L=R(a,2)^R(a,13)^R(a,22),F=a&I^a&x^I&x,i=L+F>>>0;y=A,A=k,k=m,m=N+g>>>0,N=x,x=I,I=a,a=g+i>>>0}o[0]=o[0]+a>>>0,o[1]=o[1]+I>>>0,o[2]=o[2]+x>>>0,o[3]=o[3]+N>>>0,o[4]=o[4]+m>>>0,o[5]=o[5]+k>>>0,o[6]=o[6]+A>>>0,o[7]=o[7]+y>>>0}let d="";for(let u=0;u<8;u++){let p=o[u];d+=(p>>>28).toString(16)+(p>>>24&15).toString(16)+(p>>>20&15).toString(16)+(p>>>16&15).toString(16)+(p>>>12&15).toString(16)+(p>>>8&15).toString(16)+(p>>>4&15).toString(16)+(p&15).toString(16)}return d.toLowerCase()}function R(e,t){return e>>>t|e<<32-t}function Ie(e){let t=e.length,n=[];for(let p=0;p<t;p++){let a=e.charCodeAt(p);a<128?n.push(a):a<2048?n.push(192|a>>6,128|a&63):a<55296||a>=57344?n.push(224|a>>12,128|a>>6&63,128|a&63):(a=65536+((a&1023)<<10|e.charCodeAt(++p)&1023),n.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|a&63))}let o=n.length,s=(64-(o+9)%64)%64,c=o+9+s,d=new Uint8Array(c);d.set(n),d[o]=128;let u=new DataView(d.buffer,d.byteOffset,d.byteLength);return u.setUint32(c-8,0,!1),u.setUint32(c-4,o*8>>>0,!1),d}function Ae(){let e=[];return"428a2f98 71374491 b5c0fbcf e9b5dba5 3956c25b 59f111f1 923f82a4 ab1c5ed5 d807aa98 12835b01 243185be 550c7dc3 72be5d74 80deb1fe 9bdc06a7 c19bf174 e49b69c1 efbe4786 0fc19dc6 240ca1cc 2de92c6f 4a7484aa 5cb0a9dc 76f988da 983e5152 a831c66d b00327c8 bf597fc7 c6e00bf3 d5a79147 06ca6351 14292967 27b70a85 2e1b2138 4d2c6dfc 53380d13 650a7354 766a0abb 81c2c92e 92722c85 a2bfe8a1 a81a664b c24b8b70 c76c51a3 d192e819 d6990624 f40e3585 106aa070 19a4c116 1e376c08 2748774c 34b0bcb5 391c0cb3 4ed8aa4a 5b9cca4f 682e6ff3 748f82ee 78a5636f 84c87814 8cc70208 90befffa a4506ceb bef9a3f7 c67178f2".split(" ").forEach(n=>e.push(parseInt(n,16))),e}function Ee(){return[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]}function De(){return!(typeof crypto>"u"||!crypto.subtle)}async function T(e){return typeof e!="string"||e.length===0?e:De()?we(e):Promise.resolve(Se(e))}var K=require("@tanstack/react-query"),ce=Pe(require("axios")),B=require("react"),j=require("react/jsx-runtime"),ae=(0,B.createContext)(void 0),Ue=({baseURL:e="",axiosConfig:t={},requestInterceptors:n={},responseInterceptors:o={}})=>{let s=ce.default.create({baseURL:e,...t});return s.interceptors.request.use(n.onFulfilled,n.onRejected),s.interceptors.response.use(o.onFulfilled,o.onRejected),{consentApi:s,updateHeaders:d=>{Object.entries(d).forEach(([u,p])=>{s.defaults.headers.common[u]=p})}}},de=({children:e,baseURL:t="",axiosConfig:n={},queryClient:o,queryClientConfig:s={},requestInterceptors:c={},responseInterceptors:d={}})=>{let u=(0,B.useMemo)(()=>o||new K.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,...s?.defaultOptions?.queries},mutations:{...s?.defaultOptions?.mutations}},queryCache:s?.queryCache,mutationCache:s?.mutationCache}),[o]),p=(0,B.useMemo)(()=>{let a=Ue({baseURL:t,axiosConfig:n,requestInterceptors:c,responseInterceptors:d});return{consentApi:a.consentApi,updateHeaders:a.updateHeaders,queryClient:u}},[t,u,n,c,d]);return(0,j.jsx)(ae.Provider,{value:p,children:(0,j.jsx)(K.QueryClientProvider,{client:u,children:e})})},w=()=>{let e=(0,B.useContext)(ae);if(!e)throw new Error("useConsentService must be used within a ConsentServiceProvider");return e};var h={all:["consent"],health:()=>[...h.all,"health"],list:e=>[...h.all,"list",e],detail:e=>[...h.all,"detail",e],latestByUserId:e=>[...h.all,"user-id",e],latestCookieByDeviceId:e=>[...h.all,"cookies","device-id",e]},_e=e=>{let{consentApi:t}=w(),n=P(t);return(0,v.useQuery)({queryKey:h.health(),queryFn:()=>n.getHealth(),...e})},Te=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.list(e),queryFn:()=>o.getManyConsents(e),...t})},Be=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.detail(e.id),queryFn:()=>o.getConsentById(e),enabled:!!e.id,...t})},Ne=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.latestByUserId(e.user_id),queryFn:async()=>{let s=await T(e.user_id);return o.getLatestConsentByUserId({user_id:s})},enabled:!!e.user_id,...t})},Oe=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,v.useQuery)({queryKey:h.latestCookieByDeviceId(e.device_id),queryFn:async()=>{let s=await T(e.device_id);return o.getLatestCookieConsentByDeviceId({device_id:s})},enabled:!!e.device_id,...t})},Y=e=>{let{consentApi:t}=w(),n=(0,v.useQueryClient)(),o=P(t);return(0,v.useMutation)({mutationFn:async s=>{let c={...s};return s.user_id!=null&&s.user_id!==""&&(c.user_id=await T(s.user_id)),s.device_id!=null&&s.device_id!==""&&(c.device_id=await T(s.device_id)),o.createUserConsent(c)},onSuccess:(s,c)=>{c.user_id&&n.invalidateQueries({queryKey:h.latestByUserId(c.user_id)}),n.invalidateQueries({queryKey:h.list()})},...e})},J=e=>{let{consentApi:t}=w(),n=(0,v.useQueryClient)(),o=P(t);return(0,v.useMutation)({mutationFn:async s=>{let c={...s,device_id:await T(s.device_id)};return o.createDeviceCookieConsent(c)},onSuccess:(s,c)=>{n.invalidateQueries({queryKey:h.latestCookieByDeviceId(c.device_id)}),n.invalidateQueries({queryKey:h.list()})},...e})};var le=require("@tanstack/react-query");var X={all:["policy"],list:e=>[...X.all,"list",e]},q=(e,t)=>{let{consentApi:n}=w(),o=P(n);return(0,le.useQuery)({queryKey:X.list(e),queryFn:()=>o.getPolicies(e),...t})};var r=require("react/jsx-runtime");function Z({onSubmitted:e,onDismiss:t,className:n=""}){let[o,s]=(0,D.useState)(!1),[c,d]=(0,D.useState)(!1),[u,p]=(0,D.useState)(null),[a,I]=(0,D.useState)({}),{data:x}=q({type:"COOKIE_PREFERENCE",status:"ACTIVE"}),m=(0,D.useMemo)(()=>x?.data?x?.data?.find(i=>i.type==="COOKIE_PREFERENCE"&&i.status==="ACTIVE")??x?.data?.[0]:null,[x])?.preferences??[],k=(0,D.useMemo)(()=>({...Object.fromEntries(m.map(C=>[C.id??"",!0]).filter(([C])=>!!C)),...a}),[m,a]),{deviceId:A}=W(),y=J({onSuccess:(i,C)=>{$(A,C.selected_preferences??[]),e?.(),t?.(),s(!0),d(!1)}}),l=()=>m.map(i=>i.id).filter(i=>!!i).filter(i=>k[i]),b=(i,C)=>({device_id:A,status:i,selected_preferences:C,page_url:typeof window<"u"?window.location.href:void 0,user_agent:typeof navigator<"u"?navigator.userAgent:void 0}),U=i=>{m.find(E=>E.id===i)?.is_mandatory||I(E=>({...E,[i]:!k[i]}))},g=()=>{y.mutate(b("REJECTED",[]))},L=()=>{let i=m.map(C=>C.id).filter(C=>!!C);y.mutate(b("ACCEPTED",i.length>0?i:[]))},F=()=>{let i=l();y.mutate(b("ACCEPTED",i.length>0?i:["essential"]))};return o?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{role:"dialog","aria-label":"Th\xF4ng b\xE1o v\u1EC1 cookie",className:`consent:fixed consent:bottom-0 consent:left-0 consent:right-0 consent:z-50 consent:flex consent:flex-col consent:gap-4 consent:rounded-t-xl consent:border consent:border-b-0 consent:border-gray-200 consent:bg-white consent:p-4 consent:shadow-lg consent:md:left-4 consent:md:right-auto consent:md:bottom-4 consent:md:max-w-md consent:md:rounded-xl consent:md:border consent:md:border-gray-200 ${n}`,style:{position:"fixed",bottom:0,left:0,right:0,zIndex:50,display:"flex",flexDirection:"column",gap:"1rem",borderRadius:"0.75rem 0.75rem 0 0",borderWidth:"1px 1px 0 1px",borderColor:"#e5e7eb",backgroundColor:"#fff",padding:"1rem",boxShadow:"0 -4px 6px -1px rgb(0 0 0 / 0.1)"},children:[(0,r.jsx)("h2",{className:"consent:text-lg consent:font-semibold consent:text-gray-900",style:{fontSize:"1.125rem",fontWeight:600,color:"#111827"},children:"Th\xF4ng b\xE1o v\u1EC1 cookie"}),(0,r.jsxs)("div",{className:"consent:text-sm consent:text-gray-600",style:{fontSize:"0.875rem",color:"#4b5563",display:"flex",flexDirection:"column",gap:"0.5rem"},children:[(0,r.jsx)("p",{children:"TapQuest s\u1EED d\u1EE5ng tr\xECnh theo d\xF5i (nh\u01B0 Cookie ho\u1EB7c SDK) cho:"}),(0,r.jsx)("ul",{style:{margin:0,paddingLeft:"1.25rem"},children:m.map(i=>(0,r.jsx)("li",{children:i.name??i.id??""},i.id??i.name))}),(0,r.jsx)("p",{children:"Tr\u01B0\u1EDBc khi b\u1EA1n \u0111\u1ED3ng \xFD, ch\u1EC9 nh\u1EEFng tr\xECnh theo d\xF5i ho\xE0n to\xE0n c\u1EA7n thi\u1EBFt m\u1EDBi \u0111\u01B0\u1EE3c tri\u1EC3n khai."}),(0,r.jsx)("p",{children:"N\u1EBFu b\u1EA1n ch\u1ECDn Ch\u1EA5p nh\u1EADn t\u1EA5t c\u1EA3, b\u1EA1n \u0111\u1ED3ng \xFD s\u1EED d\u1EE5ng t\u1EA5t c\u1EA3 tr\xECnh theo d\xF5i c\u1EE7a ch\xFAng t\xF4i."}),(0,r.jsx)("p",{children:"N\u1EBFu b\u1EA1n ch\u1ECDn T\u1EEB ch\u1ED1i t\u1EA5t c\u1EA3, b\u1EA1n t\u1EEB ch\u1ED1i nh\u1EEFng tr\xECnh theo d\xF5i y\xEAu c\u1EA7u s\u1EF1 \u0111\u1ED3ng \xFD c\u1EE7a b\u1EA1n v\xE0 s\u1EBD kh\xF4ng c\xF3 quy\u1EC1n truy c\u1EADp v\xE0o c\xE1c \u0111\u1EC1 ngh\u1ECB ho\u1EB7c n\u1ED9i dung \u0111\u01B0\u1EE3c c\xE1 nh\xE2n h\xF3a."}),(0,r.jsx)("p",{children:"N\u1EBFu b\u1EA1n ch\u1ECDn T\xF9y ch\u1ECDn, b\u1EA1n c\xF3 th\u1EC3 ch\u1ECDn xem b\u1EA1n c\xF3 \u0111\u1ED3ng \xFD s\u1EED d\u1EE5ng tr\xECnh theo d\xF5i tr\xEAn \u1EE9ng d\u1EE5ng c\u1EE7a ch\xFAng t\xF4i hay kh\xF4ng v\xE0 \u1EDF m\u1EE9c \u0111\u1ED9 n\xE0o."}),(0,r.jsxs)("p",{children:["B\u1EA1n c\xF3 th\u1EC3 r\xFAt l\u1EA1i s\u1EF1 \u0111\u1ED3ng \xFD c\u1EE7a m\xECnh b\u1EA5t k\u1EF3 l\xFAc n\xE0o b\u1EB1ng c\xE1ch nh\u1EA5p v\xE0o li\xEAn k\u1EBFt trong"," ","Ch\xEDnh s\xE1ch cookie"," ","c\u1EE7a ch\xFAng t\xF4i."]})]}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 flex-wrap",children:[(0,r.jsx)("button",{type:"button",onClick:()=>d(!0),className:"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",border:"1px solid #111827",background:"#fff",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#111827",cursor:"pointer"},children:"T\xF9y ch\u1ECDn"}),(0,r.jsx)("button",{type:"button",onClick:g,disabled:y.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",background:"#111827",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer"},children:"T\u1EEB ch\u1ED1i t\u1EA5t c\u1EA3"}),(0,r.jsx)("button",{type:"button",onClick:L,disabled:y.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50",style:{borderRadius:"0.5rem",background:"#111827",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer"},children:"Ch\u1EA5p nh\u1EADn t\u1EA5t c\u1EA3"})]}),y.isError&&(0,r.jsx)("p",{className:"consent:text-sm consent:text-red-600",style:{fontSize:"0.875rem",color:"#dc2626"},children:"\u0110\xE3 x\u1EA3y ra l\u1ED7i. Vui l\xF2ng th\u1EED l\u1EA1i."})]}),c&&(0,r.jsx)("div",{role:"dialog","aria-modal":"true","aria-label":"Trung t\xE2m tu\u1EF3 ch\u1ECDn b\u1EA3o m\u1EADt",style:{position:"fixed",inset:0,zIndex:60,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)",padding:"1rem"},onClick:i=>i.target===i.currentTarget&&d(!1),children:(0,r.jsxs)("div",{className:"consent:bg-white consent:rounded-xl consent:border consent:border-gray-200 consent:shadow-lg consent:max-h-[90vh] consent:overflow-y-auto",style:{backgroundColor:"#fff",borderRadius:"0.75rem",border:"1px solid #e5e7eb",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)",maxWidth:"28rem",width:"100%",maxHeight:"90vh",overflowY:"auto",padding:"1.25rem",position:"relative"},onClick:i=>i.stopPropagation(),children:[(0,r.jsx)("button",{type:"button",onClick:()=>d(!1),"aria-label":"\u0110\xF3ng",style:{position:"absolute",top:"1rem",right:"1rem",width:"2rem",height:"2rem",borderRadius:"0.25rem",border:"none",background:"transparent",cursor:"pointer",fontSize:"1.25rem",lineHeight:1,color:"#6b7280"},children:"\xD7"}),(0,r.jsx)("h2",{className:"consent:text-lg consent:font-semibold consent:text-gray-900",style:{fontSize:"1.125rem",fontWeight:600,color:"#111827",marginBottom:"0.75rem",paddingRight:"2rem"},children:"Trung t\xE2m tu\u1EF3 ch\u1ECDn b\u1EA3o m\u1EADt"}),(0,r.jsxs)("div",{className:"consent:text-sm consent:text-gray-600",style:{fontSize:"0.875rem",color:"#4b5563",marginBottom:"1rem"},children:[(0,r.jsx)("p",{style:{marginBottom:"0.5rem"},children:"Khi b\u1EA1n truy c\u1EADp b\u1EA5t k\u1EF3 trang web n\xE0o, trang web \u0111\xF3 c\xF3 th\u1EC3 l\u01B0u tr\u1EEF ho\u1EB7c truy xu\u1EA5t th\xF4ng tin tr\xEAn tr\xECnh duy\u1EC7t c\u1EE7a b\u1EA1n, ch\u1EE7 y\u1EBFu d\u01B0\u1EDBi d\u1EA1ng cookie. Th\xF4ng tin n\xE0y c\xF3 th\u1EC3 li\xEAn quan \u0111\u1EBFn b\u1EA1n, t\xF9y ch\u1ECDn c\u1EE7a b\u1EA1n ho\u1EB7c thi\u1EBFt b\u1ECB c\u1EE7a b\u1EA1n, v\xE0 ch\u1EE7 y\u1EBFu \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u0111\u1EC3 trang web ho\u1EA1t \u0111\u1ED9ng nh\u01B0 mong \u0111\u1EE3i."}),(0,r.jsx)("p",{style:{marginBottom:"0.5rem"},children:"Th\xF4ng tin n\xE0y th\u01B0\u1EDDng kh\xF4ng tr\u1EF1c ti\u1EBFp x\xE1c \u0111\u1ECBnh b\u1EA1n nh\u01B0ng c\xF3 th\u1EC3 mang l\u1EA1i tr\u1EA3i nghi\u1EC7m web \u0111\u01B0\u1EE3c c\xE1 nh\xE2n h\xF3a h\u01A1n. Ch\xFAng t\xF4i t\xF4n tr\u1ECDng quy\u1EC1n ri\xEAng t\u01B0 c\u1EE7a b\u1EA1n; b\u1EA1n c\xF3 th\u1EC3 ch\u1ECDn kh\xF4ng cho ph\xE9p m\u1ED9t s\u1ED1 lo\u1EA1i cookie. Nh\u1EA5p v\xE0o ti\xEAu \u0111\u1EC1 t\u1EEBng danh m\u1EE5c \u0111\u1EC3 t\xECm hi\u1EC3u th\xEAm v\xE0 thay \u0111\u1ED5i c\xE0i \u0111\u1EB7t m\u1EB7c \u0111\u1ECBnh. Vi\u1EC7c ch\u1EB7n m\u1ED9t s\u1ED1 cookie c\xF3 th\u1EC3 \u1EA3nh h\u01B0\u1EDFng \u0111\u1EBFn tr\u1EA3i nghi\u1EC7m c\u1EE7a b\u1EA1n v\u1EDBi trang web v\xE0 c\xE1c d\u1ECBch v\u1EE5 \u0111\u01B0\u1EE3c cung c\u1EA5p."}),(0,r.jsx)("p",{style:{marginBottom:"0.5rem"},children:'N\u1EBFu ch\u1ECDn "Kh\xF4ng theo d\xF5i" khi l\u1EA7n \u0111\u1EA7u s\u1EED d\u1EE5ng TapQuest, ch\u1EC9 cookie ho\xE0n to\xE0n c\u1EA7n thi\u1EBFt m\u1EDBi \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng.'}),(0,r.jsx)("span",{style:{color:"#2563eb",textDecoration:"underline"},children:"Th\xF4ng tin kh\xE1c"})]}),(0,r.jsx)("h3",{className:"consent:text-sm consent:font-semibold consent:text-gray-900",style:{fontSize:"0.875rem",fontWeight:600,color:"#111827",marginBottom:"0.75rem"},children:"Qu\u1EA3n l\xFD tu\u1EF3 ch\u1ECDn \u0111\u1ED3ng \xFD"}),(0,r.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",marginBottom:"1.25rem"},children:m.map(i=>{let C=i.id??i.name??"",E=k[C],M=u===C,Q=i.is_mandatory===!0;return(0,r.jsxs)("div",{style:{border:"1px solid #e5e7eb",borderRadius:"0.5rem",overflow:"hidden"},children:[(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.75rem",cursor:"pointer",backgroundColor:M?"#f9fafb":"transparent"},onClick:()=>p(M?null:C),children:[(0,r.jsx)("span",{style:{flexShrink:0,width:"1.25rem",height:"1.25rem",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"1rem",color:"#6b7280",transform:M?"rotate(45deg)":"none",transition:"transform 0.2s"},children:"+"}),(0,r.jsx)("span",{className:"consent:font-medium consent:text-gray-900",style:{flex:1,fontSize:"0.875rem",fontWeight:500,color:"#111827"},children:i.name??C}),(0,r.jsx)("button",{type:"button",role:"switch","aria-checked":E,"aria-label":`${i.name??C} ${E?"b\u1EADt":"t\u1EAFt"}`,disabled:Q,onClick:ge=>{ge.stopPropagation(),U(C)},style:{flexShrink:0,width:44,height:24,borderRadius:12,border:"none",padding:0,cursor:Q?"default":"pointer",backgroundColor:Q?"#e5e7eb":E?"#111827":"#d1d5db",opacity:Q?.7:1,transition:"background-color 0.2s"},children:(0,r.jsx)("span",{style:{display:"block",width:20,height:20,borderRadius:"50%",backgroundColor:"#fff",marginLeft:E?22:2,marginTop:2,transition:"margin-left 0.2s",boxShadow:"0 1px 2px rgb(0 0 0 / 0.2)"}})})]}),M&&(0,r.jsx)("div",{className:"consent:text-sm consent:text-gray-600",style:{fontSize:"0.875rem",color:"#4b5563",padding:"0.75rem 0.75rem 0.75rem 2.5rem",borderTop:"1px solid #e5e7eb"},children:i.description??""})]},C)})}),(0,r.jsx)("button",{type:"button",onClick:F,disabled:y.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm hover:consent:bg-gray-800 disabled:consent:opacity-50 consent:w-full",style:{borderRadius:"0.5rem",background:"#111827",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer",width:"100%"},children:"X\xE1c nh\u1EADn l\u1EF1a ch\u1ECDn c\u1EE7a t\xF4i"})]})})]})}var Ge="analytics",Le="advertising";function z(){let e=O();return e?.selected_preferences?e.selected_preferences.includes(Ge):!1}function ee(){let e=O();return e?.selected_preferences?e.selected_preferences.includes(Le):!1}var G=require("react/jsx-runtime"),fe=(0,S.createContext)(void 0);function qe({children:e,deviceId:t,showBannerWhenNoPreference:n=!0}){let[o,s]=(0,S.useState)(!1),c=(0,S.useCallback)(()=>{let u=O();s(!!u)},[]);(0,S.useEffect)(()=>{c()},[c]);let d={deviceId:t,hasConsentPreference:o,isAnalyticsAllowed:z(),isAdvertisingAllowed:ee(),refreshConsentPreference:c};return(0,G.jsxs)(fe.Provider,{value:d,children:[e,n&&!o&&(0,G.jsx)(Z,{onSubmitted:c})]})}function We(e){let{children:t,deviceId:n,showBannerWhenNoPreference:o=!0,...s}=e;return(0,G.jsx)(de,{...s,children:(0,G.jsx)(qe,{deviceId:n,showBannerWhenNoPreference:o,children:t})})}function W(){let e=(0,S.useContext)(fe);if(!e)throw new Error("usePhygitalConsent must be used within a PhygitalConsentProvider");return e}function ze(){return W(),z()}var te=require("react");var me=require("@phygitallabs/helpers"),f=require("react/jsx-runtime"),Me="V\xEC b\u1EA1n kh\xF4ng \u0111\u1ED3ng \xFD v\u1EDBi th\u1ECFa thu\u1EADn n\xE0y. Ch\xFAng t\xF4i s\u1EBD x\xF3a t\xE0i kho\u1EA3n trong v\xF2ng x ng\xE0y. Nh\u1EA5n n\xFAt '\u0110\u1ED3ng \xFD' \u0111\u1EC3 ti\u1EBFp t\u1EE5c";function Qe({open:e,onClose:t,onReject:n,userId:o,onAgreeSuccess:s}){let[c,d]=(0,te.useState)(!1),[u,p]=(0,te.useState)(!1),{data:a}=q({type:"ACCOUNT_REGISTER"}),I=g=>{try{return JSON.parse(g||"")}catch{return{htmlContent:""}}},x=a?.data?.[0]?.documents?.find(g=>g.id==="privacy-policy"),N=I(x?.content),m=Y({onSuccess:(g,L)=>{L.status==="ACCEPTED"&&s?.(),k()}}),k=()=>{d(!1),p(!1),t()},A=()=>{p(!0)},y=()=>{p(!1)},l=g=>({user_id:o,status:g,page_url:typeof window<"u"?window.location.href:void 0,user_agent:typeof navigator<"u"?navigator.userAgent:void 0}),b=()=>{m.mutate(l("REJECTED")),n?.()},U=()=>{c&&m.mutate(l("ACCEPTED"))};return e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:(0,f.jsxs)("div",{className:"consent:bg-white consent:overflow-hidden consent:flex consent:flex-col",style:{backgroundColor:"#fff",maxWidth:"28rem",width:"100%",maxHeight:"90vh",overflow:"hidden",display:"flex",flexDirection:"column",position:"relative"},onClick:g=>g.stopPropagation(),children:[(0,f.jsx)("h2",{style:{fontSize:"18px",fontWeight:600,color:"#000",paddingTop:"20px",paddingBottom:"12px"},children:"Ch\xEDnh s\xE1ch b\u1EA3o m\u1EADt"}),(0,f.jsx)("div",{style:{flex:1,overflowY:"auto",paddingTop:"1rem",paddingBottom:"1rem",fontSize:"0.875rem",color:"#111827",lineHeight:1.6},children:(0,f.jsx)("p",{style:{margin:0,whiteSpace:"pre-wrap"},children:(0,me.parse)(N?.htmlContent)})}),(0,f.jsxs)("div",{style:{paddingTop:"1rem",paddingBottom:"1rem",display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,f.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.875rem",color:"#111827",cursor:"pointer"},children:[(0,f.jsx)("input",{type:"checkbox",checked:c,onChange:g=>d(g.target.checked),style:{width:"1rem",height:"1rem",accentColor:"#111827"},"aria-label":"T\xF4i \u0111\u1ED3ng \xFD v\u1EDBi ch\xEDnh s\xE1ch b\u1EA3o m\u1EADt tr\xEAn"}),(0,f.jsx)("span",{children:"T\xF4i \u0111\u1ED3ng \xFD v\u1EDBi ch\xEDnh s\xE1ch b\u1EA3o m\u1EADt tr\xEAn"})]}),(0,f.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[(0,f.jsx)("button",{type:"button",onClick:A,disabled:m.isPending,className:"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50",style:{flex:1,borderRadius:"0.5rem",border:"1px solid #111827",background:"#fff",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#111827",cursor:"pointer"},children:"T\u1EEB ch\u1ED1i"}),(0,f.jsx)("button",{type:"button",onClick:U,disabled:!c||m.isPending,className:"consent:rounded-lg consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:shadow-sm disabled:consent:opacity-50 disabled:consent:cursor-not-allowed",style:{flex:1,minWidth:0,borderRadius:"0.5rem",background:c?"#111827":"#e5e7eb",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:c?"#fff":"#9ca3af",border:"none",cursor:c?"pointer":"not-allowed"},children:"Ti\u1EBFp t\u1EE5c"})]}),m.isError&&(0,f.jsx)("p",{className:"consent:text-sm consent:text-red-600",style:{fontSize:"0.875rem",color:"#dc2626",margin:0},children:"\u0110\xE3 x\u1EA3y ra l\u1ED7i. Vui l\xF2ng th\u1EED l\u1EA1i."})]})]})}),u&&(0,f.jsx)("div",{role:"alertdialog","aria-modal":"true","aria-label":"Th\xF4ng b\xE1o t\u1EEB ch\u1ED1i",style:{position:"fixed",inset:0,zIndex:70,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.5)",padding:"1rem"},onClick:g=>g.target===g.currentTarget&&y(),children:(0,f.jsxs)("div",{className:"consent:bg-white consent:rounded-xl consent:border consent:border-gray-200 consent:shadow-lg",style:{backgroundColor:"#fff",borderRadius:"0.75rem",border:"1px solid #e5e7eb",boxShadow:"0 10px 15px -3px rgb(0 0 0 / 0.1)",maxWidth:"22rem",width:"100%",padding:"1.25rem"},onClick:g=>g.stopPropagation(),children:[(0,f.jsx)("p",{className:"consent:text-sm consent:text-gray-700",style:{fontSize:"0.875rem",color:"#374151",margin:"0 0 1rem 0",lineHeight:1.5},children:Me}),(0,f.jsxs)("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[(0,f.jsx)("button",{type:"button",onClick:y,className:"consent:rounded-lg consent:border consent:border-gray-300 consent:bg-white consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-gray-700 consent:shadow-sm hover:consent:bg-gray-50 disabled:consent:opacity-50",style:{flex:1,borderRadius:"0.5rem",border:"1px solid #111827",background:"#fff",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#111827",cursor:"pointer"},children:"Tr\u1EDF l\u1EA1i"}),(0,f.jsx)("button",{type:"button",onClick:b,disabled:m.isPending,className:"consent:rounded-lg consent:bg-gray-900 consent:px-4 consent:py-2 consent:text-sm consent:font-medium consent:text-white consent:shadow-sm disabled:consent:opacity-50 consent:flex-1",style:{flex:1,minWidth:0,borderRadius:"0.5rem",background:"#a71f24",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:500,color:"#fff",border:"none",cursor:"pointer"},children:"\u0110\u1ED3ng \xFD"})]}),m.isError&&(0,f.jsx)("p",{className:"consent:text-sm consent:text-red-600",style:{fontSize:"0.875rem",color:"#dc2626",margin:"0.5rem 0 0 0"},children:"\u0110\xE3 x\u1EA3y ra l\u1ED7i. Vui l\xF2ng th\u1EED l\u1EA1i."})]})})]}):null}0&&(module.exports={COOKIE_CONSENT_NAME,CookieConsentBanner,EntityStatus,MediaType,PhygitalConsentProvider,PolicyPopup,consentQueryKeys,consentService,getConsentPreferenceCookie,getCookie,isAdvertisingAllowed,isAnalyticsAllowed,policyQueryKeys,setConsentPreferenceCookie,setCookie,sha256,useConsentById,useCreateDeviceCookieConsent,useCreateUserConsent,useHealth,useIsAnalyticsAllowed,useLatestConsentByUserId,useLatestCookieConsentByDeviceId,useManyConsents,usePhygitalConsent,usePolicies});
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|