Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web SDK Release 1.11.5 #294

Merged
merged 22 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3585206
feat: passing personalisation to overlay
kkyusuftk Sep 23, 2024
5afed6a
renoved unnecessary changes
kkyusuftk Sep 23, 2024
818e620
Merge branch 'master' of github.com:CleverTap/clevertap-web-sdk into …
kkyusuftk Sep 26, 2024
a66eb1b
fix: removed isshopify as an argument
kkyusuftk Sep 26, 2024
f991fcf
added changes for preview
AshwinSaxena01 Oct 8, 2024
90fbe99
Merge remote-tracking branch 'origin/visual-editor-payload' into WEB-…
AshwinSaxena01 Oct 10, 2024
e0a86dc
added preview flag
AshwinSaxena01 Oct 10, 2024
5b6be2c
updated text render key for delivery
AshwinSaxena01 Oct 10, 2024
ef3f2d0
Updated build files
KambleSonam Oct 10, 2024
41a9a90
Merge branch 'develop' into WEB-3204
AshwinSaxena01 Oct 18, 2024
99cce0c
updated build files
AshwinSaxena01 Oct 18, 2024
126edb8
Merge branch 'WEB-3204' of https://github.com/CleverTap/clevertap-web…
AshwinSaxena01 Oct 18, 2024
dc0b344
Merge branch 'develop' of https://github.com/CleverTap/clevertap-web-…
AshwinSaxena01 Oct 22, 2024
b1ba9f4
updated build files
AshwinSaxena01 Oct 22, 2024
e8f8d43
Merge branch 'master' of https://github.com/CleverTap/clevertap-web-s…
AshwinSaxena01 Oct 22, 2024
59b1d9c
staging overlay path
AshwinSaxena01 Oct 22, 2024
77a4f2c
added overlay production
AshwinSaxena01 Oct 24, 2024
9f6cfb2
removed console
AshwinSaxena01 Oct 24, 2024
e75c042
merging with develop
kkyusuftk Oct 24, 2024
f20841b
updated version and changelog
kkyusuftk Oct 30, 2024
ef315f3
Update CHANGELOG.md
kkyusuftk Oct 30, 2024
dcae8a1
Merge pull request #267 from CleverTap/WEB-3204
kkyusuftk Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.

## [1.11.5] 30th Oct, 2024
- Added support for personalisation in visual editor

## [1.11.4] 24th Oct, 2024
- Fix for gender values. Have removed frontend validation

Expand Down
29 changes: 17 additions & 12 deletions clevertap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clevertap.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clevertap.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clevertap-web-sdk",
"version": "1.11.4",
"version": "1.11.5",
"description": "",
"main": "clevertap.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/visualBuilder/dataUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const updateFormData = (element, formStyle, payload, isPreview = false) =

// Update element text
if (formStyle.text !== undefined) {
element.innerText = formStyle.text
element.innerText = isPreview ? formStyle.text.text : formStyle.text
}

// Handle element onClick
Expand Down
25 changes: 17 additions & 8 deletions src/modules/visualBuilder/pageBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ const handleMessageEvent = (event) => {
return
}
if (event.data.message === 'Dashboard') {
initialiseCTBuilder(event.data.url, event.data.variant ?? null, event.data.details ?? {})
// handle personalisation
window.evtMaster = event.data.personalisation.evtMaster
initialiseCTBuilder(
event.data.url,
event.data.variant ?? null,
event.data.details ?? {},
event.data.personalisation
)
} else if (event.data.message === 'Overlay') {
renderVisualBuilder(event.data, true)
}
Expand All @@ -56,14 +63,15 @@ const handleMessageEvent = (event) => {
* @param {string} url - The URL to initialize the builder.
* @param {string} variant - The variant of the builder.
* @param {Object} details - The details object.
* @param {Object} personalisation - The personalisation object
*/
const initialiseCTBuilder = (url, variant, details) => {
const initialiseCTBuilder = (url, variant, details, personalisation) => {
if (document.readyState === 'complete') {
onContentLoad(url, variant, details)
onContentLoad(url, variant, details, personalisation)
} else {
document.addEventListener('readystatechange', () => {
if (document.readyState === 'complete') {
onContentLoad(url, variant, details)
onContentLoad(url, variant, details, personalisation)
}
})
}
Expand All @@ -75,7 +83,7 @@ let isShopify = false
/**
* Handles content load for Clevertap builder.
*/
function onContentLoad (url, variant, details) {
function onContentLoad (url, variant, details, personalisation) {
if (!contentLoaded) {
if (window.Shopify) {
isShopify = true
Expand All @@ -89,7 +97,7 @@ function onContentLoad (url, variant, details) {
container.style.display = 'flex'
document.body.appendChild(container)
const overlayPath = OVERLAY_PATH
loadOverlayScript(overlayPath, url, variant, details)
loadOverlayScript(overlayPath, url, variant, details, personalisation)
.then(() => {
console.log('Overlay script loaded successfully.')
contentLoaded = true
Expand Down Expand Up @@ -118,16 +126,17 @@ function loadCSS () {
* @param {string} url - The URL.
* @param {string} variant - The variant.
* @param {Object} details - The details object.
* @param {Object} personalisation
* @returns {Promise} A promise.
*/
function loadOverlayScript (overlayPath, url, variant, details) {
function loadOverlayScript (overlayPath, url, variant, details, personalisation) {
return new Promise((resolve, reject) => {
var script = document.createElement('script')
script.type = 'module'
script.src = overlayPath
script.onload = function () {
if (typeof window.Overlay === 'function') {
window.Overlay({ id: '#overlayDiv', url, variant, details, isShopify })
window.Overlay({ id: '#overlayDiv', url, variant, details, isShopify, personalisation })
resolve()
} else {
reject(new Error('ContentLayout not found in overlay.js'))
Expand Down
Loading