@pickaxeproject/react 6.8.1 → 6.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("axios"));const r=process.env.NEXT_PUBLIC_API_URL;if(!r)throw new Error("[px/react] NEXT_PUBLIC_API_URL is not defined");const o=process.env.NEXT_PUBLIC_API2_URL;if(!o)throw new Error("[px/react] NEXT_PUBLIC_API2_URL is not defined");
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("axios"));const r=process.env.NEXT_PUBLIC_API_URL;if(!r)throw new Error("[px/react] NEXT_PUBLIC_API_URL is not defined");const o=process.env.NEXT_PUBLIC_API2_URL;if(!o)throw new Error("[px/react] NEXT_PUBLIC_API2_URL is not defined");t.default.create({baseURL:r});const s=t.default.create({baseURL:o});exports.api2=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),i=require("../../../common/error.js"),s=require("../../Core/Button.js"),n=require("../../Core/ErrorAlert.js"),r=require("../../../common/api/pickaxe.js"),c=require("../../../common/utils.js"),a=require("../Addons/Auth/hooks/useAuthContext.js"),l=require("../../../hooks/pickaxe/usePickaxeContext.js");exports.default=({serverId:u,toolkitSlug:d,name:m,resubmitPrompt:x})=>{const{pickaxe:p,sender:j,translations:b,colors:f}=l.usePickaxeContext(),{token:g}=a.useAuthContext(),h=o.useRef(null),[v,k]=o.useState(!0),[C,O]=o.useState(!1),[y,q]=o.useState(null),w=()=>{if(j)return j;if(h.current)return h.current;const e=c.initializeEmbedUserId();return h.current=e,e},_=()=>{const e={serverId:u,studioId:null==p?void 0:p.studioid};return g?Object.assign(Object.assign({},e),{studioSessionToken:g}):Object.assign(Object.assign({},e),{userId:w()})};return v?t.jsxs("div",Object.assign({className:"w-full bg-white border border-c-sep rounded-lg shadow-sm p-4 flex flex-col gap-4"},{children:[t.jsxs("div",Object.assign({className:"flex flex-col gap-1"},{children:[t.jsx("h3",Object.assign({className:"font-semibold text-black/80 text-lg"},{children:(null==b?void 0:b["authentication-required"])||"Authentication Required"})),t.jsxs("p",Object.assign({className:"text-black/60 text-sm"},{children:[(null==b?void 0:b["composio-auth-description-prefix"])||"The tool you are trying to use requires authentication with"," ",t.jsx("span",Object.assign({className:"font-semibold text-black/80"},{children:m||d})),"."]}))]})),y&&t.jsx(n.default,{error:y}),t.jsxs("div",Object.assign({className:"flex justify-end gap-2"},{children:[t.jsx(s.default,Object.assign({variant:"secondary",onClick:()=>k(!1),className:"text-sm px-3 h-9"},{children:(null==b?void 0:b.dismiss)||"Dismiss"})),t.jsx(s.default,Object.assign({variant:"primary",loadingText:(null==b?void 0:b.connecting)||"Connecting...",isLoading:C,style:{borderColor:f.accent,backgroundColor:f.accent,color:f.accentText},onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(C)return;const t=_();if("LOGGED OUT"!==t.userId)try{q(null),O(!0);const o=yield r.pickaxeApi2.post("/mcp/composio/connect",t),{connectLinkUrl:i,connected:s}=o.data;if(i&&window.open(i,"_blank","noopener,noreferrer"),!s){const t=yield e.__awaiter(void 0,void 0,void 0,(function*(){for(let e=0;e<180;e+=1){const e=yield r.pickaxeApi2.post("/mcp/composio/status",_()),{connected:t}=e.data;if(t)return!0;yield new Promise((e=>setTimeout(e,1e3)))}return!1}));if(!t)throw new Error((null==b?void 0:b["composio-auth-timeout"])||"Composio authentication timed out.")}k(!1),x()}catch(e){q(i.default(e))}finally{O(!1)}else q((null==b?void 0:b["must-be-logged-in-to-connect-composio"])||"You must be logged in to connect Composio MCPs.")})),className:"text-sm px-3 h-9 hover:opacity-90"},{children:(null==b?void 0:b.connect)||"Connect"}))]}))]})):null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"axios";const r=process.env.NEXT_PUBLIC_API_URL;if(!r)throw new Error("[px/react] NEXT_PUBLIC_API_URL is not defined");const o=process.env.NEXT_PUBLIC_API2_URL;if(!o)throw new Error("[px/react] NEXT_PUBLIC_API2_URL is not defined");
|
|
1
|
+
import e from"axios";const r=process.env.NEXT_PUBLIC_API_URL;if(!r)throw new Error("[px/react] NEXT_PUBLIC_API_URL is not defined");const o=process.env.NEXT_PUBLIC_API2_URL;if(!o)throw new Error("[px/react] NEXT_PUBLIC_API2_URL is not defined");e.create({baseURL:r});const t=e.create({baseURL:o});export{t as api2};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as n,useState as i}from"react";import s from"../../../common/error.js";import r from"../../Core/Button.js";import c from"../../Core/ErrorAlert.js";import{
|
|
1
|
+
import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as n,useState as i}from"react";import s from"../../../common/error.js";import r from"../../Core/Button.js";import c from"../../Core/ErrorAlert.js";import{pickaxeApi2 as l}from"../../../common/api/pickaxe.js";import{initializeEmbedUserId as a}from"../../../common/utils.js";import{useAuthContext as d}from"../Addons/Auth/hooks/useAuthContext.js";import{usePickaxeContext as u}from"../../../hooks/pickaxe/usePickaxeContext.js";const m=({serverId:m,toolkitSlug:p,name:f,resubmitPrompt:g})=>{const{pickaxe:h,sender:b,translations:x,colors:v}=u(),{token:j}=d(),k=n(null),[O,y]=i(!0),[C,w]=i(!1),[N,T]=i(null),A=()=>{if(b)return b;if(k.current)return k.current;const o=a();return k.current=o,o},I=()=>{const o={serverId:m,studioId:null==h?void 0:h.studioid};return j?Object.assign(Object.assign({},o),{studioSessionToken:j}):Object.assign(Object.assign({},o),{userId:A()})};return O?e("div",Object.assign({className:"w-full bg-white border border-c-sep rounded-lg shadow-sm p-4 flex flex-col gap-4"},{children:[e("div",Object.assign({className:"flex flex-col gap-1"},{children:[t("h3",Object.assign({className:"font-semibold text-black/80 text-lg"},{children:(null==x?void 0:x["authentication-required"])||"Authentication Required"})),e("p",Object.assign({className:"text-black/60 text-sm"},{children:[(null==x?void 0:x["composio-auth-description-prefix"])||"The tool you are trying to use requires authentication with"," ",t("span",Object.assign({className:"font-semibold text-black/80"},{children:f||p})),"."]}))]})),N&&t(c,{error:N}),e("div",Object.assign({className:"flex justify-end gap-2"},{children:[t(r,Object.assign({variant:"secondary",onClick:()=>y(!1),className:"text-sm px-3 h-9"},{children:(null==x?void 0:x.dismiss)||"Dismiss"})),t(r,Object.assign({variant:"primary",loadingText:(null==x?void 0:x.connecting)||"Connecting...",isLoading:C,style:{borderColor:v.accent,backgroundColor:v.accent,color:v.accentText},onClick:()=>o(void 0,void 0,void 0,(function*(){if(C)return;const e=I();if("LOGGED OUT"!==e.userId)try{T(null),w(!0);const t=yield l.post("/mcp/composio/connect",e),{connectLinkUrl:n,connected:i}=t.data;if(n&&window.open(n,"_blank","noopener,noreferrer"),!i){const e=yield o(void 0,void 0,void 0,(function*(){for(let o=0;o<180;o+=1){const o=yield l.post("/mcp/composio/status",I()),{connected:e}=o.data;if(e)return!0;yield new Promise((o=>setTimeout(o,1e3)))}return!1}));if(!e)throw new Error((null==x?void 0:x["composio-auth-timeout"])||"Composio authentication timed out.")}y(!1),g()}catch(o){T(s(o))}finally{w(!1)}else T((null==x?void 0:x["must-be-logged-in-to-connect-composio"])||"You must be logged in to connect Composio MCPs.")})),className:"text-sm px-3 h-9 hover:opacity-90"},{children:(null==x?void 0:x.connect)||"Connect"}))]}))]})):null};export{m as default};
|