@dropins/storefront-order 0.1.0-alpha13 → 0.1.0-alpha15
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/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +1 -1
- package/api/getOrderDetailsById/graphql/index.d.ts +1 -0
- package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +2 -2
- package/api/getOrderDetailsById/graphql/returnsFragment.graphql.d.ts +2 -0
- package/api/requestGuestOrderCancel/requestGuestOrderCancel.d.ts +1 -1
- package/api.js +11 -3
- package/chunks/OrderCancelForm.js +1 -0
- package/chunks/OrderLoaders.js +1 -1
- package/chunks/getAttributesForm.js +1 -1
- package/chunks/getCustomer.js +2 -2
- package/chunks/getCustomerOrdersReturn.js +12 -45
- package/chunks/getGuestOrder.graphql.js +10 -6
- package/chunks/requestGuestOrderCancel.js +5 -5
- package/chunks/transform-order-details.js +48 -6
- package/chunks/useIsMobile.js +1 -0
- package/components/OrderCancel/OrderCancel.d.ts +5 -0
- package/components/index.d.ts +1 -1
- package/configs/mock.config.d.ts +12 -0
- package/containers/CustomerDetails.js +1 -1
- package/containers/OrderCancelForm/OrderCancelForm.d.ts +5 -0
- package/containers/OrderCancelForm/index.d.ts +3 -0
- package/containers/OrderCancelForm.d.ts +3 -0
- package/containers/OrderCancelForm.js +1 -0
- package/containers/OrderCostSummary.js +1 -1
- package/containers/OrderProductList.js +1 -1
- package/containers/OrderReturns/OrderReturns.d.ts +5 -0
- package/containers/OrderReturns/index.d.ts +3 -0
- package/containers/OrderReturns.d.ts +3 -0
- package/containers/OrderReturns.js +1 -0
- package/containers/OrderSearch.js +1 -1
- package/containers/OrderStatus.js +3 -3
- package/containers/ReturnsList.js +1 -1
- package/containers/ShippingStatus.js +1 -1
- package/containers/index.d.ts +2 -1
- package/data/models/customer-orders-return.d.ts +7 -5
- package/data/models/order-details.d.ts +4 -0
- package/data/transforms/index.d.ts +1 -1
- package/data/transforms/transform-customer-orders-returns.d.ts +5 -0
- package/hooks/containers/useCustomerDetails.d.ts +2 -2
- package/hooks/containers/useOrderReturns.d.ts +8 -0
- package/hooks/containers/useReturnsList.d.ts +2 -2
- package/i18n/en_US.json.d.ts +49 -7
- package/lib/returnOrdersHelper.d.ts +19 -0
- package/package.json +1 -1
- package/render.js +2 -2
- package/types/api/getCustomerOrdersReturn.types.d.ts +10 -35
- package/types/api/getOrderDetails.types.d.ts +31 -2
- package/types/orderCancel.types.d.ts +1 -2
- package/types/orderProductList.types.d.ts +2 -0
- package/types/returnsList.types.d.ts +40 -9
- package/types/shippingStatus.types.d.ts +1 -0
- package/chunks/useGetStoreConfig.js +0 -1
- package/components/OrderCancelReasonsForm/OrderCancelReasonsForm.d.ts +0 -5
- package/components/OrderCancelReasonsForm/index.d.ts +0 -3
- package/containers/OrderCancel/OrderCancel.d.ts +0 -5
- package/containers/OrderCancel.d.ts +0 -3
- package/containers/OrderCancel.js +0 -1
- package/data/transforms/transform-customer-orders-return.d.ts +0 -5
- package/lib/formatAddressFields.d.ts +0 -6
- /package/chunks/{OrderCancelReasonsForm.js → OrderCancel.js} +0 -0
- /package/{containers → components}/OrderCancel/index.d.ts +0 -0
|
@@ -1,42 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReturnsItemsProps } from './getOrderDetails.types';
|
|
2
2
|
|
|
3
|
+
export interface OrdersReturnResponseProps {
|
|
4
|
+
page_info?: {
|
|
5
|
+
page_size: number;
|
|
6
|
+
total_pages: number;
|
|
7
|
+
current_page: number;
|
|
8
|
+
};
|
|
9
|
+
items?: ReturnsItemsProps[];
|
|
10
|
+
}
|
|
3
11
|
export interface GetCustomerOrdersReturnResponse {
|
|
4
12
|
data: {
|
|
5
13
|
customer: {
|
|
6
|
-
returns:
|
|
7
|
-
page_info: {
|
|
8
|
-
page_size: number;
|
|
9
|
-
total_pages: number;
|
|
10
|
-
current_page: number;
|
|
11
|
-
};
|
|
12
|
-
items: {
|
|
13
|
-
number: number;
|
|
14
|
-
order: {
|
|
15
|
-
number: string;
|
|
16
|
-
token: string;
|
|
17
|
-
};
|
|
18
|
-
shipping: {
|
|
19
|
-
tracking: {
|
|
20
|
-
status: {
|
|
21
|
-
text: string;
|
|
22
|
-
type: string;
|
|
23
|
-
};
|
|
24
|
-
carrier: {
|
|
25
|
-
uid: string;
|
|
26
|
-
label: string;
|
|
27
|
-
};
|
|
28
|
-
tracking_number: string;
|
|
29
|
-
}[];
|
|
30
|
-
};
|
|
31
|
-
items: {
|
|
32
|
-
quantity: number;
|
|
33
|
-
status: string;
|
|
34
|
-
uid: string;
|
|
35
|
-
request_quantity: number;
|
|
36
|
-
order_item: OrderItemProps;
|
|
37
|
-
}[];
|
|
38
|
-
}[];
|
|
39
|
-
};
|
|
14
|
+
returns: OrdersReturnResponseProps;
|
|
40
15
|
};
|
|
41
16
|
};
|
|
42
17
|
errors?: {
|
|
@@ -24,6 +24,7 @@ export interface ProductProps {
|
|
|
24
24
|
thumbnail?: ThumbnailImageProps;
|
|
25
25
|
image: ThumbnailImageProps;
|
|
26
26
|
canonical_url: string;
|
|
27
|
+
url_key: string;
|
|
27
28
|
id: string;
|
|
28
29
|
uid: string;
|
|
29
30
|
name: string;
|
|
@@ -181,6 +182,34 @@ export declare enum AvailableActionsProps {
|
|
|
181
182
|
RETURN = "RETURN",
|
|
182
183
|
REORDER = "REORDER"
|
|
183
184
|
}
|
|
185
|
+
export interface ReturnsItemsProps {
|
|
186
|
+
number: string;
|
|
187
|
+
status: string;
|
|
188
|
+
order: {
|
|
189
|
+
number: string;
|
|
190
|
+
token: string;
|
|
191
|
+
};
|
|
192
|
+
shipping: {
|
|
193
|
+
tracking: {
|
|
194
|
+
status: {
|
|
195
|
+
text: string;
|
|
196
|
+
type: string;
|
|
197
|
+
};
|
|
198
|
+
carrier: {
|
|
199
|
+
uid: string;
|
|
200
|
+
label: string;
|
|
201
|
+
};
|
|
202
|
+
tracking_number: string;
|
|
203
|
+
}[];
|
|
204
|
+
};
|
|
205
|
+
items: {
|
|
206
|
+
quantity: number;
|
|
207
|
+
status: string;
|
|
208
|
+
uid: string;
|
|
209
|
+
request_quantity: number;
|
|
210
|
+
order_item: OrderItemProps;
|
|
211
|
+
}[];
|
|
212
|
+
}
|
|
184
213
|
export interface OrderProps {
|
|
185
214
|
available_actions: AvailableActionsProps[];
|
|
186
215
|
shipping_method: string;
|
|
@@ -197,8 +226,8 @@ export interface OrderProps {
|
|
|
197
226
|
code: string;
|
|
198
227
|
}[];
|
|
199
228
|
returns: {
|
|
200
|
-
|
|
201
|
-
|
|
229
|
+
__typename: string;
|
|
230
|
+
items: ReturnsItemsProps[];
|
|
202
231
|
};
|
|
203
232
|
shipments: ShipmentsProps[];
|
|
204
233
|
items_eligible_for_return: OrderItemProps[];
|
|
@@ -4,11 +4,10 @@ import { PickerOption } from '@dropins/tools/types/elsie/src/components';
|
|
|
4
4
|
export interface OrderCancelProps {
|
|
5
5
|
orderRef: string;
|
|
6
6
|
}
|
|
7
|
-
export interface
|
|
7
|
+
export interface OrderCancelFormProps {
|
|
8
8
|
orderRef: string;
|
|
9
9
|
pickerProps?: PickerProps;
|
|
10
10
|
submitButtonProps?: ButtonProps;
|
|
11
|
-
cancelOrder: (orderId: string, reason: string, onSuccess: Function, onError: Function) => Promise<void | null | undefined>;
|
|
12
11
|
cancelReasons: PickerOption[];
|
|
13
12
|
}
|
|
14
13
|
export interface ConfirmCancelOrderProps {
|
|
@@ -10,6 +10,7 @@ export interface OrderProductListProps {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
withHeader?: boolean;
|
|
12
12
|
showConfigurableOptions?: (options: options | {}) => options;
|
|
13
|
+
routeProductDetails?: (product: any) => string;
|
|
13
14
|
}
|
|
14
15
|
export interface OrderProductListContentProps extends Omit<OrderProductListProps, 'className'> {
|
|
15
16
|
order?: OrderDataModel;
|
|
@@ -23,6 +24,7 @@ export interface CartSummaryItemProps {
|
|
|
23
24
|
showConfigurableOptions?: (options: options | {}) => options;
|
|
24
25
|
itemType: string;
|
|
25
26
|
product: OrderItemModel;
|
|
27
|
+
routeProductDetails?: (product: any) => string;
|
|
26
28
|
}
|
|
27
29
|
export interface UseOrderProductListProps extends Omit<OrderProductListProps, 'className' | 'withHeader' | 'showConfigurableOptions'> {
|
|
28
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SlotProps } from '@dropins/tools/types/elsie/src/src/lib';
|
|
2
|
-
import { OrderItemModel,
|
|
2
|
+
import { OrderDataModel, OrderItemModel, OrdersReturnItemsPropsModel, OrdersReturnPropsModel, OrdersReturnTrackingProps, PageInfoProps } from '../data/models';
|
|
3
3
|
|
|
4
4
|
export interface IconConfig {
|
|
5
5
|
size: '12' | '16' | '24' | '32' | '64' | '80' | undefined;
|
|
@@ -8,35 +8,66 @@ export interface IconConfig {
|
|
|
8
8
|
export interface ReturnsListProps {
|
|
9
9
|
slots?: {
|
|
10
10
|
ReturnItemsDetails?: SlotProps<{
|
|
11
|
-
items:
|
|
11
|
+
items: OrdersReturnItemsPropsModel[];
|
|
12
12
|
}>;
|
|
13
13
|
DetailsActionParams?: SlotProps<{
|
|
14
|
-
returnOrderItem:
|
|
14
|
+
returnOrderItem: OrdersReturnPropsModel;
|
|
15
15
|
}>;
|
|
16
16
|
};
|
|
17
17
|
withReturnsListButton?: boolean;
|
|
18
18
|
returnsInMinifiedView?: number;
|
|
19
|
-
className
|
|
19
|
+
className?: string;
|
|
20
20
|
minifiedView?: boolean;
|
|
21
21
|
withHeader?: boolean;
|
|
22
|
-
routeReturnDetails?: ({ token, orderNumber, }: {
|
|
22
|
+
routeReturnDetails?: ({ returnNumber, token, orderNumber, }: {
|
|
23
|
+
returnNumber: string;
|
|
24
|
+
token: string;
|
|
25
|
+
orderNumber: string;
|
|
26
|
+
}) => string;
|
|
27
|
+
routeOrderDetails?: ({ token, orderNumber, }: {
|
|
23
28
|
token: string;
|
|
24
29
|
orderNumber: string;
|
|
25
30
|
}) => string;
|
|
26
|
-
routeOrderDetails?: (number: string) => string;
|
|
27
31
|
routeTracking?: (track: OrdersReturnTrackingProps) => string;
|
|
28
32
|
routeReturnsList?: () => string;
|
|
29
33
|
routeProductDetails?: (orderItem?: OrderItemModel) => string;
|
|
30
34
|
withThumbnails?: boolean;
|
|
31
35
|
}
|
|
32
36
|
export interface ReturnsListContentProps extends Omit<ReturnsListProps, 'className'> {
|
|
33
|
-
|
|
37
|
+
minifiedViewKey: 'minifiedView' | 'fullSizeView';
|
|
38
|
+
orderReturns?: OrdersReturnPropsModel[] | [];
|
|
34
39
|
translations: Record<string, string>;
|
|
35
40
|
isMobile: boolean;
|
|
36
41
|
pageInfo: PageInfoProps;
|
|
37
|
-
selectedPage
|
|
38
|
-
handleSetSelectPage
|
|
42
|
+
selectedPage?: number;
|
|
43
|
+
handleSetSelectPage?: (value: number) => void;
|
|
44
|
+
withOrderNumber?: boolean;
|
|
45
|
+
withReturnNumber?: boolean;
|
|
46
|
+
loading: boolean;
|
|
39
47
|
}
|
|
40
48
|
export interface UseReturnsListProps {
|
|
41
49
|
}
|
|
50
|
+
export interface OrderReturnsProps {
|
|
51
|
+
slots?: {
|
|
52
|
+
ReturnItemsDetails?: SlotProps<{
|
|
53
|
+
items: OrdersReturnItemsPropsModel[];
|
|
54
|
+
}>;
|
|
55
|
+
DetailsActionParams?: SlotProps<{
|
|
56
|
+
returnOrderItem: OrdersReturnPropsModel;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
withThumbnails?: boolean;
|
|
60
|
+
withHeader?: boolean;
|
|
61
|
+
className?: string;
|
|
62
|
+
orderData?: OrderDataModel;
|
|
63
|
+
routeReturnDetails?: ({ token, orderNumber, }: {
|
|
64
|
+
token: string;
|
|
65
|
+
orderNumber: string;
|
|
66
|
+
}) => string;
|
|
67
|
+
routeProductDetails?: (product: any) => string;
|
|
68
|
+
routeTracking?: (track: OrdersReturnTrackingProps) => string;
|
|
69
|
+
}
|
|
70
|
+
export interface UseOrderReturnsProps {
|
|
71
|
+
orderData?: OrderDataModel;
|
|
72
|
+
}
|
|
42
73
|
//# sourceMappingURL=returnsList.types.d.ts.map
|
|
@@ -9,6 +9,7 @@ export interface ShippingStatusProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
DeliveryTimeLine?: SlotProps;
|
|
10
10
|
DeliveryTrackActions?: SlotProps;
|
|
11
11
|
};
|
|
12
|
+
routeProductDetails?: (productData: any) => string;
|
|
12
13
|
}
|
|
13
14
|
export interface UseShippingStatusProps {
|
|
14
15
|
orderData?: OrderDataModel;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useState as i,useEffect as s}from"@dropins/tools/preact-hooks.js";import{g as f}from"./getStoreConfig.js";const c=()=>{const[n,e]=i(null);return s(()=>{const o=sessionStorage.getItem("orderStoreConfig"),r=o?JSON.parse(o):null;r?e(r):f().then(t=>{t&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(t)),e(t))})},[]),n};export{c as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as g,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{u as h}from"../chunks/useGetStoreConfig.js";import{InLineAlert as v,Picker as x,Button as S}from"@dropins/tools/components.js";import{F}from"../chunks/OrderCancelReasonsForm.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact-compat.js";import{useState as d}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/preact.js";import{events as u}from"@dropins/tools/event-bus.js";import{useText as E,Text as p}from"@dropins/tools/i18n.js";import{c as _,r as D}from"../chunks/requestGuestOrderCancel.js";import"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-order-details.js";import"../chunks/convertCase.js";import"../chunks/getGuestOrder.graphql.js";const L=({pickerProps:s,submitButtonProps:o,cancelReasons:n,cancelOrder:i,orderRef:m})=>{const a=E({ErrorHeading:"Order.OrderCancellationReasonsForm.errorHeading",ErrorDescription:"Order.OrderCancellationReasonsForm.errorDescription",orderCancellationLabel:"Order.OrderCancellationReasonsForm.label"}),[r,c]=d(0),[f,C]=d(!1),[O,b]=d(!1);u.on("authenticated",t=>{t&&b(!0)},{eager:!0});const R=t=>{t.preventDefault();const l=Number(t.target.value);c(l)};return g(F,{onSubmit:async t=>(t.preventDefault(),i(m,n[r].text,l=>{O||(l.status="guest order cancellation requested"),u.emit("order/data",l)},()=>{C(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[f&&e(v,{heading:a.ErrorHeading,description:a.ErrorDescription}),e("div",{className:"order-order-cancel-reasons-form__text",children:e(p,{id:"Order.OrderCancellationReasonsForm.description"})}),e(x,{name:"cancellationReasons",floatingLabel:a.orderCancellationLabel,defaultOption:n[0],variant:"primary",options:n,value:String(r),handleSelect:R,required:!0,"data-testid":"order-cancellation-reasons-selector",...s}),e("div",{className:"order-order-cancel-reasons-form__button-container",children:e(S,{variant:"primary","data-testid":"order-cancel-submit-button",...o,children:e(p,{id:"Order.OrderCancellationReasonsForm.button"})})})]})},Q=({orderRef:s})=>{const o=h(),n=(o==null?void 0:o.orderCancellationReasons)??[];let i=_;return s.length>20&&(i=D),e(L,{orderRef:s,cancelOrder:i,cancelReasons:(a=>a.map((r,c)=>({text:r==null?void 0:r.description,value:c.toString()})))(n)})};export{Q as OrderCancel,Q as default};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { GetCustomerOrdersReturnResponse } from '../../types';
|
|
2
|
-
import { CustomerOrdersReturnModel } from '../models/customer-orders-return';
|
|
3
|
-
|
|
4
|
-
export declare const transformCustomerOrdersReturn: (response: GetCustomerOrdersReturnResponse) => CustomerOrdersReturnModel | null;
|
|
5
|
-
//# sourceMappingURL=transform-customer-orders-return.d.ts.map
|
|
File without changes
|
|
File without changes
|