@inkeep/cxkit-primitives 0.5.52 → 0.5.55

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.
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("../atoms/dialog.cjs"),i=require("./factory.cjs"),c=require("../atoms/icons/custom-icon.cjs"),u=require("./modal/use-inkeep-modal.cjs"),s=require("./modal/modal-provider.cjs"),m=require("../utils/compose-event-handlers.cjs"),M=require("../hooks/use-media-query.cjs"),p=require("../utils/misc.cjs"),v=i.ikp(t.Root,{_id:"modal"}),C=e=>{const{onOpenChange:n,config:l,...a}=e,r=u.useInkeepModal(l);return o.jsx(s.ModalProvider,{modal:r,children:o.jsx(v,{open:r.isOpen,onOpenChange:m.composeEventHandlers(n,d=>r.setOpen(d)),...a})})},y=i.ikp(t.Overlay,{_id:"modal__Overlay"}),_=i.ikp(t.Content,{_id:"modal__Content","aria-describedby":void 0}),q=e=>{const n=M.useMediaQuery("(max-width: 768px)");return o.jsx(_,{"data-mobile":p.dataAttr(n),...e})},O=i.ikp(t.Close,{_id:"modal__Close",children:o.jsx(c.CustomIcon,{iconKey:"close"})}),x=e=>s.useModal()?o.jsx(O,{...e}):null;exports.Close=x;exports.Content=q;exports.Modal=C;exports.Overlay=y;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),t=require("../atoms/dialog.cjs"),i=require("./factory.cjs"),c=require("../atoms/icons/custom-icon.cjs"),u=require("./modal/use-inkeep-modal.cjs"),s=require("./modal/modal-provider.cjs"),m=require("../utils/compose-event-handlers.cjs"),M=require("../hooks/use-media-query.cjs"),p=require("../utils/misc.cjs"),v=i.ikp(t.Root,{_id:"modal"}),C=e=>{const{onOpenChange:n,config:l,...a}=e,r=u.useInkeepModal(l);return o.jsx(s.ModalProvider,{modal:r,children:o.jsx(v,{open:r.isOpen,onOpenChange:m.composeEventHandlers(n,d=>r.setOpen(d)),...a})})},y=i.ikp(t.Overlay,{_id:"modal__Overlay"}),_=i.ikp(t.Content,{_id:"modal__Content","aria-describedby":void 0}),q=e=>{const n=M.useMediaQuery("(max-width: 768px)");return o.jsx(_,{"data-mobile":p.dataAttr(n),tabIndex:-1,...e})},x=i.ikp(t.Close,{_id:"modal__Close",children:o.jsx(c.CustomIcon,{iconKey:"close"})}),O=e=>s.useModal()?o.jsx(x,{...e}):null;exports.Close=O;exports.Content=q;exports.Modal=C;exports.Overlay=y;
@@ -1,37 +1,37 @@
1
1
  "use client";
2
2
  import { jsx as e } from "react/jsx-runtime";
3
- import { Overlay as s, Root as d, Content as m, Close as c } from "../atoms/dialog.js";
4
- import { ikp as r } from "./factory.js";
3
+ import { Overlay as d, Root as s, Content as m, Close as c } from "../atoms/dialog.js";
4
+ import { ikp as n } from "./factory.js";
5
5
  import { CustomIcon as p } from "../atoms/icons/custom-icon.js";
6
6
  import { useInkeepModal as C } from "./modal/use-inkeep-modal.js";
7
7
  import { ModalProvider as M, useModal as f } from "./modal/modal-provider.js";
8
8
  import { composeEventHandlers as u } from "../utils/compose-event-handlers.js";
9
9
  import { useMediaQuery as v } from "../hooks/use-media-query.js";
10
10
  import { dataAttr as _ } from "../utils/misc.js";
11
- const O = r(d, {
11
+ const O = n(s, {
12
12
  _id: "modal"
13
13
  }), E = (o) => {
14
- const { onOpenChange: t, config: i, ...a } = o, n = C(i);
15
- return /* @__PURE__ */ e(M, { modal: n, children: /* @__PURE__ */ e(
14
+ const { onOpenChange: t, config: i, ...a } = o, r = C(i);
15
+ return /* @__PURE__ */ e(M, { modal: r, children: /* @__PURE__ */ e(
16
16
  O,
17
17
  {
18
- open: n.isOpen,
19
- onOpenChange: u(t, (l) => n.setOpen(l)),
18
+ open: r.isOpen,
19
+ onOpenChange: u(t, (l) => r.setOpen(l)),
20
20
  ...a
21
21
  }
22
22
  ) });
23
- }, H = r(s, {
23
+ }, H = n(d, {
24
24
  _id: "modal__Overlay"
25
- }), y = r(m, {
25
+ }), y = n(m, {
26
26
  _id: "modal__Content",
27
27
  "aria-describedby": void 0
28
28
  }), K = (o) => {
29
29
  const t = v("(max-width: 768px)");
30
- return /* @__PURE__ */ e(y, { "data-mobile": _(t), ...o });
31
- }, h = r(c, {
30
+ return /* @__PURE__ */ e(y, { "data-mobile": _(t), tabIndex: -1, ...o });
31
+ }, b = n(c, {
32
32
  _id: "modal__Close",
33
33
  children: /* @__PURE__ */ e(p, { iconKey: "close" })
34
- }), Q = (o) => f() ? /* @__PURE__ */ e(h, { ...o }) : null;
34
+ }), Q = (o) => f() ? /* @__PURE__ */ e(b, { ...o }) : null;
35
35
  export {
36
36
  Q as Close,
37
37
  K as Content,
package/dist/index.d.cts CHANGED
@@ -3363,11 +3363,11 @@ declare const PrimitiveBotHeadingName: ForwardRefExoticComponent< PolymorphicPro
3363
3363
 
3364
3364
  declare type PrimitiveButtonProps = React_2.ComponentPropsWithoutRef<typeof Primitive.button>;
3365
3365
 
3366
- declare const PrimitiveChatAction: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3366
+ declare const PrimitiveChatAction: ForwardRefExoticComponent< PolymorphicProps & Omit<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id"> & Partial<Pick<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id">>>;
3367
3367
 
3368
3368
  declare const PrimitiveChatActionFeedback: ForwardRefExoticComponent< PolymorphicProps & Omit<TooltipPrimitive.TooltipContentProps & RefAttributes<HTMLDivElement>, "_id"> & Partial<Pick<TooltipPrimitive.TooltipContentProps & RefAttributes<HTMLDivElement>, "_id">>>;
3369
3369
 
3370
- declare const PrimitiveChatActionLabel: ForwardRefExoticComponent< PolymorphicProps & Omit<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id"> & Partial<Pick<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id">>>;
3370
+ declare const PrimitiveChatActionLabel: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
3371
3371
 
3372
3372
  declare const PrimitiveChatButtonAvatarContent: ForwardRefExoticComponent< PolymorphicProps & Omit<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id"> & Partial<Pick<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id">>>;
3373
3373
 
@@ -4189,6 +4189,7 @@ export declare interface WidgetConfig extends InkeepConfig {
4189
4189
 
4190
4190
  export declare type WidgetContextValue = {
4191
4191
  setView: (view: ModalViewTypes) => void;
4192
+ view: ModalViewTypes;
4192
4193
  };
4193
4194
 
4194
4195
  export declare const WidgetProvider: React.FC<{
package/dist/index.d.ts CHANGED
@@ -3363,11 +3363,11 @@ declare const PrimitiveBotHeadingName: ForwardRefExoticComponent< PolymorphicPro
3363
3363
 
3364
3364
  declare type PrimitiveButtonProps = React_2.ComponentPropsWithoutRef<typeof Primitive.button>;
3365
3365
 
3366
- declare const PrimitiveChatAction: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "_id">>>;
3366
+ declare const PrimitiveChatAction: ForwardRefExoticComponent< PolymorphicProps & Omit<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id"> & Partial<Pick<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id">>>;
3367
3367
 
3368
3368
  declare const PrimitiveChatActionFeedback: ForwardRefExoticComponent< PolymorphicProps & Omit<TooltipPrimitive.TooltipContentProps & RefAttributes<HTMLDivElement>, "_id"> & Partial<Pick<TooltipPrimitive.TooltipContentProps & RefAttributes<HTMLDivElement>, "_id">>>;
3369
3369
 
3370
- declare const PrimitiveChatActionLabel: ForwardRefExoticComponent< PolymorphicProps & Omit<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id"> & Partial<Pick<TooltipPrimitive.TooltipTriggerProps & RefAttributes<HTMLButtonElement>, "_id">>>;
3370
+ declare const PrimitiveChatActionLabel: ForwardRefExoticComponent< PolymorphicProps & Omit< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id"> & Partial<Pick< DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "_id">>>;
3371
3371
 
3372
3372
  declare const PrimitiveChatButtonAvatarContent: ForwardRefExoticComponent< PolymorphicProps & Omit<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id"> & Partial<Pick<AvatarPrimitive.AvatarProps & RefAttributes<HTMLSpanElement>, "_id">>>;
3373
3373
 
@@ -4189,6 +4189,7 @@ export declare interface WidgetConfig extends InkeepConfig {
4189
4189
 
4190
4190
  export declare type WidgetContextValue = {
4191
4191
  setView: (view: ModalViewTypes) => void;
4192
+ view: ModalViewTypes;
4192
4193
  };
4193
4194
 
4194
4195
  export declare const WidgetProvider: React.FC<{
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.52",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.55",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
7
7
  const u = x(void 0), U = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: n } = C(), { apiKey: s, analyticsApiBaseUrl: r, tags: i, privacyPreferences: l, env: E } = t, { userProperties: a } = b(), c = g(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.52",
10
+ widgetLibraryVersion: "0.5.55",
11
11
  componentType: n,
12
12
  tags: i
13
13
  }),
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),r=require("react"),p=require("./config-provider.cjs"),a=require("../hooks/use-browser-storage.cjs"),O=require("../utils/generate-uid.cjs"),g=r.createContext(void 0),P=({children:t})=>{const{baseSettings:{userProperties:s,privacyPreferences:l}}=p.useInkeepConfig(),{optOutAllAnalytics:e,optOutAnalyticalCookies:n}=l,{browserStorage:c,setBrowserStorage:u}=a.useBrowserStorage(),d=r.useMemo(()=>a.passesBrowserStorageChecks(),[]),o=r.useMemo(()=>!e&&!n&&d,[e,n,d]),i=r.useMemo(()=>{const v=e?"ANONYMOUS":s.id?"ID_PROVIDED":o?"COOKIED":"ANONYMOUS",U=e?void 0:s.id||o&&c.userId||O.generateUid();return{identificationType:v,id:U,email:e?void 0:s.email,cohorts:e?void 0:s.cohorts}},[s,e,o,c.userId]);return r.useEffect(()=>{o?u("userId",i.id):u("userId",void 0)},[o,i.id]),S.jsx(g.Provider,{value:{userProperties:i},children:t})},f=()=>{const t=r.useContext(g);if(!t)throw new Error("useUser must be used within a UserProvider");return t};exports.UserProvider=P;exports.useUser=f;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("react/jsx-runtime"),r=require("react"),p=require("./config-provider.cjs"),a=require("../hooks/use-browser-storage.cjs"),O=require("../utils/generate-uid.cjs"),g=r.createContext(void 0),P=({children:t})=>{const{baseSettings:{userProperties:o,privacyPreferences:U}}=p.useInkeepConfig(),{optOutAllAnalytics:e,optOutAnalyticalCookies:n}=U,{browserStorage:u,setBrowserStorage:c}=a.useBrowserStorage(),d=r.useMemo(()=>a.passesBrowserStorageChecks(),[]),s=r.useMemo(()=>!e&&!n&&d,[e,n,d]),i=r.useMemo(()=>{const l=e?"ANONYMOUS":o.id?"ID_PROVIDED":s?"COOKIED":"ANONYMOUS",v=e?void 0:o.id||s&&u.userId||O.generateUid();return{identificationType:l,...e?{}:o,id:v}},[o,e,s,u.userId]);return r.useEffect(()=>{s?c("userId",i.id):c("userId",void 0)},[s,i.id]),S.jsx(g.Provider,{value:{userProperties:i},children:t})},f=()=>{const t=r.useContext(g);if(!t)throw new Error("useUser must be used within a UserProvider");return t};exports.UserProvider=P;exports.useUser=f;
@@ -1,34 +1,33 @@
1
1
  "use client";
2
- import { jsx as l } from "react/jsx-runtime";
3
- import { useMemo as i, useEffect as v, createContext as U, useContext as C } from "react";
4
- import { useInkeepConfig as O } from "./config-provider.js";
5
- import { useBrowserStorage as g, passesBrowserStorageChecks as w } from "../hooks/use-browser-storage.js";
2
+ import { jsx as U } from "react/jsx-runtime";
3
+ import { useMemo as i, useEffect as C, createContext as O, useContext as g } from "react";
4
+ import { useInkeepConfig as l } from "./config-provider.js";
5
+ import { useBrowserStorage as v, passesBrowserStorageChecks as w } from "../hooks/use-browser-storage.js";
6
6
  import { generateUid as I } from "../utils/generate-uid.js";
7
- const a = U(void 0), A = ({ children: s }) => {
7
+ const a = O(void 0), b = ({ children: o }) => {
8
8
  const {
9
- baseSettings: { userProperties: r, privacyPreferences: m }
10
- } = O(), { optOutAllAnalytics: e, optOutAnalyticalCookies: n } = m, { browserStorage: c, setBrowserStorage: u } = g(), d = i(() => w(), []), o = i(
9
+ baseSettings: { userProperties: s, privacyPreferences: p }
10
+ } = l(), { optOutAllAnalytics: e, optOutAnalyticalCookies: n } = p, { browserStorage: c, setBrowserStorage: u } = v(), d = i(() => w(), []), r = i(
11
11
  () => !e && !n && d,
12
12
  [e, n, d]
13
13
  ), t = i(() => {
14
- const p = e ? "ANONYMOUS" : r.id ? "ID_PROVIDED" : o ? "COOKIED" : "ANONYMOUS", f = e ? void 0 : r.id || o && c.userId || I();
14
+ const m = e ? "ANONYMOUS" : s.id ? "ID_PROVIDED" : r ? "COOKIED" : "ANONYMOUS", f = e ? void 0 : s.id || r && c.userId || I();
15
15
  return {
16
- identificationType: p,
17
- id: f,
18
- email: e ? void 0 : r.email,
19
- cohorts: e ? void 0 : r.cohorts
16
+ identificationType: m,
17
+ ...e ? {} : s,
18
+ id: f
20
19
  };
21
- }, [r, e, o, c.userId]);
22
- return v(() => {
23
- o ? u("userId", t.id) : u("userId", void 0);
24
- }, [o, t.id]), /* @__PURE__ */ l(a.Provider, { value: { userProperties: t }, children: s });
25
- }, b = () => {
26
- const s = C(a);
27
- if (!s)
20
+ }, [s, e, r, c.userId]);
21
+ return C(() => {
22
+ r ? u("userId", t.id) : u("userId", void 0);
23
+ }, [r, t.id]), /* @__PURE__ */ U(a.Provider, { value: { userProperties: t }, children: o });
24
+ }, h = () => {
25
+ const o = g(a);
26
+ if (!o)
28
27
  throw new Error("useUser must be used within a UserProvider");
29
- return s;
28
+ return o;
30
29
  };
31
30
  export {
32
- A as UserProvider,
33
- b as useUser
31
+ b as UserProvider,
32
+ h as useUser
34
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.52",
3
+ "version": "0.5.55",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -59,9 +59,9 @@
59
59
  "remark-gfm": "^4.0.1",
60
60
  "unist-util-visit": "^5.0.0",
61
61
  "use-sync-external-store": "^1.4.0",
62
- "@inkeep/cxkit-color-mode": "0.5.52",
63
- "@inkeep/cxkit-theme": "0.5.52",
64
- "@inkeep/cxkit-types": "0.5.52"
62
+ "@inkeep/cxkit-color-mode": "0.5.55",
63
+ "@inkeep/cxkit-theme": "0.5.55",
64
+ "@inkeep/cxkit-types": "0.5.55"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@biomejs/biome": "1.9.4",