@dropins/storefront-order 0.1.0-alpha3
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/fetch-graphql/fetch-graphql.d.ts +8 -0
- package/api/fetch-graphql/index.d.ts +2 -0
- package/api/getGuestOrder/getGuestOrder.d.ts +8 -0
- package/api/getGuestOrder/graphql/getGuestOrder.graphql.d.ts +3 -0
- package/api/getGuestOrder/index.d.ts +2 -0
- package/api/getOrderDetailsById/getOrderDetailsById.d.ts +5 -0
- package/api/getOrderDetailsById/graphql/customerAddressFragment.graphql.d.ts +2 -0
- package/api/getOrderDetailsById/graphql/index.d.ts +5 -0
- package/api/getOrderDetailsById/graphql/orderByNumber.graphql.d.ts +2 -0
- package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +2 -0
- package/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +2 -0
- package/api/getOrderDetailsById/index.d.ts +2 -0
- package/api/helpers/initializeOrderDetails.d.ts +2 -0
- package/api/index.d.ts +5 -0
- package/api/initialize/index.d.ts +2 -0
- package/api/initialize/initialize.d.ts +10 -0
- package/api.d.ts +1 -0
- package/api.js +35 -0
- package/chunks/getGuestOrder.js +133 -0
- package/components/Form/Form.d.ts +5 -0
- package/components/Form/FormInputs/FormInputs.d.ts +5 -0
- package/components/Form/FormInputs/index.d.ts +3 -0
- package/components/Form/index.d.ts +3 -0
- package/components/OrderSearchForm/OrderSearchForm.d.ts +5 -0
- package/components/OrderSearchForm/index.d.ts +3 -0
- package/components/index.d.ts +3 -0
- package/configs/mock.config.d.ts +161 -0
- package/containers/OrderSearch/OrderSearch.d.ts +5 -0
- package/containers/OrderSearch/index.d.ts +3 -0
- package/containers/OrderSearch.d.ts +3 -0
- package/containers/OrderSearch.js +1 -0
- package/containers/index.d.ts +2 -0
- package/data/models/guest-order.d.ts +21 -0
- package/data/models/index.d.ts +3 -0
- package/data/models/order-details.d.ts +38 -0
- package/data/transforms/index.d.ts +3 -0
- package/data/transforms/transform-guest-order.d.ts +5 -0
- package/data/transforms/transform-order-details.d.ts +5 -0
- package/hooks/components/useForm.d.ts +11 -0
- package/hooks/containers/useOrderSearch.d.ts +22 -0
- package/hooks/index.d.ts +2 -0
- package/i18n/en_US.json.d.ts +25 -0
- package/lib/checkIsFunction.d.ts +2 -0
- package/lib/convertToInputDateFormat.d.ts +2 -0
- package/lib/fetch-error.d.ts +5 -0
- package/lib/getFormValues.d.ts +2 -0
- package/lib/network-error.d.ts +6 -0
- package/package.json +1 -0
- package/render/Provider.d.ts +8 -0
- package/render/index.d.ts +2 -0
- package/render/render.d.ts +4 -0
- package/render.d.ts +1 -0
- package/render.js +2 -0
- package/types/api/getGuestOrder.types.d.ts +13 -0
- package/types/api/getOrderDetails.types.d.ts +187 -0
- package/types/form.types.d.ts +60 -0
- package/types/index.d.ts +5 -0
- package/types/orderSearch.types.d.ts +18 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe/fetch-graphql').Header) => void, fetchGraphQl: <T = any>(query: string, options?: import('@adobe/fetch-graphql').FetchOptions | undefined) => Promise<{
|
|
2
|
+
errors?: import('@adobe/fetch-graphql').FetchQueryError | undefined;
|
|
3
|
+
data: T;
|
|
4
|
+
}>, getConfig: () => {
|
|
5
|
+
endpoint: string | undefined;
|
|
6
|
+
fetchGraphQlHeaders: import('@adobe/fetch-graphql').Header | undefined;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=fetch-graphql.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { QueryType } from '../../types';
|
|
2
|
+
import { TransformedData } from '../../data/models';
|
|
3
|
+
|
|
4
|
+
export declare const getOrderDetailsById: <T extends QueryType>(orderId?: string, queryType?: T | undefined) => Promise<TransformedData<T>>;
|
|
5
|
+
//# sourceMappingURL=getOrderDetailsById.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ADDRESS = "\nfragment AddressesList on OrderAddress {\n city\n company\n country_code\n fax\n firstname\n lastname\n middlename\n postcode\n prefix\n region\n region_id\n street\n suffix\n telephone\n vat_id\n}";
|
|
2
|
+
//# sourceMappingURL=customerAddressFragment.graphql.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ORDER_ITEMS = "\nfragment OrderItems on OrderItem {\n status\n product_name\n id\n quantity_ordered\n product_sale_price {\n value\n currency\n }\n selected_options {\n label\n value\n }\n product {\n name\n sku\n small_image {\n url\n }\n thumbnail {\n label\n url\n }\n price_range {\n maximum_price {\n regular_price {\n currency\n value\n }\n }\n }\n }\n}";
|
|
2
|
+
//# sourceMappingURL=orderItemsFragment.graphql.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const ORDER_SUMMARY = "\nfragment OrderSummary on OrderTotal {\n grand_total {\n value\n currency\n }\n subtotal {\n currency\n value\n }\n taxes {\n amount {\n currency\n value\n }\n rate\n title\n }\n total_tax {\n currency\n value\n }\n total_shipping {\n currency\n value\n }\n discounts {\n amount {\n currency\n value\n }\n label\n }\n}";
|
|
2
|
+
//# sourceMappingURL=orderSummaryFragment.graphql.d.ts.map
|
package/api/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Initializer } from '@dropins/tools/types/elsie/src/lib';
|
|
2
|
+
import { Lang } from '@dropins/tools/types/elsie/src/i18n';
|
|
3
|
+
|
|
4
|
+
type ConfigProps = {
|
|
5
|
+
langDefinitions?: Lang;
|
|
6
|
+
};
|
|
7
|
+
export declare const initialize: Initializer<ConfigProps>;
|
|
8
|
+
export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=initialize.d.ts.map
|
package/api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api/index'
|
package/api.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{Initializer as l}from"@dropins/tools/lib.js";import{events as g}from"@dropins/tools/event-bus.js";import{O as p,a as f,A as _,f as m,h as D,b as O}from"./chunks/getGuestOrder.js";import{g as x,e as F,r as Q,s as T,c as z,d as H}from"./chunks/getGuestOrder.js";import"@dropins/tools/fetch-graphql.js";const y=`
|
|
2
|
+
query ORDER_BY_NUMBER($orderNumber: String!) {
|
|
3
|
+
customer {
|
|
4
|
+
orders(
|
|
5
|
+
filter: {number: {eq: $orderNumber}},
|
|
6
|
+
) {
|
|
7
|
+
items {
|
|
8
|
+
shipping_method
|
|
9
|
+
payment_methods {
|
|
10
|
+
name
|
|
11
|
+
}
|
|
12
|
+
shipping_address {
|
|
13
|
+
...AddressesList
|
|
14
|
+
}
|
|
15
|
+
billing_address {
|
|
16
|
+
...AddressesList
|
|
17
|
+
}
|
|
18
|
+
number
|
|
19
|
+
id
|
|
20
|
+
order_date
|
|
21
|
+
carrier
|
|
22
|
+
items {
|
|
23
|
+
...OrderItems
|
|
24
|
+
}
|
|
25
|
+
total {
|
|
26
|
+
...OrderSummary
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
${p}
|
|
33
|
+
${f}
|
|
34
|
+
${_}
|
|
35
|
+
`,S=r=>{const{shipping_address:a,billing_address:t,payment_methods:s,gift_receipt_included:d,order_date:n,shipping_method:o,total:e,gift_wrapping:i,gift_message:c,items:h}=r;return{defaultShipping:a,defaultBulling:t,paymentMethods:s,giftReceiptIncluded:d,orderDate:n,shippingMethod:o,giftWrapping:i,giftMessage:c,items:h,total:{discount:e==null?void 0:e.discounts,subtotal:e==null?void 0:e.subtotal,totalTax:e==null?void 0:e.total_tax,totalShipping:e==null?void 0:e.total_shipping,grandTotal:e==null?void 0:e.grand_total}}},b=r=>r.total,R=r=>({carrier:r==null?void 0:r.carrier,id:r==null?void 0:r.id,items:r==null?void 0:r.items,number:r==null?void 0:r.number,orderDate:r==null?void 0:r.order_date,paymentMethods:r==null?void 0:r.payment_methods,shippingMethod:r==null?void 0:r.shipping_method}),E=r=>({defaultShipping:r==null?void 0:r.shipping_address,defaultBulling:r==null?void 0:r.billing_address}),I=(r,a)=>{var s,d,n,o,e,i,c;if(!((o=(n=(d=(s=a==null?void 0:a.data)==null?void 0:s.customer)==null?void 0:d.orders)==null?void 0:n.items)!=null&&o.length))return null;const t=(c=(i=(e=a==null?void 0:a.data)==null?void 0:e.customer)==null?void 0:i.orders)==null?void 0:c.items[0];switch(r){case"orderData":return S(t);case"orderSummary":return b(t);case"orderStatus":return R(t);case"orderCustomerInformation":return E(t);default:return null}},M=async(r,a)=>await m(y,{method:"GET",cache:"force-cache",variables:{orderNumber:r}}).then(t=>{var s;return(s=t.errors)!=null&&s.length?D(t.errors):I(a||"orderData",t)}).catch(O),B=async r=>{const a=(r==null?void 0:r.orderId)||"";if(!a){console.error("Order ID not received.");return}const t=await M(a,"orderData");g.emit("order/data",t)},u=new l({init:async r=>{const a={};u.config.setConfig({...a,...r}),B(r).catch(console.error)},listeners:()=>[]}),C=u.config;export{C as config,m as fetchGraphQl,x as getConfig,F as getGuestOrder,M as getOrderDetailsById,u as initialize,Q as removeFetchGraphQlHeader,T as setEndpoint,z as setFetchGraphQlHeader,H as setFetchGraphQlHeaders};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import{events as p}from"@dropins/tools/event-bus.js";import{FetchGraphQL as _}from"@dropins/tools/fetch-graphql.js";const g=`
|
|
2
|
+
fragment OrderSummary on OrderTotal {
|
|
3
|
+
grand_total {
|
|
4
|
+
value
|
|
5
|
+
currency
|
|
6
|
+
}
|
|
7
|
+
subtotal {
|
|
8
|
+
currency
|
|
9
|
+
value
|
|
10
|
+
}
|
|
11
|
+
taxes {
|
|
12
|
+
amount {
|
|
13
|
+
currency
|
|
14
|
+
value
|
|
15
|
+
}
|
|
16
|
+
rate
|
|
17
|
+
title
|
|
18
|
+
}
|
|
19
|
+
total_tax {
|
|
20
|
+
currency
|
|
21
|
+
value
|
|
22
|
+
}
|
|
23
|
+
total_shipping {
|
|
24
|
+
currency
|
|
25
|
+
value
|
|
26
|
+
}
|
|
27
|
+
discounts {
|
|
28
|
+
amount {
|
|
29
|
+
currency
|
|
30
|
+
value
|
|
31
|
+
}
|
|
32
|
+
label
|
|
33
|
+
}
|
|
34
|
+
}`,h=`
|
|
35
|
+
fragment AddressesList on OrderAddress {
|
|
36
|
+
city
|
|
37
|
+
company
|
|
38
|
+
country_code
|
|
39
|
+
fax
|
|
40
|
+
firstname
|
|
41
|
+
lastname
|
|
42
|
+
middlename
|
|
43
|
+
postcode
|
|
44
|
+
prefix
|
|
45
|
+
region
|
|
46
|
+
region_id
|
|
47
|
+
street
|
|
48
|
+
suffix
|
|
49
|
+
telephone
|
|
50
|
+
vat_id
|
|
51
|
+
}`,f=`
|
|
52
|
+
fragment OrderItems on OrderItem {
|
|
53
|
+
status
|
|
54
|
+
product_name
|
|
55
|
+
id
|
|
56
|
+
quantity_ordered
|
|
57
|
+
product_sale_price {
|
|
58
|
+
value
|
|
59
|
+
currency
|
|
60
|
+
}
|
|
61
|
+
selected_options {
|
|
62
|
+
label
|
|
63
|
+
value
|
|
64
|
+
}
|
|
65
|
+
product {
|
|
66
|
+
name
|
|
67
|
+
sku
|
|
68
|
+
small_image {
|
|
69
|
+
url
|
|
70
|
+
}
|
|
71
|
+
thumbnail {
|
|
72
|
+
label
|
|
73
|
+
url
|
|
74
|
+
}
|
|
75
|
+
price_range {
|
|
76
|
+
maximum_price {
|
|
77
|
+
regular_price {
|
|
78
|
+
currency
|
|
79
|
+
value
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}`,O=e=>{const t=e.map(a=>a.message).join(" ");throw Error(t)},y=e=>{throw e instanceof DOMException&&e.name==="AbortError"||p.emit("error",{source:"auth",type:"network",error:e}),e},E=e=>{var n,d;if(!((n=e==null?void 0:e.data)!=null&&n.guestOrder))return null;const t=(d=e==null?void 0:e.data)==null?void 0:d.guestOrder,{shipping_address:a,billing_address:s,payment_methods:i,gift_receipt_included:u,order_date:c,printed_card_included:o,shipping_method:l,total:r,...m}=t;return{defaultShipping:a,defaultBulling:s,paymentMethods:i,giftReceiptIncluded:u,orderDate:c,printedCardIncluded:o,shippingMethod:l,total:{discounts:(r==null?void 0:r.discounts)||null,subtotal:(r==null?void 0:r.subtotal)||null,totalTax:(r==null?void 0:r.total_tax)||null,totalShipping:(r==null?void 0:r.total_shipping)||null,grandTotal:(r==null?void 0:r.grand_total)||null},...m}},{setEndpoint:D,setFetchGraphQlHeader:S,removeFetchGraphQlHeader:T,setFetchGraphQlHeaders:x,fetchGraphQl:b,getConfig:I}=new _().getMethods(),G=`
|
|
85
|
+
fragment guestOrderData on CustomerOrder {
|
|
86
|
+
gift_receipt_included
|
|
87
|
+
carrier
|
|
88
|
+
email
|
|
89
|
+
id
|
|
90
|
+
number
|
|
91
|
+
order_date
|
|
92
|
+
printed_card_included
|
|
93
|
+
shipping_method
|
|
94
|
+
status
|
|
95
|
+
token
|
|
96
|
+
payment_methods {
|
|
97
|
+
name
|
|
98
|
+
type
|
|
99
|
+
}
|
|
100
|
+
total {
|
|
101
|
+
...OrderSummary
|
|
102
|
+
}
|
|
103
|
+
billing_address {
|
|
104
|
+
...AddressesList
|
|
105
|
+
}
|
|
106
|
+
shipping_address {
|
|
107
|
+
...AddressesList
|
|
108
|
+
}
|
|
109
|
+
items {
|
|
110
|
+
__typename
|
|
111
|
+
...OrderItems
|
|
112
|
+
... on GiftCardOrderItem {
|
|
113
|
+
gift_card {
|
|
114
|
+
recipient_name
|
|
115
|
+
recipient_email
|
|
116
|
+
sender_name
|
|
117
|
+
sender_email
|
|
118
|
+
message
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
${g}
|
|
124
|
+
${h}
|
|
125
|
+
${f}
|
|
126
|
+
`,R=`
|
|
127
|
+
query GET_GUEST_ORDER($input: OrderInformationInput!) {
|
|
128
|
+
guestOrder(input:$input) {
|
|
129
|
+
...guestOrderData
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
${G}
|
|
133
|
+
`,M=async e=>await b(R,{method:"GET",cache:"no-cache",variables:{input:e}}).then(t=>{var a;return(a=t.errors)!=null&&a.length?O(t.errors):E(t)}).catch(y);export{h as A,g as O,f as a,y as b,S as c,x as d,M as e,b as f,I as g,O as h,T as r,D as s};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export declare const mockOrder: {
|
|
2
|
+
data: {
|
|
3
|
+
guestOrder: {
|
|
4
|
+
gift_receipt_included: boolean;
|
|
5
|
+
carrier: string;
|
|
6
|
+
email: string;
|
|
7
|
+
id: string;
|
|
8
|
+
number: string;
|
|
9
|
+
order_date: string;
|
|
10
|
+
printed_card_included: boolean;
|
|
11
|
+
shipping_method: string;
|
|
12
|
+
status: string;
|
|
13
|
+
token: string;
|
|
14
|
+
payment_methods: {
|
|
15
|
+
name: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}[];
|
|
18
|
+
total: {
|
|
19
|
+
subtotal: {
|
|
20
|
+
currency: string;
|
|
21
|
+
value: number;
|
|
22
|
+
};
|
|
23
|
+
total_tax: {
|
|
24
|
+
currency: string;
|
|
25
|
+
value: number;
|
|
26
|
+
};
|
|
27
|
+
total_shipping: {
|
|
28
|
+
currency: string;
|
|
29
|
+
value: number;
|
|
30
|
+
};
|
|
31
|
+
grand_total: {
|
|
32
|
+
currency: string;
|
|
33
|
+
value: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
billing_address: {
|
|
37
|
+
firstname: string;
|
|
38
|
+
middlename: null;
|
|
39
|
+
lastname: string;
|
|
40
|
+
street: string[];
|
|
41
|
+
city: string;
|
|
42
|
+
postcode: string;
|
|
43
|
+
telephone: string;
|
|
44
|
+
country_code: string;
|
|
45
|
+
region: string;
|
|
46
|
+
region_id: string;
|
|
47
|
+
company: string;
|
|
48
|
+
};
|
|
49
|
+
shipping_address: {
|
|
50
|
+
firstname: string;
|
|
51
|
+
middlename: null;
|
|
52
|
+
lastname: string;
|
|
53
|
+
street: string[];
|
|
54
|
+
city: string;
|
|
55
|
+
postcode: string;
|
|
56
|
+
telephone: string;
|
|
57
|
+
country_code: string;
|
|
58
|
+
region: string;
|
|
59
|
+
region_id: string;
|
|
60
|
+
company: string;
|
|
61
|
+
};
|
|
62
|
+
items: {
|
|
63
|
+
__typename: string;
|
|
64
|
+
id: string;
|
|
65
|
+
quantity_ordered: number;
|
|
66
|
+
product_sale_price: {
|
|
67
|
+
value: number;
|
|
68
|
+
currency: string;
|
|
69
|
+
};
|
|
70
|
+
product: {
|
|
71
|
+
name: string;
|
|
72
|
+
sku: string;
|
|
73
|
+
thumbnail: {
|
|
74
|
+
label: string;
|
|
75
|
+
url: string;
|
|
76
|
+
};
|
|
77
|
+
price_range: {
|
|
78
|
+
maximum_price: {
|
|
79
|
+
regular_price: {
|
|
80
|
+
currency: string;
|
|
81
|
+
value: number;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
selected_options: {
|
|
87
|
+
label: string;
|
|
88
|
+
value: string;
|
|
89
|
+
}[];
|
|
90
|
+
}[];
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export declare const mockOrderDetailsResponse: {
|
|
95
|
+
customer: {
|
|
96
|
+
addresses: {
|
|
97
|
+
firstname: string;
|
|
98
|
+
lastname: string;
|
|
99
|
+
city: string;
|
|
100
|
+
company: string;
|
|
101
|
+
country_code: string;
|
|
102
|
+
region: {
|
|
103
|
+
region: string;
|
|
104
|
+
region_code: string;
|
|
105
|
+
region_id: number;
|
|
106
|
+
};
|
|
107
|
+
custom_attributesV2: never[];
|
|
108
|
+
telephone: string;
|
|
109
|
+
id: number;
|
|
110
|
+
vat_id: string;
|
|
111
|
+
postcode: string;
|
|
112
|
+
street: string[];
|
|
113
|
+
default_shipping: boolean;
|
|
114
|
+
default_billing: boolean;
|
|
115
|
+
}[];
|
|
116
|
+
orders: {
|
|
117
|
+
page_info: {
|
|
118
|
+
page_size: number;
|
|
119
|
+
total_pages: number;
|
|
120
|
+
current_page: number;
|
|
121
|
+
};
|
|
122
|
+
total_count: number;
|
|
123
|
+
items: {
|
|
124
|
+
shipping_method: string;
|
|
125
|
+
payment_methods: {
|
|
126
|
+
name: string;
|
|
127
|
+
}[];
|
|
128
|
+
number: string;
|
|
129
|
+
id: string;
|
|
130
|
+
order_date: string;
|
|
131
|
+
carrier: string;
|
|
132
|
+
items: {
|
|
133
|
+
status: string;
|
|
134
|
+
product_name: string;
|
|
135
|
+
id: string;
|
|
136
|
+
}[];
|
|
137
|
+
total: {
|
|
138
|
+
grand_total: {
|
|
139
|
+
value: number;
|
|
140
|
+
currency: string;
|
|
141
|
+
};
|
|
142
|
+
subtotal: {
|
|
143
|
+
currency: string;
|
|
144
|
+
value: number;
|
|
145
|
+
};
|
|
146
|
+
taxes: never[];
|
|
147
|
+
total_tax: {
|
|
148
|
+
currency: string;
|
|
149
|
+
value: number;
|
|
150
|
+
};
|
|
151
|
+
total_shipping: {
|
|
152
|
+
currency: string;
|
|
153
|
+
value: number;
|
|
154
|
+
};
|
|
155
|
+
discounts: never[];
|
|
156
|
+
};
|
|
157
|
+
}[];
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=mock.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as M,jsx as c,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as S}from"@dropins/tools/lib.js";import{Card as C,InLineAlert as w,Icon as L,Button as R,Field as O,Picker as q,Input as V,InputDate as g,Checkbox as F,TextArea as U}from"@dropins/tools/components.js";import{useRef as H,useState as N,useEffect as G,useCallback as A,useMemo as X}from"@dropins/tools/preact-hooks.js";import{Text as _,useText as x}from"@dropins/tools/i18n.js";import*as m from"@dropins/tools/preact-compat.js";import{memo as k,useCallback as D}from"@dropins/tools/preact-compat.js";import{events as P}from"@dropins/tools/event-bus.js";import{e as W}from"../chunks/getGuestOrder.js";import"@dropins/tools/fetch-graphql.js";const z=r=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.8052 14.4968C10.8552 14.4968 9.9752 14.0268 9.4452 13.2368L9.4152 13.1868L9.3852 13.1268C8.1352 11.2268 7.5352 8.96681 7.6852 6.68681C7.7552 4.42681 9.6052 2.61681 11.8652 2.60681H12.0052C14.2752 2.47681 16.2152 4.21681 16.3452 6.47681C16.3452 6.55681 16.3452 6.62681 16.3452 6.70681C16.4852 8.94681 15.9052 11.1768 14.6852 13.0568L14.6052 13.1768C14.0552 13.9868 13.1352 14.4668 12.1652 14.4768H12.0052C11.9352 14.4768 11.8652 14.4868 11.7952 14.4868L11.8052 14.4968Z",stroke:"currentColor"}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M4.3252 21.5469C4.3552 20.4169 4.4752 19.2869 4.6752 18.1769C4.8952 17.1669 6.4752 16.0269 8.9052 15.1569C9.2352 15.0369 9.4852 14.7869 9.5952 14.4569L9.8052 14.0269",stroke:"currentColor"}),m.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.425 14.4069L14.165 14.1569C14.375 14.5969 14.725 14.9569 15.155 15.1869C16.945 15.7969 19.125 16.9569 19.375 18.2069C19.585 19.3069 19.685 20.4269 19.675 21.5369",stroke:"currentColor"})),Z=r=>m.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},m.createElement("path",{vectorEffect:"non-scaling-stroke",fillRule:"evenodd",clipRule:"evenodd",d:"M1 20.8953L12.1922 1.5L23.395 20.8953H1ZM13.0278 13.9638L13.25 10.0377V9H11.25V10.0377L11.4722 13.9638H13.0278ZM11.2994 16V17.7509H13.2253V16H11.2994Z",fill:"currentColor"})),j=({onSubmit:r,loading:n,inLineAlert:u,fieldsConfig:o})=>M(C,{variant:"secondary",className:"dropin-order-search-form",children:[c("h2",{className:"dropin-order-search-form__title",children:c(_,{id:"Order.OrderSearchForm.title"})}),c("p",{children:c(_,{id:"Order.OrderSearchForm.description"})}),u.text?c(w,{"data-testid":"orderAlert",className:"dropin-order-search-form__alert",type:u.type,variant:"secondary",heading:u.text,icon:c(L,{source:Z})}):null,c(K,{className:"dropin-order-search-form__wrapper",name:"orderSearchForm",loading:n,fieldsConfig:o,onSubmit:r,children:c("div",{class:"dropin-order-search-form__button-container",children:c(R,{className:"dropin-order-search-form__button",size:"medium",variant:"primary",type:"submit",disabled:n,children:c(_,{id:"Order.OrderSearchForm.button"})},"logIn")})})]}),Y=r=>r.reduce((n,{code:u,required:o,defaultValue:a})=>(o&&(n[u]=a),n),{}),J=({fieldsConfig:r,onSubmit:n})=>{const{requiredFieldError:u}=x({requiredFieldError:"Order.Form.notifications.requiredFieldError"}),o=H(null),[a,i]=N({}),[h,l]=N({});G(()=>{if(!r||!r.length)return;const f=Y(r);i(f)},[r==null?void 0:r.length]);const p=A((f,e)=>{const t=r.find(s=>s.code===f);return t!=null&&t.required&&!e?u:""},[r,u]),b=A(f=>{const{name:e,value:t,type:d,checked:s}=f==null?void 0:f.target,E=d==="checkbox"?s:t;i($=>({...$,[e]:E}))},[]),T=A(f=>{const{name:e,value:t,type:d,checked:s}=f==null?void 0:f.target,E=d==="checkbox"?s:t;l($=>({...$,[e]:p(e,E)}))},[p]),I=A(f=>{f.preventDefault();let e=!0,t={},d=null;for(const[s,E]of Object.entries(a)){const $=p(s,E);$&&(t[s]=$,e=!1,d||(d=s))}if(l(t),d&&o.current){const s=o.current.elements.namedItem(d);s==null||s.focus()}n==null||n(f,e)},[a,p,n]);return{formData:a,errors:h,formRef:o,handleChange:b,handleBlur:T,handleSubmit:I}},B=k(({loading:r,values:n,fields:u=[],errors:o,className:a="",onChange:i,onBlur:h})=>{const l=`${a}__item`,p=D((e,t,d)=>{const s=e.options.map(E=>({text:E.label,value:E.value}));return c(O,{error:d,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:c(q,{name:e.id,floatingLabel:`${e.label} ${e.required?"*":""}`,placeholder:e.label,"aria-label":e.label,options:s,onBlur:h,handleSelect:i,value:t||e.defaultValue})},e.id)},[a,r,l,h,i]),b=D((e,t,d)=>{const s=e.id==="email",E=s?c(z,{}):void 0,$=s?"username":"";return c(O,{error:d,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e==null?void 0:e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:c(V,{"aria-label":e.label,"aria-required":e.required,autoComplete:$,icon:E,type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:i})},e.id)},[a,r,l,h,i]),T=D((e,t,d)=>c(O,{error:d,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:c(g,{type:"text",name:e.id,value:t||e.defaultValue,placeholder:e.label,floatingLabel:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:i})},e.id),[a,r,l,h,i]),I=D((e,t,d)=>c(O,{error:d,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:c(F,{name:e.id,checked:t||e.defaultValue,placeholder:e.label,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:i})},e.id),[a,r,l,h,i]),f=D((e,t,d)=>c(O,{error:d,className:S([l,`${l}--${e.id}`,[`${l}--${e.id}-hidden`,e.is_hidden],e.className]),"data-testid":`${a}--${e.id}`,disabled:r,children:c(U,{type:"text",name:e.id,value:t===void 0?e.defaultValue:t,label:`${e.label} ${e.required?"*":""}`,onBlur:h,onChange:i})},e.id),[a,r,l,h,i]);return u.length?c(v,{children:u.map(e=>{var s;const t=(o==null?void 0:o[e.id])??"",d=(n==null?void 0:n[e.id])??"";switch(e.fieldType){case"TEXT":return(s=e==null?void 0:e.options)!=null&&s.length?p(e,d,t):b(e,d,t);case"MULTILINE":return b(e,d,t);case"SELECT":return p(e,d,t);case"DATE":return T(e,d,t);case"BOOLEAN":return I(e,d,t);case"TEXTAREA":return f(e,d,t);default:return null}})}):null}),K=k(({name:r,loading:n,children:u,className:o="defaultForm",fieldsConfig:a,onSubmit:i})=>{const{formData:h,errors:l,formRef:p,handleChange:b,handleBlur:T,handleSubmit:I}=J({fieldsConfig:a,onSubmit:i});return M("form",{className:S(["dropin-form",o]),onSubmit:I,name:r,ref:p,children:[c(B,{className:o,loading:n,fields:a,onChange:b,onBlur:T,errors:l,values:h}),u]})});var y=(r=>(r.BOOLEAN="BOOLEAN",r.DATE="DATE",r.DATETIME="DATETIME",r.DROPDOWN="DROPDOWN",r.FILE="FILE",r.GALLERY="GALLERY",r.HIDDEN="HIDDEN",r.IMAGE="IMAGE",r.MEDIA_IMAGE="MEDIA_IMAGE",r.MULTILINE="MULTILINE",r.MULTISELECT="MULTISELECT",r.PRICE="PRICE",r.SELECT="SELECT",r.TEXT="TEXT",r.TEXTAREA="TEXTAREA",r.UNDEFINED="UNDEFINED",r.VISUAL="VISUAL",r.WEIGHT="WEIGHT",r.EMPTY="",r))(y||{});const Q=r=>{if(!r)return null;const n=new FormData(r);if(r.querySelectorAll('input[type="checkbox"]').forEach(o=>{n.has(o.name)||n.set(o.name,"false"),o.checked&&n.set(o.name,"true")}),n&&typeof n.entries=="function"){const o=n.entries();if(o&&typeof o[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(o)))||{}}return{}},ee=()=>{const[r,n]=N({text:"",type:"success"}),[u,o]=N(!1),a=x({invalidSearch:"Order.Errors.invalidSearch",unknown:"Order.Errors.unknown",email:"Order.OrderSearchForm.email",postcode:"Order.OrderSearchForm.postcode",number:"Order.OrderSearchForm.orderNumber"}),i=X(()=>[{entity_type:"CUSTOMER_ADDRESS",is_unique:!1,label:a.email,options:[],defaultValue:"",fieldType:y.TEXT,className:"",required:!0,orderNumber:1,name:"email",id:"email",code:"email"},{entity_type:"CUSTOMER_ADDRESS",is_unique:!1,label:a.postcode,options:[],defaultValue:"",fieldType:y.TEXT,className:"",required:!0,orderNumber:2,name:"postcode",id:"postcode",code:"postcode"},{entity_type:"CUSTOMER_ADDRESS",is_unique:!1,label:a.number,options:[],defaultValue:"",fieldType:y.TEXT,className:"",required:!0,orderNumber:3,name:"number",id:"number",code:"number"}],[a]);return{onSubmit:A(async(l,p)=>{if(!p)return null;o(!0);const b=Q(l.target);await W(b).then(T=>{T||n({text:a.invalidSearch,type:"warning"}),P.emit("order/data",T)}).catch(()=>{n({text:a.unknown,type:"warning"})}).finally(()=>{o(!1)}),l.target.reset()},[a]),inLineAlert:r,loading:u,normalizeFieldsConfig:i}},ue=({className:r})=>{const{onSubmit:n,loading:u,inLineAlert:o,normalizeFieldsConfig:a}=ee();return c("div",{className:S(["dropin-order-search",r]),children:c(j,{onSubmit:n,loading:u,inLineAlert:o,fieldsConfig:a})})};export{ue as OrderSearch,ue as default};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DiscountProps, GuestOrderProps, MoneyProps, paymentMethodsProps, UserAddressesProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
export interface GuestOrderModel extends Omit<GuestOrderProps, 'shipping_address' | 'billing_address' | 'payment_methods' | 'gift_receipt_included' | 'order_date' | 'printed_card_included' | 'shipping_method' | 'total'> {
|
|
4
|
+
defaultShipping: UserAddressesProps;
|
|
5
|
+
defaultBulling: UserAddressesProps;
|
|
6
|
+
paymentMethods: paymentMethodsProps[];
|
|
7
|
+
giftReceiptIncluded: boolean;
|
|
8
|
+
orderDate: string;
|
|
9
|
+
printedCardIncluded: boolean;
|
|
10
|
+
shippingMethod: string;
|
|
11
|
+
total: {
|
|
12
|
+
discounts: DiscountProps[] | null;
|
|
13
|
+
subtotal: MoneyProps | null;
|
|
14
|
+
totalTax: MoneyProps | null;
|
|
15
|
+
totalShipping: MoneyProps | null;
|
|
16
|
+
grandTotal: MoneyProps | null;
|
|
17
|
+
};
|
|
18
|
+
token: string;
|
|
19
|
+
}
|
|
20
|
+
export type GuestOrderModelResponse = GuestOrderModel | null;
|
|
21
|
+
//# sourceMappingURL=guest-order.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DiscountProps, GiftMessageProps, GiftWrappingProps, MoneyProps, OrderItemProps, paymentMethodsProps, QueryType, TotalProps, UserAddressesProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
export interface OrderData {
|
|
4
|
+
giftWrapping: GiftWrappingProps;
|
|
5
|
+
giftMessage: GiftMessageProps;
|
|
6
|
+
defaultShipping: UserAddressesProps;
|
|
7
|
+
defaultBulling: UserAddressesProps;
|
|
8
|
+
paymentMethods: paymentMethodsProps[];
|
|
9
|
+
giftReceiptIncluded: boolean;
|
|
10
|
+
orderDate: string;
|
|
11
|
+
shippingMethod: string;
|
|
12
|
+
items: OrderItemProps[];
|
|
13
|
+
total: {
|
|
14
|
+
discount: DiscountProps[];
|
|
15
|
+
subtotal: MoneyProps;
|
|
16
|
+
totalTax: MoneyProps;
|
|
17
|
+
totalShipping: MoneyProps;
|
|
18
|
+
grandTotal: MoneyProps;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface OrderSummary {
|
|
22
|
+
orderSummary: TotalProps;
|
|
23
|
+
}
|
|
24
|
+
export interface OrderStatus {
|
|
25
|
+
carrier: string;
|
|
26
|
+
id: string;
|
|
27
|
+
items: any;
|
|
28
|
+
number: string;
|
|
29
|
+
orderDate: string;
|
|
30
|
+
paymentMethods: any;
|
|
31
|
+
shippingMethod: string;
|
|
32
|
+
}
|
|
33
|
+
export interface OrderCustomerInformation {
|
|
34
|
+
defaultShipping: UserAddressesProps;
|
|
35
|
+
defaultBulling: UserAddressesProps;
|
|
36
|
+
}
|
|
37
|
+
export type TransformedData<T extends QueryType> = T extends 'orderData' ? OrderData : T extends 'orderSummary' ? OrderSummary : T extends 'orderStatus' ? OrderStatus : T extends 'orderCustomerInformation' ? OrderCustomerInformation : null;
|
|
38
|
+
//# sourceMappingURL=order-details.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { QueryType, ResponseData } from '../../types';
|
|
2
|
+
import { TransformedData } from '../models';
|
|
3
|
+
|
|
4
|
+
export declare const transformOrderDetails: <T extends QueryType>(queryType: QueryType, response: ResponseData<T>) => TransformedData<T>;
|
|
5
|
+
//# sourceMappingURL=transform-order-details.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FormValues, useFormProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
export declare const useForm: ({ fieldsConfig, onSubmit }: useFormProps) => {
|
|
4
|
+
formData: FormValues;
|
|
5
|
+
errors: Record<string, string>;
|
|
6
|
+
formRef: import('preact').RefObject<HTMLFormElement>;
|
|
7
|
+
handleChange: (event: Event) => void;
|
|
8
|
+
handleBlur: (event: Event) => void;
|
|
9
|
+
handleSubmit: (event: SubmitEvent) => void;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=useForm.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FieldEnumList, inLineAlertProps } from '../../types';
|
|
2
|
+
|
|
3
|
+
export declare const useOrderSearch: () => {
|
|
4
|
+
onSubmit: (event: Event, valid: boolean) => Promise<null | undefined>;
|
|
5
|
+
inLineAlert: inLineAlertProps;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
normalizeFieldsConfig: {
|
|
8
|
+
entity_type: string;
|
|
9
|
+
is_unique: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
options: never[];
|
|
12
|
+
defaultValue: string;
|
|
13
|
+
fieldType: FieldEnumList;
|
|
14
|
+
className: string;
|
|
15
|
+
required: boolean;
|
|
16
|
+
orderNumber: number;
|
|
17
|
+
name: string;
|
|
18
|
+
id: string;
|
|
19
|
+
code: string;
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useOrderSearch.d.ts.map
|
package/hooks/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"Order": {
|
|
3
|
+
"OrderSearchForm": {
|
|
4
|
+
"title": "Enter your information to view order details",
|
|
5
|
+
"description": "You can find your order number in the receipt you received via email.",
|
|
6
|
+
"button": "View Order",
|
|
7
|
+
"email": "Email",
|
|
8
|
+
"postcode": "Zip Code",
|
|
9
|
+
"orderNumber": "Order Number"
|
|
10
|
+
},
|
|
11
|
+
"Form": {
|
|
12
|
+
"notifications": {
|
|
13
|
+
"requiredFieldError": "This is a required field."
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"Errors": {
|
|
17
|
+
"invalidOrder": "Invalid order. Please try again.",
|
|
18
|
+
"invalidSearch": "No order found with these order details.",
|
|
19
|
+
"unknown": "Something went wrong. Please try again."
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
;
|
|
24
|
+
|
|
25
|
+
export default _default;
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "@dropins/storefront-order", "version": "0.1.0-alpha3", "@dropins/elsie": "0.26.0-alpha225"}
|
package/render.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './render/index'
|
package/render.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(a,t){try{if(typeof document<"u"){const e=document.createElement("style"),n=t.styleId;for(const r in t.attributes)e.setAttribute(r,t.attributes[r]);e.setAttribute("data-dropin",n),e.appendChild(document.createTextNode(a));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(e);else{const r=document.querySelector('link[rel="stylesheet"], style');r?r.before(e):document.head.append(e)}}}catch(e){console.error("dropin-styles (injectCodeFunction)",e)}})('.dropin-order-search-form{gap:var(--spacing-small)}.dropin-order-search-form p{color:var(--color-neutral-700);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing);margin:0}.dropin-order-search-form__title{color:var(--color-neutral-800);font:var(--type-headline-2-strong-font);letter-spacing:var(--type-headline-2-strong-letter-spacing);margin:0}.dropin-order-search-form__wrapper{display:grid;grid-template-columns:1fr;grid-template-rows:auto;grid-template-areas:"email" "postcode" "number" "button";gap:var(--spacing-medium)}.dropin-order-search-form__wrapper__item--email{grid-area:email}.dropin-order-search-form__wrapper__item--postcode{grid-area:postcode}.dropin-order-search-form__wrapper__item--number{grid-area:number}.dropin-order-search-form__button-container{display:flex;justify-content:flex-end;grid-area:button}.dropin-order-search-form form button{align-self:flex-end;justify-self:flex-end;margin-top:var(--spacing-small)}@media (min-width: 768px){.dropin-order-search-form__wrapper{grid-template-columns:1fr 1fr;grid-template-rows:auto auto auto;grid-template-areas:"email postcode" "number number" "button button"}}',{styleId:"order"});
|
|
2
|
+
import{jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{Render as d}from"@dropins/tools/lib.js";import{useState as a,useEffect as s}from"@dropins/tools/preact-hooks.js";import{UIProvider as m}from"@dropins/tools/components.js";import{events as u}from"@dropins/tools/event-bus.js";const c={OrderSearchForm:{title:"Enter your information to view order details",description:"You can find your order number in the receipt you received via email.",button:"View Order",email:"Email",postcode:"Zip Code",orderNumber:"Order Number"},Form:{notifications:{requiredFieldError:"This is a required field."}},Errors:{invalidOrder:"Invalid order. Please try again.",invalidSearch:"No order found with these order details.",unknown:"Something went wrong. Please try again."}},f={Order:c},l={default:f},p=({children:o})=>{const[i,n]=a("en_US");return s(()=>{const r=u.on("locale",t=>{n(t)},{eager:!0});return()=>{r==null||r.off()}},[]),e(m,{lang:i,langDefinitions:l,children:o})},S=new d(e(p,{}));export{S as render};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OrderProps } from '..';
|
|
2
|
+
|
|
3
|
+
export interface GuestOrderProps extends OrderProps {
|
|
4
|
+
}
|
|
5
|
+
export interface GuestOrderResponse {
|
|
6
|
+
data: {
|
|
7
|
+
guestOrder?: GuestOrderProps;
|
|
8
|
+
};
|
|
9
|
+
errors?: {
|
|
10
|
+
message: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=getGuestOrder.types.d.ts.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
export type QueryType = 'orderData' | 'orderSummary' | 'orderStatus' | 'orderCustomerInformation';
|
|
2
|
+
export interface UserAddressesProps {
|
|
3
|
+
city?: string;
|
|
4
|
+
company?: string;
|
|
5
|
+
country_code?: string;
|
|
6
|
+
fax?: string;
|
|
7
|
+
firstname?: string;
|
|
8
|
+
lastname?: string;
|
|
9
|
+
middlename?: string;
|
|
10
|
+
postcode?: string;
|
|
11
|
+
prefix?: string;
|
|
12
|
+
region?: string;
|
|
13
|
+
region_id?: number;
|
|
14
|
+
street?: string[];
|
|
15
|
+
suffix?: string;
|
|
16
|
+
telephone?: string;
|
|
17
|
+
vat_id?: string;
|
|
18
|
+
}
|
|
19
|
+
interface SmallImageProps {
|
|
20
|
+
url?: string;
|
|
21
|
+
}
|
|
22
|
+
interface ProductProps {
|
|
23
|
+
small_image?: SmallImageProps;
|
|
24
|
+
}
|
|
25
|
+
export interface OrderItemProps {
|
|
26
|
+
status?: string;
|
|
27
|
+
product_name?: string;
|
|
28
|
+
id?: string;
|
|
29
|
+
product?: ProductProps;
|
|
30
|
+
}
|
|
31
|
+
export interface MoneyProps {
|
|
32
|
+
value?: number;
|
|
33
|
+
currency?: string;
|
|
34
|
+
}
|
|
35
|
+
interface GrandTotalProps extends MoneyProps {
|
|
36
|
+
}
|
|
37
|
+
interface SubtotalProps extends MoneyProps {
|
|
38
|
+
}
|
|
39
|
+
interface TotalTaxProps extends MoneyProps {
|
|
40
|
+
}
|
|
41
|
+
interface TaxAmountProps extends MoneyProps {
|
|
42
|
+
}
|
|
43
|
+
interface TotalShippingProps extends MoneyProps {
|
|
44
|
+
}
|
|
45
|
+
interface TaxDetailProps {
|
|
46
|
+
amount?: TaxAmountProps;
|
|
47
|
+
rate?: number;
|
|
48
|
+
title?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface DiscountProps {
|
|
51
|
+
amount?: MoneyProps;
|
|
52
|
+
label?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface TotalProps {
|
|
55
|
+
grand_total?: GrandTotalProps;
|
|
56
|
+
subtotal?: SubtotalProps;
|
|
57
|
+
taxes?: TaxDetailProps[];
|
|
58
|
+
total_tax?: TotalTaxProps;
|
|
59
|
+
total_shipping?: TotalShippingProps;
|
|
60
|
+
discounts?: DiscountProps[];
|
|
61
|
+
}
|
|
62
|
+
interface InvoiceItemInterface {
|
|
63
|
+
}
|
|
64
|
+
interface InvoiceProps {
|
|
65
|
+
id?: string;
|
|
66
|
+
number?: string;
|
|
67
|
+
total?: TotalProps;
|
|
68
|
+
items?: InvoiceItemInterface[];
|
|
69
|
+
comments?: {
|
|
70
|
+
message: string;
|
|
71
|
+
timestamp: string;
|
|
72
|
+
}[];
|
|
73
|
+
}
|
|
74
|
+
export interface GiftMessageProps {
|
|
75
|
+
gift_message: {
|
|
76
|
+
form: string;
|
|
77
|
+
message: string;
|
|
78
|
+
to: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export interface GiftWrappingProps {
|
|
82
|
+
gift_wrapping: {
|
|
83
|
+
design: string;
|
|
84
|
+
price: MoneyProps;
|
|
85
|
+
uid: string;
|
|
86
|
+
image: {
|
|
87
|
+
url: string;
|
|
88
|
+
label: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
interface OrderItemInterface {
|
|
93
|
+
discounts: DiscountProps[];
|
|
94
|
+
eligible_for_return: boolean;
|
|
95
|
+
entered_options: {
|
|
96
|
+
label: string;
|
|
97
|
+
value: string;
|
|
98
|
+
}[];
|
|
99
|
+
gift_message: GiftMessageProps;
|
|
100
|
+
gift_wrapping: GiftWrappingProps;
|
|
101
|
+
id: string;
|
|
102
|
+
product: ProductProps;
|
|
103
|
+
product_name: string;
|
|
104
|
+
product_sale_price: MoneyProps;
|
|
105
|
+
product_sku: string;
|
|
106
|
+
product_type: string;
|
|
107
|
+
product_url_key: string;
|
|
108
|
+
quantity_canceled: number;
|
|
109
|
+
quantity_invoiced: number;
|
|
110
|
+
quantity_ordered: number;
|
|
111
|
+
quantity_refunded: number;
|
|
112
|
+
quantity_returned: number;
|
|
113
|
+
quantity_shipped: number;
|
|
114
|
+
selected_options: {
|
|
115
|
+
label: string;
|
|
116
|
+
value: string;
|
|
117
|
+
}[];
|
|
118
|
+
status: string;
|
|
119
|
+
}
|
|
120
|
+
export interface paymentMethodsProps {
|
|
121
|
+
name: string;
|
|
122
|
+
type: string;
|
|
123
|
+
additional_data: {
|
|
124
|
+
name: string;
|
|
125
|
+
value: string;
|
|
126
|
+
}[];
|
|
127
|
+
}
|
|
128
|
+
export interface OrderProps {
|
|
129
|
+
shipping_method: string;
|
|
130
|
+
status: string;
|
|
131
|
+
token: string;
|
|
132
|
+
carrier: string;
|
|
133
|
+
email: string;
|
|
134
|
+
gift_receipt_included: boolean;
|
|
135
|
+
id: string;
|
|
136
|
+
number: string;
|
|
137
|
+
order_date: string;
|
|
138
|
+
printed_card_included: boolean;
|
|
139
|
+
applied_coupons: {
|
|
140
|
+
code: string;
|
|
141
|
+
}[];
|
|
142
|
+
shipments: {
|
|
143
|
+
id: string;
|
|
144
|
+
number: string;
|
|
145
|
+
tracking: {
|
|
146
|
+
carrier: string;
|
|
147
|
+
number: string;
|
|
148
|
+
title: string;
|
|
149
|
+
}[];
|
|
150
|
+
comments: {
|
|
151
|
+
message: string;
|
|
152
|
+
timestamp: string;
|
|
153
|
+
}[];
|
|
154
|
+
}[];
|
|
155
|
+
returns: {
|
|
156
|
+
pageSize: number;
|
|
157
|
+
currentPage: number;
|
|
158
|
+
};
|
|
159
|
+
items_eligible_for_return: OrderItemInterface[];
|
|
160
|
+
gift_wrapping: GiftWrappingProps;
|
|
161
|
+
gift_message: GiftMessageProps;
|
|
162
|
+
payment_methods: paymentMethodsProps[];
|
|
163
|
+
invoices: InvoiceProps[];
|
|
164
|
+
items: OrderItemProps[];
|
|
165
|
+
shipping_address: UserAddressesProps;
|
|
166
|
+
billing_address: UserAddressesProps;
|
|
167
|
+
total?: TotalProps;
|
|
168
|
+
}
|
|
169
|
+
export interface ErrorProps {
|
|
170
|
+
errors?: {
|
|
171
|
+
message?: string;
|
|
172
|
+
}[];
|
|
173
|
+
}
|
|
174
|
+
export interface OrdersResponse extends ErrorProps {
|
|
175
|
+
data?: {
|
|
176
|
+
customer?: {
|
|
177
|
+
orders?: {
|
|
178
|
+
items?: OrderProps[];
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
export interface OrderByNumberResponse extends OrdersResponse {
|
|
184
|
+
}
|
|
185
|
+
export type ResponseData<T extends QueryType> = T extends 'orderData' | 'orderSummary' | 'orderStatus' ? OrderByNumberResponse : never;
|
|
186
|
+
export {};
|
|
187
|
+
//# sourceMappingURL=getOrderDetails.types.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare enum FieldEnumList {
|
|
2
|
+
BOOLEAN = "BOOLEAN",
|
|
3
|
+
DATE = "DATE",
|
|
4
|
+
DATETIME = "DATETIME",
|
|
5
|
+
DROPDOWN = "DROPDOWN",
|
|
6
|
+
FILE = "FILE",
|
|
7
|
+
GALLERY = "GALLERY",
|
|
8
|
+
HIDDEN = "HIDDEN",
|
|
9
|
+
IMAGE = "IMAGE",
|
|
10
|
+
MEDIA_IMAGE = "MEDIA_IMAGE",
|
|
11
|
+
MULTILINE = "MULTILINE",
|
|
12
|
+
MULTISELECT = "MULTISELECT",
|
|
13
|
+
PRICE = "PRICE",
|
|
14
|
+
SELECT = "SELECT",
|
|
15
|
+
TEXT = "TEXT",
|
|
16
|
+
TEXTAREA = "TEXTAREA",
|
|
17
|
+
UNDEFINED = "UNDEFINED",
|
|
18
|
+
VISUAL = "VISUAL",
|
|
19
|
+
WEIGHT = "WEIGHT",
|
|
20
|
+
EMPTY = ""
|
|
21
|
+
}
|
|
22
|
+
export interface FieldsProps {
|
|
23
|
+
className: string;
|
|
24
|
+
fieldType: FieldEnumList;
|
|
25
|
+
id: string;
|
|
26
|
+
code: string;
|
|
27
|
+
name: string;
|
|
28
|
+
defaultValue: string | boolean | number;
|
|
29
|
+
entity_type: string;
|
|
30
|
+
required: boolean;
|
|
31
|
+
is_unique: boolean;
|
|
32
|
+
label: string;
|
|
33
|
+
orderNumber: number;
|
|
34
|
+
options: {
|
|
35
|
+
is_default: boolean;
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}[];
|
|
39
|
+
}
|
|
40
|
+
export interface FormProps {
|
|
41
|
+
fieldsConfig?: FieldsProps[] | [];
|
|
42
|
+
name?: string;
|
|
43
|
+
className?: string;
|
|
44
|
+
children?: any;
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
onSubmit?: (event: SubmitEvent, isValid: boolean) => Promise<void | null | undefined>;
|
|
47
|
+
}
|
|
48
|
+
export interface useFormProps extends Omit<FormProps, 'children' | 'className' | 'name'> {
|
|
49
|
+
}
|
|
50
|
+
export type FormValues = Record<string, string | number | boolean | undefined>;
|
|
51
|
+
export interface FormInputsProps {
|
|
52
|
+
className?: string;
|
|
53
|
+
errors?: Record<string, string>;
|
|
54
|
+
values?: FormValues;
|
|
55
|
+
fields?: FieldsProps[];
|
|
56
|
+
loading?: boolean;
|
|
57
|
+
onChange?: (event: Event) => void;
|
|
58
|
+
onBlur?: (event: Event) => void;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=form.types.d.ts.map
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FieldsProps } from '.';
|
|
2
|
+
|
|
3
|
+
export interface inLineAlertProps {
|
|
4
|
+
text: string;
|
|
5
|
+
type: 'success' | 'warning' | 'error';
|
|
6
|
+
}
|
|
7
|
+
export interface OrderSearchProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface OrderSearchFormProps extends Omit<OrderSearchProps, 'className'> {
|
|
11
|
+
onSubmit?: (event: SubmitEvent, isValid: boolean) => Promise<void | null | undefined>;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
inLineAlert: inLineAlertProps;
|
|
14
|
+
fieldsConfig: FieldsProps[];
|
|
15
|
+
}
|
|
16
|
+
export interface useOrderSearch extends Omit<OrderSearchProps, 'className'> {
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=orderSearch.types.d.ts.map
|