Skip to content

Commit d31a4d5

Browse files
Merge pull request #412 from contentstack/develop_v3
Stage-v3.1.3
2 parents 0ab602c + 6b52088 commit d31a4d5

25 files changed

Lines changed: 1099 additions & 945 deletions

CHANGELOG.md

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,63 @@
11
# Changelog
22

3+
## [v3.1.3](https://github.com/contentstack/live-preview-sdk/compare/v3.1.3...v3.1.3)
4+
5+
> 28 March 2025
6+
7+
### Chores And Housekeeping
8+
9+
- chore: add tagPattern to auto-changelog configuration in package.json (hiteshshetty-dev - [e0a208b](https://github.com/contentstack/live-preview-sdk/commit/e0a208bab316535abfb9c0e1ead19dab95b76f2d))
10+
11+
## [v3.1.3](https://github.com/contentstack/live-preview-sdk/compare/v3.1.2...v3.1.3)
12+
13+
> 28 March 2025
14+
15+
### New Features
16+
17+
- feat: v3.1.2 (Faraaz Biyabani - [#381](https://github.com/contentstack/live-preview-sdk/pull/381))
18+
19+
### Fixes
20+
21+
- fix(VE-5643): Replace button is visible for parent wrapper for Multiple file field (Hitesh Shetty - [#410](https://github.com/contentstack/live-preview-sdk/pull/410))
22+
- fix: enhance loading state for form field focus (Hitesh Shetty - [#409](https://github.com/contentstack/live-preview-sdk/pull/409))
23+
- fix(VE-5555): add instance button loading state (Faraaz Biyabani - [#406](https://github.com/contentstack/live-preview-sdk/pull/406))
24+
- fix: call onChangeCallback when live_preview parameter is present in URL (Faraaz Biyabani - [#363](https://github.com/contentstack/live-preview-sdk/pull/363))
25+
26+
### Chores And Housekeeping
27+
28+
- chore: rename `editButtonBulider` to `editInVisualBuilderButton` (Hitesh Shetty - [#379](https://github.com/contentstack/live-preview-sdk/pull/379))
29+
30+
### Changes to Test Assests
31+
32+
- test(VE-5478): add unit test for inline editing related functions (Faraaz Biyabani - [#398](https://github.com/contentstack/live-preview-sdk/pull/398))
33+
34+
### General Changes
35+
36+
- VE-5544: Investigate button click issue with `data-cslp` attribute (Sairaj - [#408](https://github.com/contentstack/live-preview-sdk/pull/408))
37+
- Stage: v3.1.2 (Faraaz Biyabani - [#377](https://github.com/contentstack/live-preview-sdk/pull/377))
38+
39+
### New Features
40+
41+
- feat(VE-5544): allow click in csr app with modifier key (Sairaj Chouhan - [41dc8ad](https://github.com/contentstack/live-preview-sdk/commit/41dc8adfa4bd7f0bef8f657596a16008cbbb83cc))
42+
43+
### Fixes
44+
45+
- fix: add instance button loading state (Faraaz Biyabani - [11e3862](https://github.com/contentstack/live-preview-sdk/commit/11e3862d59cdeb78423cfda371cf29bce499cb2b))
46+
- fix: call onLiveEdit on registration only in builder (Faraaz Biyabani - [98562c7](https://github.com/contentstack/live-preview-sdk/commit/98562c7370c9b03583d7abb3552af07bc0e9f57f))
47+
- fix(VE-5643): replace button is visible for parent wrapper for multiple file field (Sairaj Chouhan - [2e2c259](https://github.com/contentstack/live-preview-sdk/commit/2e2c259baa42c1b460044c7aa3a091330cb135ec))
48+
49+
### Chores And Housekeeping
50+
51+
- chore: rename editButtonBulider to editInVisualBuilderButton (Sairaj Chouhan - [bd8be29](https://github.com/contentstack/live-preview-sdk/commit/bd8be29d97c151fc85aad98f55573a6821b3d4fc))
52+
- chore: update integrity (hiteshshetty-dev - [ad2c8aa](https://github.com/contentstack/live-preview-sdk/commit/ad2c8aa3780b973233a82e5a978254f777773af2))
53+
54+
### Changes to Test Assests
55+
56+
- test: add unit test for inline editing related functions (Faraaz Biyabani - [50a2167](https://github.com/contentstack/live-preview-sdk/commit/50a21675271c7ec65d0959a1e20334011119a729))
57+
- test: fix unit tests related to add instance button (Faraaz Biyabani - [b6af0cc](https://github.com/contentstack/live-preview-sdk/commit/b6af0cc1d6142c9cfcbcdbef745ac245d0f271ca))
58+
- test: add test for replace button visibility in multiple file fields (Sairaj Chouhan - [aa1d818](https://github.com/contentstack/live-preview-sdk/commit/aa1d818533f8759cfc428c6a2c32691041beef93))
59+
- test: fix failing test cases (Sairaj Chouhan - [6d36acb](https://github.com/contentstack/live-preview-sdk/commit/6d36acbd5c4e717f92ce40e2e4490df28a857948))
60+
361
## [v3.1.2](https://github.com/contentstack/live-preview-sdk/compare/v3.1.1...v3.1.2)
462

563
> 3 March 2025
@@ -27,7 +85,6 @@
2785
### General Changes
2886

2987
- Ve 5139 (srinad007 - [#343](https://github.com/contentstack/live-preview-sdk/pull/343))
30-
- sync main for upcoming release (Hitesh Shetty - [#338](https://github.com/contentstack/live-preview-sdk/pull/338))
3188

3289
### New Features
3390

@@ -46,7 +103,6 @@
46103

47104
- chore: remove else block (Sairaj Chouhan - [834c3e7](https://github.com/contentstack/live-preview-sdk/commit/834c3e78250f36b32e21c948bda313818f0db7bc))
48105
- chore: remove `describe.only` (Faraaz Biyabani - [5aa5958](https://github.com/contentstack/live-preview-sdk/commit/5aa59587217ff7f64d495240f9e252bcf5b60a9c))
49-
- chore: update ContentstackLivePreview version to 3.1.1 in README (hiteshshetty-dev - [d885fa5](https://github.com/contentstack/live-preview-sdk/commit/d885fa5f65ef32e22bfb86fa3871238bdec02d61))
50106

51107
### Changes to Test Assests
52108

@@ -60,7 +116,7 @@
60116

61117
## [v3.1.1](https://github.com/contentstack/live-preview-sdk/compare/v3.1.0...v3.1.1)
62118

63-
> 3 February 2025
119+
> 6 February 2025
64120
65121
### Fixes
66122

@@ -75,10 +131,18 @@
75131

76132
- test: add unit tests for error handling and field state validation in visual builder (Hitesh Shetty - [#329](https://github.com/contentstack/live-preview-sdk/pull/329))
77133

134+
### General Changes
135+
136+
- sync main for upcoming release (Hitesh Shetty - [#338](https://github.com/contentstack/live-preview-sdk/pull/338))
137+
78138
### Fixes
79139

80140
- fix: live preview doc (Kirtesh Suthar - [8fcdcc5](https://github.com/contentstack/live-preview-sdk/commit/8fcdcc5127ea722bd9c01f74b1168d9f579e5f30))
81141

142+
### Chores And Housekeeping
143+
144+
- chore: update ContentstackLivePreview version to 3.1.1 in README (hiteshshetty-dev - [d885fa5](https://github.com/contentstack/live-preview-sdk/commit/d885fa5f65ef32e22bfb86fa3871238bdec02d61))
145+
82146
### Changes to Test Assests
83147

84148
- test: remove skipped number field tests and add validation for numeric input (hiteshshetty-dev - [ba0062e](https://github.com/contentstack/live-preview-sdk/commit/ba0062e6c9a5769d124707d6f02e7956a083acb2))

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Alternatively, if you want to include the package directly in your website HTML
1616

1717
```html
1818
<script type='module' integrity='sha384-LQQFdnInqHR0YPq3ypmbejKtYGi+kb43FlR7STQHgZtSrkLXPrN1eovxsdlxofuL' crossorigin="anonymous">
19-
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@3.1.2';
19+
import ContentstackLivePreview from 'https://esm.sh/@contentstack/live-preview-utils@3.1.3';
2020
2121
ContentstackLivePreview.init({
2222
stackDetails: {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@contentstack/live-preview-utils",
3-
"version": "3.1.2",
3+
"version": "3.1.3",
44
"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.",
55
"type": "module",
66
"types": "dist/legacy/index.d.ts",
@@ -106,7 +106,8 @@
106106
},
107107
"auto-changelog": {
108108
"commitLimit": false,
109-
"template": "changelog-template.hbs"
109+
"template": "changelog-template.hbs",
110+
"tagPattern": "^v?[0-9]+\\.[0-9]+\\.[0-9]+$"
110111
},
111112
"commitlint": {
112113
"extends": [

src/__test__/data/fields.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,18 @@ export const mockMultipleLinkFieldSchema: ISchemaFieldMap = {
3535
non_localizable: false,
3636
unique: false,
3737
};
38+
39+
export const mockMultipleFileFieldSchema: ISchemaFieldMap = {
40+
data_type: "file",
41+
display_name: "File",
42+
uid: "file",
43+
extensions: [],
44+
field_metadata: {
45+
description: "",
46+
rich_text_type: "standard"
47+
},
48+
mandatory: false,
49+
multiple: true,
50+
non_localizable: false,
51+
unique: false,
52+
};

src/preview/contentstack-live-preview-HOC.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,18 @@ class ContentstackLivePreview {
152152
onChangeCallback;
153153
}
154154

155-
if (!skipInitialRender) {
155+
const searchParams =
156+
typeof window !== "undefined"
157+
? new URLSearchParams(window.location.search)
158+
: null;
159+
const hasLivePreviewHash =
160+
searchParams && searchParams.has("live_preview");
161+
const isBuilder = searchParams && searchParams.has("builder");
162+
const shouldCallCallback = hasLivePreviewHash && isBuilder;
163+
// calling onChangeCallback when live_preview search parameter
164+
// is present because we don't send the initial client-data-send
165+
// message in visual builder
166+
if (!skipInitialRender || shouldCallCallback) {
156167
onChangeCallback();
157168
}
158169

0 commit comments

Comments
 (0)