@shipfox/client-auth 11.0.0 → 12.0.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,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 42 files with swc (394.18ms)
2
+ Successfully compiled: 42 files with swc (282.3ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @shipfox/client-auth
2
2
 
3
+ ## 12.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 0087553: Render configured signup-gate denial messages in the Auth client.
8
+ - Updated dependencies [95d1456]
9
+ - Updated dependencies [0773b85]
10
+ - Updated dependencies [07e7371]
11
+ - @shipfox/api-auth-dto@10.2.0
12
+ - @shipfox/api-workspaces-dto@10.2.0
13
+ - @shipfox/client-invitations@12.0.1
14
+ - @shipfox/client-shell@12.0.1
15
+
16
+ ## 12.0.0
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [fb34b6a]
21
+ - Updated dependencies [96ae951]
22
+ - @shipfox/api-auth-dto@10.1.0
23
+ - @shipfox/client-shell@12.0.0
24
+ - @shipfox/client-invitations@12.0.0
25
+
3
26
  ## 11.0.0
4
27
 
5
28
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"form-utils.d.ts","sourceRoot":"","sources":["../../src/pages/form-utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA0BvD"}
1
+ {"version":3,"file":"form-utils.d.ts","sourceRoot":"","sources":["../../src/pages/form-utils.ts"],"names":[],"mappings":"AAcA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA4BvD"}
@@ -1,4 +1,14 @@
1
1
  import { ApiError } from '@shipfox/client-api';
2
+ function isRecord(value) {
3
+ return typeof value === 'object' && value !== null;
4
+ }
5
+ function signupNotAllowedMessage(error) {
6
+ if (error.code !== 'signup-not-allowed') return undefined;
7
+ if (!isRecord(error.details)) return undefined;
8
+ const details = error.details.details;
9
+ if (!isRecord(details)) return undefined;
10
+ return typeof details.message === 'string' ? details.message : undefined;
11
+ }
2
12
  export function authErrorMessage(error) {
3
13
  if (!(error instanceof ApiError)) return 'Something went wrong. Try again.';
4
14
  if (error.code === 'invalid-credentials') {
@@ -22,6 +32,8 @@ export function authErrorMessage(error) {
22
32
  if (error.code === 'network-error') {
23
33
  return 'We could not reach the API. Check your connection and try again.';
24
34
  }
35
+ const signupMessage = signupNotAllowedMessage(error);
36
+ if (signupMessage) return signupMessage;
25
37
  return error.message || 'Something went wrong. Try again.';
26
38
  }
27
39
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/pages/form-utils.ts"],"sourcesContent":["import {ApiError} from '@shipfox/client-api';\n\nexport function authErrorMessage(error: unknown): string {\n if (!(error instanceof ApiError)) return 'Something went wrong. Try again.';\n\n if (error.code === 'invalid-credentials') {\n return 'Email or password is incorrect.';\n }\n if (error.code === 'email-not-verified') {\n return 'Verify your email before signing in.';\n }\n if (error.code === 'email-taken') {\n return 'An account already exists for this email.';\n }\n if (error.code === 'token-invalid') {\n return 'This link is invalid or expired.';\n }\n if (error.code === 'rate-limited') {\n return 'Too many attempts. Wait a bit and try again.';\n }\n if (error.code === 'auth-rate-limit-unavailable') {\n return 'Sign-in is temporarily unavailable. Try again soon.';\n }\n if (error.code === 'network-error') {\n return 'We could not reach the API. Check your connection and try again.';\n }\n\n return error.message || 'Something went wrong. Try again.';\n}\n"],"names":["ApiError","authErrorMessage","error","code","message"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,sBAAsB;AAE7C,OAAO,SAASC,iBAAiBC,KAAc;IAC7C,IAAI,CAAEA,CAAAA,iBAAiBF,QAAO,GAAI,OAAO;IAEzC,IAAIE,MAAMC,IAAI,KAAK,uBAAuB;QACxC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,sBAAsB;QACvC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,eAAe;QAChC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,iBAAiB;QAClC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,gBAAgB;QACjC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,+BAA+B;QAChD,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,iBAAiB;QAClC,OAAO;IACT;IAEA,OAAOD,MAAME,OAAO,IAAI;AAC1B"}
1
+ {"version":3,"sources":["../../src/pages/form-utils.ts"],"sourcesContent":["import {ApiError} from '@shipfox/client-api';\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction signupNotAllowedMessage(error: ApiError): string | undefined {\n if (error.code !== 'signup-not-allowed') return undefined;\n if (!isRecord(error.details)) return undefined;\n const details = error.details.details;\n if (!isRecord(details)) return undefined;\n return typeof details.message === 'string' ? details.message : undefined;\n}\n\nexport function authErrorMessage(error: unknown): string {\n if (!(error instanceof ApiError)) return 'Something went wrong. Try again.';\n\n if (error.code === 'invalid-credentials') {\n return 'Email or password is incorrect.';\n }\n if (error.code === 'email-not-verified') {\n return 'Verify your email before signing in.';\n }\n if (error.code === 'email-taken') {\n return 'An account already exists for this email.';\n }\n if (error.code === 'token-invalid') {\n return 'This link is invalid or expired.';\n }\n if (error.code === 'rate-limited') {\n return 'Too many attempts. Wait a bit and try again.';\n }\n if (error.code === 'auth-rate-limit-unavailable') {\n return 'Sign-in is temporarily unavailable. Try again soon.';\n }\n if (error.code === 'network-error') {\n return 'We could not reach the API. Check your connection and try again.';\n }\n\n const signupMessage = signupNotAllowedMessage(error);\n if (signupMessage) return signupMessage;\n return error.message || 'Something went wrong. Try again.';\n}\n"],"names":["ApiError","isRecord","value","signupNotAllowedMessage","error","code","undefined","details","message","authErrorMessage","signupMessage"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,sBAAsB;AAE7C,SAASC,SAASC,KAAc;IAC9B,OAAO,OAAOA,UAAU,YAAYA,UAAU;AAChD;AAEA,SAASC,wBAAwBC,KAAe;IAC9C,IAAIA,MAAMC,IAAI,KAAK,sBAAsB,OAAOC;IAChD,IAAI,CAACL,SAASG,MAAMG,OAAO,GAAG,OAAOD;IACrC,MAAMC,UAAUH,MAAMG,OAAO,CAACA,OAAO;IACrC,IAAI,CAACN,SAASM,UAAU,OAAOD;IAC/B,OAAO,OAAOC,QAAQC,OAAO,KAAK,WAAWD,QAAQC,OAAO,GAAGF;AACjE;AAEA,OAAO,SAASG,iBAAiBL,KAAc;IAC7C,IAAI,CAAEA,CAAAA,iBAAiBJ,QAAO,GAAI,OAAO;IAEzC,IAAII,MAAMC,IAAI,KAAK,uBAAuB;QACxC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,sBAAsB;QACvC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,eAAe;QAChC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,iBAAiB;QAClC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,gBAAgB;QACjC,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,+BAA+B;QAChD,OAAO;IACT;IACA,IAAID,MAAMC,IAAI,KAAK,iBAAiB;QAClC,OAAO;IACT;IAEA,MAAMK,gBAAgBP,wBAAwBC;IAC9C,IAAIM,eAAe,OAAOA;IAC1B,OAAON,MAAMI,OAAO,IAAI;AAC1B"}