@privy-io/react-auth 1.2.3-beta.1 → 1.3.0-beta.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.
Files changed (2) hide show
  1. package/dist/index.js +13 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -851,20 +851,10 @@ var EmailFlow = class {
851
851
  };
852
852
 
853
853
  // src/mobile.ts
854
- var isMobile = (userAgent) => {
855
- if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
856
- userAgent
857
- ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
858
- userAgent.substr(0, 4)
859
- )) {
860
- return true;
861
- } else {
862
- return false;
863
- }
864
- };
854
+ var import_react_device_detect = require("react-device-detect");
865
855
  var mobileRedirect = (walletType) => {
866
856
  const currentURL = new URL(window.location.href);
867
- if (!window.ethereum && isMobile(navigator.userAgent || navigator.vendor || window.opera)) {
857
+ if (!window.ethereum && import_react_device_detect.isMobile) {
868
858
  let url = void 0;
869
859
  switch (walletType) {
870
860
  case "metamask":
@@ -1317,6 +1307,7 @@ var WalletConnect = ({ style, ...props }) => {
1317
1307
  };
1318
1308
 
1319
1309
  // src/components/ConnectWalletButtons.tsx
1310
+ var import_react_device_detect2 = require("react-device-detect");
1320
1311
  var import_jsx_runtime9 = require("react/jsx-runtime");
1321
1312
  var ConnectWalletButtons = () => {
1322
1313
  const { navigate } = usePrivyModal();
@@ -1325,7 +1316,7 @@ var ConnectWalletButtons = () => {
1325
1316
  children: [
1326
1317
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ConnectWalletButton, {
1327
1318
  onClick: () => {
1328
- if (isMetamaskInstalled()) {
1319
+ if (isMetamaskInstalled() || import_react_device_detect2.isMobile) {
1329
1320
  initLoginWithWallet("metamask");
1330
1321
  navigate("AWAITING_CONNECTION" /* AWAITING_CONNECTION */);
1331
1322
  } else {
@@ -1338,13 +1329,13 @@ var ConnectWalletButtons = () => {
1338
1329
  children: "Metamask"
1339
1330
  }),
1340
1331
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", {
1341
- children: isMetamaskInstalled() ? "Connect" : "Install"
1332
+ children: isMetamaskInstalled() || import_react_device_detect2.isMobile ? "Connect" : "Install"
1342
1333
  })
1343
1334
  ]
1344
1335
  }),
1345
1336
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ConnectWalletButton, {
1346
1337
  onClick: () => {
1347
- if (isCoinbaseWalletInstalled()) {
1338
+ if (isCoinbaseWalletInstalled() || import_react_device_detect2.isMobile) {
1348
1339
  initLoginWithWallet("coinbase_wallet");
1349
1340
  navigate("AWAITING_CONNECTION" /* AWAITING_CONNECTION */);
1350
1341
  } else {
@@ -1357,7 +1348,7 @@ var ConnectWalletButtons = () => {
1357
1348
  children: "Coinbase Wallet"
1358
1349
  }),
1359
1350
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", {
1360
- children: isCoinbaseWalletInstalled() ? "Connect" : "Install"
1351
+ children: isCoinbaseWalletInstalled() || import_react_device_detect2.isMobile ? "Connect" : "Install"
1361
1352
  })
1362
1353
  ]
1363
1354
  }),
@@ -1856,7 +1847,7 @@ var import_jsx_runtime17 = require("react/jsx-runtime");
1856
1847
  var DEFAULT_FAIL_SCREEN_DURATION_MS = 1400;
1857
1848
  var AwaitingEmailCodeScreen = () => {
1858
1849
  var _a;
1859
- const { navigate } = usePrivyModal();
1850
+ const { navigate, app } = usePrivyModal();
1860
1851
  const { closePrivyModal, resendEmailCode, getAuthMeta, loginWithCode } = usePrivyInternal();
1861
1852
  const { authenticated, user } = usePrivy();
1862
1853
  const [code, setCode] = (0, import_react6.useState)(["", "", "", "", ""]);
@@ -1955,7 +1946,9 @@ var AwaitingEmailCodeScreen = () => {
1955
1946
  children: [
1956
1947
  "Please check ",
1957
1948
  (_a = getAuthMeta()) == null ? void 0 : _a.email,
1958
- " for an email from Privy and enter your code below."
1949
+ " for an email from ",
1950
+ (app == null ? void 0 : app.name) || "privy.io",
1951
+ " and enter your code below."
1959
1952
  ]
1960
1953
  }),
1961
1954
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(CodeInput, {
@@ -5184,14 +5177,14 @@ var WalletEducation = ({ style, ...props }) => {
5184
5177
  };
5185
5178
 
5186
5179
  // src/screens/WalletEducationScreen.tsx
5187
- var import_react_device_detect = require("react-device-detect");
5180
+ var import_react_device_detect3 = require("react-device-detect");
5188
5181
  var import_jsx_runtime23 = require("react/jsx-runtime");
5189
5182
  var WalletEducationScreen = () => {
5190
5183
  const [activeView, setActiveView] = (0, import_react8.useState)("WHAT_IS_A_WALLET" /* WHAT_IS_A_WALLET */);
5191
5184
  const { navigateBack, navigate } = usePrivyModal();
5192
5185
  const backFn = activeView === "WHAT_IS_A_WALLET" /* WHAT_IS_A_WALLET */ ? navigateBack : activeView === "PICK_A_NEW_WALLET" /* PICK_A_NEW_WALLET */ ? () => setActiveView("WHAT_IS_A_WALLET" /* WHAT_IS_A_WALLET */) : () => setActiveView("PICK_A_NEW_WALLET" /* PICK_A_NEW_WALLET */);
5193
5186
  let extensionStoreLink;
5194
- if (import_react_device_detect.isFirefox) {
5187
+ if (import_react_device_detect3.isFirefox) {
5195
5188
  extensionStoreLink = "https://addons.mozilla.org/en-US/firefox/addon/ether-metamask/";
5196
5189
  } else {
5197
5190
  extensionStoreLink = "https://chrome.google.com/webstore/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn?hl=en";
@@ -6144,7 +6137,6 @@ var ModalWrapper = import_styled_components17.default.div`
6144
6137
  textarea:focus {
6145
6138
  outline: none;
6146
6139
  border-color: var(--primary-color);
6147
- border-width: 1px;
6148
6140
  box-shadow: 0 0 0 1px var(--primary-color);
6149
6141
  }
6150
6142
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "1.2.3-beta.1",
3
+ "version": "1.3.0-beta.2",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",