Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
5b14913
fix: multiple reloads in timeline
contentstackMridul Jul 11, 2025
94c2c63
Merge branch 'main' of github.com:contentstack/live-preview-sdk into …
contentstackMridul Jul 11, 2025
e335877
chore: test fix from merge operation
contentstackMridul Jul 11, 2025
e781891
test: added test cases for addLivePreviewQueryTags and addParamsToUrl
contentstackMridul Aug 5, 2025
bab5a47
chore: fieldlocation fetch completed
SahilCs15 Jun 29, 2025
0c49039
chore: rendered the fieldmodifier apps added an event listner to send…
SahilCs15 Jun 30, 2025
6337a6d
chore: added test cases for the field location data
SahilCs15 Jul 1, 2025
d0dae47
fix: undo unneccsary changes
SahilCs15 Jul 1, 2025
3987e1c
fix: resolved the issues
SahilCs15 Jul 3, 2025
bd5095a
redner the app on dom
SahilCs15 Jul 9, 2025
2cb9824
fix: disable scroll when field modifer is active
SahilCs15 Jul 9, 2025
a0803ad
fix:removed uncessary changes
SahilCs15 Jul 11, 2025
27ec2f3
fix: addresed the requested cahnges
SahilCs15 Jul 14, 2025
17423d5
fix: fixed conficts
SahilCs15 Jul 16, 2025
53c6e77
fix: fixed the required changes
SahilCs15 Jul 16, 2025
6837e62
fix: removed not requied changes
SahilCs15 Jul 16, 2025
b7bba12
fix: modified the way we were handling fieldlocation data fetch (#462)
SahilCs15 Jul 18, 2025
2205887
Merge pull request #467 from contentstack/VE-7005-hover-toolbar-click…
csAyushDubey Jul 22, 2025
46ee07b
fix: removed edit icon when the click is on the container (#478)
SahilCs15 Aug 4, 2025
8122192
chore(VE-6918/error-text): warning message improved
csAdityaPachauri Jul 15, 2025
dc3901f
chore(VE-6918/error-text): component name changed to title case
csAdityaPachauri Jul 23, 2025
ed1c0bb
chore(VE-6918/error-text): unit test file added
csAdityaPachauri Jul 25, 2025
f253c9d
Merge pull request #481 from contentstack/VE-5474-clean
faraazb Aug 6, 2025
e6e68c9
Merge pull request #482 from contentstack/hover-toolbar-clickability
faraazb Aug 6, 2025
7376bdc
Merge pull request #485 from contentstack/sync-7130
faraazb Aug 6, 2025
a66343e
Merge pull request #487 from contentstack/VE-6918/error-text-main-che…
faraazb Aug 6, 2025
7695da3
Merge pull request #484 from contentstack/VE_6673
faraazb Aug 6, 2025
8ee321a
3.4.0
faraazb-contentstack Aug 6, 2025
d470fcb
chore: skip tests
faraazb-contentstack Aug 6, 2025
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
2 changes: 1 addition & 1 deletion .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fileignoreconfig:
- filename: README.md
checksum: 568289bbe7c088967493db246dbf29e465382648ac574c1b1236be57d5662a38
- filename: CHANGELOG.md
checksum: ed794e2f5c5884f74af12e5f5bfbb117c08ba454104f929df3deb7627407317a
checksum: 8e2495db48ed58704b0883b052c5d44b9f1a96cff7556235f924d16a47442688
- filename: src/visualBuilder/components/__test__/fieldToolbar.test.tsx
checksum: 3badd6a142456b6a361569e6fc546349a38ac6b366bef7fd5255d1e93220444e
- filename: src/visualBuilder/components/Collab/ThreadPopup/__test__/CommentTextArea.test.tsx
Expand Down
57 changes: 54 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,51 @@
# Changelog

## [v3.4.0](https://github.com/contentstack/live-preview-sdk/compare/v3.3.0...v3.4.0)

> 6 August 2025

### Fixes

- fix: multiple reloads in timeline (Mridul Sharma - [#484](https://github.com/contentstack/live-preview-sdk/pull/484))
- fix: removed edit icon when the click is on the container (#478) (Sahil Chalke - [#485](https://github.com/contentstack/live-preview-sdk/pull/485))
- Fix: Issue with hover toolbar click-ability (Ayush Dubey - [#467](https://github.com/contentstack/live-preview-sdk/pull/467))
- fix: modified the way we were handling fieldlocation data fetch (Sahil Chalke - [#462](https://github.com/contentstack/live-preview-sdk/pull/462))

### General Changes

- VE-6918 (Aditya Pachauri - [#487](https://github.com/contentstack/live-preview-sdk/pull/487))
- Hover Toolbar Click-ability Missed Commit (Ayush Dubey - [#482](https://github.com/contentstack/live-preview-sdk/pull/482))
- Ve 5474 clean (Sahil Chalke - [#481](https://github.com/contentstack/live-preview-sdk/pull/481))

### Fixes

- fix: fixed the required changes (SahilCs15 - [53c6e77](https://github.com/contentstack/live-preview-sdk/commit/53c6e77c2d49718c748895d3bdecb7676461fe8d))
- fix: resolved the issues (SahilCs15 - [3987e1c](https://github.com/contentstack/live-preview-sdk/commit/3987e1c92daf17658c0b814e52f2ce8950334d5b))
- fix: undo unneccsary changes (SahilCs15 - [d0dae47](https://github.com/contentstack/live-preview-sdk/commit/d0dae47dda1bc41fde6ff6205bcee9b046ac2c09))
- fix: fixed conficts (SahilCs15 - [17423d5](https://github.com/contentstack/live-preview-sdk/commit/17423d5e34094d91c0840a49dbee913be3b4bc37))
- fix: removed not requied changes (SahilCs15 - [6837e62](https://github.com/contentstack/live-preview-sdk/commit/6837e62f73fbb6cc46adf6d4454157181d428043))
- fix: disable scroll when field modifer is active (SahilCs15 - [2cb9824](https://github.com/contentstack/live-preview-sdk/commit/2cb9824dde552548a66d5a1ae79f1b98b089a535))
- fix: addresed the requested cahnges (SahilCs15 - [27ec2f3](https://github.com/contentstack/live-preview-sdk/commit/27ec2f3442f1fdc1b327e77fda1b8cb1b71b1822))
- fix:removed uncessary changes (SahilCs15 - [a0803ad](https://github.com/contentstack/live-preview-sdk/commit/a0803ad8aeab52fd298ef71a1dab754ae116aa27))

### Chores And Housekeeping

- chore: rendered the fieldmodifier apps added an event listner to send the selected app (SahilCs15 - [0c49039](https://github.com/contentstack/live-preview-sdk/commit/0c490390011da7a4c7b8a4b64e4e53cdab0cc9a3))
- chore: added test cases for the field location data (SahilCs15 - [6337a6d](https://github.com/contentstack/live-preview-sdk/commit/6337a6de2c41684d6cc70b62f600a4036264577b))
- chore: fieldlocation fetch completed (SahilCs15 - [bab5a47](https://github.com/contentstack/live-preview-sdk/commit/bab5a47953979af9cc5acc4fc05cbe6623caeb55))
- chore(VE-6918/error-text): unit test file added (Aditya Pachauri - [ed1c0bb](https://github.com/contentstack/live-preview-sdk/commit/ed1c0bb03bc21a92f61c63e8db6120b6b35cb17e))
- chore(VE-6918/error-text): warning message improved (Aditya Pachauri - [8122192](https://github.com/contentstack/live-preview-sdk/commit/8122192f46a29579da04ea7e7c6e0fb102a9043a))
- chore(VE-6918/error-text): component name changed to title case (Aditya Pachauri - [dc3901f](https://github.com/contentstack/live-preview-sdk/commit/dc3901fafe5560b8a58f57303f934e21bbb73d98))
- chore: test fix from merge operation (Mridul Sharma - [e335877](https://github.com/contentstack/live-preview-sdk/commit/e335877c8f7d120f5f0549463f6ad1a1c81c9176))

### Changes to Test Assests

- test: added test cases for addLivePreviewQueryTags and addParamsToUrl (Mridul Sharma - [e781891](https://github.com/contentstack/live-preview-sdk/commit/e781891b9f65baae7860c11e09d0ac88b0c9b229))

### General Changes

- redner the app on dom (SahilCs15 - [bd5095a](https://github.com/contentstack/live-preview-sdk/commit/bd5095a556930aeef55afc9de7f64d26f5e268d6))

## [v3.3.0](https://github.com/contentstack/live-preview-sdk/compare/v3.2.5...v3.3.0)

> 24 July 2025
Expand All @@ -10,10 +56,15 @@

### General Changes

- v3.3.0 (Sairaj - [#474](https://github.com/contentstack/live-preview-sdk/pull/474))
- Release 24 July to stage_v3 (Sairaj - [#473](https://github.com/contentstack/live-preview-sdk/pull/473))
- HoverToolbar: Requested Changes (Ayush Dubey - [#464](https://github.com/contentstack/live-preview-sdk/pull/464))
- [Feature] HoverToolbar (Ayush Dubey - [#455](https://github.com/contentstack/live-preview-sdk/pull/455))

### Chores And Housekeeping

- chore:increment package version (Aditya Pachauri - [950170c](https://github.com/contentstack/live-preview-sdk/commit/950170c321a8850d6854b9c09f27e6522a5c5798))

## [v3.2.5](https://github.com/contentstack/live-preview-sdk/compare/v3.2.4...v3.2.5)

> 10 July 2025
Expand Down Expand Up @@ -121,6 +172,7 @@

- v3.2.2 (Hitesh Shetty - [#435](https://github.com/contentstack/live-preview-sdk/pull/435))
- Stage v3.2.2 (Hitesh Shetty - [#433](https://github.com/contentstack/live-preview-sdk/pull/433))
- v3.2.1 (Faraaz Biyabani - [#430](https://github.com/contentstack/live-preview-sdk/pull/430))

### Fixes

Expand Down Expand Up @@ -150,14 +202,15 @@
### General Changes

- secrets-scan.yml (Aravind Kumar - [f9c5068](https://github.com/contentstack/live-preview-sdk/commit/f9c5068f3996d39aa73dcabac788950903513e32))
- policy-scan.yml (Aravind Kumar - [7ae545b](https://github.com/contentstack/live-preview-sdk/commit/7ae545b3167869dc01874c8a75ffaff118d0d00a))
- talismanrc file updated (Aravind Kumar - [8a70888](https://github.com/contentstack/live-preview-sdk/commit/8a70888d24083ff4f5f9c2878d3b94661dabbd08))
- Updated codeowners (Aravind Kumar - [86bc538](https://github.com/contentstack/live-preview-sdk/commit/86bc538fc3f1bb42f2d86cf39ae8568be94880dd))
- issues-jira.yml (Aravind Kumar - [84a292c](https://github.com/contentstack/live-preview-sdk/commit/84a292cc28491bdab4ea9ab819594de320a99e8e))
- policy-scan.yml (Aravind Kumar - [55a2765](https://github.com/contentstack/live-preview-sdk/commit/55a2765deefc7ba4ebc91e2af07496834ee3dce3))

## [v3.2.1](https://github.com/contentstack/live-preview-sdk/compare/v3.2.0...v3.2.1)

> 24 April 2025
> 23 April 2025

### Fixes

Expand All @@ -169,7 +222,6 @@

### General Changes

- v3.2.1 (Faraaz Biyabani - [#430](https://github.com/contentstack/live-preview-sdk/pull/430))
- Stage-v3.2.1 (Faraaz Biyabani - [#428](https://github.com/contentstack/live-preview-sdk/pull/428))

### Fixes
Expand All @@ -195,7 +247,6 @@
- Delete jira.yml (Aravind Kumar - [80a496c](https://github.com/contentstack/live-preview-sdk/commit/80a496c805ce52542221f9bafa11116211f24f73))
- issues-jira.yml (Aravind Kumar - [a429983](https://github.com/contentstack/live-preview-sdk/commit/a4299833949c80c274abd8af8ae81062fd78556f))
- policy-scan.yml (Aravind Kumar - [a4b69a0](https://github.com/contentstack/live-preview-sdk/commit/a4b69a07a50b0d8145122bf99b330c3b22d91e8f))
- policy-scan.yml (Aravind Kumar - [7ae545b](https://github.com/contentstack/live-preview-sdk/commit/7ae545b3167869dc01874c8a75ffaff118d0d00a))
- Delete sast-scan.yml (Aravind Kumar - [c0bffef](https://github.com/contentstack/live-preview-sdk/commit/c0bffefd3a100a96117b080bd5cd7d2f6302deea))
- Updated codeowners (Aravind Kumar - [b759727](https://github.com/contentstack/live-preview-sdk/commit/b759727225ca20ee5e4b5addb8783a87eb8bc385))
- codeql-analysis.yml (Aravind Kumar - [d90af9f](https://github.com/contentstack/live-preview-sdk/commit/d90af9f61ed6fca7f4fdfac6ad6993006ed771ea))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Alternatively, if you want to include the package directly in your website HTML

```html
<script type='module' integrity='sha384-b6G+ggU20rGxqCqsgaS6zludFgj5N11xsuXhMEIARMuQY2PtyDS04TU0H5goP+32' crossorigin="anonymous">
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@3.2.5';
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@3.4.0';

ContentstackLivePreview.init({
stackDetails: {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@contentstack/live-preview-utils",
"version": "3.3.0",
"version": "3.4.0",
"description": "Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.",
"type": "module",
"types": "dist/legacy/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/livePreview/__test__/live-preview.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ describe("incoming postMessage", () => {

describe("testing window event listeners", () => {
let addEventListenerMock: any;
let sendInitEvent = vi.fn().mockImplementation(mockLivePreviewInitEventListener);
const sendInitEvent = vi.fn().mockImplementation(mockLivePreviewInitEventListener);
let livePreviewInstance: LivePreview;

beforeEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/livePreview/eventManager/postMessageEvent.hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config, { setConfigFromParams } from "../../configManager/configManager";
import { ILivePreviewWindowType } from "../../types/types";
import { addParamsToUrl } from "../../utils";
import { addParamsToUrl, isOpeningInTimeline } from "../../utils";
import livePreviewPostMessage from "./livePreviewEventManager";
import { LIVE_PREVIEW_POST_MESSAGE_EVENTS } from "./livePreviewEventManager.constant";
import {
Expand Down Expand Up @@ -95,7 +95,7 @@ export function sendInitializeLivePreviewPostMessageEvent(): void {
// "init message did not contain contentTypeUid or entryUid."
// );
}
if (Config.get().ssr) {
if (Config.get().ssr || isOpeningInTimeline()) {
addParamsToUrl();
}
Config.set("windowType", windowType);
Expand Down
81 changes: 81 additions & 0 deletions src/utils/__test__/addLivePreviewQueryTags.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { describe, test, expect, vi, beforeEach } from "vitest";
import { addLivePreviewQueryTags } from "../addLivePreviewQueryTags";
import { PublicLogger } from "../../logger/logger";

// Mock the logger
vi.mock("../../logger/logger", () => ({
PublicLogger: {
error: vi.fn(),
},
}));

describe("addLivePreviewQueryTags", () => {
beforeEach(() => {
vi.clearAllMocks();
});

test("should return original URL when no live preview parameters in current location", () => {
// This test works with current document.location (likely has no live preview params)
const targetUrl = "http://example.com/target-page";

const result = addLivePreviewQueryTags(targetUrl);

// Should return unchanged since no live preview params in current location
expect(result).toBe(targetUrl);
});

test("should log error and return original link when target URL is invalid", () => {
const targetUrl = "not-a-valid-url-at-all-invalid";

const result = addLivePreviewQueryTags(targetUrl);

expect(PublicLogger.error).toHaveBeenCalledWith("Error while adding live preview to URL");
expect(result).toBe(targetUrl);
});

test("should handle empty string input", () => {
const targetUrl = "";

const result = addLivePreviewQueryTags(targetUrl);

expect(PublicLogger.error).toHaveBeenCalledWith("Error while adding live preview to URL");
expect(result).toBe(targetUrl);
});

test("should handle malformed URLs gracefully", () => {
const targetUrl = "http://";

const result = addLivePreviewQueryTags(targetUrl);

expect(PublicLogger.error).toHaveBeenCalledWith("Error while adding live preview to URL");
expect(result).toBe(targetUrl);
});

test("should handle valid URLs without errors", () => {
const targetUrl = "https://example.com/valid-page";

const result = addLivePreviewQueryTags(targetUrl);

// Should not throw errors and return some result
expect(typeof result).toBe("string");
expect(result.length).toBeGreaterThan(0);
});

test("should add live preview query tags to URL with all required query parameters", () => {
const originalUrl =
"http://example.com?live_preview=hash&content_type_uid=ctuid&entry_uid=entryuid";
const expectedUrl =
"http://example.com/?live_preview=hash&content_type_uid=ctuid&entry_uid=entryuid";

global.window = Object.create(window);
Object.defineProperty(window, "location", {
value: {
href: originalUrl,
},
writable: true,
});
const result = addLivePreviewQueryTags(originalUrl);

expect(result).toEqual(expectedUrl);
});
});
Loading
Loading