@canva/cli 0.0.1-beta.35 → 0.0.1-beta.37
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/cli.js +612 -612
- package/lib/cjs/index.cjs +3 -3
- package/lib/esm/index.mjs +4 -4
- package/package.json +1 -1
- package/templates/base/backend/routers/auth.ts +4 -4
- package/templates/base/backend/routers/oauth.ts +2 -2
- package/templates/base/scripts/ssl/ssl.ts +1 -1
- package/templates/base/scripts/start/app_runner.ts +6 -6
- package/templates/base/scripts/start/start.ts +1 -1
- package/templates/base/utils/backend/base_backend/create.ts +3 -3
- package/templates/base/utils/backend/bearer_middleware/bearer_middleware.ts +1 -1
- package/templates/base/utils/backend/jwt_middleware/jwt_middleware.ts +3 -3
- package/templates/base/utils/use_add_element.ts +1 -1
- package/templates/base/utils/use_feature_support.ts +1 -1
- package/templates/base/webpack.config.ts +1 -1
- package/templates/common/utils/backend/base_backend/create.ts +3 -3
- package/templates/common/utils/backend/jwt_middleware/jwt_middleware.ts +3 -3
- package/templates/common/utils/tests/table_wrapper.tests.ts +1 -1
- package/templates/common/utils/use_add_element.ts +1 -1
- package/templates/common/utils/use_feature_support.ts +1 -1
- package/templates/dam/backend/routers/dam.ts +2 -2
- package/templates/dam/backend/server.ts +1 -1
- package/templates/dam/scripts/ssl/ssl.ts +1 -1
- package/templates/dam/scripts/start/app_runner.ts +6 -6
- package/templates/dam/scripts/start/start.ts +1 -1
- package/templates/dam/src/app.tsx +1 -1
- package/templates/dam/src/index.tsx +1 -1
- package/templates/dam/utils/backend/base_backend/create.ts +3 -3
- package/templates/dam/utils/backend/jwt_middleware/jwt_middleware.ts +3 -3
- package/templates/dam/webpack.config.ts +1 -1
- package/templates/data_connector/scripts/ssl/ssl.ts +1 -1
- package/templates/data_connector/scripts/start/app_runner.ts +6 -6
- package/templates/data_connector/scripts/start/start.ts +1 -1
- package/templates/data_connector/src/api/data_source.ts +1 -1
- package/templates/data_connector/src/api/data_sources/designs.tsx +9 -9
- package/templates/data_connector/src/api/data_sources/templates.tsx +9 -9
- package/templates/data_connector/src/api/fetch_data_table.ts +1 -1
- package/templates/data_connector/src/api/tests/data_source.test.tsx +2 -2
- package/templates/data_connector/src/app.tsx +5 -5
- package/templates/data_connector/src/components/footer.tsx +1 -1
- package/templates/data_connector/src/components/header.tsx +1 -1
- package/templates/data_connector/src/context/app_context.tsx +1 -1
- package/templates/data_connector/src/entrypoint.tsx +7 -7
- package/templates/data_connector/src/home.tsx +2 -2
- package/templates/data_connector/src/index.tsx +5 -6
- package/templates/data_connector/src/pages/error.tsx +2 -2
- package/templates/data_connector/src/pages/login.tsx +7 -7
- package/templates/data_connector/src/routes/routes.tsx +1 -1
- package/templates/data_connector/src/utils/data_table.ts +1 -1
- package/templates/data_connector/src/utils/fetch_result.ts +1 -1
- package/templates/data_connector/src/utils/tests/data_table.test.ts +5 -5
- package/templates/data_connector/webpack.config.ts +1 -1
- package/templates/gen_ai/backend/server.ts +1 -1
- package/templates/gen_ai/scripts/ssl/ssl.ts +1 -1
- package/templates/gen_ai/scripts/start/app_runner.ts +6 -6
- package/templates/gen_ai/scripts/start/start.ts +1 -1
- package/templates/gen_ai/src/app.tsx +3 -3
- package/templates/gen_ai/src/components/footer.tsx +4 -4
- package/templates/gen_ai/src/components/image_grid.tsx +1 -1
- package/templates/gen_ai/src/components/loading_results.tsx +8 -8
- package/templates/gen_ai/src/components/prompt_input.tsx +3 -3
- package/templates/gen_ai/src/components/remaining_credits.tsx +1 -1
- package/templates/gen_ai/src/components/report_box.tsx +1 -1
- package/templates/gen_ai/src/components/tests/remaining_credit.tests.tsx +2 -2
- package/templates/gen_ai/src/home.tsx +2 -2
- package/templates/gen_ai/src/pages/error.tsx +2 -2
- package/templates/gen_ai/src/pages/results.tsx +1 -1
- package/templates/gen_ai/utils/backend/base_backend/create.ts +3 -3
- package/templates/gen_ai/utils/backend/bearer_middleware/bearer_middleware.ts +1 -1
- package/templates/gen_ai/webpack.config.ts +1 -1
- package/templates/hello_world/scripts/ssl/ssl.ts +1 -1
- package/templates/hello_world/scripts/start/app_runner.ts +6 -6
- package/templates/hello_world/scripts/start/start.ts +1 -1
- package/templates/hello_world/src/app.tsx +1 -1
- package/templates/hello_world/src/index.tsx +1 -1
- package/templates/hello_world/src/tests/app.tests.tsx +3 -3
- package/templates/hello_world/utils/use_add_element.ts +1 -1
- package/templates/hello_world/utils/use_feature_support.ts +1 -1
- package/templates/hello_world/webpack.config.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
2
3
|
import { pki } from "node-forge";
|
|
3
4
|
import * as path from "path";
|
|
4
|
-
import * as fs from "fs/promises";
|
|
5
5
|
|
|
6
6
|
const SSL_CERT_DIR = path.resolve(process.cwd(), "..", "..", ".ssl");
|
|
7
7
|
const CERT_FILE = path.resolve(SSL_CERT_DIR, "certificate.pem");
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import
|
|
3
|
-
import * as chalk from "chalk";
|
|
4
|
-
import { buildConfig } from "../../webpack.config";
|
|
2
|
+
import { generatePreviewUrl } from "@canva/cli";
|
|
5
3
|
import * as ngrok from "@ngrok/ngrok";
|
|
6
|
-
import * as
|
|
4
|
+
import * as chalk from "chalk";
|
|
7
5
|
import * as Table from "cli-table3";
|
|
6
|
+
import * as nodemon from "nodemon";
|
|
7
|
+
import * as open from "open";
|
|
8
8
|
import * as webpack from "webpack";
|
|
9
9
|
import * as WebpackDevServer from "webpack-dev-server";
|
|
10
|
-
import
|
|
11
|
-
import { generatePreviewUrl } from "@canva/cli";
|
|
10
|
+
import { buildConfig } from "../../webpack.config";
|
|
12
11
|
import type { Certificate } from "../ssl/ssl";
|
|
13
12
|
import { createOrRetrieveCertificate } from "../ssl/ssl";
|
|
13
|
+
import type { Context } from "./context";
|
|
14
14
|
|
|
15
15
|
export const infoChalk = chalk.blue.bold;
|
|
16
16
|
export const warnChalk = chalk.bgYellow.bold;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SearchableListView } from "@canva/app-components";
|
|
2
2
|
import { Box } from "@canva/app-ui-kit";
|
|
3
3
|
import "@canva/app-ui-kit/styles.css";
|
|
4
|
-
import { useConfig } from "./config";
|
|
5
4
|
import { findResources } from "./adapter";
|
|
5
|
+
import { useConfig } from "./config";
|
|
6
6
|
import * as styles from "./index.css";
|
|
7
7
|
|
|
8
8
|
export function App() {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { AppI18nProvider } from "@canva/app-i18n-kit";
|
|
1
2
|
import { AppUiProvider } from "@canva/app-ui-kit";
|
|
2
3
|
import { createRoot } from "react-dom/client";
|
|
3
4
|
import { App } from "./app";
|
|
4
5
|
import "@canva/app-ui-kit/styles.css";
|
|
5
|
-
import { AppI18nProvider } from "@canva/app-i18n-kit";
|
|
6
6
|
|
|
7
7
|
const root = createRoot(document.getElementById("root") as Element);
|
|
8
8
|
function render() {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
import debug from "debug";
|
|
2
3
|
import * as express from "express";
|
|
4
|
+
import type { NextFunction, Request, Response } from "express";
|
|
5
|
+
import * as fs from "fs";
|
|
3
6
|
import * as http from "http";
|
|
4
7
|
import * as https from "https";
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import type { Request, Response, NextFunction } from "express";
|
|
7
|
-
import debug from "debug";
|
|
8
8
|
|
|
9
9
|
const serverDebug = debug("server");
|
|
10
10
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import * as chalk from "chalk";
|
|
3
3
|
import * as debug from "debug";
|
|
4
|
-
import type { Request, Response
|
|
5
|
-
import * as jwt from "jsonwebtoken";
|
|
6
|
-
import { JwksClient, SigningKeyNotFoundError } from "jwks-rsa";
|
|
4
|
+
import type { NextFunction, Request, Response } from "express";
|
|
7
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
6
|
import Express from "express-serve-static-core";
|
|
7
|
+
import * as jwt from "jsonwebtoken";
|
|
8
|
+
import { JwksClient, SigningKeyNotFoundError } from "jwks-rsa";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Prefix your start command with `DEBUG=express:middleware:jwt` to enable debug logging
|
|
@@ -182,7 +182,7 @@ export function buildConfig({
|
|
|
182
182
|
new DefinePlugin({
|
|
183
183
|
BACKEND_HOST: JSON.stringify(backendHost),
|
|
184
184
|
}),
|
|
185
|
-
// Apps can only submit a single JS file via the
|
|
185
|
+
// Apps can only submit a single JS file via the Developer Portal
|
|
186
186
|
new optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
|
|
187
187
|
].filter(Boolean),
|
|
188
188
|
...buildDevConfig(devConfig),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
2
3
|
import { pki } from "node-forge";
|
|
3
4
|
import * as path from "path";
|
|
4
|
-
import * as fs from "fs/promises";
|
|
5
5
|
|
|
6
6
|
const SSL_CERT_DIR = path.resolve(process.cwd(), "..", "..", ".ssl");
|
|
7
7
|
const CERT_FILE = path.resolve(SSL_CERT_DIR, "certificate.pem");
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import
|
|
3
|
-
import * as chalk from "chalk";
|
|
4
|
-
import { buildConfig } from "../../webpack.config";
|
|
2
|
+
import { generatePreviewUrl } from "@canva/cli";
|
|
5
3
|
import * as ngrok from "@ngrok/ngrok";
|
|
6
|
-
import * as
|
|
4
|
+
import * as chalk from "chalk";
|
|
7
5
|
import * as Table from "cli-table3";
|
|
6
|
+
import * as nodemon from "nodemon";
|
|
7
|
+
import * as open from "open";
|
|
8
8
|
import * as webpack from "webpack";
|
|
9
9
|
import * as WebpackDevServer from "webpack-dev-server";
|
|
10
|
-
import
|
|
11
|
-
import { generatePreviewUrl } from "@canva/cli";
|
|
10
|
+
import { buildConfig } from "../../webpack.config";
|
|
12
11
|
import type { Certificate } from "../ssl/ssl";
|
|
13
12
|
import { createOrRetrieveCertificate } from "../ssl/ssl";
|
|
13
|
+
import type { Context } from "./context";
|
|
14
14
|
|
|
15
15
|
export const infoChalk = chalk.blue.bold;
|
|
16
16
|
export const warnChalk = chalk.bgYellow.bold;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataTable } from "@canva/intents/data";
|
|
2
|
-
import {
|
|
2
|
+
import { type DataTableColumn, toDataTable } from "src/utils";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This file defines types and classes related to data source configuration, fetching and outputting as a data table.
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/* eslint-disable formatjs/no-literal-string-in-object */
|
|
2
|
-
import type { APIResponseItem, DataSourceConfig } from "../data_source";
|
|
3
|
-
import { DataAPIError, DataSourceHandler } from "../data_source";
|
|
4
|
-
import type { CanvaItemResponse } from "../connect_client";
|
|
5
2
|
|
|
6
3
|
import type { SelectOption } from "@canva/app-ui-kit";
|
|
7
4
|
import { Button, DatabaseIcon, HorizontalCard, Rows } from "@canva/app-ui-kit";
|
|
8
|
-
import {
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { useIntl } from "react-intl";
|
|
7
|
+
import { useNavigate } from "react-router-dom";
|
|
9
8
|
import { Header } from "src/components";
|
|
10
9
|
import {
|
|
11
10
|
ownershipFilter,
|
|
12
11
|
sortOrderField,
|
|
13
12
|
} from "src/components/inputs/messages";
|
|
14
|
-
import {
|
|
13
|
+
import { SearchFilter } from "src/components/inputs/search_filter";
|
|
15
14
|
import { SelectField } from "src/components/inputs/select_field";
|
|
16
|
-
import {
|
|
15
|
+
import { useAppContext } from "src/context";
|
|
17
16
|
import { Paths } from "src/routes";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
17
|
+
import { dateCell, numberCell, stringCell } from "src/utils";
|
|
18
|
+
import type { CanvaItemResponse } from "../connect_client";
|
|
19
|
+
import { DataAPIError, DataSourceHandler } from "../data_source";
|
|
20
|
+
import type { APIResponseItem, DataSourceConfig } from "../data_source";
|
|
21
21
|
|
|
22
22
|
export interface DesignsDataSource extends DataSourceConfig {
|
|
23
23
|
query: string;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
/* eslint-disable formatjs/no-literal-string-in-object */
|
|
2
|
-
import { useAppContext } from "src/context";
|
|
3
|
-
import type { APIResponseItem, DataSourceConfig } from "../data_source";
|
|
4
|
-
import { DataAPIError, DataSourceHandler } from "../data_source";
|
|
5
|
-
import type { CanvaItemResponse } from "../connect_client";
|
|
6
|
-
import { dateCell, stringCell } from "src/utils";
|
|
7
2
|
import type { SelectOption } from "@canva/app-ui-kit";
|
|
8
3
|
import {
|
|
9
4
|
Button,
|
|
@@ -11,18 +6,23 @@ import {
|
|
|
11
6
|
Rows,
|
|
12
7
|
TableMergedHeaderCellsIcon,
|
|
13
8
|
} from "@canva/app-ui-kit";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
14
10
|
import { useIntl } from "react-intl";
|
|
11
|
+
import { useNavigate } from "react-router-dom";
|
|
12
|
+
import { Header } from "src/components";
|
|
15
13
|
import {
|
|
16
14
|
datasetFilter,
|
|
17
15
|
ownershipFilter,
|
|
18
16
|
sortOrderField,
|
|
19
17
|
} from "src/components/inputs/messages";
|
|
18
|
+
import { SearchFilter } from "src/components/inputs/search_filter";
|
|
20
19
|
import { SelectField } from "src/components/inputs/select_field";
|
|
21
|
-
import {
|
|
22
|
-
import { useNavigate } from "react-router-dom";
|
|
20
|
+
import { useAppContext } from "src/context";
|
|
23
21
|
import { Paths } from "src/routes";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
22
|
+
import { dateCell, stringCell } from "src/utils";
|
|
23
|
+
import type { CanvaItemResponse } from "../connect_client";
|
|
24
|
+
import { DataAPIError, DataSourceHandler } from "../data_source";
|
|
25
|
+
import type { APIResponseItem, DataSourceConfig } from "../data_source";
|
|
26
26
|
|
|
27
27
|
export interface BrandTemplatesDataSource extends DataSourceConfig {
|
|
28
28
|
query: string;
|
|
@@ -2,13 +2,13 @@ import type {
|
|
|
2
2
|
GetDataTableRequest,
|
|
3
3
|
GetDataTableResponse,
|
|
4
4
|
} from "@canva/intents/data";
|
|
5
|
-
import { DATA_SOURCES } from "./data_sources";
|
|
6
5
|
import {
|
|
7
6
|
appError,
|
|
8
7
|
completeDataTable,
|
|
9
8
|
outdatedSourceRef,
|
|
10
9
|
remoteRequestFailed,
|
|
11
10
|
} from "src/utils/fetch_result";
|
|
11
|
+
import { DATA_SOURCES } from "./data_sources";
|
|
12
12
|
import { DataAPIError } from ".";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/* eslint-disable formatjs/no-literal-string-in-object */
|
|
2
2
|
/* eslint-disable formatjs/no-literal-string-in-jsx */
|
|
3
|
-
import type { DataSourceConfig, APIResponseItem } from "../data_source";
|
|
4
|
-
import { DataSourceHandler, DataAPIError } from "../data_source";
|
|
5
3
|
import { toDataTable } from "src/utils";
|
|
4
|
+
import type { APIResponseItem, DataSourceConfig } from "../data_source";
|
|
5
|
+
import { DataAPIError, DataSourceHandler } from "../data_source";
|
|
6
6
|
|
|
7
7
|
// Mock dependencies
|
|
8
8
|
jest.mock("src/utils", () => ({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { createHashRouter, RouterProvider } from "react-router-dom";
|
|
2
|
-
import { ContextProvider } from "./context";
|
|
3
|
-
import { routes } from "./routes";
|
|
4
|
-
import { AppUiProvider } from "@canva/app-ui-kit";
|
|
5
1
|
import { AppI18nProvider } from "@canva/app-i18n-kit";
|
|
2
|
+
import { AppUiProvider } from "@canva/app-ui-kit";
|
|
3
|
+
import type { RenderSelectionUiRequest } from "@canva/intents/data";
|
|
6
4
|
import { ErrorBoundary } from "react-error-boundary";
|
|
5
|
+
import { createHashRouter, RouterProvider } from "react-router-dom";
|
|
6
|
+
import { ContextProvider } from "./context";
|
|
7
7
|
import { ErrorPage } from "./pages";
|
|
8
|
-
import
|
|
8
|
+
import { routes } from "./routes";
|
|
9
9
|
|
|
10
10
|
export const App = ({ request }: { request: RenderSelectionUiRequest }) => (
|
|
11
11
|
<AppI18nProvider>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useNavigate } from "react-router-dom";
|
|
2
1
|
import {
|
|
3
2
|
ArrowLeftIcon,
|
|
4
3
|
Box,
|
|
@@ -7,6 +6,7 @@ import {
|
|
|
7
6
|
Columns,
|
|
8
7
|
Title,
|
|
9
8
|
} from "@canva/app-ui-kit";
|
|
9
|
+
import { useNavigate } from "react-router-dom";
|
|
10
10
|
import { Paths } from "src/routes";
|
|
11
11
|
|
|
12
12
|
export const Header = ({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createContext, useState, useCallback } from "react";
|
|
2
1
|
import type { RenderSelectionUiRequest } from "@canva/intents/data";
|
|
3
2
|
import type { AccessTokenResponse } from "@canva/user";
|
|
4
3
|
import { auth } from "@canva/user";
|
|
4
|
+
import { createContext, useCallback, useState } from "react";
|
|
5
5
|
import type { APIResponseItem, DataSourceHandler } from "src/api/data_source";
|
|
6
6
|
import { type DataSourceConfig } from "src/api/data_source";
|
|
7
7
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { LoadingIndicator } from "@canva/app-ui-kit";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import { useNavigate } from "react-router-dom";
|
|
4
|
+
import type {
|
|
5
|
+
APIResponseItem,
|
|
6
|
+
DataSourceConfig,
|
|
7
|
+
DataSourceHandler,
|
|
8
|
+
} from "./api";
|
|
9
|
+
import { DATA_SOURCES } from "./api/data_sources";
|
|
4
10
|
import { useAppContext } from "./context";
|
|
11
|
+
import { Paths } from "./routes";
|
|
5
12
|
import {
|
|
6
13
|
isDataRefEmpty,
|
|
7
14
|
isLaunchedWithError,
|
|
8
15
|
isOutdatedSource,
|
|
9
16
|
} from "./utils/data_params";
|
|
10
|
-
import { Paths } from "./routes";
|
|
11
|
-
import { DATA_SOURCES } from "./api/data_sources";
|
|
12
|
-
import type {
|
|
13
|
-
APIResponseItem,
|
|
14
|
-
DataSourceConfig,
|
|
15
|
-
DataSourceHandler,
|
|
16
|
-
} from "./api";
|
|
17
17
|
|
|
18
18
|
const parseDataSource = (source: string) => {
|
|
19
19
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Outlet } from "react-router-dom";
|
|
2
1
|
import { Box, Rows } from "@canva/app-ui-kit";
|
|
3
|
-
import {
|
|
2
|
+
import { Outlet } from "react-router-dom";
|
|
4
3
|
import * as styles from "styles/components.css";
|
|
4
|
+
import { AppError } from "./components";
|
|
5
5
|
|
|
6
6
|
export const Home = () => (
|
|
7
7
|
<div className={styles.scrollContainer}>
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
import { Alert, AppUiProvider } from "@canva/app-ui-kit";
|
|
1
2
|
import type {
|
|
2
|
-
RenderSelectionUiRequest,
|
|
3
3
|
GetDataTableRequest,
|
|
4
4
|
GetDataTableResponse,
|
|
5
|
+
RenderSelectionUiRequest,
|
|
5
6
|
} from "@canva/intents/data";
|
|
6
7
|
import { prepareDataConnector } from "@canva/intents/data";
|
|
7
|
-
import { createRoot } from "react-dom/client";
|
|
8
|
-
import { App } from "./app";
|
|
9
8
|
import { auth } from "@canva/user";
|
|
9
|
+
import { createRoot } from "react-dom/client";
|
|
10
10
|
import { buildDataTableResult, scope } from "./api";
|
|
11
|
-
|
|
11
|
+
import { App } from "./app";
|
|
12
12
|
import "@canva/app-ui-kit/styles.css";
|
|
13
|
-
import { Alert, AppUiProvider } from "@canva/app-ui-kit";
|
|
14
13
|
|
|
15
14
|
const root = createRoot(document.getElementById("root") as Element);
|
|
16
15
|
prepareDataConnector({
|
|
@@ -63,7 +62,7 @@ root.render(
|
|
|
63
62
|
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
|
|
64
63
|
<Alert tone="critical">
|
|
65
64
|
If you're seeing this, you need to turn on the data connector intent in
|
|
66
|
-
the
|
|
65
|
+
the Developer Portal for this app.
|
|
67
66
|
</Alert>
|
|
68
67
|
</AppUiProvider>,
|
|
69
68
|
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useNavigate } from "react-router-dom";
|
|
2
1
|
import { Button, Rows, Text } from "@canva/app-ui-kit";
|
|
2
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
3
|
+
import { useNavigate } from "react-router-dom";
|
|
3
4
|
import { Paths } from "src/routes";
|
|
4
5
|
import * as styles from "styles/components.css";
|
|
5
|
-
import { FormattedMessage, useIntl } from "react-intl";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Bare bones Error Page, please add relevant information and behavior that your app requires.
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Box,
|
|
2
3
|
Button,
|
|
3
4
|
LoadingIndicator,
|
|
4
5
|
Rows,
|
|
5
|
-
Title,
|
|
6
6
|
Text,
|
|
7
|
-
|
|
7
|
+
Title,
|
|
8
8
|
} from "@canva/app-ui-kit";
|
|
9
|
-
import {
|
|
9
|
+
import { useCallback, useEffect, useState } from "react";
|
|
10
|
+
import { defineMessages, FormattedMessage, useIntl } from "react-intl";
|
|
11
|
+
import { useNavigate } from "react-router-dom";
|
|
12
|
+
import { scope } from "src/api";
|
|
13
|
+
import { Header } from "src/components";
|
|
10
14
|
import * as styles from "styles/components.css";
|
|
11
15
|
import { useAppContext } from "../context";
|
|
12
|
-
import { useNavigate } from "react-router-dom";
|
|
13
16
|
import { Paths } from "../routes";
|
|
14
|
-
import { Header } from "src/components";
|
|
15
|
-
import { useIntl, FormattedMessage, defineMessages } from "react-intl";
|
|
16
|
-
import { scope } from "src/api";
|
|
17
17
|
|
|
18
18
|
export const Login = () => {
|
|
19
19
|
const intl = useIntl();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entrypoint } from "src/entrypoint";
|
|
2
2
|
import { Home } from "src/home";
|
|
3
|
-
import { ErrorPage, Login,
|
|
3
|
+
import { DataSourceConfig, ErrorPage, Login, SelectSource } from "src/pages";
|
|
4
4
|
import { ProtectedRoute } from "./protected_route";
|
|
5
5
|
|
|
6
6
|
export enum Paths {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* eslint-disable formatjs/no-literal-string-in-object */
|
|
2
|
+
import type { APIResponseItem } from "src/api";
|
|
2
3
|
import {
|
|
3
|
-
toDataTable,
|
|
4
|
-
stringCell,
|
|
5
|
-
numberCell,
|
|
6
|
-
dateCell,
|
|
7
4
|
booleanCell,
|
|
5
|
+
dateCell,
|
|
6
|
+
numberCell,
|
|
7
|
+
stringCell,
|
|
8
|
+
toDataTable,
|
|
8
9
|
} from "../data_table";
|
|
9
10
|
import type { DataTableColumn } from "../data_table";
|
|
10
|
-
import type { APIResponseItem } from "src/api";
|
|
11
11
|
|
|
12
12
|
describe("data table utils", () => {
|
|
13
13
|
interface TestItem extends APIResponseItem {
|
|
@@ -182,7 +182,7 @@ export function buildConfig({
|
|
|
182
182
|
new DefinePlugin({
|
|
183
183
|
BACKEND_HOST: JSON.stringify(backendHost),
|
|
184
184
|
}),
|
|
185
|
-
// Apps can only submit a single JS file via the
|
|
185
|
+
// Apps can only submit a single JS file via the Developer Portal
|
|
186
186
|
new optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
|
|
187
187
|
].filter(Boolean),
|
|
188
188
|
...buildDevConfig(devConfig),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
2
3
|
import { pki } from "node-forge";
|
|
3
4
|
import * as path from "path";
|
|
4
|
-
import * as fs from "fs/promises";
|
|
5
5
|
|
|
6
6
|
const SSL_CERT_DIR = path.resolve(process.cwd(), "..", "..", ".ssl");
|
|
7
7
|
const CERT_FILE = path.resolve(SSL_CERT_DIR, "certificate.pem");
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import
|
|
3
|
-
import * as chalk from "chalk";
|
|
4
|
-
import { buildConfig } from "../../webpack.config";
|
|
2
|
+
import { generatePreviewUrl } from "@canva/cli";
|
|
5
3
|
import * as ngrok from "@ngrok/ngrok";
|
|
6
|
-
import * as
|
|
4
|
+
import * as chalk from "chalk";
|
|
7
5
|
import * as Table from "cli-table3";
|
|
6
|
+
import * as nodemon from "nodemon";
|
|
7
|
+
import * as open from "open";
|
|
8
8
|
import * as webpack from "webpack";
|
|
9
9
|
import * as WebpackDevServer from "webpack-dev-server";
|
|
10
|
-
import
|
|
11
|
-
import { generatePreviewUrl } from "@canva/cli";
|
|
10
|
+
import { buildConfig } from "../../webpack.config";
|
|
12
11
|
import type { Certificate } from "../ssl/ssl";
|
|
13
12
|
import { createOrRetrieveCertificate } from "../ssl/ssl";
|
|
13
|
+
import type { Context } from "./context";
|
|
14
14
|
|
|
15
15
|
export const infoChalk = chalk.blue.bold;
|
|
16
16
|
export const warnChalk = chalk.bgYellow.bold;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createHashRouter, RouterProvider } from "react-router-dom";
|
|
2
|
-
import { ContextProvider } from "./context";
|
|
3
|
-
import { routes } from "./routes";
|
|
4
1
|
import { AppI18nProvider } from "@canva/app-i18n-kit";
|
|
5
2
|
import { AppUiProvider } from "@canva/app-ui-kit";
|
|
6
3
|
import { ErrorBoundary } from "react-error-boundary";
|
|
4
|
+
import { createHashRouter, RouterProvider } from "react-router-dom";
|
|
5
|
+
import { ContextProvider } from "./context";
|
|
7
6
|
import { ErrorPage } from "./pages";
|
|
7
|
+
import { routes } from "./routes";
|
|
8
8
|
|
|
9
9
|
export const App = () => (
|
|
10
10
|
<AppI18nProvider>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Button, Rows } from "@canva/app-ui-kit";
|
|
2
|
+
import { useIntl } from "react-intl";
|
|
3
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
4
|
+
import { purchaseCredits, queueImageGeneration } from "src/api";
|
|
4
5
|
import { RemainingCredits } from "src/components";
|
|
5
6
|
import { NUMBER_OF_IMAGES_TO_GENERATE } from "src/config";
|
|
6
7
|
import { useAppContext } from "src/context";
|
|
7
8
|
import { Paths } from "src/routes";
|
|
8
9
|
import { getObsceneWords } from "src/utils";
|
|
9
|
-
import { useIntl } from "react-intl";
|
|
10
10
|
import { FooterMessages as Messages } from "./footer.messages";
|
|
11
11
|
|
|
12
12
|
export const Footer = () => {
|
|
@@ -2,10 +2,10 @@ import { Grid, ImageCard, Rows, Text } from "@canva/app-ui-kit";
|
|
|
2
2
|
import type { QueuedImage } from "@canva/asset";
|
|
3
3
|
import { upload } from "@canva/asset";
|
|
4
4
|
import { addElementAtPoint, ui } from "@canva/design";
|
|
5
|
+
import { FormattedMessage, useIntl } from "react-intl";
|
|
5
6
|
import type { ImageType } from "src/api";
|
|
6
7
|
import { useAppContext } from "src/context";
|
|
7
8
|
import * as styles from "styles/utils.css";
|
|
8
|
-
import { FormattedMessage, useIntl } from "react-intl";
|
|
9
9
|
|
|
10
10
|
const THUMBNAIL_HEIGHT = 150;
|
|
11
11
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
import { useNavigate } from "react-router-dom";
|
|
3
1
|
import {
|
|
4
|
-
|
|
2
|
+
Box,
|
|
3
|
+
Button,
|
|
5
4
|
Grid,
|
|
6
5
|
Placeholder,
|
|
7
6
|
ProgressBar,
|
|
7
|
+
Rows,
|
|
8
8
|
Text,
|
|
9
|
-
Button,
|
|
10
|
-
Box,
|
|
11
9
|
} from "@canva/app-ui-kit";
|
|
12
|
-
import {
|
|
13
|
-
import { useAppContext } from "src/context";
|
|
14
|
-
import { cancelImageGenerationJob, getImageGenerationJobStatus } from "src/api";
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
15
11
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
12
|
+
import { useNavigate } from "react-router-dom";
|
|
13
|
+
import { cancelImageGenerationJob, getImageGenerationJobStatus } from "src/api";
|
|
14
|
+
import { useAppContext } from "src/context";
|
|
15
|
+
import { Paths } from "src/routes";
|
|
16
16
|
|
|
17
17
|
const INTERVAL_DURATION_IN_MS = 100;
|
|
18
18
|
const TOTAL_PROGRESS_PERCENTAGE = 100;
|