@constructive-io/sheets 0.11.0 → 0.12.0

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/dist/advanced.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  createSheetsCell,
6
6
  resolveNativeEditor,
7
7
  wrapNativeEditor
8
- } from "./chunk-J67BAGEN.js";
8
+ } from "./chunk-CBXNKMN6.js";
9
9
  import "./chunk-26J3DVW7.js";
10
10
  import "./chunk-H5HR5HUJ.js";
11
11
  import {
package/dist/auth.cjs CHANGED
@@ -381,14 +381,7 @@ var SIGN_UP_MUTATION = (
381
381
  `
382
382
  mutation SignUp($input: SignUpInput!) {
383
383
  signUp(input: $input) {
384
- result {
385
- id
386
- userId
387
- accessToken
388
- accessTokenExpiresAt
389
- isVerified
390
- totpEnabled
391
- }
384
+ clientMutationId
392
385
  }
393
386
  }
394
387
  `
@@ -400,27 +393,19 @@ function useSheetsRegister() {
400
393
  return (0, import_react_query2.useMutation)({
401
394
  mutationKey: ["sheets", "auth", "signUp"],
402
395
  mutationFn: async (formData) => {
403
- const result = await executeAuthMutation(
396
+ await executeAuthMutation(
404
397
  config,
405
398
  SIGN_UP_MUTATION,
406
399
  {
407
400
  input: {
408
401
  email: formData.email,
409
- password: formData.password,
410
- rememberMe: formData.rememberMe ?? true
402
+ password: formData.password
411
403
  }
412
404
  }
413
405
  );
414
- const signUpResult = result.signUp?.result;
415
- const token = signUpResult ? toAuthToken(signUpResult) : null;
416
- return { token, email: formData.email, identityKey: signUpResult?.userId ?? null };
406
+ return { email: formData.email };
417
407
  },
418
- onSuccess: ({ token, identityKey }) => {
419
- if (token) {
420
- const databaseId = config.databaseId || "default";
421
- setStoredToken(databaseId, token.accessToken, token.expiresAt, identityKey);
422
- storeApi.getState().setAuthenticated(token.accessToken, token.expiresAt, identityKey);
423
- }
408
+ onSuccess: () => {
424
409
  queryClient.invalidateQueries({ queryKey: ["sheets"] });
425
410
  },
426
411
  onError: () => {
@@ -518,8 +503,7 @@ var loginSchema = import_zod.z.object({
518
503
  var registerSchema = import_zod.z.object({
519
504
  email: emailSchema,
520
505
  password: import_zod.z.string().min(1, "Password is required"),
521
- confirmPassword: import_zod.z.string().min(1, "Please confirm your password"),
522
- rememberMe: import_zod.z.boolean().optional()
506
+ confirmPassword: import_zod.z.string().min(1, "Please confirm your password")
523
507
  }).refine((data) => data.password === data.confirmPassword, {
524
508
  message: "Passwords do not match",
525
509
  path: ["confirmPassword"]
@@ -561,7 +545,7 @@ function AuthErrorAlert({ error, className }) {
561
545
  "aria-live": "polite",
562
546
  "aria-hidden": !hasError,
563
547
  className: cn(
564
- "overflow-hidden transition-all duration-300 ease-out",
548
+ "overflow-hidden transition-[max-height,opacity] duration-(--duration-slow) ease-out",
565
549
  hasError ? "max-h-32" : "max-h-0",
566
550
  className
567
551
  ),
@@ -572,7 +556,7 @@ function AuthErrorAlert({ error, className }) {
572
556
  "flex items-start gap-2.5 rounded-md px-3 py-2.5",
573
557
  "bg-destructive/8 border border-destructive/20",
574
558
  "text-destructive text-sm text-left",
575
- "transition-opacity duration-200",
559
+ "transition-opacity duration-(--duration-slow)",
576
560
  hasError ? "opacity-100" : "opacity-0"
577
561
  ),
578
562
  children: [
@@ -802,19 +786,19 @@ function SheetsLoginForm({ onLogin, onShowForgot, onShowRegister, defaultEmail =
802
786
  // src/auth/ui/register-form.tsx
803
787
  var import_react4 = require("react");
804
788
  var import_react_form2 = require("@tanstack/react-form");
789
+ var import_lucide_react3 = require("lucide-react");
805
790
  var import_button3 = require("@constructive-io/ui/button");
806
- var import_checkbox2 = require("@constructive-io/ui/checkbox");
807
791
  var import_jsx_runtime5 = require("react/jsx-runtime");
808
792
  function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
809
793
  const [error, setError] = (0, import_react4.useState)(null);
810
794
  const [isSubmitting, setIsSubmitting] = (0, import_react4.useState)(false);
795
+ const [isSuccess, setIsSuccess] = (0, import_react4.useState)(false);
811
796
  const passwordInputRef = (0, import_react4.useRef)(null);
812
797
  const form = (0, import_react_form2.useForm)({
813
798
  defaultValues: {
814
799
  email: defaultEmail,
815
800
  password: "",
816
- confirmPassword: "",
817
- rememberMe: true
801
+ confirmPassword: ""
818
802
  },
819
803
  onSubmit: async ({ value }) => {
820
804
  setError(null);
@@ -822,6 +806,7 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
822
806
  try {
823
807
  const validatedData = registerSchema.parse(value);
824
808
  await onRegister(validatedData);
809
+ setIsSuccess(true);
825
810
  } catch (err) {
826
811
  setError(parseGraphQLError(err).message);
827
812
  } finally {
@@ -829,6 +814,15 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
829
814
  }
830
815
  }
831
816
  });
817
+ if (isSuccess) {
818
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-5 text-center", children: [
819
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.CheckCircleIcon, { className: "text-success h-6 w-6" }) }) }),
820
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-1.5", children: [
821
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "text-lg font-semibold", children: "Check your email" }),
822
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-muted-foreground text-sm", children: "We've sent a link to confirm your address. Open it, then sign in with your password." })
823
+ ] })
824
+ ] });
825
+ }
832
826
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "space-y-5", children: [
833
827
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
834
828
  "form",
@@ -869,26 +863,6 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
869
863
  type: "password"
870
864
  }
871
865
  ) }),
872
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(form.Field, { name: "rememberMe", children: (field) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center space-x-2", children: [
873
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
874
- import_checkbox2.Checkbox,
875
- {
876
- id: "rememberMe",
877
- checked: field.state.value,
878
- onCheckedChange: (checked) => {
879
- field.handleChange(checked === true);
880
- }
881
- }
882
- ),
883
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
884
- "label",
885
- {
886
- htmlFor: "rememberMe",
887
- className: "text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
888
- children: "Remember me"
889
- }
890
- )
891
- ] }) }),
892
866
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
893
867
  AuthLoadingButton,
894
868
  {
@@ -924,7 +898,7 @@ function SheetsRegisterForm({ onRegister, onShowLogin, defaultEmail = "" }) {
924
898
  // src/auth/ui/forgot-password-form.tsx
925
899
  var import_react5 = require("react");
926
900
  var import_react_form3 = require("@tanstack/react-form");
927
- var import_lucide_react3 = require("lucide-react");
901
+ var import_lucide_react4 = require("lucide-react");
928
902
  var import_button4 = require("@constructive-io/ui/button");
929
903
 
930
904
  // src/auth/ui/auth-screen-header.tsx
@@ -988,7 +962,7 @@ function SheetsForgotPasswordForm({ onForgotPassword, onShowLogin }) {
988
962
  });
989
963
  if (isSuccess) {
990
964
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-5 text-center", children: [
991
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.CheckCircleIcon, { className: "text-success h-6 w-6" }) }) }),
965
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react4.CheckCircleIcon, { className: "text-success h-6 w-6" }) }) }),
992
966
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1.5", children: [
993
967
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h3", { className: "text-lg font-semibold", children: "Check your email" }),
994
968
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-muted-foreground text-sm", children: "We've sent a password reset link to your email address." })
@@ -1065,7 +1039,7 @@ function SheetsForgotPasswordForm({ onForgotPassword, onShowLogin }) {
1065
1039
  // src/auth/ui/reset-password-form.tsx
1066
1040
  var React = __toESM(require("react"), 1);
1067
1041
  var import_react_form4 = require("@tanstack/react-form");
1068
- var import_lucide_react4 = require("lucide-react");
1042
+ var import_lucide_react5 = require("lucide-react");
1069
1043
  var import_button5 = require("@constructive-io/ui/button");
1070
1044
 
1071
1045
  // src/auth/utils/validators.ts
@@ -1163,7 +1137,7 @@ function SheetsResetPasswordForm({
1163
1137
  });
1164
1138
  if (isSuccess) {
1165
1139
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-5 text-center", children: [
1166
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react4.CheckCircleIcon, { className: "text-success h-6 w-6" }) }) }),
1140
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bg-success/10 flex h-12 w-12 items-center justify-center rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react5.CheckCircleIcon, { className: "text-success h-6 w-6" }) }) }),
1167
1141
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "space-y-1.5", children: [
1168
1142
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { className: "text-lg font-semibold", children: "Password reset successful" }),
1169
1143
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-muted-foreground text-sm", children: "Your password has been reset successfully. You can now sign in with your new password." })