@c15t/react 1.1.5 → 1.2.0-canary.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/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/providers/__tests__/test-helpers.cjs +1 -1
- package/dist/providers/__tests__/test-helpers.d.ts +6 -0
- package/dist/providers/__tests__/test-helpers.d.ts.map +1 -1
- package/dist/providers/__tests__/test-helpers.js +1 -1
- package/package.json +5 -5
package/dist/hooks/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"./use-consent-manager":function(e){e.exports=require("./use-consent-manager.cjs")},"./use-focus-trap":function(e){e.exports=require("./use-focus-trap.cjs")},"
|
|
1
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_modules__={"./use-consent-manager":function(e){e.exports=require("./use-consent-manager.cjs")},"./use-focus-trap":function(e){e.exports=require("./use-focus-trap.cjs")},"./use-theme":function(e){e.exports=require("./use-theme.cjs")},"./use-translations":function(e){e.exports=require("./use-translations.cjs")}},__webpack_module_cache__={};function __webpack_require__(e){var _=__webpack_module_cache__[e];if(void 0!==_)return _.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var _=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(_,{a:_}),_},__webpack_require__.d=(e,_)=>{for(var r in _)__webpack_require__.o(_,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:_[r]})},__webpack_require__.o=(e,_)=>Object.prototype.hasOwnProperty.call(e,_),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};for(var __webpack_i__ in(()=>{__webpack_require__.r(__webpack_exports__);var e=__webpack_require__("./use-consent-manager"),_={};for(var r in e)"default"!==r&&(_[r]=(function(_){return e[_]}).bind(0,r));__webpack_require__.d(__webpack_exports__,_);var a=__webpack_require__("./use-focus-trap"),_={};for(var r in a)"default"!==r&&(_[r]=(function(e){return a[e]}).bind(0,r));__webpack_require__.d(__webpack_exports__,_);var t=__webpack_require__("./use-theme"),_={};for(var r in t)"default"!==r&&(_[r]=(function(e){return t[e]}).bind(0,r));__webpack_require__.d(__webpack_exports__,_);var u=__webpack_require__("./use-translations"),_={};for(var r in u)"default"!==r&&(_[r]=(function(e){return u[e]}).bind(0,r));__webpack_require__.d(__webpack_exports__,_)})(),__webpack_exports__)exports[__webpack_i__]=__webpack_exports__[__webpack_i__];Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/hooks/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import*as e from"./use-theme.js";export*from"./use-consent-manager.js";export*from"./use-focus-trap.js";export*from"./use-translations.js";var o={"~/hooks/use-theme":function(o){o.exports=e}},r={};!function e(s){var t=r[s];if(void 0!==t)return t.exports;var n=r[s]={exports:{}};return o[s](n,n.exports,e),n.exports}("~/hooks/use-theme");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,n)=>{for(var r in n)__webpack_require__.o(n,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},__webpack_require__.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{setupMocks:()=>setupMocks,TestConsumer:()=>TestConsumer});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_vitest_namespaceObject=require("vitest"),external_index_cjs_namespaceObject=require("../../index.cjs");function setupMocks(){let e=external_vitest_namespaceObject.vi.fn();window.fetch=e;let n=external_vitest_namespaceObject.vi.fn(),r=new Map;return(0,external_vitest_namespaceObject.beforeEach)(()=>{r.clear()}),external_vitest_namespaceObject.vi.mock("c15t",async()=>({...await external_vitest_namespaceObject.vi.importActual("c15t"),configureConsentManager:s=>{n(s);let t=s.backendURL||"";if("c15t"===s.mode)return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>(r.has(t)||(e(`${t}/show-consent-banner`,{headers:{"Content-Type":"application/json"}}),r.set(t,!0)),{ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("offline"===s.mode)return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("custom"===s.mode&&"endpointHandlers"in s){let e=s.endpointHandlers;return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>e.showConsentBanner({}),setConsent:async n=>e.setConsent(n),verifyConsent:async n=>e.verifyConsent(n)}}return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})}}})),{mockFetch:e,mockConfigureConsentManager:n}}let TestConsumer=()=>{let e=(0,external_index_cjs_namespaceObject.useConsentManager)();return(0,jsx_runtime_namespaceObject.jsx)("div",{"data-testid":"consumer",children:e.showPopup?"Show":"Hide"})};for(var __webpack_i__ in exports.TestConsumer=__webpack_exports__.TestConsumer,exports.setupMocks=__webpack_exports__.setupMocks,__webpack_exports__)-1===["TestConsumer","setupMocks"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
1
|
+
"use strict";let __rslib_import_meta_url__="undefined"==typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,n)=>{for(var r in n)__webpack_require__.o(n,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},__webpack_require__.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{setupMocks:()=>setupMocks,TestConsumer:()=>TestConsumer});let jsx_runtime_namespaceObject=require("react/jsx-runtime"),external_vitest_namespaceObject=require("vitest"),external_index_cjs_namespaceObject=require("../../index.cjs");function setupMocks(){let e=external_vitest_namespaceObject.vi.fn();window.fetch=e;let n=external_vitest_namespaceObject.vi.fn(),r=new Map;return(0,external_vitest_namespaceObject.beforeEach)(()=>{r.clear()}),external_vitest_namespaceObject.vi.mock("c15t",async()=>({...await external_vitest_namespaceObject.vi.importActual("c15t"),configureConsentManager:s=>{n(s);let t=s.backendURL||"";if("c15t"===s.mode)return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>(r.has(t)||(e(`${t}/show-consent-banner`,{headers:{"Content-Type":"application/json"}}),r.set(t,!0)),{ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("offline"===s.mode)return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("custom"===s.mode&&"endpointHandlers"in s){let e=s.endpointHandlers;return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>e.showConsentBanner({}),setConsent:async n=>e.setConsent({body:n}),verifyConsent:async n=>e.verifyConsent({body:n})}}return{getCallbacks:()=>s.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})}}})),{mockFetch:e,mockConfigureConsentManager:n}}let TestConsumer=()=>{let e=(0,external_index_cjs_namespaceObject.useConsentManager)();return(0,jsx_runtime_namespaceObject.jsx)("div",{"data-testid":"consumer",children:e.showPopup?"Show":"Hide"})};for(var __webpack_i__ in exports.TestConsumer=__webpack_exports__.TestConsumer,exports.setupMocks=__webpack_exports__.setupMocks,__webpack_exports__)-1===["TestConsumer","setupMocks"].indexOf(__webpack_i__)&&(exports[__webpack_i__]=__webpack_exports__[__webpack_i__]);Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { ContractsInputs, ContractsOutputs } from 'c15t';
|
|
2
|
+
export type SetConsentRequestBody = ContractsInputs['consent']['post'];
|
|
3
|
+
export type SetConsentResponse = ContractsOutputs['consent']['post'];
|
|
4
|
+
export type ShowConsentBannerResponse = ContractsOutputs['consent']['showBanner'];
|
|
5
|
+
export type VerifyConsentRequestBody = ContractsInputs['consent']['verify'];
|
|
6
|
+
export type VerifyConsentResponse = ContractsOutputs['consent']['verify'];
|
|
1
7
|
export declare function setupMocks(): {
|
|
2
8
|
mockFetch: import("vitest").Mock<(...args: any[]) => any>;
|
|
3
9
|
mockConfigureConsentManager: import("vitest").Mock<(...args: any[]) => any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../../src/providers/__tests__/test-helpers.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../../src/providers/__tests__/test-helpers.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAK9D,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AACrE,MAAM,MAAM,yBAAyB,GACpC,gBAAgB,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;AAC3C,MAAM,MAAM,wBAAwB,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC5E,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE1E,wBAAgB,UAAU;;;EAkIzB;AAGD,eAAO,MAAM,YAAY,+CAOxB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as n from"react/jsx-runtime";import*as e from"vitest";import*as s from"../../index.js";function o(){let n=e.vi.fn();window.fetch=n;let s=e.vi.fn(),o=new Map;return(0,e.beforeEach)(()=>{o.clear()}),e.vi.mock("c15t",async()=>({...await e.vi.importActual("c15t"),configureConsentManager:e=>{s(e);let r=e.backendURL||"";if("c15t"===e.mode)return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>(o.has(r)||(n(`${r}/show-consent-banner`,{headers:{"Content-Type":"application/json"}}),o.set(r,!0)),{ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("offline"===e.mode)return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("custom"===e.mode&&"endpointHandlers"in e){let n=e.endpointHandlers;return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>n.showConsentBanner({}),setConsent:async e=>n.setConsent(e),verifyConsent:async e=>n.verifyConsent(e)}}return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})}}})),{mockFetch:n,mockConfigureConsentManager:s}}let r=()=>{let e=(0,s.useConsentManager)();return(0,n.jsx)("div",{"data-testid":"consumer",children:e.showPopup?"Show":"Hide"})};export{r as TestConsumer,o as setupMocks};
|
|
1
|
+
import*as n from"react/jsx-runtime";import*as e from"vitest";import*as s from"../../index.js";function o(){let n=e.vi.fn();window.fetch=n;let s=e.vi.fn(),o=new Map;return(0,e.beforeEach)(()=>{o.clear()}),e.vi.mock("c15t",async()=>({...await e.vi.importActual("c15t"),configureConsentManager:e=>{s(e);let r=e.backendURL||"";if("c15t"===e.mode)return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>(o.has(r)||(n(`${r}/show-consent-banner`,{headers:{"Content-Type":"application/json"}}),o.set(r,!0)),{ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("offline"===e.mode)return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})};if("custom"===e.mode&&"endpointHandlers"in e){let n=e.endpointHandlers;return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>n.showConsentBanner({}),setConsent:async e=>n.setConsent({body:e}),verifyConsent:async e=>n.verifyConsent({body:e})}}return{getCallbacks:()=>e.callbacks,showConsentBanner:async()=>({ok:!0,data:{showConsentBanner:!0},error:null,response:null}),setConsent:async()=>({ok:!0,data:{success:!0},error:null,response:null}),verifyConsent:async()=>({ok:!0,data:{valid:!0},error:null,response:null})}}})),{mockFetch:n,mockConfigureConsentManager:s}}let r=()=>{let e=(0,s.useConsentManager)();return(0,n.jsx)("div",{"data-testid":"consumer",children:e.showPopup?"Show":"Hide"})};export{r as TestConsumer,o as setupMocks};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c15t/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-canary.0",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"@radix-ui/react-switch": "1.1.4",
|
|
69
69
|
"clsx": "2.1.1",
|
|
70
70
|
"zustand": "^5.0.3",
|
|
71
|
-
"c15t": "1.
|
|
71
|
+
"c15t": "1.2.0-canary.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@c15t/backend": "1.0.
|
|
75
|
-
"@c15t/
|
|
76
|
-
"@c15t/
|
|
74
|
+
"@c15t/backend": "1.1.0-canary.0",
|
|
75
|
+
"@c15t/vitest-config": "1.0.0",
|
|
76
|
+
"@c15t/typescript-config": "0.0.1-beta.1"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|