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": { "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" "oneOf": [
}, {
{ "$ref": "#/components/schemas/buttonsInputV5"
"$ref": "#/components/schemas/email" },
}, {
{ "$ref": "#/components/schemas/fileInputV5"
"$ref": "#/components/schemas/numberInput" },
}, {
{ "$ref": "#/components/schemas/pictureChoiceV5"
"$ref": "#/components/schemas/url" }
}, ],
{ "discriminator": {
"$ref": "#/components/schemas/phoneNumberInput" "propertyName": "type",
}, "mapping": {
{ "choice input": "#/components/schemas/buttonsInputV5",
"$ref": "#/components/schemas/dateInput" "file input": "#/components/schemas/fileInputV5",
}, "picture choice input": "#/components/schemas/pictureChoiceV5"
{ }
"$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"
}
}
}, },
{ {
"oneOf": [ "type": "object",
{ "properties": {
"$ref": "#/components/schemas/buttonsInputV5" "prefilledValue": {
"type": "string"
}, },
{ "runtimeOptions": {
"$ref": "#/components/schemas/fileInputV5" "type": "object",
}, "properties": {
{ "paymentIntentSecret": {
"$ref": "#/components/schemas/pictureChoiceV5" "type": "string"
} },
], "amountLabel": {
"discriminator": { "type": "string"
"propertyName": "type", },
"mapping": { "publicKey": {
"choice input": "#/components/schemas/buttonsInputV5", "type": "string"
"file input": "#/components/schemas/fileInputV5", }
"picture choice input": "#/components/schemas/pictureChoiceV5" },
"required": [
"paymentIntentSecret",
"amountLabel",
"publicKey"
]
} }
} }
} }
@@ -1711,78 +1742,109 @@
} }
}, },
"input": { "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" "oneOf": [
}, {
{ "$ref": "#/components/schemas/buttonsInputV5"
"$ref": "#/components/schemas/email" },
}, {
{ "$ref": "#/components/schemas/fileInputV5"
"$ref": "#/components/schemas/numberInput" },
}, {
{ "$ref": "#/components/schemas/pictureChoiceV5"
"$ref": "#/components/schemas/url" }
}, ],
{ "discriminator": {
"$ref": "#/components/schemas/phoneNumberInput" "propertyName": "type",
}, "mapping": {
{ "choice input": "#/components/schemas/buttonsInputV5",
"$ref": "#/components/schemas/dateInput" "file input": "#/components/schemas/fileInputV5",
}, "picture choice input": "#/components/schemas/pictureChoiceV5"
{ }
"$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"
}
}
}, },
{ {
"oneOf": [ "type": "object",
{ "properties": {
"$ref": "#/components/schemas/buttonsInputV5" "prefilledValue": {
"type": "string"
}, },
{ "runtimeOptions": {
"$ref": "#/components/schemas/fileInputV5" "type": "object",
}, "properties": {
{ "paymentIntentSecret": {
"$ref": "#/components/schemas/pictureChoiceV5" "type": "string"
} },
], "amountLabel": {
"discriminator": { "type": "string"
"propertyName": "type", },
"mapping": { "publicKey": {
"choice input": "#/components/schemas/buttonsInputV5", "type": "string"
"file input": "#/components/schemas/fileInputV5", }
"picture choice input": "#/components/schemas/pictureChoiceV5" },
"required": [
"paymentIntentSecret",
"amountLabel",
"publicKey"
]
} }
} }
} }
@@ -2175,78 +2237,109 @@
} }
}, },
"input": { "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" "oneOf": [
}, {
{ "$ref": "#/components/schemas/buttonsInputV5"
"$ref": "#/components/schemas/email" },
}, {
{ "$ref": "#/components/schemas/fileInputV5"
"$ref": "#/components/schemas/numberInput" },
}, {
{ "$ref": "#/components/schemas/pictureChoiceV5"
"$ref": "#/components/schemas/url" }
}, ],
{ "discriminator": {
"$ref": "#/components/schemas/phoneNumberInput" "propertyName": "type",
}, "mapping": {
{ "choice input": "#/components/schemas/buttonsInputV5",
"$ref": "#/components/schemas/dateInput" "file input": "#/components/schemas/fileInputV5",
}, "picture choice input": "#/components/schemas/pictureChoiceV5"
{ }
"$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"
}
}
}, },
{ {
"oneOf": [ "type": "object",
{ "properties": {
"$ref": "#/components/schemas/buttonsInputV5" "prefilledValue": {
"type": "string"
}, },
{ "runtimeOptions": {
"$ref": "#/components/schemas/fileInputV5" "type": "object",
}, "properties": {
{ "paymentIntentSecret": {
"$ref": "#/components/schemas/pictureChoiceV5" "type": "string"
} },
], "amountLabel": {
"discriminator": { "type": "string"
"propertyName": "type", },
"mapping": { "publicKey": {
"choice input": "#/components/schemas/buttonsInputV5", "type": "string"
"file input": "#/components/schemas/fileInputV5", }
"picture choice input": "#/components/schemas/pictureChoiceV5" },
"required": [
"paymentIntentSecret",
"amountLabel",
"publicKey"
]
} }
} }
} }

View File

@@ -1,6 +1,6 @@
{ {
"name": "@typebot.io/js", "name": "@typebot.io/js",
"version": "0.2.30", "version": "0.2.31",
"description": "Javascript library to display typebots on your website", "description": "Javascript library to display typebots on your website",
"type": "module", "type": "module",
"main": "dist/index.js", "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="flex min-h-full items-center justify-center p-4 text-center sm:p-0">
<div <div
class={ 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' : '') (props.theme?.backgroundColor ? ' shadow-xl' : '')
} }
style={{ style={{
'background-color': 'background-color':
props.theme?.backgroundColor ?? 'transparent', props.theme?.backgroundColor ?? 'transparent',
'max-width': props.theme?.width ?? '512px',
}} }}
on:pointerdown={stopPropagation} on:pointerdown={stopPropagation}
> >

View File

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

View File

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

View File

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

View File

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

View File

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