@commercelayer/app-elements 0.2.0 → 0.3.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.
- package/LICENSE +1 -1
- package/README.md +15 -14
- package/dist/{InputDateComponent-926e5e6d.js → InputDateComponent-dee358c1.js} +1 -1
- package/dist/hooks/useOnBlurFromContainer.d.ts +9 -0
- package/dist/main-49356a73.js +41117 -0
- package/dist/main.d.ts +5 -6
- package/dist/main.js +140 -142
- package/dist/mocks/data/customers.d.ts +2 -0
- package/dist/providers/CoreSdkProvider/useCoreApi.d.ts +23 -0
- package/dist/providers/TokenProvider/TokenProvider.d.ts +12 -13
- package/dist/style.css +1 -1
- package/dist/ui/atoms/A.d.ts +1 -1
- package/dist/ui/atoms/Avatar.d.ts +3 -0
- package/dist/ui/atoms/AvatarLetter/AvatarLetter.d.ts +23 -0
- package/dist/ui/atoms/AvatarLetter/colors.d.ts +2 -0
- package/dist/ui/atoms/AvatarLetter/index.d.ts +1 -0
- package/dist/ui/atoms/Badge.d.ts +5 -6
- package/dist/ui/atoms/Button.d.ts +4 -3
- package/dist/ui/atoms/Card.d.ts +1 -0
- package/dist/ui/atoms/Container.d.ts +6 -8
- package/dist/ui/atoms/CopyToClipboard.d.ts +2 -4
- package/dist/ui/atoms/Hr.d.ts +5 -4
- package/dist/ui/atoms/Icon/Icon.d.ts +18 -0
- package/dist/ui/atoms/{Icon.d.ts → Icon/icons.d.ts} +1 -26
- package/dist/ui/atoms/Icon/index.d.ts +1 -0
- package/dist/ui/atoms/Progress.d.ts +9 -6
- package/dist/ui/atoms/RadialProgress.d.ts +7 -0
- package/dist/ui/atoms/Tag.d.ts +2 -2
- package/dist/ui/composite/{ActionButtons.d.ts → ActionButtons/ActionButtons.d.ts} +2 -2
- package/dist/ui/composite/ActionButtons/index.d.ts +1 -0
- package/dist/ui/composite/Dropdown/Dropdown.d.ts +16 -0
- package/dist/ui/{atoms/dropdown/DropdownMenuDivider.d.ts → composite/Dropdown/DropdownDivider.d.ts} +3 -3
- package/dist/ui/{atoms/dropdown/DropdownMenuItem.d.ts → composite/Dropdown/DropdownItem.d.ts} +3 -3
- package/dist/ui/{atoms/dropdown → composite/Dropdown}/DropdownMenu.d.ts +3 -3
- package/dist/ui/composite/Dropdown/index.d.ts +3 -0
- package/dist/ui/composite/ListDetails.d.ts +2 -2
- package/dist/ui/composite/SearchBar.d.ts +2 -2
- package/dist/ui/forms/Input/Input.d.ts +2 -2
- package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +3 -3
- package/dist/ui/forms/InputDate/InputDateComponent.d.ts +10 -10
- package/dist/ui/forms/InputReadonly.d.ts +4 -4
- package/dist/ui/forms/InputResourceGroup/InputResourceGroup.d.ts +1 -1
- package/dist/ui/forms/InputSelect/InputSelect.d.ts +1 -1
- package/dist/ui/internals/InputWrapper.d.ts +5 -5
- package/dist/ui/resources/ResourceAddress/ResourceAddress.d.ts +15 -0
- package/dist/ui/resources/ResourceAddress/ResourceAddress.mocks.d.ts +38 -0
- package/dist/ui/resources/ResourceAddress/ResourceAddressForm.d.ts +48 -0
- package/dist/ui/resources/ResourceAddress/index.d.ts +1 -0
- package/dist/ui/resources/ResourceLineItems/ResourceLineItems.d.ts +15 -0
- package/dist/ui/resources/{ResourceLineItems.mocks.d.ts → ResourceLineItems/ResourceLineItems.mocks.d.ts} +18 -0
- package/dist/ui/resources/ResourceLineItems/index.d.ts +1 -0
- package/dist/ui/resources/ResourceMetadata/ResourceMetadata.d.ts +22 -0
- package/dist/ui/resources/ResourceMetadata/ResourceMetadata.test.d.ts +1 -0
- package/dist/ui/resources/ResourceMetadata/ResourceMetadataForm.d.ts +14 -0
- package/dist/ui/resources/ResourceMetadata/index.d.ts +1 -0
- package/dist/ui/resources/ResourceTags.d.ts +12 -0
- package/dist/ui/resources/useResourceFilters/types.d.ts +2 -2
- package/dist/utils/array.d.ts +10 -0
- package/dist/utils/text.d.ts +5 -2
- package/package.json +2 -1
- package/dist/main-d208b3aa.js +0 -29029
- package/dist/ui/atoms/AvatarLetter.d.ts +0 -16
- package/dist/ui/atoms/BlockCode.d.ts +0 -12
- package/dist/ui/atoms/dropdown/index.d.ts +0 -3
- package/dist/ui/composite/ContextMenu.d.ts +0 -10
- package/dist/ui/forms/InputMetadata/HookedInputMetadata.d.ts +0 -19
- package/dist/ui/forms/InputMetadata/index.d.ts +0 -1
- package/dist/ui/resources/ResourceLineItems.d.ts +0 -12
- package/dist/ui/resources/ResourceListItemsMetadata.d.ts +0 -6
- /package/dist/ui/atoms/{AvatarLetter.test.d.ts → AvatarLetter/AvatarLetter.test.d.ts} +0 -0
- /package/dist/ui/atoms/{BlockCode.test.d.ts → AvatarLetter/colors.test.d.ts} +0 -0
- /package/dist/ui/atoms/{Icon.test.d.ts → Icon/Icon.test.d.ts} +0 -0
- /package/dist/ui/composite/{ActionButtons.test.d.ts → ActionButtons/ActionButtons.test.d.ts} +0 -0
- /package/dist/ui/resources/{ResourceLineItems.test.d.ts → ResourceAddress/ResourceAddress.test.d.ts} +0 -0
- /package/dist/ui/resources/{ResourceListItemsMetadata.test.d.ts → ResourceLineItems/ResourceLineItems.test.d.ts} +0 -0
package/dist/main.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export { getAvatarSrcFromRate, getParcelTrackingDetail, getParcelTrackingDetails
|
|
|
8
8
|
export { useClickAway } from './hooks/useClickAway';
|
|
9
9
|
export { useDelayShow } from './hooks/useDelayShow';
|
|
10
10
|
export { useIsChanged } from './hooks/useIsChanged';
|
|
11
|
+
export { useOnBlurFromContainer } from './hooks/useOnBlurFromContainer';
|
|
11
12
|
export { useOverlay } from './hooks/useOverlay';
|
|
12
13
|
export { CoreSdkProvider, useCoreApi, useCoreSdkProvider } from './providers/CoreSdkProvider';
|
|
13
14
|
export { ErrorBoundary } from './providers/ErrorBoundary';
|
|
@@ -16,7 +17,6 @@ export { A } from './ui/atoms/A';
|
|
|
16
17
|
export { Avatar } from './ui/atoms/Avatar';
|
|
17
18
|
export { AvatarLetter } from './ui/atoms/AvatarLetter';
|
|
18
19
|
export { Badge, badgeVariants } from './ui/atoms/Badge';
|
|
19
|
-
export { BlockCode } from './ui/atoms/BlockCode';
|
|
20
20
|
export { Button } from './ui/atoms/Button';
|
|
21
21
|
export { ButtonFilter } from './ui/atoms/ButtonFilter';
|
|
22
22
|
export { Card } from './ui/atoms/Card';
|
|
@@ -26,7 +26,7 @@ export { EmptyState } from './ui/atoms/EmptyState';
|
|
|
26
26
|
export { Grid } from './ui/atoms/Grid';
|
|
27
27
|
export { Hint } from './ui/atoms/Hint';
|
|
28
28
|
export { Hr } from './ui/atoms/Hr';
|
|
29
|
-
export { Icon,
|
|
29
|
+
export { Icon, type IconProps } from './ui/atoms/Icon';
|
|
30
30
|
export { PageHeading } from './ui/atoms/PageHeading';
|
|
31
31
|
export { Pagination } from './ui/atoms/Pagination';
|
|
32
32
|
export { Progress } from './ui/atoms/Progress';
|
|
@@ -42,10 +42,9 @@ export { Table, Td, Th, Tr } from './ui/atoms/Table';
|
|
|
42
42
|
export { Tab, Tabs } from './ui/atoms/Tabs';
|
|
43
43
|
export { Tag } from './ui/atoms/Tag';
|
|
44
44
|
export { Text } from './ui/atoms/Text';
|
|
45
|
-
export { DropdownMenu, DropdownMenuDivider, DropdownMenuItem } from './ui/atoms/dropdown';
|
|
46
45
|
export { ActionButtons } from './ui/composite/ActionButtons';
|
|
47
46
|
export { CardDialog } from './ui/composite/CardDialog';
|
|
48
|
-
export {
|
|
47
|
+
export { Dropdown, DropdownDivider, DropdownItem } from './ui/composite/Dropdown';
|
|
49
48
|
export { List } from './ui/composite/List';
|
|
50
49
|
export { ListDetails } from './ui/composite/ListDetails';
|
|
51
50
|
export { ListDetailsItem } from './ui/composite/ListDetailsItem';
|
|
@@ -68,7 +67,6 @@ export { HookedInputDateRange, InputDateRange } from './ui/forms/InputDateRange'
|
|
|
68
67
|
export { InputFeedback } from './ui/forms/InputFeedback';
|
|
69
68
|
export { InputFile } from './ui/forms/InputFile';
|
|
70
69
|
export { InputJson } from './ui/forms/InputJson';
|
|
71
|
-
export { HookedInputMetadata } from './ui/forms/InputMetadata';
|
|
72
70
|
export { InputRadioGroup } from './ui/forms/InputRadioGroup';
|
|
73
71
|
export { InputReadonly } from './ui/forms/InputReadonly';
|
|
74
72
|
export { HookedInputResourceGroup, InputResourceGroup } from './ui/forms/InputResourceGroup';
|
|
@@ -81,10 +79,11 @@ export { HookedInputToggleButton, InputToggleButton, type InputToggleButtonProps
|
|
|
81
79
|
export { Label } from './ui/forms/Label';
|
|
82
80
|
export { Legend } from './ui/forms/Legend';
|
|
83
81
|
export { HookedValidationApiError, HookedValidationError, setApiFormErrors, useValidationFeedback } from './ui/forms/ReactHookForm';
|
|
82
|
+
export { ResourceAddress } from './ui/resources/ResourceAddress';
|
|
84
83
|
export { ResourceLineItems } from './ui/resources/ResourceLineItems';
|
|
85
84
|
export { ResourceList } from './ui/resources/ResourceList';
|
|
86
85
|
export { ResourceListItem } from './ui/resources/ResourceListItem';
|
|
87
|
-
export {
|
|
86
|
+
export { ResourceMetadata } from './ui/resources/ResourceMetadata';
|
|
88
87
|
export { ResourceOrderSummary } from './ui/resources/ResourceOrderSummary';
|
|
89
88
|
export { ResourceOrderTimeline } from './ui/resources/ResourceOrderTimeline';
|
|
90
89
|
export { ResourceShipmentParcels } from './ui/resources/ResourceShipmentParcels';
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ao as u, aY as i, ap as b, aq as p, ar as l, at as c, au as d, av as g, aZ as m, aw as S, ax as I, ah as k, a_ as T, a$ as D, b0 as R, ay as y, ak as C, az as A, aA as h, bc as H, bd as P, bf as F, bi as B, bm as L, bo as O, bv as V, bx as f, bE as v, bG as N, bI as w, bL as E, bP as G, bQ as x, aB as M, aC as J, be as U, bg as W, bh as X, bj as Y, bl as Z, bn as $, bp as j, bq as q, br as z, bs as K, bt as Q, bu as _, bw as aa, by as ea, bF as sa, bH as ta, bJ as ra, bK as oa, bM as na, bN as ua, bO as ia, b1 as ba, b2 as pa, b3 as la, b4 as ca, al as da, b5 as ga, aD as ma, b6 as Sa, b7 as Ia, aE as ka, aF as Ta, aG as Da, b8 as Ra, bT as ya, bU as Ca, bV as Aa, bW as ha, bX as Ha, bY as Pa, bZ as Fa, b_ as Ba, b$ as La, b9 as Oa, aH as Va, aI as fa, aJ as va, aK as Na, aM as wa, aN as Ea, aO as Ga, aP as xa, aU as Ma, aQ as Ja, ba as Ua, aV as Wa, aW as Xa, aR as Ya, aX as Za, aS as $a, bb as ja, am as qa, aT as za, as as Ka, a2 as Qa, a1 as _a, bz as ae, bk as ee, X as se, a3 as te, a4 as re, a5 as oe, c1 as ne, c2 as ue, bA as ie, Y as be, Z as pe, c3 as le, c4 as ce, c5 as de, c6 as ge, c7 as me, c8 as Se, a6 as Ie, a7 as ke, c9 as Te, ca as De, cb as Re, a8 as ye, a9 as Ce, T as Ae, aa as he, ab as He, V as Pe, bB as Fe, bC as Be, bD as Le, U as Oe, W as Ve, bR as fe, $ as ve, a0 as Ne, ac as we, ai as Ee, aj as Ge, ad as xe, ae as Me, af as Je, ag as Ue, c0 as We, an as Xe, bS as Ye, aL as Ze } from "./main-49356a73.js";
|
|
2
2
|
import "react";
|
|
3
3
|
import "react-dom";
|
|
4
4
|
import "@commercelayer/sdk";
|
|
@@ -9,150 +9,148 @@ export {
|
|
|
9
9
|
i as ActionButtons,
|
|
10
10
|
b as Avatar,
|
|
11
11
|
p as AvatarLetter,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
d as
|
|
15
|
-
g as
|
|
16
|
-
m as
|
|
17
|
-
S as
|
|
18
|
-
I as
|
|
19
|
-
k as
|
|
20
|
-
T as
|
|
21
|
-
D as
|
|
22
|
-
R as
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
H as EmptyState,
|
|
26
|
-
h as ErrorBoundary,
|
|
12
|
+
l as Badge,
|
|
13
|
+
c as Button,
|
|
14
|
+
d as ButtonFilter,
|
|
15
|
+
g as Card,
|
|
16
|
+
m as CardDialog,
|
|
17
|
+
S as Container,
|
|
18
|
+
I as CopyToClipboard,
|
|
19
|
+
k as CoreSdkProvider,
|
|
20
|
+
T as Dropdown,
|
|
21
|
+
D as DropdownDivider,
|
|
22
|
+
R as DropdownItem,
|
|
23
|
+
y as EmptyState,
|
|
24
|
+
C as ErrorBoundary,
|
|
27
25
|
A as Grid,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
E as
|
|
41
|
-
G as
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
26
|
+
h as Hint,
|
|
27
|
+
H as HookedForm,
|
|
28
|
+
P as HookedInput,
|
|
29
|
+
F as HookedInputCheckbox,
|
|
30
|
+
B as HookedInputCurrency,
|
|
31
|
+
L as HookedInputDate,
|
|
32
|
+
O as HookedInputDateRange,
|
|
33
|
+
V as HookedInputResourceGroup,
|
|
34
|
+
f as HookedInputSelect,
|
|
35
|
+
v as HookedInputSimpleSelect,
|
|
36
|
+
N as HookedInputSpinner,
|
|
37
|
+
w as HookedInputSwitch,
|
|
38
|
+
E as HookedInputToggleButton,
|
|
39
|
+
G as HookedValidationApiError,
|
|
40
|
+
x as HookedValidationError,
|
|
41
|
+
M as Hr,
|
|
42
|
+
J as Icon,
|
|
43
|
+
U as Input,
|
|
44
|
+
W as InputCheckbox,
|
|
45
|
+
X as InputCheckboxGroup,
|
|
46
|
+
Y as InputCurrency,
|
|
47
|
+
Z as InputCurrencyRange,
|
|
48
|
+
$ as InputDate,
|
|
49
|
+
j as InputDateRange,
|
|
50
|
+
q as InputFeedback,
|
|
51
|
+
z as InputFile,
|
|
52
|
+
K as InputJson,
|
|
53
|
+
Q as InputRadioGroup,
|
|
54
|
+
_ as InputReadonly,
|
|
55
|
+
aa as InputResourceGroup,
|
|
56
|
+
ea as InputSelect,
|
|
57
|
+
sa as InputSimpleSelect,
|
|
58
|
+
ta as InputSpinner,
|
|
59
|
+
ra as InputSwitch,
|
|
60
|
+
oa as InputTextArea,
|
|
61
|
+
na as InputToggleButton,
|
|
62
|
+
ua as Label,
|
|
63
|
+
ia as Legend,
|
|
64
|
+
ba as List,
|
|
65
|
+
pa as ListDetails,
|
|
66
|
+
la as ListDetailsItem,
|
|
67
|
+
ca as ListItem,
|
|
68
|
+
da as MetaTags,
|
|
69
|
+
ga as PageError,
|
|
70
|
+
ma as PageHeading,
|
|
71
|
+
Sa as PageLayout,
|
|
72
|
+
Ia as PageSkeleton,
|
|
73
|
+
ka as Pagination,
|
|
74
|
+
Ta as Progress,
|
|
75
|
+
Da as RadialProgress,
|
|
76
|
+
Ra as Report,
|
|
77
|
+
ya as ResourceAddress,
|
|
78
|
+
Ca as ResourceLineItems,
|
|
81
79
|
Aa as ResourceList,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
ha as ResourceListItem,
|
|
81
|
+
Ha as ResourceMetadata,
|
|
82
|
+
Pa as ResourceOrderSummary,
|
|
83
|
+
Fa as ResourceOrderTimeline,
|
|
84
|
+
Ba as ResourceShipmentParcels,
|
|
85
|
+
La as ResourceTags,
|
|
86
|
+
Oa as SearchBar,
|
|
87
|
+
Va as Section,
|
|
88
|
+
fa as Skeleton,
|
|
89
|
+
va as SkeletonItem,
|
|
90
|
+
Na as SkeletonTemplate,
|
|
91
|
+
wa as Spacer,
|
|
94
92
|
Ea as Stack,
|
|
95
93
|
Ga as StatusDot,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
94
|
+
xa as Steps,
|
|
95
|
+
Ma as Tab,
|
|
96
|
+
Ja as Table,
|
|
97
|
+
Ua as TableData,
|
|
98
|
+
Wa as Tabs,
|
|
99
|
+
Xa as Tag,
|
|
100
|
+
Ya as Td,
|
|
101
|
+
Za as Text,
|
|
102
|
+
$a as Th,
|
|
103
|
+
ja as Timeline,
|
|
104
|
+
qa as TokenProvider,
|
|
105
|
+
za as Tr,
|
|
106
|
+
Ka as badgeVariants,
|
|
107
|
+
Qa as computeFullname,
|
|
108
|
+
_a as downloadJsonAsFile,
|
|
109
|
+
ae as flatSelectValues,
|
|
110
|
+
ee as formatCentsToCurrency,
|
|
111
|
+
se as formatDate,
|
|
112
|
+
te as formatDisplayName,
|
|
113
|
+
re as formatResourceName,
|
|
114
|
+
oe as getAvatarSrcFromRate,
|
|
115
|
+
ne as getCustomerDisplayStatus,
|
|
116
|
+
ue as getCustomerStatusName,
|
|
117
|
+
ie as getDefaultValueFromFlatten,
|
|
118
|
+
be as getIsoDateAtDayEdge,
|
|
119
|
+
pe as getIsoDateAtDaysBefore,
|
|
120
|
+
le as getOrderDisplayStatus,
|
|
121
|
+
ce as getOrderFulfillmentStatusName,
|
|
122
|
+
de as getOrderPaymentStatusName,
|
|
123
|
+
ge as getOrderStatusName,
|
|
124
|
+
me as getOrderTransactionPastTense,
|
|
125
|
+
Se as getOrderTriggerAttributeName,
|
|
126
|
+
Ie as getParcelTrackingDetail,
|
|
127
|
+
ke as getParcelTrackingDetails,
|
|
128
|
+
Te as getReturnDisplayStatus,
|
|
129
|
+
De as getReturnStatusName,
|
|
130
|
+
Re as getReturnTriggerAttributeName,
|
|
131
|
+
ye as getShipmentRate,
|
|
132
|
+
Ce as getShipmentRates,
|
|
135
133
|
Ae as goBack,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Ee as
|
|
149
|
-
Ge as
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
134
|
+
he as hasBeenPurchased,
|
|
135
|
+
He as hasSingleTracking,
|
|
136
|
+
Pe as isAttachmentValidNote,
|
|
137
|
+
Fe as isGroupedSelectValues,
|
|
138
|
+
Be as isMultiValueSelected,
|
|
139
|
+
Le as isSingleValueSelected,
|
|
140
|
+
Oe as navigateTo,
|
|
141
|
+
Ve as referenceOrigins,
|
|
142
|
+
fe as setApiFormErrors,
|
|
143
|
+
ve as sortAndGroupByDate,
|
|
144
|
+
Ne as timeSeparator,
|
|
145
|
+
we as useClickAway,
|
|
146
|
+
Ee as useCoreApi,
|
|
147
|
+
Ge as useCoreSdkProvider,
|
|
148
|
+
xe as useDelayShow,
|
|
149
|
+
Me as useIsChanged,
|
|
150
|
+
Je as useOnBlurFromContainer,
|
|
151
|
+
Ue as useOverlay,
|
|
152
|
+
We as useResourceFilters,
|
|
153
|
+
Xe as useTokenProvider,
|
|
154
|
+
Ye as useValidationFeedback,
|
|
155
|
+
Ze as withSkeletonTemplate
|
|
158
156
|
};
|
|
@@ -4,5 +4,28 @@ import { type Fetcher, type SWRConfiguration, type SWRResponse } from 'swr';
|
|
|
4
4
|
import { type ConditionalKeys } from 'type-fest';
|
|
5
5
|
type GenericMethod = (...args: any) => Promise<any>;
|
|
6
6
|
type ForceToBeMethod<Method> = Method extends GenericMethod ? Method : GenericMethod;
|
|
7
|
+
/**
|
|
8
|
+
* This hook performs api request base on [`@commercelayer/sdk`](https://github.com/commercelayer/commercelayer-sdk) and [`swr`](https://swr.vercel.app/).
|
|
9
|
+
*
|
|
10
|
+
* This is an example of getting the order with id `1234`.
|
|
11
|
+
*
|
|
12
|
+
* If you're used to use our sdk you can write:
|
|
13
|
+
* ```ts
|
|
14
|
+
* const order = await client.orders.retrieve('1234')
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* With `useCoreApi` you'll write instead:
|
|
18
|
+
* ```ts
|
|
19
|
+
* const {
|
|
20
|
+
* data: order,
|
|
21
|
+
* isLoading
|
|
22
|
+
* } = useCoreApi('orders', 'retrieve', ['1234'])
|
|
23
|
+
* ```
|
|
24
|
+
* @param resource Resource type
|
|
25
|
+
* @param action Related resource action
|
|
26
|
+
* @param args Action arguments
|
|
27
|
+
* @param config SWR options
|
|
28
|
+
* @returns SWR response
|
|
29
|
+
*/
|
|
7
30
|
export declare function useCoreApi<Resource extends ResourceTypeLock, Action extends ConditionalKeys<CommerceLayerClient[Resource], GenericMethod>, Method extends ForceToBeMethod<CommerceLayerClient[Resource][Action]>, Args extends Parameters<Method>, Output extends Awaited<ReturnType<Method>>, SWROptions extends SWRConfiguration<Output, any, Fetcher<Output>>>(resource: Resource, action: Action, args: Args | null, config?: SWROptions): SWRResponse<Output, any, SWROptions>;
|
|
8
31
|
export {};
|
|
@@ -14,23 +14,30 @@ export interface TokenProviderValue {
|
|
|
14
14
|
}
|
|
15
15
|
export interface TokenProviderProps {
|
|
16
16
|
/**
|
|
17
|
-
* Token kind (will be validated)
|
|
18
|
-
*
|
|
17
|
+
* Token kind (will be validated).
|
|
18
|
+
* For example: `integration`, `sales_channel` or `webapp` but also `imports` or `orders` in case of dashboard-generated token.
|
|
19
19
|
*/
|
|
20
20
|
kind: TokenProviderTokenApplicationKind;
|
|
21
21
|
/**
|
|
22
22
|
* Slug of the current app. It needs to match one of the allowed app slugs enabled in the dashboard.
|
|
23
|
-
* Example: `orders`, `imports`, `exports`, `shipments`, `webhooks`, `returns`
|
|
24
23
|
* Will be used to persist token for current app only.
|
|
25
24
|
*/
|
|
26
25
|
appSlug: TokenProviderAllowedApp;
|
|
27
26
|
/**
|
|
28
|
-
*
|
|
27
|
+
* Skip domain slug validation when is dev mode
|
|
28
|
+
*/
|
|
29
|
+
devMode: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Entire app content
|
|
32
|
+
*/
|
|
33
|
+
children: ((props: TokenProviderValue) => ReactNode) | ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Required when application is running as self-hosted.
|
|
29
36
|
* It's used to perform a security check to test the validity of token against current organization.
|
|
30
37
|
*/
|
|
31
38
|
organizationSlug?: string;
|
|
32
39
|
/**
|
|
33
|
-
* Base domain to be used for Commerce Layer API requests (
|
|
40
|
+
* Base domain to be used for Commerce Layer API requests (e.g. `commercelayer.io`)
|
|
34
41
|
*/
|
|
35
42
|
domain?: string;
|
|
36
43
|
/**
|
|
@@ -53,19 +60,11 @@ export interface TokenProviderProps {
|
|
|
53
60
|
* Element to display in case of invalid token
|
|
54
61
|
*/
|
|
55
62
|
errorElement?: ReactNode;
|
|
56
|
-
/**
|
|
57
|
-
* skip domain slug validation when is dev mode
|
|
58
|
-
*/
|
|
59
|
-
devMode: boolean;
|
|
60
63
|
/**
|
|
61
64
|
* Optional. In case you already have an access token, this will skip the retrieval of token from URL or localStorage.
|
|
62
65
|
* When undefined (default scenario), token is expected to be retrieved from `?accessToken=xxxx` query string or localStorage (in this order).
|
|
63
66
|
*/
|
|
64
67
|
accessToken?: string;
|
|
65
|
-
/**
|
|
66
|
-
* Entire app content
|
|
67
|
-
*/
|
|
68
|
-
children: ((props: TokenProviderValue) => ReactNode) | ReactNode;
|
|
69
68
|
}
|
|
70
69
|
export declare const AuthContext: import("react").Context<TokenProviderValue>;
|
|
71
70
|
export declare const useTokenProvider: () => TokenProviderValue;
|