@adhese/sdk-react 1.0.0 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @adhese/sdk-react
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e59b2d5: Replace use-deep-compare-effect in useAdheseSlot with useEffect and useRef
8
+
9
+ ## 1.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 5393373: Add fallback legacy d.ts file for older ts version with very limited types
14
+ - 5393373: Mode @adhese/sdk as a dependency instead of peer dependency
15
+
3
16
  ## 1.0.0
4
17
 
5
18
  ### Major Changes
@@ -1,15 +1,22 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useRef, useEffect } from "react";
2
+ import { useRef } from "react";
3
+ import { watch } from "@adhese/sdk-shared";
3
4
  import { useAdheseSlot } from "./useAdheseSlot.js";
4
5
  function AdheseSlot({
5
6
  onChange,
6
7
  ...options
7
8
  }) {
8
9
  const element = useRef(null);
9
- const slot = useAdheseSlot(element, options);
10
- useEffect(() => {
11
- onChange == null ? void 0 : onChange(slot);
12
- }, [onChange, slot]);
10
+ useAdheseSlot(element, {
11
+ ...options,
12
+ setup(context, hooks) {
13
+ var _a;
14
+ (_a = options.setup) == null ? void 0 : _a.call(options, context, hooks);
15
+ watch(context, (newSlot) => {
16
+ onChange == null ? void 0 : onChange(newSlot);
17
+ }, { immediate: true, deep: true });
18
+ }
19
+ });
13
20
  return /* @__PURE__ */ jsx("div", { ref: element });
14
21
  }
15
22
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"AdheseSlot.js","sources":["../src/AdheseSlot.tsx"],"sourcesContent":["import { type ReactElement, useEffect, useRef } from 'react';\nimport type { AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n ...options\n}: AdheseSlotProps): ReactElement {\n const element = useRef<HTMLDivElement | null>(null);\n\n const slot = useAdheseSlot(element, options);\n\n useEffect(() => {\n onChange?.(slot);\n }, [onChange, slot]);\n\n return (\n <div ref={element} />\n );\n}\n"],"names":[],"mappings":";;;AAgBO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,GAAG;AACL,GAAkC;AAC1B,QAAA,UAAU,OAA8B,IAAI;AAE5C,QAAA,OAAO,cAAc,SAAS,OAAO;AAE3C,YAAU,MAAM;AACd,yCAAW;AAAA,EAAI,GACd,CAAC,UAAU,IAAI,CAAC;AAGjB,SAAA,oBAAC,OAAI,EAAA,KAAK,QAAS,CAAA;AAEvB;"}
1
+ {"version":3,"file":"AdheseSlot.js","sources":["../src/AdheseSlot.tsx"],"sourcesContent":["import { type ReactElement, useRef } from 'react';\nimport type { AdheseSlotContext, AdheseSlotHooks, AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { type Ref, watch } from '@adhese/sdk-shared';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n ...options\n}: AdheseSlotProps): ReactElement {\n const element = useRef<HTMLDivElement | null>(null);\n\n useAdheseSlot(element, {\n ...options,\n setup(context: Ref<AdheseSlotContext | null>, hooks: AdheseSlotHooks) {\n options.setup?.(context, hooks);\n\n watch(context, (newSlot) => {\n onChange?.(newSlot);\n }, { immediate: true, deep: true });\n },\n });\n\n return (\n <div ref={element} />\n );\n}\n"],"names":[],"mappings":";;;;AAiBO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,GAAG;AACL,GAAkC;AAC1B,QAAA,UAAU,OAA8B,IAAI;AAElD,gBAAc,SAAS;AAAA,IACrB,GAAG;AAAA,IACH,MAAM,SAAwC,OAAwB;;AAC5D,oBAAA,UAAA,iCAAQ,SAAS;AAEnB,YAAA,SAAS,CAAC,YAAY;AAC1B,6CAAW;AAAA,SACV,EAAE,WAAW,MAAM,MAAM,KAAM,CAAA;AAAA,IACpC;AAAA,EAAA,CACD;AAGC,SAAA,oBAAC,OAAI,EAAA,KAAK,QAAS,CAAA;AAEvB;"}
@@ -2,16 +2,23 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const jsxRuntime = require("react/jsx-runtime");
4
4
  const react = require("react");
5
+ const sdkShared = require("@adhese/sdk-shared");
5
6
  const useAdheseSlot = require("./useAdheseSlot.cjs");
6
7
  function AdheseSlot({
7
8
  onChange,
8
9
  ...options
9
10
  }) {
10
11
  const element = react.useRef(null);
11
- const slot = useAdheseSlot.useAdheseSlot(element, options);
12
- react.useEffect(() => {
13
- onChange == null ? void 0 : onChange(slot);
14
- }, [onChange, slot]);
12
+ useAdheseSlot.useAdheseSlot(element, {
13
+ ...options,
14
+ setup(context, hooks) {
15
+ var _a;
16
+ (_a = options.setup) == null ? void 0 : _a.call(options, context, hooks);
17
+ sdkShared.watch(context, (newSlot) => {
18
+ onChange == null ? void 0 : onChange(newSlot);
19
+ }, { immediate: true, deep: true });
20
+ }
21
+ });
15
22
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: element });
16
23
  }
17
24
  exports.AdheseSlot = AdheseSlot;
@@ -1 +1 @@
1
- {"version":3,"file":"AdheseSlot.cjs","sources":["../../src/AdheseSlot.tsx"],"sourcesContent":["import { type ReactElement, useEffect, useRef } from 'react';\nimport type { AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n ...options\n}: AdheseSlotProps): ReactElement {\n const element = useRef<HTMLDivElement | null>(null);\n\n const slot = useAdheseSlot(element, options);\n\n useEffect(() => {\n onChange?.(slot);\n }, [onChange, slot]);\n\n return (\n <div ref={element} />\n );\n}\n"],"names":["useRef","useAdheseSlot","useEffect","jsx"],"mappings":";;;;;AAgBO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,GAAG;AACL,GAAkC;AAC1B,QAAA,UAAUA,aAA8B,IAAI;AAE5C,QAAA,OAAOC,cAAAA,cAAc,SAAS,OAAO;AAE3CC,QAAAA,UAAU,MAAM;AACd,yCAAW;AAAA,EAAI,GACd,CAAC,UAAU,IAAI,CAAC;AAGjB,SAAAC,2BAAA,IAAC,OAAI,EAAA,KAAK,QAAS,CAAA;AAEvB;;"}
1
+ {"version":3,"file":"AdheseSlot.cjs","sources":["../../src/AdheseSlot.tsx"],"sourcesContent":["import { type ReactElement, useRef } from 'react';\nimport type { AdheseSlotContext, AdheseSlotHooks, AdheseSlotOptions, AdheseSlot as Slot } from '@adhese/sdk';\nimport { type Ref, watch } from '@adhese/sdk-shared';\nimport { useAdheseSlot } from './useAdheseSlot';\n\nexport type AdheseSlotProps = {\n /**\n * Callback to be called when the slot is created or disposed\n */\n onChange?(slot: Slot | null): void;\n} & Omit<AdheseSlotOptions, 'containingElement' | 'context'>;\n\n/**\n * Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be\n * created when the containing element is available and the Adhese instance is available.\n */\n// eslint-disable-next-line ts/naming-convention\nexport function AdheseSlot({\n onChange,\n ...options\n}: AdheseSlotProps): ReactElement {\n const element = useRef<HTMLDivElement | null>(null);\n\n useAdheseSlot(element, {\n ...options,\n setup(context: Ref<AdheseSlotContext | null>, hooks: AdheseSlotHooks) {\n options.setup?.(context, hooks);\n\n watch(context, (newSlot) => {\n onChange?.(newSlot);\n }, { immediate: true, deep: true });\n },\n });\n\n return (\n <div ref={element} />\n );\n}\n"],"names":["useRef","useAdheseSlot","watch","jsx"],"mappings":";;;;;;AAiBO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,GAAG;AACL,GAAkC;AAC1B,QAAA,UAAUA,aAA8B,IAAI;AAElDC,gBAAAA,cAAc,SAAS;AAAA,IACrB,GAAG;AAAA,IACH,MAAM,SAAwC,OAAwB;;AAC5D,oBAAA,UAAA,iCAAQ,SAAS;AAEnBC,sBAAA,SAAS,CAAC,YAAY;AAC1B,6CAAW;AAAA,SACV,EAAE,WAAW,MAAM,MAAM,KAAM,CAAA;AAAA,IACpC;AAAA,EAAA,CACD;AAGC,SAAAC,2BAAA,IAAC,OAAI,EAAA,KAAK,QAAS,CAAA;AAEvB;;"}
@@ -1,27 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const react = require("react");
4
- const useDeepCompareEffect = require("use-deep-compare-effect");
5
- const sdkShared = require("@adhese/sdk-shared");
6
4
  const adheseContext = require("./adheseContext.cjs");
7
5
  function useAdheseSlot(elementRef, options) {
8
- const [slot, setSlot] = react.useState(null);
6
+ const slot = react.useRef(null);
9
7
  const adhese = adheseContext.useAdhese();
10
- useDeepCompareEffect(() => {
11
- let intermediate;
12
- if (adhese && elementRef.current) {
13
- intermediate = adhese.addSlot(
14
- {
15
- ...options,
16
- containingElement: elementRef.current
17
- }
18
- );
19
- setSlot(intermediate);
20
- }
8
+ react.useEffect(() => {
9
+ if (!adhese || !elementRef.current)
10
+ return;
11
+ slot.current = adhese == null ? void 0 : adhese.addSlot({
12
+ ...options,
13
+ containingElement: elementRef.current
14
+ });
21
15
  return () => {
22
- intermediate == null ? void 0 : intermediate.dispose();
16
+ var _a;
17
+ (_a = slot.current) == null ? void 0 : _a.dispose();
23
18
  };
24
- }, [adhese, sdkShared.omit(options, Object.entries(options).filter(([, value]) => typeof value === "function").map(([key]) => key)), elementRef.current]);
19
+ }, [adhese == null ? void 0 : adhese.addSlot, options, elementRef.current]);
25
20
  return slot;
26
21
  }
27
22
  exports.useAdheseSlot = useAdheseSlot;
@@ -1 +1 @@
1
- {"version":3,"file":"useAdheseSlot.cjs","sources":["../../src/useAdheseSlot.ts"],"sourcesContent":["import { type RefObject, useState } from 'react';\nimport type { AdheseSlot, AdheseSlotOptions } from '@adhese/sdk';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\nimport { omit } from '@adhese/sdk-shared';\nimport { useAdhese } from './adheseContext';\n\n/**\n * Hook to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be created\n * when the containing element is available and the Adhese instance is available.\n * @param elementRef The ref to the containing element\n * @param options The options to create the slot\n */\nexport function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: Omit<AdheseSlotOptions, 'containingElement' | 'context'>): AdheseSlot | null {\n const [slot, setSlot] = useState<AdheseSlot | null>(null);\n const adhese = useAdhese();\n\n useDeepCompareEffect(() => {\n let intermediate: AdheseSlot | undefined;\n\n if (adhese && elementRef.current) {\n intermediate = adhese.addSlot(\n {\n ...options,\n containingElement: elementRef.current,\n },\n );\n\n setSlot(intermediate);\n }\n\n return (): void => {\n intermediate?.dispose();\n };\n }, [adhese, omit(options, Object.entries(options).filter(([, value]) => typeof value === 'function').map(([key]) => key as keyof typeof options)), elementRef.current]);\n\n return slot;\n}\n"],"names":["useState","useAdhese","omit"],"mappings":";;;;;;AAYgB,SAAA,cAAc,YAAoC,SAAsF;AACtJ,QAAM,CAAC,MAAM,OAAO,IAAIA,eAA4B,IAAI;AACxD,QAAM,SAASC,cAAAA;AAEf,uBAAqB,MAAM;AACrB,QAAA;AAEA,QAAA,UAAU,WAAW,SAAS;AAChC,qBAAe,OAAO;AAAA,QACpB;AAAA,UACE,GAAG;AAAA,UACH,mBAAmB,WAAW;AAAA,QAChC;AAAA,MAAA;AAGF,cAAQ,YAAY;AAAA,IACtB;AAEA,WAAO,MAAY;AACjB,mDAAc;AAAA,IAAQ;AAAA,EAEvB,GAAA,CAAC,QAAQC,eAAK,SAAS,OAAO,QAAQ,OAAO,EAAE,OAAO,CAAC,CAAA,EAAG,KAAK,MAAM,OAAO,UAAU,UAAU,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,GAA2B,CAAC,GAAG,WAAW,OAAO,CAAC;AAE/J,SAAA;AACT;;"}
1
+ {"version":3,"file":"useAdheseSlot.cjs","sources":["../../src/useAdheseSlot.ts"],"sourcesContent":["import { type RefObject, useEffect, useRef } from 'react';\nimport type { AdheseSlot, AdheseSlotOptions } from '@adhese/sdk';\nimport { useAdhese } from './adheseContext';\n\n/**\n * Hook to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be created\n * when the containing element is available and the Adhese instance is available.\n * @param elementRef The ref to the containing element\n * @param options The options to create the slot\n */\nexport function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: Omit<AdheseSlotOptions, 'containingElement' | 'context'>): RefObject<AdheseSlot | null> {\n const slot = useRef<AdheseSlot | null>(null);\n const adhese = useAdhese();\n\n useEffect(() => {\n if (!adhese || !elementRef.current)\n return;\n\n slot.current = adhese?.addSlot({\n ...options,\n containingElement: elementRef.current,\n });\n return (): void => {\n slot.current?.dispose();\n };\n }, [adhese?.addSlot, options, elementRef.current]);\n\n return slot;\n}\n"],"names":["useRef","useAdhese","useEffect"],"mappings":";;;;AAUgB,SAAA,cAAc,YAAoC,SAAiG;AAC3J,QAAA,OAAOA,aAA0B,IAAI;AAC3C,QAAM,SAASC,cAAAA;AAEfC,QAAAA,UAAU,MAAM;AACV,QAAA,CAAC,UAAU,CAAC,WAAW;AACzB;AAEG,SAAA,UAAU,iCAAQ,QAAQ;AAAA,MAC7B,GAAG;AAAA,MACH,mBAAmB,WAAW;AAAA,IAAA;AAEhC,WAAO,MAAY;;AACjB,iBAAK,YAAL,mBAAc;AAAA,IAAQ;AAAA,EACxB,GACC,CAAC,iCAAQ,SAAS,SAAS,WAAW,OAAO,CAAC;AAE1C,SAAA;AACT;;"}
@@ -0,0 +1,13 @@
1
+ import type { PropsWithChildren, ReactElement, RefObject } from 'react';
2
+
3
+ declare function AdheseProvider({ children, options }: PropsWithChildren<{
4
+ options: any;
5
+ }>): ReactElement;
6
+
7
+ declare function useAdhese(): any | undefined;
8
+
9
+ declare function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: any): any;
10
+
11
+ declare function AdheseSlot({ onChange, ...options }: {
12
+ onChange?(slot: any | null): void;
13
+ } & any): ReactElement;
@@ -20,7 +20,7 @@ declare function useAdhese(): Adhese | undefined;
20
20
  * @param elementRef The ref to the containing element
21
21
  * @param options The options to create the slot
22
22
  */
23
- declare function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: Omit<AdheseSlotOptions, 'containingElement' | 'context'>): AdheseSlot$1 | null;
23
+ declare function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: Omit<AdheseSlotOptions, 'containingElement' | 'context'>): RefObject<AdheseSlot$1 | null>;
24
24
 
25
25
  type AdheseSlotProps = {
26
26
  /**
@@ -1,25 +1,20 @@
1
- import { useState } from "react";
2
- import useDeepCompareEffect from "use-deep-compare-effect";
3
- import { omit } from "@adhese/sdk-shared";
1
+ import { useRef, useEffect } from "react";
4
2
  import { useAdhese } from "./adheseContext.js";
5
3
  function useAdheseSlot(elementRef, options) {
6
- const [slot, setSlot] = useState(null);
4
+ const slot = useRef(null);
7
5
  const adhese = useAdhese();
8
- useDeepCompareEffect(() => {
9
- let intermediate;
10
- if (adhese && elementRef.current) {
11
- intermediate = adhese.addSlot(
12
- {
13
- ...options,
14
- containingElement: elementRef.current
15
- }
16
- );
17
- setSlot(intermediate);
18
- }
6
+ useEffect(() => {
7
+ if (!adhese || !elementRef.current)
8
+ return;
9
+ slot.current = adhese == null ? void 0 : adhese.addSlot({
10
+ ...options,
11
+ containingElement: elementRef.current
12
+ });
19
13
  return () => {
20
- intermediate == null ? void 0 : intermediate.dispose();
14
+ var _a;
15
+ (_a = slot.current) == null ? void 0 : _a.dispose();
21
16
  };
22
- }, [adhese, omit(options, Object.entries(options).filter(([, value]) => typeof value === "function").map(([key]) => key)), elementRef.current]);
17
+ }, [adhese == null ? void 0 : adhese.addSlot, options, elementRef.current]);
23
18
  return slot;
24
19
  }
25
20
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"useAdheseSlot.js","sources":["../src/useAdheseSlot.ts"],"sourcesContent":["import { type RefObject, useState } from 'react';\nimport type { AdheseSlot, AdheseSlotOptions } from '@adhese/sdk';\nimport useDeepCompareEffect from 'use-deep-compare-effect';\nimport { omit } from '@adhese/sdk-shared';\nimport { useAdhese } from './adheseContext';\n\n/**\n * Hook to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be created\n * when the containing element is available and the Adhese instance is available.\n * @param elementRef The ref to the containing element\n * @param options The options to create the slot\n */\nexport function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: Omit<AdheseSlotOptions, 'containingElement' | 'context'>): AdheseSlot | null {\n const [slot, setSlot] = useState<AdheseSlot | null>(null);\n const adhese = useAdhese();\n\n useDeepCompareEffect(() => {\n let intermediate: AdheseSlot | undefined;\n\n if (adhese && elementRef.current) {\n intermediate = adhese.addSlot(\n {\n ...options,\n containingElement: elementRef.current,\n },\n );\n\n setSlot(intermediate);\n }\n\n return (): void => {\n intermediate?.dispose();\n };\n }, [adhese, omit(options, Object.entries(options).filter(([, value]) => typeof value === 'function').map(([key]) => key as keyof typeof options)), elementRef.current]);\n\n return slot;\n}\n"],"names":[],"mappings":";;;;AAYgB,SAAA,cAAc,YAAoC,SAAsF;AACtJ,QAAM,CAAC,MAAM,OAAO,IAAI,SAA4B,IAAI;AACxD,QAAM,SAAS;AAEf,uBAAqB,MAAM;AACrB,QAAA;AAEA,QAAA,UAAU,WAAW,SAAS;AAChC,qBAAe,OAAO;AAAA,QACpB;AAAA,UACE,GAAG;AAAA,UACH,mBAAmB,WAAW;AAAA,QAChC;AAAA,MAAA;AAGF,cAAQ,YAAY;AAAA,IACtB;AAEA,WAAO,MAAY;AACjB,mDAAc;AAAA,IAAQ;AAAA,EAEvB,GAAA,CAAC,QAAQ,KAAK,SAAS,OAAO,QAAQ,OAAO,EAAE,OAAO,CAAC,CAAA,EAAG,KAAK,MAAM,OAAO,UAAU,UAAU,EAAE,IAAI,CAAC,CAAC,GAAG,MAAM,GAA2B,CAAC,GAAG,WAAW,OAAO,CAAC;AAE/J,SAAA;AACT;"}
1
+ {"version":3,"file":"useAdheseSlot.js","sources":["../src/useAdheseSlot.ts"],"sourcesContent":["import { type RefObject, useEffect, useRef } from 'react';\nimport type { AdheseSlot, AdheseSlotOptions } from '@adhese/sdk';\nimport { useAdhese } from './adheseContext';\n\n/**\n * Hook to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be created\n * when the containing element is available and the Adhese instance is available.\n * @param elementRef The ref to the containing element\n * @param options The options to create the slot\n */\nexport function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: Omit<AdheseSlotOptions, 'containingElement' | 'context'>): RefObject<AdheseSlot | null> {\n const slot = useRef<AdheseSlot | null>(null);\n const adhese = useAdhese();\n\n useEffect(() => {\n if (!adhese || !elementRef.current)\n return;\n\n slot.current = adhese?.addSlot({\n ...options,\n containingElement: elementRef.current,\n });\n return (): void => {\n slot.current?.dispose();\n };\n }, [adhese?.addSlot, options, elementRef.current]);\n\n return slot;\n}\n"],"names":[],"mappings":";;AAUgB,SAAA,cAAc,YAAoC,SAAiG;AAC3J,QAAA,OAAO,OAA0B,IAAI;AAC3C,QAAM,SAAS;AAEf,YAAU,MAAM;AACV,QAAA,CAAC,UAAU,CAAC,WAAW;AACzB;AAEG,SAAA,UAAU,iCAAQ,QAAQ;AAAA,MAC7B,GAAG;AAAA,MACH,mBAAmB,WAAW;AAAA,IAAA;AAEhC,WAAO,MAAY;;AACjB,iBAAK,YAAL,mBAAc;AAAA,IAAQ;AAAA,EACxB,GACC,CAAC,iCAAQ,SAAS,SAAS,WAAW,OAAO,CAAC;AAE1C,SAAA;AACT;"}
package/package.json CHANGED
@@ -1,20 +1,36 @@
1
1
  {
2
2
  "name": "@adhese/sdk-react",
3
3
  "type": "module",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "description": "Adhese SDK",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/adhese/sdk_typescript.git"
9
9
  },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/sdkReact.d.ts",
13
+ "import": "./dist/sdkReact.js",
14
+ "require": "./dist/cjs/sdkReact.cjs",
15
+ "types@<5.1": "./dist/legacy.d.ts"
16
+ }
17
+ },
10
18
  "main": "./dist/cjs/sdkReact.cjs",
11
19
  "module": "./dist/sdkReact.js",
12
20
  "types": "./dist/sdkReact.d.ts",
21
+ "typesVersions": {
22
+ "<5.1": {
23
+ "*": [
24
+ "./dist/legacy.d.ts"
25
+ ]
26
+ }
27
+ },
13
28
  "files": [
14
29
  "CHANGELOG.md",
15
30
  "LICENSE",
16
31
  "README.md",
17
- "dist"
32
+ "dist",
33
+ "src/legacy.d.ts"
18
34
  ],
19
35
  "scripts": {
20
36
  "build": "vite build",
@@ -25,16 +41,11 @@
25
41
  "prepareRelease": "npm run build"
26
42
  },
27
43
  "peerDependencies": {
28
- "@adhese/sdk": ">=1.0.0",
29
44
  "react": ">=16.13",
30
45
  "react-dom": ">=16.13"
31
46
  },
32
47
  "dependencies": {
33
- "@adhese/sdk-shared": "^1.0.0",
34
- "use-deep-compare-effect": "^1.8.1"
35
- },
36
- "devDependencies": {
37
- "react": "^18.3.1",
38
- "react-dom": "^18.3.1"
48
+ "@adhese/sdk": "^1.0.2",
49
+ "@adhese/sdk-shared": "^1.0.0"
39
50
  }
40
51
  }
@@ -0,0 +1,13 @@
1
+ import type { PropsWithChildren, ReactElement, RefObject } from 'react';
2
+
3
+ declare function AdheseProvider({ children, options }: PropsWithChildren<{
4
+ options: any;
5
+ }>): ReactElement;
6
+
7
+ declare function useAdhese(): any | undefined;
8
+
9
+ declare function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: any): any;
10
+
11
+ declare function AdheseSlot({ onChange, ...options }: {
12
+ onChange?(slot: any | null): void;
13
+ } & any): ReactElement;