Socket
Socket
Sign inDemoInstall

@hoory/embed

Package Overview
Dependencies
Maintainers
5
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hoory/embed - npm Package Compare versions

Comparing version 1.0.72 to 1.0.73

2

index.cjs.js

@@ -1,1 +0,1 @@

var b=Object.create,d=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var f=t=>d(t,"__esModule",{value:!0});var R=(t,o)=>{for(var e in o)d(t,e,{get:o[e],enumerable:!0})},z=(t,o,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let a of E(o))!D.call(t,a)&&a!=="default"&&d(t,a,{get:()=>o[a],enumerable:!(e=L(o,a))||e.enumerable});return t},V=t=>z(f(d(t!=null?b(N(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);f(exports);R(exports,{ENV_URLS:()=>m,useHoory:()=>F});var n=V(require("react")),m={DEV:"https://embed-dev.hoory.cloud/embed.js",PROD:"https://embed.hoory.com/embed.js"};function F(t,o={}){let e=(0,n.useRef)(""),[a,S]=(0,n.useState)(!1),[H,B]=(0,n.useState)(!1),s=o.env||"PROD",i=(...r)=>s==="DEV"?console.info(...r):null,I=(0,n.useCallback)(async()=>{await window.hoory.show()},[]),g=(0,n.useCallback)(async()=>{await window.hoory.hide()},[]),p=(0,n.useCallback)(async()=>{await window.hoory.openChat()},[]),v=(0,n.useCallback)(async()=>{await window.hoory.closeChat()},[]),O=(0,n.useCallback)(async r=>{await window.hoory.setUserInfo(r)},[]),l=(0,n.useCallback)(()=>{typeof o.onChatOpen=="function"&&o.onChatOpen(),i("Hoory:: onChatOpen called")},[o?.onChatOpen]),w=(0,n.useCallback)(()=>{typeof o.onChatClose=="function"&&o.onChatClose(),i("Hoory:: onChatClose called")},[o?.onChatClose]),y=(0,n.useCallback)(()=>{typeof o.onShowButton=="function"&&o.onShowButton(),i("Hoory:: onShowButton called")},[o?.onShowButton]),C=(0,n.useCallback)(()=>{typeof o.onHideButton=="function"&&o.onHideButton(),i("Hoory:: onHideButton called")},[o?.onHideButton]),u=(0,n.useCallback)(()=>{typeof o.onChatInit=="function"&&o.onChatInit(),i("Hoory:: onChatInit called")},[o?.onChatInit]),h=(0,n.useCallback)(()=>{typeof o.onScriptLoad=="function"&&o.onScriptLoad(),i("Hoory:: onScriptLoad called")},[o?.onScriptLoad]);return(0,n.useEffect)(()=>{window.hoory=window.hoory||{...o.user||{}},window.hoory.workspace=t,window.hoory.initializeHidden=o.initializeHidden,window.hoory.chatFrameCustomStyles=o.chatFrameCustomStyles||{},window.hoory.forceChatInit=o.forceChatInit;let r=document.getElementsByTagName("script")[0],c=document.createElement("script");c.id="HooryScript",c.async=!0,c.src=`${m[s]}${e.current}`,r.parentNode.insertBefore(c,r),c.onload=()=>{window.hoory.onOpen(()=>{l()}),window.hoory.onClose(()=>{w()}),window.hoory.onShow(()=>{y()}),window.hoory.onHide(()=>{C()}),window.hoory.onChatInit(()=>{u(),B(!0)}),h(),S(!0),window.hoory.init()}},[s,h]),{isScriptLoaded:a,isChatInitialized:H,showButton:I,hideButton:g,openChat:p,closeChat:v,setUserInfo:O,onChatOpen:l,onChatClose:w,onShowButton:y,onHideButton:C,onChatInit:u,onScriptLoad:h}}
var N=Object.create,s=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var V=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var H=e=>s(e,"__esModule",{value:!0});var U=(e,o)=>{for(var i in o)s(e,i,{get:o[i],enumerable:!0})},j=(e,o,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let d of z(o))!F.call(e,d)&&d!=="default"&&s(e,d,{get:()=>o[d],enumerable:!(i=D(o,d))||i.enumerable});return e},k=e=>j(H(s(e!=null?N(V(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);H(exports);U(exports,{ENV_URLS:()=>S,useHoory:()=>x});var n=k(require("react")),S={DEV:"https://embed-dev.hoory.cloud/embed.js",PROD:"https://embed.hoory.com/embed.js"};function x(e,o={}){let i=(0,n.useRef)(""),[d,O]=(0,n.useState)(!1),[p,I]=(0,n.useState)(!1),c=o.env||"PROD",a=(...t)=>c==="DEV"?console.info(...t):null,v=(0,n.useCallback)(async()=>{await window.hoory.show()},[]),B=(0,n.useCallback)(async()=>{await window.hoory.hide()},[]),b=(0,n.useCallback)(async()=>{await window.hoory.openChat()},[]),P=(0,n.useCallback)(async()=>{await window.hoory.closeChat()},[]),L=(0,n.useCallback)(async()=>{await window.hoory.closeModalIframe()},[]),R=(0,n.useCallback)(async(t,r={},h=()=>{})=>{await window.hoory.openModalIframe(t,r,h)},[]),E=(0,n.useCallback)(async t=>{await window.hoory.setUserInfo(t)},[]),w=(0,n.useCallback)(()=>{typeof o.onChatOpen=="function"&&o.onChatOpen(),a("Hoory:: onChatOpen called")},[o?.onChatOpen]),y=(0,n.useCallback)(()=>{typeof o.onChatClose=="function"&&o.onChatClose(),a("Hoory:: onChatClose called")},[o?.onChatClose]),f=(0,n.useCallback)(()=>{typeof o.onShowButton=="function"&&o.onShowButton(),a("Hoory:: onShowButton called")},[o?.onShowButton]),C=(0,n.useCallback)(()=>{typeof o.onHideButton=="function"&&o.onHideButton(),a("Hoory:: onHideButton called")},[o?.onHideButton]),u=(0,n.useCallback)(()=>{typeof o.onChatInit=="function"&&o.onChatInit(),a("Hoory:: onChatInit called")},[o?.onChatInit]),l=(0,n.useCallback)(()=>{typeof o.onScriptLoad=="function"&&o.onScriptLoad(),a("Hoory:: onScriptLoad called")},[o?.onScriptLoad]),m=(0,n.useCallback)(()=>{typeof o.onPostMessage=="function"&&o.onPostMessage(),a("Hoory:: onPostMessage called")},[o?.onPostMessage]),g=(0,n.useCallback)(t=>{typeof o.onModalOpen=="function"&&o.onModalOpen(t),a("Hoory:: onModalOpen called")},[o?.onModalOpen]),M=(0,n.useCallback)(()=>{typeof o.onModalClose=="function"&&o.onModalClose(),a("Hoory:: onModalOpen called")},[o?.onModalClose]);return(0,n.useEffect)(()=>{window.hoory=window.hoory||{...o.user||{}},window.hoory.workspace=e,window.hoory.initializeHidden=o.initializeHidden,window.hoory.chatFrameCustomStyles=o.chatFrameCustomStyles||{},window.hoory.forceChatInit=o.forceChatInit;let t=document.getElementsByTagName("script")[0],r=document.createElement("script");r.id="HooryScript",r.async=!0,r.src=`${S[c]}${i.current}`,t.parentNode.insertBefore(r,t),r.onload=()=>{window.hoory.onOpen(()=>{w()}),window.hoory.onClose(()=>{y()}),window.hoory.onShow(()=>{f()}),window.hoory.onHide(()=>{C()}),window.hoory.onPostMessage(()=>{m()}),window.hoory.onModalClose(()=>{M()}),window.hoory.onModalOpen(h=>{g(h)}),window.hoory.onChatInit(()=>{u(),I(!0)}),l(),O(!0),window.hoory.init()}},[c,l]),{isScriptLoaded:d,isChatInitialized:p,openModal:R,closeModal:L,showButton:v,hideButton:B,openChat:b,closeChat:P,setUserInfo:E,onChatOpen:w,onChatClose:y,onShowButton:f,onHideButton:C,onChatInit:u,onScriptLoad:l,onPostMessage:m,onModalOpen:g,onModalClose:M}}

@@ -1,1 +0,1 @@

import{useCallback as n,useEffect as v,useRef as O,useState as w}from"react";var b={DEV:"https://embed-dev.hoory.cloud/embed.js",PROD:"https://embed.hoory.com/embed.js"};function E(y,o={}){let C=O(""),[u,f]=w(!1),[m,S]=w(!1),i=o.env||"PROD",t=(...e)=>i==="DEV"?console.info(...e):null,H=n(async()=>{await window.hoory.show()},[]),B=n(async()=>{await window.hoory.hide()},[]),I=n(async()=>{await window.hoory.openChat()},[]),g=n(async()=>{await window.hoory.closeChat()},[]),p=n(async e=>{await window.hoory.setUserInfo(e)},[]),c=n(()=>{typeof o.onChatOpen=="function"&&o.onChatOpen(),t("Hoory:: onChatOpen called")},[o?.onChatOpen]),d=n(()=>{typeof o.onChatClose=="function"&&o.onChatClose(),t("Hoory:: onChatClose called")},[o?.onChatClose]),s=n(()=>{typeof o.onShowButton=="function"&&o.onShowButton(),t("Hoory:: onShowButton called")},[o?.onShowButton]),h=n(()=>{typeof o.onHideButton=="function"&&o.onHideButton(),t("Hoory:: onHideButton called")},[o?.onHideButton]),l=n(()=>{typeof o.onChatInit=="function"&&o.onChatInit(),t("Hoory:: onChatInit called")},[o?.onChatInit]),r=n(()=>{typeof o.onScriptLoad=="function"&&o.onScriptLoad(),t("Hoory:: onScriptLoad called")},[o?.onScriptLoad]);return v(()=>{window.hoory=window.hoory||{...o.user||{}},window.hoory.workspace=y,window.hoory.initializeHidden=o.initializeHidden,window.hoory.chatFrameCustomStyles=o.chatFrameCustomStyles||{},window.hoory.forceChatInit=o.forceChatInit;let e=document.getElementsByTagName("script")[0],a=document.createElement("script");a.id="HooryScript",a.async=!0,a.src=`${b[i]}${C.current}`,e.parentNode.insertBefore(a,e),a.onload=()=>{window.hoory.onOpen(()=>{c()}),window.hoory.onClose(()=>{d()}),window.hoory.onShow(()=>{s()}),window.hoory.onHide(()=>{h()}),window.hoory.onChatInit(()=>{l(),S(!0)}),r(),f(!0),window.hoory.init()}},[i,r]),{isScriptLoaded:u,isChatInitialized:m,showButton:H,hideButton:B,openChat:I,closeChat:g,setUserInfo:p,onChatOpen:c,onChatClose:d,onShowButton:s,onHideButton:h,onChatInit:l,onScriptLoad:r}}export{b as ENV_URLS,E as useHoory};
import{useCallback as n,useEffect as R,useRef as E,useState as u}from"react";var N={DEV:"https://embed-dev.hoory.cloud/embed.js",PROD:"https://embed.hoory.com/embed.js"};function z(m,o={}){let g=E(""),[M,H]=u(!1),[S,O]=u(!1),i=o.env||"PROD",t=(...e)=>i==="DEV"?console.info(...e):null,p=n(async()=>{await window.hoory.show()},[]),I=n(async()=>{await window.hoory.hide()},[]),v=n(async()=>{await window.hoory.openChat()},[]),B=n(async()=>{await window.hoory.closeChat()},[]),b=n(async()=>{await window.hoory.closeModalIframe()},[]),P=n(async(e,a={},r=()=>{})=>{await window.hoory.openModalIframe(e,a,r)},[]),L=n(async e=>{await window.hoory.setUserInfo(e)},[]),s=n(()=>{typeof o.onChatOpen=="function"&&o.onChatOpen(),t("Hoory:: onChatOpen called")},[o?.onChatOpen]),c=n(()=>{typeof o.onChatClose=="function"&&o.onChatClose(),t("Hoory:: onChatClose called")},[o?.onChatClose]),l=n(()=>{typeof o.onShowButton=="function"&&o.onShowButton(),t("Hoory:: onShowButton called")},[o?.onShowButton]),h=n(()=>{typeof o.onHideButton=="function"&&o.onHideButton(),t("Hoory:: onHideButton called")},[o?.onHideButton]),w=n(()=>{typeof o.onChatInit=="function"&&o.onChatInit(),t("Hoory:: onChatInit called")},[o?.onChatInit]),d=n(()=>{typeof o.onScriptLoad=="function"&&o.onScriptLoad(),t("Hoory:: onScriptLoad called")},[o?.onScriptLoad]),y=n(()=>{typeof o.onPostMessage=="function"&&o.onPostMessage(),t("Hoory:: onPostMessage called")},[o?.onPostMessage]),f=n(e=>{typeof o.onModalOpen=="function"&&o.onModalOpen(e),t("Hoory:: onModalOpen called")},[o?.onModalOpen]),C=n(()=>{typeof o.onModalClose=="function"&&o.onModalClose(),t("Hoory:: onModalOpen called")},[o?.onModalClose]);return R(()=>{window.hoory=window.hoory||{...o.user||{}},window.hoory.workspace=m,window.hoory.initializeHidden=o.initializeHidden,window.hoory.chatFrameCustomStyles=o.chatFrameCustomStyles||{},window.hoory.forceChatInit=o.forceChatInit;let e=document.getElementsByTagName("script")[0],a=document.createElement("script");a.id="HooryScript",a.async=!0,a.src=`${N[i]}${g.current}`,e.parentNode.insertBefore(a,e),a.onload=()=>{window.hoory.onOpen(()=>{s()}),window.hoory.onClose(()=>{c()}),window.hoory.onShow(()=>{l()}),window.hoory.onHide(()=>{h()}),window.hoory.onPostMessage(()=>{y()}),window.hoory.onModalClose(()=>{C()}),window.hoory.onModalOpen(r=>{f(r)}),window.hoory.onChatInit(()=>{w(),O(!0)}),d(),H(!0),window.hoory.init()}},[i,d]),{isScriptLoaded:M,isChatInitialized:S,openModal:P,closeModal:b,showButton:p,hideButton:I,openChat:v,closeChat:B,setUserInfo:L,onChatOpen:s,onChatClose:c,onShowButton:l,onHideButton:h,onChatInit:w,onScriptLoad:d,onPostMessage:y,onModalOpen:f,onModalClose:C}}export{N as ENV_URLS,z as useHoory};

@@ -26,2 +26,5 @@ import { useCallback, useEffect, useRef, useState } from "react";

onScriptLoad?: () => void;
onPostMessage?: () => void;
onModalOpen?: (data: Record<string, any>) => void;
onModalClose?: () => void;
};

@@ -41,2 +44,3 @@

const env = options.env || "PROD";
// eslint-disable-next-line no-console
const log = (...params) => (env === "DEV" ? console.info(...params) : null);

@@ -56,2 +60,15 @@

}, []);
const closeModal = useCallback(async () => {
await window.hoory.closeModalIframe();
}, []);
const openModal = useCallback(
async (
address: string,
data: Record<string, any> = {},
cb: () => void = () => undefined
) => {
await window.hoory.openModalIframe(address, data, cb);
},
[]
);
const setUserInfo = useCallback(

@@ -93,2 +110,17 @@ async (user: {

}, [options?.onScriptLoad]);
const onPostMessage = useCallback(() => {
if (typeof options.onPostMessage === "function") options.onPostMessage();
log("Hoory:: onPostMessage called");
}, [options?.onPostMessage]);
const onModalOpen = useCallback(
(data) => {
if (typeof options.onModalOpen === "function") options.onModalOpen(data);
log("Hoory:: onModalOpen called");
},
[options?.onModalOpen]
);
const onModalClose = useCallback(() => {
if (typeof options.onModalClose === "function") options.onModalClose();
log("Hoory:: onModalOpen called");
}, [options?.onModalClose]);

@@ -121,2 +153,11 @@ useEffect(() => {

});
window.hoory.onPostMessage(() => {
onPostMessage();
});
window.hoory.onModalClose(() => {
onModalClose();
});
window.hoory.onModalOpen((data) => {
onModalOpen(data);
});
window.hoory.onChatInit(() => {

@@ -137,2 +178,4 @@ onChatInit();

// Functions
openModal,
closeModal,
showButton,

@@ -150,2 +193,5 @@ hideButton,

onScriptLoad,
onPostMessage,
onModalOpen,
onModalClose,
};

@@ -152,0 +198,0 @@ }

{
"name": "@hoory/embed",
"version": "1.0.72",
"version": "1.0.73",
"private": false,

@@ -10,4 +10,5 @@ "description": "Hoory script embedder",

"scripts": {
"prepack": "yarn build",
"build": "node ./build.react.js",
"publish-npm": "yarn build && npm version patch && npm publish --access=public"
"publish-npm": "npm version patch && npm publish --access=public"
},

@@ -14,0 +15,0 @@ "keywords": [],

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc