@magic-ext/farcaster
Advanced tools
Comparing version 0.0.5-canary.754.9662877746.0 to 0.0.5-canary.754.9666852162.0
@@ -1,2 +0,2 @@ | ||
"use strict";var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var I=(t,n,e)=>n in t?d(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,v=(t,n)=>{for(var e in n||(n={}))w.call(n,e)&&I(t,e,n[e]);if(A)for(var e of A(n))U.call(n,e)&&I(t,e,n[e]);return t};var S=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},T=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of L(n))!w.call(t,o)&&o!==e&&d(t,o,{get:()=>n[o],enumerable:!(i=k(n,o))||i.enumerable});return t};var _=t=>T(d({},"__esModule",{value:!0}),t);var m=(t,n,e)=>new Promise((i,o)=>{var h=r=>{try{l(e.next(r))}catch(c){o(c)}},f=r=>{try{l(e.throw(r))}catch(c){o(c)}},l=r=>r.done?i(r.value):Promise.resolve(r.value).then(h,f);l((e=e.apply(t,n)).next())});var V={};S(V,{FarcasterExtension:()=>E});module.exports=_(V);var p=require("@magic-sdk/commons"),g=require("@farcaster/auth-client");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function D(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function H(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function F(){return D()||H()}function C(){return x()||F()}var P={CHANNEL:"channel",DONE:"done",ERROR:"error"},O=t=>typeof t=="function",N=t=>typeof t=="function",q="https://relay.farcaster.xyz",W="https://example.com/login",J=6e4,M=500,Q=!0,E=class extends p.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>{var b;let i=(b=e==null?void 0:e.showUI)!=null?b:Q,o=null,h,f,l;C()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),o=window.open());let r=(0,g.createAppClient)({relay:q,ethereum:(0,g.viemConnector)()}),c=r.createChannel({siweUri:W,domain:window.location.host}),R=c.then(({data:a})=>(C()&&(o==null||o.location.assign(a.url)),l=a.channelToken,h=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:v({showUI:i},a)}]),f=this.request(h),r.watchStatus({channelToken:a.channelToken,timeout:J,interval:M}).then(s=>{if(s.isError)throw s.error;return s})));R.then(s=>m(this,[s],function*({data:a}){a.state==="completed"&&(this.createIntermediaryEvent(p.FarcasterLoginEventEmit.SuccessSignIn,h.id)({channel_token:l,message:a.message,signature:a.signature,fid:a.fid,username:a.username}),yield f,o==null||o.close())})).catch(a=>{console.error(a),o==null||o.close()});let y={on:(a,s)=>(a==="channel"&&m(this,null,function*(){let{data:u}=yield c;!O(s)||s(u)}),a===P.DONE&&m(this,null,function*(){let{data:u}=yield R;u.state==="completed"&&(!N(s)||s(u))}),a===P.ERROR&&R.catch(u=>{s(u)}),y)};return y}}}; | ||
"use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},m=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!g.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(r=d(e,o))||r.enumerable});return t};var A=t=>m(s({},"__esModule",{value:!0}),t);var b={};v(b,{FarcasterExtension:()=>c});module.exports=A(b);var h=require("@magic-sdk/commons"),i=require("@farcaster/auth-client");function C(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function I(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function R(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function L(){return I()||R()}function a(){return C()||L()}var P=!0;var c=class extends h.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.appClient=(0,i.createAppClient)({ethereum:(0,i.viemConnector)()});this.channel=null;this.login=n=>{var u;let r=(u=n==null?void 0:n.showUI)!=null?u:P,o=location.origin,p=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:r,domain:o,channel:this.channel,isMobile:a()}}]),l=this.request(p);if(a())if(this.channel)location.href=this.channel.url;else return l;return l};a()&&this.appClient.createChannel({siweUri:`${location.origin}/login`,domain:location.host}).then(({data:n})=>{this.channel=n})}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var d=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var I=(t,n,e)=>n in t?d(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e,v=(t,n)=>{for(var e in n||(n={}))w.call(n,e)&&I(t,e,n[e]);if(A)for(var e of A(n))U.call(n,e)&&I(t,e,n[e]);return t};var S=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},T=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of L(n))!w.call(t,o)&&o!==e&&d(t,o,{get:()=>n[o],enumerable:!(i=k(n,o))||i.enumerable});return t};var _=t=>T(d({},"__esModule",{value:!0}),t);var m=(t,n,e)=>new Promise((i,o)=>{var h=r=>{try{l(e.next(r))}catch(c){o(c)}},f=r=>{try{l(e.throw(r))}catch(c){o(c)}},l=r=>r.done?i(r.value):Promise.resolve(r.value).then(h,f);l((e=e.apply(t,n)).next())});var V={};S(V,{FarcasterExtension:()=>E});module.exports=_(V);var p=require("@magic-sdk/commons"),g=require("@farcaster/auth-client");function x(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function D(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function H(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function F(){return D()||H()}function C(){return x()||F()}var P={CHANNEL:"channel",DONE:"done",ERROR:"error"},O=t=>typeof t=="function",N=t=>typeof t=="function",q="https://relay.farcaster.xyz",W="https://example.com/login",J=6e4,M=500,Q=!0,E=class extends p.Extension.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>{var b;let i=(b=e==null?void 0:e.showUI)!=null?b:Q,o=null,h,f,l;C()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),o=window.open());let r=(0,g.createAppClient)({relay:q,ethereum:(0,g.viemConnector)()}),c=r.createChannel({siweUri:W,domain:window.location.host}),R=c.then(({data:a})=>(C()&&(o==null||o.location.assign(a.url)),l=a.channelToken,h=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:v({showUI:i},a)}]),f=this.request(h),r.watchStatus({channelToken:a.channelToken,timeout:J,interval:M}).then(s=>{if(s.isError)throw s.error;return s})));R.then(s=>m(this,[s],function*({data:a}){a.state==="completed"&&(this.createIntermediaryEvent(p.FarcasterLoginEventEmit.SuccessSignIn,h.id)({channel_token:l,message:a.message,signature:a.signature,fid:a.fid,username:a.username}),yield f,o==null||o.close())})).catch(a=>{console.error(a),o==null||o.close()});let y={on:(a,s)=>(a==="channel"&&m(this,null,function*(){let{data:u}=yield c;!O(s)||s(u)}),a===P.DONE&&m(this,null,function*(){let{data:u}=yield R;u.state==="completed"&&(!N(s)||s(u))}),a===P.ERROR&&R.catch(u=>{s(u)}),y)};return y}}}; | ||
"use strict";var s=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var v=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},m=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of f(e))!g.call(t,o)&&o!==n&&s(t,o,{get:()=>e[o],enumerable:!(r=d(e,o))||r.enumerable});return t};var A=t=>m(s({},"__esModule",{value:!0}),t);var b={};v(b,{FarcasterExtension:()=>c});module.exports=A(b);var h=require("@magic-sdk/commons"),i=require("@farcaster/auth-client");function C(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function I(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function R(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function L(){return I()||R()}function a(){return C()||L()}var P=!0;var c=class extends h.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.appClient=(0,i.createAppClient)({ethereum:(0,i.viemConnector)()});this.channel=null;this.login=n=>{var u;let r=(u=n==null?void 0:n.showUI)!=null?u:P,o=location.origin,p=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:r,domain:o,channel:this.channel,isMobile:a()}}]),l=this.request(p);if(a())if(this.channel)location.href=this.channel.url;else return l;return l};a()&&this.appClient.createChannel({siweUri:`${location.origin}/login`,domain:location.host}).then(({data:n})=>{this.channel=n})}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var I=Object.defineProperty;var C=Object.getOwnPropertySymbols;var w=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable;var E=(t,o,e)=>o in t?I(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,y=(t,o)=>{for(var e in o||(o={}))w.call(o,e)&&E(t,e,o[e]);if(C)for(var e of C(o))v.call(o,e)&&E(t,e,o[e]);return t};var f=(t,o,e)=>new Promise((d,a)=>{var u=r=>{try{i(e.next(r))}catch(l){a(l)}},h=r=>{try{i(e.throw(r))}catch(l){a(l)}},i=r=>r.done?d(r.value):Promise.resolve(r.value).then(u,h);i((e=e.apply(t,o)).next())});import{Extension as S,FarcasterLoginEventEmit as T}from"@magic-sdk/commons";import{createAppClient as _,viemConnector as x}from"@farcaster/auth-client";function P(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function k(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function L(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function U(){return k()||L()}function p(){return P()||U()}var b={CHANNEL:"channel",DONE:"done",ERROR:"error"},D=t=>typeof t=="function",H=t=>typeof t=="function",F="https://relay.farcaster.xyz",O="https://example.com/login",N=6e4,q=500,W=!0,A=class extends S.Internal{constructor(){super(...arguments);this.name="farcaster";this.config={};this.login=e=>{var R;let d=(R=e==null?void 0:e.showUI)!=null?R:W,a=null,u,h,i;p()&&(console.info("Info: showUI parameter is ignored on mobile, open URL directly"),a=window.open());let r=_({relay:F,ethereum:x()}),l=r.createChannel({siweUri:O,domain:window.location.host}),m=l.then(({data:n})=>(p()&&(a==null||a.location.assign(n.url)),i=n.channelToken,u=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:y({showUI:d},n)}]),h=this.request(u),r.watchStatus({channelToken:n.channelToken,timeout:N,interval:q}).then(s=>{if(s.isError)throw s.error;return s})));m.then(s=>f(this,[s],function*({data:n}){n.state==="completed"&&(this.createIntermediaryEvent(T.SuccessSignIn,u.id)({channel_token:i,message:n.message,signature:n.signature,fid:n.fid,username:n.username}),yield h,a==null||a.close())})).catch(n=>{console.error(n),a==null||a.close()});let g={on:(n,s)=>(n==="channel"&&f(this,null,function*(){let{data:c}=yield l;!D(s)||s(c)}),n===b.DONE&&f(this,null,function*(){let{data:c}=yield m;c.state==="completed"&&(!H(s)||s(c))}),n===b.ERROR&&m.catch(c=>{s(c)}),g)};return g}}};export{A as FarcasterExtension}; | ||
import{Extension as p}from"@magic-sdk/commons";import{createAppClient as d,viemConnector as f}from"@farcaster/auth-client";function c(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function l(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function u(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function h(){return l()||u()}function n(){return c()||h()}var g=!0;var r=class extends p.Internal{constructor(){super();this.name="farcaster";this.config={};this.appClient=d({ethereum:f()});this.channel=null;this.login=e=>{var o;let a=(o=e==null?void 0:e.showUI)!=null?o:g,i=location.origin,s=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:a,domain:i,channel:this.channel,isMobile:n()}}]),t=this.request(s);if(n())if(this.channel)location.href=this.channel.url;else return t;return t};n()&&this.appClient.createChannel({siweUri:`${location.origin}/login`,domain:location.host}).then(({data:e})=>{this.channel=e})}};export{r as FarcasterExtension}; | ||
//# sourceMappingURL=index.js.map |
import { Extension } from '@magic-sdk/commons'; | ||
import type { CreateChannelAPIResponse, AuthenticateAPIResponse, AuthClientError } from '@farcaster/auth-client'; | ||
type Handle = { | ||
on: Handler; | ||
}; | ||
type ChannelCallback = (params: CreateChannelAPIResponse) => void; | ||
type DoneCallback = (params: AuthenticateAPIResponse) => void; | ||
type ErrorCallback = (params: AuthClientError) => void; | ||
interface Handler { | ||
(event: 'channel', callback: ChannelCallback): Handle; | ||
(event: 'done', callback: DoneCallback): Handle; | ||
(event: 'error', callback: ErrorCallback): Handle; | ||
} | ||
type LoginParams = { | ||
showUI: boolean; | ||
}; | ||
declare const FarcasterLoginEventOnReceived: { | ||
readonly OpenChannel: "channel"; | ||
readonly Success: "success"; | ||
readonly Failed: "failed"; | ||
}; | ||
type FarcasterLoginEventHandlers = { | ||
[FarcasterLoginEventOnReceived.OpenChannel]: (channel: CreateChannelAPIResponse) => void; | ||
[FarcasterLoginEventOnReceived.Success]: (data: AuthenticateAPIResponse) => void; | ||
[FarcasterLoginEventOnReceived.Failed]: (error: AuthClientError) => void; | ||
}; | ||
export declare class FarcasterExtension extends Extension.Internal<'farcaster'> { | ||
name: "farcaster"; | ||
config: {}; | ||
login: (params?: LoginParams) => Handle; | ||
appClient: import("@farcaster/auth-client").AppClient; | ||
channel: CreateChannelAPIResponse | null; | ||
constructor(); | ||
login: (params?: LoginParams) => import("@magic-sdk/commons").PromiEvent<void, FarcasterLoginEventHandlers & { | ||
done: (result: void) => void; | ||
error: (reason: any) => void; | ||
settled: () => void; | ||
}>; | ||
} | ||
export {}; |
{ | ||
"name": "@magic-ext/farcaster", | ||
"version": "0.0.5-canary.754.9662877746.0", | ||
"version": "0.0.5-canary.754.9666852162.0", | ||
"description": "magic farcaster extension", | ||
@@ -42,3 +42,3 @@ "author": "Magic <team@magic.link> (https://magic.link/)", | ||
}, | ||
"gitHead": "bacb6ec88d0b443345fc35d5b2f5bb1e19224677" | ||
"gitHead": "2edddf723542a49dc20e9dd1b6e4e0094499dfaf" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
944710
4171