@dropins/storefront-order 0.1.0-alpha30 → 0.1.0-alpha32

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 (48) hide show
  1. package/api/fragment.d.ts +7 -0
  2. package/api/getAttributesForm/graphql/getAttributesForm.graphql.d.ts +1 -1
  3. package/api/getCustomer/graphql/getCustomer.graphql.d.ts +1 -1
  4. package/api/getCustomerOrdersReturn/getCustomerOrdersReturn.d.ts +1 -1
  5. package/api/getGuestOrder/graphql/getGuestOrder.graphql.d.ts +0 -1
  6. package/api/getStoreConfig/graphql/StoreConfigQuery.d.ts +1 -1
  7. package/api/graphql/CustomerAddressFragment.graphql.d.ts +2 -0
  8. package/api/graphql/GurestOrderFragment.graphql.d.ts +2 -0
  9. package/api/graphql/OrderItemsFragment.graphql.d.ts +6 -0
  10. package/api/graphql/OrderSummaryFragment.graphql.d.ts +2 -0
  11. package/api/graphql/RequestReturnOrderFragment.graphql.d.ts +2 -0
  12. package/api/graphql/ReturnsFragment.graphql.d.ts +2 -0
  13. package/api/initialize/initialize.d.ts +7 -1
  14. package/api/reorderItems/graphql/reorderItems.graphql.d.ts +1 -1
  15. package/api/requestReturn/requestReturn.d.ts +2 -6
  16. package/api.js +18 -229
  17. package/chunks/GurestOrderFragment.graphql.js +99 -0
  18. package/chunks/getAttributesForm.js +1 -1
  19. package/chunks/getCustomerOrdersReturn.js +17 -17
  20. package/chunks/getGuestOrder.js +12 -5
  21. package/chunks/getStoreConfig.js +12 -12
  22. package/chunks/initialize.js +407 -0
  23. package/chunks/network-error.js +1 -1
  24. package/chunks/reorderItems.js +12 -12
  25. package/chunks/requestGuestOrderCancel.js +84 -81
  26. package/chunks/requestReturn.js +17 -16
  27. package/chunks/transform-attributes-form.js +1 -1
  28. package/containers/CreateReturn.js +1 -1
  29. package/containers/CustomerDetails.js +1 -1
  30. package/containers/OrderCancelForm.js +1 -1
  31. package/containers/OrderSearch.js +1 -1
  32. package/containers/OrderStatus.js +8 -9
  33. package/containers/ReturnsList.js +1 -1
  34. package/data/models/index.d.ts +1 -0
  35. package/data/models/request-return.d.ts +7 -0
  36. package/data/transforms/index.d.ts +1 -0
  37. package/data/transforms/transform-request-return.d.ts +5 -0
  38. package/package.json +1 -1
  39. package/render.js +1 -1
  40. package/api/getOrderDetailsById/graphql/customerAddressFragment.graphql.d.ts +0 -2
  41. package/api/getOrderDetailsById/graphql/index.d.ts +0 -6
  42. package/api/getOrderDetailsById/graphql/orderItemsFragment.graphql.d.ts +0 -6
  43. package/api/getOrderDetailsById/graphql/orderSummaryFragment.graphql.d.ts +0 -2
  44. package/api/getOrderDetailsById/graphql/returnsFragment.graphql.d.ts +0 -2
  45. package/api/requestReturn/graphql/fragments.d.ts +0 -2
  46. package/chunks/convertCase.js +0 -3
  47. package/chunks/getGuestOrder.graphql.js +0 -160
  48. package/chunks/transform-customer-orders-returns.js +0 -142
@@ -0,0 +1,7 @@
1
+ export { REQUEST_RETURN_ORDER_FRAGMENT } from './graphql/RequestReturnOrderFragment.graphql';
2
+ export { ADDRESS_FRAGMENT } from './graphql/CustomerAddressFragment.graphql';
3
+ export { PRODUCT_DETAILS_FRAGMENT, PRICE_DETAILS_FRAGMENT, GIFT_CARD_DETAILS_FRAGMENT, ORDER_ITEM_DETAILS_FRAGMENT, BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT, } from './graphql/OrderItemsFragment.graphql';
4
+ export { ORDER_SUMMARY_FRAGMENT } from './graphql/OrderSummaryFragment.graphql';
5
+ export { RETURNS_FRAGMENT } from './graphql/ReturnsFragment.graphql';
6
+ export { GUEST_ORDER_FRAGMENT } from './graphql/GurestOrderFragment.graphql';
7
+ //# sourceMappingURL=fragment.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export declare const GET_ATTRIBUTES_FORM = "\n query GET_ATTRIBUTES_FORM($formCode: String!) {\n attributesForm(formCode: $formCode) {\n items {\n code\n default_value\n entity_type\n frontend_class\n frontend_input\n is_required\n is_unique\n label\n options {\n is_default\n label\n value\n }\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n validate_rules {\n name\n value\n }\n }\n }\n errors {\n type\n message\n }\n }\n }\n";
2
- export declare const GET_ATTRIBUTES_FORM_SHORT = "\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n";
2
+ export declare const GET_ATTRIBUTES_FORM_SHORT = "\n query GET_ATTRIBUTES_FORM_SHORT {\n attributesForm(formCode: \"customer_register_address\") {\n items {\n frontend_input\n label\n code\n ... on CustomerAttributeMetadata {\n multiline_count\n sort_order\n }\n }\n }\n }\n";
3
3
  //# sourceMappingURL=getAttributesForm.graphql.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const GET_CUSTOMER = "\n query GET_CUSTOMER {\n customer {\n firstname\n lastname\n email\n }\n }\n";
1
+ export declare const GET_CUSTOMER = "\n query GET_CUSTOMER {\n customer {\n firstname\n lastname\n email\n }\n }\n";
2
2
  //# sourceMappingURL=getCustomer.graphql.d.ts.map
@@ -1,4 +1,4 @@
1
1
  import { CustomerOrdersReturnModel } from '../../data/models';
2
2
 
3
- export declare const getCustomerOrdersReturn: (pageSize?: number) => Promise<CustomerOrdersReturnModel | null>;
3
+ export declare const getCustomerOrdersReturn: (pageSize?: number, currentPage?: number) => Promise<CustomerOrdersReturnModel | null>;
4
4
  //# sourceMappingURL=getCustomerOrdersReturn.d.ts.map
@@ -1,3 +1,2 @@
1
- export declare const GUEST_ORDER_FRAGMENT: string;
2
1
  export declare const GET_GUEST_ORDER: string;
3
2
  //# sourceMappingURL=getGuestOrder.graphql.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n base_media_url\n orders_invoices_credit_memos_display_price\n orders_invoices_credit_memos_display_shipping_amount\n orders_invoices_credit_memos_display_subtotal\n orders_invoices_credit_memos_display_grandtotal\n orders_invoices_credit_memos_display_full_summary\n orders_invoices_credit_memos_display_zero_tax\n }\n}\n";
1
+ export declare const STORE_CONFIG_QUERY = "\n query STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n base_media_url\n orders_invoices_credit_memos_display_price\n orders_invoices_credit_memos_display_shipping_amount\n orders_invoices_credit_memos_display_subtotal\n orders_invoices_credit_memos_display_grandtotal\n orders_invoices_credit_memos_display_full_summary\n orders_invoices_credit_memos_display_zero_tax\n }\n }\n";
2
2
  //# sourceMappingURL=StoreConfigQuery.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const ADDRESS_FRAGMENT = "\n fragment ADDRESS_FRAGMENT 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 }\n";
2
+ //# sourceMappingURL=CustomerAddressFragment.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const GUEST_ORDER_FRAGMENT: string;
2
+ //# sourceMappingURL=GurestOrderFragment.graphql.d.ts.map
@@ -0,0 +1,6 @@
1
+ export declare const PRODUCT_DETAILS_FRAGMENT = "\n fragment PRODUCT_DETAILS_FRAGMENT on ProductInterface {\n __typename\n canonical_url\n url_key\n uid\n name\n sku\n only_x_left_in_stock\n stock_status\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
+ export declare const PRICE_DETAILS_FRAGMENT = "\n fragment PRICE_DETAILS_FRAGMENT on OrderItemInterface {\n prices {\n price_including_tax {\n value\n currency\n }\n original_price {\n value\n currency\n }\n original_price_including_tax {\n value\n currency\n }\n price {\n value\n currency\n }\n }\n }\n";
3
+ export declare const GIFT_CARD_DETAILS_FRAGMENT = "\n fragment GIFT_CARD_DETAILS_FRAGMENT on GiftCardOrderItem {\n ...PRICE_DETAILS_FRAGMENT\n gift_message {\n message\n }\n gift_card {\n recipient_name\n recipient_email\n sender_name\n sender_email\n message\n }\n }\n";
4
+ export declare const ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment ORDER_ITEM_DETAILS_FRAGMENT on OrderItemInterface {\n __typename\n status\n product_sku\n eligible_for_return\n product_name\n product_url_key\n id\n quantity_ordered\n quantity_shipped\n quantity_canceled\n quantity_invoiced\n quantity_refunded\n quantity_return_requested\n product_sale_price {\n value\n currency\n }\n selected_options {\n label\n value\n }\n product {\n ...PRODUCT_DETAILS_FRAGMENT\n }\n ...PRICE_DETAILS_FRAGMENT\n }\n";
5
+ export declare const BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT = "\n fragment BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT on BundleOrderItem {\n ...PRICE_DETAILS_FRAGMENT\n bundle_options {\n uid\n label\n values {\n uid\n product_name\n }\n }\n }\n";
6
+ //# sourceMappingURL=OrderItemsFragment.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const ORDER_SUMMARY_FRAGMENT = "\n fragment ORDER_SUMMARY_FRAGMENT on OrderTotal {\n grand_total {\n value\n currency\n }\n total_giftcard {\n currency\n value\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 }\n";
2
+ //# sourceMappingURL=OrderSummaryFragment.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const REQUEST_RETURN_ORDER_FRAGMENT = "\n fragment REQUEST_RETURN_ORDER_FRAGMENT on Return {\n __typename\n uid\n status\n number\n created_at\n }\n";
2
+ //# sourceMappingURL=RequestReturnOrderFragment.graphql.d.ts.map
@@ -0,0 +1,2 @@
1
+ export declare const RETURNS_FRAGMENT = "\n fragment RETURNS_FRAGMENT on Returns {\n __typename\n items {\n number\n status\n created_at\n shipping {\n tracking {\n status {\n text\n type\n }\n carrier {\n uid\n label\n }\n tracking_number\n }\n }\n order {\n number\n token\n }\n items {\n uid\n quantity\n status\n request_quantity\n order_item {\n ...ORDER_ITEM_DETAILS_FRAGMENT\n ... on GiftCardOrderItem {\n ...GIFT_CARD_DETAILS_FRAGMENT\n product {\n ...PRODUCT_DETAILS_FRAGMENT\n }\n }\n }\n }\n }\n }\n";
2
+ //# sourceMappingURL=ReturnsFragment.graphql.d.ts.map
@@ -1,8 +1,14 @@
1
- import { Initializer } from '@dropins/tools/types/elsie/src/lib';
1
+ import { Initializer, Model } from '@dropins/tools/types/elsie/src/lib';
2
2
  import { Lang } from '@dropins/tools/types/elsie/src/i18n';
3
+ import { CustomerOrdersReturnModel, OrderDataModel, RequestReturnModel } from '../../data/models';
3
4
 
4
5
  type ConfigProps = {
5
6
  langDefinitions?: Lang;
7
+ models?: {
8
+ OrderDataModel?: Model<OrderDataModel>;
9
+ CustomerOrdersReturnModel?: Model<CustomerOrdersReturnModel>;
10
+ RequestReturnModel?: Model<RequestReturnModel>;
11
+ };
6
12
  };
7
13
  export declare const initialize: Initializer<ConfigProps>;
8
14
  export declare const config: import('@dropins/tools/types/elsie/src/lib').Config<ConfigProps>;
@@ -1,2 +1,2 @@
1
- export declare const REORDER_ITEMS_MUTATION = "\nmutation REORDER_ITEMS_MUTATION($orderNumber: String!) {\n reorderItems(orderNumber: $orderNumber) {\n cart {\n itemsV2 {\n items {\n uid\n }\n }\n }\n userInputErrors{\n code\n message\n path\n }\n }\n}\n";
1
+ export declare const REORDER_ITEMS_MUTATION = "\n mutation REORDER_ITEMS_MUTATION($orderNumber: String!) {\n reorderItems(orderNumber: $orderNumber) {\n cart {\n itemsV2 {\n items {\n uid\n }\n }\n }\n userInputErrors {\n code\n message\n path\n }\n }\n }\n";
2
2
  //# sourceMappingURL=reorderItems.graphql.d.ts.map
@@ -1,9 +1,5 @@
1
1
  import { RequestReturnProps } from '../../types';
2
+ import { RequestReturnModel } from '../../data/models';
2
3
 
3
- export declare const requestReturn: (form: RequestReturnProps) => Promise<{
4
- uid: string;
5
- number: string;
6
- status: string;
7
- createdAt: string;
8
- }>;
4
+ export declare const requestReturn: (form: RequestReturnProps) => Promise<RequestReturnModel | {}>;
9
5
  //# sourceMappingURL=requestReturn.d.ts.map
package/api.js CHANGED
@@ -1,217 +1,6 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{c as ae,r as se}from"./chunks/requestGuestOrderCancel.js";import{f as i,h as I}from"./chunks/fetch-graphql.js";import{g as de,r as ne,s as ie,a as le,b as ue}from"./chunks/fetch-graphql.js";import{g as pe}from"./chunks/getAttributesForm.js";import{g as _e,r as Oe}from"./chunks/requestReturn.js";import{t as f}from"./chunks/getGuestOrder.js";import{g as he,a as Re}from"./chunks/getGuestOrder.js";import{g as Ee}from"./chunks/getCustomerOrdersReturn.js";import{h as l}from"./chunks/network-error.js";import{P as u,a as m,G as p,O as c,B as _,R as y,b as A,c as G}from"./chunks/transform-customer-orders-returns.js";import{O,A as D}from"./chunks/getGuestOrder.graphql.js";import{g as ye}from"./chunks/getStoreConfig.js";import{Initializer as $}from"@dropins/tools/lib.js";import{events as n}from"@dropins/tools/event-bus.js";import{r as ge}from"./chunks/reorderItems.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"./chunks/convertCase.js";const N=`
4
- query ORDER_BY_NUMBER($orderNumber: String!, $pageSize: Int) {
5
- customer {
6
- orders(
7
- filter: { number: { eq: $orderNumber } }
8
- ) {
9
- items {
10
- email
11
- available_actions
12
- status
13
- number
14
- id
15
- order_date
16
- order_status_change_date
17
- carrier
18
- shipping_method
19
- is_virtual
20
- returns(pageSize: $pageSize) {
21
- ...OrderReturns
22
- }
23
- items_eligible_for_return {
24
- ...OrderItemDetails
25
- ... on BundleOrderItem {
26
- ...BundleOrderItemDetails
27
- }
28
- ... on GiftCardOrderItem {
29
- ...GiftCardDetails
30
- product {
31
- ...ProductDetails
32
- }
33
- }
34
- ... on DownloadableOrderItem {
35
- product_name
36
- downloadable_links {
37
- sort_order
38
- title
39
- }
40
- }
41
- }
42
- applied_coupons {
43
- code
44
- }
45
- shipments {
46
- id
47
- number
48
- tracking {
49
- title
50
- number
51
- carrier
52
- }
53
- comments {
54
- message
55
- timestamp
56
- }
57
- items {
58
- id
59
- product_sku
60
- product_name
61
- quantity_shipped
62
- order_item {
63
- ...OrderItemDetails
64
- ... on GiftCardOrderItem {
65
- ...GiftCardDetails
66
- product {
67
- ...ProductDetails
68
- }
69
- }
70
- }
71
- }
72
- }
73
- payment_methods {
74
- name
75
- type
76
- }
77
- shipping_address {
78
- ...AddressesList
79
- }
80
- billing_address {
81
- ...AddressesList
82
- }
83
- items {
84
- ...OrderItemDetails
85
- ... on BundleOrderItem {
86
- ...BundleOrderItemDetails
87
- }
88
- ... on GiftCardOrderItem {
89
- ...GiftCardDetails
90
- product {
91
- ...ProductDetails
92
- }
93
- }
94
- ... on DownloadableOrderItem {
95
- product_name
96
- downloadable_links {
97
- sort_order
98
- title
99
- }
100
- }
101
- }
102
- total {
103
- ...OrderSummary
104
- }
105
- }
106
- }
107
- }
108
- }
109
- ${u}
110
- ${m}
111
- ${p}
112
- ${c}
113
- ${_}
114
- ${O}
115
- ${D}
116
- ${y}
117
- `,v=(e,t)=>({id:e,totalQuantity:t.totalQuantity,possibleOnepageCheckout:!0,items:t.items.map(r=>{var a,s,o,d,h,R;return{canApplyMsrp:!0,formattedPrice:"",id:r.id,quantity:r.totalQuantity,product:{canonicalUrl:((a=r.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((s=r.product)==null?void 0:s.image)??"",name:((o=r.product)==null?void 0:o.name)??"",productId:0,productType:(d=r.product)==null?void 0:d.productType,sku:((h=r.product)==null?void 0:h.sku)??""},prices:{price:{value:r.price.value,currency:r.price.currency}},configurableOptions:((R=r.selectedOptions)==null?void 0:R.map(b=>({optionLabel:b.label,valueLabel:b.value})))||[]}})}),L=e=>{var a,s,o;const t=e.coupons[0],r=(a=e.payments)==null?void 0:a[0];return{appliedCouponCode:(t==null?void 0:t.code)??"",email:e.email,grandTotal:e.grandTotal.value,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax.value,shipping:{shippingMethod:((s=e.shipping)==null?void 0:s.code)??"",shippingAmount:((o=e.shipping)==null?void 0:o.amount)??0},subtotalExcludingTax:e.subtotal.value,subtotalIncludingTax:0,payments:r?[{paymentMethodCode:(r==null?void 0:r.code)||"",paymentMethodName:(r==null?void 0:r.name)||"",total:e.grandTotal.value}]:[]}},S=e=>{var r,a;const t=(a=(r=e==null?void 0:e.data)==null?void 0:r.placeOrder)==null?void 0:a.orderV2;return t?A(t):null},k=async({orderId:e,returnRef:t,queryType:r,returnsPageSize:a=50})=>await i(N,{method:"GET",cache:"force-cache",variables:{orderNumber:e,pageSize:a}}).then(s=>G(r??"orderData",s,t)).catch(l),w=`
118
- query ORDER_BY_TOKEN($token: String!) {
119
- guestOrderByToken(input: { token: $token }) {
120
- email
121
- id
122
- number
123
- order_date
124
- order_status_change_date
125
- status
126
- token
127
- carrier
128
- shipping_method
129
- printed_card_included
130
- gift_receipt_included
131
- available_actions
132
- is_virtual
133
- items_eligible_for_return {
134
- ...OrderItemDetails
135
- }
136
- returns(pageSize: 50) {
137
- ...OrderReturns
138
- }
139
- payment_methods {
140
- name
141
- type
142
- }
143
- applied_coupons {
144
- code
145
- }
146
- shipments {
147
- id
148
- tracking {
149
- title
150
- number
151
- carrier
152
- }
153
- comments {
154
- message
155
- timestamp
156
- }
157
- items {
158
- id
159
- product_sku
160
- product_name
161
- order_item {
162
- ...OrderItemDetails
163
- ... on GiftCardOrderItem {
164
- ...GiftCardDetails
165
- product {
166
- ...ProductDetails
167
- }
168
- }
169
- }
170
- }
171
- }
172
- payment_methods {
173
- name
174
- type
175
- }
176
- shipping_address {
177
- ...AddressesList
178
- }
179
- billing_address {
180
- ...AddressesList
181
- }
182
- items {
183
- ...OrderItemDetails
184
- ... on BundleOrderItem {
185
- ...BundleOrderItemDetails
186
- }
187
- ... on GiftCardOrderItem {
188
- ...GiftCardDetails
189
- product {
190
- ...ProductDetails
191
- }
192
- }
193
- ... on DownloadableOrderItem {
194
- product_name
195
- downloadable_links {
196
- sort_order
197
- title
198
- }
199
- }
200
- }
201
- total {
202
- ...OrderSummary
203
- }
204
- }
205
- }
206
- ${u}
207
- ${m}
208
- ${p}
209
- ${c}
210
- ${_}
211
- ${O}
212
- ${D}
213
- ${y}
214
- `,x=async(e,t)=>await i(w,{method:"GET",cache:"no-cache",variables:{token:e}}).then(r=>f(r,t)).catch(l),B="orderData",P=async e=>{var d;const t=typeof(e==null?void 0:e.orderRef)=="string"?e==null?void 0:e.orderRef:"",r=typeof(e==null?void 0:e.returnRef)=="string"?e==null?void 0:e.returnRef:"",a=t&&typeof(e==null?void 0:e.orderRef)=="string"&&((d=e==null?void 0:e.orderRef)==null?void 0:d.length)>20,s=(e==null?void 0:e.orderData)??null;if(s){n.emit("order/data",{...s,returnNumber:r});return}if(!t)return;const o=a?await x(t,r):await k({orderId:t,returnRef:r,queryType:B});o?n.emit("order/data",{...o,returnNumber:r}):n.emit("order/error",{source:"order",type:"network",error:"The data was not received."})},C=new $({init:async e=>{const t={};C.config.setConfig({...t,...e}),P(e).catch(console.error)},listeners:()=>[]}),Z=C.config,E={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},M={PLACE_ORDER:"place-order"};function g(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function T(e,t){const r=g();r.push({[e]:null}),r.push({[e]:t})}function F(e,t){g().push(a=>{const s=a.getState?a.getState():{};a.push({event:e,eventInfo:{...s,...t}})})}function U(e,t){const r=L(t),a=v(e,t);T(E.ORDER_CONTEXT,{...r}),T(E.SHOPPING_CART_CONTEXT,{...a}),F(M.PLACE_ORDER)}const q=`
3
+ import{c as H,r as X}from"./chunks/requestGuestOrderCancel.js";import{f as _,h as T}from"./chunks/fetch-graphql.js";import{g as V,r as Y,s as z,a as j,b as J}from"./chunks/fetch-graphql.js";import{g as W}from"./chunks/getAttributesForm.js";import{g as tt,r as et}from"./chunks/requestReturn.js";import{g as at,a as ot}from"./chunks/getGuestOrder.js";import{g as st}from"./chunks/getCustomerOrdersReturn.js";import{c as m,P as R,a as A,G as D,O as g,B as O,b as h,A as C}from"./chunks/initialize.js";import{e as pt,g as ct,d as ut,i as dt}from"./chunks/initialize.js";import{g as Et}from"./chunks/getStoreConfig.js";import{h as f}from"./chunks/network-error.js";import{events as u}from"@dropins/tools/event-bus.js";import{r as Tt}from"./chunks/reorderItems.js";import"./chunks/GurestOrderFragment.graphql.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-attributes-form.js";import"@dropins/tools/lib.js";const M=(e,r)=>({id:e,totalQuantity:r.totalQuantity,possibleOnepageCheckout:!0,items:r.items.map(t=>{var a,o,n,s,i,p;return{canApplyMsrp:!0,formattedPrice:"",id:t.id,quantity:t.totalQuantity,product:{canonicalUrl:((a=t.product)==null?void 0:a.canonicalUrl)??"",mainImageUrl:((o=t.product)==null?void 0:o.image)??"",name:((n=t.product)==null?void 0:n.name)??"",productId:0,productType:(s=t.product)==null?void 0:s.productType,sku:((i=t.product)==null?void 0:i.sku)??""},prices:{price:{value:t.price.value,currency:t.price.currency}},configurableOptions:((p=t.selectedOptions)==null?void 0:p.map(c=>({optionLabel:c.label,valueLabel:c.value})))||[]}})}),G=e=>{var a,o,n;const r=e.coupons[0],t=(a=e.payments)==null?void 0:a[0];return{appliedCouponCode:(r==null?void 0:r.code)??"",email:e.email,grandTotal:e.grandTotal.value,orderId:e.number,orderType:"checkout",otherTax:0,salesTax:e.totalTax.value,shipping:{shippingMethod:((o=e.shipping)==null?void 0:o.code)??"",shippingAmount:((n=e.shipping)==null?void 0:n.amount)??0},subtotalExcludingTax:e.subtotal.value,subtotalIncludingTax:0,payments:t?[{paymentMethodCode:(t==null?void 0:t.code)||"",paymentMethodName:(t==null?void 0:t.name)||"",total:e.grandTotal.value}]:[]}},N=e=>{var t,a;const r=(a=(t=e==null?void 0:e.data)==null?void 0:t.placeOrder)==null?void 0:a.orderV2;return r?m(r):null},d={SHOPPING_CART_CONTEXT:"shoppingCartContext",ORDER_CONTEXT:"orderContext"},b={PLACE_ORDER:"place-order"};function E(){return window.adobeDataLayer=window.adobeDataLayer||[],window.adobeDataLayer}function l(e,r){const t=E();t.push({[e]:null}),t.push({[e]:r})}function I(e,r){E().push(a=>{const o=a.getState?a.getState():{};a.push({event:e,eventInfo:{...o,...r}})})}function L(e,r){const t=G(r),a=M(e,r);l(d.ORDER_CONTEXT,{...t}),l(d.SHOPPING_CART_CONTEXT,{...a}),I(b.PLACE_ORDER)}const S=`
215
4
  mutation PLACE_ORDER_MUTATION($cartId: String!) {
216
5
  placeOrder(input: { cart_id: $cartId }) {
217
6
  errors {
@@ -248,11 +37,11 @@ ${y}
248
37
  product_sku
249
38
  product_name
250
39
  order_item {
251
- ...OrderItemDetails
40
+ ...ORDER_ITEM_DETAILS_FRAGMENT
252
41
  ... on GiftCardOrderItem {
253
- ...GiftCardDetails
42
+ ...GIFT_CARD_DETAILS_FRAGMENT
254
43
  product {
255
- ...ProductDetails
44
+ ...PRODUCT_DETAILS_FRAGMENT
256
45
  }
257
46
  }
258
47
  }
@@ -263,20 +52,20 @@ ${y}
263
52
  type
264
53
  }
265
54
  shipping_address {
266
- ...AddressesList
55
+ ...ADDRESS_FRAGMENT
267
56
  }
268
57
  billing_address {
269
- ...AddressesList
58
+ ...ADDRESS_FRAGMENT
270
59
  }
271
60
  items {
272
- ...OrderItemDetails
61
+ ...ORDER_ITEM_DETAILS_FRAGMENT
273
62
  ... on BundleOrderItem {
274
- ...BundleOrderItemDetails
63
+ ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT
275
64
  }
276
65
  ... on GiftCardOrderItem {
277
- ...GiftCardDetails
66
+ ...GIFT_CARD_DETAILS_FRAGMENT
278
67
  product {
279
- ...ProductDetails
68
+ ...PRODUCT_DETAILS_FRAGMENT
280
69
  }
281
70
  }
282
71
  ... on DownloadableOrderItem {
@@ -288,16 +77,16 @@ ${y}
288
77
  }
289
78
  }
290
79
  total {
291
- ...OrderSummary
80
+ ...ORDER_SUMMARY_FRAGMENT
292
81
  }
293
82
  }
294
83
  }
295
84
  }
296
- ${u}
297
- ${m}
298
- ${p}
299
- ${c}
300
- ${_}
301
- ${O}
85
+ ${R}
86
+ ${A}
302
87
  ${D}
303
- `,ee=async e=>{if(!e)throw new Error("No cart ID found");return i(q,{variables:{cartId:e}}).then(t=>{var a;(a=t.errors)!=null&&a.length&&I(t.errors);const r=S(t);return r&&(n.emit("order/placed",r),n.emit("cart/reset",void 0),U(e,r)),r}).catch(l)};export{ae as cancelOrder,Z as config,i as fetchGraphQl,pe as getAttributesForm,_e as getAttributesList,de as getConfig,he as getCustomer,Ee as getCustomerOrdersReturn,Re as getGuestOrder,k as getOrderDetailsById,ye as getStoreConfig,x as guestOrderByToken,C as initialize,ee as placeOrder,ne as removeFetchGraphQlHeader,ge as reorderItems,se as requestGuestOrderCancel,Oe as requestReturn,ie as setEndpoint,le as setFetchGraphQlHeader,ue as setFetchGraphQlHeaders};
88
+ ${g}
89
+ ${O}
90
+ ${h}
91
+ ${C}
92
+ `,k=async e=>{if(!e)throw new Error("No cart ID found");return _(S,{variables:{cartId:e}}).then(r=>{var a;(a=r.errors)!=null&&a.length&&T(r.errors);const t=N(r);return t&&(u.emit("order/placed",t),u.emit("cart/reset",void 0),L(e,t)),t}).catch(f)};export{H as cancelOrder,pt as config,_ as fetchGraphQl,W as getAttributesForm,tt as getAttributesList,V as getConfig,at as getCustomer,st as getCustomerOrdersReturn,ot as getGuestOrder,ct as getOrderDetailsById,Et as getStoreConfig,ut as guestOrderByToken,dt as initialize,k as placeOrder,Y as removeFetchGraphQlHeader,Tt as reorderItems,X as requestGuestOrderCancel,et as requestReturn,z as setEndpoint,j as setFetchGraphQlHeader,J as setFetchGraphQlHeaders};
@@ -0,0 +1,99 @@
1
+ /*! Copyright 2024 Adobe
2
+ All Rights Reserved. */
3
+ import{P as _,a as e,G as E,O as R,B as t,b as r,A as T,R as a}from"./initialize.js";const d=`
4
+ fragment GUEST_ORDER_FRAGMENT on CustomerOrder {
5
+ email
6
+ id
7
+ number
8
+ order_date
9
+ order_status_change_date
10
+ status
11
+ token
12
+ carrier
13
+ shipping_method
14
+ printed_card_included
15
+ gift_receipt_included
16
+ available_actions
17
+ is_virtual
18
+ items_eligible_for_return {
19
+ ...ORDER_ITEM_DETAILS_FRAGMENT
20
+ }
21
+ returns {
22
+ ...RETURNS_FRAGMENT
23
+ }
24
+ payment_methods {
25
+ name
26
+ type
27
+ }
28
+ applied_coupons {
29
+ code
30
+ }
31
+ shipments {
32
+ id
33
+ tracking {
34
+ title
35
+ number
36
+ carrier
37
+ }
38
+ comments {
39
+ message
40
+ timestamp
41
+ }
42
+ items {
43
+ __typename
44
+ id
45
+ product_sku
46
+ product_name
47
+ order_item {
48
+ ...ORDER_ITEM_DETAILS_FRAGMENT
49
+ ... on GiftCardOrderItem {
50
+ ...GIFT_CARD_DETAILS_FRAGMENT
51
+ product {
52
+ ...PRODUCT_DETAILS_FRAGMENT
53
+ }
54
+ }
55
+ }
56
+ }
57
+ }
58
+ payment_methods {
59
+ name
60
+ type
61
+ }
62
+ shipping_address {
63
+ ...ADDRESS_FRAGMENT
64
+ }
65
+ billing_address {
66
+ ...ADDRESS_FRAGMENT
67
+ }
68
+ items {
69
+ ...ORDER_ITEM_DETAILS_FRAGMENT
70
+ ... on BundleOrderItem {
71
+ ...BUNDLE_ORDER_ITEM_DETAILS_FRAGMENT
72
+ }
73
+ ... on GiftCardOrderItem {
74
+ ...GIFT_CARD_DETAILS_FRAGMENT
75
+ product {
76
+ ...PRODUCT_DETAILS_FRAGMENT
77
+ }
78
+ }
79
+ ... on DownloadableOrderItem {
80
+ product_name
81
+ downloadable_links {
82
+ sort_order
83
+ title
84
+ }
85
+ }
86
+ }
87
+ total {
88
+ ...ORDER_SUMMARY_FRAGMENT
89
+ }
90
+ }
91
+ ${_}
92
+ ${e}
93
+ ${E}
94
+ ${R}
95
+ ${t}
96
+ ${r}
97
+ ${T}
98
+ ${a}
99
+ `;export{d as G};
@@ -34,7 +34,7 @@ import{h as i}from"./network-error.js";import{f as u,h as s}from"./fetch-graphql
34
34
  }
35
35
  `,_=`
36
36
  query GET_ATTRIBUTES_FORM_SHORT {
37
- attributesForm(formCode: "customer_register_address") {
37
+ attributesForm(formCode: "customer_register_address") {
38
38
  items {
39
39
  frontend_input
40
40
  label
@@ -1,21 +1,21 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{h as e}from"./network-error.js";import{R,P as E,a as _,G as T,O as s,t as o}from"./transform-customer-orders-returns.js";import{f as c}from"./fetch-graphql.js";const u=`
4
- query GET_CUSTOMER_ORDERS_RETURN($pageSize: Int) {
5
- customer {
6
- returns(pageSize: $pageSize) {
7
- page_info {
8
- page_size
9
- total_pages
10
- current_page
3
+ import{h as R}from"./network-error.js";import{R as E,P as T,a as _,G as c,O as s,t as o}from"./initialize.js";import{f as n}from"./fetch-graphql.js";const u=`
4
+ query GET_CUSTOMER_ORDERS_RETURN($currentPage: Int, $pageSize: Int) {
5
+ customer {
6
+ returns(currentPage: $currentPage, pageSize: $pageSize) {
7
+ page_info {
8
+ page_size
9
+ total_pages
10
+ current_page
11
+ }
12
+ ...RETURNS_FRAGMENT
13
+ }
11
14
  }
12
- ...OrderReturns
13
15
  }
14
- }
15
- }
16
- ${R}
17
- ${E}
18
- ${_}
19
- ${T}
20
- ${s}
21
- `,G=async(t=10)=>await c(u,{method:"GET",cache:"force-cache",variables:{pageSize:t}}).then(r=>{var a;return o((a=r==null?void 0:r.data)==null?void 0:a.customer.returns)}).catch(e);export{G as g};
16
+ ${E}
17
+ ${T}
18
+ ${_}
19
+ ${c}
20
+ ${s}
21
+ `,G=async(e=10,t=1)=>await n(u,{method:"GET",cache:"force-cache",variables:{pageSize:e,currentPage:t}}).then(r=>{var a;return o((a=r==null?void 0:r.data)==null?void 0:a.customer.returns)}).catch(R);export{G as g};
@@ -1,11 +1,18 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{h}from"./network-error.js";import{f,h as l}from"./fetch-graphql.js";import{a as O}from"./getGuestOrder.graphql.js";import{b as i}from"./transform-customer-orders-returns.js";const T=t=>{var a,m,r,c,u,d;return{email:((m=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:m.email)||"",firstname:((c=(r=t==null?void 0:t.data)==null?void 0:r.customer)==null?void 0:c.firstname)||"",lastname:((d=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:d.lastname)||""}},E=(t,a)=>{var r,c;if(!((r=t==null?void 0:t.data)!=null&&r.guestOrder))return null;const m=(c=t==null?void 0:t.data)==null?void 0:c.guestOrder;return i(m,a)},k=(t,a)=>{var r,c;if(!((r=t==null?void 0:t.data)!=null&&r.guestOrderByToken))return null;const m=(c=t==null?void 0:t.data)==null?void 0:c.guestOrderByToken;return i(m,a)},g=`
3
+ import{h as E}from"./network-error.js";import{f as i,h}from"./fetch-graphql.js";import{G as n}from"./GurestOrderFragment.graphql.js";import{f as o}from"./initialize.js";const G=t=>{var a,r,m,c,u,e;return{email:((r=(a=t==null?void 0:t.data)==null?void 0:a.customer)==null?void 0:r.email)||"",firstname:((c=(m=t==null?void 0:t.data)==null?void 0:m.customer)==null?void 0:c.firstname)||"",lastname:((e=(u=t==null?void 0:t.data)==null?void 0:u.customer)==null?void 0:e.lastname)||""}},f=`
4
4
  query GET_CUSTOMER {
5
5
  customer {
6
- firstname
7
- lastname
8
- email
6
+ firstname
7
+ lastname
8
+ email
9
9
  }
10
10
  }
11
- `,B=async()=>await f(g,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?l(t.errors):T(t)}).catch(h),C=async t=>await f(O,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>E(a)).catch(h);export{C as a,B as g,k as t};
11
+ `,_=async()=>await i(f,{method:"GET",cache:"force-cache"}).then(t=>{var a;return(a=t.errors)!=null&&a.length?h(t.errors):G(t)}).catch(E),T=`
12
+ query GET_GUEST_ORDER($input: GuestOrderInformationInput!) {
13
+ guestOrder(input: $input) {
14
+ ...GUEST_ORDER_FRAGMENT
15
+ }
16
+ }
17
+ ${n}
18
+ `,S=async t=>await i(T,{method:"GET",cache:"no-cache",variables:{input:t}}).then(a=>o(a)).catch(E);export{S as a,_ as g};
@@ -1,19 +1,19 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
3
  import{f as s,h as i}from"./fetch-graphql.js";function o(e){return e?{baseMediaUrl:e.base_media_url,orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons,shoppingCartDisplayPrice:e.orders_invoices_credit_memos_display_price,shoppingOrdersDisplaySubtotal:e.orders_invoices_credit_memos_display_subtotal,shoppingOrdersDisplayShipping:e.orders_invoices_credit_memos_display_shipping_amount,shoppingOrdersDisplayGrandTotal:e.orders_invoices_credit_memos_display_grandtotal,shoppingOrdersDisplayFullSummary:e.orders_invoices_credit_memos_display_full_summary,shoppingOrdersDisplayZeroTax:e.orders_invoices_credit_memos_display_zero_tax}:null}const _=`
4
- query STORE_CONFIG_QUERY {
5
- storeConfig {
6
- order_cancellation_enabled
7
- order_cancellation_reasons {
4
+ query STORE_CONFIG_QUERY {
5
+ storeConfig {
6
+ order_cancellation_enabled
7
+ order_cancellation_reasons {
8
8
  description
9
+ }
10
+ base_media_url
11
+ orders_invoices_credit_memos_display_price
12
+ orders_invoices_credit_memos_display_shipping_amount
13
+ orders_invoices_credit_memos_display_subtotal
14
+ orders_invoices_credit_memos_display_grandtotal
15
+ orders_invoices_credit_memos_display_full_summary
16
+ orders_invoices_credit_memos_display_zero_tax
9
17
  }
10
- base_media_url
11
- orders_invoices_credit_memos_display_price
12
- orders_invoices_credit_memos_display_shipping_amount
13
- orders_invoices_credit_memos_display_subtotal
14
- orders_invoices_credit_memos_display_grandtotal
15
- orders_invoices_credit_memos_display_full_summary
16
- orders_invoices_credit_memos_display_zero_tax
17
18
  }
18
- }
19
19
  `,l=async()=>s(_,{method:"GET",cache:"force-cache"}).then(({errors:e,data:r})=>e?i(e):o(r.storeConfig));export{l as g};