gbc-kyc-kit 3.4.1 → 3.4.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.
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
1
7
  import * as React$2 from "react";
2
8
  import React__default$1, { forwardRef, useEffect, useReducer, useState, useRef, isValidElement, cloneElement, useLayoutEffect, useContext, Children, createElement, useCallback } from "react";
3
9
  import * as ReactDOM from "react-dom";
@@ -42657,7 +42663,7 @@ const V2OcrComponent = ({
42657
42663
  });
42658
42664
  };
42659
42665
  const name = "gbc-kyc-kit";
42660
- const version = "3.4.1";
42666
+ const version = "3.4.2";
42661
42667
  const description = "Componentes para el desarrollo de un Onboarding";
42662
42668
  const license = "MIT";
42663
42669
  const author = "Global Bridge Connections";
@@ -42709,6 +42715,7 @@ const eslintConfig = {
42709
42715
  }
42710
42716
  };
42711
42717
  const dependencies = {
42718
+ "@didit-protocol/sdk-web": "^0.1.8",
42712
42719
  "@emotion/react": "^11.10.6",
42713
42720
  "@emotion/styled": "^11.10.6",
42714
42721
  "@fontsource/roboto": "^4.5.8",
@@ -42726,7 +42733,7 @@ const dependencies = {
42726
42733
  "comma-separated-values": "^3.6.4",
42727
42734
  eslint: "^8.18.0",
42728
42735
  "eslint-plugin-react": "^7.30.1",
42729
- "gbc-kyc-kit": "^3.4.0",
42736
+ "gbc-kyc-kit": "^3.4.1",
42730
42737
  "image-compressor.js": "^1.1.4",
42731
42738
  "image-js": "^0.37.0",
42732
42739
  "is-empty": "^1.2.0",
@@ -44899,6 +44906,1324 @@ lib.useDeviceData = useDeviceData;
44899
44906
  lib.useDeviceSelectors = useDeviceSelectors;
44900
44907
  lib.useMobileOrientation = useMobileOrientation;
44901
44908
  lib.withOrientationChange = withOrientationChange;
44909
+ const DEFAULT_CONFIG = {
44910
+ zIndex: 9999,
44911
+ showCloseButton: true,
44912
+ showExitConfirmation: true,
44913
+ loggingEnabled: false,
44914
+ closeModalOnComplete: false
44915
+ };
44916
+ const CSS_CLASSES = {
44917
+ overlay: "didit-modal-overlay",
44918
+ container: "didit-modal-container",
44919
+ content: "didit-modal-content",
44920
+ iframe: "didit-verification-iframe",
44921
+ closeButton: "didit-close-button",
44922
+ loading: "didit-loading",
44923
+ confirmOverlay: "didit-confirm-overlay",
44924
+ confirmBox: "didit-confirm-box",
44925
+ embedded: "didit-embedded"
44926
+ };
44927
+ const languages = [
44928
+ "ar",
44929
+ "bg",
44930
+ "bn",
44931
+ "ca",
44932
+ "cnr",
44933
+ "cs",
44934
+ "da",
44935
+ "de",
44936
+ "el",
44937
+ "en",
44938
+ "es",
44939
+ "et",
44940
+ "fa",
44941
+ "fi",
44942
+ "fr",
44943
+ "he",
44944
+ "hi",
44945
+ "hr",
44946
+ "hu",
44947
+ "hy",
44948
+ "id",
44949
+ "it",
44950
+ "ja",
44951
+ "ka",
44952
+ "ko",
44953
+ "lt",
44954
+ "lv",
44955
+ "mk",
44956
+ "ms",
44957
+ "nl",
44958
+ "no",
44959
+ "pl",
44960
+ "pt-BR",
44961
+ "pt",
44962
+ "ro",
44963
+ "ru",
44964
+ "sk",
44965
+ "sl",
44966
+ "so",
44967
+ "sr",
44968
+ "sv",
44969
+ "th",
44970
+ "tr",
44971
+ "uk",
44972
+ "uz",
44973
+ "vi",
44974
+ "zh-CN",
44975
+ "zh-TW",
44976
+ "zh"
44977
+ ];
44978
+ class SDKLogger {
44979
+ static get isEnabled() {
44980
+ return this._enabled;
44981
+ }
44982
+ static set isEnabled(value) {
44983
+ this._enabled = value;
44984
+ }
44985
+ static log(...args) {
44986
+ if (this._enabled) {
44987
+ console.log("[DiditSDK]", ...args);
44988
+ }
44989
+ }
44990
+ static warn(...args) {
44991
+ if (this._enabled) {
44992
+ console.warn("[DiditSDK]", ...args);
44993
+ }
44994
+ }
44995
+ static error(...args) {
44996
+ if (this._enabled) {
44997
+ console.error("[DiditSDK]", ...args);
44998
+ }
44999
+ }
45000
+ }
45001
+ __publicField(SDKLogger, "_enabled", false);
45002
+ function generateModalId() {
45003
+ return `didit-modal-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
45004
+ }
45005
+ function isAllowedOrigin(origin) {
45006
+ try {
45007
+ const url = new URL(origin);
45008
+ return url.hostname.endsWith(".didit.me");
45009
+ } catch {
45010
+ return false;
45011
+ }
45012
+ }
45013
+ function createVerificationError(type, customMessage) {
45014
+ const messages = {
45015
+ sessionExpired: "La sesi\xF3n de verificaci\xF3n ha expirado.",
45016
+ networkError: "Un error de red ha ocurrido. Por favor, intenta de nuevo.",
45017
+ cameraAccessDenied: "El acceso a la c\xE1mara es necesario para la verificaci\xF3n.",
45018
+ unknown: customMessage || "Un error desconocido ha ocurrido."
45019
+ };
45020
+ return {
45021
+ type,
45022
+ message: customMessage || messages[type]
45023
+ };
45024
+ }
45025
+ function detectLanguageFromUrl(url) {
45026
+ try {
45027
+ const { pathname } = new URL(url);
45028
+ const firstSegment = pathname.split("/").filter(Boolean)[0];
45029
+ if (firstSegment && languages.includes(firstSegment)) {
45030
+ return firstSegment;
45031
+ }
45032
+ } catch {
45033
+ }
45034
+ const browserLang = navigator.language;
45035
+ if (languages.includes(browserLang))
45036
+ return browserLang;
45037
+ const baseLang = browserLang.split("-")[0];
45038
+ if (languages.includes(baseLang))
45039
+ return baseLang;
45040
+ return "es";
45041
+ }
45042
+ const EN = {
45043
+ exitTitle: "Exit verification?",
45044
+ exitMessage: "Exiting will end your verification process. Are you sure?",
45045
+ continueButton: "Continue",
45046
+ exitButton: "Exit",
45047
+ ariaLabelModal: "Didit Verification",
45048
+ ariaLabelClose: "Close verification"
45049
+ };
45050
+ const translationsMap = {
45051
+ ar: {
45052
+ exitTitle: "\u0627\u0644\u062E\u0631\u0648\u062C \u0645\u0646 \u0627\u0644\u062A\u062D\u0642\u0642\u061F",
45053
+ exitMessage: "\u0633\u064A\u0624\u062F\u064A \u0627\u0644\u062E\u0631\u0648\u062C \u0625\u0644\u0649 \u0625\u0646\u0647\u0627\u0621 \u0639\u0645\u0644\u064A\u0629 \u0627\u0644\u062A\u062D\u0642\u0642 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643. \u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F\u061F",
45054
+ continueButton: "\u0645\u062A\u0627\u0628\u0639\u0629",
45055
+ exitButton: "\u062E\u0631\u0648\u062C",
45056
+ ariaLabelModal: "\u0627\u0644\u062A\u062D\u0642\u0642 \u0645\u0646 Didit",
45057
+ ariaLabelClose: "\u0625\u063A\u0644\u0627\u0642 \u0627\u0644\u062A\u062D\u0642\u0642"
45058
+ },
45059
+ bg: {
45060
+ exitTitle: "\u0418\u0437\u043B\u0438\u0437\u0430\u043D\u0435 \u043E\u0442 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F\u0442\u0430?",
45061
+ exitMessage: "\u0418\u0437\u043B\u0438\u0437\u0430\u043D\u0435\u0442\u043E \u0449\u0435 \u043F\u0440\u0435\u043A\u0440\u0430\u0442\u0438 \u043F\u0440\u043E\u0446\u0435\u0441\u0430 \u043D\u0430 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F. \u0421\u0438\u0433\u0443\u0440\u043D\u0438 \u043B\u0438 \u0441\u0442\u0435?",
45062
+ continueButton: "\u041F\u0440\u043E\u0434\u044A\u043B\u0436\u0438",
45063
+ exitButton: "\u0418\u0437\u0445\u043E\u0434",
45064
+ ariaLabelModal: "\u0412\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F Didit",
45065
+ ariaLabelClose: "\u0417\u0430\u0442\u0432\u0430\u0440\u044F\u043D\u0435 \u043D\u0430 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F\u0442\u0430"
45066
+ },
45067
+ bn: {
45068
+ exitTitle: "\u09AF\u09BE\u099A\u09BE\u0987\u0995\u09B0\u09A3 \u09A5\u09C7\u0995\u09C7 \u09AC\u09C7\u09B0 \u09B9\u09AC\u09C7\u09A8?",
45069
+ exitMessage: "\u09AC\u09C7\u09B0 \u09B9\u09B2\u09C7 \u0986\u09AA\u09A8\u09BE\u09B0 \u09AF\u09BE\u099A\u09BE\u0987\u0995\u09B0\u09A3 \u09AA\u09CD\u09B0\u0995\u09CD\u09B0\u09BF\u09AF\u09BC\u09BE \u09B6\u09C7\u09B7 \u09B9\u09AF\u09BC\u09C7 \u09AF\u09BE\u09AC\u09C7\u0964 \u0986\u09AA\u09A8\u09BF \u0995\u09BF \u09A8\u09BF\u09B6\u09CD\u099A\u09BF\u09A4?",
45070
+ continueButton: "\u099A\u09BE\u09B2\u09BF\u09AF\u09BC\u09C7 \u09AF\u09BE\u09A8",
45071
+ exitButton: "\u09AC\u09C7\u09B0 \u09B9\u09A8",
45072
+ ariaLabelModal: "Didit \u09AF\u09BE\u099A\u09BE\u0987\u0995\u09B0\u09A3",
45073
+ ariaLabelClose: "\u09AF\u09BE\u099A\u09BE\u0987\u0995\u09B0\u09A3 \u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8"
45074
+ },
45075
+ ca: {
45076
+ exitTitle: "Sortir de la verificaci\xF3?",
45077
+ exitMessage: "Sortir finalitzar\xE0 el proc\xE9s de verificaci\xF3. N'esteu segur?",
45078
+ continueButton: "Continua",
45079
+ exitButton: "Sortir",
45080
+ ariaLabelModal: "Verificaci\xF3 Didit",
45081
+ ariaLabelClose: "Tancar verificaci\xF3"
45082
+ },
45083
+ cnr: {
45084
+ exitTitle: "Iza\u0107i iz verifikacije?",
45085
+ exitMessage: "Izlaskom \u0107ete prekinuti proces verifikacije. Jeste li sigurni?",
45086
+ continueButton: "Nastavi",
45087
+ exitButton: "Iza\u0111i",
45088
+ ariaLabelModal: "Didit verifikacija",
45089
+ ariaLabelClose: "Zatvori verifikaciju"
45090
+ },
45091
+ cs: {
45092
+ exitTitle: "Opustit ov\u011B\u0159en\xED?",
45093
+ exitMessage: "Odchodem ukon\u010D\xEDte proces ov\u011B\u0159en\xED. Jste si jisti?",
45094
+ continueButton: "Pokra\u010Dovat",
45095
+ exitButton: "Odej\xEDt",
45096
+ ariaLabelModal: "Ov\u011B\u0159en\xED Didit",
45097
+ ariaLabelClose: "Zav\u0159\xEDt ov\u011B\u0159en\xED"
45098
+ },
45099
+ da: {
45100
+ exitTitle: "Forlad verifikation?",
45101
+ exitMessage: "Hvis du forlader, afsluttes din verifikationsproces. Er du sikker?",
45102
+ continueButton: "Forts\xE6t",
45103
+ exitButton: "Forlad",
45104
+ ariaLabelModal: "Didit-verifikation",
45105
+ ariaLabelClose: "Luk verifikation"
45106
+ },
45107
+ de: {
45108
+ exitTitle: "Verifizierung verlassen?",
45109
+ exitMessage: "Das Verlassen beendet Ihren Verifizierungsprozess. Sind Sie sicher?",
45110
+ continueButton: "Fortfahren",
45111
+ exitButton: "Verlassen",
45112
+ ariaLabelModal: "Didit-Verifizierung",
45113
+ ariaLabelClose: "Verifizierung schlie\xDFen"
45114
+ },
45115
+ el: {
45116
+ exitTitle: "\u0388\u03BE\u03BF\u03B4\u03BF\u03C2 \u03B1\u03C0\u03CC \u03C4\u03B7\u03BD \u03B5\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7;",
45117
+ exitMessage: "\u0397 \u03AD\u03BE\u03BF\u03B4\u03BF\u03C2 \u03B8\u03B1 \u03C4\u03B5\u03C1\u03BC\u03B1\u03C4\u03AF\u03C3\u03B5\u03B9 \u03C4\u03B7 \u03B4\u03B9\u03B1\u03B4\u03B9\u03BA\u03B1\u03C3\u03AF\u03B1 \u03B5\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7\u03C2. \u0395\u03AF\u03C3\u03C4\u03B5 \u03C3\u03AF\u03B3\u03BF\u03C5\u03C1\u03BF\u03B9;",
45118
+ continueButton: "\u03A3\u03C5\u03BD\u03AD\u03C7\u03B5\u03B9\u03B1",
45119
+ exitButton: "\u0388\u03BE\u03BF\u03B4\u03BF\u03C2",
45120
+ ariaLabelModal: "\u0395\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7 Didit",
45121
+ ariaLabelClose: "\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF \u03B5\u03C0\u03B1\u03BB\u03AE\u03B8\u03B5\u03C5\u03C3\u03B7\u03C2"
45122
+ },
45123
+ en: EN,
45124
+ es: {
45125
+ exitTitle: "\xBFSalir de la verificaci\xF3n?",
45126
+ exitMessage: "Salir terminar\xE1 tu proceso de verificaci\xF3n. \xBFEst\xE1s seguro?",
45127
+ continueButton: "Continuar",
45128
+ exitButton: "Salir",
45129
+ ariaLabelModal: "Verificaci\xF3n Didit",
45130
+ ariaLabelClose: "Cerrar verificaci\xF3n"
45131
+ },
45132
+ et: {
45133
+ exitTitle: "Lahkuda kinnitamisest?",
45134
+ exitMessage: "Lahkumine l\xF5petab teie kinnitamisprotsessi. Kas olete kindel?",
45135
+ continueButton: "J\xE4tka",
45136
+ exitButton: "Lahku",
45137
+ ariaLabelModal: "Didit kinnitus",
45138
+ ariaLabelClose: "Sulge kinnitus"
45139
+ },
45140
+ fa: {
45141
+ exitTitle: "\u062E\u0631\u0648\u062C \u0627\u0632 \u062A\u0623\u06CC\u06CC\u062F \u0647\u0648\u06CC\u062A\u061F",
45142
+ exitMessage: "\u062E\u0631\u0648\u062C \u0628\u0627\u0639\u062B \u067E\u0627\u06CC\u0627\u0646 \u0641\u0631\u0622\u06CC\u0646\u062F \u062A\u0623\u06CC\u06CC\u062F \u0647\u0648\u06CC\u062A \u0634\u0645\u0627 \u0645\u06CC\u200C\u0634\u0648\u062F. \u0622\u06CC\u0627 \u0645\u0637\u0645\u0626\u0646 \u0647\u0633\u062A\u06CC\u062F\u061F",
45143
+ continueButton: "\u0627\u062F\u0627\u0645\u0647",
45144
+ exitButton: "\u062E\u0631\u0648\u062C",
45145
+ ariaLabelModal: "\u062A\u0623\u06CC\u06CC\u062F \u0647\u0648\u06CC\u062A Didit",
45146
+ ariaLabelClose: "\u0628\u0633\u062A\u0646 \u062A\u0623\u06CC\u06CC\u062F \u0647\u0648\u06CC\u062A"
45147
+ },
45148
+ fi: {
45149
+ exitTitle: "Poistu vahvistuksesta?",
45150
+ exitMessage: "Poistuminen p\xE4\xE4tt\xE4\xE4 vahvistusprosessisi. Oletko varma?",
45151
+ continueButton: "Jatka",
45152
+ exitButton: "Poistu",
45153
+ ariaLabelModal: "Didit-vahvistus",
45154
+ ariaLabelClose: "Sulje vahvistus"
45155
+ },
45156
+ fr: {
45157
+ exitTitle: "Quitter la v\xE9rification ?",
45158
+ exitMessage: "Quitter mettra fin \xE0 votre processus de v\xE9rification. \xCAtes-vous s\xFBr ?",
45159
+ continueButton: "Continuer",
45160
+ exitButton: "Quitter",
45161
+ ariaLabelModal: "V\xE9rification Didit",
45162
+ ariaLabelClose: "Fermer la v\xE9rification"
45163
+ },
45164
+ he: {
45165
+ exitTitle: "\u05DC\u05E6\u05D0\u05EA \u05DE\u05D4\u05D0\u05D9\u05DE\u05D5\u05EA?",
45166
+ exitMessage: "\u05D9\u05E6\u05D9\u05D0\u05D4 \u05EA\u05E1\u05D9\u05D9\u05DD \u05D0\u05EA \u05EA\u05D4\u05DC\u05D9\u05DA \u05D4\u05D0\u05D9\u05DE\u05D5\u05EA \u05E9\u05DC\u05DA. \u05D4\u05D0\u05DD \u05D0\u05EA\u05D4 \u05D1\u05D8\u05D5\u05D7?",
45167
+ continueButton: "\u05D4\u05DE\u05E9\u05DA",
45168
+ exitButton: "\u05D9\u05E6\u05D9\u05D0\u05D4",
45169
+ ariaLabelModal: "\u05D0\u05D9\u05DE\u05D5\u05EA Didit",
45170
+ ariaLabelClose: "\u05E1\u05D2\u05D9\u05E8\u05EA \u05D0\u05D9\u05DE\u05D5\u05EA"
45171
+ },
45172
+ hi: {
45173
+ exitTitle: "\u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0938\u0947 \u092C\u093E\u0939\u0930 \u0928\u093F\u0915\u0932\u0947\u0902?",
45174
+ exitMessage: "\u092C\u093E\u0939\u0930 \u0928\u093F\u0915\u0932\u0928\u0947 \u0938\u0947 \u0906\u092A\u0915\u0940 \u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u092A\u094D\u0930\u0915\u094D\u0930\u093F\u092F\u093E \u0938\u092E\u093E\u092A\u094D\u0924 \u0939\u094B \u091C\u093E\u090F\u0917\u0940\u0964 \u0915\u094D\u092F\u093E \u0906\u092A \u0938\u0941\u0928\u093F\u0936\u094D\u091A\u093F\u0924 \u0939\u0948\u0902?",
45175
+ continueButton: "\u091C\u093E\u0930\u0940 \u0930\u0916\u0947\u0902",
45176
+ exitButton: "\u092C\u093E\u0939\u0930 \u0928\u093F\u0915\u0932\u0947\u0902",
45177
+ ariaLabelModal: "Didit \u0938\u0924\u094D\u092F\u093E\u092A\u0928",
45178
+ ariaLabelClose: "\u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u092C\u0902\u0926 \u0915\u0930\u0947\u0902"
45179
+ },
45180
+ hr: {
45181
+ exitTitle: "Iza\u0107i iz verifikacije?",
45182
+ exitMessage: "Izlaskom \u0107ete prekinuti proces verifikacije. Jeste li sigurni?",
45183
+ continueButton: "Nastavi",
45184
+ exitButton: "Iza\u0111i",
45185
+ ariaLabelModal: "Didit verifikacija",
45186
+ ariaLabelClose: "Zatvori verifikaciju"
45187
+ },
45188
+ hu: {
45189
+ exitTitle: "Kil\xE9p\xE9s az ellen\u0151rz\xE9sb\u0151l?",
45190
+ exitMessage: "A kil\xE9p\xE9s befejezi az ellen\u0151rz\xE9si folyamatot. Biztos benne?",
45191
+ continueButton: "Folytat\xE1s",
45192
+ exitButton: "Kil\xE9p\xE9s",
45193
+ ariaLabelModal: "Didit ellen\u0151rz\xE9s",
45194
+ ariaLabelClose: "Ellen\u0151rz\xE9s bez\xE1r\xE1sa"
45195
+ },
45196
+ hy: {
45197
+ exitTitle: "\u0534\u0578\u0582\u0580\u057D \u0563\u0561\u055E\u056C \u057D\u057F\u0578\u0582\u0563\u0578\u0582\u0574\u056B\u0581",
45198
+ exitMessage: "\u0534\u0578\u0582\u0580\u057D \u0563\u0561\u056C\u0568 \u056F\u0561\u057E\u0561\u0580\u057F\u056B \u0571\u0565\u0580 \u057D\u057F\u0578\u0582\u0563\u0574\u0561\u0576 \u0563\u0578\u0580\u056E\u0568\u0576\u0569\u0561\u0581\u0568\u0589 \u0540\u0561\u0574\u0578\u0566\u057E\u0561\u056E \u0565\u055E\u0584?",
45199
+ continueButton: "\u0547\u0561\u0580\u0578\u0582\u0576\u0561\u056F\u0565\u056C",
45200
+ exitButton: "\u0534\u0578\u0582\u0580\u057D \u0563\u0561\u056C",
45201
+ ariaLabelModal: "Didit \u057D\u057F\u0578\u0582\u0563\u0578\u0582\u0574",
45202
+ ariaLabelClose: "\u0553\u0561\u056F\u0565\u056C \u057D\u057F\u0578\u0582\u0563\u0578\u0582\u0574\u0568"
45203
+ },
45204
+ id: {
45205
+ exitTitle: "Keluar dari verifikasi?",
45206
+ exitMessage: "Keluar akan mengakhiri proses verifikasi Anda. Apakah Anda yakin?",
45207
+ continueButton: "Lanjutkan",
45208
+ exitButton: "Keluar",
45209
+ ariaLabelModal: "Verifikasi Didit",
45210
+ ariaLabelClose: "Tutup verifikasi"
45211
+ },
45212
+ it: {
45213
+ exitTitle: "Uscire dalla verifica?",
45214
+ exitMessage: "L'uscita terminer\xE0 il processo di verifica. Sei sicuro?",
45215
+ continueButton: "Continua",
45216
+ exitButton: "Esci",
45217
+ ariaLabelModal: "Verifica Didit",
45218
+ ariaLabelClose: "Chiudi verifica"
45219
+ },
45220
+ ja: {
45221
+ exitTitle: "\u8A8D\u8A3C\u3092\u7D42\u4E86\u3057\u307E\u3059\u304B\uFF1F",
45222
+ exitMessage: "\u7D42\u4E86\u3059\u308B\u3068\u8A8D\u8A3C\u30D7\u30ED\u30BB\u30B9\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3059\u3002\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F",
45223
+ continueButton: "\u7D9A\u3051\u308B",
45224
+ exitButton: "\u7D42\u4E86",
45225
+ ariaLabelModal: "Didit \u8A8D\u8A3C",
45226
+ ariaLabelClose: "\u8A8D\u8A3C\u3092\u9589\u3058\u308B"
45227
+ },
45228
+ ka: {
45229
+ exitTitle: "\u10D2\u10D0\u10DB\u10DD\u10E1\u10D5\u10DA\u10D0 \u10E8\u10D4\u10DB\u10DD\u10EC\u10DB\u10D4\u10D1\u10D8\u10D3\u10D0\u10DC?",
45230
+ exitMessage: "\u10D2\u10D0\u10DB\u10DD\u10E1\u10D5\u10DA\u10D0 \u10D3\u10D0\u10D0\u10E1\u10E0\u10E3\u10DA\u10D4\u10D1\u10E1 \u10D7\u10E5\u10D5\u10D4\u10DC\u10E1 \u10E8\u10D4\u10DB\u10DD\u10EC\u10DB\u10D4\u10D1\u10D8\u10E1 \u10DE\u10E0\u10DD\u10EA\u10D4\u10E1\u10E1. \u10D3\u10D0\u10E0\u10EC\u10DB\u10E3\u10DC\u10D4\u10D1\u10E3\u10DA\u10D8 \u10EE\u10D0\u10E0\u10D7?",
45231
+ continueButton: "\u10D2\u10D0\u10D2\u10E0\u10EB\u10D4\u10DA\u10D4\u10D1\u10D0",
45232
+ exitButton: "\u10D2\u10D0\u10DB\u10DD\u10E1\u10D5\u10DA\u10D0",
45233
+ ariaLabelModal: "Didit \u10E8\u10D4\u10DB\u10DD\u10EC\u10DB\u10D4\u10D1\u10D0",
45234
+ ariaLabelClose: "\u10E8\u10D4\u10DB\u10DD\u10EC\u10DB\u10D4\u10D1\u10D8\u10E1 \u10D3\u10D0\u10EE\u10E3\u10E0\u10D5\u10D0"
45235
+ },
45236
+ ko: {
45237
+ exitTitle: "\uC778\uC99D\uC744 \uC885\uB8CC\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?",
45238
+ exitMessage: "\uC885\uB8CC\uD558\uBA74 \uC778\uC99D \uC808\uCC28\uAC00 \uC911\uB2E8\uB429\uB2C8\uB2E4. \uD655\uC2E4\uD558\uC2ED\uB2C8\uAE4C?",
45239
+ continueButton: "\uACC4\uC18D",
45240
+ exitButton: "\uC885\uB8CC",
45241
+ ariaLabelModal: "Didit \uC778\uC99D",
45242
+ ariaLabelClose: "\uC778\uC99D \uB2EB\uAE30"
45243
+ },
45244
+ lt: {
45245
+ exitTitle: "I\u0161eiti i\u0161 patvirtinimo?",
45246
+ exitMessage: "I\u0161\u0117jimas nutrauks j\u016Bs\u0173 patvirtinimo proces\u0105. Ar esate tikri?",
45247
+ continueButton: "T\u0119sti",
45248
+ exitButton: "I\u0161eiti",
45249
+ ariaLabelModal: "Didit patvirtinimas",
45250
+ ariaLabelClose: "U\u017Edaryti patvirtinim\u0105"
45251
+ },
45252
+ lv: {
45253
+ exitTitle: "Iziet no verifik\u0101cijas?",
45254
+ exitMessage: "Izie\u0161ana p\u0101rtrauks j\u016Bsu verifik\u0101cijas procesu. Vai esat p\u0101rliecin\u0101ts?",
45255
+ continueButton: "Turpin\u0101t",
45256
+ exitButton: "Iziet",
45257
+ ariaLabelModal: "Didit verifik\u0101cija",
45258
+ ariaLabelClose: "Aizv\u0113rt verifik\u0101ciju"
45259
+ },
45260
+ mk: {
45261
+ exitTitle: "\u0418\u0437\u043B\u0435\u0437\u0438 \u043E\u0434 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0430\u0442\u0430?",
45262
+ exitMessage: "\u0418\u0437\u043B\u0435\u0433\u0443\u0432\u0430\u045A\u0435\u0442\u043E \u045C\u0435 \u0433\u043E \u043F\u0440\u0435\u043A\u0438\u043D\u0435 \u043F\u0440\u043E\u0446\u0435\u0441\u043E\u0442 \u043D\u0430 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0430. \u0414\u0430\u043B\u0438 \u0441\u0442\u0435 \u0441\u0438\u0433\u0443\u0440\u043D\u0438?",
45263
+ continueButton: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438",
45264
+ exitButton: "\u0418\u0437\u043B\u0435\u0437\u0438",
45265
+ ariaLabelModal: "\u0412\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0430 Didit",
45266
+ ariaLabelClose: "\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0430"
45267
+ },
45268
+ ms: {
45269
+ exitTitle: "Keluar dari pengesahan?",
45270
+ exitMessage: "Keluar akan menamatkan proses pengesahan anda. Adakah anda pasti?",
45271
+ continueButton: "Teruskan",
45272
+ exitButton: "Keluar",
45273
+ ariaLabelModal: "Pengesahan Didit",
45274
+ ariaLabelClose: "Tutup pengesahan"
45275
+ },
45276
+ nl: {
45277
+ exitTitle: "Verificatie verlaten?",
45278
+ exitMessage: "Verlaten be\xEBindigt uw verificatieproces. Weet u het zeker?",
45279
+ continueButton: "Doorgaan",
45280
+ exitButton: "Verlaten",
45281
+ ariaLabelModal: "Didit-verificatie",
45282
+ ariaLabelClose: "Verificatie sluiten"
45283
+ },
45284
+ no: {
45285
+ exitTitle: "Forlat verifisering?",
45286
+ exitMessage: "\xC5 forlate vil avslutte verifiseringsprosessen. Er du sikker?",
45287
+ continueButton: "Fortsett",
45288
+ exitButton: "Forlat",
45289
+ ariaLabelModal: "Didit-verifisering",
45290
+ ariaLabelClose: "Lukk verifisering"
45291
+ },
45292
+ pl: {
45293
+ exitTitle: "Czy wyj\u015B\u0107 z weryfikacji?",
45294
+ exitMessage: "Wyj\u015Bcie zako\u0144czy proces weryfikacji. Czy na pewno?",
45295
+ continueButton: "Kontynuuj",
45296
+ exitButton: "Wyjd\u017A",
45297
+ ariaLabelModal: "Weryfikacja Didit",
45298
+ ariaLabelClose: "Zamknij weryfikacj\u0119"
45299
+ },
45300
+ "pt-BR": {
45301
+ exitTitle: "Sair da verifica\xE7\xE3o?",
45302
+ exitMessage: "Sair encerrar\xE1 seu processo de verifica\xE7\xE3o. Tem certeza?",
45303
+ continueButton: "Continuar",
45304
+ exitButton: "Sair",
45305
+ ariaLabelModal: "Verifica\xE7\xE3o Didit",
45306
+ ariaLabelClose: "Fechar verifica\xE7\xE3o"
45307
+ },
45308
+ pt: {
45309
+ exitTitle: "Sair da verifica\xE7\xE3o?",
45310
+ exitMessage: "Sair terminar\xE1 o seu processo de verifica\xE7\xE3o. Tem a certeza?",
45311
+ continueButton: "Continuar",
45312
+ exitButton: "Sair",
45313
+ ariaLabelModal: "Verifica\xE7\xE3o Didit",
45314
+ ariaLabelClose: "Fechar verifica\xE7\xE3o"
45315
+ },
45316
+ ro: {
45317
+ exitTitle: "Ie\u0219i din verificare?",
45318
+ exitMessage: "Ie\u0219irea va \xEEncheia procesul de verificare. E\u0219ti sigur?",
45319
+ continueButton: "Continu\u0103",
45320
+ exitButton: "Ie\u0219i",
45321
+ ariaLabelModal: "Verificare Didit",
45322
+ ariaLabelClose: "\xCEnchide verificarea"
45323
+ },
45324
+ ru: {
45325
+ exitTitle: "\u0412\u044B\u0439\u0442\u0438 \u0438\u0437 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438?",
45326
+ exitMessage: "\u0412\u044B\u0445\u043E\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u043F\u0440\u043E\u0446\u0435\u0441\u0441 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0438. \u0412\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B?",
45327
+ continueButton: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C",
45328
+ exitButton: "\u0412\u044B\u0439\u0442\u0438",
45329
+ ariaLabelModal: "\u0412\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F Didit",
45330
+ ariaLabelClose: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044E"
45331
+ },
45332
+ sk: {
45333
+ exitTitle: "Opusti\u0165 overenie?",
45334
+ exitMessage: "Odchodom ukon\u010D\xEDte proces overenia. Ste si ist\xED?",
45335
+ continueButton: "Pokra\u010Dova\u0165",
45336
+ exitButton: "Od\xEDs\u0165",
45337
+ ariaLabelModal: "Overenie Didit",
45338
+ ariaLabelClose: "Zavrie\u0165 overenie"
45339
+ },
45340
+ sl: {
45341
+ exitTitle: "Zapustiti preverjanje?",
45342
+ exitMessage: "Izhod bo prekinil postopek preverjanja. Ali ste prepri\u010Dani?",
45343
+ continueButton: "Nadaljuj",
45344
+ exitButton: "Izhod",
45345
+ ariaLabelModal: "Preverjanje Didit",
45346
+ ariaLabelClose: "Zapri preverjanje"
45347
+ },
45348
+ so: {
45349
+ exitTitle: "Ka baxdo xaqiijinta?",
45350
+ exitMessage: "Ka bixitaanku wuxuu dhammayn doonaa habka xaqiijintaada. Ma hubtaa?",
45351
+ continueButton: "Sii wad",
45352
+ exitButton: "Ka bax",
45353
+ ariaLabelModal: "Xaqiijinta Didit",
45354
+ ariaLabelClose: "Xir xaqiijinta"
45355
+ },
45356
+ sr: {
45357
+ exitTitle: "\u0418\u0437\u0430\u045B\u0438 \u0438\u0437 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0435?",
45358
+ exitMessage: "\u0418\u0437\u043B\u0430\u0441\u043A\u043E\u043C \u045B\u0435\u0442\u0435 \u043F\u0440\u0435\u043A\u0438\u043D\u0443\u0442\u0438 \u043F\u0440\u043E\u0446\u0435\u0441 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0435. \u0414\u0430 \u043B\u0438 \u0441\u0442\u0435 \u0441\u0438\u0433\u0443\u0440\u043D\u0438?",
45359
+ continueButton: "\u041D\u0430\u0441\u0442\u0430\u0432\u0438",
45360
+ exitButton: "\u0418\u0437\u0430\u0452\u0438",
45361
+ ariaLabelModal: "\u0412\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0430 Didit",
45362
+ ariaLabelClose: "\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0432\u0435\u0440\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0458\u0443"
45363
+ },
45364
+ sv: {
45365
+ exitTitle: "L\xE4mna verifiering?",
45366
+ exitMessage: "Att l\xE4mna avslutar din verifieringsprocess. \xC4r du s\xE4ker?",
45367
+ continueButton: "Forts\xE4tt",
45368
+ exitButton: "L\xE4mna",
45369
+ ariaLabelModal: "Didit-verifiering",
45370
+ ariaLabelClose: "St\xE4ng verifiering"
45371
+ },
45372
+ th: {
45373
+ exitTitle: "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19?",
45374
+ exitMessage: "\u0E01\u0E32\u0E23\u0E2D\u0E2D\u0E01\u0E08\u0E30\u0E2A\u0E34\u0E49\u0E19\u0E2A\u0E38\u0E14\u0E01\u0E23\u0E30\u0E1A\u0E27\u0E19\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13 \u0E04\u0E38\u0E13\u0E41\u0E19\u0E48\u0E43\u0E08\u0E2B\u0E23\u0E37\u0E2D\u0E44\u0E21\u0E48?",
45375
+ continueButton: "\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23\u0E15\u0E48\u0E2D",
45376
+ exitButton: "\u0E2D\u0E2D\u0E01",
45377
+ ariaLabelModal: "\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19 Didit",
45378
+ ariaLabelClose: "\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19"
45379
+ },
45380
+ tr: {
45381
+ exitTitle: "Do\u011Frulamadan \xE7\u0131kmak istiyor musunuz?",
45382
+ exitMessage: "\xC7\u0131k\u0131\u015F, do\u011Frulama s\xFCrecinizi sonland\u0131racak. Emin misiniz?",
45383
+ continueButton: "Devam et",
45384
+ exitButton: "\xC7\u0131k\u0131\u015F",
45385
+ ariaLabelModal: "Didit do\u011Frulama",
45386
+ ariaLabelClose: "Do\u011Frulamay\u0131 kapat"
45387
+ },
45388
+ uk: {
45389
+ exitTitle: "\u0412\u0438\u0439\u0442\u0438 \u0437 \u0432\u0435\u0440\u0438\u0444\u0456\u043A\u0430\u0446\u0456\u0457?",
45390
+ exitMessage: "\u0412\u0438\u0445\u0456\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C \u043F\u0440\u043E\u0446\u0435\u0441 \u0432\u0435\u0440\u0438\u0444\u0456\u043A\u0430\u0446\u0456\u0457. \u0412\u0438 \u0432\u043F\u0435\u0432\u043D\u0435\u043D\u0456?",
45391
+ continueButton: "\u041F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438",
45392
+ exitButton: "\u0412\u0438\u0439\u0442\u0438",
45393
+ ariaLabelModal: "\u0412\u0435\u0440\u0438\u0444\u0456\u043A\u0430\u0446\u0456\u044F Didit",
45394
+ ariaLabelClose: "\u0417\u0430\u043A\u0440\u0438\u0442\u0438 \u0432\u0435\u0440\u0438\u0444\u0456\u043A\u0430\u0446\u0456\u044E"
45395
+ },
45396
+ uz: {
45397
+ exitTitle: "Tekshiruvdan chiqasizmi?",
45398
+ exitMessage: "Chiqish tekshiruv jarayonini tugatadi. Ishonchingiz komilmi?",
45399
+ continueButton: "Davom etish",
45400
+ exitButton: "Chiqish",
45401
+ ariaLabelModal: "Didit tekshiruvi",
45402
+ ariaLabelClose: "Tekshiruvni yopish"
45403
+ },
45404
+ vi: {
45405
+ exitTitle: "Tho\xE1t kh\u1ECFi x\xE1c minh?",
45406
+ exitMessage: "Tho\xE1t s\u1EBD k\u1EBFt th\xFAc qu\xE1 tr\xECnh x\xE1c minh c\u1EE7a b\u1EA1n. B\u1EA1n c\xF3 ch\u1EAFc kh\xF4ng?",
45407
+ continueButton: "Ti\u1EBFp t\u1EE5c",
45408
+ exitButton: "Tho\xE1t",
45409
+ ariaLabelModal: "X\xE1c minh Didit",
45410
+ ariaLabelClose: "\u0110\xF3ng x\xE1c minh"
45411
+ },
45412
+ "zh-CN": {
45413
+ exitTitle: "\u9000\u51FA\u9A8C\u8BC1\uFF1F",
45414
+ exitMessage: "\u9000\u51FA\u5C06\u7ED3\u675F\u60A8\u7684\u9A8C\u8BC1\u6D41\u7A0B\u3002\u786E\u5B9A\u8981\u9000\u51FA\u5417\uFF1F",
45415
+ continueButton: "\u7EE7\u7EED",
45416
+ exitButton: "\u9000\u51FA",
45417
+ ariaLabelModal: "Didit \u9A8C\u8BC1",
45418
+ ariaLabelClose: "\u5173\u95ED\u9A8C\u8BC1"
45419
+ },
45420
+ "zh-TW": {
45421
+ exitTitle: "\u9000\u51FA\u9A57\u8B49\uFF1F",
45422
+ exitMessage: "\u9000\u51FA\u5C07\u7D50\u675F\u60A8\u7684\u9A57\u8B49\u6D41\u7A0B\u3002\u78BA\u5B9A\u8981\u9000\u51FA\u55CE\uFF1F",
45423
+ continueButton: "\u7E7C\u7E8C",
45424
+ exitButton: "\u9000\u51FA",
45425
+ ariaLabelModal: "Didit \u9A57\u8B49",
45426
+ ariaLabelClose: "\u95DC\u9589\u9A57\u8B49"
45427
+ },
45428
+ zh: {
45429
+ exitTitle: "\u9000\u51FA\u9A8C\u8BC1\uFF1F",
45430
+ exitMessage: "\u9000\u51FA\u5C06\u7ED3\u675F\u60A8\u7684\u9A8C\u8BC1\u6D41\u7A0B\u3002\u786E\u5B9A\u8981\u9000\u51FA\u5417\uFF1F",
45431
+ continueButton: "\u7EE7\u7EED",
45432
+ exitButton: "\u9000\u51FA",
45433
+ ariaLabelModal: "Didit \u9A8C\u8BC1",
45434
+ ariaLabelClose: "\u5173\u95ED\u9A8C\u8BC1"
45435
+ }
45436
+ };
45437
+ function getTranslations(language) {
45438
+ var _a;
45439
+ return (_a = translationsMap[language]) != null ? _a : EN;
45440
+ }
45441
+ class VerificationModal {
45442
+ constructor(configuration, callbacks) {
45443
+ __publicField(this, "modalId");
45444
+ __publicField(this, "config");
45445
+ __publicField(this, "callbacks");
45446
+ __publicField(this, "state", {
45447
+ isOpen: false,
45448
+ isLoading: true,
45449
+ showConfirmation: false
45450
+ });
45451
+ __publicField(this, "overlay", null);
45452
+ __publicField(this, "container", null);
45453
+ __publicField(this, "iframe", null);
45454
+ __publicField(this, "loadingEl", null);
45455
+ __publicField(this, "confirmOverlay", null);
45456
+ __publicField(this, "containerElement");
45457
+ __publicField(this, "boundHandleMessage", null);
45458
+ __publicField(this, "boundHandleKeydown", null);
45459
+ __publicField(this, "embedded", false);
45460
+ __publicField(this, "embeddedContainer", null);
45461
+ __publicField(this, "language", "es");
45462
+ var _a, _b, _c, _d, _e;
45463
+ this.modalId = generateModalId();
45464
+ this.config = {
45465
+ zIndex: (_a = configuration == null ? void 0 : configuration.zIndex) != null ? _a : DEFAULT_CONFIG.zIndex,
45466
+ showCloseButton: (_b = configuration == null ? void 0 : configuration.showCloseButton) != null ? _b : DEFAULT_CONFIG.showCloseButton,
45467
+ showExitConfirmation: (_c = configuration == null ? void 0 : configuration.showExitConfirmation) != null ? _c : DEFAULT_CONFIG.showExitConfirmation,
45468
+ color: configuration == null ? void 0 : configuration.color
45469
+ };
45470
+ this.callbacks = callbacks;
45471
+ this.containerElement = (_d = configuration == null ? void 0 : configuration.containerElement) != null ? _d : document.body;
45472
+ this.embedded = (_e = configuration == null ? void 0 : configuration.embedded) != null ? _e : false;
45473
+ if (this.embedded && (configuration == null ? void 0 : configuration.embeddedContainerId)) {
45474
+ this.embeddedContainer = document.getElementById(configuration.embeddedContainerId);
45475
+ }
45476
+ }
45477
+ injectStyles() {
45478
+ const styleId = "didit-sdk-styles";
45479
+ if (document.getElementById(styleId)) {
45480
+ return;
45481
+ }
45482
+ const styles2 = document.createElement("style");
45483
+ styles2.id = styleId;
45484
+ styles2.textContent = `
45485
+ .${CSS_CLASSES.overlay} {
45486
+ display: none;
45487
+ position: fixed;
45488
+ inset: 0;
45489
+ background: rgba(0, 0, 0, 0.6);
45490
+ z-index: ${this.config.zIndex};
45491
+ justify-content: center;
45492
+ align-items: center;
45493
+ padding: 1rem;
45494
+ opacity: 0;
45495
+ transition: opacity 0.2s ease-out;
45496
+ }
45497
+
45498
+ .${CSS_CLASSES.overlay}.active {
45499
+ display: flex;
45500
+ opacity: 1;
45501
+ }
45502
+
45503
+ .${CSS_CLASSES.container} {
45504
+ position: relative;
45505
+ width: 100%;
45506
+ max-width: 500px;
45507
+ max-height: 90dvh;
45508
+ border-radius: 16px;
45509
+ overflow: hidden;
45510
+ background: transparent;
45511
+ }
45512
+
45513
+ .${CSS_CLASSES.overlay}.active .${CSS_CLASSES.container} {
45514
+ transform: scale(1);
45515
+ }
45516
+
45517
+ .${CSS_CLASSES.iframe} {
45518
+ width: 100%;
45519
+ height: 700px;
45520
+ border: none;
45521
+ display: block;
45522
+ }
45523
+
45524
+ .${CSS_CLASSES.closeButton} {
45525
+ position: absolute;
45526
+ top: 4px;
45527
+ right: 4px;
45528
+ width: 24px;
45529
+ height: 24px;
45530
+ background: transparent;
45531
+ border: none;
45532
+ cursor: pointer;
45533
+ padding: 0;
45534
+ z-index: 10;
45535
+ outline: none;
45536
+ }
45537
+
45538
+ .${CSS_CLASSES.closeButton}:hover,
45539
+ .${CSS_CLASSES.closeButton}:focus {
45540
+ background: transparent;
45541
+ opacity: 0.5;
45542
+ }
45543
+
45544
+ .${CSS_CLASSES.closeButton} svg {
45545
+ stroke: #666;
45546
+ stroke-width: 2;
45547
+ stroke-linecap: round;
45548
+ }
45549
+
45550
+ .${CSS_CLASSES.loading} {
45551
+ position: absolute;
45552
+ inset: 0;
45553
+ display: flex;
45554
+ align-items: center;
45555
+ justify-content: center;
45556
+ background: #fafafa;
45557
+ z-index: 5;
45558
+ }
45559
+
45560
+ .${CSS_CLASSES.loading}.hidden {
45561
+ display: none;
45562
+ }
45563
+
45564
+ .${CSS_CLASSES.loading} svg {
45565
+ width: 4rem;
45566
+ height: 4rem;
45567
+ animation: didit-spin 1s linear infinite;
45568
+ }
45569
+
45570
+ .${CSS_CLASSES.loading} circle {
45571
+ stroke: #e5e5e5;
45572
+ stroke-width: 2.5;
45573
+ fill: none;
45574
+ }
45575
+
45576
+ .${CSS_CLASSES.loading} path {
45577
+ stroke: #525252;
45578
+ stroke-width: 2.5;
45579
+ stroke-linecap: round;
45580
+ fill: none;
45581
+ }
45582
+
45583
+ @keyframes didit-spin {
45584
+ from { transform: rotate(0deg); }
45585
+ to { transform: rotate(360deg); }
45586
+ }
45587
+
45588
+ .${CSS_CLASSES.confirmOverlay} {
45589
+ display: none;
45590
+ position: absolute;
45591
+ inset: 0;
45592
+ background: rgba(0, 0, 0, 0.5);
45593
+ z-index: 20;
45594
+ justify-content: center;
45595
+ align-items: center;
45596
+ opacity: 0;
45597
+ transition: opacity 0.15s ease-out;
45598
+ }
45599
+
45600
+ .${CSS_CLASSES.confirmOverlay}.active {
45601
+ display: flex;
45602
+ opacity: 1;
45603
+ }
45604
+
45605
+ .${CSS_CLASSES.confirmBox} {
45606
+ background: #fff;
45607
+ border-radius: 12px;
45608
+ padding: 1.5rem;
45609
+ text-align: center;
45610
+ max-width: 300px;
45611
+ margin: 1rem;
45612
+ transform: scale(0.95);
45613
+ transition: transform 0.15s ease-out;
45614
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
45615
+ }
45616
+
45617
+ .${CSS_CLASSES.confirmOverlay}.active .${CSS_CLASSES.confirmBox} {
45618
+ transform: scale(1);
45619
+ }
45620
+
45621
+ .${CSS_CLASSES.confirmBox} h3 {
45622
+ color: #1a1a2e;
45623
+ margin: 0 0 0.5rem 0;
45624
+ font-size: 1.125rem;
45625
+ font-weight: 600;
45626
+ }
45627
+
45628
+ .${CSS_CLASSES.confirmBox} p {
45629
+ color: #666;
45630
+ font-size: 0.875rem;
45631
+ margin: 0 0 1.25rem 0;
45632
+ line-height: 1.5;
45633
+ }
45634
+
45635
+ .didit-confirm-actions {
45636
+ display: flex;
45637
+ align-items: center;
45638
+ justify-content: center;
45639
+ gap: 1rem;
45640
+ }
45641
+
45642
+ .didit-confirm-actions button {
45643
+ background: #2563eb;
45644
+ color: #fff;
45645
+ border: none;
45646
+ padding: 0.625rem 1.25rem;
45647
+ border-radius: 8px;
45648
+ font-size: 0.875rem;
45649
+ font-weight: 500;
45650
+ cursor: pointer;
45651
+ transition: background 0.15s ease;
45652
+ }
45653
+
45654
+ .didit-confirm-actions button:hover {
45655
+ background: #1d4ed8;
45656
+ }
45657
+
45658
+ .didit-confirm-actions span {
45659
+ color: #666;
45660
+ font-size: 0.875rem;
45661
+ cursor: pointer;
45662
+ padding: 0.625rem;
45663
+ transition: color 0.15s ease;
45664
+ }
45665
+
45666
+ .didit-confirm-actions span:hover {
45667
+ color: #1a1a2e;
45668
+ }
45669
+
45670
+ @media (max-width: 540px) {
45671
+ .${CSS_CLASSES.overlay} {
45672
+ padding: 0;
45673
+ }
45674
+
45675
+ .${CSS_CLASSES.container} {
45676
+ max-width: 100%;
45677
+ max-height: 100dvh;
45678
+ border-radius: 0;
45679
+ }
45680
+
45681
+ .${CSS_CLASSES.iframe} {
45682
+ height: 100dvh;
45683
+ }
45684
+ }
45685
+
45686
+ .${CSS_CLASSES.embedded} {
45687
+ position: relative;
45688
+ width: 100%;
45689
+ height: 100%;
45690
+ }
45691
+
45692
+ .${CSS_CLASSES.embedded} .${CSS_CLASSES.iframe} {
45693
+ width: 100%;
45694
+ height: 100%;
45695
+ }
45696
+
45697
+ .${CSS_CLASSES.embedded} .${CSS_CLASSES.loading} {
45698
+ border-radius: 0;
45699
+ }
45700
+ `;
45701
+ document.head.appendChild(styles2);
45702
+ }
45703
+ createDOM() {
45704
+ var _a, _b;
45705
+ this.injectStyles();
45706
+ if (this.embedded && this.embeddedContainer) {
45707
+ this.createEmbeddedDOM();
45708
+ return;
45709
+ }
45710
+ const t2 = getTranslations(this.language);
45711
+ this.overlay = document.createElement("div");
45712
+ this.overlay.id = this.modalId;
45713
+ this.overlay.className = CSS_CLASSES.overlay;
45714
+ this.overlay.setAttribute("role", "dialog");
45715
+ this.overlay.setAttribute("aria-modal", "true");
45716
+ this.overlay.setAttribute("aria-label", t2.ariaLabelModal);
45717
+ this.container = document.createElement("div");
45718
+ this.container.className = CSS_CLASSES.container;
45719
+ this.loadingEl = document.createElement("div");
45720
+ this.loadingEl.className = CSS_CLASSES.loading;
45721
+ this.loadingEl.innerHTML = `
45722
+ <svg viewBox="0 0 24 24">
45723
+ <circle cx="12" cy="12" r="10" />
45724
+ <path d="M12 2a10 10 0 0 1 10 10" />
45725
+ </svg>
45726
+ `;
45727
+ if (this.config.showCloseButton) {
45728
+ const closeBtn = document.createElement("button");
45729
+ closeBtn.className = CSS_CLASSES.closeButton;
45730
+ closeBtn.setAttribute("aria-label", t2.ariaLabelClose);
45731
+ closeBtn.innerHTML = `
45732
+ <svg width="14" height="14" viewBox="0 0 14 14">
45733
+ <line x1="1" y1="1" x2="13" y2="13" />
45734
+ <line x1="13" y1="1" x2="1" y2="13" />
45735
+ </svg>
45736
+ `;
45737
+ closeBtn.addEventListener("click", () => this.handleCloseRequest());
45738
+ this.container.appendChild(closeBtn);
45739
+ }
45740
+ this.iframe = document.createElement("iframe");
45741
+ this.iframe.className = CSS_CLASSES.iframe;
45742
+ this.iframe.setAttribute("allow", "camera; microphone; fullscreen; autoplay; encrypted-media; geolocation");
45743
+ this.iframe.setAttribute("title", t2.ariaLabelModal);
45744
+ this.iframe.addEventListener("load", () => this.handleIframeLoad());
45745
+ this.confirmOverlay = document.createElement("div");
45746
+ this.confirmOverlay.className = CSS_CLASSES.confirmOverlay;
45747
+ this.confirmOverlay.innerHTML = `
45748
+ <div class="${CSS_CLASSES.confirmBox}">
45749
+ <h3>${t2.exitTitle}</h3>
45750
+ <p>${t2.exitMessage}</p>
45751
+ <div class="didit-confirm-actions">
45752
+ <button type="button" data-action="continue">${t2.continueButton}</button>
45753
+ <span data-action="exit">${t2.exitButton}</span>
45754
+ </div>
45755
+ </div>
45756
+ `;
45757
+ (_a = this.confirmOverlay.querySelector('[data-action="continue"]')) == null ? void 0 : _a.addEventListener("click", () => {
45758
+ this.hideConfirmation();
45759
+ });
45760
+ (_b = this.confirmOverlay.querySelector('[data-action="exit"]')) == null ? void 0 : _b.addEventListener("click", () => {
45761
+ this.confirmExit();
45762
+ });
45763
+ this.container.appendChild(this.loadingEl);
45764
+ this.container.appendChild(this.iframe);
45765
+ this.container.appendChild(this.confirmOverlay);
45766
+ this.overlay.appendChild(this.container);
45767
+ this.overlay.addEventListener("click", (e2) => {
45768
+ if (e2.target === this.overlay) {
45769
+ this.handleCloseRequest();
45770
+ }
45771
+ });
45772
+ this.containerElement.appendChild(this.overlay);
45773
+ }
45774
+ createEmbeddedDOM() {
45775
+ if (!this.embeddedContainer)
45776
+ return;
45777
+ this.container = document.createElement("div");
45778
+ this.container.id = this.modalId;
45779
+ this.container.className = CSS_CLASSES.embedded;
45780
+ this.loadingEl = document.createElement("div");
45781
+ this.loadingEl.className = CSS_CLASSES.loading;
45782
+ this.loadingEl.innerHTML = `
45783
+ <svg viewBox="0 0 24 24">
45784
+ <circle cx="12" cy="12" r="10" />
45785
+ <path d="M12 2a10 10 0 0 1 10 10" />
45786
+ </svg>
45787
+ `;
45788
+ this.iframe = document.createElement("iframe");
45789
+ this.iframe.className = CSS_CLASSES.iframe;
45790
+ this.iframe.setAttribute("allow", "camera; microphone; fullscreen; autoplay; encrypted-media; geolocation");
45791
+ this.iframe.setAttribute("title", getTranslations(this.language).ariaLabelModal);
45792
+ this.iframe.addEventListener("load", () => this.handleIframeLoad());
45793
+ this.container.appendChild(this.loadingEl);
45794
+ this.container.appendChild(this.iframe);
45795
+ this.embeddedContainer.appendChild(this.container);
45796
+ }
45797
+ setupEventListeners() {
45798
+ this.boundHandleMessage = this.handleMessage.bind(this);
45799
+ window.addEventListener("message", this.boundHandleMessage);
45800
+ this.boundHandleKeydown = this.handleKeydown.bind(this);
45801
+ document.addEventListener("keydown", this.boundHandleKeydown);
45802
+ }
45803
+ removeEventListeners() {
45804
+ if (this.boundHandleMessage) {
45805
+ window.removeEventListener("message", this.boundHandleMessage);
45806
+ this.boundHandleMessage = null;
45807
+ }
45808
+ if (this.boundHandleKeydown) {
45809
+ document.removeEventListener("keydown", this.boundHandleKeydown);
45810
+ this.boundHandleKeydown = null;
45811
+ }
45812
+ }
45813
+ handleMessage(event) {
45814
+ if (!isAllowedOrigin(event.origin)) {
45815
+ return;
45816
+ }
45817
+ SDKLogger.log("Received postMessage:", event.data);
45818
+ let messageData;
45819
+ try {
45820
+ if (typeof event.data === "string") {
45821
+ messageData = JSON.parse(event.data);
45822
+ } else {
45823
+ messageData = event.data;
45824
+ }
45825
+ } catch {
45826
+ SDKLogger.warn("Failed to parse postMessage:", event.data);
45827
+ return;
45828
+ }
45829
+ if (messageData.type === "didit:close_request") {
45830
+ this.handleCloseRequest();
45831
+ return;
45832
+ }
45833
+ this.callbacks.onMessage(messageData);
45834
+ }
45835
+ handleKeydown(event) {
45836
+ if (!this.state.isOpen)
45837
+ return;
45838
+ if (event.key === "Escape") {
45839
+ event.preventDefault();
45840
+ if (this.state.showConfirmation) {
45841
+ this.hideConfirmation();
45842
+ } else {
45843
+ this.handleCloseRequest();
45844
+ }
45845
+ }
45846
+ }
45847
+ handleIframeLoad() {
45848
+ var _a, _b;
45849
+ if (((_a = this.iframe) == null ? void 0 : _a.src) && this.iframe.src !== "about:blank") {
45850
+ this.state.isLoading = false;
45851
+ (_b = this.loadingEl) == null ? void 0 : _b.classList.add("hidden");
45852
+ this.callbacks.onIframeLoad();
45853
+ }
45854
+ }
45855
+ handleCloseRequest() {
45856
+ if (this.config.showExitConfirmation) {
45857
+ this.showConfirmation();
45858
+ } else {
45859
+ this.callbacks.onCloseConfirmed();
45860
+ }
45861
+ }
45862
+ showConfirmation() {
45863
+ var _a;
45864
+ this.state.showConfirmation = true;
45865
+ (_a = this.confirmOverlay) == null ? void 0 : _a.classList.add("active");
45866
+ this.callbacks.onClose();
45867
+ }
45868
+ hideConfirmation() {
45869
+ var _a;
45870
+ this.state.showConfirmation = false;
45871
+ (_a = this.confirmOverlay) == null ? void 0 : _a.classList.remove("active");
45872
+ }
45873
+ confirmExit() {
45874
+ this.hideConfirmation();
45875
+ this.callbacks.onCloseConfirmed();
45876
+ }
45877
+ open(verificationUrl) {
45878
+ var _a, _b, _c;
45879
+ this.language = detectLanguageFromUrl(verificationUrl);
45880
+ if (!this.overlay && !this.container) {
45881
+ this.createDOM();
45882
+ this.setupEventListeners();
45883
+ }
45884
+ SDKLogger.log("Opening with URL:", verificationUrl);
45885
+ this.state.isLoading = true;
45886
+ this.state.showConfirmation = false;
45887
+ (_a = this.loadingEl) == null ? void 0 : _a.classList.remove("hidden");
45888
+ (_b = this.confirmOverlay) == null ? void 0 : _b.classList.remove("active");
45889
+ if (this.iframe) {
45890
+ try {
45891
+ const urlObj = new URL(verificationUrl);
45892
+ urlObj.searchParams.set("device", "desktop");
45893
+ urlObj.searchParams.set("ui", "embedded");
45894
+ urlObj.searchParams.set("autostart", "true");
45895
+ if (!urlObj.searchParams.has("lang") && this.language) {
45896
+ urlObj.searchParams.set("lang", this.language);
45897
+ }
45898
+ this.iframe.src = urlObj.toString();
45899
+ } catch (e2) {
45900
+ this.iframe.src = verificationUrl;
45901
+ }
45902
+ }
45903
+ this.state.isOpen = true;
45904
+ if (this.embedded) {
45905
+ return;
45906
+ }
45907
+ (_c = this.overlay) == null ? void 0 : _c.classList.add("active");
45908
+ document.body.style.overflow = "hidden";
45909
+ }
45910
+ close() {
45911
+ var _a;
45912
+ SDKLogger.log("Closing");
45913
+ this.state.isOpen = false;
45914
+ this.state.isLoading = true;
45915
+ this.state.showConfirmation = false;
45916
+ if (this.iframe) {
45917
+ this.iframe.src = "about:blank";
45918
+ }
45919
+ if (this.embedded) {
45920
+ return;
45921
+ }
45922
+ (_a = this.overlay) == null ? void 0 : _a.classList.remove("active");
45923
+ document.body.style.overflow = "";
45924
+ }
45925
+ destroy() {
45926
+ SDKLogger.log("Destroying");
45927
+ this.close();
45928
+ this.removeEventListeners();
45929
+ if (this.embedded && this.container && this.container.parentNode) {
45930
+ this.container.parentNode.removeChild(this.container);
45931
+ } else if (this.overlay && this.overlay.parentNode) {
45932
+ this.overlay.parentNode.removeChild(this.overlay);
45933
+ }
45934
+ this.overlay = null;
45935
+ this.container = null;
45936
+ this.iframe = null;
45937
+ this.loadingEl = null;
45938
+ this.confirmOverlay = null;
45939
+ }
45940
+ isOpen() {
45941
+ return this.state.isOpen;
45942
+ }
45943
+ isLoading() {
45944
+ return this.state.isLoading;
45945
+ }
45946
+ }
45947
+ const _DiditSdk = class {
45948
+ constructor() {
45949
+ __publicField(this, "_state", "idle");
45950
+ __publicField(this, "_configuration");
45951
+ __publicField(this, "_sessionId");
45952
+ __publicField(this, "_url");
45953
+ __publicField(this, "_modal", null);
45954
+ __publicField(this, "_errorMessage");
45955
+ __publicField(this, "onComplete");
45956
+ __publicField(this, "onStateChange");
45957
+ __publicField(this, "onEvent");
45958
+ SDKLogger.log("DiditSdk initialized");
45959
+ }
45960
+ static get shared() {
45961
+ if (!_DiditSdk._instance) {
45962
+ _DiditSdk._instance = new _DiditSdk();
45963
+ }
45964
+ return _DiditSdk._instance;
45965
+ }
45966
+ static reset() {
45967
+ if (_DiditSdk._instance) {
45968
+ _DiditSdk._instance.destroy();
45969
+ _DiditSdk._instance = null;
45970
+ }
45971
+ }
45972
+ get state() {
45973
+ return this._state;
45974
+ }
45975
+ get configuration() {
45976
+ return this._configuration;
45977
+ }
45978
+ get isPresented() {
45979
+ var _a, _b;
45980
+ return (_b = (_a = this._modal) == null ? void 0 : _a.isOpen()) != null ? _b : false;
45981
+ }
45982
+ get errorMessage() {
45983
+ return this._errorMessage;
45984
+ }
45985
+ async startVerification(options) {
45986
+ var _a, _b;
45987
+ const config2 = options.configuration;
45988
+ this._configuration = config2;
45989
+ SDKLogger.isEnabled = (_a = config2 == null ? void 0 : config2.loggingEnabled) != null ? _a : DEFAULT_CONFIG.loggingEnabled;
45990
+ SDKLogger.log("Starting verification with options:", options);
45991
+ if (this._modal) {
45992
+ this._modal.destroy();
45993
+ this._modal = null;
45994
+ }
45995
+ this._modal = new VerificationModal(config2, {
45996
+ onClose: () => this.handleModalClose(),
45997
+ onCloseConfirmed: () => this.handleModalCloseConfirmed(),
45998
+ onMessage: (event) => this.handleVerificationEvent(event),
45999
+ onIframeLoad: () => this.handleIframeLoad()
46000
+ });
46001
+ try {
46002
+ const {
46003
+ url
46004
+ } = options;
46005
+ if (!url || typeof url !== "string") {
46006
+ throw new Error("Invalid options: url is required");
46007
+ }
46008
+ this._url = url;
46009
+ this.setState("loading");
46010
+ this.emitInternalEvent("didit:started", {});
46011
+ (_b = this._modal) == null ? void 0 : _b.open(this._url);
46012
+ } catch (error2) {
46013
+ this.handleError(error2);
46014
+ }
46015
+ }
46016
+ close() {
46017
+ SDKLogger.log("Closing verification programmatically");
46018
+ this.handleModalCloseConfirmed();
46019
+ }
46020
+ destroy() {
46021
+ var _a;
46022
+ SDKLogger.log("Destroying SDK instance");
46023
+ (_a = this._modal) == null ? void 0 : _a.destroy();
46024
+ this._modal = null;
46025
+ this.reset();
46026
+ }
46027
+ handleModalClose() {
46028
+ SDKLogger.log("Modal close requested");
46029
+ }
46030
+ handleModalCloseConfirmed() {
46031
+ var _a, _b;
46032
+ SDKLogger.log("Modal close confirmed");
46033
+ const sessionData = this.buildSessionData();
46034
+ (_a = this._modal) == null ? void 0 : _a.close();
46035
+ this.reset();
46036
+ const result = {
46037
+ type: "cancelled",
46038
+ session: sessionData
46039
+ };
46040
+ (_b = this.onComplete) == null ? void 0 : _b.call(this, result);
46041
+ }
46042
+ handleIframeLoad() {
46043
+ SDKLogger.log("Iframe loaded");
46044
+ }
46045
+ emitInternalEvent(type, data2) {
46046
+ var _a;
46047
+ const event = {
46048
+ type,
46049
+ data: data2,
46050
+ timestamp: Date.now()
46051
+ };
46052
+ SDKLogger.log("Emitting internal event:", event);
46053
+ (_a = this.onEvent) == null ? void 0 : _a.call(this, event);
46054
+ }
46055
+ handleVerificationEvent(event) {
46056
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
46057
+ SDKLogger.log("Verification event:", event);
46058
+ (_a = this.onEvent) == null ? void 0 : _a.call(this, event);
46059
+ switch (event.type) {
46060
+ case "didit:ready":
46061
+ SDKLogger.log("Verification iframe ready");
46062
+ break;
46063
+ case "didit:started":
46064
+ SDKLogger.log("User started verification");
46065
+ break;
46066
+ case "didit:step_started":
46067
+ SDKLogger.log("Step started:", (_b = event.data) == null ? void 0 : _b.step);
46068
+ break;
46069
+ case "didit:step_completed":
46070
+ SDKLogger.log("Step completed:", (_c = event.data) == null ? void 0 : _c.step, "-> next:", (_d = event.data) == null ? void 0 : _d.nextStep);
46071
+ break;
46072
+ case "didit:media_started":
46073
+ SDKLogger.log("Media started:", (_e = event.data) == null ? void 0 : _e.mediaType, "for step:", (_f = event.data) == null ? void 0 : _f.step);
46074
+ break;
46075
+ case "didit:media_captured":
46076
+ SDKLogger.log("Media captured for step:", (_g = event.data) == null ? void 0 : _g.step, "isAuto:", (_h = event.data) == null ? void 0 : _h.isAuto);
46077
+ break;
46078
+ case "didit:document_selected":
46079
+ SDKLogger.log("Document selected:", (_i = event.data) == null ? void 0 : _i.documentType, "country:", (_j = event.data) == null ? void 0 : _j.country);
46080
+ break;
46081
+ case "didit:verification_submitted":
46082
+ SDKLogger.log("Verification submitted for step:", (_k = event.data) == null ? void 0 : _k.step);
46083
+ break;
46084
+ case "didit:code_sent":
46085
+ SDKLogger.log("Code sent via:", (_l = event.data) == null ? void 0 : _l.channel, "codeSize:", (_m = event.data) == null ? void 0 : _m.codeSize);
46086
+ break;
46087
+ case "didit:code_verified":
46088
+ SDKLogger.log("Code verified via:", (_n = event.data) == null ? void 0 : _n.channel);
46089
+ break;
46090
+ case "didit:status_updated":
46091
+ SDKLogger.log("Status updated:", (_o = event.data) == null ? void 0 : _o.status, "step:", (_p = event.data) == null ? void 0 : _p.step);
46092
+ break;
46093
+ case "didit:completed":
46094
+ this.handleVerificationCompleted(event);
46095
+ break;
46096
+ case "didit:cancelled":
46097
+ this.handleVerificationCancelled(event);
46098
+ break;
46099
+ case "didit:error":
46100
+ this.handleVerificationError(event);
46101
+ break;
46102
+ case "didit:step_changed":
46103
+ SDKLogger.log("Step changed:", (_q = event.data) == null ? void 0 : _q.step);
46104
+ break;
46105
+ }
46106
+ }
46107
+ handleVerificationCompleted(event) {
46108
+ var _a, _b, _c;
46109
+ SDKLogger.log("Verification completed:", event.data);
46110
+ const sessionData = this.buildSessionData(event.data);
46111
+ if ((_a = this._configuration) == null ? void 0 : _a.closeModalOnComplete) {
46112
+ (_b = this._modal) == null ? void 0 : _b.close();
46113
+ this.reset();
46114
+ }
46115
+ const result = {
46116
+ type: "completed",
46117
+ session: sessionData
46118
+ };
46119
+ (_c = this.onComplete) == null ? void 0 : _c.call(this, result);
46120
+ }
46121
+ handleVerificationCancelled(event) {
46122
+ var _a, _b;
46123
+ SDKLogger.log("Verification cancelled:", event.data);
46124
+ const sessionData = this.buildSessionData(event.data);
46125
+ (_a = this._modal) == null ? void 0 : _a.close();
46126
+ this.reset();
46127
+ const result = {
46128
+ type: "cancelled",
46129
+ session: sessionData
46130
+ };
46131
+ (_b = this.onComplete) == null ? void 0 : _b.call(this, result);
46132
+ }
46133
+ handleVerificationError(event) {
46134
+ SDKLogger.log("Verification error:", event.data);
46135
+ }
46136
+ handleError(error2) {
46137
+ var _a, _b;
46138
+ SDKLogger.error("SDK error:", error2);
46139
+ let verificationError;
46140
+ if (error2 instanceof Error) {
46141
+ verificationError = createVerificationError("unknown", error2.message);
46142
+ } else {
46143
+ verificationError = createVerificationError("unknown", "An unknown error occurred");
46144
+ }
46145
+ this._errorMessage = verificationError.message;
46146
+ this.setState("error");
46147
+ (_a = this._modal) == null ? void 0 : _a.close();
46148
+ this.reset();
46149
+ const result = {
46150
+ type: "failed",
46151
+ error: verificationError
46152
+ };
46153
+ (_b = this.onComplete) == null ? void 0 : _b.call(this, result);
46154
+ }
46155
+ setState(state) {
46156
+ var _a;
46157
+ const previousState = this._state;
46158
+ this._state = state;
46159
+ if (previousState !== state) {
46160
+ SDKLogger.log("State changed:", previousState, "->", state);
46161
+ (_a = this.onStateChange) == null ? void 0 : _a.call(this, state, this._errorMessage);
46162
+ }
46163
+ }
46164
+ reset() {
46165
+ this._state = "idle";
46166
+ this._sessionId = void 0;
46167
+ this._url = void 0;
46168
+ this._errorMessage = void 0;
46169
+ this._configuration = void 0;
46170
+ }
46171
+ buildSessionData(eventData) {
46172
+ const sessionId = (eventData == null ? void 0 : eventData.sessionId) || this._sessionId;
46173
+ if (!sessionId) {
46174
+ return void 0;
46175
+ }
46176
+ return {
46177
+ sessionId,
46178
+ status: (eventData == null ? void 0 : eventData.status) || "Pending"
46179
+ };
46180
+ }
46181
+ };
46182
+ let DiditSdk = _DiditSdk;
46183
+ __publicField(DiditSdk, "_instance", null);
46184
+ const DiditEmbedded = ({
46185
+ url,
46186
+ config: config2,
46187
+ onComplete,
46188
+ onEvent
46189
+ }) => {
46190
+ const containerRef = useRef(null);
46191
+ useEffect(() => {
46192
+ if (!url || !containerRef.current)
46193
+ return;
46194
+ if (!containerRef.current.id) {
46195
+ containerRef.current.id = `didit-embedded-container-${Math.random().toString(36).substring(2, 9)}`;
46196
+ }
46197
+ const sdk = new DiditSdk();
46198
+ if (onComplete)
46199
+ sdk.onComplete = onComplete;
46200
+ if (onEvent)
46201
+ sdk.onEvent = onEvent;
46202
+ console.log(onEvent, "Eveeeent");
46203
+ sdk.onComplete = (result) => {
46204
+ console.log(result, "Resullllllt");
46205
+ };
46206
+ sdk.startVerification({
46207
+ url,
46208
+ configuration: {
46209
+ ...config2,
46210
+ embedded: true,
46211
+ embeddedContainerId: containerRef.current.id
46212
+ }
46213
+ });
46214
+ return () => {
46215
+ sdk.destroy();
46216
+ };
46217
+ }, [url, config2, onComplete, onEvent]);
46218
+ return /* @__PURE__ */ jsx$1("div", {
46219
+ ref: containerRef,
46220
+ style: {
46221
+ width: "100%",
46222
+ height: "100%",
46223
+ minHeight: "600px"
46224
+ }
46225
+ });
46226
+ };
44902
46227
  function LivenessCheck({
44903
46228
  mode = "light",
44904
46229
  clientId,
@@ -44955,55 +46280,52 @@ function LivenessCheck({
44955
46280
  authorize().then((res) => setToken(res));
44956
46281
  }
44957
46282
  }, []);
44958
- return /* @__PURE__ */ jsx$1("div", {
46283
+ return /* @__PURE__ */ jsxs("div", {
44959
46284
  ref: containerRef,
44960
46285
  className: `${styles$a["kit-gbc"]} ${styles$a["liveness-container"]} ${styles$a[mode]} ${status === "NOT_VERIFY" && styles$a.error}`,
44961
- children: /* @__PURE__ */ jsxs("div", {
44962
- id: "liveness-check",
44963
- children: [/* @__PURE__ */ jsx$1(k$2, {
44964
- className: "kit-gbc-toastify-container",
44965
- position: "top-center",
44966
- autoClose: 5e3,
44967
- hideProgressBar: false,
44968
- newestOnTop: false,
44969
- closeOnClick: true,
44970
- rtl: false,
44971
- pauseOnFocusLoss: true,
44972
- draggable: true,
44973
- pauseOnHover: true
44974
- }), isLoading || countryCodeAllowed !== null && !countryCode ? /* @__PURE__ */ jsx$1(BackDropLoader, {}) : null, !lib$1(status) ? /* @__PURE__ */ jsxs("div", {
44975
- className: styles$a.sub,
44976
- children: [showBackButton(status) && /* @__PURE__ */ jsx$1(BackButton, {
44977
- action: clearState
44978
- }), /* @__PURE__ */ jsx$1("h4", {
44979
- children: "Verificaci\xF3n liveness"
44980
- }), /* @__PURE__ */ jsx$1(StatusComponent, {
44981
- status,
44982
- message
44983
- })]
44984
- }) : lib$1(data2) && faceMatch || faceMatch === null ? /* @__PURE__ */ jsx$1("face-liveness", {
44985
- className: styles$a.liveness
44986
- }) : /* @__PURE__ */ jsx$1(Box$1, {
44987
- className: `${styles$a["box-liveness"]} ${isMobile_1 && styles$a.responsive}`,
44988
- children: similarity === 0 ? /* @__PURE__ */ jsxs(Box$1, {
44989
- display: "flex",
44990
- flexDirection: "column",
44991
- justifyContent: "center",
44992
- alignItems: "center",
44993
- children: [/* @__PURE__ */ jsx$1(CustomSpinnerProgress, {}), /* @__PURE__ */ jsx$1(Typography$1, {
44994
- variant: "caption",
44995
- style: {
44996
- fontSize: "0.875em",
44997
- paddingTop: "0.875em",
44998
- color: "#000000"
44999
- },
45000
- children: "Comparando rostro..."
45001
- })]
45002
- }) : /* @__PURE__ */ jsx$1(SuccessAnimation, {
45003
- message
45004
- })
46286
+ children: [/* @__PURE__ */ jsx$1(k$2, {
46287
+ className: "kit-gbc-toastify-container",
46288
+ position: "top-center",
46289
+ autoClose: 5e3,
46290
+ hideProgressBar: false,
46291
+ newestOnTop: false,
46292
+ closeOnClick: true,
46293
+ rtl: false,
46294
+ pauseOnFocusLoss: true,
46295
+ draggable: true,
46296
+ pauseOnHover: true
46297
+ }), isLoading || countryCodeAllowed !== null && !countryCode ? /* @__PURE__ */ jsx$1(BackDropLoader, {}) : null, !lib$1(status) ? /* @__PURE__ */ jsxs("div", {
46298
+ className: styles$a.sub,
46299
+ children: [showBackButton(status) && /* @__PURE__ */ jsx$1(BackButton, {
46300
+ action: clearState
46301
+ }), /* @__PURE__ */ jsx$1("h4", {
46302
+ children: "Verificaci\xF3n liveness"
46303
+ }), /* @__PURE__ */ jsx$1(StatusComponent, {
46304
+ status,
46305
+ message
45005
46306
  })]
45006
- })
46307
+ }) : lib$1(data2) && faceMatch || faceMatch === null ? /* @__PURE__ */ jsx$1(DiditEmbedded, {
46308
+ url: "https://verify.didit.me/session/DKKlc5XwrIph"
46309
+ }) : /* @__PURE__ */ jsx$1(Box$1, {
46310
+ className: `${styles$a["box-liveness"]} ${isMobile_1 && styles$a.responsive}`,
46311
+ children: similarity === 0 ? /* @__PURE__ */ jsxs(Box$1, {
46312
+ display: "flex",
46313
+ flexDirection: "column",
46314
+ justifyContent: "center",
46315
+ alignItems: "center",
46316
+ children: [/* @__PURE__ */ jsx$1(CustomSpinnerProgress, {}), /* @__PURE__ */ jsx$1(Typography$1, {
46317
+ variant: "caption",
46318
+ style: {
46319
+ fontSize: "0.875em",
46320
+ paddingTop: "0.875em",
46321
+ color: "#000000"
46322
+ },
46323
+ children: "Comparando rostro..."
46324
+ })]
46325
+ }) : /* @__PURE__ */ jsx$1(SuccessAnimation, {
46326
+ message
46327
+ })
46328
+ })]
45007
46329
  });
45008
46330
  }
45009
46331
  LivenessCheck.propTypes = {
@@ -63467,4 +64789,4 @@ var bootstrap_bundle_min = { exports: {} };
63467
64789
  return R2(In), g2(In), { Alert: q2, Button: K, Carousel: at, Collapse: pt, Dropdown: li, Modal: Si, Offcanvas: Bi, Popover: hn, ScrollSpy: mn, Tab: On, Toast: In, Tooltip: an };
63468
64790
  });
63469
64791
  })(bootstrap_bundle_min);
63470
- export { BlackList, BulkVerification, DocumentReader, FaceMatch, LivenessCheck };
64792
+ export { BlackList, BulkVerification, DiditEmbedded, DocumentReader, FaceMatch, LivenessCheck };