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.9-alpha to 2.0.10-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 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};
"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 s=e.createChatAdapter().withUrl(r);return o&&(s=s.withMode(o)),n&&(s=s.withContext(n)),a&&(s=s.withHeaders(a)),s.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:s}=e,[c,i]=t.useState(s);t.useEffect((()=>{if(s||!c)if(!s||c){if(s&&c){if(Object.keys(s).length!==Object.keys(c).length)return void i(s);for(const e in s)if(s[e]!==c[e])return void i(s)}}else i(s);else i(void 0)}),[s]);const u=o?.ref?t.useContext(o.ref):void 0,[d,f]=t.useState(r({url:n,mode:a,context:u,headers:s}));return t.useEffect((()=>{const e=r({url:n,mode:a,headers:c,context:u});f(e)}),[n,a,c,u]),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: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};
import{createChatAdapter as e}from"@nlux/nlbridge";export{createChatAdapter,createContextAdapter}from"@nlux/nlbridge";import{useState as t,useEffect as r,useContext as o}from"react";const n=t=>{const{url:r,mode:o,context:n,headers:i}=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 d=e().withUrl(r);return o&&(d=d.withMode(o)),n&&(d=d.withContext(n)),i&&(d=d.withHeaders(i)),d.create()},i=e=>{const{context:i,url:d,mode:c,headers:s}=e,[a,l]=t(s);r((()=>{if(s||!a)if(!s||a){if(s&&a){if(Object.keys(s).length!==Object.keys(a).length)return void l(s);for(const e in s)if(s[e]!==a[e])return void l(s)}}else l(s);else l(void 0)}),[s]);const f=i?.ref?o(i.ref):void 0,[h,u]=t(n({url:d,mode:c,context:f,headers:s}));return r((()=>{const e=n({url:d,mode:c,headers:a,context:f});u(e)}),[d,c,a,f]),h};export{i as useChatAdapter};
{
"name": "@nlux/nlbridge-react",
"version": "2.0.9-alpha",
"version": "2.0.10-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.9-alpha"
"@nlux/nlbridge": "2.0.10-alpha"
},
"peerDependencies": {
"@nlux/react": "2.0.9-alpha",
"@nlux/react": "2.0.10-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((()=>{const 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:i}=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)),i&&(d=d.withHeaders(i)),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:i,headers:d}=e,[a,c]=r.useState(d);r.useEffect((()=>{if(d||!a)if(!d||a){if(d&&a){if(Object.keys(d).length!==Object.keys(a).length)return void c(d);for(const e in d)if(d[e]!==a[e])return void c(d)}}else c(d);else c(void 0)}),[d]);const u=t?.ref?r.useContext(t.ref):void 0,[s,f]=r.useState(n({url:o,mode:i,context:u,headers:d}));return r.useEffect((()=>{const e=n({url:o,mode:i,headers:a,context:u});f(e)}),[o,i,a,u]),s}}));
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