Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nlux/nlbridge-react

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nlux/nlbridge-react - npm Package Compare versions

Comparing version 2.0.7-alpha to 2.0.8-alpha

2

cjs/nlbridge-react.js

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

"use strict";var e=require("@nlux/nlbridge"),t=require("react");const r=t=>{const{url:r,mode:o,context:n,headers:a}=t||{};if(o&&"copilot"!==o&&"chat"!==o)throw new Error("Data transfer mode not supported");if(!r)throw new Error("Runnable URL is required");let u=e.createChatAdapter().withUrl(r);return o&&(u=u.withMode(o)),n&&(u=u.withContext(n)),a&&(u=u.withHeaders(a)),u.create()};Object.defineProperty(exports,"createChatAdapter",{enumerable:!0,get:function(){return e.createChatAdapter}}),Object.defineProperty(exports,"createContextAdapter",{enumerable:!0,get:function(){return e.createContextAdapter}}),exports.useChatAdapter=e=>{const{context:o,url:n,mode:a,headers:u}=e,c=o?.ref?t.useContext(o.ref):void 0,[d,s]=t.useState(r({url:n,mode:a,context:c,headers:u}));return t.useEffect((()=>{let e=r({url:n,mode:a,context:c});s(e)}),[n,c,u]),d};
"use strict";var e=require("@nlux/nlbridge"),t=require("react");const r=t=>{const{url:r,mode:o,context:n,headers:a}=t||{};if(o&&"copilot"!==o&&"chat"!==o)throw new Error("Data transfer mode not supported");if(!r)throw new Error("Runnable URL is required");let c=e.createChatAdapter().withUrl(r);return o&&(c=c.withMode(o)),n&&(c=c.withContext(n)),a&&(c=c.withHeaders(a)),c.create()};Object.defineProperty(exports,"createChatAdapter",{enumerable:!0,get:function(){return e.createChatAdapter}}),Object.defineProperty(exports,"createContextAdapter",{enumerable:!0,get:function(){return e.createContextAdapter}}),exports.useChatAdapter=e=>{const{context:o,url:n,mode:a,headers:c}=e,u=o?.ref?t.useContext(o.ref):void 0,[d,s]=t.useState(r({url:n,mode:a,context:u,headers:c}));return t.useEffect((()=>{const e=r({url:n,mode:a,context:u});s(e)}),[n,u,c]),d};

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

import{createChatAdapter as e}from"@nlux/nlbridge";export{createChatAdapter,createContextAdapter}from"@nlux/nlbridge";import{useContext as r,useState as t,useEffect as o}from"react";const n=r=>{const{url:t,mode:o,context:n,headers:d}=r||{};if(o&&"copilot"!==o&&"chat"!==o)throw new Error("Data transfer mode not supported");if(!t)throw new Error("Runnable URL is required");let a=e().withUrl(t);return o&&(a=a.withMode(o)),n&&(a=a.withContext(n)),d&&(a=a.withHeaders(d)),a.create()},d=e=>{const{context:d,url:a,mode:i,headers:c}=e,l=d?.ref?r(d.ref):void 0,[h,u]=t(n({url:a,mode:i,context:l,headers:c}));return o((()=>{let e=n({url:a,mode:i,context:l});u(e)}),[a,l,c]),h};export{d as useChatAdapter};
import{createChatAdapter as e}from"@nlux/nlbridge";export{createChatAdapter,createContextAdapter}from"@nlux/nlbridge";import{useContext as r,useState as t,useEffect as o}from"react";const n=r=>{const{url:t,mode:o,context:n,headers:d}=r||{};if(o&&"copilot"!==o&&"chat"!==o)throw new Error("Data transfer mode not supported");if(!t)throw new Error("Runnable URL is required");let a=e().withUrl(t);return o&&(a=a.withMode(o)),n&&(a=a.withContext(n)),d&&(a=a.withHeaders(d)),a.create()},d=e=>{const{context:d,url:a,mode:c,headers:i}=e,l=d?.ref?r(d.ref):void 0,[h,s]=t(n({url:a,mode:c,context:l,headers:i}));return o((()=>{const e=n({url:a,mode:c,context:l});s(e)}),[a,l,i]),h};export{d as useChatAdapter};
{
"name": "@nlux/nlbridge-react",
"version": "2.0.7-alpha",
"version": "2.0.8-alpha",
"description": "The nlbridge adapters for nlux React, the React JS library for building conversational AI interfaces.",

@@ -62,6 +62,6 @@ "keywords": [

"dependencies": {
"@nlux/nlbridge": "2.0.7-alpha"
"@nlux/nlbridge": "2.0.8-alpha"
},
"peerDependencies": {
"@nlux/react": "2.0.7-alpha",
"@nlux/react": "2.0.8-alpha",
"react": "^18.2.0"

@@ -68,0 +68,0 @@ },

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@nlux/nlbridge"),require("react")):"function"==typeof define&&define.amd?define(["exports","@nlux/nlbridge","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@nlux/nlbridge-react"]={},e.nlbridge,e.react)}(this,(function(e,t,r){"use strict";const n=e=>{const{url:r,mode:n,context:o,headers:a}=e||{};if(n&&"copilot"!==n&&"chat"!==n)throw new Error("Data transfer mode not supported");if(!r)throw new Error("Runnable URL is required");let d=t.createChatAdapter().withUrl(r);return n&&(d=d.withMode(n)),o&&(d=d.withContext(o)),a&&(d=d.withHeaders(a)),d.create()};Object.defineProperty(e,"createChatAdapter",{enumerable:!0,get:function(){return t.createChatAdapter}}),Object.defineProperty(e,"createContextAdapter",{enumerable:!0,get:function(){return t.createContextAdapter}}),e.useChatAdapter=e=>{const{context:t,url:o,mode:a,headers:d}=e,i=t?.ref?r.useContext(t.ref):void 0,[u,c]=r.useState(n({url:o,mode:a,context:i,headers:d}));return r.useEffect((()=>{let e=n({url:o,mode:a,context:i});c(e)}),[o,i,d]),u}}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@nlux/nlbridge"),require("react")):"function"==typeof define&&define.amd?define(["exports","@nlux/nlbridge","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["@nlux/nlbridge-react"]={},e.nlbridge,e.react)}(this,(function(e,t,r){"use strict";const n=e=>{const{url:r,mode:n,context:o,headers:a}=e||{};if(n&&"copilot"!==n&&"chat"!==n)throw new Error("Data transfer mode not supported");if(!r)throw new Error("Runnable URL is required");let d=t.createChatAdapter().withUrl(r);return n&&(d=d.withMode(n)),o&&(d=d.withContext(o)),a&&(d=d.withHeaders(a)),d.create()};Object.defineProperty(e,"createChatAdapter",{enumerable:!0,get:function(){return t.createChatAdapter}}),Object.defineProperty(e,"createContextAdapter",{enumerable:!0,get:function(){return t.createContextAdapter}}),e.useChatAdapter=e=>{const{context:t,url:o,mode:a,headers:d}=e,i=t?.ref?r.useContext(t.ref):void 0,[u,c]=r.useState(n({url:o,mode:a,context:i,headers:d}));return r.useEffect((()=>{const e=n({url:o,mode:a,context:i});c(e)}),[o,i,d]),u}}));
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