yichong-canva2 1.3.0 → 1.3.1

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/README.md CHANGED
@@ -5,13 +5,15 @@
5
5
  ## 使用
6
6
 
7
7
  ```sh
8
- npm install yichong-canva2@1.3.0
8
+ npm install yichong-canva2@1.3.1
9
9
  ```
10
10
 
11
11
  `1.2.0` 新增文本审核、三个消费接口,以及 Cloudflare R2 单次和分片上传;继续复用原有 Provider。
12
12
 
13
13
  `1.3.0` 新增 `client.reportError`,直接调用现有错误上报 Worker,无需后端改动或额外配置。
14
14
 
15
+ `1.3.1` 补齐通用参数中的 `timezone`,并统一旧登录、通行证、状态查询、版本配置及旧消费请求。
16
+
15
17
  ```tsx
16
18
  import { useState } from "react";
17
19
  import { YiChongCanvaProvider, useYiChongCanva } from "yichong-canva2";
@@ -95,7 +97,11 @@ function GenerateButton() {
95
97
  | `client.completeUpload({ objectName, uploadId, parts, bucketName? })` | `POST {uploadBaseUrl}/upload/complete-upload` | `{ ETag, Bucket?, Key?, Location?, ... }` |
96
98
  | `client.uploadFile({ file, ... })` | 自动单次 PUT 或初始化 → 分片签名 / PUT → 合并 | `{ url: "公开资源地址", key, endpointBaseUrl }` |
97
99
 
98
- Provider 自动注入自有后端请求 query 中的 `uid`、`platform_uid`、`platform=canva_addon`、`app_channel`,以及 `Accept-Language`。AI 接口还携带 `Authorization: Bearer <jwt>`、`Channel: ai`;消费接口使用 `X-Access-Ticket`、`X-Access-Channel`;签名接口使用 `Channel: node-nauth`。R2 PUT 原样使用签名 URL,只携带文件的 `Content-Type`。创建请求中的 `user_id` 使用系统用户 ID(`userStatus.profile.id`)。公共审核只要求有效的业务 JWT;`uid` 和 `platform_uid` 在账户状态包含这些值时才附带,审核身份由后端验签确定。调用方无需维护这些字段。
100
+ Provider 自动注入自有后端请求 query 中的 `uid`、`platform_uid`、`platform=canva_addon`、`app_channel`、`timezone`,以及请求头 `Accept-Language`。时区每次请求通过 `Intl.DateTimeFormat().resolvedOptions().timeZone` 读取,如 `Asia/Taipei`;运行环境不支持时使用 `UTC`。浏览器请求不额外发送 `accept_language` 参数。
101
+
102
+ 这些通用信息覆盖预测、文本审核、消费、上传签名和分片管理,以及原有登录、通行证、状态查询、版本配置和 `use` 消费请求。登录开始时不附带未知的用户 ID;拿到 Canva 用户 ID 后附带 `platform_uid`,拿到系统用户 ID 后再附带 `uid`,后续刷新和轮询读取最新语言与时区。调用方无需配置时区或在业务参数中重复填写通用字段。
103
+
104
+ AI 接口还携带 `Authorization: Bearer <jwt>`、`Channel: ai`;具名消费接口使用 `X-Access-Ticket`、`X-Access-Channel`;签名接口使用 `Channel: node-nauth`。R2 PUT 原样使用签名 URL,只携带文件的 `Content-Type`;错误上报 Worker 使用独立协议,身份与渠道信息放在诊断消息中。创建请求中的 `user_id` 使用系统用户 ID(`userStatus.profile.id`)。公共审核只要求有效的业务 JWT;`uid` 和 `platform_uid` 在账户状态包含这些值时才附带,审核身份由后端验签确定。
99
105
 
100
106
  当前创建接口支持普通的 `owner/name/input` 合同;视频 `schema_v2` 等高级参数后续接入。模型参数按 JSON 原样发送,不改写 prompt 或供应商。创建、查询和文本审核只发送一次请求,不自动轮询、重试、额外扣费或插入 Canva 设计。消费由应用显式调用具名方法。原有登录、额度和结账会话方法继续由同一个 hook 提供。
101
107
 
@@ -33,6 +33,14 @@ function language(getLocale) {
33
33
  return "en";
34
34
  }
35
35
  }
36
+ function timezone() {
37
+ try {
38
+ const value = Intl.DateTimeFormat().resolvedOptions().timeZone;
39
+ return isNonemptyString(value) ? value : "UTC";
40
+ } catch {
41
+ return "UTC";
42
+ }
43
+ }
36
44
  function endpoint(baseUrl, path) {
37
45
  let url;
38
46
  try {
@@ -53,6 +61,7 @@ function addContextQuery(url, context) {
53
61
  if (isNonemptyString(userId)) url.searchParams.set("platform_uid", userId);
54
62
  url.searchParams.set("platform", "canva_addon");
55
63
  url.searchParams.set("app_channel", context.productName);
64
+ url.searchParams.set("timezone", timezone());
56
65
  }
57
66
  async function readJson(response) {
58
67
  try {
@@ -115,5 +124,6 @@ export {
115
124
  language,
116
125
  postApi,
117
126
  readJson,
127
+ timezone,
118
128
  validateJson
119
129
  };
@@ -3,7 +3,7 @@ const headers = {
3
3
  "Content-Type": "application/json"
4
4
  };
5
5
  const baseUrl = "https://usa.imgkits.com/";
6
- function getUserIds(token, appId) {
6
+ function getUserIds(token, appId, context) {
7
7
  const queryString = new URLSearchParams({
8
8
  canva_user_token: token,
9
9
  appid: appId
@@ -14,9 +14,9 @@ function getUserIds(token, appId) {
14
14
  method: "GET",
15
15
  headers,
16
16
  redirect: "follow"
17
- });
17
+ }, context);
18
18
  }
19
- function handleUserLoginByCanvaId(userId, productName) {
19
+ function handleUserLoginByCanvaId(userId, productName, context) {
20
20
  const url = baseUrl + productName + "/api/user/canvaid-login";
21
21
  return requestUrl({
22
22
  url,
@@ -26,9 +26,9 @@ function handleUserLoginByCanvaId(userId, productName) {
26
26
  canva_id: userId
27
27
  }),
28
28
  redirect: "follow"
29
- });
29
+ }, context);
30
30
  }
31
- function getPassport(userId, productName) {
31
+ function getPassport(userId, productName, context) {
32
32
  const passport = localStorage.getItem(userId + "_passport");
33
33
  if (passport) {
34
34
  return Promise.resolve({
@@ -49,12 +49,12 @@ function getPassport(userId, productName) {
49
49
  canva_id: userId
50
50
  }),
51
51
  redirect: "follow"
52
- }).then((res) => {
52
+ }, context).then((res) => {
53
53
  localStorage.setItem(userId + "_passport", res.data.passport);
54
54
  return res;
55
55
  });
56
56
  }
57
- function getUserStatusByPassport(passport, productName) {
57
+ function getUserStatusByPassport(passport, productName, context) {
58
58
  const header = {
59
59
  "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
60
60
  "X-Access-Ticket": passport
@@ -65,7 +65,7 @@ function getUserStatusByPassport(passport, productName) {
65
65
  method: "POST",
66
66
  headers: header,
67
67
  redirect: "follow"
68
- });
68
+ }, context);
69
69
  }
70
70
  const apis = {
71
71
  getUserIds,
@@ -1,5 +1,14 @@
1
- const requestUrl = (option) => {
2
- return fetch(option.url, option).then((res) => res.json());
1
+ import { addContextQuery, language } from "../../../api/request.js";
2
+ const requestUrl = (option, context) => {
3
+ const { url, ...init } = option;
4
+ const target = new URL(url);
5
+ if (context) {
6
+ addContextQuery(target, context);
7
+ const headers = new Headers(init.headers);
8
+ headers.set("Accept-Language", language(context.getLocale));
9
+ init.headers = headers;
10
+ }
11
+ return fetch(target.toString(), init).then((res) => res.json());
3
12
  };
4
13
  export {
5
14
  requestUrl as default
@@ -1,10 +1,20 @@
1
1
  import { auth } from "@canva/user";
2
2
  import apis from "./apis/index.js";
3
+ function accountContext(productName, userId, getContext) {
4
+ const context = getContext == null ? void 0 : getContext();
5
+ const current = context == null ? void 0 : context.userStatus;
6
+ return {
7
+ productName,
8
+ getLocale: context == null ? void 0 : context.getLocale,
9
+ userStatus: { userId, profile: userId && (current == null ? void 0 : current.userId) === userId ? current.profile : void 0 }
10
+ };
11
+ }
3
12
  auth.initOauth();
4
13
  async function handleLogin({
5
14
  appId,
6
15
  productName,
7
- onPassport
16
+ onPassport,
17
+ getRequestContext
8
18
  }) {
9
19
  try {
10
20
  let userId = window.userId;
@@ -12,15 +22,16 @@ async function handleLogin({
12
22
  if (!userId) {
13
23
  const token = await auth.getCanvaUserToken();
14
24
  window.g_canva_token = token;
15
- const userIdResult = await apis.getUserIds(token, appId);
25
+ const userIdResult = await apis.getUserIds(token, appId, accountContext(productName, userId, getRequestContext));
16
26
  userId = userIdResult.verified.userId;
17
27
  window.userId = userId;
18
- await apis.handleUserLoginByCanvaId(userId, productName);
28
+ await apis.handleUserLoginByCanvaId(userId, productName, accountContext(productName, userId, getRequestContext));
19
29
  }
20
30
  const userStatus = await getUserProfile({
21
31
  userId,
22
32
  productName,
23
- onPassport
33
+ onPassport,
34
+ getRequestContext
24
35
  });
25
36
  window.g_token = userStatus.jwt || "";
26
37
  userStatus.userId = userId;
@@ -81,12 +92,18 @@ async function getUserProfile({
81
92
  baseline,
82
93
  isChanged,
83
94
  onStop,
84
- onPassport
95
+ onPassport,
96
+ getRequestContext
85
97
  }) {
86
98
  var _a, _b;
87
99
  let count = 0;
88
100
  const startedAt = Date.now();
89
- let passportResult = await apis.getPassport(userId, productName);
101
+ let latestProfile;
102
+ const requestContext = () => {
103
+ const context = accountContext(productName, userId, getRequestContext);
104
+ return { ...context, userStatus: { ...context.userStatus, profile: latestProfile ?? context.userStatus.profile } };
105
+ };
106
+ let passportResult = await apis.getPassport(userId, productName, requestContext());
90
107
  let passport = (_a = passportResult.data) == null ? void 0 : _a.passport;
91
108
  let isStop = false;
92
109
  let cancelSleep = null;
@@ -101,11 +118,12 @@ async function getUserProfile({
101
118
  console.log("poll", count);
102
119
  let userStatus;
103
120
  try {
104
- userStatus = await (await apis.getUserStatusByPassport(passport, productName)).data;
121
+ userStatus = await (await apis.getUserStatusByPassport(passport, productName, requestContext())).data;
105
122
  } catch (e) {
106
123
  userStatus = void 0;
107
124
  }
108
125
  if (userStatus == null ? void 0 : userStatus.profile) {
126
+ latestProfile = userStatus.profile;
109
127
  if (typeof passport === "string" && passport) onPassport == null ? void 0 : onPassport(passport, userId, userStatus.profile.id);
110
128
  if (!isSubscribe) {
111
129
  successCallback == null ? void 0 : successCallback(userStatus);
@@ -124,7 +142,7 @@ async function getUserProfile({
124
142
  } else if (userStatus) {
125
143
  localStorage.removeItem(userId + "_passport");
126
144
  try {
127
- passportResult = await apis.getPassport(userId, productName);
145
+ passportResult = await apis.getPassport(userId, productName, requestContext());
128
146
  passport = (_b = passportResult.data) == null ? void 0 : _b.passport;
129
147
  } catch (e) {
130
148
  }
@@ -9,31 +9,37 @@ import { createTextModerationApi } from "../api/moderation.js";
9
9
  import { createUsageApi } from "../api/usage.js";
10
10
  import { createUploadApi } from "../api/uploads.js";
11
11
  import { createErrorReportingApi } from "../api/reporting.js";
12
- function reduceFreeTimes(baseUrl, passport, cnt = 1) {
12
+ import { language, addContextQuery } from "../api/request.js";
13
+ function reduceFreeTimes(baseUrl, passport, cnt, context) {
13
14
  const header = {
14
15
  "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
15
- "X-Access-Ticket": passport
16
+ "X-Access-Ticket": passport,
17
+ "Accept-Language": language(context.getLocale)
16
18
  };
17
- const url = baseUrl + "/api/user/reduce-free-cnt?cnt=" + cnt;
18
- return fetch(url, {
19
+ const url = new URL(baseUrl + "/api/user/reduce-free-cnt?cnt=" + cnt);
20
+ addContextQuery(url, context);
21
+ return fetch(url.toString(), {
19
22
  method: "POST",
20
23
  headers: header,
21
24
  redirect: "follow"
22
25
  }).catch((error) => {
23
26
  console.log("reduceFreeTimes: ", error);
24
- reduceFreeTimes(baseUrl, passport);
27
+ reduceFreeTimes(baseUrl, passport, cnt, context);
25
28
  });
26
29
  }
27
- function addMonthlyUsage(passport, cnt = 1, productName) {
30
+ function addMonthlyUsage(passport, cnt, productName, context) {
28
31
  const headers = {
29
32
  "X-Access-Ticket": passport,
30
33
  "Content-Type": "application/json",
31
- "X-Access-Channel": productName
34
+ "X-Access-Channel": productName,
35
+ "Accept-Language": language(context.getLocale)
32
36
  };
33
37
  const data = {
34
38
  cnt
35
39
  };
36
- return fetch("https://usa.imgkits.com/api/user/add-monthly-usage", {
40
+ const url = new URL("https://usa.imgkits.com/api/user/add-monthly-usage");
41
+ addContextQuery(url, context);
42
+ return fetch(url.toString(), {
37
43
  method: "POST",
38
44
  headers,
39
45
  body: JSON.stringify(data)
@@ -138,7 +144,8 @@ const YiChongCanvaProvider = ({
138
144
  handleLogin({
139
145
  appId,
140
146
  productName,
141
- onPassport
147
+ onPassport,
148
+ getRequestContext: getApiContext
142
149
  }).then((userStatus2) => {
143
150
  setLoginStatus("success");
144
151
  updateUserStatus(userStatus2);
@@ -202,6 +209,7 @@ const YiChongCanvaProvider = ({
202
209
  productName,
203
210
  userId,
204
211
  onPassport,
212
+ getRequestContext: getApiContext,
205
213
  isSubscribe: true,
206
214
  baseline,
207
215
  // 会话时长由 sessionTtlMs 主导;次数上限只作双保险
@@ -251,7 +259,7 @@ const YiChongCanvaProvider = ({
251
259
  console.log("code version: ", version);
252
260
  console.log("local version: ", _version);
253
261
  if (Number.isNaN(_version)) {
254
- getAppVersion("canva_" + appId).then((res) => {
262
+ getAppVersion("canva_" + appId, getApiContext()).then((res) => {
255
263
  console.log("latest version: ", res.version);
256
264
  if (typeof res.version !== "number") {
257
265
  res.version = version + 1;
@@ -265,7 +273,7 @@ const YiChongCanvaProvider = ({
265
273
  });
266
274
  } else {
267
275
  if (version !== _version) {
268
- getAppVersion("canva_" + appId).then((res) => {
276
+ getAppVersion("canva_" + appId, getApiContext()).then((res) => {
269
277
  if (typeof res.version !== "number") {
270
278
  res.version = version + 1;
271
279
  }
@@ -434,6 +442,7 @@ const YiChongCanvaProvider = ({
434
442
  productName,
435
443
  userId: (window == null ? void 0 : window.userId) || "",
436
444
  onPassport,
445
+ getRequestContext: getApiContext,
437
446
  maxCount: 2,
438
447
  successCallback(userStatus2) {
439
448
  userStatus2.userId = (window == null ? void 0 : window.userId) || "";
@@ -480,7 +489,7 @@ const YiChongCanvaProvider = ({
480
489
  const passport = localStorage.getItem(window.userId + "_passport") || "";
481
490
  setCredits(credits - cnt);
482
491
  if (!notUpload) {
483
- reduceFreeTimes(baseUrl, passport, cnt);
492
+ reduceFreeTimes(baseUrl, passport, cnt, getApiContext());
484
493
  }
485
494
  };
486
495
  const handleSubscribedUse = (cnt, notUpload) => {
@@ -491,7 +500,7 @@ const YiChongCanvaProvider = ({
491
500
  const monthly_usage_cnt = (subscription == null ? void 0 : subscription.monthly_usage_cnt) ?? 0;
492
501
  let limitUsage = ((usage_limits == null ? void 0 : usage_limits.monthly_usage_limit) ?? 0) - monthly_usage_cnt;
493
502
  if (((usage_limits == null ? void 0 : usage_limits.monthly_usage_limit) ?? 0) <= -1 || limitUsage >= cnt) {
494
- addMonthlyUsage(passport, cnt, productName);
503
+ addMonthlyUsage(passport, cnt, productName, getApiContext());
495
504
  updateUserStatus({
496
505
  ...userStatus,
497
506
  subscription: {
@@ -504,7 +513,7 @@ const YiChongCanvaProvider = ({
504
513
  limitUsage = 0;
505
514
  }
506
515
  if (limitUsage > 0) {
507
- addMonthlyUsage(passport, limitUsage, productName);
516
+ addMonthlyUsage(passport, limitUsage, productName, getApiContext());
508
517
  updateUserStatus({
509
518
  ...userStatus,
510
519
  subscription: {
@@ -1,4 +1,5 @@
1
- function getAppVersion(key) {
1
+ import requestUrl from "./login/apis/request.js";
2
+ function getAppVersion(key, context) {
2
3
  const myHeaders = new Headers();
3
4
  myHeaders.append("User-Agent", "Apifox/1.0.0 (https://apifox.com)");
4
5
  myHeaders.append("Accept", "*/*");
@@ -13,7 +14,7 @@ function getAppVersion(key) {
13
14
  body: urlencoded,
14
15
  redirect: "follow"
15
16
  };
16
- return fetch("https://usa.imgkits.com/site/get", requestOptions).then((res) => res.json()).then((res) => {
17
+ return requestUrl({ ...requestOptions, url: "https://usa.imgkits.com/site/get" }, context).then((res) => {
17
18
  if (!(res == null ? void 0 : res.success)) {
18
19
  return {};
19
20
  } else {
@@ -2,12 +2,14 @@ import { UserStatus } from '../login/interface';
2
2
  import { ApiError } from './error';
3
3
  import { ApiRequestOptions, ApiResponse, JsonObject } from './types';
4
4
  /** 内部读取 Provider 的当前状态,不从 window / localStorage 读取 API 凭据。 */
5
- export interface ApiContext {
5
+ export interface CommonRequestContext {
6
6
  userStatus: UserStatus;
7
7
  productName: string;
8
- apiBaseUrl: string;
9
8
  getLocale?: () => string;
10
9
  }
10
+ export interface ApiContext extends CommonRequestContext {
11
+ apiBaseUrl: string;
12
+ }
11
13
  declare const apiPaths: {
12
14
  readonly createSpecifyPrediction: "/replicate/createSpecifyPrediction";
13
15
  readonly getPrediction: "/replicate/getPrediction";
@@ -19,8 +21,10 @@ export declare function invalid(message: string): never;
19
21
  /** 防止 stringify 悄悄删掉 undefined / 函数,或把 NaN / Infinity 转成 null。 */
20
22
  export declare function validateJson(value: unknown, ancestors?: Set<object>): void;
21
23
  export declare function language(getLocale?: () => string): string;
24
+ /** 每次请求读取当前运行环境的 IANA 时区,环境不支持时使用 UTC。 */
25
+ export declare function timezone(): string;
22
26
  export declare function endpoint(baseUrl: string, path: string): URL;
23
- export declare function addContextQuery(url: URL, context: ApiContext): void;
27
+ export declare function addContextQuery(url: URL, context: CommonRequestContext): void;
24
28
  export declare function readJson(response: Response): Promise<unknown>;
25
29
  export declare function backendError(response: Response, payload: unknown, fallbackCode: string | number): ApiError;
26
30
  export declare function postApi<T>(context: ApiContext, method: keyof typeof apiPaths, params: JsonObject, options?: ApiRequestOptions): Promise<ApiResponse<T>>;
@@ -1,28 +1,29 @@
1
+ import { CommonRequestContext } from '../../../api/request';
1
2
  /**
2
3
  * 由token和appId获取用户唯一的id
3
4
  * @param token canva颁发的token
4
5
  * @param appId 当前应用的appId
5
6
  * @returns
6
7
  */
7
- declare function getUserIds(token: string, appId: string): Promise<any>;
8
+ declare function getUserIds(token: string, appId: string, context: CommonRequestContext): Promise<any>;
8
9
  /**
9
10
  * 利用id登录用户
10
11
  * @param userId 获取到的用户唯一id
11
12
  */
12
- declare function handleUserLoginByCanvaId(userId: string, productName?: string): Promise<any>;
13
+ declare function handleUserLoginByCanvaId(userId: string, productName: string, context: CommonRequestContext): Promise<any>;
13
14
  /**
14
15
  * 由id获取通行证
15
16
  * @param userId
16
17
  * @param appName
17
18
  * @returns
18
19
  */
19
- declare function getPassport(userId: string, productName: string): Promise<any>;
20
+ declare function getPassport(userId: string, productName: string, context: CommonRequestContext): Promise<any>;
20
21
  /**
21
22
  * 由通行证获取用户信息
22
23
  * @param passport
23
24
  * @returns
24
25
  */
25
- declare function getUserStatusByPassport(passport: string, productName: string): Promise<any>;
26
+ declare function getUserStatusByPassport(passport: string, productName: string, context: CommonRequestContext): Promise<any>;
26
27
  declare const apis: {
27
28
  getUserIds: typeof getUserIds;
28
29
  handleUserLoginByCanvaId: typeof handleUserLoginByCanvaId;
@@ -1,3 +1,4 @@
1
+ import { CommonRequestContext } from '../../../api/request';
1
2
  /**
2
3
  * 请求json数据
3
4
  * @param option RequestInit & { url: string }
@@ -5,5 +6,5 @@
5
6
  */
6
7
  declare const requestUrl: (option: RequestInit & {
7
8
  url: string;
8
- }) => Promise<any>;
9
+ }, context?: CommonRequestContext) => Promise<any>;
9
10
  export default requestUrl;
@@ -1,5 +1,6 @@
1
1
  import { UserStatus } from './../interface';
2
- export declare function handleLogin({ appId, productName, onPassport, }: LoginProps): Promise<UserStatus>;
2
+ import { CommonRequestContext } from '../../api/request';
3
+ export declare function handleLogin({ appId, productName, onPassport, getRequestContext, }: LoginProps): Promise<UserStatus>;
3
4
  /**
4
5
  * 订阅比较基线:打开定价页「之前」的用户状态快照。
5
6
  * 由 Provider 在会话开始时用当时的 userStatus 生成(takeSubscribeBaseline),
@@ -48,7 +49,7 @@ export declare function isSubscribeChanged(current: UserStatus, baseline: Subscr
48
49
  * 2. 手动停止(onStop 交出的函数被调用):打断等待中的 sleep,return undefined(不算失败)
49
50
  * 3. maxCount 次数耗尽或 maxDurationMs 到期:failCallback + throw
50
51
  */
51
- export declare function getUserProfile({ maxCount, interval, maxDurationMs, productName, userId, successCallback, failCallback, isSubscribe, baseline, isChanged, onStop, onPassport, }: UserProfileProps): Promise<UserStatus | undefined>;
52
+ export declare function getUserProfile({ maxCount, interval, maxDurationMs, productName, userId, successCallback, failCallback, isSubscribe, baseline, isChanged, onStop, onPassport, getRequestContext, }: UserProfileProps): Promise<UserStatus | undefined>;
52
53
  export interface UserProfileProps {
53
54
  maxCount?: number;
54
55
  interval?: number | (() => number);
@@ -62,6 +63,7 @@ export interface UserProfileProps {
62
63
  isChanged?: (current: UserStatus, baseline: SubscribeBaseline) => boolean;
63
64
  onStop?: (fn: () => void) => void;
64
65
  onPassport?: (passport: string, userId: string, uid: string) => void;
66
+ getRequestContext?: () => CommonRequestContext;
65
67
  }
66
68
  export interface LoginProps {
67
69
  callback?: (state: LoginState) => void;
@@ -69,6 +71,7 @@ export interface LoginProps {
69
71
  productName: string;
70
72
  requestConfig?: UserProfileProps;
71
73
  onPassport?: UserProfileProps["onPassport"];
74
+ getRequestContext?: UserProfileProps["getRequestContext"];
72
75
  }
73
76
  export interface LoginState {
74
77
  status: "finish" | "error" | "start" | "user_id";
@@ -1,4 +1,5 @@
1
+ import { CommonRequestContext } from '../api/request';
1
2
  export interface AppVersion {
2
3
  version: number;
3
4
  }
4
- export declare function getAppVersion(key: string): Promise<AppVersion>;
5
+ export declare function getAppVersion(key: string, context?: CommonRequestContext): Promise<AppVersion>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yichong-canva2",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",