@dropins/storefront-purchase-order 1.1.1 → 1.2.0-beta.0

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 (76) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/api.js +784 -6
  3. package/api.js.map +1 -1
  4. package/chunks/components.js +4 -0
  5. package/chunks/components.js.map +1 -0
  6. package/containers/ApprovalRuleDetails.js +1 -1
  7. package/containers/ApprovalRuleDetails.js.map +1 -1
  8. package/containers/ApprovalRuleForm.js +1 -1
  9. package/containers/ApprovalRuleForm.js.map +1 -1
  10. package/containers/ApprovalRulesList.js +1 -1
  11. package/containers/ApprovalRulesList.js.map +1 -1
  12. package/containers/CompanyPurchaseOrders.js +1 -1
  13. package/containers/CompanyPurchaseOrders.js.map +1 -1
  14. package/containers/CustomerPurchaseOrders.js +1 -1
  15. package/containers/CustomerPurchaseOrders.js.map +1 -1
  16. package/containers/PurchaseOrderApprovalFlow.js +1 -1
  17. package/containers/PurchaseOrderApprovalFlow.js.map +1 -1
  18. package/containers/PurchaseOrderCommentForm.js +1 -1
  19. package/containers/PurchaseOrderCommentForm.js.map +1 -1
  20. package/containers/PurchaseOrderCommentsList.js +1 -1
  21. package/containers/PurchaseOrderCommentsList.js.map +1 -1
  22. package/containers/PurchaseOrderConfirmation.js +1 -1
  23. package/containers/PurchaseOrderConfirmation.js.map +1 -1
  24. package/containers/PurchaseOrderHistoryLog.js +1 -1
  25. package/containers/PurchaseOrderHistoryLog.js.map +1 -1
  26. package/containers/PurchaseOrderStatus.js +1 -1
  27. package/containers/PurchaseOrderStatus.js.map +1 -1
  28. package/containers/RequireApprovalPurchaseOrders.js +1 -1
  29. package/containers/RequireApprovalPurchaseOrders.js.map +1 -1
  30. package/package.json +1 -1
  31. package/render.js +2 -3
  32. package/render.js.map +1 -1
  33. package/chunks/FormLoader.js +0 -4
  34. package/chunks/FormLoader.js.map +0 -1
  35. package/chunks/PurchaseOrderHistoryLogContent.js +0 -4
  36. package/chunks/PurchaseOrderHistoryLogContent.js.map +0 -1
  37. package/chunks/PurchaseOrdersHeader.js +0 -4
  38. package/chunks/PurchaseOrdersHeader.js.map +0 -1
  39. package/chunks/PurchaseOrdersTableActions.js +0 -4
  40. package/chunks/PurchaseOrdersTableActions.js.map +0 -1
  41. package/chunks/addPurchaseOrderComment.js +0 -36
  42. package/chunks/addPurchaseOrderComment.js.map +0 -1
  43. package/chunks/case-converter.js +0 -4
  44. package/chunks/case-converter.js.map +0 -1
  45. package/chunks/currencyInfo.js +0 -124
  46. package/chunks/currencyInfo.js.map +0 -1
  47. package/chunks/fetch-error.js +0 -4
  48. package/chunks/fetch-error.js.map +0 -1
  49. package/chunks/formatDate.js +0 -4
  50. package/chunks/formatDate.js.map +0 -1
  51. package/chunks/getPurchaseOrderApprovalRule.js +0 -45
  52. package/chunks/getPurchaseOrderApprovalRule.js.map +0 -1
  53. package/chunks/getPurchaseOrderApprovalRules.js +0 -75
  54. package/chunks/getPurchaseOrderApprovalRules.js.map +0 -1
  55. package/chunks/getPurchaseOrders.js +0 -29
  56. package/chunks/getPurchaseOrders.js.map +0 -1
  57. package/chunks/initialize.js +0 -13
  58. package/chunks/initialize.js.map +0 -1
  59. package/chunks/pageSize.config.js +0 -4
  60. package/chunks/pageSize.config.js.map +0 -1
  61. package/chunks/permissions.js +0 -4
  62. package/chunks/permissions.js.map +0 -1
  63. package/chunks/placeOrderForPurchaseOrder.js +0 -39
  64. package/chunks/placeOrderForPurchaseOrder.js.map +0 -1
  65. package/chunks/rejectPurchaseOrders.js +0 -30
  66. package/chunks/rejectPurchaseOrders.js.map +0 -1
  67. package/chunks/transform-purchase-order-approval-rule.js +0 -4
  68. package/chunks/transform-purchase-order-approval-rule.js.map +0 -1
  69. package/chunks/transform-purchase-order.js +0 -423
  70. package/chunks/transform-purchase-order.js.map +0 -1
  71. package/chunks/useCustomerRolePermissions.js +0 -4
  72. package/chunks/useCustomerRolePermissions.js.map +0 -1
  73. package/chunks/usePurchaseOrderData.js +0 -4
  74. package/chunks/usePurchaseOrderData.js.map +0 -1
  75. package/chunks/usePurchaseOrders.js +0 -4
  76. package/chunks/usePurchaseOrders.js.map +0 -1
package/api.js CHANGED
@@ -1,6 +1,473 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{c as z,g as L,i as Q}from"./chunks/initialize.js";import{f as n,h as i,a as h}from"./chunks/fetch-error.js";import{g as B,r as J,s as K,b as W,c as X}from"./chunks/fetch-error.js";import{a as Z,r as rr}from"./chunks/rejectPurchaseOrders.js";import{c as sr,p as ar}from"./chunks/placeOrderForPurchaseOrder.js";import{P as S,t as D}from"./chunks/transform-purchase-order.js";import{a as cr}from"./chunks/addPurchaseOrderComment.js";import{a as ur,c as pr,g as nr,u as ir}from"./chunks/currencyInfo.js";import{d as dr,g as lr}from"./chunks/getPurchaseOrderApprovalRules.js";import{g as Pr}from"./chunks/getPurchaseOrders.js";import{events as I}from"@dropins/tools/event-bus.js";import{g as gr}from"./chunks/getPurchaseOrderApprovalRule.js";import{P as Rr}from"./chunks/permissions.js";import"@dropins/tools/lib.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-purchase-order-approval-rule.js";import"./chunks/case-converter.js";const v=`
3
+ import{events as $}from"@dropins/tools/event-bus.js";import{Initializer as Pe,getGlobalLocale as ve}from"@dropins/tools/lib.js";import{FetchGraphQL as Se}from"@dropins/tools/fetch-graphql.js";const{setEndpoint:lr,setFetchGraphQlHeader:_r,removeFetchGraphQlHeader:cr,setFetchGraphQlHeaders:sr,fetchGraphQl:v,getConfig:or}=new Se().getMethods(),S=e=>{const a=e instanceof DOMException&&(e==null?void 0:e.name)==="AbortError",u=(e==null?void 0:e.name)==="PlaceOrderError";throw!a&&!u&&$.emit("purchase-order/error",{source:"purchase-order",type:"network",error:e.message}),e},T=e=>{var t,i;if(e.length===1&&((i=(t=e[0])==null?void 0:t.path)==null?void 0:i.length)>0){const s=e[0].path[e[0].path.length-1];if(["applied_coupons","applied_gift_cards","available_payment_methods"].includes(s))return}const u=e.map(s=>s.message).join(" ");throw Error(u)},Te=`
4
+ fragment PURCHASE_ORDER_QUOTE_FRAGMENT on Cart {
5
+ __typename
6
+ id
7
+ email
8
+ is_virtual
9
+ total_quantity
10
+ applied_coupons {
11
+ code
12
+ }
13
+ applied_gift_cards {
14
+ code
15
+ applied_balance {
16
+ value
17
+ currency
18
+ }
19
+ current_balance {
20
+ value
21
+ currency
22
+ }
23
+ expiration_date
24
+ }
25
+ applied_reward_points {
26
+ money {
27
+ value
28
+ currency
29
+ }
30
+ points
31
+ }
32
+ applied_store_credit {
33
+ applied_balance {
34
+ value
35
+ currency
36
+ }
37
+ current_balance {
38
+ value
39
+ currency
40
+ }
41
+ }
42
+ available_gift_wrappings {
43
+ uid
44
+ design
45
+ price {
46
+ value
47
+ currency
48
+ }
49
+ image {
50
+ url
51
+ label
52
+ }
53
+ }
54
+ gift_message {
55
+ from
56
+ to
57
+ message
58
+ }
59
+ gift_receipt_included
60
+ gift_wrapping {
61
+ uid
62
+ design
63
+ price {
64
+ value
65
+ currency
66
+ }
67
+ image {
68
+ url
69
+ label
70
+ }
71
+ }
72
+ printed_card_included
73
+ available_payment_methods {
74
+ code
75
+ title
76
+ is_deferred
77
+ }
78
+ selected_payment_method {
79
+ code
80
+ title
81
+ }
82
+ billing_address {
83
+ city
84
+ company
85
+ country {
86
+ code
87
+ label
88
+ }
89
+ firstname
90
+ lastname
91
+ postcode
92
+ region {
93
+ code
94
+ label
95
+ }
96
+ street
97
+ telephone
98
+ custom_attributes {
99
+ code
100
+ }
101
+ fax
102
+ id
103
+ middlename
104
+ prefix
105
+ suffix
106
+ uid
107
+ vat_id
108
+ }
109
+ shipping_addresses {
110
+ city
111
+ company
112
+ country {
113
+ code
114
+ label
115
+ }
116
+ firstname
117
+ lastname
118
+ postcode
119
+ region {
120
+ code
121
+ label
122
+ }
123
+ street
124
+ telephone
125
+ custom_attributes {
126
+ code
127
+ }
128
+ fax
129
+ id
130
+ middlename
131
+ prefix
132
+ suffix
133
+ uid
134
+ vat_id
135
+ available_shipping_methods {
136
+ amount {
137
+ value
138
+ currency
139
+ }
140
+ carrier_code
141
+ carrier_title
142
+ method_code
143
+ method_title
144
+ }
145
+ selected_shipping_method {
146
+ amount {
147
+ value
148
+ currency
149
+ }
150
+ carrier_code
151
+ carrier_title
152
+ method_code
153
+ method_title
154
+ }
155
+ }
156
+ rules {
157
+ uid
158
+ }
159
+ itemsV2(pageSize: 100, currentPage: 1) {
160
+ items {
161
+ uid
162
+ quantity
163
+ product {
164
+ __typename
165
+ uid
166
+ name
167
+ sku
168
+ url_key
169
+ canonical_url
170
+ stock_status
171
+ only_x_left_in_stock
172
+ image {
173
+ url
174
+ label
175
+ }
176
+ small_image {
177
+ url
178
+ label
179
+ }
180
+ thumbnail {
181
+ url
182
+ label
183
+ }
184
+ price_range {
185
+ maximum_price {
186
+ regular_price {
187
+ value
188
+ currency
189
+ }
190
+ final_price {
191
+ value
192
+ currency
193
+ }
194
+ }
195
+ }
196
+ }
197
+ prices {
198
+ price {
199
+ value
200
+ currency
201
+ }
202
+ price_including_tax {
203
+ value
204
+ currency
205
+ }
206
+ original_item_price {
207
+ value
208
+ currency
209
+ }
210
+ original_row_total {
211
+ value
212
+ currency
213
+ }
214
+ row_total {
215
+ value
216
+ currency
217
+ }
218
+ row_total_including_tax {
219
+ value
220
+ currency
221
+ }
222
+ total_item_discount {
223
+ value
224
+ currency
225
+ }
226
+ discounts {
227
+ label
228
+ amount {
229
+ value
230
+ currency
231
+ }
232
+ }
233
+ fixed_product_taxes {
234
+ label
235
+ amount {
236
+ value
237
+ currency
238
+ }
239
+ }
240
+ }
241
+ ... on SimpleCartItem {
242
+ customizable_options {
243
+ label
244
+ values {
245
+ label
246
+ value
247
+ }
248
+ }
249
+ }
250
+ ... on ConfigurableCartItem {
251
+ configurable_options {
252
+ option_label
253
+ value_label
254
+ }
255
+ }
256
+ ... on BundleCartItem {
257
+ bundle_options {
258
+ uid
259
+ label
260
+ type
261
+ values {
262
+ uid
263
+ label
264
+ quantity
265
+ }
266
+ }
267
+ }
268
+ ... on DownloadableCartItem {
269
+ links {
270
+ uid
271
+ title
272
+ }
273
+ }
274
+ ... on GiftCardCartItem {
275
+ sender_name
276
+ sender_email
277
+ recipient_name
278
+ recipient_email
279
+ message
280
+ amount {
281
+ value
282
+ currency
283
+ }
284
+ }
285
+ errors {
286
+ code
287
+ message
288
+ }
289
+ is_available
290
+ max_qty
291
+ min_qty
292
+ not_available_message
293
+ note_from_buyer {
294
+ note_uid
295
+ note
296
+ created_at
297
+ }
298
+ note_from_seller {
299
+ note_uid
300
+ note
301
+ created_at
302
+ }
303
+ }
304
+ page_info {
305
+ current_page
306
+ page_size
307
+ total_pages
308
+ }
309
+ total_count
310
+ }
311
+ prices {
312
+ grand_total {
313
+ value
314
+ currency
315
+ }
316
+ grand_total_excluding_tax {
317
+ value
318
+ currency
319
+ }
320
+ subtotal_excluding_tax {
321
+ value
322
+ currency
323
+ }
324
+ subtotal_including_tax {
325
+ value
326
+ currency
327
+ }
328
+ subtotal_with_discount_excluding_tax {
329
+ value
330
+ currency
331
+ }
332
+ applied_taxes {
333
+ label
334
+ amount {
335
+ value
336
+ currency
337
+ }
338
+ }
339
+ discounts {
340
+ label
341
+ amount {
342
+ value
343
+ currency
344
+ }
345
+ }
346
+ gift_options {
347
+ gift_wrapping_for_items {
348
+ value
349
+ currency
350
+ }
351
+ gift_wrapping_for_items_incl_tax {
352
+ value
353
+ currency
354
+ }
355
+ gift_wrapping_for_order {
356
+ value
357
+ currency
358
+ }
359
+ gift_wrapping_for_order_incl_tax {
360
+ value
361
+ currency
362
+ }
363
+ printed_card {
364
+ value
365
+ currency
366
+ }
367
+ printed_card_incl_tax {
368
+ value
369
+ currency
370
+ }
371
+ }
372
+ }
373
+ }
374
+ `,F=`
375
+ fragment PURCHASE_ORDERS_FRAGMENT on PurchaseOrder {
376
+ __typename
377
+ uid
378
+ number
379
+ status
380
+ available_actions
381
+ approval_flow {
382
+ events {
383
+ name
384
+ role
385
+ message
386
+ status
387
+ updated_at
388
+ }
389
+ rule_name
390
+ }
391
+ comments {
392
+ created_at
393
+ author {
394
+ firstname
395
+ lastname
396
+ email
397
+ }
398
+ text
399
+ }
400
+ created_at
401
+ updated_at
402
+ created_by {
403
+ firstname
404
+ lastname
405
+ email
406
+ }
407
+ history_log {
408
+ message
409
+ created_at
410
+ activity
411
+ __typename
412
+ uid
413
+ }
414
+ order {
415
+ number
416
+ }
417
+ quote {
418
+ ...PURCHASE_ORDER_QUOTE_FRAGMENT
419
+ }
420
+ }
421
+ ${Te}
422
+ `,Oe=`
423
+ query GET_PURCHASE_ORDER($uid: ID!) {
424
+ customer {
425
+ purchase_order(uid: $uid) {
426
+ ...PURCHASE_ORDERS_FRAGMENT
427
+ }
428
+ }
429
+ }
430
+ ${F}
431
+ `,M=e=>{var u,t,i,s,E,p,c,y;return{typename:(e==null?void 0:e.__typename)??"",uid:(e==null?void 0:e.uid)??"",number:(e==null?void 0:e.number)??"",status:(e==null?void 0:e.status)??"",availableActions:(e==null?void 0:e.available_actions)??[],approvalFlow:(u=e==null?void 0:e.approval_flow)!=null&&u.length?e.approval_flow.map(o=>{var h;return{ruleName:(o==null?void 0:o.rule_name)??"",events:((h=o==null?void 0:o.events)==null?void 0:h.map(f=>({message:(f==null?void 0:f.message)??"",name:(f==null?void 0:f.name)??"",role:(f==null?void 0:f.role)??"",status:(f==null?void 0:f.status)??"",updatedAt:(f==null?void 0:f.updated_at)??""})))??[]}}):[],comments:((t=e==null?void 0:e.comments)==null?void 0:t.map(o=>{var h,f,U;return{uid:(o==null?void 0:o.uid)??"",createdAt:(o==null?void 0:o.created_at)??"",author:{firstname:((h=o==null?void 0:o.author)==null?void 0:h.firstname)??"",lastname:((f=o==null?void 0:o.author)==null?void 0:f.lastname)??"",email:((U=o==null?void 0:o.author)==null?void 0:U.email)??""},text:(o==null?void 0:o.text)??""}}))??[],createdAt:(e==null?void 0:e.created_at)??"",updatedAt:(e==null?void 0:e.updated_at)??"",createdBy:{firstname:((i=e==null?void 0:e.created_by)==null?void 0:i.firstname)??"",lastname:((s=e==null?void 0:e.created_by)==null?void 0:s.lastname)??"",email:((E=e==null?void 0:e.created_by)==null?void 0:E.email)??""},historyLog:((p=e==null?void 0:e.history_log)==null?void 0:p.map(o=>({activity:(o==null?void 0:o.activity)??"",createdAt:(o==null?void 0:o.created_at)??"",message:(o==null?void 0:o.message)??"",uid:(o==null?void 0:o.uid)??""})))??[],quote:Ue(e==null?void 0:e.quote),order:{id:((c=e==null?void 0:e.order)==null?void 0:c.id)??"",orderNumber:((y=e==null?void 0:e.order)==null?void 0:y.number)??""}}};function Ue(e){var X,J,Z,q,ee,re,ne,te,ae,ie,ue,le,_e,ce,se;if(!e)return null;const a=n=>n||0,u=n=>({firstName:(n==null?void 0:n.firstname)??"",lastName:(n==null?void 0:n.lastname)??"",middleName:(n==null?void 0:n.middlename)??""}),t=n=>{var R,O,d,D;const{firstName:l,lastName:_,middleName:g}=u(n);return{firstName:l,lastName:_,middleName:g,city:(n==null?void 0:n.city)??"",company:(n==null?void 0:n.company)??"",country:((R=n==null?void 0:n.country)==null?void 0:R.label)??"",countryCode:((O=n==null?void 0:n.country)==null?void 0:O.code)??"",fax:(n==null?void 0:n.fax)??"",postCode:(n==null?void 0:n.postcode)??"",prefix:(n==null?void 0:n.prefix)??"",region:((d=n==null?void 0:n.region)==null?void 0:d.label)??"",regionId:((D=n==null?void 0:n.region)==null?void 0:D.code)??"",street:(n==null?void 0:n.street)??[],suffix:(n==null?void 0:n.suffix)??"",telephone:(n==null?void 0:n.telephone)??"",vatId:(n==null?void 0:n.vat_id)??"",customAttributes:(n==null?void 0:n.custom_attributes)??[]}},i=n=>{var l,_,g,R,O,d,D,m,I,x;return{__typename:(n==null?void 0:n.__typename)||"",uid:(n==null?void 0:n.uid)||"",onlyXLeftInStock:(n==null?void 0:n.only_x_left_in_stock)??0,stockStatus:(n==null?void 0:n.stock_status)??"",priceRange:{maximumPrice:{regularPrice:{currency:((g=(_=(l=n==null?void 0:n.price_range)==null?void 0:l.maximum_price)==null?void 0:_.regular_price)==null?void 0:g.currency)??"",value:((d=(O=(R=n==null?void 0:n.price_range)==null?void 0:R.maximum_price)==null?void 0:O.regular_price)==null?void 0:d.value)??0}}},canonicalUrl:(n==null?void 0:n.canonical_url)??"",urlKey:(n==null?void 0:n.url_key)||"",id:(n==null?void 0:n.uid)??"",name:(n==null?void 0:n.name)||"",sku:(n==null?void 0:n.sku)||"",image:((D=n==null?void 0:n.image)==null?void 0:D.url)||"",imageAlt:((m=n==null?void 0:n.image)==null?void 0:m.label)||"",productType:(n==null?void 0:n.__typename)||"",thumbnail:{label:((I=n==null?void 0:n.thumbnail)==null?void 0:I.label)||"",url:((x=n==null?void 0:n.thumbnail)==null?void 0:x.url)||""}}},s=n=>{if(!n||!("configurable_options"in n))return;const l={};for(const _ of n.configurable_options)l[_.option_label]=_.value_label;return l},E=n=>{const l=n==null?void 0:n.map(g=>({uid:g.uid,label:g.label,values:g.values.map(R=>R.product_name).join(", ")})),_={};return l==null||l.forEach(g=>{_[g.label]=g.values}),Object.keys(_).length>0?_:null},p=n=>(n==null?void 0:n.length)>0?{count:n.length,result:n.map(l=>l.title).join(", ")}:null,c=n=>{var l,_,g,R,O;return{senderName:((l=n==null?void 0:n.gift_card)==null?void 0:l.sender_name)||"",senderEmail:((_=n==null?void 0:n.gift_card)==null?void 0:_.sender_email)||"",recipientEmail:((g=n==null?void 0:n.gift_card)==null?void 0:g.recipient_email)||"",recipientName:((R=n==null?void 0:n.gift_card)==null?void 0:R.recipient_name)||"",message:((O=n==null?void 0:n.gift_card)==null?void 0:O.message)||""}},y=n=>{var l,_,g;return{senderName:((l=n==null?void 0:n.gift_message)==null?void 0:l.from)??"",recipientName:((_=n==null?void 0:n.gift_message)==null?void 0:_.to)??"",message:((g=n==null?void 0:n.gift_message)==null?void 0:g.message)??""}},o=n=>{var l,_,g,R,O,d,D,m,I,x,H;return{design:((l=n==null?void 0:n.gift_wrapping)==null?void 0:l.design)??"",uid:((_=n==null?void 0:n.gift_wrapping)==null?void 0:_.uid)??"",selected:!!((g=n==null?void 0:n.gift_wrapping)!=null&&g.uid),image:{url:((O=(R=n==null?void 0:n.gift_wrapping)==null?void 0:R.image)==null?void 0:O.url)??"",label:((D=(d=n==null?void 0:n.gift_wrapping)==null?void 0:d.image)==null?void 0:D.label)??""},price:{currency:((I=(m=n==null?void 0:n.gift_wrapping)==null?void 0:m.price)==null?void 0:I.currency)??"USD",value:((H=(x=n==null?void 0:n.gift_wrapping)==null?void 0:x.price)==null?void 0:H.value)??0}}},h=n=>({currency:(n==null?void 0:n.currency)??"USD",value:(n==null?void 0:n.value)??0}),f=(n,l)=>{const _=n==null?void 0:n.price,g=n==null?void 0:n.priceIncludingTax,R=n==null?void 0:n.originalPrice,O=!1,d=O?R==null?void 0:R.value:g==null?void 0:g.value,D={originalPrice:R,baseOriginalPrice:{value:d,currency:R==null?void 0:R.currency},baseDiscountedPrice:{value:g==null?void 0:g.value,currency:g==null?void 0:g.currency},baseExcludingTax:{value:_==null?void 0:_.value,currency:_==null?void 0:_.currency}},m={originalPrice:R,baseOriginalPrice:{value:R==null?void 0:R.value,currency:g==null?void 0:g.currency},baseDiscountedPrice:{value:l==null?void 0:l.value,currency:_==null?void 0:_.currency},baseExcludingTax:{value:_==null?void 0:_.value,currency:_==null?void 0:_.currency}},I={singleItemPrice:{value:O?R.value:g.value,currency:g.currency},baseOriginalPrice:{value:d,currency:g.currency},baseDiscountedPrice:{value:g.value,currency:g.currency}};return{includeAndExcludeTax:D,excludeTax:m,includeTax:I}},U=n=>{var D,m,I,x,H,oe,pe,Ee,ge,ye,fe;const l=n==null?void 0:n.product,_=n==null?void 0:n.prices,g=a(n==null?void 0:n.quantity),R={price:(_==null?void 0:_.price)??{value:0,currency:"USD"},priceIncludingTax:(_==null?void 0:_.price_including_tax)??{value:0,currency:"USD"},originalPrice:(_==null?void 0:_.original_item_price)??{value:0,currency:"USD"},originalPriceIncludingTax:(_==null?void 0:_.original_item_price)??{value:0,currency:"USD"},discounts:(_==null?void 0:_.discounts)??[]},O=(((D=_==null?void 0:_.original_item_price)==null?void 0:D.value)??0)>(((m=_==null?void 0:_.price)==null?void 0:m.value)??0),d=(_==null?void 0:_.price)??{value:0,currency:"USD"};return{giftMessage:y(n),giftWrappingPrice:h((I=n==null?void 0:n.gift_wrapping)==null?void 0:I.price),productGiftWrapping:[o(n)],taxCalculations:f(R,d),productSalePrice:d,status:n!=null&&n.is_available?"available":"unavailable",currentReturnOrderQuantity:0,eligibleForReturn:!1,productSku:(l==null?void 0:l.sku)??"",type:(l==null?void 0:l.__typename)??"",discounted:O,id:(n==null?void 0:n.uid)??"",productName:(l==null?void 0:l.name)??"",productUrlKey:(l==null?void 0:l.url_key)??"",regularPrice:{value:((oe=(H=(x=l==null?void 0:l.price_range)==null?void 0:x.maximum_price)==null?void 0:H.regular_price)==null?void 0:oe.value)??0,currency:((ge=(Ee=(pe=l==null?void 0:l.price_range)==null?void 0:pe.maximum_price)==null?void 0:Ee.regular_price)==null?void 0:ge.currency)??"USD"},price:d,product:i(l),selectedOptions:(n==null?void 0:n.customizable_options)??[],thumbnail:{label:((ye=l==null?void 0:l.thumbnail)==null?void 0:ye.label)||"",url:((fe=l==null?void 0:l.thumbnail)==null?void 0:fe.url)||""},downloadableLinks:(l==null?void 0:l.__typename)==="DownloadableProduct"&&(n!=null&&n.downloadable_links)?p(n.downloadable_links):null,prices:R,itemPrices:R,bundleOptions:(l==null?void 0:l.__typename)==="BundleProduct"&&(n!=null&&n.bundle_options)?E(n.bundle_options):null,totalInclTax:(_==null?void 0:_.row_total_including_tax)??{value:0,currency:"USD"},priceInclTax:(_==null?void 0:_.price_including_tax)??{value:0,currency:"USD"},total:(_==null?void 0:_.row_total)??{value:0,currency:"USD"},configurableOptions:(l==null?void 0:l.__typename)==="ConfigurableProduct"?s(n):void 0,giftCard:(l==null?void 0:l.__typename)==="GiftCardProduct"?c(n):void 0,quantityCanceled:0,quantityInvoiced:0,quantityOrdered:g,quantityRefunded:0,quantityReturned:0,quantityShipped:0,requestQuantity:0,totalQuantity:g,returnableQuantity:0,quantityReturnRequested:0}},C=n=>({giftWrappingForItems:(n==null?void 0:n.gift_wrapping_for_items)??{value:0,currency:"USD"},giftWrappingForItemsInclTax:(n==null?void 0:n.gift_wrapping_for_items_incl_tax)??{value:0,currency:"USD"},giftWrappingForOrder:(n==null?void 0:n.gift_wrapping_for_order)??{value:0,currency:"USD"},giftWrappingForOrderInclTax:(n==null?void 0:n.gift_wrapping_for_order_incl_tax)??{value:0,currency:"USD"},printedCard:(n==null?void 0:n.printed_card)??{value:0,currency:"USD"},printedCardInclTax:(n==null?void 0:n.printed_card_incl_tax)??{value:0,currency:"USD"}}),L=(n=[])=>!n||n.length===0?[]:n.map(l=>{var _,g;return{code:(l==null?void 0:l.code)??"",appliedBalance:{value:((_=l==null?void 0:l.applied_balance)==null?void 0:_.value)??0,currency:((g=l==null?void 0:l.applied_balance)==null?void 0:g.currency)??"USD"}}}),N=(n=[])=>!n||n.length===0?[]:n.map(l=>{var _,g;return{amount:{value:((_=l==null?void 0:l.amount)==null?void 0:_.value)??0,currency:((g=l==null?void 0:l.amount)==null?void 0:g.currency)??"USD"},rate:(l==null?void 0:l.rate)??0,title:(l==null?void 0:l.title)??(l==null?void 0:l.label)??""}}),b=(X=e==null?void 0:e.shipping_addresses)==null?void 0:X[0],r=e==null?void 0:e.billing_address,P=b==null?void 0:b.selected_shipping_method,w=e==null?void 0:e.selected_payment_method,A=e==null?void 0:e.prices,j=((Z=(J=e==null?void 0:e.itemsV2)==null?void 0:J.items)==null?void 0:Z.map(U))??[],be=j.reduce((n,l)=>n+l.totalQuantity,0),K=P?`${P.carrier_title??""} - ${P.method_title??""}`.trim():"",k=L(e==null?void 0:e.applied_gift_cards);return{giftReceiptIncluded:(e==null?void 0:e.gift_receipt_included)??!1,printedCardIncluded:(e==null?void 0:e.printed_card_included)??!1,giftWrappingOrder:{price:{value:((ee=(q=e==null?void 0:e.gift_wrapping)==null?void 0:q.price)==null?void 0:ee.value)??0,currency:((ne=(re=e==null?void 0:e.gift_wrapping)==null?void 0:re.price)==null?void 0:ne.currency)??"USD"},uid:((te=e==null?void 0:e.gift_wrapping)==null?void 0:te.uid)??""},placeholderImage:"",returnNumber:void 0,id:(e==null?void 0:e.id)??"",orderStatusChangeDate:void 0,number:"",email:(e==null?void 0:e.email)??"",token:void 0,status:"pending",isVirtual:(e==null?void 0:e.is_virtual)??!1,totalQuantity:be,shippingMethod:K,carrier:(P==null?void 0:P.carrier_code)??"",orderDate:"",returns:[],discounts:(A==null?void 0:A.discounts)??[],coupons:(e==null?void 0:e.applied_coupons)??[],payments:[{code:(w==null?void 0:w.code)??"",name:(w==null?void 0:w.title)??""}],shipping:{code:K,amount:((ae=P==null?void 0:P.amount)==null?void 0:ae.value)??0,currency:((ie=P==null?void 0:P.amount)==null?void 0:ie.currency)??"USD"},shipments:[],items:j,totalGiftCard:k.length?k.reduce((n,l)=>{var _,g;return{value:n.value+(((_=l==null?void 0:l.appliedBalance)==null?void 0:_.value)??0),currency:((g=l==null?void 0:l.appliedBalance)==null?void 0:g.currency)??n.currency}},{value:0,currency:((le=(ue=k[0])==null?void 0:ue.appliedBalance)==null?void 0:le.currency)??"USD"}):{value:0,currency:"USD"},grandTotal:(A==null?void 0:A.grand_total)??{value:0,currency:"USD"},grandTotalExclTax:(A==null?void 0:A.grand_total_excluding_tax)??{value:0,currency:"USD"},totalShipping:(P==null?void 0:P.amount)??{value:0,currency:"USD"},subtotalExclTax:(A==null?void 0:A.subtotal_excluding_tax)??{value:0,currency:"USD"},subtotalInclTax:(A==null?void 0:A.subtotal_including_tax)??{value:0,currency:"USD"},totalTax:{value:(((_e=A==null?void 0:A.grand_total)==null?void 0:_e.value)??0)-(((ce=A==null?void 0:A.grand_total_excluding_tax)==null?void 0:ce.value)??0),currency:((se=A==null?void 0:A.grand_total)==null?void 0:se.currency)??"USD"},shippingAddress:b?t(b):null,totalGiftOptions:C(A==null?void 0:A.gift_options),billingAddress:r?t(r):null,availableActions:[],taxes:N(A==null?void 0:A.applied_taxes),appliedGiftCards:k}}const de=async e=>{if(!e||e.trim()==="")throw new Error("Purchase Order UID is required");return v(Oe,{variables:{uid:e}}).then(a=>{var t,i,s;(t=a.errors)!=null&&t.length&&T(a.errors);const u=(s=(i=a.data)==null?void 0:i.customer)==null?void 0:s.purchase_order;if(!u)throw new Error("Failed to get purchase order");return{purchaseOrder:M(u)}}).catch(S)},Ae=async e=>{var u;const a=await de(e);(u=a==null?void 0:a.purchaseOrder)!=null&&u.quote?($.emit("order/data",{...a.purchaseOrder.quote}),$.emit("purchase-order/data",{...a.purchaseOrder})):console.error("Failed to fetch purchase order data.")},Y=new Pe({init:async e=>{const a={};Y.config.setConfig({...a,...e}),typeof(e==null?void 0:e.poRef)=="string"&&e.poRef.trim()!==""&&await Ae(e.poRef)},listeners:()=>[$.on("purchase-order/refresh",async()=>{const e=Y.config.getConfig();typeof(e==null?void 0:e.poRef)=="string"&&e.poRef.trim()!==""&&await Ae(e.poRef)})]}),pr=Y.config,De=`
432
+ mutation APPROVE_PURCHASE_ORDERS($input: PurchaseOrdersActionInput!) {
433
+ approvePurchaseOrders(input: $input) {
434
+ purchase_orders {
435
+ ...PURCHASE_ORDERS_FRAGMENT
436
+ }
437
+ errors {
438
+ message
439
+ type
440
+ }
441
+ }
442
+ }
443
+ ${F}
444
+ `,Er=async e=>{const a=Array.isArray(e)?e:[e];if(!a||a.length===0)throw new Error("Purchase Order UID(s) are required");if(a.some(t=>!t||t.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return v(De,{variables:{input:{purchase_order_uids:a}}}).then(t=>{var s,E,p;(s=t.errors)!=null&&s.length&&T(t.errors);const i=(E=t.data)==null?void 0:E.approvePurchaseOrders;if(!i)throw new Error("Failed to approve purchase orders");return{errors:((i==null?void 0:i.errors)??[]).map(c=>({message:(c==null?void 0:c.message)??"",type:(c==null?void 0:c.type)??""})),purchaseOrders:((p=i==null?void 0:i.purchase_orders)==null?void 0:p.map(c=>M(c)))??[]}}).catch(S)},Ce=`
445
+ mutation CANCEL_PURCHASE_ORDERS($input: PurchaseOrdersActionInput!) {
446
+ cancelPurchaseOrders(input: $input) {
447
+ purchase_orders {
448
+ ...PURCHASE_ORDERS_FRAGMENT
449
+ }
450
+ errors {
451
+ message
452
+ type
453
+ }
454
+ }
455
+ }
456
+ ${F}
457
+ `,gr=async e=>{const a=Array.isArray(e)?e:[e];if(!a||a.length===0)throw new Error("Purchase Order UID(s) are required");if(a.some(t=>!t||t.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return v(Ce,{variables:{input:{purchase_order_uids:a}}}).then(t=>{var s,E,p;(s=t.errors)!=null&&s.length&&T(t.errors);const i=(E=t.data)==null?void 0:E.cancelPurchaseOrders;if(!i)throw new Error("Failed to cancel purchase orders");return{errors:((i==null?void 0:i.errors)??[]).map(c=>({message:(c==null?void 0:c.message)??"",type:(c==null?void 0:c.type)??""})),purchaseOrders:((p=i==null?void 0:i.purchase_orders)==null?void 0:p.map(c=>M(c)))??[]}}).catch(S)},Le=`
458
+ mutation REJECT_PURCHASE_ORDERS($input: PurchaseOrdersActionInput!) {
459
+ rejectPurchaseOrders(input: $input) {
460
+ purchase_orders {
461
+ ...PURCHASE_ORDERS_FRAGMENT
462
+ }
463
+ errors {
464
+ message
465
+ type
466
+ }
467
+ }
468
+ }
469
+ ${F}
470
+ `,yr=async e=>{const a=Array.isArray(e)?e:[e];if(!a||a.length===0)throw new Error("Purchase Order UID(s) are required");if(a.some(t=>!t||t.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return v(Le,{variables:{input:{purchase_order_uids:a}}}).then(t=>{var s,E;(s=t.errors)!=null&&s.length&&T(t.errors);const i=(E=t.data)==null?void 0:E.rejectPurchaseOrders;return{errors:((i==null?void 0:i.errors)??[]).map(p=>({message:(p==null?void 0:p.message)??"",type:(p==null?void 0:p.type)??""})),purchaseOrders:((i==null?void 0:i.purchase_orders)??[]).map(M)}}).catch(S)},me=`
4
471
  mutation VALIDATE_PURCHASE_ORDERS($input: ValidatePurchaseOrdersInput!) {
5
472
  validatePurchaseOrders(input: $input) {
6
473
  errors {
@@ -12,8 +479,40 @@ import{c as z,g as L,i as Q}from"./chunks/initialize.js";import{f as n,h as i,a
12
479
  }
13
480
  }
14
481
  }
15
- ${S}
16
- `,G=async r=>{const u=Array.isArray(r)?r:[r];if(!u||u.length===0)throw new Error("Purchase Order UID(s) are required");if(u.some(c=>!c||c.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return n(v,{variables:{input:{purchase_order_uids:u}}}).then(c=>{var t,o;(t=c.errors)!=null&&t.length&&i(c.errors);const s=(o=c.data)==null?void 0:o.validatePurchaseOrders;return{errors:((s==null?void 0:s.errors)??[]).map(a=>({message:(a==null?void 0:a.message)??"",type:(a==null?void 0:a.type)??""})),purchaseOrders:((s==null?void 0:s.purchase_orders)||[]).map(D)}}).catch(h)},w=r=>{var p,c,s,t,o,a,d,l,_,P,O,g,E,R,m;const u=((c=(p=r==null?void 0:r.cart)==null?void 0:p.itemsV2)==null?void 0:c.items)??[];return{cart:{id:((s=r==null?void 0:r.cart)==null?void 0:s.id)??"",items:u.map(e=>{var f,A,C;return{uid:(e==null?void 0:e.uid)??"",quantity:(e==null?void 0:e.quantity)??0,product:{uid:((f=e==null?void 0:e.product)==null?void 0:f.uid)??"",name:((A=e==null?void 0:e.product)==null?void 0:A.name)??"",sku:((C=e==null?void 0:e.product)==null?void 0:C.sku)??""}}}),pagination:{currentPage:((a=(o=(t=r==null?void 0:r.cart)==null?void 0:t.itemsV2)==null?void 0:o.page_info)==null?void 0:a.current_page)??1,pageSize:((_=(l=(d=r==null?void 0:r.cart)==null?void 0:d.itemsV2)==null?void 0:l.page_info)==null?void 0:_.page_size)??20,totalPages:((g=(O=(P=r==null?void 0:r.cart)==null?void 0:P.itemsV2)==null?void 0:O.page_info)==null?void 0:g.total_pages)??0,totalCount:((R=(E=r==null?void 0:r.cart)==null?void 0:E.itemsV2)==null?void 0:R.total_count)??0}},userErrors:((m=r==null?void 0:r.user_errors)==null?void 0:m.map(e=>({message:(e==null?void 0:e.message)??""})))??[]}},x=`
482
+ ${F}
483
+ `,fr=async e=>{const a=Array.isArray(e)?e:[e];if(!a||a.length===0)throw new Error("Purchase Order UID(s) are required");if(a.some(t=>!t||t.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return v(me,{variables:{input:{purchase_order_uids:a}}}).then(t=>{var s,E;(s=t.errors)!=null&&s.length&&T(t.errors);const i=(E=t.data)==null?void 0:E.validatePurchaseOrders;return{errors:((i==null?void 0:i.errors)??[]).map(p=>({message:(p==null?void 0:p.message)??"",type:(p==null?void 0:p.type)??""})),purchaseOrders:((i==null?void 0:i.purchase_orders)||[]).map(M)}}).catch(S)},Ie=`
484
+ mutation ADD_PURCHASE_ORDER_COMMENT(
485
+ $purchaseOrderUid: ID!
486
+ $comment: String!
487
+ ) {
488
+ addPurchaseOrderComment(
489
+ input: { purchase_order_uid: $purchaseOrderUid, comment: $comment }
490
+ ) {
491
+ comment {
492
+ created_at
493
+ text
494
+ uid
495
+ author {
496
+ allow_remote_shopping_assistance
497
+ confirmation_status
498
+ created_at
499
+ date_of_birth
500
+ email
501
+ firstname
502
+ gender
503
+ job_title
504
+ lastname
505
+ middlename
506
+ prefix
507
+ status
508
+ structure_id
509
+ suffix
510
+ telephone
511
+ }
512
+ }
513
+ }
514
+ }
515
+ `,we=e=>{var u,t,i,s,E,p,c,y,o,h,f,U,C,L,N;const a=((t=(u=e==null?void 0:e.cart)==null?void 0:u.itemsV2)==null?void 0:t.items)??[];return{cart:{id:((i=e==null?void 0:e.cart)==null?void 0:i.id)??"",items:a.map(b=>{var r,P,w;return{uid:(b==null?void 0:b.uid)??"",quantity:(b==null?void 0:b.quantity)??0,product:{uid:((r=b==null?void 0:b.product)==null?void 0:r.uid)??"",name:((P=b==null?void 0:b.product)==null?void 0:P.name)??"",sku:((w=b==null?void 0:b.product)==null?void 0:w.sku)??""}}}),pagination:{currentPage:((p=(E=(s=e==null?void 0:e.cart)==null?void 0:s.itemsV2)==null?void 0:E.page_info)==null?void 0:p.current_page)??1,pageSize:((o=(y=(c=e==null?void 0:e.cart)==null?void 0:c.itemsV2)==null?void 0:y.page_info)==null?void 0:o.page_size)??20,totalPages:((U=(f=(h=e==null?void 0:e.cart)==null?void 0:h.itemsV2)==null?void 0:f.page_info)==null?void 0:U.total_pages)??0,totalCount:((L=(C=e==null?void 0:e.cart)==null?void 0:C.itemsV2)==null?void 0:L.total_count)??0}},userErrors:((N=e==null?void 0:e.user_errors)==null?void 0:N.map(b=>({message:(b==null?void 0:b.message)??""})))??[]}},xe=e=>{var N,b;const a=(b=(N=e.data)==null?void 0:N.placeOrderForPurchaseOrder)==null?void 0:b.order,u=r=>({value:(r==null?void 0:r.value)||0,currency:(r==null?void 0:r.currency)||""}),t=r=>({code:(r==null?void 0:r.code)||"",label:(r==null?void 0:r.label)||""}),i=r=>({code:(r==null?void 0:r.code)||"",appliedBalance:u(r==null?void 0:r.applied_balance),currentBalance:u(r==null?void 0:r.current_balance)}),s=r=>({firstname:(r==null?void 0:r.firstname)||"",lastname:(r==null?void 0:r.lastname)||"",street:(r==null?void 0:r.street)||[],city:(r==null?void 0:r.city)||"",region:(r==null?void 0:r.region)||"",postcode:(r==null?void 0:r.postcode)||"",countryCode:(r==null?void 0:r.country_code)||"",telephone:(r==null?void 0:r.telephone)||"",company:(r==null?void 0:r.company)||""}),E=r=>({name:(r==null?void 0:r.name)||"",type:(r==null?void 0:r.type)||"",additionalData:(r==null?void 0:r.additional_data)||{}}),p=r=>({id:(r==null?void 0:r.id)||"",productName:(r==null?void 0:r.product_name)||"",productSku:(r==null?void 0:r.product_sku)||"",quantityOrdered:(r==null?void 0:r.quantity_ordered)||0,quantityShipped:(r==null?void 0:r.quantity_shipped)||0,quantityInvoiced:(r==null?void 0:r.quantity_invoiced)||0,quantityRefunded:(r==null?void 0:r.quantity_refunded)||0,price:u(r==null?void 0:r.price),total:u(r==null?void 0:r.total)}),c=r=>({number:(r==null?void 0:r.number)||"",carrier:(r==null?void 0:r.carrier)||"",title:(r==null?void 0:r.title)||""}),y=r=>({message:(r==null?void 0:r.message)||"",timestamp:(r==null?void 0:r.timestamp)||""}),o=r=>({id:(r==null?void 0:r.id)||"",productName:(r==null?void 0:r.product_name)||"",productSku:(r==null?void 0:r.product_sku)||"",quantityShipped:(r==null?void 0:r.quantity_shipped)||0}),h=r=>({id:(r==null?void 0:r.id)||"",number:(r==null?void 0:r.number)||"",tracking:((r==null?void 0:r.tracking)||[]).map(c),comments:((r==null?void 0:r.comments)||[]).map(y),items:((r==null?void 0:r.items)||[]).map(o)}),f=r=>({firstname:(r==null?void 0:r.firstname)||"",lastname:(r==null?void 0:r.lastname)||"",email:(r==null?void 0:r.email)||""}),U=r=>({label:(r==null?void 0:r.label)||"",amount:u(r==null?void 0:r.amount)}),C=r=>({baseGrandTotal:u(r==null?void 0:r.base_grand_total),grandTotal:u(r==null?void 0:r.grand_total),subtotal:u(r==null?void 0:r.subtotal),totalTax:u(r==null?void 0:r.total_tax),totalShipping:u(r==null?void 0:r.total_shipping),discounts:((r==null?void 0:r.discounts)||[]).map(U)}),L=r=>({appliedCoupons:((r==null?void 0:r.applied_coupons)||[]).map(t),appliedGiftCards:((r==null?void 0:r.applied_gift_cards)||[]).map(i),availableActions:(r==null?void 0:r.available_actions)||[],billingAddress:r!=null&&r.billing_address?s(r.billing_address):{firstname:"",lastname:"",street:[],city:"",region:"",postcode:"",countryCode:"",telephone:"",company:""},carrier:(r==null?void 0:r.carrier)||"",comments:(r==null?void 0:r.comments)||[],creditMemos:(r==null?void 0:r.credit_memos)||[],customerInfo:r!=null&&r.customer_info?f(r.customer_info):{firstname:"",lastname:"",email:""},email:(r==null?void 0:r.email)||"",giftMessage:(r==null?void 0:r.gift_message)||"",giftReceiptIncluded:(r==null?void 0:r.gift_receipt_included)||!1,giftWrapping:(r==null?void 0:r.gift_wrapping)||null,id:(r==null?void 0:r.id)||"",invoices:(r==null?void 0:r.invoices)||[],isVirtual:(r==null?void 0:r.is_virtual)||!1,items:((r==null?void 0:r.items)||[]).map(p),itemsEligibleForReturn:(r==null?void 0:r.items_eligible_for_return)||[],number:(r==null?void 0:r.number)||"",orderDate:(r==null?void 0:r.order_date)||"",orderStatusChangeDate:(r==null?void 0:r.order_status_change_date)||"",paymentMethods:((r==null?void 0:r.payment_methods)||[]).map(E),printedCardIncluded:(r==null?void 0:r.printed_card_included)||!1,returns:(r==null?void 0:r.returns)||null,shipments:((r==null?void 0:r.shipments)||[]).map(h),shippingAddress:r!=null&&r.shipping_address?s(r.shipping_address):{firstname:"",lastname:"",street:[],city:"",region:"",postcode:"",countryCode:"",telephone:"",company:""},shippingMethod:(r==null?void 0:r.shipping_method)||"",status:(r==null?void 0:r.status)||"",token:(r==null?void 0:r.token)||"",total:r!=null&&r.total?C(r.total):{baseGrandTotal:u(null),grandTotal:u(null),subtotal:u(null),totalTax:u(null),totalShipping:u(null),discounts:[]}});return L(a||null)},Ne=e=>{var E,p;const a=(p=(E=e==null?void 0:e.data)==null?void 0:E.customer)==null?void 0:p.purchase_order_approval_rule_metadata,u=c=>{var y;return{id:(c==null?void 0:c.id)||"",sortOrder:(c==null?void 0:c.sort_order)||0,text:(c==null?void 0:c.text)||"",children:((y=c==null?void 0:c.children)==null?void 0:y.map(u))||void 0}},t=c=>({id:(c==null?void 0:c.id)||"",name:(c==null?void 0:c.name)||"",usersCount:(c==null?void 0:c.users_count)||0,permissions:((c==null?void 0:c.permissions)||[]).map(u)}),i=((a==null?void 0:a.available_applies_to)||[]).map(t),s=((a==null?void 0:a.available_requires_approval_from)||[]).map(t);return{availableAppliesTo:i,availableRequiresApprovalFrom:s}},z=e=>{const a=t=>({id:(t==null?void 0:t.id)||"",name:(t==null?void 0:t.name)||"",usersCount:(t==null?void 0:t.users_count)||0,permissions:((t==null?void 0:t.permissions)||[]).map(i=>({id:(i==null?void 0:i.id)||"",sortOrder:(i==null?void 0:i.sort_order)||0,text:(i==null?void 0:i.text)||""}))}),u=t=>{var i,s;return{attribute:t==null?void 0:t.attribute,operator:t==null?void 0:t.operator,quantity:(t==null?void 0:t.quantity)||0,amount:{currency:((i=t==null?void 0:t.amount)==null?void 0:i.currency)||"USD",value:((s=t==null?void 0:t.amount)==null?void 0:s.value)||0}}};return{uid:(e==null?void 0:e.uid)||"",name:(e==null?void 0:e.name)||"",description:(e==null?void 0:e.description)||"",status:e==null?void 0:e.status,createdAt:(e==null?void 0:e.created_at)||"",updatedAt:(e==null?void 0:e.updated_at)||"",createdBy:e==null?void 0:e.created_by,appliesToRoles:((e==null?void 0:e.applies_to_roles)||[]).map(a),approverRoles:((e==null?void 0:e.approver_roles)||[]).map(a),condition:u((e==null?void 0:e.condition)||{})}},Fe=e=>{var a,u,t,i,s,E,p,c,y,o,h,f,U,C,L;return{createdAt:(e==null?void 0:e.created_at)??"",text:(e==null?void 0:e.text)??"",uid:(e==null?void 0:e.uid)??"",author:{allowRemoteShoppingAssistance:((a=e==null?void 0:e.author)==null?void 0:a.allow_remote_shopping_assistance)??!1,confirmationStatus:((u=e==null?void 0:e.author)==null?void 0:u.confirmation_status)??"",createdAt:((t=e==null?void 0:e.author)==null?void 0:t.created_at)??"",dateOfBirth:((i=e==null?void 0:e.author)==null?void 0:i.date_of_birth)??"",email:((s=e==null?void 0:e.author)==null?void 0:s.email)??"",firstname:((E=e==null?void 0:e.author)==null?void 0:E.firstname)??"",gender:((p=e==null?void 0:e.author)==null?void 0:p.gender)??0,jobTitle:((c=e==null?void 0:e.author)==null?void 0:c.job_title)??"",lastname:((y=e==null?void 0:e.author)==null?void 0:y.lastname)??"",middlename:((o=e==null?void 0:e.author)==null?void 0:o.middlename)??"",prefix:((h=e==null?void 0:e.author)==null?void 0:h.prefix)??"",status:((f=e==null?void 0:e.author)==null?void 0:f.status)??"",structureId:((U=e==null?void 0:e.author)==null?void 0:U.structure_id)??"",suffix:((C=e==null?void 0:e.author)==null?void 0:C.suffix)??"",telephone:((L=e==null?void 0:e.author)==null?void 0:L.telephone)??""}}},Ar=async(e,a)=>{if(!e)throw new Error("Purchase Order ID is required");if(!a)throw new Error("Comment text is required");return v(Ie,{variables:{purchaseOrderUid:e,comment:a}}).then(t=>{var i,s,E;return(i=t.errors)!=null&&i.length&&T(t.errors),Fe((E=(s=t.data)==null?void 0:s.addPurchaseOrderComment)==null?void 0:E.comment)}).catch(S)},Me=`
17
516
  mutation ADD_PURCHASE_ORDER_ITEMS_TO_CART(
18
517
  $purchaseOrderUid: ID!
19
518
  $cartId: String!
@@ -48,7 +547,141 @@ import{c as z,g as L,i as Q}from"./chunks/initialize.js";import{f as n,h as i,a
48
547
  }
49
548
  }
50
549
  }
51
- `,M=async(r,u,p=!1)=>{if(!r)throw new Error("Purchase Order UID is required");if(!u)throw new Error("Cart ID is required");return n(x,{variables:{purchaseOrderUid:r,cartId:u,replaceExistingCartItems:p}}).then(s=>{var o,a;(o=s.errors)!=null&&o.length&&i(s.errors);const t=(a=s.data)==null?void 0:a.addPurchaseOrderItemsToCart;if(!(t!=null&&t.cart))throw new Error("Failed to add purchase order items to cart");return w(t)}).catch(h)},T=`
550
+ `,Rr=async(e,a,u=!1)=>{if(!e)throw new Error("Purchase Order UID is required");if(!a)throw new Error("Cart ID is required");return v(Me,{variables:{purchaseOrderUid:e,cartId:a,replaceExistingCartItems:u}}).then(i=>{var E,p;(E=i.errors)!=null&&E.length&&T(i.errors);const s=(p=i.data)==null?void 0:p.addPurchaseOrderItemsToCart;if(!(s!=null&&s.cart))throw new Error("Failed to add purchase order items to cart");return we(s)}).catch(S)},He=`
551
+ mutation CREATE_PURCHASE_ORDER_APPROVAL_RULE(
552
+ $input: PurchaseOrderApprovalRuleInput!
553
+ ) {
554
+ createPurchaseOrderApprovalRule(input: $input) {
555
+ created_at
556
+ created_by
557
+ description
558
+ name
559
+ status
560
+ uid
561
+ updated_at
562
+ applies_to_roles {
563
+ id
564
+ name
565
+ users_count
566
+ permissions {
567
+ id
568
+ sort_order
569
+ text
570
+ }
571
+ }
572
+ condition {
573
+ attribute
574
+ operator
575
+ }
576
+ approver_roles {
577
+ id
578
+ name
579
+ users_count
580
+ permissions {
581
+ id
582
+ sort_order
583
+ text
584
+ }
585
+ }
586
+ }
587
+ }
588
+ `,hr=async e=>{if(!e.name||e.name.trim()==="")throw new Error("Rule name is required");return v(He,{variables:{input:e}}).then(a=>{var t,i;if((t=a.errors)!=null&&t.length&&T(a.errors),!((i=a.data)==null?void 0:i.createPurchaseOrderApprovalRule))throw new Error("Failed to create purchase order approval rule");return z(a.data.createPurchaseOrderApprovalRule)}).catch(S)},Ve=`
589
+ mutation DELETE_PURCHASE_ORDER_APPROVAL_RULE(
590
+ $input: DeletePurchaseOrderApprovalRuleInput!
591
+ ) {
592
+ deletePurchaseOrderApprovalRule(input: $input) {
593
+ errors {
594
+ message
595
+ type
596
+ }
597
+ }
598
+ }
599
+ `,br=async e=>{const a=Array.isArray(e)?e:[e];if(!a||a.length===0)throw new Error("Approval Rule UID(s) are required");if(a.some(t=>!t||t.trim()===""))throw new Error("All Approval Rule UIDs must be valid");return v(Ve,{variables:{input:{approval_rule_uids:a}}}).then(t=>{var E,p,c;if((E=t.errors)!=null&&E.length&&T(t.errors),!((p=t.data)==null?void 0:p.deletePurchaseOrderApprovalRule))throw new Error("Failed to delete purchase order approval rule");const s=(c=t==null?void 0:t.data)==null?void 0:c.deletePurchaseOrderApprovalRule;return{deletePurchaseOrderApprovalRule:{errors:((s==null?void 0:s.errors)??[]).map(y=>({message:y==null?void 0:y.message,type:y==null?void 0:y.type}))}}}).catch(S)},Ge=`
600
+ mutation UPDATE_PURCHASE_ORDER_APPROVAL_RULE(
601
+ $input: UpdatePurchaseOrderApprovalRuleInput!
602
+ ) {
603
+ updatePurchaseOrderApprovalRule(input: $input) {
604
+ created_at
605
+ created_by
606
+ description
607
+ name
608
+ status
609
+ uid
610
+ updated_at
611
+ applies_to_roles {
612
+ id
613
+ name
614
+ users_count
615
+ permissions {
616
+ id
617
+ sort_order
618
+ text
619
+ }
620
+ }
621
+ condition {
622
+ attribute
623
+ operator
624
+ }
625
+ approver_roles {
626
+ id
627
+ name
628
+ users_count
629
+ permissions {
630
+ id
631
+ sort_order
632
+ text
633
+ }
634
+ }
635
+ }
636
+ }
637
+ `,Pr=async e=>{if(!e.uid||e.uid.trim()==="")throw new Error("Approval Rule UID is required");return v(Ge,{variables:{input:e}}).then(a=>{var u,t;return(u=a.errors)!=null&&u.length&&T(a.errors),z(((t=a.data)==null?void 0:t.updatePurchaseOrderApprovalRule)||{})}).catch(S)},$e=`
638
+ query GET_PURCHASE_ORDERS(
639
+ $filter: PurchaseOrdersFilterInput
640
+ $pageSize: Int
641
+ $currentPage: Int
642
+ ) {
643
+ customer {
644
+ purchase_orders(
645
+ filter: $filter
646
+ pageSize: $pageSize
647
+ currentPage: $currentPage
648
+ ) {
649
+ total_count
650
+ page_info {
651
+ current_page
652
+ page_size
653
+ total_pages
654
+ }
655
+ items {
656
+ ...PURCHASE_ORDERS_FRAGMENT
657
+ }
658
+ }
659
+ }
660
+ }
661
+ ${F}
662
+ `,vr=e=>{try{return new URL(e,window.location.origin).origin===window.location.origin}catch{return e.startsWith("/")||e.startsWith("./")||e.startsWith("../")}};var W={};function ke(e){if(e)return e;const a=ve();return a||(W.LOCALE&&W.LOCALE!=="undefined"?W.LOCALE:"en-US")}const Sr=(e,a="en-US")=>{try{const u=new Date(e);if(isNaN(u.getTime()))return e;const t=ke(a);return u.toLocaleString(t,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})}catch{return e}},Q=e=>{if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(Q);const a={};for(const[u,t]of Object.entries(e)){const i=u.replace(/[A-Z]/g,s=>`_${s.toLowerCase()}`);a[i]=Q(t)}return a},Tr=(e,a,u)=>{if(u<=0)return{from:0,to:0,total:0};const t=Math.max(1,Math.ceil(u/a)),i=Math.min(Math.max(e,1),t),s=(i-1)*a+1,E=Math.min(i*a,u);return{from:s,to:E,total:u}},Or=(e,a,u)=>{const t={...e};switch(a){case"status":t.status=u?"ENABLED":"DISABLED";break;case"name":t.name=u;break;case"description":t.description=u;break;case"ruleType":t.condition.attribute=u;break;case"ruleCondition":t.condition.operator=u;break;case"ruleValue":{let i=typeof u=="string"?u.replace(/[^\d]/g,""):String(u);i===""?t.condition.attribute==="NUMBER_OF_SKUS"?t.condition.quantity="":t.condition.amount.value="":t.condition.attribute==="NUMBER_OF_SKUS"?t.condition.quantity=+i:t.condition.amount.value=+i;break}case"ruleConditionCurrency":t.condition.amount.currency=u;break;case"approvers":t.approvers=u;break;case"roleType":t.roleType=u;break;case"appliesTo":t.appliesTo=u;break}return t},Ur=e=>{const a={};return(!e.name||e.name.trim()==="")&&(a.name="PurchaseOrders.approvalRuleForm.errorsMessages.required"),e.roleType==="specific_roles"&&(!e.appliesTo||e.appliesTo.length===0)&&(a.appliesTo="PurchaseOrders.approvalRuleForm.errorsMessages.approvers"),e.condition.attribute==="NUMBER_OF_SKUS"?e.condition.quantity===""&&(a.ruleValue="PurchaseOrders.approvalRuleForm.errorsMessages.required"):e.condition.amount.value===""&&(a.ruleValue="PurchaseOrders.approvalRuleForm.errorsMessages.required"),(!e.approvers||e.approvers.length===0)&&(a.approvers="PurchaseOrders.approvalRuleForm.errorsMessages.approvers"),a},dr=(e,a,u)=>{const t={...a};return Object.keys(e).forEach(i=>{u[i]&&(t[i]=e[i])}),Object.keys(t).forEach(i=>{u[i]&&!e[i]&&delete t[i]}),t},B={GRAND_TOTAL:"ruleTypeGrandTotal",SHIPPING_INCL_TAX:"ruleTypeShippingInclTax",NUMBER_OF_SKUS:"ruleTypeNumberOfSkus"},G={MORE_THAN:"conditionOperatorMoreThan",LESS_THAN:"conditionOperatorLessThan",MORE_THAN_OR_EQUAL_TO:"conditionOperatorMoreThanOrEqualTo",LESS_THAN_OR_EQUAL_TO:"conditionOperatorLessThanOrEqualTo"},Re={ALL_USERS:"appliesToAllUsers",SPECIFIC_ROLES:"appliesToSpecificRoles"},Be={status:"ENABLED",name:"",description:"",roleType:"all_users",appliesTo:[],condition:{quantity:"",amount:{currency:"USD",value:""},attribute:"GRAND_TOTAL",operator:"MORE_THAN"},approvers:[]},Dr={formValues:Be,isLoading:!1,submitError:null,availableAppliesTo:[],availableRequiresApprovalFrom:[],errors:{},touched:{},currencyCodesList:[{text:"USD",value:"USD"}]},Cr={name:!0,appliesTo:!0,ruleValue:!0,approvers:!0},Lr={REQUIRED:"PurchaseOrders.approvalRuleForm.errorsMessages.required",APPROVERS:"PurchaseOrders.approvalRuleForm.errorsMessages.approvers",FAILED_TO_LOAD:"Failed to load metadata. Please try again.",FAILED_TO_CREATE:"Failed to create approval rule. Please try again."},mr=e=>[{text:e[B.GRAND_TOTAL],value:"GRAND_TOTAL"},{text:e[B.SHIPPING_INCL_TAX],value:"SHIPPING_INCL_TAX"},{text:e[B.NUMBER_OF_SKUS],value:"NUMBER_OF_SKUS"}],Ir=e=>[{text:e[G.MORE_THAN],value:"MORE_THAN"},{text:e[G.LESS_THAN],value:"LESS_THAN"},{text:e[G.MORE_THAN_OR_EQUAL_TO],value:"MORE_THAN_OR_EQUAL_TO"},{text:e[G.LESS_THAN_OR_EQUAL_TO],value:"LESS_THAN_OR_EQUAL_TO"}],wr=e=>[{text:e[Re.ALL_USERS],value:"all_users"},{text:e[Re.SPECIFIC_ROLES],value:"specific_roles"}],Qe="ENABLED",ze="GRAND_TOTAL",We="MORE_THAN",Ye="USD",je=0,Ke=0,Xe=e=>Object.keys(B).includes(e),Je=e=>Object.keys(G).includes(e),xr=e=>{var a,u,t,i,s,E,p,c,y,o;return{status:e.status||Qe,name:e.name||"",description:e.description||"",roleType:((a=e.appliesToRoles)==null?void 0:a.length)>0?"specific_roles":"all_users",appliesTo:((u=e.appliesToRoles)==null?void 0:u.map(h=>h.id))||[],condition:{quantity:((t=e.condition)==null?void 0:t.quantity)??je,amount:{currency:((s=(i=e.condition)==null?void 0:i.amount)==null?void 0:s.currency)||Ye,value:((p=(E=e.condition)==null?void 0:E.amount)==null?void 0:p.value)??Ke},attribute:Xe((c=e.condition)==null?void 0:c.attribute)?e.condition.attribute:ze,operator:Je((y=e.condition)==null?void 0:y.operator)?e.condition.operator:We},approvers:((o=e.approverRoles)==null?void 0:o.map(h=>h.id))||[]}},he=e=>e!=null&&e!==""&&e!==0;function Nr(e){const{roleType:a,appliesTo:u,condition:t,...i}=e,s=a==="all_users"?{appliesTo:[]}:{appliesTo:u};let E={};if(t){const{amount:c,quantity:y,...o}=t,h={...o};he(c==null?void 0:c.value)&&(h.amount=c),he(y)&&(h.quantity=y),E=h}return Q({...i,...s,condition:E})}const Fr=e=>{const a=e.toUpperCase();return["APPROVED","ORDER_PLACED","APPROVED_PENDING_PAYMENT","ENABLED"].includes(a)?"positive":["REJECTED","CANCELED","ORDER_FAILED","DISABLED"].includes(a)?"negative":"waiting"},Mr=async(e,a=20,u=1)=>v($e,{variables:{filter:Q(e),pageSize:a,currentPage:u}}).then(t=>{var p,c,y,o,h,f,U,C;if((p=t.errors)!=null&&p.length&&T(t.errors),!((y=(c=t.data)==null?void 0:c.customer)!=null&&y.purchase_orders))throw new Error("Failed to get purchase orders");const i=(h=(o=t==null?void 0:t.data)==null?void 0:o.customer)==null?void 0:h.purchase_orders,s=(i==null?void 0:i.total_count)??0,E={currentPage:((f=i==null?void 0:i.page_info)==null?void 0:f.current_page)??1,pageSize:((U=i==null?void 0:i.page_info)==null?void 0:U.page_size)??20,totalPages:((C=i==null?void 0:i.page_info)==null?void 0:C.total_pages)??1};return{totalCount:s,pageInfo:E,purchaseOrderItems:((i==null?void 0:i.items)||[]).map(M)}}).catch(S),Ze=`
663
+ mutation PLACE_ORDER_FOR_PURCHASE_ORDER(
664
+ $input: PlaceOrderForPurchaseOrderInput!
665
+ ) {
666
+ placeOrderForPurchaseOrder(input: $input) {
667
+ order {
668
+ available_actions
669
+ carrier
670
+ email
671
+ gift_receipt_included
672
+ id
673
+ is_virtual
674
+ number
675
+ order_date
676
+ order_status_change_date
677
+ printed_card_included
678
+ shipping_method
679
+ status
680
+ token
681
+ }
682
+ }
683
+ }
684
+ `,Hr=async e=>{var u;if(!e||e.trim()==="")throw new Error("Purchase Order UID is required");const a={purchase_order_uid:e};try{const t=await v(Ze,{variables:{input:a}});return(u=t.errors)!=null&&u.length&&T(t.errors),xe(t)}catch(t){throw S(t)}},qe=`
52
685
  mutation PLACE_PURCHASE_ORDER($input: PlacePurchaseOrderInput!) {
53
686
  placePurchaseOrder(input: $input) {
54
687
  purchase_order {
@@ -56,6 +689,151 @@ import{c as z,g as L,i as Q}from"./chunks/initialize.js";import{f as n,h as i,a
56
689
  }
57
690
  }
58
691
  }
59
- ${S}
60
- `,b=async r=>{if(!r||r.trim()==="")throw new Error("Cart ID is required");return n(T,{variables:{input:{cart_id:r}}}).then(p=>{var t,o,a;(t=p.errors)!=null&&t.length&&i(p.errors);const c=(a=(o=p.data)==null?void 0:o.placePurchaseOrder)==null?void 0:a.purchase_order,s=D(c);return I.emit("purchase-order/placed",s),{purchaseOrder:s}}).catch(h)};export{Rr as PO_PERMISSIONS,cr as addPurchaseOrderComment,M as addPurchaseOrderItemsToCart,Z as approvePurchaseOrders,sr as cancelPurchaseOrders,z as config,ur as createPurchaseOrderApprovalRule,pr as currencyInfo,dr as deletePurchaseOrderApprovalRule,n as fetchGraphQl,B as getConfig,L as getPurchaseOrder,gr as getPurchaseOrderApprovalRule,nr as getPurchaseOrderApprovalRuleMetadata,lr as getPurchaseOrderApprovalRules,Pr as getPurchaseOrders,Q as initialize,ar as placeOrderForPurchaseOrder,b as placePurchaseOrder,rr as rejectPurchaseOrders,J as removeFetchGraphQlHeader,K as setEndpoint,W as setFetchGraphQlHeader,X as setFetchGraphQlHeaders,ir as updatePurchaseOrderApprovalRule,G as validatePurchaseOrders};
692
+ ${F}
693
+ `,Vr=async e=>{if(!e||e.trim()==="")throw new Error("Cart ID is required");return v(qe,{variables:{input:{cart_id:e}}}).then(u=>{var s,E,p;(s=u.errors)!=null&&s.length&&T(u.errors);const t=(p=(E=u.data)==null?void 0:E.placePurchaseOrder)==null?void 0:p.purchase_order,i=M(t);return $.emit("purchase-order/placed",i),{purchaseOrder:i}}).catch(S)},er=`
694
+ query GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA {
695
+ customer {
696
+ purchase_order_approval_rule_metadata {
697
+ available_applies_to {
698
+ id
699
+ name
700
+ users_count
701
+ permissions {
702
+ id
703
+ sort_order
704
+ text
705
+ children {
706
+ id
707
+ sort_order
708
+ text
709
+ }
710
+ }
711
+ }
712
+ available_requires_approval_from {
713
+ id
714
+ name
715
+ users_count
716
+ permissions {
717
+ id
718
+ sort_order
719
+ text
720
+ children {
721
+ id
722
+ sort_order
723
+ text
724
+ }
725
+ }
726
+ }
727
+ }
728
+ }
729
+ }
730
+ `,Gr=async()=>v(er,{variables:{}}).then(e=>{var a;return(a=e.errors)!=null&&a.length&&T(e.errors),Ne(e)}).catch(S),rr=`
731
+ query GET_CURRENCY_INFO {
732
+ currency {
733
+ base_currency_code
734
+ available_currency_codes
735
+ }
736
+ }
737
+ `,$r=async()=>v(rr,{}).then(e=>{var t,i,s,E,p;if(!e)return{baseCurrencyCode:"USD",availableCurrencyCodes:[]};(t=e.errors)!=null&&t.length&&T(e.errors);const a=((s=(i=e==null?void 0:e.data)==null?void 0:i.currency)==null?void 0:s.available_currency_codes)??[];return{baseCurrencyCode:((p=(E=e==null?void 0:e.data)==null?void 0:E.currency)==null?void 0:p.base_currency_code)||"USD",availableCurrencyCodes:a.length?a.map(c=>({text:String(c),value:String(c)})):[]}}).catch(S),nr=`
738
+ query GET_PURCHASE_ORDER_APPROVAL_RULE($uid: ID!) {
739
+ customer {
740
+ purchase_order_approval_rule(uid: $uid) {
741
+ created_at
742
+ created_by
743
+ description
744
+ name
745
+ status
746
+ uid
747
+ updated_at
748
+ applies_to_roles {
749
+ id
750
+ name
751
+ users_count
752
+ }
753
+ approver_roles {
754
+ id
755
+ name
756
+ users_count
757
+ }
758
+ condition {
759
+ attribute
760
+ operator
761
+ ... on PurchaseOrderApprovalRuleConditionAmount {
762
+ attribute
763
+ operator
764
+ amount {
765
+ currency
766
+ value
767
+ }
768
+ }
769
+ ... on PurchaseOrderApprovalRuleConditionQuantity {
770
+ attribute
771
+ operator
772
+ quantity
773
+ }
774
+ }
775
+ }
776
+ }
777
+ }
778
+ `,kr=async e=>v(nr,{variables:{uid:e}}).then(a=>{var t,i,s;(t=a.errors)!=null&&t.length&&T(a.errors);const u=(s=(i=a==null?void 0:a.data)==null?void 0:i.customer)==null?void 0:s.purchase_order_approval_rule;return z(u)}).catch(S),tr=`
779
+ query GET_PURCHASE_ORDER_APPROVAL_RULES($currentPage: Int!, $pageSize: Int!) {
780
+ customer {
781
+ email
782
+ purchase_order_approval_rules(
783
+ currentPage: $currentPage
784
+ pageSize: $pageSize
785
+ ) {
786
+ items {
787
+ applies_to_roles {
788
+ id
789
+ name
790
+ users_count
791
+ permissions {
792
+ id
793
+ sort_order
794
+ text
795
+ children {
796
+ id
797
+ sort_order
798
+ text
799
+ }
800
+ }
801
+ }
802
+ approver_roles {
803
+ id
804
+ name
805
+ users_count
806
+ permissions {
807
+ id
808
+ sort_order
809
+ text
810
+ children {
811
+ id
812
+ sort_order
813
+ text
814
+ }
815
+ }
816
+ }
817
+ condition {
818
+ attribute
819
+ operator
820
+ }
821
+ created_at
822
+ created_by
823
+ description
824
+ name
825
+ status
826
+ uid
827
+ updated_at
828
+ }
829
+ total_count
830
+ page_info {
831
+ page_size
832
+ current_page
833
+ total_pages
834
+ }
835
+ }
836
+ }
837
+ }
838
+ `,V={currentPage:1,pageSize:20,totalPages:1},Br=async(e=V.currentPage,a=V.pageSize)=>v(tr,{variables:{currentPage:e,pageSize:a}}).then(u=>{var E,p,c,y,o,h;(E=u.errors)!=null&&E.length&&T(u.errors);const t=(c=(p=u==null?void 0:u.data)==null?void 0:p.customer)==null?void 0:c.purchase_order_approval_rules,i=(t==null?void 0:t.total_count)??0,s={currentPage:((y=t==null?void 0:t.page_info)==null?void 0:y.current_page)??V.currentPage,pageSize:((o=t==null?void 0:t.page_info)==null?void 0:o.page_size)??V.pageSize,totalPages:((h=t==null?void 0:t.page_info)==null?void 0:h.total_pages)??V.totalPages};return{totalCount:i,pageInfo:s,items:((t==null?void 0:t.items)||[]).map(z)}}).catch(S),Qr={PO_ALL:"Magento_PurchaseOrder::all",VIEW_CUSTOMER:"Magento_PurchaseOrder::view_purchase_orders",VIEW_SUBORDINATES:"Magento_PurchaseOrder::view_purchase_orders_for_subordinates",VIEW_COMPANY:"Magento_PurchaseOrder::view_purchase_orders_for_company",AUTO_APPROVE:"Magento_PurchaseOrder::autoapprove_purchase_order",SUPER_APPROVE:"Magento_PurchaseOrderRule::super_approve_purchase_order",VIEW_RULES:"Magento_PurchaseOrderRule::view_approval_rules",MANAGE_RULES:"Magento_PurchaseOrderRule::manage_approval_rules"};export{Dr as I,Qr as PO_PERMISSIONS,Cr as R,Lr as V,Fr as a,Ar as addPurchaseOrderComment,Rr as addPurchaseOrderItemsToCart,Er as approvePurchaseOrders,Ir as b,mr as c,gr as cancelPurchaseOrders,pr as config,hr as createPurchaseOrderApprovalRule,$r as currencyInfo,wr as d,br as deletePurchaseOrderApprovalRule,Nr as e,Sr as f,v as fetchGraphQl,Tr as g,or as getConfig,de as getPurchaseOrder,kr as getPurchaseOrderApprovalRule,Gr as getPurchaseOrderApprovalRuleMetadata,Br as getPurchaseOrderApprovalRules,Mr as getPurchaseOrders,Or as h,vr as i,Y as initialize,Hr as placeOrderForPurchaseOrder,Vr as placePurchaseOrder,yr as rejectPurchaseOrders,cr as removeFetchGraphQlHeader,lr as setEndpoint,_r as setFetchGraphQlHeader,sr as setFetchGraphQlHeaders,xr as t,dr as u,Pr as updatePurchaseOrderApprovalRule,Ur as v,fr as validatePurchaseOrders};
61
839
  //# sourceMappingURL=api.js.map