@safetech/inheriti-client-sdk 1.11.0 → 1.16.0

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.
@@ -0,0 +1,59 @@
1
+ export { SDKContainer } from '@safetech/inheriti-core-sdk/vanilla';
2
+ import { ValidEnv, AuthClientProps } from '@safetech/inheriti-core-sdk';
3
+ export * from '@safetech/inheriti-core-sdk';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ReactNode } from 'react';
6
+
7
+ /**
8
+ * Props for the `InheritiClientProvider` component.
9
+ */
10
+ interface InheritiClientProviderProps {
11
+ /**
12
+ * React children nodes to be wrapped by the provider.
13
+ */
14
+ children: ReactNode;
15
+ /**
16
+ * The client ID used to authenticate or identify the consumer of the SDK.
17
+ */
18
+ clientId?: string;
19
+ /**
20
+ * Additional configuration options.
21
+ */
22
+ options?: {
23
+ /**
24
+ * The environment in which the SDK should operate.
25
+ */
26
+ env: ValidEnv;
27
+ };
28
+ }
29
+ /**
30
+ * Provides the Inheriti SDK context to all children components.
31
+ *
32
+ * This should be placed near the root of your application to ensure
33
+ * the SDK client is properly initialized and available throughout your app.
34
+ *
35
+ * @param props - The provider props including children, clientId, and options.
36
+ */
37
+ declare function InheritiClientProvider({ children, clientId, options }: InheritiClientProviderProps): react_jsx_runtime.JSX.Element;
38
+
39
+ /**
40
+ * Wraps core's useClient to update the httpClient's apiUrl
41
+ * whenever connect is called with a different env.
42
+ */
43
+ declare function useClient(): {
44
+ connect: (params: AuthClientProps) => Promise<void>;
45
+ client: AuthClientProps | undefined;
46
+ isConnected: boolean;
47
+ disconnect: () => Promise<void>;
48
+ loading: boolean;
49
+ };
50
+
51
+ declare function getAvailableEnvs(): {
52
+ availableEnvironments: ValidEnv[];
53
+ defaultEnv: "local" | "development" | "staging";
54
+ registerUrl: string;
55
+ demoKeyApiUrl: string;
56
+ };
57
+
58
+ export { InheritiClientProvider, getAvailableEnvs, useClient };
59
+ export type { InheritiClientProviderProps };
@@ -0,0 +1,2 @@
1
+ import { ErrorHandlingStrategy } from "@safetech/inheriti-core-sdk";
2
+ export declare const ClientSDKErrorHandlingStrategy: ErrorHandlingStrategy;
@@ -0,0 +1 @@
1
+ export default function getApiUrl(path: string, env?: string): string;
@@ -0,0 +1,7 @@
1
+ import type { ValidEnv } from "@safetech/inheriti-core-sdk";
2
+ export declare function getAvailableEnvs(): {
3
+ availableEnvironments: ValidEnv[];
4
+ defaultEnv: "local" | "development" | "staging";
5
+ registerUrl: string;
6
+ demoKeyApiUrl: string;
7
+ };
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from "react";
2
+ import { type ValidEnv } from "@safetech/inheriti-core-sdk";
3
+ export declare const HttpClientContext: import("react").Context<any>;
4
+ /**
5
+ * Props for the `InheritiClientProvider` component.
6
+ */
7
+ export interface InheritiClientProviderProps {
8
+ /**
9
+ * React children nodes to be wrapped by the provider.
10
+ */
11
+ children: ReactNode;
12
+ /**
13
+ * The client ID used to authenticate or identify the consumer of the SDK.
14
+ */
15
+ clientId?: string;
16
+ /**
17
+ * Additional configuration options.
18
+ */
19
+ options?: {
20
+ /**
21
+ * The environment in which the SDK should operate.
22
+ */
23
+ env: ValidEnv;
24
+ };
25
+ }
26
+ /**
27
+ * Provides the Inheriti SDK context to all children components.
28
+ *
29
+ * This should be placed near the root of your application to ensure
30
+ * the SDK client is properly initialized and available throughout your app.
31
+ *
32
+ * @param props - The provider props including children, clientId, and options.
33
+ */
34
+ export default function InheritiClientProvider({ children, clientId, options }: InheritiClientProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { type AuthClientProps } from "@safetech/inheriti-core-sdk";
2
+ /**
3
+ * Wraps core's useClient to update the httpClient's apiUrl
4
+ * whenever connect is called with a different env.
5
+ */
6
+ export default function useClient(): {
7
+ connect: (params: AuthClientProps) => Promise<void>;
8
+ client: AuthClientProps | undefined;
9
+ isConnected: boolean;
10
+ disconnect: () => Promise<void>;
11
+ loading: boolean;
12
+ };
@@ -0,0 +1 @@
1
+ import{TestUtils as t}from"@safetech/inheriti-core-sdk/test";import{DataAssetBuilder as a}from"@safetech/inheriti-core-sdk";var i=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","afford","afraid","again","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert"],d={plainText:e=>a.plainText({name:e?.name??"Plain text asset",id:e?.id,secret:e?.secret??{text:"Sample plain text"}}),onlineAccount:e=>a.userAndPassword({name:e?.name??"Online account",id:e?.id,secret:e?.secret??{appOrWebsite:"example.com",email:"user@example.com",username:"sampleuser",password:"SamplePass123!"}}),recoveryCode:e=>a.recoveryCode({name:e?.name??"Recovery code",id:e?.id,secret:e?.secret??{appOrWebsite:"example.com",code:"XXXX-XXXX-XXXX-XXXX"}}),pinCode:e=>a.pinCode({name:e?.name??"PIN code",id:e?.id,secret:e?.secret??{deviceOrApp:"My Device",code:"1234"}}),apiKey:e=>a.apiKey({name:e?.name??"API key",id:e?.id,secret:e?.secret??{app:"My App",apiKey:"sk-sample-api-key-12345"}}),privateKey:e=>a.privateKey({name:e?.name??"Private key",id:e?.id,secret:e?.secret??{publicAddress:"0x0000000000000000000000000000000000000000",privateKey:"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"}}),seedPhrase:e=>{let r=e?.typeLength??12,n=e?.secret?.words??Array.from({length:r},(s,c)=>i[c%i.length]);return a.seedPhrase({name:e?.name??"Seed phrase",id:e?.id,secret:{words:n}})},paymentDebitCard:e=>a.paymentDebitCard({name:e?.name??"Debit card",id:e?.id,secret:e?.secret??{cardNumber:"4111 1111 1111 1111",expiryDate:"12/28"}}),paymentCreditCard:e=>a.paymentCreditCard({name:e?.name??"Credit card",id:e?.id,secret:e?.secret??{cardNumber:"4111 1111 1111 1111",expiryDate:"12/28"}})},l={...t,ProtectionPlan:{...t.ProtectionPlan,PlanDataAssetInputGenerator:d}};export{l as TestUtils};
package/dist/test.d.ts ADDED
@@ -0,0 +1,184 @@
1
+ export declare const TestUtils: {
2
+ ProtectionPlan: {
3
+ PlanDataAssetInputGenerator: {
4
+ plainText: (props?: {
5
+ id?: string;
6
+ name?: string;
7
+ secret?: {
8
+ text: string;
9
+ };
10
+ }) => import("@safetech/inheriti-core-sdk").DataAsset;
11
+ onlineAccount: (props?: any) => import("@safetech/inheriti-core-sdk").DataAsset;
12
+ recoveryCode: (props?: any) => import("@safetech/inheriti-core-sdk").DataAsset;
13
+ pinCode: (props?: any) => import("@safetech/inheriti-core-sdk").DataAsset;
14
+ apiKey: (props?: any) => import("@safetech/inheriti-core-sdk").DataAsset;
15
+ privateKey: (props?: any) => import("@safetech/inheriti-core-sdk").DataAsset;
16
+ seedPhrase: (props?: {
17
+ id?: string;
18
+ name?: string;
19
+ typeLength?: number;
20
+ secret?: {
21
+ words: string[];
22
+ };
23
+ }) => import("@safetech/inheriti-core-sdk").DataAsset;
24
+ paymentDebitCard: (props?: any) => import("@safetech/inheriti-core-sdk").DataAsset;
25
+ paymentCreditCard: (props?: any) => import("@safetech/inheriti-core-sdk").DataAsset;
26
+ };
27
+ };
28
+ RandomElementPickerMother: {
29
+ new (): {};
30
+ from(a: any): any;
31
+ };
32
+ SharedProtectionPlan: {};
33
+ DataAssetInputGenerator: {
34
+ new (): {};
35
+ plainText({ id: a, name: e, secret: i }?: {
36
+ id?: any;
37
+ name?: any;
38
+ }): {
39
+ id: any;
40
+ type: string;
41
+ meta: {
42
+ name: any;
43
+ };
44
+ secret: any;
45
+ };
46
+ userAndPassword({ id: a, name: e, notes: i, secret: n }?: {
47
+ id?: any;
48
+ name?: any;
49
+ notes?: any;
50
+ }): {
51
+ id: any;
52
+ type: string;
53
+ meta: {
54
+ name: any;
55
+ notes: any;
56
+ };
57
+ secret: any;
58
+ };
59
+ recoveryCode({ id: a, name: e, notes: i, secret: n }?: {
60
+ id?: any;
61
+ name?: any;
62
+ notes?: any;
63
+ }): {
64
+ id: any;
65
+ type: string;
66
+ meta: {
67
+ name: any;
68
+ notes: any;
69
+ };
70
+ secret: any;
71
+ };
72
+ pinCode({ id: a, name: e, notes: i, secret: n }?: {
73
+ id?: any;
74
+ name?: any;
75
+ notes?: any;
76
+ }): {
77
+ id: any;
78
+ type: string;
79
+ meta: {
80
+ name: any;
81
+ notes: any;
82
+ };
83
+ secret: any;
84
+ };
85
+ apiKey({ id: a, name: e, notes: i, secret: n }?: {
86
+ id?: any;
87
+ name?: any;
88
+ notes?: any;
89
+ }): {
90
+ id: any;
91
+ type: string;
92
+ meta: {
93
+ name: any;
94
+ notes: any;
95
+ };
96
+ secret: any;
97
+ };
98
+ privateKey({ id: a, name: e, notes: i, secret: n }?: {
99
+ id?: any;
100
+ name?: any;
101
+ notes?: any;
102
+ }): {
103
+ id: any;
104
+ type: string;
105
+ meta: {
106
+ name: any;
107
+ notes: any;
108
+ };
109
+ secret: any;
110
+ };
111
+ seedPhrase({ id: a, name: e, notes: i, typeLength: n, secret: r }?: {
112
+ id?: any;
113
+ name?: any;
114
+ notes?: any;
115
+ typeLength?: any;
116
+ }): {
117
+ id: any;
118
+ type: string;
119
+ meta: {
120
+ name: any;
121
+ notes: any;
122
+ };
123
+ secret: any;
124
+ };
125
+ paymentDebitCard({ id: a, name: e, notes: i, secret: n }?: {
126
+ id?: any;
127
+ name?: any;
128
+ notes?: any;
129
+ }): {
130
+ id: any;
131
+ type: string;
132
+ meta: {
133
+ name: any;
134
+ notes: any;
135
+ };
136
+ secret: any;
137
+ };
138
+ pdf({ id: a, name: e }?: {
139
+ id?: any;
140
+ name?: any;
141
+ }): {
142
+ id: any;
143
+ type: string;
144
+ meta: {
145
+ name: any;
146
+ mimeType: string;
147
+ isMedia: boolean;
148
+ };
149
+ secret: {
150
+ data: string;
151
+ mimeType: string;
152
+ };
153
+ };
154
+ video({ id: a, name: e }?: {
155
+ id?: any;
156
+ name?: any;
157
+ }): {
158
+ id: any;
159
+ type: string;
160
+ meta: {
161
+ name: any;
162
+ mimeType: string;
163
+ isMedia: boolean;
164
+ };
165
+ secret: {
166
+ data: string;
167
+ mimeType: string;
168
+ };
169
+ };
170
+ paymentCreditCard({ id: a, name: e, notes: i, secret: n }?: {
171
+ id?: any;
172
+ name?: any;
173
+ notes?: any;
174
+ }): {
175
+ id: any;
176
+ type: string;
177
+ meta: {
178
+ name: any;
179
+ notes: any;
180
+ };
181
+ secret: any;
182
+ };
183
+ };
184
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@safetech/inheriti-client-sdk",
3
- "version": "1.11.0",
3
+ "version": "1.16.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -62,6 +62,7 @@
62
62
  },
63
63
  "scripts": {
64
64
  "build": "node esbuild.config.js",
65
+ "prepublishOnly": "node esbuild.config.js",
65
66
  "publish-version": "node scripts/publish-sdk-version.js",
66
67
  "add-patch": "node scripts/bump-version.js patch",
67
68
  "generate-docs": "npx typedoc --json docs/docs.json",