@commercelayer/app-elements 5.6.0 → 6.0.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/dist/CodeEditorComponent-9BjmYH9v.js +720 -0
- package/dist/InputDateComponent-DeKe0ONv.js +4887 -0
- package/dist/RuleEngineComponent-C1DXm3EO.js +1404 -0
- package/dist/dictionaries/customers.d.ts +1 -1
- package/dist/dictionaries/orders.d.ts +7 -7
- package/dist/dictionaries/promotions.d.ts +2 -2
- package/dist/dictionaries/returns.d.ts +4 -4
- package/dist/dictionaries/shipments.d.ts +4 -4
- package/dist/dictionaries/stockTransfers.d.ts +4 -4
- package/dist/dictionaries/types.d.ts +2 -2
- package/dist/fetchCoreResourcesSuggestions-DLZhtrDX.js +124 -0
- package/dist/helpers/appsNavigation.d.ts +2 -2
- package/dist/helpers/attachments.d.ts +1 -1
- package/dist/helpers/date.d.ts +13 -13
- package/dist/helpers/downloadJsonAsFile.d.ts +1 -1
- package/dist/helpers/resources.d.ts +4 -4
- package/dist/helpers/tracking.d.ts +4 -4
- package/dist/hooks/useClickAway.d.ts +1 -1
- package/dist/hooks/useEditMetadataOverlay.d.ts +3 -3
- package/dist/hooks/useEditTagsOverlay.d.ts +2 -2
- package/dist/hooks/useIsChanged.d.ts +1 -1
- package/dist/{main-YD7ko8U-.js → main-BANV9Udl.js} +26949 -28776
- package/dist/main.d.ts +60 -60
- package/dist/main.js +1 -1
- package/dist/{parseISO-Cq_loYUP.js → parseISO-8P5gMU86.js} +17 -17
- package/dist/providers/CoreSdkProvider/CoreSdkProvider.d.ts +1 -1
- package/dist/providers/CoreSdkProvider/makeSdkClient.d.ts +1 -1
- package/dist/providers/CoreSdkProvider/useCoreApi.d.ts +1 -1
- package/dist/providers/GTMProvider.d.ts +1 -1
- package/dist/providers/TokenProvider/MockTokenProvider.d.ts +1 -1
- package/dist/providers/TokenProvider/TokenProvider.d.ts +1 -1
- package/dist/providers/TokenProvider/getAccessTokenFromUrl.d.ts +1 -1
- package/dist/providers/TokenProvider/index.d.ts +1 -1
- package/dist/providers/TokenProvider/reducer.d.ts +2 -2
- package/dist/providers/TokenProvider/storage.d.ts +4 -4
- package/dist/providers/TokenProvider/types.d.ts +10 -10
- package/dist/providers/TokenProvider/url.d.ts +1 -1
- package/dist/providers/TokenProvider/validateToken.d.ts +2 -2
- package/dist/providers/createApp.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/tailwind.global.css +291 -0
- package/dist/ui/atoms/A.d.ts +1 -1
- package/dist/ui/atoms/Alert.d.ts +1 -1
- package/dist/ui/atoms/Avatar.d.ts +3 -3
- package/dist/ui/atoms/Avatar.utils.d.ts +18 -18
- package/dist/ui/atoms/AvatarLetter/colors.d.ts +1 -1
- package/dist/ui/atoms/Badge/Badge.d.ts +3 -3
- package/dist/ui/atoms/Badge/badgeVariants.d.ts +1 -1
- package/dist/ui/atoms/ButtonFilter.d.ts +1 -1
- package/dist/ui/atoms/Card.d.ts +15 -11
- package/dist/ui/atoms/CodeBlock.d.ts +1 -1
- package/dist/ui/atoms/EmptyState.d.ts +1 -1
- package/dist/ui/atoms/Grid.d.ts +6 -6
- package/dist/ui/atoms/Hint.d.ts +1 -1
- package/dist/ui/atoms/Hr.d.ts +2 -2
- package/dist/ui/atoms/Icon/Icon.d.ts +2 -2
- package/dist/ui/atoms/Icon/icons.d.ts +1 -1
- package/dist/ui/atoms/PageHeading/PageHeading.d.ts +3 -3
- package/dist/ui/atoms/PageHeading/PageHeadingToolbar.d.ts +2 -2
- package/dist/ui/atoms/Progress.d.ts +1 -1
- package/dist/ui/atoms/RadialProgress.d.ts +2 -2
- package/dist/ui/atoms/Section.d.ts +2 -2
- package/dist/ui/atoms/Skeleton.d.ts +1 -1
- package/dist/ui/atoms/Spacer.d.ts +3 -3
- package/dist/ui/atoms/StatusDot.d.ts +1 -1
- package/dist/ui/atoms/StatusIcon.d.ts +2 -2
- package/dist/ui/atoms/Table/Table.d.ts +1 -1
- package/dist/ui/atoms/Tag.d.ts +3 -3
- package/dist/ui/atoms/Text.d.ts +6 -6
- package/dist/ui/atoms/Tooltip.d.ts +2 -2
- package/dist/ui/composite/ActionButtons/ActionButtons.d.ts +2 -2
- package/dist/ui/composite/Address.d.ts +1 -1
- package/dist/ui/composite/Dropdown/Dropdown.d.ts +1 -1
- package/dist/ui/composite/Dropdown/DropdownItem.d.ts +11 -7
- package/dist/ui/composite/Dropdown/DropdownMenu.d.ts +3 -3
- package/dist/ui/composite/HomePageLayout.d.ts +3 -3
- package/dist/ui/composite/List.d.ts +2 -2
- package/dist/ui/composite/ListDetails.d.ts +2 -2
- package/dist/ui/composite/ListDetailsItem.d.ts +3 -3
- package/dist/ui/composite/ListItem.d.ts +7 -7
- package/dist/ui/composite/PageError.d.ts +2 -2
- package/dist/ui/composite/PageLayout.d.ts +6 -6
- package/dist/ui/composite/Routes/Routes.d.ts +3 -3
- package/dist/ui/composite/Routes/index.d.ts +2 -2
- package/dist/ui/composite/Routes/utils.d.ts +5 -5
- package/dist/ui/composite/SearchBar.d.ts +1 -1
- package/dist/ui/composite/Timeline.d.ts +1 -1
- package/dist/ui/composite/Toast.d.ts +1 -1
- package/dist/ui/composite/Toolbar.d.ts +6 -6
- package/dist/ui/forms/CodeEditor/CodeEditorComponent.d.ts +4 -4
- package/dist/ui/forms/CodeEditor/HookedCodeEditor.d.ts +1 -1
- package/dist/ui/forms/CodeEditor/fetchCoreResourcesSuggestions.d.ts +7 -7
- package/dist/ui/forms/CodeEditor/index.d.ts +1 -1
- package/dist/ui/forms/Input/Input.d.ts +2 -2
- package/dist/ui/forms/InputCheckbox/HookedInputCheckbox.d.ts +1 -1
- package/dist/ui/forms/InputCheckbox/InputCheckbox.d.ts +2 -2
- package/dist/ui/forms/InputCheckbox/index.d.ts +1 -1
- package/dist/ui/forms/InputCheckboxGroup/HookedInputCheckboxGroup.d.ts +1 -1
- package/dist/ui/forms/InputCheckboxGroup/InputCheckboxGroupItem.d.ts +2 -2
- package/dist/ui/forms/InputCheckboxGroup/index.d.ts +2 -2
- package/dist/ui/forms/InputCheckboxGroup/reducer.d.ts +3 -3
- package/dist/ui/forms/InputCurrency/HookedInputCurrency.d.ts +1 -1
- package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +3 -3
- package/dist/ui/forms/InputCurrency/index.d.ts +1 -1
- package/dist/ui/forms/InputCurrency/utils.d.ts +1 -1
- package/dist/ui/forms/InputCurrencyRange.d.ts +3 -3
- package/dist/ui/forms/InputDate/HookedInputDate.d.ts +1 -1
- package/dist/ui/forms/InputDateRange/HookedInputDateRange.d.ts +1 -1
- package/dist/ui/forms/InputDateRange/InputDateRange.d.ts +5 -5
- package/dist/ui/forms/InputDateRange/index.d.ts +1 -1
- package/dist/ui/forms/InputFeedback.d.ts +1 -1
- package/dist/ui/forms/InputFile.d.ts +1 -1
- package/dist/ui/forms/InputJson.d.ts +1 -1
- package/dist/ui/forms/InputRadioGroup/HookedInputRadioGroup.d.ts +1 -1
- package/dist/ui/forms/InputRadioGroup/index.d.ts +1 -1
- package/dist/ui/forms/InputResourceGroup/FullList.d.ts +3 -3
- package/dist/ui/forms/InputResourceGroup/HookedInputResourceGroup.d.ts +1 -1
- package/dist/ui/forms/InputResourceGroup/InputResourceGroup.d.ts +1 -1
- package/dist/ui/forms/InputResourceGroup/index.d.ts +2 -2
- package/dist/ui/forms/InputResourceGroup/utils.d.ts +3 -3
- package/dist/ui/forms/InputSelect/CreatableComponent.d.ts +1 -1
- package/dist/ui/forms/InputSelect/GenericAsyncComponent.d.ts +1 -1
- package/dist/ui/forms/InputSelect/HookedInputSelect.d.ts +1 -1
- package/dist/ui/forms/InputSelect/InputSelect.d.ts +1 -1
- package/dist/ui/forms/InputSelect/SelectComponent.d.ts +1 -1
- package/dist/ui/forms/InputSelect/index.d.ts +3 -3
- package/dist/ui/forms/InputSelect/styles.d.ts +1 -1
- package/dist/ui/forms/InputSelect/utils.d.ts +1 -1
- package/dist/ui/forms/InputSimpleSelect/InputSimpleSelect.d.ts +1 -1
- package/dist/ui/forms/InputSimpleSelect/index.d.ts +2 -2
- package/dist/ui/forms/InputSpinner/HookedInputSpinner.d.ts +1 -1
- package/dist/ui/forms/InputSpinner/InputSpinner.d.ts +1 -1
- package/dist/ui/forms/InputSpinner/index.d.ts +1 -1
- package/dist/ui/forms/InputSwitch/InputSwitch.d.ts +1 -1
- package/dist/ui/forms/InputSwitch/index.d.ts +1 -1
- package/dist/ui/forms/InputTextArea/index.d.ts +1 -1
- package/dist/ui/forms/InputToggleButton/HookedInputToggleButton.d.ts +1 -1
- package/dist/ui/forms/InputToggleButton/InputToggleButton.d.ts +4 -4
- package/dist/ui/forms/InputToggleButton/index.d.ts +2 -2
- package/dist/ui/forms/MarketWithCurrencySelector/HookedMarketWithCurrencySelector.d.ts +2 -2
- package/dist/ui/forms/MarketWithCurrencySelector/index.d.ts +1 -1
- package/dist/ui/forms/ReactHookForm/HookedValidationApiError.d.ts +1 -1
- package/dist/ui/forms/ReactHookForm/setApiFormErrors.d.ts +1 -1
- package/dist/ui/forms/ReactHookForm/useValidationFeedback.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Action/ActionListItem.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Action/ActionValue.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Action/index.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ArrayMatch.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/ConditionListItem.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ConditionMatcher.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ConditionValue.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/Connector.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/RangeInputs.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputArrayMatch.d.ts +2 -2
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputNumberRange.d.ts +2 -2
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputTextRange.d.ts +2 -2
- package/dist/ui/forms/RuleEngine/Condition/dictionaries.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/index.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/types.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/utils.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/RuleEngineComponent.d.ts +4 -4
- package/dist/ui/forms/RuleEngine/RuleEngineContext.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/utils.d.ts +6 -6
- package/dist/ui/internals/FlexRow.d.ts +1 -1
- package/dist/ui/internals/InputWrapper.d.ts +6 -6
- package/dist/ui/internals/InteractiveElement.className.d.ts +4 -4
- package/dist/ui/internals/Overlay.d.ts +1 -1
- package/dist/ui/resources/ResourceAddress/ResourceAddress.d.ts +2 -2
- package/dist/ui/resources/ResourceAddress/ResourceAddressFormFields.d.ts +1 -1
- package/dist/ui/resources/ResourceAddress/index.d.ts +1 -1
- package/dist/ui/resources/ResourceAddress/useResourceAddressOverlay.d.ts +2 -2
- package/dist/ui/resources/ResourceAttachments/index.d.ts +1 -1
- package/dist/ui/resources/ResourceDetails/useEditDetailsOverlay.d.ts +2 -2
- package/dist/ui/resources/ResourceLineItems/index.d.ts +1 -1
- package/dist/ui/resources/ResourceListItem/ResourceListItem.d.ts +2 -2
- package/dist/ui/resources/ResourceListItem/ResourceListItem.mocks.d.ts +9 -0
- package/dist/ui/resources/ResourceListItem/index.d.ts +1 -1
- package/dist/ui/resources/ResourceListItem/types.d.ts +3 -3
- package/dist/ui/resources/ResourceMetadata/ResourceMetadata.d.ts +2 -2
- package/dist/ui/resources/ResourceMetadata/index.d.ts +1 -1
- package/dist/ui/resources/ResourceOrderTimeline.d.ts +1 -1
- package/dist/ui/resources/ResourcePaymentMethod.d.ts +3 -3
- package/dist/ui/resources/ResourceShipmentParcels.mocks.d.ts +2 -2
- package/dist/ui/resources/ResourceTags.d.ts +3 -3
- package/dist/ui/resources/useResourceFilters/FieldCurrencyRange.d.ts +1 -2
- package/dist/ui/resources/useResourceFilters/FiltersForm.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/FiltersNav.d.ts +1 -2
- package/dist/ui/resources/useResourceFilters/FiltersSearchBar.d.ts +3 -3
- package/dist/ui/resources/useResourceFilters/adaptFormValuesToSdk.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptFormValuesToUrlQuery.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptSdkToMetrics.d.ts +4 -4
- package/dist/ui/resources/useResourceFilters/adaptSdkToUrlQuery.d.ts +2 -2
- package/dist/ui/resources/useResourceFilters/adaptUrlQueryToFormValues.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptUrlQueryToSdk.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptUrlQueryToUrlQuery.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adapters.types.d.ts +8 -8
- package/dist/ui/resources/useResourceFilters/timeUtils.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/types.d.ts +18 -18
- package/dist/ui/resources/useResourceFilters/useResourceFilters.d.ts +10 -11
- package/dist/ui/resources/useResourceFilters/utils.d.ts +2 -2
- package/dist/ui/resources/useResourceList/adaptMetricsOrderToCore.d.ts +1 -1
- package/dist/ui/resources/useResourceList/index.d.ts +1 -1
- package/dist/ui/resources/useResourceList/infiniteFetcher.d.ts +5 -5
- package/dist/ui/resources/useResourceList/metricsApiClient.d.ts +4 -4
- package/dist/ui/resources/useResourceList/reducer.d.ts +5 -5
- package/dist/ui/resources/useResourceList/useResourceList.d.ts +10 -10
- package/dist/ui/resources/useResourceList/utils.d.ts +1 -1
- package/dist/utils/array.d.ts +1 -1
- package/dist/utils/htmltags.d.ts +1 -1
- package/dist/utils/pagination.d.ts +4 -4
- package/dist/vendor.css +2 -1
- package/package.json +38 -41
- package/dist/CodeEditorComponent-DhpbUF3I.js +0 -739
- package/dist/InputDateComponent-BZyuY3F6.js +0 -4964
- package/dist/RuleEngineComponent-UggkM5Zc.js +0 -1390
- package/dist/fetchCoreResourcesSuggestions-CZkDwjO2.js +0 -126
- package/dist/tailwind.config.js +0 -197
|
@@ -5,8 +5,8 @@ export interface EditDetailsOverlayProps {
|
|
|
5
5
|
* Optional title shown as first line in edit overlay heading
|
|
6
6
|
*/
|
|
7
7
|
title?: string;
|
|
8
|
-
resource: ResourceDetailsProps[
|
|
9
|
-
onUpdated: ResourceDetailsProps[
|
|
8
|
+
resource: ResourceDetailsProps["resource"];
|
|
9
|
+
onUpdated: ResourceDetailsProps["onUpdated"];
|
|
10
10
|
}
|
|
11
11
|
interface DetailsOverlayHook {
|
|
12
12
|
show: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ResourceLineItems, type ResourceLineItemsProps } from './ResourceLineItems';
|
|
1
|
+
export { ResourceLineItems, type ResourceLineItemsProps, } from './ResourceLineItems';
|
|
@@ -8,11 +8,11 @@ export interface ResourceListItemProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Optional href
|
|
10
10
|
*/
|
|
11
|
-
href?: ListItemProps[
|
|
11
|
+
href?: ListItemProps["href"];
|
|
12
12
|
/**
|
|
13
13
|
* Optional onClick function
|
|
14
14
|
*/
|
|
15
|
-
onClick?: ListItemProps[
|
|
15
|
+
onClick?: ListItemProps["onClick"];
|
|
16
16
|
/**
|
|
17
17
|
* Optional setting to show right content, if available, instead of right arrow
|
|
18
18
|
*/
|
|
@@ -544,6 +544,7 @@ export declare const presetResourceListItem: {
|
|
|
544
544
|
readonly price_amount_cents: 0;
|
|
545
545
|
readonly created_at: "";
|
|
546
546
|
readonly updated_at: "";
|
|
547
|
+
readonly shared_secret: "";
|
|
547
548
|
};
|
|
548
549
|
};
|
|
549
550
|
shipmentPicking: {
|
|
@@ -567,6 +568,7 @@ export declare const presetResourceListItem: {
|
|
|
567
568
|
readonly price_amount_cents: 0;
|
|
568
569
|
readonly created_at: "";
|
|
569
570
|
readonly updated_at: "";
|
|
571
|
+
readonly shared_secret: "";
|
|
570
572
|
};
|
|
571
573
|
};
|
|
572
574
|
shipmentPacking: {
|
|
@@ -590,6 +592,7 @@ export declare const presetResourceListItem: {
|
|
|
590
592
|
readonly price_amount_cents: 0;
|
|
591
593
|
readonly created_at: "";
|
|
592
594
|
readonly updated_at: "";
|
|
595
|
+
readonly shared_secret: "";
|
|
593
596
|
};
|
|
594
597
|
};
|
|
595
598
|
shipmentReadyToShip: {
|
|
@@ -613,6 +616,7 @@ export declare const presetResourceListItem: {
|
|
|
613
616
|
readonly price_amount_cents: 0;
|
|
614
617
|
readonly created_at: "";
|
|
615
618
|
readonly updated_at: "";
|
|
619
|
+
readonly shared_secret: "";
|
|
616
620
|
};
|
|
617
621
|
};
|
|
618
622
|
shipmentOnHold: {
|
|
@@ -636,6 +640,7 @@ export declare const presetResourceListItem: {
|
|
|
636
640
|
readonly price_amount_cents: 0;
|
|
637
641
|
readonly created_at: "";
|
|
638
642
|
readonly updated_at: "";
|
|
643
|
+
readonly shared_secret: "";
|
|
639
644
|
};
|
|
640
645
|
};
|
|
641
646
|
shipmentShipped: {
|
|
@@ -659,6 +664,7 @@ export declare const presetResourceListItem: {
|
|
|
659
664
|
readonly price_amount_cents: 0;
|
|
660
665
|
readonly created_at: "";
|
|
661
666
|
readonly updated_at: "";
|
|
667
|
+
readonly shared_secret: "";
|
|
662
668
|
};
|
|
663
669
|
};
|
|
664
670
|
shipmentDelivered: {
|
|
@@ -682,6 +688,7 @@ export declare const presetResourceListItem: {
|
|
|
682
688
|
readonly price_amount_cents: 0;
|
|
683
689
|
readonly created_at: "";
|
|
684
690
|
readonly updated_at: "";
|
|
691
|
+
readonly shared_secret: "";
|
|
685
692
|
};
|
|
686
693
|
};
|
|
687
694
|
shipmentWithReference: {
|
|
@@ -706,6 +713,7 @@ export declare const presetResourceListItem: {
|
|
|
706
713
|
readonly price_amount_cents: 0;
|
|
707
714
|
readonly created_at: "";
|
|
708
715
|
readonly updated_at: "";
|
|
716
|
+
readonly shared_secret: "";
|
|
709
717
|
};
|
|
710
718
|
};
|
|
711
719
|
shipmentWithStockTransfer: {
|
|
@@ -729,6 +737,7 @@ export declare const presetResourceListItem: {
|
|
|
729
737
|
readonly price_amount_cents: 0;
|
|
730
738
|
readonly created_at: "";
|
|
731
739
|
readonly updated_at: "";
|
|
740
|
+
readonly shared_secret: "";
|
|
732
741
|
};
|
|
733
742
|
stock_transfers: {
|
|
734
743
|
readonly type: "stock_transfers";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ResourceListItem, type ResourceListItemProps } from './ResourceListItem';
|
|
1
|
+
export { ResourceListItem, type ResourceListItemProps, } from './ResourceListItem';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { TokenProviderAuthUser } from '../../../providers/TokenProvider/types';
|
|
2
|
-
import { ListItemProps } from '../../composite/ListItem';
|
|
3
1
|
import { BuyXPayYPromotion, Customer, ExternalPromotion, FixedAmountPromotion, FixedPricePromotion, FlexPromotion, FreeGiftPromotion, FreeShippingPromotion, Order, PercentageDiscountPromotion, Return, Shipment, SkuListItem, StockTransfer } from '@commercelayer/sdk';
|
|
4
2
|
import { t } from 'i18next';
|
|
5
3
|
import { JSX } from 'react';
|
|
4
|
+
import { TokenProviderAuthUser } from '../../../providers/TokenProvider/types';
|
|
5
|
+
import { ListItemProps } from '../../composite/ListItem';
|
|
6
6
|
export type ResourceListItemType = Order | Return | Customer | StockTransfer | SkuListItem | Shipment | BuyXPayYPromotion | ExternalPromotion | FixedAmountPromotion | FixedPricePromotion | FreeGiftPromotion | FreeShippingPromotion | PercentageDiscountPromotion | FlexPromotion;
|
|
7
7
|
export interface ResourceListItemComponentProps {
|
|
8
8
|
name: React.ReactNode;
|
|
@@ -10,7 +10,7 @@ export interface ResourceListItemComponentProps {
|
|
|
10
10
|
icon: JSX.Element;
|
|
11
11
|
rightContent?: JSX.Element;
|
|
12
12
|
invertNameDescription?: boolean;
|
|
13
|
-
alignItems?: ListItemProps[
|
|
13
|
+
alignItems?: ListItemProps["alignItems"];
|
|
14
14
|
}
|
|
15
15
|
export type ResourceToProps<Resource> = (options: {
|
|
16
16
|
resource: Resource;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EditMetadataOverlayProps } from '../../../hooks/useEditMetadataOverlay';
|
|
2
1
|
import { ListableResourceType } from '@commercelayer/sdk';
|
|
3
|
-
|
|
2
|
+
import { EditMetadataOverlayProps } from '../../../hooks/useEditMetadataOverlay';
|
|
3
|
+
interface MetadataOverlay extends Omit<EditMetadataOverlayProps, "resourceId" | "resourceType"> {
|
|
4
4
|
}
|
|
5
5
|
export interface ResourceMetadataProps {
|
|
6
6
|
resourceType: ListableResourceType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ResourceMetadata, type ResourceMetadataProps } from './ResourceMetadata';
|
|
1
|
+
export { ResourceMetadata, type ResourceMetadataProps, } from './ResourceMetadata';
|
|
@@ -6,7 +6,7 @@ export interface ResourcePaymentMethodProps {
|
|
|
6
6
|
* Any resource that has `payment_source` or `payment_method` properties is actually eligible.
|
|
7
7
|
* But we are only interested in `Order` and `CustomerPaymentSource` resources.
|
|
8
8
|
*/
|
|
9
|
-
resource: SetRequired<SetNonNullable<Partial<Order>,
|
|
9
|
+
resource: SetRequired<SetNonNullable<Partial<Order>, "payment_method">, "payment_method"> | SetRequired<SetNonNullable<CustomerPaymentSource, "payment_source">, "payment_source">;
|
|
10
10
|
/**
|
|
11
11
|
* When true and if `payment_source.payment_response` is present, enables the expandable content to show more details on the transaction.
|
|
12
12
|
*/
|
|
@@ -14,7 +14,7 @@ export interface ResourcePaymentMethodProps {
|
|
|
14
14
|
/**
|
|
15
15
|
* Defines the style of the component. Default is `boxed`, with a light gray background and rounded corners.
|
|
16
16
|
*/
|
|
17
|
-
variant?:
|
|
17
|
+
variant?: "plain" | "boxed";
|
|
18
18
|
/**
|
|
19
19
|
* This will render a button on the right side of the row.
|
|
20
20
|
*/
|
|
@@ -27,4 +27,4 @@ export declare const ResourcePaymentMethod: FC<ResourcePaymentMethodProps>;
|
|
|
27
27
|
/**
|
|
28
28
|
* Retrieve the logo URL based on the payment source type.
|
|
29
29
|
*/
|
|
30
|
-
export declare function getPaymentMethodLogoSrc(type?: PaymentMethod[
|
|
30
|
+
export declare function getPaymentMethodLogoSrc(type?: PaymentMethod["payment_source_type"]): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ResourceShipmentParcels } from './ResourceShipmentParcels';
|
|
2
|
-
type Shipment = Parameters<typeof ResourceShipmentParcels>[0][
|
|
3
|
-
type Parcel = NonNullable<Shipment[
|
|
2
|
+
type Shipment = Parameters<typeof ResourceShipmentParcels>[0]["shipment"];
|
|
3
|
+
type Parcel = NonNullable<Shipment["parcels"]>[number];
|
|
4
4
|
export declare const parcelWithoutTracking1: import('@commercelayer/sdk').Parcel;
|
|
5
5
|
export declare const parcelWithoutTracking2: import('@commercelayer/sdk').Parcel;
|
|
6
6
|
export declare const parcelWithTracking1: import('@commercelayer/sdk').Parcel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EditTagsOverlayProps } from '../../hooks/useEditTagsOverlay';
|
|
2
1
|
import { ListableResourceType } from '@commercelayer/sdk';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { EditTagsOverlayProps } from '../../hooks/useEditTagsOverlay';
|
|
3
|
+
type TaggableResource = Extract<ListableResourceType, "addresses" | "bundles" | "coupons" | "customers" | "gift_cards" | "line_items" | "line_item_options" | "order_subscriptions" | "orders" | "buy_x_pay_y_promotions" | "external_promotions" | "fixed_amount_promotions" | "fixed_price_promotions" | "flex_promotions" | "free_gift_promotions" | "free_shipping_promotions" | "percentage_discount_promotions" | "returns" | "shipments" | "sku_options" | "skus">;
|
|
4
|
+
interface TagsOverlay extends Omit<EditTagsOverlayProps, "resourceId" | "resourceType"> {
|
|
5
5
|
}
|
|
6
6
|
export interface ResourceTagsProps {
|
|
7
7
|
resourceType: TaggableResource;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { JSX } from 'react';
|
|
2
1
|
import { FilterItemCurrencyRange } from './types';
|
|
3
2
|
interface FieldCurrencyRangeProps {
|
|
4
3
|
item: FilterItemCurrencyRange;
|
|
5
4
|
}
|
|
6
|
-
export declare function FieldCurrencyRange({ item }: FieldCurrencyRangeProps):
|
|
5
|
+
export declare function FieldCurrencyRange({ item, }: FieldCurrencyRangeProps): React.ReactNode;
|
|
7
6
|
export {};
|
|
@@ -23,7 +23,7 @@ export interface FiltersFormProps {
|
|
|
23
23
|
*/
|
|
24
24
|
predicateWhitelist: string[];
|
|
25
25
|
}
|
|
26
|
-
declare function FiltersForm({ instructions, predicateWhitelist, onSubmit }: FiltersFormProps): JSX.Element;
|
|
26
|
+
declare function FiltersForm({ instructions, predicateWhitelist, onSubmit, }: FiltersFormProps): JSX.Element;
|
|
27
27
|
declare namespace FiltersForm {
|
|
28
28
|
var displayName: string;
|
|
29
29
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { JSX } from 'react';
|
|
2
1
|
import { FiltersInstructions } from './types';
|
|
3
2
|
export interface FiltersNavProps {
|
|
4
3
|
/**
|
|
@@ -35,4 +34,4 @@ export interface FiltersNavProps {
|
|
|
35
34
|
*/
|
|
36
35
|
predicateWhitelist: string[];
|
|
37
36
|
}
|
|
38
|
-
export declare function FiltersNav({ instructions, onFilterClick: onBtnLabelClick, onUpdate, queryString, predicateWhitelist }: FiltersNavProps):
|
|
37
|
+
export declare function FiltersNav({ instructions, onFilterClick: onBtnLabelClick, onUpdate, queryString, predicateWhitelist, }: FiltersNavProps): React.ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SearchBarProps } from '../../composite/SearchBar';
|
|
2
1
|
import { JSX } from 'react';
|
|
2
|
+
import { SearchBarProps } from '../../composite/SearchBar';
|
|
3
3
|
import { FiltersInstructions } from './types';
|
|
4
|
-
export interface FilterSearchBarProps extends Pick<SearchBarProps,
|
|
4
|
+
export interface FilterSearchBarProps extends Pick<SearchBarProps, "placeholder" | "debounceMs"> {
|
|
5
5
|
/**
|
|
6
6
|
* Array of instruction items to build the filters behaviors
|
|
7
7
|
*/
|
|
@@ -31,7 +31,7 @@ export interface FilterSearchBarProps extends Pick<SearchBarProps, 'placeholder'
|
|
|
31
31
|
*/
|
|
32
32
|
predicateWhitelist: string[];
|
|
33
33
|
}
|
|
34
|
-
declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString, predicateWhitelist, debounceMs }: FilterSearchBarProps): JSX.Element;
|
|
34
|
+
declare function FiltersSearchBar({ instructions, placeholder, onUpdate, queryString, predicateWhitelist, debounceMs, }: FilterSearchBarProps): JSX.Element;
|
|
35
35
|
declare namespace FiltersSearchBar {
|
|
36
36
|
var displayName: string;
|
|
37
37
|
}
|
|
@@ -11,7 +11,7 @@ export interface AdaptFormValuesToSdkParams<FilterFormValues> {
|
|
|
11
11
|
* @param formValues a valid FilterFormValues object
|
|
12
12
|
* @returns an object of type QueryFilter to be used in the SDK stripping out empty or undefined values
|
|
13
13
|
*/
|
|
14
|
-
export declare function adaptFormValuesToSdk<FilterFormValues extends Record<UiFilterName, UiFilterValue | CurrencyRangeFieldValue>>({ formValues, instructions, timezone, predicateWhitelist }: AdaptFormValuesToSdkParams<FilterFormValues>): QueryFilter;
|
|
14
|
+
export declare function adaptFormValuesToSdk<FilterFormValues extends Record<UiFilterName, UiFilterValue | CurrencyRangeFieldValue>>({ formValues, instructions, timezone, predicateWhitelist, }: AdaptFormValuesToSdkParams<FilterFormValues>): QueryFilter;
|
|
15
15
|
export declare function extractEnforcedValues(instructions: FiltersInstructions): QueryFilter;
|
|
16
16
|
/**
|
|
17
17
|
* Be sure to have all the default values
|
|
@@ -8,4 +8,4 @@ export interface AdaptFormValuesToUrlQueryParams<FilterFormValues extends FormFu
|
|
|
8
8
|
* @param formValues a valid FilterFormValues object
|
|
9
9
|
* @returns a string ready to be used in URL
|
|
10
10
|
*/
|
|
11
|
-
export declare function adaptFormValuesToUrlQuery<FilterFormValues extends FormFullValues>({ formValues, instructions }: AdaptFormValuesToUrlQueryParams<FilterFormValues>): string;
|
|
11
|
+
export declare function adaptFormValuesToUrlQuery<FilterFormValues extends FormFullValues>({ formValues, instructions, }: AdaptFormValuesToUrlQueryParams<FilterFormValues>): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FiltersInstructions } from './types';
|
|
2
1
|
import { ListableResourceType, QueryFilter } from '@commercelayer/sdk';
|
|
3
|
-
|
|
4
|
-
type
|
|
2
|
+
import { FiltersInstructions } from './types';
|
|
3
|
+
export type CoreResourceEnabledInMetrics = "orders" | "returns";
|
|
4
|
+
type MetricsResource = "order" | "return";
|
|
5
5
|
/** Record of core api filter operators with relative metrics operator */
|
|
6
6
|
declare const metricsFiltersMapping: {
|
|
7
7
|
readonly _eq: "eq";
|
|
@@ -27,5 +27,5 @@ export interface AdaptSdkToMetricsParams {
|
|
|
27
27
|
instructions: FiltersInstructions;
|
|
28
28
|
predicateWhitelist?: string[];
|
|
29
29
|
}
|
|
30
|
-
export declare function adaptSdkToMetrics({ sdkFilters, resourceType, instructions, predicateWhitelist }: AdaptSdkToMetricsParams): MetricsFilters;
|
|
30
|
+
export declare function adaptSdkToMetrics({ sdkFilters, resourceType, instructions, predicateWhitelist, }: AdaptSdkToMetricsParams): MetricsFilters;
|
|
31
31
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { FiltersInstructions } from './types';
|
|
2
1
|
import { QueryFilter } from '@commercelayer/sdk';
|
|
2
|
+
import { FiltersInstructions } from './types';
|
|
3
3
|
export interface AdaptSdkToUrlQueryParams {
|
|
4
4
|
sdkFilters: QueryFilter;
|
|
5
5
|
instructions: FiltersInstructions;
|
|
6
6
|
predicateWhitelist?: string[];
|
|
7
7
|
}
|
|
8
|
-
export declare function adaptSdkToUrlQuery({ sdkFilters, predicateWhitelist, instructions }: AdaptSdkToUrlQueryParams): string;
|
|
8
|
+
export declare function adaptSdkToUrlQuery({ sdkFilters, predicateWhitelist, instructions, }: AdaptSdkToUrlQueryParams): string;
|
|
@@ -9,4 +9,4 @@ export interface AdaptUrlQueryToFormValuesParams {
|
|
|
9
9
|
* @param qs url query string
|
|
10
10
|
* @returns an object containing FilterFormValues
|
|
11
11
|
*/
|
|
12
|
-
export declare function adaptUrlQueryToFormValues<FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ queryString, instructions, predicateWhitelist }: AdaptUrlQueryToFormValuesParams): FilterFormValues & FormFullValues;
|
|
12
|
+
export declare function adaptUrlQueryToFormValues<FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ queryString, instructions, predicateWhitelist, }: AdaptUrlQueryToFormValuesParams): FilterFormValues & FormFullValues;
|
|
@@ -12,4 +12,4 @@ export interface AdaptUrlQueryToSdkParams {
|
|
|
12
12
|
* @returns an object of type QueryFilter to be used in the SDK
|
|
13
13
|
* stripping out empty or undefined values and enforcing default status_in when empty
|
|
14
14
|
*/
|
|
15
|
-
export declare function adaptUrlQueryToSdk({ queryString, instructions, predicateWhitelist, timezone }: AdaptUrlQueryToSdkParams): QueryFilter;
|
|
15
|
+
export declare function adaptUrlQueryToSdk({ queryString, instructions, predicateWhitelist, timezone, }: AdaptUrlQueryToSdkParams): QueryFilter;
|
|
@@ -9,4 +9,4 @@ export interface AdaptUrlQueryToUrlQueryParams {
|
|
|
9
9
|
* @param qs url query string
|
|
10
10
|
* @returns an object of type QueryFilter to be used in the SDK stripping out empty or undefined values
|
|
11
11
|
*/
|
|
12
|
-
export declare function adaptUrlQueryToUrlQuery({ queryString, instructions, predicateWhitelist }: AdaptUrlQueryToUrlQueryParams): string;
|
|
12
|
+
export declare function adaptUrlQueryToUrlQuery({ queryString, instructions, predicateWhitelist, }: AdaptUrlQueryToUrlQueryParams): string;
|
|
@@ -12,14 +12,14 @@ interface MakeFilterAdaptersParams {
|
|
|
12
12
|
predicateWhitelist: string[];
|
|
13
13
|
}
|
|
14
14
|
interface MakeFilterAdaptersReturn<FilterFormValues extends FormFullValues> {
|
|
15
|
-
adaptFormValuesToUrlQuery: (params: Pick<AdaptFormValuesToUrlQueryParams<FormFullValues>,
|
|
16
|
-
adaptFormValuesToSdk: (params: Pick<AdaptFormValuesToSdkParams<FilterFormValues>,
|
|
17
|
-
adaptUrlQueryToFormValues: (params: Pick<AdaptUrlQueryToFormValuesParams,
|
|
18
|
-
adaptUrlQueryToSdk: (params: Pick<AdaptUrlQueryToSdkParams,
|
|
19
|
-
adaptUrlQueryToUrlQuery: (params: Pick<AdaptUrlQueryToUrlQueryParams,
|
|
20
|
-
adaptSdkToMetrics: (params: Pick<AdaptSdkToMetricsParams,
|
|
21
|
-
adaptSdkToUrlQuery: (params: Pick<AdaptSdkToUrlQueryParams,
|
|
15
|
+
adaptFormValuesToUrlQuery: (params: Pick<AdaptFormValuesToUrlQueryParams<FormFullValues>, "formValues">) => string;
|
|
16
|
+
adaptFormValuesToSdk: (params: Pick<AdaptFormValuesToSdkParams<FilterFormValues>, "formValues" | "timezone">) => QueryFilter;
|
|
17
|
+
adaptUrlQueryToFormValues: (params: Pick<AdaptUrlQueryToFormValuesParams, "queryString">) => FilterFormValues & TimeRangeFormValues & PageInfoFormValues;
|
|
18
|
+
adaptUrlQueryToSdk: (params: Pick<AdaptUrlQueryToSdkParams, "queryString" | "timezone">) => QueryFilter;
|
|
19
|
+
adaptUrlQueryToUrlQuery: (params: Pick<AdaptUrlQueryToUrlQueryParams, "queryString">) => string;
|
|
20
|
+
adaptSdkToMetrics: (params: Pick<AdaptSdkToMetricsParams, "sdkFilters" | "resourceType">) => MetricsFilters;
|
|
21
|
+
adaptSdkToUrlQuery: (params: Pick<AdaptSdkToUrlQueryParams, "sdkFilters">) => string;
|
|
22
22
|
validInstructions: FiltersInstructions;
|
|
23
23
|
}
|
|
24
|
-
export type MakeFiltersAdapters = <FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ instructions, predicateWhitelist }: MakeFilterAdaptersParams) => MakeFilterAdaptersReturn<FilterFormValues>;
|
|
24
|
+
export type MakeFiltersAdapters = <FilterFormValues extends Record<UiFilterName, UiFilterValue>>({ instructions, predicateWhitelist, }: MakeFilterAdaptersParams) => MakeFilterAdaptersReturn<FilterFormValues>;
|
|
25
25
|
export {};
|
|
@@ -8,7 +8,7 @@ interface MakerSdkFilterTimeParams {
|
|
|
8
8
|
timezone?: string;
|
|
9
9
|
sdkFilterName?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const makeSdkFilterTime: ({ timePreset, timeFrom, timeTo, timezone, sdkFilterName }: MakerSdkFilterTimeParams) => Record<string, string | undefined>;
|
|
11
|
+
export declare const makeSdkFilterTime: ({ timePreset, timeFrom, timeTo, timezone, sdkFilterName, }: MakerSdkFilterTimeParams) => Record<string, string | undefined>;
|
|
12
12
|
export declare function getDefaultBrowserTimezone(): string | undefined;
|
|
13
13
|
export declare function getTimeRangePresetName(timeRangePreset: TimeRangePreset, t: typeof tFn): string;
|
|
14
14
|
export declare const timeRangeValidationSchema: z.ZodEffects<z.ZodObject<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { InputCurrencyRangeProps } from '../../forms/InputCurrencyRange';
|
|
2
|
-
import { InputResourceGroupProps } from '../../forms/InputResourceGroup';
|
|
3
1
|
import { QueryFilter } from '@commercelayer/sdk';
|
|
4
2
|
import { ValueOf } from 'type-fest';
|
|
3
|
+
import { InputCurrencyRangeProps } from '../../forms/InputCurrencyRange';
|
|
4
|
+
import { InputResourceGroupProps } from '../../forms/InputResourceGroup';
|
|
5
5
|
export declare const filterableTimeRangePreset: readonly ["today", "last7days", "last30days", "custom"];
|
|
6
6
|
export type UiFilterName = string;
|
|
7
7
|
export type UiFilterValue = string | string[] | boolean | Date | undefined;
|
|
@@ -52,17 +52,17 @@ export interface BaseFilterItem {
|
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
export type FilterItemOptions = BaseFilterItem & {
|
|
55
|
-
type:
|
|
55
|
+
type: "options";
|
|
56
56
|
render: {
|
|
57
57
|
/**
|
|
58
58
|
* UI component to render
|
|
59
59
|
*/
|
|
60
|
-
component:
|
|
60
|
+
component: "inputToggleButton";
|
|
61
61
|
/**
|
|
62
62
|
* props required for the UI component
|
|
63
63
|
*/
|
|
64
64
|
props: {
|
|
65
|
-
mode:
|
|
65
|
+
mode: "multi" | "single";
|
|
66
66
|
/**
|
|
67
67
|
* an option can be hidden from the UI but still be used in the query
|
|
68
68
|
* Example: we wont show the button to filter `pending` status in the UI, but we still want to accept it for a predefined list)
|
|
@@ -77,27 +77,27 @@ export type FilterItemOptions = BaseFilterItem & {
|
|
|
77
77
|
/**
|
|
78
78
|
* UI component to render
|
|
79
79
|
*/
|
|
80
|
-
component:
|
|
80
|
+
component: "inputResourceGroup";
|
|
81
81
|
/**
|
|
82
82
|
* props required for the UI component
|
|
83
83
|
*/
|
|
84
|
-
props: Omit<InputResourceGroupProps,
|
|
84
|
+
props: Omit<InputResourceGroupProps, "onChange" | "defaultValues" | "title">;
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
|
-
export interface FilterItemTextSearch extends Omit<BaseFilterItem,
|
|
88
|
-
type:
|
|
87
|
+
export interface FilterItemTextSearch extends Omit<BaseFilterItem, "sdk"> {
|
|
88
|
+
type: "textSearch";
|
|
89
89
|
render: {
|
|
90
90
|
/**
|
|
91
91
|
* UI component to render.
|
|
92
92
|
*
|
|
93
93
|
* ⚠️ You can have only one `searchBar` component.
|
|
94
94
|
*/
|
|
95
|
-
component:
|
|
95
|
+
component: "searchBar" | "input";
|
|
96
96
|
};
|
|
97
|
-
sdk: Pick<BaseFilterItem[
|
|
97
|
+
sdk: Pick<BaseFilterItem["sdk"], "predicate" | "parseFormValue">;
|
|
98
98
|
}
|
|
99
|
-
export interface FilterItemTime extends Omit<BaseFilterItem,
|
|
100
|
-
type:
|
|
99
|
+
export interface FilterItemTime extends Omit<BaseFilterItem, "sdk"> {
|
|
100
|
+
type: "timeRange";
|
|
101
101
|
sdk: {
|
|
102
102
|
/**
|
|
103
103
|
* SDK predicate to use in the query (example: `updated_at` or `updated_at`).
|
|
@@ -107,11 +107,11 @@ export interface FilterItemTime extends Omit<BaseFilterItem, 'sdk'> {
|
|
|
107
107
|
predicate: string;
|
|
108
108
|
};
|
|
109
109
|
render: {
|
|
110
|
-
component:
|
|
110
|
+
component: "dateRangePicker";
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
export interface FilterItemCurrencyRange extends Omit<BaseFilterItem,
|
|
114
|
-
type:
|
|
113
|
+
export interface FilterItemCurrencyRange extends Omit<BaseFilterItem, "sdk"> {
|
|
114
|
+
type: "currencyRange";
|
|
115
115
|
sdk: {
|
|
116
116
|
/**
|
|
117
117
|
* SDK predicate to use in the query (example: `total_amount_cents` or `subtotal_amount_cents`).
|
|
@@ -122,8 +122,8 @@ export interface FilterItemCurrencyRange extends Omit<BaseFilterItem, 'sdk'> {
|
|
|
122
122
|
predicate: string;
|
|
123
123
|
};
|
|
124
124
|
render: {
|
|
125
|
-
component:
|
|
126
|
-
props: Omit<InputCurrencyRangeProps,
|
|
125
|
+
component: "inputCurrencyRange";
|
|
126
|
+
props: Omit<InputCurrencyRangeProps, "onChange" | "fromCents" | "toCents" | "defaultCurrency" | "currencyList">;
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
export type FiltersInstructionItem = FilterItemOptions | FilterItemTextSearch | FilterItemTime | FilterItemCurrencyRange;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { ListableResourceType, QueryFilter } from '@commercelayer/sdk';
|
|
1
2
|
import { UseResourceListConfig } from '../useResourceList';
|
|
2
3
|
import { ResourceListProps } from '../useResourceList/useResourceList';
|
|
3
|
-
import {
|
|
4
|
-
import { JSX } from 'react';
|
|
4
|
+
import { makeFilterAdapters } from './adapters';
|
|
5
5
|
import { FiltersFormProps } from './FiltersForm';
|
|
6
6
|
import { FiltersNavProps } from './FiltersNav';
|
|
7
|
-
import { makeFilterAdapters } from './adapters';
|
|
8
7
|
import { FiltersInstructions } from './types';
|
|
9
8
|
interface UseResourceFiltersConfig {
|
|
10
9
|
/**
|
|
@@ -33,7 +32,7 @@ interface UseResourceFiltersHook {
|
|
|
33
32
|
/**
|
|
34
33
|
* Search bar component with filters navigation buttons
|
|
35
34
|
*/
|
|
36
|
-
SearchWithNav: (props: Pick<FiltersNavProps,
|
|
35
|
+
SearchWithNav: (props: Pick<FiltersNavProps, "onFilterClick" | "queryString"> & {
|
|
37
36
|
/**
|
|
38
37
|
* Callback triggered when user interact with search bar or remove a filter from the buttons
|
|
39
38
|
*/
|
|
@@ -50,22 +49,22 @@ interface UseResourceFiltersHook {
|
|
|
50
49
|
* @default 500
|
|
51
50
|
*/
|
|
52
51
|
searchBarDebounceMs?: number;
|
|
53
|
-
}) =>
|
|
52
|
+
}) => React.ReactNode;
|
|
54
53
|
/**
|
|
55
54
|
* Form component with filters fields based on provided instructions
|
|
56
55
|
*/
|
|
57
|
-
FiltersForm: (props: Pick<FiltersFormProps,
|
|
56
|
+
FiltersForm: (props: Pick<FiltersFormProps, "onSubmit">) => React.ReactNode;
|
|
58
57
|
/**
|
|
59
58
|
* Filtered ResourceList component based on current active filters
|
|
60
59
|
*/
|
|
61
|
-
FilteredList: <TResource extends ListableResourceType>(props: Omit<UseResourceListConfig<TResource>,
|
|
62
|
-
query?: Omit<NonNullable<UseResourceListConfig<TResource>[
|
|
63
|
-
metricsQuery?: Omit<NonNullable<UseResourceListConfig<TResource>[
|
|
60
|
+
FilteredList: <TResource extends ListableResourceType>(props: Omit<UseResourceListConfig<TResource>, "query" | "metricsQuery"> & ResourceListProps<TResource> & {
|
|
61
|
+
query?: Omit<NonNullable<UseResourceListConfig<TResource>["query"]>, "filters">;
|
|
62
|
+
metricsQuery?: Omit<NonNullable<UseResourceListConfig<TResource>["metricsQuery"]>, "filter"> & {
|
|
64
63
|
/** Filters need to be configured within the `useResourceFilters` options. */
|
|
65
64
|
filters?: never;
|
|
66
65
|
};
|
|
67
66
|
hideTitle?: boolean;
|
|
68
|
-
}) =>
|
|
67
|
+
}) => React.ReactNode;
|
|
69
68
|
/**
|
|
70
69
|
* SDK filters object to be used in the sdk query
|
|
71
70
|
*/
|
|
@@ -80,5 +79,5 @@ interface UseResourceFiltersHook {
|
|
|
80
79
|
*/
|
|
81
80
|
viewTitle?: string;
|
|
82
81
|
}
|
|
83
|
-
export declare function useResourceFilters({ instructions, predicateWhitelist }: UseResourceFiltersConfig): UseResourceFiltersHook;
|
|
82
|
+
export declare function useResourceFilters({ instructions, predicateWhitelist, }: UseResourceFiltersConfig): UseResourceFiltersHook;
|
|
84
83
|
export {};
|
|
@@ -9,7 +9,7 @@ import { FilterItemOptions, FiltersInstructions } from './types';
|
|
|
9
9
|
* "Markets · 2 of 4"
|
|
10
10
|
* "Markets · 4"
|
|
11
11
|
*/
|
|
12
|
-
export declare function computeFilterLabel({ label, totalCount, selectedCount }: {
|
|
12
|
+
export declare function computeFilterLabel({ label, totalCount, selectedCount, }: {
|
|
13
13
|
label: string;
|
|
14
14
|
totalCount: number;
|
|
15
15
|
selectedCount: number;
|
|
@@ -21,7 +21,7 @@ export declare function computeFilterLabel({ label, totalCount, selectedCount }:
|
|
|
21
21
|
* Example: if we have 3 markets selected, will still count as `1` active filter group
|
|
22
22
|
* If we have 3 markets and 1 status selected, will count as `2`.
|
|
23
23
|
*/
|
|
24
|
-
export declare function getActiveFilterCountFromUrl({ includeTextSearch, instructions, queryString }: {
|
|
24
|
+
export declare function getActiveFilterCountFromUrl({ includeTextSearch, instructions, queryString, }: {
|
|
25
25
|
includeTextSearch?: boolean;
|
|
26
26
|
instructions: FiltersInstructions;
|
|
27
27
|
queryString: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type ResourceListItemTemplateProps, type ResourceListProps, type UseResourceListConfig, useResourceList, } from './useResourceList';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommerceLayerClient, ListableResourceType, QueryParamsList, ResourceFields } from '@commercelayer/sdk';
|
|
2
2
|
import { MetricsApiClient } from './metricsApiClient';
|
|
3
|
-
type ListResource<TResource extends ListableResourceType> = Awaited<ReturnType<CommerceLayerClient[TResource][
|
|
3
|
+
type ListResource<TResource extends ListableResourceType> = Awaited<ReturnType<CommerceLayerClient[TResource]["list"]>>;
|
|
4
4
|
export type Resource<TResource extends ListableResourceType> = ListResource<TResource>[number];
|
|
5
5
|
export interface FetcherResponse<TResource> {
|
|
6
6
|
list: TResource[];
|
|
@@ -12,16 +12,16 @@ export interface FetcherResponse<TResource> {
|
|
|
12
12
|
cursor?: string | null;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
export declare function infiniteFetcher<TResource extends ListableResourceType>({ currentData, resourceType, client, clientType, query }: {
|
|
15
|
+
export declare function infiniteFetcher<TResource extends ListableResourceType>({ currentData, resourceType, client, clientType, query, }: {
|
|
16
16
|
currentData?: FetcherResponse<Resource<TResource>>;
|
|
17
17
|
resourceType: TResource;
|
|
18
18
|
} & ({
|
|
19
19
|
client: CommerceLayerClient;
|
|
20
|
-
clientType:
|
|
21
|
-
query?: Omit<QueryParamsList<ResourceFields[TResource]>,
|
|
20
|
+
clientType: "coreSdkClient";
|
|
21
|
+
query?: Omit<QueryParamsList<ResourceFields[TResource]>, "pageNumber">;
|
|
22
22
|
} | {
|
|
23
23
|
client: MetricsApiClient;
|
|
24
|
-
clientType:
|
|
24
|
+
clientType: "metricsClient";
|
|
25
25
|
query: Record<string, Record<string, unknown>>;
|
|
26
26
|
})): Promise<FetcherResponse<Resource<TResource>>>;
|
|
27
27
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MetricsFilters } from '../useResourceFilters/adaptSdkToMetrics';
|
|
2
1
|
import { ListableResourceType, ListMeta, ListResponse } from '@commercelayer/sdk';
|
|
3
2
|
import { Writable } from 'type-fest';
|
|
3
|
+
import { MetricsFilters } from '../useResourceFilters/adaptSdkToMetrics';
|
|
4
4
|
import { Resource } from './infiniteFetcher';
|
|
5
|
-
export type MetricsResources =
|
|
6
|
-
type ListResponseWithoutMeta<ResourceType extends MetricsResources> = Omit<ListResponse<Resource<ResourceType>>,
|
|
5
|
+
export type MetricsResources = "orders" | "returns";
|
|
6
|
+
type ListResponseWithoutMeta<ResourceType extends MetricsResources> = Omit<ListResponse<Resource<ResourceType>>, "meta">;
|
|
7
7
|
type ListMetaWithCursor = Writable<ListMeta> & {
|
|
8
8
|
cursor: string | null;
|
|
9
9
|
};
|
|
@@ -13,7 +13,7 @@ type ListResponseMetrics<ResourceType extends MetricsResources> = ListResponseWi
|
|
|
13
13
|
type MetricsList = <Resource extends MetricsResources>(resourceType: Resource, query: {
|
|
14
14
|
search?: {
|
|
15
15
|
limit?: number;
|
|
16
|
-
sort?:
|
|
16
|
+
sort?: "asc" | "desc";
|
|
17
17
|
sort_by?: string;
|
|
18
18
|
fields?: string[];
|
|
19
19
|
cursor?: string | null;
|
|
@@ -9,17 +9,17 @@ interface ResourceListInternalState<TResource extends ListableResourceType> {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const initialState: ResourceListInternalState<ListableResourceType>;
|
|
11
11
|
type Action<TResource extends ListableResourceType> = {
|
|
12
|
-
type:
|
|
12
|
+
type: "prepare";
|
|
13
13
|
} | {
|
|
14
|
-
type:
|
|
14
|
+
type: "reset";
|
|
15
15
|
} | {
|
|
16
|
-
type:
|
|
16
|
+
type: "loaded";
|
|
17
17
|
payload: FetcherResponse<Resource<TResource>>;
|
|
18
18
|
} | {
|
|
19
|
-
type:
|
|
19
|
+
type: "error";
|
|
20
20
|
payload: string;
|
|
21
21
|
} | {
|
|
22
|
-
type:
|
|
22
|
+
type: "removeItem";
|
|
23
23
|
payload: {
|
|
24
24
|
resourceId: string;
|
|
25
25
|
};
|