reflet-sdk 0.6.2 → 0.6.3

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/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as Reflet } from "./client-DAdWdIFY.js";
2
- import { a as useRefletContext, i as useRefletClient, n as RefletContext, r as RefletProvider, t as REFLET_Z_INDEX } from "./z-index-BL0SGZEP.js";
2
+ import { a as useRefletContext, i as useRefletClient, n as RefletContext, r as RefletProvider, t as REFLET_Z_INDEX } from "./z-index-CIb4-3Fy.js";
3
3
  import { cloneElement, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/react-changelog-widget.tsx
@@ -87,9 +87,10 @@ const REFLET_Z_INDEX = {
87
87
  devtoolsBar: 2147483647,
88
88
  dialogContent: 2147482991,
89
89
  dialogOverlay: 2147482990,
90
+ elementPicker: 2147483647,
90
91
  widgetRoot: 2147483e3
91
92
  };
92
93
  //#endregion
93
94
  export { useRefletContext as a, useRefletClient as i, RefletContext as n, RefletProvider as r, REFLET_Z_INDEX as t };
94
95
 
95
- //# sourceMappingURL=z-index-BL0SGZEP.js.map
96
+ //# sourceMappingURL=z-index-CIb4-3Fy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"z-index-BL0SGZEP.js","names":[],"sources":["../src/react-context.tsx","../src/z-index.ts"],"sourcesContent":["import {\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport { Reflet } from \"./client\";\nimport type { RefletConfig, RefletUser } from \"./types\";\n\n// ============================================\n// Context Types\n// ============================================\n\nexport interface RefletContextValue {\n baseUrl?: string;\n client: Reflet;\n isReady: boolean;\n publicKey: string;\n setUser: (user: RefletUser | undefined) => void;\n user: RefletUser | undefined;\n userToken: string | undefined;\n}\n\n// ============================================\n// Context\n// ============================================\n\nexport const RefletContext = createContext<RefletContextValue | null>(null);\n\n// ============================================\n// Provider\n// ============================================\n\nexport interface RefletProviderProps {\n /** API base URL (optional, defaults to Reflet production API) */\n baseUrl?: string;\n /** Children */\n children: ReactNode;\n /** Your organization's public API key */\n publicKey: string;\n /** Initial user identification */\n user?: RefletUser;\n /** Pre-signed user token (alternative to user) */\n userToken?: string;\n}\n\nfunction subscribeToNothing(): () => void {\n return () => undefined;\n}\n\n/**\n * Provider component for Reflet SDK\n *\n * @example\n * ```tsx\n * import { RefletProvider } from 'reflet-sdk/react';\n *\n * function App() {\n * return (\n * <RefletProvider\n * publicKey=\"fb_pub_xxx\"\n * user={{ id: 'user_123', email: 'user@example.com', name: 'John' }}\n * >\n * <YourApp />\n * </RefletProvider>\n * );\n * }\n * ```\n */\nexport function RefletProvider({\n publicKey,\n baseUrl,\n user: initialUser,\n userToken,\n children,\n}: RefletProviderProps) {\n const [user, setUser] = useState<RefletUser | undefined>(initialUser);\n const isReady = useSyncExternalStore(\n subscribeToNothing,\n () => true,\n () => false\n );\n\n const client = useMemo(() => {\n const config: RefletConfig = {\n baseUrl,\n publicKey,\n user,\n userToken,\n };\n return new Reflet(config);\n }, [publicKey, baseUrl, user, userToken]);\n\n // Update client when user changes\n useEffect(() => {\n if (userToken) {\n client.setUserToken(userToken);\n } else {\n client.setUser(user);\n }\n }, [client, user, userToken]);\n\n const value = useMemo(\n () => ({\n baseUrl,\n client,\n isReady,\n publicKey,\n setUser,\n user,\n userToken,\n }),\n [client, publicKey, baseUrl, isReady, user, userToken]\n );\n\n return (\n <RefletContext.Provider value={value}>{children}</RefletContext.Provider>\n );\n}\n\n// ============================================\n// Hook to access context\n// ============================================\n\nexport function useRefletContext(): RefletContextValue {\n const context = useContext(RefletContext);\n if (!context) {\n throw new Error(\"useRefletContext must be used within a RefletProvider\");\n }\n return context;\n}\n\nexport function useRefletClient(): Reflet {\n const { client } = useRefletContext();\n return client;\n}\n","export const REFLET_Z_INDEX = {\n annotatorOverlay: 2_147_483_001,\n captureHalo: 2_147_482_999,\n devtoolsBar: 2_147_483_647,\n dialogContent: 2_147_482_991,\n dialogOverlay: 2_147_482_990,\n widgetRoot: 2_147_483_000,\n} as const;\n"],"mappings":";;;;AA8BA,MAAa,gBAAgB,cAAyC,IAAI;AAmB1E,SAAS,qBAAiC;CACxC,aAAa,KAAA;AACf;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,EAC7B,WACA,SACA,MAAM,aACN,WACA,YACsB;CACtB,MAAM,CAAC,MAAM,WAAW,SAAiC,WAAW;CACpE,MAAM,UAAU,qBACd,0BACM,YACA,KACR;CAEA,MAAM,SAAS,cAAc;EAO3B,OAAO,IAAI,OAAO;GALhB;GACA;GACA;GACA;EAEqB,CAAC;CAC1B,GAAG;EAAC;EAAW;EAAS;EAAM;CAAS,CAAC;CAGxC,gBAAgB;EACd,IAAI,WACF,OAAO,aAAa,SAAS;OAE7B,OAAO,QAAQ,IAAI;CAEvB,GAAG;EAAC;EAAQ;EAAM;CAAS,CAAC;CAE5B,MAAM,QAAQ,eACL;EACL;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EAAC;EAAQ;EAAW;EAAS;EAAS;EAAM;CAAS,CACvD;CAEA,OACE,oBAAC,cAAc,UAAf;EAA+B;EAAQ;CAAiC,CAAA;AAE5E;AAMA,SAAgB,mBAAuC;CACrD,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,uDAAuD;CAEzE,OAAO;AACT;AAEA,SAAgB,kBAA0B;CACxC,MAAM,EAAE,WAAW,iBAAiB;CACpC,OAAO;AACT;;;AC1IA,MAAa,iBAAiB;CAC5B,kBAAkB;CAClB,aAAa;CACb,aAAa;CACb,eAAe;CACf,eAAe;CACf,YAAY;AACd"}
1
+ {"version":3,"file":"z-index-CIb4-3Fy.js","names":[],"sources":["../src/react-context.tsx","../src/z-index.ts"],"sourcesContent":["import {\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport { Reflet } from \"./client\";\nimport type { RefletConfig, RefletUser } from \"./types\";\n\n// ============================================\n// Context Types\n// ============================================\n\nexport interface RefletContextValue {\n baseUrl?: string;\n client: Reflet;\n isReady: boolean;\n publicKey: string;\n setUser: (user: RefletUser | undefined) => void;\n user: RefletUser | undefined;\n userToken: string | undefined;\n}\n\n// ============================================\n// Context\n// ============================================\n\nexport const RefletContext = createContext<RefletContextValue | null>(null);\n\n// ============================================\n// Provider\n// ============================================\n\nexport interface RefletProviderProps {\n /** API base URL (optional, defaults to Reflet production API) */\n baseUrl?: string;\n /** Children */\n children: ReactNode;\n /** Your organization's public API key */\n publicKey: string;\n /** Initial user identification */\n user?: RefletUser;\n /** Pre-signed user token (alternative to user) */\n userToken?: string;\n}\n\nfunction subscribeToNothing(): () => void {\n return () => undefined;\n}\n\n/**\n * Provider component for Reflet SDK\n *\n * @example\n * ```tsx\n * import { RefletProvider } from 'reflet-sdk/react';\n *\n * function App() {\n * return (\n * <RefletProvider\n * publicKey=\"fb_pub_xxx\"\n * user={{ id: 'user_123', email: 'user@example.com', name: 'John' }}\n * >\n * <YourApp />\n * </RefletProvider>\n * );\n * }\n * ```\n */\nexport function RefletProvider({\n publicKey,\n baseUrl,\n user: initialUser,\n userToken,\n children,\n}: RefletProviderProps) {\n const [user, setUser] = useState<RefletUser | undefined>(initialUser);\n const isReady = useSyncExternalStore(\n subscribeToNothing,\n () => true,\n () => false\n );\n\n const client = useMemo(() => {\n const config: RefletConfig = {\n baseUrl,\n publicKey,\n user,\n userToken,\n };\n return new Reflet(config);\n }, [publicKey, baseUrl, user, userToken]);\n\n // Update client when user changes\n useEffect(() => {\n if (userToken) {\n client.setUserToken(userToken);\n } else {\n client.setUser(user);\n }\n }, [client, user, userToken]);\n\n const value = useMemo(\n () => ({\n baseUrl,\n client,\n isReady,\n publicKey,\n setUser,\n user,\n userToken,\n }),\n [client, publicKey, baseUrl, isReady, user, userToken]\n );\n\n return (\n <RefletContext.Provider value={value}>{children}</RefletContext.Provider>\n );\n}\n\n// ============================================\n// Hook to access context\n// ============================================\n\nexport function useRefletContext(): RefletContextValue {\n const context = useContext(RefletContext);\n if (!context) {\n throw new Error(\"useRefletContext must be used within a RefletProvider\");\n }\n return context;\n}\n\nexport function useRefletClient(): Reflet {\n const { client } = useRefletContext();\n return client;\n}\n","export const REFLET_Z_INDEX = {\n annotatorOverlay: 2_147_483_001,\n captureHalo: 2_147_482_999,\n devtoolsBar: 2_147_483_647,\n dialogContent: 2_147_482_991,\n dialogOverlay: 2_147_482_990,\n elementPicker: 2_147_483_647,\n widgetRoot: 2_147_483_000,\n} as const;\n"],"mappings":";;;;AA8BA,MAAa,gBAAgB,cAAyC,IAAI;AAmB1E,SAAS,qBAAiC;CACxC,aAAa,KAAA;AACf;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,EAC7B,WACA,SACA,MAAM,aACN,WACA,YACsB;CACtB,MAAM,CAAC,MAAM,WAAW,SAAiC,WAAW;CACpE,MAAM,UAAU,qBACd,0BACM,YACA,KACR;CAEA,MAAM,SAAS,cAAc;EAO3B,OAAO,IAAI,OAAO;GALhB;GACA;GACA;GACA;EAEqB,CAAC;CAC1B,GAAG;EAAC;EAAW;EAAS;EAAM;CAAS,CAAC;CAGxC,gBAAgB;EACd,IAAI,WACF,OAAO,aAAa,SAAS;OAE7B,OAAO,QAAQ,IAAI;CAEvB,GAAG;EAAC;EAAQ;EAAM;CAAS,CAAC;CAE5B,MAAM,QAAQ,eACL;EACL;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IACA;EAAC;EAAQ;EAAW;EAAS;EAAS;EAAM;CAAS,CACvD;CAEA,OACE,oBAAC,cAAc,UAAf;EAA+B;EAAQ;CAAiC,CAAA;AAE5E;AAMA,SAAgB,mBAAuC;CACrD,MAAM,UAAU,WAAW,aAAa;CACxC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,uDAAuD;CAEzE,OAAO;AACT;AAEA,SAAgB,kBAA0B;CACxC,MAAM,EAAE,WAAW,iBAAiB;CACpC,OAAO;AACT;;;AC1IA,MAAa,iBAAiB;CAC5B,kBAAkB;CAClB,aAAa;CACb,aAAa;CACb,eAAe;CACf,eAAe;CACf,eAAe;CACf,YAAY;AACd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reflet-sdk",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Official Reflet SDK - Collect user feedback, feature requests, and bug reports from your app",
5
5
  "keywords": [
6
6
  "feedback",