@dropins/storefront-order 0.1.0-alpha4 → 0.1.0-alpha6

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.
Files changed (68) hide show
  1. package/api/getAttributesForm/getAttributesForm.d.ts +4 -0
  2. package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +3 -0
  3. package/api/getAttributesForm/index.d.ts +2 -0
  4. package/api/getGuestOrder/getGuestOrder.d.ts +2 -2
  5. package/api/getOrderDetailsById/getOrderDetailsById.d.ts +1 -2
  6. package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +1 -1
  7. package/api/guestOrderByToken/guestOrderByToken.d.ts +2 -2
  8. package/api/helpers/initializeOrderDetails.d.ts +3 -1
  9. package/api/index.d.ts +1 -0
  10. package/api.js +129 -27
  11. package/chunks/CustomerDetailsContent.js +1 -0
  12. package/chunks/OrderLoaders.js +1 -0
  13. package/chunks/fetch-graphql.js +1 -0
  14. package/chunks/getAttributesForm.js +47 -0
  15. package/chunks/getGuestOrder.js +75 -31
  16. package/components/CustomerDetailsContent/CustomerDetailsContent.d.ts +5 -0
  17. package/components/CustomerDetailsContent/index.d.ts +3 -0
  18. package/components/OrderActions/OrderActions.d.ts +5 -0
  19. package/components/OrderActions/index.d.ts +3 -0
  20. package/components/OrderLoaders/OrderLoaders.d.ts +7 -0
  21. package/components/OrderLoaders/index.d.ts +3 -0
  22. package/components/OrderStatusContent/OrderStatusContent.d.ts +5 -0
  23. package/components/OrderStatusContent/index.d.ts +3 -0
  24. package/components/ShippingStatusCard/ShippingStatusCard.d.ts +5 -0
  25. package/components/ShippingStatusCard/index.d.ts +3 -0
  26. package/components/index.d.ts +5 -0
  27. package/configs/defaultAttributePreset.config.d.ts +2 -0
  28. package/configs/mock.config.d.ts +773 -0
  29. package/containers/CustomerDetails/CustomerDetails.d.ts +5 -0
  30. package/containers/CustomerDetails/index.d.ts +3 -0
  31. package/containers/CustomerDetails.d.ts +3 -0
  32. package/containers/CustomerDetails.js +1 -0
  33. package/containers/OrderSearch.js +1 -1
  34. package/containers/OrderStatus/OrderStatus.d.ts +5 -0
  35. package/containers/OrderStatus/index.d.ts +3 -0
  36. package/containers/OrderStatus.d.ts +3 -0
  37. package/containers/OrderStatus.js +1 -0
  38. package/containers/ShippingStatus/ShippingStatus.d.ts +5 -0
  39. package/containers/ShippingStatus/index.d.ts +3 -0
  40. package/containers/ShippingStatus.d.ts +3 -0
  41. package/containers/ShippingStatus.js +1 -0
  42. package/containers/index.d.ts +3 -0
  43. package/data/models/attributes-form.d.ts +46 -0
  44. package/data/models/index.d.ts +1 -1
  45. package/data/models/order-details.d.ts +109 -32
  46. package/data/transforms/index.d.ts +1 -0
  47. package/data/transforms/transform-attributes-form.d.ts +6 -0
  48. package/data/transforms/transform-guest-order.d.ts +3 -3
  49. package/data/transforms/transform-order-details.d.ts +4 -2
  50. package/hooks/containers/useCustomerDetails.d.ts +12 -0
  51. package/hooks/containers/useOrderSearch.d.ts +1 -1
  52. package/hooks/containers/useOrderStatus.d.ts +8 -0
  53. package/hooks/containers/useShippingStatus.d.ts +7 -0
  54. package/hooks/index.d.ts +3 -0
  55. package/i18n/en_US.json.d.ts +69 -2
  56. package/lib/convertCase.d.ts +4 -0
  57. package/lib/convertToInputDateFormat.d.ts +1 -0
  58. package/package.json +1 -1
  59. package/render.js +2 -2
  60. package/types/api/getAttributesForm.types.d.ts +31 -0
  61. package/types/api/getOrderDetails.types.d.ts +54 -28
  62. package/types/customerDetails.types.d.ts +49 -0
  63. package/types/form.types.d.ts +5 -5
  64. package/types/index.d.ts +5 -1
  65. package/types/orderSearch.types.d.ts +5 -5
  66. package/types/orderStatus.types.d.ts +41 -0
  67. package/types/shippingStatus.types.d.ts +18 -0
  68. package/data/models/guest-order.d.ts +0 -21
@@ -1,4 +1,4 @@
1
- export type QueryType = 'orderData' | 'orderSummary' | 'orderStatus' | 'orderCustomerInformation';
1
+ export type QueryType = 'orderData';
2
2
  export interface UserAddressesProps {
3
3
  city?: string;
4
4
  company?: string;
@@ -16,17 +16,23 @@ export interface UserAddressesProps {
16
16
  telephone?: string;
17
17
  vat_id?: string;
18
18
  }
19
- interface SmallImageProps {
19
+ interface ThumbnailImageProps {
20
20
  url?: string;
21
+ label?: string;
21
22
  }
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;
23
+ export interface ProductProps {
24
+ thumbnail?: ThumbnailImageProps;
25
+ image: ThumbnailImageProps;
26
+ canonical_url: string;
27
+ uid: string;
28
+ name: string;
29
+ __typename: string;
30
+ sku: string;
31
+ price_range: {
32
+ maximum_price: {
33
+ regular_price: MoneyProps;
34
+ };
35
+ };
30
36
  }
31
37
  export interface MoneyProps {
32
38
  value?: number;
@@ -89,7 +95,14 @@ export interface GiftWrappingProps {
89
95
  };
90
96
  };
91
97
  }
92
- interface OrderItemInterface {
98
+ export interface giftCardProps {
99
+ sender_name: string;
100
+ sender_email: string;
101
+ recipient_email: string;
102
+ recipient_name: string;
103
+ }
104
+ export interface OrderItemProps {
105
+ __typename: string;
93
106
  discounts: DiscountProps[];
94
107
  eligible_for_return: boolean;
95
108
  entered_options: {
@@ -116,8 +129,9 @@ interface OrderItemInterface {
116
129
  value: string;
117
130
  }[];
118
131
  status: string;
132
+ gift_card?: giftCardProps;
119
133
  }
120
- export interface paymentMethodsProps {
134
+ export interface PaymentMethodsProps {
121
135
  name: string;
122
136
  type: string;
123
137
  additional_data: {
@@ -125,7 +139,31 @@ export interface paymentMethodsProps {
125
139
  value: string;
126
140
  }[];
127
141
  }
142
+ export interface ShipmentsProps {
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
+ items: {
155
+ id: string;
156
+ product_sku: string;
157
+ product_name: string;
158
+ };
159
+ }
160
+ export declare enum AvailableActionsProps {
161
+ CANCEL = "CANCEL",
162
+ RETURN = "RETURN",
163
+ REORDER = "REORDER"
164
+ }
128
165
  export interface OrderProps {
166
+ available_actions: AvailableActionsProps[];
129
167
  shipping_method: string;
130
168
  status: string;
131
169
  token: string;
@@ -139,29 +177,17 @@ export interface OrderProps {
139
177
  applied_coupons: {
140
178
  code: string;
141
179
  }[];
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
180
  returns: {
156
181
  pageSize: number;
157
182
  currentPage: number;
158
183
  };
159
- items_eligible_for_return: OrderItemInterface[];
184
+ shipments: ShipmentsProps[];
185
+ items_eligible_for_return: OrderItemProps[];
186
+ items: OrderItemProps[];
160
187
  gift_wrapping: GiftWrappingProps;
161
188
  gift_message: GiftMessageProps;
162
- payment_methods: paymentMethodsProps[];
189
+ payment_methods: PaymentMethodsProps[];
163
190
  invoices: InvoiceProps[];
164
- items: OrderItemProps[];
165
191
  shipping_address: UserAddressesProps;
166
192
  billing_address: UserAddressesProps;
167
193
  total?: TotalProps;
@@ -0,0 +1,49 @@
1
+ import { OrderDataModel } from '../data/models';
2
+
3
+ export interface KeysSortOrderProps {
4
+ name: string;
5
+ orderNumber?: number;
6
+ label?: string | null;
7
+ }
8
+ export interface NormalizeAddressProps extends KeysSortOrderProps {
9
+ value: any;
10
+ }
11
+ export interface CustomerDetailsProps {
12
+ className?: string;
13
+ paymentIconsMap?: Record<string, string>;
14
+ orderData?: OrderDataModel;
15
+ withHeader?: boolean;
16
+ title?: string;
17
+ }
18
+ export interface UseCustomerDetails {
19
+ orderData?: OrderDataModel;
20
+ }
21
+ export interface CustomerDetailsContentProps extends Omit<CustomerDetailsProps, 'orderData' | 'className'> {
22
+ loading: boolean;
23
+ order?: OrderDataModel;
24
+ normalizeAddress?: {
25
+ billingAddress: NormalizeAddressProps[];
26
+ shippingAddress: NormalizeAddressProps[];
27
+ };
28
+ }
29
+ export interface CustomerAddressesModel {
30
+ firstname?: string;
31
+ lastname?: string;
32
+ city?: string;
33
+ company?: string;
34
+ countryCode?: string;
35
+ region?: {
36
+ region: string;
37
+ regionCode: string;
38
+ regionId: string | number;
39
+ };
40
+ telephone?: string;
41
+ id?: string;
42
+ vatId?: string;
43
+ postcode?: string;
44
+ street?: string;
45
+ street_2?: string;
46
+ defaultShipping?: boolean;
47
+ defaultBilling?: boolean;
48
+ }
49
+ //# sourceMappingURL=customerDetails.types.d.ts.map
@@ -26,15 +26,15 @@ export interface FieldsProps {
26
26
  code: string;
27
27
  name: string;
28
28
  defaultValue: string | boolean | number;
29
- entity_type: string;
29
+ entityType: string;
30
30
  required: boolean;
31
31
  is_unique: boolean;
32
32
  label: string;
33
33
  orderNumber: number;
34
- options: {
35
- is_default: boolean;
36
- label: string;
37
- value: string;
34
+ options?: {
35
+ is_default?: boolean;
36
+ label?: string;
37
+ value?: string;
38
38
  }[];
39
39
  }
40
40
  export interface FormProps {
package/types/index.d.ts CHANGED
@@ -1,6 +1,10 @@
1
+ export * from './api/guestOrderByToken.types';
1
2
  export * from './api/getOrderDetails.types';
2
3
  export * from './api/getGuestOrder.types';
4
+ export * from './api/getAttributesForm.types';
3
5
  export * from './orderSearch.types';
4
6
  export * from './form.types';
5
- export * from './api/guestOrderByToken.types';
7
+ export * from './orderStatus.types';
8
+ export * from './shippingStatus.types';
9
+ export * from './customerDetails.types';
6
10
  //# sourceMappingURL=index.d.ts.map
@@ -14,16 +14,16 @@ export interface inLineAlertProps {
14
14
  }
15
15
  export interface OrderSearchProps {
16
16
  className?: string;
17
- onError?: (errorInformation: errorInformationProps) => void;
17
+ onError?: (errorInformation: errorInformationProps) => boolean | Promise<boolean> | undefined;
18
18
  }
19
19
  export interface useOrderSearchProps {
20
- onError?: (errorInformation: errorInformationProps) => void;
20
+ onError?: (errorInformation: errorInformationProps) => boolean | Promise<boolean> | undefined;
21
21
  }
22
- export interface OrderSearchFormProps extends Omit<OrderSearchProps, 'className' | 'onError'> {
22
+ export interface OrderSearchFormProps {
23
23
  onSubmit?: (event: SubmitEvent, isValid: boolean) => Promise<void | null | undefined>;
24
- loading: boolean;
24
+ loading?: boolean;
25
25
  inLineAlert: inLineAlertProps;
26
- fieldsConfig: FieldsProps[];
26
+ fieldsConfig?: FieldsProps[];
27
27
  }
28
28
  export interface useOrderSearch extends Omit<OrderSearchProps, 'className'> {
29
29
  }
@@ -0,0 +1,41 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { OrderDataModel } from '../data/models';
3
+ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
4
+
5
+ export declare enum StatusEnumProps {
6
+ PENDING = "pending",
7
+ SHIPPING = "shipping",
8
+ COMPLETE = "complete",
9
+ PROCESSING = "processing",
10
+ HOLD = "on hold",
11
+ CANCELED = "Canceled",
12
+ SUSPECTED_FRAUD = "suspected fraud",
13
+ PAYMENT_REVIEW = "payment review"
14
+ }
15
+ type DefaultSlotContext = {
16
+ orderData?: OrderDataModel;
17
+ };
18
+ export interface OrderStatusProps extends HTMLAttributes<HTMLDivElement> {
19
+ orderData?: OrderDataModel;
20
+ statusTitle?: string;
21
+ status?: StatusEnumProps;
22
+ slots?: {
23
+ OrderActions: SlotProps<DefaultSlotContext>;
24
+ };
25
+ }
26
+ export interface OrderStatusContentProps extends Omit<OrderStatusProps, 'statusTitle' | 'orderData' | 'status'> {
27
+ title?: string;
28
+ status?: StatusEnumProps;
29
+ orderData?: OrderDataModel;
30
+ }
31
+ export interface OrderActionsProps extends HTMLAttributes<HTMLDivElement> {
32
+ orderData?: OrderDataModel;
33
+ slots?: {
34
+ OrderActions: SlotProps<DefaultSlotContext>;
35
+ };
36
+ }
37
+ export interface UseOrderStatusProps {
38
+ orderData?: OrderDataModel;
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=orderStatus.types.d.ts.map
@@ -0,0 +1,18 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
+ import { OrderDataModel } from '../data/models';
4
+
5
+ export interface ShippingStatusProps extends HTMLAttributes<HTMLDivElement> {
6
+ orderData?: OrderDataModel;
7
+ collapseThreshold?: number;
8
+ slots?: {
9
+ DeliveryTimeLine?: SlotProps;
10
+ DeliveryTrackActions?: SlotProps;
11
+ };
12
+ }
13
+ export interface UseShippingStatusProps {
14
+ orderData?: OrderDataModel;
15
+ }
16
+ export interface ShippingStatusCardProps extends ShippingStatusProps {
17
+ }
18
+ //# sourceMappingURL=shippingStatus.types.d.ts.map
@@ -1,21 +0,0 @@
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