@activepieces/piece-forms 0.4.18 → 0.4.19

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activepieces/piece-forms",
3
- "version": "0.4.18",
3
+ "version": "0.4.19",
4
4
  "main": "./src/index.js",
5
5
  "dependencies": {},
6
6
  "files": [
package/src/index.js CHANGED
@@ -7,7 +7,7 @@ This trigger sets up a chat interface. Ensure that **Respond on UI** is used in
7
7
  Use this for production, views the published version of the chat flow.
8
8
  <br>
9
9
  <br>
10
- `,Lo=Tt({name:"chat_submission",displayName:"Chat UI",description:"Trigger the flow by sending a message",props:{about:H.MarkDown({value:Ls,variant:"BORDERLESS"}),responseMarkdown:H.MarkDown({value:Ms,variant:"WARNING"}),botName:H.ShortText({displayName:"Bot Name",description:"The name of the chatbot",required:!0,defaultValue:"AI Bot"})},sampleData:void 0,type:"WEBHOOK",async onEnable(){},async onDisable(){},async run(e){let t=e.payload.body;if(!t.chatId)throw new Error("Chat ID is required");if(!t.message)throw new Error("Message is required");let r=Object.entries(t).filter(([a])=>a.startsWith("file")).map(([a,l])=>[Number(a.split("[")[1].split("]")[0]),l]).sort(([a],[l])=>a-l).map(([a,l])=>l);return[{sessionId:t.chatId,message:t.message,files:r}]}});var js=`**Published Form URL:**
10
+ `,Lo=Tt({name:"chat_submission",displayName:"Chat UI",description:"Trigger the flow by sending a message",aiMetadata:{description:"Fires each time a person sends a message in the hosted chat interface generated by this trigger, carrying the message text, the chat session id that groups one conversation, and any attached files. Represents a single turn of a human conversation with the flow, so the session id is what ties multiple turns together. The sender waits for a reply, so the flow must call the Respond on UI action; submissions missing a chat id or message are rejected."},props:{about:H.MarkDown({value:Ls,variant:"BORDERLESS"}),responseMarkdown:H.MarkDown({value:Ms,variant:"WARNING"}),botName:H.ShortText({displayName:"Bot Name",description:"The name of the chatbot",required:!0,defaultValue:"AI Bot"})},sampleData:void 0,type:"WEBHOOK",async onEnable(){},async onDisable(){},async run(e){let t=e.payload.body;if(!t.chatId)throw new Error("Chat ID is required");if(!t.message)throw new Error("Message is required");let r=Object.entries(t).filter(([a])=>a.startsWith("file")).map(([a,l])=>[Number(a.split("[")[1].split("]")[0]),l]).sort(([a],[l])=>a-l).map(([a,l])=>l);return[{sessionId:t.chatId,message:t.message,files:r}]}});var js=`**Published Form URL:**
11
11
  \`\`\`text
12
12
  {{formUrl}}
13
13
  \`\`\`
@@ -21,7 +21,7 @@ Use this for production, views the published version of the form.
21
21
  Use this to generate sample data, views the draft version of the form (the one you are editing now).
22
22
  `,Fs=`
23
23
  If **Wait for Response** is enabled, use **Respond on UI** in your flow to provide a response back to the form.
24
- `,Zs=o((e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){let r=e.toLowerCase();if(r==="true"||r==="false")return r==="true"}throw new Error(`Field ${t} must be a boolean or 'true'/'false' string`)},"parseBoolean"),jo=Tt({name:"form_submission",displayName:"Web Form",description:"Trigger the flow by submitting a form.",props:{about:H.MarkDown({value:js,variant:"BORDERLESS"}),response:H.MarkDown({value:Fs,variant:"WARNING"}),waitForResponse:H.Checkbox({displayName:"Wait for Response",defaultValue:!1,required:!0}),inputs:H.Array({displayName:"Inputs",required:!0,properties:{displayName:H.ShortText({displayName:"Field Name",required:!0}),type:H.StaticDropdown({displayName:"Field Type",required:!0,options:{options:[{value:"text",label:"Text"},{value:"text_area",label:"Text Area"},{value:"file",label:"File"},{value:"toggle",label:"Toggle"}]}}),description:H.ShortText({displayName:"Field Description",required:!1}),required:H.Checkbox({displayName:"Required",required:!0})}})},sampleData:{},type:"WEBHOOK",async onEnable(){},async onDisable(){},async run(e){let t=e.payload.body,r=e.propsValue.inputs,i={};for(let a of r){let l=tr(a.displayName),d=t[l];switch(a.type){case"toggle":i[l]=Zs(d,a.displayName);break;case"text":case"text_area":case"file":i[l]=d;break}}return[i]}});var Qo=Ie(Wo()),ei=Ie(qo()),ti=Dn({audience:"both",name:"return_response",displayName:"Respond on UI",description:"Return a file or text (markdown) as a response.",props:{markdown:H.LongText({displayName:"Text (Markdown)",required:!1}),file:H.File({displayName:"Attachment",required:!1})},errorHandlingOptions:{retryOnFailure:{hide:!0},continueOnFailure:{hide:!0}},async run({propsValue:e,run:t,files:r}){let i=[];if(e.file){let l=e.file.filename,d=e.file.base64,f=ei.default.lookup(l);i.push({url:await r.write({fileName:l,data:Buffer.from(d,"base64")}),mimeType:f||""})}let a={type:"markdown",value:e.markdown??"",files:i};return t.respond({response:{status:Qo.StatusCodes.OK,body:a,headers:{}}}),a}});var ou=Do({displayName:"Human Input",description:"Trigger a flow through human input.",auth:lr.None(),minimumSupportedRelease:"0.65.0",categories:["CORE"],logoUrl:"https://cdn.activepieces.com/pieces/new-core/human-input.svg",authors:["anasbarg","MoShizzle","abuaboud"],actions:[ti],triggers:[jo,Lo]});0&&(module.exports={forms});
24
+ `,Zs=o((e,t)=>{if(typeof e=="boolean")return e;if(typeof e=="string"){let r=e.toLowerCase();if(r==="true"||r==="false")return r==="true"}throw new Error(`Field ${t} must be a boolean or 'true'/'false' string`)},"parseBoolean"),jo=Tt({name:"form_submission",displayName:"Web Form",description:"Trigger the flow by submitting a form.",aiMetadata:{description:'Fires once each time a person submits the hosted web form generated by this trigger, carrying the value of every field configured on it. Represents one-shot human input as a set of structured fields, unlike the sibling Chat UI trigger that fires per message in a multi-turn conversation. When "Wait for Response" is enabled the submitter is held waiting until the flow calls the Respond on UI action.'},props:{about:H.MarkDown({value:js,variant:"BORDERLESS"}),response:H.MarkDown({value:Fs,variant:"WARNING"}),waitForResponse:H.Checkbox({displayName:"Wait for Response",defaultValue:!1,required:!0}),inputs:H.Array({displayName:"Inputs",required:!0,properties:{displayName:H.ShortText({displayName:"Field Name",required:!0}),type:H.StaticDropdown({displayName:"Field Type",required:!0,options:{options:[{value:"text",label:"Text"},{value:"text_area",label:"Text Area"},{value:"file",label:"File"},{value:"toggle",label:"Toggle"}]}}),description:H.ShortText({displayName:"Field Description",required:!1}),required:H.Checkbox({displayName:"Required",required:!0})}})},sampleData:{},type:"WEBHOOK",async onEnable(){},async onDisable(){},async run(e){let t=e.payload.body,r=e.propsValue.inputs,i={};for(let a of r){let l=tr(a.displayName),d=t[l];switch(a.type){case"toggle":i[l]=Zs(d,a.displayName);break;case"text":case"text_area":case"file":i[l]=d;break}}return[i]}});var Qo=Ie(Wo()),ei=Ie(qo()),ti=Dn({audience:"both",name:"return_response",displayName:"Respond on UI",description:"Return a file or text (markdown) as a response.",aiMetadata:{description:'Sends markdown text and/or one file attachment back to the person waiting on the Web Form or Chat UI trigger that started the flow. Pick it as the replying step when that trigger has "Wait for Response" enabled; it produces nothing visible in flows started any other way. Not idempotent: each call emits a response to the waiting caller and stores a new file for any attachment.',idempotent:!1},props:{markdown:H.LongText({displayName:"Text (Markdown)",required:!1}),file:H.File({displayName:"Attachment",required:!1})},errorHandlingOptions:{retryOnFailure:{hide:!0},continueOnFailure:{hide:!0}},async run({propsValue:e,run:t,files:r}){let i=[];if(e.file){let l=e.file.filename,d=e.file.base64,f=ei.default.lookup(l);i.push({url:await r.write({fileName:l,data:Buffer.from(d,"base64")}),mimeType:f||""})}let a={type:"markdown",value:e.markdown??"",files:i};return t.respond({response:{status:Qo.StatusCodes.OK,body:a,headers:{}}}),a}});var ou=Do({displayName:"Human Input",description:"Trigger a flow through human input.",auth:lr.None(),minimumSupportedRelease:"0.65.0",categories:["CORE"],logoUrl:"https://cdn.activepieces.com/pieces/new-core/human-input.svg",authors:["anasbarg","MoShizzle","abuaboud"],actions:[ti],triggers:[jo,Lo]});0&&(module.exports={forms});
25
25
  /*! Bundled license information:
26
26
 
27
27
  mime-types/index.js: