@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
|
@@ -3,4 +3,4 @@ import { DisplayStatus } from './types';
|
|
|
3
3
|
export interface CustomerDisplayStatus extends DisplayStatus {
|
|
4
4
|
}
|
|
5
5
|
export declare function getCustomerDisplayStatus(customerObj: Customer): CustomerDisplayStatus;
|
|
6
|
-
export declare function getCustomerStatusName(status: Customer[
|
|
6
|
+
export declare function getCustomerStatusName(status: Customer["status"]): string;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
2
1
|
import { Order } from '@commercelayer/sdk';
|
|
2
|
+
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
3
3
|
import { DisplayStatus } from './types';
|
|
4
4
|
export interface OrderDisplayStatus extends DisplayStatus {
|
|
5
5
|
label: string;
|
|
6
|
-
icon: StatusIconProps[
|
|
7
|
-
color: StatusIconProps[
|
|
6
|
+
icon: StatusIconProps["name"];
|
|
7
|
+
color: StatusIconProps["background"];
|
|
8
8
|
task?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function getOrderDisplayStatus(order: Order): OrderDisplayStatus;
|
|
11
|
-
export declare function getOrderTransactionName(type: NonNullable<Order[
|
|
11
|
+
export declare function getOrderTransactionName(type: NonNullable<Order["transactions"]>[number]["type"]): {
|
|
12
12
|
pastTense: string;
|
|
13
13
|
singular: string;
|
|
14
14
|
};
|
|
15
|
-
export declare function getOrderStatusName(status: Order[
|
|
16
|
-
export declare function getOrderPaymentStatusName(status: Order[
|
|
17
|
-
export declare function getOrderFulfillmentStatusName(status: Order[
|
|
15
|
+
export declare function getOrderStatusName(status: Order["status"]): string;
|
|
16
|
+
export declare function getOrderPaymentStatusName(status: Order["payment_status"]): string;
|
|
17
|
+
export declare function getOrderFulfillmentStatusName(status: Order["fulfillment_status"]): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Promotion } from '@commercelayer/sdk';
|
|
2
2
|
import { DisplayStatus } from './types';
|
|
3
3
|
interface PromotionDisplayStatus extends DisplayStatus {
|
|
4
|
-
status:
|
|
4
|
+
status: "disabled" | "active" | "upcoming" | "expired" | "used";
|
|
5
5
|
}
|
|
6
|
-
export declare function getPromotionDisplayStatus(promotion: Omit<Promotion,
|
|
6
|
+
export declare function getPromotionDisplayStatus(promotion: Omit<Promotion, "type" | "promotion_rules">): PromotionDisplayStatus;
|
|
7
7
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
2
1
|
import { Return } from '@commercelayer/sdk';
|
|
2
|
+
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
3
3
|
import { DisplayStatus } from './types';
|
|
4
4
|
export interface ReturnDisplayStatus extends DisplayStatus {
|
|
5
5
|
label: string;
|
|
6
|
-
icon: StatusIconProps[
|
|
7
|
-
color: StatusIconProps[
|
|
6
|
+
icon: StatusIconProps["name"];
|
|
7
|
+
color: StatusIconProps["background"];
|
|
8
8
|
task?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function getReturnDisplayStatus(returnObj: Return): ReturnDisplayStatus;
|
|
11
|
-
export declare function getReturnStatusName(status: Return[
|
|
11
|
+
export declare function getReturnStatusName(status: Return["status"]): string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
2
1
|
import { Shipment } from '@commercelayer/sdk';
|
|
2
|
+
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
3
3
|
import { DisplayStatus } from './types';
|
|
4
4
|
export interface ShipmentDisplayStatus extends DisplayStatus {
|
|
5
5
|
label: string;
|
|
6
|
-
icon: StatusIconProps[
|
|
7
|
-
color: StatusIconProps[
|
|
6
|
+
icon: StatusIconProps["name"];
|
|
7
|
+
color: StatusIconProps["background"];
|
|
8
8
|
task?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function getShipmentDisplayStatus(shipment: Shipment, awaitingStockTransfer?: boolean): ShipmentDisplayStatus;
|
|
11
|
-
export declare function getShipmentStatusName(status: Shipment[
|
|
11
|
+
export declare function getShipmentStatusName(status: Shipment["status"]): string;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
2
1
|
import { StockTransfer } from '@commercelayer/sdk';
|
|
2
|
+
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
3
3
|
import { DisplayStatus } from './types';
|
|
4
4
|
export interface StockTransferDisplayStatus extends DisplayStatus {
|
|
5
5
|
label: string;
|
|
6
|
-
icon: StatusIconProps[
|
|
7
|
-
color: StatusIconProps[
|
|
6
|
+
icon: StatusIconProps["name"];
|
|
7
|
+
color: StatusIconProps["background"];
|
|
8
8
|
task?: string;
|
|
9
9
|
}
|
|
10
10
|
export declare function getStockTransferDisplayStatus(stockTransfer: StockTransfer): StockTransferDisplayStatus;
|
|
11
|
-
export declare function getStockTransferStatusName(status: StockTransfer[
|
|
11
|
+
export declare function getStockTransferStatusName(status: StockTransfer["status"]): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StatusIconProps } from '../ui/atoms/StatusIcon';
|
|
2
2
|
export interface DisplayStatus {
|
|
3
3
|
label: string;
|
|
4
|
-
icon: StatusIconProps[
|
|
5
|
-
color: StatusIconProps[
|
|
4
|
+
icon: StatusIconProps["name"];
|
|
5
|
+
color: StatusIconProps["background"];
|
|
6
6
|
task?: string;
|
|
7
7
|
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const c = /* @__PURE__ */ (() => {
|
|
3
|
+
let t;
|
|
4
|
+
return async (a = !0) => {
|
|
5
|
+
if (a) {
|
|
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((s) => s.id === "sku" ? (delete s.attributes.fields.inventory, {
|
|
30
|
+
...s,
|
|
31
|
+
attributes: {
|
|
32
|
+
...s.attributes,
|
|
33
|
+
relationships: {
|
|
34
|
+
...s.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
|
+
}) : s)
|
|
49
|
+
})).then(
|
|
50
|
+
({ data: e }) => e.reduce((s, r, i, u) => ({
|
|
51
|
+
...s,
|
|
52
|
+
[r.id]: {
|
|
53
|
+
...r,
|
|
54
|
+
fields: Object.entries(r.attributes.fields).filter(([n]) => !n.startsWith("_")),
|
|
55
|
+
relationships: Object.entries(r.attributes.relationships).filter(([n]) => !n.startsWith("_")).filter(
|
|
56
|
+
([, n]) => e.find(
|
|
57
|
+
(o) => o.id === h(n.class_name)
|
|
58
|
+
) != null
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}), {})
|
|
62
|
+
).catch((e) => {
|
|
63
|
+
throw e;
|
|
64
|
+
})), t;
|
|
65
|
+
};
|
|
66
|
+
})();
|
|
67
|
+
c(!1);
|
|
68
|
+
async function f(t, a) {
|
|
69
|
+
if (!new RegExp(`^(${t.join("|")})(.|$)`).test(a))
|
|
70
|
+
return t.map((r) => ({
|
|
71
|
+
value: r,
|
|
72
|
+
type: "relationship"
|
|
73
|
+
}));
|
|
74
|
+
const e = await p(a);
|
|
75
|
+
return [].concat(
|
|
76
|
+
e.resource?.fields.map(([r]) => ({
|
|
77
|
+
value: `${e.resourcePath}.${r}`,
|
|
78
|
+
type: "field"
|
|
79
|
+
})) ?? []
|
|
80
|
+
).concat(
|
|
81
|
+
e.resource?.relationships.map(([r]) => ({
|
|
82
|
+
value: `${e.resourcePath}.${r}`,
|
|
83
|
+
type: "relationship"
|
|
84
|
+
})) ?? []
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
async function p(t, a) {
|
|
88
|
+
const e = await c(), s = t.replace(/\.$/, "").split("."), r = s.shift();
|
|
89
|
+
return a ??= e[r ?? ""], s.reduce(
|
|
90
|
+
(i, u) => {
|
|
91
|
+
const n = i.resource?.relationships.find(
|
|
92
|
+
([l]) => l === u
|
|
93
|
+
)?.[1].class_name;
|
|
94
|
+
if (n == null) {
|
|
95
|
+
const l = i.resource?.fields.find(([d]) => d === u)?.[1];
|
|
96
|
+
return {
|
|
97
|
+
...i,
|
|
98
|
+
field: l != null ? {
|
|
99
|
+
...l,
|
|
100
|
+
name: u
|
|
101
|
+
} : void 0
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const o = e[h(n)];
|
|
105
|
+
return o == null ? i : {
|
|
106
|
+
path: i.path,
|
|
107
|
+
resourcePath: `${i.resourcePath == null ? "" : `${i.resourcePath}.`}${u}`,
|
|
108
|
+
resource: o
|
|
109
|
+
};
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
path: t,
|
|
113
|
+
resourcePath: a != null ? r ?? "" : "",
|
|
114
|
+
resource: a
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function h(t) {
|
|
119
|
+
return t.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toLowerCase();
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
p as a,
|
|
123
|
+
f
|
|
124
|
+
};
|
|
@@ -12,7 +12,7 @@ export interface BackToItem {
|
|
|
12
12
|
/**
|
|
13
13
|
* Navigate back to the url found in sessionStorage or to the default relative path.
|
|
14
14
|
*/
|
|
15
|
-
export declare function goBack({ setLocation, defaultRelativePath }: {
|
|
15
|
+
export declare function goBack({ setLocation, defaultRelativePath, }: {
|
|
16
16
|
/**
|
|
17
17
|
* React router's history.push method, this is used when linking internal app pages.
|
|
18
18
|
*/
|
|
@@ -57,7 +57,7 @@ interface NavigateToExternalParams {
|
|
|
57
57
|
/**
|
|
58
58
|
* required when linking to another app, it indicates if the destination app should be opened in test or live mode
|
|
59
59
|
*/
|
|
60
|
-
mode:
|
|
60
|
+
mode: "test" | "live";
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -5,4 +5,4 @@ export declare const referenceOrigins: {
|
|
|
5
5
|
readonly appOrdersRefundNote: "app-orders--refund-note";
|
|
6
6
|
readonly appShipmentsNote: "app-shipments--note";
|
|
7
7
|
};
|
|
8
|
-
export declare function isAttachmentValidNote(attachment: Attachment, validReferenceOrigins: Array<(typeof referenceOrigins)[keyof typeof referenceOrigins]>): attachment is SetNonNullable<SetRequired<Attachment,
|
|
8
|
+
export declare function isAttachmentValidNote(attachment: Attachment, validReferenceOrigins: Array<(typeof referenceOrigins)[keyof typeof referenceOrigins]>): attachment is SetNonNullable<SetRequired<Attachment, "description" | "reference_origin">, "description" | "reference_origin">;
|
package/dist/helpers/date.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { I18NLocale } from '../providers/I18NProvider';
|
|
2
1
|
import { Simplify } from 'type-fest';
|
|
3
|
-
|
|
2
|
+
import { I18NLocale } from '../providers/I18NProvider';
|
|
3
|
+
type Format = "date" | "time" | "timeWithSeconds" | "full" | "fullWithSeconds" | "distanceToNow";
|
|
4
4
|
interface FormatDateOptions {
|
|
5
5
|
/**
|
|
6
6
|
* JavaScript ISO date string. Example '2022-10-06T11:59:30.371Z'
|
|
@@ -49,7 +49,7 @@ interface FormatDateWithPredicateOptions extends FormatDateOptions {
|
|
|
49
49
|
* @param opts a set of `FormatDateOptions` along with a date verb predicate. In this method `format` prop has 'full' default value.
|
|
50
50
|
* @returns a nice string representation of the predicate, followed by the proper separator and the formatted date. Examples: 'Created today · 1:16 PM', 'Updated on Jul 21, 2022 · 1:16 PM' or 'Updated at 1:16 PM'
|
|
51
51
|
*/
|
|
52
|
-
export declare function formatDateWithPredicate({ isoDate, timezone, format, predicate, locale }: FormatDateWithPredicateOptions): string;
|
|
52
|
+
export declare function formatDateWithPredicate({ isoDate, timezone, format, predicate, locale, }: FormatDateWithPredicateOptions): string;
|
|
53
53
|
export declare const timeSeparator = ", ";
|
|
54
54
|
type DateISOString = string;
|
|
55
55
|
/**
|
|
@@ -61,9 +61,9 @@ type DateISOString = string;
|
|
|
61
61
|
* @returns a JavaScript ISO date string that reflect the start or end of the day
|
|
62
62
|
* based on the user timezone. Example '2022-10-06T22:00:00.000Z' when timezone is 'Europe/Rome'
|
|
63
63
|
*/
|
|
64
|
-
export declare function getIsoDateAtDayEdge({ isoString, edge, timezone }: {
|
|
64
|
+
export declare function getIsoDateAtDayEdge({ isoString, edge, timezone, }: {
|
|
65
65
|
isoString: DateISOString;
|
|
66
|
-
edge:
|
|
66
|
+
edge: "startOfTheDay" | "endOfTheDay";
|
|
67
67
|
timezone?: string;
|
|
68
68
|
}): string | undefined;
|
|
69
69
|
/**
|
|
@@ -80,7 +80,7 @@ export declare function getIsoDateAtDayEdge({ isoString, edge, timezone }: {
|
|
|
80
80
|
* @param timezone (optional) in case of working with a specific timezone different from UTC
|
|
81
81
|
* @returns a new iso string
|
|
82
82
|
*/
|
|
83
|
-
export declare function getIsoDateAtDaysBefore({ isoString, days, timezone }: {
|
|
83
|
+
export declare function getIsoDateAtDaysBefore({ isoString, days, timezone, }: {
|
|
84
84
|
isoString: DateISOString;
|
|
85
85
|
days: number;
|
|
86
86
|
timezone?: string;
|
|
@@ -88,19 +88,19 @@ export declare function getIsoDateAtDaysBefore({ isoString, days, timezone }: {
|
|
|
88
88
|
/**
|
|
89
89
|
* Given the event date (`startsAt` and `expiresAt`) it returns whether the the event is `active`, `past` or `upcoming`.
|
|
90
90
|
*/
|
|
91
|
-
export declare function getEventDateInfo({ startsAt, expiresAt, timezone }: {
|
|
91
|
+
export declare function getEventDateInfo({ startsAt, expiresAt, timezone, }: {
|
|
92
92
|
/** The activation date/time of the event (ISO date string. Example '2022-10-06T11:59:30.371Z'). */
|
|
93
93
|
startsAt: DateISOString;
|
|
94
94
|
/** The expiration date/time of the promotion (must be after startsAt) (ISO date string. Example '2022-10-06T11:59:30.371Z'). */
|
|
95
95
|
expiresAt: DateISOString;
|
|
96
96
|
/** Set a specific timezone, when not passed default value is 'UTC' */
|
|
97
97
|
timezone?: string;
|
|
98
|
-
}):
|
|
98
|
+
}): "active" | "past" | "upcoming";
|
|
99
99
|
/**
|
|
100
100
|
* Format a date range as a nice string also specifying a custom timezone
|
|
101
101
|
* @returns a nice string representation. Example: '1-21 Jul, 2022' or 'Jul 21, 2022 - Jan 12, 2023'
|
|
102
102
|
*/
|
|
103
|
-
export declare function formatDateRange({ rangeFrom, rangeTo, timezone, locale }: {
|
|
103
|
+
export declare function formatDateRange({ rangeFrom, rangeTo, timezone, locale, }: {
|
|
104
104
|
/** JavaScript Date or ISO string. Example '2022-10-06T11:59:30.371Z' */
|
|
105
105
|
rangeFrom: DateISOString | Date;
|
|
106
106
|
/** JavaScript Date or ISO string. Example '2022-11-06T11:59:30.371Z' */
|
|
@@ -114,17 +114,17 @@ export declare function formatDateRange({ rangeFrom, rangeTo, timezone, locale }
|
|
|
114
114
|
export interface Event {
|
|
115
115
|
date: string;
|
|
116
116
|
}
|
|
117
|
-
type Position =
|
|
117
|
+
type Position = "first" | "other";
|
|
118
118
|
/**
|
|
119
119
|
*
|
|
120
120
|
* @param events
|
|
121
121
|
* @param options
|
|
122
122
|
* @returns
|
|
123
123
|
*/
|
|
124
|
-
export declare function sortAndGroupByDate<T extends Event>(events: T[], { timezone, locale, orders }?: {
|
|
124
|
+
export declare function sortAndGroupByDate<T extends Event>(events: T[], { timezone, locale, orders, }?: {
|
|
125
125
|
timezone?: string;
|
|
126
126
|
locale?: I18NLocale;
|
|
127
|
-
orders?:
|
|
127
|
+
orders?: "asc" | "desc";
|
|
128
128
|
}): Record<string, Array<Simplify<T & {
|
|
129
129
|
position: Position;
|
|
130
130
|
}>>>;
|
|
@@ -159,7 +159,7 @@ export declare function removeMillisecondsFromIsoDate(isoDate: string): string;
|
|
|
159
159
|
* // { date_from: '2022-04-24T13:45:01.000Z, date_to: '2023-04-24T13:45:00.000Z' }
|
|
160
160
|
* ```
|
|
161
161
|
*/
|
|
162
|
-
export declare function makeDateYearsRange({ now, yearsAgo, showMilliseconds }: {
|
|
162
|
+
export declare function makeDateYearsRange({ now, yearsAgo, showMilliseconds, }: {
|
|
163
163
|
now: Date;
|
|
164
164
|
yearsAgo: number;
|
|
165
165
|
showMilliseconds: boolean;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @param json - optional JSON object that will be the content of downloaded file
|
|
4
4
|
* @param filename - string to define the downloaded file name
|
|
5
5
|
*/
|
|
6
|
-
export declare function downloadJsonAsFile({ json, filename }: {
|
|
6
|
+
export declare function downloadJsonAsFile({ json, filename, }: {
|
|
7
7
|
json?: object;
|
|
8
8
|
filename: string;
|
|
9
9
|
}): void;
|
|
@@ -3,13 +3,13 @@ import { ListableResourceType, ResourceTypeLock, ResourceUpdate } from '@commerc
|
|
|
3
3
|
* Format a resource name for display in the UI based on the count and format.
|
|
4
4
|
* default format is lower case and singular
|
|
5
5
|
*/
|
|
6
|
-
export declare function formatResourceName({ resource, count, format }: {
|
|
6
|
+
export declare function formatResourceName({ resource, count, format, }: {
|
|
7
7
|
resource: ListableResourceType;
|
|
8
|
-
count?: number |
|
|
9
|
-
format?:
|
|
8
|
+
count?: number | "singular" | "plural";
|
|
9
|
+
format?: "lower" | "title";
|
|
10
10
|
}): string;
|
|
11
11
|
export type TriggerAttribute<Resource extends ResourceUpdate> = Extract<keyof Resource, `_${string}`>;
|
|
12
|
-
export type ResourceEndpoint = Exclude<ResourceTypeLock,
|
|
12
|
+
export type ResourceEndpoint = Exclude<ResourceTypeLock, "applications" | "organizations"> | ("organization" | "application");
|
|
13
13
|
/**
|
|
14
14
|
* Get the resource endpoint for a given resource type.
|
|
15
15
|
* @param resourceType The resource type
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AvatarProps } from '../ui/atoms/Avatar';
|
|
2
1
|
import { Parcel, Shipment } from '@commercelayer/sdk';
|
|
3
2
|
import { SetNonNullable } from 'type-fest';
|
|
4
3
|
import { z } from 'zod';
|
|
5
|
-
|
|
4
|
+
import { AvatarProps } from '../ui/atoms/Avatar';
|
|
5
|
+
export declare function getAvatarSrcFromRate(rate: Rate): AvatarProps["src"];
|
|
6
6
|
/**
|
|
7
7
|
* Get tracking details descending sorted from a parcel.
|
|
8
8
|
*/
|
|
@@ -86,9 +86,9 @@ declare const trackingDetailSchema: z.ZodObject<{
|
|
|
86
86
|
carrier_code: z.ZodNullable<z.ZodString>;
|
|
87
87
|
}, "strip", z.ZodTypeAny, {
|
|
88
88
|
object: "TrackingDetail";
|
|
89
|
-
description: string | null;
|
|
90
89
|
source: string | null;
|
|
91
90
|
status: string | null;
|
|
91
|
+
description: string | null;
|
|
92
92
|
message: string | null;
|
|
93
93
|
status_detail: string | null;
|
|
94
94
|
datetime: string | null;
|
|
@@ -102,9 +102,9 @@ declare const trackingDetailSchema: z.ZodObject<{
|
|
|
102
102
|
carrier_code: string | null;
|
|
103
103
|
}, {
|
|
104
104
|
object: "TrackingDetail";
|
|
105
|
-
description: string | null;
|
|
106
105
|
source: string | null;
|
|
107
106
|
status: string | null;
|
|
107
|
+
description: string | null;
|
|
108
108
|
message: string | null;
|
|
109
109
|
status_detail: string | null;
|
|
110
110
|
datetime: string | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
export declare const useClickAway: (onClickAway
|
|
2
|
+
export declare const useClickAway: (onClickAway: () => void) => RefObject<HTMLDivElement> | undefined;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ResourceMetadataProps } from '../ui/resources/ResourceMetadata';
|
|
2
1
|
import { FC } from 'react';
|
|
2
|
+
import { ResourceMetadataProps } from '../ui/resources/ResourceMetadata';
|
|
3
3
|
export interface EditMetadataOverlayProps {
|
|
4
4
|
/**
|
|
5
5
|
* Optional title shown as first line in edit overlay heading
|
|
6
6
|
*/
|
|
7
7
|
title?: string;
|
|
8
|
-
resourceId: ResourceMetadataProps[
|
|
9
|
-
resourceType: ResourceMetadataProps[
|
|
8
|
+
resourceId: ResourceMetadataProps["resourceId"];
|
|
9
|
+
resourceType: ResourceMetadataProps["resourceType"];
|
|
10
10
|
}
|
|
11
11
|
interface MetadataOverlayHook {
|
|
12
12
|
show: () => void;
|
|
@@ -8,8 +8,8 @@ export interface EditTagsOverlayProps {
|
|
|
8
8
|
* Optional setting to define if tags app management link is to be shown in edit overlay heading
|
|
9
9
|
*/
|
|
10
10
|
showManageAction?: boolean;
|
|
11
|
-
resourceId: ResourceTagsProps[
|
|
12
|
-
resourceType: ResourceTagsProps[
|
|
11
|
+
resourceId: ResourceTagsProps["resourceId"];
|
|
12
|
+
resourceType: ResourceTagsProps["resourceType"];
|
|
13
13
|
}
|
|
14
14
|
interface TagsOverlayHook {
|
|
15
15
|
show: () => void;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param onChange - the action to trigger when the value has changed
|
|
6
6
|
* @returns - a boolean that is true when the value has changed
|
|
7
7
|
*/
|
|
8
|
-
export declare function useIsChanged<T>({ value, onChange }: {
|
|
8
|
+
export declare function useIsChanged<T>({ value, onChange, }: {
|
|
9
9
|
value: T;
|
|
10
10
|
onChange?: () => void;
|
|
11
11
|
}): boolean;
|