@adhese/sdk-react 0.9.13 → 0.9.14
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 +6 -0
- package/dist/sdkReact.d.ts +37 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactElement, RefObject } from 'react';
|
|
2
|
+
import { AdheseOptions, Adhese, AdheseSlotOptions, AdheseSlot as AdheseSlot$1 } from '@adhese/sdk';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Provider to create an Adhese instance with the given options. Via the `useAdhese` hook, the Adhese instance can be
|
|
6
|
+
* used in all child components.
|
|
7
|
+
* @constructor
|
|
8
|
+
*/
|
|
9
|
+
declare function AdheseProvider({ children, options }: PropsWithChildren<{
|
|
10
|
+
options: AdheseOptions;
|
|
11
|
+
}>): ReactElement;
|
|
12
|
+
/**
|
|
13
|
+
* Hook to get the Adhese instance from the nearest `AdheseProvider`. When the Adhese instance is not available yet, `null`
|
|
14
|
+
*/
|
|
15
|
+
declare function useAdhese(): Adhese | undefined;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Hook to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be created
|
|
19
|
+
* when the containing element is available and the Adhese instance is available.
|
|
20
|
+
* @param elementRef The ref to the containing element
|
|
21
|
+
* @param options The options to create the slot
|
|
22
|
+
*/
|
|
23
|
+
declare function useAdheseSlot(elementRef: RefObject<HTMLElement>, options: Omit<AdheseSlotOptions, 'containingElement' | 'context'>): AdheseSlot$1 | null;
|
|
24
|
+
|
|
25
|
+
type AdheseSlotProps = {
|
|
26
|
+
/**
|
|
27
|
+
* Callback to be called when the slot is created or disposed
|
|
28
|
+
*/
|
|
29
|
+
onChange?(slot: AdheseSlot$1 | null): void;
|
|
30
|
+
} & Omit<AdheseSlotOptions, 'containingElement' | 'context'>;
|
|
31
|
+
/**
|
|
32
|
+
* Component to create an Adhese slot. The slot will be disposed when the component is unmounted. The slot will be
|
|
33
|
+
* created when the containing element is available and the Adhese instance is available.
|
|
34
|
+
*/
|
|
35
|
+
declare function AdheseSlot({ onChange, ...options }: AdheseSlotProps): ReactElement;
|
|
36
|
+
|
|
37
|
+
export { AdheseProvider, AdheseSlot, useAdhese, useAdheseSlot };
|