@abtnode/ux 1.16.26-beta-cca12425 → 1.16.26-beta-c8902aec

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.
Files changed (61) hide show
  1. package/es/blocklet/app-avatar.js +7 -19
  2. package/es/blocklet/authentication/oauth/apple.js +39 -15
  3. package/es/blocklet/authentication/oauth/auth0.js +18 -12
  4. package/es/blocklet/authentication/oauth/github.js +10 -9
  5. package/es/blocklet/authentication/oauth/google.js +10 -9
  6. package/es/blocklet/component/component-cell.js +201 -359
  7. package/es/blocklet/component/component-info-dialog.js +257 -0
  8. package/es/blocklet/component/index.js +16 -13
  9. package/es/blocklet/component/store-blocklet-list.js +3 -0
  10. package/es/blocklet/publish/connect-store-list.js +33 -4
  11. package/es/blocklet/publish/create-release.js +9 -4
  12. package/es/blocklet/status.js +13 -7
  13. package/es/locales/ar.js +20 -13
  14. package/es/locales/de.js +20 -13
  15. package/es/locales/en.js +19 -12
  16. package/es/locales/es.js +21 -14
  17. package/es/locales/fr.js +20 -13
  18. package/es/locales/hi.js +20 -13
  19. package/es/locales/i18n.db +0 -0
  20. package/es/locales/id.js +20 -13
  21. package/es/locales/ja.js +20 -13
  22. package/es/locales/ko.js +20 -13
  23. package/es/locales/pt.js +20 -13
  24. package/es/locales/ru.js +20 -13
  25. package/es/locales/th.js +20 -13
  26. package/es/locales/vi.js +20 -13
  27. package/es/locales/zh-tw.js +29 -22
  28. package/es/locales/zh.js +28 -21
  29. package/es/lost-passport.js +10 -2
  30. package/es/subscription/chip-label.js +19 -0
  31. package/lib/blocklet/app-avatar.js +7 -20
  32. package/lib/blocklet/authentication/oauth/apple.js +51 -28
  33. package/lib/blocklet/authentication/oauth/auth0.js +18 -16
  34. package/lib/blocklet/authentication/oauth/github.js +10 -13
  35. package/lib/blocklet/authentication/oauth/google.js +10 -13
  36. package/lib/blocklet/component/component-cell.js +209 -370
  37. package/lib/blocklet/component/component-info-dialog.js +253 -0
  38. package/lib/blocklet/component/index.js +16 -13
  39. package/lib/blocklet/component/store-blocklet-list.js +3 -0
  40. package/lib/blocklet/publish/connect-store-list.js +32 -3
  41. package/lib/blocklet/publish/create-release.js +9 -4
  42. package/lib/blocklet/status.js +14 -8
  43. package/lib/locales/ar.js +20 -13
  44. package/lib/locales/de.js +20 -13
  45. package/lib/locales/en.js +19 -12
  46. package/lib/locales/es.js +21 -14
  47. package/lib/locales/fr.js +20 -13
  48. package/lib/locales/hi.js +20 -13
  49. package/lib/locales/i18n.db +0 -0
  50. package/lib/locales/id.js +20 -13
  51. package/lib/locales/ja.js +20 -13
  52. package/lib/locales/ko.js +20 -13
  53. package/lib/locales/pt.js +20 -13
  54. package/lib/locales/ru.js +20 -13
  55. package/lib/locales/th.js +20 -13
  56. package/lib/locales/vi.js +20 -13
  57. package/lib/locales/zh-tw.js +29 -22
  58. package/lib/locales/zh.js +28 -21
  59. package/lib/lost-passport.js +7 -3
  60. package/lib/subscription/chip-label.js +19 -0
  61. package/package.json +16 -16
@@ -20,6 +20,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
20
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
22
22
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ const defaultValue = {
24
+ enabled: false,
25
+ teamId: '',
26
+ serviceId: '',
27
+ keyId: '',
28
+ authKey: '',
29
+ bundleId: ''
30
+ };
23
31
  function OAuthApple() {
24
32
  var _blocklet$meta, _blocklet$settings;
25
33
  const {
@@ -32,13 +40,7 @@ function OAuthApple() {
32
40
  t
33
41
  } = (0, _context.useLocaleContext)();
34
42
  const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
35
- const authData = Object.assign({
36
- enabled: false,
37
- teamId: '',
38
- serviceId: '',
39
- keyId: '',
40
- authKey: ''
41
- }, (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.apple) || {});
43
+ const authData = Object.assign(_objectSpread({}, defaultValue), (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.apple) || {});
42
44
  const {
43
45
  handleSubmit,
44
46
  control,
@@ -46,7 +48,7 @@ function OAuthApple() {
46
48
  watch,
47
49
  reset
48
50
  } = (0, _reactHookForm.useForm)({
49
- defaultValues: (0, _pick.default)(authData, ['enabled', 'teamId', 'serviceId', 'keyId', 'authKey'])
51
+ defaultValues: (0, _pick.default)(authData, Object.keys(defaultValue))
50
52
  });
51
53
  const enabled = watch('enabled');
52
54
  const onSubmit = (0, _ahooks.useMemoizedFn)(async data => {
@@ -62,13 +64,7 @@ function OAuthApple() {
62
64
  })
63
65
  }
64
66
  });
65
- const defaultValues = Object.assign({
66
- enabled: false,
67
- teamId: '',
68
- serviceId: '',
69
- keyId: '',
70
- authKey: ''
71
- }, (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.apple) || {});
67
+ const defaultValues = Object.assign(_objectSpread({}, defaultValue), (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.apple) || {});
72
68
  // 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
73
69
  reset(defaultValues);
74
70
  _Toast.default.success(t('oauth.saveSuccess'));
@@ -78,25 +74,31 @@ function OAuthApple() {
78
74
  });
79
75
  const validateTeamId = (0, _ahooks.useMemoizedFn)(val => {
80
76
  if (!(val !== null && val !== void 0 && val.trim())) {
81
- return t('oauth.apple.teamIdDescribe');
77
+ return t('oauth.apple.teamIdDescription');
82
78
  }
83
79
  return true;
84
80
  });
85
81
  const validateServiceId = (0, _ahooks.useMemoizedFn)(val => {
86
82
  if (!(val !== null && val !== void 0 && val.trim())) {
87
- return t('oauth.apple.serviceIdDescribe');
83
+ return t('oauth.apple.serviceIdDescription');
88
84
  }
89
85
  return true;
90
86
  });
91
87
  const validateKeyId = (0, _ahooks.useMemoizedFn)(val => {
92
88
  if (!(val !== null && val !== void 0 && val.trim())) {
93
- return t('oauth.apple.keyIdDescribe');
89
+ return t('oauth.apple.keyIdDescription');
94
90
  }
95
91
  return true;
96
92
  });
97
93
  const validateAuthKey = (0, _ahooks.useMemoizedFn)(val => {
98
94
  if (!(val !== null && val !== void 0 && val.trim())) {
99
- return t('oauth.apple.authKeyDescribe');
95
+ return t('oauth.apple.authKeyDescription');
96
+ }
97
+ return true;
98
+ });
99
+ const validateBundleId = (0, _ahooks.useMemoizedFn)(val => {
100
+ if (!(val !== null && val !== void 0 && val.trim())) {
101
+ return t('oauth.apple.bundleIdDescription');
100
102
  }
101
103
  return true;
102
104
  });
@@ -148,10 +150,10 @@ function OAuthApple() {
148
150
  });
149
151
  }
150
152
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
151
- name: "serviceId",
153
+ name: "bundleId",
152
154
  control: control,
153
155
  rules: {
154
- validate: enabled ? validateServiceId : noop
156
+ validate: enabled ? validateBundleId : noop
155
157
  },
156
158
  render: _ref3 => {
157
159
  var _formState$errors$fie2;
@@ -162,17 +164,17 @@ function OAuthApple() {
162
164
  fullWidth: true,
163
165
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
164
166
  error: !!formState.errors[field.name],
165
- label: t('oauth.apple.serviceId'),
167
+ label: t('oauth.apple.bundleId'),
166
168
  helperText: ((_formState$errors$fie2 = formState.errors[field.name]) === null || _formState$errors$fie2 === void 0 ? void 0 : _formState$errors$fie2.message) || ' ',
167
169
  disabled: !enabled
168
170
  }))
169
171
  });
170
172
  }
171
173
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
172
- name: "keyId",
174
+ name: "serviceId",
173
175
  control: control,
174
176
  rules: {
175
- validate: enabled ? validateKeyId : noop
177
+ validate: enabled ? validateServiceId : noop
176
178
  },
177
179
  render: _ref4 => {
178
180
  var _formState$errors$fie3;
@@ -183,23 +185,44 @@ function OAuthApple() {
183
185
  fullWidth: true,
184
186
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
185
187
  error: !!formState.errors[field.name],
186
- label: t('oauth.apple.keyId'),
188
+ label: t('oauth.apple.serviceId'),
187
189
  helperText: ((_formState$errors$fie3 = formState.errors[field.name]) === null || _formState$errors$fie3 === void 0 ? void 0 : _formState$errors$fie3.message) || ' ',
188
190
  disabled: !enabled
189
191
  }))
190
192
  });
191
193
  }
192
194
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
193
- name: "authKey",
195
+ name: "keyId",
194
196
  control: control,
195
197
  rules: {
196
- validate: enabled ? validateAuthKey : noop
198
+ validate: enabled ? validateKeyId : noop
197
199
  },
198
200
  render: _ref5 => {
199
201
  var _formState$errors$fie4;
200
202
  let {
201
203
  field
202
204
  } = _ref5;
205
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
206
+ fullWidth: true,
207
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
208
+ error: !!formState.errors[field.name],
209
+ label: t('oauth.apple.keyId'),
210
+ helperText: ((_formState$errors$fie4 = formState.errors[field.name]) === null || _formState$errors$fie4 === void 0 ? void 0 : _formState$errors$fie4.message) || ' ',
211
+ disabled: !enabled
212
+ }))
213
+ });
214
+ }
215
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
216
+ name: "authKey",
217
+ control: control,
218
+ rules: {
219
+ validate: enabled ? validateAuthKey : noop
220
+ },
221
+ render: _ref6 => {
222
+ var _formState$errors$fie5;
223
+ let {
224
+ field
225
+ } = _ref6;
203
226
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, {
204
227
  fullWidth: true,
205
228
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, _objectSpread(_objectSpread({}, field), {}, {
@@ -208,7 +231,7 @@ function OAuthApple() {
208
231
  rows: 4,
209
232
  label: t('oauth.apple.authKey'),
210
233
  error: !!formState.errors[field.name],
211
- helperText: ((_formState$errors$fie4 = formState.errors[field.name]) === null || _formState$errors$fie4 === void 0 ? void 0 : _formState$errors$fie4.message) || ' ',
234
+ helperText: ((_formState$errors$fie5 = formState.errors[field.name]) === null || _formState$errors$fie5 === void 0 ? void 0 : _formState$errors$fie5.message) || ' ',
212
235
  disabled: !enabled
213
236
  }))
214
237
  });
@@ -20,6 +20,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
20
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
22
22
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ const defaultValue = {
24
+ enabled: false,
25
+ domain: '',
26
+ clientId: '',
27
+ clientSecret: ''
28
+ };
23
29
  function OAuthAuth0() {
24
30
  var _blocklet$meta, _blocklet$settings;
25
31
  const {
@@ -32,12 +38,7 @@ function OAuthAuth0() {
32
38
  t
33
39
  } = (0, _context.useLocaleContext)();
34
40
  const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
35
- const auth0 = Object.assign({
36
- enabled: false,
37
- domain: '',
38
- clientId: '',
39
- clientSecret: ''
40
- }, (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.auth0) || {});
41
+ const auth0 = Object.assign(_objectSpread({}, defaultValue), (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.auth0) || {});
41
42
  const {
42
43
  handleSubmit,
43
44
  control,
@@ -45,7 +46,7 @@ function OAuthAuth0() {
45
46
  watch,
46
47
  reset
47
48
  } = (0, _reactHookForm.useForm)({
48
- defaultValues: (0, _pick.default)(auth0, ['domain', 'clientId', 'clientSecret', 'enabled'])
49
+ defaultValues: (0, _pick.default)(auth0, Object.keys(defaultValue))
49
50
  });
50
51
  const enabled = watch('enabled');
51
52
  const onSubmit = (0, _ahooks.useMemoizedFn)(async data => {
@@ -61,12 +62,7 @@ function OAuthAuth0() {
61
62
  })
62
63
  }
63
64
  });
64
- const defaultValues = Object.assign({
65
- enabled: false,
66
- domain: '',
67
- clientId: '',
68
- clientSecret: ''
69
- }, (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.auth0) || {});
65
+ const defaultValues = Object.assign(_objectSpread({}, defaultValue), (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.auth0) || {});
70
66
  // 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
71
67
  reset(defaultValues);
72
68
  _Toast.default.success(t('oauth.saveSuccess'));
@@ -76,13 +72,19 @@ function OAuthAuth0() {
76
72
  });
77
73
  const validateDomain = (0, _ahooks.useMemoizedFn)(val => {
78
74
  if (!(val !== null && val !== void 0 && val.trim())) {
79
- return t('oauth.auth0.domainDescribe');
75
+ return t('oauth.auth0.domainDescription');
80
76
  }
81
77
  return true;
82
78
  });
83
79
  const validateClientId = (0, _ahooks.useMemoizedFn)(val => {
84
80
  if (!(val !== null && val !== void 0 && val.trim())) {
85
- return t('oauth.auth0.clientIdDescribe');
81
+ return t('oauth.auth0.clientIdDescription');
82
+ }
83
+ return true;
84
+ });
85
+ const validateClientSecret = (0, _ahooks.useMemoizedFn)(val => {
86
+ if (!(val !== null && val !== void 0 && val.trim())) {
87
+ return t('oauth.auth0.clientSecretDescription');
86
88
  }
87
89
  return true;
88
90
  });
@@ -158,7 +160,7 @@ function OAuthAuth0() {
158
160
  name: "clientSecret",
159
161
  control: control,
160
162
  rules: {
161
- validate: noop
163
+ validate: enabled ? validateClientSecret : noop
162
164
  },
163
165
  render: _ref4 => {
164
166
  var _formState$errors$fie3;
@@ -20,6 +20,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
20
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
22
22
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ const defaultValue = {
24
+ enabled: false,
25
+ clientId: '',
26
+ clientSecret: ''
27
+ };
23
28
  function OAuthGithub() {
24
29
  var _blocklet$meta, _blocklet$settings;
25
30
  const {
@@ -33,11 +38,7 @@ function OAuthGithub() {
33
38
  } = (0, _context.useLocaleContext)();
34
39
  // TODO: @zhanghan 将来需要换成 permanent did
35
40
  const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
36
- const github = Object.assign({
37
- enabled: false,
38
- clientId: '',
39
- clientSecret: ''
40
- }, (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.github) || {});
41
+ const github = Object.assign(_objectSpread({}, defaultValue), (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.github) || {});
41
42
  const {
42
43
  handleSubmit,
43
44
  control,
@@ -45,7 +46,7 @@ function OAuthGithub() {
45
46
  watch,
46
47
  reset
47
48
  } = (0, _reactHookForm.useForm)({
48
- defaultValues: (0, _pick.default)(github, ['clientSecret', 'clientId', 'enabled'])
49
+ defaultValues: (0, _pick.default)(github, Object.keys(defaultValue))
49
50
  });
50
51
  const enabled = watch('enabled');
51
52
  const onSubmit = (0, _ahooks.useMemoizedFn)(async data => {
@@ -61,11 +62,7 @@ function OAuthGithub() {
61
62
  })
62
63
  }
63
64
  });
64
- const defaultValues = Object.assign({
65
- enabled: false,
66
- clientId: '',
67
- clientSecret: ''
68
- }, (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.github) || {});
65
+ const defaultValues = Object.assign(_objectSpread({}, defaultValue), (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.github) || {});
69
66
  // 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
70
67
  reset(defaultValues);
71
68
  _Toast.default.success(t('oauth.saveSuccess'));
@@ -75,13 +72,13 @@ function OAuthGithub() {
75
72
  });
76
73
  const validateClientId = (0, _ahooks.useMemoizedFn)(val => {
77
74
  if (!(val !== null && val !== void 0 && val.trim())) {
78
- return t('oauth.github.clientIdDescribe');
75
+ return t('oauth.github.clientIdDescription');
79
76
  }
80
77
  return true;
81
78
  });
82
79
  const validateClientSecret = (0, _ahooks.useMemoizedFn)(val => {
83
80
  if (!(val !== null && val !== void 0 && val.trim())) {
84
- return t('oauth.github.clientSecretDescribe');
81
+ return t('oauth.github.clientSecretDescription');
85
82
  }
86
83
  return true;
87
84
  });
@@ -20,6 +20,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
20
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
21
21
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
22
22
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
23
+ const defaultValue = {
24
+ enabled: false,
25
+ clientId: '',
26
+ clientSecret: ''
27
+ };
23
28
  function OAuthGoogle() {
24
29
  var _blocklet$meta, _blocklet$settings;
25
30
  const {
@@ -32,11 +37,7 @@ function OAuthGoogle() {
32
37
  t
33
38
  } = (0, _context.useLocaleContext)();
34
39
  const did = blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did;
35
- const authData = Object.assign({
36
- enabled: false,
37
- clientId: '',
38
- clientSecret: ''
39
- }, (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.google) || {});
40
+ const authData = Object.assign(_objectSpread({}, defaultValue), (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 || (_blocklet$settings = _blocklet$settings.oauth) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.google) || {});
40
41
  const {
41
42
  handleSubmit,
42
43
  control,
@@ -44,7 +45,7 @@ function OAuthGoogle() {
44
45
  watch,
45
46
  reset
46
47
  } = (0, _reactHookForm.useForm)({
47
- defaultValues: (0, _pick.default)(authData, ['clientSecret', 'clientId', 'enabled'])
48
+ defaultValues: (0, _pick.default)(authData, Object.keys(defaultValue))
48
49
  });
49
50
  const enabled = watch('enabled');
50
51
  const onSubmit = (0, _ahooks.useMemoizedFn)(async data => {
@@ -60,11 +61,7 @@ function OAuthGoogle() {
60
61
  })
61
62
  }
62
63
  });
63
- const defaultValues = Object.assign({
64
- enabled: false,
65
- clientId: '',
66
- clientSecret: ''
67
- }, (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.google) || {});
64
+ const defaultValues = Object.assign(_objectSpread({}, defaultValue), (blockletChanged === null || blockletChanged === void 0 || (_blockletChanged$sett = blockletChanged.settings) === null || _blockletChanged$sett === void 0 || (_blockletChanged$sett = _blockletChanged$sett.oauth) === null || _blockletChanged$sett === void 0 ? void 0 : _blockletChanged$sett.google) || {});
68
65
  // 将当前表单的默认值重置为新的数据,这样能够修正页面的 isDirty 数据
69
66
  reset(defaultValues);
70
67
  _Toast.default.success(t('oauth.saveSuccess'));
@@ -74,13 +71,13 @@ function OAuthGoogle() {
74
71
  });
75
72
  const validateClientId = (0, _ahooks.useMemoizedFn)(val => {
76
73
  if (!(val !== null && val !== void 0 && val.trim())) {
77
- return t('oauth.google.clientIdDescribe');
74
+ return t('oauth.google.clientIdDescription');
78
75
  }
79
76
  return true;
80
77
  });
81
78
  const validateClientSecret = (0, _ahooks.useMemoizedFn)(val => {
82
79
  if (!(val !== null && val !== void 0 && val.trim())) {
83
- return t('oauth.google.clientSecretDescribe');
80
+ return t('oauth.google.clientSecretDescription');
84
81
  }
85
82
  return true;
86
83
  });