@springmicro/auth 0.4.1 → 0.5.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.
@@ -1,4 +1,4 @@
1
- import { i as D, t as ue, q as h, B as f, o as He, s as I, y as ce, C as ze, u as je, d as P, n as w, f as $, g as U, e as te } from "./Web3Auth-DB9s-qbl.js";
1
+ import { i as D, t as ue, q as h, B as f, o as He, s as I, y as ce, C as ze, u as je, d as P, n as w, f as $, g as U, e as te } from "./Web3Auth-D-jzK5S2.js";
2
2
  function A(e) {
3
3
  if (!Number.isSafeInteger(e) || e < 0)
4
4
  throw new Error(`Wrong positive integer: ${e}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@springmicro/auth",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -27,13 +27,9 @@
27
27
  "@typescript-eslint/eslint-plugin": "^7.14.1",
28
28
  "@typescript-eslint/parser": "^7.14.1",
29
29
  "@vitejs/plugin-react": "^4.2.1",
30
- "auth-astro": "^4.1.1",
31
30
  "eslint": "^9.5.0",
32
31
  "eslint-plugin-react-hooks": "^4.6.0",
33
32
  "eslint-plugin-react-refresh": "^0.4.6",
34
- "i18next": "^23.11.2",
35
- "i18next-browser-languagedetector": "^7.2.1",
36
- "react-i18next": "^14.1.2",
37
33
  "typescript": "^5.5.2",
38
34
  "vite": "^5.3.1",
39
35
  "vite-plugin-dts": "^3.9.0"
@@ -48,11 +44,15 @@
48
44
  "@web3-onboard/injected-wallets": "^2.10.16",
49
45
  "@web3-onboard/taho": "^2.0.5",
50
46
  "@web3-onboard/trust": "^2.0.4",
47
+ "auth-astro": "^4.1.1",
51
48
  "buffer": "^6.0.3",
49
+ "i18next": "^23.11.2",
50
+ "i18next-browser-languagedetector": "^7.2.1",
52
51
  "libphonenumber-js": "^1.10.61",
53
52
  "react-google-one-tap-login": "^0.1.1",
53
+ "react-i18next": "^14.1.2",
54
54
  "react-social-login-buttons": "^4.1.0",
55
55
  "uuid": "^9.0.1"
56
56
  },
57
- "gitHead": "53937ff954e78bc3053c107c26e1d4d0dc036ccd"
57
+ "gitHead": "e70cccb664b3229f00fd70be3f443f210124230d"
58
58
  }
@@ -23,7 +23,7 @@ type ButtonClickArgsTuple = [
23
23
  dest: any,
24
24
  type: any,
25
25
  applicationId: any,
26
- checkUser?: string,
26
+ checkUser?: string
27
27
  ];
28
28
 
29
29
  export type SendCodeInputProps = {
@@ -132,8 +132,8 @@ export const SendCodeInput = ({
132
132
  {buttonLeftTime > 0
133
133
  ? `${buttonLeftTime} s`
134
134
  : buttonLoading
135
- ? t("code.sending")
136
- : t("code.sendCode")}
135
+ ? t("code.sending")
136
+ : t("code.sendCode")}
137
137
  </button>
138
138
  </div>
139
139
  <CaptchaModal
@@ -234,9 +234,9 @@ export function renderFormItem(
234
234
  signupItem.label
235
235
  ? signupItem.label
236
236
  : signupItem.rule === "Real name" ||
237
- signupItem.rule === "First, last"
238
- ? t("general.realName")
239
- : t("general.displayName")
237
+ signupItem.rule === "First, last"
238
+ ? t("general.realName")
239
+ : t("general.displayName")
240
240
  }
241
241
  rules={[
242
242
  {
@@ -61,12 +61,14 @@ export function getApplicationsByOrganization(
61
61
 
62
62
  export function getApplication(owner: string, name: string) {
63
63
  return fetch(
64
- `${Setting.ROOT_URLS.casdoor}/api/get-application?id=${owner}/${encodeURIComponent(
65
- name
66
- )}`,
64
+ `${
65
+ Setting.ROOT_URLS.casdoor
66
+ }/api/get-application?id=${owner}/${encodeURIComponent(name)}`,
67
67
  {
68
68
  method: "GET",
69
- credentials: "include",
69
+ credentials: Setting.ROOT_URLS.casdoor.startsWith("https")
70
+ ? "include"
71
+ : undefined,
70
72
  headers: {
71
73
  "Accept-Language": Setting.getAcceptLanguage(),
72
74
  },
@@ -85,7 +85,9 @@ export function addUserKeys(user) {
85
85
  export function updateUser(owner, name, user) {
86
86
  const newUser = deepCopy(user);
87
87
  return fetch(
88
- `${ROOT_URLS.casdoor}/api/update-user?id=${owner}/${encodeURIComponent(name)}`,
88
+ `${ROOT_URLS.casdoor}/api/update-user?id=${owner}/${encodeURIComponent(
89
+ name
90
+ )}`,
89
91
  {
90
92
  method: "POST",
91
93
  credentials: "include",
@@ -183,7 +185,7 @@ export function sendCode(
183
185
  console.log(Object.fromEntries(formData.entries()));
184
186
  return fetch(`${ROOT_URLS.casdoor}/api/send-verification-code`, {
185
187
  method: "POST",
186
- credentials: "include",
188
+ credentials: ROOT_URLS.casdoor.startsWith("https") ? "include" : undefined,
187
189
  body: formData,
188
190
  headers: {
189
191
  "Accept-Language": getAcceptLanguage(),
@@ -254,7 +256,9 @@ export function resetEmailOrPhone(dest, type, code) {
254
256
 
255
257
  export function getCaptcha(owner, name, isCurrentProvider) {
256
258
  return fetch(
257
- `${ROOT_URLS.casdoor}/api/get-captcha?applicationId=${owner}/${encodeURIComponent(
259
+ `${
260
+ ROOT_URLS.casdoor
261
+ }/api/get-captcha?applicationId=${owner}/${encodeURIComponent(
258
262
  name
259
263
  )}&isCurrentProvider=${isCurrentProvider}`,
260
264
  {
@@ -166,8 +166,5 @@ export function getDefaultValues(signupItems: SignupItem[]) {
166
166
 
167
167
  export function requiresCode(signupItem: SignupItem) {
168
168
  const key = getKey(signupItem);
169
- return (
170
- (key === "email" || key === "phone") &&
171
- signupItem.rule !== "No verification"
172
- );
169
+ return (key === "email" || key === "phone") && signupItem.rule !== "None";
173
170
  }