@commercelayer/app-elements 3.5.5 → 4.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-NikfTdOf.js → CodeEditorComponent-BM9GGZHI.js} +1 -1
- package/dist/{InputDateComponent-DvW00SBU.js → InputDateComponent-XtWNeU2M.js} +1 -1
- package/dist/en--hqV_y40.js +633 -0
- package/dist/helpers/date.d.ts +13 -4
- package/dist/helpers/tracking.d.ts +12 -12
- package/dist/it-CcVOP-FB.js +633 -0
- package/dist/locales/en.d.ts +626 -0
- package/dist/locales/it.d.ts +3 -0
- package/dist/{main-DhEziGo0.js → main-K7NMNv6S.js} +21606 -19112
- package/dist/main.d.ts +7 -6
- package/dist/main.js +162 -156
- package/dist/providers/I18NProvider.d.ts +23 -0
- package/dist/providers/TokenProvider/types.d.ts +1 -0
- package/dist/ui/atoms/Card.d.ts +4 -4
- package/dist/ui/composite/Dropdown/DropdownItem.d.ts +4 -4
- package/dist/ui/composite/Routes/Routes.d.ts +3 -0
- package/dist/ui/composite/Routes/index.d.ts +1 -1
- package/dist/ui/resources/ResourceAddress/ResourceAddressFormFields.d.ts +8 -8
- package/dist/ui/resources/ResourceListItem/types.d.ts +2 -0
- package/dist/ui/resources/useResourceFilters/timeUtils.d.ts +2 -1
- package/package.json +4 -1
package/dist/helpers/date.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { I18NLocale } from '../providers/I18NProvider';
|
|
1
2
|
import { Simplify } from 'type-fest';
|
|
2
3
|
type Format = 'date' | 'time' | 'timeWithSeconds' | 'full' | 'fullWithSeconds' | 'distanceToNow';
|
|
3
4
|
interface FormatDateOptions {
|
|
@@ -25,13 +26,18 @@ interface FormatDateOptions {
|
|
|
25
26
|
* @default false
|
|
26
27
|
*/
|
|
27
28
|
showCurrentYear?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Locale to use for formatting the date.
|
|
31
|
+
* @default en
|
|
32
|
+
*/
|
|
33
|
+
locale?: I18NLocale;
|
|
28
34
|
}
|
|
29
35
|
/**
|
|
30
36
|
* Format the date as nice string also specifying a custom timezone
|
|
31
37
|
* @param opts a set of `FormatDateOptions`
|
|
32
38
|
* @returns a nice string representation. Example: 'Jul 21, 2022' or 'Jul 21, 2022 · 1:16 PM' if includeTime
|
|
33
39
|
*/
|
|
34
|
-
export declare function formatDate({ isoDate, timezone, showCurrentYear, ...opts }: FormatDateOptions): string;
|
|
40
|
+
export declare function formatDate({ isoDate, timezone, locale, showCurrentYear, ...opts }: FormatDateOptions): string;
|
|
35
41
|
interface FormatDateWithPredicateOptions extends FormatDateOptions {
|
|
36
42
|
/**
|
|
37
43
|
* Date predicate verb string. Example: 'Created' or 'Updated'.
|
|
@@ -43,7 +49,7 @@ interface FormatDateWithPredicateOptions extends FormatDateOptions {
|
|
|
43
49
|
* @param opts a set of `FormatDateOptions` along with a date verb predicate. In this method `format` prop has 'full' default value.
|
|
44
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'
|
|
45
51
|
*/
|
|
46
|
-
export declare function formatDateWithPredicate({ isoDate, timezone, format, predicate }: FormatDateWithPredicateOptions): string;
|
|
52
|
+
export declare function formatDateWithPredicate({ isoDate, timezone, format, predicate, locale }: FormatDateWithPredicateOptions): string;
|
|
47
53
|
export declare const timeSeparator = ", ";
|
|
48
54
|
type DateISOString = string;
|
|
49
55
|
/**
|
|
@@ -94,13 +100,15 @@ export declare function getEventDateInfo({ startsAt, expiresAt, timezone }: {
|
|
|
94
100
|
* Format a date range as a nice string also specifying a custom timezone
|
|
95
101
|
* @returns a nice string representation. Example: '1-21 Jul, 2022' or 'Jul 21, 2022 - Jan 12, 2023'
|
|
96
102
|
*/
|
|
97
|
-
export declare function formatDateRange({ rangeFrom, rangeTo, timezone }: {
|
|
103
|
+
export declare function formatDateRange({ rangeFrom, rangeTo, timezone, locale }: {
|
|
98
104
|
/** JavaScript ISO date string. Example '2022-10-06T11:59:30.371Z' */
|
|
99
105
|
rangeFrom: DateISOString;
|
|
100
106
|
/** JavaScript ISO date string. Example '2022-11-06T11:59:30.371Z' */
|
|
101
107
|
rangeTo: DateISOString;
|
|
102
108
|
/** Set a specific timezone, when not passed default value is 'UTC' */
|
|
103
109
|
timezone?: string;
|
|
110
|
+
/** Locale to use for formatting the date. */
|
|
111
|
+
locale?: I18NLocale;
|
|
104
112
|
}): string;
|
|
105
113
|
export interface Event {
|
|
106
114
|
date: string;
|
|
@@ -112,8 +120,9 @@ type Position = 'first' | 'other';
|
|
|
112
120
|
* @param options
|
|
113
121
|
* @returns
|
|
114
122
|
*/
|
|
115
|
-
export declare function sortAndGroupByDate<T extends Event>(events: T[], { timezone, orders }?: {
|
|
123
|
+
export declare function sortAndGroupByDate<T extends Event>(events: T[], { timezone, locale, orders }?: {
|
|
116
124
|
timezone?: string;
|
|
125
|
+
locale?: I18NLocale;
|
|
117
126
|
orders?: 'asc' | 'desc';
|
|
118
127
|
}): Record<string, Array<Simplify<T & {
|
|
119
128
|
position: Position;
|
|
@@ -59,26 +59,26 @@ declare const trackingDetailSchema: z.ZodObject<{
|
|
|
59
59
|
zip: z.ZodNullable<z.ZodString>;
|
|
60
60
|
}, "strip", z.ZodTypeAny, {
|
|
61
61
|
object: "TrackingLocation";
|
|
62
|
-
country: string | null;
|
|
63
62
|
city: string | null;
|
|
63
|
+
country: string | null;
|
|
64
64
|
state: string | null;
|
|
65
65
|
zip: string | null;
|
|
66
66
|
}, {
|
|
67
67
|
object: "TrackingLocation";
|
|
68
|
-
country: string | null;
|
|
69
68
|
city: string | null;
|
|
69
|
+
country: string | null;
|
|
70
70
|
state: string | null;
|
|
71
71
|
zip: string | null;
|
|
72
72
|
}>, SetNonNullable<{
|
|
73
73
|
object: "TrackingLocation";
|
|
74
|
-
country: string | null;
|
|
75
74
|
city: string | null;
|
|
75
|
+
country: string | null;
|
|
76
76
|
state: string | null;
|
|
77
77
|
zip: string | null;
|
|
78
78
|
}, "city"> | null, {
|
|
79
79
|
object: "TrackingLocation";
|
|
80
|
-
country: string | null;
|
|
81
80
|
city: string | null;
|
|
81
|
+
country: string | null;
|
|
82
82
|
state: string | null;
|
|
83
83
|
zip: string | null;
|
|
84
84
|
}>;
|
|
@@ -88,14 +88,14 @@ declare const trackingDetailSchema: z.ZodObject<{
|
|
|
88
88
|
object: "TrackingDetail";
|
|
89
89
|
description: string | null;
|
|
90
90
|
source: string | null;
|
|
91
|
-
message: string | null;
|
|
92
91
|
status: string | null;
|
|
92
|
+
message: string | null;
|
|
93
93
|
status_detail: string | null;
|
|
94
94
|
datetime: string | null;
|
|
95
95
|
tracking_location: SetNonNullable<{
|
|
96
96
|
object: "TrackingLocation";
|
|
97
|
-
country: string | null;
|
|
98
97
|
city: string | null;
|
|
98
|
+
country: string | null;
|
|
99
99
|
state: string | null;
|
|
100
100
|
zip: string | null;
|
|
101
101
|
}, "city"> | null;
|
|
@@ -104,14 +104,14 @@ declare const trackingDetailSchema: z.ZodObject<{
|
|
|
104
104
|
object: "TrackingDetail";
|
|
105
105
|
description: string | null;
|
|
106
106
|
source: string | null;
|
|
107
|
-
message: string | null;
|
|
108
107
|
status: string | null;
|
|
108
|
+
message: string | null;
|
|
109
109
|
status_detail: string | null;
|
|
110
110
|
datetime: string | null;
|
|
111
111
|
tracking_location: {
|
|
112
112
|
object: "TrackingLocation";
|
|
113
|
-
country: string | null;
|
|
114
113
|
city: string | null;
|
|
114
|
+
country: string | null;
|
|
115
115
|
state: string | null;
|
|
116
116
|
zip: string | null;
|
|
117
117
|
};
|
|
@@ -150,12 +150,12 @@ declare const rateSchema: z.ZodObject<{
|
|
|
150
150
|
}, "strip", z.ZodTypeAny, {
|
|
151
151
|
id: string;
|
|
152
152
|
mode: "test" | "production";
|
|
153
|
+
currency: string;
|
|
154
|
+
rate: number;
|
|
153
155
|
service: string;
|
|
154
156
|
carrier: string;
|
|
155
157
|
carrier_account_id: string;
|
|
156
158
|
shipment_id: string;
|
|
157
|
-
rate: number;
|
|
158
|
-
currency: string;
|
|
159
159
|
formatted_rate: string;
|
|
160
160
|
delivery_days?: number | undefined;
|
|
161
161
|
delivery_date?: string | undefined;
|
|
@@ -164,12 +164,12 @@ declare const rateSchema: z.ZodObject<{
|
|
|
164
164
|
}, {
|
|
165
165
|
id: string;
|
|
166
166
|
mode: "test" | "production";
|
|
167
|
+
currency: string;
|
|
168
|
+
rate: number;
|
|
167
169
|
service: string;
|
|
168
170
|
carrier: string;
|
|
169
171
|
carrier_account_id: string;
|
|
170
172
|
shipment_id: string;
|
|
171
|
-
rate: number;
|
|
172
|
-
currency: string;
|
|
173
173
|
formatted_rate: string;
|
|
174
174
|
delivery_days?: number | undefined;
|
|
175
175
|
delivery_date?: string | undefined;
|