@magic-ext/farcaster
Advanced tools
Comparing version 0.18.0 to 0.18.1-canary.841.12038986507.0
@@ -1,2 +0,2 @@ | ||
"use strict";var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},A=(t,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of v(n))!w.call(t,r)&&r!==e&&d(t,r,{get:()=>n[r],enumerable:!(a=C(n,r))||a.enumerable});return t};var b=t=>A(d({},"__esModule",{value:!0}),t);var h=(t,n,e)=>new Promise((a,r)=>{var i=o=>{try{l(e.next(o))}catch(c){r(c)}},f=o=>{try{l(e.throw(o))}catch(c){r(c)}},l=o=>o.done?a(o.value):Promise.resolve(o.value).then(i,f);l((e=e.apply(t,n)).next())});var P={};m(P,{FarcasterExtension:()=>u,isMobile:()=>s});module.exports=b(P);var p=require("@magic-sdk/commons");function E(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function y(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function R(){return y()||x()}function s(){return E()||R()}function g(){return typeof window!="undefined"&&window===window.top}var I=!0;var O="https://relay.farcaster.xyz",u=class extends p.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=e=>{var i;if(!this.channel)throw new Error("Channel not created yet.");let a=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=e==null?void 0:e.showUI)!=null?i:I,domain:window.location.origin,isMobile:s(),channel:this.channel}}]),r=this.request(a);return s()&&g()&&(window.location.href=this.channel.url),r};h(this,null,function*(){this.channel=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>e.json())})}}; | ||
"use strict";var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var E=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},m=(r,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of v(n))!C.call(r,t)&&t!==e&&u(r,t,{get:()=>n[t],enumerable:!(o=w(n,t))||o.enumerable});return r};var b=r=>m(u({},"__esModule",{value:!0}),r);var p=(r,n,e)=>new Promise((o,t)=>{var c=a=>{try{i(e.next(a))}catch(d){t(d)}},l=a=>{try{i(e.throw(a))}catch(d){t(d)}},i=a=>a.done?o(a.value):Promise.resolve(a.value).then(c,l);i((e=e.apply(r,n)).next())});var S={};E(S,{FarcasterExtension:()=>g,isMobile:()=>s});module.exports=b(S);var f=require("@magic-sdk/commons");function A(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function y(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function R(){return y()||x()}function s(){return A()||R()}function h(){return typeof window!="undefined"&&window===window.top}var I=!0;var O="https://relay.farcaster.xyz",g=class extends f.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.login=e=>p(this,null,function*(){var i;let o=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!o.ok)throw new Error("Error creating channel.");let t=yield o.json();if(!t)throw new Error("Channel not created yet.");let c=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=e==null?void 0:e.showUI)!=null?i:I,domain:window.location.origin,isMobile:s(),channel:t}}]),l=this.request(c);return s()&&h()&&(window.location.href=t.url),l})}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var d=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var w=Object.prototype.hasOwnProperty;var m=(t,n)=>{for(var e in n)d(t,e,{get:n[e],enumerable:!0})},A=(t,n,e,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of v(n))!w.call(t,r)&&r!==e&&d(t,r,{get:()=>n[r],enumerable:!(a=C(n,r))||a.enumerable});return t};var b=t=>A(d({},"__esModule",{value:!0}),t);var h=(t,n,e)=>new Promise((a,r)=>{var i=o=>{try{l(e.next(o))}catch(c){r(c)}},f=o=>{try{l(e.throw(o))}catch(c){r(c)}},l=o=>o.done?a(o.value):Promise.resolve(o.value).then(i,f);l((e=e.apply(t,n)).next())});var P={};m(P,{FarcasterExtension:()=>u,isMobile:()=>s});module.exports=b(P);var p=require("@magic-sdk/commons");function E(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function y(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function R(){return y()||x()}function s(){return E()||R()}function g(){return typeof window!="undefined"&&window===window.top}var I=!0;var O="https://relay.farcaster.xyz",u=class extends p.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=e=>{var i;if(!this.channel)throw new Error("Channel not created yet.");let a=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=e==null?void 0:e.showUI)!=null?i:I,domain:window.location.origin,isMobile:s(),channel:this.channel}}]),r=this.request(a);return s()&&g()&&(window.location.href=this.channel.url),r};h(this,null,function*(){this.channel=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>e.json())})}}; | ||
"use strict";var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var E=(r,n)=>{for(var e in n)u(r,e,{get:n[e],enumerable:!0})},m=(r,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of v(n))!C.call(r,t)&&t!==e&&u(r,t,{get:()=>n[t],enumerable:!(o=w(n,t))||o.enumerable});return r};var b=r=>m(u({},"__esModule",{value:!0}),r);var p=(r,n,e)=>new Promise((o,t)=>{var c=a=>{try{i(e.next(a))}catch(d){t(d)}},l=a=>{try{i(e.throw(a))}catch(d){t(d)}},i=a=>a.done?o(a.value):Promise.resolve(a.value).then(c,l);i((e=e.apply(r,n)).next())});var S={};E(S,{FarcasterExtension:()=>g,isMobile:()=>s});module.exports=b(S);var f=require("@magic-sdk/commons");function A(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function y(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function x(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function R(){return y()||x()}function s(){return A()||R()}function h(){return typeof window!="undefined"&&window===window.top}var I=!0;var O="https://relay.farcaster.xyz",g=class extends f.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.login=e=>p(this,null,function*(){var i;let o=yield fetch(`${O}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!o.ok)throw new Error("Error creating channel.");let t=yield o.json();if(!t)throw new Error("Channel not created yet.");let c=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=e==null?void 0:e.showUI)!=null?i:I,domain:window.location.origin,isMobile:s(),channel:t}}]),l=this.request(c);return s()&&h()&&(window.location.href=t.url),l})}}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
var d=(l,c,e)=>new Promise((o,t)=>{var r=n=>{try{a(e.next(n))}catch(i){t(i)}},g=n=>{try{a(e.throw(n))}catch(i){t(i)}},a=n=>n.done?o(n.value):Promise.resolve(n.value).then(r,g);a((e=e.apply(l,c)).next())});import{Extension as w}from"@magic-sdk/commons";function p(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function f(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function C(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function v(){return f()||C()}function s(){return p()||v()}function u(){return typeof window!="undefined"&&window===window.top}var m=!0;var A="https://relay.farcaster.xyz",h=class extends w.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=e=>{var r;if(!this.channel)throw new Error("Channel not created yet.");let o=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(r=e==null?void 0:e.showUI)!=null?r:m,domain:window.location.origin,isMobile:s(),channel:this.channel}}]),t=this.request(o);return s()&&u()&&(window.location.href=this.channel.url),t};d(this,null,function*(){this.channel=yield fetch(`${A}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(e=>e.json())})}};export{h as FarcasterExtension,s as isMobile}; | ||
var u=(l,d,e)=>new Promise((o,t)=>{var a=n=>{try{r(e.next(n))}catch(s){t(s)}},i=n=>{try{r(e.throw(n))}catch(s){t(s)}},r=n=>n.done?o(n.value):Promise.resolve(n.value).then(a,i);r((e=e.apply(l,d)).next())});import{Extension as C}from"@magic-sdk/commons";function h(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function f(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function w(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function v(){return f()||w()}function c(){return h()||v()}function g(){return typeof window!="undefined"&&window===window.top}var E=!0;var m="https://relay.farcaster.xyz",p=class extends C.Internal{constructor(){super();this.name="farcaster";this.config={};this.login=e=>u(this,null,function*(){var r;let o=yield fetch(`${m}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!o.ok)throw new Error("Error creating channel.");let t=yield o.json();if(!t)throw new Error("Channel not created yet.");let a=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(r=e==null?void 0:e.showUI)!=null?r:E,domain:window.location.origin,isMobile:c(),channel:t}}]),i=this.request(a);return c()&&g()&&(window.location.href=t.url),i})}};export{p as FarcasterExtension,c as isMobile}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var MagicFarcasterExtension=(()=>{var m=Object.create;var s=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var E=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var y=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),R=(e,n)=>{for(var t in n)s(e,t,{get:n[t],enumerable:!0})},h=(e,n,t,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of b(n))!x.call(e,r)&&r!==t&&s(e,r,{get:()=>n[r],enumerable:!(a=A(n,r))||a.enumerable});return e};var I=(e,n,t)=>(t=e!=null?m(E(e)):{},h(n||!e||!e.__esModule?s(t,"default",{value:e,enumerable:!0}):t,e)),O=e=>h(s({},"__esModule",{value:!0}),e);var g=(e,n,t)=>new Promise((a,r)=>{var i=o=>{try{c(t.next(o))}catch(d){r(d)}},w=o=>{try{c(t.throw(o))}catch(d){r(d)}},c=o=>o.done?a(o.value):Promise.resolve(o.value).then(i,w);c((t=t.apply(e,n)).next())});var f=y((T,p)=>{p.exports=Magic});var H={};R(H,{FarcasterExtension:()=>u,isMobile:()=>l});var v=I(f());function P(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function S(){return typeof navigator!="undefined"&&/iPhone|iPod/.test(navigator.userAgent)}function F(){return typeof navigator!="undefined"&&(/iPad/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)}function L(){return S()||F()}function l(){return P()||L()}function C(){return typeof window!="undefined"&&window===window.top}var _=!0;var U="https://relay.farcaster.xyz",u=class extends v.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.channel=null;this.login=t=>{var i;if(!this.channel)throw new Error("Channel not created yet.");let a=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=t==null?void 0:t.showUI)!=null?i:_,domain:window.location.origin,isMobile:l(),channel:this.channel}}]),r=this.request(a);return l()&&C()&&(window.location.href=this.channel.url),r};g(this,null,function*(){this.channel=yield fetch(`${U}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})}).then(t=>t.json())})}};return O(H);})(); | ||
"use strict";var MagicFarcasterExtension=(()=>{var E=Object.create;var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty;var y=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),R=(e,n)=>{for(var t in n)s(e,t,{get:n[t],enumerable:!0})},p=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of b(n))!x.call(e,r)&&r!==t&&s(e,r,{get:()=>n[r],enumerable:!(o=m(n,r))||o.enumerable});return e};var I=(e,n,t)=>(t=e!=null?E(A(e)):{},p(n||!e||!e.__esModule?s(t,"default",{value:e,enumerable:!0}):t,e)),O=e=>p(s({},"__esModule",{value:!0}),e);var h=(e,n,t)=>new Promise((o,r)=>{var l=a=>{try{i(t.next(a))}catch(u){r(u)}},d=a=>{try{i(t.throw(a))}catch(u){r(u)}},i=a=>a.done?o(a.value):Promise.resolve(a.value).then(l,d);i((t=t.apply(e,n)).next())});var w=y((T,f)=>{f.exports=Magic});var H={};R(H,{FarcasterExtension:()=>g,isMobile:()=>c});var C=I(w());function S(){return typeof navigator!="undefined"&&/android/i.test(navigator.userAgent)}function F(){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 P(){return F()||L()}function c(){return S()||P()}function v(){return typeof window!="undefined"&&window===window.top}var _=!0;var U="https://relay.farcaster.xyz",g=class extends C.Extension.Internal{constructor(){super();this.name="farcaster";this.config={};this.login=t=>h(this,null,function*(){var i;let o=yield fetch(`${U}/v1/channel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:window.location.host,siweUri:window.location.origin})});if(!o.ok)throw new Error("Error creating channel.");let r=yield o.json();if(!r)throw new Error("Channel not created yet.");let l=this.utils.createJsonRpcRequestPayload("farcaster_show_QR",[{data:{showUI:(i=t==null?void 0:t.showUI)!=null?i:_,domain:window.location.origin,isMobile:c(),channel:r}}]),d=this.request(l);return c()&&v()&&(window.location.href=r.url),d})}};return O(H);})(); | ||
if (MagicFarcasterExtension && MagicFarcasterExtension.default != null) { MagicFarcasterExtension = Object.assign(MagicFarcasterExtension.default, MagicFarcasterExtension); delete MagicFarcasterExtension.default; } |
import { Extension } from '@magic-sdk/commons'; | ||
import { isMobile } from './utils'; | ||
declare type LoginParams = { | ||
type LoginParams = { | ||
showUI: boolean; | ||
}; | ||
declare const FarcasterLoginEventOnReceived: { | ||
readonly OpenChannel: "channel"; | ||
readonly Success: "success"; | ||
readonly Failed: "failed"; | ||
}; | ||
interface CreateChannelAPIResponse { | ||
channelToken: string; | ||
url: string; | ||
nonce: string; | ||
} | ||
declare type Hex = `0x${string}`; | ||
interface StatusAPIResponse { | ||
state: 'pending' | 'completed'; | ||
nonce: string; | ||
url: string; | ||
message?: string; | ||
signature?: `0x${string}`; | ||
fid?: number; | ||
username?: string; | ||
bio?: string; | ||
displayName?: string; | ||
pfpUrl?: string; | ||
verifications?: Hex[]; | ||
custody?: Hex; | ||
} | ||
declare type AuthClientErrorCode = 'unauthenticated' | 'unauthorized' | 'bad_request' | 'bad_request.validation_failure' | 'not_found' | 'not_implemented' | 'unavailable' | 'unknown'; | ||
interface AuthClientErrorOpts { | ||
message: string; | ||
cause: Error | AuthClientError; | ||
presentable: boolean; | ||
} | ||
declare class AuthClientError extends Error { | ||
readonly errCode: AuthClientErrorCode; | ||
readonly presentable: boolean; | ||
/** | ||
* @param errCode - the AuthClientError code for this message | ||
* @param context - a message, another Error, or a AuthClientErrorOpts | ||
*/ | ||
constructor(errCode: AuthClientErrorCode, context: Partial<AuthClientErrorOpts> | string | Error); | ||
} | ||
declare type FarcasterLoginEventHandlers = { | ||
[FarcasterLoginEventOnReceived.OpenChannel]: (channel: CreateChannelAPIResponse) => void; | ||
[FarcasterLoginEventOnReceived.Success]: (data: StatusAPIResponse) => void; | ||
[FarcasterLoginEventOnReceived.Failed]: (error: AuthClientError) => void; | ||
}; | ||
export declare class FarcasterExtension extends Extension.Internal<'farcaster'> { | ||
name: "farcaster"; | ||
config: {}; | ||
channel: CreateChannelAPIResponse | null; | ||
constructor(); | ||
login: (params?: LoginParams | undefined) => import("@magic-sdk/commons").PromiEvent<string, FarcasterLoginEventHandlers & { | ||
done: (result: string) => void; | ||
error: (reason: any) => void; | ||
settled: () => void; | ||
"closed-by-user": () => void; | ||
}>; | ||
login: (params?: LoginParams) => Promise<string>; | ||
} | ||
export { isMobile }; |
{ | ||
"name": "@magic-ext/farcaster", | ||
"version": "0.18.0", | ||
"version": "0.18.1-canary.841.12038986507.0", | ||
"description": "magic farcaster extension", | ||
@@ -31,5 +31,5 @@ "author": "Magic <team@magic.link> (https://magic.link/)", | ||
"devDependencies": { | ||
"@magic-sdk/commons": "^24.18.0" | ||
"@magic-sdk/commons": "24.18.1-canary.841.12038986507.0" | ||
}, | ||
"gitHead": "936a5bdf1a85c110d4d5eaa498fb52dc461bd139" | ||
"gitHead": "3ef5d0ade2763c536437d48c0ea44018826cef07" | ||
} |
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
37956
64