2
0

🐛 (js) Improve session remember behavior

Make sure it correctly retrieves saved variables and doesn't clash with other embedded typebots
This commit is contained in:
Baptiste Arnaud
2023-03-02 10:55:03 +01:00
parent c172a44566
commit ba253cf3e9
16 changed files with 122 additions and 42 deletions

View File

@ -441,7 +441,6 @@
"hostAvatar": {
"isEnabled": true
},
"guestAvatar": { "isEnabled": false },
"hostBubbles": { "color": "#303235", "backgroundColor": "#F7F8FF" },
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" }
},
@ -451,7 +450,13 @@
}
},
"settings": {
"general": { "isBrandingEnabled": true },
"general": {
"isBrandingEnabled": true,
"isInputPrefillEnabled": true,
"isResultSavingEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true
},
"metadata": {
"description": "Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form."
},

View File

@ -467,7 +467,6 @@
"hostAvatar": {
"isEnabled": true
},
"guestAvatar": { "isEnabled": false },
"hostBubbles": { "color": "#303235", "backgroundColor": "#F7F8FF" },
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" }
},
@ -480,6 +479,7 @@
"general": {
"isBrandingEnabled": true,
"isInputPrefillEnabled": true,
"isResultSavingEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true
},

View File

@ -558,6 +558,7 @@
"general": {
"isBrandingEnabled": true,
"isInputPrefillEnabled": true,
"isResultSavingEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true
},

View File

@ -336,11 +336,11 @@
"placeholderColor": "#9095A0"
},
"buttons": { "color": "#FFFFFF", "backgroundColor": "#0042DA" },
"hostBubbles": { "color": "#303235", "backgroundColor": "#F7F8FF" },
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" },
"hostAvatar": {
"isEnabled": true
}
},
"hostBubbles": { "color": "#303235", "backgroundColor": "#F7F8FF" },
"guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" }
},
"general": {
"font": "Open Sans",
@ -348,7 +348,13 @@
}
},
"settings": {
"general": { "isBrandingEnabled": true },
"general": {
"isBrandingEnabled": true,
"isInputPrefillEnabled": true,
"isResultSavingEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true
},
"metadata": {
"description": "Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form."
},

View File

@ -790,6 +790,8 @@
"general": {
"isBrandingEnabled": true,
"isInputPrefillEnabled": true,
"isResultSavingEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true
},
"metadata": {

View File

@ -465,6 +465,8 @@
"general": {
"isBrandingEnabled": true,
"isInputPrefillEnabled": true,
"isResultSavingEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true
},
"metadata": {

View File

@ -959,6 +959,8 @@
"general": {
"isBrandingEnabled": true,
"isInputPrefillEnabled": true,
"isResultSavingEnabled": true,
"isHideQueryParamsEnabled": true,
"isNewResultOnRefreshEnabled": true
},
"metadata": {

View File

@ -89,7 +89,7 @@ test.describe('Builder', () => {
await page.click('text=Save in variables')
await page.click('text=Add an entry >> nth=-1')
await page.click('input[placeholder="Select the data"]')
await page.click('text=data.map(item => item.name)')
await page.click('text=data.flatMap(item => item.name)')
})
})

View File

@ -235,9 +235,12 @@ export const TypebotProvider = ({
)
useEffect(() => {
Router.events.on('routeChangeStart', () => saveTypebot())
const handleSaveTypebot = () => {
saveTypebot()
}
Router.events.on('routeChangeStart', handleSaveTypebot)
return () => {
Router.events.off('routeChangeStart', () => saveTypebot())
Router.events.off('routeChangeStart', handleSaveTypebot)
}
}, [saveTypebot])

View File

@ -88,7 +88,7 @@ export const GeneralSettingsForm = ({
: true
}
onCheckChange={handleNewResultOnRefreshChange}
moreInfoContent="If the user refreshes the page, its existing results will be overwritten. Disable this if you want to create a new results every time the user refreshes the page."
moreInfoContent="If the user refreshes the page or opens the typebot again during the same session, his previous variables will be prefilled and his new answers will override the previous ones."
/>
<SwitchWithLabel
label="Hide query params on bot start"