@canva/design 1.5.0 → 1.7.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/index.d.ts CHANGED
@@ -97,10 +97,7 @@ export declare type AppElementRenderer<A extends AppElementData> = (
97
97
  * A return value of {@link AppElementRenderer} function.
98
98
  * It is an array of elements to render within an app element.
99
99
  */
100
- export declare type AppElementRendererOutput = Exclude<
101
- NativeSimpleElementWithBox,
102
- NativeVideoElementWithBox
103
- >[];
100
+ export declare type AppElementRendererOutput = NativeSimpleElementWithBox[];
104
101
 
105
102
  /**
106
103
  * @public
@@ -231,6 +228,14 @@ export declare type DesignSelection = {
231
228
  }): () => void;
232
229
  };
233
230
 
231
+ /**
232
+ * @public
233
+ * JWT that contains the Design ID and App ID.
234
+ */
235
+ export declare type DesignToken = {
236
+ token: string;
237
+ };
238
+
234
239
  /**
235
240
  * @public
236
241
  * Represents a width and a height.
@@ -494,6 +499,14 @@ export declare type Fill = {
494
499
  asset?: ImageFill | VideoFill;
495
500
  };
496
501
 
502
+ /**
503
+ * @public
504
+ * A reference to a font that can be used in other parts of the SDK.
505
+ */
506
+ export declare type FontRef = string & {
507
+ __fontRef: never;
508
+ };
509
+
497
510
  /**
498
511
  * @public
499
512
  * Font weights supported in the SDK.
@@ -529,6 +542,12 @@ export declare function getDefaultPageDimensions(): Promise<
529
542
  Dimensions | undefined
530
543
  >;
531
544
 
545
+ /**
546
+ * @public
547
+ * Retrieves a signed JWT that contains the Design ID, App ID and User ID.
548
+ */
549
+ export declare function getDesignToken(): Promise<DesignToken>;
550
+
532
551
  declare type Height = {
533
552
  width: "auto";
534
553
  height: number;
@@ -1186,7 +1205,11 @@ export declare type TextAttributes = {
1186
1205
  * (e.g. #ff0099). The default value is #000000.
1187
1206
  */
1188
1207
  color?: string;
1189
-
1208
+ /**
1209
+ * @public
1210
+ * A reference to the font to use for this text element.
1211
+ */
1212
+ fontRef?: FontRef;
1190
1213
  /**
1191
1214
  * The weight of the font.
1192
1215
  * @defaultValue 'normal'
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initAppElement = exports.getCurrentPageContext = exports.addAudioTrack = exports.addNativeElement = exports.ui = exports.requestExport = exports.getDefaultPageDimensions = exports.setCurrentPageBackground = exports.addPage = exports.selection = void 0;
3
+ exports.getDesignToken = exports.initAppElement = exports.getCurrentPageContext = exports.addAudioTrack = exports.addNativeElement = exports.ui = exports.requestExport = exports.getDefaultPageDimensions = exports.setCurrentPageBackground = exports.addPage = exports.selection = void 0;
4
4
  const { canva } = window;
5
5
  /**
6
6
  * @public
@@ -87,3 +87,11 @@ function initAppElement(appElementConfig) {
87
87
  return canva.designInteraction.initAppElement(appElementConfig);
88
88
  }
89
89
  exports.initAppElement = initAppElement;
90
+ /**
91
+ * @public
92
+ * Retrieves a signed JWT that contains the Design ID, App ID and User ID.
93
+ */
94
+ function getDesignToken() {
95
+ return canva.designInteraction.getDesignToken();
96
+ }
97
+ exports.getDesignToken = getDesignToken;
@@ -76,3 +76,10 @@ export function getCurrentPageContext() {
76
76
  export function initAppElement(appElementConfig) {
77
77
  return canva.designInteraction.initAppElement(appElementConfig);
78
78
  }
79
+ /**
80
+ * @public
81
+ * Retrieves a signed JWT that contains the Design ID, App ID and User ID.
82
+ */
83
+ export function getDesignToken() {
84
+ return canva.designInteraction.getDesignToken();
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "The Canva Apps SDK design library",
5
5
  "author": "Canva Pty Ltd.",
6
6
  "license": "SEE LICENSE IN LICENSE.md FILE",