@dismissible/react-client 0.3.2-canary.3.c1b8c41 → 0.3.2-canary.5.88e2777

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/README.md CHANGED
@@ -100,7 +100,7 @@ import { Dismissible } from '@dismissible/react-client';
100
100
 
101
101
  function WelcomeBanner() {
102
102
  return (
103
- <Dismissible id="welcome-banner">
103
+ <Dismissible itemId="welcome-banner">
104
104
  <div className="banner">
105
105
  <h2>Welcome to our app!</h2>
106
106
  <p>This banner can be dismissed and won't show again.</p>
@@ -193,12 +193,12 @@ The main component for creating dismissible content.
193
193
 
194
194
  | Prop | Type | Required | Description |
195
195
  |------|------|----------|-------------|
196
- | `id` | `string` | ✅ | Unique identifier for the dismissible item |
196
+ | `itemId` | `string` | ✅ | Unique identifier for the dismissible item |
197
197
  | `children` | `ReactNode` | ✅ | Content to render when not dismissed |
198
198
  | `onDismiss` | `() => void` | ❌ | Callback fired when item is dismissed |
199
- | `LoadingComponent` | `ComponentType<{id: string}>` | ❌ | Custom loading component |
200
- | `ErrorComponent` | `ComponentType<{id: string, error: Error}>` | ❌ | Custom error component |
201
- | `DismissButtonComponent` | `ComponentType<{id: string, onDismiss: () => Promise<void>, ariaLabel: string}>` | ❌ | Custom dismiss button |
199
+ | `LoadingComponent` | `ComponentType<{itemId: string}>` | ❌ | Custom loading component |
200
+ | `ErrorComponent` | `ComponentType<{itemId: string, error: Error}>` | ❌ | Custom error component |
201
+ | `DismissButtonComponent` | `ComponentType<{onDismiss: () => Promise<void>, ariaLabel: string}>` | ❌ | Custom dismiss button |
202
202
  | `ignoreErrors` | `boolean` | ❌ | Ignore errors and display component anyway (default: false) |
203
203
  | `enableCache` | `boolean` | ❌ | Enable localStorage caching (default: true) |
204
204
  | `cachePrefix` | `string` | ❌ | Cache key prefix (default: 'dismissible') |
@@ -208,7 +208,7 @@ The main component for creating dismissible content.
208
208
 
209
209
  ```tsx
210
210
  <Dismissible
211
- id="promo-banner"
211
+ itemId="promo-banner"
212
212
  onDismiss={() => console.log('Banner dismissed')}
213
213
  >
214
214
  <div className="promo">
@@ -226,8 +226,17 @@ For custom implementations and advanced use cases.
226
226
 
227
227
  | Parameter | Type | Required | Description |
228
228
  |-----------|------|----------|-------------|
229
- | `id` | `string` | ✅ | Unique identifier for the dismissible item |
230
- | `options` | `object` | ❌ | Cache configuration options |
229
+ | `itemId` | `string` | ✅ | Unique identifier for the dismissible item |
230
+ | `options` | `object` | ❌ | Configuration options |
231
+
232
+ #### Options
233
+
234
+ | Option | Type | Required | Description |
235
+ |--------|------|----------|-------------|
236
+ | `enableCache` | `boolean` | ❌ | Enable localStorage caching (default: true) |
237
+ | `cachePrefix` | `string` | ❌ | Cache key prefix (default: 'dismissible') |
238
+ | `cacheExpiration` | `number` | ❌ | Cache expiration time in milliseconds |
239
+ | `initialData` | `IDismissibleItem` | ❌ | Initial data for the dismissible item |
231
240
 
232
241
  #### Returns
233
242
 
@@ -245,8 +254,8 @@ For custom implementations and advanced use cases.
245
254
  ```tsx
246
255
  import { useDismissibleItem } from '@dismissible/react-client';
247
256
 
248
- function CustomDismissible({ id, children }) {
249
- const { dismissedOn, dismiss, restore, isLoading, error } = useDismissibleItem(id);
257
+ function CustomDismissible({ itemId, children }) {
258
+ const { dismissedOn, dismiss, restore, isLoading, error } = useDismissibleItem(itemId);
250
259
 
251
260
  if (isLoading) {
252
261
  return <div>Loading...</div>;
@@ -295,7 +304,7 @@ function App() {
295
304
 
296
305
  function Dashboard() {
297
306
  return (
298
- <Dismissible id="welcome-banner">
307
+ <Dismissible itemId="welcome-banner">
299
308
  <div className="alert alert-info">
300
309
  <h4>Welcome!</h4>
301
310
  <p>Thanks for joining our platform. Here are some quick tips to get started.</p>
@@ -330,7 +339,7 @@ function Dashboard() {
330
339
  return (
331
340
  <div>
332
341
  {/* Dismissible state is tracked per user */}
333
- <Dismissible id="user-welcome-banner">
342
+ <Dismissible itemId="user-welcome-banner">
334
343
  <div className="alert alert-info">
335
344
  <h4>Welcome back!</h4>
336
345
  <p>You have 3 new notifications.</p>
@@ -359,7 +368,7 @@ const CustomDismissButton = ({ onDismiss, ariaLabel }) => (
359
368
  function CustomBanner() {
360
369
  return (
361
370
  <Dismissible
362
- id="custom-banner"
371
+ itemId="custom-banner"
363
372
  DismissButtonComponent={CustomDismissButton}
364
373
  >
365
374
  <div className="banner">
@@ -375,7 +384,7 @@ function CustomBanner() {
375
384
  ```tsx
376
385
  import { Dismissible } from '@dismissible/react-client';
377
386
 
378
- const CustomLoader = ({ id }) => (
387
+ const CustomLoader = ({ itemId }) => (
379
388
  <div className="spinner">
380
389
  <div className="bounce1"></div>
381
390
  <div className="bounce2"></div>
@@ -396,7 +405,7 @@ const CustomError = ({ error }) => (
396
405
  function AdvancedBanner() {
397
406
  return (
398
407
  <Dismissible
399
- id="advanced-banner"
408
+ itemId="advanced-banner"
400
409
  LoadingComponent={CustomLoader}
401
410
  ErrorComponent={CustomError}
402
411
  >
@@ -416,19 +425,19 @@ import { Dismissible } from '@dismissible/react-client';
416
425
  function Dashboard() {
417
426
  return (
418
427
  <div>
419
- <Dismissible id="feature-announcement">
428
+ <Dismissible itemId="feature-announcement">
420
429
  <div className="alert alert-success">
421
430
  🎉 New feature: Dark mode is now available!
422
431
  </div>
423
432
  </Dismissible>
424
433
 
425
- <Dismissible id="maintenance-notice">
434
+ <Dismissible itemId="maintenance-notice">
426
435
  <div className="alert alert-warning">
427
436
  ⚠️ Scheduled maintenance: Sunday 2AM-4AM EST
428
437
  </div>
429
438
  </Dismissible>
430
439
 
431
- <Dismissible id="survey-request">
440
+ <Dismissible itemId="survey-request">
432
441
  <div className="alert alert-info">
433
442
  📝 Help us improve! Take our 2-minute survey.
434
443
  </div>
@@ -447,7 +456,7 @@ import { Dismissible } from '@dismissible/react-client';
447
456
  function RobustBanner() {
448
457
  return (
449
458
  <Dismissible
450
- id="important-announcement"
459
+ itemId="important-announcement"
451
460
  ignoreErrors={true}
452
461
  >
453
462
  <div className="important-banner">
@@ -533,8 +542,8 @@ function AppWithTokenRefresh() {
533
542
  import { useDismissibleItem } from '@dismissible/react-client';
534
543
  import { useState, useEffect } from 'react';
535
544
 
536
- function SmartNotification({ id, message, type = 'info' }) {
537
- const { dismissedOn, dismiss, isLoading } = useDismissibleItem(id);
545
+ function SmartNotification({ itemId, message, type = 'info' }) {
546
+ const { dismissedOn, dismiss, isLoading } = useDismissibleItem(itemId);
538
547
  const [autoHide, setAutoHide] = useState(false);
539
548
 
540
549
  // Auto-hide after 10 seconds for info messages
@@ -575,8 +584,8 @@ Use the `restore` function to bring back previously dismissed content:
575
584
  ```tsx
576
585
  import { useDismissibleItem } from '@dismissible/react-client';
577
586
 
578
- function RestorableBanner({ id }) {
579
- const { dismissedOn, dismiss, restore, isLoading } = useDismissibleItem(id);
587
+ function RestorableBanner({ itemId }) {
588
+ const { dismissedOn, dismiss, restore, isLoading } = useDismissibleItem(itemId);
580
589
 
581
590
  if (dismissedOn) {
582
591
  return (
@@ -674,7 +683,7 @@ The library includes minimal default styles. You can override them or provide yo
674
683
  The library is written in TypeScript and exports all type definitions:
675
684
 
676
685
  ```tsx
677
- import type {
686
+ import type {
678
687
  DismissibleProps,
679
688
  DismissibleProviderProps,
680
689
  JwtToken,
@@ -320,6 +320,8 @@ function ue(e, r, t) {
320
320
  return `.${i}`;
321
321
  case "matrix":
322
322
  return `;${e}=${i}`;
323
+ // case "spaceDelimited":
324
+ // case "pipeDelimited":
323
325
  default:
324
326
  return `${e}=${i}`;
325
327
  }
@@ -479,7 +481,7 @@ const ae = (e, r, t) => {
479
481
  );
480
482
  if (c) return c;
481
483
  }
482
- }), S = V(() => $(void 0, null, function* () {
484
+ }), S = V(() => $(null, null, function* () {
483
485
  var y;
484
486
  if (n) {
485
487
  const h = ae(
@@ -497,7 +499,7 @@ const ae = (e, r, t) => {
497
499
  a.current = c, C(!0), x(null);
498
500
  try {
499
501
  const h = yield i.getAuthHeaders(), { data: H, error: G } = yield f.GET(
500
- "/v1/user/{userId}/dismissible-item/{itemId}",
502
+ "/v1/users/{userId}/items/{itemId}",
501
503
  {
502
504
  params: {
503
505
  path: {
@@ -545,11 +547,11 @@ const ae = (e, r, t) => {
545
547
  cacheExpiration: s
546
548
  }, S());
547
549
  }, [n, o, s, d, S]);
548
- const P = V(() => $(void 0, null, function* () {
550
+ const P = V(() => $(null, null, function* () {
549
551
  x(null);
550
552
  try {
551
553
  const c = yield i.getAuthHeaders(), { data: y, error: h } = yield f.DELETE(
552
- "/v1/user/{userId}/dismissible-item/{itemId}",
554
+ "/v1/users/{userId}/items/{itemId}",
553
555
  {
554
556
  params: {
555
557
  path: {
@@ -576,11 +578,11 @@ const ae = (e, r, t) => {
576
578
  o,
577
579
  f,
578
580
  i
579
- ]), z = V(() => $(void 0, null, function* () {
581
+ ]), z = V(() => $(null, null, function* () {
580
582
  x(null);
581
583
  try {
582
584
  const c = yield i.getAuthHeaders(), { data: y, error: h } = yield f.POST(
583
- "/v1/user/{userId}/dismissible-item/{itemId}",
585
+ "/v1/users/{userId}/items/{itemId}",
584
586
  {
585
587
  params: {
586
588
  path: {
@@ -648,7 +650,7 @@ const ae = (e, r, t) => {
648
650
  _(() => {
649
651
  C(!1);
650
652
  }, [e]);
651
- const O = () => $(void 0, null, function* () {
653
+ const O = () => $(null, null, function* () {
652
654
  C(!0);
653
655
  try {
654
656
  yield a(), t == null || t();
@@ -666,7 +668,7 @@ const ae = (e, r, t) => {
666
668
  }
667
669
  ) : null
668
670
  ] });
669
- }, He = (e) => $(void 0, null, function* () {
671
+ }, He = (e) => $(null, null, function* () {
670
672
  if (typeof e == "function")
671
673
  try {
672
674
  const r = e();
@@ -676,7 +678,7 @@ const ae = (e, r, t) => {
676
678
  return;
677
679
  }
678
680
  return e;
679
- }), qe = (e) => $(void 0, null, function* () {
681
+ }), qe = (e) => $(null, null, function* () {
680
682
  const r = yield He(e);
681
683
  return r ? { Authorization: `Bearer ${r}` } : {};
682
684
  }), Oe = (e) => {
@@ -701,7 +703,7 @@ const ae = (e, r, t) => {
701
703
  userId: e,
702
704
  jwt: r,
703
705
  baseUrl: t,
704
- getAuthHeaders: () => $(void 0, null, function* () {
706
+ getAuthHeaders: () => $(null, null, function* () {
705
707
  return yield qe(r);
706
708
  })
707
709
  }),
@@ -1 +1 @@
1
- (function(c,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],d):(c=typeof globalThis!="undefined"?globalThis:c||self,d(c.DismissibleClient={},c.React.jsxRuntime,c.React))})(this,function(c,d,o){"use strict";var Ae=Object.defineProperty,$e=Object.defineProperties;var Te=Object.getOwnPropertyDescriptors;var Q=Object.getOwnPropertySymbols;var ye=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var me=(c,d,o)=>d in c?Ae(c,d,{enumerable:!0,configurable:!0,writable:!0,value:o}):c[d]=o,g=(c,d)=>{for(var o in d||(d={}))ye.call(d,o)&&me(c,o,d[o]);if(Q)for(var o of Q(d))be.call(d,o)&&me(c,o,d[o]);return c},S=(c,d)=>$e(c,Te(d));var re=(c,d)=>{var o={};for(var R in c)ye.call(c,R)&&d.indexOf(R)<0&&(o[R]=c[R]);if(c!=null&&Q)for(var R of Q(c))d.indexOf(R)<0&&be.call(c,R)&&(o[R]=c[R]);return o};var U=(c,d,o)=>new Promise((R,M)=>{var V=j=>{try{q(o.next(j))}catch(F){M(F)}},X=j=>{try{q(o.throw(j))}catch(F){M(F)}},q=j=>j.done?R(j.value):Promise.resolve(j.value).then(V,X);q((o=o.apply(c,d)).next())});const R=/\{[^{}]+\}/g,M=()=>{var e,r;return typeof process=="object"&&Number.parseInt((r=(e=process==null?void 0:process.versions)==null?void 0:e.node)==null?void 0:r.substring(0,2))>=18&&process.versions.undici};function V(){return Math.random().toString(36).slice(2,11)}function X(e){let H=g({},e),{baseUrl:r="",Request:t=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:s,headers:a,requestInitExt:h=void 0}=H,b=re(H,["baseUrl","Request","fetch","querySerializer","bodySerializer","headers","requestInitExt"]);h=M()?h:void 0,r=ie(r);const m=[];function C(f,l){return U(this,null,function*(){var he;const de=l||{},{baseUrl:x,fetch:A=n,Request:L=t,headers:$,params:D={},parseAs:O="json",querySerializer:T,bodySerializer:J=s!=null?s:pe,body:W,middleware:_=[]}=de,u=re(de,["baseUrl","fetch","Request","headers","params","parseAs","querySerializer","bodySerializer","body","middleware"]);let p=r;x&&(p=(he=ie(x))!=null?he:r);let y=typeof i=="function"?i:se(i);T&&(y=typeof T=="function"?T:se(g(g({},typeof i=="object"?i:{}),T)));const k=W===void 0?void 0:J(W,ne(a,$,D.header)),ee=ne(k===void 0||k instanceof FormData?{}:{"Content-Type":"application/json"},a,$,D.header),P=[...m,..._],je=S(g(g({redirect:"follow"},b),u),{body:k,headers:ee});let B,G,I=new L(ge(f,{baseUrl:p,params:D,querySerializer:y}),je),w;for(const v in u)v in I||(I[v]=u[v]);if(P.length){B=V(),G=Object.freeze({baseUrl:p,fetch:A,parseAs:O,querySerializer:y,bodySerializer:J});for(const v of P)if(v&&typeof v=="object"&&typeof v.onRequest=="function"){const E=yield v.onRequest({request:I,schemaPath:f,params:D,options:G,id:B});if(E)if(E instanceof L)I=E;else if(E instanceof Response){w=E;break}else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!w){try{w=yield A(I,h)}catch(v){let E=v;if(P.length)for(let z=P.length-1;z>=0;z--){const K=P[z];if(K&&typeof K=="object"&&typeof K.onError=="function"){const N=yield K.onError({request:I,error:E,schemaPath:f,params:D,options:G,id:B});if(N){if(N instanceof Response){E=void 0,w=N;break}if(N instanceof Error){E=N;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(E)throw E}if(P.length)for(let v=P.length-1;v>=0;v--){const E=P[v];if(E&&typeof E=="object"&&typeof E.onResponse=="function"){const z=yield E.onResponse({request:I,response:w,schemaPath:f,params:D,options:G,id:B});if(z){if(!(z instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");w=z}}}}if(w.status===204||I.method==="HEAD"||w.headers.get("Content-Length")==="0")return w.ok?{data:void 0,response:w}:{error:void 0,response:w};if(w.ok)return O==="stream"?{data:w.body,response:w}:{data:yield w[O](),response:w};let te=yield w.text();try{te=JSON.parse(te)}catch(v){}return{error:te,response:w}})}return{request(f,l,x){return C(l,S(g({},x),{method:f.toUpperCase()}))},GET(f,l){return C(f,S(g({},l),{method:"GET"}))},PUT(f,l){return C(f,S(g({},l),{method:"PUT"}))},POST(f,l){return C(f,S(g({},l),{method:"POST"}))},DELETE(f,l){return C(f,S(g({},l),{method:"DELETE"}))},OPTIONS(f,l){return C(f,S(g({},l),{method:"OPTIONS"}))},HEAD(f,l){return C(f,S(g({},l),{method:"HEAD"}))},PATCH(f,l){return C(f,S(g({},l),{method:"PATCH"}))},TRACE(f,l){return C(f,S(g({},l),{method:"TRACE"}))},use(...f){for(const l of f)if(l){if(typeof l!="object"||!("onRequest"in l||"onResponse"in l||"onError"in l))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");m.push(l)}},eject(...f){for(const l of f){const x=m.indexOf(l);x!==-1&&m.splice(x,1)}}}}function q(e,r,t){if(r==null)return"";if(typeof r=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${(t==null?void 0:t.allowReserved)===!0?r:encodeURIComponent(r)}`}function j(e,r,t){if(!r||typeof r!="object")return"";const n=[],i={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(const h in r)n.push(h,t.allowReserved===!0?r[h]:encodeURIComponent(r[h]));const a=n.join(",");switch(t.style){case"form":return`${e}=${a}`;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return a}}for(const a in r){const h=t.style==="deepObject"?`${e}[${a}]`:a;n.push(q(h,r[a],t))}const s=n.join(i);return t.style==="label"||t.style==="matrix"?`${i}${s}`:s}function F(e,r,t){if(!Array.isArray(r))return"";if(t.explode===!1){const s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[t.style]||",",a=(t.allowReserved===!0?r:r.map(h=>encodeURIComponent(h))).join(s);switch(t.style){case"simple":return a;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return`${e}=${a}`}}const n={simple:",",label:".",matrix:";"}[t.style]||"&",i=[];for(const s of r)t.style==="simple"||t.style==="label"?i.push(t.allowReserved===!0?s:encodeURIComponent(s)):i.push(q(e,s,t));return t.style==="label"||t.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function se(e){return function(t){const n=[];if(t&&typeof t=="object")for(const i in t){const s=t[i];if(s!=null){if(Array.isArray(s)){if(s.length===0)continue;n.push(F(i,s,S(g({style:"form",explode:!0},e==null?void 0:e.array),{allowReserved:(e==null?void 0:e.allowReserved)||!1})));continue}if(typeof s=="object"){n.push(j(i,s,S(g({style:"deepObject",explode:!0},e==null?void 0:e.object),{allowReserved:(e==null?void 0:e.allowReserved)||!1})));continue}n.push(q(i,s,e))}}return n.join("&")}}function we(e,r){var n;let t=e;for(const i of(n=e.match(R))!=null?n:[]){let s=i.substring(1,i.length-1),a=!1,h="simple";if(s.endsWith("*")&&(a=!0,s=s.substring(0,s.length-1)),s.startsWith(".")?(h="label",s=s.substring(1)):s.startsWith(";")&&(h="matrix",s=s.substring(1)),!r||r[s]===void 0||r[s]===null)continue;const b=r[s];if(Array.isArray(b)){t=t.replace(i,F(s,b,{style:h,explode:a}));continue}if(typeof b=="object"){t=t.replace(i,j(s,b,{style:h,explode:a}));continue}if(h==="matrix"){t=t.replace(i,`;${q(s,b)}`);continue}t=t.replace(i,h==="label"?`.${encodeURIComponent(b)}`:encodeURIComponent(b))}return t}function pe(e,r){var t,n;return e instanceof FormData?e:r&&(r.get instanceof Function?(t=r.get("Content-Type"))!=null?t:r.get("content-type"):(n=r["Content-Type"])!=null?n:r["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(e).toString():JSON.stringify(e)}function ge(e,r){var i,s;let t=`${r.baseUrl}${e}`;(i=r.params)!=null&&i.path&&(t=we(t,r.params.path));let n=r.querySerializer((s=r.params.query)!=null?s:{});return n.startsWith("?")&&(n=n.substring(1)),n&&(t+=`?${n}`),t}function ne(...e){const r=new Headers;for(const t of e){if(!t||typeof t!="object")continue;const n=t instanceof Headers?t.entries():Object.entries(t);for(const[i,s]of n)if(s===null)r.delete(i);else if(Array.isArray(s))for(const a of s)r.append(i,a);else s!==void 0&&r.set(i,s)}return r}function ie(e){return e.endsWith("/")?e.substring(0,e.length-1):e}const oe=(e,r,t)=>{try{const n=`${r}_${e}`,i=localStorage.getItem(n);if(!i)return null;const{data:s,timestamp:a}=JSON.parse(i);return t&&Date.now()-a>t?(localStorage.removeItem(n),null):s}catch(n){return null}},Y=(e,r,t)=>{try{const n=`${t}_${e}`,i={data:r,timestamp:Date.now()};localStorage.setItem(n,JSON.stringify(i))}catch(n){console.warn("Failed to cache dismissible item:",n)}},ae=(e,r)=>{try{const t=`${r}_${e}`;localStorage.removeItem(t)}catch(t){console.warn("Failed to remove cached dismissible item:",t)}},Z=o.createContext(null),ce=()=>{const e=o.useContext(Z);if(!e)throw new Error("useDismissibleContext must be used within a DismissibleProvider");return e},Ee="dismissible",le=(e,r={})=>{var _;const{initialData:t,enableCache:n=!0,cachePrefix:i=Ee,cacheExpiration:s}=r,a=ce(),{userId:h}=a,b=o.useMemo(()=>X({baseUrl:a.baseUrl,headers:{}}),[a.baseUrl]),m=o.useMemo(()=>`${h}-${e}`,[h,e]),C=o.useRef({enableCache:n,cachePrefix:i,cacheExpiration:s}),H=o.useRef(e),f=o.useRef(m),l=o.useRef(null),[x,A]=o.useState(!1),[L,$]=o.useState(null),[D,O]=o.useState(()=>{if(t)return t;if(n){const u=oe(m,i,s);if(u)return u}}),T=o.useCallback(()=>U(this,null,function*(){var p;if(n){const y=oe(m,i,s);if(y!=null&&y.dismissedAt){O(y),A(!1);return}}(p=l.current)==null||p.abort();const u=new AbortController;l.current=u,A(!0),$(null);try{const y=yield a.getAuthHeaders(),{data:k,error:ee}=yield b.GET("/v1/user/{userId}/dismissible-item/{itemId}",{params:{path:{userId:h,itemId:e}},headers:y,signal:u.signal});if(ee||!k)throw new Error("Failed to fetch dismissible item");O(k.data),n&&Y(m,k.data,i)}catch(y){if(y instanceof Error&&y.name==="AbortError")return;$(y instanceof Error?y:new Error("Unknown error occurred"))}finally{A(!1)}}),[e,h,m,n,i,s,b,a]);o.useEffect(()=>{const u=H.current!==e,p=f.current!==m;u||p?(H.current=e,f.current=m,T()):t||T()},[e,m,t,T]),o.useEffect(()=>()=>{var u;(u=l.current)==null||u.abort()},[]),o.useEffect(()=>{const u=C.current;(u.enableCache!==n||u.cachePrefix!==i||u.cacheExpiration!==s)&&(u.cachePrefix!==i&&ae(m,u.cachePrefix),!n&&u.enableCache&&ae(m,u.cachePrefix),C.current={enableCache:n,cachePrefix:i,cacheExpiration:s},T())},[n,i,s,m,T]);const J=o.useCallback(()=>U(this,null,function*(){$(null);try{const u=yield a.getAuthHeaders(),{data:p,error:y}=yield b.DELETE("/v1/user/{userId}/dismissible-item/{itemId}",{params:{path:{userId:h,itemId:e}},headers:u});if(y||!p)throw new Error("Failed to dismiss item");O(p.data),n&&Y(m,p.data,i)}catch(u){throw $(u instanceof Error?u:new Error("Failed to dismiss item")),u}}),[e,h,m,n,i,b,a]),W=o.useCallback(()=>U(this,null,function*(){$(null);try{const u=yield a.getAuthHeaders(),{data:p,error:y}=yield b.POST("/v1/user/{userId}/dismissible-item/{itemId}",{params:{path:{userId:h,itemId:e}},headers:u});if(y||!p)throw new Error("Failed to restore item");O(p.data),n&&Y(m,p.data,i)}catch(u){throw $(u instanceof Error?u:new Error("Failed to restore item")),u}}),[e,h,m,n,i,b,a]);return{dismissedOn:(_=D==null?void 0:D.dismissedAt)!=null?_:null,dismiss:J,restore:W,isLoading:x,error:L,item:D}},ve=()=>d.jsx("div",{className:"dismissible-loading","aria-live":"polite",children:"Loading..."}),Ce=()=>d.jsx("div",{className:"dismissible-error",role:"alert",children:"Unable to load content. Please try again later."}),Re=({onDismiss:e,ariaLabel:r})=>d.jsx("button",{className:"dismissible-button",onClick:e,"aria-label":r,type:"button",children:"×"}),Se=({itemId:e,children:r,onDismiss:t,LoadingComponent:n=ve,ErrorComponent:i=Ce,DismissButtonComponent:s=Re,enableCache:a,cachePrefix:h,cacheExpiration:b,ignoreErrors:m=!1})=>{const{dismissedOn:C,isLoading:H,error:f,dismiss:l}=le(e,{enableCache:a,cachePrefix:h,cacheExpiration:b}),[x,A]=o.useState(!1);o.useEffect(()=>{A(!1)},[e]);const L=()=>U(this,null,function*(){A(!0);try{yield l(),t==null||t()}catch($){A(!1)}});return H&&n?d.jsx(n,{itemId:e}):H&&!n?null:f&&i&&!m?d.jsx(i,{itemId:e,error:f}):C||x?null:d.jsxs("div",{className:"dismissible-container",children:[d.jsx("div",{className:"dismissible-content",children:r}),s?d.jsx(s,{onDismiss:L,ariaLabel:`Dismiss ${e}`}):null]})},ue=e=>U(this,null,function*(){if(typeof e=="function")try{const r=e();return yield Promise.resolve(r)}catch(r){console.warn("Failed to resolve JWT from function:",r);return}return e}),fe=e=>U(this,null,function*(){const r=yield ue(e);return r?{Authorization:`Bearer ${r}`}:{}}),xe=e=>{try{const r=new URL(e),t=r.hostname==="localhost"||r.hostname==="127.0.0.1"||r.hostname==="[::1]",n=r.protocol==="https:";return{isSecure:n||t,isLocalhost:t,isHttps:n}}catch(r){return{isSecure:!1,isLocalhost:!1,isHttps:!1}}},De=({userId:e,jwt:r,baseUrl:t,children:n})=>{const{isSecure:i}=xe(t);i||console.warn(`[dismissible] Insecure baseUrl "${t}". Use https:// in production (or localhost for development). JWT tokens may be exposed over insecure connections.`);const s=o.useMemo(()=>({userId:e,jwt:r,baseUrl:t,getAuthHeaders:()=>U(this,null,function*(){return yield fe(r)})}),[e,r,t]);return d.jsx(Z.Provider,{value:s,children:n})};c.Dismissible=Se,c.DismissibleContext=Z,c.DismissibleProvider=De,c.getAuthHeaders=fe,c.resolveJwt=ue,c.useDismissibleContext=ce,c.useDismissibleItem=le,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(c,d){typeof exports=="object"&&typeof module!="undefined"?d(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],d):(c=typeof globalThis!="undefined"?globalThis:c||self,d(c.DismissibleClient={},c.React.jsxRuntime,c.React))})(this,(function(c,d,o){"use strict";var Ae=Object.defineProperty,$e=Object.defineProperties;var Te=Object.getOwnPropertyDescriptors;var Q=Object.getOwnPropertySymbols;var ye=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable;var me=(c,d,o)=>d in c?Ae(c,d,{enumerable:!0,configurable:!0,writable:!0,value:o}):c[d]=o,g=(c,d)=>{for(var o in d||(d={}))ye.call(d,o)&&me(c,o,d[o]);if(Q)for(var o of Q(d))be.call(d,o)&&me(c,o,d[o]);return c},S=(c,d)=>$e(c,Te(d));var re=(c,d)=>{var o={};for(var R in c)ye.call(c,R)&&d.indexOf(R)<0&&(o[R]=c[R]);if(c!=null&&Q)for(var R of Q(c))d.indexOf(R)<0&&be.call(c,R)&&(o[R]=c[R]);return o};var U=(c,d,o)=>new Promise((R,M)=>{var V=j=>{try{q(o.next(j))}catch(F){M(F)}},X=j=>{try{q(o.throw(j))}catch(F){M(F)}},q=j=>j.done?R(j.value):Promise.resolve(j.value).then(V,X);q((o=o.apply(c,d)).next())});const R=/\{[^{}]+\}/g,M=()=>{var e,r;return typeof process=="object"&&Number.parseInt((r=(e=process==null?void 0:process.versions)==null?void 0:e.node)==null?void 0:r.substring(0,2))>=18&&process.versions.undici};function V(){return Math.random().toString(36).slice(2,11)}function X(e){let H=g({},e),{baseUrl:r="",Request:t=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:s,headers:a,requestInitExt:h=void 0}=H,b=re(H,["baseUrl","Request","fetch","querySerializer","bodySerializer","headers","requestInitExt"]);h=M()?h:void 0,r=ie(r);const m=[];function C(f,l){return U(this,null,function*(){var he;const de=l||{},{baseUrl:x,fetch:A=n,Request:L=t,headers:$,params:D={},parseAs:O="json",querySerializer:T,bodySerializer:J=s!=null?s:pe,body:W,middleware:_=[]}=de,u=re(de,["baseUrl","fetch","Request","headers","params","parseAs","querySerializer","bodySerializer","body","middleware"]);let p=r;x&&(p=(he=ie(x))!=null?he:r);let y=typeof i=="function"?i:se(i);T&&(y=typeof T=="function"?T:se(g(g({},typeof i=="object"?i:{}),T)));const k=W===void 0?void 0:J(W,ne(a,$,D.header)),ee=ne(k===void 0||k instanceof FormData?{}:{"Content-Type":"application/json"},a,$,D.header),P=[...m,..._],je=S(g(g({redirect:"follow"},b),u),{body:k,headers:ee});let B,G,I=new L(ge(f,{baseUrl:p,params:D,querySerializer:y}),je),w;for(const v in u)v in I||(I[v]=u[v]);if(P.length){B=V(),G=Object.freeze({baseUrl:p,fetch:A,parseAs:O,querySerializer:y,bodySerializer:J});for(const v of P)if(v&&typeof v=="object"&&typeof v.onRequest=="function"){const E=yield v.onRequest({request:I,schemaPath:f,params:D,options:G,id:B});if(E)if(E instanceof L)I=E;else if(E instanceof Response){w=E;break}else throw new Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!w){try{w=yield A(I,h)}catch(v){let E=v;if(P.length)for(let z=P.length-1;z>=0;z--){const K=P[z];if(K&&typeof K=="object"&&typeof K.onError=="function"){const N=yield K.onError({request:I,error:E,schemaPath:f,params:D,options:G,id:B});if(N){if(N instanceof Response){E=void 0,w=N;break}if(N instanceof Error){E=N;continue}throw new Error("onError: must return new Response() or instance of Error")}}}if(E)throw E}if(P.length)for(let v=P.length-1;v>=0;v--){const E=P[v];if(E&&typeof E=="object"&&typeof E.onResponse=="function"){const z=yield E.onResponse({request:I,response:w,schemaPath:f,params:D,options:G,id:B});if(z){if(!(z instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");w=z}}}}if(w.status===204||I.method==="HEAD"||w.headers.get("Content-Length")==="0")return w.ok?{data:void 0,response:w}:{error:void 0,response:w};if(w.ok)return O==="stream"?{data:w.body,response:w}:{data:yield w[O](),response:w};let te=yield w.text();try{te=JSON.parse(te)}catch(v){}return{error:te,response:w}})}return{request(f,l,x){return C(l,S(g({},x),{method:f.toUpperCase()}))},GET(f,l){return C(f,S(g({},l),{method:"GET"}))},PUT(f,l){return C(f,S(g({},l),{method:"PUT"}))},POST(f,l){return C(f,S(g({},l),{method:"POST"}))},DELETE(f,l){return C(f,S(g({},l),{method:"DELETE"}))},OPTIONS(f,l){return C(f,S(g({},l),{method:"OPTIONS"}))},HEAD(f,l){return C(f,S(g({},l),{method:"HEAD"}))},PATCH(f,l){return C(f,S(g({},l),{method:"PATCH"}))},TRACE(f,l){return C(f,S(g({},l),{method:"TRACE"}))},use(...f){for(const l of f)if(l){if(typeof l!="object"||!("onRequest"in l||"onResponse"in l||"onError"in l))throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");m.push(l)}},eject(...f){for(const l of f){const x=m.indexOf(l);x!==-1&&m.splice(x,1)}}}}function q(e,r,t){if(r==null)return"";if(typeof r=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${(t==null?void 0:t.allowReserved)===!0?r:encodeURIComponent(r)}`}function j(e,r,t){if(!r||typeof r!="object")return"";const n=[],i={simple:",",label:".",matrix:";"}[t.style]||"&";if(t.style!=="deepObject"&&t.explode===!1){for(const h in r)n.push(h,t.allowReserved===!0?r[h]:encodeURIComponent(r[h]));const a=n.join(",");switch(t.style){case"form":return`${e}=${a}`;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return a}}for(const a in r){const h=t.style==="deepObject"?`${e}[${a}]`:a;n.push(q(h,r[a],t))}const s=n.join(i);return t.style==="label"||t.style==="matrix"?`${i}${s}`:s}function F(e,r,t){if(!Array.isArray(r))return"";if(t.explode===!1){const s={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[t.style]||",",a=(t.allowReserved===!0?r:r.map(h=>encodeURIComponent(h))).join(s);switch(t.style){case"simple":return a;case"label":return`.${a}`;case"matrix":return`;${e}=${a}`;default:return`${e}=${a}`}}const n={simple:",",label:".",matrix:";"}[t.style]||"&",i=[];for(const s of r)t.style==="simple"||t.style==="label"?i.push(t.allowReserved===!0?s:encodeURIComponent(s)):i.push(q(e,s,t));return t.style==="label"||t.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function se(e){return function(t){const n=[];if(t&&typeof t=="object")for(const i in t){const s=t[i];if(s!=null){if(Array.isArray(s)){if(s.length===0)continue;n.push(F(i,s,S(g({style:"form",explode:!0},e==null?void 0:e.array),{allowReserved:(e==null?void 0:e.allowReserved)||!1})));continue}if(typeof s=="object"){n.push(j(i,s,S(g({style:"deepObject",explode:!0},e==null?void 0:e.object),{allowReserved:(e==null?void 0:e.allowReserved)||!1})));continue}n.push(q(i,s,e))}}return n.join("&")}}function we(e,r){var n;let t=e;for(const i of(n=e.match(R))!=null?n:[]){let s=i.substring(1,i.length-1),a=!1,h="simple";if(s.endsWith("*")&&(a=!0,s=s.substring(0,s.length-1)),s.startsWith(".")?(h="label",s=s.substring(1)):s.startsWith(";")&&(h="matrix",s=s.substring(1)),!r||r[s]===void 0||r[s]===null)continue;const b=r[s];if(Array.isArray(b)){t=t.replace(i,F(s,b,{style:h,explode:a}));continue}if(typeof b=="object"){t=t.replace(i,j(s,b,{style:h,explode:a}));continue}if(h==="matrix"){t=t.replace(i,`;${q(s,b)}`);continue}t=t.replace(i,h==="label"?`.${encodeURIComponent(b)}`:encodeURIComponent(b))}return t}function pe(e,r){var t,n;return e instanceof FormData?e:r&&(r.get instanceof Function?(t=r.get("Content-Type"))!=null?t:r.get("content-type"):(n=r["Content-Type"])!=null?n:r["content-type"])==="application/x-www-form-urlencoded"?new URLSearchParams(e).toString():JSON.stringify(e)}function ge(e,r){var i,s;let t=`${r.baseUrl}${e}`;(i=r.params)!=null&&i.path&&(t=we(t,r.params.path));let n=r.querySerializer((s=r.params.query)!=null?s:{});return n.startsWith("?")&&(n=n.substring(1)),n&&(t+=`?${n}`),t}function ne(...e){const r=new Headers;for(const t of e){if(!t||typeof t!="object")continue;const n=t instanceof Headers?t.entries():Object.entries(t);for(const[i,s]of n)if(s===null)r.delete(i);else if(Array.isArray(s))for(const a of s)r.append(i,a);else s!==void 0&&r.set(i,s)}return r}function ie(e){return e.endsWith("/")?e.substring(0,e.length-1):e}const oe=(e,r,t)=>{try{const n=`${r}_${e}`,i=localStorage.getItem(n);if(!i)return null;const{data:s,timestamp:a}=JSON.parse(i);return t&&Date.now()-a>t?(localStorage.removeItem(n),null):s}catch(n){return null}},Y=(e,r,t)=>{try{const n=`${t}_${e}`,i={data:r,timestamp:Date.now()};localStorage.setItem(n,JSON.stringify(i))}catch(n){console.warn("Failed to cache dismissible item:",n)}},ae=(e,r)=>{try{const t=`${r}_${e}`;localStorage.removeItem(t)}catch(t){console.warn("Failed to remove cached dismissible item:",t)}},Z=o.createContext(null),ce=()=>{const e=o.useContext(Z);if(!e)throw new Error("useDismissibleContext must be used within a DismissibleProvider");return e},Ee="dismissible",le=(e,r={})=>{var _;const{initialData:t,enableCache:n=!0,cachePrefix:i=Ee,cacheExpiration:s}=r,a=ce(),{userId:h}=a,b=o.useMemo(()=>X({baseUrl:a.baseUrl,headers:{}}),[a.baseUrl]),m=o.useMemo(()=>`${h}-${e}`,[h,e]),C=o.useRef({enableCache:n,cachePrefix:i,cacheExpiration:s}),H=o.useRef(e),f=o.useRef(m),l=o.useRef(null),[x,A]=o.useState(!1),[L,$]=o.useState(null),[D,O]=o.useState(()=>{if(t)return t;if(n){const u=oe(m,i,s);if(u)return u}}),T=o.useCallback(()=>U(null,null,function*(){var p;if(n){const y=oe(m,i,s);if(y!=null&&y.dismissedAt){O(y),A(!1);return}}(p=l.current)==null||p.abort();const u=new AbortController;l.current=u,A(!0),$(null);try{const y=yield a.getAuthHeaders(),{data:k,error:ee}=yield b.GET("/v1/users/{userId}/items/{itemId}",{params:{path:{userId:h,itemId:e}},headers:y,signal:u.signal});if(ee||!k)throw new Error("Failed to fetch dismissible item");O(k.data),n&&Y(m,k.data,i)}catch(y){if(y instanceof Error&&y.name==="AbortError")return;$(y instanceof Error?y:new Error("Unknown error occurred"))}finally{A(!1)}}),[e,h,m,n,i,s,b,a]);o.useEffect(()=>{const u=H.current!==e,p=f.current!==m;u||p?(H.current=e,f.current=m,T()):t||T()},[e,m,t,T]),o.useEffect(()=>()=>{var u;(u=l.current)==null||u.abort()},[]),o.useEffect(()=>{const u=C.current;(u.enableCache!==n||u.cachePrefix!==i||u.cacheExpiration!==s)&&(u.cachePrefix!==i&&ae(m,u.cachePrefix),!n&&u.enableCache&&ae(m,u.cachePrefix),C.current={enableCache:n,cachePrefix:i,cacheExpiration:s},T())},[n,i,s,m,T]);const J=o.useCallback(()=>U(null,null,function*(){$(null);try{const u=yield a.getAuthHeaders(),{data:p,error:y}=yield b.DELETE("/v1/users/{userId}/items/{itemId}",{params:{path:{userId:h,itemId:e}},headers:u});if(y||!p)throw new Error("Failed to dismiss item");O(p.data),n&&Y(m,p.data,i)}catch(u){throw $(u instanceof Error?u:new Error("Failed to dismiss item")),u}}),[e,h,m,n,i,b,a]),W=o.useCallback(()=>U(null,null,function*(){$(null);try{const u=yield a.getAuthHeaders(),{data:p,error:y}=yield b.POST("/v1/users/{userId}/items/{itemId}",{params:{path:{userId:h,itemId:e}},headers:u});if(y||!p)throw new Error("Failed to restore item");O(p.data),n&&Y(m,p.data,i)}catch(u){throw $(u instanceof Error?u:new Error("Failed to restore item")),u}}),[e,h,m,n,i,b,a]);return{dismissedOn:(_=D==null?void 0:D.dismissedAt)!=null?_:null,dismiss:J,restore:W,isLoading:x,error:L,item:D}},ve=()=>d.jsx("div",{className:"dismissible-loading","aria-live":"polite",children:"Loading..."}),Ce=()=>d.jsx("div",{className:"dismissible-error",role:"alert",children:"Unable to load content. Please try again later."}),Re=({onDismiss:e,ariaLabel:r})=>d.jsx("button",{className:"dismissible-button",onClick:e,"aria-label":r,type:"button",children:"×"}),Se=({itemId:e,children:r,onDismiss:t,LoadingComponent:n=ve,ErrorComponent:i=Ce,DismissButtonComponent:s=Re,enableCache:a,cachePrefix:h,cacheExpiration:b,ignoreErrors:m=!1})=>{const{dismissedOn:C,isLoading:H,error:f,dismiss:l}=le(e,{enableCache:a,cachePrefix:h,cacheExpiration:b}),[x,A]=o.useState(!1);o.useEffect(()=>{A(!1)},[e]);const L=()=>U(null,null,function*(){A(!0);try{yield l(),t==null||t()}catch($){A(!1)}});return H&&n?d.jsx(n,{itemId:e}):H&&!n?null:f&&i&&!m?d.jsx(i,{itemId:e,error:f}):C||x?null:d.jsxs("div",{className:"dismissible-container",children:[d.jsx("div",{className:"dismissible-content",children:r}),s?d.jsx(s,{onDismiss:L,ariaLabel:`Dismiss ${e}`}):null]})},ue=e=>U(null,null,function*(){if(typeof e=="function")try{const r=e();return yield Promise.resolve(r)}catch(r){console.warn("Failed to resolve JWT from function:",r);return}return e}),fe=e=>U(null,null,function*(){const r=yield ue(e);return r?{Authorization:`Bearer ${r}`}:{}}),xe=e=>{try{const r=new URL(e),t=r.hostname==="localhost"||r.hostname==="127.0.0.1"||r.hostname==="[::1]",n=r.protocol==="https:";return{isSecure:n||t,isLocalhost:t,isHttps:n}}catch(r){return{isSecure:!1,isLocalhost:!1,isHttps:!1}}},De=({userId:e,jwt:r,baseUrl:t,children:n})=>{const{isSecure:i}=xe(t);i||console.warn(`[dismissible] Insecure baseUrl "${t}". Use https:// in production (or localhost for development). JWT tokens may be exposed over insecure connections.`);const s=o.useMemo(()=>({userId:e,jwt:r,baseUrl:t,getAuthHeaders:()=>U(null,null,function*(){return yield fe(r)})}),[e,r,t]);return d.jsx(Z.Provider,{value:s,children:n})};c.Dismissible=Se,c.DismissibleContext=Z,c.DismissibleProvider=De,c.getAuthHeaders=fe,c.resolveJwt=ue,c.useDismissibleContext=ce,c.useDismissibleItem=le,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
@@ -28,9 +28,6 @@ export declare const useDismissibleItem: (itemId: string, options?: UseDismissib
28
28
  userId: string;
29
29
  createdAt: string;
30
30
  dismissedAt?: string;
31
- metadata?: {
32
- [key: string]: unknown;
33
- };
34
31
  } | undefined;
35
32
  };
36
33
  export {};
@@ -1 +1 @@
1
- .dismissible-container{position:relative;display:inline-block;width:100%}.dismissible-content{width:100%}.dismissible-button{position:absolute;top:8px;right:8px;background:#0000001a;border:none;border-radius:50%;width:24px;height:24px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:16px;line-height:1;color:#666;transition:all .2s ease}.dismissible-button:hover{background:#0003;color:#333}.dismissible-button:focus{outline:2px solid #007bff;outline-offset:2px}.dismissible-button:active{transform:scale(.95)}.dismissible-loading{padding:16px;text-align:center;color:#666;font-style:italic}.dismissible-error{padding:16px;background:#fee;border:1px solid #fcc;border-radius:4px;color:#c33;font-size:14px}@media (max-width: 768px){.dismissible-button{width:32px;height:32px;font-size:18px}}
1
+ .dismissible-container{position:relative;display:inline-block;width:100%}.dismissible-content{width:100%}.dismissible-button{position:absolute;top:8px;right:8px;background:#0000001a;border:none;border-radius:50%;width:24px;height:24px;display:flex;align-items:center;justify-content:center;cursor:pointer;font-size:16px;line-height:1;color:#666;transition:all .2s ease}.dismissible-button:hover{background:#0003;color:#333}.dismissible-button:focus{outline:2px solid #007bff;outline-offset:2px}.dismissible-button:active{transform:scale(.95)}.dismissible-loading{padding:16px;text-align:center;color:#666;font-style:italic}.dismissible-error{padding:16px;background:#fee;border:1px solid #fcc;border-radius:4px;color:#c33;font-size:14px}@media(max-width:768px){.dismissible-button{width:32px;height:32px;font-size:18px}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dismissible/react-client",
3
- "version": "0.3.2-canary.3.c1b8c41",
3
+ "version": "0.3.2-canary.5.88e2777",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -48,44 +48,44 @@
48
48
  "@babel/core": "^7.28.5",
49
49
  "@babel/preset-env": "^7.28.5",
50
50
  "@babel/preset-typescript": "^7.28.5",
51
- "@commitlint/cli": "^19.8.1",
52
- "@commitlint/config-conventional": "^19.8.1",
51
+ "@commitlint/cli": "^20.2.0",
52
+ "@commitlint/config-conventional": "^20.2.0",
53
53
  "@semantic-release/changelog": "^6.0.3",
54
54
  "@semantic-release/git": "^10.0.1",
55
- "@semantic-release/github": "^10.3.5",
56
- "@semantic-release/npm": "^12.0.2",
57
- "@storybook/addon-a11y": "^9.1.16",
58
- "@storybook/addon-docs": "^9.1.16",
59
- "@storybook/react-vite": "^9.1.16",
55
+ "@semantic-release/github": "^12.0.2",
56
+ "@semantic-release/npm": "^13.1.3",
57
+ "@storybook/addon-a11y": "^10.1.10",
58
+ "@storybook/addon-docs": "^10.1.10",
59
+ "@storybook/react-vite": "^10.1.10",
60
60
  "@testing-library/jest-dom": "^6.9.1",
61
- "@testing-library/react": "^16.3.0",
62
- "@types/node": "^25.0.2",
61
+ "@testing-library/react": "^16.3.1",
62
+ "@types/node": "^25.0.3",
63
63
  "@types/react": "^19.2.7",
64
64
  "@types/react-dom": "^19.2.3",
65
- "@typescript-eslint/eslint-plugin": "^8.49.0",
66
- "@typescript-eslint/parser": "^8.49.0",
67
- "@vitejs/plugin-react": "^4.7.0",
65
+ "@typescript-eslint/eslint-plugin": "^8.50.0",
66
+ "@typescript-eslint/parser": "^8.50.0",
67
+ "@vitejs/plugin-react": "^5.1.2",
68
68
  "commitizen": "^4.3.1",
69
69
  "core-js": "^3.47.0",
70
70
  "cz-conventional-changelog": "^3.3.0",
71
- "eslint": "^8.57.1",
71
+ "eslint": "^9.39.2",
72
72
  "eslint-plugin-react": "^7.37.5",
73
- "eslint-plugin-react-hooks": "^5.2.0",
74
- "eslint-plugin-storybook": "^9.1.16",
75
- "happy-dom": "^18.0.1",
73
+ "eslint-plugin-react-hooks": "^7.0.1",
74
+ "eslint-plugin-storybook": "^10.1.10",
75
+ "happy-dom": "^20.0.11",
76
76
  "msw": "^2.12.4",
77
77
  "msw-storybook-addon": "^2.0.6",
78
78
  "openapi-typescript": "^7.10.1",
79
79
  "prettier": "^3.7.4",
80
80
  "react": "^19.2.3",
81
81
  "react-dom": "^19.2.3",
82
- "semantic-release": "^24.2.7",
83
- "storybook": "^9.1.16",
82
+ "semantic-release": "^25.0.2",
83
+ "storybook": "^10.1.10",
84
84
  "ts-node": "^10.9.2",
85
85
  "typescript": "^5.9.3",
86
- "vite": "^5.4.21",
86
+ "vite": "^7.3.0",
87
87
  "vite-plugin-dts": "^4.5.4",
88
- "vitest": "^3.2.4"
88
+ "vitest": "^4.0.16"
89
89
  },
90
90
  "config": {
91
91
  "commitizen": {