2
0

🚑 Add back runtimeOptions and fix popup width option

This commit is contained in:
Baptiste Arnaud
2023-12-22 10:24:33 +01:00
parent 1e5fa5a575
commit 867e68c4d9
8 changed files with 300 additions and 196 deletions

View File

@ -1335,78 +1335,109 @@
}
},
"input": {
"anyOf": [
"allOf": [
{
"oneOf": [
"anyOf": [
{
"$ref": "#/components/schemas/textInput"
"oneOf": [
{
"$ref": "#/components/schemas/textInput"
},
{
"$ref": "#/components/schemas/buttonsInput"
},
{
"$ref": "#/components/schemas/email"
},
{
"$ref": "#/components/schemas/numberInput"
},
{
"$ref": "#/components/schemas/url"
},
{
"$ref": "#/components/schemas/phoneNumberInput"
},
{
"$ref": "#/components/schemas/dateInput"
},
{
"$ref": "#/components/schemas/paymentInput"
},
{
"$ref": "#/components/schemas/rating"
},
{
"$ref": "#/components/schemas/fileInput"
},
{
"$ref": "#/components/schemas/pictureChoice"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"text input": "#/components/schemas/textInput",
"choice input": "#/components/schemas/buttonsInput",
"email input": "#/components/schemas/email",
"number input": "#/components/schemas/numberInput",
"url input": "#/components/schemas/url",
"phone number input": "#/components/schemas/phoneNumberInput",
"date input": "#/components/schemas/dateInput",
"payment input": "#/components/schemas/paymentInput",
"rating input": "#/components/schemas/rating",
"file input": "#/components/schemas/fileInput",
"picture choice input": "#/components/schemas/pictureChoice"
}
}
},
{
"$ref": "#/components/schemas/buttonsInput"
},
{
"$ref": "#/components/schemas/email"
},
{
"$ref": "#/components/schemas/numberInput"
},
{
"$ref": "#/components/schemas/url"
},
{
"$ref": "#/components/schemas/phoneNumberInput"
},
{
"$ref": "#/components/schemas/dateInput"
},
{
"$ref": "#/components/schemas/paymentInput"
},
{
"$ref": "#/components/schemas/rating"
},
{
"$ref": "#/components/schemas/fileInput"
},
{
"$ref": "#/components/schemas/pictureChoice"
"oneOf": [
{
"$ref": "#/components/schemas/buttonsInputV5"
},
{
"$ref": "#/components/schemas/fileInputV5"
},
{
"$ref": "#/components/schemas/pictureChoiceV5"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"choice input": "#/components/schemas/buttonsInputV5",
"file input": "#/components/schemas/fileInputV5",
"picture choice input": "#/components/schemas/pictureChoiceV5"
}
}
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"text input": "#/components/schemas/textInput",
"choice input": "#/components/schemas/buttonsInput",
"email input": "#/components/schemas/email",
"number input": "#/components/schemas/numberInput",
"url input": "#/components/schemas/url",
"phone number input": "#/components/schemas/phoneNumberInput",
"date input": "#/components/schemas/dateInput",
"payment input": "#/components/schemas/paymentInput",
"rating input": "#/components/schemas/rating",
"file input": "#/components/schemas/fileInput",
"picture choice input": "#/components/schemas/pictureChoice"
}
}
]
},
{
"oneOf": [
{
"$ref": "#/components/schemas/buttonsInputV5"
"type": "object",
"properties": {
"prefilledValue": {
"type": "string"
},
{
"$ref": "#/components/schemas/fileInputV5"
},
{
"$ref": "#/components/schemas/pictureChoiceV5"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"choice input": "#/components/schemas/buttonsInputV5",
"file input": "#/components/schemas/fileInputV5",
"picture choice input": "#/components/schemas/pictureChoiceV5"
"runtimeOptions": {
"type": "object",
"properties": {
"paymentIntentSecret": {
"type": "string"
},
"amountLabel": {
"type": "string"
},
"publicKey": {
"type": "string"
}
},
"required": [
"paymentIntentSecret",
"amountLabel",
"publicKey"
]
}
}
}
@ -1711,78 +1742,109 @@
}
},
"input": {
"anyOf": [
"allOf": [
{
"oneOf": [
"anyOf": [
{
"$ref": "#/components/schemas/textInput"
"oneOf": [
{
"$ref": "#/components/schemas/textInput"
},
{
"$ref": "#/components/schemas/buttonsInput"
},
{
"$ref": "#/components/schemas/email"
},
{
"$ref": "#/components/schemas/numberInput"
},
{
"$ref": "#/components/schemas/url"
},
{
"$ref": "#/components/schemas/phoneNumberInput"
},
{
"$ref": "#/components/schemas/dateInput"
},
{
"$ref": "#/components/schemas/paymentInput"
},
{
"$ref": "#/components/schemas/rating"
},
{
"$ref": "#/components/schemas/fileInput"
},
{
"$ref": "#/components/schemas/pictureChoice"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"text input": "#/components/schemas/textInput",
"choice input": "#/components/schemas/buttonsInput",
"email input": "#/components/schemas/email",
"number input": "#/components/schemas/numberInput",
"url input": "#/components/schemas/url",
"phone number input": "#/components/schemas/phoneNumberInput",
"date input": "#/components/schemas/dateInput",
"payment input": "#/components/schemas/paymentInput",
"rating input": "#/components/schemas/rating",
"file input": "#/components/schemas/fileInput",
"picture choice input": "#/components/schemas/pictureChoice"
}
}
},
{
"$ref": "#/components/schemas/buttonsInput"
},
{
"$ref": "#/components/schemas/email"
},
{
"$ref": "#/components/schemas/numberInput"
},
{
"$ref": "#/components/schemas/url"
},
{
"$ref": "#/components/schemas/phoneNumberInput"
},
{
"$ref": "#/components/schemas/dateInput"
},
{
"$ref": "#/components/schemas/paymentInput"
},
{
"$ref": "#/components/schemas/rating"
},
{
"$ref": "#/components/schemas/fileInput"
},
{
"$ref": "#/components/schemas/pictureChoice"
"oneOf": [
{
"$ref": "#/components/schemas/buttonsInputV5"
},
{
"$ref": "#/components/schemas/fileInputV5"
},
{
"$ref": "#/components/schemas/pictureChoiceV5"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"choice input": "#/components/schemas/buttonsInputV5",
"file input": "#/components/schemas/fileInputV5",
"picture choice input": "#/components/schemas/pictureChoiceV5"
}
}
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"text input": "#/components/schemas/textInput",
"choice input": "#/components/schemas/buttonsInput",
"email input": "#/components/schemas/email",
"number input": "#/components/schemas/numberInput",
"url input": "#/components/schemas/url",
"phone number input": "#/components/schemas/phoneNumberInput",
"date input": "#/components/schemas/dateInput",
"payment input": "#/components/schemas/paymentInput",
"rating input": "#/components/schemas/rating",
"file input": "#/components/schemas/fileInput",
"picture choice input": "#/components/schemas/pictureChoice"
}
}
]
},
{
"oneOf": [
{
"$ref": "#/components/schemas/buttonsInputV5"
"type": "object",
"properties": {
"prefilledValue": {
"type": "string"
},
{
"$ref": "#/components/schemas/fileInputV5"
},
{
"$ref": "#/components/schemas/pictureChoiceV5"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"choice input": "#/components/schemas/buttonsInputV5",
"file input": "#/components/schemas/fileInputV5",
"picture choice input": "#/components/schemas/pictureChoiceV5"
"runtimeOptions": {
"type": "object",
"properties": {
"paymentIntentSecret": {
"type": "string"
},
"amountLabel": {
"type": "string"
},
"publicKey": {
"type": "string"
}
},
"required": [
"paymentIntentSecret",
"amountLabel",
"publicKey"
]
}
}
}
@ -2175,78 +2237,109 @@
}
},
"input": {
"anyOf": [
"allOf": [
{
"oneOf": [
"anyOf": [
{
"$ref": "#/components/schemas/textInput"
"oneOf": [
{
"$ref": "#/components/schemas/textInput"
},
{
"$ref": "#/components/schemas/buttonsInput"
},
{
"$ref": "#/components/schemas/email"
},
{
"$ref": "#/components/schemas/numberInput"
},
{
"$ref": "#/components/schemas/url"
},
{
"$ref": "#/components/schemas/phoneNumberInput"
},
{
"$ref": "#/components/schemas/dateInput"
},
{
"$ref": "#/components/schemas/paymentInput"
},
{
"$ref": "#/components/schemas/rating"
},
{
"$ref": "#/components/schemas/fileInput"
},
{
"$ref": "#/components/schemas/pictureChoice"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"text input": "#/components/schemas/textInput",
"choice input": "#/components/schemas/buttonsInput",
"email input": "#/components/schemas/email",
"number input": "#/components/schemas/numberInput",
"url input": "#/components/schemas/url",
"phone number input": "#/components/schemas/phoneNumberInput",
"date input": "#/components/schemas/dateInput",
"payment input": "#/components/schemas/paymentInput",
"rating input": "#/components/schemas/rating",
"file input": "#/components/schemas/fileInput",
"picture choice input": "#/components/schemas/pictureChoice"
}
}
},
{
"$ref": "#/components/schemas/buttonsInput"
},
{
"$ref": "#/components/schemas/email"
},
{
"$ref": "#/components/schemas/numberInput"
},
{
"$ref": "#/components/schemas/url"
},
{
"$ref": "#/components/schemas/phoneNumberInput"
},
{
"$ref": "#/components/schemas/dateInput"
},
{
"$ref": "#/components/schemas/paymentInput"
},
{
"$ref": "#/components/schemas/rating"
},
{
"$ref": "#/components/schemas/fileInput"
},
{
"$ref": "#/components/schemas/pictureChoice"
"oneOf": [
{
"$ref": "#/components/schemas/buttonsInputV5"
},
{
"$ref": "#/components/schemas/fileInputV5"
},
{
"$ref": "#/components/schemas/pictureChoiceV5"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"choice input": "#/components/schemas/buttonsInputV5",
"file input": "#/components/schemas/fileInputV5",
"picture choice input": "#/components/schemas/pictureChoiceV5"
}
}
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"text input": "#/components/schemas/textInput",
"choice input": "#/components/schemas/buttonsInput",
"email input": "#/components/schemas/email",
"number input": "#/components/schemas/numberInput",
"url input": "#/components/schemas/url",
"phone number input": "#/components/schemas/phoneNumberInput",
"date input": "#/components/schemas/dateInput",
"payment input": "#/components/schemas/paymentInput",
"rating input": "#/components/schemas/rating",
"file input": "#/components/schemas/fileInput",
"picture choice input": "#/components/schemas/pictureChoice"
}
}
]
},
{
"oneOf": [
{
"$ref": "#/components/schemas/buttonsInputV5"
"type": "object",
"properties": {
"prefilledValue": {
"type": "string"
},
{
"$ref": "#/components/schemas/fileInputV5"
},
{
"$ref": "#/components/schemas/pictureChoiceV5"
}
],
"discriminator": {
"propertyName": "type",
"mapping": {
"choice input": "#/components/schemas/buttonsInputV5",
"file input": "#/components/schemas/fileInputV5",
"picture choice input": "#/components/schemas/pictureChoiceV5"
"runtimeOptions": {
"type": "object",
"properties": {
"paymentIntentSecret": {
"type": "string"
},
"amountLabel": {
"type": "string"
},
"publicKey": {
"type": "string"
}
},
"required": [
"paymentIntentSecret",
"amountLabel",
"publicKey"
]
}
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/js",
"version": "0.2.30",
"version": "0.2.31",
"description": "Javascript library to display typebots on your website",
"type": "module",
"main": "dist/index.js",

View File

@ -126,12 +126,13 @@ export const Popup = (props: PopupProps) => {
<div class="flex min-h-full items-center justify-center p-4 text-center sm:p-0">
<div
class={
'relative h-[80vh] transform overflow-hidden rounded-lg text-left transition-all sm:my-8 sm:w-full sm:max-w-lg' +
'relative h-[80vh] transform overflow-hidden rounded-lg text-left transition-all sm:my-8 w-full max-w-lg' +
(props.theme?.backgroundColor ? ' shadow-xl' : '')
}
style={{
'background-color':
props.theme?.backgroundColor ?? 'transparent',
'max-width': props.theme?.width ?? '512px',
}}
on:pointerdown={stopPropagation}
>

View File

@ -105,6 +105,7 @@ export async function startChatQuery({
isStreamEnabled: true,
prefilledVariables,
resultId,
isOnlyRegistering: false,
} satisfies Omit<StartChatInput, 'publicId'>,
timeout: false,
}

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/nextjs",
"version": "0.2.30",
"version": "0.2.31",
"description": "Convenient library to display typebots on your Next.js website",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -1,6 +1,6 @@
{
"name": "@typebot.io/react",
"version": "0.2.30",
"version": "0.2.31",
"description": "Convenient library to display typebots on your React app",
"main": "dist/index.js",
"types": "dist/index.d.ts",

View File

@ -11,6 +11,9 @@ export const Default = () => {
typebot={leadGenerationTypebot}
apiHost="http://localhost:3001"
autoShowDelay={3000}
theme={{
width: '800px',
}}
isPreview
/>
</>

View File

@ -290,6 +290,12 @@ const chatResponseBaseSchema = z.object({
pictureChoiceBlockSchemas.v5,
]),
])
.and(
z.object({
prefilledValue: z.string().optional(),
runtimeOptions: runtimeOptionsSchema.optional(),
})
)
.optional(),
clientSideActions: z
.array(clientSideActionSchema)