Skip to content

Commit cdd5ee8

Browse files
committed
chore(react-sdk): configure publish files and gitignore
- Added array to package.json to only publish dist directory to NPM - Added .gitignore to prevent tracking dist and node_modules folders
1 parent 6ff1baf commit cdd5ee8

9 files changed

Lines changed: 84 additions & 23 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/urbackend-react/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

sdks/urbackend-react/dist/index.d.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ interface AuthLabels {
133133
footerSignupPrompt: string;
134134
footerForgotPrompt: string;
135135
noAuthMethods: string;
136+
forgotSubtitle: string;
137+
resetSubtitle: string;
136138
signInTitle?: string;
137139
signUpTitle?: string;
138140
signInTab?: string;

sdks/urbackend-react/dist/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ interface AuthLabels {
133133
footerSignupPrompt: string;
134134
footerForgotPrompt: string;
135135
noAuthMethods: string;
136+
forgotSubtitle: string;
137+
resetSubtitle: string;
136138
signInTitle?: string;
137139
signUpTitle?: string;
138140
signInTab?: string;

sdks/urbackend-react/dist/index.js

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

sdks/urbackend-react/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/urbackend-react/dist/index.mjs

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,9 @@ var defaultLabels = {
400400
footerSigninPrompt: "Don't have an account yet?",
401401
footerSignupPrompt: "Already have an account?",
402402
footerForgotPrompt: "Remember your password?",
403-
noAuthMethods: "No authentication methods are enabled for this screen."
403+
noAuthMethods: "No authentication methods are enabled for this screen.",
404+
forgotSubtitle: "Welcome back",
405+
resetSubtitle: "Enter the code sent to {email}"
404406
};
405407
var defaultThemeColors = {
406408
light: {
@@ -430,6 +432,28 @@ var defaultThemeColors = {
430432
socialButtonBackground: "#2a2a2a"
431433
}
432434
};
435+
var adjustColor = (color, percent) => {
436+
try {
437+
if (color.startsWith("#")) {
438+
let hex = color.replace("#", "");
439+
if (hex.length === 3) {
440+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
441+
}
442+
let r = parseInt(hex.substring(0, 2), 16);
443+
let g = parseInt(hex.substring(2, 4), 16);
444+
let b = parseInt(hex.substring(4, 6), 16);
445+
r = Math.min(255, Math.max(0, r + percent));
446+
g = Math.min(255, Math.max(0, g + percent));
447+
b = Math.min(255, Math.max(0, b + percent));
448+
const rr = r.toString(16).padStart(2, "0");
449+
const gg = g.toString(16).padStart(2, "0");
450+
const bb = b.toString(16).padStart(2, "0");
451+
return `#${rr}${gg}${bb}`;
452+
}
453+
} catch (e) {
454+
}
455+
return color;
456+
};
433457
var UrAuth = ({
434458
providers = ["google", "github"],
435459
enableEmailPassword = true,
@@ -449,15 +473,16 @@ var UrAuth = ({
449473
const text = {
450474
...defaultLabels,
451475
...labels,
452-
loginTab: labels?.signInTab || labels?.loginTab || defaultLabels.loginTab,
453-
loginTitle: labels?.signInTitle || labels?.loginTitle || defaultLabels.loginTitle,
454-
loginButton: labels?.signInButton || labels?.loginButton || defaultLabels.loginButton,
455-
signupTab: labels?.signUpTab || labels?.signupTab || defaultLabels.signupTab,
456-
signupTitle: labels?.signUpTitle || labels?.signupTitle || defaultLabels.signupTitle,
457-
signupButton: labels?.signUpButton || labels?.signupButton || defaultLabels.signupButton
476+
loginTab: labels?.signInTab ?? labels?.loginTab ?? defaultLabels.loginTab,
477+
loginTitle: labels?.signInTitle ?? labels?.loginTitle ?? defaultLabels.loginTitle,
478+
loginButton: labels?.signInButton ?? labels?.loginButton ?? defaultLabels.loginButton,
479+
signupTab: labels?.signUpTab ?? labels?.signupTab ?? defaultLabels.signupTab,
480+
signupTitle: labels?.signUpTitle ?? labels?.signupTitle ?? defaultLabels.signupTitle,
481+
signupButton: labels?.signUpButton ?? labels?.signupButton ?? defaultLabels.signupButton
458482
};
459483
const themeColors = { ...defaultThemeColors[theme], ...colors };
460484
const primaryColor = branding?.primaryColor || themeColors.primary;
485+
const secondStopColor = adjustColor(primaryColor, -15);
461486
let isGoogleEnabled = true;
462487
let isGithubEnabled = true;
463488
let isEmailPasswordEnabled = enableEmailPassword;
@@ -468,7 +493,7 @@ var UrAuth = ({
468493
} else if (typeof providers === "object") {
469494
isGoogleEnabled = !!providers.google;
470495
isGithubEnabled = !!providers.github;
471-
isEmailPasswordEnabled = providers.emailPassword !== void 0 ? providers.emailPassword : false;
496+
isEmailPasswordEnabled = providers.emailPassword !== void 0 ? providers.emailPassword : enableEmailPassword;
472497
}
473498
}
474499
const hasPasswordAuth = isEmailPasswordEnabled;
@@ -632,7 +657,7 @@ var UrAuth = ({
632657
width: "100%",
633658
padding: "14px",
634659
borderRadius: "0",
635-
background: `linear-gradient(180deg, ${primaryColor} 0%, ${theme === "dark" ? "#111111" : "#111111"} 100%)`,
660+
background: `linear-gradient(180deg, ${primaryColor} 0%, ${secondStopColor} 100%)`,
636661
color: themeColors.primaryText,
637662
fontSize: "15px",
638663
fontWeight: 600,
@@ -788,7 +813,7 @@ var UrAuth = ({
788813
] }) }),
789814
(mode === "forgot" || mode === "reset") && /* @__PURE__ */ jsxs2("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
790815
/* @__PURE__ */ jsx4("h2", { style: { margin: "0 0 8px", fontSize: "20px", fontWeight: 700, color: themeColors.text }, children: mode === "forgot" ? text.forgotTitle : text.resetTitle }),
791-
/* @__PURE__ */ jsx4("p", { style: { margin: 0, fontSize: "14px", color: themeColors.textMuted }, children: mode === "forgot" ? text.loginTitle : `Enter the code sent to ${email}` })
816+
/* @__PURE__ */ jsx4("p", { style: { margin: 0, fontSize: "14px", color: themeColors.textMuted }, children: mode === "forgot" ? text.forgotSubtitle : text.resetSubtitle.replace("{email}", email) })
792817
] }),
793818
!hasPasswordAuth && !hasSocialAuth && /* @__PURE__ */ jsx4("div", { style: { textAlign: "center", color: themeColors.textMuted, fontSize: "14px", lineHeight: 1.5 }, children: text.noAuthMethods }),
794819
hasPasswordAuth && /* @__PURE__ */ jsxs2("form", { onSubmit: handleSubmit, children: [

sdks/urbackend-react/dist/index.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdks/urbackend-react/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
"publishConfig": {
66
"access": "public"
77
},
8+
"files": [
9+
"dist",
10+
"README.md",
11+
"LICENSE"
12+
],
813
"main": "./dist/index.js",
914
"module": "./dist/index.mjs",
1015
"types": "./dist/index.d.ts",

0 commit comments

Comments
 (0)