@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.
- package/dist/CodeEditorComponent-ioY-kydb.js +739 -0
- package/dist/{InputDateComponent-BB1cA4uH.js → InputDateComponent-BuVP44xp.js} +1174 -1301
- package/dist/RuleEngineComponent-CGOH-VpI.js +1376 -0
- package/dist/fetchCoreResourcesSuggestions-CZkDwjO2.js +126 -0
- package/dist/helpers/giftCards.d.ts +1 -0
- package/dist/helpers/giftCards.test.d.ts +1 -0
- package/dist/{main-DvygJyZL.js → main-Dncz1fnB.js} +8819 -8151
- package/dist/main.d.ts +3 -0
- package/dist/main.js +137 -133
- package/dist/parseISO-DFqToJvK.js +120 -0
- package/dist/style.css +1 -1
- package/dist/tailwind.config.js +5 -5
- package/dist/ui/atoms/Icon/icons.d.ts +5 -0
- package/dist/ui/composite/ListItem.d.ts +3 -1
- package/dist/ui/composite/Timeline.d.ts +1 -0
- package/dist/ui/composite/Toast.d.ts +8 -0
- package/dist/ui/forms/CodeEditor/CodeEditor.d.ts +2 -1
- package/dist/ui/forms/CodeEditor/CodeEditorComponent.d.ts +10 -1
- package/dist/ui/forms/CodeEditor/fetchCoreResourcesSuggestions.d.ts +34 -18
- package/dist/ui/forms/RuleEngine/Action/ActionListItem.d.ts +6 -0
- package/dist/ui/forms/RuleEngine/Action/ActionValue.d.ts +5 -0
- package/dist/ui/forms/RuleEngine/Action/index.d.ts +4 -0
- package/dist/ui/forms/RuleEngine/Condition/ConditionListItem.d.ts +8 -0
- package/dist/ui/forms/RuleEngine/Condition/ConditionMatcher.d.ts +6 -0
- package/dist/ui/forms/RuleEngine/Condition/ConditionValue.d.ts +12 -0
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputArrayMatch.d.ts +6 -0
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputNumberRange.d.ts +6 -0
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputTextRange.d.ts +6 -0
- package/dist/ui/forms/RuleEngine/Condition/hooks.d.ts +5 -0
- package/dist/ui/forms/RuleEngine/Condition/index.d.ts +8 -0
- package/dist/ui/forms/RuleEngine/Condition/utils.d.ts +3 -0
- package/dist/ui/forms/RuleEngine/RuleEngine.d.ts +3 -0
- package/dist/ui/forms/RuleEngine/RuleEngineComponent.d.ts +22 -0
- package/dist/ui/forms/RuleEngine/RuleEngineContext.d.ts +18 -0
- package/dist/ui/forms/RuleEngine/RuleName.d.ts +1 -0
- package/dist/ui/forms/RuleEngine/index.d.ts +2 -0
- package/dist/ui/forms/RuleEngine/schema.order_rules.d.ts +335 -0
- package/dist/ui/forms/RuleEngine/schema.price_rules.d.ts +286 -0
- package/dist/ui/forms/RuleEngine/utils.d.ts +24 -0
- package/dist/ui/internals/Overlay.d.ts +13 -0
- package/dist/ui/resources/ResourceLineItems/ResourceLineItems.mocks.d.ts +17 -0
- package/dist/ui/resources/ResourceListItem/ResourceListItem.mocks.d.ts +24 -0
- package/dist/vendor.css +1 -1
- package/package.json +6 -2
- 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 {};
|