@powerhousedao/connect 1.0.25-dev.5 → 1.0.25-dev.7

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.
Files changed (29) hide show
  1. package/dist/assets/{app-DpvGvYx-.js → app-BawOrz8P.js} +170 -122
  2. package/dist/assets/{app-DpvGvYx-.js.map → app-BawOrz8P.js.map} +1 -1
  3. package/dist/assets/{app-loader-DlmRZ8eU.js → app-loader-DWuFuWRQ.js} +14 -7
  4. package/dist/assets/app-loader-DWuFuWRQ.js.map +1 -0
  5. package/dist/assets/{browser-CyAxFNDr.js → browser-D7qLTojd.js} +4 -4
  6. package/dist/assets/{browser-CyAxFNDr.js.map → browser-D7qLTojd.js.map} +1 -1
  7. package/dist/assets/{ccip-B0vnV_KE.js → ccip-C6FcwgDd.js} +4 -4
  8. package/dist/assets/{ccip-B0vnV_KE.js.map → ccip-C6FcwgDd.js.map} +1 -1
  9. package/dist/assets/{content-BECi_eC-.js → content-Czo1Wsf6.js} +5 -5
  10. package/dist/assets/{content-BECi_eC-.js.map → content-Czo1Wsf6.js.map} +1 -1
  11. package/dist/assets/{index-CSdlimsY.js → index-BUUK9nfm.js} +4 -4
  12. package/dist/assets/{index-CSdlimsY.js.map → index-BUUK9nfm.js.map} +1 -1
  13. package/dist/assets/{index-DdwuDRF1.js → index-Cx0MRis3.js} +4 -4
  14. package/dist/assets/{index-DdwuDRF1.js.map → index-Cx0MRis3.js.map} +1 -1
  15. package/dist/assets/{index-mvOgfrBU.js → index-DRzDb5EN.js} +4 -4
  16. package/dist/assets/index-DRzDb5EN.js.map +1 -0
  17. package/dist/assets/{index-K6dF3gGM.js → index-MnlUPJwk.js} +5 -5
  18. package/dist/assets/{index-K6dF3gGM.js.map → index-MnlUPJwk.js.map} +1 -1
  19. package/dist/assets/{main.6cK_RVAD.js → main.C52g8GYY.js} +2 -2
  20. package/dist/assets/{main.6cK_RVAD.js.map → main.C52g8GYY.js.map} +1 -1
  21. package/dist/assets/{reactor-analytics-CPrrgnol.js → reactor-analytics-DSutrq09.js} +6 -6
  22. package/dist/assets/{reactor-analytics-CPrrgnol.js.map → reactor-analytics-DSutrq09.js.map} +1 -1
  23. package/dist/assets/{router-Cdqw5UqJ.js → router-CkY4iXs9.js} +6 -6
  24. package/dist/assets/{router-Cdqw5UqJ.js.map → router-CkY4iXs9.js.map} +1 -1
  25. package/dist/index.html +1 -1
  26. package/dist/vite-envs.sh +1 -1
  27. package/package.json +9 -9
  28. package/dist/assets/app-loader-DlmRZ8eU.js.map +0 -1
  29. package/dist/assets/index-mvOgfrBU.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-B0vnV_KE.js","assets/main.6cK_RVAD.js","assets/app-loader-DlmRZ8eU.js","assets/app-loader-b43YtazY.css","assets/index-CSdlimsY.js","assets/style-CK8AY-7U.css","assets/index-K6dF3gGM.js","assets/browser-CyAxFNDr.js","assets/router-Cdqw5UqJ.js","assets/reactor-analytics-CPrrgnol.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-C6FcwgDd.js","assets/main.C52g8GYY.js","assets/app-loader-DWuFuWRQ.js","assets/app-loader-b43YtazY.css","assets/index-BUUK9nfm.js","assets/style-CK8AY-7U.css","assets/index-MnlUPJwk.js","assets/browser-D7qLTojd.js","assets/router-CkY4iXs9.js","assets/reactor-analytics-DSutrq09.js"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -19,9 +19,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
19
19
  }
20
20
  });
21
21
  var _InternalTransmitter_instances, buildInternalOperationUpdate_fn, _focused, _cleanup, _setup, _a, _online, _cleanup2, _setup2, _b, _gcTimeout, _c, _initialState, _revertState, _cache, _retryer, _defaultOptions, _abortSignalConsumed, _Query_instances, dispatch_fn, _d, _queries, _e2, _observers, _mutationCache, _retryer2, _Mutation_instances, dispatch_fn2, _f, _mutations, _scopes, _mutationId, _g, _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _h, _client, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _currentThenable, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _QueryObserver_instances, executeFetch_fn, updateStaleTimeout_fn, computeRefetchInterval_fn, updateRefetchInterval_fn, updateTimers_fn, clearStaleTimeout_fn, clearRefetchInterval_fn, updateQuery_fn, notify_fn, _i, _subtleCrypto, _keyPair, _keyPairStorage, _did, _bearerToken, _ConnectCrypto_instances, initCrypto_fn, initialize_fn, parseDid_fn, generateECDSAKeyPair_fn, exportKeyPair_fn, importKeyPair_fn, _sign, _verify, stringToBytes_fn;
22
- import { _ as __vitePreload } from "./main.6cK_RVAD.js";
22
+ import { _ as __vitePreload } from "./main.C52g8GYY.js";
23
23
  import { jsx as jsx$1, jsxs, Fragment } from "react/jsx-runtime";
24
- import { c as createAction, a as createReducer, i as isDocumentAction, R as ReorderStateExamplesInputSchema, D as DeleteStateExampleInputSchema, U as UpdateStateExampleInputSchema, A as AddStateExampleInputSchema, S as SetInitialStateInputSchema, b as SetStateSchemaInputSchema, d as ReorderModuleOperationsInputSchema, e as DeleteOperationInputSchema, M as MoveOperationInputSchema, f as SetOperationReducerInputSchema, g as SetOperationTemplateInputSchema, h as SetOperationDescriptionInputSchema, j as SetOperationSchemaInputSchema, k as SetOperationScopeInputSchema, l as SetOperationNameInputSchema, m as AddOperationInputSchema, n as ReorderOperationExamplesInputSchema, o as DeleteOperationExampleInputSchema, p as UpdateOperationExampleInputSchema, q as AddOperationExampleInputSchema, r as ReorderOperationErrorsInputSchema, s as DeleteOperationErrorInputSchema, t as SetOperationErrorTemplateInputSchema, u as SetOperationErrorDescriptionInputSchema, v as SetOperationErrorNameInputSchema, w as SetOperationErrorCodeInputSchema, x as AddOperationErrorInputSchema, y as ReorderModulesInputSchema, z as DeleteModuleInputSchema, B as SetModuleDescriptionInputSchema, C as SetModuleNameInputSchema, E as AddModuleInputSchema, F as ReorderChangeLogItemsInputSchema, G as DeleteChangeLogItemInputSchema, H as UpdateChangeLogItemInputSchema, I as AddChangeLogItemInputSchema, J as SetAuthorWebsiteInputSchema, K as SetAuthorNameInputSchema, L as SetModelDescriptionInputSchema, N as SetModelExtensionInputSchema, O as SetModelIdInputSchema, P as SetModelNameInputSchema, Q as baseCreateExtendedState, T as baseCreateDocument, V as baseSaveToFile, W as baseSaveToFileHandle, X as baseLoadFromFile, Y as baseLoadFromInput, Z as pascalCase, _ as logger$3, $ as utils, a0 as Icon, a1 as getDefaultExportFromCjs, a2 as LOCAL, a3 as commonjsGlobal, a4 as PUBLIC, a5 as SWITCHBOARD, a6 as locationInfoByLocation, a7 as sharingTypeOptions, a8 as objectType, a9 as recordType, aa as stringType, ab as capitalCase, ac as CLOUD, ad as createZip, ae as LZString, af as buildSignedOperation, ag as getI18n, ah as getDefaults, ai as connectConfig, aj as hashDocumentStateForScope, ak as getAugmentedNamespace, al as childLogger, am as process, an as setErrorHandler, ao as module, ap as createBrowserStorage, aq as createBrowserDocumentDriveServer, ar as generateId, as as reducer$8, at as isDocumentDrive, au as generateAddNodeAction, av as isFileNode, aw as uploadDocumentOperations, ax as updateFile, ay as addFolder, az as isFolderNode, aA as deleteNode, aB as updateNode, aC as FILE$1, aD as moveNode, aE as generateNodesCopy, aF as copyNode, aG as setDriveName, aH as setAvailableOffline, aI as setSharingType, aJ as SynchronizationUnitNotFoundError, aK as removeTrigger, aL as PullResponderTransmitter, aM as addTrigger, aN as ReadDriveNotFoundError, aO as openUrl, aP as getNodeOptions, aQ as DRIVE$1, aR as FOLDER, aS as requestPublicDrive, aT as serviceWorkerManager, aU as packageJson, aV as t$1 } from "./app-loader-DlmRZ8eU.js";
24
+ import { c as createAction, a as createReducer, i as isDocumentAction, R as ReorderStateExamplesInputSchema, D as DeleteStateExampleInputSchema, U as UpdateStateExampleInputSchema, A as AddStateExampleInputSchema, S as SetInitialStateInputSchema, b as SetStateSchemaInputSchema, d as ReorderModuleOperationsInputSchema, e as DeleteOperationInputSchema, M as MoveOperationInputSchema, f as SetOperationReducerInputSchema, g as SetOperationTemplateInputSchema, h as SetOperationDescriptionInputSchema, j as SetOperationSchemaInputSchema, k as SetOperationScopeInputSchema, l as SetOperationNameInputSchema, m as AddOperationInputSchema, n as ReorderOperationExamplesInputSchema, o as DeleteOperationExampleInputSchema, p as UpdateOperationExampleInputSchema, q as AddOperationExampleInputSchema, r as ReorderOperationErrorsInputSchema, s as DeleteOperationErrorInputSchema, t as SetOperationErrorTemplateInputSchema, u as SetOperationErrorDescriptionInputSchema, v as SetOperationErrorNameInputSchema, w as SetOperationErrorCodeInputSchema, x as AddOperationErrorInputSchema, y as ReorderModulesInputSchema, z as DeleteModuleInputSchema, B as SetModuleDescriptionInputSchema, C as SetModuleNameInputSchema, E as AddModuleInputSchema, F as ReorderChangeLogItemsInputSchema, G as DeleteChangeLogItemInputSchema, H as UpdateChangeLogItemInputSchema, I as AddChangeLogItemInputSchema, J as SetAuthorWebsiteInputSchema, K as SetAuthorNameInputSchema, L as SetModelDescriptionInputSchema, N as SetModelExtensionInputSchema, O as SetModelIdInputSchema, P as SetModelNameInputSchema, Q as baseCreateExtendedState, T as baseCreateDocument, V as baseSaveToFile, W as baseSaveToFileHandle, X as baseLoadFromFile, Y as baseLoadFromInput, Z as pascalCase, _ as logger$3, $ as utils, a0 as Icon, a1 as getDefaultExportFromCjs, a2 as LOCAL, a3 as commonjsGlobal, a4 as PUBLIC, a5 as SWITCHBOARD, a6 as locationInfoByLocation, a7 as sharingTypeOptions, a8 as objectType, a9 as recordType, aa as stringType, ab as capitalCase, ac as CLOUD, ad as createZip, ae as LZString, af as buildSignedOperation, ag as getI18n, ah as getDefaults, ai as connectConfig, aj as hashDocumentStateForScope, ak as getAugmentedNamespace, al as childLogger, am as process, an as setErrorHandler, ao as module, ap as createBrowserDocumentDriveServer, aq as createBrowserStorage, ar as generateId, as as reducer$8, at as isDocumentDrive, au as generateAddNodeAction, av as isFileNode, aw as uploadDocumentOperations, ax as updateFile, ay as addFolder, az as isFolderNode, aA as deleteNode, aB as updateNode, aC as FILE$1, aD as moveNode, aE as generateNodesCopy, aF as copyNode, aG as setDriveName, aH as setAvailableOffline, aI as setSharingType, aJ as SynchronizationUnitNotFoundError, aK as removeTrigger, aL as PullResponderTransmitter, aM as addTrigger, aN as ReadDriveNotFoundError, aO as openUrl, aP as getNodeOptions, aQ as DRIVE$1, aR as FOLDER, aS as requestPublicDrive, aT as serviceWorkerManager, aU as packageJson, aV as t$1 } from "./app-loader-DWuFuWRQ.js";
25
25
  import * as React from "react";
26
26
  import React__default, { useLayoutEffect, useEffect, useState, forwardRef, useCallback, useContext, useRef, useMemo, createContext, Component, Fragment as Fragment$1, createElement, useId as useId$2, useSyncExternalStore, isValidElement, cloneElement, Children, useReducer, useDebugValue, Suspense, lazy } from "react";
27
27
  import * as ReactDOM from "react-dom";
@@ -22071,7 +22071,7 @@ async function call(client2, args) {
22071
22071
  } catch (err) {
22072
22072
  const data2 = getRevertErrorData(err);
22073
22073
  const { offchainLookup, offchainLookupSignature } = await __vitePreload(async () => {
22074
- const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-B0vnV_KE.js");
22074
+ const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-C6FcwgDd.js");
22075
22075
  return { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 };
22076
22076
  }, true ? __vite__mapDeps([0,1,2,3]) : void 0);
22077
22077
  if (client2.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature && to)
@@ -76708,7 +76708,7 @@ const useFilteredDocumentModels = () => {
76708
76708
  return filteredDocumentModels;
76709
76709
  };
76710
76710
  async function loadBaseEditors() {
76711
- const documentModelEditor = await __vitePreload(() => import("./index-CSdlimsY.js"), true ? __vite__mapDeps([4,2,1,3]) : void 0);
76711
+ const documentModelEditor = await __vitePreload(() => import("./index-BUUK9nfm.js"), true ? __vite__mapDeps([4,2,1,3]) : void 0);
76712
76712
  await __vitePreload(() => Promise.resolve({}), true ? __vite__mapDeps([5]) : void 0);
76713
76713
  const module2 = documentModelEditor.documentModelEditorModule;
76714
76714
  return [module2];
@@ -76741,7 +76741,123 @@ const useGetEditor = () => {
76741
76741
  const [defaultDocumentModelEditor] = useDefaultDocumentModelEditor();
76742
76742
  return (documentType2) => editors ? getEditor(documentType2, editors, defaultDocumentModelEditor.value) : void 0;
76743
76743
  };
76744
+ let _connectCrypto;
76745
+ async function initConnectCrypto() {
76746
+ const { ConnectCrypto: ConnectCrypto2 } = await __vitePreload(async () => {
76747
+ const { ConnectCrypto: ConnectCrypto3 } = await import("./index-MnlUPJwk.js");
76748
+ return { ConnectCrypto: ConnectCrypto3 };
76749
+ }, true ? __vite__mapDeps([6,2,1,3]) : void 0);
76750
+ const { BrowserKeyStorage } = await __vitePreload(async () => {
76751
+ const { BrowserKeyStorage: BrowserKeyStorage2 } = await import("./index-MnlUPJwk.js");
76752
+ return { BrowserKeyStorage: BrowserKeyStorage2 };
76753
+ }, true ? __vite__mapDeps([6,2,1,3]) : void 0);
76754
+ const connectCrypto = new ConnectCrypto2(new BrowserKeyStorage());
76755
+ await connectCrypto.did();
76756
+ return connectCrypto;
76757
+ }
76758
+ function getConnectCrypto() {
76759
+ if (window.connectCrypto) {
76760
+ return Promise.resolve(window.connectCrypto);
76761
+ }
76762
+ if (_connectCrypto) {
76763
+ return _connectCrypto;
76764
+ }
76765
+ _connectCrypto = initConnectCrypto();
76766
+ return _connectCrypto;
76767
+ }
76768
+ function useConnectCrypto() {
76769
+ return useMemo(
76770
+ () => ({
76771
+ async regenerateDid() {
76772
+ const crypto2 = await getConnectCrypto();
76773
+ return crypto2.regenerateDid();
76774
+ },
76775
+ async did() {
76776
+ const crypto2 = await getConnectCrypto();
76777
+ return crypto2.did();
76778
+ },
76779
+ sign: async (data) => {
76780
+ const crypto2 = await getConnectCrypto();
76781
+ return await crypto2.sign(data);
76782
+ },
76783
+ async getIssuer() {
76784
+ const crypto2 = await getConnectCrypto();
76785
+ return crypto2.getIssuer();
76786
+ },
76787
+ async getBearerToken(driveUrl, address, refresh = false) {
76788
+ const crypto2 = await getConnectCrypto();
76789
+ return crypto2.getBearerToken(driveUrl, address, refresh);
76790
+ }
76791
+ }),
76792
+ []
76793
+ );
76794
+ }
76795
+ const didAtom = atom(void 0);
76796
+ function useConnectDid() {
76797
+ const [did, setDid] = useAtom(didAtom);
76798
+ useEffect(() => {
76799
+ if (did) {
76800
+ return;
76801
+ }
76802
+ getConnectCrypto().then((c2) => c2.did()).then((did2) => setDid(did2)).catch(logger$3.error);
76803
+ });
76804
+ return did;
76805
+ }
76806
+ const renownStatusAtom = atom("idle");
76807
+ const renownAtom = atom(
76808
+ window.renown ? Promise.resolve(window.renown) : void 0
76809
+ );
76810
+ function useRenown() {
76811
+ const [renown, setRenown] = useAtom(renownAtom);
76812
+ const [, setRenownStatus] = useAtom(renownStatusAtom);
76813
+ const { did } = useConnectCrypto();
76814
+ async function initRenown(getDid) {
76815
+ setRenownStatus("loading");
76816
+ try {
76817
+ const did2 = await getDid();
76818
+ if (!did2) {
76819
+ setRenownStatus("error");
76820
+ return;
76821
+ }
76822
+ const { initRenownBrowser } = await __vitePreload(async () => {
76823
+ const { initRenownBrowser: initRenownBrowser2 } = await import("./index-MnlUPJwk.js");
76824
+ return { initRenownBrowser: initRenownBrowser2 };
76825
+ }, true ? __vite__mapDeps([6,2,1,3]) : void 0);
76826
+ const renownBrowser = initRenownBrowser(did2);
76827
+ const renown2 = {
76828
+ user: function() {
76829
+ return Promise.resolve(renownBrowser.user);
76830
+ },
76831
+ login: function(did3) {
76832
+ return renownBrowser.login(did3);
76833
+ },
76834
+ logout() {
76835
+ return Promise.resolve(renownBrowser.logout());
76836
+ },
76837
+ on: {
76838
+ user(cb) {
76839
+ return renownBrowser.on("user", cb);
76840
+ }
76841
+ }
76842
+ };
76843
+ setRenownStatus("finished");
76844
+ return renown2;
76845
+ } catch (err) {
76846
+ console.error(
76847
+ "Error initializing renown:",
76848
+ err instanceof Error ? err.message : "Unknown error"
76849
+ );
76850
+ setRenownStatus("error");
76851
+ return void 0;
76852
+ }
76853
+ }
76854
+ if (!renown) {
76855
+ setRenown(initRenown(did));
76856
+ }
76857
+ return renown;
76858
+ }
76744
76859
  async function initReactor(reactor) {
76860
+ await initJwtHandler(reactor);
76745
76861
  const errors = await reactor.initialize();
76746
76862
  const error = errors == null ? void 0 : errors.at(0);
76747
76863
  if (error) {
@@ -76765,8 +76881,44 @@ async function initReactor(reactor) {
76765
76881
  }).catch(logger$3.error);
76766
76882
  }
76767
76883
  }
76884
+ async function initJwtHandler(server) {
76885
+ const renown = await atomStore.get(renownAtom);
76886
+ const user = await (renown == null ? void 0 : renown.user());
76887
+ const crypto2 = await getConnectCrypto();
76888
+ if (user == null ? void 0 : user.address) {
76889
+ server.setGenerateJwtHandler(async (driveUrl) => {
76890
+ return crypto2.getBearerToken(driveUrl, user.address);
76891
+ });
76892
+ }
76893
+ }
76894
+ async function waitForRenown() {
76895
+ return new Promise((resolve) => {
76896
+ const unsubscribe = observe$1((get2) => {
76897
+ try {
76898
+ const status = get2(renownStatusAtom);
76899
+ if (status === "finished" || status === "error") {
76900
+ unsubscribe();
76901
+ resolve();
76902
+ }
76903
+ } catch (err) {
76904
+ console.warn(
76905
+ "Error observing renown status:",
76906
+ err instanceof Error ? err.message : "Unknown error"
76907
+ );
76908
+ unsubscribe();
76909
+ resolve();
76910
+ }
76911
+ }, atomStore);
76912
+ setTimeout(() => {
76913
+ unsubscribe();
76914
+ console.warn("Timed out waiting for renown to initialize");
76915
+ resolve();
76916
+ }, 5e3);
76917
+ });
76918
+ }
76768
76919
  async function createReactor() {
76769
76920
  var _a2;
76921
+ await waitForRenown();
76770
76922
  const storage = atomStore.get(storageAtom);
76771
76923
  const documentModels = await atomStore.get(documentModelsAtom);
76772
76924
  const server = ((_a2 = window.electronAPI) == null ? void 0 : _a2.documentDrive) ?? createBrowserDocumentDriveServer(documentModels, storage);
@@ -76858,124 +77010,12 @@ const acceptedCookiesAtom = atomWithStorage(
76858
77010
  const useAcceptedCookies = () => {
76859
77011
  return useAtom(acceptedCookiesAtom);
76860
77012
  };
76861
- let _connectCrypto;
76862
- async function initConnectCrypto() {
76863
- const { ConnectCrypto: ConnectCrypto2 } = await __vitePreload(async () => {
76864
- const { ConnectCrypto: ConnectCrypto3 } = await import("./index-K6dF3gGM.js");
76865
- return { ConnectCrypto: ConnectCrypto3 };
76866
- }, true ? __vite__mapDeps([6,2,1,3]) : void 0);
76867
- const { BrowserKeyStorage } = await __vitePreload(async () => {
76868
- const { BrowserKeyStorage: BrowserKeyStorage2 } = await import("./index-K6dF3gGM.js");
76869
- return { BrowserKeyStorage: BrowserKeyStorage2 };
76870
- }, true ? __vite__mapDeps([6,2,1,3]) : void 0);
76871
- const connectCrypto = new ConnectCrypto2(new BrowserKeyStorage());
76872
- await connectCrypto.did();
76873
- return connectCrypto;
76874
- }
76875
- function getConnectCrypto() {
76876
- if (window.connectCrypto) {
76877
- return Promise.resolve(window.connectCrypto);
76878
- }
76879
- if (_connectCrypto) {
76880
- return _connectCrypto;
76881
- }
76882
- _connectCrypto = initConnectCrypto();
76883
- return _connectCrypto;
76884
- }
76885
- function useConnectCrypto() {
76886
- return useMemo(
76887
- () => ({
76888
- async regenerateDid() {
76889
- const crypto2 = await getConnectCrypto();
76890
- return crypto2.regenerateDid();
76891
- },
76892
- async did() {
76893
- const crypto2 = await getConnectCrypto();
76894
- return crypto2.did();
76895
- },
76896
- sign: async (data) => {
76897
- const crypto2 = await getConnectCrypto();
76898
- return await crypto2.sign(data);
76899
- },
76900
- async getIssuer() {
76901
- const crypto2 = await getConnectCrypto();
76902
- return crypto2.getIssuer();
76903
- },
76904
- async getBearerToken(driveUrl, address, refresh = false) {
76905
- const crypto2 = await getConnectCrypto();
76906
- return crypto2.getBearerToken(driveUrl, address, refresh);
76907
- }
76908
- }),
76909
- []
76910
- );
76911
- }
76912
- const didAtom = atom(void 0);
76913
- function useConnectDid() {
76914
- const [did, setDid] = useAtom(didAtom);
76915
- useEffect(() => {
76916
- if (did) {
76917
- return;
76918
- }
76919
- getConnectCrypto().then((c2) => c2.did()).then((did2) => setDid(did2)).catch(logger$3.error);
76920
- });
76921
- return did;
76922
- }
76923
- const renownAtom = atom(
76924
- window.renown ? Promise.resolve(window.renown) : void 0
76925
- );
76926
- function useRenown() {
76927
- const [renown, setRenown] = useAtom(renownAtom);
76928
- const { did, getBearerToken } = useConnectCrypto();
76929
- const reactor = useUnwrappedReactor();
76930
- useEffect(() => {
76931
- if (!renown || !reactor || !did) {
76932
- return;
76933
- }
76934
- renown.user().then((user) => {
76935
- reactor.setGenerateJwtHandler(
76936
- async (driveUrl) => getBearerToken(driveUrl, user == null ? void 0 : user.address)
76937
- );
76938
- });
76939
- }, [renown, reactor]);
76940
- async function initRenown(getDid) {
76941
- const did2 = await getDid();
76942
- if (!did2) {
76943
- return;
76944
- }
76945
- const { initRenownBrowser } = await __vitePreload(async () => {
76946
- const { initRenownBrowser: initRenownBrowser2 } = await import("./index-K6dF3gGM.js");
76947
- return { initRenownBrowser: initRenownBrowser2 };
76948
- }, true ? __vite__mapDeps([6,2,1,3]) : void 0);
76949
- const renownBrowser = initRenownBrowser(did2);
76950
- const renown2 = {
76951
- user: function() {
76952
- return Promise.resolve(renownBrowser.user);
76953
- },
76954
- login: function(did3) {
76955
- return renownBrowser.login(did3);
76956
- },
76957
- logout() {
76958
- return Promise.resolve(renownBrowser.logout());
76959
- },
76960
- on: {
76961
- user(cb) {
76962
- return renownBrowser.on("user", cb);
76963
- }
76964
- }
76965
- };
76966
- return renown2;
76967
- }
76968
- if (!renown) {
76969
- setRenown(initRenown(did));
76970
- }
76971
- return renown;
76972
- }
76973
77013
  const loginStatusAtom = atom("initial");
76974
77014
  const useLogin = () => {
76975
77015
  const [status, setStatus] = useAtom(loginStatusAtom);
76976
77016
  const user = useUser();
76977
77017
  const renown = useRenown();
76978
- const { did } = useConnectCrypto();
77018
+ const { did, getBearerToken } = useConnectCrypto();
76979
77019
  const openRenown = useCallback(async () => {
76980
77020
  var _a2;
76981
77021
  const connectId = await did();
@@ -77011,6 +77051,11 @@ const useLogin = () => {
77011
77051
  const newUser = await renown.login(userDid);
77012
77052
  if (newUser) {
77013
77053
  setStatus("authorized");
77054
+ atomStore.get(reactorAtom).then((reactor) => {
77055
+ reactor.setGenerateJwtHandler(
77056
+ async (driveUrl) => getBearerToken(driveUrl, newUser.address)
77057
+ );
77058
+ }).catch((err) => console.error(err));
77014
77059
  return newUser;
77015
77060
  } else {
77016
77061
  setStatus("not-authorized");
@@ -77030,6 +77075,9 @@ const useLogin = () => {
77030
77075
  const logout = useCallback(async () => {
77031
77076
  setStatus("initial");
77032
77077
  await (renown == null ? void 0 : renown.logout());
77078
+ atomStore.get(reactorAtom).then((reactor) => {
77079
+ reactor.removeJwtHandler();
77080
+ }).catch((err) => console.error(err));
77033
77081
  }, [renown]);
77034
77082
  return useMemo(
77035
77083
  () => ({
@@ -91653,7 +91701,7 @@ async function createAnalyticsStore({ databaseName }) {
91653
91701
  return globalAnalytics.store;
91654
91702
  }
91655
91703
  const { BrowserAnalyticsStore } = await __vitePreload(async () => {
91656
- const { BrowserAnalyticsStore: BrowserAnalyticsStore2 } = await import("./browser-CyAxFNDr.js");
91704
+ const { BrowserAnalyticsStore: BrowserAnalyticsStore2 } = await import("./browser-D7qLTojd.js");
91657
91705
  return { BrowserAnalyticsStore: BrowserAnalyticsStore2 };
91658
91706
  }, true ? __vite__mapDeps([7,2,1,3]) : void 0);
91659
91707
  const store = new BrowserAnalyticsStore({ databaseName });
@@ -91785,7 +91833,7 @@ atomStore.sub(reactorAtom, () => {
91785
91833
  return atomStore.get(processorManagerAtom);
91786
91834
  });
91787
91835
  const Router = React__default.lazy(async () => {
91788
- const createRouterComponent = await __vitePreload(() => import("./router-Cdqw5UqJ.js").then((n2) => n2.r), true ? __vite__mapDeps([8,1,2,3]) : void 0);
91836
+ const createRouterComponent = await __vitePreload(() => import("./router-CkY4iXs9.js").then((n2) => n2.r), true ? __vite__mapDeps([8,1,2,3]) : void 0);
91789
91837
  const router = await createRouterComponent.default();
91790
91838
  return { default: router };
91791
91839
  });
@@ -91797,7 +91845,7 @@ const Preloader = () => {
91797
91845
  return null;
91798
91846
  };
91799
91847
  const ReactorAnalyticsProvider = lazy(
91800
- () => __vitePreload(() => import("./reactor-analytics-CPrrgnol.js"), true ? __vite__mapDeps([9,1,2,3]) : void 0)
91848
+ () => __vitePreload(() => import("./reactor-analytics-DSutrq09.js"), true ? __vite__mapDeps([9,1,2,3]) : void 0)
91801
91849
  );
91802
91850
  const App = () => /* @__PURE__ */ jsx$1(React__default.StrictMode, { children: /* @__PURE__ */ jsx$1(Suspense, { fallback: /* @__PURE__ */ jsx$1(Fragment, {}), children: /* @__PURE__ */ jsxs(Provider, { store: atomStore, children: [
91803
91851
  /* @__PURE__ */ jsx$1(Preloader, {}),
@@ -91975,4 +92023,4 @@ export {
91975
92023
  isLatestVersion as y,
91976
92024
  useParams as z
91977
92025
  };
91978
- //# sourceMappingURL=app-DpvGvYx-.js.map
92026
+ //# sourceMappingURL=app-BawOrz8P.js.map