@dropins/storefront-purchase-order 0.0.1-alpha1 → 0.0.1-alpha2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/addPurchaseOrderComment/addPurchaseOrderComment.d.ts +4 -0
- package/api/addPurchaseOrderComment/graphql/addPurchaseOrderComment.graphql.d.ts +18 -0
- package/api/addPurchaseOrderComment/index.d.ts +18 -0
- package/api/addPurchaseOrderItemsToCart/addPurchaseOrderItemsToCart.d.ts +4 -0
- package/api/addPurchaseOrderItemsToCart/graphql/addPurchaseOrderItemsToCart.graphql.d.ts +18 -0
- package/api/addPurchaseOrderItemsToCart/index.d.ts +18 -0
- package/api/approvePurchaseOrders/approvePurchaseOrders.d.ts +10 -0
- package/api/approvePurchaseOrders/graphql/approvePurchaseOrders.graphql.d.ts +18 -0
- package/api/approvePurchaseOrders/index.d.ts +18 -0
- package/api/cancelPurchaseOrders/cancelPurchaseOrders.d.ts +10 -0
- package/api/cancelPurchaseOrders/graphql/cancelPurchaseOrders.graphql.d.ts +18 -0
- package/api/cancelPurchaseOrders/index.d.ts +18 -0
- package/api/createPurchaseOrderApprovalRule/createPurchaseOrderApprovalRule.d.ts +4 -0
- package/api/createPurchaseOrderApprovalRule/graphql/createPurchaseOrderApprovalRule.graphql.d.ts +18 -0
- package/api/createPurchaseOrderApprovalRule/index.d.ts +18 -0
- package/api/deletePurchaseOrderApprovalRule/deletePurchaseOrderApprovalRule.d.ts +9 -0
- package/api/deletePurchaseOrderApprovalRule/graphql/deletePurchaseOrderApprovalRule.graphql.d.ts +18 -0
- package/api/deletePurchaseOrderApprovalRule/index.d.ts +18 -0
- package/api/fragments.d.ts +18 -0
- package/api/getCustomerRolePermissions/getCustomerRolePermissions.d.ts +4 -0
- package/api/getCustomerRolePermissions/graphql/getCustomerRolePermissions.d.ts +16 -0
- package/api/getCustomerRolePermissions/index.d.ts +18 -0
- package/api/getPurchaseOrder/getPurchaseOrder.d.ts +6 -0
- package/api/getPurchaseOrder/graphql/getPurchaseOrder.graphql.d.ts +18 -0
- package/api/getPurchaseOrder/index.d.ts +18 -0
- package/api/getPurchaseOrderApprovalRuleMetadata/getPurchaseOrderApprovalRuleMetadata.d.ts +4 -0
- package/api/getPurchaseOrderApprovalRuleMetadata/graphql/getPurchaseOrderApprovalRuleMetadata.graphql.d.ts +18 -0
- package/api/getPurchaseOrderApprovalRuleMetadata/index.d.ts +18 -0
- package/api/getPurchaseOrders/getPurchaseOrders.d.ts +12 -0
- package/api/getPurchaseOrders/graphql/getPurchaseOrders.graphql.d.ts +18 -0
- package/api/getPurchaseOrders/index.d.ts +18 -0
- package/api/graphql/PurchaseOrdersFragment.graphql.d.ts +18 -0
- package/api/index.d.ts +31 -0
- package/api/initialize/lib/getPermissions.d.ts +19 -0
- package/api/initialize/lib/index.d.ts +18 -0
- package/api/placeOrderForPurchaseOrder/graphql/placeOrderForPurchaseOrder.graphql.d.ts +18 -0
- package/api/placeOrderForPurchaseOrder/index.d.ts +18 -0
- package/api/placeOrderForPurchaseOrder/placeOrderForPurchaseOrder.d.ts +4 -0
- package/api/placePurchaseOrder/graphql/placePurchaseOrder.graphql.d.ts +18 -0
- package/api/placePurchaseOrder/index.d.ts +18 -0
- package/api/placePurchaseOrder/placePurchaseOrder.d.ts +6 -0
- package/api/rejectPurchaseOrders/graphql/rejectPurchaseOrders.graphql.d.ts +18 -0
- package/api/rejectPurchaseOrders/index.d.ts +18 -0
- package/api/rejectPurchaseOrders/rejectPurchaseOrders.d.ts +10 -0
- package/api/updatePurchaseOrderApprovalRule/graphql/updatePurchaseOrderApprovalRule.graphql.d.ts +18 -0
- package/api/updatePurchaseOrderApprovalRule/index.d.ts +18 -0
- package/api/updatePurchaseOrderApprovalRule/updatePurchaseOrderApprovalRule.d.ts +4 -0
- package/api/validatePurchaseOrders/graphql/validatePurchaseOrders.graphql.d.ts +18 -0
- package/api/validatePurchaseOrders/index.d.ts +18 -0
- package/api/validatePurchaseOrders/validatePurchaseOrders.d.ts +10 -0
- package/api.js +330 -1
- package/api.js.map +1 -1
- package/chunks/PurchaseOrdersTableActions.js +4 -0
- package/chunks/PurchaseOrdersTableActions.js.map +1 -0
- package/chunks/getPurchaseOrders.js +113 -0
- package/chunks/getPurchaseOrders.js.map +1 -0
- package/chunks/usePurchaseOrders.js +4 -0
- package/chunks/usePurchaseOrders.js.map +1 -0
- package/components/PurchaseOrdersHeader/PurchaseOrdersHeader.d.ts +6 -0
- package/components/PurchaseOrdersHeader/index.d.ts +19 -0
- package/components/PurchaseOrdersTable/PurchaseOrdersTable.d.ts +5 -0
- package/components/PurchaseOrdersTable/index.d.ts +19 -0
- package/components/PurchaseOrdersTableActions/PurchaseOrdersTableActions.d.ts +5 -0
- package/components/PurchaseOrdersTableActions/index.d.ts +19 -0
- package/components/index.d.ts +19 -1
- package/configs/companyPurchaseOrders.config.d.ts +4 -0
- package/configs/customerPurchaseOrders.config.d.ts +4 -0
- package/configs/index.d.ts +21 -0
- package/configs/pageSize.config.d.ts +22 -0
- package/configs/purchaseOrderApprovalRules.config.d.ts +4 -0
- package/containers/CompanyPurchaseOrders/CompanyPurchaseOrders.d.ts +5 -0
- package/containers/CompanyPurchaseOrders/index.d.ts +19 -0
- package/containers/CompanyPurchaseOrders.d.ts +3 -0
- package/containers/CompanyPurchaseOrders.js +4 -0
- package/containers/CompanyPurchaseOrders.js.map +1 -0
- package/containers/CustomerPurchaseOrders/CustomerPurchaseOrders.d.ts +5 -0
- package/containers/CustomerPurchaseOrders/index.d.ts +19 -0
- package/containers/CustomerPurchaseOrders.d.ts +3 -0
- package/containers/CustomerPurchaseOrders.js +4 -0
- package/containers/CustomerPurchaseOrders.js.map +1 -0
- package/containers/RequireApprovalPurchaseOrders/RequireApprovalPurchaseOrders.d.ts +5 -0
- package/containers/RequireApprovalPurchaseOrders/index.d.ts +19 -0
- package/containers/RequireApprovalPurchaseOrders.d.ts +3 -0
- package/containers/RequireApprovalPurchaseOrders.js +4 -0
- package/containers/RequireApprovalPurchaseOrders.js.map +1 -0
- package/containers/index.d.ts +3 -1
- package/data/models/cart-model.d.ts +40 -0
- package/data/models/customer-order-model.d.ts +128 -0
- package/data/models/customer-role-permissions-model.d.ts +35 -0
- package/data/models/index.d.ts +23 -1
- package/data/models/purchase-order-approval-rule-metadata-model.d.ts +33 -0
- package/data/models/purchase-order-approval-rule-model.d.ts +50 -0
- package/data/models/purchase-order-comment-model.d.ts +39 -0
- package/data/models/purchase-order-model.d.ts +75 -0
- package/data/transforms/index.d.ts +22 -1
- package/data/transforms/transform-cart.d.ts +4 -0
- package/data/transforms/transform-customer-order.d.ts +4 -0
- package/data/transforms/transform-customer-role-permissions.d.ts +4 -0
- package/data/transforms/transform-purchase-order-approval-rule-metadata.d.ts +4 -0
- package/data/transforms/transform-purchase-order-approval-rule.d.ts +4 -0
- package/data/transforms/transform-purchase-order-comment.d.ts +4 -0
- package/data/transforms/transform-purchase-order.d.ts +4 -0
- package/hooks/index.d.ts +18 -0
- package/hooks/usePurchaseOrders.d.ts +4 -0
- package/i18n/en_US.json.d.ts +86 -2
- package/lib/case-converter.d.ts +25 -0
- package/lib/fetch-error.d.ts +21 -0
- package/lib/formatDate.d.ts +24 -0
- package/lib/getRange.d.ts +6 -0
- package/lib/index.d.ts +7 -0
- package/lib/isValidUrl.d.ts +2 -0
- package/lib/network-error.d.ts +22 -0
- package/mocks/index.d.ts +2832 -0
- package/mocks/storybook/index.d.ts +29 -0
- package/package.json +1 -1
- package/render.js +2 -1
- package/render.js.map +1 -1
- package/types/api/api.enums.types.d.ts +21 -0
- package/types/api/index.d.ts +2 -0
- package/types/components/index.d.ts +4 -0
- package/types/components/pagination.types.d.ts +27 -0
- package/types/components/purchaseOrdersTable.types.d.ts +31 -0
- package/types/components/purchaseOrdersTableActions.d.ts +8 -0
- package/types/containers/companyPurchaseOrders.types.d.ts +12 -0
- package/types/containers/customerPurchaseOrders.types.d.ts +12 -0
- package/types/containers/index.d.ts +4 -0
- package/types/containers/requireApprovalPurchaseOrders.types.d.ts +12 -0
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/usePurchaseOrders.types.d.ts +37 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const PLACE_PURCHASE_ORDER: string;
|
|
18
|
+
//# sourceMappingURL=placePurchaseOrder.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './placePurchaseOrder';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const REJECT_PURCHASE_ORDERS: string;
|
|
18
|
+
//# sourceMappingURL=rejectPurchaseOrders.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './rejectPurchaseOrders';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PurchaseOrderModel } from '../../data/models';
|
|
2
|
+
|
|
3
|
+
export declare const rejectPurchaseOrders: (uids: string | string[]) => Promise<{
|
|
4
|
+
errors: {
|
|
5
|
+
message: string;
|
|
6
|
+
type: string;
|
|
7
|
+
}[];
|
|
8
|
+
purchaseOrders: PurchaseOrderModel[];
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=rejectPurchaseOrders.d.ts.map
|
package/api/updatePurchaseOrderApprovalRule/graphql/updatePurchaseOrderApprovalRule.graphql.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const UPDATE_PURCHASE_ORDER_APPROVAL_RULE = "\n mutation UPDATE_PURCHASE_ORDER_APPROVAL_RULE(\n $input: UpdatePurchaseOrderApprovalRuleInput!\n ) {\n updatePurchaseOrderApprovalRule(input: $input) {\n created_at\n created_by\n description\n name\n status\n uid\n updated_at\n applies_to_roles {\n id\n name\n users_count\n permissions {\n id\n sort_order\n text\n }\n }\n condition {\n attribute\n operator\n }\n approver_roles {\n id\n name\n users_count\n permissions {\n id\n sort_order\n text\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=updatePurchaseOrderApprovalRule.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './updatePurchaseOrderApprovalRule';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PurchaseOrderApprovalRuleModel } from '../../data/models/purchase-order-approval-rule-model';
|
|
2
|
+
|
|
3
|
+
export declare const updatePurchaseOrderApprovalRule: (input: any) => Promise<PurchaseOrderApprovalRuleModel>;
|
|
4
|
+
//# sourceMappingURL=updatePurchaseOrderApprovalRule.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const VALIDATE_PURCHASE_ORDERS: string;
|
|
18
|
+
//# sourceMappingURL=validatePurchaseOrders.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './validatePurchaseOrders';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PurchaseOrderModel } from '../../data/models';
|
|
2
|
+
|
|
3
|
+
export declare const validatePurchaseOrders: (uids: string | string[]) => Promise<{
|
|
4
|
+
errors: {
|
|
5
|
+
message: string;
|
|
6
|
+
type: string;
|
|
7
|
+
}[];
|
|
8
|
+
purchaseOrders: PurchaseOrderModel[];
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=validatePurchaseOrders.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,4 +1,333 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{Initializer as
|
|
3
|
+
import{Initializer as I}from"@dropins/tools/lib.js";import{events as w}from"@dropins/tools/event-bus.js";import{P as y,f as l,h as d,t as C,b as p}from"./chunks/getPurchaseOrders.js";import{a as Pr,i as Ar,g as Er,r as fr,d as Rr,s as gr,c as br,e as Cr}from"./chunks/getPurchaseOrders.js";import"@dropins/tools/fetch-graphql.js";let b=null;const v=()=>{const e=sessionStorage.getItem("b2b-po-permissions");if(e)try{return Promise.resolve(JSON.parse(e))}catch{}return b||(b=Y().then(t=>(sessionStorage.setItem("b2b-po-permissions",JSON.stringify(t)),t)).finally(()=>{b=null})),b},x=()=>{sessionStorage.removeItem("b2b-po-permissions")};typeof window<"u"&&(window.__getPermissions=v);const U=new I({init:async e=>{const t={};U.config.setConfig({...t,...e})},listeners:()=>[w.on("authenticated",async e=>{if(e){const t=await v();w.emit("purchase-order/permissions-initialised",t)}else x()},{eager:!0})]}),sr=U.config,q=`
|
|
4
|
+
mutation CANCEL_PURCHASE_ORDERS($input: PurchaseOrdersActionInput!) {
|
|
5
|
+
cancelPurchaseOrders(input: $input) {
|
|
6
|
+
purchase_orders {
|
|
7
|
+
...PURCHASE_ORDERS_FRAGMENT
|
|
8
|
+
}
|
|
9
|
+
errors {
|
|
10
|
+
message
|
|
11
|
+
type
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
${y}
|
|
16
|
+
`,tr=async e=>{const t=Array.isArray(e)?e:[e];if(!t||t.length===0)throw new Error("Purchase Order UID(s) are required");if(t.some(s=>!s||s.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return l(q,{variables:{input:{purchase_order_uids:t}}}).then(s=>{var c,_,o;(c=s.errors)!=null&&c.length&&d(s.errors);const u=(_=s.data)==null?void 0:_.cancelPurchaseOrders;if(!u)throw new Error("Failed to cancel purchase orders");return{errors:((u==null?void 0:u.errors)??[]).map(n=>({message:(n==null?void 0:n.message)??"",type:(n==null?void 0:n.type)??""})),purchaseOrders:((o=u==null?void 0:u.purchase_orders)==null?void 0:o.map(n=>C(n)))??[]}}).catch(p)},M=`
|
|
17
|
+
mutation VALIDATE_PURCHASE_ORDERS($input: ValidatePurchaseOrdersInput!) {
|
|
18
|
+
validatePurchaseOrders(input: $input) {
|
|
19
|
+
errors {
|
|
20
|
+
message
|
|
21
|
+
type
|
|
22
|
+
}
|
|
23
|
+
purchase_orders {
|
|
24
|
+
...PURCHASE_ORDERS_FRAGMENT
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
${y}
|
|
29
|
+
`,ur=async e=>{const t=Array.isArray(e)?e:[e];if(!t||t.length===0)throw new Error("Purchase Order UID(s) are required");if(t.some(s=>!s||s.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return l(M,{variables:{input:{purchase_order_uids:t}}}).then(s=>{var c,_;(c=s.errors)!=null&&c.length&&d(s.errors);const u=(_=s.data)==null?void 0:_.validatePurchaseOrders;return{errors:((u==null?void 0:u.errors)??[]).map(o=>({message:(o==null?void 0:o.message)??"",type:(o==null?void 0:o.type)??""})),purchaseOrders:((u==null?void 0:u.purchase_orders)||[]).map(C)}}).catch(p)},H=`
|
|
30
|
+
mutation ADD_PURCHASE_ORDER_COMMENT(
|
|
31
|
+
$purchaseOrderUid: ID!
|
|
32
|
+
$comment: String!
|
|
33
|
+
) {
|
|
34
|
+
addPurchaseOrderComment(
|
|
35
|
+
input: { purchase_order_uid: $purchaseOrderUid, comment: $comment }
|
|
36
|
+
) {
|
|
37
|
+
comment {
|
|
38
|
+
created_at
|
|
39
|
+
text
|
|
40
|
+
uid
|
|
41
|
+
author {
|
|
42
|
+
allow_remote_shopping_assistance
|
|
43
|
+
confirmation_status
|
|
44
|
+
created_at
|
|
45
|
+
date_of_birth
|
|
46
|
+
email
|
|
47
|
+
firstname
|
|
48
|
+
gender
|
|
49
|
+
job_title
|
|
50
|
+
lastname
|
|
51
|
+
middlename
|
|
52
|
+
prefix
|
|
53
|
+
status
|
|
54
|
+
structure_id
|
|
55
|
+
suffix
|
|
56
|
+
telephone
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`,$=e=>{var i,s,u,c,_,o,n,h,P,A,E,f,R,O,g;const t=((s=(i=e==null?void 0:e.cart)==null?void 0:i.itemsV2)==null?void 0:s.items)??[];return{cart:{id:((u=e==null?void 0:e.cart)==null?void 0:u.id)??"",items:t.map(a=>{var r,D,S;return{uid:(a==null?void 0:a.uid)??"",quantity:(a==null?void 0:a.quantity)??0,product:{uid:((r=a==null?void 0:a.product)==null?void 0:r.uid)??"",name:((D=a==null?void 0:a.product)==null?void 0:D.name)??"",sku:((S=a==null?void 0:a.product)==null?void 0:S.sku)??""}}}),pagination:{currentPage:((o=(_=(c=e==null?void 0:e.cart)==null?void 0:c.itemsV2)==null?void 0:_.page_info)==null?void 0:o.current_page)??1,pageSize:((P=(h=(n=e==null?void 0:e.cart)==null?void 0:n.itemsV2)==null?void 0:h.page_info)==null?void 0:P.page_size)??20,totalPages:((f=(E=(A=e==null?void 0:e.cart)==null?void 0:A.itemsV2)==null?void 0:E.page_info)==null?void 0:f.total_pages)??0,totalCount:((O=(R=e==null?void 0:e.cart)==null?void 0:R.itemsV2)==null?void 0:O.total_count)??0}},userErrors:((g=e==null?void 0:e.user_errors)==null?void 0:g.map(a=>({message:(a==null?void 0:a.message)??""})))??[]}},L=e=>{var g,a;const t=(a=(g=e.data)==null?void 0:g.placeOrderForPurchaseOrder)==null?void 0:a.order,i=r=>({value:(r==null?void 0:r.value)||0,currency:(r==null?void 0:r.currency)||""}),s=r=>({code:(r==null?void 0:r.code)||"",label:(r==null?void 0:r.label)||""}),u=r=>({code:(r==null?void 0:r.code)||"",appliedBalance:i(r==null?void 0:r.applied_balance),currentBalance:i(r==null?void 0:r.current_balance)}),c=r=>({firstname:(r==null?void 0:r.firstname)||"",lastname:(r==null?void 0:r.lastname)||"",street:(r==null?void 0:r.street)||[],city:(r==null?void 0:r.city)||"",region:(r==null?void 0:r.region)||"",postcode:(r==null?void 0:r.postcode)||"",countryCode:(r==null?void 0:r.country_code)||"",telephone:(r==null?void 0:r.telephone)||"",company:(r==null?void 0:r.company)||""}),_=r=>({name:(r==null?void 0:r.name)||"",type:(r==null?void 0:r.type)||"",additionalData:(r==null?void 0:r.additional_data)||{}}),o=r=>({id:(r==null?void 0:r.id)||"",productName:(r==null?void 0:r.product_name)||"",productSku:(r==null?void 0:r.product_sku)||"",quantityOrdered:(r==null?void 0:r.quantity_ordered)||0,quantityShipped:(r==null?void 0:r.quantity_shipped)||0,quantityInvoiced:(r==null?void 0:r.quantity_invoiced)||0,quantityRefunded:(r==null?void 0:r.quantity_refunded)||0,price:i(r==null?void 0:r.price),total:i(r==null?void 0:r.total)}),n=r=>({number:(r==null?void 0:r.number)||"",carrier:(r==null?void 0:r.carrier)||"",title:(r==null?void 0:r.title)||""}),h=r=>({message:(r==null?void 0:r.message)||"",timestamp:(r==null?void 0:r.timestamp)||""}),P=r=>({id:(r==null?void 0:r.id)||"",productName:(r==null?void 0:r.product_name)||"",productSku:(r==null?void 0:r.product_sku)||"",quantityShipped:(r==null?void 0:r.quantity_shipped)||0}),A=r=>({id:(r==null?void 0:r.id)||"",number:(r==null?void 0:r.number)||"",tracking:((r==null?void 0:r.tracking)||[]).map(n),comments:((r==null?void 0:r.comments)||[]).map(h),items:((r==null?void 0:r.items)||[]).map(P)}),E=r=>({firstname:(r==null?void 0:r.firstname)||"",lastname:(r==null?void 0:r.lastname)||"",email:(r==null?void 0:r.email)||""}),f=r=>({label:(r==null?void 0:r.label)||"",amount:i(r==null?void 0:r.amount)}),R=r=>({baseGrandTotal:i(r==null?void 0:r.base_grand_total),grandTotal:i(r==null?void 0:r.grand_total),subtotal:i(r==null?void 0:r.subtotal),totalTax:i(r==null?void 0:r.total_tax),totalShipping:i(r==null?void 0:r.total_shipping),discounts:((r==null?void 0:r.discounts)||[]).map(f)}),O=r=>({appliedCoupons:((r==null?void 0:r.applied_coupons)||[]).map(s),appliedGiftCards:((r==null?void 0:r.applied_gift_cards)||[]).map(u),availableActions:(r==null?void 0:r.available_actions)||[],billingAddress:r!=null&&r.billing_address?c(r.billing_address):{firstname:"",lastname:"",street:[],city:"",region:"",postcode:"",countryCode:"",telephone:"",company:""},carrier:(r==null?void 0:r.carrier)||"",comments:(r==null?void 0:r.comments)||[],creditMemos:(r==null?void 0:r.credit_memos)||[],customAttributes:(r==null?void 0:r.custom_attributes)||[],customerInfo:r!=null&&r.customer_info?E(r.customer_info):{firstname:"",lastname:"",email:""},email:(r==null?void 0:r.email)||"",giftMessage:(r==null?void 0:r.gift_message)||"",giftReceiptIncluded:(r==null?void 0:r.gift_receipt_included)||!1,giftWrapping:(r==null?void 0:r.gift_wrapping)||null,id:(r==null?void 0:r.id)||"",invoices:(r==null?void 0:r.invoices)||[],isVirtual:(r==null?void 0:r.is_virtual)||!1,items:((r==null?void 0:r.items)||[]).map(o),itemsEligibleForReturn:(r==null?void 0:r.items_eligible_for_return)||[],number:(r==null?void 0:r.number)||"",orderDate:(r==null?void 0:r.order_date)||"",orderStatusChangeDate:(r==null?void 0:r.order_status_change_date)||"",paymentMethods:((r==null?void 0:r.payment_methods)||[]).map(_),printedCardIncluded:(r==null?void 0:r.printed_card_included)||!1,returns:(r==null?void 0:r.returns)||null,shipments:((r==null?void 0:r.shipments)||[]).map(A),shippingAddress:r!=null&&r.shipping_address?c(r.shipping_address):{firstname:"",lastname:"",street:[],city:"",region:"",postcode:"",countryCode:"",telephone:"",company:""},shippingMethod:(r==null?void 0:r.shipping_method)||"",status:(r==null?void 0:r.status)||"",token:(r==null?void 0:r.token)||"",total:r!=null&&r.total?R(r.total):{baseGrandTotal:i(null),grandTotal:i(null),subtotal:i(null),totalTax:i(null),totalShipping:i(null),discounts:[]}});return O(t||null)},F=e=>{var _,o;const t=(o=(_=e==null?void 0:e.data)==null?void 0:_.customer)==null?void 0:o.purchase_order_approval_rule_metadata,i=n=>{var h;return{id:(n==null?void 0:n.id)||"",sortOrder:(n==null?void 0:n.sort_order)||0,text:(n==null?void 0:n.text)||"",children:((h=n==null?void 0:n.children)==null?void 0:h.map(i))||void 0}},s=n=>({id:(n==null?void 0:n.id)||"",name:(n==null?void 0:n.name)||"",usersCount:(n==null?void 0:n.users_count)||0,permissions:((n==null?void 0:n.permissions)||[]).map(i)}),u=((t==null?void 0:t.available_applies_to)||[]).map(s),c=((t==null?void 0:t.available_requires_approval_from)||[]).map(s);return{availableAppliesTo:u,availableRequiresApprovalFrom:c}},T=e=>{const t=s=>({id:(s==null?void 0:s.id)||"",name:(s==null?void 0:s.name)||"",usersCount:(s==null?void 0:s.users_count)||0,permissions:((s==null?void 0:s.permissions)||[]).map(u=>({id:(u==null?void 0:u.id)||"",sortOrder:(u==null?void 0:u.sort_order)||0,text:(u==null?void 0:u.text)||""}))}),i=s=>({attribute:s==null?void 0:s.attribute,operator:s==null?void 0:s.operator});return{uid:(e==null?void 0:e.uid)||"",name:(e==null?void 0:e.name)||"",description:(e==null?void 0:e.description)||"",status:e==null?void 0:e.status,createdAt:(e==null?void 0:e.created_at)||"",updatedAt:(e==null?void 0:e.updated_at)||"",createdBy:e==null?void 0:e.created_by,appliesToRoles:((e==null?void 0:e.applies_to_roles)||[]).map(t),approverRoles:((e==null?void 0:e.approver_roles)||[]).map(t),condition:i((e==null?void 0:e.condition)||{})}},G=e=>{var t,i,s,u,c,_,o,n,h,P,A,E,f,R,O;return{createdAt:(e==null?void 0:e.created_at)??"",text:(e==null?void 0:e.text)??"",uid:(e==null?void 0:e.uid)??"",author:{allowRemoteShoppingAssistance:((t=e==null?void 0:e.author)==null?void 0:t.allow_remote_shopping_assistance)??!1,confirmationStatus:((i=e==null?void 0:e.author)==null?void 0:i.confirmation_status)??"",createdAt:((s=e==null?void 0:e.author)==null?void 0:s.created_at)??"",dateOfBirth:((u=e==null?void 0:e.author)==null?void 0:u.date_of_birth)??"",email:((c=e==null?void 0:e.author)==null?void 0:c.email)??"",firstname:((_=e==null?void 0:e.author)==null?void 0:_.firstname)??"",gender:((o=e==null?void 0:e.author)==null?void 0:o.gender)??0,jobTitle:((n=e==null?void 0:e.author)==null?void 0:n.job_title)??"",lastname:((h=e==null?void 0:e.author)==null?void 0:h.lastname)??"",middlename:((P=e==null?void 0:e.author)==null?void 0:P.middlename)??"",prefix:((A=e==null?void 0:e.author)==null?void 0:A.prefix)??"",status:((E=e==null?void 0:e.author)==null?void 0:E.status)??"",structureId:((f=e==null?void 0:e.author)==null?void 0:f.structure_id)??"",suffix:((R=e==null?void 0:e.author)==null?void 0:R.suffix)??"",telephone:((O=e==null?void 0:e.author)==null?void 0:O.telephone)??""}}},ir=async(e,t)=>{if(!e)throw new Error("Purchase Order ID is required");if(!t)throw new Error("Comment text is required");return l(H,{variables:{purchaseOrderUid:e,comment:t}}).then(s=>{var u,c,_;return(u=s.errors)!=null&&u.length&&d(s.errors),G((_=(c=s.data)==null?void 0:c.addPurchaseOrderComment)==null?void 0:_.comment)}).catch(p)},V=`
|
|
62
|
+
mutation ADD_PURCHASE_ORDER_ITEMS_TO_CART(
|
|
63
|
+
$purchaseOrderUid: ID!
|
|
64
|
+
$cartId: String!
|
|
65
|
+
$replaceExistingCartItems: Boolean!
|
|
66
|
+
) {
|
|
67
|
+
addPurchaseOrderItemsToCart(
|
|
68
|
+
input: {
|
|
69
|
+
purchase_order_uid: $purchaseOrderUid
|
|
70
|
+
cart_id: $cartId
|
|
71
|
+
replace_existing_cart_items: $replaceExistingCartItems
|
|
72
|
+
}
|
|
73
|
+
) {
|
|
74
|
+
cart {
|
|
75
|
+
id
|
|
76
|
+
itemsV2 {
|
|
77
|
+
items {
|
|
78
|
+
uid
|
|
79
|
+
quantity
|
|
80
|
+
product {
|
|
81
|
+
uid
|
|
82
|
+
name
|
|
83
|
+
sku
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
page_info {
|
|
87
|
+
current_page
|
|
88
|
+
page_size
|
|
89
|
+
total_pages
|
|
90
|
+
}
|
|
91
|
+
total_count
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
`,nr=async(e,t,i=!1)=>{if(!e)throw new Error("Purchase Order UID is required");if(!t)throw new Error("Cart ID is required");return l(V,{variables:{purchaseOrderUid:e,cartId:t,replaceExistingCartItems:i}}).then(u=>{var _,o;(_=u.errors)!=null&&_.length&&d(u.errors);const c=(o=u.data)==null?void 0:o.addPurchaseOrderItemsToCart;if(!(c!=null&&c.cart))throw new Error("Failed to add purchase order items to cart");return $(c)}).catch(p)},N=`
|
|
97
|
+
mutation CREATE_PURCHASE_ORDER_APPROVAL_RULE(
|
|
98
|
+
$input: PurchaseOrderApprovalRuleInput!
|
|
99
|
+
) {
|
|
100
|
+
createPurchaseOrderApprovalRule(input: $input) {
|
|
101
|
+
created_at
|
|
102
|
+
created_by
|
|
103
|
+
description
|
|
104
|
+
name
|
|
105
|
+
status
|
|
106
|
+
uid
|
|
107
|
+
updated_at
|
|
108
|
+
applies_to_roles {
|
|
109
|
+
id
|
|
110
|
+
name
|
|
111
|
+
users_count
|
|
112
|
+
permissions {
|
|
113
|
+
id
|
|
114
|
+
sort_order
|
|
115
|
+
text
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
condition {
|
|
119
|
+
attribute
|
|
120
|
+
operator
|
|
121
|
+
}
|
|
122
|
+
approver_roles {
|
|
123
|
+
id
|
|
124
|
+
name
|
|
125
|
+
users_count
|
|
126
|
+
permissions {
|
|
127
|
+
id
|
|
128
|
+
sort_order
|
|
129
|
+
text
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`,cr=async e=>{if(!e.name||e.name.trim()==="")throw new Error("Rule name is required");return l(N,{variables:{input:e}}).then(t=>{var s,u;if((s=t.errors)!=null&&s.length&&d(t.errors),!((u=t.data)==null?void 0:u.createPurchaseOrderApprovalRule))throw new Error("Failed to create purchase order approval rule");return T(t.data.createPurchaseOrderApprovalRule)}).catch(p)},z=`
|
|
135
|
+
mutation DELETE_PURCHASE_ORDER_APPROVAL_RULE(
|
|
136
|
+
$input: DeletePurchaseOrderApprovalRuleInput!
|
|
137
|
+
) {
|
|
138
|
+
deletePurchaseOrderApprovalRule(input: $input) {
|
|
139
|
+
errors {
|
|
140
|
+
message
|
|
141
|
+
type
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
`,_r=async e=>{const t=Array.isArray(e)?e:[e];if(!t||t.length===0)throw new Error("Approval Rule UID(s) are required");if(t.some(s=>!s||s.trim()===""))throw new Error("All Approval Rule UIDs must be valid");return l(z,{variables:{input:{approval_rule_uids:t}}}).then(s=>{var _,o,n;if((_=s.errors)!=null&&_.length&&d(s.errors),!((o=s.data)==null?void 0:o.deletePurchaseOrderApprovalRule))throw new Error("Failed to delete purchase order approval rule");const c=(n=s==null?void 0:s.data)==null?void 0:n.deletePurchaseOrderApprovalRule;return{deletePurchaseOrderApprovalRule:{errors:((c==null?void 0:c.errors)??[]).map(h=>({message:h==null?void 0:h.message,type:h==null?void 0:h.type}))}}}).catch(p)},B=`
|
|
146
|
+
mutation UPDATE_PURCHASE_ORDER_APPROVAL_RULE(
|
|
147
|
+
$input: UpdatePurchaseOrderApprovalRuleInput!
|
|
148
|
+
) {
|
|
149
|
+
updatePurchaseOrderApprovalRule(input: $input) {
|
|
150
|
+
created_at
|
|
151
|
+
created_by
|
|
152
|
+
description
|
|
153
|
+
name
|
|
154
|
+
status
|
|
155
|
+
uid
|
|
156
|
+
updated_at
|
|
157
|
+
applies_to_roles {
|
|
158
|
+
id
|
|
159
|
+
name
|
|
160
|
+
users_count
|
|
161
|
+
permissions {
|
|
162
|
+
id
|
|
163
|
+
sort_order
|
|
164
|
+
text
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
condition {
|
|
168
|
+
attribute
|
|
169
|
+
operator
|
|
170
|
+
}
|
|
171
|
+
approver_roles {
|
|
172
|
+
id
|
|
173
|
+
name
|
|
174
|
+
users_count
|
|
175
|
+
permissions {
|
|
176
|
+
id
|
|
177
|
+
sort_order
|
|
178
|
+
text
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
`,or=async e=>{if(!e.uid||e.uid.trim()==="")throw new Error("Approval Rule UID is required");return l(B,{variables:{input:e}}).then(t=>{var i,s;return(i=t.errors)!=null&&i.length&&d(t.errors),T(((s=t.data)==null?void 0:s.updatePurchaseOrderApprovalRule)||{})}).catch(p)},j=`
|
|
184
|
+
query GET_PURCHASE_ORDER($uid: ID!) {
|
|
185
|
+
customer {
|
|
186
|
+
purchase_order(uid: $uid) {
|
|
187
|
+
uid
|
|
188
|
+
number
|
|
189
|
+
created_at
|
|
190
|
+
updated_at
|
|
191
|
+
status
|
|
192
|
+
available_actions
|
|
193
|
+
created_by {
|
|
194
|
+
firstname
|
|
195
|
+
lastname
|
|
196
|
+
email
|
|
197
|
+
}
|
|
198
|
+
order {
|
|
199
|
+
id
|
|
200
|
+
number
|
|
201
|
+
total {
|
|
202
|
+
grand_total {
|
|
203
|
+
value
|
|
204
|
+
currency
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
quote {
|
|
209
|
+
prices {
|
|
210
|
+
grand_total {
|
|
211
|
+
value
|
|
212
|
+
currency
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
`,ar=async e=>{if(!e||e.trim()==="")throw new Error("Purchase Order UID is required");return l(j,{variables:{uid:e}}).then(t=>{var s,u,c;(s=t.errors)!=null&&s.length&&d(t.errors);const i=(c=(u=t.data)==null?void 0:u.customer)==null?void 0:c.purchase_order;if(!i)throw new Error("Failed to get purchase order");return{purchaseOrder:C(i)}}).catch(p)},Q=`
|
|
220
|
+
mutation PLACE_ORDER_FOR_PURCHASE_ORDER(
|
|
221
|
+
$input: PlaceOrderForPurchaseOrderInput!
|
|
222
|
+
) {
|
|
223
|
+
placeOrderForPurchaseOrder(input: $input) {
|
|
224
|
+
order {
|
|
225
|
+
available_actions
|
|
226
|
+
carrier
|
|
227
|
+
email
|
|
228
|
+
gift_receipt_included
|
|
229
|
+
id
|
|
230
|
+
is_virtual
|
|
231
|
+
number
|
|
232
|
+
order_date
|
|
233
|
+
order_status_change_date
|
|
234
|
+
printed_card_included
|
|
235
|
+
shipping_method
|
|
236
|
+
status
|
|
237
|
+
token
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`,hr=async e=>{var i;if(!e||e.trim()==="")throw new Error("Purchase Order UID is required");const t={purchase_order_uid:e};try{const s=await l(Q,{variables:{input:t}});return(i=s.errors)!=null&&i.length&&d(s.errors),L(s)}catch(s){throw p(s)}},J=`
|
|
242
|
+
mutation PLACE_PURCHASE_ORDER($input: PlacePurchaseOrderInput!) {
|
|
243
|
+
placePurchaseOrder(input: $input) {
|
|
244
|
+
purchase_order {
|
|
245
|
+
...PURCHASE_ORDERS_FRAGMENT
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
${y}
|
|
250
|
+
`,lr=async e=>{if(!e||e.trim()==="")throw new Error("Cart ID is required");return l(J,{variables:{input:{cart_id:e}}}).then(i=>{var u,c,_;(u=i.errors)!=null&&u.length&&d(i.errors);const s=(_=(c=i.data)==null?void 0:c.placePurchaseOrder)==null?void 0:_.purchase_order;return{purchaseOrder:C(s)}}).catch(p)},W=`
|
|
251
|
+
query GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA {
|
|
252
|
+
customer {
|
|
253
|
+
purchase_order_approval_rule_metadata {
|
|
254
|
+
available_applies_to {
|
|
255
|
+
id
|
|
256
|
+
name
|
|
257
|
+
users_count
|
|
258
|
+
permissions {
|
|
259
|
+
id
|
|
260
|
+
sort_order
|
|
261
|
+
text
|
|
262
|
+
children {
|
|
263
|
+
id
|
|
264
|
+
sort_order
|
|
265
|
+
text
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
available_requires_approval_from {
|
|
270
|
+
id
|
|
271
|
+
name
|
|
272
|
+
users_count
|
|
273
|
+
permissions {
|
|
274
|
+
id
|
|
275
|
+
sort_order
|
|
276
|
+
text
|
|
277
|
+
children {
|
|
278
|
+
id
|
|
279
|
+
sort_order
|
|
280
|
+
text
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
`,dr=async()=>l(W,{variables:{}}).then(e=>{var t;return(t=e.errors)!=null&&t.length&&d(e.errors),F(e)}).catch(p),k=`
|
|
288
|
+
query GET_CUSTOMER_ROLE_PERMISSIONS {
|
|
289
|
+
customer {
|
|
290
|
+
purchase_orders_enabled
|
|
291
|
+
role {
|
|
292
|
+
id
|
|
293
|
+
name
|
|
294
|
+
permissions {
|
|
295
|
+
id
|
|
296
|
+
text
|
|
297
|
+
sort_order
|
|
298
|
+
children {
|
|
299
|
+
# 2
|
|
300
|
+
id
|
|
301
|
+
text
|
|
302
|
+
sort_order
|
|
303
|
+
children {
|
|
304
|
+
# 3
|
|
305
|
+
id
|
|
306
|
+
text
|
|
307
|
+
sort_order
|
|
308
|
+
children {
|
|
309
|
+
# 4
|
|
310
|
+
id
|
|
311
|
+
text
|
|
312
|
+
sort_order
|
|
313
|
+
children {
|
|
314
|
+
# 5
|
|
315
|
+
id
|
|
316
|
+
text
|
|
317
|
+
sort_order
|
|
318
|
+
children {
|
|
319
|
+
# 6
|
|
320
|
+
id
|
|
321
|
+
text
|
|
322
|
+
sort_order
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
`,K=e=>{const t=new Set,i=s=>{s.forEach(u=>{u!=null&&u.id&&t.add(u.id),u!=null&&u.children&&Array.isArray(u.children)&&i(u.children)})};return e&&Array.isArray(e)&&i(e),t},X=e=>{var _,o,n,h,P,A,E,f,R,O,g;const t=(o=(_=e==null?void 0:e.data)==null?void 0:_.customer)==null?void 0:o.role,i=((h=(n=e==null?void 0:e.data)==null?void 0:n.customer)==null?void 0:h.purchase_orders_enabled)??!1,s=((f=(E=(A=(P=e==null?void 0:e.data)==null?void 0:P.customer)==null?void 0:A.role)==null?void 0:E.permissions)==null?void 0:f.length)===0&&((g=(O=(R=e==null?void 0:e.data)==null?void 0:R.customer)==null?void 0:O.role)==null?void 0:g.name)==="Company Administrator";if(!t)return{isAdmin:!1,purchaseOrderEnabled:i,role:{id:"",name:""},permissions:{purchaseOrderAll:!1,viewPurchaseOrders:!1,viewPurchaseOrdersForSubordinates:!1,viewPurchaseOrdersForCompany:!1,autoApprovePurchaseOrder:!1,superApprovePurchaseOrder:!1,viewApprovalRules:!1,manageApprovalRules:!1}};const u=K(t.permissions||[]),c=a=>u.has(a);return{isAdmin:s,purchaseOrderEnabled:i,role:{id:t.id||"",name:t.name||""},permissions:{purchaseOrderAll:s||c("Magento_PurchaseOrder::all"),viewPurchaseOrders:s||c("Magento_PurchaseOrder::view_purchase_orders"),viewPurchaseOrdersForSubordinates:s||c("Magento_PurchaseOrder::view_purchase_orders_for_subordinates"),viewPurchaseOrdersForCompany:s||c("Magento_PurchaseOrder::view_purchase_orders_for_company"),autoApprovePurchaseOrder:s||c("Magento_PurchaseOrder::autoapprove_purchase_order"),superApprovePurchaseOrder:s||c("Magento_PurchaseOrderRule::super_approve_purchase_order"),viewApprovalRules:s||c("Magento_PurchaseOrderRule::view_approval_rules"),manageApprovalRules:s||c("Magento_PurchaseOrderRule::manage_approval_rules")}}},Y=async()=>l(k,{variables:{}}).then(e=>{var t;return(t=e.errors)!=null&&t.length&&d(e.errors),X(e)}).catch(p);export{ir as addPurchaseOrderComment,nr as addPurchaseOrderItemsToCart,Pr as approvePurchaseOrders,tr as cancelPurchaseOrders,sr as config,cr as createPurchaseOrderApprovalRule,_r as deletePurchaseOrderApprovalRule,l as fetchGraphQl,Ar as getConfig,Y as getCustomerRolePermissions,ar as getPurchaseOrder,dr as getPurchaseOrderApprovalRuleMetadata,Er as getPurchaseOrders,U as initialize,hr as placeOrderForPurchaseOrder,lr as placePurchaseOrder,fr as rejectPurchaseOrders,Rr as removeFetchGraphQlHeader,gr as setEndpoint,br as setFetchGraphQlHeader,Cr as setFetchGraphQlHeaders,or as updatePurchaseOrderApprovalRule,ur as validatePurchaseOrders};
|
|
4
333
|
//# sourceMappingURL=api.js.map
|