@canva/design 2.7.6-beta.2 → 2.8.1-alpha.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
@@ -1 +1 @@
1
- export * from "./beta";
1
+ export * from "./alpha";
@@ -9,17 +9,17 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- get editContent () {
13
- return editContent;
12
+ get getBrandTemplateMetadata () {
13
+ return getBrandTemplateMetadata;
14
14
  },
15
- get getDesignMetadata () {
16
- return getDesignMetadata;
15
+ get initAppElement () {
16
+ return initAppElement;
17
17
  },
18
- get getDesignTemplateMetadata () {
19
- return getDesignTemplateMetadata;
18
+ get requestAutofillDesign () {
19
+ return requestAutofillDesign;
20
20
  },
21
- get openDesign () {
22
- return openDesign;
21
+ get requestBrandTemplates () {
22
+ return requestBrandTemplates;
23
23
  }
24
24
  });
25
25
  const _version = require("./version");
@@ -37,11 +37,8 @@ function _export_star(from, to) {
37
37
  });
38
38
  return from;
39
39
  }
40
- const { canva_sdk } = window;
41
- const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadata;
42
- function editContent(options, callback) {
43
- return canva_sdk.design.v2.designInteraction.editContent(options, (session)=>callback(session));
44
- }
45
- const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
46
- const getDesignTemplateMetadata = canva_sdk.design.v2.designInteraction.getDesignTemplateMetadata;
47
- window.__canva__?.sdkRegistration?.registerPackageVersion('design', _version.LATEST_VERSION_BETA, 'beta');
40
+ const initAppElement = canva_sdk.design.v2.designInteraction.initAppElement;
41
+ const requestAutofillDesign = canva_sdk.design.v2.autofill.requestAutofillDesign;
42
+ const requestBrandTemplates = canva_sdk.design.v2.designInteraction.requestBrandTemplates;
43
+ const getBrandTemplateMetadata = canva_sdk.design.v2.designInteraction.getBrandTemplateMetadata;
44
+ window.__canva__?.sdkRegistration?.registerPackageVersion('design', _version.LATEST_VERSION_ALPHA, 'alpha');
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "createBetaFakeDesignClients", {
9
9
  }
10
10
  });
11
11
  const _synthetic_delay = require('../../utils/synthetic_delay');
12
+ const _fake_autofill_client = require("./fake_autofill_client");
12
13
  const _fake_design_interaction_client = require("./fake_design_interaction_client");
13
14
  const _fake_drag_and_drop_client = require("./fake_drag_and_drop_client");
14
15
  const _fake_export_client = require("./fake_export_client");
@@ -17,7 +18,8 @@ function createBetaFakeDesignClients() {
17
18
  const v2 = {
18
19
  designInteraction: new FakeBetaDesignInteractionClient(syntheticDelay),
19
20
  dragAndDrop: new _fake_drag_and_drop_client.FakeDragAndDropClient(syntheticDelay),
20
- export: new _fake_export_client.FakeExportClient(syntheticDelay)
21
+ export: new _fake_export_client.FakeExportClient(syntheticDelay),
22
+ autofill: new _fake_autofill_client.FakeAutofillClient(syntheticDelay)
21
23
  };
22
24
  return {
23
25
  design: {
@@ -0,0 +1,21 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "FakeAutofillClient", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return FakeAutofillClient;
9
+ }
10
+ });
11
+ class FakeAutofillClient {
12
+ async requestAutofillDesign(opts) {
13
+ await this.delay();
14
+ return {
15
+ status: 'success'
16
+ };
17
+ }
18
+ constructor(delay){
19
+ this.delay = delay;
20
+ }
21
+ }
@@ -26,6 +26,28 @@ class FakeDesignInteractionClient {
26
26
  token: 'token'
27
27
  };
28
28
  }
29
+ async requestBrandTemplates() {
30
+ await this.delay();
31
+ return {
32
+ status: 'completed',
33
+ brandTemplates: [
34
+ {
35
+ token: 'token'
36
+ }
37
+ ]
38
+ };
39
+ }
40
+ async getBrandTemplateMetadata(id) {
41
+ await this.delay();
42
+ return {
43
+ domain: 'brand',
44
+ keywords: [
45
+ 'word1',
46
+ 'word2'
47
+ ],
48
+ dataset: undefined
49
+ };
50
+ }
29
51
  async getDesignMetadata() {
30
52
  await this.delay();
31
53
  return {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./beta"), exports);
5
+ _export_star(require("./alpha"), exports);
6
6
  function _export_star(from, to) {
7
7
  Object.keys(from).forEach(function(k) {
8
8
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -70,7 +70,6 @@ _export(exports, {
70
70
  return ui;
71
71
  }
72
72
  });
73
- const { canva_sdk } = window;
74
73
  const selection = canva_sdk.design.v2.designInteraction.selection;
75
74
  const overlay = canva_sdk.design.v2.designInteraction.overlay;
76
75
  const addPage = canva_sdk.design.v2.designInteraction.addPage;
@@ -0,0 +1,18 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
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
+ }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./beta"), exports);
5
+ _export_star(require("./alpha"), exports);
6
6
  function _export_star(from, to) {
7
7
  Object.keys(from).forEach(function(k) {
8
8
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -19,6 +19,6 @@ _export(exports, {
19
19
  return LATEST_VERSION_BETA;
20
20
  }
21
21
  });
22
- const LATEST_VERSION = '2.7.5';
22
+ const LATEST_VERSION = '2.8.0';
23
23
  const LATEST_VERSION_BETA = '2.7.6-beta.2';
24
- const LATEST_VERSION_ALPHA = 'NONE';
24
+ const LATEST_VERSION_ALPHA = '2.8.1-alpha.0';
@@ -0,0 +1,7 @@
1
+ import { LATEST_VERSION_ALPHA } from './version';
2
+ export const initAppElement = canva_sdk.design.v2.designInteraction.initAppElement;
3
+ export const requestAutofillDesign = canva_sdk.design.v2.autofill.requestAutofillDesign;
4
+ export const requestBrandTemplates = canva_sdk.design.v2.designInteraction.requestBrandTemplates;
5
+ export const getBrandTemplateMetadata = canva_sdk.design.v2.designInteraction.getBrandTemplateMetadata;
6
+ export * from './public';
7
+ window.__canva__?.sdkRegistration?.registerPackageVersion('design', LATEST_VERSION_ALPHA, 'alpha');
@@ -1,4 +1,5 @@
1
1
  import { createSyntheticDelay } from '../../utils/synthetic_delay';
2
+ import { FakeAutofillClient } from './fake_autofill_client';
2
3
  import { FakeDesignInteractionClient, fakeOpenDesignHelpers, fakePage } from './fake_design_interaction_client';
3
4
  import { FakeDragAndDropClient } from './fake_drag_and_drop_client';
4
5
  import { FakeExportClient } from './fake_export_client';
@@ -7,7 +8,8 @@ export function createBetaFakeDesignClients() {
7
8
  const v2 = {
8
9
  designInteraction: new FakeBetaDesignInteractionClient(syntheticDelay),
9
10
  dragAndDrop: new FakeDragAndDropClient(syntheticDelay),
10
- export: new FakeExportClient(syntheticDelay)
11
+ export: new FakeExportClient(syntheticDelay),
12
+ autofill: new FakeAutofillClient(syntheticDelay)
11
13
  };
12
14
  return {
13
15
  design: {
@@ -0,0 +1,11 @@
1
+ export class FakeAutofillClient {
2
+ async requestAutofillDesign(opts) {
3
+ await this.delay();
4
+ return {
5
+ status: 'success'
6
+ };
7
+ }
8
+ constructor(delay){
9
+ this.delay = delay;
10
+ }
11
+ }
@@ -5,6 +5,28 @@ export class FakeDesignInteractionClient {
5
5
  token: 'token'
6
6
  };
7
7
  }
8
+ async requestBrandTemplates() {
9
+ await this.delay();
10
+ return {
11
+ status: 'completed',
12
+ brandTemplates: [
13
+ {
14
+ token: 'token'
15
+ }
16
+ ]
17
+ };
18
+ }
19
+ async getBrandTemplateMetadata(id) {
20
+ await this.delay();
21
+ return {
22
+ domain: 'brand',
23
+ keywords: [
24
+ 'word1',
25
+ 'word2'
26
+ ],
27
+ dataset: undefined
28
+ };
29
+ }
8
30
  async getDesignMetadata() {
9
31
  await this.delay();
10
32
  return {
@@ -1 +1 @@
1
- export * from './beta';
1
+ export * from './alpha';
@@ -1,4 +1,3 @@
1
- const { canva_sdk } = window;
2
1
  export const selection = canva_sdk.design.v2.designInteraction.selection;
3
2
  export const overlay = canva_sdk.design.v2.designInteraction.overlay;
4
3
  export const addPage = canva_sdk.design.v2.designInteraction.addPage;
@@ -0,0 +1 @@
1
+ export * from './beta';
@@ -1 +1 @@
1
- export * from './beta';
1
+ export * from './alpha';
@@ -1,3 +1,3 @@
1
- export const LATEST_VERSION = '2.7.5';
1
+ export const LATEST_VERSION = '2.8.0';
2
2
  export const LATEST_VERSION_BETA = '2.7.6-beta.2';
3
- export const LATEST_VERSION_ALPHA = 'NONE';
3
+ export const LATEST_VERSION_ALPHA = '2.8.1-alpha.0';
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "2.7.6-beta.2",
3
+ "version": "2.8.1-alpha.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",
7
7
  "peerDependencies": {
8
8
  "@canva/error": "^2.0.0"
9
9
  },
10
- "main": "./lib/cjs/sdk/design/beta.js",
11
- "module": "./lib/esm/sdk/design/beta.js",
10
+ "main": "./lib/cjs/sdk/design/alpha.js",
11
+ "module": "./lib/esm/sdk/design/alpha.js",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./beta.d.ts",
15
- "require": "./lib/cjs/sdk/design/beta.js",
16
- "import": "./lib/esm/sdk/design/beta.js"
14
+ "types": "./alpha.d.ts",
15
+ "require": "./lib/cjs/sdk/design/alpha.js",
16
+ "import": "./lib/esm/sdk/design/alpha.js"
17
17
  },
18
18
  "./test": {
19
- "types": "./test/beta.d.ts",
20
- "require": "./lib/cjs/sdk/design/test/beta.js",
21
- "import": "./lib/esm/sdk/design/test/beta.js"
19
+ "types": "./test/alpha.d.ts",
20
+ "require": "./lib/cjs/sdk/design/test/alpha.js",
21
+ "import": "./lib/esm/sdk/design/test/alpha.js"
22
22
  }
23
23
  },
24
- "typings": "./beta.d.ts"
24
+ "typings": "./alpha.d.ts"
25
25
  }
package/test/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./beta";
1
+ export * from "./alpha";
@@ -1,10 +0,0 @@
1
- import { LATEST_VERSION_BETA } from './version';
2
- const { canva_sdk } = window;
3
- export const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadata;
4
- export function editContent(options, callback) {
5
- return canva_sdk.design.v2.designInteraction.editContent(options, (session)=>callback(session));
6
- }
7
- export const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
8
- export const getDesignTemplateMetadata = canva_sdk.design.v2.designInteraction.getDesignTemplateMetadata;
9
- export * from './public';
10
- window.__canva__?.sdkRegistration?.registerPackageVersion('design', LATEST_VERSION_BETA, 'beta');
File without changes