@animaapp/anima-sdk-react 0.6.34 → 0.7.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/dist/index.cjs +28 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +60 -29
- package/dist/index.js +1137 -4525
- package/dist/index.js.map +1 -1
- package/package.json +12 -13
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,60 @@
|
|
|
1
|
+
import { AnimaFiles } from '@animaapp/anima-sdk';
|
|
1
2
|
import { AnimaSDKResult } from '@animaapp/anima-sdk';
|
|
2
3
|
import { CodegenError } from '@animaapp/anima-sdk';
|
|
4
|
+
import { Context } from 'react';
|
|
3
5
|
import { GetCodeFromWebsiteParams } from '@animaapp/anima-sdk';
|
|
4
6
|
import { GetCodeParams } from '@animaapp/anima-sdk';
|
|
5
7
|
import { GetFileResponse } from '@figma/rest-api-spec';
|
|
6
8
|
import { GetLink2CodeParams } from '@animaapp/anima-sdk';
|
|
9
|
+
import { JSX } from 'react/jsx-runtime';
|
|
7
10
|
import { ProgressMessage } from '@animaapp/anima-sdk';
|
|
11
|
+
import { ReactNode } from 'react';
|
|
8
12
|
|
|
9
|
-
export declare
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tasks: {
|
|
15
|
-
fetchDesign: {
|
|
16
|
-
status: TaskStatus;
|
|
17
|
-
};
|
|
18
|
-
codeGeneration: {
|
|
19
|
-
status: TaskStatus;
|
|
20
|
-
progress: number;
|
|
21
|
-
};
|
|
22
|
-
uploadAssets: {
|
|
23
|
-
status: TaskStatus;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
jobSessionId: string | null;
|
|
27
|
-
jobStatus: Record<string, any>;
|
|
13
|
+
export declare const AnimaSdkContext: Context<AnimaSdkContextType | null>;
|
|
14
|
+
|
|
15
|
+
declare type AnimaSdkContextType = {
|
|
16
|
+
createJob: <T extends UseAnimaParams = UseAnimaParams>(type: JobType, params: T) => Promise<void>;
|
|
17
|
+
job: Job;
|
|
28
18
|
};
|
|
29
19
|
|
|
30
|
-
export declare
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
export declare function AnimaSdkProvider({ f2cUrl, l2cUrl, p2cUrl, children }: Props): JSX.Element;
|
|
21
|
+
|
|
22
|
+
export declare class CreateJobError extends Error {
|
|
23
|
+
constructor(message: string, cause: unknown);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare type Job = {
|
|
27
|
+
status: 'idle';
|
|
33
28
|
} | {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
status: 'error';
|
|
30
|
+
type: JobType;
|
|
31
|
+
params: Record<string, any>;
|
|
32
|
+
error: CreateJobError;
|
|
33
|
+
sessionId: string | null;
|
|
34
|
+
payload: Record<string, any>;
|
|
35
|
+
progressMessages: ProgressMessage[];
|
|
36
|
+
} | {
|
|
37
|
+
status: 'pending';
|
|
38
|
+
type: JobType;
|
|
39
|
+
params: Record<string, any>;
|
|
40
|
+
sessionId: string | null;
|
|
41
|
+
payload: Record<string, any>;
|
|
42
|
+
progressMessages: ProgressMessage[];
|
|
43
|
+
} | {
|
|
44
|
+
status: 'success';
|
|
45
|
+
type: JobType;
|
|
46
|
+
params: Record<string, any>;
|
|
47
|
+
sessionId: string;
|
|
48
|
+
payload: Record<string, any>;
|
|
49
|
+
assets?: Array<{
|
|
50
|
+
name: string;
|
|
51
|
+
url: string;
|
|
52
|
+
}>;
|
|
53
|
+
files: AnimaFiles;
|
|
54
|
+
progressMessages: ProgressMessage[];
|
|
55
|
+
};
|
|
37
56
|
|
|
38
|
-
|
|
57
|
+
declare type JobType = 'f2c' | 'l2c' | 'p2c';
|
|
39
58
|
|
|
40
59
|
declare type LocalAssetsStorage = {
|
|
41
60
|
strategy: "local";
|
|
@@ -46,10 +65,20 @@ declare type LocalAssetsStorage = {
|
|
|
46
65
|
referencePath: string;
|
|
47
66
|
};
|
|
48
67
|
|
|
49
|
-
declare type
|
|
68
|
+
declare type Props = {
|
|
69
|
+
f2cUrl: string;
|
|
70
|
+
l2cUrl: string;
|
|
71
|
+
p2cUrl: string;
|
|
72
|
+
children: ReactNode;
|
|
73
|
+
};
|
|
50
74
|
|
|
51
|
-
declare
|
|
75
|
+
export declare class UnknownCodegenError extends Error {
|
|
76
|
+
constructor();
|
|
77
|
+
}
|
|
52
78
|
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated use `createJob` from `AnimaSdkProvider` instead
|
|
81
|
+
*/
|
|
53
82
|
export declare const useAnimaCodegen: ({ url, method, }: {
|
|
54
83
|
url: string;
|
|
55
84
|
method?: string;
|
|
@@ -81,7 +110,7 @@ export declare const useAnimaCodegen: ({ url, method, }: {
|
|
|
81
110
|
result: AnimaSDKResult | null;
|
|
82
111
|
};
|
|
83
112
|
|
|
84
|
-
|
|
113
|
+
declare type UseAnimaParams = (Omit<GetCodeParams, "assetsStorage"> & {
|
|
85
114
|
assetsStorage?: GetCodeParams["assetsStorage"] | LocalAssetsStorage;
|
|
86
115
|
}) | (Omit<GetCodeFromWebsiteParams, "assetsStorage"> & {
|
|
87
116
|
assetsStorage?: GetCodeFromWebsiteParams["assetsStorage"] | LocalAssetsStorage;
|
|
@@ -89,6 +118,8 @@ export declare type UseAnimaParams = (Omit<GetCodeParams, "assetsStorage"> & {
|
|
|
89
118
|
assetsStorage?: GetLink2CodeParams["assetsStorage"] | LocalAssetsStorage;
|
|
90
119
|
});
|
|
91
120
|
|
|
121
|
+
export declare function useAnimaSDK(): AnimaSdkContextType;
|
|
122
|
+
|
|
92
123
|
export declare const useFigmaFile: ({ fileKey, authToken, enabled, params, }: {
|
|
93
124
|
fileKey: string;
|
|
94
125
|
authToken: string;
|