@dropins/storefront-order 0.1.0-alpha11 → 0.1.0-alpha12
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/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts +4 -0
- package/api/getCustomerOrdersReturn/graphql/getCustomerOrdersReturn.graphql.d.ts +2 -0
- package/api/getCustomerOrdersReturn/index.d.ts +2 -0
- package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +5 -5
- package/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +1 -1
- package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
- package/api/index.d.ts +1 -0
- package/api.js +85 -41
- package/chunks/OrderLoaders.js +1 -1
- package/chunks/customerAddressFragment.graphql.js +55 -0
- package/chunks/getCustomer.js +40 -17
- package/chunks/getCustomerOrdersReturn.js +52 -0
- package/chunks/getStoreConfig.js +6 -2
- package/chunks/setTaxStatus.js +1 -0
- package/chunks/transform-order-details.js +45 -116
- package/components/EmptyList/EmptyList.d.ts +5 -0
- package/components/EmptyList/index.d.ts +3 -0
- package/components/OrderCostSummaryContent/Blocks.d.ts +38 -0
- package/components/OrderCostSummaryContent/OrderCostSummaryContent.d.ts +5 -0
- package/components/OrderCostSummaryContent/index.d.ts +3 -0
- package/components/OrderLoaders/OrderLoaders.d.ts +1 -0
- package/components/ReturnsListContent/ReturnsListContent.d.ts +5 -0
- package/components/ReturnsListContent/index.d.ts +3 -0
- package/components/index.d.ts +3 -0
- package/configs/mock.config.d.ts +318 -0
- package/containers/CustomerDetails.js +1 -1
- package/containers/OrderCancel.js +26 -18
- package/containers/OrderCostSummary/OrderCostSummary.d.ts +5 -0
- package/containers/OrderCostSummary/index.d.ts +3 -0
- package/containers/OrderCostSummary.d.ts +3 -0
- package/containers/OrderCostSummary.js +1 -0
- package/containers/OrderProductList.js +1 -1
- package/containers/OrderSearch.js +1 -1
- package/containers/ReturnsList/ReturnsList.d.ts +5 -0
- package/containers/ReturnsList/index.d.ts +3 -0
- package/containers/ReturnsList.d.ts +3 -0
- package/containers/ReturnsList.js +1 -0
- package/containers/index.d.ts +2 -0
- package/data/models/customer-orders-return.d.ts +36 -0
- package/data/models/index.d.ts +2 -0
- package/data/models/order-details.d.ts +27 -16
- package/data/models/store-config.d.ts +6 -0
- package/data/transforms/index.d.ts +2 -0
- package/data/transforms/transform-customer-orders-return.d.ts +5 -0
- package/data/transforms/transform-order-details.d.ts +2 -1
- package/hooks/containers/useOrderCostSummary.d.ts +9 -0
- package/hooks/containers/useReturnsList.d.ts +14 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/useIsMobile.d.ts +2 -0
- package/i18n/en_US.json.d.ts +56 -8
- package/package.json +1 -1
- package/render.js +2 -2
- package/types/api/getCustomerOrdersReturn.types.d.ts +46 -0
- package/types/api/getOrderDetails.types.d.ts +1 -0
- package/types/emptyList.types.d.ts +7 -0
- package/types/index.d.ts +4 -0
- package/types/orderCostSummary.types.d.ts +28 -0
- package/types/returnsList.types.d.ts +42 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { OrderDataModel } from '../../data/models';
|
|
2
|
+
import { TaxTypes } from '../../types';
|
|
3
|
+
|
|
4
|
+
type translationsTypes = Record<string, string>;
|
|
5
|
+
export declare const Subtotal: ({ translations, order, subTotalValue, shoppingOrdersDisplaySubtotal, }: {
|
|
6
|
+
translations: translationsTypes;
|
|
7
|
+
order?: OrderDataModel | undefined;
|
|
8
|
+
subTotalValue: number;
|
|
9
|
+
shoppingOrdersDisplaySubtotal: TaxTypes;
|
|
10
|
+
}) => import("preact").JSX.Element;
|
|
11
|
+
export declare const Shipping: ({ translations, shoppingOrdersDisplayShipping, order, totalShipping, }: {
|
|
12
|
+
totalShipping: number;
|
|
13
|
+
shoppingOrdersDisplayShipping: TaxTypes;
|
|
14
|
+
order: OrderDataModel;
|
|
15
|
+
translations: translationsTypes;
|
|
16
|
+
}) => import("preact").JSX.Element;
|
|
17
|
+
export declare const Discounts: ({ translations, order, totalGiftcardValue, totalGiftcardCurrency, }: {
|
|
18
|
+
totalGiftcardValue: number;
|
|
19
|
+
totalGiftcardCurrency: string;
|
|
20
|
+
order: OrderDataModel;
|
|
21
|
+
translations: translationsTypes;
|
|
22
|
+
}) => import("preact").JSX.Element | null;
|
|
23
|
+
export declare const Coupons: ({ order }: {
|
|
24
|
+
order: OrderDataModel;
|
|
25
|
+
}) => import("preact").JSX.Element;
|
|
26
|
+
export declare const AccordionTax: ({ translations, renderTaxAccordion, totalAccordionTaxValue, order, }: {
|
|
27
|
+
translations: translationsTypes;
|
|
28
|
+
order: OrderDataModel;
|
|
29
|
+
renderTaxAccordion: boolean;
|
|
30
|
+
totalAccordionTaxValue: number;
|
|
31
|
+
}) => import("preact").JSX.Element;
|
|
32
|
+
export declare const Total: ({ translations, shoppingOrdersDisplaySubtotal, order, }: {
|
|
33
|
+
translations: translationsTypes;
|
|
34
|
+
order?: OrderDataModel | undefined;
|
|
35
|
+
shoppingOrdersDisplaySubtotal: TaxTypes;
|
|
36
|
+
}) => import("preact").JSX.Element;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=Blocks.d.ts.map
|
|
@@ -5,4 +5,5 @@ export declare const CardLoader: ({ testId, withCard, }: {
|
|
|
5
5
|
}) => import("preact").JSX.Element;
|
|
6
6
|
export declare const DetailsSkeleton: (props: any) => import("preact").JSX.Element;
|
|
7
7
|
export declare const OrderProductListSkeleton: () => import("preact").JSX.Element;
|
|
8
|
+
export declare const OrderSummarySkeleton: () => import("preact").JSX.Element;
|
|
8
9
|
//# sourceMappingURL=OrderLoaders.d.ts.map
|
package/components/index.d.ts
CHANGED
|
@@ -5,6 +5,9 @@ export * from './ShippingStatusCard';
|
|
|
5
5
|
export * from './OrderLoaders';
|
|
6
6
|
export * from './OrderActions';
|
|
7
7
|
export * from './CustomerDetailsContent';
|
|
8
|
+
export * from './EmptyList';
|
|
9
|
+
export * from './ReturnsListContent';
|
|
8
10
|
export * from './OrderProductListContent';
|
|
11
|
+
export * from './OrderCostSummaryContent';
|
|
9
12
|
export * from './OrderCancelReasonsForm';
|
|
10
13
|
//# sourceMappingURL=index.d.ts.map
|
package/configs/mock.config.d.ts
CHANGED
|
@@ -921,6 +921,186 @@ export declare const storyBookNormalizeAddress: {
|
|
|
921
921
|
label: null;
|
|
922
922
|
}[])[];
|
|
923
923
|
};
|
|
924
|
+
export declare const orderCostSummaryMockup: {
|
|
925
|
+
number: string;
|
|
926
|
+
email: string;
|
|
927
|
+
token: string;
|
|
928
|
+
status: string;
|
|
929
|
+
isVirtual: boolean;
|
|
930
|
+
totalQuantity: number;
|
|
931
|
+
shippingMethod: string;
|
|
932
|
+
carrier: string;
|
|
933
|
+
discounts: {
|
|
934
|
+
amount: {
|
|
935
|
+
value: number;
|
|
936
|
+
currency: string;
|
|
937
|
+
};
|
|
938
|
+
label: string;
|
|
939
|
+
}[];
|
|
940
|
+
coupons: {
|
|
941
|
+
code: string;
|
|
942
|
+
}[];
|
|
943
|
+
payments: {
|
|
944
|
+
code: string;
|
|
945
|
+
name: string;
|
|
946
|
+
}[];
|
|
947
|
+
shipping: {
|
|
948
|
+
code: string;
|
|
949
|
+
amount: number;
|
|
950
|
+
currency: string;
|
|
951
|
+
};
|
|
952
|
+
shipments: {
|
|
953
|
+
id: string;
|
|
954
|
+
number: string;
|
|
955
|
+
tracking: {
|
|
956
|
+
carrier: string;
|
|
957
|
+
number: string;
|
|
958
|
+
title: string;
|
|
959
|
+
}[];
|
|
960
|
+
comments: {
|
|
961
|
+
message: string;
|
|
962
|
+
timestamp: string;
|
|
963
|
+
}[];
|
|
964
|
+
items: {
|
|
965
|
+
id: string;
|
|
966
|
+
productSku: string;
|
|
967
|
+
productName: string;
|
|
968
|
+
orderItem: {
|
|
969
|
+
id: string;
|
|
970
|
+
type: string;
|
|
971
|
+
discounted: boolean;
|
|
972
|
+
productName: string;
|
|
973
|
+
totalQuantity: number;
|
|
974
|
+
price: {
|
|
975
|
+
value: number;
|
|
976
|
+
currency: string;
|
|
977
|
+
};
|
|
978
|
+
totalInclTax: {};
|
|
979
|
+
priceInclTax: {};
|
|
980
|
+
regularPrice: {
|
|
981
|
+
value: number;
|
|
982
|
+
currency: string;
|
|
983
|
+
};
|
|
984
|
+
total: {
|
|
985
|
+
value: number;
|
|
986
|
+
currency: string;
|
|
987
|
+
};
|
|
988
|
+
configurableOptions: {};
|
|
989
|
+
product: {
|
|
990
|
+
id: string;
|
|
991
|
+
name: string;
|
|
992
|
+
productType: string;
|
|
993
|
+
sku: string;
|
|
994
|
+
thumbnail: {
|
|
995
|
+
url: string;
|
|
996
|
+
label: string;
|
|
997
|
+
};
|
|
998
|
+
};
|
|
999
|
+
thumbnail: {
|
|
1000
|
+
url: string;
|
|
1001
|
+
label: string;
|
|
1002
|
+
};
|
|
1003
|
+
quantityCanceled: number;
|
|
1004
|
+
quantityInvoiced: number;
|
|
1005
|
+
quantityOrdered: number;
|
|
1006
|
+
quantityRefunded: number;
|
|
1007
|
+
quantityReturned: number;
|
|
1008
|
+
quantityShipped: number;
|
|
1009
|
+
};
|
|
1010
|
+
}[];
|
|
1011
|
+
}[];
|
|
1012
|
+
items: {
|
|
1013
|
+
id: string;
|
|
1014
|
+
type: string;
|
|
1015
|
+
discounted: boolean;
|
|
1016
|
+
productName: string;
|
|
1017
|
+
totalQuantity: number;
|
|
1018
|
+
price: {
|
|
1019
|
+
value: number;
|
|
1020
|
+
currency: string;
|
|
1021
|
+
};
|
|
1022
|
+
totalInclTax: {};
|
|
1023
|
+
priceInclTax: {};
|
|
1024
|
+
regularPrice: {
|
|
1025
|
+
value: number;
|
|
1026
|
+
currency: string;
|
|
1027
|
+
};
|
|
1028
|
+
total: {
|
|
1029
|
+
value: number;
|
|
1030
|
+
currency: string;
|
|
1031
|
+
};
|
|
1032
|
+
configurableOptions: {};
|
|
1033
|
+
product: {
|
|
1034
|
+
id: string;
|
|
1035
|
+
name: string;
|
|
1036
|
+
productType: string;
|
|
1037
|
+
sku: string;
|
|
1038
|
+
thumbnail: {
|
|
1039
|
+
url: string;
|
|
1040
|
+
label: string;
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
thumbnail: {
|
|
1044
|
+
url: string;
|
|
1045
|
+
label: string;
|
|
1046
|
+
};
|
|
1047
|
+
quantityCanceled: number;
|
|
1048
|
+
quantityInvoiced: number;
|
|
1049
|
+
quantityOrdered: number;
|
|
1050
|
+
quantityRefunded: number;
|
|
1051
|
+
quantityReturned: number;
|
|
1052
|
+
quantityShipped: number;
|
|
1053
|
+
}[];
|
|
1054
|
+
totalGiftcard: {
|
|
1055
|
+
value: number;
|
|
1056
|
+
currency: string;
|
|
1057
|
+
};
|
|
1058
|
+
grandTotal: {
|
|
1059
|
+
value: number;
|
|
1060
|
+
currency: string;
|
|
1061
|
+
};
|
|
1062
|
+
totalShipping: {
|
|
1063
|
+
value: number;
|
|
1064
|
+
currency: string;
|
|
1065
|
+
};
|
|
1066
|
+
subtotal: {
|
|
1067
|
+
value: number;
|
|
1068
|
+
currency: string;
|
|
1069
|
+
};
|
|
1070
|
+
totalTax: {
|
|
1071
|
+
value: number;
|
|
1072
|
+
currency: string;
|
|
1073
|
+
};
|
|
1074
|
+
shippingAddress: {
|
|
1075
|
+
street: string[];
|
|
1076
|
+
city: string;
|
|
1077
|
+
country: string;
|
|
1078
|
+
company: string;
|
|
1079
|
+
firstName: string;
|
|
1080
|
+
middleName: string;
|
|
1081
|
+
lastName: string;
|
|
1082
|
+
postCode: string;
|
|
1083
|
+
region: string;
|
|
1084
|
+
regionId: string;
|
|
1085
|
+
telephone: string;
|
|
1086
|
+
customAttributes: never[];
|
|
1087
|
+
};
|
|
1088
|
+
billingAddress: {
|
|
1089
|
+
street: string[];
|
|
1090
|
+
city: string;
|
|
1091
|
+
company: string;
|
|
1092
|
+
country: string;
|
|
1093
|
+
firstName: string;
|
|
1094
|
+
middleName: string;
|
|
1095
|
+
lastName: string;
|
|
1096
|
+
postCode: string;
|
|
1097
|
+
region: string;
|
|
1098
|
+
regionId: string;
|
|
1099
|
+
telephone: string;
|
|
1100
|
+
customAttributes: never[];
|
|
1101
|
+
};
|
|
1102
|
+
availableActions: never[];
|
|
1103
|
+
};
|
|
924
1104
|
export declare const orderMockOrderProductItemsList: {
|
|
925
1105
|
items: ({
|
|
926
1106
|
type: string;
|
|
@@ -1389,4 +1569,142 @@ export declare const orderMockOrderProductItemsList: {
|
|
|
1389
1569
|
})[];
|
|
1390
1570
|
totalQuantity: number;
|
|
1391
1571
|
};
|
|
1572
|
+
export declare const returnOrderListMockResponse: {
|
|
1573
|
+
customer: {
|
|
1574
|
+
returns: {
|
|
1575
|
+
page_info: {
|
|
1576
|
+
page_size: number;
|
|
1577
|
+
total_pages: number;
|
|
1578
|
+
current_page: number;
|
|
1579
|
+
};
|
|
1580
|
+
items: {
|
|
1581
|
+
number: string;
|
|
1582
|
+
shipping: {
|
|
1583
|
+
tracking: {
|
|
1584
|
+
status: null;
|
|
1585
|
+
carrier: {
|
|
1586
|
+
uid: string;
|
|
1587
|
+
label: string;
|
|
1588
|
+
};
|
|
1589
|
+
tracking_number: string;
|
|
1590
|
+
}[];
|
|
1591
|
+
};
|
|
1592
|
+
order: {
|
|
1593
|
+
number: string;
|
|
1594
|
+
token: string;
|
|
1595
|
+
};
|
|
1596
|
+
items: {
|
|
1597
|
+
uid: string;
|
|
1598
|
+
quantity: number;
|
|
1599
|
+
status: string;
|
|
1600
|
+
request_quantity: number;
|
|
1601
|
+
order_item: {
|
|
1602
|
+
__typename: string;
|
|
1603
|
+
status: string;
|
|
1604
|
+
product_name: string;
|
|
1605
|
+
id: string;
|
|
1606
|
+
quantity_ordered: number;
|
|
1607
|
+
quantity_shipped: number;
|
|
1608
|
+
quantity_canceled: number;
|
|
1609
|
+
quantity_invoiced: number;
|
|
1610
|
+
quantity_refunded: number;
|
|
1611
|
+
quantity_returned: number;
|
|
1612
|
+
product_sale_price: {
|
|
1613
|
+
value: number;
|
|
1614
|
+
currency: string;
|
|
1615
|
+
};
|
|
1616
|
+
selected_options: never[];
|
|
1617
|
+
product: {
|
|
1618
|
+
__typename: string;
|
|
1619
|
+
canonical_url: null;
|
|
1620
|
+
uid: string;
|
|
1621
|
+
name: string;
|
|
1622
|
+
sku: string;
|
|
1623
|
+
thumbnail: {
|
|
1624
|
+
label: string;
|
|
1625
|
+
url: string;
|
|
1626
|
+
};
|
|
1627
|
+
price_range: {
|
|
1628
|
+
maximum_price: {
|
|
1629
|
+
regular_price: {
|
|
1630
|
+
currency: string;
|
|
1631
|
+
value: number;
|
|
1632
|
+
};
|
|
1633
|
+
};
|
|
1634
|
+
};
|
|
1635
|
+
};
|
|
1636
|
+
};
|
|
1637
|
+
}[];
|
|
1638
|
+
}[];
|
|
1639
|
+
};
|
|
1640
|
+
};
|
|
1641
|
+
};
|
|
1642
|
+
export declare const returnOrderListMock: {
|
|
1643
|
+
token: string;
|
|
1644
|
+
orderNumber: string;
|
|
1645
|
+
items: {
|
|
1646
|
+
uid: string;
|
|
1647
|
+
quantity: number;
|
|
1648
|
+
status: string;
|
|
1649
|
+
requestQuantity: number;
|
|
1650
|
+
orderItem: {
|
|
1651
|
+
type: string;
|
|
1652
|
+
productName: string;
|
|
1653
|
+
quantityCanceled: number;
|
|
1654
|
+
quantityInvoiced: number;
|
|
1655
|
+
quantityOrdered: number;
|
|
1656
|
+
quantityRefunded: number;
|
|
1657
|
+
quantityReturned: number;
|
|
1658
|
+
quantityShipped: number;
|
|
1659
|
+
id: string;
|
|
1660
|
+
discounted: boolean;
|
|
1661
|
+
total: {
|
|
1662
|
+
value: number;
|
|
1663
|
+
currency: string;
|
|
1664
|
+
};
|
|
1665
|
+
totalInclTax: {
|
|
1666
|
+
value: number;
|
|
1667
|
+
currency: string;
|
|
1668
|
+
};
|
|
1669
|
+
price: {
|
|
1670
|
+
value: number;
|
|
1671
|
+
currency: string;
|
|
1672
|
+
};
|
|
1673
|
+
priceInclTax: {
|
|
1674
|
+
value: number;
|
|
1675
|
+
currency: string;
|
|
1676
|
+
};
|
|
1677
|
+
totalQuantity: number;
|
|
1678
|
+
regularPrice: {
|
|
1679
|
+
value: number;
|
|
1680
|
+
currency: string;
|
|
1681
|
+
};
|
|
1682
|
+
product: {
|
|
1683
|
+
canonicalUrl: string;
|
|
1684
|
+
id: string;
|
|
1685
|
+
name: string;
|
|
1686
|
+
sku: string;
|
|
1687
|
+
image: string;
|
|
1688
|
+
productType: string;
|
|
1689
|
+
thumbnail: {
|
|
1690
|
+
label: string;
|
|
1691
|
+
url: string;
|
|
1692
|
+
};
|
|
1693
|
+
};
|
|
1694
|
+
thumbnail: {
|
|
1695
|
+
label: string;
|
|
1696
|
+
url: string;
|
|
1697
|
+
};
|
|
1698
|
+
configurableOptions: {};
|
|
1699
|
+
};
|
|
1700
|
+
}[];
|
|
1701
|
+
tracking: {
|
|
1702
|
+
status: null;
|
|
1703
|
+
carrier: {
|
|
1704
|
+
uid: string;
|
|
1705
|
+
label: string;
|
|
1706
|
+
};
|
|
1707
|
+
trackingNumber: string;
|
|
1708
|
+
}[];
|
|
1709
|
+
}[];
|
|
1392
1710
|
//# sourceMappingURL=mock.config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,jsxs as
|
|
1
|
+
import{jsx as t,jsxs as m,Fragment as L}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{useMemo as x,useCallback as H,useState as k,useEffect as O}from"@dropins/tools/preact-hooks.js";import{events as Z}from"@dropins/tools/event-bus.js";import{c as R}from"../chunks/convertCase.js";import{g as z}from"../chunks/getAttributesForm.js";import{Card as B,Header as F,Price as $,Icon as q}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import*as h from"@dropins/tools/preact-compat.js";import{D as K}from"../chunks/OrderLoaders.js";import"@dropins/tools/preact.js";import{useText as G}from"@dropins/tools/i18n.js";import"../chunks/network-error.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const I=o=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.93 14.8V18.75H5.97C4.75 18.75 3.75 17.97 3.75 17V6.5M3.75 6.5C3.75 5.53 4.74 4.75 5.97 4.75H15.94V8.25H5.97C4.75 8.25 3.75 7.47 3.75 6.5Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.35 11.64H14.04V14.81H19.35V11.64Z",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.9304 11.64V8.25H15.1504",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round"})),J=o=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o},h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M2.00718 5H22.1507C22.7047 5 23.1579 5.45323 23.1579 6.00718V7.51794C23.1579 7.51794 1.01007 7.58844 1 7.55823V6.00718C1 5.45323 1.45323 5 2.00718 5Z",stroke:"currentColor",strokeWidth:1}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M23.1579 9.78409V18.3451C23.1579 18.899 22.7047 19.3523 22.1507 19.3523H2.00718C1.45323 19.3523 1 18.899 1 18.3451V9.78409H23.1579Z",stroke:"currentColor",strokeWidth:1}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M3.01465 15.9682H8.40305",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round"}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.6192 17.5897C18.4535 17.5897 19.1299 16.9133 19.1299 16.0789C19.1299 15.2446 18.4535 14.5682 17.6192 14.5682C16.7848 14.5682 16.1084 15.2446 16.1084 16.0789C16.1084 16.9133 16.7848 17.5897 17.6192 17.5897Z",stroke:"currentColor",strokeWidth:1}),h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M19.8848 17.5897C20.7192 17.5897 21.3956 16.9133 21.3956 16.0789C21.3956 15.2446 20.7192 14.5682 19.8848 14.5682C19.0504 14.5682 18.374 15.2446 18.374 16.0789C18.374 16.9133 19.0504 17.5897 19.8848 17.5897Z",stroke:"currentColor",strokeWidth:1})),Q=({loading:o,order:e,withHeader:a=!0,title:c,paymentIconsMap:s={},normalizeAddress:r})=>{var N,M,E,T,D;const i=G({emailTitle:"Order.CustomerDetails.email.title",shippingAddressTitle:"Order.CustomerDetails.shippingAddress.title",shippingMethodsTitle:"Order.CustomerDetails.shippingMethods.title",billingAddressTitle:"Order.CustomerDetails.billingAddress.title",billingMethodsTitle:"Order.CustomerDetails.billingMethods.title",headerText:"Order.CustomerDetails.headerText",freeShipping:"Order.CustomerDetails.freeShipping"}),p=x(()=>({checkmo:I,card:J,...s}),[s]),_=H(S=>{var w;return(w=r[S])==null?void 0:w.map((f,W)=>t("div",{className:"order-customer-details-content__container-description--row",children:f==null?void 0:f.map((l,P)=>m(L,{children:[t("p",{children:l.label?`${l.label}: ${Array.isArray(l.value)?l.value.join(" "):l==null?void 0:l.value}`:Array.isArray(l.value)?l.value.join(" "):l==null?void 0:l.value},P)," "]}))},W))},[r]);if(!e||o)return t(K,{});const d=(e==null?void 0:e.email)??"",u=(N=e==null?void 0:e.shipping)==null?void 0:N.code,n=(M=e==null?void 0:e.shipping)==null?void 0:M.amount,v=(E=e==null?void 0:e.shipping)==null?void 0:E.currency,g=e==null?void 0:e.payments,C=g&&g.length>0,A=C?(T=g[0])==null?void 0:T.name:"",y=C?(D=g[0])==null?void 0:D.code:"",j=C&&A!=="";return m(B,{"data-testid":"order-details",variant:"secondary",className:b(["order-customer-details-content"]),children:[a?t(F,{title:c??i.headerText}):null,m("div",{className:"order-customer-details-content__container",children:[m("div",{className:"order-customer-details-content__container-email",children:[t("div",{className:"order-customer-details-content__container-title",children:i.emailTitle}),t("p",{children:d})]}),m("div",{className:"order-customer-details-content__container-shipping_address",children:[t("div",{className:"order-customer-details-content__container-title",children:i.shippingAddressTitle}),t("div",{className:"order-customer-details-content__container-description",children:_("shippingAddress")})]}),m("div",{className:"order-customer-details-content__container-billing_address",children:[t("div",{className:"order-customer-details-content__container-title",children:i.billingAddressTitle}),t("div",{className:"order-customer-details-content__container-description",children:_("billingAddress")})]}),m("div",{className:"order-customer-details-content__container-shipping_methods",children:[t("div",{className:"order-customer-details-content__container-title",children:i.shippingMethodsTitle}),u?t(L,{children:n?m("p",{"data-testid":"shipping_methods_price",children:[t($,{amount:n,currency:v})," ",u]}):t("p",{"data-testid":"shipping_methods_placeholder",children:i.freeShipping})}):null]}),m("div",{className:"order-customer-details-content__container-billing_methods",children:[t("div",{className:"order-customer-details-content__container-title",children:i.billingMethodsTitle}),j&&m("p",{"data-testid":"billing_methods_description",className:b([["order-customer-details-content__container-billing_methods--icon",!!p[y]]]),children:[t(q,{source:p[y]}),A]})]})]})]})},U=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_2","default_shipping","default_billing"],V=o=>{o.sort((s,r)=>s.orderNumber-r.orderNumber);const e=[];let a=[];const c=s=>s.value!==void 0&&s.value!==null&&s.value!=="";for(let s=0;s<o.length;s++){const r=o[s];if(c(r))if(Array.isArray(r.value)){const i=r.value.map(p=>({...r,value:p}));e.push(i)}else e.length<4?(a.push(r),a.length===2&&(e.push(a),a=[])):e.push([r])}return a.length>0&&e.length<4&&e.push(a),e},X=({orderData:o})=>{const[e,a]=k(!0),[c,s]=k(o),[r,i]=k([]);O(()=>{const d=Z.on("order/data",u=>{s(u)},{eager:!0});return()=>{d==null||d.off()}},[]),O(()=>{z("shortRequest").then(d=>{if(d){const u=d.map(({name:n,orderNumber:v,label:g})=>({name:R(n),orderNumber:v,label:U.includes(n)?null:g}));i(u)}}).finally(()=>{a(!1)})},[]);const p=H(d=>{if(!r.length||!c||!c[d])return[];const u=Object.fromEntries(Object.entries(c[d]).map(([n,v])=>[n.toLowerCase(),v]));return r.filter(({name:n})=>u[n.toLowerCase()]).map(n=>({name:n.name,orderNumber:n.orderNumber,value:u[n.name.toLowerCase()],label:n.label}))},[r,c]),_=x(()=>({billingAddress:V(p("billingAddress")),shippingAddress:V(p("shippingAddress"))}),[p]);return{order:c,normalizeAddress:_,loading:e}},ue=({paymentIconsMap:o,orderData:e,title:a,className:c})=>{const{order:s,normalizeAddress:r,loading:i}=X({orderData:e});return t("div",{className:b(["order-customer-details",c]),children:t(Q,{loading:i,order:s,title:a,paymentIconsMap:o,normalizeAddress:r})})};export{ue as CustomerDetails,ue as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as n,Fragment as f,jsxs as E}from"@dropins/tools/preact-jsx-runtime.js";import{P as g,a as S,G as h,O as I,B as A,t as T}from"../chunks/transform-order-details.js";import{O as b,A as N}from"../chunks/customerAddressFragment.graphql.js";import{f as F,h as L}from"../chunks/fetch-graphql.js";import{useState as c,useEffect as v}from"@dropins/tools/preact-hooks.js";import{g as G}from"../chunks/getStoreConfig.js";import{InLineAlert as M,Picker as $,Button as x}from"@dropins/tools/components.js";import{F as y}from"../chunks/OrderCancelReasonsForm.js";import"@dropins/tools/lib.js";import"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{events as m}from"@dropins/tools/event-bus.js";import{useText as w,Text as u}from"@dropins/tools/i18n.js";import"../chunks/convertCase.js";import"@dropins/tools/fetch-graphql.js";const P=({pickerProps:a,submitButtonProps:r,cancelReasons:e,cancelOrder:s,orderId:t})=>{const o=w({ErrorHeading:"Order.OrderCancellationReasonsForm.errorHeading",ErrorDescription:"Order.OrderCancellationReasonsForm.errorDescription",orderCancellationLabel:"Order.OrderCancellationReasonsForm.label"}),[i,p]=c(0),[_,O]=c(!1),[R,C]=c(!1);m.on("authenticated",d=>{d&&C(!0)},{eager:!0});const D=d=>{d.preventDefault();const l=Number(d.target.value);p(l)};return n(f,{children:E(y,{onSubmit:async d=>(d.preventDefault(),s(t,e[i].text,l=>{R||(l.status="guest order cancellation requested"),m.emit("order/data",l)},()=>{O(!0)})),"data-testid":"order-order-cancel-reasons-form__text",children:[_&&n(M,{heading:o.ErrorHeading,description:o.ErrorDescription}),n("div",{className:"order-order-cancel-reasons-form__text",children:n(u,{id:"Order.OrderCancellationReasonsForm.description"})}),n($,{name:"cancellationReasons",floatingLabel:o.orderCancellationLabel,defaultOption:e[0],variant:"primary",options:e,value:String(i),handleSelect:D,required:!0,"data-testid":"order-cancellation-reasons-selector",...a}),n("div",{className:"order-order-cancel-reasons-form__button-container",children:n(x,{variant:"primary",...r,children:n(u,{id:"Order.OrderCancellationReasonsForm.button"})})})]})})},B=`
|
|
2
2
|
mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) {
|
|
3
3
|
cancelOrder(input: { order_id: $orderId, reason: $reason }) {
|
|
4
4
|
error
|
|
@@ -32,14 +32,11 @@ mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) {
|
|
|
32
32
|
product_sku
|
|
33
33
|
product_name
|
|
34
34
|
order_item {
|
|
35
|
-
|
|
35
|
+
...OrderItemDetails
|
|
36
36
|
... on GiftCardOrderItem {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
sender_name
|
|
41
|
-
sender_email
|
|
42
|
-
message
|
|
37
|
+
...GiftCardDetails
|
|
38
|
+
product {
|
|
39
|
+
...ProductDetails
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
}
|
|
@@ -56,15 +53,21 @@ mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) {
|
|
|
56
53
|
...AddressesList
|
|
57
54
|
}
|
|
58
55
|
items {
|
|
59
|
-
|
|
56
|
+
...OrderItemDetails
|
|
57
|
+
... on BundleOrderItem {
|
|
58
|
+
...BundleOrderItemDetails
|
|
59
|
+
}
|
|
60
60
|
... on GiftCardOrderItem {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
...GiftCardDetails
|
|
62
|
+
product {
|
|
63
|
+
...ProductDetails
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
... on DownloadableOrderItem {
|
|
67
|
+
product_name
|
|
68
|
+
downloadable_links {
|
|
69
|
+
sort_order
|
|
70
|
+
title
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
}
|
|
@@ -74,6 +77,11 @@ mutation CANCEL_ORDER_MUTATION($orderId: ID!, $reason: String!) {
|
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
}
|
|
80
|
+
${g}
|
|
81
|
+
${S}
|
|
82
|
+
${h}
|
|
83
|
+
${I}
|
|
84
|
+
${A}
|
|
77
85
|
${b}
|
|
78
|
-
${
|
|
79
|
-
`,
|
|
86
|
+
${N}
|
|
87
|
+
`,U=async(a,r,e,s)=>{if(!a)throw new Error("No order ID found");if(!r)throw new Error("No reason found");return F(B,{variables:{orderId:a,reason:r}}).then(({errors:t,data:o})=>{if(t)return L(t);if(o.cancelOrder.error!=null){s();return}const i=T(o.cancelOrder.order);e(i)})},k=()=>{const[a,r]=c(null);return v(()=>{const e=sessionStorage.getItem("orderStoreConfig"),s=e?JSON.parse(e):null;s?r(s):G().then(t=>{t&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(t)),r(t))})},[]),a},nr=({orderId:a})=>{const r=k(),e=(r==null?void 0:r.orderCancellationReasons)??[];return n(f,{children:n(P,{orderId:a,cancelOrder:U,cancelReasons:(t=>t.map((o,i)=>({text:o==null?void 0:o.description,value:i.toString()})))(e)})})};export{nr as OrderCancel,nr as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as r,jsx as c,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as H}from"@dropins/tools/lib.js";import{useState as _,useEffect as T}from"@dropins/tools/preact-hooks.js";import{events as V}from"@dropins/tools/event-bus.js";import{s as C}from"../chunks/setTaxStatus.js";import{g as N}from"../chunks/getStoreConfig.js";import{Price as u,Icon as b,Accordion as f,AccordionSection as E,Card as D,Header as k}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import*as h from"@dropins/tools/preact-compat.js";import"@dropins/tools/preact.js";import{a as z}from"../chunks/OrderLoaders.js";import{useText as B}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const A=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M7.74512 9.87701L12.0001 14.132L16.2551 9.87701",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),I=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{d:"M7.74512 14.132L12.0001 9.87701L16.2551 14.132",stroke:"#2B2B2B",strokeWidth:1.5,strokeLinecap:"square",strokeLinejoin:"round"})),j=e=>h.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},h.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M22 6.25H22.75C22.75 5.83579 22.4142 5.5 22 5.5V6.25ZM22 9.27L22.2514 9.97663C22.5503 9.87029 22.75 9.58731 22.75 9.27H22ZM20.26 12.92L19.5534 13.1714L19.5539 13.1728L20.26 12.92ZM22 14.66H22.75C22.75 14.3433 22.551 14.0607 22.2528 13.9539L22 14.66ZM22 17.68V18.43C22.4142 18.43 22.75 18.0942 22.75 17.68H22ZM2 17.68H1.25C1.25 18.0942 1.58579 18.43 2 18.43V17.68ZM2 14.66L1.74865 13.9534C1.44969 14.0597 1.25 14.3427 1.25 14.66H2ZM3.74 11.01L4.44663 10.7586L4.44611 10.7572L3.74 11.01ZM2 9.27H1.25C1.25 9.58675 1.44899 9.86934 1.7472 9.97611L2 9.27ZM2 6.25V5.5C1.58579 5.5 1.25 5.83579 1.25 6.25H2ZM21.25 6.25V9.27H22.75V6.25H21.25ZM21.7486 8.56337C19.8706 9.23141 18.8838 11.2889 19.5534 13.1714L20.9666 12.6686C20.5762 11.5711 21.1494 10.3686 22.2514 9.97663L21.7486 8.56337ZM19.5539 13.1728C19.9195 14.1941 20.7259 15.0005 21.7472 15.3661L22.2528 13.9539C21.6541 13.7395 21.1805 13.2659 20.9661 12.6672L19.5539 13.1728ZM21.25 14.66V17.68H22.75V14.66H21.25ZM22 16.93H2V18.43H22V16.93ZM2.75 17.68V14.66H1.25V17.68H2.75ZM2.25135 15.3666C4.12941 14.6986 5.11623 12.6411 4.44663 10.7586L3.03337 11.2614C3.42377 12.3589 2.85059 13.5614 1.74865 13.9534L2.25135 15.3666ZM4.44611 10.7572C4.08045 9.73588 3.27412 8.92955 2.2528 8.56389L1.7472 9.97611C2.34588 10.1905 2.81955 10.6641 3.03389 11.2628L4.44611 10.7572ZM2.75 9.27V6.25H1.25V9.27H2.75ZM2 7H22V5.5H2V7ZM7.31 6.74V18.17H8.81V6.74H7.31ZM17.0997 8.39967L11.0397 14.4597L12.1003 15.5203L18.1603 9.46033L17.0997 8.39967ZM12.57 9.67C12.57 9.87231 12.4159 10 12.27 10V11.5C13.2839 11.5 14.07 10.6606 14.07 9.67H12.57ZM12.27 10C12.1241 10 11.97 9.87231 11.97 9.67H10.47C10.47 10.6606 11.2561 11.5 12.27 11.5V10ZM11.97 9.67C11.97 9.46769 12.1241 9.34 12.27 9.34V7.84C11.2561 7.84 10.47 8.67938 10.47 9.67H11.97ZM12.27 9.34C12.4159 9.34 12.57 9.46769 12.57 9.67H14.07C14.07 8.67938 13.2839 7.84 12.27 7.84V9.34ZM17.22 14.32C17.22 14.5223 17.0659 14.65 16.92 14.65V16.15C17.9339 16.15 18.72 15.3106 18.72 14.32H17.22ZM16.92 14.65C16.7741 14.65 16.62 14.5223 16.62 14.32H15.12C15.12 15.3106 15.9061 16.15 16.92 16.15V14.65ZM16.62 14.32C16.62 14.1177 16.7741 13.99 16.92 13.99V12.49C15.9061 12.49 15.12 13.3294 15.12 14.32H16.62ZM16.92 13.99C17.0659 13.99 17.22 14.1177 17.22 14.32H18.72C18.72 13.3294 17.9339 12.49 16.92 12.49V13.99Z",fill:"#3D3D3D"})),P=({translations:e,order:a,subTotalValue:t,shoppingOrdersDisplaySubtotal:n})=>{var l,i;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--subtotal",children:[r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.subtotal}),c(u,{className:"order-cost-summary-content__description--normal-price",weight:"normal",currency:(l=a==null?void 0:a.subtotal)==null?void 0:l.currency,amount:t})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[!n.taxExcluded&&n.taxIncluded?c("span",{children:e.incl}):null,n.taxExcluded&&n.taxIncluded?r(v,{children:[c(u,{currency:(i=a==null?void 0:a.subtotal)==null?void 0:i.currency,amount:t,size:"small"})," ",c("span",{children:e.excl})]}):null]})]})},W=({translations:e,shoppingOrdersDisplayShipping:a,order:t,totalShipping:n})=>{var l,i,o,s;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--shipping",children:[r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.shipping}),(l=t==null?void 0:t.totalShipping)!=null&&l.value?c(u,{weight:"normal",currency:(i=t==null?void 0:t.totalShipping)==null?void 0:i.currency,amount:n}):c("span",{children:e.freeShipping})]}),r("div",{className:"order-cost-summary-content__description--subheader",children:[a.taxIncluded&&a.taxExcluded?r(v,{children:[c(u,{weight:"normal",currency:(o=t==null?void 0:t.totalShipping)==null?void 0:o.currency,amount:(s=t==null?void 0:t.totalShipping)==null?void 0:s.value,size:"small"}),r("span",{children:[" ",e.excl]})]}):null,a.taxIncluded&&!a.taxExcluded?c("span",{children:e.incl}):null]})]})},q=({translations:e,order:a,totalGiftcardValue:t,totalGiftcardCurrency:n})=>{var l;return!(a!=null&&a.discounts.length)&&!t?null:r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--discount",children:[r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.discount}),c("span",{children:a!=null&&a.discounts.length?(l=a==null?void 0:a.discounts)==null?void 0:l.map(({amount:i},o)=>{const s=(i==null?void 0:i.value)??0;return c(u,{weight:"normal",sale:!0,currency:i==null?void 0:i.currency,amount:-(s+t)},o)}):null})]}),!(a!=null&&a.discounts.length)&&t?r("div",{className:"order-cost-summary-content__description--subheader",children:[r("span",{children:[c(b,{source:j,size:"16"}),c("span",{children:e.discountSubtitle.toLocaleUpperCase()})]}),c(u,{weight:"normal",sale:!0,currency:n,amount:-t})]}):null]})},F=({order:e})=>c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--coupon",children:e.coupons.map((a,t)=>r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:a.code}),c("span",{children:"TBD"})]},t))}),U=({translations:e,renderTaxAccordion:a,totalAccordionTaxValue:t,order:n})=>{var o;const[l,i]=_(!1);return a?c(f,{"data-testid":"tax-accordionTaxes",className:"order-cost-summary-content__accordion",iconOpen:A,iconClose:I,children:r(E,{onStateChange:i,title:e.accordionTitle,secondaryText:c(v,{children:l?null:c(u,{weight:"normal",amount:t,currency:n.totalTax.currency})}),renderContentWhenClosed:!1,children:[n.taxes.map((s,m)=>{var d,p;return r("div",{className:"order-cost-summary-content__accordion-row",children:[c("p",{children:s==null?void 0:s.title}),c("p",{children:c(u,{weight:"normal",amount:(d=s==null?void 0:s.amount)==null?void 0:d.value,currency:(p=s==null?void 0:s.amount)==null?void 0:p.currency})})]},m)}),r("div",{className:"order-cost-summary-content__accordion-row order-cost-summary-content__accordion-total",children:[c("p",{children:e.accordionTotalTax}),c("p",{children:c(u,{weight:"normal",amount:t,currency:n.totalTax.currency,size:"medium"})})]})]})}):c("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--tax",children:r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.tax}),c(u,{currency:(o=n==null?void 0:n.totalTax)==null?void 0:o.currency,amount:n==null?void 0:n.totalTax.value,weight:"normal",size:"small"})]})})},G=({translations:e,shoppingOrdersDisplaySubtotal:a,order:t})=>{var n,l,i,o;return r("div",{className:"order-cost-summary-content__description order-cost-summary-content__description--total",children:[r("div",{className:"order-cost-summary-content__description--header",children:[c("span",{children:e.total}),c(u,{currency:(n=t==null?void 0:t.grandTotal)==null?void 0:n.currency,amount:(l=t==null?void 0:t.grandTotal)==null?void 0:l.value,weight:"bold",size:"medium"})]}),a.taxExcluded&&a.taxIncluded?r("div",{className:"order-cost-summary-content__description--subheader",children:[c("span",{children:e.totalExcludingTaxes}),c(u,{currency:(i=t==null?void 0:t.grandTotal)==null?void 0:i.currency,amount:((o=t==null?void 0:t.grandTotal)==null?void 0:o.value)-(t==null?void 0:t.totalTax.value),weight:"normal",size:"small"})]}):null]})},R=({translations:e,loading:a,storeConfig:t,order:n,withHeader:l=!0})=>{var y,x,S,O,w,L;if(a||!n)return c(z,{});const i=((y=n==null?void 0:n.totalGiftcard)==null?void 0:y.value)??0,o=((x=n.totalGiftcard)==null?void 0:x.currency)??"",s=((S=n.subtotal)==null?void 0:S.value)??0,m=((O=n.totalShipping)==null?void 0:O.value)??0,d=!!((w=n==null?void 0:n.taxes)!=null&&w.length)&&(t==null?void 0:t.shoppingOrdersDisplayFullSummary),p=d?(L=n==null?void 0:n.taxes)==null?void 0:L.reduce((Z,g)=>{var M;return+((M=g==null?void 0:g.amount)==null?void 0:M.value)+Z},0):0;return r(D,{variant:"secondary",className:H(["order-cost-summary-content"]),children:[l?c(k,{title:e.headerText}):null,r("div",{className:"order-cost-summary-content__wrapper",children:[c(P,{translations:e,order:n,subTotalValue:s,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal}),c(W,{translations:e,order:n,totalShipping:m,shoppingOrdersDisplayShipping:t==null?void 0:t.shoppingOrdersDisplayShipping}),c(q,{translations:e,order:n,totalGiftcardValue:i,totalGiftcardCurrency:o}),c(F,{order:n}),c(U,{order:n,translations:e,renderTaxAccordion:d,totalAccordionTaxValue:p}),c(G,{translations:e,shoppingOrdersDisplaySubtotal:t==null?void 0:t.shoppingOrdersDisplaySubtotal,order:n})]})]})},J=({orderData:e})=>{const[a,t]=_(!0),[n,l]=_(e),[i,o]=_(null);return T(()=>{N().then(s=>{if(s){const{shoppingCartDisplayPrice:m,shoppingOrdersDisplayShipping:d,shoppingOrdersDisplaySubtotal:p,...y}=s;o(x=>({...x,...y,shoppingCartDisplayPrice:C(m),shoppingOrdersDisplayShipping:C(d),shoppingOrdersDisplaySubtotal:C(p)}))}}).finally(()=>{t(!1)})},[]),T(()=>{const s=V.on("order/data",m=>{l(m)},{eager:!0});return()=>{s==null||s.off()}},[]),{loading:a,storeConfig:i,order:n}},lt=({withHeader:e,orderData:a,children:t,className:n,...l})=>{const{loading:i,storeConfig:o,order:s}=J({orderData:a}),m=B({headerText:"Order.OrderCostSummary.headerText",subtotal:"Order.OrderCostSummary.subtotal.title",shipping:"Order.OrderCostSummary.shipping.title",freeShipping:"Order.OrderCostSummary.shipping.freeShipping",tax:"Order.OrderCostSummary.tax.title",incl:"Order.OrderCostSummary.tax.incl",excl:"Order.OrderCostSummary.tax.excl",discount:"Order.OrderCostSummary.discount.title",discountSubtitle:"Order.OrderCostSummary.discount.subtitle",total:"Order.OrderCostSummary.total.title",accordionTitle:"Order.OrderCostSummary.tax.accordionTitle",accordionTotalTax:"Order.OrderCostSummary.tax.accordionTotalTax",totalExcludingTaxes:"Order.OrderCostSummary.tax.totalExcludingTaxes"});return c("div",{...l,className:H(["order-cost-summary",n]),children:c(R,{order:s,withHeader:e,loading:i,storeConfig:o,translations:m})})};export{lt as OrderCostSummary,lt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,jsxs as k,Fragment as E}from"@dropins/tools/preact-jsx-runtime.js";import{Card as Z,Header as j,Price as W,CartItem as z,Icon as B,Image as K}from"@dropins/tools/components.js";import"../chunks/OrderCancelReasonsForm.js";import{classes as q}from"@dropins/tools/lib.js";import*as L from"@dropins/tools/preact-compat.js";import{useMemo as R,useCallback as A,useState as b,useEffect as P}from"@dropins/tools/preact-hooks.js";import{Fragment as J}from"@dropins/tools/preact.js";import{O as U}from"../chunks/OrderLoaders.js";import{events as X}from"@dropins/tools/event-bus.js";import{useText as Y}from"@dropins/tools/i18n.js";import{s as g}from"../chunks/setTaxStatus.js";import{g as I}from"../chunks/getStoreConfig.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const T=u=>L.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...u},L.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),L.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),p=({loading:u,taxConfig:e,order:d=null,withHeader:c=!0,showConfigurableOptions:i})=>{const m=Y({cancelled:"Order.OrderProductListContent.cancelledTitle",allOrders:"Order.OrderProductListContent.allOrdersTitle",sender:"Order.OrderProductListContent.GiftCard.sender",recipient:"Order.OrderProductListContent.GiftCard.recipient",message:"Order.OrderProductListContent.GiftCard.message",outOfStock:"Order.OrderProductListContent.stockStatus.outOfStock",downloadableCount:"Order.OrderProductListContent.downloadableCount"}),h=R(()=>{if(!d)return[];const{items:s}=d;return[{type:"cancelled",list:s.filter(a=>a.quantityCanceled),title:m.cancelled},{type:"",list:s.filter(a=>!a.quantityCanceled),title:m.allOrders}]},[d,m]);return d?r(Z,{variant:"secondary",className:"order-order-product-list-content",children:h.filter(s=>s.list.length).map((s,a)=>{var v;return k(J,{children:[c?r(j,{title:`${s.title} (${s.list.length})`}):null,r("ul",{className:"order-order-product-list-content__items",children:(v=s.list)==null?void 0:v.map(O=>r("li",{"data-testid":"order-product-list-content-item",children:r(ee,{loading:u,product:O,itemType:s.type,taxConfig:e,translations:m,showConfigurableOptions:i})},O.id))})]},a)})}):r(U,{})},ee=({loading:u,product:e,itemType:d,taxConfig:c,translations:i,showConfigurableOptions:m})=>{var S,C,N,x,Q,_,H,V,$,M;const{taxExcluded:h,taxIncluded:s}=c,a=A((y,F,G)=>r(W,{amount:y,currency:F,weight:"normal",...G}),[]);let v={};const O=d==="cancelled",D=(C=(S=e==null?void 0:e.product)==null?void 0:S.stockStatus)==null?void 0:C.includes("IN_STOCK"),t=(e==null?void 0:e.giftCard)||{},l=(N=e==null?void 0:e.itemPrices)==null?void 0:N.priceIncludingTax,n=(x=e==null?void 0:e.itemPrices)==null?void 0:x.originalPrice,o=(Q=e==null?void 0:e.itemPrices)==null?void 0:Q.price,f=e.discounted&&((_=e.price)==null?void 0:_.value)!==(n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),w={..."configurableOptions"in e?e.configurableOptions:{},..."bundleOptions"in e?e.bundleOptions:{},..."senderName"in t&&(t!=null&&t.senderName)?{[i.sender]:t==null?void 0:t.senderName}:{},..."senderEmail"in t&&(t!=null&&t.senderEmail)?{[i.sender]:t==null?void 0:t.senderEmail}:{},..."recipientName"in t&&(t!=null&&t.recipientName)?{[i.recipient]:t==null?void 0:t.recipientName}:{},..."recipientEmail"in t&&(t!=null&&t.recipientEmail)?{[i.recipient]:t==null?void 0:t.recipientEmail}:{},..."message"in t&&(t!=null&&t.message)?{[i.message]:t==null?void 0:t.message}:{},..."downloadableLinks"in e&&(e!=null&&e.downloadableLinks)?{[`${(H=e==null?void 0:e.downloadableLinks)==null?void 0:H.count} ${i.downloadableCount}`]:(V=e==null?void 0:e.downloadableLinks)==null?void 0:V.result}:{}};if(s&&h){const y=f?n==null?void 0:n.value:(l==null?void 0:l.value)*(e==null?void 0:e.totalQuantity);v={taxExcluded:!0,taxIncluded:void 0,price:a(n==null?void 0:n.value,n==null?void 0:n.currency),total:k(E,{children:[a(y,n==null?void 0:n.currency,{variant:e.discounted&&(l==null?void 0:l.value)!==y?"strikethrough":"default"}),e.discounted&&(l==null?void 0:l.value)!==y?a(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:a((o==null?void 0:o.value)*e.totalQuantity,o==null?void 0:o.currency)}}else if(!s&&h)v={taxExcluded:void 0,taxIncluded:void 0,price:a(n==null?void 0:n.value,n==null?void 0:n.currency),total:k(E,{children:[a((n==null?void 0:n.value)*(e==null?void 0:e.totalQuantity),l==null?void 0:l.currency,{variant:f?"strikethrough":"default"}),f?a(($=e.price)==null?void 0:$.value,(M=e.price)==null?void 0:M.currency,{sale:!0,weight:"bold"}):null]}),totalExcludingTax:a((o==null?void 0:o.value)*(e==null?void 0:e.totalQuantity),o==null?void 0:o.currency)};else if(s&&!h){const y=f?n.value:l.value*e.totalQuantity;v={taxExcluded:void 0,taxIncluded:!0,price:a(l==null?void 0:l.value,l==null?void 0:l.currency),total:k(E,{children:[a(y,l==null?void 0:l.currency,{variant:f?"strikethrough":"default",weight:"bold"}),f?a(l==null?void 0:l.value,l==null?void 0:l.currency,{sale:!0,weight:"bold"}):null]})}}return r(z,{loading:u,alert:O&&D?k("span",{children:[r(B,{source:T}),i.outOfStock]}):r(E,{}),configurations:(m==null?void 0:m(w))??w,title:r("div",{"data-testid":"product-name",className:q(["cart-summary-item__title",["cart-summary-item__title--strikethrough",O]]),children:e.product.name}),sku:r("div",{children:e.product.sku}),quantity:e.totalQuantity,image:r(K,{src:e.product.thumbnail.url,alt:e.product.thumbnail.label,loading:"lazy",width:"90",height:"120"}),...v})},te=({orderData:u})=>{const[e,d]=b(!0),[c,i]=b(u),[m,h]=b({taxIncluded:!1,taxExcluded:!1});return P(()=>{I().then(s=>{s&&h(g(s==null?void 0:s.shoppingCartDisplayPrice))}).finally(()=>{d(!1)})},[]),P(()=>{const s=X.on("order/data",a=>{i(a)},{eager:!0});return()=>{s==null||s.off()}},[]),{loading:e,taxConfig:m,order:c}},ye=({className:u,orderData:e,withHeader:d,showConfigurableOptions:c})=>{const{loading:i,taxConfig:m,order:h}=te({orderData:e});return r("div",{className:q(["order-order-product-list",u]),children:r(p,{loading:i,taxConfig:m,order:h,withHeader:d,showConfigurableOptions:c})})};export{ye as OrderProductList,ye as default};
|