@canva/intents 2.0.2-beta.3 → 2.1.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.
- package/CHANGELOG.md +15 -0
- package/asset/index.d.ts +1 -1
- package/content/index.d.ts +1440 -1
- package/data/index.d.ts +1229 -1
- package/design/index.d.ts +41 -1
- package/index.d.ts +2821 -1
- package/lib/cjs/sdk/intents/asset/index.js +1 -15
- package/lib/cjs/sdk/intents/content/index.js +4 -2
- package/lib/cjs/sdk/intents/content/{beta.js → public.js} +0 -2
- package/lib/cjs/sdk/intents/fake/create.js +3 -0
- package/lib/cjs/sdk/intents/index.js +4 -2
- package/lib/cjs/sdk/intents/public.js +8 -4
- package/lib/cjs/sdk/intents/version.js +17 -4
- package/lib/esm/sdk/intents/asset/index.js +1 -1
- package/lib/esm/sdk/intents/content/index.js +3 -1
- package/lib/esm/sdk/intents/content/public.js +2 -0
- package/lib/esm/sdk/intents/fake/create.js +3 -0
- package/lib/esm/sdk/intents/index.js +3 -1
- package/lib/esm/sdk/intents/public.js +2 -1
- package/lib/esm/sdk/intents/version.js +3 -1
- package/package.json +23 -23
- package/test/index.d.ts +11 -1
- package/asset/beta.d.ts +0 -236
- package/beta.d.ts +0 -1309
- package/content/beta.d.ts +0 -1410
- package/data/beta.d.ts +0 -1242
- package/design/beta.d.ts +0 -43
- package/lib/cjs/sdk/intents/asset/beta.js +0 -14
- package/lib/cjs/sdk/intents/beta.js +0 -20
- package/lib/cjs/sdk/intents/data/beta.js +0 -20
- package/lib/cjs/sdk/intents/design/beta.js +0 -20
- package/lib/cjs/sdk/intents/test/beta.js +0 -18
- package/lib/esm/sdk/intents/asset/beta.js +0 -4
- package/lib/esm/sdk/intents/beta.js +0 -3
- package/lib/esm/sdk/intents/content/beta.js +0 -4
- package/lib/esm/sdk/intents/data/beta.js +0 -3
- package/lib/esm/sdk/intents/design/beta.js +0 -3
- package/lib/esm/sdk/intents/test/beta.js +0 -1
- package/test/beta.d.ts +0 -11
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict"
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
_export_star(require("./beta"), exports);
|
|
6
|
-
function _export_star(from, to) {
|
|
7
|
-
Object.keys(from).forEach(function(k) {
|
|
8
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
-
Object.defineProperty(to, k, {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function() {
|
|
12
|
-
return from[k];
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return from;
|
|
18
|
-
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict"
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
5
|
+
const _version = require("../version");
|
|
6
|
+
_export_star(require("./public"), exports);
|
|
6
7
|
function _export_star(from, to) {
|
|
7
8
|
Object.keys(from).forEach(function(k) {
|
|
8
9
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -16,3 +17,4 @@ function _export_star(from, to) {
|
|
|
16
17
|
});
|
|
17
18
|
return from;
|
|
18
19
|
}
|
|
20
|
+
window.__canva__?.sdkRegistration?.registerPackageVersion('intents/content', _version.LATEST_VERSION, 'ga');
|
|
@@ -8,7 +8,5 @@ Object.defineProperty(exports, "prepareContentPublisher", {
|
|
|
8
8
|
return prepareContentPublisher;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const _version = require("../version");
|
|
12
11
|
const { canva_sdk } = window;
|
|
13
12
|
const prepareContentPublisher = canva_sdk.intents.v1.content.prepareContentPublisher;
|
|
14
|
-
window.__canva__?.sdkRegistration?.registerPackageVersion('intents/content', _version.LATEST_VERSION, 'beta');
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict"
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
5
|
+
const _version = require("./version");
|
|
6
|
+
_export_star(require("./public"), exports);
|
|
6
7
|
function _export_star(from, to) {
|
|
7
8
|
Object.keys(from).forEach(function(k) {
|
|
8
9
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
@@ -16,3 +17,4 @@ function _export_star(from, to) {
|
|
|
16
17
|
});
|
|
17
18
|
return from;
|
|
18
19
|
}
|
|
20
|
+
window.__canva__?.sdkRegistration?.registerPackageVersion('intents', _version.LATEST_VERSION, 'ga');
|
|
@@ -9,15 +9,19 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
get
|
|
12
|
+
get content () {
|
|
13
13
|
return _index;
|
|
14
14
|
},
|
|
15
|
-
get
|
|
15
|
+
get data () {
|
|
16
16
|
return _index1;
|
|
17
|
+
},
|
|
18
|
+
get design () {
|
|
19
|
+
return _index2;
|
|
17
20
|
}
|
|
18
21
|
});
|
|
19
|
-
const _index = _interop_require_wildcard(require("./
|
|
20
|
-
const _index1 = _interop_require_wildcard(require("./
|
|
22
|
+
const _index = _interop_require_wildcard(require("./content/index"));
|
|
23
|
+
const _index1 = _interop_require_wildcard(require("./data/index"));
|
|
24
|
+
const _index2 = _interop_require_wildcard(require("./design/index"));
|
|
21
25
|
function _getRequireWildcardCache(nodeInterop) {
|
|
22
26
|
if (typeof WeakMap !== "function") return null;
|
|
23
27
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -2,10 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get LATEST_VERSION () {
|
|
8
13
|
return LATEST_VERSION;
|
|
14
|
+
},
|
|
15
|
+
get LATEST_VERSION_ALPHA () {
|
|
16
|
+
return LATEST_VERSION_ALPHA;
|
|
17
|
+
},
|
|
18
|
+
get LATEST_VERSION_BETA () {
|
|
19
|
+
return LATEST_VERSION_BETA;
|
|
9
20
|
}
|
|
10
21
|
});
|
|
11
|
-
const LATEST_VERSION = '2.0
|
|
22
|
+
const LATEST_VERSION = '2.1.0';
|
|
23
|
+
const LATEST_VERSION_BETA = '2.0.2-beta.3';
|
|
24
|
+
const LATEST_VERSION_ALPHA = 'NONE';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canva/intents",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "The Canva Apps SDK Intents library",
|
|
5
5
|
"author": "Canva Pty Ltd.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md FILE",
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@canva/error": "^2.0.0"
|
|
9
9
|
},
|
|
10
|
-
"main": "./lib/cjs/sdk/intents/
|
|
11
|
-
"module": "./lib/esm/sdk/intents/
|
|
10
|
+
"main": "./lib/cjs/sdk/intents/index.js",
|
|
11
|
+
"module": "./lib/esm/sdk/intents/index.js",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"require": "./lib/cjs/sdk/intents/
|
|
16
|
-
"import": "./lib/esm/sdk/intents/
|
|
14
|
+
"types": "./index.d.ts",
|
|
15
|
+
"require": "./lib/cjs/sdk/intents/index.js",
|
|
16
|
+
"import": "./lib/esm/sdk/intents/index.js"
|
|
17
17
|
},
|
|
18
18
|
"./test": {
|
|
19
|
-
"types": "./test/
|
|
20
|
-
"require": "./lib/cjs/sdk/intents/test/
|
|
21
|
-
"import": "./lib/esm/sdk/intents/test/
|
|
19
|
+
"types": "./test/index.d.ts",
|
|
20
|
+
"require": "./lib/cjs/sdk/intents/test/index.js",
|
|
21
|
+
"import": "./lib/esm/sdk/intents/test/index.js"
|
|
22
22
|
},
|
|
23
23
|
"./data": {
|
|
24
|
-
"types": "./data/
|
|
25
|
-
"require": "./lib/cjs/sdk/intents/data/
|
|
26
|
-
"import": "./lib/esm/sdk/intents/data/
|
|
24
|
+
"types": "./data/index.d.ts",
|
|
25
|
+
"require": "./lib/cjs/sdk/intents/data/index.js",
|
|
26
|
+
"import": "./lib/esm/sdk/intents/data/index.js"
|
|
27
27
|
},
|
|
28
28
|
"./design": {
|
|
29
|
-
"types": "./design/
|
|
30
|
-
"require": "./lib/cjs/sdk/intents/design/
|
|
31
|
-
"import": "./lib/esm/sdk/intents/design/
|
|
29
|
+
"types": "./design/index.d.ts",
|
|
30
|
+
"require": "./lib/cjs/sdk/intents/design/index.js",
|
|
31
|
+
"import": "./lib/esm/sdk/intents/design/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./asset": {
|
|
34
|
-
"types": "./asset/
|
|
35
|
-
"require": "./lib/cjs/sdk/intents/asset/
|
|
36
|
-
"import": "./lib/esm/sdk/intents/asset/
|
|
34
|
+
"types": "./asset/index.d.ts",
|
|
35
|
+
"require": "./lib/cjs/sdk/intents/asset/index.js",
|
|
36
|
+
"import": "./lib/esm/sdk/intents/asset/index.js"
|
|
37
37
|
},
|
|
38
38
|
"./content": {
|
|
39
|
-
"types": "./content/
|
|
40
|
-
"require": "./lib/cjs/sdk/intents/content/
|
|
41
|
-
"import": "./lib/esm/sdk/intents/content/
|
|
39
|
+
"types": "./content/index.d.ts",
|
|
40
|
+
"require": "./lib/cjs/sdk/intents/content/index.js",
|
|
41
|
+
"import": "./lib/esm/sdk/intents/content/index.js"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"typings": "./
|
|
45
|
-
}
|
|
44
|
+
"typings": "./index.d.ts"
|
|
45
|
+
}
|
package/test/index.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @public
|
|
3
|
+
* Initializes a test environment for the `@canva/intents` package, enabling unit tests to mock Canva's APIs.
|
|
4
|
+
* @remarks
|
|
5
|
+
* This method should only be called once in a test environment, such as in a Jest setup file.
|
|
6
|
+
* @see
|
|
7
|
+
* https://www.canva.dev/docs/apps/testing/
|
|
8
|
+
*/
|
|
9
|
+
export declare function initTestEnvironment(): void;
|
|
10
|
+
|
|
11
|
+
export { }
|
package/asset/beta.d.ts
DELETED
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @beta
|
|
3
|
-
* Union of all supported asset types.
|
|
4
|
-
*/
|
|
5
|
-
export declare type Asset =
|
|
6
|
-
| ImageAsset
|
|
7
|
-
| VideoAsset
|
|
8
|
-
| AudioAsset
|
|
9
|
-
| DocumentAsset
|
|
10
|
-
| SheetAsset
|
|
11
|
-
| GenericAsset;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @beta
|
|
15
|
-
* Reference to an asset. Used as a unique identifier.
|
|
16
|
-
*/
|
|
17
|
-
export declare type AssetRef = string & {
|
|
18
|
-
__assetRef: never;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @beta
|
|
23
|
-
* Audio asset result structure.
|
|
24
|
-
*/
|
|
25
|
-
export declare type AudioAsset = BaseAsset & {
|
|
26
|
-
type: "audio";
|
|
27
|
-
mimeType:
|
|
28
|
-
| "audio/mpeg"
|
|
29
|
-
| "audio/mp4"
|
|
30
|
-
| "audio/x-m4a"
|
|
31
|
-
| "audio/mp3"
|
|
32
|
-
| "audio/ogg"
|
|
33
|
-
| "audio/wav"
|
|
34
|
-
| "audio/x-wav"
|
|
35
|
-
| "audio/x-pn-wav"
|
|
36
|
-
| "audio/wave"
|
|
37
|
-
| "audio/vnd.wave"
|
|
38
|
-
| "audio/webm";
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @beta
|
|
43
|
-
* Base structure for an asset result.
|
|
44
|
-
*/
|
|
45
|
-
export declare type BaseAsset = {
|
|
46
|
-
name: string;
|
|
47
|
-
url: string;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @beta
|
|
52
|
-
* Document asset result structure.
|
|
53
|
-
*/
|
|
54
|
-
export declare type DocumentAsset = BaseAsset & {
|
|
55
|
-
type: "document";
|
|
56
|
-
parentRef?: AssetRef;
|
|
57
|
-
mimeType: DocumentMimeType;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @beta
|
|
62
|
-
* Supported mimetype for document assets.
|
|
63
|
-
*/
|
|
64
|
-
export declare type DocumentMimeType =
|
|
65
|
-
| "application/pdf"
|
|
66
|
-
| "application/msword"
|
|
67
|
-
| "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
68
|
-
| "text/plain"
|
|
69
|
-
| "text/markdown";
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @beta
|
|
73
|
-
* Request parameters for URL expansion.
|
|
74
|
-
*/
|
|
75
|
-
export declare type ExpandUrlRequest = {
|
|
76
|
-
url: string;
|
|
77
|
-
requestConnection: () => Promise<void>;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* @beta
|
|
82
|
-
* Response from URL expansion operation.
|
|
83
|
-
*/
|
|
84
|
-
export declare type ExpandUrlResponse =
|
|
85
|
-
| {
|
|
86
|
-
status: "completed";
|
|
87
|
-
result: ExpandUrlResult;
|
|
88
|
-
}
|
|
89
|
-
| {
|
|
90
|
-
status: "not_found";
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* @beta
|
|
95
|
-
* Result of completed URL expansion.
|
|
96
|
-
*/
|
|
97
|
-
export declare type ExpandUrlResult = {
|
|
98
|
-
ref: UrlExpanderAssetRef;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @beta
|
|
103
|
-
* Generic asset result structure.
|
|
104
|
-
* A generic asset is any file that is not already covered by other asset types such as ImageAsset etc.
|
|
105
|
-
* It is an error to pass a mime type that is covered by another asset type.
|
|
106
|
-
*/
|
|
107
|
-
export declare type GenericAsset = BaseAsset & {
|
|
108
|
-
type: "generic";
|
|
109
|
-
mimeType: string;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @beta
|
|
114
|
-
* Completed response from content retrieval operation.
|
|
115
|
-
*/
|
|
116
|
-
export declare type GetContentCompletedResponse = {
|
|
117
|
-
status: "completed";
|
|
118
|
-
result: {
|
|
119
|
-
type: "asset";
|
|
120
|
-
asset: Asset;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @beta
|
|
126
|
-
* Error response from content retrieval operation.
|
|
127
|
-
*/
|
|
128
|
-
export declare type GetContentErrorResponse = {
|
|
129
|
-
status: "app_error";
|
|
130
|
-
message: string;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @beta
|
|
135
|
-
* Request parameters for content retrieval.
|
|
136
|
-
*/
|
|
137
|
-
export declare type GetContentRequest = {
|
|
138
|
-
ref: UrlExpanderAssetRef;
|
|
139
|
-
requestConnection: () => Promise<void>;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @beta
|
|
144
|
-
* Response from content retrieval operation.
|
|
145
|
-
*/
|
|
146
|
-
export declare type GetContentResponse =
|
|
147
|
-
| GetContentCompletedResponse
|
|
148
|
-
| GetContentErrorResponse;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @beta
|
|
152
|
-
* Image asset result structure.
|
|
153
|
-
*/
|
|
154
|
-
export declare type ImageAsset = BaseAsset & {
|
|
155
|
-
type: "image";
|
|
156
|
-
thumbnailUrl: string;
|
|
157
|
-
parentRef?: AssetRef;
|
|
158
|
-
mimeType:
|
|
159
|
-
| "image/heic"
|
|
160
|
-
| "image/jpeg"
|
|
161
|
-
| "image/png"
|
|
162
|
-
| "image/svg+xml"
|
|
163
|
-
| "image/tiff"
|
|
164
|
-
| "image/webp";
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* @beta
|
|
169
|
-
*
|
|
170
|
-
* Prepares the `UrlExpanderIntent`.
|
|
171
|
-
*/
|
|
172
|
-
export declare const prepareUrlExpander: (
|
|
173
|
-
implementation: UrlExpanderIntent,
|
|
174
|
-
) => void;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* @beta
|
|
178
|
-
* Sheet asset result structure.
|
|
179
|
-
*/
|
|
180
|
-
export declare type SheetAsset = BaseAsset & {
|
|
181
|
-
type: "sheet";
|
|
182
|
-
parentRef?: AssetRef;
|
|
183
|
-
mimeType: SheetMimeType;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* @beta
|
|
188
|
-
* Supported mimetype for sheet assets.
|
|
189
|
-
*/
|
|
190
|
-
export declare type SheetMimeType =
|
|
191
|
-
| "text/csv"
|
|
192
|
-
| "application/vnd.ms-excel"
|
|
193
|
-
| "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* @beta
|
|
197
|
-
* Reference to an asset with metadata.
|
|
198
|
-
*/
|
|
199
|
-
export declare type UrlExpanderAssetRef = {
|
|
200
|
-
type: "asset";
|
|
201
|
-
id: string;
|
|
202
|
-
name: string;
|
|
203
|
-
iconUrl?: string;
|
|
204
|
-
description?: string;
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* @beta
|
|
209
|
-
* Intent interface for URL expansion and content retrieval operations.
|
|
210
|
-
*/
|
|
211
|
-
export declare type UrlExpanderIntent = {
|
|
212
|
-
expandUrl(request: ExpandUrlRequest): Promise<ExpandUrlResponse>;
|
|
213
|
-
getContent(request: GetContentRequest): Promise<GetContentResponse>;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @beta
|
|
218
|
-
* Video asset result structure.
|
|
219
|
-
*/
|
|
220
|
-
export declare type VideoAsset = BaseAsset & {
|
|
221
|
-
type: "video";
|
|
222
|
-
thumbnailImageUrl: string;
|
|
223
|
-
parentRef?: AssetRef;
|
|
224
|
-
mimeType:
|
|
225
|
-
| "video/avi"
|
|
226
|
-
| "video/x-msvideo"
|
|
227
|
-
| "image/gif"
|
|
228
|
-
| "video/x-m4v"
|
|
229
|
-
| "video/x-matroska"
|
|
230
|
-
| "video/quicktime"
|
|
231
|
-
| "video/mp4"
|
|
232
|
-
| "video/mpeg"
|
|
233
|
-
| "video/webm";
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
export {};
|