@privy-io/expo 0.3.2 → 0.3.3-beta-20231212163447
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/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=require("@privy-io/js-sdk-core"),t=require("react"),s=require("react-native"),a=require("react-native-webview"),r=require("react-fast-compare"),i=require("expo-application"),n=require("expo-linking"),o=require("expo-secure-store");function c(e,t){return Object.keys(t).forEach(function(s){"default"===s||"__esModule"===s||e.hasOwnProperty(s)||Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[s]}})}),e}function u(e,t,s,a){Object.defineProperty(e,t,{get:s,set:a,enumerable:!0,configurable:!0})}function l(e){return e&&e.__esModule?e.default:e}u(module.exports,"getUserEmbeddedWallet",()=>g),u(module.exports,"SecureStorageAdapter",()=>E),u(module.exports,"useOAuthFlow",()=>x);var d={};u(d,"PrivyContext",()=>W),u(d,"PrivyProvider",()=>I);var p={};p=JSON.parse('{"name":"@privy-io/expo","version":"0.3.2","description":"Expo client for the Privy Auth API","keywords":["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],"license":"Apache-2.0","source":"./src/index.ts","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.js","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"targets":{"main":{"isLibrary":true,"sourceMap":false,"optimize":true},"module":{"isLibrary":true,"sourceMap":false,"optimize":true}},"files":["dist/**/*","LICENSE","README.md"],"scripts":{"build":"npx parcel build --no-cache","clean":"rm -rf dist .turbo","dev":"npx parcel watch -p 4234","test":"jest --testMatch \\"**/test/unit/**/*.test.ts\\"","test:ci":"npm run test","test-integration":"jest --testMatch \\"**/test/integration/**/*.test.ts\\"","lint":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" && npx tsc --noEmit","format":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" --fix"},"peerDependencies":{"react":"*","react-native":"*","react-native-webview":"*","expo-constants":"*","expo-linking":"*","expo-secure-store":"*","expo-application":"*"},"dependencies":{"@privy-io/js-sdk-core":"
|
|
1
|
+
var e=require("@privy-io/js-sdk-core"),t=require("react"),s=require("react-native"),a=require("react-native-webview"),r=require("react-fast-compare"),i=require("expo-application"),n=require("expo-linking"),o=require("expo-secure-store");function c(e,t){return Object.keys(t).forEach(function(s){"default"===s||"__esModule"===s||e.hasOwnProperty(s)||Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[s]}})}),e}function u(e,t,s,a){Object.defineProperty(e,t,{get:s,set:a,enumerable:!0,configurable:!0})}function l(e){return e&&e.__esModule?e.default:e}u(module.exports,"getUserEmbeddedWallet",()=>g),u(module.exports,"SecureStorageAdapter",()=>E),u(module.exports,"useOAuthFlow",()=>x);var d={};u(d,"PrivyContext",()=>W),u(d,"PrivyProvider",()=>I);var p={};p=JSON.parse('{"name":"@privy-io/expo","version":"0.3.2","description":"Expo client for the Privy Auth API","keywords":["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],"license":"Apache-2.0","source":"./src/index.ts","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.js","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"targets":{"main":{"isLibrary":true,"sourceMap":false,"optimize":true},"module":{"isLibrary":true,"sourceMap":false,"optimize":true}},"files":["dist/**/*","LICENSE","README.md"],"scripts":{"build":"npx parcel build --no-cache","clean":"rm -rf dist .turbo","dev":"npx parcel watch -p 4234","test":"jest --testMatch \\"**/test/unit/**/*.test.ts\\"","test:ci":"npm run test","test-integration":"jest --testMatch \\"**/test/integration/**/*.test.ts\\"","lint":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" && npx tsc --noEmit","format":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" --fix"},"peerDependencies":{"react":"*","react-native":"*","react-native-webview":"*","expo-constants":"*","expo-linking":"*","expo-secure-store":"*","expo-application":"*"},"dependencies":{"@privy-io/js-sdk-core":"0.8.2","react-fast-compare":"^3.2.2"},"devDependencies":{"@privy-io/eslint-config-custom":"*","@privy-io/parcel-config":"*","@privy-io/tsconfig":"*","@tsconfig/node16-strictest-esm":"^1.0.3","parcel":"2.10.1","typescript":"^4.9.5"},"author":"privy.io","publishConfig":{"access":"public"}}');const h=({client:e,isWebViewReady:s,setIsWebViewReady:r})=>{let i=(0,t.useRef)(null);(0,t.useEffect)(()=>{s&&i.current&&e.setMessagePoster(i.current)},[s,e]);let n=(0,t.useCallback)(async t=>{let{data:s}=t.nativeEvent,a=e.embeddedWallet.getMessageHandler();a?.(JSON.parse(s))},[e]);return l(t).createElement(l(a),{style:{flex:1},ref:i,source:{uri:e.embeddedWallet.getURL()},onLoad:()=>r(!0),onMessage:n})},y=e=>t=>e(e=>l(r)(e,t)?e:t),g=e=>{if(!e)return null;let t=e.linked_accounts.find(e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type);return t||null},m=e=>"object"==typeof e&&!!(e?.error&&e?.code),b=e=>t=>e instanceof Error?{status:"error",error:e}:m(e)?{status:"error",error:Error(e.error)}:"string"==typeof e?{status:"error",error:Error(e)}:t,f=({client:s,user:a,wallet:r,setWallet:i,isWebViewReady:n})=>{let o=(0,t.useCallback)(async e=>{i({status:"creating"});try{let t=await s.embeddedWallet.create(e);i({status:"connected",provider:t})}catch(e){i({status:"error",error:"Error creating embedded wallet"})}},[s]),c=(0,t.useCallback)(async e=>{i({status:"connecting"});try{let t=await s.embeddedWallet.getProvider(e);i({status:"connected",provider:t})}catch(e){i({status:"error",error:"Error creating embedded wallet"})}},[s]);return(0,t.useEffect)(()=>{// Ensures that in the event of an expiring session or otherwise bad token,
|
|
2
2
|
// the wallet returns to disconnected state along with a logged out user
|
|
3
3
|
if(!a&&"disconnected"!==r.status)return i({status:"disconnected"});async function t(){// There is a user but no embedded wallet account
|
|
4
4
|
// We need to create an embedded walert for this user
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"@privy-io/js-sdk-core";import t,{createContext as a,useState as s,useMemo as r,useCallback as i,useRef as n,useEffect as o,useContext as c}from"react";import{View as d,AppState as l}from"react-native";import u from"react-native-webview";import p from"react-fast-compare";import{applicationId as h}from"expo-application";import{createURL as f,openURL as b,useURL as y,parse as g}from"expo-linking";import{getItemAsync as m,setItemAsync as v,deleteItemAsync as $}from"expo-secure-store";function w(e,t,a,s){Object.defineProperty(e,t,{get:a,set:s,enumerable:!0,configurable:!0})}var x,C={};w(C,"PrivyContext",()=>z),w(C,"PrivyProvider",()=>V);var E={};E=JSON.parse('{"name":"@privy-io/expo","version":"0.3.2","description":"Expo client for the Privy Auth API","keywords":["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],"license":"Apache-2.0","source":"./src/index.ts","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.js","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"targets":{"main":{"isLibrary":true,"sourceMap":false,"optimize":true},"module":{"isLibrary":true,"sourceMap":false,"optimize":true}},"files":["dist/**/*","LICENSE","README.md"],"scripts":{"build":"npx parcel build --no-cache","clean":"rm -rf dist .turbo","dev":"npx parcel watch -p 4234","test":"jest --testMatch \\"**/test/unit/**/*.test.ts\\"","test:ci":"npm run test","test-integration":"jest --testMatch \\"**/test/integration/**/*.test.ts\\"","lint":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" && npx tsc --noEmit","format":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" --fix"},"peerDependencies":{"react":"*","react-native":"*","react-native-webview":"*","expo-constants":"*","expo-linking":"*","expo-secure-store":"*","expo-application":"*"},"dependencies":{"@privy-io/js-sdk-core":"
|
|
1
|
+
import e from"@privy-io/js-sdk-core";import t,{createContext as a,useState as s,useMemo as r,useCallback as i,useRef as n,useEffect as o,useContext as c}from"react";import{View as d,AppState as l}from"react-native";import u from"react-native-webview";import p from"react-fast-compare";import{applicationId as h}from"expo-application";import{createURL as f,openURL as b,useURL as y,parse as g}from"expo-linking";import{getItemAsync as m,setItemAsync as v,deleteItemAsync as $}from"expo-secure-store";function w(e,t,a,s){Object.defineProperty(e,t,{get:a,set:s,enumerable:!0,configurable:!0})}var x,C={};w(C,"PrivyContext",()=>z),w(C,"PrivyProvider",()=>V);var E={};E=JSON.parse('{"name":"@privy-io/expo","version":"0.3.2","description":"Expo client for the Privy Auth API","keywords":["authentication","authorization","identity","privacy","privy","user data","react-native","expo","web3"],"license":"Apache-2.0","source":"./src/index.ts","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"require":"./dist/index.js","import":"./dist/index.mjs","types":"./dist/index.d.ts"}},"targets":{"main":{"isLibrary":true,"sourceMap":false,"optimize":true},"module":{"isLibrary":true,"sourceMap":false,"optimize":true}},"files":["dist/**/*","LICENSE","README.md"],"scripts":{"build":"npx parcel build --no-cache","clean":"rm -rf dist .turbo","dev":"npx parcel watch -p 4234","test":"jest --testMatch \\"**/test/unit/**/*.test.ts\\"","test:ci":"npm run test","test-integration":"jest --testMatch \\"**/test/integration/**/*.test.ts\\"","lint":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" && npx tsc --noEmit","format":"eslint \\"src/**/*.{ts,tsx,js,jsx}\\" --fix"},"peerDependencies":{"react":"*","react-native":"*","react-native-webview":"*","expo-constants":"*","expo-linking":"*","expo-secure-store":"*","expo-application":"*"},"dependencies":{"@privy-io/js-sdk-core":"0.8.2","react-fast-compare":"^3.2.2"},"devDependencies":{"@privy-io/eslint-config-custom":"*","@privy-io/parcel-config":"*","@privy-io/tsconfig":"*","@tsconfig/node16-strictest-esm":"^1.0.3","parcel":"2.10.1","typescript":"^4.9.5"},"author":"privy.io","publishConfig":{"access":"public"}}');let W=({client:e,isWebViewReady:a,setIsWebViewReady:s})=>{let r=n(null);o(()=>{a&&r.current&&e.setMessagePoster(r.current)},[a,e]);let c=i(async t=>{let{data:a}=t.nativeEvent,s=e.embeddedWallet.getMessageHandler();s?.(JSON.parse(a))},[e]);return t.createElement(u,{style:{flex:1},ref:r,source:{uri:e.embeddedWallet.getURL()},onLoad:()=>s(!0),onMessage:c})},S=e=>t=>e(e=>p(e,t)?e:t),k=e=>{if(!e)return null;let t=e.linked_accounts.find(e=>"wallet"===e.type&&"privy"===e.wallet_client_type&&"embedded"===e.connector_type);return t||null},I=e=>"object"==typeof e&&!!(e?.error&&e?.code),P=e=>t=>e instanceof Error?{status:"error",error:e}:I(e)?{status:"error",error:Error(e.error)}:"string"==typeof e?{status:"error",error:Error(e)}:t,A=({client:e,user:t,wallet:a,setWallet:s,isWebViewReady:r})=>{let n=i(async t=>{s({status:"creating"});try{let a=await e.embeddedWallet.create(t);s({status:"connected",provider:a})}catch(e){s({status:"error",error:"Error creating embedded wallet"})}},[e]),c=i(async t=>{s({status:"connecting"});try{let a=await e.embeddedWallet.getProvider(t);s({status:"connected",provider:a})}catch(e){s({status:"error",error:"Error creating embedded wallet"})}},[e]);return o(()=>{// Ensures that in the event of an expiring session or otherwise bad token,
|
|
2
2
|
// the wallet returns to disconnected state along with a logged out user
|
|
3
3
|
if(!t&&"disconnected"!==a.status)return s({status:"disconnected"});async function i(){// There is a user but no embedded wallet account
|
|
4
4
|
// We need to create an embedded walert for this user
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privy-io/expo",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3-beta-20231212163447",
|
|
4
4
|
"description": "Expo client for the Privy Auth API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"authentication",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"expo-application": "*"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@privy-io/js-sdk-core": "
|
|
65
|
+
"@privy-io/js-sdk-core": "0.8.3-beta-20231212163447",
|
|
66
66
|
"react-fast-compare": "^3.2.2"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|