@canva/design 2.4.1-beta.1 → 2.4.1-beta.2

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/beta.d.ts CHANGED
@@ -1121,6 +1121,40 @@ export declare type DesignElement =
1121
1121
  | RichtextElement
1122
1122
  | TableElement;
1123
1123
 
1124
+ /**
1125
+ * @beta
1126
+ * Information about the design.
1127
+ */
1128
+ export declare type DesignMetadata = {
1129
+ /**
1130
+ * The title of the user's design.
1131
+ * @remarks
1132
+ * This is optional and will be `undefined` if the user hasn't set a title.
1133
+ */
1134
+ title?: string;
1135
+ /**
1136
+ * The default dimensions that a new page will have when it is added to a design.
1137
+ * It is possible for a user to resize a page without resizing the entire design, e.g. by clicking
1138
+ * "Expand to Whiteboard". However, there will always be a single set of default dimensions for a
1139
+ * design that is applied whenever a new page is created.
1140
+ * @remarks
1141
+ * This is optional and will be `undefined` if the design is unbounded (e.g. Whiteboard or Doc).
1142
+ */
1143
+ defaultPageDimensions?: PageDimensions;
1144
+ /**
1145
+ * The information associated with each page of the design.
1146
+ * @remarks
1147
+ * The order of pages is not guaranteed.
1148
+ */
1149
+ pageMetadata: Iterable<PageContext>;
1150
+ /**
1151
+ * The duration of the whole design in seconds.
1152
+ * @remarks
1153
+ * This is the precise value, which differs from what is displayed in the UI as duration in Canva UI is formatted differently.
1154
+ */
1155
+ durationInSeconds: number;
1156
+ };
1157
+
1124
1158
  /**
1125
1159
  * @beta
1126
1160
  * A callback for reading and updating part of a design.
@@ -1543,6 +1577,12 @@ export declare const getDefaultPageDimensions: () => Promise<
1543
1577
  Dimensions | undefined
1544
1578
  >;
1545
1579
 
1580
+ /**
1581
+ * @beta
1582
+ * Retrieves information about the design.
1583
+ */
1584
+ export declare const getDesignMetadata: () => Promise<DesignMetadata>;
1585
+
1546
1586
  /**
1547
1587
  * @public
1548
1588
  * Retrieves a signed JWT that contains the Design ID, App ID and User ID.
@@ -2,9 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "openDesign", {
6
- enumerable: true,
7
- get: function() {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getDesignMetadata: function() {
13
+ return getDesignMetadata;
14
+ },
15
+ openDesign: function() {
8
16
  return openDesign;
9
17
  }
10
18
  });
@@ -25,4 +33,5 @@ function _export_star(from, to) {
25
33
  var _window___canva___sdkRegistration, _window___canva__;
26
34
  const { canva_sdk } = window;
27
35
  const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
28
- (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.4.0', 'beta');
36
+ const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadata;
37
+ (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.5.0', 'beta');
@@ -9,12 +9,44 @@ Object.defineProperty(exports, "FakeDesignInteractionClient", {
9
9
  }
10
10
  });
11
11
  class FakeDesignInteractionClient {
12
+ async getDesignTitle() {
13
+ await this.delay();
14
+ return 'title';
15
+ }
12
16
  async getDesignToken() {
13
17
  await this.delay();
14
18
  return {
15
19
  token: 'token'
16
20
  };
17
21
  }
22
+ async getDesignMetadata() {
23
+ await this.delay();
24
+ return {
25
+ title: 'title',
26
+ defaultPageDimensions: {
27
+ width: 800,
28
+ height: 600
29
+ },
30
+ pageMetadata: [
31
+ {
32
+ dimensions: {
33
+ width: 800,
34
+ height: 600
35
+ }
36
+ },
37
+ {
38
+ dimensions: {
39
+ width: 300,
40
+ height: 900
41
+ }
42
+ },
43
+ {
44
+ dimensions: undefined
45
+ }
46
+ ],
47
+ durationInSeconds: 30
48
+ };
49
+ }
18
50
  async addNativeElement(element) {
19
51
  await this.delay();
20
52
  }
@@ -90,6 +122,9 @@ class FakeDesignInteractionClient {
90
122
  elementBuilder: fakeElementBuilder
91
123
  });
92
124
  }
125
+ async openDesign2(options, callback) {
126
+ throw new Error('Not yet implemented');
127
+ }
93
128
  constructor(delay){
94
129
  this.delay = delay;
95
130
  this.selection = {
@@ -1,5 +1,6 @@
1
1
  var _window___canva___sdkRegistration, _window___canva__;
2
2
  const { canva_sdk } = window;
3
3
  export const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
4
+ export const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadata;
4
5
  export * from './public';
5
- (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.4.0', 'beta');
6
+ (_window___canva__ = window.__canva__) === null || _window___canva__ === void 0 ? void 0 : (_window___canva___sdkRegistration = _window___canva__.sdkRegistration) === null || _window___canva___sdkRegistration === void 0 ? void 0 : _window___canva___sdkRegistration.registerPackageVersion('design', '2.5.0', 'beta');
@@ -1,10 +1,42 @@
1
1
  export class FakeDesignInteractionClient {
2
+ async getDesignTitle() {
3
+ await this.delay();
4
+ return 'title';
5
+ }
2
6
  async getDesignToken() {
3
7
  await this.delay();
4
8
  return {
5
9
  token: 'token'
6
10
  };
7
11
  }
12
+ async getDesignMetadata() {
13
+ await this.delay();
14
+ return {
15
+ title: 'title',
16
+ defaultPageDimensions: {
17
+ width: 800,
18
+ height: 600
19
+ },
20
+ pageMetadata: [
21
+ {
22
+ dimensions: {
23
+ width: 800,
24
+ height: 600
25
+ }
26
+ },
27
+ {
28
+ dimensions: {
29
+ width: 300,
30
+ height: 900
31
+ }
32
+ },
33
+ {
34
+ dimensions: undefined
35
+ }
36
+ ],
37
+ durationInSeconds: 30
38
+ };
39
+ }
8
40
  async addNativeElement(element) {
9
41
  await this.delay();
10
42
  }
@@ -80,6 +112,9 @@ export class FakeDesignInteractionClient {
80
112
  elementBuilder: fakeElementBuilder
81
113
  });
82
114
  }
115
+ async openDesign2(options, callback) {
116
+ throw new Error('Not yet implemented');
117
+ }
83
118
  constructor(delay){
84
119
  this.delay = delay;
85
120
  this.selection = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "2.4.1-beta.1",
3
+ "version": "2.4.1-beta.2",
4
4
  "description": "The Canva Apps SDK design library",
5
5
  "author": "Canva Pty Ltd.",
6
6
  "license": "SEE LICENSE IN LICENSE.md FILE",