From 7dc2e5740c67073f7567a25221ce58d8b22d1ad6 Mon Sep 17 00:00:00 2001 From: Gourav Kadu Date: Mon, 20 Nov 2023 18:32:03 +0000 Subject: [PATCH] Debugging if wyre is loaded or not --- src/services/wyre.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/services/wyre.js b/src/services/wyre.js index 05a59e3fc..6ed637314 100644 --- a/src/services/wyre.js +++ b/src/services/wyre.js @@ -3,16 +3,23 @@ const Wyre = window.Wyre; /** Constants **/ const DEVICE_TOKEN__KEY = 'WYRE__DEVICE_TOKEN'; - +if (!Wyre) { + console.error('Wyre SDK not found. Not properly loaded.'); +} else { class WyreWrapper { async configure() { - let deviceToken = localStorage.getItem(DEVICE_TOKEN__KEY); + try { + let deviceToken = localStorage.getItem(DEVICE_TOKEN__KEY);npm install -g ganache-cli + ganache-cli if (!deviceToken) { let array = new Uint8Array(25); window.crypto.getRandomValues(array); deviceToken = Array.prototype.map.call(array, x => ('00' + x.toString(16)).slice(-2)).join(''); localStorage.setItem(DEVICE_TOKEN__KEY, deviceToken); } + } catch (error) { + console.error('Error configuring Wyre:', error); + } } displayWidget( @@ -45,5 +52,6 @@ class WyreWrapper { }) } } +} export default new WyreWrapper();