@commercelayer/app-elements 5.4.2 → 5.5.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.
Files changed (45) hide show
  1. package/dist/CodeEditorComponent-ioY-kydb.js +739 -0
  2. package/dist/{InputDateComponent-BB1cA4uH.js → InputDateComponent-BuVP44xp.js} +1174 -1301
  3. package/dist/RuleEngineComponent-CGOH-VpI.js +1376 -0
  4. package/dist/fetchCoreResourcesSuggestions-CZkDwjO2.js +126 -0
  5. package/dist/helpers/giftCards.d.ts +1 -0
  6. package/dist/helpers/giftCards.test.d.ts +1 -0
  7. package/dist/{main-DvygJyZL.js → main-Dncz1fnB.js} +8819 -8151
  8. package/dist/main.d.ts +3 -0
  9. package/dist/main.js +137 -133
  10. package/dist/parseISO-DFqToJvK.js +120 -0
  11. package/dist/style.css +1 -1
  12. package/dist/tailwind.config.js +5 -5
  13. package/dist/ui/atoms/Icon/icons.d.ts +5 -0
  14. package/dist/ui/composite/ListItem.d.ts +3 -1
  15. package/dist/ui/composite/Timeline.d.ts +1 -0
  16. package/dist/ui/composite/Toast.d.ts +8 -0
  17. package/dist/ui/forms/CodeEditor/CodeEditor.d.ts +2 -1
  18. package/dist/ui/forms/CodeEditor/CodeEditorComponent.d.ts +10 -1
  19. package/dist/ui/forms/CodeEditor/fetchCoreResourcesSuggestions.d.ts +34 -18
  20. package/dist/ui/forms/RuleEngine/Action/ActionListItem.d.ts +6 -0
  21. package/dist/ui/forms/RuleEngine/Action/ActionValue.d.ts +5 -0
  22. package/dist/ui/forms/RuleEngine/Action/index.d.ts +4 -0
  23. package/dist/ui/forms/RuleEngine/Condition/ConditionListItem.d.ts +8 -0
  24. package/dist/ui/forms/RuleEngine/Condition/ConditionMatcher.d.ts +6 -0
  25. package/dist/ui/forms/RuleEngine/Condition/ConditionValue.d.ts +12 -0
  26. package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputArrayMatch.d.ts +6 -0
  27. package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputNumberRange.d.ts +6 -0
  28. package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputTextRange.d.ts +6 -0
  29. package/dist/ui/forms/RuleEngine/Condition/hooks.d.ts +5 -0
  30. package/dist/ui/forms/RuleEngine/Condition/index.d.ts +8 -0
  31. package/dist/ui/forms/RuleEngine/Condition/utils.d.ts +3 -0
  32. package/dist/ui/forms/RuleEngine/RuleEngine.d.ts +3 -0
  33. package/dist/ui/forms/RuleEngine/RuleEngineComponent.d.ts +22 -0
  34. package/dist/ui/forms/RuleEngine/RuleEngineContext.d.ts +18 -0
  35. package/dist/ui/forms/RuleEngine/RuleName.d.ts +1 -0
  36. package/dist/ui/forms/RuleEngine/index.d.ts +2 -0
  37. package/dist/ui/forms/RuleEngine/schema.order_rules.d.ts +335 -0
  38. package/dist/ui/forms/RuleEngine/schema.price_rules.d.ts +286 -0
  39. package/dist/ui/forms/RuleEngine/utils.d.ts +24 -0
  40. package/dist/ui/internals/Overlay.d.ts +13 -0
  41. package/dist/ui/resources/ResourceLineItems/ResourceLineItems.mocks.d.ts +17 -0
  42. package/dist/ui/resources/ResourceListItem/ResourceListItem.mocks.d.ts +24 -0
  43. package/dist/vendor.css +1 -1
  44. package/package.json +6 -2
  45. package/dist/CodeEditorComponent-CZdWLH8G.js +0 -794
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ const f = /* @__PURE__ */ (() => {
3
+ let t;
4
+ return async (n = !0) => {
5
+ if (n) {
6
+ for (; t == null; )
7
+ await new Promise((e) => setTimeout(e, 100));
8
+ return t;
9
+ }
10
+ return t != null || (t = await fetch("https://core.commercelayer.io/api/public/resources").then(async (e) => await e.json()).then((e) => ({
11
+ data: e.data.concat([
12
+ {
13
+ id: "inventory",
14
+ type: "resources",
15
+ attributes: {
16
+ fields: {
17
+ available: {
18
+ type: "boolean",
19
+ desc: "Indicates if the sku is available."
20
+ },
21
+ quantity: {
22
+ type: "integer",
23
+ desc: "The available stock quantity."
24
+ }
25
+ },
26
+ relationships: {}
27
+ }
28
+ }
29
+ ]).map((r) => r.id === "sku" ? (delete r.attributes.fields.inventory, {
30
+ ...r,
31
+ attributes: {
32
+ ...r.attributes,
33
+ relationships: {
34
+ ...r.attributes.relationships,
35
+ inventory: {
36
+ type: "has_one",
37
+ desc: "The associated inventory.",
38
+ required: "required",
39
+ creatable: !0,
40
+ updatable: !0,
41
+ filterable: !0,
42
+ sortable: !0,
43
+ parent_resource: "Api::SkuResource",
44
+ class_name: "Inventory"
45
+ }
46
+ }
47
+ }
48
+ }) : r)
49
+ })).then(
50
+ ({ data: e }) => e.reduce((r, i, s, a) => ({
51
+ ...r,
52
+ [i.id]: {
53
+ ...i,
54
+ fields: Object.entries(i.attributes.fields).filter(([u]) => !u.startsWith("_")),
55
+ relationships: Object.entries(i.attributes.relationships).filter(([u]) => !u.startsWith("_")).filter(
56
+ ([, u]) => e.find(
57
+ (o) => o.id === y(u.class_name)
58
+ ) != null
59
+ )
60
+ }
61
+ }), {})
62
+ ).catch((e) => {
63
+ throw e;
64
+ })), t;
65
+ };
66
+ })();
67
+ f(!1);
68
+ async function $(t, n) {
69
+ var i, s;
70
+ if (!new RegExp(`^(${t.join("|")})(.|$)`).test(n))
71
+ return t.map((a) => ({
72
+ value: a,
73
+ type: "relationship"
74
+ }));
75
+ const e = await v(n);
76
+ return [].concat(
77
+ ((i = e.resource) == null ? void 0 : i.fields.map(([a]) => ({
78
+ value: `${e.resourcePath}.${a}`,
79
+ type: "field"
80
+ }))) ?? []
81
+ ).concat(
82
+ ((s = e.resource) == null ? void 0 : s.relationships.map(([a]) => ({
83
+ value: `${e.resourcePath}.${a}`,
84
+ type: "relationship"
85
+ }))) ?? []
86
+ );
87
+ }
88
+ async function v(t, n) {
89
+ const e = await f(), r = t.replace(/\.$/, "").split("."), i = r.shift();
90
+ return n ?? (n = e[i ?? ""]), r.reduce(
91
+ (s, a) => {
92
+ var c, h, d, p;
93
+ const u = (h = (c = s.resource) == null ? void 0 : c.relationships.find(
94
+ ([l]) => l === a
95
+ )) == null ? void 0 : h[1].class_name;
96
+ if (u == null) {
97
+ const l = (p = (d = s.resource) == null ? void 0 : d.fields.find(([b]) => b === a)) == null ? void 0 : p[1];
98
+ return {
99
+ ...s,
100
+ field: l != null ? {
101
+ ...l,
102
+ name: a
103
+ } : void 0
104
+ };
105
+ }
106
+ const o = e[y(u)];
107
+ return o == null ? s : {
108
+ path: s.path,
109
+ resourcePath: `${s.resourcePath == null ? "" : `${s.resourcePath}.`}${a}`,
110
+ resource: o
111
+ };
112
+ },
113
+ {
114
+ path: t,
115
+ resourcePath: n != null ? i ?? "" : "",
116
+ resource: n
117
+ }
118
+ );
119
+ }
120
+ function y(t) {
121
+ return t.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toLowerCase();
122
+ }
123
+ export {
124
+ v as a,
125
+ $ as f
126
+ };
@@ -0,0 +1 @@
1
+ export declare function maskGiftCardCode(code?: string | null): string;
@@ -0,0 +1 @@
1
+ export {};