@shipengine/elements 2.25.0 → 2.26.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.
- package/dist/cjs/components/display-term/display-term.cjs +13 -4
- package/dist/cjs/components/grid-controller/error-banner/error-banner.cjs +74 -0
- package/dist/cjs/components/{error-display/error-display.styles.cjs → grid-controller/error-banner/error-banner.styles.cjs} +8 -4
- package/dist/cjs/components/grid-controller/error-banner/index.cjs +7 -0
- package/dist/cjs/components/grid-controller/grid-controller.cjs +49 -3
- package/dist/cjs/components/grid-controller/grid-controller.styles.cjs +11 -1
- package/dist/cjs/components/history/history-card/history-card.cjs +1 -1
- package/dist/cjs/components/history/history-card-extension/history-card-extension.cjs +0 -1
- package/dist/cjs/components/ups-terms-disclosure/index.cjs +7 -0
- package/dist/cjs/components/ups-terms-disclosure/ups-terms-disclosure.cjs +35 -0
- package/dist/cjs/elements/labels-grid/hooks/use-labels-grid.cjs +45 -5
- package/dist/cjs/elements/labels-grid/labels-grid.cjs +24 -6
- package/dist/cjs/elements/shipments-grid/hooks/use-shipments-grid.cjs +41 -3
- package/dist/cjs/elements/shipments-grid/shipments-grid.cjs +18 -3
- package/dist/cjs/features/manage-carriers/hooks/use-list-funding-source-carriers.cjs +9 -10
- package/dist/cjs/features/manage-carriers/manage-carriers-row/manage-carriers-row.cjs +6 -1
- package/dist/cjs/features/manage-carriers/register-funding-source-carrier-form/register-funding-source-carrier-form.cjs +3 -3
- package/dist/cjs/locales/en/grid-controller.json.cjs +13 -0
- package/dist/cjs/locales/en/index.cjs +2 -1
- package/dist/cjs/locales/en/onboarding.json.cjs +5 -0
- package/dist/cjs/package.json.cjs +1 -1
- package/dist/cjs/utilities/files.cjs +35 -0
- package/dist/cjs/utilities/formatString.cjs +9 -0
- package/dist/cjs/utilities/index.cjs +2 -0
- package/dist/cjs/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.cjs +11 -11
- package/dist/cjs/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.styles.cjs +0 -3
- package/dist/cjs/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.cjs +23 -10
- package/dist/cjs/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.styles.cjs +10 -4
- package/dist/esm/components/display-term/display-term.js +14 -5
- package/dist/esm/components/grid-controller/error-banner/error-banner.js +72 -0
- package/dist/esm/components/{error-display/error-display.styles.js → grid-controller/error-banner/error-banner.styles.js} +8 -4
- package/dist/esm/components/grid-controller/error-banner/index.js +1 -0
- package/dist/esm/components/grid-controller/grid-controller.js +51 -5
- package/dist/esm/components/grid-controller/grid-controller.styles.js +11 -1
- package/dist/esm/components/history/history-card/history-card.js +1 -1
- package/dist/esm/components/history/history-card-extension/history-card-extension.js +0 -1
- package/dist/esm/components/ups-terms-disclosure/index.js +1 -0
- package/dist/esm/components/ups-terms-disclosure/ups-terms-disclosure.js +33 -0
- package/dist/esm/elements/labels-grid/hooks/use-labels-grid.js +46 -6
- package/dist/esm/elements/labels-grid/labels-grid.js +24 -6
- package/dist/esm/elements/shipments-grid/hooks/use-shipments-grid.js +42 -4
- package/dist/esm/elements/shipments-grid/shipments-grid.js +18 -3
- package/dist/esm/features/manage-carriers/hooks/use-list-funding-source-carriers.js +9 -10
- package/dist/esm/features/manage-carriers/manage-carriers-row/manage-carriers-row.js +7 -2
- package/dist/esm/features/manage-carriers/register-funding-source-carrier-form/register-funding-source-carrier-form.js +3 -3
- package/dist/esm/locales/en/grid-controller.json.js +11 -0
- package/dist/esm/locales/en/index.js +2 -1
- package/dist/esm/locales/en/onboarding.json.js +5 -0
- package/dist/esm/package.json.js +1 -1
- package/dist/esm/utilities/files.js +32 -0
- package/dist/esm/utilities/formatString.js +9 -1
- package/dist/esm/utilities/index.js +1 -0
- package/dist/esm/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.js +11 -11
- package/dist/esm/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.styles.js +0 -3
- package/dist/esm/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.js +24 -11
- package/dist/esm/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.styles.js +10 -4
- package/dist/types/components/display-term/display-term.d.ts +3 -3
- package/dist/types/components/display-term/display-term.d.ts.map +1 -1
- package/dist/types/components/grid-controller/error-banner/error-banner.d.ts +10 -0
- package/dist/types/components/grid-controller/error-banner/error-banner.d.ts.map +1 -0
- package/dist/types/components/grid-controller/error-banner/error-banner.styles.d.ts +24 -0
- package/dist/types/components/grid-controller/error-banner/error-banner.styles.d.ts.map +1 -0
- package/dist/types/components/grid-controller/error-banner/index.d.ts +2 -0
- package/dist/types/components/grid-controller/error-banner/index.d.ts.map +1 -0
- package/dist/types/components/grid-controller/grid-controller.d.ts +8 -1
- package/dist/types/components/grid-controller/grid-controller.d.ts.map +1 -1
- package/dist/types/components/grid-controller/grid-controller.styles.d.ts +10 -0
- package/dist/types/components/grid-controller/grid-controller.styles.d.ts.map +1 -1
- package/dist/types/components/history/history-card-extension/history-card-extension.d.ts.map +1 -1
- package/dist/types/components/ups-terms-disclosure/index.d.ts +2 -0
- package/dist/types/components/ups-terms-disclosure/index.d.ts.map +1 -0
- package/dist/types/components/ups-terms-disclosure/ups-terms-disclosure.d.ts +2 -0
- package/dist/types/components/ups-terms-disclosure/ups-terms-disclosure.d.ts.map +1 -0
- package/dist/types/elements/labels-grid/hooks/use-labels-grid.d.ts +7 -2
- package/dist/types/elements/labels-grid/hooks/use-labels-grid.d.ts.map +1 -1
- package/dist/types/elements/labels-grid/labels-grid.d.ts +18 -2
- package/dist/types/elements/labels-grid/labels-grid.d.ts.map +1 -1
- package/dist/types/elements/manage-carriers/manage-carriers.d.ts +12 -0
- package/dist/types/elements/manage-carriers/manage-carriers.d.ts.map +1 -1
- package/dist/types/elements/manage-external-carriers/manage-external-carriers.d.ts +12 -0
- package/dist/types/elements/manage-external-carriers/manage-external-carriers.d.ts.map +1 -1
- package/dist/types/elements/manage-funding/manage-funding-element.d.ts +12 -0
- package/dist/types/elements/manage-funding/manage-funding-element.d.ts.map +1 -1
- package/dist/types/elements/manage-warehouses/manage-warehouses.d.ts +12 -0
- package/dist/types/elements/manage-warehouses/manage-warehouses.d.ts.map +1 -1
- package/dist/types/elements/payment-method-settings/payment-method-settings-element.d.ts +12 -0
- package/dist/types/elements/payment-method-settings/payment-method-settings-element.d.ts.map +1 -1
- package/dist/types/elements/purchase-label/purchase-label.d.ts +12 -0
- package/dist/types/elements/purchase-label/purchase-label.d.ts.map +1 -1
- package/dist/types/elements/select-label-layout/select-label-layout-element.d.ts +12 -0
- package/dist/types/elements/select-label-layout/select-label-layout-element.d.ts.map +1 -1
- package/dist/types/elements/shipment-summary/shipment-summary.d.ts +12 -0
- package/dist/types/elements/shipment-summary/shipment-summary.d.ts.map +1 -1
- package/dist/types/elements/shipments-grid/hooks/use-shipments-grid.d.ts +6 -1
- package/dist/types/elements/shipments-grid/hooks/use-shipments-grid.d.ts.map +1 -1
- package/dist/types/elements/shipments-grid/shipments-grid.d.ts +21 -1
- package/dist/types/elements/shipments-grid/shipments-grid.d.ts.map +1 -1
- package/dist/types/elements/theme-creator/theme-creator.d.ts +12 -0
- package/dist/types/elements/theme-creator/theme-creator.d.ts.map +1 -1
- package/dist/types/elements/transaction-history/transaction-history-element.d.ts +12 -0
- package/dist/types/elements/transaction-history/transaction-history-element.d.ts.map +1 -1
- package/dist/types/elements/unit-settings/unit-settings-element.d.ts +12 -0
- package/dist/types/elements/unit-settings/unit-settings-element.d.ts.map +1 -1
- package/dist/types/elements/vat-settings/vat-settings-element.d.ts +12 -0
- package/dist/types/elements/vat-settings/vat-settings-element.d.ts.map +1 -1
- package/dist/types/elements/void-label/void-label.d.ts +12 -0
- package/dist/types/elements/void-label/void-label.d.ts.map +1 -1
- package/dist/types/features/manage-carriers/hooks/use-list-funding-source-carriers.d.ts.map +1 -1
- package/dist/types/features/manage-carriers/manage-carriers-row/manage-carriers-row.d.ts.map +1 -1
- package/dist/types/features/manage-carriers/register-funding-source-carrier-form/register-funding-source-carrier-form.d.ts +3 -2
- package/dist/types/features/manage-carriers/register-funding-source-carrier-form/register-funding-source-carrier-form.d.ts.map +1 -1
- package/dist/types/locales/en/index.d.ts +12 -0
- package/dist/types/locales/en/index.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +5 -4
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/terms-with-disclosure.d.ts +7 -0
- package/dist/types/types/terms-with-disclosure.d.ts.map +1 -0
- package/dist/types/utilities/feature-flags/types.d.ts +4 -0
- package/dist/types/utilities/feature-flags/types.d.ts.map +1 -1
- package/dist/types/utilities/files.d.ts +12 -0
- package/dist/types/utilities/files.d.ts.map +1 -0
- package/dist/types/utilities/formatString.d.ts +8 -0
- package/dist/types/utilities/formatString.d.ts.map +1 -1
- package/dist/types/utilities/index.d.ts +1 -0
- package/dist/types/utilities/index.d.ts.map +1 -1
- package/dist/types/workflows/account-settings/account-settings.d.ts +12 -0
- package/dist/types/workflows/account-settings/account-settings.d.ts.map +1 -1
- package/dist/types/workflows/carrier-services/carrier-services.d.ts +12 -0
- package/dist/types/workflows/carrier-services/carrier-services.d.ts.map +1 -1
- package/dist/types/workflows/connect-external-carrier/connect-external-carrier.d.ts +12 -0
- package/dist/types/workflows/connect-external-carrier/connect-external-carrier.d.ts.map +1 -1
- package/dist/types/workflows/label-workflow/label-workflow.d.ts +12 -0
- package/dist/types/workflows/label-workflow/label-workflow.d.ts.map +1 -1
- package/dist/types/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.d.ts +2 -1
- package/dist/types/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.d.ts.map +1 -1
- package/dist/types/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.styles.d.ts +0 -3
- package/dist/types/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.styles.d.ts.map +1 -1
- package/dist/types/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.d.ts.map +1 -1
- package/dist/types/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.styles.d.ts +8 -2
- package/dist/types/workflows/onboarding/components/terms-agreement-step/terms-agreement-step.styles.d.ts.map +1 -1
- package/dist/types/workflows/onboarding/onboarding.d.ts +12 -0
- package/dist/types/workflows/onboarding/onboarding.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/error-display/error-display.cjs +0 -34
- package/dist/cjs/components/error-display/index.cjs +0 -7
- package/dist/esm/components/error-display/error-display.js +0 -32
- package/dist/esm/components/error-display/index.js +0 -1
- package/dist/types/components/error-display/error-display.d.ts +0 -7
- package/dist/types/components/error-display/error-display.d.ts.map +0 -1
- package/dist/types/components/error-display/error-display.styles.d.ts +0 -20
- package/dist/types/components/error-display/error-display.styles.d.ts.map +0 -1
- package/dist/types/components/error-display/index.d.ts +0 -2
- package/dist/types/components/error-display/index.d.ts.map +0 -1
|
@@ -29,7 +29,6 @@ import { Spacer } from '../../spacer/spacer.js';
|
|
|
29
29
|
// </div>
|
|
30
30
|
// );
|
|
31
31
|
//
|
|
32
|
-
// const ErrorState = () => <ErrorDisplay />;
|
|
33
32
|
//
|
|
34
33
|
// // replace type call with its se version - lmnt-936
|
|
35
34
|
// const SuccessState = ({ adjustment }: { adjustment: WalletAdjustment }) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UPSTermsDisclosure } from './ups-terms-disclosure.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { Typography } from '@shipengine/giger';
|
|
3
|
+
import { createStyles, scopeTheme } from '../../utilities/styles.js';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
|
|
6
|
+
const styles = createStyles({
|
|
7
|
+
upsDisclosure: theme => ({
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column",
|
|
10
|
+
gap: scopeTheme(theme).spacing(1)
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
const UPSTermsDisclosure = () => {
|
|
14
|
+
const {
|
|
15
|
+
t
|
|
16
|
+
} = useTranslation();
|
|
17
|
+
return jsxs("div", {
|
|
18
|
+
css: styles.upsDisclosure,
|
|
19
|
+
children: [jsx(Typography, {
|
|
20
|
+
bold: true,
|
|
21
|
+
variant: "body1",
|
|
22
|
+
children: t("onboarding:upsDisclosure.title")
|
|
23
|
+
}), jsx(Typography, {
|
|
24
|
+
variant: "body1",
|
|
25
|
+
children: t("onboarding:upsDisclosure.line1")
|
|
26
|
+
}), jsx(Typography, {
|
|
27
|
+
variant: "body1",
|
|
28
|
+
children: t("onboarding:upsDisclosure.line2")
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { UPSTermsDisclosure };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTheme } from '@emotion/react';
|
|
2
2
|
import { useGetServiceName } from '../../../hooks/use-get-service-name.js';
|
|
3
|
-
import { useListLabels, useListSalesOrderShipments, useGetLabel } from '@shipengine/react-api';
|
|
3
|
+
import { useListLabels, useExportLabels, useListSalesOrderShipments, useGetLabel } from '@shipengine/react-api';
|
|
4
|
+
import { createLocalFileFromBlobResponse } from '../../../utilities/files.js';
|
|
4
5
|
import { scopeTheme } from '../../../utilities/styles.js';
|
|
5
6
|
import { useState, useCallback, useEffect, useMemo } from 'react';
|
|
6
7
|
import { useTrackingStatusFilter } from './use-tracking-status-filter.js';
|
|
@@ -14,9 +15,10 @@ const useLabelsGrid = ({
|
|
|
14
15
|
showStatusFilter,
|
|
15
16
|
showTrackingStatusFilter,
|
|
16
17
|
fetchShipments,
|
|
17
|
-
sortDir
|
|
18
|
+
sortDir,
|
|
19
|
+
columns
|
|
18
20
|
}) => {
|
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
20
22
|
const initialFilters = {
|
|
21
23
|
labelId: {
|
|
22
24
|
enabled: !!showLabelIdFilter,
|
|
@@ -45,6 +47,7 @@ const useLabelsGrid = ({
|
|
|
45
47
|
pagerProps
|
|
46
48
|
} = usePager(PAGE_SIZE);
|
|
47
49
|
const [filters, setFilters] = useState(initialFilters);
|
|
50
|
+
const [enabledLabelsExport, setEnabledLabelsExport] = useState(false);
|
|
48
51
|
const clearAllFilters = () => {
|
|
49
52
|
setFilters(initialFilters);
|
|
50
53
|
};
|
|
@@ -132,6 +135,39 @@ const useLabelsGrid = ({
|
|
|
132
135
|
sortDir: sortDir !== null && sortDir !== void 0 ? sortDir : "desc"
|
|
133
136
|
}
|
|
134
137
|
});
|
|
138
|
+
const {
|
|
139
|
+
data: exportLabelsData,
|
|
140
|
+
isInitialLoading: isExportLabelsinitialLoading,
|
|
141
|
+
isRefetching,
|
|
142
|
+
isError: isExportLabelsError
|
|
143
|
+
} = useExportLabels({
|
|
144
|
+
enabled: enabledLabelsExport,
|
|
145
|
+
queryFnParams: {
|
|
146
|
+
labelStatus: ((_g = filters.status) === null || _g === void 0 ? void 0 : _g.value) || labelStatus,
|
|
147
|
+
labelId: ((_h = filters.labelId) === null || _h === void 0 ? void 0 : _h.value) || undefined,
|
|
148
|
+
shipmentId: filters.shipmentId.value || undefined,
|
|
149
|
+
sortDir: sortDir !== null && sortDir !== void 0 ? sortDir : "desc",
|
|
150
|
+
columns
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
if (exportLabelsData && !isExportLabelsinitialLoading && !isRefetching) {
|
|
155
|
+
createLocalFileFromBlobResponse("label", exportLabelsData);
|
|
156
|
+
setEnabledLabelsExport(false);
|
|
157
|
+
}
|
|
158
|
+
}, [isExportLabelsinitialLoading, isRefetching, exportLabelsData]);
|
|
159
|
+
// This function will be called when the error display duration ends
|
|
160
|
+
const onExportErrorDurationEnd = () => {
|
|
161
|
+
setEnabledLabelsExport(false);
|
|
162
|
+
};
|
|
163
|
+
const onClickExportLabelsCSV = () => {
|
|
164
|
+
if (exportLabelsData) {
|
|
165
|
+
createLocalFileFromBlobResponse("label", exportLabelsData);
|
|
166
|
+
setEnabledLabelsExport(false);
|
|
167
|
+
} else {
|
|
168
|
+
setEnabledLabelsExport(true);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
135
171
|
const labels = useMemo(() => {
|
|
136
172
|
// If tracking status filter is active, use the filtered labels from the hook
|
|
137
173
|
if (isTrackingStatusFilterActive) {
|
|
@@ -167,8 +203,8 @@ const useLabelsGrid = ({
|
|
|
167
203
|
data: labelFilterData,
|
|
168
204
|
isError: isLabelFilterError,
|
|
169
205
|
isInitialLoading: isLabelFilterLoading
|
|
170
|
-
} = useGetLabel(((
|
|
171
|
-
const isLabelFilterActive = (
|
|
206
|
+
} = useGetLabel(((_j = filters.labelId) === null || _j === void 0 ? void 0 : _j.value) || undefined);
|
|
207
|
+
const isLabelFilterActive = (_k = filters.labelId) === null || _k === void 0 ? void 0 : _k.value;
|
|
172
208
|
const isStatusFilteredOut = (status, filter) => {
|
|
173
209
|
return (filter === null || filter === void 0 ? void 0 : filter.length) && !filter.includes(status);
|
|
174
210
|
};
|
|
@@ -225,13 +261,16 @@ const useLabelsGrid = ({
|
|
|
225
261
|
return [];
|
|
226
262
|
};
|
|
227
263
|
return {
|
|
264
|
+
onClickExportLabelsCSV,
|
|
228
265
|
clearAllFilters,
|
|
229
266
|
filters,
|
|
230
267
|
getGridData,
|
|
231
268
|
hasMoreUnfetchedResults: isTrackingStatusFilterActive ? hasMoreUnfetchedResults : false,
|
|
232
269
|
isAnyFilterActive,
|
|
270
|
+
isExportLabelsError,
|
|
233
271
|
isError: isListLabelsError || isListShipmentsError && fetchShipments,
|
|
234
272
|
isFetchingNextPage: isTrackingStatusFilterActive ? isFetchingNextPage : false,
|
|
273
|
+
onExportErrorDurationEnd,
|
|
235
274
|
// Calculate isLoading based on which query should be active
|
|
236
275
|
isLoading:
|
|
237
276
|
// Always include label filter loading when label ID filter is active
|
|
@@ -249,7 +288,8 @@ const useLabelsGrid = ({
|
|
|
249
288
|
totalElements: labelFilteredById ? 1 : isTrackingStatusFilterActive ? (statusFilteredPaginationInfo === null || statusFilteredPaginationInfo === void 0 ? void 0 : statusFilteredPaginationInfo.totalCount) || 0 : (listLabelsData === null || listLabelsData === void 0 ? void 0 : listLabelsData.total) || 0
|
|
250
289
|
},
|
|
251
290
|
setFilters: onSetFilters,
|
|
252
|
-
shouldShowFilters: isAnyFilterEnabled
|
|
291
|
+
shouldShowFilters: isAnyFilterEnabled,
|
|
292
|
+
isExportLabelsLoading: isExportLabelsinitialLoading || isRefetching
|
|
253
293
|
};
|
|
254
294
|
};
|
|
255
295
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import { useSortableQuery } from '../../hooks/use-sortable-query.js';
|
|
3
3
|
import { EmptyState, Button, Tag, TagColor, TagVariant, Typography, Next } from '@shipengine/giger';
|
|
4
|
+
import { toSnakeCase } from '../../utilities/formatString.js';
|
|
4
5
|
import { useRef, useMemo, useEffect, useCallback } from 'react';
|
|
5
6
|
import { useTranslation } from 'react-i18next';
|
|
6
7
|
import { useLabelsGrid } from './hooks/use-labels-grid.js';
|
|
@@ -30,9 +31,10 @@ const Component = ({
|
|
|
30
31
|
onRowClick,
|
|
31
32
|
onClickExternalOrderId,
|
|
32
33
|
onClickExternalShipmentId,
|
|
33
|
-
onClickShipmentNumber
|
|
34
|
+
onClickShipmentNumber,
|
|
35
|
+
onLabelsCSVExportClick
|
|
34
36
|
}) => {
|
|
35
|
-
var _a, _b, _c;
|
|
37
|
+
var _a, _b, _c, _d;
|
|
36
38
|
const {
|
|
37
39
|
t
|
|
38
40
|
} = useTranslation(["common", "list-labels"]);
|
|
@@ -74,6 +76,7 @@ const Component = ({
|
|
|
74
76
|
const showShipmentIdFilter = shipmentIdColumn && ((_b = shipmentIdColumn.allowFilter) !== null && _b !== void 0 ? _b : true);
|
|
75
77
|
const showStatusFilter = statusColumn && ((_c = statusColumn.allowFilter) !== null && _c !== void 0 ? _c : true);
|
|
76
78
|
const showTrackingStatusFilter = trackingStatusColumn && !!trackingStatusColumn.allowFilter;
|
|
79
|
+
const columnsArray = (_d = features === null || features === void 0 ? void 0 : features.columns) === null || _d === void 0 ? void 0 : _d.map(column => toSnakeCase(column.name));
|
|
77
80
|
const {
|
|
78
81
|
labels,
|
|
79
82
|
getGridData,
|
|
@@ -86,7 +89,11 @@ const Component = ({
|
|
|
86
89
|
pageConfig,
|
|
87
90
|
isAnyFilterActive,
|
|
88
91
|
shouldShowFilters,
|
|
89
|
-
clearAllFilters
|
|
92
|
+
clearAllFilters,
|
|
93
|
+
onClickExportLabelsCSV,
|
|
94
|
+
isExportLabelsError,
|
|
95
|
+
isExportLabelsLoading,
|
|
96
|
+
onExportErrorDurationEnd
|
|
90
97
|
} = useLabelsGrid({
|
|
91
98
|
fetchShipments: !!shipmentNumberColumn,
|
|
92
99
|
labelStatus,
|
|
@@ -94,7 +101,8 @@ const Component = ({
|
|
|
94
101
|
showShipmentIdFilter,
|
|
95
102
|
showStatusFilter,
|
|
96
103
|
showTrackingStatusFilter,
|
|
97
|
-
sortDir: sortState.dir
|
|
104
|
+
sortDir: sortState.dir,
|
|
105
|
+
columns: columnsArray
|
|
98
106
|
});
|
|
99
107
|
useEffect(() => {
|
|
100
108
|
if (prevStatus.current !== labelStatus) {
|
|
@@ -381,7 +389,7 @@ const Component = ({
|
|
|
381
389
|
});
|
|
382
390
|
}
|
|
383
391
|
return cols;
|
|
384
|
-
}, [t, toggleCreatedDateSort, sortState.createdAtDir, features === null || features === void 0 ? void 0 : features.columns, features === null || features === void 0 ? void 0 : features.showActions, labels, onClickExternalOrderId, onClickExternalShipmentId, onClickShipmentNumber, onClickVoidLabel, onClickViewDetails, onClickPrintLabel, onClickPrintForms]);
|
|
392
|
+
}, [t, toggleCreatedDateSort, sortState.createdAtDir, features === null || features === void 0 ? void 0 : features.columns, features === null || features === void 0 ? void 0 : features.showActions, labels, onClickExternalOrderId, onClickExternalShipmentId, onClickShipmentNumber, onClickTrackingNumber, onClickVoidLabel, onClickViewDetails, onClickPrintLabel, onClickPrintForms]);
|
|
385
393
|
const emptyContentComponent = useMemo(() => {
|
|
386
394
|
if (isLoading) {
|
|
387
395
|
return undefined;
|
|
@@ -432,8 +440,18 @@ const Component = ({
|
|
|
432
440
|
showPagination: pageConfig.showPagination,
|
|
433
441
|
total: pageConfig.totalElements
|
|
434
442
|
}),
|
|
443
|
+
hasExportCSVError: isExportLabelsError,
|
|
444
|
+
hasTrackingStatusFilter: showTrackingStatusFilter,
|
|
445
|
+
isExportCSVLoading: isExportLabelsLoading,
|
|
435
446
|
isLoading: isLoading,
|
|
436
|
-
|
|
447
|
+
onClickExportCSV: () => {
|
|
448
|
+
onClickExportLabelsCSV();
|
|
449
|
+
onLabelsCSVExportClick === null || onLabelsCSVExportClick === void 0 ? void 0 : onLabelsCSVExportClick();
|
|
450
|
+
},
|
|
451
|
+
onExportErrorDurationEnd: onExportErrorDurationEnd,
|
|
452
|
+
onRowClick: onRowClick,
|
|
453
|
+
showExportCSV: features === null || features === void 0 ? void 0 : features.showExportCSVButton,
|
|
454
|
+
totalAmountGridItems: pageConfig.totalElements
|
|
437
455
|
}), globalFeatures.poweredByShipEngine && jsxs(Fragment, {
|
|
438
456
|
children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
|
|
439
457
|
})]
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useGetServiceName } from '../../../hooks/use-get-service-name.js';
|
|
2
|
-
import { useListShipments, useGetShipment } from '@shipengine/react-api';
|
|
2
|
+
import { useListShipments, useExportShipments, useGetShipment } from '@shipengine/react-api';
|
|
3
|
+
import { createLocalFileFromBlobResponse } from '../../../utilities/files.js';
|
|
3
4
|
import { useState, useEffect, useMemo } from 'react';
|
|
4
5
|
import { getCreatedDateFilterValue, filterDateAndShipmentDateIsSameOrWithinInterval } from '../utils/created-date-value.js';
|
|
5
6
|
import { usePager } from '../../../components/pager/usePager.js';
|
|
@@ -20,9 +21,10 @@ const useShipmentsGrid = ({
|
|
|
20
21
|
showShipmentIdFilter = true,
|
|
21
22
|
showCreatedDateFilter = true,
|
|
22
23
|
sortBy,
|
|
23
|
-
sortDir
|
|
24
|
+
sortDir,
|
|
25
|
+
columns
|
|
24
26
|
}) => {
|
|
25
|
-
var _a, _b, _c, _d;
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
28
|
const initialFilters = getInitialFilters(showShipmentIdFilter, showCreatedDateFilter);
|
|
27
29
|
const {
|
|
28
30
|
getServiceName
|
|
@@ -33,6 +35,7 @@ const useShipmentsGrid = ({
|
|
|
33
35
|
pagerProps
|
|
34
36
|
} = usePager(PAGE_SIZE);
|
|
35
37
|
const [activeShipmentId, setActiveShipmentId] = useState();
|
|
38
|
+
const [enabled, setEnabled] = useState(false);
|
|
36
39
|
const [filters, setFilters] = useState(initialFilters);
|
|
37
40
|
const clearAllFilters = () => {
|
|
38
41
|
setFilters(initialFilters);
|
|
@@ -64,6 +67,37 @@ const useShipmentsGrid = ({
|
|
|
64
67
|
sortBy: sortBy,
|
|
65
68
|
sortDir: sortDir
|
|
66
69
|
}, getCreatedDateFilterValue((_b = (_a = filters.createdDate) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.start, (_d = (_c = filters.createdDate) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.end)));
|
|
70
|
+
const {
|
|
71
|
+
data: exportShipmentsData,
|
|
72
|
+
isInitialLoading: isExportShipmentsinitialLoading,
|
|
73
|
+
isRefetching,
|
|
74
|
+
isError: isExportShipmentsError
|
|
75
|
+
} = useExportShipments({
|
|
76
|
+
enabled,
|
|
77
|
+
queryFnParams: Object.assign({
|
|
78
|
+
shipmentId: filters.shipmentId.value || undefined,
|
|
79
|
+
sortDir: sortDir !== null && sortDir !== void 0 ? sortDir : "desc",
|
|
80
|
+
columns
|
|
81
|
+
}, getCreatedDateFilterValue((_f = (_e = filters.createdDate) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.start, (_h = (_g = filters.createdDate) === null || _g === void 0 ? void 0 : _g.value) === null || _h === void 0 ? void 0 : _h.end))
|
|
82
|
+
});
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (exportShipmentsData && !isExportShipmentsinitialLoading && !isRefetching) {
|
|
85
|
+
createLocalFileFromBlobResponse("shipment", exportShipmentsData);
|
|
86
|
+
setEnabled(false);
|
|
87
|
+
}
|
|
88
|
+
}, [isExportShipmentsinitialLoading, isRefetching, exportShipmentsData]);
|
|
89
|
+
// This function will be called when the error display duration ends
|
|
90
|
+
const onExportErrorDurationEnd = () => {
|
|
91
|
+
setEnabled(false);
|
|
92
|
+
};
|
|
93
|
+
const onClickDownloadShipmentsCSV = () => {
|
|
94
|
+
if (exportShipmentsData) {
|
|
95
|
+
createLocalFileFromBlobResponse("shipment", exportShipmentsData);
|
|
96
|
+
setEnabled(false);
|
|
97
|
+
} else {
|
|
98
|
+
setEnabled(true);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
67
101
|
const shipments = useMemo(() => data === null || data === void 0 ? void 0 : data.shipments.map(shipment => Object.assign(Object.assign({}, shipment), {
|
|
68
102
|
disableOnRowClick: shipment.shipmentStatus === "cancelled",
|
|
69
103
|
isLoading: activeShipmentId === shipment.shipmentId,
|
|
@@ -120,12 +154,15 @@ const useShipmentsGrid = ({
|
|
|
120
154
|
return [];
|
|
121
155
|
};
|
|
122
156
|
return {
|
|
157
|
+
onClickDownloadShipmentsCSV,
|
|
123
158
|
clearAllFilters,
|
|
124
159
|
filters,
|
|
125
160
|
getGridData,
|
|
126
161
|
isAnyFilterActive,
|
|
162
|
+
isExportShipmentsError,
|
|
127
163
|
isError,
|
|
128
164
|
isLoading: isLoadingShipments || isLoadingShipment,
|
|
165
|
+
onExportErrorDurationEnd,
|
|
129
166
|
pageConfig: {
|
|
130
167
|
currentPage: shipmentFilteredById ? 1 : (data === null || data === void 0 ? void 0 : data.page) || 0,
|
|
131
168
|
pagerProps,
|
|
@@ -137,7 +174,8 @@ const useShipmentsGrid = ({
|
|
|
137
174
|
setActiveShipmentId,
|
|
138
175
|
setFilters: onSetFilters,
|
|
139
176
|
shipments,
|
|
140
|
-
shouldShowFilters: isAnyFilterEnabled
|
|
177
|
+
shouldShowFilters: isAnyFilterEnabled,
|
|
178
|
+
isExportShipmentsLoading: isExportShipmentsinitialLoading || isRefetching
|
|
141
179
|
};
|
|
142
180
|
};
|
|
143
181
|
|
|
@@ -46,7 +46,9 @@ const Component = ({
|
|
|
46
46
|
onClickCancelShipment,
|
|
47
47
|
shipmentStatus,
|
|
48
48
|
showShipmentIdFilter = true,
|
|
49
|
-
showCreatedDateFilter = true
|
|
49
|
+
showCreatedDateFilter = true,
|
|
50
|
+
onShipmentsCSVExportClick,
|
|
51
|
+
showExportCSVButton = false
|
|
50
52
|
}) => {
|
|
51
53
|
const {
|
|
52
54
|
globalFeatures
|
|
@@ -71,7 +73,11 @@ const Component = ({
|
|
|
71
73
|
isAnyFilterActive,
|
|
72
74
|
shouldShowFilters,
|
|
73
75
|
clearAllFilters,
|
|
74
|
-
setActiveShipmentId
|
|
76
|
+
setActiveShipmentId,
|
|
77
|
+
onClickDownloadShipmentsCSV,
|
|
78
|
+
isExportShipmentsError,
|
|
79
|
+
isExportShipmentsLoading,
|
|
80
|
+
onExportErrorDurationEnd
|
|
75
81
|
} = useShipmentsGrid({
|
|
76
82
|
shipmentStatus,
|
|
77
83
|
showCreatedDateFilter,
|
|
@@ -254,8 +260,17 @@ const Component = ({
|
|
|
254
260
|
showPagination: pageConfig.showPagination,
|
|
255
261
|
total: pageConfig.totalElements
|
|
256
262
|
}),
|
|
263
|
+
hasExportCSVError: isExportShipmentsError,
|
|
264
|
+
isExportCSVLoading: isExportShipmentsLoading,
|
|
257
265
|
isLoading: isLoading,
|
|
258
|
-
|
|
266
|
+
onClickExportCSV: () => {
|
|
267
|
+
onClickDownloadShipmentsCSV();
|
|
268
|
+
onShipmentsCSVExportClick === null || onShipmentsCSVExportClick === void 0 ? void 0 : onShipmentsCSVExportClick();
|
|
269
|
+
},
|
|
270
|
+
onExportErrorDurationEnd: onExportErrorDurationEnd,
|
|
271
|
+
onRowClick: onRowClick,
|
|
272
|
+
showExportCSV: showExportCSVButton,
|
|
273
|
+
totalAmountGridItems: pageConfig.totalElements
|
|
259
274
|
}), globalFeatures.poweredByShipEngine && jsxs(Fragment, {
|
|
260
275
|
children: [jsx(Spacer, {}), jsx(PoweredByShipEngine, {})]
|
|
261
276
|
})]
|
|
@@ -43,22 +43,21 @@ const useListFundingSourceCarriers = () => {
|
|
|
43
43
|
}, getInsuranceProviderWithFriendlyName(t.termType));
|
|
44
44
|
});
|
|
45
45
|
}, [optionalTerms, insuranceProviderAcceptedTerms]);
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}));
|
|
50
|
-
const fundingSourceCarrierMetadata = carrierProfiles === null || carrierProfiles === void 0 ? void 0 : carrierProfiles.map(cp => {
|
|
46
|
+
const normalizeCarrierCode = (carrierCode, nickname) => carrierCode === "usps" || (nickname === null || nickname === void 0 ? void 0 : nickname.includes("free")) ? "stamps_com" : carrierCode;
|
|
47
|
+
const normalizeConnectedCarrierCodes = new Set(connectedCarriers === null || connectedCarriers === void 0 ? void 0 : connectedCarriers.map(c => normalizeCarrierCode(c.carrierCode, c.nickname)));
|
|
48
|
+
const fundingSourceCarriersData = carrierProfiles === null || carrierProfiles === void 0 ? void 0 : carrierProfiles.map(cp => {
|
|
51
49
|
var _a, _b;
|
|
52
|
-
|
|
50
|
+
const carrier = {
|
|
53
51
|
carrierProfile: cp,
|
|
54
52
|
friendlyName: (_b = (_a = carrierMetadata[cp.carrierCode]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : cp.carrierCode
|
|
55
53
|
};
|
|
54
|
+
return {
|
|
55
|
+
carrier,
|
|
56
|
+
isConnected: normalizeConnectedCarrierCodes.has(cp.carrierCode)
|
|
57
|
+
};
|
|
56
58
|
});
|
|
57
59
|
return {
|
|
58
|
-
data:
|
|
59
|
-
carrier: m,
|
|
60
|
-
isConnected: normalizeConnectedCarrierCodes.has(m.carrierProfile.carrierCode)
|
|
61
|
-
})),
|
|
60
|
+
data: fundingSourceCarriersData,
|
|
62
61
|
error: error,
|
|
63
62
|
insuranceProviderProfiles,
|
|
64
63
|
isLoading: isInitialLoading || isFundingSourceMetadataLoading || isInsuranceProviderAcceptedTermsLoading,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __awaiter, __rest } from '../../../_virtual/_tslib.js';
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
3
3
|
import { IconSize, Typography } from '@shipengine/giger';
|
|
4
4
|
import { SE } from '@shipengine/react-api';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
import { styles } from './manage-carriers-row.styles.js';
|
|
8
|
+
import { UPSTermsDisclosure } from '../../../components/ups-terms-disclosure/ups-terms-disclosure.js';
|
|
8
9
|
import { AddressPreferenceProvider } from '../../../components/address-preference-context/address-preference-context.js';
|
|
9
10
|
import { RegisterFundingSourceCarrierForm } from '../register-funding-source-carrier-form/register-funding-source-carrier-form.js';
|
|
10
11
|
import { CarrierIcon } from '../../../components/carrier-icon/carrier-icon.js';
|
|
@@ -32,6 +33,10 @@ const ManageCarriersRow = ({
|
|
|
32
33
|
const requirementTypes = carrierProfile.registrationRequirements.map(r => r.requirementType);
|
|
33
34
|
const requiresAddress = requirementTypes.includes(SE.MetadataRequirement.PickupAddress);
|
|
34
35
|
const requiresTermsAcceptance = carrierProfile.requiredTerms.length > 0;
|
|
36
|
+
const requiredCarrierTerms = {
|
|
37
|
+
links: carrierProfile.requiredTerms.flatMap(term => term.links),
|
|
38
|
+
disclosure: carrierProfile.carrierCode === "ups_walleted" ? jsx(UPSTermsDisclosure, {}) : undefined
|
|
39
|
+
};
|
|
35
40
|
const handleRegister = values => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
41
|
setIsSubmitting(true);
|
|
37
42
|
showDropDown && setShowDropDown(false);
|
|
@@ -94,7 +99,7 @@ const ManageCarriersRow = ({
|
|
|
94
99
|
onCancel: () => setShowDropDown(false),
|
|
95
100
|
onSubmit: handleRegister,
|
|
96
101
|
requirementTypes: requirementTypes,
|
|
97
|
-
terms:
|
|
102
|
+
terms: requiredCarrierTerms
|
|
98
103
|
})
|
|
99
104
|
})
|
|
100
105
|
})]
|
|
@@ -149,9 +149,9 @@ const RegisterFundingSourceCarrierForm = ({
|
|
|
149
149
|
children: [jsx(Typography, {
|
|
150
150
|
variant: "heading4",
|
|
151
151
|
children: t("terms.carriersTitle")
|
|
152
|
-
}),
|
|
153
|
-
|
|
154
|
-
}
|
|
152
|
+
}), jsx(DisplayTerm, {
|
|
153
|
+
terms: terms
|
|
154
|
+
})]
|
|
155
155
|
}), jsx(ButtonGroup, {
|
|
156
156
|
justify: "end",
|
|
157
157
|
children: jsx(Button, {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var gridController = {
|
|
2
|
+
"grid-controller": {
|
|
3
|
+
showExportCSV: {
|
|
4
|
+
button: "Export CSV",
|
|
5
|
+
"generic-error-message": "We couldn’t export your CSV. Please try again.",
|
|
6
|
+
"limit-error": "We're sorry, but exporting more than {{LIMIT_GRID_ITEMS_EXPORT}} items is not supported at this time."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { gridController as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import accoutSettings from './account-settings.json.js';
|
|
2
2
|
import common from './common.json.js';
|
|
3
3
|
import connectCarriers from './connect-carrier.json.js';
|
|
4
|
+
import gridController from './grid-controller.json.js';
|
|
4
5
|
import listLabels from './list-labels.json.js';
|
|
5
6
|
import listShipments from './list-shipments.json.js';
|
|
6
7
|
import manageCarriers from './manage-carriers.json.js';
|
|
@@ -18,6 +19,6 @@ import viewShipment from './view-shipment.json.js';
|
|
|
18
19
|
import voidLabel from './void-label.json.js';
|
|
19
20
|
import walletHistory from './wallet-history.json.js';
|
|
20
21
|
|
|
21
|
-
var en = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, accoutSettings), common), connectCarriers), listLabels), listShipments), manageDefaults), manageDefaults), manageFunding), manageWarehouses), onboarding), paymentMethod), purchaseLabel), rateDetails), registerCarrier), registerWallet), manageCarriers), vatSettings), viewShipment), voidLabel), walletHistory);
|
|
22
|
+
var en = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, accoutSettings), common), connectCarriers), listLabels), listShipments), manageDefaults), manageDefaults), manageFunding), manageWarehouses), onboarding), paymentMethod), purchaseLabel), rateDetails), registerCarrier), registerWallet), manageCarriers), vatSettings), viewShipment), voidLabel), walletHistory), gridController);
|
|
22
23
|
|
|
23
24
|
export { en as default };
|
|
@@ -22,6 +22,11 @@ var onboarding = {
|
|
|
22
22
|
title: "Activate ShipEngine Services",
|
|
23
23
|
subtitle: "Your account includes access to services from these partners."
|
|
24
24
|
},
|
|
25
|
+
upsDisclosure: {
|
|
26
|
+
title: "UPS Promotional Rates and Technology Agreements",
|
|
27
|
+
line1: "I have read and agree to the Terms and Conditions and the Privacy Policy, and I confirm that information I have provided is accurate and truthful.",
|
|
28
|
+
line2: "To start shipping with UPS, you must first agree to the following: UPS®, the UPS brandmark, UPS Ready® and the color brown are trademarks of the United Parcel Service of America, Inc. All Rights Reserved."
|
|
29
|
+
},
|
|
25
30
|
warehouse: {
|
|
26
31
|
title: "Ship From Address",
|
|
27
32
|
subtitle: "Enter your default Ship From Address",
|
package/dist/esm/package.json.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a local file from an AxiosResponse containing a blob.
|
|
3
|
+
*/
|
|
4
|
+
const createLocalFileFromBlobResponse = (type, {
|
|
5
|
+
data: blob
|
|
6
|
+
}) => {
|
|
7
|
+
const url = URL.createObjectURL(new Blob([blob], {
|
|
8
|
+
type: blob.type
|
|
9
|
+
}));
|
|
10
|
+
const fileName = type === "label" ? "labels-download" : "shipments-download";
|
|
11
|
+
triggerDownload(url, fileName);
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Triggers the download of the sent URL.
|
|
15
|
+
* @param {string} url - The URL for the download.
|
|
16
|
+
* @param {string} filename - The filename for the download.
|
|
17
|
+
*/
|
|
18
|
+
const triggerDownload = (url, filename) => {
|
|
19
|
+
const downloadLink = createInvisibleAnchor(url, filename);
|
|
20
|
+
document.body.appendChild(downloadLink);
|
|
21
|
+
downloadLink.click();
|
|
22
|
+
document.body.removeChild(downloadLink);
|
|
23
|
+
};
|
|
24
|
+
const createInvisibleAnchor = (url, filename) => {
|
|
25
|
+
const downloadLink = document.createElement("a");
|
|
26
|
+
downloadLink.setAttribute("href", url);
|
|
27
|
+
downloadLink.setAttribute("download", filename);
|
|
28
|
+
downloadLink.style.display = "none";
|
|
29
|
+
return downloadLink;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { createLocalFileFromBlobResponse, triggerDownload };
|
|
@@ -17,5 +17,13 @@ const replaceSpacesWithDashes = str => str === null || str === void 0 ? void 0 :
|
|
|
17
17
|
const addSpaceBetweenWords = str => str.replace(/([a-z])([A-Z])/g, "$1 $2") // add space if there is a lowercase letter followed by an uppercase letter
|
|
18
18
|
.replace(/(?<=[a-zA-Z])(\d)/g, " $1") // add space if there is a letter followed by a number
|
|
19
19
|
.trim();
|
|
20
|
+
/**
|
|
21
|
+
* Converts a string from camelCase or PascalCase to snake_case
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* toSnakeCase("helloWorld") // returns "hello_world"
|
|
25
|
+
* toSnakeCase("HelloWorld") // returns "hello_world"
|
|
26
|
+
*/
|
|
27
|
+
const toSnakeCase = str => str.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
|
|
20
28
|
|
|
21
|
-
export { addSpaceBetweenWords, capitalizeFirstLetter, capitalizeFirstLetterOfEachWord, pascalize, replaceSpacesWithDashes };
|
|
29
|
+
export { addSpaceBetweenWords, capitalizeFirstLetter, capitalizeFirstLetterOfEachWord, pascalize, replaceSpacesWithDashes, toSnakeCase };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createStyles, scopeTheme } from './styles.js';
|
|
2
2
|
export { getSellerIdFromToken, isOnboarded, validateShipFromAddress } from './checks.js';
|
|
3
|
+
export { createLocalFileFromBlobResponse } from './files.js';
|
|
3
4
|
export { getCountries, getUsStates } from './address.js';
|
|
4
5
|
export { getDefaultFeatures } from './feature-flags/feature-flags.js';
|
package/dist/esm/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.js
CHANGED
|
@@ -86,34 +86,34 @@ const TermsAgreementForm = ({
|
|
|
86
86
|
variant: "body1",
|
|
87
87
|
children: t("terms.shipEngineTitle")
|
|
88
88
|
}), jsx(DisplayTerm, {
|
|
89
|
-
|
|
89
|
+
terms: {
|
|
90
90
|
links: [{
|
|
91
91
|
link: "https://www.shipengine.com/terms-of-service/",
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
title: "ShipEngine Terms of Service",
|
|
93
|
+
locale: "en-US"
|
|
94
94
|
}, {
|
|
95
|
-
link: "https://auctane.com/
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
link: "https://www.auctane.com/terms-of-service/",
|
|
96
|
+
title: "Auctane Terms of Service",
|
|
97
|
+
locale: "en-US"
|
|
98
98
|
}]
|
|
99
99
|
}
|
|
100
100
|
}), requiredTerms.map(term => jsx(DisplayTerm, {
|
|
101
|
-
|
|
101
|
+
terms: term
|
|
102
102
|
}, term.termType)), !!carrierTerms.length && jsxs(Fragment, {
|
|
103
103
|
children: [jsx(Spacer, {}), jsx(Typography, {
|
|
104
104
|
bold: true,
|
|
105
105
|
variant: "body1",
|
|
106
106
|
children: t("terms.carriersTitle")
|
|
107
|
-
}), carrierTerms.map(term => jsx(DisplayTerm, {
|
|
108
|
-
|
|
109
|
-
},
|
|
107
|
+
}), carrierTerms.map((term, idx) => jsx(DisplayTerm, {
|
|
108
|
+
terms: term
|
|
109
|
+
}, idx))]
|
|
110
110
|
}), enableParcelGuard && !!insuranceProviderTerms.length && jsxs(Fragment, {
|
|
111
111
|
children: [jsx(Spacer, {}), jsx(Typography, {
|
|
112
112
|
bold: true,
|
|
113
113
|
variant: "body1",
|
|
114
114
|
children: t("terms.insuranceProvidersTitle")
|
|
115
115
|
}), insuranceProviderTerms.map(term => jsx(DisplayTerm, {
|
|
116
|
-
|
|
116
|
+
terms: term
|
|
117
117
|
}, term.termType))]
|
|
118
118
|
})]
|
|
119
119
|
}), jsx(ButtonGroup, {
|
package/dist/esm/workflows/onboarding/components/terms-agreement-form/terms-agreement-form.styles.js
CHANGED
|
@@ -13,9 +13,6 @@ const styles = createStyles({
|
|
|
13
13
|
display: "inline-flex",
|
|
14
14
|
fontWeight: scopeTheme(theme).typography.fontWeight.normal
|
|
15
15
|
}),
|
|
16
|
-
fullWidth: {
|
|
17
|
-
width: "100%"
|
|
18
|
-
},
|
|
19
16
|
termsWell: theme => ({
|
|
20
17
|
backgroundColor: scopeTheme(theme).palette.gray.ultraLight,
|
|
21
18
|
marginBottom: scopeTheme(theme).spacing(6),
|