@dropins/storefront-purchase-order 0.0.5-alpha8 → 0.0.6-alpha1

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 (122) hide show
  1. package/api/fetch-graphql/fetch-graphql.d.ts +16 -0
  2. package/api/fetch-graphql/index.d.ts +16 -0
  3. package/api/graphql/PurchaseOrdersFragment.graphql.d.ts +1 -1
  4. package/api/initialize/index.d.ts +16 -0
  5. package/api/permissions.d.ts +16 -0
  6. package/api.js +9 -435
  7. package/api.js.map +1 -1
  8. package/chunks/FormLoader.js +1 -1
  9. package/chunks/FormLoader.js.map +1 -1
  10. package/chunks/PurchaseOrderHistoryLogContent.js +4 -0
  11. package/chunks/PurchaseOrderHistoryLogContent.js.map +1 -0
  12. package/chunks/PurchaseOrdersHeader.js +1 -1
  13. package/chunks/PurchaseOrdersHeader.js.map +1 -1
  14. package/chunks/PurchaseOrdersTableActions.js +1 -1
  15. package/chunks/PurchaseOrdersTableActions.js.map +1 -1
  16. package/chunks/addPurchaseOrderComment.js +36 -0
  17. package/chunks/addPurchaseOrderComment.js.map +1 -0
  18. package/chunks/fetch-graphql.js.map +1 -1
  19. package/chunks/formatDate.js +4 -0
  20. package/chunks/formatDate.js.map +1 -0
  21. package/chunks/getPurchaseOrders.js +3 -3
  22. package/chunks/getPurchaseOrders.js.map +1 -1
  23. package/chunks/pageSize.config.js +1 -1
  24. package/chunks/pageSize.config.js.map +1 -1
  25. package/chunks/permissions.js.map +1 -1
  26. package/chunks/rejectPurchaseOrders.js +392 -21
  27. package/chunks/rejectPurchaseOrders.js.map +1 -1
  28. package/chunks/transform-purchase-order-approval-rule.js.map +1 -1
  29. package/chunks/usePurchaseOrderData.js +4 -0
  30. package/chunks/usePurchaseOrderData.js.map +1 -0
  31. package/chunks/usePurchaseOrders.js +1 -1
  32. package/chunks/usePurchaseOrders.js.map +1 -1
  33. package/components/ApprovalRuleDetailsContent/index.d.ts +11 -3
  34. package/components/ApprovalRuleForm/index.d.ts +11 -3
  35. package/components/PurchaseOrderApprovalFlowContent/PurchaseOrderApprovalFlowContent.d.ts +5 -0
  36. package/components/PurchaseOrderApprovalFlowContent/index.d.ts +19 -0
  37. package/components/PurchaseOrderCommentFormContent/PurchaseOrderCommentFormContent.d.ts +5 -0
  38. package/components/PurchaseOrderCommentFormContent/index.d.ts +19 -0
  39. package/components/PurchaseOrderCommentsListContent/PurchaseOrderCommentsListContent.d.ts +5 -0
  40. package/components/PurchaseOrderCommentsListContent/index.d.ts +19 -0
  41. package/components/PurchaseOrderHistoryLogContent/PurchaseOrderHistoryLogContent.d.ts +5 -0
  42. package/components/PurchaseOrderHistoryLogContent/index.d.ts +19 -0
  43. package/components/index.d.ts +4 -0
  44. package/containers/ApprovalRuleDetails/index.d.ts +11 -3
  45. package/containers/ApprovalRuleDetails.js +1 -1
  46. package/containers/ApprovalRuleDetails.js.map +1 -1
  47. package/containers/ApprovalRuleForm/index.d.ts +11 -3
  48. package/containers/ApprovalRuleForm.js +1 -1
  49. package/containers/ApprovalRuleForm.js.map +1 -1
  50. package/containers/ApprovalRulesList.js +1 -1
  51. package/containers/ApprovalRulesList.js.map +1 -1
  52. package/containers/CompanyPurchaseOrders.js +1 -1
  53. package/containers/CompanyPurchaseOrders.js.map +1 -1
  54. package/containers/CustomerPurchaseOrders.js +1 -1
  55. package/containers/CustomerPurchaseOrders.js.map +1 -1
  56. package/containers/PurchaseOrderApprovalFlow/PurchaseOrderApprovalFlow.d.ts +5 -0
  57. package/containers/PurchaseOrderApprovalFlow/index.d.ts +19 -0
  58. package/containers/PurchaseOrderApprovalFlow.d.ts +3 -0
  59. package/containers/PurchaseOrderApprovalFlow.js +4 -0
  60. package/containers/PurchaseOrderApprovalFlow.js.map +1 -0
  61. package/containers/PurchaseOrderCommentForm/PurchaseOrderCommentForm.d.ts +5 -0
  62. package/containers/PurchaseOrderCommentForm/index.d.ts +19 -0
  63. package/containers/PurchaseOrderCommentForm.d.ts +3 -0
  64. package/containers/PurchaseOrderCommentForm.js +4 -0
  65. package/containers/PurchaseOrderCommentForm.js.map +1 -0
  66. package/containers/PurchaseOrderCommentsList/PurchaseOrderCommentsList.d.ts +5 -0
  67. package/containers/PurchaseOrderCommentsList/index.d.ts +19 -0
  68. package/containers/PurchaseOrderCommentsList.d.ts +3 -0
  69. package/containers/PurchaseOrderCommentsList.js +4 -0
  70. package/containers/PurchaseOrderCommentsList.js.map +1 -0
  71. package/containers/PurchaseOrderConfirmation.js +1 -1
  72. package/containers/PurchaseOrderConfirmation.js.map +1 -1
  73. package/containers/PurchaseOrderHistoryLog/PurchaseOrderHistoryLog.d.ts +5 -0
  74. package/containers/PurchaseOrderHistoryLog/index.d.ts +19 -0
  75. package/containers/PurchaseOrderHistoryLog.d.ts +3 -0
  76. package/containers/PurchaseOrderHistoryLog.js +4 -0
  77. package/containers/PurchaseOrderHistoryLog.js.map +1 -0
  78. package/containers/PurchaseOrderStatus.js +1 -1
  79. package/containers/PurchaseOrderStatus.js.map +1 -1
  80. package/containers/RequireApprovalPurchaseOrders.js +1 -1
  81. package/containers/RequireApprovalPurchaseOrders.js.map +1 -1
  82. package/containers/index.d.ts +4 -0
  83. package/data/models/purchase-order-model.d.ts +2 -1
  84. package/hooks/index.d.ts +2 -0
  85. package/hooks/useApprovalRulesList.d.ts +1 -1
  86. package/hooks/usePurchaseOrderData.d.ts +7 -0
  87. package/i18n/en_US.json.d.ts +65 -7
  88. package/lib/cleanAndDeep.d.ts +16 -0
  89. package/lib/formatDate.d.ts +5 -0
  90. package/lib/getRange.d.ts +16 -0
  91. package/lib/getStatusVariant.d.ts +2 -0
  92. package/lib/index.d.ts +17 -0
  93. package/lib/isValidUrl.d.ts +16 -0
  94. package/mocks/index.d.ts +16 -0
  95. package/mocks/storybook/events-data.d.ts +16 -0
  96. package/package.json +1 -1
  97. package/render/index.d.ts +16 -0
  98. package/render.js +3 -3
  99. package/render.js.map +1 -1
  100. package/types/api/api.enums.types.d.ts +16 -0
  101. package/types/api/index.d.ts +16 -0
  102. package/types/components/approvalFlowContent.types.d.ts +6 -0
  103. package/types/components/historyLogContent.types.d.ts +7 -0
  104. package/types/components/index.d.ts +20 -0
  105. package/types/components/purchaseOrderCommentFormContent.types.d.ts +7 -0
  106. package/types/components/purchaseOrderCommentsListContent.types.d.ts +7 -0
  107. package/types/components/purchaseOrderHistoryLogContent.types.d.ts +7 -0
  108. package/types/components/purchaseOrdersTable.types.d.ts +1 -0
  109. package/types/components/purchaseOrdersTableActions.d.ts +16 -0
  110. package/types/containers/approvalRuleDetailsProps.types.d.ts +16 -0
  111. package/types/containers/historyLog.types.d.ts +7 -0
  112. package/types/containers/index.d.ts +20 -0
  113. package/types/containers/purchaseOrderApprovalFlow.types.d.ts +6 -0
  114. package/types/containers/purchaseOrderCommentForm.types.d.ts +6 -0
  115. package/types/containers/purchaseOrderCommentsList.types.d.ts +7 -0
  116. package/types/containers/purchaseOrderHistoryLog.types.d.ts +23 -0
  117. package/types/hooks/index.d.ts +16 -0
  118. package/types/hooks/useApprovalRuleDetails.types.d.ts +16 -0
  119. package/types/hooks/useApprovalRulesList.types.d.ts +2 -0
  120. package/types/hooks/usePurchaseOrders.types.d.ts +1 -0
  121. package/chunks/FormLoader2.js +0 -4
  122. package/chunks/FormLoader2.js.map +0 -1
@@ -1,3 +1,19 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
1
17
  export declare const setEndpoint: (endpoint: string) => void, setFetchGraphQlHeader: (key: string, value: string | null) => void, removeFetchGraphQlHeader: (key: string) => void, setFetchGraphQlHeaders: (header: import('@adobe-commerce/fetch-graphql').Header | ((prev: import('@adobe-commerce/fetch-graphql').Header) => import('@adobe-commerce/fetch-graphql').Header)) => void, fetchGraphQl: <T = any>(query: string, options?: import('@adobe-commerce/fetch-graphql').FetchOptions | undefined) => Promise<{
2
18
  errors?: import('@adobe-commerce/fetch-graphql').FetchQueryError | undefined;
3
19
  data: T;
@@ -1,2 +1,18 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
1
17
  export * from './fetch-graphql';
2
18
  //# sourceMappingURL=index.d.ts.map
@@ -14,5 +14,5 @@
14
14
  * is strictly forbidden unless prior written permission is obtained
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
- export declare const PURCHASE_ORDERS_FRAGMENT = "\n fragment PURCHASE_ORDERS_FRAGMENT on PurchaseOrder {\n __typename\n uid\n number\n status\n available_actions\n comments {\n created_at\n author {\n firstname\n lastname\n email\n }\n text\n }\n created_at\n updated_at\n created_by {\n firstname\n lastname\n email\n }\n history_log {\n activity\n created_at\n message\n uid\n }\n order {\n number\n }\n quote {\n id\n prices {\n grand_total {\n value\n currency\n }\n }\n itemsV2 {\n items {\n uid\n quantity\n }\n }\n }\n }\n";
17
+ export declare const PURCHASE_ORDERS_FRAGMENT: string;
18
18
  //# sourceMappingURL=PurchaseOrdersFragment.graphql.d.ts.map
@@ -1,2 +1,18 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
1
17
  export * from './initialize';
2
18
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,19 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
1
17
  export declare const PO_PERMISSIONS: {
2
18
  PO_ALL: string;
3
19
  VIEW_CUSTOMER: string;
package/api.js CHANGED
@@ -1,409 +1,15 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{Initializer as D}from"@dropins/tools/lib.js";import{f as y,h as O}from"./chunks/fetch-graphql.js";import{g as m,r as rr,s as er,a as ar,b as tr}from"./chunks/fetch-graphql.js";import{h as R}from"./chunks/fetch-error.js";import{t as v,P as A}from"./chunks/rejectPurchaseOrders.js";import{a as ur,r as sr}from"./chunks/rejectPurchaseOrders.js";import{events as C}from"@dropins/tools/event-bus.js";import{c as _r,p as cr}from"./chunks/placeOrderForPurchaseOrder.js";import{a as nr,c as dr,g as pr,u as hr}from"./chunks/currencyInfo.js";import{d as gr,g as yr}from"./chunks/getPurchaseOrderApprovalRules.js";import{g as Rr}from"./chunks/getPurchaseOrders.js";import{g as Er}from"./chunks/getPurchaseOrderApprovalRule.js";import{P as br}from"./chunks/permissions.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-purchase-order-approval-rule.js";import"./chunks/case-converter.js";const S=`
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
- `,I=`
3
+ import{Initializer as v}from"@dropins/tools/lib.js";import{f as i,h as p}from"./chunks/fetch-graphql.js";import{g as K,r as W,s as X,a as Y,b as Z}from"./chunks/fetch-graphql.js";import{h}from"./chunks/fetch-error.js";import{P as d,t as l}from"./chunks/rejectPurchaseOrders.js";import{a as er,r as sr}from"./chunks/rejectPurchaseOrders.js";import{events as I}from"@dropins/tools/event-bus.js";import{c as ar,p as or}from"./chunks/placeOrderForPurchaseOrder.js";import{a as ur}from"./chunks/addPurchaseOrderComment.js";import{a as ir,c as pr,g as hr,u as dr}from"./chunks/currencyInfo.js";import{d as _r,g as Or}from"./chunks/getPurchaseOrderApprovalRules.js";import{g as Pr}from"./chunks/getPurchaseOrders.js";import{g as mr}from"./chunks/getPurchaseOrderApprovalRule.js";import{P as gr}from"./chunks/permissions.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/transform-purchase-order-approval-rule.js";import"./chunks/case-converter.js";const y=`
375
4
  query GET_PURCHASE_ORDER($uid: ID!) {
376
5
  customer {
377
6
  purchase_order(uid: $uid) {
378
- uid
379
- number
380
- created_at
381
- updated_at
382
- status
383
- available_actions
384
- created_by {
385
- firstname
386
- lastname
387
- email
388
- }
389
- order {
390
- id
391
- number
392
- total {
393
- grand_total {
394
- value
395
- currency
396
- }
397
- }
398
- }
399
- quote {
400
- ...PURCHASE_ORDER_QUOTE_FRAGMENT
401
- }
7
+ ...PURCHASE_ORDERS_FRAGMENT
402
8
  }
403
9
  }
404
10
  }
405
- ${S}
406
- `,U=async r=>{if(!r||r.trim()==="")throw new Error("Purchase Order UID is required");return y(I,{variables:{uid:r}}).then(i=>{var t,a,e;(t=i.errors)!=null&&t.length&&R(i.errors);const l=(e=(a=i.data)==null?void 0:a.customer)==null?void 0:e.purchase_order;if(!l)throw new Error("Failed to get purchase order");return{purchaseOrder:v(l)}}).catch(O)},w=new D({init:async r=>{var t,a;const i={};if(w.config.setConfig({...i,...r}),typeof(r==null?void 0:r.poRef)=="string"&&r.poRef.trim()!==""){const e=await U(r.poRef);(t=e==null?void 0:e.purchaseOrder)!=null&&t.quote&&C.emit("order/data",{...e.purchaseOrder.quote,poNumber:(a=e==null?void 0:e.purchaseOrder)==null?void 0:a.number})}},listeners:()=>[]}),B=w.config,T=`
11
+ ${d}
12
+ `,T=async r=>{if(!r||r.trim()==="")throw new Error("Purchase Order UID is required");return i(y,{variables:{uid:r}}).then(o=>{var a,s,e;(a=o.errors)!=null&&a.length&&h(o.errors);const u=(e=(s=o.data)==null?void 0:s.customer)==null?void 0:e.purchase_order;if(!u)throw new Error("Failed to get purchase order");return{purchaseOrder:l(u)}}).catch(p)},w=new v({init:async r=>{var a,s;const o={};if(w.config.setConfig({...o,...r}),typeof(r==null?void 0:r.poRef)=="string"&&r.poRef.trim()!==""){const e=await T(r.poRef);(a=e==null?void 0:e.purchaseOrder)!=null&&a.quote&&I.emit("order/data",{...e.purchaseOrder.quote,poNumber:(s=e==null?void 0:e.purchaseOrder)==null?void 0:s.number})}},listeners:()=>[]}),k=w.config,U=`
407
13
  mutation VALIDATE_PURCHASE_ORDERS($input: ValidatePurchaseOrdersInput!) {
408
14
  validatePurchaseOrders(input: $input) {
409
15
  errors {
@@ -415,40 +21,8 @@ import{Initializer as D}from"@dropins/tools/lib.js";import{f as y,h as O}from"./
415
21
  }
416
22
  }
417
23
  }
418
- ${A}
419
- `,J=async r=>{const i=Array.isArray(r)?r:[r];if(!i||i.length===0)throw new Error("Purchase Order UID(s) are required");if(i.some(t=>!t||t.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return y(T,{variables:{input:{purchase_order_uids:i}}}).then(t=>{var e,_;(e=t.errors)!=null&&e.length&&R(t.errors);const a=(_=t.data)==null?void 0:_.validatePurchaseOrders;return{errors:((a==null?void 0:a.errors)??[]).map(s=>({message:(s==null?void 0:s.message)??"",type:(s==null?void 0:s.type)??""})),purchaseOrders:((a==null?void 0:a.purchase_orders)||[]).map(v)}}).catch(O)},q=`
420
- mutation ADD_PURCHASE_ORDER_COMMENT(
421
- $purchaseOrderUid: ID!
422
- $comment: String!
423
- ) {
424
- addPurchaseOrderComment(
425
- input: { purchase_order_uid: $purchaseOrderUid, comment: $comment }
426
- ) {
427
- comment {
428
- created_at
429
- text
430
- uid
431
- author {
432
- allow_remote_shopping_assistance
433
- confirmation_status
434
- created_at
435
- date_of_birth
436
- email
437
- firstname
438
- gender
439
- job_title
440
- lastname
441
- middlename
442
- prefix
443
- status
444
- structure_id
445
- suffix
446
- telephone
447
- }
448
- }
449
- }
450
- }
451
- `,H=r=>{var l,t,a,e,_,s,c,o,n,d,p,h,f,g,E;const i=((t=(l=r==null?void 0:r.cart)==null?void 0:l.itemsV2)==null?void 0:t.items)??[];return{cart:{id:((a=r==null?void 0:r.cart)==null?void 0:a.id)??"",items:i.map(u=>{var P,b,x;return{uid:(u==null?void 0:u.uid)??"",quantity:(u==null?void 0:u.quantity)??0,product:{uid:((P=u==null?void 0:u.product)==null?void 0:P.uid)??"",name:((b=u==null?void 0:u.product)==null?void 0:b.name)??"",sku:((x=u==null?void 0:u.product)==null?void 0:x.sku)??""}}}),pagination:{currentPage:((s=(_=(e=r==null?void 0:r.cart)==null?void 0:e.itemsV2)==null?void 0:_.page_info)==null?void 0:s.current_page)??1,pageSize:((n=(o=(c=r==null?void 0:r.cart)==null?void 0:c.itemsV2)==null?void 0:o.page_info)==null?void 0:n.page_size)??20,totalPages:((h=(p=(d=r==null?void 0:r.cart)==null?void 0:d.itemsV2)==null?void 0:p.page_info)==null?void 0:h.total_pages)??0,totalCount:((g=(f=r==null?void 0:r.cart)==null?void 0:f.itemsV2)==null?void 0:g.total_count)??0}},userErrors:((E=r==null?void 0:r.user_errors)==null?void 0:E.map(u=>({message:(u==null?void 0:u.message)??""})))??[]}},$=r=>{var i,l,t,a,e,_,s,c,o,n,d,p,h,f,g;return{createdAt:(r==null?void 0:r.created_at)??"",text:(r==null?void 0:r.text)??"",uid:(r==null?void 0:r.uid)??"",author:{allowRemoteShoppingAssistance:((i=r==null?void 0:r.author)==null?void 0:i.allow_remote_shopping_assistance)??!1,confirmationStatus:((l=r==null?void 0:r.author)==null?void 0:l.confirmation_status)??"",createdAt:((t=r==null?void 0:r.author)==null?void 0:t.created_at)??"",dateOfBirth:((a=r==null?void 0:r.author)==null?void 0:a.date_of_birth)??"",email:((e=r==null?void 0:r.author)==null?void 0:e.email)??"",firstname:((_=r==null?void 0:r.author)==null?void 0:_.firstname)??"",gender:((s=r==null?void 0:r.author)==null?void 0:s.gender)??0,jobTitle:((c=r==null?void 0:r.author)==null?void 0:c.job_title)??"",lastname:((o=r==null?void 0:r.author)==null?void 0:o.lastname)??"",middlename:((n=r==null?void 0:r.author)==null?void 0:n.middlename)??"",prefix:((d=r==null?void 0:r.author)==null?void 0:d.prefix)??"",status:((p=r==null?void 0:r.author)==null?void 0:p.status)??"",structureId:((h=r==null?void 0:r.author)==null?void 0:h.structure_id)??"",suffix:((f=r==null?void 0:r.author)==null?void 0:f.suffix)??"",telephone:((g=r==null?void 0:r.author)==null?void 0:g.telephone)??""}}},K=async(r,i)=>{if(!r)throw new Error("Purchase Order ID is required");if(!i)throw new Error("Comment text is required");return y(q,{variables:{purchaseOrderUid:r,comment:i}}).then(t=>{var a,e,_;return(a=t.errors)!=null&&a.length&&R(t.errors),$((_=(e=t.data)==null?void 0:e.addPurchaseOrderComment)==null?void 0:_.comment)}).catch(O)},M=`
24
+ ${d}
25
+ `,L=async r=>{const o=Array.isArray(r)?r:[r];if(!o||o.length===0)throw new Error("Purchase Order UID(s) are required");if(o.some(a=>!a||a.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return i(U,{variables:{input:{purchase_order_uids:o}}}).then(a=>{var e,n;(e=a.errors)!=null&&e.length&&h(a.errors);const s=(n=a.data)==null?void 0:n.validatePurchaseOrders;return{errors:((s==null?void 0:s.errors)??[]).map(c=>({message:(c==null?void 0:c.message)??"",type:(c==null?void 0:c.type)??""})),purchaseOrders:((s==null?void 0:s.purchase_orders)||[]).map(l)}}).catch(p)},H=r=>{var u,a,s,e,n,c,_,O,R,P,E,m,f,g,A;const o=((a=(u=r==null?void 0:r.cart)==null?void 0:u.itemsV2)==null?void 0:a.items)??[];return{cart:{id:((s=r==null?void 0:r.cart)==null?void 0:s.id)??"",items:o.map(t=>{var C,D,S;return{uid:(t==null?void 0:t.uid)??"",quantity:(t==null?void 0:t.quantity)??0,product:{uid:((C=t==null?void 0:t.product)==null?void 0:C.uid)??"",name:((D=t==null?void 0:t.product)==null?void 0:D.name)??"",sku:((S=t==null?void 0:t.product)==null?void 0:S.sku)??""}}}),pagination:{currentPage:((c=(n=(e=r==null?void 0:r.cart)==null?void 0:e.itemsV2)==null?void 0:n.page_info)==null?void 0:c.current_page)??1,pageSize:((R=(O=(_=r==null?void 0:r.cart)==null?void 0:_.itemsV2)==null?void 0:O.page_info)==null?void 0:R.page_size)??20,totalPages:((m=(E=(P=r==null?void 0:r.cart)==null?void 0:P.itemsV2)==null?void 0:E.page_info)==null?void 0:m.total_pages)??0,totalCount:((g=(f=r==null?void 0:r.cart)==null?void 0:f.itemsV2)==null?void 0:g.total_count)??0}},userErrors:((A=r==null?void 0:r.user_errors)==null?void 0:A.map(t=>({message:(t==null?void 0:t.message)??""})))??[]}},$=`
452
26
  mutation ADD_PURCHASE_ORDER_ITEMS_TO_CART(
453
27
  $purchaseOrderUid: ID!
454
28
  $cartId: String!
@@ -483,7 +57,7 @@ import{Initializer as D}from"@dropins/tools/lib.js";import{f as y,h as O}from"./
483
57
  }
484
58
  }
485
59
  }
486
- `,W=async(r,i,l=!1)=>{if(!r)throw new Error("Purchase Order UID is required");if(!i)throw new Error("Cart ID is required");return y(M,{variables:{purchaseOrderUid:r,cartId:i,replaceExistingCartItems:l}}).then(a=>{var _,s;(_=a.errors)!=null&&_.length&&R(a.errors);const e=(s=a.data)==null?void 0:s.addPurchaseOrderItemsToCart;if(!(e!=null&&e.cart))throw new Error("Failed to add purchase order items to cart");return H(e)}).catch(O)},F=`
60
+ `,Q=async(r,o,u=!1)=>{if(!r)throw new Error("Purchase Order UID is required");if(!o)throw new Error("Cart ID is required");return i($,{variables:{purchaseOrderUid:r,cartId:o,replaceExistingCartItems:u}}).then(s=>{var n,c;(n=s.errors)!=null&&n.length&&h(s.errors);const e=(c=s.data)==null?void 0:c.addPurchaseOrderItemsToCart;if(!(e!=null&&e.cart))throw new Error("Failed to add purchase order items to cart");return H(e)}).catch(p)},x=`
487
61
  mutation PLACE_PURCHASE_ORDER($input: PlacePurchaseOrderInput!) {
488
62
  placePurchaseOrder(input: $input) {
489
63
  purchase_order {
@@ -491,6 +65,6 @@ import{Initializer as D}from"@dropins/tools/lib.js";import{f as y,h as O}from"./
491
65
  }
492
66
  }
493
67
  }
494
- ${A}
495
- `,X=async r=>{if(!r||r.trim()==="")throw new Error("Cart ID is required");return y(F,{variables:{input:{cart_id:r}}}).then(l=>{var e,_,s;(e=l.errors)!=null&&e.length&&R(l.errors);const t=(s=(_=l.data)==null?void 0:_.placePurchaseOrder)==null?void 0:s.purchase_order,a=v(t);return C.emit("purchase-order/placed",a),{purchaseOrder:a}}).catch(O)};export{br as PO_PERMISSIONS,K as addPurchaseOrderComment,W as addPurchaseOrderItemsToCart,ur as approvePurchaseOrders,_r as cancelPurchaseOrders,B as config,nr as createPurchaseOrderApprovalRule,dr as currencyInfo,gr as deletePurchaseOrderApprovalRule,y as fetchGraphQl,m as getConfig,U as getPurchaseOrder,Er as getPurchaseOrderApprovalRule,pr as getPurchaseOrderApprovalRuleMetadata,yr as getPurchaseOrderApprovalRules,Rr as getPurchaseOrders,w as initialize,cr as placeOrderForPurchaseOrder,X as placePurchaseOrder,sr as rejectPurchaseOrders,rr as removeFetchGraphQlHeader,er as setEndpoint,ar as setFetchGraphQlHeader,tr as setFetchGraphQlHeaders,hr as updatePurchaseOrderApprovalRule,J as validatePurchaseOrders};
68
+ ${d}
69
+ `,j=async r=>{if(!r||r.trim()==="")throw new Error("Cart ID is required");return i(x,{variables:{input:{cart_id:r}}}).then(u=>{var e,n,c;(e=u.errors)!=null&&e.length&&h(u.errors);const a=(c=(n=u.data)==null?void 0:n.placePurchaseOrder)==null?void 0:c.purchase_order,s=l(a);return I.emit("purchase-order/placed",s),{purchaseOrder:s}}).catch(p)};export{gr as PO_PERMISSIONS,ur as addPurchaseOrderComment,Q as addPurchaseOrderItemsToCart,er as approvePurchaseOrders,ar as cancelPurchaseOrders,k as config,ir as createPurchaseOrderApprovalRule,pr as currencyInfo,_r as deletePurchaseOrderApprovalRule,i as fetchGraphQl,K as getConfig,T as getPurchaseOrder,mr as getPurchaseOrderApprovalRule,hr as getPurchaseOrderApprovalRuleMetadata,Or as getPurchaseOrderApprovalRules,Pr as getPurchaseOrders,w as initialize,or as placeOrderForPurchaseOrder,j as placePurchaseOrder,sr as rejectPurchaseOrders,W as removeFetchGraphQlHeader,X as setEndpoint,Y as setFetchGraphQlHeader,Z as setFetchGraphQlHeaders,dr as updatePurchaseOrderApprovalRule,L as validatePurchaseOrders};
496
70
  //# sourceMappingURL=api.js.map