@commercelayer/app-elements 3.3.1 → 3.4.0

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.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { j as se, I as Ee } from "./main-mxu1NrZ9.js";
3
- import z, { memo as ce, useState as U, useRef as w, useCallback as ue, useEffect as $, forwardRef as Ce } from "react";
2
+ import { j as se, I as Ee } from "./main-BBkPeXZ8.js";
3
+ import V, { memo as ce, useState as U, useRef as y, useCallback as ue, useEffect as $, forwardRef as Ce } from "react";
4
4
  function Ie(e, t, r) {
5
5
  return t in e ? Object.defineProperty(e, t, {
6
6
  value: r,
@@ -57,7 +57,7 @@ function De(e, t) {
57
57
  if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
58
58
  var r = [], n = !0, i = !1, o = void 0;
59
59
  try {
60
- for (var a = e[Symbol.iterator](), l; !(n = (l = a.next()).done) && (r.push(l.value), !(t && r.length === t)); n = !0)
60
+ for (var a = e[Symbol.iterator](), s; !(n = (s = a.next()).done) && (r.push(s.value), !(t && r.length === t)); n = !0)
61
61
  ;
62
62
  } catch (p) {
63
63
  i = !0, o = p;
@@ -131,41 +131,41 @@ function H(e) {
131
131
  for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
132
132
  i[o] = arguments[o];
133
133
  return i.length >= e.length ? e.apply(this, i) : function() {
134
- for (var a = arguments.length, l = new Array(a), p = 0; p < a; p++)
135
- l[p] = arguments[p];
136
- return t.apply(r, [].concat(i, l));
134
+ for (var a = arguments.length, s = new Array(a), p = 0; p < a; p++)
135
+ s[p] = arguments[p];
136
+ return t.apply(r, [].concat(i, s));
137
137
  };
138
138
  };
139
139
  }
140
- function ee(e) {
140
+ function te(e) {
141
141
  return {}.toString.call(e).includes("Object");
142
142
  }
143
143
  function qe(e) {
144
144
  return !Object.keys(e).length;
145
145
  }
146
- function K(e) {
146
+ function G(e) {
147
147
  return typeof e == "function";
148
148
  }
149
- function Ve(e, t) {
149
+ function ze(e, t) {
150
150
  return Object.prototype.hasOwnProperty.call(e, t);
151
151
  }
152
- function ze(e, t) {
153
- return ee(t) || D("changeType"), Object.keys(t).some(function(r) {
154
- return !Ve(e, r);
152
+ function Ve(e, t) {
153
+ return te(t) || D("changeType"), Object.keys(t).some(function(r) {
154
+ return !ze(e, r);
155
155
  }) && D("changeField"), t;
156
156
  }
157
157
  function Ue(e) {
158
- K(e) || D("selectorType");
158
+ G(e) || D("selectorType");
159
159
  }
160
160
  function We(e) {
161
- K(e) || ee(e) || D("handlerType"), ee(e) && Object.values(e).some(function(t) {
162
- return !K(t);
161
+ G(e) || te(e) || D("handlerType"), te(e) && Object.values(e).some(function(t) {
162
+ return !G(t);
163
163
  }) && D("handlersType");
164
164
  }
165
- function Fe(e) {
166
- e || D("initialIsRequired"), ee(e) || D("initialType"), qe(e) && D("initialContent");
165
+ function ke(e) {
166
+ e || D("initialIsRequired"), te(e) || D("initialType"), qe(e) && D("initialContent");
167
167
  }
168
- function ke(e, t) {
168
+ function Fe(e, t) {
169
169
  throw new Error(e[t] || e.default);
170
170
  }
171
171
  var He = {
@@ -178,37 +178,37 @@ var He = {
178
178
  changeType: "provided value of changes should be an object",
179
179
  changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
180
180
  default: "an unknown error accured in `state-local` package"
181
- }, D = H(ke)(He), Q = {
182
- changes: ze,
181
+ }, D = H(Fe)(He), X = {
182
+ changes: Ve,
183
183
  selector: Ue,
184
184
  handler: We,
185
- initial: Fe
185
+ initial: ke
186
186
  };
187
187
  function Be(e) {
188
188
  var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
189
- Q.initial(e), Q.handler(t);
189
+ X.initial(e), X.handler(t);
190
190
  var r = {
191
191
  current: e
192
- }, n = H(Je)(r, t), i = H(Ge)(r), o = H(Q.changes)(e), a = H(Ke)(r);
193
- function l() {
194
- var g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(y) {
195
- return y;
192
+ }, n = H(Je)(r, t), i = H(Ge)(r), o = H(X.changes)(e), a = H(Ke)(r);
193
+ function s() {
194
+ var g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(O) {
195
+ return O;
196
196
  };
197
- return Q.selector(g), g(r.current);
197
+ return X.selector(g), g(r.current);
198
198
  }
199
199
  function p(g) {
200
200
  _e(n, i, o, a)(g);
201
201
  }
202
- return [l, p];
202
+ return [s, p];
203
203
  }
204
204
  function Ke(e, t) {
205
- return K(t) ? t(e.current) : t;
205
+ return G(t) ? t(e.current) : t;
206
206
  }
207
207
  function Ge(e, t) {
208
208
  return e.current = he(he({}, e.current), t), t;
209
209
  }
210
210
  function Je(e, t, r) {
211
- return K(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
211
+ return G(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
212
212
  var i;
213
213
  return (i = t[n]) === null || i === void 0 ? void 0 : i.call(t, e.current[n]);
214
214
  }), r;
@@ -225,9 +225,9 @@ function Qe(e) {
225
225
  for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
226
226
  i[o] = arguments[o];
227
227
  return i.length >= e.length ? e.apply(this, i) : function() {
228
- for (var a = arguments.length, l = new Array(a), p = 0; p < a; p++)
229
- l[p] = arguments[p];
230
- return t.apply(r, [].concat(i, l));
228
+ for (var a = arguments.length, s = new Array(a), p = 0; p < a; p++)
229
+ s[p] = arguments[p];
230
+ return t.apply(r, [].concat(i, s));
231
231
  };
232
232
  };
233
233
  }
@@ -297,7 +297,7 @@ var at = Ye.create({
297
297
  resolve: null,
298
298
  reject: null,
299
299
  monaco: null
300
- }), ye = Ae(at, 2), G = ye[0], ne = ye[1];
300
+ }), ye = Ae(at, 2), J = ye[0], ne = ye[1];
301
301
  function ut(e) {
302
302
  var t = nt.config(e), r = t.monaco, n = Le(t, ["monaco"]);
303
303
  ne(function(i) {
@@ -308,7 +308,7 @@ function ut(e) {
308
308
  });
309
309
  }
310
310
  function ct() {
311
- var e = G(function(t) {
311
+ var e = J(function(t) {
312
312
  var r = t.monaco, n = t.isInitialized, i = t.resolve;
313
313
  return {
314
314
  monaco: r,
@@ -335,7 +335,7 @@ function st(e) {
335
335
  return e && (t.src = e), t;
336
336
  }
337
337
  function ft(e) {
338
- var t = G(function(n) {
338
+ var t = J(function(n) {
339
339
  var i = n.config, o = n.reject;
340
340
  return {
341
341
  config: i,
@@ -347,7 +347,7 @@ function ft(e) {
347
347
  }, r.onerror = t.reject, r;
348
348
  }
349
349
  function dt() {
350
- var e = G(function(r) {
350
+ var e = J(function(r) {
351
351
  var n = r.config, i = r.resolve, o = r.reject;
352
352
  return {
353
353
  config: n,
@@ -362,12 +362,12 @@ function dt() {
362
362
  });
363
363
  }
364
364
  function Oe(e) {
365
- G().monaco || ne({
365
+ J().monaco || ne({
366
366
  monaco: e
367
367
  });
368
368
  }
369
369
  function pt() {
370
- return G(function(e) {
370
+ return J(function(e) {
371
371
  var t = e.monaco;
372
372
  return t;
373
373
  });
@@ -377,17 +377,17 @@ var oe = new Promise(function(e, t) {
377
377
  resolve: e,
378
378
  reject: t
379
379
  });
380
- }), te = {
380
+ }), re = {
381
381
  config: ut,
382
382
  init: ct,
383
383
  __getMonacoInstance: pt
384
384
  }, gt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ae = gt, ht = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, mt = ht;
385
385
  function vt({ children: e }) {
386
- return z.createElement("div", { style: mt.container }, e);
386
+ return V.createElement("div", { style: mt.container }, e);
387
387
  }
388
388
  var bt = vt, wt = bt;
389
389
  function yt({ width: e, height: t, isEditorReady: r, loading: n, _ref: i, className: o, wrapperProps: a }) {
390
- return z.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...a }, !r && z.createElement(wt, null, n), z.createElement("div", { ref: i, style: { ...ae.fullWidth, ...!r && ae.hide }, className: o }));
390
+ return V.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...a }, !r && V.createElement(wt, null, n), V.createElement("div", { ref: i, style: { ...ae.fullWidth, ...!r && ae.hide }, className: o }));
391
391
  }
392
392
  var Ot = yt, je = ce(Ot);
393
393
  function jt(e) {
@@ -395,7 +395,7 @@ function jt(e) {
395
395
  }
396
396
  var le = jt;
397
397
  function Mt(e, t, r = !0) {
398
- let n = w(!0);
398
+ let n = y(!0);
399
399
  $(n.current || !r ? () => {
400
400
  n.current = !1;
401
401
  } : e, t);
@@ -403,140 +403,140 @@ function Mt(e, t, r = !0) {
403
403
  var E = Mt;
404
404
  function B() {
405
405
  }
406
- function V(e, t, r, n) {
407
- return St(e, n) || Pt(e, t, r, n);
406
+ function z(e, t, r, n) {
407
+ return Pt(e, n) || St(e, t, r, n);
408
408
  }
409
- function St(e, t) {
409
+ function Pt(e, t) {
410
410
  return e.editor.getModel(Me(e, t));
411
411
  }
412
- function Pt(e, t, r, n) {
412
+ function St(e, t, r, n) {
413
413
  return e.editor.createModel(t, r, n ? Me(e, n) : void 0);
414
414
  }
415
415
  function Me(e, t) {
416
416
  return e.Uri.parse(t);
417
417
  }
418
- function Et({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: a, keepCurrentOriginalModel: l = !1, keepCurrentModifiedModel: p = !1, theme: g = "light", loading: y = "Loading...", options: O = {}, height: T = "100%", width: L = "100%", className: J, wrapperProps: I = {}, beforeMount: C = B, onMount: A = B }) {
419
- let [j, R] = U(!1), [m, b] = U(!0), d = w(null), s = w(null), M = w(null), S = w(A), f = w(C), N = w(!1);
418
+ function Et({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: a, keepCurrentOriginalModel: s = !1, keepCurrentModifiedModel: p = !1, theme: g = "light", loading: O = "Loading...", options: j = {}, height: T = "100%", width: L = "100%", className: Y, wrapperProps: I = {}, beforeMount: C = B, onMount: A = B }) {
419
+ let [M, R] = U(!1), [h, b] = U(!0), d = y(null), l = y(null), w = y(null), P = y(A), f = y(C), N = y(!1);
420
420
  le(() => {
421
- let u = te.init();
422
- return u.then((h) => (s.current = h) && b(!1)).catch((h) => (h == null ? void 0 : h.type) !== "cancelation" && console.error("Monaco initialization: error:", h)), () => d.current ? W() : u.cancel();
421
+ let u = re.init();
422
+ return u.then((m) => (l.current = m) && b(!1)).catch((m) => (m == null ? void 0 : m.type) !== "cancelation" && console.error("Monaco initialization: error:", m)), () => d.current ? W() : u.cancel();
423
423
  }), E(() => {
424
- if (d.current && s.current) {
425
- let u = d.current.getOriginalEditor(), h = V(s.current, e || "", n || r || "text", o || "");
426
- h !== u.getModel() && u.setModel(h);
424
+ if (d.current && l.current) {
425
+ let u = d.current.getOriginalEditor(), m = z(l.current, e || "", n || r || "text", o || "");
426
+ m !== u.getModel() && u.setModel(m);
427
427
  }
428
- }, [o], j), E(() => {
429
- if (d.current && s.current) {
430
- let u = d.current.getModifiedEditor(), h = V(s.current, t || "", i || r || "text", a || "");
431
- h !== u.getModel() && u.setModel(h);
428
+ }, [o], M), E(() => {
429
+ if (d.current && l.current) {
430
+ let u = d.current.getModifiedEditor(), m = z(l.current, t || "", i || r || "text", a || "");
431
+ m !== u.getModel() && u.setModel(m);
432
432
  }
433
- }, [a], j), E(() => {
433
+ }, [a], M), E(() => {
434
434
  let u = d.current.getModifiedEditor();
435
- u.getOption(s.current.editor.EditorOption.readOnly) ? u.setValue(t || "") : t !== u.getValue() && (u.executeEdits("", [{ range: u.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), u.pushUndoStop());
436
- }, [t], j), E(() => {
437
- var u, h;
438
- (h = (u = d.current) == null ? void 0 : u.getModel()) == null || h.original.setValue(e || "");
439
- }, [e], j), E(() => {
440
- let { original: u, modified: h } = d.current.getModel();
441
- s.current.editor.setModelLanguage(u, n || r || "text"), s.current.editor.setModelLanguage(h, i || r || "text");
442
- }, [r, n, i], j), E(() => {
435
+ u.getOption(l.current.editor.EditorOption.readOnly) ? u.setValue(t || "") : t !== u.getValue() && (u.executeEdits("", [{ range: u.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), u.pushUndoStop());
436
+ }, [t], M), E(() => {
437
+ var u, m;
438
+ (m = (u = d.current) == null ? void 0 : u.getModel()) == null || m.original.setValue(e || "");
439
+ }, [e], M), E(() => {
440
+ let { original: u, modified: m } = d.current.getModel();
441
+ l.current.editor.setModelLanguage(u, n || r || "text"), l.current.editor.setModelLanguage(m, i || r || "text");
442
+ }, [r, n, i], M), E(() => {
443
443
  var u;
444
- (u = s.current) == null || u.editor.setTheme(g);
445
- }, [g], j), E(() => {
444
+ (u = l.current) == null || u.editor.setTheme(g);
445
+ }, [g], M), E(() => {
446
446
  var u;
447
- (u = d.current) == null || u.updateOptions(O);
448
- }, [O], j);
449
- let Y = ue(() => {
447
+ (u = d.current) == null || u.updateOptions(j);
448
+ }, [j], M);
449
+ let Z = ue(() => {
450
450
  var x;
451
- if (!s.current) return;
452
- f.current(s.current);
453
- let u = V(s.current, e || "", n || r || "text", o || ""), h = V(s.current, t || "", i || r || "text", a || "");
454
- (x = d.current) == null || x.setModel({ original: u, modified: h });
455
- }, [r, t, i, e, n, o, a]), Z = ue(() => {
451
+ if (!l.current) return;
452
+ f.current(l.current);
453
+ let u = z(l.current, e || "", n || r || "text", o || ""), m = z(l.current, t || "", i || r || "text", a || "");
454
+ (x = d.current) == null || x.setModel({ original: u, modified: m });
455
+ }, [r, t, i, e, n, o, a]), Q = ue(() => {
456
456
  var u;
457
- !N.current && M.current && (d.current = s.current.editor.createDiffEditor(M.current, { automaticLayout: !0, ...O }), Y(), (u = s.current) == null || u.editor.setTheme(g), R(!0), N.current = !0);
458
- }, [O, g, Y]);
457
+ !N.current && w.current && (d.current = l.current.editor.createDiffEditor(w.current, { automaticLayout: !0, ...j }), Z(), (u = l.current) == null || u.editor.setTheme(g), R(!0), N.current = !0);
458
+ }, [j, g, Z]);
459
459
  $(() => {
460
- j && S.current(d.current, s.current);
461
- }, [j]), $(() => {
462
- !m && !j && Z();
463
- }, [m, j, Z]);
460
+ M && P.current(d.current, l.current);
461
+ }, [M]), $(() => {
462
+ !h && !M && Q();
463
+ }, [h, M, Q]);
464
464
  function W() {
465
- var h, x, _, F;
466
- let u = (h = d.current) == null ? void 0 : h.getModel();
467
- l || ((x = u == null ? void 0 : u.original) == null || x.dispose()), p || ((_ = u == null ? void 0 : u.modified) == null || _.dispose()), (F = d.current) == null || F.dispose();
465
+ var m, x, _, k;
466
+ let u = (m = d.current) == null ? void 0 : m.getModel();
467
+ s || ((x = u == null ? void 0 : u.original) == null || x.dispose()), p || ((_ = u == null ? void 0 : u.modified) == null || _.dispose()), (k = d.current) == null || k.dispose();
468
468
  }
469
- return z.createElement(je, { width: L, height: T, isEditorReady: j, loading: y, _ref: M, className: J, wrapperProps: I });
469
+ return V.createElement(je, { width: L, height: T, isEditorReady: M, loading: O, _ref: w, className: Y, wrapperProps: I });
470
470
  }
471
471
  var Ct = Et;
472
472
  ce(Ct);
473
473
  function It() {
474
- let [e, t] = U(te.__getMonacoInstance());
474
+ let [e, t] = U(re.__getMonacoInstance());
475
475
  return le(() => {
476
476
  let r;
477
- return e || (r = te.init(), r.then((n) => {
477
+ return e || (r = re.init(), r.then((n) => {
478
478
  t(n);
479
479
  })), () => r == null ? void 0 : r.cancel();
480
480
  }), e;
481
481
  }
482
482
  var $t = It;
483
483
  function Lt(e) {
484
- let t = w();
484
+ let t = y();
485
485
  return $(() => {
486
486
  t.current = e;
487
487
  }, [e]), t.current;
488
488
  }
489
- var At = Lt, X = /* @__PURE__ */ new Map();
490
- function xt({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: i, path: o, theme: a = "light", line: l, loading: p = "Loading...", options: g = {}, overrideServices: y = {}, saveViewState: O = !0, keepCurrentModel: T = !1, width: L = "100%", height: J = "100%", className: I, wrapperProps: C = {}, beforeMount: A = B, onMount: j = B, onChange: R, onValidate: m = B }) {
491
- let [b, d] = U(!1), [s, M] = U(!0), S = w(null), f = w(null), N = w(null), Y = w(j), Z = w(A), W = w(), u = w(n), h = At(o), x = w(!1), _ = w(!1);
489
+ var At = Lt, ee = /* @__PURE__ */ new Map();
490
+ function xt({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: i, path: o, theme: a = "light", line: s, loading: p = "Loading...", options: g = {}, overrideServices: O = {}, saveViewState: j = !0, keepCurrentModel: T = !1, width: L = "100%", height: Y = "100%", className: I, wrapperProps: C = {}, beforeMount: A = B, onMount: M = B, onChange: R, onValidate: h = B }) {
491
+ let [b, d] = U(!1), [l, w] = U(!0), P = y(null), f = y(null), N = y(null), Z = y(M), Q = y(A), W = y(), u = y(n), m = At(o), x = y(!1), _ = y(!1);
492
492
  le(() => {
493
- let c = te.init();
494
- return c.then((v) => (S.current = v) && M(!1)).catch((v) => (v == null ? void 0 : v.type) !== "cancelation" && console.error("Monaco initialization: error:", v)), () => f.current ? Pe() : c.cancel();
493
+ let c = re.init();
494
+ return c.then((v) => (P.current = v) && w(!1)).catch((v) => (v == null ? void 0 : v.type) !== "cancelation" && console.error("Monaco initialization: error:", v)), () => f.current ? Se() : c.cancel();
495
495
  }), E(() => {
496
- var v, P, k, q;
497
- let c = V(S.current, e || n || "", t || i || "", o || r || "");
498
- c !== ((v = f.current) == null ? void 0 : v.getModel()) && (O && X.set(h, (P = f.current) == null ? void 0 : P.saveViewState()), (k = f.current) == null || k.setModel(c), O && ((q = f.current) == null || q.restoreViewState(X.get(o))));
496
+ var v, S, F, q;
497
+ let c = z(P.current, e || n || "", t || i || "", o || r || "");
498
+ c !== ((v = f.current) == null ? void 0 : v.getModel()) && (j && ee.set(m, (S = f.current) == null ? void 0 : S.saveViewState()), (F = f.current) == null || F.setModel(c), j && ((q = f.current) == null || q.restoreViewState(ee.get(o))));
499
499
  }, [o], b), E(() => {
500
500
  var c;
501
501
  (c = f.current) == null || c.updateOptions(g);
502
502
  }, [g], b), E(() => {
503
- !f.current || n === void 0 || (f.current.getOption(S.current.editor.EditorOption.readOnly) ? f.current.setValue(n) : n !== f.current.getValue() && (_.current = !0, f.current.executeEdits("", [{ range: f.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), f.current.pushUndoStop(), _.current = !1));
503
+ !f.current || n === void 0 || (f.current.getOption(P.current.editor.EditorOption.readOnly) ? f.current.setValue(n) : n !== f.current.getValue() && (_.current = !0, f.current.executeEdits("", [{ range: f.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), f.current.pushUndoStop(), _.current = !1));
504
504
  }, [n], b), E(() => {
505
- var v, P;
505
+ var v, S;
506
506
  let c = (v = f.current) == null ? void 0 : v.getModel();
507
- c && i && ((P = S.current) == null || P.editor.setModelLanguage(c, i));
507
+ c && i && ((S = P.current) == null || S.editor.setModelLanguage(c, i));
508
508
  }, [i], b), E(() => {
509
509
  var c;
510
- l !== void 0 && ((c = f.current) == null || c.revealLine(l));
511
- }, [l], b), E(() => {
510
+ s !== void 0 && ((c = f.current) == null || c.revealLine(s));
511
+ }, [s], b), E(() => {
512
512
  var c;
513
- (c = S.current) == null || c.editor.setTheme(a);
513
+ (c = P.current) == null || c.editor.setTheme(a);
514
514
  }, [a], b);
515
- let F = ue(() => {
515
+ let k = ue(() => {
516
516
  var c;
517
- if (!(!N.current || !S.current) && !x.current) {
518
- Z.current(S.current);
519
- let v = o || r, P = V(S.current, n || e || "", t || i || "", v || "");
520
- f.current = (c = S.current) == null ? void 0 : c.editor.create(N.current, { model: P, automaticLayout: !0, ...g }, y), O && f.current.restoreViewState(X.get(v)), S.current.editor.setTheme(a), l !== void 0 && f.current.revealLine(l), d(!0), x.current = !0;
517
+ if (!(!N.current || !P.current) && !x.current) {
518
+ Q.current(P.current);
519
+ let v = o || r, S = z(P.current, n || e || "", t || i || "", v || "");
520
+ f.current = (c = P.current) == null ? void 0 : c.editor.create(N.current, { model: S, automaticLayout: !0, ...g }, O), j && f.current.restoreViewState(ee.get(v)), P.current.editor.setTheme(a), s !== void 0 && f.current.revealLine(s), d(!0), x.current = !0;
521
521
  }
522
- }, [e, t, r, n, i, o, g, y, O, a, l]);
522
+ }, [e, t, r, n, i, o, g, O, j, a, s]);
523
523
  $(() => {
524
- b && Y.current(f.current, S.current);
524
+ b && Z.current(f.current, P.current);
525
525
  }, [b]), $(() => {
526
- !s && !b && F();
527
- }, [s, b, F]), u.current = n, $(() => {
526
+ !l && !b && k();
527
+ }, [l, b, k]), u.current = n, $(() => {
528
528
  var c, v;
529
- b && R && ((c = W.current) == null || c.dispose(), W.current = (v = f.current) == null ? void 0 : v.onDidChangeModelContent((P) => {
530
- _.current || R(f.current.getValue(), P);
529
+ b && R && ((c = W.current) == null || c.dispose(), W.current = (v = f.current) == null ? void 0 : v.onDidChangeModelContent((S) => {
530
+ _.current || R(f.current.getValue(), S);
531
531
  }));
532
532
  }, [b, R]), $(() => {
533
533
  if (b) {
534
- let c = S.current.editor.onDidChangeMarkers((v) => {
535
- var k;
536
- let P = (k = f.current.getModel()) == null ? void 0 : k.uri;
537
- if (P && v.find((q) => q.path === P.path)) {
538
- let q = S.current.editor.getModelMarkers({ resource: P });
539
- m == null || m(q);
534
+ let c = P.current.editor.onDidChangeMarkers((v) => {
535
+ var F;
536
+ let S = (F = f.current.getModel()) == null ? void 0 : F.uri;
537
+ if (S && v.find((q) => q.path === S.path)) {
538
+ let q = P.current.editor.getModelMarkers({ resource: S });
539
+ h == null || h(q);
540
540
  }
541
541
  });
542
542
  return () => {
@@ -545,12 +545,12 @@ function xt({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, lan
545
545
  }
546
546
  return () => {
547
547
  };
548
- }, [b, m]);
549
- function Pe() {
548
+ }, [b, h]);
549
+ function Se() {
550
550
  var c, v;
551
- (c = W.current) == null || c.dispose(), T ? O && X.set(o, f.current.saveViewState()) : (v = f.current.getModel()) == null || v.dispose(), f.current.dispose();
551
+ (c = W.current) == null || c.dispose(), T ? j && ee.set(o, f.current.saveViewState()) : (v = f.current.getModel()) == null || v.dispose(), f.current.dispose();
552
552
  }
553
- return z.createElement(je, { width: L, height: J, isEditorReady: b, loading: p, _ref: N, className: I, wrapperProps: C });
553
+ return V.createElement(je, { width: L, height: Y, isEditorReady: b, loading: p, _ref: N, className: I, wrapperProps: C });
554
554
  }
555
555
  var Dt = xt, Tt = ce(Dt), Rt = Tt;
556
556
  const Nt = /* @__PURE__ */ (() => {
@@ -562,7 +562,7 @@ const Nt = /* @__PURE__ */ (() => {
562
562
  fields: Object.entries(n.attributes.fields).filter(([a]) => !a.startsWith("_")),
563
563
  relationships: Object.entries(n.attributes.relationships).filter(([a]) => !a.startsWith("_")).filter(
564
564
  ([, a]) => t.find(
565
- (l) => l.id === Se(a.class_name)
565
+ (s) => s.id === Pe(a.class_name)
566
566
  ) != null
567
567
  )
568
568
  }
@@ -595,13 +595,13 @@ async function qt(e, t) {
595
595
  const r = await Nt(), n = e.replace(/\.$/, "").split("."), i = n.shift();
596
596
  return t ?? (t = r[i ?? ""]), n.reduce(
597
597
  (o, a) => {
598
- var g, y;
599
- const l = (y = (g = o.obj) == null ? void 0 : g.relationships.find(
600
- ([O]) => O === a
601
- )) == null ? void 0 : y[1].class_name;
602
- if (l == null)
598
+ var g, O;
599
+ const s = (O = (g = o.obj) == null ? void 0 : g.relationships.find(
600
+ ([j]) => j === a
601
+ )) == null ? void 0 : O[1].class_name;
602
+ if (s == null)
603
603
  return o;
604
- const p = r[Se(l)];
604
+ const p = r[Pe(s)];
605
605
  return p == null ? o : {
606
606
  path: `${o.path == null ? "" : `${o.path}.`}${a}`,
607
607
  obj: p
@@ -610,10 +610,10 @@ async function qt(e, t) {
610
610
  { path: t != null ? i ?? "" : "", obj: t }
611
611
  );
612
612
  }
613
- function Se(e) {
613
+ function Pe(e) {
614
614
  return e.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toLowerCase();
615
615
  }
616
- const Vt = Ut(500), zt = Ce(
616
+ const zt = Ut(500), Vt = Ce(
617
617
  ({
618
618
  feedback: e,
619
619
  hint: t,
@@ -622,54 +622,64 @@ const Vt = Ut(500), zt = Ce(
622
622
  defaultValue: i,
623
623
  readOnly: o,
624
624
  value: a,
625
- language: l = "plaintext",
625
+ language: s = "plaintext",
626
626
  height: p = "220px",
627
627
  jsonSchema: g = "none",
628
- onValidate: y,
629
- onValid: O,
628
+ onValidate: O,
629
+ onValid: j,
630
630
  onChange: T,
631
631
  ...L
632
- }, J) => {
633
- const I = $t(), C = w(), [A, j] = U(null), R = (m, b) => {
634
- j(m), m.onDidPaste(() => {
632
+ }, Y) => {
633
+ const I = $t(), C = y(), [A, M] = U(null), R = (h, b) => {
634
+ M(h), h.onDidPaste(() => {
635
635
  var d;
636
- (d = m.getAction("editor.action.formatDocument")) == null || d.run();
637
- }), m.onDidChangeModelContent(() => {
638
- const d = m.getModel(), s = b.editor.getModelMarkers({
636
+ (d = h.getAction("editor.action.formatDocument")) == null || d.run();
637
+ }), h.onDidChangeModelContent(() => {
638
+ const d = h.getModel(), l = b.editor.getModelMarkers({
639
639
  resource: d == null ? void 0 : d.uri
640
- }), M = m.getValue();
641
- Vt(() => {
642
- y == null || y(s.length > 0 ? s : null), T == null || T(M), s.length === 0 && (O == null || O(M));
640
+ }), w = h.getValue();
641
+ zt(() => {
642
+ O == null || O(l.length > 0 ? l : null), T == null || T(w), l.length === 0 && (j == null || j(w));
643
643
  });
644
644
  });
645
645
  };
646
646
  return $(() => (async function() {
647
647
  var b, d;
648
- const m = (b = A == null ? void 0 : A.getModel()) == null ? void 0 : b.uri.toString();
649
- if (I != null && m != null && g != null) {
648
+ const h = (b = A == null ? void 0 : A.getModel()) == null ? void 0 : b.uri.toString();
649
+ if (I != null && h != null && g != null) {
650
650
  (d = C.current) == null || d.call(C);
651
- const s = I.languages.json.jsonDefaults.diagnosticsOptions.schemas ?? [];
651
+ const l = I.languages.json.jsonDefaults.diagnosticsOptions.schemas ?? [];
652
652
  switch (g) {
653
653
  case "none":
654
654
  break;
655
+ case "organization-config": {
656
+ l.push({
657
+ schema: await fetch(
658
+ "https://provisioning.commercelayer.io/api/public/schemas/organization_config"
659
+ ).then(async (w) => await w.json()).then((w) => K(w)),
660
+ uri: `file:///json-schema--${g}.json`,
661
+ fileMatch: [h]
662
+ });
663
+ break;
664
+ }
655
665
  case "order-rules": {
656
- s.push({
666
+ l.push({
657
667
  schema: await fetch(
658
668
  "https://core.commercelayer.io/api/public/schemas/order_rules"
659
- ).then(async (M) => await M.json()).then((M) => re(M)),
669
+ ).then(async (w) => await w.json()).then((w) => K(w)),
660
670
  uri: `file:///json-schema--${g}.json`,
661
- fileMatch: [m]
662
- }), C.current = ve(I, m, ["order"]);
671
+ fileMatch: [h]
672
+ }), C.current = ve(I, h, ["order"]);
663
673
  break;
664
674
  }
665
675
  case "price-rules": {
666
- s.push({
676
+ l.push({
667
677
  schema: await fetch(
668
678
  "https://core.commercelayer.io/api/public/schemas/price_rules"
669
- ).then(async (M) => await M.json()).then((M) => re(M)),
679
+ ).then(async (w) => await w.json()).then((w) => K(w)),
670
680
  uri: `file:///json-schema--${g}.json`,
671
- fileMatch: [m]
672
- }), C.current = ve(I, m, ["price"]);
681
+ fileMatch: [h]
682
+ }), C.current = ve(I, h, ["price"]);
673
683
  break;
674
684
  }
675
685
  }
@@ -678,12 +688,12 @@ const Vt = Ut(500), zt = Ce(
678
688
  schemaRequest: "ignore",
679
689
  schemaValidation: "error",
680
690
  validate: !0,
681
- schemas: s
691
+ schemas: l
682
692
  });
683
693
  }
684
694
  }(), () => {
685
- var m;
686
- (m = C.current) == null || m.call(C);
695
+ var h;
696
+ (h = C.current) == null || h.call(C);
687
697
  }), [I, A, g]), /* @__PURE__ */ se.jsx(
688
698
  Ee,
689
699
  {
@@ -698,7 +708,7 @@ const Vt = Ut(500), zt = Ce(
698
708
  defaultPath: L.id ?? L.name,
699
709
  className: "[&>.monaco-editor]:rounded [&>.monaco-editor>.overflow-guard]:rounded",
700
710
  theme: "vs-dark",
701
- language: l,
711
+ language: s,
702
712
  height: p,
703
713
  defaultValue: i,
704
714
  value: a,
@@ -724,7 +734,7 @@ const Vt = Ut(500), zt = Ce(
724
734
  );
725
735
  }
726
736
  );
727
- zt.displayName = "CodeEditor";
737
+ Vt.displayName = "CodeEditor";
728
738
  function Ut(e = 100) {
729
739
  let t = null;
730
740
  return function(n) {
@@ -733,10 +743,10 @@ function Ut(e = 100) {
733
743
  }, e);
734
744
  };
735
745
  }
736
- function re(e, t) {
737
- return typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) => re(r)) : Object.entries(e).reduce((r, [n, i]) => t !== "properties" && ["examples", "default"].includes(n) ? r : {
746
+ function K(e, t) {
747
+ return typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) => K(r)) : Object.entries(e).reduce((r, [n, i]) => t !== "properties" && ["examples", "default"].includes(n) ? r : {
738
748
  ...r,
739
- [n]: re(i, n)
749
+ [n]: K(i, n)
740
750
  }, {});
741
751
  }
742
752
  function ve(e, t, r) {
@@ -756,10 +766,10 @@ function ve(e, t, r) {
756
766
  suggestions: (await _t(
757
767
  r,
758
768
  p
759
- )).map((y) => ({
760
- kind: y.type === "relationship" ? e.languages.CompletionItemKind.Module : e.languages.CompletionItemKind.Value,
761
- label: y.value,
762
- insertText: y.value,
769
+ )).map((O) => ({
770
+ kind: O.type === "relationship" ? e.languages.CompletionItemKind.Module : e.languages.CompletionItemKind.Value,
771
+ label: O.value,
772
+ insertText: O.value,
763
773
  // documentation: `Field: ${suggestion}`,
764
774
  range: {
765
775
  startLineNumber: i.lineNumber,
@@ -778,5 +788,5 @@ function ve(e, t, r) {
778
788
  };
779
789
  }
780
790
  export {
781
- zt as CodeEditor
791
+ Vt as CodeEditor
782
792
  };
@@ -2,7 +2,7 @@
2
2
  var un = Object.defineProperty;
3
3
  var dn = (a, n, t) => n in a ? un(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
4
4
  var y = (a, n, t) => dn(a, typeof n != "symbol" ? n + "" : n, t);
5
- import { o as pn, f as fn, c as hn, a as er, g as mn, i as $e, b as vn, j as Ee, I as gn, d as Dn, e as wn, w as yn, R as bn } from "./main-mxu1NrZ9.js";
5
+ import { o as pn, f as fn, c as hn, a as er, g as mn, i as $e, b as vn, j as Ee, I as gn, d as Dn, e as wn, w as yn, R as bn } from "./main-BBkPeXZ8.js";
6
6
  import * as x from "react";
7
7
  import h, { useLayoutEffect as Or, useEffect as Vt, createElement as _n, cloneElement as Yr, Component as Z, createRef as Se, useRef as At, useCallback as kn, forwardRef as Mn } from "react";
8
8
  import * as Cn from "react-dom";
@@ -29497,15 +29497,13 @@ const Ei = ({
29497
29497
  onSelect: n,
29498
29498
  ...a
29499
29499
  }) => {
29500
- const { control: i, watch: o, getValues: u } = i0(), c = In(t), [d, p] = ce(u(t)), g = o(t), h = ct(null);
29501
- oe(
29500
+ const { control: i, watch: o, getValues: u, formState: c } = i0(), d = In(t), [p, g] = ce(u(t)), h = o(t), v = ct(null);
29501
+ return oe(
29502
29502
  function() {
29503
- h.current != null && g == null && d !== g && h.current.clearValue(), p(g);
29503
+ v.current != null && h == null && p !== h && v.current.clearValue(), g(h);
29504
29504
  },
29505
- [g, h]
29506
- );
29507
- const v = a.loadAsyncValues != null;
29508
- return /* @__PURE__ */ m.jsx(
29505
+ [h, v]
29506
+ ), /* @__PURE__ */ m.jsx(
29509
29507
  Bn,
29510
29508
  {
29511
29509
  name: t,
@@ -29515,22 +29513,22 @@ const Ei = ({
29515
29513
  {
29516
29514
  ...a,
29517
29515
  name: t,
29518
- ref: h,
29516
+ ref: v,
29519
29517
  onBlur: y,
29520
- defaultValue: v ? I_({
29518
+ defaultValue: I_({
29521
29519
  initialValues: a.initialValues,
29522
29520
  currentValue: A,
29523
29521
  pathToValue: e
29524
- }) : void 0,
29525
- value: v ? void 0 : I_({
29522
+ }),
29523
+ value: c.dirtyFields[t] !== !0 ? I_({
29526
29524
  initialValues: a.initialValues,
29527
29525
  currentValue: A,
29528
29526
  pathToValue: e
29529
- }),
29527
+ }) : void 0,
29530
29528
  onSelect: (E) => {
29531
29529
  _(PH(E, e)), n == null || n(E);
29532
29530
  },
29533
- feedback: c
29531
+ feedback: d
29534
29532
  }
29535
29533
  )
29536
29534
  }
@@ -32077,7 +32075,7 @@ function Mce(t) {
32077
32075
  );
32078
32076
  }
32079
32077
  const Cce = Y6(
32080
- async () => await import("./CodeEditorComponent-Ddvvj8Wz.js").then((t) => ({
32078
+ async () => await import("./CodeEditorComponent-D5qd5nn5.js").then((t) => ({
32081
32079
  default: t.CodeEditor
32082
32080
  }))
32083
32081
  ), UH = N(
@@ -32978,7 +32976,7 @@ function eV({
32978
32976
  }
32979
32977
  eV.displayName = "InputCurrencyRange";
32980
32978
  const Uce = Y6(
32981
- async () => await import("./InputDateComponent-Djb2hJ5y.js").then((t) => ({
32979
+ async () => await import("./InputDateComponent-CIZED8wv.js").then((t) => ({
32982
32980
  default: t.InputDateComponent
32983
32981
  }))
32984
32982
  ), Mo = N(
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a7 as s, aN as t, a8 as o, a9 as r, aa as n, ab as u, ac as i, ad as c, ae as d, af as l, aO as p, ag as b, b8 as g, ah as S, ai as m, Y as I, aP as k, aQ as T, aR as D, aS as R, aj as y, a0 as h, a1 as C, b0 as H, ak as P, al as A, aT as F, b9 as v, ba as f, bb as B, bd as O, bf as E, bh as L, bl as N, bn as G, bs as M, bu as w, bx as x, bE as V, bG as W, bI as J, bK as U, bM as Y, bQ as j, bR as q, bS as z, am as K, an as Q, bc as X, be as Z, bg as _, bi as $, bk as aa, bm as ea, bo as sa, bp as ta, bq as oa, br as ra, bt as na, bv as ua, by as ia, bF as ca, bH as da, bJ as la, bL as pa, bN as ba, bO as ga, bP as Sa, aU as ma, aV as Ia, aW as ka, aX as Ta, a3 as Da, aY as Ra, ao as ya, aZ as ha, a_ as Ca, ap as Ha, aq as Pa, ar as Aa, as as Fa, a$ as va, bV as fa, bW as Ba, bZ as Oa, b_ as Ea, b$ as La, c0 as Na, c1 as Ga, c2 as Ma, c4 as wa, c5 as xa, b1 as Va, at as Wa, b4 as Ja, au as Ua, av as Ya, aw as ja, ax as qa, az as za, aA as Ka, aB as Qa, aC as Xa, aD as Za, aI as _a, aE as $a, b5 as ae, aJ as ee, aK as se, aF as te, aL as oe, aG as re, b6 as ne, a4 as ue, b7 as ie, aM as ce, aH as de, C as le, $ as pe, b2 as be, b3 as ge, l as Se, m as me, B as Ie, a5 as ke, bz as Te, bj as De, p as Re, q as ye, s as he, D as Ce, E as He, G as Pe, c8 as Ae, c9 as Fe, bA as ve, t as fe, u as Be, v as Oe, ca as Ee, cb as Le, cc as Ne, cd as Ge, ce as Me, H as we, J as xe, c3 as Ve, cf as We, bX as Je, F as Ue, cg as Ye, ch as je, ci as qe, K as ze, L as Ke, cj as Qe, ck as Xe, cl as Ze, O as _e, P as $e, h as as, M as es, N as ss, k as ts, bB as os, bC as rs, bD as ns, x as us, n as is, r as cs, y as ds, bT as ls, z as ps, A as bs, Q as gs, Z as Ss, _ as ms, S as Is, T as ks, U as Ts, bw as Ds, V as Rs, W as ys, X as hs, bY as Cs, c6 as Hs, c7 as Ps, a2 as As, a6 as Fs, bU as vs, ay as fs } from "./main-mxu1NrZ9.js";
2
+ import { a7 as s, aN as t, a8 as o, a9 as r, aa as n, ab as u, ac as i, ad as c, ae as d, af as l, aO as p, ag as b, b8 as g, ah as S, ai as m, Y as I, aP as k, aQ as T, aR as D, aS as R, aj as y, a0 as h, a1 as C, b0 as H, ak as P, al as A, aT as F, b9 as v, ba as f, bb as B, bd as O, bf as E, bh as L, bl as N, bn as G, bs as M, bu as w, bx as x, bE as V, bG as W, bI as J, bK as U, bM as Y, bQ as j, bR as q, bS as z, am as K, an as Q, bc as X, be as Z, bg as _, bi as $, bk as aa, bm as ea, bo as sa, bp as ta, bq as oa, br as ra, bt as na, bv as ua, by as ia, bF as ca, bH as da, bJ as la, bL as pa, bN as ba, bO as ga, bP as Sa, aU as ma, aV as Ia, aW as ka, aX as Ta, a3 as Da, aY as Ra, ao as ya, aZ as ha, a_ as Ca, ap as Ha, aq as Pa, ar as Aa, as as Fa, a$ as va, bV as fa, bW as Ba, bZ as Oa, b_ as Ea, b$ as La, c0 as Na, c1 as Ga, c2 as Ma, c4 as wa, c5 as xa, b1 as Va, at as Wa, b4 as Ja, au as Ua, av as Ya, aw as ja, ax as qa, az as za, aA as Ka, aB as Qa, aC as Xa, aD as Za, aI as _a, aE as $a, b5 as ae, aJ as ee, aK as se, aF as te, aL as oe, aG as re, b6 as ne, a4 as ue, b7 as ie, aM as ce, aH as de, C as le, $ as pe, b2 as be, b3 as ge, l as Se, m as me, B as Ie, a5 as ke, bz as Te, bj as De, p as Re, q as ye, s as he, D as Ce, E as He, G as Pe, c8 as Ae, c9 as Fe, bA as ve, t as fe, u as Be, v as Oe, ca as Ee, cb as Le, cc as Ne, cd as Ge, ce as Me, H as we, J as xe, c3 as Ve, cf as We, bX as Je, F as Ue, cg as Ye, ch as je, ci as qe, K as ze, L as Ke, cj as Qe, ck as Xe, cl as Ze, O as _e, P as $e, h as as, M as es, N as ss, k as ts, bB as os, bC as rs, bD as ns, x as us, n as is, r as cs, y as ds, bT as ls, z as ps, A as bs, Q as gs, Z as Ss, _ as ms, S as Is, T as ks, U as Ts, bw as Ds, V as Rs, W as ys, X as hs, bY as Cs, c6 as Hs, c7 as Ps, a2 as As, a6 as Fs, bU as vs, ay as fs } from "./main-BBkPeXZ8.js";
3
3
  export {
4
4
  s as A,
5
5
  t as ActionButtons,
@@ -20,7 +20,7 @@ export interface CodeEditorProps extends InputWrapperBaseProps, SetOptional<Pick
20
20
  * JSON Schema to be used when writing JSON
21
21
  * @default none
22
22
  */
23
- jsonSchema?: 'none' | 'order-rules' | 'price-rules';
23
+ jsonSchema?: 'none' | 'order-rules' | 'price-rules' | 'organization-config';
24
24
  /**
25
25
  * Trigger on every update.
26
26
  * @param markers List of markers (errors). `null` when there're no errors.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercelayer/app-elements",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [