@sylphx/sdk 0.7.0 → 0.8.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -27
- package/dist/health/index.mjs +475 -0
- package/dist/health/index.mjs.map +1 -0
- package/dist/index.d.ts +51 -17
- package/dist/index.mjs +11 -6
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.mjs +10 -10
- package/dist/react/index.mjs.map +1 -1
- package/dist/server/index.d.ts +11 -7
- package/dist/server/index.mjs +5 -5
- package/dist/server/index.mjs.map +1 -1
- package/dist/web-analytics.mjs.map +1 -1
- package/package.json +18 -14
- package/dist/index.d.cts +0 -9385
- package/dist/index.js +0 -11229
- package/dist/index.js.map +0 -1
- package/dist/nextjs/index.d.cts +0 -567
- package/dist/nextjs/index.js +0 -2081
- package/dist/nextjs/index.js.map +0 -1
- package/dist/react/index.d.cts +0 -14250
- package/dist/react/index.js +0 -81688
- package/dist/react/index.js.map +0 -1
- package/dist/server/index.d.cts +0 -1842
- package/dist/server/index.js +0 -3430
- package/dist/server/index.js.map +0 -1
- package/dist/web-analytics.js +0 -248
- package/dist/web-analytics.js.map +0 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -924,7 +924,7 @@ type FlagClientEvent = {
|
|
|
924
924
|
* import { createClient } from '@sylphx/sdk'
|
|
925
925
|
*
|
|
926
926
|
* const sylphx = createClient(process.env.SYLPHX_URL!)
|
|
927
|
-
* // Parses: sylphx://pk_prod_{hex}@bold-river-a1b2c3.sylphx.com
|
|
927
|
+
* // Parses: sylphx://pk_prod_{hex}@bold-river-a1b2c3.api.sylphx.com
|
|
928
928
|
* ```
|
|
929
929
|
*/
|
|
930
930
|
|
|
@@ -943,7 +943,7 @@ interface SylphxConfig {
|
|
|
943
943
|
readonly env: 'dev' | 'stg' | 'prod' | 'prev';
|
|
944
944
|
/** Resource slug (first DNS label), e.g. 'bold-river-a1b2c3' */
|
|
945
945
|
readonly slug: string;
|
|
946
|
-
/** Pre-computed API base URL, e.g. 'https://bold-river-a1b2c3.sylphx.com/v1' */
|
|
946
|
+
/** Pre-computed API base URL, e.g. 'https://bold-river-a1b2c3.api.sylphx.com/v1' */
|
|
947
947
|
readonly baseUrl: string;
|
|
948
948
|
/** Optional access token for authenticated requests */
|
|
949
949
|
readonly accessToken?: string;
|
package/dist/react/index.mjs
CHANGED
|
@@ -42734,7 +42734,7 @@ function parseConnectionUrl(url) {
|
|
|
42734
42734
|
init_constants();
|
|
42735
42735
|
var LEGACY_EMBEDDED_REF_PATTERN = /^(pk|sk)_(dev|stg|prod|prev)_[a-z0-9]{12}_[a-f0-9]+$/;
|
|
42736
42736
|
var LEGACY_APP_KEY_PATTERN = /^app_(dev|stg|prod|prev)_/;
|
|
42737
|
-
var MIGRATION_MESSAGE = "API key format has changed. Use a sylphx:// connection URL instead.\n\nNew format: sylphx://pk_prod_{hex}@your-slug.sylphx.com\n\nGenerate new credentials from the Sylphx Console \u2192 Your App \u2192 Environments.\nSee https://docs.sylphx.com/migration for details.";
|
|
42737
|
+
var MIGRATION_MESSAGE = "API key format has changed. Use a sylphx:// connection URL instead.\n\nNew format: sylphx://pk_prod_{hex}@your-slug.api.sylphx.com\n\nGenerate new credentials from the Sylphx Console \u2192 Your App \u2192 Environments.\nSee https://docs.sylphx.com/migration for details.";
|
|
42738
42738
|
function rejectLegacyKeyFormat(input) {
|
|
42739
42739
|
const trimmed = input.trim().toLowerCase();
|
|
42740
42740
|
if (LEGACY_APP_KEY_PATTERN.test(trimmed)) {
|
|
@@ -42767,7 +42767,7 @@ function createClient(input) {
|
|
|
42767
42767
|
function createConfigFromUrl(url) {
|
|
42768
42768
|
if (!url || typeof url !== "string") {
|
|
42769
42769
|
throw new SylphxError(
|
|
42770
|
-
"[Sylphx] Connection URL is required. Set SYLPHX_URL or NEXT_PUBLIC_SYLPHX_URL environment variable.\n\nFormat: sylphx://pk_prod_{hex}@your-slug.sylphx.com",
|
|
42770
|
+
"[Sylphx] Connection URL is required. Set SYLPHX_URL or NEXT_PUBLIC_SYLPHX_URL environment variable.\n\nFormat: sylphx://pk_prod_{hex}@your-slug.api.sylphx.com",
|
|
42771
42771
|
{ code: "BAD_REQUEST" }
|
|
42772
42772
|
);
|
|
42773
42773
|
}
|
|
@@ -42776,7 +42776,7 @@ function createConfigFromUrl(url) {
|
|
|
42776
42776
|
if (!trimmed.startsWith("sylphx://")) {
|
|
42777
42777
|
if (CREDENTIAL_REGEX.test(trimmed)) {
|
|
42778
42778
|
throw new SylphxError(
|
|
42779
|
-
"[Sylphx] Received a bare credential instead of a connection URL.\n\nWrap it in a connection URL: sylphx://<credential>@<slug>.sylphx.com\nOr use createClient({ slug, publicKey }) for explicit components.",
|
|
42779
|
+
"[Sylphx] Received a bare credential instead of a connection URL.\n\nWrap it in a connection URL: sylphx://<credential>@<slug>.api.sylphx.com\nOr use createClient({ slug, publicKey }) for explicit components.",
|
|
42780
42780
|
{ code: "BAD_REQUEST" }
|
|
42781
42781
|
);
|
|
42782
42782
|
}
|
|
@@ -54788,7 +54788,7 @@ function SylphxProviderInner({
|
|
|
54788
54788
|
}, [authState.isSignedIn, authPrefix]);
|
|
54789
54789
|
const resetPassword = useCallback66(
|
|
54790
54790
|
async (options) => {
|
|
54791
|
-
const response = await fetch(`${platformUrl}/
|
|
54791
|
+
const response = await fetch(`${platformUrl}/v1/auth/reset-password`, {
|
|
54792
54792
|
method: "POST",
|
|
54793
54793
|
headers: { "Content-Type": "application/json" },
|
|
54794
54794
|
body: JSON.stringify({
|
|
@@ -54806,7 +54806,7 @@ function SylphxProviderInner({
|
|
|
54806
54806
|
);
|
|
54807
54807
|
const verifyEmail = useCallback66(
|
|
54808
54808
|
async (options) => {
|
|
54809
|
-
const response = await fetch(`${platformUrl}/
|
|
54809
|
+
const response = await fetch(`${platformUrl}/v1/auth/verify-email`, {
|
|
54810
54810
|
method: "POST",
|
|
54811
54811
|
headers: { "Content-Type": "application/json" },
|
|
54812
54812
|
body: JSON.stringify({
|
|
@@ -54823,7 +54823,7 @@ function SylphxProviderInner({
|
|
|
54823
54823
|
);
|
|
54824
54824
|
const resendVerificationEmail = useCallback66(
|
|
54825
54825
|
async (options) => {
|
|
54826
|
-
const response = await fetch(`${platformUrl}/
|
|
54826
|
+
const response = await fetch(`${platformUrl}/v1/auth/resend-verification`, {
|
|
54827
54827
|
method: "POST",
|
|
54828
54828
|
headers: { "Content-Type": "application/json" },
|
|
54829
54829
|
body: JSON.stringify({
|
|
@@ -54840,7 +54840,7 @@ function SylphxProviderInner({
|
|
|
54840
54840
|
);
|
|
54841
54841
|
const forgotPassword = useCallback66(
|
|
54842
54842
|
async (options) => {
|
|
54843
|
-
const response = await fetch(`${platformUrl}/
|
|
54843
|
+
const response = await fetch(`${platformUrl}/v1/auth/forgot-password`, {
|
|
54844
54844
|
method: "POST",
|
|
54845
54845
|
headers: { "Content-Type": "application/json" },
|
|
54846
54846
|
body: JSON.stringify({
|
|
@@ -55728,7 +55728,7 @@ function SylphxProviderInner({
|
|
|
55728
55728
|
});
|
|
55729
55729
|
},
|
|
55730
55730
|
verifyEmail: async (token) => {
|
|
55731
|
-
const response = await fetch(`${platformUrl}/
|
|
55731
|
+
const response = await fetch(`${platformUrl}/v1/auth/verify-email`, {
|
|
55732
55732
|
method: "POST",
|
|
55733
55733
|
headers: { "Content-Type": "application/json" },
|
|
55734
55734
|
body: JSON.stringify({ token, client_id: appId || "" })
|
|
@@ -55758,8 +55758,8 @@ function SylphxProviderInner({
|
|
|
55758
55758
|
},
|
|
55759
55759
|
getOAuthProviders: async () => {
|
|
55760
55760
|
if (!appId) return { providers: [] };
|
|
55761
|
-
const response = await fetch(`${platformUrl}/
|
|
55762
|
-
headers: { "
|
|
55761
|
+
const response = await fetch(`${platformUrl}/v1/auth/oauth-providers`, {
|
|
55762
|
+
headers: { "x-app-secret": appId }
|
|
55763
55763
|
});
|
|
55764
55764
|
if (!response.ok) {
|
|
55765
55765
|
return { providers: [] };
|