@turnkey/sdk-react 2.0.2 → 2.0.4

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/auth/Auth.d.ts +3 -0
  3. package/dist/components/auth/Auth.d.ts.map +1 -1
  4. package/dist/components/auth/Auth.js +30 -20
  5. package/dist/components/auth/Auth.js.map +1 -1
  6. package/dist/components/auth/Auth.mjs +30 -20
  7. package/dist/components/auth/Auth.mjs.map +1 -1
  8. package/dist/components/auth/Auth.module.css.js +1 -1
  9. package/dist/components/auth/Auth.module.css.mjs +1 -1
  10. package/dist/components/auth/OtpVerification.d.ts +1 -0
  11. package/dist/components/auth/OtpVerification.d.ts.map +1 -1
  12. package/dist/components/auth/OtpVerification.js +6 -7
  13. package/dist/components/auth/OtpVerification.js.map +1 -1
  14. package/dist/components/auth/OtpVerification.mjs +6 -7
  15. package/dist/components/auth/OtpVerification.mjs.map +1 -1
  16. package/dist/components/auth/PhoneInput.d.ts +1 -1
  17. package/dist/components/auth/PhoneInput.d.ts.map +1 -1
  18. package/dist/components/auth/PhoneInput.js +1 -2
  19. package/dist/components/auth/PhoneInput.js.map +1 -1
  20. package/dist/components/auth/PhoneInput.mjs +1 -2
  21. package/dist/components/auth/PhoneInput.mjs.map +1 -1
  22. package/dist/components/auth/TurnkeyThemeProvider.d.ts.map +1 -1
  23. package/dist/components/auth/TurnkeyThemeProvider.js +8 -1
  24. package/dist/components/auth/TurnkeyThemeProvider.js.map +1 -1
  25. package/dist/components/auth/TurnkeyThemeProvider.mjs +9 -2
  26. package/dist/components/auth/TurnkeyThemeProvider.mjs.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +0 -12
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +0 -6
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/styles.cjs.css +2 -2
  34. package/dist/styles.cjs.css.map +1 -1
  35. package/dist/styles.esm.css +2 -2
  36. package/dist/styles.esm.css.map +1 -1
  37. package/package.json +4 -4
  38. package/dist/actions/createSuborg.d.ts +0 -21
  39. package/dist/actions/createSuborg.d.ts.map +0 -1
  40. package/dist/actions/createSuborg.js +0 -50
  41. package/dist/actions/createSuborg.js.map +0 -1
  42. package/dist/actions/createSuborg.mjs +0 -48
  43. package/dist/actions/createSuborg.mjs.map +0 -1
  44. package/dist/actions/getSuborgs.d.ts +0 -10
  45. package/dist/actions/getSuborgs.d.ts.map +0 -1
  46. package/dist/actions/getSuborgs.js +0 -31
  47. package/dist/actions/getSuborgs.js.map +0 -1
  48. package/dist/actions/getSuborgs.mjs +0 -29
  49. package/dist/actions/getSuborgs.mjs.map +0 -1
  50. package/dist/actions/getVerifiedSuborgs.d.ts +0 -10
  51. package/dist/actions/getVerifiedSuborgs.d.ts.map +0 -1
  52. package/dist/actions/getVerifiedSuborgs.js +0 -31
  53. package/dist/actions/getVerifiedSuborgs.js.map +0 -1
  54. package/dist/actions/getVerifiedSuborgs.mjs +0 -29
  55. package/dist/actions/getVerifiedSuborgs.mjs.map +0 -1
  56. package/dist/actions/index.d.ts +0 -7
  57. package/dist/actions/index.d.ts.map +0 -1
  58. package/dist/actions/initOtpAuth.d.ts +0 -13
  59. package/dist/actions/initOtpAuth.d.ts.map +0 -1
  60. package/dist/actions/initOtpAuth.js +0 -39
  61. package/dist/actions/initOtpAuth.js.map +0 -1
  62. package/dist/actions/initOtpAuth.mjs +0 -37
  63. package/dist/actions/initOtpAuth.mjs.map +0 -1
  64. package/dist/actions/oauth.d.ts +0 -13
  65. package/dist/actions/oauth.d.ts.map +0 -1
  66. package/dist/actions/oauth.js +0 -32
  67. package/dist/actions/oauth.js.map +0 -1
  68. package/dist/actions/oauth.mjs +0 -30
  69. package/dist/actions/oauth.mjs.map +0 -1
  70. package/dist/actions/otpAuth.d.ts +0 -14
  71. package/dist/actions/otpAuth.d.ts.map +0 -1
  72. package/dist/actions/otpAuth.js +0 -32
  73. package/dist/actions/otpAuth.js.map +0 -1
  74. package/dist/actions/otpAuth.mjs +0 -30
  75. package/dist/actions/otpAuth.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @turnkey/sdk-react
2
2
 
3
+ ## 2.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 99ebe78: Fixed MUI components not inheriting fonts.
8
+ - Updated dependencies [053fbfb]
9
+ - @turnkey/sdk-browser@1.11.2
10
+ - @turnkey/sdk-server@1.7.3
11
+ - @turnkey/crypto@2.3.0
12
+ - @turnkey/wallet-stamper@1.0.2
13
+
14
+ ## 2.0.3
15
+
16
+ ### Patch Changes
17
+
18
+ - d43c52c: Add session length customization, wallet generation customization, enter to continue, more css customization and css fixes (icon sizing issues, etc)
19
+ - 5419d49: fix css bundling bug
20
+ - Updated dependencies [328d6aa]
21
+ - Updated dependencies [b90947e]
22
+ - Updated dependencies [2d5977b]
23
+ - Updated dependencies [fad7c37]
24
+ - @turnkey/sdk-browser@1.11.1
25
+ - @turnkey/sdk-server@1.7.2
26
+ - @turnkey/crypto@2.3.0
27
+ - @turnkey/wallet-stamper@1.0.2
28
+
3
29
  ## 2.0.2
4
30
 
5
31
  ### Patch Changes
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import type { WalletAccount } from "@turnkey/sdk-browser";
2
3
  interface AuthProps {
3
4
  onAuthSuccess: () => Promise<void>;
4
5
  onError: (errorMessage: string) => void;
@@ -9,9 +10,11 @@ interface AuthProps {
9
10
  appleEnabled: boolean;
10
11
  facebookEnabled: boolean;
11
12
  googleEnabled: boolean;
13
+ sessionLengthSeconds?: number;
12
14
  };
13
15
  configOrder: string[];
14
16
  customSmsMessage?: string;
17
+ customAccounts?: WalletAccount[];
15
18
  }
16
19
  declare const Auth: React.FC<AuthProps>;
17
20
  export default Auth;
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../../src/components/auth/Auth.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAkDnD,UAAU,SAAS;IACjB,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,EAAE;QACV,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,YAAY,EAAE,OAAO,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA0iB7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"Auth.d.ts","sourceRoot":"","sources":["../../../src/components/auth/Auth.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAoC1D,UAAU,SAAS;IACjB,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,UAAU,EAAE;QACV,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,YAAY,EAAE,OAAO,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,aAAa,EAAE,OAAO,CAAC;QACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;KAC/B,CAAC;IACF,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAujB7B,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -4,12 +4,6 @@
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var Auth_module = require('./Auth.module.css.js');
6
6
  var React = require('react');
7
- var createSuborg = require('../../actions/createSuborg.js');
8
- var getSuborgs = require('../../actions/getSuborgs.js');
9
- var getVerifiedSuborgs = require('../../actions/getVerifiedSuborgs.js');
10
- var initOtpAuth = require('../../actions/initOtpAuth.js');
11
- var oauth = require('../../actions/oauth.js');
12
- require('@turnkey/sdk-server');
13
7
  var PhoneInput = require('./PhoneInput.js');
14
8
  var Google = require('./Google.js');
15
9
  var Apple = require('./Apple.js');
@@ -23,10 +17,11 @@ var ChevronLeftIcon = require('@mui/icons-material/ChevronLeft');
23
17
  var OtpVerification = require('./OtpVerification.js');
24
18
  var useTurnkey = require('../../hooks/use-turnkey.js');
25
19
  var constants = require('./constants.js');
20
+ var sdkServer = require('@turnkey/sdk-server');
26
21
 
27
22
  const passkeyIcon = (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "43", height: "48", fill: "none", children: [jsxRuntime.jsx("path", { fill: "var(--icon-color)", "fill-rule": "evenodd", d: "M27.52 37.06a6.8 6.8 0 0 0-2.02-.31H12a6.75 6.75 0 0 0-6.75 6.75V48H.75v-4.5A11.25 11.25 0 0 1 12 32.25h13.5c.68 0 1.355.062 2.016.182zm4.698-23.74a13.5 13.5 0 1 0-8.503 13.484c-.057-.178-.131-.425-.167-.566a13 13 0 0 1-.229-1.134 12 12 0 0 1-.054-.448q-.02-.202-.013-1.064c.007-.82.01-.877.055-1.186.018-.121.046-.29.072-.438a9 9 0 1 1 4.315-6.714 13.83 13.83 0 0 1 .87-.564 14 14 0 0 1 1.08-.556c.102-.045.299-.128.44-.184.14-.056.384-.146.544-.202.16-.055.436-.141.615-.194.18-.05.467-.125.641-.165.092-.02.214-.046.334-.07", "clip-rule": "evenodd" }), jsxRuntime.jsx("path", { fill: "var(--icon-color)", "fill-rule": "evenodd", d: "M33.844 16.554a9.563 9.563 0 0 0-.975.134c-.125.022-.355.075-.51.114s-.418.12-.589.177a11 11 0 0 0-.553.21 12 12 0 0 0-.519.244 8.29 8.29 0 0 0-.961.573c-.114.08-.313.23-.445.334-.13.104-.358.31-.507.454a10 10 0 0 0-.466.495c-.107.127-.269.334-.362.46-.091.128-.232.34-.313.474-.079.133-.195.34-.256.46-.062.122-.15.308-.196.413a10 10 0 0 0-.152.387c-.04.107-.1.304-.14.44a9 9 0 0 0-.119.51c-.028.145-.065.374-.082.51a6 6 0 0 0-.032.773c-.002.327.007.598.021.712a8.924 8.924 0 0 0 .163.905c.03.116.09.322.134.457.046.136.125.35.178.475a8 8 0 0 0 .725 1.329 9.15 9.15 0 0 0 .622.772c.111.121.294.306.408.41.114.101.295.256.4.342.108.085.273.211.37.28.097.068.244.165.325.218l.299.179c.082.047.251.137.374.2.125.062.232.127.24.146.013.025.018 2.403.018 7.032 0 5.905.004 7.018.025 7.125.014.07.047.18.075.24.029.064.08.156.113.203.032.05.522.654 1.086 1.345.564.693 1.07 1.31 1.123 1.371.054.063.14.151.195.195.054.042.162.111.239.151s.204.092.281.115c.121.035.181.04.413.04.206 0 .3-.007.387-.03a2 2 0 0 0 .237-.09 1.8 1.8 0 0 0 .388-.25c.029-.029.547-.657 1.153-1.397a97 97 0 0 0 1.12-1.383.4.4 0 0 0 .019-.137c0-.053-.016-.178-.035-.276a5 5 0 0 0-.273-.876 24 24 0 0 0-.298-.73 32 32 0 0 0-.626-1.365.8.8 0 0 1-.069-.172q.001-.033.041-.043c.021-.003.134-.016.25-.026s.295-.032.395-.046c.102-.016.248-.044.325-.065a.9.9 0 0 0 .237-.102.8.8 0 0 0 .15-.133c.028-.037.073-.116.1-.174.026-.058.054-.16.065-.229a1.895 1.895 0 0 0-.042-.589 2 2 0 0 0-.074-.193c-.023-.053-.355-.542-.736-1.085-.38-.543-.693-1.005-.693-1.025 0-.028.037-.046.234-.105.128-.04.339-.113.469-.162.132-.047.293-.116.36-.15a1 1 0 0 0 .204-.144.8.8 0 0 0 .144-.212c.034-.072.072-.18.085-.238s.024-.2.024-.316c0-.123-.009-.25-.024-.308a1.4 1.4 0 0 0-.072-.202c-.032-.07-.275-.39-.737-.975-.378-.479-.687-.883-.687-.9s.018-.043.04-.055.197-.11.39-.215c.194-.103.431-.237.528-.295.096-.058.22-.15.274-.204a1.1 1.1 0 0 0 .257-.459c.026-.1.031-.247.04-1.283.005-.642.016-1.178.023-1.19s.105-.069.22-.125c.112-.058.284-.15.38-.204a10 10 0 0 0 .985-.668 6.762 6.762 0 0 0 .826-.767c.107-.117.267-.305.358-.418a8 8 0 0 0 .605-.891 8.9 8.9 0 0 0 .373-.756c.045-.105.12-.308.17-.448a8 8 0 0 0 .156-.536c.037-.155.088-.408.113-.563.023-.155.05-.381.061-.505a8 8 0 0 0-.007-1.139 8 8 0 0 0-.07-.527 8 8 0 0 0-.097-.466c-.028-.116-.08-.3-.116-.413a7 7 0 0 0-.83-1.714 10 10 0 0 0-.256-.37 9 9 0 0 0-.23-.29 9 9 0 0 0-.81-.82 9 9 0 0 0-.395-.32 9 9 0 0 0-.835-.556 13 13 0 0 0-.417-.221 11 11 0 0 0-.483-.223 8 8 0 0 0-.98-.343 11 11 0 0 0-.422-.108c-.106-.022-.288-.06-.404-.079a10 10 0 0 0-.51-.073 8 8 0 0 0-.852-.043c-.304-.001-.644.002-.756.011m.207 3.334-.058.006a4.6 4.6 0 0 0-1.283.341 4 4 0 0 0-.334.159 4.354 4.354 0 0 0-.668.452 5.5 5.5 0 0 0-.669.69 5 5 0 0 0-.207.308 4 4 0 0 0-.18.325c-.04.088-.101.234-.135.325a3.856 3.856 0 0 0-.177.66c-.016.087-.034.24-.04.342-.01.159-.008.19.017.215.028.03.25.031 4.175.031 3.663 0 4.15-.003 4.174-.026q.029-.027.028-.12a3 3 0 0 0-.072-.574 3.9 3.9 0 0 0-.297-.87 4 4 0 0 0-.21-.379 6 6 0 0 0-.23-.316 6 6 0 0 0-.346-.37 5 5 0 0 0-.365-.326 7 7 0 0 0-.246-.178 5 5 0 0 0-.264-.16 4.6 4.6 0 0 0-1.585-.52 5.681 5.681 0 0 0-.84-.035z", "clip-rule": "evenodd" })] }));
28
23
  const passkeyIconError = (jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "43", height: "48", fill: "none", children: [jsxRuntime.jsx("path", { fill: "var(--error-color)", "fill-rule": "evenodd", d: "M27.52 37.06a6.8 6.8 0 0 0-2.02-.31H12a6.75 6.75 0 0 0-6.75 6.75V48H.75v-4.5A11.25 11.25 0 0 1 12 32.25h13.5c.68 0 1.355.062 2.016.182zm4.698-23.74a13.5 13.5 0 1 0-8.503 13.484c-.057-.178-.131-.425-.167-.566a13 13 0 0 1-.229-1.134 12 12 0 0 1-.054-.448q-.02-.202-.013-1.064c.007-.82.01-.877.055-1.186.018-.121.046-.29.072-.438a9 9 0 1 1 4.315-6.714 13.83 13.83 0 0 1 .87-.564 14 14 0 0 1 1.08-.556c.102-.045.299-.128.44-.184.14-.056.384-.146.544-.202.16-.055.436-.141.615-.194.18-.05.467-.125.641-.165.092-.02.214-.046.334-.07", "clip-rule": "evenodd" }), jsxRuntime.jsx("path", { fill: "var(--error-color)", "fill-rule": "evenodd", d: "M33.844 16.554a9.563 9.563 0 0 0-.975.134c-.125.022-.355.075-.51.114s-.418.12-.589.177a11 11 0 0 0-.553.21 12 12 0 0 0-.519.244 8.29 8.29 0 0 0-.961.573c-.114.08-.313.23-.445.334-.13.104-.358.31-.507.454a10 10 0 0 0-.466.495c-.107.127-.269.334-.362.46-.091.128-.232.34-.313.474-.079.133-.195.34-.256.46-.062.122-.15.308-.196.413a10 10 0 0 0-.152.387c-.04.107-.1.304-.14.44a9 9 0 0 0-.119.51c-.028.145-.065.374-.082.51a6 6 0 0 0-.032.773c-.002.327.007.598.021.712a8.924 8.924 0 0 0 .163.905c.03.116.09.322.134.457.046.136.125.35.178.475a8 8 0 0 0 .725 1.329 9.15 9.15 0 0 0 .622.772c.111.121.294.306.408.41.114.101.295.256.4.342.108.085.273.211.37.28.097.068.244.165.325.218l.299.179c.082.047.251.137.374.2.125.062.232.127.24.146.013.025.018 2.403.018 7.032 0 5.905.004 7.018.025 7.125.014.07.047.18.075.24.029.064.08.156.113.203.032.05.522.654 1.086 1.345.564.693 1.07 1.31 1.123 1.371.054.063.14.151.195.195.054.042.162.111.239.151s.204.092.281.115c.121.035.181.04.413.04.206 0 .3-.007.387-.03a2 2 0 0 0 .237-.09 1.8 1.8 0 0 0 .388-.25c.029-.029.547-.657 1.153-1.397a97 97 0 0 0 1.12-1.383.4.4 0 0 0 .019-.137c0-.053-.016-.178-.035-.276a5 5 0 0 0-.273-.876 24 24 0 0 0-.298-.73 32 32 0 0 0-.626-1.365.8.8 0 0 1-.069-.172q.001-.033.041-.043c.021-.003.134-.016.25-.026s.295-.032.395-.046c.102-.016.248-.044.325-.065a.9.9 0 0 0 .237-.102.8.8 0 0 0 .15-.133c.028-.037.073-.116.1-.174.026-.058.054-.16.065-.229a1.895 1.895 0 0 0-.042-.589 2 2 0 0 0-.074-.193c-.023-.053-.355-.542-.736-1.085-.38-.543-.693-1.005-.693-1.025 0-.028.037-.046.234-.105.128-.04.339-.113.469-.162.132-.047.293-.116.36-.15a1 1 0 0 0 .204-.144.8.8 0 0 0 .144-.212c.034-.072.072-.18.085-.238s.024-.2.024-.316c0-.123-.009-.25-.024-.308a1.4 1.4 0 0 0-.072-.202c-.032-.07-.275-.39-.737-.975-.378-.479-.687-.883-.687-.9s.018-.043.04-.055.197-.11.39-.215c.194-.103.431-.237.528-.295.096-.058.22-.15.274-.204a1.1 1.1 0 0 0 .257-.459c.026-.1.031-.247.04-1.283.005-.642.016-1.178.023-1.19s.105-.069.22-.125c.112-.058.284-.15.38-.204a10 10 0 0 0 .985-.668 6.762 6.762 0 0 0 .826-.767c.107-.117.267-.305.358-.418a8 8 0 0 0 .605-.891 8.9 8.9 0 0 0 .373-.756c.045-.105.12-.308.17-.448a8 8 0 0 0 .156-.536c.037-.155.088-.408.113-.563.023-.155.05-.381.061-.505a8 8 0 0 0-.007-1.139 8 8 0 0 0-.07-.527 8 8 0 0 0-.097-.466c-.028-.116-.08-.3-.116-.413a7 7 0 0 0-.83-1.714 10 10 0 0 0-.256-.37 9 9 0 0 0-.23-.29 9 9 0 0 0-.81-.82 9 9 0 0 0-.395-.32 9 9 0 0 0-.835-.556 13 13 0 0 0-.417-.221 11 11 0 0 0-.483-.223 8 8 0 0 0-.98-.343 11 11 0 0 0-.422-.108c-.106-.022-.288-.06-.404-.079a10 10 0 0 0-.51-.073 8 8 0 0 0-.852-.043c-.304-.001-.644.002-.756.011m.207 3.334-.058.006a4.6 4.6 0 0 0-1.283.341 4 4 0 0 0-.334.159 4.354 4.354 0 0 0-.668.452 5.5 5.5 0 0 0-.669.69 5 5 0 0 0-.207.308 4 4 0 0 0-.18.325c-.04.088-.101.234-.135.325a3.856 3.856 0 0 0-.177.66c-.016.087-.034.24-.04.342-.01.159-.008.19.017.215.028.03.25.031 4.175.031 3.663 0 4.15-.003 4.174-.026q.029-.027.028-.12a3 3 0 0 0-.072-.574 3.9 3.9 0 0 0-.297-.87 4 4 0 0 0-.21-.379 6 6 0 0 0-.23-.316 6 6 0 0 0-.346-.37 5 5 0 0 0-.365-.326 7 7 0 0 0-.246-.178 5 5 0 0 0-.264-.16 4.6 4.6 0 0 0-1.585-.52 5.681 5.681 0 0 0-.84-.035z", "clip-rule": "evenodd" })] }));
29
- const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessage, }) => {
24
+ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessage, customAccounts, }) => {
30
25
  const { passkeyClient, authIframeClient } = useTurnkey.useTurnkey();
31
26
  const [email, setEmail] = React.useState("");
32
27
  const [phone, setPhone] = React.useState("");
@@ -61,7 +56,7 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
61
56
  let suborgId;
62
57
  if (filterType == constants.FilterType.Email ||
63
58
  filterType == constants.FilterType.PhoneNumber) {
64
- const getVerifiedSuborgsResponse = await getVerifiedSuborgs.getVerifiedSuborgs({
59
+ const getVerifiedSuborgsResponse = await sdkServer.server.getVerifiedSuborgs({
65
60
  filterType,
66
61
  filterValue,
67
62
  });
@@ -72,7 +67,10 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
72
67
  suborgId = getVerifiedSuborgsResponse?.organizationIds[0];
73
68
  }
74
69
  else {
75
- const getSuborgsResponse = await getSuborgs.getSuborgs({ filterType, filterValue });
70
+ const getSuborgsResponse = await sdkServer.server.getSuborgs({
71
+ filterType,
72
+ filterValue,
73
+ });
76
74
  if (!getSuborgsResponse || !getSuborgsResponse.organizationIds) {
77
75
  onError(constants.authErrors.suborg.fetchFailed);
78
76
  }
@@ -84,7 +82,10 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
84
82
  createSuborgData.email = filterValue;
85
83
  else if (filterType === constants.FilterType.PhoneNumber)
86
84
  createSuborgData.phoneNumber = filterValue;
87
- const createSuborgResponse = await createSuborg.createSuborg(createSuborgData);
85
+ if (customAccounts) {
86
+ createSuborgData.customAccounts = customAccounts;
87
+ }
88
+ const createSuborgResponse = await sdkServer.server.createSuborg(createSuborgData);
88
89
  if (!createSuborgResponse || !createSuborgResponse.subOrganizationId) {
89
90
  onError(constants.authErrors.suborg.createFailed);
90
91
  }
@@ -117,13 +118,14 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
117
118
  publicKey: { user: { name: siteInfo, displayName: siteInfo } },
118
119
  })) || {};
119
120
  if (encodedChallenge && attestation) {
120
- const response = await createSuborg.createSuborg({
121
+ const response = await sdkServer.server.createSuborg({
121
122
  email,
122
123
  passkey: {
123
124
  authenticatorName: "First Passkey",
124
125
  challenge: encodedChallenge,
125
126
  attestation,
126
127
  },
128
+ ...(customAccounts && { customAccounts }),
127
129
  });
128
130
  if (response?.subOrganizationId) {
129
131
  setPasskeyCreated(true);
@@ -170,7 +172,7 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
170
172
  };
171
173
  const handleOtpLogin = async (type, value, otpType) => {
172
174
  const suborgId = await handleGetOrCreateSuborg(type, value);
173
- const initAuthResponse = await initOtpAuth.initOtpAuth({
175
+ const initAuthResponse = await sdkServer.server.sendOtp({
174
176
  suborgID: suborgId,
175
177
  otpType,
176
178
  contact: value,
@@ -191,13 +193,14 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
191
193
  const suborgId = await handleGetOrCreateSuborg(constants.FilterType.OidcToken, credential, {
192
194
  oauthProviders: [{ providerName, oidcToken: credential }],
193
195
  });
194
- const oauthResponse = await oauth.oauth({
196
+ const oauthResponse = await sdkServer.server.oauth({
195
197
  suborgID: suborgId,
196
198
  oidcToken: credential,
197
199
  targetPublicKey: authIframeClient?.iframePublicKey,
200
+ sessionLengthSeconds: authConfig.sessionLengthSeconds,
198
201
  });
199
- if (oauthResponse && oauthResponse.credentialBundle) {
200
- await handleAuthSuccess(oauthResponse.credentialBundle);
202
+ if (oauthResponse && oauthResponse.token) {
203
+ await handleAuthSuccess(oauthResponse.token);
201
204
  }
202
205
  else {
203
206
  onError(constants.authErrors.oauth.loginFailed);
@@ -211,6 +214,7 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
211
214
  }, sx: {
212
215
  color: "var(--text-secondary)",
213
216
  position: "absolute",
217
+ fontSize: "24px",
214
218
  top: 16,
215
219
  left: 16,
216
220
  zIndex: 10,
@@ -231,7 +235,10 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
231
235
  const renderSection = (section) => {
232
236
  switch (section) {
233
237
  case "email":
234
- return authConfig.emailEnabled && !otpId ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: Auth_module.inputGroup, children: jsxRuntime.jsx(material.TextField, { name: "emailInput", autoComplete: "off", type: "email", placeholder: "Enter your email", value: email, onChange: (e) => setEmail(e.target.value), fullWidth: true, sx: {
238
+ return authConfig.emailEnabled && !otpId ? (jsxRuntime.jsxs("form", { onSubmit: (e) => {
239
+ e.preventDefault();
240
+ handleOtpLogin(constants.FilterType.Email, email, constants.OtpType.Email);
241
+ }, children: [jsxRuntime.jsx("div", { className: Auth_module.inputGroup, children: jsxRuntime.jsx(material.TextField, { name: "email-input", type: "email", placeholder: "Enter your email", value: email, onChange: (e) => setEmail(e.target.value), fullWidth: true, sx: {
235
242
  "& .MuiOutlinedInput-root": {
236
243
  color: "var(--input-text)",
237
244
  "& fieldset": {
@@ -249,11 +256,14 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
249
256
  padding: "12px",
250
257
  },
251
258
  backgroundColor: "var(--input-bg)",
252
- }, variant: "outlined" }) }), jsxRuntime.jsx("button", { className: Auth_module.authButton, type: "button", onClick: () => handleOtpLogin(constants.FilterType.Email, email, constants.OtpType.Email), disabled: !isValidEmail(email), children: "Continue" })] })) : null;
259
+ }, variant: "outlined" }) }), jsxRuntime.jsx("button", { className: Auth_module.authButton, type: "submit", disabled: !isValidEmail(email), children: "Continue" })] })) : null;
260
+ case "phone":
261
+ return authConfig.phoneEnabled && !otpId ? (jsxRuntime.jsxs("form", { onSubmit: (e) => {
262
+ e.preventDefault();
263
+ handleOtpLogin(constants.FilterType.PhoneNumber, phone, constants.OtpType.Sms);
264
+ }, children: [jsxRuntime.jsx("div", { className: Auth_module.phoneInput, children: jsxRuntime.jsx(PhoneInput.MuiPhone, { onChange: (value) => setPhone(value), value: phone }) }), jsxRuntime.jsx("button", { className: Auth_module.authButton, type: "submit", disabled: !isValidPhone(phone), children: "Continue" })] })) : null;
253
265
  case "passkey":
254
266
  return authConfig.passkeyEnabled && !otpId ? (jsxRuntime.jsxs("div", { className: Auth_module.passkeyContainer, children: [jsxRuntime.jsx("button", { className: Auth_module.authButton, type: "button", onClick: handleLoginWithPasskey, children: "Log in with passkey" }), jsxRuntime.jsx("div", { className: Auth_module.noPasskeyLink, onClick: () => setPasskeySignupScreen(true), children: "Sign up with passkey" })] })) : null;
255
- case "phone":
256
- return authConfig.phoneEnabled && !otpId ? (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("div", { className: Auth_module.phoneInput, children: jsxRuntime.jsx(PhoneInput.MuiPhone, { onChange: (value) => setPhone(value), value: phone }) }), jsxRuntime.jsx("button", { className: Auth_module.authButton, type: "button", onClick: () => handleOtpLogin(constants.FilterType.PhoneNumber, phone, constants.OtpType.Sms), disabled: !isValidPhone(phone), children: "Continue" })] })) : null;
257
267
  case "socials":
258
268
  return authConfig.googleEnabled ||
259
269
  authConfig.appleEnabled ||
@@ -271,7 +281,7 @@ const Auth = ({ onAuthSuccess, onError, authConfig, configOrder, customSmsMessag
271
281
  : "Creating passkey..." }) }), jsxRuntime.jsx("div", { className: Auth_module.rowsContainer, children: jsxRuntime.jsx("span", { className: Auth_module.primaryText, children: jsxRuntime.jsx("center", { children: passkeySignupError ? passkeySignupError : "" }) }) }), passkeySignupError && (jsxRuntime.jsx("button", { className: Auth_module.authButton, type: "button", onClick: handleSignupWithPasskey, children: "Retry" }))] })) : (jsxRuntime.jsx("div", { children: oauthLoading !== "" ? (jsxRuntime.jsxs("div", { className: Auth_module.authCardLoading, children: [jsxRuntime.jsxs("h3", { className: Auth_module.verifyingText, children: ["Verifying with ", oauthLoading] }), jsxRuntime.jsxs("div", { className: Auth_module.loadingWrapper, children: [jsxRuntime.jsx(material.CircularProgress, { size: 80, thickness: 1, className: Auth_module.circularProgress }), oauthLoading === "Google" && (jsxRuntime.jsx("img", { src: google, className: Auth_module.oauthIcon })), oauthLoading === "Facebook" && (jsxRuntime.jsx("img", { src: facebook, className: Auth_module.oauthIcon })), oauthLoading === "Apple" && (jsxRuntime.jsx("img", { src: apple, className: Auth_module.oauthIcon }))] }), jsxRuntime.jsxs("div", { className: Auth_module.poweredBy, children: [jsxRuntime.jsx("span", { children: "Secured by" }), jsxRuntime.jsx("img", { src: turnkey })] })] })) : (jsxRuntime.jsxs("div", { className: Auth_module.authCard, children: [otpId && renderBackButton(), jsxRuntime.jsx("h2", { className: Auth_module.primaryText, children: !otpId && "Log in or sign up" }), jsxRuntime.jsxs("div", { className: Auth_module.authForm, children: [!otpId &&
272
282
  configOrder
273
283
  .filter((section) => renderSection(section) !== null)
274
- .map((section, index, visibleSections) => (jsxRuntime.jsxs(React.Fragment, { children: [renderSection(section), index < visibleSections.length - 1 && (jsxRuntime.jsx("div", { className: Auth_module.separator, children: jsxRuntime.jsx("span", { children: "OR" }) }))] }, section))), otpId && (jsxRuntime.jsx(OtpVerification, { type: step, contact: step === constants.OtpType.Email ? email : phone, suborgId: suborgId, otpId: otpId, authIframeClient: authIframeClient, onValidateSuccess: handleAuthSuccess, onResendCode: handleResendCode })), !otpId && (jsxRuntime.jsx("div", { className: Auth_module.tos, children: jsxRuntime.jsxs("span", { children: ["By continuing, you agree to our", " ", jsxRuntime.jsx("a", { href: "https://www.turnkey.com/legal/terms", target: "_blank", rel: "noopener noreferrer", className: Auth_module.tosBold, children: "Terms of Service" }), " ", "&", " ", jsxRuntime.jsx("a", { href: "https://www.turnkey.com/legal/privacy", target: "_blank", rel: "noopener noreferrer", className: Auth_module.tosBold, children: "Privacy Policy" }), "."] }) }))] }), jsxRuntime.jsxs("div", { onClick: () => (window.location.href = "https://www.turnkey.com/"), className: Auth_module.poweredBy, children: [jsxRuntime.jsx("span", { children: "Secured by" }), jsxRuntime.jsx("img", { src: turnkey })] })] })) })) }));
284
+ .map((section, index, visibleSections) => (jsxRuntime.jsxs(React.Fragment, { children: [renderSection(section), index < visibleSections.length - 1 && (jsxRuntime.jsx("div", { className: Auth_module.separator, children: jsxRuntime.jsx("span", { children: "OR" }) }))] }, section))), otpId && (jsxRuntime.jsx(OtpVerification, { type: step, contact: step === constants.OtpType.Email ? email : phone, suborgId: suborgId, otpId: otpId, sessionLengthSeconds: authConfig.sessionLengthSeconds, authIframeClient: authIframeClient, onValidateSuccess: handleAuthSuccess, onResendCode: handleResendCode })), !otpId && (jsxRuntime.jsx("div", { className: Auth_module.tos, children: jsxRuntime.jsxs("span", { children: ["By continuing, you agree to our", " ", jsxRuntime.jsx("a", { href: "https://www.turnkey.com/legal/terms", target: "_blank", rel: "noopener noreferrer", className: Auth_module.tosBold, children: "Terms of Service" }), " ", "&", " ", jsxRuntime.jsx("a", { href: "https://www.turnkey.com/legal/privacy", target: "_blank", rel: "noopener noreferrer", className: Auth_module.tosBold, children: "Privacy Policy" }), "."] }) }))] }), jsxRuntime.jsxs("div", { onClick: () => (window.location.href = "https://www.turnkey.com/"), className: Auth_module.poweredBy, children: [jsxRuntime.jsx("span", { children: "Secured by" }), jsxRuntime.jsx("img", { src: turnkey })] })] })) })) }));
275
285
  };
276
286
 
277
287
  module.exports = Auth;