Skip to content

Commit bda56f6

Browse files
committed
Merge branch 'main' of github.com:RequestNetwork/web-components into 319-invoice-dashboard-lit-protocol-sign-in-fails-when-switching-accounts-sometimes-lit-protocol-prompts-sign-in-infinite-loop
2 parents 2f9011c + 71e1cbc commit bda56f6

File tree

10 files changed

+5989
-2757
lines changed

10 files changed

+5989
-2757
lines changed

package-lock.json

Lines changed: 5920 additions & 2723 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010
],
1111
"scripts": {
1212
"test": "echo \"Error: no test specified\" && exit 1",
13-
"clean": "find . -path './node_modules' -prune -o -name 'dist' -type d -exec rm -rf '{}' \\; -printf '%p deleted\\n' 2>/dev/null",
14-
"deep-clean": "find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \\;",
1513
"build": "turbo run build",
1614
"build:form": "turbo run build --filter=@requestnetwork/create-invoice-form",
1715
"build:dashboard": "turbo run build --filter=@requestnetwork/invoice-dashboard",
1816
"build:stakeholder": "turbo run build --filter=@requestnetwork/add-stakeholder",
1917
"build:payment-widget": "turbo run build --filter=@requestnetwork/payment-widget",
2018
"build:single-invoice": "turbo run build --filter=@requestnetwork/single-invoice",
19+
"clean": "npm run clean:dist && npm run clean:sveltekit",
20+
"clean:dist": "find . -path ./node_modules -prune -o -name 'dist' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \\;",
21+
"clean:sveltekit": "find . -name '.svelte-kit' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \\;",
22+
"deep-clean": "npm run clean && npm run deep-clean:turbo && npm run deep-clean:node-modules",
23+
"deep-clean:turbo": "find . -name '.turbo' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \\;",
24+
"deep-clean:node-modules": "find . -name 'node_modules' -type d -exec rm -rf '{}' + -exec echo '{}' deleted \\;",
2125
"link:react": "npm link $npm_config_app_path/node_modules/react $npm_config_app_path/node_modules/react-dom",
2226
"link:all": "npm run link:react --app-path=$npm_config_app_path && for d in packages/*; do (cd $d && npm link); done",
2327
"unlink:all": "for d in packages/*; do (cd $d && npm unlink); done"

packages/create-invoice-form/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@requestnetwork/create-invoice-form",
3-
"version": "0.12.3",
3+
"version": "0.13.0",
44
"main": "./dist/web-component.umd.cjs",
55
"scripts": {
66
"dev": "vite dev",
@@ -33,8 +33,8 @@
3333
"!dist/**/*.spec.*"
3434
],
3535
"dependencies": {
36-
"@requestnetwork/data-format": "0.19.8",
37-
"@requestnetwork/request-client.js": "0.57.0",
36+
"@requestnetwork/data-format": "0.19.9",
37+
"@requestnetwork/request-client.js": "0.58.0",
3838
"@wagmi/core": "^2.15.2",
3939
"validator": "^13.12.0",
4040
"viem": "^2.21.53"

packages/invoice-dashboard/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@requestnetwork/invoice-dashboard",
3-
"version": "0.15.0",
3+
"version": "0.15.2",
44
"main": "./dist/web-component.umd.cjs",
55
"scripts": {
66
"dev": "vite dev",
@@ -37,9 +37,9 @@
3737
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
3838
},
3939
"dependencies": {
40-
"@requestnetwork/payment-detection": "0.52.0",
41-
"@requestnetwork/payment-processor": "0.55.0",
42-
"@requestnetwork/request-client.js": "0.57.0",
40+
"@requestnetwork/payment-detection": "0.53.0",
41+
"@requestnetwork/payment-processor": "0.56.0",
42+
"@requestnetwork/request-client.js": "0.58.0",
4343
"@wagmi/connectors": "^5.5.3",
4444
"@wagmi/core": "^2.15.2",
4545
"ethers": "^5.7.2",

packages/invoice-dashboard/src/lib/dashboard/invoice-view.svelte

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@
100100
101101
let isSigningTransaction = false;
102102
103+
let initialPaymentCheck = false;
104+
105+
let showPaymentButton = true;
106+
103107
const generateDetailParagraphs = (info: any) => {
104108
const fullName = [info?.firstName, info?.lastName]
105109
.filter(Boolean)
@@ -154,6 +158,12 @@
154158
$: {
155159
if (request?.requestId !== previousRequestId) {
156160
previousRequestId = request?.requestId;
161+
initialPaymentCheck =
162+
request?.state === "paid" ||
163+
request?.state === "overpaid" ||
164+
status === "paid" ||
165+
status === "overpaid" ||
166+
request?.balance?.balance >= request?.expectedAmount;
157167
checkInvoice();
158168
}
159169
}
@@ -345,6 +355,7 @@
345355
isPaid = true;
346356
status = checkStatus(requestData);
347357
isRequestPayed = true;
358+
showPaymentButton = false; // Hide the button after successful payment
348359
} catch (err) {
349360
console.error("Something went wrong while paying : ", err);
350361
@@ -857,7 +868,7 @@
857868
{/each}
858869
{/if}
859870
</div>
860-
{#if !isPaid && !isPayee}
871+
{#if !isPayee && !initialPaymentCheck}
861872
<div class="status-container">
862873
<div class="statuses">
863874
{#if statuses?.length > 0}
@@ -920,7 +931,7 @@
920931
</div>
921932
{/if}
922933
<div class="invoice-view-actions">
923-
{#if !isPayee && !unsupportedNetwork && !isPaid && !isRequestPayed && !isSigningTransaction && !unknownCurrency}
934+
{#if showPaymentButton && !isPayee && !unsupportedNetwork && !isSigningTransaction && !unknownCurrency && !initialPaymentCheck}
924935
{#if !hasEnoughBalance && correctChain}
925936
<div class="balance-warning">
926937
Insufficient funds: {Number(userBalance).toFixed(4)}

packages/invoice-dashboard/src/lib/view-requests.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@
452452
currentTab = tab;
453453
activeRequest = undefined;
454454
currentPage = 1;
455+
getRequests(account, requestNetwork);
455456
};
456457
457458
const handleColumnChange = (selectedOption: any) => {

packages/payment-widget/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@requestnetwork/payment-widget",
3-
"version": "0.3.9",
3+
"version": "0.3.10",
44
"main": "./dist/web-component.umd.cjs",
55
"scripts": {
66
"dev": "vite dev",
@@ -56,9 +56,9 @@
5656
"access": "public"
5757
},
5858
"dependencies": {
59-
"@requestnetwork/payment-processor": "0.55.0",
60-
"@requestnetwork/request-client.js": "0.57.0",
61-
"@requestnetwork/web3-signature": "0.8.8",
59+
"@requestnetwork/payment-processor": "0.56.0",
60+
"@requestnetwork/request-client.js": "0.58.0",
61+
"@requestnetwork/web3-signature": "0.8.9",
6262
"@web3modal/ethers5": "^5.0.11",
6363
"ethers": "^5.7.2",
6464
"vite-plugin-node-polyfills": "^0.22.0"

packages/single-invoice/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@requestnetwork/single-invoice",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"main": "./dist/web-component.umd.cjs",
55
"scripts": {
66
"dev": "vite dev",
@@ -33,9 +33,9 @@
3333
"!dist/**/*.spec.*"
3434
],
3535
"dependencies": {
36-
"@requestnetwork/payment-detection": "0.52.0",
37-
"@requestnetwork/payment-processor": "0.55.0",
38-
"@requestnetwork/request-client.js": "0.57.0",
36+
"@requestnetwork/payment-detection": "0.53.0",
37+
"@requestnetwork/payment-processor": "0.56.0",
38+
"@requestnetwork/request-client.js": "0.58.0",
3939
"@wagmi/core": "^2.15.2",
4040
"ethers": "^5.7.2",
4141
"viem": "^2.21.53",

shared/utils/generateInvoice.ts

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ async function ensureHtml2PdfLoaded() {
3030
export const exportToPDF = async (
3131
invoice: Types.IRequestDataWithEvents,
3232
currency?: CurrencyTypes.CurrencyDefinition,
33-
paymentCurrencies?: (CurrencyTypes.ERC20Currency | CurrencyTypes.NativeCurrency | undefined)[],
33+
paymentCurrencies?: (
34+
| CurrencyTypes.ERC20Currency
35+
| CurrencyTypes.NativeCurrency
36+
| undefined
37+
)[],
3438
logo?: string
3539
) => {
3640
await ensureHtml2PdfLoaded();
@@ -79,7 +83,7 @@ export const exportToPDF = async (
7983
<div id="invoice" style="max-width: 680px; margin: 0 auto; padding: 20px;">
8084
<div style="display: flex; justify-content: space-between; align-items: start;">
8185
${logo && logo.length > 0 ? `<img src="${logo}" alt="Logo" style="width: 50px; height: 50px;">` : ""}
82-
<div style="text-align: right;">
86+
<div style="text-align: right; min-width: 150px; width: auto;">
8387
<p>Issued on ${formatDate(invoice.contentData?.creationDate)}</p>
8488
<p>Payment due by ${formatDate(invoice.contentData?.paymentTerms?.dueDate)}</p>
8589
</div>
@@ -198,11 +202,35 @@ export const exportToPDF = async (
198202
},
199203
};
200204

205+
// Create a hidden container
206+
const container = document.createElement("div");
207+
container.style.cssText = `
208+
position: fixed;
209+
left: -9999px;
210+
top: -9999px;
211+
height: 0;
212+
overflow: hidden;
213+
opacity: 0;
214+
pointer-events: none;
215+
`;
216+
217+
// Create the actual content element (this will be rendered in the PDF)
201218
const element = document.createElement("div");
202219
element.innerHTML = content;
203-
document.body.appendChild(element);
204220

205-
await window.html2pdf().from(element).set(opt).save();
206-
207-
document.body.removeChild(element);
221+
// Add the content element to the hidden container
222+
container.appendChild(element);
223+
document.body.appendChild(container);
224+
225+
try {
226+
await window
227+
.html2pdf()
228+
.from(element) // Use the inner element for PDF generation
229+
.set(opt)
230+
.save();
231+
} finally {
232+
if (document.body.contains(container)) {
233+
document.body.removeChild(container);
234+
}
235+
}
208236
};

shared/utils/initCurrencyManager.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ const defaultCurrencyIds = [
88
"CNY",
99
"GBP",
1010
"JPY",
11-
"DAI-bsc",
12-
"BUSD-bsc",
13-
"ETH-base-base",
1411
"DAI-mainnet",
1512
"ETH-mainnet",
1613
"REQ-mainnet",
@@ -20,16 +17,10 @@ const defaultCurrencyIds = [
2017
"MATIC-matic",
2118
"USDC-matic",
2219
"USDT-matic",
23-
"DAI-optimism",
24-
"ETH-optimism-optimism",
25-
"USDC-optimism",
26-
"USDT-optimism",
2720
"FAU-sepolia",
2821
"ETH-sepolia-sepolia",
2922
"fUSDC-sepolia",
3023
"fUSDT-sepolia",
31-
"USDC-xdai",
32-
"USDC-base",
3324
];
3425

3526
const TOKEN_LIST_URL =

0 commit comments

Comments
 (0)