@koraidv/react 1.8.2 → 1.8.3

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/dist/index.js CHANGED
@@ -3109,11 +3109,28 @@ function ResultScreen({ verification, onDone, onRetry, resultPageMode, simplifie
3109
3109
  case "approved":
3110
3110
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SimplifiedSuccess, { onDone, customMessages });
3111
3111
  case "rejected":
3112
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SimplifiedFailed, { onRetry: onRetry || onDone, customMessages });
3112
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3113
+ SimplifiedFailed,
3114
+ {
3115
+ verification,
3116
+ onRetry: onRetry || onDone,
3117
+ customMessages
3118
+ }
3119
+ );
3113
3120
  case "review_required":
3114
3121
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SimplifiedReview, { verification, onDone, customMessages });
3115
3122
  case "expired":
3116
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SimplifiedFailed, { onRetry: onRetry || onDone, customMessages: { failedTitle: "Document Expired", failedMessage: "The document you submitted has expired. Please use a valid document." } });
3123
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3124
+ SimplifiedFailed,
3125
+ {
3126
+ verification,
3127
+ onRetry: onRetry || onDone,
3128
+ customMessages: {
3129
+ failedTitle: "Document Expired",
3130
+ failedMessage: "The document you submitted has expired. Please use a valid document."
3131
+ }
3132
+ }
3133
+ );
3117
3134
  default:
3118
3135
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SimplifiedSuccess, { onDone, customMessages });
3119
3136
  }
@@ -3175,9 +3192,6 @@ function SuccessResult({ verification, onDone }) {
3175
3192
  ] });
3176
3193
  }
3177
3194
  function RejectedResult({ verification, onRetry }) {
3178
- const score = Math.round(
3179
- verification.scores?.overall ?? 100 - (verification.riskScore ?? 58)
3180
- );
3181
3195
  const metrics = computeScoreBreakdown(verification);
3182
3196
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: styles.resultContainer, children: [
3183
3197
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: styles.resultContent, children: [
@@ -3203,13 +3217,45 @@ function RejectedResult({ verification, onRetry }) {
3203
3217
  }
3204
3218
  ),
3205
3219
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { style: styles.resultTitle, children: "Verification rejected" }),
3206
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { style: styles.resultSubtitle, children: "We could not verify your identity. Please try again with a valid document." }),
3207
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3208
- ScoreCard,
3220
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3221
+ "div",
3209
3222
  {
3210
- score,
3211
- badge: "REJECTED",
3212
- gradient: `linear-gradient(135deg, ${colors.error}, #B91C1C)`
3223
+ style: {
3224
+ margin: "16px 0",
3225
+ padding: "16px 20px",
3226
+ borderRadius: "12px",
3227
+ backgroundColor: `${colors.error}10`,
3228
+ border: `1px solid ${colors.error}40`
3229
+ },
3230
+ children: [
3231
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3232
+ "p",
3233
+ {
3234
+ style: {
3235
+ margin: 0,
3236
+ fontSize: "13px",
3237
+ fontWeight: 600,
3238
+ letterSpacing: "0.06em",
3239
+ textTransform: "uppercase",
3240
+ color: colors.error,
3241
+ marginBottom: 6
3242
+ },
3243
+ children: "Reason for rejection"
3244
+ }
3245
+ ),
3246
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3247
+ "p",
3248
+ {
3249
+ style: {
3250
+ margin: 0,
3251
+ fontSize: "15px",
3252
+ lineHeight: 1.45,
3253
+ color: colors.textPrimary
3254
+ },
3255
+ children: verification.decisionReason || verification.rejectionReason || "We could not verify your identity. Please try again with a valid document."
3256
+ }
3257
+ )
3258
+ ]
3213
3259
  }
3214
3260
  ),
3215
3261
  metrics.map((m, i) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScoreMetricRow, { ...m }, i))
@@ -3243,7 +3289,7 @@ function ExpiredResult({ verification, onRetry }) {
3243
3289
  }
3244
3290
  ),
3245
3291
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { style: styles.resultTitle, children: "Document expired" }),
3246
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { style: styles.resultSubtitle, children: "The document you submitted has expired. Please use a valid, non-expired document." }),
3292
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { style: styles.resultSubtitle, children: verification.decisionReason || verification.rejectionReason || "The document you submitted has expired. Please use a valid, non-expired document." }),
3247
3293
  verification.documentVerification && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: styles.expiryCard, children: [
3248
3294
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: styles.expiryRow, children: [
3249
3295
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { style: styles.expiryLabel, children: "Document type" }),
@@ -3352,7 +3398,13 @@ function SimplifiedSuccess({ onDone, customMessages }) {
3352
3398
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: styles.footer, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { style: styles.primaryButton, onClick: onDone, children: "Continue" }) })
3353
3399
  ] });
3354
3400
  }
3355
- function SimplifiedFailed({ onRetry, customMessages }) {
3401
+ function SimplifiedFailed({
3402
+ verification,
3403
+ onRetry,
3404
+ customMessages
3405
+ }) {
3406
+ const backendReason = verification?.decisionReason || verification?.rejectionReason || "";
3407
+ const message = customMessages?.failedMessage || backendReason || "We could not verify your identity. Please try again with a valid document.";
3356
3408
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: styles.resultContainer, children: [
3357
3409
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: { ...styles.resultContent, textAlign: "center" }, children: [
3358
3410
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
@@ -3382,7 +3434,19 @@ function SimplifiedFailed({ onRetry, customMessages }) {
3382
3434
  }
3383
3435
  ),
3384
3436
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { style: { ...styles.resultTitle, fontSize: 24, marginTop: 16 }, children: customMessages?.failedTitle || "Verification Failed" }),
3385
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { style: { ...styles.resultSubtitle, fontSize: 16, maxWidth: 320, margin: "8px auto 0" }, children: customMessages?.failedMessage || "We could not verify your identity. Please try again with a valid document." })
3437
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3438
+ "p",
3439
+ {
3440
+ style: {
3441
+ ...styles.resultSubtitle,
3442
+ fontSize: 16,
3443
+ maxWidth: 380,
3444
+ margin: "8px auto 0",
3445
+ lineHeight: 1.45
3446
+ },
3447
+ children: message
3448
+ }
3449
+ )
3386
3450
  ] }),
3387
3451
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: styles.footer, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { style: styles.primaryButton, onClick: onRetry, children: "Try Again" }) })
3388
3452
  ] });
package/dist/index.mjs CHANGED
@@ -3060,11 +3060,28 @@ function ResultScreen({ verification, onDone, onRetry, resultPageMode, simplifie
3060
3060
  case "approved":
3061
3061
  return /* @__PURE__ */ jsx11(SimplifiedSuccess, { onDone, customMessages });
3062
3062
  case "rejected":
3063
- return /* @__PURE__ */ jsx11(SimplifiedFailed, { onRetry: onRetry || onDone, customMessages });
3063
+ return /* @__PURE__ */ jsx11(
3064
+ SimplifiedFailed,
3065
+ {
3066
+ verification,
3067
+ onRetry: onRetry || onDone,
3068
+ customMessages
3069
+ }
3070
+ );
3064
3071
  case "review_required":
3065
3072
  return /* @__PURE__ */ jsx11(SimplifiedReview, { verification, onDone, customMessages });
3066
3073
  case "expired":
3067
- return /* @__PURE__ */ jsx11(SimplifiedFailed, { onRetry: onRetry || onDone, customMessages: { failedTitle: "Document Expired", failedMessage: "The document you submitted has expired. Please use a valid document." } });
3074
+ return /* @__PURE__ */ jsx11(
3075
+ SimplifiedFailed,
3076
+ {
3077
+ verification,
3078
+ onRetry: onRetry || onDone,
3079
+ customMessages: {
3080
+ failedTitle: "Document Expired",
3081
+ failedMessage: "The document you submitted has expired. Please use a valid document."
3082
+ }
3083
+ }
3084
+ );
3068
3085
  default:
3069
3086
  return /* @__PURE__ */ jsx11(SimplifiedSuccess, { onDone, customMessages });
3070
3087
  }
@@ -3126,9 +3143,6 @@ function SuccessResult({ verification, onDone }) {
3126
3143
  ] });
3127
3144
  }
3128
3145
  function RejectedResult({ verification, onRetry }) {
3129
- const score = Math.round(
3130
- verification.scores?.overall ?? 100 - (verification.riskScore ?? 58)
3131
- );
3132
3146
  const metrics = computeScoreBreakdown(verification);
3133
3147
  return /* @__PURE__ */ jsxs10("div", { style: styles.resultContainer, children: [
3134
3148
  /* @__PURE__ */ jsxs10("div", { style: styles.resultContent, children: [
@@ -3154,13 +3168,45 @@ function RejectedResult({ verification, onRetry }) {
3154
3168
  }
3155
3169
  ),
3156
3170
  /* @__PURE__ */ jsx11("h1", { style: styles.resultTitle, children: "Verification rejected" }),
3157
- /* @__PURE__ */ jsx11("p", { style: styles.resultSubtitle, children: "We could not verify your identity. Please try again with a valid document." }),
3158
- /* @__PURE__ */ jsx11(
3159
- ScoreCard,
3171
+ /* @__PURE__ */ jsxs10(
3172
+ "div",
3160
3173
  {
3161
- score,
3162
- badge: "REJECTED",
3163
- gradient: `linear-gradient(135deg, ${colors.error}, #B91C1C)`
3174
+ style: {
3175
+ margin: "16px 0",
3176
+ padding: "16px 20px",
3177
+ borderRadius: "12px",
3178
+ backgroundColor: `${colors.error}10`,
3179
+ border: `1px solid ${colors.error}40`
3180
+ },
3181
+ children: [
3182
+ /* @__PURE__ */ jsx11(
3183
+ "p",
3184
+ {
3185
+ style: {
3186
+ margin: 0,
3187
+ fontSize: "13px",
3188
+ fontWeight: 600,
3189
+ letterSpacing: "0.06em",
3190
+ textTransform: "uppercase",
3191
+ color: colors.error,
3192
+ marginBottom: 6
3193
+ },
3194
+ children: "Reason for rejection"
3195
+ }
3196
+ ),
3197
+ /* @__PURE__ */ jsx11(
3198
+ "p",
3199
+ {
3200
+ style: {
3201
+ margin: 0,
3202
+ fontSize: "15px",
3203
+ lineHeight: 1.45,
3204
+ color: colors.textPrimary
3205
+ },
3206
+ children: verification.decisionReason || verification.rejectionReason || "We could not verify your identity. Please try again with a valid document."
3207
+ }
3208
+ )
3209
+ ]
3164
3210
  }
3165
3211
  ),
3166
3212
  metrics.map((m, i) => /* @__PURE__ */ jsx11(ScoreMetricRow, { ...m }, i))
@@ -3194,7 +3240,7 @@ function ExpiredResult({ verification, onRetry }) {
3194
3240
  }
3195
3241
  ),
3196
3242
  /* @__PURE__ */ jsx11("h1", { style: styles.resultTitle, children: "Document expired" }),
3197
- /* @__PURE__ */ jsx11("p", { style: styles.resultSubtitle, children: "The document you submitted has expired. Please use a valid, non-expired document." }),
3243
+ /* @__PURE__ */ jsx11("p", { style: styles.resultSubtitle, children: verification.decisionReason || verification.rejectionReason || "The document you submitted has expired. Please use a valid, non-expired document." }),
3198
3244
  verification.documentVerification && /* @__PURE__ */ jsxs10("div", { style: styles.expiryCard, children: [
3199
3245
  /* @__PURE__ */ jsxs10("div", { style: styles.expiryRow, children: [
3200
3246
  /* @__PURE__ */ jsx11("span", { style: styles.expiryLabel, children: "Document type" }),
@@ -3303,7 +3349,13 @@ function SimplifiedSuccess({ onDone, customMessages }) {
3303
3349
  /* @__PURE__ */ jsx11("div", { style: styles.footer, children: /* @__PURE__ */ jsx11("button", { style: styles.primaryButton, onClick: onDone, children: "Continue" }) })
3304
3350
  ] });
3305
3351
  }
3306
- function SimplifiedFailed({ onRetry, customMessages }) {
3352
+ function SimplifiedFailed({
3353
+ verification,
3354
+ onRetry,
3355
+ customMessages
3356
+ }) {
3357
+ const backendReason = verification?.decisionReason || verification?.rejectionReason || "";
3358
+ const message = customMessages?.failedMessage || backendReason || "We could not verify your identity. Please try again with a valid document.";
3307
3359
  return /* @__PURE__ */ jsxs10("div", { style: styles.resultContainer, children: [
3308
3360
  /* @__PURE__ */ jsxs10("div", { style: { ...styles.resultContent, textAlign: "center" }, children: [
3309
3361
  /* @__PURE__ */ jsx11(
@@ -3333,7 +3385,19 @@ function SimplifiedFailed({ onRetry, customMessages }) {
3333
3385
  }
3334
3386
  ),
3335
3387
  /* @__PURE__ */ jsx11("h1", { style: { ...styles.resultTitle, fontSize: 24, marginTop: 16 }, children: customMessages?.failedTitle || "Verification Failed" }),
3336
- /* @__PURE__ */ jsx11("p", { style: { ...styles.resultSubtitle, fontSize: 16, maxWidth: 320, margin: "8px auto 0" }, children: customMessages?.failedMessage || "We could not verify your identity. Please try again with a valid document." })
3388
+ /* @__PURE__ */ jsx11(
3389
+ "p",
3390
+ {
3391
+ style: {
3392
+ ...styles.resultSubtitle,
3393
+ fontSize: 16,
3394
+ maxWidth: 380,
3395
+ margin: "8px auto 0",
3396
+ lineHeight: 1.45
3397
+ },
3398
+ children: message
3399
+ }
3400
+ )
3337
3401
  ] }),
3338
3402
  /* @__PURE__ */ jsx11("div", { style: styles.footer, children: /* @__PURE__ */ jsx11("button", { style: styles.primaryButton, onClick: onRetry, children: "Try Again" }) })
3339
3403
  ] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koraidv/react",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "Kora IDV React Components for Identity Verification",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -21,7 +21,7 @@
21
21
  "test": "vitest run"
22
22
  },
23
23
  "dependencies": {
24
- "@koraidv/core": "^1.8.2"
24
+ "@koraidv/core": "^1.8.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "^18.2.0",