@koraidv/core 1.7.1 → 1.7.2
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.d.mts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +32 -2
- package/dist/index.mjs +32 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -532,7 +532,22 @@ declare class ApiClient {
|
|
|
532
532
|
private readonly baseDelay;
|
|
533
533
|
constructor(configuration: Configuration);
|
|
534
534
|
/**
|
|
535
|
-
* Get supported countries and their document types
|
|
535
|
+
* Get supported countries and their document types.
|
|
536
|
+
*
|
|
537
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
538
|
+
* countries catalog is bundled into the /document-types response
|
|
539
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
540
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
541
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
542
|
+
* - `flagEmoji` derived from the ISO code
|
|
543
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
544
|
+
*
|
|
545
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
546
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
547
|
+
* previous standalone /supported-countries call had been silently
|
|
548
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
549
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
550
|
+
* wire-format pass.
|
|
536
551
|
*/
|
|
537
552
|
getSupportedCountries(): Promise<SupportedCountry[]>;
|
|
538
553
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -532,7 +532,22 @@ declare class ApiClient {
|
|
|
532
532
|
private readonly baseDelay;
|
|
533
533
|
constructor(configuration: Configuration);
|
|
534
534
|
/**
|
|
535
|
-
* Get supported countries and their document types
|
|
535
|
+
* Get supported countries and their document types.
|
|
536
|
+
*
|
|
537
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
538
|
+
* countries catalog is bundled into the /document-types response
|
|
539
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
540
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
541
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
542
|
+
* - `flagEmoji` derived from the ISO code
|
|
543
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
544
|
+
*
|
|
545
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
546
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
547
|
+
* previous standalone /supported-countries call had been silently
|
|
548
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
549
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
550
|
+
* wire-format pass.
|
|
536
551
|
*/
|
|
537
552
|
getSupportedCountries(): Promise<SupportedCountry[]>;
|
|
538
553
|
/**
|
package/dist/index.js
CHANGED
|
@@ -538,10 +538,31 @@ var ApiClient = class {
|
|
|
538
538
|
this.baseUrl = environmentUrls[configuration.environment];
|
|
539
539
|
}
|
|
540
540
|
/**
|
|
541
|
-
* Get supported countries and their document types
|
|
541
|
+
* Get supported countries and their document types.
|
|
542
|
+
*
|
|
543
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
544
|
+
* countries catalog is bundled into the /document-types response
|
|
545
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
546
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
547
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
548
|
+
* - `flagEmoji` derived from the ISO code
|
|
549
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
550
|
+
*
|
|
551
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
552
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
553
|
+
* previous standalone /supported-countries call had been silently
|
|
554
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
555
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
556
|
+
* wire-format pass.
|
|
542
557
|
*/
|
|
543
558
|
async getSupportedCountries() {
|
|
544
|
-
|
|
559
|
+
const response = await this.request("/document-types");
|
|
560
|
+
return response.countries.map((c) => ({
|
|
561
|
+
id: c.code,
|
|
562
|
+
name: c.name,
|
|
563
|
+
flagEmoji: countryCodeToFlagEmoji(c.code),
|
|
564
|
+
documentTypes: response.documentTypes.filter((dt) => dt.country === c.code).map((dt) => dt.type)
|
|
565
|
+
})).filter((country) => country.documentTypes.length > 0);
|
|
545
566
|
}
|
|
546
567
|
/**
|
|
547
568
|
* Create a new verification
|
|
@@ -839,6 +860,15 @@ function instructionForChallengeType(type) {
|
|
|
839
860
|
return "Follow the on-screen prompt";
|
|
840
861
|
}
|
|
841
862
|
}
|
|
863
|
+
function countryCodeToFlagEmoji(code) {
|
|
864
|
+
if (!code || code.length !== 2) return "";
|
|
865
|
+
const upper = code.toUpperCase();
|
|
866
|
+
const a = upper.charCodeAt(0);
|
|
867
|
+
const b = upper.charCodeAt(1);
|
|
868
|
+
if (a < 65 || a > 90 || b < 65 || b > 90) return "";
|
|
869
|
+
const offset = 127462 - 65;
|
|
870
|
+
return String.fromCodePoint(a + offset, b + offset);
|
|
871
|
+
}
|
|
842
872
|
|
|
843
873
|
// src/KoraIDV.ts
|
|
844
874
|
var KoraIDV = class {
|
package/dist/index.mjs
CHANGED
|
@@ -494,10 +494,31 @@ var ApiClient = class {
|
|
|
494
494
|
this.baseUrl = environmentUrls[configuration.environment];
|
|
495
495
|
}
|
|
496
496
|
/**
|
|
497
|
-
* Get supported countries and their document types
|
|
497
|
+
* Get supported countries and their document types.
|
|
498
|
+
*
|
|
499
|
+
* Backend has no dedicated /supported-countries endpoint — the
|
|
500
|
+
* countries catalog is bundled into the /document-types response
|
|
501
|
+
* alongside the per-type metadata. We fetch that bundled payload,
|
|
502
|
+
* then project it onto the SDK's `SupportedCountry` shape:
|
|
503
|
+
* - `id` ← `code` (ISO-3166 alpha-2)
|
|
504
|
+
* - `flagEmoji` derived from the ISO code
|
|
505
|
+
* - `documentTypes` filtered from the bundled types list by country
|
|
506
|
+
*
|
|
507
|
+
* Mirrors the iOS / Android pattern (SessionManager.fetchSupported-
|
|
508
|
+
* Countries on iOS, ApiService.getDocumentTypes on Android). The
|
|
509
|
+
* previous standalone /supported-countries call had been silently
|
|
510
|
+
* 404-ing since the Web SDK shipped — surfaced 2026-05-29 by
|
|
511
|
+
* Luckycat's integration, hot on the heels of the v1.7.1
|
|
512
|
+
* wire-format pass.
|
|
498
513
|
*/
|
|
499
514
|
async getSupportedCountries() {
|
|
500
|
-
|
|
515
|
+
const response = await this.request("/document-types");
|
|
516
|
+
return response.countries.map((c) => ({
|
|
517
|
+
id: c.code,
|
|
518
|
+
name: c.name,
|
|
519
|
+
flagEmoji: countryCodeToFlagEmoji(c.code),
|
|
520
|
+
documentTypes: response.documentTypes.filter((dt) => dt.country === c.code).map((dt) => dt.type)
|
|
521
|
+
})).filter((country) => country.documentTypes.length > 0);
|
|
501
522
|
}
|
|
502
523
|
/**
|
|
503
524
|
* Create a new verification
|
|
@@ -795,6 +816,15 @@ function instructionForChallengeType(type) {
|
|
|
795
816
|
return "Follow the on-screen prompt";
|
|
796
817
|
}
|
|
797
818
|
}
|
|
819
|
+
function countryCodeToFlagEmoji(code) {
|
|
820
|
+
if (!code || code.length !== 2) return "";
|
|
821
|
+
const upper = code.toUpperCase();
|
|
822
|
+
const a = upper.charCodeAt(0);
|
|
823
|
+
const b = upper.charCodeAt(1);
|
|
824
|
+
if (a < 65 || a > 90 || b < 65 || b > 90) return "";
|
|
825
|
+
const offset = 127462 - 65;
|
|
826
|
+
return String.fromCodePoint(a + offset, b + offset);
|
|
827
|
+
}
|
|
798
828
|
|
|
799
829
|
// src/KoraIDV.ts
|
|
800
830
|
var KoraIDV = class {
|