-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add buzzpay internal app (#580)
* feat: add uncle jim internal app * fix: wrong number in instructions * chore: simplify alby jim internal app copy * Feat: app metadata (#570) * chore: wg.Add() before go (#559) * chore: code cleanup (#558) * Update README.md Add command to make the install script executable in the instructions. * feat: add migration card in wallet screen (#555) * feat: add migration card in wallet screen * chore: transfer funds if channel exists * chore: typo * chore: improve copy * chore: add transfer funds button * fix: remove duplicate icon --------- Co-authored-by: Roland Bewick <roland.bewick@gmail.com> * chore: run extra workflows on PR (#563) * chore: run extra workflows on PR * fix: pull request workflows * build(deps): bump github.com/nbd-wtf/go-nostr from 0.34.5 to 0.34.10 (#551) Bumps [github.com/nbd-wtf/go-nostr](https://github.com/nbd-wtf/go-nostr) from 0.34.5 to 0.34.10. - [Commits](nbd-wtf/go-nostr@v0.34.5...v0.34.10) --- updated-dependencies: - dependency-name: github.com/nbd-wtf/go-nostr dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump gopkg.in/DataDog/dd-trace-go.v1 from 1.66.0 to 1.67.0 (#552) Bumps gopkg.in/DataDog/dd-trace-go.v1 from 1.66.0 to 1.67.0. --- updated-dependencies: - dependency-name: gopkg.in/DataDog/dd-trace-go.v1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: do not render 0 on withdraw onchain funds page when reserve balance is 0 (#549) * chore: update fly default kill timeout to ensure app gracefully shuts down (#547) * feat: app metadata * fix(wails): parse max length in log output endpoint (#568) * fix: alby account image and name on transaction list * fix: vertically center transaction item content * fix: use slashed zero on wallet balance * chore: align app image with app name in transaction list * fix: ensure auth with correct user if refresh token expires (#572) * fix: do not allow editing name of Alby Account connection * fix: change "Create Wallet" to "Create Subaccount" * fix: subaccount copy * chore: update friends and family app icon * fix: update app store images (#574) * fix: update app store images * chore: update paper scissors hodl and zapplanner icons * chore: update lume and habla news icons * chore: resize and compress zapplanner and rps logos --------- Co-authored-by: Roland Bewick <roland.bewick@gmail.com> * feat: add new auto channel flow that works with existing channels (#556) * feat: add new auto channel flow that works with existing channels * chore: remove "first" from auto channel copy * feat: new transaction list item design --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Matjaž Lipuš <matjazl@gmail.com> Co-authored-by: BtcPins <pardus79@gmail.com> Co-authored-by: Michael Bumann <hello@michaelbumann.com> Co-authored-by: Adithya Vardhan <imadithyavardhan@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * feat: add buzzpay internal app * chore: remove connection secret from metadata * fix: make buzzpay isolated * chore: update buzzpay app UI and instructions * chore: extract app creation into shared method * fix: isolated app permission display * chore: update copy --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Matjaž Lipuš <matjazl@gmail.com> Co-authored-by: BtcPins <pardus79@gmail.com> Co-authored-by: Michael Bumann <hello@michaelbumann.com> Co-authored-by: Adithya Vardhan <imadithyavardhan@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7032bba
commit 3266e64
Showing
13 changed files
with
446 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { CreateAppRequest, CreateAppResponse } from "src/types"; | ||
import { request } from "src/utils/request"; | ||
|
||
export async function createApp( | ||
createAppRequest: CreateAppRequest | ||
): Promise<CreateAppResponse> { | ||
const createAppResponse = await request<CreateAppResponse>("/api/apps", { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify(createAppRequest), | ||
}); | ||
|
||
if (!createAppResponse) { | ||
throw new Error("no create app response received"); | ||
} | ||
return createAppResponse; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React from "react"; | ||
import AppHeader from "src/components/AppHeader"; | ||
import AppCard from "src/components/connections/AppCard"; | ||
import Loading from "src/components/Loading"; | ||
import { ExternalLinkButton } from "src/components/ui/button"; | ||
import { LoadingButton } from "src/components/ui/loading-button"; | ||
import { useToast } from "src/components/ui/use-toast"; | ||
import { useApps } from "src/hooks/useApps"; | ||
import { createApp } from "src/requests/createApp"; | ||
import { handleRequestError } from "src/utils/handleRequestError"; | ||
|
||
export function BuzzPay() { | ||
const { data: apps, mutate: reloadApps } = useApps(); | ||
const [creatingApp, setCreatingApp] = React.useState(false); | ||
const [connectionSecret, setConnectionSecret] = React.useState(""); | ||
const { toast } = useToast(); | ||
|
||
if (!apps) { | ||
return <Loading />; | ||
} | ||
const app = apps.find((app) => app.metadata?.app_store_app_id === "buzzpay"); | ||
|
||
function handleCreateApp() { | ||
setCreatingApp(true); | ||
(async () => { | ||
try { | ||
const name = "BuzzPay"; | ||
if (apps?.some((existingApp) => existingApp.name === name)) { | ||
throw new Error("A connection with the same name already exists."); | ||
} | ||
|
||
const createAppResponse = await createApp({ | ||
name, | ||
scopes: ["get_info", "lookup_invoice", "make_invoice"], | ||
isolated: true, | ||
metadata: { | ||
app_store_app_id: "buzzpay", | ||
}, | ||
}); | ||
|
||
setConnectionSecret(createAppResponse.pairingUri); | ||
|
||
await reloadApps(); | ||
|
||
toast({ title: "BuzzPay app created" }); | ||
} catch (error) { | ||
handleRequestError(toast, "Failed to create app", error); | ||
} | ||
setCreatingApp(false); | ||
})(); | ||
} | ||
|
||
return ( | ||
<div className="grid gap-5"> | ||
<AppHeader | ||
title="BuzzPay" | ||
description="Receive-only PoS you can safely share with your employees" | ||
/> | ||
{app && ( | ||
<div className="max-w-lg flex flex-col gap-5"> | ||
<p className="text-muted-foreground"> | ||
Simply click the button below to access your PoS which you can | ||
instantly receive payments, manage your items, and share your PoS | ||
with your employees. | ||
</p> | ||
<ExternalLinkButton | ||
to={`https://pos.albylabs.com${connectionSecret && `/#/wallet/${encodeURIComponent(connectionSecret)}/new`}`} | ||
> | ||
Go to BuzzPay PoS | ||
</ExternalLinkButton> | ||
<AppCard app={app} /> | ||
</div> | ||
)} | ||
{!app && ( | ||
<div className="max-w-lg flex flex-col gap-5"> | ||
<p className="text-muted-foreground"> | ||
By creating a new buzzpay app, a read-only wallet connection will be | ||
created and you will receive a link to a PoS you can share with your | ||
employees, on any device. | ||
</p> | ||
<LoadingButton loading={creatingApp} onClick={handleCreateApp}> | ||
Create BuzzPay App | ||
</LoadingButton> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.