@commercelayer/app-elements 7.4.2 → 7.5.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,7 +1,7 @@
1
1
  "use client";
2
- import { u as Pe, j as le, I as Se } from "./main-RB0PeDoP.js";
2
+ import { u as Pe, j as le, I as Se } from "./main-YBGuu4K1.js";
3
3
  import $, { memo as ie, useState as N, useRef as h, useCallback as ne, useEffect as S, forwardRef as Ce } from "react";
4
- import { f as Ee, a as Ie } from "./fetchCoreResourcesSuggestions-B1NH8QOj.js";
4
+ import { f as Ee, a as Ie } from "./fetchCoreResourcesSuggestions-C8IfxnQi.js";
5
5
  function se(e, t) {
6
6
  (t == null || t > e.length) && (t = e.length);
7
7
  for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { c as z, t as M, m as dr, a as pr, b as me, d as ve, n as ht, e as Be, g as fr, f as Kr, h as Ur, s as ot, i as hr, k as Vr, l as vr, o as mr, p as qr, q as jr, r as Yt, v as $r, w as Gr, x as zr, y as Lt, z as Ae, A as Xr, j as ae, B as G, C as pe, D as be, E as bt, F as xt, G as Dr, H as Et, J as gr, K as Zr, L as Ft, M as Te, N as Jr, O as en, P as tn, Q as st, R as rn, S as nn, I as an, T as on, U as sn, V as ln, W as cn } from "./main-RB0PeDoP.js";
2
+ import { c as z, t as M, m as dr, a as pr, b as me, d as ve, n as ht, e as Be, g as fr, f as Kr, h as Ur, s as ot, i as hr, k as Vr, l as vr, o as mr, p as qr, q as jr, r as Yt, v as $r, w as Gr, x as zr, y as Lt, z as Ae, A as Xr, j as ae, B as G, C as pe, D as be, E as bt, F as xt, G as Dr, H as Et, J as gr, K as Zr, L as Ft, M as Te, N as Jr, O as en, P as tn, Q as st, R as rn, S as nn, I as an, T as on, U as sn, V as ln, W as cn } from "./main-YBGuu4K1.js";
3
3
  import * as k from "react";
4
4
  import v, { useLayoutEffect as yr, cloneElement as wr, createRef as Me, Component as X, useRef as _t, useEffect as At, useCallback as un, createElement as dn, forwardRef as pn, useMemo as fn } from "react";
5
5
  import * as hn from "react-dom";
6
6
  import vn from "react-dom";
7
- import { p as mn } from "./parseISO-B1sV_-rm.js";
7
+ import { p as mn } from "./parseISO-B6RzzNAR.js";
8
8
  function br(o, n, t) {
9
9
  return z(o, +M(o) + n);
10
10
  }
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { t as B, X as Oe, Y as Re, Z as Ve, j as t, _ as R, $ as U, a0 as j, a1 as S, E as L, a2 as Ae, a3 as Me, a4 as Ee, a5 as Y, a6 as ae, a7 as x, T as k, a8 as C, a9 as $, aa as _, ab as y, ac as re, ad as E, ae as z, af as O, ag as X, ah as Ie, u as oe, ai as qe, aj as De, ak as H, I as Le, al as Fe } from "./main-RB0PeDoP.js";
2
+ import { t as B, X as Oe, Y as Re, Z as Ve, j as t, _ as R, $ as U, a0 as j, a1 as S, E as L, a2 as Ae, a3 as Me, a4 as Ee, a5 as Y, a6 as ae, a7 as x, T as k, a8 as C, a9 as $, aa as _, ab as y, ac as re, ad as E, ae as z, af as O, ag as X, ah as Ie, u as oe, ai as qe, aj as De, ak as H, I as Le, al as Fe } from "./main-YBGuu4K1.js";
3
3
  import K, { useReducer as ze, useCallback as A, useMemo as ie, createContext as Ge, useContext as Ue, useState as v, useEffect as T, useRef as ue } from "react";
4
4
  import "react-hook-form";
5
- import { b as Je, e as ce, a as We, c as de, f as Be } from "./fetchCoreResourcesSuggestions-B1NH8QOj.js";
5
+ import { b as Je, e as ce, a as We, c as de, f as Be } from "./fetchCoreResourcesSuggestions-C8IfxnQi.js";
6
6
  import "wouter";
7
- import { p as Q } from "./parseISO-B1sV_-rm.js";
7
+ import { p as Q } from "./parseISO-B6RzzNAR.js";
8
8
  function Z(e, s) {
9
9
  const n = e.match(
10
10
  /(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { am as d } from "./main-RB0PeDoP.js";
2
+ import { am as d } from "./main-YBGuu4K1.js";
3
3
  const m = d([
4
4
  "blank",
5
5
  "present",
6
6
  "null",
7
7
  "not_null"
8
8
  ]);
9
- async function _(t, r) {
9
+ async function v(t, r) {
10
10
  switch (r === "localhost" && (r = "commercelayer.co"), t) {
11
11
  case "none":
12
12
  break;
@@ -20,7 +20,7 @@ async function _(t, r) {
20
20
  return (await fetch(`https://core.${r}/api/public/schemas/price_rules`)).json();
21
21
  }
22
22
  }
23
- function g(t) {
23
+ function _(t) {
24
24
  return null;
25
25
  }
26
26
  const p = /* @__PURE__ */ (() => {
@@ -73,14 +73,14 @@ const p = /* @__PURE__ */ (() => {
73
73
  }
74
74
  }) : a)
75
75
  })).then(
76
- ({ data: e }) => e.reduce((a, s, n, u) => ({
76
+ ({ data: e }) => e.reduce((a, s, i, u) => ({
77
77
  ...a,
78
78
  [s.id]: {
79
79
  ...s,
80
- fields: Object.entries(s.attributes.fields).filter(([i]) => !i.startsWith("_")),
81
- relationships: Object.entries(s.attributes.relationships).filter(([i]) => !i.startsWith("_")).filter(
82
- ([, i]) => e.find(
83
- (l) => l.id === h(i.class_name)
80
+ fields: Object.entries(s.attributes.fields).filter(([n]) => !n.startsWith("_")),
81
+ relationships: Object.entries(s.attributes.relationships).filter(([n]) => !n.startsWith("_")).filter(
82
+ ([, n]) => e.find(
83
+ (l) => l.id === h(n.class_name)
84
84
  ) != null
85
85
  )
86
86
  }
@@ -91,7 +91,7 @@ const p = /* @__PURE__ */ (() => {
91
91
  };
92
92
  })();
93
93
  p(!1);
94
- async function v(t, r) {
94
+ async function g(t, r) {
95
95
  if (!new RegExp(`^(${t.join("|")})(.|$)`).test(r))
96
96
  return t.map((s) => ({
97
97
  value: s,
@@ -113,17 +113,20 @@ async function v(t, r) {
113
113
  async function y(t, r) {
114
114
  const e = await p(), a = t.replace(/\.$/, "").split("."), s = a.shift();
115
115
  return r ??= e[s ?? ""], a.reduce(
116
- (n, u) => {
117
- const i = n.resource?.relationships.find(
116
+ (i, u) => {
117
+ const n = i.resource?.relationships.find(
118
118
  ([o]) => o === u
119
119
  )?.[1].class_name;
120
- if (i == null) {
121
- const o = n.resource?.fields.find(([f]) => f === u)?.[1];
120
+ if (n == null) {
121
+ const o = i.resource?.fields.find(([f]) => f === u)?.[1];
122
122
  if (o == null)
123
- return n;
123
+ return {
124
+ ...i,
125
+ field: void 0
126
+ };
124
127
  let c = o.type;
125
128
  return c === "string" && o?.format === "datetime" && (c = "datetime"), {
126
- ...n,
129
+ ...i,
127
130
  field: {
128
131
  ...o,
129
132
  type: c,
@@ -131,10 +134,10 @@ async function y(t, r) {
131
134
  }
132
135
  };
133
136
  }
134
- const l = e[h(i)];
135
- return l == null ? n : {
136
- path: n.path,
137
- resourcePath: `${n.resourcePath == null ? "" : `${n.resourcePath}.`}${u}`,
137
+ const l = e[h(n)];
138
+ return l == null ? i : {
139
+ path: i.path,
140
+ resourcePath: `${i.resourcePath == null ? "" : `${i.resourcePath}.`}${u}`,
138
141
  resource: l
139
142
  };
140
143
  },
@@ -149,9 +152,9 @@ function h(t) {
149
152
  return t.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toLowerCase();
150
153
  }
151
154
  export {
152
- v as a,
155
+ g as a,
153
156
  y as b,
154
157
  m as c,
155
- g as e,
156
- _ as f
158
+ _ as e,
159
+ v as f
157
160
  };
@@ -22,6 +22,8 @@ interface ConfirmDialogProps {
22
22
  description?: React.ReactNode;
23
23
  /** Configuration for the confirm (primary action) button */
24
24
  confirm: ConfirmDialogConfirmProps;
25
+ /** Optional label for the cancel button - Default "Cancel" */
26
+ cancelLabel?: string;
25
27
  /**
26
28
  * Message shown in the error toast when `confirm.onClick` rejects and overrides the API errors.
27
29
  */