Skip to content

Updates to core, ui #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
7eaeba2
Add new quote screen to demo send flow (#16461)
JasonCWang Apr 7, 2025
c873fef
[bridge] add new progress header design to card forms and design upda…
bsiaotickchong Apr 7, 2025
edffb57
Add send demo autopop modal (#16747)
JasonCWang Apr 11, 2025
3ebde2b
Add graphicHeader to CardForm and update ActivateUma (#16767)
JasonCWang Apr 11, 2025
eb5abc5
[bridge] updated mutations to support email/phone split (#16664)
AaryamanBhute Apr 11, 2025
e215ea7
Add toggle send and receive amount animation (#16570)
JasonCWang Apr 11, 2025
9736edd
clean up kyc page for 3a users (#16868)
matthappens Apr 14, 2025
42db51e
[bridge] transactions zero state update (#16813)
AaryamanBhute Apr 14, 2025
40785c5
fix link bank styling, add language strings (#16879)
matthappens Apr 14, 2025
de0d6a6
[uma-bridge] Fix CardForm key error (#16896)
coreymartin Apr 15, 2025
257e7dc
Remove us2mx invite before onboarding is complete and fix send page a…
JasonCWang Apr 15, 2025
f40f69c
[sparkcore] Validate ui logs input with pydantic (#16860)
coreymartin Apr 15, 2025
5208dfe
[bridge] added UI changes for new reset password workflow (#16715)
AaryamanBhute Apr 17, 2025
c1b5320
[bridge] Fix gk loading create account state, add focus phone input e…
coreymartin Apr 17, 2025
954fa6b
[bridge] temporarily fix infinite render bug with useFields (#16992)
bsiaotickchong Apr 17, 2025
0e41e8d
[ui] Only set fields when defaultFields actually changes (#16997)
coreymartin Apr 18, 2025
552da81
Revert "[bridge] temporarily fix infinite render bug with useFields" …
coreymartin Apr 18, 2025
511d389
Add country code selector to CreateAccount (#16663)
JasonCWang Apr 18, 2025
b66998d
CI update lock file for PR
Apr 18, 2025
8dc02a7
[ui] Ensure fields memoized if haven't changed in call to mergeWithFi…
coreymartin Apr 18, 2025
03254a6
Add search/auto focus to country code selector (#16909)
JasonCWang Apr 18, 2025
4066db6
[bridge] fix margins in onboarding steps, fix activate uma navigation…
bsiaotickchong Apr 18, 2025
a7326f0
[bridge] Move flag SVGs to app and remove react-circle-flags dep (#17…
coreymartin Apr 18, 2025
11b5c0c
CI update lock file for PR
Apr 18, 2025
3840496
[bridge] Support v2 query param to enable related features (#17116)
coreymartin Apr 23, 2025
e3313c0
[bridge] updated verify email (#16890)
AaryamanBhute Apr 23, 2025
687356d
Fix CountryCodeSelector height and keyboard accessibility (#17131)
JasonCWang Apr 24, 2025
3cc6258
[bridge] New start page (#17168)
coreymartin Apr 24, 2025
bd5b17b
[bridge] Fix inner border radius on start page (#17187)
coreymartin Apr 24, 2025
7a483a1
[s2c] gather clabe info (stage 1/2) (#17146)
AaryamanBhute Apr 24, 2025
93d416d
[bridge] New start using UMA page (#17191)
coreymartin Apr 24, 2025
a04b151
removed checkFieldForError from useFields return (#17204)
AaryamanBhute Apr 24, 2025
e2db18c
[site, docs] Update to new logo (#17235)
coreymartin Apr 28, 2025
0fb548c
[s2c] updated nationality select (#17269)
AaryamanBhute Apr 28, 2025
f00a1c4
Fix country code selector height again (#17306)
JasonCWang Apr 28, 2025
31d14c5
[js] Update favicons and manifest files with new logo (#17303)
coreymartin Apr 28, 2025
5a44e79
[bridge] add new invite modal design (#17322)
bsiaotickchong Apr 30, 2025
85fae15
fix birthday input style and add hint (#17401)
JasonCWang May 1, 2025
960294a
[bridge] add success notice after linking bank (#17437)
bsiaotickchong May 1, 2025
171e260
[s2c] added title margin (#17433)
AaryamanBhute May 1, 2025
911f5bd
[bridge] add carousel to home page (#17497)
bsiaotickchong May 5, 2025
d63ba6b
[s2c] added stroke for input icon (#17492)
AaryamanBhute May 5, 2025
3657b33
[UMAaaS][DevTool] Add supported currencies to platform (#17514)
yunyuyunyu May 5, 2025
c45ffbc
[s2c] added promo item and modal (#17526)
AaryamanBhute May 5, 2025
9bd40df
[s2c] Add express setup hook and banner (#17565)
JasonCWang May 7, 2025
78ecb91
[s2c] receipt page (#17552)
AaryamanBhute May 7, 2025
b2aaf29
[js] fix feature gating (#17595)
wuvictor-95 May 9, 2025
302bfa7
[core] Async init Requester wsClient (#17603)
coreymartin May 12, 2025
925f046
Add changesets
coreymartin May 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/grumpy-eagles-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"@lightsparkdev/core": minor
---

- **Test script**
- Renamed `test` to `test-cmd` and made `test` an alias that accepts arbitrary Jest patterns.
- **Requester**
- Switched `wsClient` to a lazily initialized `Promise` resolved in a new `initWsClient` method.
- Moved `autoBind` into constructor and improved cleanup/cancellation logic in `subscribe()`.
- **New tests**
- Added `Requester.test.ts` covering query execution, error handling, subscriptions, and signing logic.
- **Errors utility**
- Enhanced `errorToJSON` to enumerate non-enumerable props and optionally stringify nested objects.
- **LocalStorage utility**
- Made `getLocalStorageBoolean` return `true`/`false`/`null`; `getLocalStorageConfigItem` now defaults missing keys to `false`.
- **Type guards**
- Tightened `isObject` signature, added `isRecord`, and removed a duplicate in `types.ts`.
- **Static assets**
- Replaced the monolithic SVG logo with an optimized, higher-resolution `lightspark-logo.svg`.
36 changes: 36 additions & 0 deletions .changeset/small-lies-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
"@lightsparkdev/ui": patch
---

- **BirthdayInput**
- Dropped internal validity state; added `formatDateToText` hint formatter and “must be before today” validation.
- **TextInput**
- Introduced `success` & `contentError` props, `hideNonErrorsIfBlurred`, configurable `iconOffsets`, `iconStrokeWidths`.
- **PhoneInput**
- Added `onFocus` callback.
- **QRCode**
- Swapped in new `LogoMark` asset (vs. `FramedLogoOnCircle`), adjusted image sizing.
- **Drawer & Modal**
- Added `alignBottom` and `disableTouchMove` flags to support bottom-aligned, non-dismissable drawers.
- **Button & Checkbox**
- New kinds: `green37`, `gray99`, `white21`.
- Added margin props (`mb`, `ml`, `mr`) for fine-grained spacing.
- **CardForm**
- Major refactor: dozens of new props (`aboveHeaderContent`, `graphicHeader`, `centeredContent`, `paddingX`, `contentMarginTop`, `formButtonTopMargin`, `selectMarginTop`, `smDontAdjustWidth`, etc.).
- Extracted `CardFormHeadline`/`CenteredHeader`, wrapped forms in a `Flex` when using graphic headers.
- **InputSubtext**
- Now supports rich React-node `content`, distinguishes error vs. success styling, and respects “hide if blurred” logic.
- **Toasts**
- Added optional `type` (`error` | `success` | `info`) to color toast backgrounds.
- **Hooks**
- **`useFields`**: validator signature now `(value, fields?)`; added `matchesField` and `clabe` validators; smarter merge to prevent unnecessary rerenders.
- **`useQueryParamBooleans`**: new hook for parsing multiple boolean query parameters at once.
- **Icons**
- Introduced dozens of new icons (e.g. `LogoMark`, `LightningBoltOutline`, `NonagonCheckmark`, `NubankLogo`) plus a full “central” icon set under `icons/central/`.
- Standardized on a `PathProps` interface for configurable strokes.
- **Styles & Theme**
- **Colors**: added `gray35`, `gray7`, `white21`, `green37`, `blue32`, `linkLight`.
- **Layout helper**: `buildStandardContentInset` gains an `smDontAdjustWidth` opt-out.
- Tweaked `smHeaderLogoMarginLeft` (30px → 20px).
- **Button themes**: added `white21`, `linkLight`, and `tertiary` kinds.
- **CardForm theme**: now allows zero padding for new layout options.
15 changes: 9 additions & 6 deletions apps/examples/oauth-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>Lightspark OAuth Demo</title>
<meta
name="description"
content="A demo of using oauth with the Lightspark JS SDK"
/>
<link rel="apple-touch-icon" href="/logo192.png" />
<link rel="manifest" href="/manifest.json" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

<title>Lightspark OAuth Demo</title>
<link rel="icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<meta name="theme-color" content="#000000" />

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/examples/oauth-app/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/examples/oauth-app/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/examples/oauth-app/public/favicon-48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/examples/oauth-app/public/favicon.ico
Binary file not shown.
Binary file removed apps/examples/oauth-app/public/logo192.png
Binary file not shown.
Binary file removed apps/examples/oauth-app/public/logo512.png
Binary file not shown.
37 changes: 26 additions & 11 deletions apps/examples/oauth-app/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "Lightspark OAuth App",
"name": "Lightspark OAuth App",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/apple-touch-icon.png",
"sizes": "180x180",
"type": "image/png"
},
{
"src": "/favicon-32x32.png",
"sizes": "32x32",
"type": "image/png"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
"src": "/favicon-16x16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
"src": "/favicon.ico",
"sizes": "16x16 32x32 48x48",
"type": "image/x-icon"
}
],
"start_url": ".",
Expand Down
17 changes: 7 additions & 10 deletions apps/examples/ui-test-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@
<html lang="en">
<head data-commit="__CURRENT_COMMIT__">
<meta charset="utf-8" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-16.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<title>Lightspark UI Test App</title>
<meta
name="description"
content="Lightspark is building infrastructure for the Lightning Network to deliver open payments for the Internet at scale. Lightspark services and tools aim to be the fastest, easiest and most reliable way to send and receive payments globally, with exceptionally low fees, using the Lightning Network."
/>
<link rel="apple-touch-icon" href="/logo192.png" />

<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<meta name="theme-color" content="#000000" />

<title>Lightspark</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
</head>
<body>
<!-- Google Tag Manager (noscript) -->
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/examples/ui-test-app/public/favicon-16.ico
Binary file not shown.
Binary file added apps/examples/ui-test-app/public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/examples/ui-test-app/public/favicon-32.ico
Binary file not shown.
Binary file added apps/examples/ui-test-app/public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/examples/ui-test-app/public/favicon.ico
Binary file not shown.
Binary file removed apps/examples/ui-test-app/public/logo192.png
Binary file not shown.
Binary file removed apps/examples/ui-test-app/public/logo512.png
Binary file not shown.
37 changes: 26 additions & 11 deletions apps/examples/ui-test-app/public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
{
"short_name": "Lightspark",
"name": "Lightspark App",
"short_name": "Lightspark UI Test App",
"name": "Lightspark UI Test App",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "/apple-touch-icon.png",
"sizes": "180x180",
"type": "image/png"
},
{
"src": "/favicon-32x32.png",
"sizes": "32x32",
"type": "image/png"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
"src": "/favicon-16x16.png",
"sizes": "16x16",
"type": "image/png"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
"src": "/favicon.ico",
"sizes": "16x16 32x32 48x48",
"type": "image/x-icon"
}
],
"start_url": ".",
Expand Down
4 changes: 2 additions & 2 deletions apps/examples/ui-test-app/src/tests/toReactNodes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ describe("toReactNodes", () => {
to: TestAppRoutes.PageOne,
},
};
const iconNode = { icon: { name: "LogoBolt" as const } };
const iconNode = { icon: { name: "LogoMark" as const } };
const nextLinkNode = {
nextLink: {
text: "Some next link node that should have typography applied",
Expand Down Expand Up @@ -330,7 +330,7 @@ describe("toReactNodes", () => {
typography: { type: "Display", size: "Medium" } as const,
},
};
const iconNode = { icon: { name: "LogoBolt" } as const };
const iconNode = { icon: { name: "LogoMark" } as const };
const externalLinkNode = {
link: {
text: "Some external link node that should have typography applied",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
"lint": "eslint .",
"package:checks": "yarn publint && yarn attw --pack .",
"postversion": "yarn build",
"test": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail src/**/tests/**/*.test.ts",
"test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail",
"test": "yarn test-cmd -- src/**/tests/**/*.test.ts",
"types:watch": "tsc-absolute --watch",
"types": "tsc"
},
Expand Down
63 changes: 52 additions & 11 deletions packages/core/src/requester/Requester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import dayjs from "dayjs";
import utc from "dayjs/plugin/utc.js";
import type { Client as WsClient } from "graphql-ws";
import { createClient } from "graphql-ws";
import NodeWebSocket from "ws";
import { Observable } from "zen-observable-ts";

import type Query from "./Query.js";
Expand Down Expand Up @@ -33,7 +32,8 @@ type BodyData = {
};

class Requester {
private readonly wsClient: WsClient;
private wsClient: Promise<WsClient>;
private resolveWsClient: ((value: WsClient) => void) | null = null;
constructor(
private readonly nodeKeyCache: NodeKeyCache,
private readonly schemaEndpoint: string,
Expand All @@ -44,22 +44,43 @@ class Requester {
private readonly signingKey?: SigningKey,
private readonly fetchImpl: typeof fetch = fetch,
) {
this.wsClient = new Promise<WsClient>((resolve) => {
this.resolveWsClient = resolve;
});
void this.initWsClient(baseUrl, authProvider);
autoBind(this);
}

private async initWsClient(baseUrl: string, authProvider: AuthProvider) {
if (!this.resolveWsClient) {
/* If resolveWsClient is null assume already initialized: */
return this.wsClient;
}

let websocketImpl;
if (typeof WebSocket === "undefined" && typeof window === "undefined") {
websocketImpl = NodeWebSocket;
if (isNode && typeof WebSocket === "undefined") {
const wsModule = await import("ws");
websocketImpl = wsModule.default;
}
let websocketProtocol = "wss";
if (baseUrl.startsWith("http://")) {
websocketProtocol = "ws";
}
this.wsClient = createClient({

const wsClient = createClient({
url: `${websocketProtocol}://${this.stripProtocol(this.baseUrl)}/${
this.schemaEndpoint
}`,
connectionParams: () => authProvider.addWsConnectionParams({}),
webSocketImpl: websocketImpl,
});
autoBind(this);

if (this.resolveWsClient) {
this.resolveWsClient(wsClient);
this.resolveWsClient = null;
}

return wsClient;
}

public async executeQuery<T>(query: Query<T>): Promise<T | null> {
Expand Down Expand Up @@ -106,11 +127,31 @@ class Requester {

return new Observable<{ data: T }>((observer) => {
logger.trace(`Requester.subscribe observer`, observer);
return this.wsClient.subscribe(bodyData, {
next: (data) => observer.next(data as { data: T }),
error: (err) => observer.error(err),
complete: () => observer.complete(),
});

let cleanup: (() => void) | null = null;
let canceled = false;

void (async () => {
try {
const wsClient = await this.wsClient;
if (!canceled) {
cleanup = wsClient.subscribe(bodyData, {
next: (data) => observer.next(data as { data: T }),
error: (err) => observer.error(err),
complete: () => observer.complete(),
});
}
} catch (err) {
observer.error(err);
}
})();

return () => {
canceled = true;
if (cleanup) {
cleanup();
}
};
});
}

Expand Down
Loading