@huddle01/iframe
Advanced tools
Comparing version 0.0.5 to 0.0.6
import HuddleIframe from './components/HuddleIframe'; | ||
export type THuddleEvents = 'lobby:joined' | 'lobby:failed' | 'room:joined' | 'room:failed' | 'room:new-peer' | 'room:peer-left' | 'room:recording-started' | 'room:recording-stopped' | 'room:livestream-started' | 'room:livestream-stopped'; | ||
import { TReaction } from './types'; | ||
export type THuddleEvents = 'lobby:initialized' | 'lobby:joined' | 'lobby:failed' | 'room:joined' | 'room:failed' | 'room:new-peer' | 'room:peer-left' | 'room:recording-started' | 'room:recording-stopped' | 'room:livestream-started' | 'room:livestream-stopped'; | ||
declare const iframeApi: { | ||
@@ -7,2 +8,3 @@ initialize: (eventData: { | ||
gradientAndMesh?: boolean | undefined; | ||
redirectUrlOnLeave?: string | undefined; | ||
wallets?: ("*" | "metamask" | "walletconnect" | "keplr" | "templewallet" | "lens" | "ud" | "cyberconnect" | "phantom")[] | undefined; | ||
@@ -16,4 +18,6 @@ }) => Promise<void>; | ||
disableShare: () => Promise<void>; | ||
changeAvatarUrl: (avatarUrl: string) => void; | ||
sendReaction: (reaction: TReaction) => void; | ||
}; | ||
declare const useEventListner: (huddleEvent: THuddleEvents, cb: (data?: any) => void) => void; | ||
export { HuddleIframe, iframeApi, useEventListner }; |
@@ -12,5 +12,8 @@ import { z } from 'zod'; | ||
}; | ||
export declare const reactions: readonly ["😂", "😢", "😦", "😍", "🤔", "👀", "🙌", "👍", "👎", "🔥", "🍻", "🚀", "🎉", "❤️", "💯"]; | ||
export type TReaction = (typeof reactions)[number]; | ||
export declare const ClientConfigSchema: z.ZodObject<{ | ||
background: z.ZodOptional<z.ZodString>; | ||
gradientAndMesh: z.ZodOptional<z.ZodBoolean>; | ||
redirectUrlOnLeave: z.ZodOptional<z.ZodString>; | ||
wallets: z.ZodOptional<z.ZodArray<z.ZodEnum<["*", "metamask", "walletconnect", "keplr", "templewallet", "lens", "ud", "cyberconnect", "phantom"]>, "many">>; | ||
@@ -20,2 +23,3 @@ }, "strip", z.ZodTypeAny, { | ||
gradientAndMesh?: boolean | undefined; | ||
redirectUrlOnLeave?: string | undefined; | ||
wallets?: ("*" | "metamask" | "walletconnect" | "keplr" | "templewallet" | "lens" | "ud" | "cyberconnect" | "phantom")[] | undefined; | ||
@@ -25,4 +29,5 @@ }, { | ||
gradientAndMesh?: boolean | undefined; | ||
redirectUrlOnLeave?: string | undefined; | ||
wallets?: ("*" | "metamask" | "walletconnect" | "keplr" | "templewallet" | "lens" | "ud" | "cyberconnect" | "phantom")[] | undefined; | ||
}>; | ||
export type TClientConfig = z.infer<typeof ClientConfigSchema>; |
@@ -6,3 +6,4 @@ 'use strict'; | ||
var React = require('react'); | ||
var zod = require('zod'); | ||
var types_dist_huddle01IframeTypes = require('../types/dist/huddle01-iframe-types.cjs.dev.js'); | ||
require('zod'); | ||
@@ -403,8 +404,2 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
var ClientConfigSchema = zod.z.object({ | ||
background: zod.z.string().optional(), | ||
gradientAndMesh: zod.z["boolean"]().optional(), | ||
wallets: zod.z.array(zod.z["enum"](['*', 'metamask', 'walletconnect', 'keplr', 'templewallet', 'lens', 'ud', 'cyberconnect', 'phantom'])).optional() | ||
}); | ||
var sendDataToIframe = function sendDataToIframe(eventData) { | ||
@@ -445,3 +440,3 @@ var huddleIframe = document.getElementById('huddle01-iframe'); | ||
console.log('initialize'); | ||
ClientConfigSchema.parse(eventData); | ||
types_dist_huddle01IframeTypes.ClientConfigSchema.parse(eventData); | ||
sendDataToIframe({ | ||
@@ -511,3 +506,17 @@ type: 'huddle01-iframe-from-parent', | ||
return disableShare; | ||
}() | ||
}(), | ||
changeAvatarUrl: function changeAvatarUrl(avatarUrl) { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'changeAvatarUrl', | ||
eventData: avatarUrl | ||
}); | ||
}, | ||
sendReaction: function sendReaction(reaction) { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'sendReaction', | ||
eventData: reaction | ||
}); | ||
} | ||
// on: (huddleEvent: THuddleEvents, cb: (data?: any) => void) => { | ||
@@ -514,0 +523,0 @@ // window.onmessage = (event: MessageEvent<any>) => { |
@@ -6,3 +6,4 @@ 'use strict'; | ||
var React = require('react'); | ||
var zod = require('zod'); | ||
var types_dist_huddle01IframeTypes = require('../types/dist/huddle01-iframe-types.cjs.prod.js'); | ||
require('zod'); | ||
@@ -403,8 +404,2 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; } | ||
var ClientConfigSchema = zod.z.object({ | ||
background: zod.z.string().optional(), | ||
gradientAndMesh: zod.z["boolean"]().optional(), | ||
wallets: zod.z.array(zod.z["enum"](['*', 'metamask', 'walletconnect', 'keplr', 'templewallet', 'lens', 'ud', 'cyberconnect', 'phantom'])).optional() | ||
}); | ||
var sendDataToIframe = function sendDataToIframe(eventData) { | ||
@@ -445,3 +440,3 @@ var huddleIframe = document.getElementById('huddle01-iframe'); | ||
console.log('initialize'); | ||
ClientConfigSchema.parse(eventData); | ||
types_dist_huddle01IframeTypes.ClientConfigSchema.parse(eventData); | ||
sendDataToIframe({ | ||
@@ -511,3 +506,17 @@ type: 'huddle01-iframe-from-parent', | ||
return disableShare; | ||
}() | ||
}(), | ||
changeAvatarUrl: function changeAvatarUrl(avatarUrl) { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'changeAvatarUrl', | ||
eventData: avatarUrl | ||
}); | ||
}, | ||
sendReaction: function sendReaction(reaction) { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'sendReaction', | ||
eventData: reaction | ||
}); | ||
} | ||
// on: (huddleEvent: THuddleEvents, cb: (data?: any) => void) => { | ||
@@ -514,0 +523,0 @@ // window.onmessage = (event: MessageEvent<any>) => { |
import React, { useEffect } from 'react'; | ||
import { z } from 'zod'; | ||
import { ClientConfigSchema } from '../types/dist/huddle01-iframe-types.esm.js'; | ||
import 'zod'; | ||
@@ -394,8 +395,2 @@ function _regeneratorRuntime() { | ||
var ClientConfigSchema = z.object({ | ||
background: z.string().optional(), | ||
gradientAndMesh: z["boolean"]().optional(), | ||
wallets: z.array(z["enum"](['*', 'metamask', 'walletconnect', 'keplr', 'templewallet', 'lens', 'ud', 'cyberconnect', 'phantom'])).optional() | ||
}); | ||
var sendDataToIframe = function sendDataToIframe(eventData) { | ||
@@ -501,3 +496,17 @@ var huddleIframe = document.getElementById('huddle01-iframe'); | ||
return disableShare; | ||
}() | ||
}(), | ||
changeAvatarUrl: function changeAvatarUrl(avatarUrl) { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'changeAvatarUrl', | ||
eventData: avatarUrl | ||
}); | ||
}, | ||
sendReaction: function sendReaction(reaction) { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'sendReaction', | ||
eventData: reaction | ||
}); | ||
} | ||
// on: (huddleEvent: THuddleEvents, cb: (data?: any) => void) => { | ||
@@ -504,0 +513,0 @@ // window.onmessage = (event: MessageEvent<any>) => { |
{ | ||
"name": "@huddle01/iframe", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -23,3 +23,7 @@ "main": "dist/huddle01-iframe.cjs.js", | ||
"react": "React" | ||
} | ||
}, | ||
"entrypoints": [ | ||
"index.ts", | ||
"types/index.ts" | ||
] | ||
}, | ||
@@ -26,0 +30,0 @@ "devDependencies": { |
import { useEffect } from 'react'; | ||
import HuddleIframe from './components/HuddleIframe'; | ||
import { ClientConfigSchema, TClientConfig } from './types'; | ||
import { ClientConfigSchema, TClientConfig, TReaction } from './types'; | ||
import { sendDataToIframe, zodErrHandler } from './utils'; | ||
export type THuddleEvents = | ||
| 'lobby:initialized' | ||
| 'lobby:joined' | ||
@@ -67,2 +68,16 @@ | 'lobby:failed' | ||
}, | ||
changeAvatarUrl: (avatarUrl: string) => { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'changeAvatarUrl', | ||
eventData: avatarUrl, | ||
}); | ||
}, | ||
sendReaction: (reaction: TReaction) => { | ||
sendDataToIframe({ | ||
type: 'huddle01-iframe-from-parent', | ||
method: 'sendReaction', | ||
eventData: reaction, | ||
}); | ||
}, | ||
// on: (huddleEvent: THuddleEvents, cb: (data?: any) => void) => { | ||
@@ -69,0 +84,0 @@ // window.onmessage = (event: MessageEvent<any>) => { |
@@ -15,5 +15,26 @@ import { z } from 'zod'; | ||
export const reactions = [ | ||
'😂', | ||
'😢', | ||
'😦', | ||
'😍', | ||
'🤔', | ||
'👀', | ||
'🙌', | ||
'👍', | ||
'👎', | ||
'🔥', | ||
'🍻', | ||
'🚀', | ||
'🎉', | ||
'❤️', | ||
'💯', | ||
] as const; | ||
export type TReaction = (typeof reactions)[number]; | ||
export const ClientConfigSchema = z.object({ | ||
background: z.string().optional(), | ||
gradientAndMesh: z.boolean().optional(), | ||
redirectUrlOnLeave: z.string().optional(), | ||
wallets: z | ||
@@ -20,0 +41,0 @@ .array( |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
361834
21
2145