@dropins/storefront-purchase-order 1.0.0-beta3 → 1.0.0-beta5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +59 -60
- package/api.js +1 -1
- package/chunks/FormLoader.js +1 -1
- package/chunks/PurchaseOrderHistoryLogContent.js +1 -1
- package/chunks/PurchaseOrdersHeader.js +1 -1
- package/chunks/PurchaseOrdersTableActions.js +1 -1
- package/chunks/addPurchaseOrderComment.js +1 -1
- package/chunks/case-converter.js +1 -1
- package/chunks/currencyInfo.js +1 -1
- package/chunks/fetch-graphql.js +1 -1
- package/chunks/formatDate.js +1 -1
- package/chunks/getPurchaseOrderApprovalRule.js +1 -1
- package/chunks/getPurchaseOrderApprovalRules.js +1 -1
- package/chunks/getPurchaseOrders.js +1 -1
- package/chunks/pageSize.config.js +1 -1
- package/chunks/permissions.js +1 -1
- package/chunks/placeOrderForPurchaseOrder.js +1 -1
- package/chunks/rejectPurchaseOrders.js +1 -1
- package/chunks/transform-purchase-order-approval-rule.js +1 -1
- package/chunks/useCustomerRolePermissions.js +1 -1
- package/chunks/usePurchaseOrderData.js +1 -1
- package/chunks/usePurchaseOrders.js +1 -1
- package/containers/ApprovalRuleDetails.js +1 -1
- package/containers/ApprovalRuleForm.js +1 -1
- package/containers/ApprovalRulesList.js +1 -1
- package/containers/CompanyPurchaseOrders.js +1 -1
- package/containers/CustomerPurchaseOrders.js +1 -1
- package/containers/PurchaseOrderApprovalFlow.js +1 -1
- package/containers/PurchaseOrderCommentForm.js +1 -1
- package/containers/PurchaseOrderCommentsList.js +1 -1
- package/containers/PurchaseOrderConfirmation.js +1 -1
- package/containers/PurchaseOrderHistoryLog.js +1 -1
- package/containers/PurchaseOrderStatus.js +1 -1
- package/containers/RequireApprovalPurchaseOrders.js +1 -1
- package/package.json +1 -1
- package/render.js +1 -1
package/LICENSE.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Last Updated: 28 October 2024
|
|
1
|
+
Last Updated: 8 December 2025
|
|
3
2
|
|
|
4
|
-
ADOBE COMMERCE DROP-IN LICENSE AGREEMENT
|
|
3
|
+
**ADOBE COMMERCE DROP-IN LICENSE AGREEMENT**
|
|
5
4
|
|
|
6
|
-
applicable to Adobe Commerce Customers
|
|
5
|
+
applicable to Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer Customers
|
|
7
6
|
|
|
8
7
|
**Effective Date:** first date you download or use the Drop-in
|
|
9
8
|
|
|
10
|
-
NOTICE TO USER: The Adobe Commerce Drop-in (
|
|
9
|
+
NOTICE TO USER: The Adobe Commerce Drop-ins are licensed only for use with Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer. The Adobe Commerce Drop-in ("Drop-in") is licensed to you subject to the terms and conditions below which form a binding agreement between you and Adobe. **By downloading, installing, or making use of any portion of the Drop-in, you are agreeing to the following terms and conditions. If you do not agree to the terms and conditions below, do not use the Drop-in**. If you agree to be bound by this agreement on behalf of your employer or other entity, you must have the legal authority to do so. If you are not authorized to so bind your employer or such entity, do not download and do not use the Drop-in.
|
|
11
10
|
|
|
12
11
|
Your access to and use of the Drop-in is governed by the Adobe Enterprise Licensing Terms previously agreed to by you and Adobe or an authorized Adobe Reseller in a separate agreement. If you have not previously agreed to licensing terms then your installation and use of the Drop-in is subject to the current applicable Adobe Enterprise Licensing Terms available at <http://www.adobe.com/legal/terms/enterprise-licensing.html>. You agree that this agreement will have the same effect as any written negotiated agreement signed by you.
|
|
13
12
|
|
|
@@ -15,7 +14,7 @@ By downloading, installing or making use of any portion of the Drop-in, you acce
|
|
|
15
14
|
|
|
16
15
|
This agreement is enforceable against any person or entity that installs and uses the Drop-in and any person or entity (e.g., system integrator, consultant or contractor) that installs or uses the drop-in on another person's or entity's behalf (e.g., Adobe Customer).
|
|
17
16
|
|
|
18
|
-
Notice to U.S. Government End Users: Products and services are
|
|
17
|
+
Notice to U.S. Government End Users: Products and services are "Commercial Product(s)," and "Commercial Service(s)" as those terms are defined at 48 C.F.R. section 2.101, consisting of "Commercial Computer Software" and "Commercial Computer Software Documentation," as the terms are used in 48 C.F.R. section 12.212 or 48 C.F.R. section 227.7202, as applicable. Customer agrees, consistent with 48 C.F.R. section 12.212 or 48 C.F.R. sections 227.7202-1 through 227.72024, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (A) only as Commercial Products and Services; and (B) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished rights are reserved under the copyright laws of the United States.
|
|
19
18
|
|
|
20
19
|
**ADOBE COMMERCE DROP-IN LICENSE AGREEMENT**
|
|
21
20
|
|
|
@@ -23,89 +22,89 @@ applicable to Developers
|
|
|
23
22
|
|
|
24
23
|
**Effective Date:** first date you download or use the Drop-in
|
|
25
24
|
|
|
26
|
-
The Adobe Commerce Drop-in (
|
|
25
|
+
The Adobe Commerce Drop-ins are licensed only for use with Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer. The Adobe Commerce Drop-in ("Drop-in") is licensed to you subject to the terms and conditions below which form a binding agreement between you and Adobe. **By downloading, installing, or making use of any portion of the Drop-in, you are agreeing to the following terms and conditions. If you do not agree to the terms and conditions below, do not use the Drop-in**. If you agree to be bound by this agreement on behalf of your employer or other entity, you must have the legal authority to do so. If you are not authorized to so bind your employer or such entity, do not download and do not use the Drop-in.
|
|
27
26
|
|
|
28
27
|
**AGREED TERMS AND CONDITIONS**
|
|
29
28
|
|
|
30
29
|
1. **DEFINITIONS**.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
|
|
31
|
+
1.1 "**Adobe**" means collectively, Adobe Inc., a company incorporated in Delaware, U.S.A., having a place of business at 345 Park Avenue, San Jose, California USA 95110-2704, U.S.A. ("**Adobe US**") and Adobe Systems Software Ireland, company incorporated in Ireland, having a place of business 4-6 Riverwalk, City West Business Campus, Saggart, Dublin 24, Ireland ("**Adobe Ireland**").
|
|
32
|
+
|
|
33
|
+
1.2 "**Adobe Product(s)**" means software applications, programs and other technologies not included in or with the Drop-in which are or may be made available by Adobe for licensing to the general public. This agreement does not govern use of Adobe Products. See the end user license agreement accompanying an Adobe Product for terms governing its use.
|
|
34
|
+
|
|
35
|
+
1.3 "**Developer Product(s)**" means any software application(s), program(s) and other technolog(y/ies) you develop with use of the Drop-in to function or interoperate with Adobe Products.
|
|
36
|
+
|
|
37
|
+
1.4 "**Intellectual Property Rights**" means copyright, moral rights, trademark, trade dress, patent, trade secret, unfair competition, and any other intellectual and proprietary rights.
|
|
38
|
+
|
|
39
|
+
1.5 "**Adobe Commerce Drop-in**" or "Drop-in" means all items comprising the application and all associated materials licensed to you by Adobe as part of the Drop-in, including all Drop-in system files, tools, programs and utilities, as well as any plug-ins or other application programming interfaces, header or JAR files ("**API**"), sample images, sounds, or similar assets ("**Content** **Files**"), software code samples, runtimes and libraries, including any portion(s) that is modified by you, or merged or incorporated with your Developer Products ("**Sample Code**"), and any related documentation, technical specifications, notes and explanatory materials, as well any modifications, updates, upgrades, or copies of, any of the foregoing items, that may be made available by Adobe, whether online or recorded on media, or manually downloaded by you.
|
|
41
40
|
|
|
42
41
|
2. **LICENSES GRANTED TO YOU**.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
|
|
43
|
+
2.1 **Drop-in**. Subject to your compliance with terms of this agreement, Adobe grants to you a non-exclusive, non-sublicensable, non-transferable license to install and use the Drop-in solely for your internal design, development and testing of your Developer Products, subject further to the requirements and limitations below.
|
|
44
|
+
|
|
45
|
+
2.2 **API.** Subject to your compliance with terms of this agreement, Adobe grants to you a non-exclusive, non-sublicensable, non-transferable license to use the API only as provided in or by the applicable specification and to distribute the API solely in, with, and on the same media as, your Developer Products. For clarification, you may not modify the API.
|
|
46
|
+
|
|
47
|
+
2.3 **Content Files**. You may not use, modify, reproduce or distribute any of the Content Files. For the avoidance of doubt, the Content Files are included as examples only. You acquire no rights to the Content Files.
|
|
48
|
+
|
|
49
|
+
2.4 **Sample Code.** Subject to your compliance with terms of this agreement, Adobe grants to you a non-exclusive, non-sublicensable, non-transferable license to use, modify, merge, and redistribute (in object code form only) all or any portions of the Sample Code solely as part of, and as necessary to properly implement, the Drop-in in your Developer Products. All and any portion of the Sample Code that is modified or merged by you in your Developer Products is subject to the terms of this agreement.
|
|
51
50
|
|
|
52
51
|
3. **SCOPE OF LICENSE; LIMITATIONS AND RESTRICTIONS**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
|
|
53
|
+
3.1 You may not distribute the Drop-ins or any of its component parts to interoperate with or to run on a platform other than Adobe Commerce as a Cloud Service and Adobe Commerce Optimizer.
|
|
54
|
+
|
|
55
|
+
3.2 Third-Party Software. The Drop-ins may contain third-party software, subject to additional terms and conditions, available at <http://www.adobe.com/go/thirdparty>; and
|
|
56
|
+
|
|
57
|
+
3.3 You may not modify, port, adapt, create derivate works, redistribute, or translate any portion of this Drop-in; or add or delete any Drop-in program files that would in any way result in modifying the functionality or appearance of any element of the Adobe Products.
|
|
58
|
+
|
|
59
|
+
3.4 You may not reverse engineer, decompile, disassemble, or otherwise attempt to discover the source code of, any portion of the Drop-in, except and only to the extent that applicable laws of the jurisdiction where you are located grant you the right to decompile the Drop-in in order to obtain information necessary to render the Drop-in interoperable with other software; in which case you must first request the information from Adobe in writing and Adobe may, in its discretion, either provide such information to you or impose reasonable conditions, including reasonable fees, on your use of the Drop-in to ensure that Adobe's and its licensors' Intellectual Proprietary Rights in the Drop-in are protected.
|
|
60
|
+
|
|
61
|
+
3.5 You may not unbundle, repackage, distribute, rent, lease, offer, sell, resale, sublicense, assign or transfer all, or any component parts of the Drop-in, or any of your rights in the Drop-in, nor authorize any portion of the Drop-in to be copied onto another's device, computer or platform, including on a service bureau basis to other providers (i.e., volume printing, banking, payroll service providers, etc) who provide you free or fee-based business services.
|
|
63
62
|
|
|
64
63
|
4. **VIRAL OPEN SOURCE SOFTWARE AND SERVICES**
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
You are not licensed to (and you agree that you will not) merge, integrate or use the Drop-in with any Viral Open Source Software or Viral Service, or otherwise take any action that could require disclosure, distribution, or licensing of all or any part of the Drop-in in source code form for any purpose whatsoever. For purposes of this Section, "**Viral Open Source Software**" means software licensed under the GNU General Public License, the GNU Affero General Public License (AGPL), the GNU Lesser General Public License (LGPL), or any other license terms that would require, or condition your use, modification, or distribution of such licensed software on the disclosure, distribution, or licensing of any other software in source code form, for the purpose of making derivative works, or at no charge, and "**Viral Service**" means any service that contains any viruses, Trojan horses, worms, time bombs, cancelbots or other computer programming routines that are intended to damage, detrimentally interfere with, surreptitiously intercept, expropriate or deprive owners' possession of any system, data or personal information, or that in any way violates any law, statute, ordinance, regulation or rights (including any law, regulations or rights respecting intellectual property, computer spyware, privacy, export control, unfair competition, antidiscrimination or false advertising), or otherwise interferes with the operability of Adobe Products or third-party programs or software.
|
|
67
66
|
|
|
68
67
|
5. **NON-BLOCKING OF ADOBE DEVELOPMENT**
|
|
69
68
|
|
|
70
|
-
|
|
69
|
+
You acknowledge that Adobe is currently developing or may develop technologies and Adobe Products in the future that have, or may have, design or functionality similar to Developer Products that you may develop based on the license granted to you in this agreement. Nothing in this agreement will impair, limit or curtail Adobe's right to continue with its development, maintenance or distribution of Adobe Products. You agree that you will not assert in any way any patent owned by you arising out of or in connection with your use of the Drop-in, or any Drop-in modifications made by you, against Adobe, its customers, subsidiaries or affiliates, or any of their customers, direct or indirect, agents and contractors for the manufacture, use, import, license, offer for sale, or sale of any Adobe Products.
|
|
71
70
|
|
|
72
71
|
6. **OWNERSHIP; INTELLECTUAL PROPERTY RIGHTS**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
|
|
73
|
+
6.1 The items contained in the Drop-in are the Intellectual Property of Adobe and its licensors and are protected by United States copyright and patent law, international treaty provisions and applicable laws of the country in which it is being used. Adobe and its licensors reserve all rights not expressly granted to you under this agreement, and retain all right, title, and interest in the Drop-in, including all Intellectual Property Rights.
|
|
74
|
+
|
|
75
|
+
6.2 The Drop-in, or any of its component parts, may be supplied to you with certain accompanying proprietary notices, including patent, copyright and trademark notices. You agree to protect all copyright and other ownership interests of Adobe and its licensors in the Drop-in supplied to you under this agreement; to preserve exactly (and not remove or alter) all proprietary notices displayed in or on the Drop-in; to reproduce the same proprietary notices in all copies you make of any portion of the Drop-in.
|
|
76
|
+
|
|
77
|
+
6.3 You agree to include in your Developer Products Adobe's copyright notices, wherever such notices are customarily posted, in substantially the following form: _Portions of software used to develop this product copyrighted by Adobe and its licensors. All Rights Reserved_.
|
|
78
|
+
|
|
79
|
+
6.4 Nothing in this agreement gives you a right to use the name, logo or trademarks of Adobe or its licensors to market your Developer Products.
|
|
81
80
|
|
|
82
81
|
7. **CONFIDENTIAL INFORMATION**
|
|
83
82
|
|
|
84
|
-
|
|
83
|
+
With respect to the API, and any portion, included in the Drop-in (for purposes of this Section, "**Adobe Confidential Information**"), you will treat the Adobe Confidential Information, and exercise the same degree of care to protect it, as you afford to your own confidential information. Your obligations under this Section will terminate when you can document that (a) the Adobe Confidential Information was in the public domain at or subsequent to the time Adobe communicated or provided it to you with no fault of your own; (b) your employees or agents developed independently without reference to any Adobe Confidential Information Adobe communicated or provided to you; or (c) your communication of Adobe Confidential Information was in response to a valid order by a court or other governmental body, was otherwise required by law, or was necessary to establish the rights of a party under this agreement.
|
|
85
84
|
|
|
86
85
|
8. **TERM; TERMINATION**
|
|
87
86
|
|
|
88
|
-
|
|
87
|
+
This agreement will commence on the Effective Date and will continue unless terminated. Adobe may terminate this agreement immediately upon notice to you, and without judicial intervention, if you fail to comply with any term of its terms. You may terminate this agreement at any time by discontinuing all your use(s) of the Drop-in and you agree to destroying or removing all full and partial copies of the Drop-in from your computer. If requested by Adobe, you must demonstrate proof of your compliance with the terms of this Section. In the event of termination, the terms of this agreement that, by their nature, are meant to survive termination, including all terms relating to viral open source software and services, ownership, confidential information, indemnity obligations and procedures, disclaimers of warranty, limitations on and exclusions of remedies and damages, dispute resolution, and waiver, will survive termination of this agreement.
|
|
89
88
|
|
|
90
89
|
9. **DISCLAIMER OF WARRANTY; LIMITATION OF LIABILITY**
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
You expressly understand and agree that, to the maximum extent permitted by applicable law:
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
9.1 **Use of the DROP-IN is entirely at your own risk. The Drop-in is provided by Adobe "AS-IS" and with all faults. Adobe and its licensors are not liable to you or anyone else for any special, incidental, indirect, consequential, or punitive damages whatsoever (even if Adobe has been advised of the possibility of such damages), including (a) damages resulting from loss of use, data, or profits, whether or not foreseeable, (b) damages based on any theory of liability, including breach of contract or warranty, negligence or other tortious action, or (c) damages arising from any other claim arising out of or in connection with your use of the Drop-in.**
|
|
94
|
+
|
|
95
|
+
9.2 **Adobe's total liability in any matter arising out of or related to these terms is limited to US $100. This limitation will apply even if Adobe has been advised of the possibility of such damages and regardless of any failure of the essential purpose of any limited remedy.**
|
|
97
96
|
|
|
98
97
|
10. **INDEMNIFICATION**
|
|
99
98
|
|
|
100
|
-
To the maximum extent permitted by law, you agree to indemnify Adobe, its subsidiaries, affiliates, officers, agents, employees, partners, licensors, or suppliers from any claim or demand, including reasonable attorneys
|
|
99
|
+
To the maximum extent permitted by law, you agree to indemnify Adobe, its subsidiaries, affiliates, officers, agents, employees, partners, licensors, or suppliers from any claim or demand, including reasonable attorneys' fees, that arise from the use and distribution of your Developer Products that contain or are based upon any portion of the Drop-in, or from your violation of the terms of this agreement.
|
|
101
100
|
|
|
102
101
|
11. **DISPUTE RESOLUTION**
|
|
103
102
|
|
|
104
103
|
11.1 **Choice of Law.** If you are a resident of North America (or if your organization is headquartered in North America), your relationship is with Adobe Systems Incorporated, a United States company, and the Drop-in is governed by the law of California, U.S.A. If you reside outside of North America, your relationship is with Adobe Systems Software Ireland Limited, and the Drop-in is governed by the law of Ireland.
|
|
105
|
-
|
|
104
|
+
|
|
106
105
|
11.2 **Venue.** You agree that any claim or dispute you may have against Adobe must be resolved by a court located in Santa Clara County, California, United States of America. You agree to submit to the personal jurisdiction of the courts located in Santa Clara County, California, United States of America when the laws of California apply, and the courts of Dublin, Ireland, when the laws of Ireland applies, for the purpose of litigating such claims or disputes. The parties specifically disclaim the U.N. Convention on Contracts for the International Sale of Goods.
|
|
107
|
-
|
|
108
|
-
11.3 **Injunctive Relief.** Notwithstanding the foregoing, in the event of your or others
|
|
106
|
+
|
|
107
|
+
11.3 **Injunctive Relief.** Notwithstanding the foregoing, in the event of your or others' unauthorized access to or use of the Drop-in in violation of this Agreement, you agree that Adobe is entitled to apply for injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
|
|
109
108
|
|
|
110
109
|
12. **EXPORT RULES**
|
|
111
110
|
|
|
@@ -113,16 +112,16 @@ The Adobe Commerce Drop-in (“Drop-in”) is licensed to you subject to the ter
|
|
|
113
112
|
|
|
114
113
|
13. **NOTICE TO U.S. GOVERNMENT END USERS**
|
|
115
114
|
|
|
116
|
-
Products and services are
|
|
115
|
+
Products and services are "Commercial Product(s)," and "Commercial Service(s)" as those terms are defined at 48 C.F.R. section 2.101, consisting of "Commercial Computer Software" and "Commercial Computer Software Documentation," as the terms are used in 48 C.F.R. section 12.212 or 48 C.F.R. section 227.7202, as applicable. Customer agrees, consistent with 48 C.F.R. section 12.212 or 48 C.F.R. sections 227.7202-1 through 227.72024, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (A) only as Commercial Products and Services; and (B) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished rights are reserved under the copyright laws of the United States.
|
|
117
116
|
|
|
118
117
|
14. **GENERAL PROVISIONS**
|
|
119
118
|
|
|
120
119
|
14.1 **Severability.** If it turns out that a particular term is not enforceable, the unenforceability of that term will not affect any other terms.
|
|
121
|
-
|
|
120
|
+
|
|
122
121
|
14.2 **Modification; Waiver.** No provision of this agreement will be deemed to have been modified or waived by any act or acquiescence on the part of Adobe, its agents, or employees, but only by any instrument in writing, signed by an authorized officer of Adobe.
|
|
123
|
-
|
|
122
|
+
|
|
124
123
|
14.3 **English Version.** The English language version of this agreement will be the version used when interpreting or construing its terms.
|
|
125
|
-
|
|
124
|
+
|
|
126
125
|
14.4 **Entire Agreement.** This Agreement is the entire agreement, superseding any prior written or oral agreements, between you and Adobe relating to the Drop-in.
|
|
127
126
|
|
|
128
|
-
Adobe Commerce Drop-in License Agreement_en_US-
|
|
127
|
+
Adobe Commerce Drop-in License Agreement_en_US-20251208_v1
|
package/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{Initializer as v}from"@dropins/tools/lib.js";import{f as p,h,a as d}from"./chunks/fetch-graphql.js";import{g as K,r as W,s as X,b as Y,c as Z}from"./chunks/fetch-graphql.js";import{P as R,t as _}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 Rr,g as _r}from"./chunks/getPurchaseOrderApprovalRules.js";import{g as Or}from"./chunks/getPurchaseOrders.js";import{g as Er}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 T=`
|
|
4
4
|
query GET_PURCHASE_ORDER($uid: ID!) {
|
package/chunks/FormLoader.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as e,jsxs as m}from"@dropins/tools/preact-jsx-runtime.js";import{classes as l}from"@dropins/tools/lib.js";import"./PurchaseOrderHistoryLogContent.js";const c=1,t=({className:r,fullWidth:o=!1,lines:i=c,size:a="small",variant:s="row",children:n=null,multilineGap:f="medium",...d})=>{const u=[[`dropin-skeleton-row__${s}`,s],[`dropin-skeleton-row__${s}-${a}`,s&&a]];if(!n&&s==="empty")return e("div",{className:l(["dropin-skeleton-row dropin-skeleton-row__empty",r])});if(n){const p=n.trim();return e("div",{...d,class:l(["dropin-skeleton-row",["dropin-skeleton-row--full",o],r]),dangerouslySetInnerHTML:{__html:p}})}return i>c===!1?e("div",{...d,class:l(["dropin-skeleton-row",["dropin-skeleton-row--full",o],"dropin-skeleton--row__content",...u,r])}):e("div",{...d,style:{"--multiline-gap-spacing":`var(--spacing-${f})`},class:l(["dropin-skeleton-row--multiline",["dropin-skeleton-row--full",o],r]),children:Array.from({length:i}).map((p,w)=>e("div",{class:l(["dropin-skeleton-row",["dropin-skeleton-row--full",o],"dropin-skeleton--row__content",...u])},w))})},v=({className:r,children:o,rowGap:i="medium",...a})=>e("div",{style:{"--row-gap-spacing":`var(--spacing-${i})`},...a,className:l(["dropin-skeleton",r]),role:"status","aria-label":"Loading...",children:o}),y=({testId:r="",className:o=""})=>e("div",{"data-testid":r,className:l(["b2b-purchase-order-form-loader",o]),children:m(v,{rowGap:"medium","data-testid":"form-loader-root",children:[e(t,{size:"small",variant:"row",fullWidth:!0,lines:1,style:{maxWidth:300},"data-testid":"form-loader-status-toggle"}),e(t,{size:"medium",variant:"row",fullWidth:!0,lines:1,"data-testid":"form-loader-name"}),e(t,{size:"medium",variant:"row",fullWidth:!0,lines:4,"data-testid":"form-loader-description"}),m("div",{className:"approval-rule-form-loader__section","data-testid":"form-loader-approval-role-section",children:[e(t,{size:"small",variant:"row",fullWidth:!0,lines:1,"data-testid":"form-loader-approval-role-label"}),e(t,{size:"small",variant:"row",fullWidth:!0,lines:1,"data-testid":"form-loader-approval-role-input"})]}),m("div",{className:"approval-rule-form-loader__buttons","data-testid":"form-loader-buttons",children:[e(t,{size:"medium",variant:"row",fullWidth:!0,lines:1,style:{width:120},"data-testid":"form-loader-button-save"}),e(t,{size:"medium",variant:"row",fullWidth:!0,lines:1,style:{width:120},"data-testid":"form-loader-button-cancel"})]})]})});export{y as F};
|
|
4
4
|
//# sourceMappingURL=FormLoader.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
const e=[{key:"poNumber",label:"PO #"},{key:"status",label:"Status"},{key:"createdBy",label:"Created By"},{key:"action",label:"Actions"}],a=[{key:"checkboxView",label:""},...e];export{e as a,a as d};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrderHistoryLogContent.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{Header as a}from"@dropins/tools/components.js";import{classes as t}from"@dropins/tools/lib.js";import"./PurchaseOrderHistoryLogContent.js";const p=({headerText:e,divider:r=!1})=>s(a,{title:e,divider:r,className:t(["purchase-orders-header",["purchase-orders-header--with-divider",r]]),"data-testid":"purchase-orders-header"});export{p as P};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrdersHeader.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as e,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as t}from"@dropins/tools/lib.js";import"./PurchaseOrderHistoryLogContent.js";import{Button as c}from"@dropins/tools/components.js";const h=({loading:s,selectedCount:r,className:i,handleRejectSelected:o,handleApproveSelected:d})=>e("div",{className:t(["b2b-purchase-order-purchase-orders-table-actions",i]),children:[e("div",{children:["Selected ",r]}),e("div",{className:"b2b-purchase-order-purchase-orders-table-actions__buttons",children:[a(c,{variant:"secondary",onClick:o,disabled:s||r===0,children:"Reject selected"}),a(c,{variant:"primary",onClick:d,disabled:s||r===0,children:"Approve selected"})]})]});export{h as P};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrdersTableActions.js.map
|
package/chunks/case-converter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
const t=e=>{if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(t);const r={};for(const[n,s]of Object.entries(e)){const a=n.replace(/[A-Z]/g,c=>`_${c.toLowerCase()}`);r[a]=t(s)}return r};export{t};
|
|
4
4
|
//# sourceMappingURL=case-converter.js.map
|
package/chunks/currencyInfo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{f as n,h as l,a as i}from"./fetch-graphql.js";import{t as R}from"./transform-purchase-order-approval-rule.js";const p=a=>{var d,_;const t=(_=(d=a==null?void 0:a.data)==null?void 0:d.customer)==null?void 0:_.purchase_order_approval_rule_metadata,u=r=>{var s;return{id:(r==null?void 0:r.id)||"",sortOrder:(r==null?void 0:r.sort_order)||0,text:(r==null?void 0:r.text)||"",children:((s=r==null?void 0:r.children)==null?void 0:s.map(u))||void 0}},e=r=>({id:(r==null?void 0:r.id)||"",name:(r==null?void 0:r.name)||"",usersCount:(r==null?void 0:r.users_count)||0,permissions:((r==null?void 0:r.permissions)||[]).map(u)}),c=((t==null?void 0:t.available_applies_to)||[]).map(e),o=((t==null?void 0:t.available_requires_approval_from)||[]).map(e);return{availableAppliesTo:c,availableRequiresApprovalFrom:o}},A=`
|
|
4
4
|
mutation CREATE_PURCHASE_ORDER_APPROVAL_RULE(
|
package/chunks/fetch-graphql.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{events as r}from"@dropins/tools/event-bus.js";import{FetchGraphQL as h}from"@dropins/tools/fetch-graphql.js";const i=e=>{var o,n;if(e.length===1&&((n=(o=e[0])==null?void 0:o.path)==null?void 0:n.length)>0){const a=e[0].path[e[0].path.length-1];if(["applied_coupons","applied_gift_cards","available_payment_methods"].includes(a))return}const t=e.map(a=>a.message).join(" ");throw Error(t)},d=e=>{const s=e instanceof DOMException&&(e==null?void 0:e.name)==="AbortError",t=(e==null?void 0:e.name)==="PlaceOrderError";throw!s&&!t&&r.emit("purchase-order/error",{source:"purchase-order",type:"network",error:e.message}),e},{setEndpoint:g,setFetchGraphQlHeader:m,removeFetchGraphQlHeader:E,setFetchGraphQlHeaders:f,fetchGraphQl:w,getConfig:u}=new h().getMethods();export{d as a,m as b,f as c,w as f,u as g,i as h,E as r,g as s};
|
|
4
4
|
//# sourceMappingURL=fetch-graphql.js.map
|
package/chunks/formatDate.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{getGlobalLocale as c}from"@dropins/tools/lib.js";var n={};function i(e){if(e)return e;const r=c();return r||(n.LOCALE&&n.LOCALE!=="undefined"?n.LOCALE:"en-US")}const a=(e,r="en-US")=>{try{const t=new Date(e);if(isNaN(t.getTime()))return e;const o=i(r);return t.toLocaleString(o,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})}catch{return e}};export{a as f};
|
|
4
4
|
//# sourceMappingURL=formatDate.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{f as i,h as c,a as d}from"./fetch-graphql.js";import"@dropins/tools/lib.js";import{t as n}from"./transform-purchase-order-approval-rule.js";const l=`
|
|
4
4
|
query GET_PURCHASE_ORDER_APPROVAL_RULE($uid: ID!) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{f as R,h as P,a as S}from"./fetch-graphql.js";import{P as p,t as s}from"./rejectPurchaseOrders.js";import"@dropins/tools/lib.js";import{t as h}from"./case-converter.js";const $=`
|
|
4
4
|
query GET_PURCHASE_ORDERS(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as p,Fragment as k,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as W,Table as j,Pagination as B,Picker as F,Card as S}from"@dropins/tools/components.js";import{classes as h}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"./PurchaseOrderHistoryLogContent.js";import{useText as G,Text as D}from"@dropins/tools/i18n.js";const X=r=>{try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return r.startsWith("/")||r.startsWith("./")||r.startsWith("../")}},H=(r,a,s)=>{if(s<=0)return{from:0,to:0,total:0};const i=Math.max(1,Math.ceil(s/a)),c=Math.min(Math.max(r,1),i),l=(c-1)*a+1,n=Math.min(c*a,s);return{from:l,to:n,total:s}},Z=r=>{const a=r.toUpperCase();return["APPROVED","ORDER_PLACED","APPROVED_PENDING_PAYMENT","ENABLED"].includes(a)?"positive":["REJECTED","CANCELED","ORDER_FAILED","DISABLED"].includes(a)?"negative":"waiting"},$=({pageSizeConfig:r,totalCount:a=0,columns:s=[],rows:i=[],paginationConfig:c,alertMessageConfig:l={heading:"",description:"",type:"success"},loading:n=!1,className:m="",variant:x="secondary",skeletonRowCount:O=10,emptyTitle:T,header:b,footer:g,withWrapper:y,expandedRows:R})=>{var N;const w=G({title:"PurchaseOrders.purchaseOrdersTable.noPurchaseOrders.default"}),{heading:_,description:f,type:A}=l,{currentPage:P,totalPages:v,handlePageChange:C}=c,{pageSizeOptionsList:t,onChange:M}=r,o=t==null?void 0:t.find(u=>u.selected),L=o&&o.value!==void 0?Number(o.value):10,{from:I,to:U,total:V}=H(P,L,a),d=!n&&i.length===0,E=p(k,{children:[_||f?e(W,{heading:_,description:f,type:A}):null,b?e("div",{className:"purchase-orders-table__header",children:b}):null,e(j,{className:"purchase-orders-table__table-wrapper",mobileLayout:"stacked",columns:s,rowData:i,expandedRows:R,loading:n,skeletonRowCount:+O}),d&&e("div",{className:"purchase-orders-table__empty-state",role:"status","aria-live":"polite",children:e("p",{children:T||w.title})}),a>0?p("div",{className:"purchase-orders-table__pagination-wrapper",children:[e("div",{className:"purchase-orders-table__pagination-counter",children:e(D,{id:"PurchaseOrders.purchaseOrdersTable.pagination.status",fields:{from:I,to:U,total:V}})}),v>1&&e(B,{className:h(["purchase-orders-table__pagination",["purchase-orders-table__pagination--loading",n]]),currentPage:P,totalPages:v,onChange:C}),a>0&&t.length?p("div",{className:"purchase-orders-table__pagination-page-size",children:[e(D,{id:"PurchaseOrders.purchaseOrdersTable.pagination.pageSizeLabel.start"}),e(F,{disabled:n,handleSelect:M,options:t,value:((N=t==null?void 0:t.find(u=>u.selected))==null?void 0:N.value)||""})]}):null]}):null,g?e("div",{className:"purchase-orders-table__footer",children:g}):null]});return y?e(S,{variant:x,"data-testid":"purchaseOrdersTable",className:h(["b2b-purchase-order-purchase-orders-table",["b2b-purchase-order-purchase-orders-table--empty-state",d],m]),children:E}):e("div",{"data-testid":"purchaseOrdersTable",className:h(["b2b-purchase-order-purchase-orders-table",["b2b-purchase-order-purchase-orders-table--empty-state",d],m]),children:E})},ee=[{text:"10",value:"10",selected:!1},{text:"20",value:"20",selected:!0},{text:"30",value:"30",selected:!1},{text:"50",value:"50",selected:!1}];export{$ as P,ee as d,Z as g,X as i};
|
|
4
4
|
//# sourceMappingURL=pageSize.config.js.map
|
package/chunks/permissions.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
const r={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{r as P};
|
|
4
4
|
//# sourceMappingURL=permissions.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
const x=t=>{const s=_=>({id:(_==null?void 0:_.id)||"",name:(_==null?void 0:_.name)||"",usersCount:(_==null?void 0:_.users_count)||0,permissions:((_==null?void 0:_.permissions)||[]).map(y=>({id:(y==null?void 0:y.id)||"",sortOrder:(y==null?void 0:y.sort_order)||0,text:(y==null?void 0:y.text)||""}))}),f=_=>{var y,b;return{attribute:_==null?void 0:_.attribute,operator:_==null?void 0:_.operator,quantity:(_==null?void 0:_.quantity)||0,amount:{currency:((y=_==null?void 0:_.amount)==null?void 0:y.currency)||"USD",value:((b=_==null?void 0:_.amount)==null?void 0:b.value)||0}}};return{uid:(t==null?void 0:t.uid)||"",name:(t==null?void 0:t.name)||"",description:(t==null?void 0:t.description)||"",status:t==null?void 0:t.status,createdAt:(t==null?void 0:t.created_at)||"",updatedAt:(t==null?void 0:t.updated_at)||"",createdBy:t==null?void 0:t.created_by,appliesToRoles:((t==null?void 0:t.applies_to_roles)||[]).map(s),approverRoles:((t==null?void 0:t.approver_roles)||[]).map(s),condition:f((t==null?void 0:t.condition)||{})}};export{x as t};
|
|
4
4
|
//# sourceMappingURL=transform-purchase-order-approval-rule.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{useState as m,useEffect as p,useMemo as c}from"@dropins/tools/preact-hooks.js";import{events as u}from"@dropins/tools/event-bus.js";import{P as s}from"./permissions.js";const P=o=>{if(!o)return{isAdmin:!1,purchaseOrderEnabled:!1,role:{id:"",name:""},permissions:{purchaseOrderAll:!1,viewPurchaseOrders:!1,viewPurchaseOrdersForSubordinates:!1,viewPurchaseOrdersForCompany:!1,autoApprovePurchaseOrder:!1,superApprovePurchaseOrder:!1,viewApprovalRules:!1,manageApprovalRules:!1}};const r=o.admin===!0,e=a=>{const t=o[a];return t===!1?!1:t===!0?!0:r},n={purchaseOrderAll:e(s.PO_ALL),viewPurchaseOrders:e(s.VIEW_CUSTOMER),viewPurchaseOrdersForSubordinates:e(s.VIEW_SUBORDINATES),viewPurchaseOrdersForCompany:e(s.VIEW_COMPANY),autoApprovePurchaseOrder:e(s.AUTO_APPROVE),superApprovePurchaseOrder:e(s.SUPER_APPROVE),viewApprovalRules:e(s.VIEW_RULES),manageApprovalRules:e(s.MANAGE_RULES)},i=Object.values(o).some(a=>a===!1)?!1:Object.values(n).some(a=>a===!0);return{isAdmin:r,purchaseOrderEnabled:i,role:{id:"",name:r?"Company Administrator":""},permissions:n}},A=()=>{const o=u.lastPayload("auth/permissions"),[r,e]=m(o);p(()=>{const i=u.on("auth/permissions",a=>{e(a)},{eager:!0});return()=>{i==null||i.off()}},[]);const n=!r;return{permissions:c(()=>P(r),[r]),loadingPermissions:n}};export{A as u};
|
|
4
4
|
//# sourceMappingURL=useCustomerRolePermissions.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{useState as a,useEffect as n}from"@dropins/tools/preact-hooks.js";import{events as c}from"@dropins/tools/event-bus.js";const i=()=>{const[t,s]=a(!0),[u,o]=a(null);return n(()=>{const e=c.on("purchase-order/data",r=>{r!=null&&r.uid&&o(r),s(!1)},{eager:!0});return()=>{e==null||e.off()}},[]),{poDataLoading:t,purchaseOrderData:u}};export{i as u};
|
|
4
4
|
//# sourceMappingURL=usePurchaseOrderData.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as a,jsxs as f}from"@dropins/tools/preact-jsx-runtime.js";import{useState as o,useEffect as U,useCallback as d,useMemo as V}from"@dropins/tools/preact-hooks.js";import{events as H}from"@dropins/tools/event-bus.js";import{i as fe,g as ge}from"./pageSize.config.js";import{f as re}from"./formatDate.js";import{Tag as me,Price as Pe,ActionButton as te}from"@dropins/tools/components.js";import{r as be,a as Re}from"./rejectPurchaseOrders.js";import{g as Oe}from"./getPurchaseOrders.js";import{d as Ae,a as Ce}from"./PurchaseOrderHistoryLogContent.js";import{Text as g}from"@dropins/tools/i18n.js";var M=(i=>(i.CUSTOMER_PURCHASE_ORDERS="customerPurchaseOrders",i.COMPANY_PURCHASE_ORDERS="companyPurchaseOrders",i.CUSTOMER_APPROVAL_PURCHASE_ORDERS="customerApprovalPurchaseOrders",i))(M||{});const Ee=20,Ie=({view:i,initialPageSize:se,routePurchaseOrderDetails:A,setColumns:C,setRowsData:k,t:n,permissions:v,loadingPermissions:j})=>{const E=i===M.COMPANY_PURCHASE_ORDERS,c=i===M.CUSTOMER_APPROVAL_PURCHASE_ORDERS,[$,S]=o(!0),[l,y]=o([]),[h,z]=o([]),[m,ae]=o(se),[ne,p]=o(!0),[ce,B]=o({currentPage:1,totalPages:1,totalCount:0}),[P,b]=o({heading:"",description:"",type:"success"}),[x,N]=o(new Set);U(()=>{const r=H.on("purchase-order/refresh",()=>{S(!0)},{eager:!0});return()=>{r==null||r.off()}},[]),U(()=>{if(P.heading||P.description){const r=setTimeout(()=>{b({heading:"",description:"",type:"success"})},7e3);return()=>clearTimeout(r)}},[P.heading,P.description]);const{currentPage:D,totalPages:oe,totalCount:de}=ce,I=d(r=>{B(s=>({...s,currentPage:r})),N(new Set),S(!0)},[]),ie=d(r=>{const s=r.target.value;ae(e=>e.map(t=>({...t,selected:t.value===s}))),I(1),N(new Set),S(!0)},[I]),R=(v==null?void 0:v.isAdmin)??!1,G=V(()=>{let r={};return E&&(r={companyPurchaseOrders:!0}),c&&(r={myApprovals:!0}),r},[E,c]);U(()=>{var e;if(!$||j)return;p(!0);const r=(e=m==null?void 0:m.find(t=>t.selected))==null?void 0:e.value,s=parseInt(r??Ee.toString(),10);Oe(G,s,D).then(t=>{var w,T;const u=(t==null?void 0:t.purchaseOrderItems)??[],_=(w=t==null?void 0:t.pageInfo)==null?void 0:w.currentPage,O=(T=t==null?void 0:t.pageInfo)==null?void 0:T.totalPages,L=t==null?void 0:t.totalCount;B({currentPage:_>O?O||1:_,totalPages:O,totalCount:L}),z(u)}).catch(t=>{console.error("Failed to fetch purchase orders:",t),z([])}).finally(()=>{p(!1),S(!1)})},[$,D,m,G,j]);const q=d(r=>{const s=A==null?void 0:A(r);return fe(s??"")?s:"#"},[A]),Q=d(r=>{N(s=>{const e=new Set(s);return e.has(r)?e.delete(r):e.add(r),e})},[]),F=d(r=>{const s=r.target.value,e=r.target.checked;y(t=>e?[...t,s]:t.filter(u=>u!==s))},[]),Y=d(r=>{const s=r.target.checked;y(()=>s?h.filter(e=>["PENDING","APPROVAL_REQUIRED"].includes(e.status)).map(e=>e.uid??""):[])},[h]),le=d(()=>{p(!0),be(l).then(()=>{b({heading:n.alertHeaderReject,description:n.alertDescriptionReject,type:"success"}),y([]),H.emit("purchase-order/refresh",!0)}).catch(r=>{b({heading:n.alertHeaderError,description:n.alertDescriptionError,type:"error"}),console.error(r)}).finally(()=>{p(!1)})},[l,n]),ue=d(()=>{p(!0),Re(l).then(()=>{b({heading:n.alertHeaderApprove,description:n.alertDescriptionApprove,type:"success"}),y([]),H.emit("purchase-order/refresh",!0)}).catch(r=>{b({heading:n.alertHeaderError,description:n.alertDescriptionError,type:"error"}),console.error(r)}).finally(()=>{p(!1)})},[l,n]),he=V(()=>{const r=E||c?Ae:Ce;return(C==null?void 0:C(r))??r.map(s=>s.key==="checkboxView"&&(R||c)?{key:s.key,label:a("input",{type:"checkbox",name:"selectAll",disabled:h.every(e=>!["PENDING","APPROVAL_REQUIRED"].includes(e.status)),onChange:Y}),ariaLabel:n.selectAllAriaLabel}:{...s,label:n[s.key]||s.label})},[n,R,E,c,C,h,Y]),pe=V(()=>{const r=h.map((e,t)=>{var Z,J,K,W,X,ee;const u=e.number??"",_=x.has(t),O=`${((Z=e.createdBy)==null?void 0:Z.firstname)??""} ${((J=e.createdBy)==null?void 0:J.lastname)??""}`.trim(),L=a(te,{type:"button",onClick:()=>Q(t),children:a(g,{id:`PurchaseOrders.purchaseOrdersTable.buttons.${_?"expandedHidden":"expandedShow"}`})}),w=a(me,{className:`b2b-purchase-order-purchase-orders-table__status b2b-purchase-order-purchase-orders-table__status--${ge(e.status)}`,children:a(g,{id:`PurchaseOrders.purchaseOrdersTable.statusOrder.${e.status.toLowerCase()}`})}),T=f("div",{className:"b2b-purchase-order-purchase-orders-table__row-details",children:[f("div",{className:"b2b-purchase-order-purchase-orders-table__row-details-content",children:[f("p",{children:[a("span",{children:a(g,{id:"PurchaseOrders.purchaseOrdersTable.expandedRowLabels.orderNumber"})})," ",e.order.orderNumber]}),f("p",{children:[a("span",{children:a(g,{id:"PurchaseOrders.purchaseOrdersTable.expandedRowLabels.createdDate"})})," ",re(e.createdAt)]}),f("p",{children:[a("span",{children:a(g,{id:"PurchaseOrders.purchaseOrdersTable.expandedRowLabels.updatedDate"})})," ",re(e.updatedAt)]}),f("p",{children:[a("span",{children:a(g,{id:"PurchaseOrders.purchaseOrdersTable.expandedRowLabels.total"})})," ",a(Pe,{amount:(W=(K=e==null?void 0:e.quote)==null?void 0:K.grandTotal)==null?void 0:W.value,currency:(ee=(X=e==null?void 0:e.quote)==null?void 0:X.grandTotal)==null?void 0:ee.currency,weight:"normal"})]})]}),a("div",{className:"b2b-purchase-order-purchase-orders-table__row-details-action",children:a(te,{onClick:()=>{window.location.href=q(e.uid??"")},"aria-label":`View purchase order ${u}`,children:n.actionView})})]});return{...R||c?{checkboxView:a("input",{type:"checkbox",name:u,value:e.uid,checked:l.includes(e.uid),onChange:F,disabled:!["PENDING","APPROVAL_REQUIRED"].includes(e.status)})}:{},poNumber:u,status:w,createdBy:O,action:L,_rowDetails:T}});let s=r;if(k){const e=k(r);e!==void 0&&Array.isArray(e)&&(s=e)}return s},[h,k,R,c,l,F,q,n.actionView,x,Q]);return{tableConfig:{columns:he,rows:pe,expandedRows:x},paginationConfig:{currentPage:D,totalPages:oe,handlePageChange:I},pageSizeConfig:{pageSizeOptionsList:m,onChange:ie},totalCount:de,loading:ne,selectedOrderIds:l,handleRejectSelected:le,handleApproveSelected:ue,isAdmin:R,isRequireApprovalPOsView:c,alertMessageConfig:P}};export{M as E,Ie as u};
|
|
4
4
|
//# sourceMappingURL=usePurchaseOrders.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as e,jsxs as u,Fragment as b}from"@dropins/tools/preact-jsx-runtime.js";import{PriceRange as O,Card as T,Button as C}from"@dropins/tools/components.js";import{classes as h}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{P as L}from"../chunks/PurchaseOrdersHeader.js";import{useState as f,useEffect as x,useMemo as N}from"@dropins/tools/preact-hooks.js";import{g as _}from"../chunks/getPurchaseOrderApprovalRule.js";import{Text as a,useText as g}from"@dropins/tools/i18n.js";import{F as w}from"../chunks/FormLoader.js";import"@dropins/tools/preact.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-purchase-order-approval-rule.js";const y=({approvalRuleID:l,routeApprovalRulesList:r})=>{const[t,i]=f(!0),[o,c]=f(null);x(()=>{l&&(i(!0),_(l).then(s=>{s.uid&&c(s)}).catch(()=>{c(null)}).finally(()=>{i(!1)}))},[l]);const m=N(()=>{if(!o||t)return[];const{name:s,status:p,description:R,appliesToRoles:P,approverRoles:D,condition:d}=o;return[{label:e(a,{id:"PurchaseOrders.approvalRuleDetails.fields.ruleName"}),value:s},{label:e(a,{id:"PurchaseOrders.approvalRuleDetails.fields.status"}),value:e(a,{id:`PurchaseOrders.approvalRuleDetails.fields.statusView.${p.toLocaleLowerCase()}`})},{label:e(a,{id:"PurchaseOrders.approvalRuleDetails.fields.description"}),value:R},{label:e(a,{id:"PurchaseOrders.approvalRuleDetails.fields.appliesTo"}),value:e("ul",{children:P.map(n=>e("li",{children:n.name},n.id))})},{label:e(a,{id:"PurchaseOrders.approvalRuleDetails.fields.ruleType"}),value:e(a,{id:`PurchaseOrders.approvalRuleDetails.fields.condition.attribute.${d.attribute.toLocaleLowerCase()}`})},{label:u(b,{children:[e(a,{id:`PurchaseOrders.approvalRuleDetails.fields.condition.attribute.${d.attribute.toLocaleLowerCase()}`}),":"]}),value:u("div",{children:[e(a,{id:`PurchaseOrders.approvalRuleDetails.fields.condition.operator.${d.operator.toLocaleLowerCase()}`}),e(a,{id:"PurchaseOrders.approvalRuleDetails.fields.amount.label"}),e(O,{amount:d.amount.value,currency:d.amount.currency})]})},{label:e(a,{id:"PurchaseOrders.approvalRuleDetails.fields.requiresApprovalFrom"}),value:e("ul",{children:D.map(n=>e("li",{children:n.name},n.id))})}]},[o,t]);return{handleRedirectToList:()=>{window.location.href=(r==null?void 0:r())??""},loading:t,formValues:m}},F=({formValues:l})=>e("div",{className:h(["b2b-purchase-order-approval-rule-details-content"]),children:l.map((r,t)=>u("div",{className:h(["b2b-purchase-order-approval-rule-details-content__item"]),children:[e("span",{className:"b2b-purchase-order-approval-rule-details-content__label",children:r.label}),e("div",{className:"b2b-purchase-order-approval-rule-details-content__value",children:r.value})]},t))}),K=({withHeader:l=!0,withWrapper:r=!0,className:t,approvalRuleID:i,routeApprovalRulesList:o})=>{const c=g({headerText:"PurchaseOrders.approvalRuleDetails.containerTitle"}),{handleRedirectToList:m,loading:v,formValues:s}=y({routeApprovalRulesList:o,approvalRuleID:i});if(!i)return null;const p=v?e(w,{className:"approval-rule-details--loader","data-testid":"approval-rule-details-container--loader"}):u(b,{children:[e(F,{formValues:s}),e(C,{className:"approval-rule-details__button",onClick:m,children:e(a,{id:"PurchaseOrders.approvalRuleDetails.buttons.back"})})]});return u("div",{className:h(["approval-rule-details",t]),"data-testid":"approval-rule-details-container",children:[l?e(L,{headerText:c.headerText}):null,r?e(T,{variant:"secondary","data-testid":"approvalRuleDetailsCard",children:p}):p]})};export{K as ApprovalRuleDetails,K as default};
|
|
4
4
|
//# sourceMappingURL=ApprovalRuleDetails.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as u,jsxs as O,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{classes as F}from"@dropins/tools/lib.js";import{Checkbox as Q,Input as k,TextArea as K,RadioButton as j,MultiSelect as B,Picker as U,Button as x,Card as Y,InLineAlert as X}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{useReducer as $,useMemo as y,useEffect as z,useCallback as g}from"@dropins/tools/preact-hooks.js";import{u as J}from"../chunks/useCustomerRolePermissions.js";import{c as W,g as Z,u as ee,a as re}from"../chunks/currencyInfo.js";import{t as ae}from"../chunks/case-converter.js";import{g as oe}from"../chunks/getPurchaseOrderApprovalRule.js";import{Text as le,useText as te}from"@dropins/tools/i18n.js";import{P as ie}from"../chunks/PurchaseOrdersHeader.js";import{F as se}from"../chunks/FormLoader.js";import"@dropins/tools/preact.js";import"../chunks/permissions.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-purchase-order-approval-rule.js";const ne=(e,a,l)=>{const r={...e};switch(a){case"status":r.status=l?"ENABLED":"DISABLED";break;case"name":r.name=l;break;case"description":r.description=l;break;case"ruleType":r.condition.attribute=l;break;case"ruleCondition":r.condition.operator=l;break;case"ruleValue":{let t=typeof l=="string"?l.replace(/[^\d]/g,""):String(l);t===""?r.condition.attribute==="NUMBER_OF_SKUS"?r.condition.quantity="":r.condition.amount.value="":r.condition.attribute==="NUMBER_OF_SKUS"?r.condition.quantity=+t:r.condition.amount.value=+t;break}case"ruleConditionCurrency":r.condition.amount.currency=l;break;case"approvers":r.approvers=l;break;case"roleType":r.roleType=l;break;case"appliesTo":r.appliesTo=l;break}return r},L=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},C=(e,a,l)=>{const r={...a};return Object.keys(e).forEach(t=>{l[t]&&(r[t]=e[t])}),Object.keys(r).forEach(t=>{l[t]&&!e[t]&&delete r[t]}),r},N={GRAND_TOTAL:"ruleTypeGrandTotal",SHIPPING_INCL_TAX:"ruleTypeShippingInclTax",NUMBER_OF_SKUS:"ruleTypeNumberOfSkus"},A={MORE_THAN:"conditionOperatorMoreThan",LESS_THAN:"conditionOperatorLessThan",MORE_THAN_OR_EQUAL_TO:"conditionOperatorMoreThanOrEqualTo",LESS_THAN_OR_EQUAL_TO:"conditionOperatorLessThanOrEqualTo"},q={ALL_USERS:"appliesToAllUsers",SPECIFIC_ROLES:"appliesToSpecificRoles"},pe={status:"ENABLED",name:"",description:"",roleType:"all_users",appliesTo:[],condition:{quantity:"",amount:{currency:"USD",value:""},attribute:"GRAND_TOTAL",operator:"MORE_THAN"},approvers:[]},ue={formValues:pe,isLoading:!1,submitError:null,availableAppliesTo:[],availableRequiresApprovalFrom:[],errors:{},touched:{},currencyCodesList:[{text:"USD",value:"USD"}]},ce={name:!0,appliesTo:!0,ruleValue:!0,approvers:!0},D={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."},de=e=>[{text:e[N.GRAND_TOTAL],value:"GRAND_TOTAL"},{text:e[N.SHIPPING_INCL_TAX],value:"SHIPPING_INCL_TAX"},{text:e[N.NUMBER_OF_SKUS],value:"NUMBER_OF_SKUS"}],Te=e=>[{text:e[A.MORE_THAN],value:"MORE_THAN"},{text:e[A.LESS_THAN],value:"LESS_THAN"},{text:e[A.MORE_THAN_OR_EQUAL_TO],value:"MORE_THAN_OR_EQUAL_TO"},{text:e[A.LESS_THAN_OR_EQUAL_TO],value:"LESS_THAN_OR_EQUAL_TO"}],me=e=>[{text:e[q.ALL_USERS],value:"all_users"},{text:e[q.SPECIFIC_ROLES],value:"specific_roles"}],_e="ENABLED",Ee="GRAND_TOTAL",Oe="MORE_THAN",ve="USD",be=0,Re=0,he=e=>Object.keys(N).includes(e),fe=e=>Object.keys(A).includes(e),Ae=e=>{var a,l,r,t,c,n,i,o,v,b;return{status:e.status||_e,name:e.name||"",description:e.description||"",roleType:((a=e.appliesToRoles)==null?void 0:a.length)>0?"specific_roles":"all_users",appliesTo:((l=e.appliesToRoles)==null?void 0:l.map(E=>E.id))||[],condition:{quantity:((r=e.condition)==null?void 0:r.quantity)??be,amount:{currency:((c=(t=e.condition)==null?void 0:t.amount)==null?void 0:c.currency)||ve,value:((i=(n=e.condition)==null?void 0:n.amount)==null?void 0:i.value)??Re},attribute:he((o=e.condition)==null?void 0:o.attribute)?e.condition.attribute:Ee,operator:fe((v=e.condition)==null?void 0:v.operator)?e.condition.operator:Oe},approvers:((b=e.approverRoles)==null?void 0:b.map(E=>E.id))||[]}},V=e=>e!=null&&e!==""&&e!==0;function ye(e){const{roleType:a,appliesTo:l,condition:r,...t}=e,c=a==="all_users"?{appliesTo:[]}:{appliesTo:l};let n={};if(r){const{amount:o,quantity:v,...b}=r,E={...b};V(o==null?void 0:o.value)&&(E.amount=o),V(v)&&(E.quantity=v),n=E}return ae({...t,...c,condition:n})}function Se(e,a){switch(a.type){case"SET_LOADING":return{...e,isLoading:a.payload};case"SET_SUBMIT_ERROR":return{...e,submitError:a.payload};case"SET_FORM_VALUES":return{...e,formValues:a.payload};case"SET_AVAILABLE_APPLIES_TO":return{...e,availableAppliesTo:a.payload};case"SET_AVAILABLE_APPROVERS":return{...e,availableRequiresApprovalFrom:a.payload};case"SET_ERRORS":return{...e,errors:a.payload};case"SET_TOUCHED":return{...e,touched:a.payload};case"SET_CURRENCIES":return{...e,currencyCodesList:a.payload};case"UPDATE_FIELD":{const{key:l,value:r}=a.payload,t=ne(e.formValues,l,r),c={...e.touched,[l]:!0};l==="roleType"&&r==="specific_roles"&&(c.appliesTo=!0);const n=L(t),i=C(n,e.errors,c);return{...e,formValues:t,touched:c,errors:i}}case"TOUCH_FIELD":{const l=a.payload,r={...e.touched,[l]:!0},t=L(e.formValues),c=C(t,e.errors,r);return{...e,touched:r,errors:c}}case"MARK_FIELDS_TOUCHED":{const l={...e.touched,...a.payload},r=L(e.formValues),t=C(r,e.errors,l);return{...e,touched:l,errors:t}}default:return e}}const Le=({t:e,approvalRuleID:a,routeApprovalRulesList:l,onSubmit:r,onChange:t,permissions:c,loadingPermissions:n})=>{const[i,o]=$(Se,ue),v=y(()=>de(e),[e]),b=y(()=>Te(e),[e]),E=y(()=>me(e),[e]);z(()=>{o({type:"SET_LOADING",payload:!0}),W().then(s=>{o({type:"SET_CURRENCIES",payload:s.availableCurrencyCodes})}).catch(s=>{console.error("Failed to fetch currencies:",s)}),Z().then(s=>{const{availableAppliesTo:R,availableRequiresApprovalFrom:m}=s;return o({type:"SET_AVAILABLE_APPLIES_TO",payload:R}),o({type:"SET_AVAILABLE_APPROVERS",payload:m}),a?oe(a):null}).then(s=>{s&&o({type:"SET_FORM_VALUES",payload:Ae(s)}),o({type:"SET_SUBMIT_ERROR",payload:null})}).catch(s=>{console.error("Failed to fetch data:",s),o({type:"SET_SUBMIT_ERROR",payload:(s==null?void 0:s.message)||D.FAILED_TO_LOAD})}).finally(()=>{o({type:"SET_LOADING",payload:!1})})},[a]);const h=g((s,R)=>{o({type:"UPDATE_FIELD",payload:{key:s,value:R}}),t&&t({...i.formValues,[s]:R})},[t,i.formValues]),_=g(s=>{o({type:"TOUCH_FIELD",payload:s}),t&&t(i.formValues)},[t,i.formValues]),f=g(async()=>{o({type:"SET_LOADING",payload:!0}),o({type:"SET_SUBMIT_ERROR",payload:null}),o({type:"MARK_FIELDS_TOUCHED",payload:ce});const s=L(i.formValues);if(Object.keys(s).length>0){o({type:"SET_ERRORS",payload:s}),o({type:"SET_LOADING",payload:!1});return}const R=ye(i.formValues);try{let m;if(a?m=await ee({uid:a,...R}):m=await re(R),!m.uid){o({type:"SET_SUBMIT_ERROR",payload:D.FAILED_TO_CREATE}),o({type:"SET_LOADING",payload:!1});return}r&&r(i.formValues),l?window.location.href=l():o({type:"SET_LOADING",payload:!1})}catch(m){console.error("Failed to save approval rule:",m),o({type:"SET_SUBMIT_ERROR",payload:(m==null?void 0:m.message)||D.FAILED_TO_CREATE}),o({type:"SET_LOADING",payload:!1})}},[i.formValues,l,a,r]),T=y(()=>!!(i.isLoading||n||!(c!=null&&c.permissions.viewApprovalRules)&&!(c!=null&&c.permissions.manageApprovalRules)),[i.isLoading,n,c]);return{availableAppliesTo:i.availableAppliesTo,availableRequiresApprovalFrom:i.availableRequiresApprovalFrom,formValues:i.formValues,ruleTypeOptions:v,conditionOperators:b,currencies:i.currencyCodesList,appliesToOptions:E,handleSetFormValues:h,handleSubmit:f,handleFieldTouch:_,errors:i.errors,touched:i.touched,isLoading:i.isLoading,formLoading:T,submitError:i.submitError}},S=({touched:e=!1,error:a,className:l="error-message"})=>!e||!a?null:u("span",{className:l,children:u(le,{id:a})}),Ne=({availableRequiresApprovalFrom:e,conditionOperators:a,availableAppliesTo:l,appliesToOptions:r,ruleTypeOptions:t,currencies:c,formValues:n,errors:i,touched:o,isLoading:v,permissions:b,handleSubmit:E,handleFieldTouch:h,handleSetFormValues:_,routeApprovalRulesList:f,t:T})=>{var R,m;const s=v||!((R=b==null?void 0:b.permissions)!=null&&R.viewApprovalRules);return O("form",{"data-testid":"approval-rule-form",children:[u(Q,{"data-testid":"status-toggle",className:"b2b-purchase-order-approval-rule-form__toggle",disabled:s,name:"status",label:T.formEnabled,checked:n.status==="ENABLED",onChange:p=>{const d=p.target.checked;_("status",d)}}),O("div",{"data-testid":"name-input-container",children:[u(k,{"data-testid":"name-input",className:"b2b-purchase-order-approval-rule-form__name-input",disabled:s,name:"name",floatingLabel:T.inputRuleNameFloatingLabel,placeholder:T.inputRuleNamePlaceholder,value:n.name,error:!!(o.name&&i.name),onChange:p=>{const d=p.target.value;_("name",d)},onBlur:()=>h("name")}),u(S,{touched:o.name,error:i.name})]}),u(K,{"data-testid":"description-textarea",className:"b2b-purchase-order-approval-rule-form__description",disabled:s,name:"description",label:T.textAreaDescriptionLabel,value:n.description,onChange:p=>{const d=p.target.value;_("description",d)}}),O("div",{"data-testid":"applies-to-section",className:"b2b-purchase-order-approval-rule-form__applies-to",children:[u("span",{className:"b2b-purchase-order-approval-rule-form__applies-to-title",children:T.titleAppliesTo}),r.map((p,d)=>u(j,{"data-testid":`applies-to-radio-${d}`,disabled:s,name:"radio-group",value:p.value,label:p.text,checked:n.roleType===p.value,onChange:P=>{const I=P.target.value;_("roleType",I)}},p.value)),n.roleType==="specific_roles"?O("div",{"data-testid":"applies-to-multiselect-container",className:"b2b-purchase-order-approval-rule-form__applies-to-multiselect",children:[u(B,{"data-testid":"applies-to-multiselect",disabled:s,name:"appliesTo",value:[...n.appliesTo],options:l.map(p=>({value:p.id,label:p.name})),error:!!(o.appliesTo&&i.appliesTo),onChange:p=>{_("appliesTo",p),o.appliesTo||h("appliesTo")}}),u(S,{touched:o.appliesTo,error:i.appliesTo})]}):null]}),O("div",{"data-testid":"rule-type-section",className:"b2b-purchase-order-approval-rule-form__rule-type",children:[u("span",{className:"b2b-purchase-order-approval-rule-form__rule-type-title",children:T.titleRuleType}),u(U,{"data-testid":"rule-type-picker",className:"b2b-purchase-order-approval-rule-form__rule-type-picker",disabled:s,name:"ruleType",value:n.condition.attribute,options:t,handleSelect:p=>{const d=p.target.value;_("ruleType",d)}})]}),O("div",{"data-testid":"rule-condition-section",className:"b2b-purchase-order-approval-rule-form__rule-condition",children:[u("span",{className:"b2b-purchase-order-approval-rule-form__rule-condition-title",children:(m=t.find(p=>p.value===n.condition.attribute))==null?void 0:m.text}),O("div",{className:F(["b2b-purchase-order-approval-rule-form__rule-condition-container",["b2b-purchase-order-approval-rule-form__rule-condition-container--error",!!i.ruleValue&&o.ruleValue]]),children:[u(U,{"data-testid":"rule-condition-picker",className:"b2b-purchase-order-approval-rule-form__rule-condition-picker",disabled:s,name:"ruleCondition",value:n.condition.operator,options:a,handleSelect:p=>{const d=p.target.value;_("ruleCondition",d)}}),O("div",{"data-testid":"rule-value-container",children:[u(k,{"data-testid":"rule-value-input",className:"b2b-purchase-order-approval-rule-form__rule-value-input",disabled:s,name:"ruleValue",floatingLabel:n.condition.attribute==="NUMBER_OF_SKUS"?T.inputQuantityFloatingLabel:T.inputAmountFloatingLabel,placeholder:n.condition.attribute==="NUMBER_OF_SKUS"?T.inputQuantityPlaceholder:T.inputAmountPlaceholder,value:n.condition.attribute==="NUMBER_OF_SKUS"?n.condition.quantity:n.condition.amount.value,error:!!(o.ruleValue&&i.ruleValue),onChange:p=>{const d=p.target.value;_("ruleValue",d)},onBlur:()=>h("ruleValue")}),u(S,{touched:o.ruleValue,error:i.ruleValue})]}),n.condition.attribute!=="NUMBER_OF_SKUS"?u(U,{"data-testid":"rule-condition-currency-picker",className:"b2b-purchase-order-approval-rule-form__rule-condition-currency-picker",disabled:s,name:"ruleConditionCurrency",value:n.condition.amount.currency,options:c,handleSelect:p=>{const d=p.target.value;_("ruleConditionCurrency",d)}}):null]})]}),O("div",{"data-testid":"approval-role-section",className:"b2b-purchase-order-approval-rule-form__approval-role",children:[u("span",{className:"b2b-purchase-order-approval-rule-form__approval-role-title",children:T.titleRequiresApprovalRole}),O("div",{className:"b2b-purchase-order-approval-rule-form__approval-role-multiselect",children:[u(B,{"data-testid":"approvers-multiselect",disabled:s,name:"approvers",value:[...n.approvers],options:e.map(p=>({value:p.id,label:p.name})),error:!!(o.approvers&&i.approvers),onChange:p=>{_("approvers",p),o.approvers||h("approvers")}}),u(S,{touched:o.approvers,error:i.approvers})]})]}),O("div",{"data-testid":"form-buttons",className:"b2b-purchase-order-approval-rule-form__buttons",children:[u(x,{"data-testid":"save-button",type:"button",disabled:s,onClick:E,children:T.buttonSave}),u(x,{"data-testid":"cancel-button",disabled:v,variant:"secondary",type:"button",onClick:()=>{window.location.href=(f==null?void 0:f())??""},children:T.buttonCancel})]})]})},Fe=({className:e,approvalRuleID:a,withHeader:l,withWrapper:r,routeApprovalRulesList:t,onSubmit:c,onChange:n})=>{const i=te({headerText:"PurchaseOrders.approvalRuleForm.headerText",titleAppliesTo:"PurchaseOrders.approvalRuleForm.titleAppliesTo",titleRuleType:"PurchaseOrders.approvalRuleForm.titleRuleType",titleRequiresApprovalRole:"PurchaseOrders.approvalRuleForm.titleRequiresApprovalRole",formEnabled:"PurchaseOrders.approvalRuleForm.fields.enabled",formDisabled:"PurchaseOrders.approvalRuleForm.fields.disabled",inputRuleNameFloatingLabel:"PurchaseOrders.approvalRuleForm.fields.inputRuleName.floatingLabel",inputRuleNamePlaceholder:"PurchaseOrders.approvalRuleForm.fields.inputRuleName.placeholder",textAreaDescriptionLabel:"PurchaseOrders.approvalRuleForm.fields.textAreaDescription.label",appliesToAllUsers:"PurchaseOrders.approvalRuleForm.fields.appliesTo.allUsers",appliesToSpecificRoles:"PurchaseOrders.approvalRuleForm.fields.appliesTo.specificRoles",ruleTypeGrandTotal:"PurchaseOrders.approvalRuleForm.fields.ruleTypeOptions.grandTotal",ruleTypeShippingInclTax:"PurchaseOrders.approvalRuleForm.fields.ruleTypeOptions.shippingInclTax",ruleTypeNumberOfSkus:"PurchaseOrders.approvalRuleForm.fields.ruleTypeOptions.numberOfSkus",conditionOperatorMoreThan:"PurchaseOrders.approvalRuleForm.fields.conditionOperators.moreThan",conditionOperatorLessThan:"PurchaseOrders.approvalRuleForm.fields.conditionOperators.lessThan",conditionOperatorMoreThanOrEqualTo:"PurchaseOrders.approvalRuleForm.fields.conditionOperators.moreThanOrEqualTo",conditionOperatorLessThanOrEqualTo:"PurchaseOrders.approvalRuleForm.fields.conditionOperators.lessThanOrEqualTo",inputQuantityFloatingLabel:"PurchaseOrders.approvalRuleForm.fields.inputQuantity.floatingLabel",inputQuantityPlaceholder:"PurchaseOrders.approvalRuleForm.fields.inputQuantity.placeholder",inputAmountFloatingLabel:"PurchaseOrders.approvalRuleForm.fields.inputAmount.floatingLabel",inputAmountPlaceholder:"PurchaseOrders.approvalRuleForm.fields.inputAmount.placeholder",buttonCancel:"PurchaseOrders.approvalRuleForm.fields.buttons.cancel",buttonSave:"PurchaseOrders.approvalRuleForm.fields.buttons.save"}),{permissions:o,loadingPermissions:v}=J(),{availableRequiresApprovalFrom:b,conditionOperators:E,availableAppliesTo:h,appliesToOptions:_,ruleTypeOptions:f,currencies:T,formValues:s,errors:R,touched:m,isLoading:p,submitError:d,formLoading:P,handleSubmit:I,handleFieldTouch:H,handleSetFormValues:G}=Le({t:i,approvalRuleID:a,loadingPermissions:v,permissions:o,routeApprovalRulesList:t,onSubmit:c,onChange:n});if(P)return u(se,{testId:"b2b-purchase-order-approval-rule-form",className:F(["b2b-purchase-order-approval-rule-form",e])});const M=O(w,{children:[!!d&&u(X,{heading:"",description:d}),u(Ne,{availableRequiresApprovalFrom:b,conditionOperators:E,availableAppliesTo:h,appliesToOptions:_,ruleTypeOptions:f,currencies:T,formValues:s,errors:R,touched:m,isLoading:p,handleSubmit:I,handleFieldTouch:H,handleSetFormValues:G,permissions:o,routeApprovalRulesList:t,t:i})]});return O("div",{"data-testid":"b2b-purchase-order-approval-rule-form",className:F(["b2b-purchase-order-approval-rule-form",e]),children:[l?u(ie,{headerText:i.headerText}):null,r?u(Y,{variant:"secondary",children:M}):M]})},Ye=({withHeader:e=!0,withWrapper:a=!0,className:l,approvalRuleID:r,routeApprovalRulesList:t,onSubmit:c,onChange:n})=>u("div",{"data-testid":"b2b-purchase-order-approval-rule-form-container",className:F(["b2b-purchase-order-approval-rule-form-container",l]),children:u(Fe,{withWrapper:a,withHeader:e,approvalRuleID:r,routeApprovalRulesList:t,onSubmit:c,onChange:n})});export{Ye as ApprovalRuleForm,Ye as default};
|
|
4
4
|
//# sourceMappingURL=ApprovalRuleForm.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as L,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as le}from"@dropins/tools/lib.js";import{i as ne,g as oe,P as ie,d as ce}from"../chunks/pageSize.config.js";import{P as de}from"../chunks/PurchaseOrdersHeader.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{ActionButton as V,Tag as ue,Button as pe,Skeleton as he,SkeletonRow as me}from"@dropins/tools/components.js";import{useState as f,useEffect as W,useCallback as v,useMemo as X}from"@dropins/tools/preact-hooks.js";import{events as Y}from"@dropins/tools/event-bus.js";import{u as be}from"../chunks/useCustomerRolePermissions.js";import{g as ge,d as fe}from"../chunks/getPurchaseOrderApprovalRules.js";import{Text as w,useText as we}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";import"../chunks/permissions.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/transform-purchase-order-approval-rule.js";const ee=[{key:"ruleName",label:"Rule Name"},{key:"status",label:"Status"},{key:"createdBy",label:"Created By"},{key:"action",label:"Actions"}],Pe=20,Te=({routeApprovalRuleDetails:u,routeCreateApprovalRule:p,routeEditApprovalRule:h,setColumns:m,setRowsData:P,initialPageSize:$,permissions:y,loadingPermissions:S,t:l})=>{const[b,o]=f([]),[T,n]=f(!0),[k,i]=f(!0),[c,A]=f($),[U,x]=f({currentPage:1,totalPages:1,totalCount:0}),[O,g]=f(new Set);W(()=>{const s=Y.on("purchase-order/refresh",()=>{n(!0)},{eager:!0});return()=>{s==null||s.off()}},[]);const{currentPage:R,totalPages:N,totalCount:re}=U,I=v(s=>{x(t=>({...t,currentPage:s})),g(new Set),n(!0)},[]),se=v(s=>{const t=s.target.value;A(e=>e.map(a=>({...a,selected:a.value===t}))),I(1),g(new Set),n(!0)},[I]),H=v(s=>{g(t=>{const e=new Set(t);return e.has(s)?e.delete(s):e.add(s),e})},[]);W(()=>{var e;if(!T||S)return;i(!0);const s=(e=c==null?void 0:c.find(a=>a.selected))==null?void 0:e.value,t=parseInt(s??Pe.toString(),10);ge(R,t).then(a=>{var z,E;const j=(a==null?void 0:a.items)??[],B=(z=a==null?void 0:a.pageInfo)==null?void 0:z.currentPage,C=(E=a==null?void 0:a.pageInfo)==null?void 0:E.totalPages,D=a==null?void 0:a.totalCount;x({currentPage:B>C?C||1:B,totalPages:C,totalCount:D}),o(j)}).catch(a=>{console.error("Error fetching approval rules:",a),o([])}).finally(()=>{i(!1),n(!1)})},[T,R,c,N,S]);const _=v((s,t)=>{let e="";switch(t){case"new":{e=p==null?void 0:p(s);break}case"edit":{e=h==null?void 0:h(s);break}case"view":{e=u==null?void 0:u(s);break}}return ne(e??"")?e:"#"},[p,h,u]),ae=X(()=>(m==null?void 0:m(ee))??ee.map(s=>({...s,label:l[s.key]||s.label})),[m,l]),M=v((s,t)=>{s.preventDefault(),i(!0),fe(t).then(()=>{Y.emit("purchase-order/refresh",!0)}).finally(()=>{g(new Set)})},[]),te=X(()=>{const s=b==null?void 0:b.map((e,a)=>{var G,Z,q,J,K,Q;const{isAdmin:j,permissions:{manageApprovalRules:B}}=y,C=O.has(a),D=j||B,z=r(V,{onClick:()=>H(a),children:r(w,{id:`PurchaseOrders.purchaseOrdersTable.buttons.${C?"expandedHidden":"expandedShow"}`})}),E=L("div",{className:"b2b-purchase-order-purchase-orders-table__row-details",children:[L("div",{className:"b2b-purchase-order-purchase-orders-table__row-details-content",children:[L("p",{children:[r("span",{children:r(w,{id:"PurchaseOrders.purchaseOrdersTable.expandedRowLabels.ruleType"})})," ",r(w,{id:`PurchaseOrders.purchaseOrdersTable.ruleTypes.${(Z=(G=e.condition)==null?void 0:G.attribute)==null?void 0:Z.toLocaleLowerCase()}`})]}),r("p",{children:r("span",{children:r(w,{id:"PurchaseOrders.purchaseOrdersTable.expandedRowLabels.appliesTo"})})}),r("ul",{children:((q=e==null?void 0:e.appliesToRoles)==null?void 0:q.length)<=0?r("li",{children:l.appliesToAll}):(J=e==null?void 0:e.appliesToRoles)==null?void 0:J.map((d,F)=>r("li",{children:d.name},F))}),r("p",{children:r("span",{children:r(w,{id:"PurchaseOrders.purchaseOrdersTable.expandedRowLabels.approver"})})}),r("ul",{children:(K=e==null?void 0:e.approverRoles)==null?void 0:K.map((d,F)=>r("li",{children:d==null?void 0:d.name},F))})]}),D?r("div",{className:"b2b-purchase-order-purchase-orders-table__row-details-action",children:L("div",{className:"b2b-purchase-order-purchase-orders-table__row-details-action-inner-wrapper",children:[r(V,{onClick:()=>{window.location.href=_(e.uid,"edit")},"aria-label":l.ariaLabelEditRule.replace("{{ruleName}}",e.name),"data-testid":`edit-approval-rule-${e.uid}`,children:l.actionEdit}),r(V,{onClick:d=>M(d,e.uid),"aria-label":l.ariaLabelDeleteRule.replace("{{ruleName}}",e.name),"data-testid":`delete-approval-rule-${e.uid}`,children:l.actionDelete})]})}):r("div",{className:"b2b-purchase-order-purchase-orders-table__row-details-action",children:r(V,{onClick:()=>{window.location.href=_(e.uid,"view")},"aria-label":l.ariaLabelViewRule.replace("{{ruleName}}",e.name),"data-testid":`view-approval-rule-${e.uid}`,children:l.actionView})})]});return{ruleName:e.name,status:r(ue,{className:`b2b-purchase-order-purchase-orders-table__status b2b-purchase-order-purchase-orders-table__status--${oe(e.status)}`,children:r(w,{id:`PurchaseOrders.purchaseOrdersTable.rulesStatus.${(Q=e.status)==null?void 0:Q.toLocaleLowerCase()}`})}),createdBy:e.createdBy,action:z,_rowDetails:E}});let t=s;if(P){const e=P(s);e!==void 0&&Array.isArray(e)&&(t=e)}return t},[b,O,y,P,l,_,M,H]);return{tableConfig:{columns:ae,rows:te,expandedRows:O},paginationConfig:{currentPage:R,totalPages:N,handlePageChange:I},pageSizeConfig:{pageSizeOptionsList:c,onChange:se},totalCount:re,loading:k,handleCreateUrl:_}},Ae=({routeCreateApprovalRule:u,routeEditApprovalRule:p,routeApprovalRuleDetails:h,setColumns:m,setRowsData:P,className:$="",withHeader:y=!0,withWrapper:S=!0,skeletonRowCount:l=5,initialPageSize:b=ce})=>{const o=we({headerText:"PurchaseOrders.approvalRulesList.containerTitle",ruleName:"PurchaseOrders.purchaseOrdersTable.tableColumns.ruleName",ruleType:"PurchaseOrders.purchaseOrdersTable.tableColumns.ruleType",appliesTo:"PurchaseOrders.purchaseOrdersTable.tableColumns.appliesTo",approver:"PurchaseOrders.purchaseOrdersTable.tableColumns.approver",createdBy:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdBy",status:"PurchaseOrders.purchaseOrdersTable.tableColumns.status",actionEdit:"PurchaseOrders.purchaseOrdersTable.actionEdit",actionDelete:"PurchaseOrders.purchaseOrdersTable.actionDelete",addNewRule:"PurchaseOrders.approvalRulesList.buttons.newRule",actionView:"PurchaseOrders.purchaseOrdersTable.actionView",appliesToAll:"PurchaseOrders.purchaseOrdersTable.appliesToAll",emptyTitle:"PurchaseOrders.approvalRulesList.emptyTitle",ariaLabelEditRule:"PurchaseOrders.approvalRulesList.ariaLabel.editRule",ariaLabelDeleteRule:"PurchaseOrders.approvalRulesList.ariaLabel.deleteRule",ariaLabelViewRule:"PurchaseOrders.approvalRulesList.ariaLabel.viewRule"}),{permissions:T,loadingPermissions:n}=be(),{loading:k,tableConfig:i,paginationConfig:c,totalCount:A,pageSizeConfig:U,handleCreateUrl:x}=Te({routeCreateApprovalRule:u,routeEditApprovalRule:p,routeApprovalRuleDetails:h,setColumns:m,setRowsData:P,permissions:T,initialPageSize:b,loadingPermissions:n,t:o}),{isAdmin:O,permissions:{manageApprovalRules:g}}=T,R=O||g?r(pe,{variant:"primary",onClick:()=>{window.location.href=x("","new")},"data-testid":"add-new-rule-button",children:o.addNewRule}):null,N=k||n?r(he,{"data-testid":"approval-rules-skeleton",children:r(me,{variant:"row",size:"small"})}):R;return L("div",{className:le(["purchase-orders",$]),"data-testid":"purchase-orders-container",children:[y?r(de,{headerText:o.headerText}):null,r(ie,{totalCount:A,columns:i.columns,rows:i.rows,expandedRows:i.expandedRows,paginationConfig:c,loading:k||n,skeletonRowCount:l,pageSizeConfig:U,emptyTitle:o.emptyTitle,withWrapper:S,footer:N})]})};export{Ae as ApprovalRulesList,Ae as default};
|
|
4
4
|
//# sourceMappingURL=ApprovalRulesList.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as A,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as w}from"@dropins/tools/lib.js";import{P as y,d as R}from"../chunks/pageSize.config.js";import{P as N}from"../chunks/PurchaseOrdersHeader.js";import{P as S}from"../chunks/PurchaseOrdersTableActions.js";import"@dropins/tools/components.js";import{E as D,u as E}from"../chunks/usePurchaseOrders.js";import{u as j}from"../chunks/useCustomerRolePermissions.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import"@dropins/tools/preact.js";import{useText as v}from"@dropins/tools/i18n.js";import"../chunks/formatDate.js";import"../chunks/rejectPurchaseOrders.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getPurchaseOrders.js";import"../chunks/case-converter.js";import"../chunks/permissions.js";const $=({initialPageSize:t=R,routePurchaseOrderDetails:o,setColumns:d,setRowsData:u,className:c="",withHeader:l=!0,withWrapper:n=!0,skeletonRowCount:i=5})=>{const m=D.COMPANY_PURCHASE_ORDERS,e=v({headerText:"PurchaseOrders.companyPurchaseOrders.containerTitle",actionView:"PurchaseOrders.purchaseOrdersTable.actionView",poNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.poNumber",orderNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.orderNumber",createdDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdDate",updatedDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.updatedDate",createdBy:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdBy",status:"PurchaseOrders.purchaseOrdersTable.tableColumns.status",total:"PurchaseOrders.purchaseOrdersTable.tableColumns.total",action:"PurchaseOrders.purchaseOrdersTable.tableColumns.action",selectAllAriaLabel:"PurchaseOrders.purchaseOrdersTable.tableColumns.selectAllAriaLabel",noPurchaseOrders:"PurchaseOrders.companyPurchaseOrders.noPurchaseOrders"}),{permissions:p,loadingPermissions:h}=j(),{totalCount:O,loading:a,tableConfig:r,paginationConfig:P,pageSizeConfig:b,selectedOrderIds:C,handleRejectSelected:T,handleApproveSelected:f,isAdmin:g,alertMessageConfig:x}=E({view:m,routePurchaseOrderDetails:o,setColumns:d,setRowsData:u,initialPageSize:t,permissions:p,loadingPermissions:h,t:e});return A("div",{className:w(["company-purchase-orders",c]),"data-testid":"company-purchase-orders-container",children:[l?s(N,{headerText:e.headerText}):null,s(y,{header:g?s(S,{loading:a,selectedCount:C.length,handleRejectSelected:T,handleApproveSelected:f}):null,totalCount:O,columns:r.columns,rows:r.rows,expandedRows:r.expandedRows,paginationConfig:P,loading:a,skeletonRowCount:i,pageSizeConfig:b,emptyTitle:e.noPurchaseOrders,alertMessageConfig:x,withWrapper:n})]})};export{$ as CompanyPurchaseOrders,$ as default};
|
|
4
4
|
//# sourceMappingURL=CompanyPurchaseOrders.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as T,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as f}from"@dropins/tools/lib.js";import{P as g,d as x}from"../chunks/pageSize.config.js";import{P as w}from"../chunks/PurchaseOrdersHeader.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import"@dropins/tools/components.js";import{E as R,u as D}from"../chunks/usePurchaseOrders.js";import{u as E}from"../chunks/useCustomerRolePermissions.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useText as N}from"@dropins/tools/i18n.js";import"../chunks/formatDate.js";import"../chunks/rejectPurchaseOrders.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getPurchaseOrders.js";import"../chunks/case-converter.js";import"../chunks/permissions.js";const L=({initialPageSize:a=x,routePurchaseOrderDetails:t,setColumns:o,setRowsData:u,className:d="",withHeader:c=!0,withWrapper:i=!0,skeletonRowCount:m=5})=>{const l=R.CUSTOMER_PURCHASE_ORDERS,e=N({headerText:"PurchaseOrders.customerPurchaseOrders.containerTitle",actionView:"PurchaseOrders.purchaseOrdersTable.actionView",poNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.poNumber",orderNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.orderNumber",createdDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdDate",updatedDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.updatedDate",createdBy:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdBy",status:"PurchaseOrders.purchaseOrdersTable.tableColumns.status",total:"PurchaseOrders.purchaseOrdersTable.tableColumns.total",action:"PurchaseOrders.purchaseOrdersTable.tableColumns.action",noPurchaseOrders:"PurchaseOrders.customerPurchaseOrders.noPurchaseOrders"}),{permissions:n,loadingPermissions:p}=E(),{pageSizeConfig:h,loading:O,paginationConfig:P,tableConfig:r,totalCount:b,alertMessageConfig:C}=D({view:l,routePurchaseOrderDetails:t,setColumns:o,setRowsData:u,initialPageSize:a,permissions:n,loadingPermissions:p,t:e});return T("div",{className:f(["purchase-orders",d]),"data-testid":"purchase-orders-container",children:[c?s(w,{headerText:e.headerText}):null,s(g,{totalCount:b,columns:r.columns,rows:r.rows,expandedRows:r.expandedRows,paginationConfig:P,loading:O,skeletonRowCount:m,pageSizeConfig:h,emptyTitle:e.noPurchaseOrders,alertMessageConfig:C,withWrapper:i})]})};export{L as CustomerPurchaseOrders,L as default};
|
|
4
4
|
//# sourceMappingURL=CustomerPurchaseOrders.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as e,jsxs as n,Fragment as u}from"@dropins/tools/preact-jsx-runtime.js";import{classes as h}from"@dropins/tools/lib.js";import{Skeleton as v,SkeletonRow as d,Card as f}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{P as p}from"../chunks/PurchaseOrdersHeader.js";import"@dropins/tools/preact-hooks.js";import{u as w}from"../chunks/usePurchaseOrderData.js";import{Fragment as g}from"@dropins/tools/preact.js";import*as t from"@dropins/tools/preact-compat.js";import{useText as m,Text as C}from"@dropins/tools/i18n.js";const b=r=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),x=r=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0 12C0 5.37931 5.37931 0 12 0C18.6207 0 24 5.37931 24 12C24 18.6207 18.6207 24 12 24C5.37931 24 0 18.6207 0 12ZM11.8885 5.06101C11.1405 5.06101 10.5357 5.66579 10.5357 6.4138V6.57295C10.5835 7.27321 11.1882 7.81433 11.8885 7.76658H12.0795C12.7797 7.70292 13.289 7.09815 13.2413 6.4138C13.2413 5.66579 12.6365 5.06101 11.8885 5.06101ZM13.1935 16.8223H14.1007C14.2599 16.8223 14.4031 16.9655 14.4031 17.1247V17.7294C14.4031 17.9045 14.2599 18.0318 14.1007 18.0318H9.8832C9.70813 18.0318 9.58081 17.8886 9.58081 17.7294V17.1247C9.58081 16.9496 9.72405 16.8223 9.8832 16.8223H10.7904V10.7905H9.8832C9.70813 10.7905 9.58081 10.6472 9.58081 10.4881V9.88329C9.58081 9.70823 9.72405 9.58091 9.8832 9.58091H12.5888C12.923 9.58091 13.1935 9.85146 13.1935 10.1857V16.8223Z",fill:"currentColor"})),E=r=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),_=({approvalFlow:r=[]})=>{const a=m({pending:"PurchaseOrders.approvalFlow.ariaLabels.icons.pending",approved:"PurchaseOrders.approvalFlow.ariaLabels.icons.approved",rejected:"PurchaseOrders.approvalFlow.ariaLabels.icons.rejected"});if(!(r!=null&&r.length))return e("div",{className:"b2b-purchase-order-approval-flow-content",children:e(C,{id:"PurchaseOrders.approvalFlow.emptyText"})});const s=o=>{switch(o){case"PENDING":return e(x,{className:"b2b-purchase-order-approval-flow-content__icon--pending","aria-label":a.pending,role:"img"});case"APPROVED":return e(b,{className:"b2b-purchase-order-approval-flow-content__icon--approved","aria-label":a.approved,role:"img"});case"REJECTED":return e(E,{className:"b2b-purchase-order-approval-flow-content__icon--rejected","aria-label":a.rejected,role:"img"});default:return null}};return e("div",{className:h(["b2b-purchase-order-approval-flow-content"]),children:e("ul",{className:"b2b-purchase-order-approval-flow-content__list",children:r.map((o,l)=>n(g,{children:[n("li",{className:"b2b-purchase-order-approval-flow-content__item",children:[e("div",{className:"b2b-purchase-order-approval-flow-content__title",children:o.ruleName}),o.events.map((c,i)=>n("div",{className:"b2b-purchase-order-approval-flow-content__description",children:[s(c.status),c.message]},i))]}),l<r.length-1&&e("hr",{className:"b2b-purchase-order-approval-flow-content__divider"})]},l))})})},Z=({className:r,withHeader:a=!0,withWrapper:s=!0})=>{const{poDataLoading:o,purchaseOrderData:l}=w(),c=m({headerText:"PurchaseOrders.approvalFlow.headerText"}),i=n(u,{children:[a&&s?e(p,{headerText:c.headerText,divider:!0}):null,o?n(v,{rowGap:"medium","data-testid":"approval-flow-loader",children:[e(d,{size:"small",variant:"row",fullWidth:!0,lines:1,style:{maxWidth:300}}),e(d,{size:"medium",variant:"row",fullWidth:!0,lines:1})]}):e(_,{approvalFlow:(l==null?void 0:l.approvalFlow)||[]})]});return n("div",{className:h(["b2b-purchase-order-approval-flow",r]),"data-testid":"order-approval-flow-container",children:[a&&!s?e(p,{headerText:c.headerText}):null,s?e(f,{variant:"secondary","data-testid":"orderApprovalFlowCard",children:i}):i]})};export{Z as PurchaseOrderApprovalFlow,Z as default};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrderApprovalFlow.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as l,jsx as o,Fragment as v}from"@dropins/tools/preact-jsx-runtime.js";import{classes as b}from"@dropins/tools/lib.js";import{TextArea as T,Button as y,Skeleton as F,SkeletonRow as f,Card as A}from"@dropins/tools/components.js";import{events as S}from"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{P as h}from"../chunks/PurchaseOrdersHeader.js";import{useState as c,useMemo as k,useCallback as x}from"@dropins/tools/preact-hooks.js";import{u as M}from"../chunks/usePurchaseOrderData.js";import"@dropins/tools/preact.js";import{a as p}from"../chunks/addPurchaseOrderComment.js";import{useText as V}from"@dropins/tools/i18n.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const j=({t:r,purchaseOrderData:e})=>{const[s,i]=c(!1),[t,m]=c(""),[n,u]=c(""),g=k(()=>!t.trim().length||!(e!=null&&e.uid)||s,[t,e,s]),C=x(d=>{const a=d.target.value;m(a),n&&u("")},[n]),P=x(()=>{const d=(e==null?void 0:e.uid)??"";!d||!t.trim().length||(i(!0),p(d,t).then(a=>{a&&(e!=null&&e.uid)&&(S.emit("purchase-order/refresh",!0),m(""))}).catch(()=>{u(r.errorMessage||"Failed to add comment. Please try again.")}).finally(()=>{i(!1)}))},[e,t,r]);return l("div",{className:b(["b2b-purchase-order-comment-form-content"]),children:[o(T,{errorMessage:n,disabled:s,value:t,label:r.textAreaPlaceholder,onChange:C}),o(y,{variant:"primary",disabled:g,onClick:P,children:r.buttonText})]})},K=({withHeader:r=!0,withWrapper:e=!0,className:s})=>{const{poDataLoading:i,purchaseOrderData:t}=M(),m=V({headerText:"PurchaseOrders.comments.add.headerText",buttonText:"PurchaseOrders.comments.add.submit",textAreaPlaceholder:"PurchaseOrders.comments.add.placeholder"}),n=l(v,{children:[r&&e?o(h,{headerText:m.headerText,divider:!0}):null,i?l(F,{rowGap:"medium","data-testid":"comment-form-loader",children:[o(f,{size:"xlarge",variant:"row",fullWidth:!0,lines:2,style:{maxWidth:500}}),o(f,{size:"medium",variant:"row",lines:1})]}):o(j,{purchaseOrderData:t,t:m})]});return l("div",{className:b(["b2b-purchase-order-comment-form",s]),"data-testid":"order-history-log-container",children:[r&&!e?o(h,{headerText:m.headerText}):null,e?o(A,{variant:"secondary","data-testid":"orderCommentFormCard",children:n}):n]})};export{K as PurchaseOrderCommentForm,K as default};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrderCommentForm.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as e,jsxs as a,Fragment as w}from"@dropins/tools/preact-jsx-runtime.js";import{classes as x}from"@dropins/tools/lib.js";import{useState as L}from"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import{Button as _,Skeleton as g,SkeletonRow as u,Card as P}from"@dropins/tools/components.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{u as N}from"../chunks/usePurchaseOrderData.js";import{useText as v,Text as b}from"@dropins/tools/i18n.js";import{P as p}from"../chunks/PurchaseOrdersHeader.js";import{Fragment as T}from"@dropins/tools/preact.js";import{f as C}from"../chunks/formatDate.js";const O=({commentsList:r=[],visibleRecordsLimit:s=5})=>{const[n,m]=L(s),o=r.length>n,c=r.length<=s,i=v({showMoreLabel:"PurchaseOrders.comments.view.ariaLabel.showMore",showLessLabel:"PurchaseOrders.comments.view.ariaLabel.showLess"});return r.length?a("div",{className:"b2b-purchase-order-comment-list-content",children:[e("ul",{className:"b2b-purchase-order-comment-list-content__list",children:r.slice(0,n).map((t,d)=>{var l,h;const f=Math.min(n,r.length);return a(T,{children:[a("li",{className:"b2b-purchase-order-comment-list-content__item",children:[a("div",{className:"b2b-purchase-order-comment-list-content__title",children:[C(t.createdAt),(l=t.author)!=null&&l.firstname&&((h=t.author)!=null&&h.lastname)?` (${t.author.firstname} ${t.author.lastname})`:""]}),e("div",{className:"b2b-purchase-order-comment-list-content__description",children:t.text})]}),d<f-1&&e("hr",{className:"b2b-purchase-order-comment-list-content__divider"})]},t.uid)})}),!c&&e("div",{className:"b2b-purchase-order-comment-list-content__actions",children:e(_,{variant:"secondary","aria-expanded":!o,"aria-label":o?i.showMoreLabel:i.showLessLabel,onClick:()=>{m(o?r.length:s)},children:e(b,{id:`PurchaseOrders.comments.view.buttons.${o?"viewMore":"viewLess"}`})})})]}):e("div",{className:"b2b-purchase-order-comment-list-content",children:e(b,{id:"PurchaseOrders.comments.view.emptyText"})})},G=({withHeader:r=!0,withWrapper:s=!0,visibleRecordsLimit:n=5,className:m})=>{const{poDataLoading:o,purchaseOrderData:c}=N(),i=v({headerText:"PurchaseOrders.comments.view.headerText"}),t=(c==null?void 0:c.comments)||[],d=a(w,{children:[r&&s?e(p,{headerText:i.headerText,divider:!0}):null,o?a(g,{rowGap:"medium","data-testid":"comment-list-loader",children:[e(u,{size:"small",variant:"row",fullWidth:!0,lines:1,style:{maxWidth:300}}),e(u,{size:"medium",variant:"row",fullWidth:!0,lines:1})]}):e(O,{commentsList:t.reverse(),visibleRecordsLimit:n})]});return a("div",{className:x(["b2b-purchase-order-comment-list",m]),"data-testid":"order-comment-list-container",children:[r&&!s?e(p,{headerText:i.headerText}):null,s?e(P,{variant:"secondary","data-testid":"orderCommentListCard",children:d}):d]})};export{G as PurchaseOrderCommentsList,G as default};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrderCommentsList.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as o,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as n}from"@dropins/tools/lib.js";import"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import"@dropins/tools/preact-hooks.js";import{useText as c}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";const m=({className:e,purchaseOrderNumber:r,routePurchaseOrderDetails:s,...i})=>{const t=c({title:"PurchaseOrders.purchaseOrderConfirmation.title",messagePrefix:"PurchaseOrders.purchaseOrderConfirmation.messagePrefix",messageSuffix:"PurchaseOrders.purchaseOrderConfirmation.messageSuffix"});return o("div",{...i,className:n(["purchase-orders-confirmation-content",e]),children:[a("h2",{className:"purchase-orders-confirmation-content__title",children:t.title}),o("p",{className:"purchase-orders-confirmation-content__message",children:[t.messagePrefix," ",o("a",{className:"purchase-orders-confirmation-content__link",href:s()??"",children:["#",r]}),". ",t.messageSuffix]})]})},g=({className:e,purchaseOrderNumber:r,routePurchaseOrderDetails:s,...i})=>r?a("div",{...i,className:n(["b2b-purchase-order-confirmation",e]),children:a(m,{purchaseOrderNumber:r,routePurchaseOrderDetails:s})}):null;export{g as PurchaseOrderConfirmation,g as default};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrderConfirmation.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as e,jsxs as a,Fragment as p}from"@dropins/tools/preact-jsx-runtime.js";import{classes as y}from"@dropins/tools/lib.js";import{Button as L,Skeleton as f,SkeletonRow as u,Card as v}from"@dropins/tools/components.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{P as m}from"../chunks/PurchaseOrdersHeader.js";import{useState as x}from"@dropins/tools/preact-hooks.js";import{u as _}from"../chunks/usePurchaseOrderData.js";import{Fragment as P}from"@dropins/tools/preact.js";import{f as w}from"../chunks/formatDate.js";import{useText as g,Text as h}from"@dropins/tools/i18n.js";const N=({historyLogRecords:r=[],visibleRecordsLimit:t})=>{const[i,c]=x(t),s=r.length>i,n=r.length<=t,d=g({showMoreLabel:"PurchaseOrders.historyLog.ariaLabel.showMore",showLessLabel:"PurchaseOrders.historyLog.ariaLabel.showLess"});return r.length?a("div",{className:"b2b-purchase-order-history-log-content",children:[e("ul",{className:"b2b-purchase-order-history-log-content__list",role:"list",children:r.slice(0,i).map((o,l)=>{const b=Math.min(i,r.length);return a(P,{children:[a("li",{className:"b2b-purchase-order-history-log-content__item",children:[e("div",{className:"b2b-purchase-order-history-log-content__title",children:e(h,{id:`PurchaseOrders.historyLog.status.${o.activity}`,fields:{date:w(o.createdAt)}})}),e("div",{className:"b2b-purchase-order-history-log-content__description",children:o.message})]}),l<b-1&&e("hr",{className:"b2b-purchase-order-history-log-content__divider"})]},o.uid)})}),!n&&e("div",{className:"b2b-purchase-order-history-log-content__actions",children:e(L,{variant:"secondary","aria-expanded":!s,"aria-label":s?d.showMoreLabel:d.showLessLabel,onClick:()=>{c(s?r.length:t)},children:e(h,{id:`PurchaseOrders.historyLog.buttons.${s?"viewMore":"viewLess"}`})})})]}):e("div",{className:"b2b-purchase-order-history-log-content",children:e(h,{id:"PurchaseOrders.historyLog.emptyText"})})},D=({withHeader:r=!0,withWrapper:t=!0,visibleRecordsLimit:i=5,className:c})=>{const{poDataLoading:s,purchaseOrderData:n}=_(),d=g({headerText:"PurchaseOrders.historyLog.headerText"}),o=(n==null?void 0:n.historyLog)||[],l=a(p,{children:[r&&t?e(m,{headerText:d.headerText,divider:!0}):null,s?a(f,{rowGap:"medium","data-testid":"comment-list-loader",children:[e(u,{size:"small",variant:"row",fullWidth:!0,lines:1,style:{maxWidth:300}}),e(u,{size:"medium",variant:"row",fullWidth:!0,lines:1})]}):e(N,{historyLogRecords:o,visibleRecordsLimit:i})]});return a("div",{className:y(["b2b-purchase-order-history-log",c]),"data-testid":"order-history-log-container",children:[r&&!t?e(m,{headerText:d.headerText}):null,t?e(v,{variant:"secondary","data-testid":"orderHistoryLogCard",children:l}):l]})};export{D as PurchaseOrderHistoryLog,D as default};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrderHistoryLog.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsx as r,jsxs as C,Fragment as B}from"@dropins/tools/preact-jsx-runtime.js";import{classes as k,Slot as N}from"@dropins/tools/lib.js";import{Button as M,Skeleton as _,SkeletonRow as y,InLineAlert as D,Card as w}from"@dropins/tools/components.js";import{useState as v,useCallback as h}from"@dropins/tools/preact-hooks.js";import{events as I}from"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{a as J,r as V}from"../chunks/rejectPurchaseOrders.js";import{c as z,p as H}from"../chunks/placeOrderForPurchaseOrder.js";import{u as F}from"../chunks/usePurchaseOrderData.js";import{useText as L,Text as $}from"@dropins/tools/i18n.js";import{P as R}from"../chunks/PurchaseOrdersHeader.js";import"@dropins/tools/preact.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";const G=()=>{const{poDataLoading:o,purchaseOrderData:s}=F(),e=L({approvalSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.approval",rejectSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.reject",cancelSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.cancel",placeOrderSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.placeOrder",approvalErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.approval",rejectErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.reject",cancelErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.cancel",placeOrderErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.placeOrder"}),u=(s==null?void 0:s.uid)??null,i=(s==null?void 0:s.status)??"PENDING",d=(s==null?void 0:s.availableActions)??[],[l,n]=v("success"),[p,O]=v(""),[a,m]=v(!1),[A,S]=v(!0),f=()=>{S(!0)},P=h((T,E)=>{let c="";if(T){switch(E){case"APPROVE":c=e.approvalSuccessMessage;break;case"REJECT":c=e.rejectSuccessMessage;break;case"CANCEL":c=e.cancelSuccessMessage;break;case"PLACE_ORDER":c=e.placeOrderSuccessMessage;break}n("success")}else{switch(E){case"APPROVE":c=e.approvalErrorMessage;break;case"REJECT":c=e.rejectErrorMessage;break;case"CANCEL":c=e.cancelErrorMessage;break;case"PLACE_ORDER":c=e.placeOrderErrorMessage;break}n("error")}O(c),S(!1)},[e]),t=h(async(T,E)=>{if(u){m(!0);try{await T(u),P(!0,E)}catch{P(!1,E)}finally{m(!1),I.emit("purchase-order/refresh",!0)}}},[u,P]),g=h(()=>t(J,"APPROVE"),[t]),x=h(()=>t(V,"REJECT"),[t]),b=h(()=>t(z,"CANCEL"),[t]),j=h(()=>t(H,"PLACE_ORDER"),[t]);return{poId:u,status:i,availableActions:d,alertType:l,loading:a,poDataLoading:o,isDismissed:A,alertMessage:p,handleOnDismiss:f,handleApprove:g,handleReject:x,handleCancel:b,handlePlaceOrder:j}},W=({slots:o,t:s,loading:e,children:u,availableActions:i=[],handleApprove:d,handleReject:l,handleCancel:n,handlePlaceOrder:p})=>{const O=i.map(a=>{switch(a){case"APPROVE":return r(M,{variant:"secondary",disabled:e,type:"button",onClick:d,children:s.approveButtonText},a);case"PLACE_ORDER":return r(M,{variant:"secondary",disabled:e,type:"button",onClick:p,children:s.placeOrderButtonText},a);case"REJECT":return r(M,{variant:"secondary",disabled:e,type:"button",onClick:l,children:s.rejectButtonText},a);case"CANCEL":return r(M,{variant:"secondary",disabled:e,type:"button",onClick:n,children:s.cancelButtonText},a);default:return null}});return C("div",{className:k(["b2b-purchase-order-status-content"]),children:[r("div",{className:"b2b-purchase-order-status-content__message",children:s.statusMessageText}),u,r("div",{className:"b2b-purchase-order-status-content__actions",children:r(N,{"data-testid":"PurchaseOrderActions",name:"PurchaseOrderActions",slot:o==null?void 0:o.PurchaseOrderActions,context:{loading:e,availableActions:i,handleApprove:d,handleReject:l,handleCancel:n,handlePlaceOrder:p},children:O})})]})},ne=({className:o,withHeader:s=!0,withWrapper:e=!0,slots:u})=>{const{poId:i,status:d,availableActions:l,alertType:n,loading:p,poDataLoading:O,isDismissed:a,alertMessage:m,handleOnDismiss:A,handleApprove:S,handleReject:f,handleCancel:P,handlePlaceOrder:t}=G(),g=L({statusHeadingText:`PurchaseOrders.purchaseOrderStatus.status.${d.toLowerCase()}.title`,statusMessageText:`PurchaseOrders.purchaseOrderStatus.status.${d.toLowerCase()}.message`,approveButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.approve",cancelButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.cancel",rejectButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.reject",placeOrderButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.placeOrder"}),x=l.length>0;if(!i)return null;const b=C(B,{children:[s&&e?r(R,{headerText:g.statusHeadingText,divider:!0}):null,O?C(_,{"data-testid":"status-content-loader-skeleton-test-id",children:[r(y,{size:"small",variant:"row",fullWidth:!0,lines:1,style:{maxWidth:300}}),r(y,{size:"medium",variant:"row",fullWidth:!0,lines:1})]}):x?r(W,{t:g,loading:p,handleApprove:S,handleReject:f,handleCancel:P,handlePlaceOrder:t,availableActions:l,slots:u}):r("div",{className:"purchase-order-status__empty",children:r($,{id:"PurchaseOrders.purchaseOrderStatus.emptyText"})})]});return C("div",{className:k(["purchase-order-status",o]),children:[!a&&m?r(D,{style:{marginBottom:"1rem",textTransform:"capitalize"},heading:n,onDismiss:A,description:m,type:n}):null,s&&!e?r(R,{headerText:g.statusHeadingText}):null,e?r(w,{variant:"secondary",children:b}):b]})};export{ne as PurchaseOrderStatus,ne as default};
|
|
4
4
|
//# sourceMappingURL=PurchaseOrderStatus.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
import{jsxs as v,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{classes as R}from"@dropins/tools/lib.js";import{P as w,d as x}from"../chunks/pageSize.config.js";import{P as D}from"../chunks/PurchaseOrdersHeader.js";import{P as M}from"../chunks/PurchaseOrdersTableActions.js";import"@dropins/tools/components.js";import{E as j,u as E}from"../chunks/usePurchaseOrders.js";import{u as S}from"../chunks/useCustomerRolePermissions.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import"@dropins/tools/preact.js";import{useText as q}from"@dropins/tools/i18n.js";import"../chunks/formatDate.js";import"../chunks/rejectPurchaseOrders.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/getPurchaseOrders.js";import"../chunks/case-converter.js";import"../chunks/permissions.js";const $=({initialPageSize:o=x,routePurchaseOrderDetails:d,setColumns:l,setRowsData:u,className:c="",withHeader:i=!0,withWrapper:p=!0,skeletonRowCount:n=5})=>{const h=j.CUSTOMER_APPROVAL_PURCHASE_ORDERS,e=q({headerText:"PurchaseOrders.requireApprovalPurchaseOrders.containerTitle",actionView:"PurchaseOrders.purchaseOrdersTable.actionView",poNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.poNumber",orderNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.orderNumber",createdDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdDate",updatedDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.updatedDate",createdBy:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdBy",status:"PurchaseOrders.purchaseOrdersTable.tableColumns.status",total:"PurchaseOrders.purchaseOrdersTable.tableColumns.total",action:"PurchaseOrders.purchaseOrdersTable.tableColumns.action",selectAllAriaLabel:"PurchaseOrders.purchaseOrdersTable.tableColumns.selectAllAriaLabel",noPurchaseOrders:"PurchaseOrders.requireApprovalPurchaseOrders.noPurchaseOrders",alertHeaderApprove:"PurchaseOrders.alertMessages.header.approve",alertHeaderReject:"PurchaseOrders.alertMessages.header.reject",alertHeaderError:"PurchaseOrders.alertMessages.header.error",alertDescriptionApprove:"PurchaseOrders.alertMessages.description.approve",alertDescriptionReject:"PurchaseOrders.alertMessages.description.reject",alertDescriptionError:"PurchaseOrders.alertMessages.description.error"}),{permissions:m,loadingPermissions:O}=S(),{totalCount:a,loading:t,tableConfig:r,paginationConfig:P,pageSizeConfig:b,selectedOrderIds:C,handleRejectSelected:T,handleApproveSelected:g,isRequireApprovalPOsView:f,alertMessageConfig:A}=E({view:h,routePurchaseOrderDetails:d,setColumns:l,setRowsData:u,initialPageSize:o,permissions:m,loadingPermissions:O,t:e});return v("div",{className:R(["require-approval-purchase-orders",c]),"data-testid":"require-approval-purchase-orders-container",children:[i?s(D,{headerText:e.headerText}):null,s(w,{header:f&&a>0?s(M,{loading:t,selectedCount:C.length,handleRejectSelected:T,handleApproveSelected:g}):null,totalCount:a,columns:r.columns,rows:r.rows,expandedRows:r.expandedRows,paginationConfig:P,loading:t,skeletonRowCount:n,pageSizeConfig:b,emptyTitle:e.noPurchaseOrders,alertMessageConfig:A,withWrapper:p})]})};export{$ as RequireApprovalPurchaseOrders,$ as default};
|
|
4
4
|
//# sourceMappingURL=RequireApprovalPurchaseOrders.js.map
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-purchase-order", "version": "1.0.0-
|
|
1
|
+
{"name": "@dropins/storefront-purchase-order", "version": "1.0.0-beta5", "@dropins/tools": "~1.6.0", "license": "SEE LICENSE IN LICENSE.md"}
|
package/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Copyright
|
|
1
|
+
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
3
|
(function(t,a){try{if(typeof document<"u"){const e=document.createElement("style"),n=a.styleId;for(const r in a.attributes)e.setAttribute(r,a.attributes[r]);e.setAttribute("data-dropin",n),e.appendChild(document.createTextNode(t));const o=document.querySelector('style[data-dropin="sdk"]');if(o)o.after(e);else{const r=document.querySelector('link[rel="stylesheet"], style');r?r.before(e):document.head.append(e)}}}catch(e){console.error("dropin-styles (injectCodeFunction)",e)}})(`.dropin-skeleton{--row-gap-spacing: var(--spacing-medium);display:grid;grid-template-columns:1fr 1fr;gap:var(--row-gap-spacing)}.dropin-skeleton .dropin-skeleton--row__content{background:var(--color-neutral-300) linear-gradient(to right,var(--color-neutral-300) 0%,var(--color-neutral-100) 20%,var(--color-neutral-300) 40%,var(--color-neutral-300) 100%) no-repeat;animation:skeletonShimmer infinite 1.2s linear;border-radius:var(--shape-border-radius-2)}.dropin-skeleton__empty{background:none}.dropin-skeleton-row--multiline{--multiline-gap-spacing: var(--spacing-medium);display:grid;grid-auto-rows:max-content;gap:var(--multiline-gap-spacing)}.dropin-skeleton-row--full{grid-column:1 / -1}.dropin-skeleton-row svg{fill:var(--color-neutral-400);fill-opacity:.5;animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:placeholderShimmer;animation-timing-function:linear}.dropin-skeleton-row__row-xsmall{height:32px}.dropin-skeleton-row__row-small{height:40px}.dropin-skeleton-row__row-medium{height:48px}.dropin-skeleton-row__row-large{height:56px}.dropin-skeleton-row__row-xlarge{height:72px}.dropin-skeleton-row__heading-xsmall{height:20px}.dropin-skeleton-row__heading-small{height:24px}.dropin-skeleton-row__heading-medium{height:32px}.dropin-skeleton-row__heading-large{height:40px}.dropin-skeleton-row__heading-xlarge{height:48px}@keyframes skeletonShimmer{0%{background-position:-600px 0}to{background-position:600px 0}}@keyframes placeholderShimmer{0%{fill-opacity:.5}50%{fill-opacity:1}to{fill-opacity:.5}}@media only screen and (max-width: 600px){.dropin-skeleton{grid-template-columns:1fr}}
|
|
4
4
|
.b2b-purchase-order-purchase-orders-table{display:flex;flex-direction:column;gap:var(--spacing-medium)}.b2b-purchase-order-purchase-orders-table__row-details-action-inner-wrapper{display:flex;gap:var(--spacing-xsmall)}.b2b-purchase-order-purchase-orders-table--empty-state,.b2b-purchase-order-purchase-orders-table--empty-state>.dropin-card__content{container-type:inline-size;gap:0}.b2b-purchase-order-purchase-orders-table--empty-state .purchase-orders-table__header{margin-bottom:var(--spacing-medium)}.b2b-purchase-order-purchase-orders-table a{cursor:pointer}.b2b-purchase-order-purchase-orders-table .purchase-orders-table__item--skeleton{max-width:200px}.purchase-orders-table__empty-state{text-align:center;color:var(--color-neutral-600);font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);border:var(--shape-border-width-1) solid var(--color-neutral-400);border-top:none}@container (max-width: 600px){.purchase-orders-table__empty-state{border-top:var(--shape-border-width-1) solid var(--color-neutral-400)}}.purchase-orders-table__empty-state:not(:last-child){margin-bottom:var(--spacing-medium)}.purchase-orders-table__pagination--loading{pointer-events:none;opacity:.5;cursor:not-allowed}.purchase-orders-table__pagination-wrapper{display:flex;justify-content:space-between;align-items:center}.purchase-orders-table__pagination-page-size{display:flex;align-items:center;gap:var(--spacing-small)}.purchase-orders-table__pagination-counter,.purchase-orders-table__pagination-page-size{color:var(--color-neutral-800);font:var(--type-body-2-default-font);letter-spacing:var(--type-body-2-default-letter-spacing)}@media (max-width: 783px){.purchase-orders-table__pagination-wrapper{display:grid;grid-template-areas:"counter page-size" "pagination pagination";grid-template-columns:auto auto;gap:var(--spacing-small)}.purchase-orders-table__pagination-counter{grid-area:counter}.purchase-orders-table__pagination-page-size{grid-area:page-size}.purchase-orders-table__pagination{grid-area:pagination;justify-self:center}}@media (max-width: 600px){.purchase-orders-table__pagination-wrapper{grid-template-areas:"counter" "page-size" "pagination";grid-template-columns:1fr;justify-items:center}.purchase-orders-table__pagination-counter{grid-area:counter}.purchase-orders-table__pagination-page-size{grid-area:page-size}.purchase-orders-table__pagination{grid-area:pagination}}.b2b-purchase-order-purchase-orders-table__row-details{display:flex;justify-content:space-between;align-items:flex-end}.b2b-purchase-order-purchase-orders-table__row-details-content{flex:1;text-align:left}.b2b-purchase-order-purchase-orders-table__row-details-content p,.b2b-purchase-order-purchase-orders-table__row-details-content ul{margin:0 var(--spacing-xsmall) var(--spacing-xsmall) 0}.b2b-purchase-order-purchase-orders-table__row-details-content span:first-child{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.b2b-purchase-order-purchase-orders-table__status{max-width:max-content}.b2b-purchase-order-purchase-orders-table__status--positive{background-color:var(--color-positive-200)}.b2b-purchase-order-purchase-orders-table__status--negative{background-color:var(--color-alert-200)}.b2b-purchase-order-purchase-orders-table__status--waiting{background-color:var(--color-informational-200)}.b2b-purchase-order-purchase-orders-table .dropin-table__body td:last-child,.b2b-purchase-order-purchase-orders-table .dropin-table__header__row th:last-child{text-align:center}@container (max-width: 600px){.b2b-purchase-order-purchase-orders-table .dropin-table__body td:last-child,.b2b-purchase-order-purchase-orders-table .dropin-table__header__row th:last-child{text-align:left}}.dropin-table__body__cell .dropin-action-button{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.purchase-orders-header{margin-bottom:var(--spacing-medium)}.purchase-orders-header--with-divider{margin-bottom:0}.purchase-orders-header--with-divider>hr.dropin-divider{margin-bottom:0}.b2b-purchase-order-purchase-orders-table-actions{display:flex;justify-content:space-between;align-items:center}.b2b-purchase-order-purchase-orders-table-actions__buttons{display:flex;gap:10px;justify-content:space-between}.b2b-purchase-order-approval-rule-form .dropin-in-line-alert{margin-bottom:var(--spacing-small)}.b2b-purchase-order-approval-rule-form form{display:flex;flex-direction:column;gap:var(--spacing-small)}.b2b-purchase-order-approval-rule-form__rule-condition,.b2b-purchase-order-approval-rule-form__approval-role,.b2b-purchase-order-approval-rule-form__rule-type,.b2b-purchase-order-approval-rule-form__applies-to,.b2b-purchase-order-approval-rule-form__rule-condition-container,.b2b-purchase-order-approval-rule-form__buttons{display:flex;flex-direction:column;gap:var(--spacing-xsmall)}.b2b-purchase-order-approval-rule-form form>label.dropin-checkbox{align-items:center}.b2b-purchase-order-approval-rule-form__rule-type select,.b2b-purchase-order-approval-rule-form__rule-condition-container select{min-height:56px}.b2b-purchase-order-approval-rule-form__rule-condition-container{flex-direction:row;position:relative}.b2b-purchase-order-approval-rule-form__rule-condition-container--error{margin-bottom:var( --spacing-xsmall )}.b2b-purchase-order-approval-rule-form__rule-condition-container>div{position:relative}.b2b-purchase-order-approval-rule-form__rule-condition-container .error-message{position:absolute;top:100%;left:0;right:0;z-index:10}.b2b-purchase-order-approval-rule-form__buttons{justify-content:flex-start;flex-direction:row}@media (max-width: 600px){.b2b-purchase-order-approval-rule-form__rule-condition-container{flex-direction:column;margin-bottom:var(--spacing-xsmall)}.b2b-purchase-order-approval-rule-form__rule-condition-container .error-message{position:static}.b2b-purchase-order-approval-rule-form form .dropin-multi-select{min-width:100%}}.error-message{font:var(--type-details-caption-2-font);letter-spacing:var(--type-details-caption-2-letter-spacing);padding-top:var(--spacing-xsmall);text-align:left;color:var(--color-alert-800)}.b2b-purchase-order-approval-rule-form .dropin-skeleton{width:100%;display:flex;flex-direction:column;gap:var(--spacing-xsmall)}.approval-rule-form-loader__section{display:flex;flex-direction:column;gap:var(--spacing-xsmall);margin-bottom:var(--spacing-medium)}.approval-rule-form-loader__buttons{display:flex;gap:var(--spacing-small)}.purchase-orders-confirmation-content__title{color:var(--color-neutral-800);font:var(--type-headline-1-font);letter-spacing:var(--type-headline-1-letter-spacing)}.purchase-orders-confirmation-content__message{font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing)}.purchase-orders-confirmation-content__link{color:var(--color-brand-500);font:var(--type-body-1-strong-font);letter-spacing:var(--type-body-1-strong-letter-spacing)}.purchase-order-status .dropin-in-line-alert__description{text-transform:none}.b2b-purchase-order-status-content__message{padding:0;margin:0;box-sizing:border-box;font:var(--type-body-1-default-font);letter-spacing:var(--type-body-1-default-letter-spacing);margin-bottom:var(--spacing-small)}.b2b-purchase-order-status-content__actions>div{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:var(--spacing-xsmall)}.b2b-purchase-order-approval-rule-details-content__item{margin-bottom:var(--spacing-medium);display:grid;grid-template-columns:1fr;gap:var(--spacing-xsmall)}.b2b-purchase-order-approval-rule-details-content__label{font:var(--type-body-1-emphasized-font);letter-spacing:var(--type-body-1-emphasized-letter-spacing)}.b2b-purchase-order-approval-rule-details-content__value{display:block}.b2b-purchase-order-approval-rule-details-content__value ul{margin:0;padding-left:var(--spacing-medium)}.b2b-purchase-order-approval-rule-details-content__value>div{display:inline-flex;flex-wrap:wrap;align-items:center;margin-right:var(--spacing-small);gap:var(--spacing-xsmall)}.approval-rule-details__button{max-width:max-content}.b2b-purchase-order-form-loader .dropin-skeleton{width:100%;display:flex;flex-direction:column;gap:var(--spacing-xsmall)}.b2b-purchase-order-form-loader .approval-rule-form-loader__section{display:flex;flex-direction:column;gap:var(--spacing-xsmall);margin-bottom:var(--spacing-medium)}.b2b-purchase-order-form-loader .approval-rule-form-loader__buttons{display:flex;gap:var(--spacing-small)}.b2b-purchase-order-comment-list-content__list{list-style:none;margin:0;padding:0}.b2b-purchase-order-comment-list-content__item{padding:var(--spacing-small) 0}.b2b-purchase-order-comment-list-content__item:first-child{padding-top:0}.b2b-purchase-order-comment-list-content__item:last-child{padding-bottom:0}.b2b-purchase-order-comment-list-content__title{font:var(--type-body-1-emphasized-font);margin-bottom:var(--spacing-xsmall)}.b2b-purchase-order-comment-list-content__description{color:var(--color-neutral-700)}.b2b-purchase-order-comment-list-content__divider{border:none;border-top:var(--shape-border-width-1) solid var(--color-neutral-300);margin:0}.b2b-purchase-order-comment-list-content__actions{display:flex;justify-content:center;align-items:center;margin-top:var(--spacing-small)}.b2b-purchase-order-comment-form-content{display:flex;flex-direction:column;gap:var(--spacing-small)}.b2b-purchase-order-comment-form-content button{align-self:flex-end}.b2b-purchase-order-comment-form-content .dropin-textarea:not(:placeholder-shown)+.dropin-textarea__label--floating{background-color:transparent}.b2b-purchase-order-approval-flow-content__list{list-style:none;margin:0;padding:0}.b2b-purchase-order-approval-flow-content__item{padding:var(--spacing-small) 0}.b2b-purchase-order-approval-flow-content__item:first-child{padding-top:0}.b2b-purchase-order-approval-flow-content__item:last-child{padding-bottom:0}.b2b-purchase-order-approval-flow-content__title{font-weight:600;margin-bottom:var(--spacing-xsmall)}.b2b-purchase-order-approval-flow-content__description{color:var(--color-neutral-700);display:flex;justify-content:flex-start;align-items:center;gap:var(--spacing-xsmall)}.b2b-purchase-order-approval-flow-content__description{margin-bottom:var(--spacing-xsmall)}.b2b-purchase-order-approval-flow-content__description:last-child{margin-bottom:0}.b2b-purchase-order-approval-flow-content__divider{border:none;border-top:var(--shape-border-width-1) solid var(--color-neutral-300);margin:0}.b2b-purchase-order-approval-flow-content__icon--pending{color:var(--color-neutral-50);background-color:var(--color-informational-500);border-radius:50%;border:1px solid var(--color-informational-500)}.b2b-purchase-order-approval-flow-content__icon--approved{color:var(--color-positive-500)}.b2b-purchase-order-approval-flow-content__icon--rejected{color:var(--color-alert-500)}.b2b-purchase-order-history-log-content__list{list-style:none;margin:0;padding:0}.b2b-purchase-order-history-log-content__item{padding:var(--spacing-small) 0}.b2b-purchase-order-history-log-content__item:first-child{padding-top:0}.b2b-purchase-order-history-log-content__item:last-child{padding-bottom:0}.b2b-purchase-order-history-log-content__title{font:var(--type-body-1-emphasized-font);margin-bottom:var(--spacing-xsmall)}.b2b-purchase-order-history-log-content__description{color:var(--color-neutral-700)}.b2b-purchase-order-history-log-content__divider{border:none;border-top:var(--shape-border-width-1) solid var(--color-neutral-300);margin:0}.b2b-purchase-order-history-log-content__actions{margin-top:var(--spacing-small);display:flex;justify-content:center;align-items:center}`,{styleId:"b2b-purchase-order"});
|