@opexa/portal-components 0.1.1 → 0.1.4

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.
@@ -105,6 +105,14 @@ const KnownErrorSchema = z
105
105
  message: z.string().optional(),
106
106
  })
107
107
  .optional(),
108
+ // Shape returned by the Inplay `/v3/inplay/sessions` endpoint, e.g.:
109
+ // { "error": { "type": "INVALID_CREDENTIALS", "message": "..." } }
110
+ error: z
111
+ .object({
112
+ type: z.string().optional(),
113
+ message: z.string().optional(),
114
+ })
115
+ .optional(),
108
116
  })
109
117
  .nullable()
110
118
  .catch(null)
@@ -118,6 +126,9 @@ const KnownErrorSchema = z
118
126
  v.message ??
119
127
  null);
120
128
  }
129
+ if (v?.error) {
130
+ return v.error.type ?? v.error.message ?? null;
131
+ }
121
132
  return v?.code ?? v?.message ?? null;
122
133
  });
123
134
  function getErrorMessage(code) {
@@ -135,6 +146,7 @@ function getErrorMessage(code) {
135
146
  case 'NOT_READY_TO_SEND_VERIFICATION_ERROR':
136
147
  return 'Not ready to send verification code';
137
148
  case 'Forbidden':
149
+ case 'INVALID_CREDENTIALS':
138
150
  return 'Invalid username or password. Please try again.';
139
151
  default:
140
152
  return 'Something went wrong. Please try again later.';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.1.1",
3
+ "version": "0.1.4",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",