| 
16 | 16 |   import TxType from "@requestnetwork/shared-components/tx-type.svelte";  | 
17 | 17 |   import DashboardSkeleton from "@requestnetwork/shared-components/dashboard-skeleton.svelte";  | 
18 | 18 |   import { toast } from "svelte-sonner";  | 
 | 19 | +  import Modal from "@requestnetwork/shared-components/modal.svelte";  | 
19 | 20 |   // Icons  | 
20 | 21 |   import ChevronDown from "@requestnetwork/shared-icons/chevron-down.svelte";  | 
21 | 22 |   import ChevronLeft from "@requestnetwork/shared-icons/chevron-left.svelte";  | 
 | 
90 | 91 |       })  | 
91 | 92 |     | undefined;  | 
92 | 93 |   let currencyManager: CurrencyManager;  | 
 | 94 | +  let loadSessionSignatures = false;  | 
93 | 95 | 
  | 
94 | 96 |   let columns = {  | 
95 | 97 |     issuedAt: false,  | 
 | 
383 | 385 |     activeRequest = undefined;  | 
384 | 386 |   };  | 
385 | 387 | 
  | 
386 |  | -  const loadRequests = async (sliderValue: string, currentAccount: GetAccountReturnType, currentRequestNetwork: RequestNetwork | undefined | null) => {  | 
 | 388 | +  const loadRequests = async (sliderValue: string, currentAccount: GetAccountReturnType | undefined, currentRequestNetwork: RequestNetwork | undefined | null) => {  | 
387 | 389 |     if (!currentAccount?.address || !currentRequestNetwork || !cipherProvider) return;  | 
388 | 390 | 
  | 
389 | 391 |     loading = true;  | 
390 | 392 |     if (sliderValue === "on") {  | 
391 | 393 |       try {  | 
392 | 394 |         const signer = await getEthersSigner(wagmiConfig);  | 
393 | 395 |         if (signer && currentAccount?.address) {  | 
 | 396 | +          loadSessionSignatures = localStorage?.getItem("lit-wallet-sig") === null;  | 
394 | 397 |           await cipherProvider?.getSessionSignatures(signer, currentAccount.address, window.location.host, "Sign in to Lit Protocol through Request Network");  | 
395 | 398 |           cipherProvider?.enableDecryption(true);  | 
396 | 399 |           localStorage?.setItem("isDecryptionEnabled", JSON.stringify(true));  | 
 | 
400 | 403 |         toast.error("Failed to enable decryption.");  | 
401 | 404 |         loading = false;  | 
402 | 405 |         return;  | 
 | 406 | +      } finally {  | 
 | 407 | +        loadSessionSignatures = false;  | 
403 | 408 |       }  | 
404 | 409 |     } else {  | 
405 | 410 |       cipherProvider?.enableDecryption(false);  | 
 | 
415 | 420 |   class="main-table"  | 
416 | 421 |   style="--mainColor: {mainColor}; --secondaryColor: {secondaryColor}; "  | 
417 | 422 | >  | 
 | 423 | +  {#if loadSessionSignatures}  | 
 | 424 | +    <Modal  | 
 | 425 | +      config={config}  | 
 | 426 | +      isOpen={true}  | 
 | 427 | +      title="Lit Protocol Signature Required"  | 
 | 428 | +    >  | 
 | 429 | +      <div class="modal-content">  | 
 | 430 | +        <p>This signature is required only once per session and will allow you to:</p>  | 
 | 431 | +        <ul>  | 
 | 432 | +          <li>Access encrypted invoice details</li>  | 
 | 433 | +        </ul>  | 
 | 434 | +      </div>  | 
 | 435 | +    </Modal>  | 
 | 436 | +  {/if}  | 
418 | 437 |   <div class="tabs">  | 
419 | 438 |     <ul>  | 
420 | 439 |       <li  | 
 | 
1036 | 1055 |     font-size: 20px;  | 
1037 | 1056 |     margin-bottom: 0;  | 
1038 | 1057 |   }  | 
 | 1058 | +
  | 
 | 1059 | +  .modal-content {  | 
 | 1060 | +    padding: 1rem;  | 
 | 1061 | +  }  | 
 | 1062 | +
  | 
 | 1063 | +  .modal-content ul {  | 
 | 1064 | +    list-style-type: disc;  | 
 | 1065 | +    margin-left: 1.5rem;  | 
 | 1066 | +    margin-top: 0.5rem;  | 
 | 1067 | +  }  | 
 | 1068 | +
  | 
 | 1069 | +  .modal-content li {  | 
 | 1070 | +    margin-bottom: 0.5rem;  | 
 | 1071 | +    color: #4B5563;  | 
 | 1072 | +  }  | 
1039 | 1073 | </style>  | 
0 commit comments