From 5c299f1998f8893c27e2c63a9b595a8bc76d7618 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Thu, 21 Aug 2025 15:21:13 -0700 Subject: [PATCH 01/13] [penny test] Add pending state for name match (#19940) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Reason In order to enforce name matching in the MX onboarding flow, we need to add a pending page and different landing pages depending on the name matching result. This PR adds the pending page when the GK is enabled. Design: https://www.figma.com/design/hb8mqsg0n3QKJHpJA0ahkI/MXN-Grid-Switch?node-id=17-15925&m=dev Screenshots below: ![Screenshot 2025-08-21 at 2.24.16 PM.png](https://app.graphite.dev/user-attachments/assets/555e2954-9675-4222-a33c-d91bd164cf3e.png) ![Screenshot 2025-08-21 at 2.24.32 PM.png](https://app.graphite.dev/user-attachments/assets/070c7fbb-4f54-4c13-a3da-dbb51d0077d2.png) GitOrigin-RevId: 16f902a477add267300b15f73f2420bbadccbd53 --- apps/examples/nodejs-scripts/CHANGELOG.md | 7 ------- apps/examples/nodejs-scripts/package.json | 4 ++-- apps/examples/oauth-app/CHANGELOG.md | 9 --------- apps/examples/oauth-app/package.json | 6 +++--- apps/examples/remote-signing-server/CHANGELOG.md | 7 ------- apps/examples/remote-signing-server/package.json | 4 ++-- apps/examples/ui-test-app/CHANGELOG.md | 7 ------- apps/examples/ui-test-app/package.json | 4 ++-- apps/examples/uma-vasp-cli/CHANGELOG.md | 7 ------- apps/examples/uma-vasp-cli/package.json | 4 ++-- apps/examples/uma-vasp/CHANGELOG.md | 7 ------- apps/examples/uma-vasp/package.json | 4 ++-- packages/lightspark-cli/CHANGELOG.md | 7 ------- packages/lightspark-cli/package.json | 4 ++-- packages/lightspark-sdk/CHANGELOG.md | 6 ------ packages/lightspark-sdk/package.json | 2 +- packages/ui/CHANGELOG.md | 6 ------ packages/ui/package.json | 2 +- packages/ui/src/icons/central/People.tsx | 8 +------- packages/ui/src/styles/colors.tsx | 1 + 20 files changed, 19 insertions(+), 87 deletions(-) diff --git a/apps/examples/nodejs-scripts/CHANGELOG.md b/apps/examples/nodejs-scripts/CHANGELOG.md index 4526edbef..72ba7e165 100644 --- a/apps/examples/nodejs-scripts/CHANGELOG.md +++ b/apps/examples/nodejs-scripts/CHANGELOG.md @@ -1,12 +1,5 @@ # @lightsparkdev/nodejs-scripts -## 0.0.30 - -### Patch Changes - -- Updated dependencies [21b1acc] - - @lightsparkdev/lightspark-sdk@1.9.8 - ## 0.0.29 ### Patch Changes diff --git a/apps/examples/nodejs-scripts/package.json b/apps/examples/nodejs-scripts/package.json index 64d25d719..b079e74a2 100644 --- a/apps/examples/nodejs-scripts/package.json +++ b/apps/examples/nodejs-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/nodejs-scripts", - "version": "0.0.30", + "version": "0.0.29", "private": true, "description": "Example NodeJS scripts for Lightspark JS SDKs", "main": "index.js", @@ -34,7 +34,7 @@ }, "dependencies": { "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.8", + "@lightsparkdev/lightspark-sdk": "1.9.7", "commander": "^11.0.0", "dayjs": "^1.11.7", "lodash-es": "^4.17.21" diff --git a/apps/examples/oauth-app/CHANGELOG.md b/apps/examples/oauth-app/CHANGELOG.md index 9646803d4..7d00b89a5 100644 --- a/apps/examples/oauth-app/CHANGELOG.md +++ b/apps/examples/oauth-app/CHANGELOG.md @@ -1,14 +1,5 @@ # @lightsparkdev/oauth-app -## 0.0.58 - -### Patch Changes - -- Updated dependencies [21b1acc] -- Updated dependencies [21b1acc] - - @lightsparkdev/lightspark-sdk@1.9.8 - - @lightsparkdev/ui@1.1.9 - ## 0.0.57 ### Patch Changes diff --git a/apps/examples/oauth-app/package.json b/apps/examples/oauth-app/package.json index 1be6ff710..b9f3e0932 100644 --- a/apps/examples/oauth-app/package.json +++ b/apps/examples/oauth-app/package.json @@ -1,14 +1,14 @@ { "name": "@lightsparkdev/oauth-app", - "version": "0.0.58", + "version": "0.0.57", "private": true, "dependencies": { "@emotion/css": "^11.11.0", "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", - "@lightsparkdev/lightspark-sdk": "1.9.8", + "@lightsparkdev/lightspark-sdk": "1.9.7", "@lightsparkdev/oauth": "*", - "@lightsparkdev/ui": "1.1.9", + "@lightsparkdev/ui": "1.1.8", "react": "^18.2.0", "react-dom": "^18.1.0", "react-router-dom": "6.11.2", diff --git a/apps/examples/remote-signing-server/CHANGELOG.md b/apps/examples/remote-signing-server/CHANGELOG.md index 9bf3c9f42..4968080b6 100644 --- a/apps/examples/remote-signing-server/CHANGELOG.md +++ b/apps/examples/remote-signing-server/CHANGELOG.md @@ -1,12 +1,5 @@ # @lightsparkdev/remote-signing-server -## 0.0.54 - -### Patch Changes - -- Updated dependencies [21b1acc] - - @lightsparkdev/lightspark-sdk@1.9.8 - ## 0.0.53 ### Patch Changes diff --git a/apps/examples/remote-signing-server/package.json b/apps/examples/remote-signing-server/package.json index a97749e81..00e350a82 100644 --- a/apps/examples/remote-signing-server/package.json +++ b/apps/examples/remote-signing-server/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/remote-signing-server", - "version": "0.0.54", + "version": "0.0.53", "private": true, "type": "module", "scripts": { @@ -18,7 +18,7 @@ }, "dependencies": { "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.8", + "@lightsparkdev/lightspark-sdk": "1.9.7", "express": "^4.18.2" }, "devDependencies": { diff --git a/apps/examples/ui-test-app/CHANGELOG.md b/apps/examples/ui-test-app/CHANGELOG.md index ce21926c6..58ab3e6c8 100644 --- a/apps/examples/ui-test-app/CHANGELOG.md +++ b/apps/examples/ui-test-app/CHANGELOG.md @@ -1,12 +1,5 @@ # @lightsparkdev/ui-test-app -## 0.0.28 - -### Patch Changes - -- Updated dependencies [21b1acc] - - @lightsparkdev/ui@1.1.9 - ## 0.0.27 ### Patch Changes diff --git a/apps/examples/ui-test-app/package.json b/apps/examples/ui-test-app/package.json index 87a6fe90b..665c74ea4 100644 --- a/apps/examples/ui-test-app/package.json +++ b/apps/examples/ui-test-app/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/ui-test-app", - "version": "0.0.28", + "version": "0.0.27", "description": "Lightspark UI components", "author": "Lightspark Inc.", "main": "./dist/index.js", @@ -30,7 +30,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/ui": "1.1.9", + "@lightsparkdev/ui": "1.1.8", "react": "^18.2.0", "react-dom": "^18.1.0", "react-router-dom": "6.11.2" diff --git a/apps/examples/uma-vasp-cli/CHANGELOG.md b/apps/examples/uma-vasp-cli/CHANGELOG.md index 0ce1de6fb..e6485a993 100644 --- a/apps/examples/uma-vasp-cli/CHANGELOG.md +++ b/apps/examples/uma-vasp-cli/CHANGELOG.md @@ -1,12 +1,5 @@ # @lightsparkdev/uma-vasp-cli -## 0.0.35 - -### Patch Changes - -- Updated dependencies [21b1acc] - - @lightsparkdev/lightspark-sdk@1.9.8 - ## 0.0.34 ### Patch Changes diff --git a/apps/examples/uma-vasp-cli/package.json b/apps/examples/uma-vasp-cli/package.json index b25f85855..ca0ef9e7e 100644 --- a/apps/examples/uma-vasp-cli/package.json +++ b/apps/examples/uma-vasp-cli/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/uma-vasp-cli", - "version": "0.0.35", + "version": "0.0.34", "private": true, "description": "CLI for the Demo UMA VASP in ../apps/examples/uma-vasp", "main": "./dist/index.js", @@ -44,7 +44,7 @@ "dependencies": { "@inquirer/prompts": "^1.1.3", "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.8", + "@lightsparkdev/lightspark-sdk": "1.9.7", "@uma-sdk/core": "^1.3.0", "chalk": "^5.3.0", "commander": "^11.0.0" diff --git a/apps/examples/uma-vasp/CHANGELOG.md b/apps/examples/uma-vasp/CHANGELOG.md index f2f6dd474..364132002 100644 --- a/apps/examples/uma-vasp/CHANGELOG.md +++ b/apps/examples/uma-vasp/CHANGELOG.md @@ -1,12 +1,5 @@ # @lightsparkdev/uma-vasp -## 0.0.55 - -### Patch Changes - -- Updated dependencies [21b1acc] - - @lightsparkdev/lightspark-sdk@1.9.8 - ## 0.0.54 ### Patch Changes diff --git a/apps/examples/uma-vasp/package.json b/apps/examples/uma-vasp/package.json index 6c28aaae6..1d4736696 100644 --- a/apps/examples/uma-vasp/package.json +++ b/apps/examples/uma-vasp/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/uma-vasp", - "version": "0.0.55", + "version": "0.0.54", "private": true, "type": "module", "scripts": { @@ -16,7 +16,7 @@ "main": "dist/index.js", "dependencies": { "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.8", + "@lightsparkdev/lightspark-sdk": "1.9.7", "@uma-sdk/core": "^1.3.0", "express": "^4.18.2", "express-async-handler": "^1.2.0", diff --git a/packages/lightspark-cli/CHANGELOG.md b/packages/lightspark-cli/CHANGELOG.md index f176f08fa..ebd4f5bf8 100644 --- a/packages/lightspark-cli/CHANGELOG.md +++ b/packages/lightspark-cli/CHANGELOG.md @@ -1,12 +1,5 @@ # @lightsparkdev/lightspark-cli -## 0.1.8 - -### Patch Changes - -- Updated dependencies [21b1acc] - - @lightsparkdev/lightspark-sdk@1.9.8 - ## 0.1.7 ### Patch Changes diff --git a/packages/lightspark-cli/package.json b/packages/lightspark-cli/package.json index cf774750f..f554682ed 100644 --- a/packages/lightspark-cli/package.json +++ b/packages/lightspark-cli/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/lightspark-cli", - "version": "0.1.8", + "version": "0.1.7", "description": "CLI for the Lightspark JS sdk", "main": "./dist/index.js", "bin": { @@ -46,7 +46,7 @@ "@inquirer/prompts": "^1.1.3", "@lightsparkdev/core": "1.4.3", "@lightsparkdev/crypto-wasm": "0.1.17", - "@lightsparkdev/lightspark-sdk": "1.9.8", + "@lightsparkdev/lightspark-sdk": "1.9.7", "commander": "^11.0.0", "dayjs": "^1.11.7", "dotenv": "^16.3.1", diff --git a/packages/lightspark-sdk/CHANGELOG.md b/packages/lightspark-sdk/CHANGELOG.md index 6e9bef090..ebd47895d 100644 --- a/packages/lightspark-sdk/CHANGELOG.md +++ b/packages/lightspark-sdk/CHANGELOG.md @@ -1,11 +1,5 @@ # @lightsparkdev/lightspark-sdk -## 1.9.8 - -### Patch Changes - -- 21b1acc: fix: wasm returned a double stringified json object where the webhook signing handler only expected it to be stringifed once. This change parses the string twice. - ## 1.9.7 ### Patch Changes diff --git a/packages/lightspark-sdk/package.json b/packages/lightspark-sdk/package.json index ae0b0bbb3..1f12a7656 100644 --- a/packages/lightspark-sdk/package.json +++ b/packages/lightspark-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/lightspark-sdk", - "version": "1.9.8", + "version": "1.9.7", "description": "Lightspark JS SDK", "author": "Lightspark Inc.", "keywords": [ diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index 635e8753b..a2b57fc93 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -1,11 +1,5 @@ # @lightsparkdev/ui -## 1.1.9 - -### Patch Changes - -- 21b1acc: feat: New UI elements for Lightspark FE - ## 1.1.8 ### Patch Changes diff --git a/packages/ui/package.json b/packages/ui/package.json index 373bf2d59..d6fdc3e19 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/ui", - "version": "1.1.9", + "version": "1.1.8", "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/ui/src/icons/central/People.tsx b/packages/ui/src/icons/central/People.tsx index dcb8869c9..5cdc2720f 100644 --- a/packages/ui/src/icons/central/People.tsx +++ b/packages/ui/src/icons/central/People.tsx @@ -6,13 +6,7 @@ export function People({ strokeLinejoin = "round", }: PathProps) { return ( - + Date: Thu, 21 Aug 2025 22:48:54 +0000 Subject: [PATCH 02/13] Update from public js-sdk main branch (#19974) Update public `js` sources with the latest code from the [public repository](https://github.com/lightsparkdev/js-sdk) main branch. This typically happens when new versions of the SDK are released and version updates need to be synced. The PR should be merged as soon as possible to avoid updates to webdev overwriting the changes in the js-sdk develop branch. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Lightspark Eng Co-authored-by: Peng Ying GitOrigin-RevId: e30a45111187be96d3583658bd02bb271521e53f --- apps/examples/nodejs-scripts/CHANGELOG.md | 7 +++++++ apps/examples/nodejs-scripts/package.json | 4 ++-- apps/examples/oauth-app/CHANGELOG.md | 9 +++++++++ apps/examples/oauth-app/package.json | 6 +++--- apps/examples/remote-signing-server/CHANGELOG.md | 7 +++++++ apps/examples/remote-signing-server/package.json | 4 ++-- apps/examples/ui-test-app/CHANGELOG.md | 7 +++++++ apps/examples/ui-test-app/package.json | 4 ++-- apps/examples/uma-vasp-cli/CHANGELOG.md | 7 +++++++ apps/examples/uma-vasp-cli/package.json | 4 ++-- apps/examples/uma-vasp/CHANGELOG.md | 7 +++++++ apps/examples/uma-vasp/package.json | 4 ++-- packages/lightspark-cli/CHANGELOG.md | 7 +++++++ packages/lightspark-cli/package.json | 4 ++-- packages/lightspark-sdk/CHANGELOG.md | 6 ++++++ packages/lightspark-sdk/package.json | 2 +- packages/ui/CHANGELOG.md | 6 ++++++ packages/ui/package.json | 2 +- 18 files changed, 80 insertions(+), 17 deletions(-) diff --git a/apps/examples/nodejs-scripts/CHANGELOG.md b/apps/examples/nodejs-scripts/CHANGELOG.md index 72ba7e165..4526edbef 100644 --- a/apps/examples/nodejs-scripts/CHANGELOG.md +++ b/apps/examples/nodejs-scripts/CHANGELOG.md @@ -1,5 +1,12 @@ # @lightsparkdev/nodejs-scripts +## 0.0.30 + +### Patch Changes + +- Updated dependencies [21b1acc] + - @lightsparkdev/lightspark-sdk@1.9.8 + ## 0.0.29 ### Patch Changes diff --git a/apps/examples/nodejs-scripts/package.json b/apps/examples/nodejs-scripts/package.json index b079e74a2..64d25d719 100644 --- a/apps/examples/nodejs-scripts/package.json +++ b/apps/examples/nodejs-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/nodejs-scripts", - "version": "0.0.29", + "version": "0.0.30", "private": true, "description": "Example NodeJS scripts for Lightspark JS SDKs", "main": "index.js", @@ -34,7 +34,7 @@ }, "dependencies": { "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.7", + "@lightsparkdev/lightspark-sdk": "1.9.8", "commander": "^11.0.0", "dayjs": "^1.11.7", "lodash-es": "^4.17.21" diff --git a/apps/examples/oauth-app/CHANGELOG.md b/apps/examples/oauth-app/CHANGELOG.md index 7d00b89a5..9646803d4 100644 --- a/apps/examples/oauth-app/CHANGELOG.md +++ b/apps/examples/oauth-app/CHANGELOG.md @@ -1,5 +1,14 @@ # @lightsparkdev/oauth-app +## 0.0.58 + +### Patch Changes + +- Updated dependencies [21b1acc] +- Updated dependencies [21b1acc] + - @lightsparkdev/lightspark-sdk@1.9.8 + - @lightsparkdev/ui@1.1.9 + ## 0.0.57 ### Patch Changes diff --git a/apps/examples/oauth-app/package.json b/apps/examples/oauth-app/package.json index b9f3e0932..1be6ff710 100644 --- a/apps/examples/oauth-app/package.json +++ b/apps/examples/oauth-app/package.json @@ -1,14 +1,14 @@ { "name": "@lightsparkdev/oauth-app", - "version": "0.0.57", + "version": "0.0.58", "private": true, "dependencies": { "@emotion/css": "^11.11.0", "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", - "@lightsparkdev/lightspark-sdk": "1.9.7", + "@lightsparkdev/lightspark-sdk": "1.9.8", "@lightsparkdev/oauth": "*", - "@lightsparkdev/ui": "1.1.8", + "@lightsparkdev/ui": "1.1.9", "react": "^18.2.0", "react-dom": "^18.1.0", "react-router-dom": "6.11.2", diff --git a/apps/examples/remote-signing-server/CHANGELOG.md b/apps/examples/remote-signing-server/CHANGELOG.md index 4968080b6..9bf3c9f42 100644 --- a/apps/examples/remote-signing-server/CHANGELOG.md +++ b/apps/examples/remote-signing-server/CHANGELOG.md @@ -1,5 +1,12 @@ # @lightsparkdev/remote-signing-server +## 0.0.54 + +### Patch Changes + +- Updated dependencies [21b1acc] + - @lightsparkdev/lightspark-sdk@1.9.8 + ## 0.0.53 ### Patch Changes diff --git a/apps/examples/remote-signing-server/package.json b/apps/examples/remote-signing-server/package.json index 00e350a82..a97749e81 100644 --- a/apps/examples/remote-signing-server/package.json +++ b/apps/examples/remote-signing-server/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/remote-signing-server", - "version": "0.0.53", + "version": "0.0.54", "private": true, "type": "module", "scripts": { @@ -18,7 +18,7 @@ }, "dependencies": { "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.7", + "@lightsparkdev/lightspark-sdk": "1.9.8", "express": "^4.18.2" }, "devDependencies": { diff --git a/apps/examples/ui-test-app/CHANGELOG.md b/apps/examples/ui-test-app/CHANGELOG.md index 58ab3e6c8..ce21926c6 100644 --- a/apps/examples/ui-test-app/CHANGELOG.md +++ b/apps/examples/ui-test-app/CHANGELOG.md @@ -1,5 +1,12 @@ # @lightsparkdev/ui-test-app +## 0.0.28 + +### Patch Changes + +- Updated dependencies [21b1acc] + - @lightsparkdev/ui@1.1.9 + ## 0.0.27 ### Patch Changes diff --git a/apps/examples/ui-test-app/package.json b/apps/examples/ui-test-app/package.json index 665c74ea4..87a6fe90b 100644 --- a/apps/examples/ui-test-app/package.json +++ b/apps/examples/ui-test-app/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/ui-test-app", - "version": "0.0.27", + "version": "0.0.28", "description": "Lightspark UI components", "author": "Lightspark Inc.", "main": "./dist/index.js", @@ -30,7 +30,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/ui": "1.1.8", + "@lightsparkdev/ui": "1.1.9", "react": "^18.2.0", "react-dom": "^18.1.0", "react-router-dom": "6.11.2" diff --git a/apps/examples/uma-vasp-cli/CHANGELOG.md b/apps/examples/uma-vasp-cli/CHANGELOG.md index e6485a993..0ce1de6fb 100644 --- a/apps/examples/uma-vasp-cli/CHANGELOG.md +++ b/apps/examples/uma-vasp-cli/CHANGELOG.md @@ -1,5 +1,12 @@ # @lightsparkdev/uma-vasp-cli +## 0.0.35 + +### Patch Changes + +- Updated dependencies [21b1acc] + - @lightsparkdev/lightspark-sdk@1.9.8 + ## 0.0.34 ### Patch Changes diff --git a/apps/examples/uma-vasp-cli/package.json b/apps/examples/uma-vasp-cli/package.json index ca0ef9e7e..b25f85855 100644 --- a/apps/examples/uma-vasp-cli/package.json +++ b/apps/examples/uma-vasp-cli/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/uma-vasp-cli", - "version": "0.0.34", + "version": "0.0.35", "private": true, "description": "CLI for the Demo UMA VASP in ../apps/examples/uma-vasp", "main": "./dist/index.js", @@ -44,7 +44,7 @@ "dependencies": { "@inquirer/prompts": "^1.1.3", "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.7", + "@lightsparkdev/lightspark-sdk": "1.9.8", "@uma-sdk/core": "^1.3.0", "chalk": "^5.3.0", "commander": "^11.0.0" diff --git a/apps/examples/uma-vasp/CHANGELOG.md b/apps/examples/uma-vasp/CHANGELOG.md index 364132002..f2f6dd474 100644 --- a/apps/examples/uma-vasp/CHANGELOG.md +++ b/apps/examples/uma-vasp/CHANGELOG.md @@ -1,5 +1,12 @@ # @lightsparkdev/uma-vasp +## 0.0.55 + +### Patch Changes + +- Updated dependencies [21b1acc] + - @lightsparkdev/lightspark-sdk@1.9.8 + ## 0.0.54 ### Patch Changes diff --git a/apps/examples/uma-vasp/package.json b/apps/examples/uma-vasp/package.json index 1d4736696..6c28aaae6 100644 --- a/apps/examples/uma-vasp/package.json +++ b/apps/examples/uma-vasp/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/uma-vasp", - "version": "0.0.54", + "version": "0.0.55", "private": true, "type": "module", "scripts": { @@ -16,7 +16,7 @@ "main": "dist/index.js", "dependencies": { "@lightsparkdev/core": "1.4.3", - "@lightsparkdev/lightspark-sdk": "1.9.7", + "@lightsparkdev/lightspark-sdk": "1.9.8", "@uma-sdk/core": "^1.3.0", "express": "^4.18.2", "express-async-handler": "^1.2.0", diff --git a/packages/lightspark-cli/CHANGELOG.md b/packages/lightspark-cli/CHANGELOG.md index ebd4f5bf8..f176f08fa 100644 --- a/packages/lightspark-cli/CHANGELOG.md +++ b/packages/lightspark-cli/CHANGELOG.md @@ -1,5 +1,12 @@ # @lightsparkdev/lightspark-cli +## 0.1.8 + +### Patch Changes + +- Updated dependencies [21b1acc] + - @lightsparkdev/lightspark-sdk@1.9.8 + ## 0.1.7 ### Patch Changes diff --git a/packages/lightspark-cli/package.json b/packages/lightspark-cli/package.json index f554682ed..cf774750f 100644 --- a/packages/lightspark-cli/package.json +++ b/packages/lightspark-cli/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/lightspark-cli", - "version": "0.1.7", + "version": "0.1.8", "description": "CLI for the Lightspark JS sdk", "main": "./dist/index.js", "bin": { @@ -46,7 +46,7 @@ "@inquirer/prompts": "^1.1.3", "@lightsparkdev/core": "1.4.3", "@lightsparkdev/crypto-wasm": "0.1.17", - "@lightsparkdev/lightspark-sdk": "1.9.7", + "@lightsparkdev/lightspark-sdk": "1.9.8", "commander": "^11.0.0", "dayjs": "^1.11.7", "dotenv": "^16.3.1", diff --git a/packages/lightspark-sdk/CHANGELOG.md b/packages/lightspark-sdk/CHANGELOG.md index ebd47895d..6e9bef090 100644 --- a/packages/lightspark-sdk/CHANGELOG.md +++ b/packages/lightspark-sdk/CHANGELOG.md @@ -1,5 +1,11 @@ # @lightsparkdev/lightspark-sdk +## 1.9.8 + +### Patch Changes + +- 21b1acc: fix: wasm returned a double stringified json object where the webhook signing handler only expected it to be stringifed once. This change parses the string twice. + ## 1.9.7 ### Patch Changes diff --git a/packages/lightspark-sdk/package.json b/packages/lightspark-sdk/package.json index 1f12a7656..ae0b0bbb3 100644 --- a/packages/lightspark-sdk/package.json +++ b/packages/lightspark-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/lightspark-sdk", - "version": "1.9.7", + "version": "1.9.8", "description": "Lightspark JS SDK", "author": "Lightspark Inc.", "keywords": [ diff --git a/packages/ui/CHANGELOG.md b/packages/ui/CHANGELOG.md index a2b57fc93..635e8753b 100644 --- a/packages/ui/CHANGELOG.md +++ b/packages/ui/CHANGELOG.md @@ -1,5 +1,11 @@ # @lightsparkdev/ui +## 1.1.9 + +### Patch Changes + +- 21b1acc: feat: New UI elements for Lightspark FE + ## 1.1.8 ### Patch Changes diff --git a/packages/ui/package.json b/packages/ui/package.json index d6fdc3e19..373bf2d59 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@lightsparkdev/ui", - "version": "1.1.8", + "version": "1.1.9", "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", From 8a0eec64db5de9c546f4e0d0465831c1284d778c Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Fri, 22 Aug 2025 09:36:25 -0700 Subject: [PATCH 03/13] [penny test] Add other landing pages to name verification (#19968) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![Screenshot 2025-08-21 at 5.07.39 PM.png](https://app.graphite.dev/user-attachments/assets/00da5f22-8717-4364-b756-df21aad7488d.png) ![Screenshot 2025-08-21 at 5.07.58 PM.png](https://app.graphite.dev/user-attachments/assets/f7825e52-4fa7-450e-bfbc-5a3bac1c31da.png) GitOrigin-RevId: fd51392ec1ad6c61ea11a55e4810cf5ff0bce6df --- packages/ui/src/icons/central/Checkmark2.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/ui/src/icons/central/Checkmark2.tsx b/packages/ui/src/icons/central/Checkmark2.tsx index c1cce374e..45c6dc551 100644 --- a/packages/ui/src/icons/central/Checkmark2.tsx +++ b/packages/ui/src/icons/central/Checkmark2.tsx @@ -6,13 +6,7 @@ export function Checkmark2({ strokeLinejoin = "round", }: PathProps) { return ( - + Date: Fri, 22 Aug 2025 12:57:21 -0700 Subject: [PATCH 04/13] Add new uma card status for pending name verification (#19996) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![Screenshot 2025-08-22 at 12.52.46 PM.png](https://app.graphite.dev/user-attachments/assets/fa2e9b48-d1e9-4ed1-9999-2ec91e297b02.png) ![Screenshot 2025-08-22 at 12.52.49 PM.png](https://app.graphite.dev/user-attachments/assets/f71dbeee-9947-4014-b63c-7d45e516d6b8.png) GitOrigin-RevId: 8a5e2a6ef5f2d08ce7ea2ce14fe9fc59a4cfb714 --- packages/ui/src/icons/UmaPaymentLoadingSpinner.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/ui/src/icons/UmaPaymentLoadingSpinner.tsx b/packages/ui/src/icons/UmaPaymentLoadingSpinner.tsx index b223ec466..ee410fa9e 100644 --- a/packages/ui/src/icons/UmaPaymentLoadingSpinner.tsx +++ b/packages/ui/src/icons/UmaPaymentLoadingSpinner.tsx @@ -5,13 +5,7 @@ export function UmaPaymentLoadingSpinner({ strokeLinecap = "round", }: PathProps) { return ( - + Date: Sun, 24 Aug 2025 20:24:36 -0700 Subject: [PATCH 05/13] switch to use fun facts wrapper and transitioning text (#20036) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Reason Add "fun facts" while users wait for their kyc to complete ## Overview This re-uses the same fun facts component from LinkBankMX ## Test Plan KYC a user - while their kyc is in pending state, we should see the following screen, complete with fun facts ![Screenshot 2025-08-24 at 6.21.54 PM.png](https://app.graphite.dev/user-attachments/assets/cf729f5e-7ec8-4fb8-ae33-de2e10c63231.png) GitOrigin-RevId: fe6335c827bd3110d2915b288da66b6de04d3e11 --- packages/ui/src/components/Loading.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/components/Loading.tsx b/packages/ui/src/components/Loading.tsx index 5ffa38416..0de30e2d0 100644 --- a/packages/ui/src/components/Loading.tsx +++ b/packages/ui/src/components/Loading.tsx @@ -1,6 +1,7 @@ import { useTheme, type Theme } from "@emotion/react"; import styled from "@emotion/styled"; import { type LoadingThemeKey } from "../styles/themeDefaults/loading.js"; +import { type FontColorKey } from "../styles/themes.js"; import { Icon } from "./Icon/Icon.js"; export const loadingKinds = ["primary", "secondary"] as const; @@ -12,6 +13,7 @@ type Props = { ml?: number; mt?: number; kind?: LoadingKind; + color?: FontColorKey | undefined; }; export function Loading({ @@ -20,6 +22,7 @@ export function Loading({ ml = 0, mt = 0, kind = "primary", + color = undefined, }: Props) { const theme = useTheme(); const iconName = resolveLoadingProp(null, kind, "defaultIconName", theme); @@ -27,7 +30,7 @@ export function Loading({ return ( - + ); From b7f21fe5eb49a803cdedde533cf5fcb37e7a6f82 Mon Sep 17 00:00:00 2001 From: Jason Wang Date: Mon, 25 Aug 2025 13:37:30 -0700 Subject: [PATCH 06/13] [Nage] Move CommandCenter to SideNav (#19881) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ![Screenshot 2025-08-18 at 5.25.07 PM.png](https://app.graphite.dev/user-attachments/assets/0fb72900-d9b6-4010-9274-9cfafa4245c0.png) GitOrigin-RevId: 6388684ba3bcce5fad01df8fbbb3621f23691c04 --- packages/ui/src/icons/central/Home.tsx | 25 +++++++++++++++++++++++++ packages/ui/src/icons/central/index.tsx | 1 + 2 files changed, 26 insertions(+) create mode 100644 packages/ui/src/icons/central/Home.tsx diff --git a/packages/ui/src/icons/central/Home.tsx b/packages/ui/src/icons/central/Home.tsx new file mode 100644 index 000000000..f157d70fa --- /dev/null +++ b/packages/ui/src/icons/central/Home.tsx @@ -0,0 +1,25 @@ +import { type PathProps } from "../types.js"; + +export function Home({ + strokeWidth = "1.5", + strokeLinecap = "round", + strokeLinejoin = "round", +}: PathProps) { + return ( + + + + ); +} diff --git a/packages/ui/src/icons/central/index.tsx b/packages/ui/src/icons/central/index.tsx index 0fbe59f08..7f1067072 100644 --- a/packages/ui/src/icons/central/index.tsx +++ b/packages/ui/src/icons/central/index.tsx @@ -71,6 +71,7 @@ export { Gift as CentralGift } from "./Gift.js"; export { Globus as CentralGlobus } from "./Globus.js"; export { Group3 as CentralGroup3 } from "./Group3.js"; export { Heart2 as CentralHeart2 } from "./Heart2.js"; +export { Home as CentralHome } from "./Home.js"; export { HomeLine as CentralHomeLine } from "./HomeLine.js"; export { Initiatives as CentralInitiatives } from "./Initiatives.js"; export { Invite as CentralInvite } from "./Invite.js"; From 3897891685fec09e11d5c580ae1d135d4d20e6c3 Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Tue, 26 Aug 2025 17:35:26 -0400 Subject: [PATCH 07/13] [core] Add circular-deps check and resolve issues (#20020) ## Reason Typically we have this circular-deps check for JS packages but it was never added to this one. I realized it's causing a downstream issue so this adds the check and resolves circular deps. GitOrigin-RevId: 1ea0bf0d6f3c7f48a38527f971cb9c32c90b6a7a --- packages/core/package.json | 12 ++++++++++++ packages/core/src/Logger.ts | 3 ++- packages/core/src/crypto/SigningKey.ts | 6 ++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index eb7ae5275..d6fabef46 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -51,6 +51,7 @@ "lint:fix": "eslint --fix .", "lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color", "lint": "eslint .", + "circular-deps": "madge --circular --extensions ts,tsx src", "package:checks": "yarn publint && yarn attw --pack .", "postversion": "yarn build", "test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail", @@ -81,6 +82,7 @@ "eslint-watch": "^8.0.0", "jest": "^29.6.2", "lodash-es": "^4.17.21", + "madge": "^6.1.0", "prettier": "3.0.3", "prettier-plugin-organize-imports": "^3.2.4", "publint": "^0.3.9", @@ -89,6 +91,16 @@ "tsup": "^8.2.4", "typescript": "^5.6.2" }, + "madge": { + "detectiveOptions": { + "ts": { + "skipTypeImports": true + }, + "tsx": { + "skipTypeImports": true + } + } + }, "engines": { "node": ">=18" } diff --git a/packages/core/src/Logger.ts b/packages/core/src/Logger.ts index c27a05164..f5694fdf9 100644 --- a/packages/core/src/Logger.ts +++ b/packages/core/src/Logger.ts @@ -1,5 +1,6 @@ -import { ConfigKeys, getLocalStorageConfigItem } from "./index.js"; +import { ConfigKeys } from "./constants/index.js"; import { isBrowser, isTest } from "./utils/environment.js"; +import { getLocalStorageConfigItem } from "./utils/localStorage.js"; type GetLoggingEnabled = (() => Promise | boolean) | undefined; diff --git a/packages/core/src/crypto/SigningKey.ts b/packages/core/src/crypto/SigningKey.ts index a14cc28e8..8626e2e98 100644 --- a/packages/core/src/crypto/SigningKey.ts +++ b/packages/core/src/crypto/SigningKey.ts @@ -1,6 +1,8 @@ import secp256k1 from "secp256k1"; -import { SigningKeyType, type CryptoInterface } from "../index.js"; -import { createSha256Hash, hexToBytes } from "../utils/index.js"; +import { createSha256Hash } from "../utils/createHash.js"; +import { hexToBytes } from "../utils/hex.js"; +import type { CryptoInterface } from "./crypto.js"; +import { SigningKeyType } from "./types.js"; interface Alias { alias: string; From 3a2e6d2245254883ee8ea69b8087db44f590cd9c Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Tue, 26 Aug 2025 17:41:19 -0400 Subject: [PATCH 08/13] [lightspark-sdk] Add circular-deps check and resolve issues (#20022) ## Reason Typically we have this circular-deps check for JS packages but it was never added to this one. I realized it's causing a downstream issue so this adds the check and resolves circular deps. GitOrigin-RevId: cc9081a0419495600c89ebec1d9e4c8ff6b5c9b3 --- packages/lightspark-sdk/package.json | 12 ++++++++++++ packages/lightspark-sdk/src/SigningKeyLoader.ts | 2 +- packages/lightspark-sdk/src/client.ts | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/lightspark-sdk/package.json b/packages/lightspark-sdk/package.json index ae0b0bbb3..9e530d111 100644 --- a/packages/lightspark-sdk/package.json +++ b/packages/lightspark-sdk/package.json @@ -59,6 +59,7 @@ "lint:fix:continue": "eslint --fix . || exit 0", "lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color", "lint": "eslint .", + "circular-deps": "madge --circular --extensions ts,tsx src", "package:checks": "yarn publint && yarn attw --pack .", "postversion": "yarn build", "test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --bail", @@ -90,6 +91,7 @@ "eslint": "^8.3.0", "eslint-watch": "^8.0.0", "jest": "^29.6.2", + "madge": "^6.1.0", "prettier": "3.0.3", "prettier-plugin-organize-imports": "^3.2.4", "publint": "^0.3.9", @@ -99,6 +101,16 @@ "typedoc": "^0.24.7", "typescript": "^5.6.2" }, + "madge": { + "detectiveOptions": { + "ts": { + "skipTypeImports": true + }, + "tsx": { + "skipTypeImports": true + } + } + }, "engines": { "node": ">=18" } diff --git a/packages/lightspark-sdk/src/SigningKeyLoader.ts b/packages/lightspark-sdk/src/SigningKeyLoader.ts index bd639664b..87b6d2bce 100644 --- a/packages/lightspark-sdk/src/SigningKeyLoader.ts +++ b/packages/lightspark-sdk/src/SigningKeyLoader.ts @@ -8,7 +8,7 @@ import { type Requester, } from "@lightsparkdev/core"; import { RecoverNodeSigningKey } from "./graphql/RecoverNodeSigningKey.js"; -import { BitcoinNetwork } from "./index.js"; +import { BitcoinNetwork } from "./objects/BitcoinNetwork.js"; const SIGNING_KEY_PATH = "m/5"; diff --git a/packages/lightspark-sdk/src/client.ts b/packages/lightspark-sdk/src/client.ts index db4222c51..48f0dae5c 100644 --- a/packages/lightspark-sdk/src/client.ts +++ b/packages/lightspark-sdk/src/client.ts @@ -68,7 +68,6 @@ import { SingleNodeDashboard as SingleNodeDashboardQuery } from "./graphql/Singl import { TransactionSubscription } from "./graphql/TransactionSubscription.js"; import { TransactionsForNode } from "./graphql/TransactionsForNode.js"; import { WithdrawalFeeEstimate } from "./graphql/WithdrawalFeeEstimate.js"; -import { RiskRating, TransactionStatus } from "./index.js"; import { logger } from "./logger.js"; import Account from "./objects/Account.js"; import { ApiTokenFromJson } from "./objects/ApiToken.js"; @@ -92,12 +91,14 @@ import type PaymentDirection from "./objects/PaymentDirection.js"; import { PaymentRequestFromJson } from "./objects/PaymentRequest.js"; import Permission from "./objects/Permission.js"; import type RegionCode from "./objects/RegionCode.js"; +import RiskRating from "./objects/RiskRating.js"; import type SingleNodeDashboard from "./objects/SingleNodeDashboard.js"; import type Transaction from "./objects/Transaction.js"; import { TransactionFromJson, getTransactionQuery, } from "./objects/Transaction.js"; +import TransactionStatus from "./objects/TransactionStatus.js"; import type TransactionUpdate from "./objects/TransactionUpdate.js"; import { TransactionUpdateFromJson } from "./objects/TransactionUpdate.js"; import type UmaInvitation from "./objects/UmaInvitation.js"; From 43aefa2bbfea1f06ee761e1f82ae02f2aa7d7335 Mon Sep 17 00:00:00 2001 From: Lightspark Eng Date: Tue, 26 Aug 2025 21:43:48 +0000 Subject: [PATCH 09/13] CI update lock file for PR --- yarn.lock | 2 ++ 1 file changed, 2 insertions(+) diff --git a/yarn.lock b/yarn.lock index 428ecd251..2aa4b009f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2145,6 +2145,7 @@ __metadata: graphql-ws: "npm:^5.11.3" jest: "npm:^29.6.2" lodash-es: "npm:^4.17.21" + madge: "npm:^6.1.0" prettier: "npm:3.0.3" prettier-plugin-organize-imports: "npm:^3.2.4" publint: "npm:^0.3.9" @@ -2249,6 +2250,7 @@ __metadata: graphql: "npm:^16.6.0" graphql-ws: "npm:^5.11.3" jest: "npm:^29.6.2" + madge: "npm:^6.1.0" prettier: "npm:3.0.3" prettier-plugin-organize-imports: "npm:^3.2.4" publint: "npm:^0.3.9" From 145ba9e70eb2f2d0863c2b1a159581721aee2af5 Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Tue, 26 Aug 2025 17:43:45 -0400 Subject: [PATCH 10/13] [core] RN entrypoint to remove ws import in spark-sdk (#20021) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Reason It's not exactly clear when this became an issue for spark-sdk on React Native because originally it was working fine with a dynamic import. Somewhere along the way, possibly due to an updated dependency in spark/js lock file, it started causing the following error: Screenshot 2025-08-21 at 11 27 57 PM We need to avoid referencing ws in React Native entrypoints which resolves the issue. GitOrigin-RevId: 8e9297ac7c1d096d90fd0f46096187cc92256c2b --- packages/core/package.json | 2 + packages/core/src/index.ts | 14 +- packages/core/src/react-native/index.ts | 2 + .../core/src/requester/DefaultRequester.ts | 46 +++++++ packages/core/src/requester/Requester.ts | 55 ++------ .../requester/tests/DefaultRequester.test.ts | 129 ++++++++++++++++++ .../src/requester/tests/Requester.test.ts | 55 ++++---- packages/core/src/shared.ts | 10 ++ packages/core/src/utils/environment.ts | 3 + packages/core/tsup.config.ts | 2 +- 10 files changed, 230 insertions(+), 88 deletions(-) create mode 100644 packages/core/src/react-native/index.ts create mode 100644 packages/core/src/requester/DefaultRequester.ts create mode 100644 packages/core/src/requester/tests/DefaultRequester.test.ts create mode 100644 packages/core/src/shared.ts diff --git a/packages/core/package.json b/packages/core/package.json index d6fabef46..10a1110fb 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -24,6 +24,7 @@ "types": "./dist/index.d.ts", "exports": { ".": { + "react-native": "./dist/react-native/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" }, @@ -39,6 +40,7 @@ "src/*", "dist/*", "dist/utils/*", + "dist/react-native/*", "CHANGELOG.md" ], "scripts": { diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 9988a8870..3dfd0c9e9 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,13 +1,5 @@ // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved -export * from "./auth/index.js"; -export * from "./constants/index.js"; -export * from "./crypto/index.js"; -export { default as LightsparkException } from "./LightsparkException.js"; -export { Logger, LoggingLevel, logger } from "./Logger.js"; -export * from "./requester/index.js"; -export { - default as ServerEnvironment, - apiDomainForEnvironment, -} from "./ServerEnvironment.js"; -export * from "./utils/index.js"; +export { DefaultRequester as Requester } from "./requester/DefaultRequester.js"; +export { default as Query } from "./requester/Query.js"; +export * from "./shared.js"; diff --git a/packages/core/src/react-native/index.ts b/packages/core/src/react-native/index.ts new file mode 100644 index 000000000..aa8747e75 --- /dev/null +++ b/packages/core/src/react-native/index.ts @@ -0,0 +1,2 @@ +export * from "../requester/index.js"; +export * from "../shared.js"; diff --git a/packages/core/src/requester/DefaultRequester.ts b/packages/core/src/requester/DefaultRequester.ts new file mode 100644 index 000000000..a3e677e51 --- /dev/null +++ b/packages/core/src/requester/DefaultRequester.ts @@ -0,0 +1,46 @@ +import type AuthProvider from "../auth/AuthProvider.js"; +import { isBare, isNode } from "../utils/environment.js"; +import Requester from "./Requester.js"; + +export class DefaultRequester extends Requester { + protected async initWsClient(baseUrl: string, authProvider: AuthProvider) { + if (!this.resolveWsClient) { + /* If resolveWsClient is null assume already initialized: */ + return this.wsClient; + } + + if (isBare) { + /* graphql-ws library is currently not supported in Bare environment, see LIG-7942 */ + return null; + } + + let websocketImpl; + if (isNode && typeof WebSocket === "undefined") { + const wsModule = await import("ws"); + websocketImpl = wsModule.default; + } + let websocketProtocol = "wss"; + if (baseUrl.startsWith("http://")) { + websocketProtocol = "ws"; + } + + const graphqlWsModule = await import("graphql-ws"); + const { createClient } = graphqlWsModule; + + const wsClient = createClient({ + url: `${websocketProtocol}://${this.stripProtocol(this.baseUrl)}/${ + this.schemaEndpoint + }`, + connectionParams: () => authProvider.addWsConnectionParams({}), + webSocketImpl: websocketImpl, + }); + + if (this.resolveWsClient) { + this.resolveWsClient(wsClient); + this.resolveWsClient = null; + } + + return wsClient; + } +} +export default DefaultRequester; diff --git a/packages/core/src/requester/Requester.ts b/packages/core/src/requester/Requester.ts index 8a82c3965..f37b08d3f 100644 --- a/packages/core/src/requester/Requester.ts +++ b/packages/core/src/requester/Requester.ts @@ -17,7 +17,7 @@ import type { SigningKey } from "../crypto/SigningKey.js"; import LightsparkException from "../LightsparkException.js"; import { logger } from "../Logger.js"; import { b64encode } from "../utils/base64.js"; -import { isBare, isNode } from "../utils/environment.js"; +import { isNode } from "../utils/environment.js"; const DEFAULT_BASE_URL = "api.lightspark.com"; dayjs.extend(utc); @@ -31,14 +31,14 @@ type BodyData = { }; class Requester { - private wsClient: Promise; - private resolveWsClient: ((value: WsClient | null) => void) | null = null; + protected wsClient: Promise; + protected resolveWsClient: ((value: WsClient | null) => void) | null = null; constructor( private readonly nodeKeyCache: NodeKeyCache, - private readonly schemaEndpoint: string, + protected readonly schemaEndpoint: string, private readonly sdkUserAgent: string, private readonly authProvider: AuthProvider = new StubAuthProvider(), - private readonly baseUrl: string = DEFAULT_BASE_URL, + protected readonly baseUrl: string = DEFAULT_BASE_URL, private readonly cryptoImpl: CryptoInterface = DefaultCrypto, private readonly signingKey?: SigningKey, private readonly fetchImpl: typeof fetch = fetch, @@ -50,44 +50,11 @@ class Requester { autoBind(this); } - private async initWsClient(baseUrl: string, authProvider: AuthProvider) { - if (!this.resolveWsClient) { - /* If resolveWsClient is null assume already initialized: */ - return this.wsClient; - } - - if (isBare) { - /* graphql-ws library is currently not supported in Bare environment, see LIG-7942 */ - return null; - } - - let websocketImpl; - if (isNode && typeof WebSocket === "undefined") { - const wsModule = await import("ws"); - websocketImpl = wsModule.default; - } - let websocketProtocol = "wss"; - if (baseUrl.startsWith("http://")) { - websocketProtocol = "ws"; - } - - const graphqlWsModule = await import("graphql-ws"); - const { createClient } = graphqlWsModule; - - const wsClient = createClient({ - url: `${websocketProtocol}://${this.stripProtocol(this.baseUrl)}/${ - this.schemaEndpoint - }`, - connectionParams: () => authProvider.addWsConnectionParams({}), - webSocketImpl: websocketImpl, - }); - - if (this.resolveWsClient) { - this.resolveWsClient(wsClient); - this.resolveWsClient = null; - } - - return wsClient; + protected initWsClient( + baseUrl: string, + authProvider: AuthProvider, + ): Promise { + return Promise.resolve(null); } public async executeQuery(query: Query): Promise { @@ -293,7 +260,7 @@ class Requester { return `${this.sdkUserAgent} ${platform}/${platformVersion}`; } - private stripProtocol(url: string): string { + protected stripProtocol(url: string): string { return url.replace(/.*?:\/\//g, ""); } diff --git a/packages/core/src/requester/tests/DefaultRequester.test.ts b/packages/core/src/requester/tests/DefaultRequester.test.ts new file mode 100644 index 000000000..b584ba00d --- /dev/null +++ b/packages/core/src/requester/tests/DefaultRequester.test.ts @@ -0,0 +1,129 @@ +import { beforeEach, jest } from "@jest/globals"; + +import type { Client as WsClient } from "graphql-ws"; +import type AuthProvider from "../../auth/AuthProvider.js"; +import type { CryptoInterface } from "../../crypto/crypto.js"; +import type NodeKeyCache from "../../crypto/NodeKeyCache.js"; +import type { SigningKey } from "../../crypto/SigningKey.js"; +import { SigningKeyType } from "../../crypto/types.js"; + +/* Mocking ESM modules (when running node with --experimental-vm-modules) + requires unstable_mockModule, see https://bit.ly/433nRV1 */ +await jest.unstable_mockModule("graphql-ws", () => ({ + __esModule: true, + createClient: jest.fn(), +})); +/* Since Requester uses graphql-ws we need a dynamic import after the above mock */ +const { DefaultRequester } = await import("../DefaultRequester.js"); + +describe("DefaultRequester", () => { + const schemaEndpoint = "graphql"; + const sdkUserAgent = "test-agent"; + const baseUrl = "https://api.example.com"; + + let nodeKeyCache: NodeKeyCache; + let authProvider: AuthProvider; + let signingKey: SigningKey; + let cryptoImpl: CryptoInterface; + let fetchImpl: typeof fetch; + + beforeEach(() => { + nodeKeyCache = { + getKey: jest.fn(), + hasKey: jest.fn(), + } as unknown as NodeKeyCache; + + authProvider = { + addAuthHeaders: jest.fn(async (headers: Record) => ({ + ...headers, + "X-Test": "1", + })), + isAuthorized: jest.fn(async () => true), + addWsConnectionParams: jest.fn( + async (params: Record) => ({ + ...params, + ws: true, + }), + ), + } satisfies AuthProvider; + + signingKey = { + type: SigningKeyType.RSASigningKey, + sign: jest.fn(async (data: Uint8Array) => new Uint8Array([1, 2, 3])), + } satisfies SigningKey; + + cryptoImpl = { + decryptSecretWithNodePassword: jest.fn(async () => new ArrayBuffer(0)), + generateSigningKeyPair: jest.fn(async () => ({ + publicKey: "", + privateKey: "", + })), + serializeSigningKey: jest.fn(async () => new ArrayBuffer(0)), + getNonce: jest.fn(async () => 123), + sign: jest.fn(async () => new ArrayBuffer(0)), + importPrivateSigningKey: jest.fn(async () => ""), + } satisfies CryptoInterface; + + fetchImpl = jest.fn( + async () => + ({ + ok: true, + json: async () => ({ data: { foo: "bar" }, errors: undefined }), + statusText: "OK", + }) as Response, + ); + }); + + describe("subscribe", () => { + it("returns an Observable for a valid subscription", async () => { + // Mock wsClient and its subscribe method + const wsClient = { + subscribe: jest.fn( + ( + _body, + handlers: { next?: (data: unknown) => void; complete?: () => void }, + ) => { + setTimeout(() => { + handlers.next?.({ data: { foo: "bar" } }); + handlers.complete?.(); + }, 10); + return jest.fn(); + }, + ), + } as unknown as WsClient; + + const { createClient } = await import("graphql-ws"); + (createClient as jest.Mock).mockReturnValue(wsClient); + + const requester = new DefaultRequester( + nodeKeyCache, + schemaEndpoint, + sdkUserAgent, + authProvider, + baseUrl, + cryptoImpl, + signingKey, + fetchImpl, + ); + + const observable = requester.subscribe<{ foo: string }>( + "subscription TestSub { foo }", + ); + + const results: { foo: string }[] = []; + await new Promise((resolve) => { + observable.subscribe({ + next: (data: { data: { foo: string } }) => { + results.push(data.data); + }, + complete: () => { + expect(results).toEqual([{ foo: "bar" }]); + resolve(); + }, + }); + }); + + expect(wsClient.subscribe).toHaveBeenCalled(); + }); + }); +}); diff --git a/packages/core/src/requester/tests/Requester.test.ts b/packages/core/src/requester/tests/Requester.test.ts index cc64bb593..9bdf2303d 100644 --- a/packages/core/src/requester/tests/Requester.test.ts +++ b/packages/core/src/requester/tests/Requester.test.ts @@ -1,6 +1,5 @@ import { beforeEach, jest } from "@jest/globals"; -import type { Client as WsClient } from "graphql-ws"; import type AuthProvider from "../../auth/AuthProvider.js"; import type { CryptoInterface } from "../../crypto/crypto.js"; import type NodeKeyCache from "../../crypto/NodeKeyCache.js"; @@ -16,7 +15,7 @@ await jest.unstable_mockModule("graphql-ws", () => ({ createClient: jest.fn(), })); /* Since Requester uses graphql-ws we need a dynamic import after the above mock */ -const { Requester } = await import("../index.js"); +const { default: Requester } = await import("../Requester.js"); describe("Requester", () => { const schemaEndpoint = "graphql"; @@ -257,26 +256,7 @@ describe("Requester", () => { expect(() => requester.subscribe("invalid")).toThrow(LightsparkException); }); - it("returns an Observable for a valid subscription", async () => { - // Mock wsClient and its subscribe method - const wsClient = { - subscribe: jest.fn( - ( - _body, - handlers: { next?: (data: unknown) => void; complete?: () => void }, - ) => { - setTimeout(() => { - handlers.next?.({ data: { foo: "bar" } }); - handlers.complete?.(); - }, 10); - return jest.fn(); - }, - ), - } as unknown as WsClient; - - const { createClient } = await import("graphql-ws"); - (createClient as jest.Mock).mockReturnValue(wsClient); - + it("emits error when wsClient is not initialized", async () => { const requester = new Requester( nodeKeyCache, schemaEndpoint, @@ -287,25 +267,36 @@ describe("Requester", () => { signingKey, fetchImpl, ); + // Resolve internal wsClient promise to null so the observable emits an error. + ( + requester as unknown as { + resolveWsClient: ((v: unknown) => void) | null; + } + ).resolveWsClient?.(null); - const observable = requester.subscribe<{ foo: string }>( - "subscription TestSub { foo }", - ); + const observable = requester.subscribe("subscription TestSub { foo }"); - const results: { foo: string }[] = []; await new Promise((resolve) => { observable.subscribe({ - next: (data) => { - results.push(data.data); + next: () => { + throw new Error( + "Should not emit next when wsClient is uninitialized", + ); }, - complete: () => { - expect(results).toEqual([{ foo: "bar" }]); + error: (err) => { + expect(err).toBeInstanceOf(LightsparkException); + expect(String((err as Error).message)).toMatch( + /WebSocket client is not initialized/, + ); resolve(); }, + complete: () => { + throw new Error( + "Should not complete when wsClient is uninitialized", + ); + }, }); }); - - expect(wsClient.subscribe).toHaveBeenCalled(); }); }); diff --git a/packages/core/src/shared.ts b/packages/core/src/shared.ts new file mode 100644 index 000000000..5540e90bd --- /dev/null +++ b/packages/core/src/shared.ts @@ -0,0 +1,10 @@ +export * from "./auth/index.js"; +export * from "./constants/index.js"; +export * from "./crypto/index.js"; +export { default as LightsparkException } from "./LightsparkException.js"; +export { Logger, LoggingLevel, logger } from "./Logger.js"; +export { + default as ServerEnvironment, + apiDomainForEnvironment, +} from "./ServerEnvironment.js"; +export * from "./utils/index.js"; diff --git a/packages/core/src/utils/environment.ts b/packages/core/src/utils/environment.ts index e98579969..a8f03eb23 100644 --- a/packages/core/src/utils/environment.ts +++ b/packages/core/src/utils/environment.ts @@ -14,3 +14,6 @@ export const isTest = isNode && process.env.NODE_ENV === "test"; /* https://github.com/holepunchto/which-runtime/blob/main/index.js */ export const isBare = typeof Bare !== "undefined"; + +export const isReactNative = + typeof navigator !== "undefined" && navigator.product === "ReactNative"; diff --git a/packages/core/tsup.config.ts b/packages/core/tsup.config.ts index 1728ea9fb..56b2ca467 100644 --- a/packages/core/tsup.config.ts +++ b/packages/core/tsup.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from "tsup"; export default defineConfig({ - entry: ["src/index.ts", "src/utils/index.ts"], + entry: ["src/index.ts", "src/react-native/index.ts", "src/utils/index.ts"], format: ["cjs", "esm"], dts: true, clean: true, From 349abe2d5ad709c7e83884de21e1dc29163c7197 Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Tue, 26 Aug 2025 17:55:51 -0400 Subject: [PATCH 11/13] Create shy-bugs-march.md --- .changeset/shy-bugs-march.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/shy-bugs-march.md diff --git a/.changeset/shy-bugs-march.md b/.changeset/shy-bugs-march.md new file mode 100644 index 000000000..26aa45269 --- /dev/null +++ b/.changeset/shy-bugs-march.md @@ -0,0 +1,5 @@ +--- +"@lightsparkdev/ui": patch +--- + +- Icon, component updates From 191f9b2a12393d82f5a0e2db7d00c343e7618ee0 Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Tue, 26 Aug 2025 17:57:34 -0400 Subject: [PATCH 12/13] Create tame-sites-mate.md --- .changeset/tame-sites-mate.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/tame-sites-mate.md diff --git a/.changeset/tame-sites-mate.md b/.changeset/tame-sites-mate.md new file mode 100644 index 000000000..a874f0bfe --- /dev/null +++ b/.changeset/tame-sites-mate.md @@ -0,0 +1,6 @@ +--- +"@lightsparkdev/core": patch +--- + +- Resolve circular dependencies +- React Native compatible entrypoint From 11e36a52a52a568dab3adf69b3b0ea7d88869d57 Mon Sep 17 00:00:00 2001 From: Corey Martin Date: Tue, 26 Aug 2025 17:58:13 -0400 Subject: [PATCH 13/13] Create short-parts-march.md --- .changeset/short-parts-march.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/short-parts-march.md diff --git a/.changeset/short-parts-march.md b/.changeset/short-parts-march.md new file mode 100644 index 000000000..ce34ed1aa --- /dev/null +++ b/.changeset/short-parts-march.md @@ -0,0 +1,5 @@ +--- +"@lightsparkdev/lightspark-sdk": patch +--- + +- Resolve circular dependencies