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.56 to 1.0.57

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,g]=(0,n.useState)(!1),s=o.env||"PROD",i=(...r)=>s==="DEV"?console.log(...r):null,B=(0,n.useCallback)(async()=>{await window.hoory.show()},[]),I=(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(),g(!0)}),h(),S(!0),window.hoory.init()}},[s,h]),{isScriptLoaded:a,isChatInitialized:H,showButton:B,hideButton:I,openChat:p,closeChat:v,setUserInfo:O,onChatOpen:l,onChatClose:w,onShowButton:y,onHideButton:C,onChatInit:u,onScriptLoad:h}}
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})},k=(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},z=t=>k(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:()=>V});var n=z(require("react")),m={DEV:"https://embed-dev.hoory.cloud/embed.js",PROD:"https://embed.hoory.com/embed.js"};function V(t,o={}){let e=(0,n.useRef)(""),[a,S]=(0,n.useState)(!1),[g,p]=(0,n.useState)(!1),s=o.env||"PROD",i=(...r)=>s==="DEV"?console.log(...r):null,H=(0,n.useCallback)(async()=>{await window.hoory.show()},[]),B=(0,n.useCallback)(async()=>{await window.hoory.hide()},[]),I=(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)},[]),w=(0,n.useCallback)(()=>{typeof o.onChatOpen=="function"&&o.onChatOpen(),i("Hoory:: onChatOpen called")},[o?.onChatOpen]),l=(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(()=>{w()}),window.hoory.onClose(()=>{l()}),window.hoory.onShow(()=>{y()}),window.hoory.onHide(()=>{C()}),window.hoory.onChatInit(()=>{u(),p(!0)}),h(),S(!0),console.log(!window?.hoory?.workspace,888888),window?.hoory?.workspace||(console.log(!window?.hoory?.workspace,88888899),window.hoory.init())}},[s,h]),{isScriptLoaded:a,isChatInitialized:g,showButton:H,hideButton:B,openChat:I,closeChat:v,setUserInfo:O,onChatOpen:w,onChatClose:l,onShowButton:y,onHideButton:C,onChatInit:u,onScriptLoad:h}}

@@ -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.log(...e):null,H=n(async()=>{await window.hoory.show()},[]),g=n(async()=>{await window.hoory.hide()},[]),B=n(async()=>{await window.hoory.openChat()},[]),I=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:g,openChat:B,closeChat:I,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 v,useRef as O,useState as l}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]=l(!1),[m,S]=l(!1),i=o.env||"PROD",t=(...e)=>i==="DEV"?console.log(...e):null,g=n(async()=>{await window.hoory.show()},[]),p=n(async()=>{await window.hoory.hide()},[]),H=n(async()=>{await window.hoory.openChat()},[]),B=n(async()=>{await window.hoory.closeChat()},[]),I=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]),w=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(()=>{w(),S(!0)}),r(),f(!0),console.log(!window?.hoory?.workspace,888888),window?.hoory?.workspace||(console.log(!window?.hoory?.workspace,88888899),window.hoory.init())}},[i,r]),{isScriptLoaded:u,isChatInitialized:m,showButton:g,hideButton:p,openChat:H,closeChat:B,setUserInfo:I,onChatOpen:c,onChatClose:d,onShowButton:s,onHideButton:h,onChatInit:w,onScriptLoad:r}}export{b as ENV_URLS,E as useHoory};

@@ -124,3 +124,7 @@ import { useCallback, useEffect, useRef, useState } from "react";

setIsScriptLoaded(true);
window.hoory.init();
console.log(!window?.hoory?.workspace, 888888);
if (!window?.hoory?.workspace) {
console.log(!window?.hoory?.workspace, 88888899);
window.hoory.init();
}
};

@@ -127,0 +131,0 @@ }, [env, onScriptLoad]);

{
"name": "@hoory/embed",
"version": "1.0.56",
"version": "1.0.57",
"private": false,

@@ -5,0 +5,0 @@ "description": "Hoory script embedder",

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