@designcrowd/library.brand-page 6.0.6-undo-8 → 6.0.6-undo-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/{CreatedOnBrandCrowd-de-de-DdT7VIEh.js → CreatedOnBrandCrowd-de-de-leTOAQPM.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-YSkiGVKr.js → CreatedOnBrandCrowd-en-us-_9b-3HPl.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-1EPcCaOy.js → CreatedOnBrandCrowd-es-es-BPeAHmQH.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-C8fnEHlw.js → CreatedOnBrandCrowd-fr-ca-B7hbXmje.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-C8fnEHlw.js → CreatedOnBrandCrowd-fr-fr-B7hbXmje.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Dl3Se_ur.js → CreatedOnBrandCrowd-pt-br-C0U-9HO7.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Dl3Se_ur.js → CreatedOnBrandCrowd-pt-pt-C0U-9HO7.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-rXbL8YwY.js → CreatedOnDcom-de-de-Bdn37x7V.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-Bm9CAhKw.js → CreatedOnDcom-en-us-usSC3HOQ.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-B8diEgO8.js → CreatedOnDcom-es-es-BE0kziRp.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-b6jqk1vU.js → CreatedOnDcom-fr-ca-CcDaV0KR.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-ECBv8SyF.js → CreatedOnDcom-fr-fr-C1bX4cuW.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-C7THecsn.js → CreatedOnDcom-pt-br-DYju5xhk.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-C7f06hrr.js → CreatedOnDcom-pt-pt-CKYX6Rd0.js} +1 -1
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-DQvE17ni.js → lib-FHU3Jvoq.js} +11 -7
- package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js +5 -4
- package/lib/src/shared/content-settings/store/content-settings-store.js +8 -11
- package/package.json +1 -1
- package/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.ts +9 -6
- package/src/shared/content-settings/store/content-settings-store.test.ts +63 -25
- package/src/shared/content-settings/store/content-settings-store.ts +8 -12
package/lib/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as T, a as E, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as C, i as t, j as G, k as D, l as P, m as R, n as L, o, p as M, q as r, r as n, s as b, t as l, u as F, v as i, w as c, x as g, y as B, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as K, J as m, K as k, L as V, M as X, N as v, O as h, P as f, Q as W, R as x, S as z, T as w, U as Z, V as j, W as q, X as J, Y as Q, Z as $, $ as aa, a0 as _a, a1 as Ta, a2 as Ea, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as Ca, ab as ta, ac as Ga, ad as Da, ae as Pa, af as Ra, ag as La, ah as oa, ai as Ma, aj as ra, ak as na, al as ba, am as la, an as Fa, ao as ia, ap as ca, aq as ga, ar as Ba, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as Ka, aA as ma, aB as ka, aC as Va, aD as Xa, aE as va, aF as ha, aG as fa, aH as Wa, aI as xa, aJ as za, aK as wa, aL as Za, aM as ja, aN as qa, aO as Ja, aP as Qa, aQ as $a, aR as a_, aS as __, aT as T_, aU as E_, aV as s_, aW as I_, aX as S_, aY as N_, aZ as e_, a_ as A_, a$ as O_, b0 as C_, b1 as t_, b2 as G_, b3 as D_, b4 as P_, b5 as R_, b6 as L_, b7 as o_, b8 as M_, b9 as r_, ba as n_, bb as b_, bc as l_, bd as F_, be as i_, bf as c_, bg as g_, bh as B_, bi as Y_, bj as U_, bk as d_, bl as u_, bm as H_, bn as p_, bo as y_, bp as K_, bq as m_, br as k_, bs as V_, bt as X_, bu as v_, bv as h_, bw as f_, bx as W_, by as x_, bz as z_, bA as w_, bB as Z_, bC as j_, bD as q_, bE as J_, bF as Q_, bG as $_, bH as aT, bI as _T, bJ as TT, bK as ET, bL as sT, bM as IT, bN as ST, bO as NT, bP as eT, bQ as AT, bR as OT, bS as CT, bT as tT, bU as GT, bV as DT, bW as PT, bX as RT, bY as LT, bZ as oT, b_ as MT, b$ as rT, c0 as nT, c1 as bT, c2 as lT, c3 as FT, c4 as iT, c5 as cT, c6 as gT, c7 as BT, c8 as YT, c9 as UT, ca as dT, cb as uT, cc as HT, cd as pT, ce as yT, cf as KT, cg as mT, ch as kT, ci as VT, cj as XT, ck as vT, cl as hT, cm as fT, cn as WT, co as xT, cp as zT, cq as wT, cr as ZT, cs as jT, ct as qT, cu as JT } from "./lib-
|
|
1
|
+
import { A as T, a as E, b as s, c as I, d as S, e as N, f as e, B as A, g as O, h as C, i as t, j as G, k as D, l as P, m as R, n as L, o, p as M, q as r, r as n, s as b, t as l, u as F, v as i, w as c, x as g, y as B, z as Y, C as U, D as d, E as u, F as H, G as p, H as y, I as K, J as m, K as k, L as V, M as X, N as v, O as h, P as f, Q as W, R as x, S as z, T as w, U as Z, V as j, W as q, X as J, Y as Q, Z as $, $ as aa, a0 as _a, a1 as Ta, a2 as Ea, a3 as sa, a4 as Ia, a5 as Sa, a6 as Na, a7 as ea, a8 as Aa, a9 as Oa, aa as Ca, ab as ta, ac as Ga, ad as Da, ae as Pa, af as Ra, ag as La, ah as oa, ai as Ma, aj as ra, ak as na, al as ba, am as la, an as Fa, ao as ia, ap as ca, aq as ga, ar as Ba, as as Ya, at as Ua, au as da, av as ua, aw as Ha, ax as pa, ay as ya, az as Ka, aA as ma, aB as ka, aC as Va, aD as Xa, aE as va, aF as ha, aG as fa, aH as Wa, aI as xa, aJ as za, aK as wa, aL as Za, aM as ja, aN as qa, aO as Ja, aP as Qa, aQ as $a, aR as a_, aS as __, aT as T_, aU as E_, aV as s_, aW as I_, aX as S_, aY as N_, aZ as e_, a_ as A_, a$ as O_, b0 as C_, b1 as t_, b2 as G_, b3 as D_, b4 as P_, b5 as R_, b6 as L_, b7 as o_, b8 as M_, b9 as r_, ba as n_, bb as b_, bc as l_, bd as F_, be as i_, bf as c_, bg as g_, bh as B_, bi as Y_, bj as U_, bk as d_, bl as u_, bm as H_, bn as p_, bo as y_, bp as K_, bq as m_, br as k_, bs as V_, bt as X_, bu as v_, bv as h_, bw as f_, bx as W_, by as x_, bz as z_, bA as w_, bB as Z_, bC as j_, bD as q_, bE as J_, bF as Q_, bG as $_, bH as aT, bI as _T, bJ as TT, bK as ET, bL as sT, bM as IT, bN as ST, bO as NT, bP as eT, bQ as AT, bR as OT, bS as CT, bT as tT, bU as GT, bV as DT, bW as PT, bX as RT, bY as LT, bZ as oT, b_ as MT, b$ as rT, c0 as nT, c1 as bT, c2 as lT, c3 as FT, c4 as iT, c5 as cT, c6 as gT, c7 as BT, c8 as YT, c9 as UT, ca as dT, cb as uT, cc as HT, cd as pT, ce as yT, cf as KT, cg as mT, ch as kT, ci as VT, cj as XT, ck as vT, cl as hT, cm as fT, cn as WT, co as xT, cp as zT, cq as wT, cr as ZT, cs as jT, ct as qT, cu as JT } from "./lib-FHU3Jvoq.js";
|
|
2
2
|
import { createPinia as $T, setActivePinia as aE } from "pinia";
|
|
3
3
|
export {
|
|
4
4
|
T as ABOUT_SECTION_SETTINGS_CONFIG,
|
|
@@ -66487,10 +66487,10 @@ const Zi = /* @__PURE__ */ f9(XU1), JU1 = (e, t, n) => {
|
|
|
66487
66487
|
D2(() => n.context.isDesignCom, async () => {
|
|
66488
66488
|
const M = a9().toLowerCase(), S = n.context.isDesignCom ? "Dcom" : "BrandCrowd";
|
|
66489
66489
|
try {
|
|
66490
|
-
const { default: _ } = await AV(/* @__PURE__ */ Object.assign({ "./watermark/CreatedOnBrandCrowd-de-de.vue": () => import("./CreatedOnBrandCrowd-de-de-
|
|
66490
|
+
const { default: _ } = await AV(/* @__PURE__ */ Object.assign({ "./watermark/CreatedOnBrandCrowd-de-de.vue": () => import("./CreatedOnBrandCrowd-de-de-leTOAQPM.js"), "./watermark/CreatedOnBrandCrowd-en-us.vue": () => import("./CreatedOnBrandCrowd-en-us-_9b-3HPl.js"), "./watermark/CreatedOnBrandCrowd-es-es.vue": () => import("./CreatedOnBrandCrowd-es-es-BPeAHmQH.js"), "./watermark/CreatedOnBrandCrowd-fr-ca.vue": () => import("./CreatedOnBrandCrowd-fr-ca-B7hbXmje.js"), "./watermark/CreatedOnBrandCrowd-fr-fr.vue": () => import("./CreatedOnBrandCrowd-fr-fr-B7hbXmje.js"), "./watermark/CreatedOnBrandCrowd-pt-br.vue": () => import("./CreatedOnBrandCrowd-pt-br-C0U-9HO7.js"), "./watermark/CreatedOnBrandCrowd-pt-pt.vue": () => import("./CreatedOnBrandCrowd-pt-pt-C0U-9HO7.js"), "./watermark/CreatedOnDcom-de-de.vue": () => import("./CreatedOnDcom-de-de-Bdn37x7V.js"), "./watermark/CreatedOnDcom-en-us.vue": () => import("./CreatedOnDcom-en-us-usSC3HOQ.js"), "./watermark/CreatedOnDcom-es-es.vue": () => import("./CreatedOnDcom-es-es-BE0kziRp.js"), "./watermark/CreatedOnDcom-fr-ca.vue": () => import("./CreatedOnDcom-fr-ca-CcDaV0KR.js"), "./watermark/CreatedOnDcom-fr-fr.vue": () => import("./CreatedOnDcom-fr-fr-C1bX4cuW.js"), "./watermark/CreatedOnDcom-pt-br.vue": () => import("./CreatedOnDcom-pt-br-DYju5xhk.js"), "./watermark/CreatedOnDcom-pt-pt.vue": () => import("./CreatedOnDcom-pt-pt-CKYX6Rd0.js") }), `./watermark/CreatedOn${S}-${M}.vue`, 3);
|
|
66491
66491
|
i.value = _;
|
|
66492
66492
|
} catch {
|
|
66493
|
-
const { default: x } = await AV(/* @__PURE__ */ Object.assign({ "./watermark/CreatedOnBrandCrowd-en-us.vue": () => import("./CreatedOnBrandCrowd-en-us-
|
|
66493
|
+
const { default: x } = await AV(/* @__PURE__ */ Object.assign({ "./watermark/CreatedOnBrandCrowd-en-us.vue": () => import("./CreatedOnBrandCrowd-en-us-_9b-3HPl.js"), "./watermark/CreatedOnDcom-en-us.vue": () => import("./CreatedOnDcom-en-us-usSC3HOQ.js") }), `./watermark/CreatedOn${S}-en-us.vue`, 3);
|
|
66494
66494
|
i.value = x;
|
|
66495
66495
|
}
|
|
66496
66496
|
}, {
|
|
@@ -79024,7 +79024,7 @@ const o0 = (e) => {
|
|
|
79024
79024
|
}), g42 = [
|
|
79025
79025
|
"profile",
|
|
79026
79026
|
"text"
|
|
79027
|
-
], ix = (e, t) => e === t
|
|
79027
|
+
], ix = (e, t) => e === t, l6 = {
|
|
79028
79028
|
edit: "edit",
|
|
79029
79029
|
add: "add",
|
|
79030
79030
|
images: "images",
|
|
@@ -99995,16 +99995,20 @@ const qb2 = /* @__PURE__ */ v(Zb2, [["render", zb2]]), fH = Q({
|
|
|
99995
99995
|
},
|
|
99996
99996
|
methods: {
|
|
99997
99997
|
toggleEnabled(e, t) {
|
|
99998
|
-
const n =
|
|
99999
|
-
|
|
99998
|
+
const n = this.value.map(
|
|
99999
|
+
(i, o) => o === e ? { ...i, enabled: t } : i
|
|
100000
|
+
);
|
|
100001
|
+
this.$emit("update:modelValue", {
|
|
100000
100002
|
id: this.id,
|
|
100001
100003
|
name: this.name,
|
|
100002
100004
|
value: n
|
|
100003
100005
|
});
|
|
100004
100006
|
},
|
|
100005
100007
|
toggleRequired(e, t) {
|
|
100006
|
-
const n =
|
|
100007
|
-
|
|
100008
|
+
const n = this.value.map(
|
|
100009
|
+
(i, o) => o === e ? { ...i, required: t } : i
|
|
100010
|
+
);
|
|
100011
|
+
this.$emit("update:modelValue", {
|
|
100008
100012
|
id: this.id,
|
|
100009
100013
|
name: this.name,
|
|
100010
100014
|
value: n
|
package/lib/src/shared/content-settings/components/form-fields-field/FormFieldsField.mixin.js
CHANGED
|
@@ -69,8 +69,10 @@ export default defineComponent({
|
|
|
69
69
|
},
|
|
70
70
|
methods: {
|
|
71
71
|
toggleEnabled(index, value) {
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
// Clone the row — `this.value[index]` is the store's reactive
|
|
73
|
+
// proxy and mutating it in place would leak the change to the
|
|
74
|
+
// store before the emit reaches updateItemValue.
|
|
75
|
+
const result = this.value.map((field, i) => i === index ? { ...field, enabled: value } : field);
|
|
74
76
|
this.$emit('update:modelValue', {
|
|
75
77
|
id: this.id,
|
|
76
78
|
name: this.name,
|
|
@@ -78,8 +80,7 @@ export default defineComponent({
|
|
|
78
80
|
});
|
|
79
81
|
},
|
|
80
82
|
toggleRequired(index, value) {
|
|
81
|
-
const result =
|
|
82
|
-
result[index].required = value;
|
|
83
|
+
const result = this.value.map((field, i) => i === index ? { ...field, required: value } : field);
|
|
83
84
|
this.$emit('update:modelValue', {
|
|
84
85
|
id: this.id,
|
|
85
86
|
name: this.name,
|
|
@@ -14,17 +14,14 @@ const DEFAULT_TEXT_COLOR_DEPENDENT_TYPES = [
|
|
|
14
14
|
'profile',
|
|
15
15
|
'text',
|
|
16
16
|
];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* option, re-clicking an already-active display style).
|
|
26
|
-
*/
|
|
27
|
-
const isSameValue = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
17
|
+
// Identity-only, not deep-equal. Drops the two BP-5772 phantoms
|
|
18
|
+
// (LogoSelectionField Upload re-click passes props.content.logoImage —
|
|
19
|
+
// the same proxy that's in the store; display-style re-click emits the
|
|
20
|
+
// stored primitive) and never false-positives on a caller that mutates
|
|
21
|
+
// the store in place via a shared reference (e.g. `[...this.value];
|
|
22
|
+
// result[i].x = v`), which would leave the payload byte-identical to
|
|
23
|
+
// the store while state actually changed.
|
|
24
|
+
const isSameValue = (a, b) => a === b;
|
|
28
25
|
export const CONTENT_SETTINGS_MODES = {
|
|
29
26
|
edit: 'edit',
|
|
30
27
|
add: 'add',
|
package/package.json
CHANGED
|
@@ -81,9 +81,12 @@ export default defineComponent({
|
|
|
81
81
|
},
|
|
82
82
|
methods: {
|
|
83
83
|
toggleEnabled(index, value) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
// Clone the row — `this.value[index]` is the store's reactive
|
|
85
|
+
// proxy and mutating it in place would leak the change to the
|
|
86
|
+
// store before the emit reaches updateItemValue.
|
|
87
|
+
const result = this.value.map((field, i) =>
|
|
88
|
+
i === index ? { ...field, enabled: value } : field,
|
|
89
|
+
);
|
|
87
90
|
|
|
88
91
|
this.$emit('update:modelValue', {
|
|
89
92
|
id: this.id,
|
|
@@ -92,9 +95,9 @@ export default defineComponent({
|
|
|
92
95
|
});
|
|
93
96
|
},
|
|
94
97
|
toggleRequired(index, value) {
|
|
95
|
-
const result =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
const result = this.value.map((field, i) =>
|
|
99
|
+
i === index ? { ...field, required: value } : field,
|
|
100
|
+
);
|
|
98
101
|
|
|
99
102
|
this.$emit('update:modelValue', {
|
|
100
103
|
id: this.id,
|
|
@@ -207,30 +207,26 @@ describe('content settings store — hydration writes arm the history merge', ()
|
|
|
207
207
|
});
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
// BP-5772: a
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
// panel's "Upload" option re-emits { logoImage, logoTemplateImage,
|
|
216
|
-
// logoImageBase64Url, isLogoVisible } deep-equal to the model under fresh
|
|
217
|
-
// references (LogoSelectionField.onLogoVisibleChanged). Same class:
|
|
218
|
-
// re-clicking the already-active display style.
|
|
210
|
+
// BP-5772: a same-reference re-write must be dropped — the assignment
|
|
211
|
+
// is a reactive no-op but onContentChanged()'s flip would land a phantom
|
|
212
|
+
// history entry. Guard is identity-only; a deep-equal guard would also
|
|
213
|
+
// drop writes where the caller mutated the store in place before emit
|
|
214
|
+
// (FormFieldsField pre-fix) and break the canvas re-render.
|
|
219
215
|
describe('content settings store — value-identical writes are dropped', () => {
|
|
220
|
-
const logoImage = () => ({
|
|
221
|
-
logoDraftToken: 'dae5cda0-602d-4c69-a26e-000000000001',
|
|
222
|
-
logoVariation: 0,
|
|
223
|
-
logoLastUpdate: '638000000000000000',
|
|
224
|
-
});
|
|
225
|
-
|
|
226
216
|
const makeItem = () => ({
|
|
227
217
|
id: 'item-1',
|
|
228
218
|
type: 'logo',
|
|
229
219
|
settings: {
|
|
230
220
|
content: {
|
|
231
221
|
title: '<p>old</p>',
|
|
222
|
+
displayStyle: 'preview',
|
|
232
223
|
isLogoVisible: true,
|
|
233
|
-
logoImage:
|
|
224
|
+
logoImage: {
|
|
225
|
+
logoDraftToken: 'dae5cda0-602d-4c69-a26e-000000000001',
|
|
226
|
+
logoVariation: 0,
|
|
227
|
+
logoLastUpdate: '638000000000000000',
|
|
228
|
+
},
|
|
229
|
+
logoTemplateImage: { url: 'https://example.test/tpl.png' },
|
|
234
230
|
},
|
|
235
231
|
},
|
|
236
232
|
});
|
|
@@ -254,26 +250,32 @@ describe('content settings store — value-identical writes are dropped', () =>
|
|
|
254
250
|
|
|
255
251
|
test('updateMultipleItemValues drops the logo-panel Upload re-click payload', () => {
|
|
256
252
|
const store = setupStore();
|
|
253
|
+
const content = store.items[0].settings.content as Record<string, unknown>;
|
|
257
254
|
|
|
258
|
-
//
|
|
259
|
-
//
|
|
255
|
+
// Exactly what LogoSelectionField.onLogoVisibleChanged emits when
|
|
256
|
+
// visibility didn't change: the same reactive-proxy refs it read from
|
|
257
|
+
// the store, plus the current primitive visibility value.
|
|
260
258
|
store.updateMultipleItemValues({
|
|
261
259
|
id: 'item-1',
|
|
262
260
|
name: 'logoImage',
|
|
263
|
-
value: {
|
|
261
|
+
value: {
|
|
262
|
+
logoImage: content.logoImage,
|
|
263
|
+
logoTemplateImage: content.logoTemplateImage,
|
|
264
|
+
isLogoVisible: content.isLogoVisible,
|
|
265
|
+
},
|
|
264
266
|
});
|
|
265
267
|
|
|
266
268
|
expect(store.onContentChanged).not.toHaveBeenCalled();
|
|
267
269
|
expect(store.validateItem).not.toHaveBeenCalled();
|
|
268
270
|
});
|
|
269
271
|
|
|
270
|
-
test('updateItemValue drops an identical primitive', () => {
|
|
272
|
+
test('updateItemValue drops an identical primitive (display-style re-click)', () => {
|
|
271
273
|
const store = setupStore();
|
|
272
274
|
|
|
273
275
|
store.updateItemValue({
|
|
274
276
|
id: 'item-1',
|
|
275
|
-
name: '
|
|
276
|
-
value: '
|
|
277
|
+
name: 'displayStyle',
|
|
278
|
+
value: 'preview',
|
|
277
279
|
});
|
|
278
280
|
|
|
279
281
|
expect(store.onContentChanged).not.toHaveBeenCalled();
|
|
@@ -282,11 +284,12 @@ describe('content settings store — value-identical writes are dropped', () =>
|
|
|
282
284
|
|
|
283
285
|
test('updateMultipleItemValues writes when any one field differs', () => {
|
|
284
286
|
const store = setupStore();
|
|
287
|
+
const content = store.items[0].settings.content as Record<string, unknown>;
|
|
285
288
|
|
|
286
289
|
store.updateMultipleItemValues({
|
|
287
290
|
id: 'item-1',
|
|
288
291
|
name: 'logoImage',
|
|
289
|
-
value: { logoImage: logoImage
|
|
292
|
+
value: { logoImage: content.logoImage, isLogoVisible: false },
|
|
290
293
|
});
|
|
291
294
|
|
|
292
295
|
expect(store.onContentChanged).toHaveBeenCalledTimes(1);
|
|
@@ -301,11 +304,46 @@ describe('content settings store — value-identical writes are dropped', () =>
|
|
|
301
304
|
|
|
302
305
|
store.updateItemValue({
|
|
303
306
|
id: 'item-1',
|
|
304
|
-
name: '
|
|
305
|
-
value: '
|
|
307
|
+
name: 'displayStyle',
|
|
308
|
+
value: 'preview',
|
|
306
309
|
isHydrationWrite: true,
|
|
307
310
|
});
|
|
308
311
|
|
|
309
312
|
expect(mergeNextMutationMock).not.toHaveBeenCalled();
|
|
310
313
|
});
|
|
314
|
+
|
|
315
|
+
// Contact-form toggle repro (bp-5772 UAT env): pre-fix FormFieldsField
|
|
316
|
+
// shallow-copied `[...this.value]` and mutated `result[i].enabled` —
|
|
317
|
+
// hitting the store's inner obj before emit. Deep-equal guard would
|
|
318
|
+
// drop this as a no-op and the canvas would stay stale.
|
|
319
|
+
test('updateItemValue writes when the outer container is a fresh reference, even if a caller mutated the shared leaf in place', () => {
|
|
320
|
+
const store = setupStore();
|
|
321
|
+
const content = store.items[0].settings.content as Record<string, unknown>;
|
|
322
|
+
|
|
323
|
+
content.fields = [
|
|
324
|
+
{ id: 'firstName', enabled: true, required: true, type: 'text' },
|
|
325
|
+
{ id: 'message', enabled: true, required: true, type: 'text-area' },
|
|
326
|
+
];
|
|
327
|
+
|
|
328
|
+
const payloadValue = [...(content.fields as Record<string, unknown>[])];
|
|
329
|
+
|
|
330
|
+
payloadValue[0].enabled = false;
|
|
331
|
+
|
|
332
|
+
store.updateItemValue({
|
|
333
|
+
id: 'item-1',
|
|
334
|
+
name: 'fields',
|
|
335
|
+
value: payloadValue,
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
expect(store.onContentChanged).toHaveBeenCalledTimes(1);
|
|
339
|
+
expect(store.validateItem).toHaveBeenCalledTimes(1);
|
|
340
|
+
// Check the effect rather than identity — Pinia wraps in a proxy.
|
|
341
|
+
expect(
|
|
342
|
+
(
|
|
343
|
+
(store.items[0].settings.content as Record<string, unknown>).fields as {
|
|
344
|
+
enabled: boolean;
|
|
345
|
+
}[]
|
|
346
|
+
)[0].enabled,
|
|
347
|
+
).toBe(false);
|
|
348
|
+
});
|
|
311
349
|
});
|
|
@@ -60,18 +60,14 @@ const DEFAULT_TEXT_COLOR_DEPENDENT_TYPES: readonly ContentType[] = [
|
|
|
60
60
|
'text',
|
|
61
61
|
] as const;
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* option, re-clicking an already-active display style).
|
|
72
|
-
*/
|
|
73
|
-
const isSameValue = (a: unknown, b: unknown): boolean =>
|
|
74
|
-
a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
63
|
+
// Identity-only, not deep-equal. Drops the two BP-5772 phantoms
|
|
64
|
+
// (LogoSelectionField Upload re-click passes props.content.logoImage —
|
|
65
|
+
// the same proxy that's in the store; display-style re-click emits the
|
|
66
|
+
// stored primitive) and never false-positives on a caller that mutates
|
|
67
|
+
// the store in place via a shared reference (e.g. `[...this.value];
|
|
68
|
+
// result[i].x = v`), which would leave the payload byte-identical to
|
|
69
|
+
// the store while state actually changed.
|
|
70
|
+
const isSameValue = (a: unknown, b: unknown): boolean => a === b;
|
|
75
71
|
|
|
76
72
|
export const CONTENT_SETTINGS_MODES = {
|
|
77
73
|
edit: 'edit',
|