@commercelayer/app-elements 6.0.0 → 6.0.1

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,9 +1,8 @@
1
1
  "use client";
2
- import { t as S, b as H, d as Z, j as e, i as V, g as G, e as Q, f, h as y, k as $, D as z, l as R, n as p, B as J, o as w, p as U, u as P, q as ee, r as te, s as ne, v as _, I as ae, C as le } from "./main-BANV9Udl.js";
3
- import I, { useReducer as se, useCallback as N, useMemo as re, createContext as ie, useContext as ue, useState as g, useEffect as v, useRef as ce } from "react";
2
+ import { t as S, b as H, d as Z, j as e, i as V, g as G, e as Q, I as f, f as y, h as $, D as z, k as R, l as p, B as J, n as P, o as w, p as U, u as ee, q as te, r as ne, s as ae, v as _, w as le, C as se } from "./main-os-TPFjB.js";
3
+ import I, { useReducer as re, useCallback as N, useMemo as ie, createContext as ue, useContext as ce, useState as g, useEffect as v, useRef as oe } from "react";
4
4
  import "react-hook-form";
5
- import { a as oe } from "./fetchCoreResourcesSuggestions-DLZhtrDX.js";
6
- import { p as k } from "./parseISO-8P5gMU86.js";
5
+ import { p as k } from "./parseISO-B-vBXvVj.js";
7
6
  function A(t, n) {
8
7
  const a = t.match(
9
8
  /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
@@ -27,7 +26,7 @@ function q(t, n, a) {
27
26
  function D(t, n) {
28
27
  return t == null ? !0 : Z(t, n);
29
28
  }
30
- const K = ie(
29
+ const K = ue(
31
30
  void 0
32
31
  );
33
32
  function de(t, n) {
@@ -78,7 +77,7 @@ function me({
78
77
  children: t,
79
78
  initialValue: n
80
79
  }) {
81
- const [a, r] = se(de, {
80
+ const [a, r] = re(de, {
82
81
  value: n,
83
82
  selectedRuleIndex: 0
84
83
  }), u = N((o, c) => {
@@ -87,7 +86,7 @@ function me({
87
86
  r({ type: "SET_SELECTED_RULE_INDEX", index: o });
88
87
  }, []), l = N((o) => {
89
88
  r({ type: "SET_VALUE", value: o });
90
- }, []), i = re(
89
+ }, []), i = ie(
91
90
  () => ({
92
91
  state: a,
93
92
  setPath: u,
@@ -99,7 +98,7 @@ function me({
99
98
  return /* @__PURE__ */ e.jsx(K.Provider, { value: i, children: t });
100
99
  }
101
100
  function h() {
102
- const t = ue(K);
101
+ const t = ce(K);
103
102
  if (t === void 0)
104
103
  throw new Error("useRuleEngine must be used within a RuleEngineProvider");
105
104
  return t;
@@ -343,7 +342,7 @@ function he({
343
342
  function X(t) {
344
343
  const [n, a] = g(void 0);
345
344
  return v(() => {
346
- t?.field != null && oe(t.field).then((r) => {
345
+ t?.field != null && P(t.field).then((r) => {
347
346
  a(r);
348
347
  }).catch((r) => {
349
348
  console.error("Error fetching field info:", r);
@@ -789,7 +788,7 @@ function je({
789
788
  item: t,
790
789
  pathPrefix: n
791
790
  }) {
792
- const { setPath: a } = h(), { infos: r } = X(t), { user: u } = P(), s = `${n}.value`;
791
+ const { setPath: a } = h(), { infos: r } = X(t), { user: u } = ee(), s = `${n}.value`;
793
792
  if (t == null || W.includes(
794
793
  t.matcher
795
794
  ))
@@ -870,7 +869,7 @@ function je({
870
869
  typeof l.value == "string" ? l.value : ""
871
870
  );
872
871
  return /* @__PURE__ */ e.jsx(
873
- te,
872
+ ne,
874
873
  {
875
874
  value: w(c) ? c : void 0,
876
875
  showTimeSelect: !0,
@@ -888,7 +887,7 @@ function je({
888
887
  return w(m) ? m : null;
889
888
  }) : [null, null];
890
889
  return /* @__PURE__ */ e.jsx(
891
- ee,
890
+ te,
892
891
  {
893
892
  value: c,
894
893
  showTimeSelect: !0,
@@ -1077,7 +1076,7 @@ function Ne({
1077
1076
  // biome-ignore lint/suspicious/noArrayIndexKey: Using index as key is acceptable here since items are static
1078
1077
  /* @__PURE__ */ e.jsx(I.Fragment, { children: c }, d)
1079
1078
  )),
1080
- i < o.length - 1 && /* @__PURE__ */ e.jsx(ne, {})
1079
+ i < o.length - 1 && /* @__PURE__ */ e.jsx(ae, {})
1081
1080
  ] }, i)
1082
1081
  ))
1083
1082
  }
@@ -1224,7 +1223,7 @@ const F = {
1224
1223
  return !1;
1225
1224
  }
1226
1225
  };
1227
- function Ae(t) {
1226
+ function ke(t) {
1228
1227
  const [n, a] = g(
1229
1228
  T(t.value ?? t.defaultValue)
1230
1229
  );
@@ -1243,7 +1242,7 @@ function $e(t) {
1243
1242
  setPath: s
1244
1243
  } = h(), [l, i] = g(
1245
1244
  t.defaultCodeEditorVisible ?? !1
1246
- ), o = n.rules[a], c = ce(null), [d, m] = g(0);
1245
+ ), o = n.rules[a], c = oe(null), [d, m] = g(0);
1247
1246
  v(
1248
1247
  function() {
1249
1248
  V(T(c.current?.getValue()), n) || c.current?.setValue(JSON.stringify(n, null, 2)), t.onChange?.(n);
@@ -1258,7 +1257,7 @@ function $e(t) {
1258
1257
  [n]
1259
1258
  );
1260
1259
  return /* @__PURE__ */ e.jsx(
1261
- ae,
1260
+ le,
1262
1261
  {
1263
1262
  hint: t.hint,
1264
1263
  feedback: t.feedback,
@@ -1358,7 +1357,7 @@ function $e(t) {
1358
1357
  d
1359
1358
  ),
1360
1359
  l && /* @__PURE__ */ e.jsx("div", { className: "shrink-0 basis-2/5", children: /* @__PURE__ */ e.jsx(
1361
- le,
1360
+ se,
1362
1361
  {
1363
1362
  ref: c,
1364
1363
  name: t.id ?? t.name,
@@ -1400,5 +1399,5 @@ function Ve({
1400
1399
  return /* @__PURE__ */ e.jsx("div", { className: "h-full w-full bg-gray-50 p-8 bg-[radial-gradient(#d6d6d6_1px,transparent_1px)] bg-size-[16px_16px] overflow-auto", children: /* @__PURE__ */ e.jsx("div", { className: "max-w-[900px] mx-auto", children: t }) });
1401
1400
  }
1402
1401
  export {
1403
- Ae as RuleEngine
1402
+ ke as RuleEngine
1404
1403
  };
@@ -282,6 +282,7 @@ const e = {
282
282
  update: "Update",
283
283
  updated: "Updated",
284
284
  view_logs: "View logs",
285
+ view_json: "View JSON",
285
286
  view_api_docs: "View API reference",
286
287
  empty_states: {
287
288
  not_found: "Not found",
@@ -0,0 +1,11 @@
1
+ import { FC } from 'react';
2
+ interface OverlayProps {
3
+ title: string;
4
+ json: object;
5
+ }
6
+ interface ViewJsonOverlayHook {
7
+ showJsonOverlay: () => void;
8
+ JsonOverlay: FC<OverlayProps>;
9
+ }
10
+ export declare function useViewJsonOverlay(): ViewJsonOverlayHook;
11
+ export {};
@@ -81,6 +81,7 @@ const e = {
81
81
  update: "Aggiorna",
82
82
  updated: "Aggiornato",
83
83
  view_logs: "Visualizza i log",
84
+ view_json: "Vedi JSON",
84
85
  view_api_docs: "Visualizza la documentazione API",
85
86
  empty_states: {
86
87
  not_found: "Non trovato",
@@ -80,6 +80,7 @@ declare const en: {
80
80
  update: string;
81
81
  updated: string;
82
82
  view_logs: string;
83
+ view_json: string;
83
84
  view_api_docs: string;
84
85
  empty_states: {
85
86
  not_found: string;