@commercelayer/app-elements 0.2.1 → 0.3.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 (59) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +15 -14
  3. package/dist/{InputDateComponent-63c12bde.js → InputDateComponent-a5946691.js} +1 -1
  4. package/dist/hooks/useOnBlurFromContainer.d.ts +9 -0
  5. package/dist/main-fea1a0e6.js +41114 -0
  6. package/dist/main.d.ts +4 -4
  7. package/dist/main.js +138 -139
  8. package/dist/providers/CoreSdkProvider/useCoreApi.d.ts +23 -0
  9. package/dist/providers/TokenProvider/TokenProvider.d.ts +12 -13
  10. package/dist/style.css +1 -1
  11. package/dist/ui/atoms/Avatar.d.ts +3 -0
  12. package/dist/ui/atoms/AvatarLetter/AvatarLetter.d.ts +23 -0
  13. package/dist/ui/atoms/AvatarLetter/colors.d.ts +2 -0
  14. package/dist/ui/atoms/AvatarLetter/index.d.ts +1 -0
  15. package/dist/ui/atoms/Badge.d.ts +5 -6
  16. package/dist/ui/atoms/Button.d.ts +4 -3
  17. package/dist/ui/atoms/Card.d.ts +1 -0
  18. package/dist/ui/atoms/Container.d.ts +6 -8
  19. package/dist/ui/atoms/CopyToClipboard.d.ts +2 -4
  20. package/dist/ui/atoms/Hr.d.ts +5 -4
  21. package/dist/ui/atoms/Icon/Icon.d.ts +18 -0
  22. package/dist/ui/atoms/{Icon.d.ts → Icon/icons.d.ts} +1 -26
  23. package/dist/ui/atoms/Icon/index.d.ts +1 -0
  24. package/dist/ui/atoms/Progress.d.ts +9 -6
  25. package/dist/ui/atoms/Tag.d.ts +2 -2
  26. package/dist/ui/composite/{ActionButtons.d.ts → ActionButtons/ActionButtons.d.ts} +2 -2
  27. package/dist/ui/composite/ActionButtons/index.d.ts +1 -0
  28. package/dist/ui/composite/Dropdown/Dropdown.d.ts +16 -0
  29. package/dist/ui/{atoms/dropdown/DropdownMenuDivider.d.ts → composite/Dropdown/DropdownDivider.d.ts} +3 -3
  30. package/dist/ui/{atoms/dropdown/DropdownMenuItem.d.ts → composite/Dropdown/DropdownItem.d.ts} +3 -3
  31. package/dist/ui/{atoms/dropdown → composite/Dropdown}/DropdownMenu.d.ts +3 -3
  32. package/dist/ui/composite/Dropdown/index.d.ts +3 -0
  33. package/dist/ui/composite/ListDetails.d.ts +2 -2
  34. package/dist/ui/forms/Input/Input.d.ts +2 -2
  35. package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +3 -3
  36. package/dist/ui/forms/InputDate/InputDateComponent.d.ts +10 -10
  37. package/dist/ui/forms/InputReadonly.d.ts +4 -4
  38. package/dist/ui/forms/InputSelect/InputSelect.d.ts +1 -1
  39. package/dist/ui/internals/InputWrapper.d.ts +5 -5
  40. package/dist/ui/resources/ResourceAddress/ResourceAddress.d.ts +15 -0
  41. package/dist/ui/resources/ResourceAddress/ResourceAddress.mocks.d.ts +38 -0
  42. package/dist/ui/resources/ResourceAddress/ResourceAddress.test.d.ts +1 -0
  43. package/dist/ui/resources/ResourceAddress/ResourceAddressForm.d.ts +48 -0
  44. package/dist/ui/resources/ResourceAddress/index.d.ts +1 -0
  45. package/dist/ui/resources/ResourceLineItems/ResourceLineItems.d.ts +3 -0
  46. package/dist/ui/resources/ResourceTags.d.ts +12 -0
  47. package/dist/ui/resources/useResourceFilters/types.d.ts +2 -2
  48. package/dist/utils/array.d.ts +10 -0
  49. package/dist/utils/text.d.ts +5 -2
  50. package/package.json +2 -1
  51. package/dist/main-ef0d4ef2.js +0 -29113
  52. package/dist/ui/atoms/AvatarLetter.d.ts +0 -16
  53. package/dist/ui/atoms/BlockCode.d.ts +0 -12
  54. package/dist/ui/atoms/dropdown/index.d.ts +0 -3
  55. package/dist/ui/composite/ContextMenu.d.ts +0 -10
  56. /package/dist/ui/atoms/{AvatarLetter.test.d.ts → AvatarLetter/AvatarLetter.test.d.ts} +0 -0
  57. /package/dist/ui/atoms/{BlockCode.test.d.ts → AvatarLetter/colors.test.d.ts} +0 -0
  58. /package/dist/ui/atoms/{Icon.test.d.ts → Icon/Icon.test.d.ts} +0 -0
  59. /package/dist/ui/composite/{ActionButtons.test.d.ts → ActionButtons/ActionButtons.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, iconNames } from './ui/atoms/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 { ContextMenu } from './ui/composite/ContextMenu';
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';
@@ -80,6 +79,7 @@ export { HookedInputToggleButton, InputToggleButton, type InputToggleButtonProps
80
79
  export { Label } from './ui/forms/Label';
81
80
  export { Legend } from './ui/forms/Legend';
82
81
  export { HookedValidationApiError, HookedValidationError, setApiFormErrors, useValidationFeedback } from './ui/forms/ReactHookForm';
82
+ export { ResourceAddress } from './ui/resources/ResourceAddress';
83
83
  export { ResourceLineItems } from './ui/resources/ResourceLineItems';
84
84
  export { ResourceList } from './ui/resources/ResourceList';
85
85
  export { ResourceListItem } from './ui/resources/ResourceListItem';
package/dist/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import { an as u, b0 as i, ao as b, ap as p, aq as l, as as c, at as d, au as g, av as m, b1 as S, aw as I, b2 as k, ax as T, ag as D, aZ as R, a_ as C, a$ as y, ay as h, aj as A, az as H, aA as P, be as B, bf as F, bh as L, bk as N, bo as V, bq as f, bx as v, bz as O, bG as w, bI as x, bK as E, bN as G, bR as M, bS as J, aB as U, aC as W, bg as X, bi as Y, bj as Z, bl as $, bn as j, bp as q, br as z, bs as K, bt as Q, bu as _, bv as aa, bw as ea, by as sa, bA as ta, bH as ra, bJ as oa, bL as na, bM as ua, bO as ia, bP as ba, bQ as pa, b3 as la, b4 as ca, b5 as da, b6 as ga, ak as ma, b7 as Sa, aE as Ia, b8 as ka, b9 as Ta, aF as Da, aG as Ra, aH as Ca, ba as ya, bV as ha, bW as Aa, bX as Ha, bY as Pa, bZ as Ba, b_ as Fa, b$ as La, c0 as Na, bb as Va, aI as fa, aJ as va, aK as Oa, aL as wa, aN as xa, aO as Ea, aP as Ga, aQ as Ma, aV as Ja, aR as Ua, bc as Wa, aW as Xa, aX as Ya, aS as Za, aY as $a, aT as ja, bd as qa, al as za, aU as Ka, ar as Qa, a2 as _a, a1 as ae, bB as ee, bm as se, X as te, a3 as re, a4 as oe, a5 as ne, c2 as ue, c3 as ie, bC as be, Y as pe, Z as le, c4 as ce, c5 as de, c6 as ge, c7 as me, c8 as Se, c9 as Ie, a6 as ke, a7 as Te, ca as De, cb as Re, cc as Ce, a8 as ye, a9 as he, T as Ae, aa as He, ab as Pe, aD as Be, V as Fe, bD as Le, bE as Ne, bF as Ve, U as fe, W as ve, bT as Oe, $ as we, a0 as xe, ac as Ee, ah as Ge, ai as Me, ad as Je, ae as Ue, af as We, c1 as Xe, am as Ye, bU as Ze, aM as $e } from "./main-ef0d4ef2.js";
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-fea1a0e6.js";
2
2
  import "react";
3
3
  import "react-dom";
4
4
  import "@commercelayer/sdk";
@@ -10,148 +10,147 @@ export {
10
10
  b as Avatar,
11
11
  p as AvatarLetter,
12
12
  l as Badge,
13
- c as BlockCode,
14
- d as Button,
15
- g as ButtonFilter,
16
- m as Card,
17
- S as CardDialog,
18
- I as Container,
19
- k as ContextMenu,
20
- T as CopyToClipboard,
21
- D as CoreSdkProvider,
22
- R as DropdownMenu,
23
- C as DropdownMenuDivider,
24
- y as DropdownMenuItem,
25
- h as EmptyState,
26
- A as ErrorBoundary,
27
- H as Grid,
28
- P as Hint,
29
- B as HookedForm,
30
- F as HookedInput,
31
- L as HookedInputCheckbox,
32
- N as HookedInputCurrency,
33
- V as HookedInputDate,
34
- f as HookedInputDateRange,
35
- v as HookedInputResourceGroup,
36
- O as HookedInputSelect,
37
- w as HookedInputSimpleSelect,
38
- x as HookedInputSpinner,
39
- E as HookedInputSwitch,
40
- G as HookedInputToggleButton,
41
- M as HookedValidationApiError,
42
- J as HookedValidationError,
43
- U as Hr,
44
- W as Icon,
45
- X as Input,
46
- Y as InputCheckbox,
47
- Z as InputCheckboxGroup,
48
- $ as InputCurrency,
49
- j as InputCurrencyRange,
50
- q as InputDate,
51
- z as InputDateRange,
52
- K as InputFeedback,
53
- Q as InputFile,
54
- _ as InputJson,
55
- aa as InputRadioGroup,
56
- ea as InputReadonly,
57
- sa as InputResourceGroup,
58
- ta as InputSelect,
59
- ra as InputSimpleSelect,
60
- oa as InputSpinner,
61
- na as InputSwitch,
62
- ua as InputTextArea,
63
- ia as InputToggleButton,
64
- ba as Label,
65
- pa as Legend,
66
- la as List,
67
- ca as ListDetails,
68
- da as ListDetailsItem,
69
- ga as ListItem,
70
- ma as MetaTags,
71
- Sa as PageError,
72
- Ia as PageHeading,
73
- ka as PageLayout,
74
- Ta as PageSkeleton,
75
- Da as Pagination,
76
- Ra as Progress,
77
- Ca as RadialProgress,
78
- ya as Report,
79
- ha as ResourceLineItems,
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,
25
+ A as Grid,
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,
80
79
  Aa as ResourceList,
81
- Ha as ResourceListItem,
82
- Pa as ResourceMetadata,
83
- Ba as ResourceOrderSummary,
80
+ ha as ResourceListItem,
81
+ Ha as ResourceMetadata,
82
+ Pa as ResourceOrderSummary,
84
83
  Fa as ResourceOrderTimeline,
85
- La as ResourceShipmentParcels,
86
- Na as ResourceTags,
87
- Va as SearchBar,
88
- fa as Section,
89
- va as Skeleton,
90
- Oa as SkeletonItem,
91
- wa as SkeletonTemplate,
92
- xa as Spacer,
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,
93
92
  Ea as Stack,
94
93
  Ga as StatusDot,
95
- Ma as Steps,
96
- Ja as Tab,
97
- Ua as Table,
98
- Wa as TableData,
99
- Xa as Tabs,
100
- Ya as Tag,
101
- Za as Td,
102
- $a as Text,
103
- ja as Th,
104
- qa as Timeline,
105
- za as TokenProvider,
106
- Ka as Tr,
107
- Qa as badgeVariants,
108
- _a as computeFullname,
109
- ae as downloadJsonAsFile,
110
- ee as flatSelectValues,
111
- se as formatCentsToCurrency,
112
- te as formatDate,
113
- re as formatDisplayName,
114
- oe as formatResourceName,
115
- ne as getAvatarSrcFromRate,
116
- ue as getCustomerDisplayStatus,
117
- ie as getCustomerStatusName,
118
- be as getDefaultValueFromFlatten,
119
- pe as getIsoDateAtDayEdge,
120
- le as getIsoDateAtDaysBefore,
121
- ce as getOrderDisplayStatus,
122
- de as getOrderFulfillmentStatusName,
123
- ge as getOrderPaymentStatusName,
124
- me as getOrderStatusName,
125
- Se as getOrderTransactionPastTense,
126
- Ie as getOrderTriggerAttributeName,
127
- ke as getParcelTrackingDetail,
128
- Te as getParcelTrackingDetails,
129
- De as getReturnDisplayStatus,
130
- Re as getReturnStatusName,
131
- Ce as getReturnTriggerAttributeName,
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,
132
131
  ye as getShipmentRate,
133
- he as getShipmentRates,
132
+ Ce as getShipmentRates,
134
133
  Ae as goBack,
135
- He as hasBeenPurchased,
136
- Pe as hasSingleTracking,
137
- Be as iconNames,
138
- Fe as isAttachmentValidNote,
139
- Le as isGroupedSelectValues,
140
- Ne as isMultiValueSelected,
141
- Ve as isSingleValueSelected,
142
- fe as navigateTo,
143
- ve as referenceOrigins,
144
- Oe as setApiFormErrors,
145
- we as sortAndGroupByDate,
146
- xe as timeSeparator,
147
- Ee as useClickAway,
148
- Ge as useCoreApi,
149
- Me as useCoreSdkProvider,
150
- Je as useDelayShow,
151
- Ue as useIsChanged,
152
- We as useOverlay,
153
- Xe as useResourceFilters,
154
- Ye as useTokenProvider,
155
- Ze as useValidationFeedback,
156
- $e as withSkeletonTemplate
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
157
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
- * Eg. `integration` or `webapp` but also `imports` or `orders` in case of dashboard-generated token
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
- * Required when application is forked or running as self-hosted.
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 (eg. `commercelayer.io`)
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;