@dashx/react 0.0.1

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 ADDED
@@ -0,0 +1,70 @@
1
+ <p align="center">
2
+ <br />
3
+ <a href="https://dashx.com"><img src="https://raw.githubusercontent.com/dashxhq/brand-book/master/assets/logo-black-text-color-icon@2x.png" alt="DashX" height="40" /></a>
4
+ <br />
5
+ <br />
6
+ <strong>Your All-in-One Product Stack</strong>
7
+ </p>
8
+
9
+ <div align="center">
10
+ <h4>
11
+ <a href="https://dashx.com">Website</a>
12
+ <span> | </span>
13
+ <a href="https://dashxdemo.com">Demos</a>
14
+ <span> | </span>
15
+ <a href="https://docs.dashx.com/developer">Documentation</a>
16
+ </h4>
17
+ </div>
18
+
19
+ <br />
20
+
21
+ # @dashx/react
22
+
23
+ _DashX SDK for the React
24
+
25
+ ## Install
26
+
27
+ **npm**
28
+
29
+ ```sh
30
+ npm install @dashx/react
31
+ ```
32
+
33
+ **yarn**
34
+
35
+ ```sh
36
+ yarn add @dashx/react
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ For detailed usage, refer to the [documentation](https://docs.dashx.com).
42
+
43
+ ## Contributing
44
+
45
+ - Make sure all the dependencies are installed:
46
+
47
+ ```sh
48
+ npm install
49
+ ```
50
+
51
+ - To start dev server with hot reload:
52
+
53
+ ```sh
54
+ yarn dev
55
+ ```
56
+
57
+ This will run a dev server that logs out errors and warnings and reloads itself on any file save.
58
+
59
+ - To create production build:
60
+
61
+ ```sh
62
+ yarn build
63
+ ```
64
+
65
+ - To publish package, make sure to login on npm cli and commit all the changes before running this:
66
+
67
+ ```sh
68
+ yarn publish
69
+ git push origin main
70
+ ```
@@ -0,0 +1,47 @@
1
+ import { ChangeEvent } from 'react';
2
+ import { ClientParams } from '@dashx/browser/dist/Client';
3
+ import { default as default_2 } from 'react';
4
+ import { default as default_3 } from '@dashx/browser/dist/Client';
5
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
6
+
7
+ export declare function DashXProvider({ children, publicKey, baseUri, targetEnvironment, }: default_2.PropsWithChildren<ClientParams>): JSX_2.Element;
8
+
9
+ export declare function Preference({ preference, onChange, renderPreference, }: PreferenceProps): JSX.Element;
10
+
11
+ declare interface PreferenceProps {
12
+ preference: PreferenceType;
13
+ onChange: (e: ChangeEvent<HTMLInputElement>, p: PreferenceType) => void;
14
+ renderPreference?: RenderPreferenceFunction;
15
+ }
16
+
17
+ export declare function Preferences({ renderPreferences, }: PreferencesProps): JSX.Element;
18
+
19
+ declare interface PreferencesProps {
20
+ renderPreferences: ({ preferences, onChange, loading, error, }: {
21
+ preferences: [string, StoredPreference][] | null;
22
+ onChange: (e: ChangeEvent<HTMLInputElement>, p: [string, StoredPreference]) => void;
23
+ loading: boolean;
24
+ error: any;
25
+ }) => JSX.Element;
26
+ }
27
+
28
+ declare type PreferenceType = [string, StoredPreference];
29
+
30
+ declare type RenderPreferenceFunction = (props: {
31
+ preference: PreferenceType;
32
+ onChange: UpdatePreferenceHandler;
33
+ }) => JSX.Element;
34
+
35
+ declare interface StoredPreference {
36
+ enabled?: boolean;
37
+ email: boolean;
38
+ push: boolean;
39
+ sms: boolean;
40
+ whatsapp: boolean;
41
+ }
42
+
43
+ declare type UpdatePreferenceHandler = (event: ChangeEvent<HTMLInputElement>, preference: PreferenceType) => void;
44
+
45
+ export declare const useDashXProvider: () => default_3;
46
+
47
+ export { }