@dropins/storefront-purchase-order 0.0.3-alpha2 → 0.0.4-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/currencyInfo/currencyInfo.d.ts +24 -0
- package/api/currencyInfo/graphql/currencyInfo.graphql.d.ts +18 -0
- package/api/currencyInfo/index.d.ts +18 -0
- package/api/getPurchaseOrderApprovalRule/getPurchaseOrderApprovalRule.d.ts +4 -0
- package/api/getPurchaseOrderApprovalRule/graphql/getPurchaseOrderApprovalRule.graphql.d.ts +18 -0
- package/api/getPurchaseOrderApprovalRule/index.d.ts +18 -0
- package/api/getPurchaseOrderApprovalRules/getPurchaseOrderApprovalRules.d.ts +12 -0
- package/api/getPurchaseOrderApprovalRules/graphql/getPurchaseOrderApprovalRules.graphql.d.ts +18 -0
- package/api/getPurchaseOrderApprovalRules/index.d.ts +18 -0
- package/api/index.d.ts +3 -0
- package/api.js +11 -135
- package/api.js.map +1 -1
- package/chunks/FormLoader.js +4 -0
- package/chunks/FormLoader.js.map +1 -0
- package/chunks/FormLoader2.js +4 -0
- package/chunks/FormLoader2.js.map +1 -0
- package/chunks/PurchaseOrdersHeader.js +4 -0
- package/chunks/PurchaseOrdersHeader.js.map +1 -0
- package/chunks/PurchaseOrdersTableActions.js +1 -1
- package/chunks/PurchaseOrdersTableActions.js.map +1 -1
- package/chunks/case-converter.js +4 -0
- package/chunks/case-converter.js.map +1 -0
- package/chunks/currencyInfo.js +124 -0
- package/chunks/currencyInfo.js.map +1 -0
- package/chunks/fetch-error.js +4 -0
- package/chunks/fetch-error.js.map +1 -0
- package/chunks/fetch-graphql.js +4 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/getPurchaseOrderApprovalRule.js +45 -0
- package/chunks/getPurchaseOrderApprovalRule.js.map +1 -0
- package/chunks/getPurchaseOrderApprovalRules.js +75 -0
- package/chunks/getPurchaseOrderApprovalRules.js.map +1 -0
- package/chunks/getPurchaseOrders.js +5 -5
- package/chunks/getPurchaseOrders.js.map +1 -1
- package/chunks/pageSize.config.js +4 -0
- package/chunks/pageSize.config.js.map +1 -0
- package/chunks/transform-purchase-order-approval-rule.js +4 -0
- package/chunks/transform-purchase-order-approval-rule.js.map +1 -0
- package/chunks/useCustomerRolePermissions.js +1 -1
- package/chunks/useCustomerRolePermissions.js.map +1 -1
- package/chunks/usePurchaseOrders.js +4 -0
- package/chunks/usePurchaseOrders.js.map +1 -0
- package/components/ApprovalRuleDetailsContent/ApprovalRuleDetailsContent.d.ts +5 -0
- package/components/ApprovalRuleDetailsContent/index.d.ts +11 -0
- package/components/ApprovalRuleForm/ApprovalRuleForm.d.ts +5 -0
- package/components/ApprovalRuleForm/blocks/ErrorMessage.d.ts +9 -0
- package/components/ApprovalRuleForm/blocks/Form.d.ts +40 -0
- package/components/ApprovalRuleForm/blocks/index.d.ts +19 -0
- package/components/ApprovalRuleForm/index.d.ts +11 -0
- package/components/FormLoader/FormLoader.d.ts +8 -0
- package/components/FormLoader/index.d.ts +19 -0
- package/components/index.d.ts +3 -0
- package/configs/approvalRuleForm.config.d.ts +74 -0
- package/configs/index.d.ts +2 -0
- package/containers/ApprovalRuleDetails/ApprovalRuleDetails.d.ts +5 -0
- package/containers/ApprovalRuleDetails/index.d.ts +11 -0
- package/containers/ApprovalRuleDetails.d.ts +3 -0
- package/containers/ApprovalRuleDetails.js +4 -0
- package/containers/ApprovalRuleDetails.js.map +1 -0
- package/containers/ApprovalRuleForm/ApprovalRuleForm.d.ts +5 -0
- package/containers/ApprovalRuleForm/index.d.ts +11 -0
- package/containers/ApprovalRuleForm.d.ts +3 -0
- package/containers/ApprovalRuleForm.js +4 -0
- package/containers/ApprovalRuleForm.js.map +1 -0
- package/containers/ApprovalRulesList/ApprovalRulesList.d.ts +5 -0
- package/containers/ApprovalRulesList/index.d.ts +19 -0
- package/containers/ApprovalRulesList.d.ts +3 -0
- package/containers/ApprovalRulesList.js +4 -0
- package/containers/ApprovalRulesList.js.map +1 -0
- package/containers/CompanyPurchaseOrders.js +1 -1
- package/containers/CompanyPurchaseOrders.js.map +1 -1
- package/containers/CustomerPurchaseOrders.js +1 -1
- package/containers/CustomerPurchaseOrders.js.map +1 -1
- package/containers/PurchaseOrderConfirmation.js +1 -1
- package/containers/PurchaseOrderConfirmation.js.map +1 -1
- package/containers/RequireApprovalPurchaseOrders.js +1 -1
- package/containers/RequireApprovalPurchaseOrders.js.map +1 -1
- package/containers/index.d.ts +3 -0
- package/data/models/purchase-order-approval-rule-model.d.ts +5 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/useApprovalRuleDetails.d.ts +14 -0
- package/hooks/useApprovalRuleForm.d.ts +4 -0
- package/hooks/useApprovalRulesList.d.ts +4 -0
- package/i18n/en_US.json.d.ts +91 -1
- package/lib/cleanAndDeep.d.ts +8 -0
- package/lib/formValidation.d.ts +22 -0
- package/lib/index.d.ts +4 -0
- package/lib/transformToFormValues.d.ts +9 -0
- package/lib/updateFormFieldValue.d.ts +4 -0
- package/mocks/index.d.ts +191 -0
- package/mocks/storybook/events-data.d.ts +12 -0
- package/mocks/storybook/index.d.ts +3 -0
- package/package.json +1 -1
- package/render.js +3 -2
- package/render.js.map +1 -1
- package/types/components/approvalRuleDetailsContentProps.types.d.ts +9 -0
- package/types/components/approvalRuleForm.types.d.ts +12 -0
- package/types/components/index.d.ts +2 -0
- package/types/components/purchaseOrdersTable.types.d.ts +6 -1
- package/types/containers/approvalRuleDetailsProps.types.d.ts +8 -0
- package/types/containers/approvalRuleForm.types.d.ts +12 -0
- package/types/containers/approvalRulesList.types.d.ts +15 -0
- package/types/containers/index.d.ts +3 -0
- package/types/hooks/index.d.ts +3 -0
- package/types/hooks/useApprovalRuleDetails.types.d.ts +5 -0
- package/types/hooks/useApprovalRuleForm.types.d.ts +121 -0
- package/types/hooks/useApprovalRulesList.types.d.ts +29 -0
|
@@ -0,0 +1,24 @@
|
|
|
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 currencyInfo: () => Promise<{
|
|
18
|
+
baseCurrencyCode: string;
|
|
19
|
+
availableCurrencyCodes: {
|
|
20
|
+
text: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}[];
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=currencyInfo.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 GET_CURRENCY_INFO = "\n query GET_CURRENCY_INFO {\n currency {\n base_currency_code\n available_currency_codes\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=currencyInfo.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 './currencyInfo';
|
|
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 GET_PURCHASE_ORDER_APPROVAL_RULE = "\n query GET_PURCHASE_ORDER_APPROVAL_RULE($uid: ID!) {\n customer {\n purchase_order_approval_rule(uid: $uid) {\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 }\n approver_roles {\n id\n name\n users_count\n }\n condition {\n attribute\n operator\n ... on PurchaseOrderApprovalRuleConditionAmount {\n attribute\n operator\n amount {\n currency\n value\n }\n }\n ... on PurchaseOrderApprovalRuleConditionQuantity {\n attribute\n operator\n quantity\n }\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=getPurchaseOrderApprovalRule.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 './getPurchaseOrderApprovalRule';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PurchaseOrderApprovalRuleModel } from '../../data/models';
|
|
2
|
+
|
|
3
|
+
export declare const getPurchaseOrderApprovalRules: (currentPage?: number, pageSize?: number) => Promise<{
|
|
4
|
+
totalCount: number;
|
|
5
|
+
pageInfo: {
|
|
6
|
+
currentPage: number;
|
|
7
|
+
pageSize: number;
|
|
8
|
+
totalPages: number;
|
|
9
|
+
};
|
|
10
|
+
items: PurchaseOrderApprovalRuleModel[];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=getPurchaseOrderApprovalRules.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 GET_PURCHASE_ORDER_APPROVAL_RULES = "\n query GET_PURCHASE_ORDER_APPROVAL_RULES($currentPage: Int!, $pageSize: Int!) {\n customer {\n email\n purchase_order_approval_rules(\n currentPage: $currentPage\n pageSize: $pageSize\n ) {\n items {\n applies_to_roles {\n id\n name\n users_count\n permissions {\n id\n sort_order\n text\n children {\n id\n sort_order\n text\n }\n }\n }\n approver_roles {\n id\n name\n users_count\n permissions {\n id\n sort_order\n text\n children {\n id\n sort_order\n text\n }\n }\n }\n condition {\n attribute\n operator\n }\n created_at\n created_by\n description\n name\n status\n uid\n updated_at\n }\n total_count\n page_info {\n page_size\n current_page\n total_pages\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=getPurchaseOrderApprovalRules.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 './getPurchaseOrderApprovalRules';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -30,4 +30,7 @@ export * from './getPurchaseOrders';
|
|
|
30
30
|
export * from './placeOrderForPurchaseOrder';
|
|
31
31
|
export * from './placePurchaseOrder';
|
|
32
32
|
export * from './getPurchaseOrderApprovalRuleMetadata';
|
|
33
|
+
export * from './currencyInfo';
|
|
34
|
+
export * from './getPurchaseOrderApprovalRule';
|
|
35
|
+
export * from './getPurchaseOrderApprovalRules';
|
|
33
36
|
//# sourceMappingURL=index.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{Initializer as
|
|
3
|
+
import{Initializer as y}from"@dropins/tools/lib.js";import{f as P,h as A}from"./chunks/fetch-graphql.js";import{g as sr,r as ur,s as ir,a as nr,b as lr}from"./chunks/fetch-graphql.js";import{P as C,t as D}from"./chunks/getPurchaseOrders.js";import{a as pr,g as _r,r as cr}from"./chunks/getPurchaseOrders.js";import{h as a}from"./chunks/fetch-error.js";import{a as tr,c as Or,g as fr,u as Er}from"./chunks/currencyInfo.js";import{d as Rr,g as Pr}from"./chunks/getPurchaseOrderApprovalRules.js";import{g as ar}from"./chunks/getPurchaseOrderApprovalRule.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";import"./chunks/case-converter.js";import"./chunks/transform-purchase-order-approval-rule.js";const v=new y({init:async e=>{const n={};v.config.setConfig({...n,...e})},listeners:()=>[]}),k=v.config,T=`
|
|
4
4
|
mutation CANCEL_PURCHASE_ORDERS($input: PurchaseOrdersActionInput!) {
|
|
5
5
|
cancelPurchaseOrders(input: $input) {
|
|
6
6
|
purchase_orders {
|
|
@@ -12,8 +12,8 @@ import{Initializer as U}from"@dropins/tools/lib.js";import{P as D,f as a,h as p,
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
${
|
|
16
|
-
`,
|
|
15
|
+
${C}
|
|
16
|
+
`,J=async e=>{const n=Array.isArray(e)?e:[e];if(!n||n.length===0)throw new Error("Purchase Order UID(s) are required");if(n.some(s=>!s||s.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return P(T,{variables:{input:{purchase_order_uids:n}}}).then(s=>{var l,o,_;(l=s.errors)!=null&&l.length&&a(s.errors);const i=(o=s.data)==null?void 0:o.cancelPurchaseOrders;if(!i)throw new Error("Failed to cancel purchase orders");return{errors:((i==null?void 0:i.errors)??[]).map(c=>({message:(c==null?void 0:c.message)??"",type:(c==null?void 0:c.type)??""})),purchaseOrders:((_=i==null?void 0:i.purchase_orders)==null?void 0:_.map(c=>D(c)))??[]}}).catch(A)},U=`
|
|
17
17
|
mutation VALIDATE_PURCHASE_ORDERS($input: ValidatePurchaseOrdersInput!) {
|
|
18
18
|
validatePurchaseOrders(input: $input) {
|
|
19
19
|
errors {
|
|
@@ -25,8 +25,8 @@ import{Initializer as U}from"@dropins/tools/lib.js";import{P as D,f as a,h as p,
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
${
|
|
29
|
-
`,
|
|
28
|
+
${C}
|
|
29
|
+
`,K=async e=>{const n=Array.isArray(e)?e:[e];if(!n||n.length===0)throw new Error("Purchase Order UID(s) are required");if(n.some(s=>!s||s.trim()===""))throw new Error("All Purchase Order UIDs must be valid");return P(U,{variables:{input:{purchase_order_uids:n}}}).then(s=>{var l,o;(l=s.errors)!=null&&l.length&&a(s.errors);const i=(o=s.data)==null?void 0:o.validatePurchaseOrders;return{errors:((i==null?void 0:i.errors)??[]).map(_=>({message:(_==null?void 0:_.message)??"",type:(_==null?void 0:_.type)??""})),purchaseOrders:((i==null?void 0:i.purchase_orders)||[]).map(D)}}).catch(A)},q=`
|
|
30
30
|
mutation ADD_PURCHASE_ORDER_COMMENT(
|
|
31
31
|
$purchaseOrderUid: ID!
|
|
32
32
|
$comment: String!
|
|
@@ -58,7 +58,7 @@ import{Initializer as U}from"@dropins/tools/lib.js";import{P as D,f as a,h as p,
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
`,$=e=>{var u,s,i,l,o,_,c,t,O,f,E,g,R,h,b;const n=((s=(u=e==null?void 0:e.cart)==null?void 0:u.itemsV2)==null?void 0:s.items)??[];return{cart:{id:((i=e==null?void 0:e.cart)==null?void 0:i.id)??"",items:n.map(p=>{var r,S,w;return{uid:(p==null?void 0:p.uid)??"",quantity:(p==null?void 0:p.quantity)??0,product:{uid:((r=p==null?void 0:p.product)==null?void 0:r.uid)??"",name:((S=p==null?void 0:p.product)==null?void 0:S.name)??"",sku:((w=p==null?void 0:p.product)==null?void 0:w.sku)??""}}}),pagination:{currentPage:((_=(o=(l=e==null?void 0:e.cart)==null?void 0:l.itemsV2)==null?void 0:o.page_info)==null?void 0:_.current_page)??1,pageSize:((O=(t=(c=e==null?void 0:e.cart)==null?void 0:c.itemsV2)==null?void 0:t.page_info)==null?void 0:O.page_size)??20,totalPages:((g=(E=(f=e==null?void 0:e.cart)==null?void 0:f.itemsV2)==null?void 0:E.page_info)==null?void 0:g.total_pages)??0,totalCount:((h=(R=e==null?void 0:e.cart)==null?void 0:R.itemsV2)==null?void 0:h.total_count)??0}},userErrors:((b=e==null?void 0:e.user_errors)==null?void 0:b.map(p=>({message:(p==null?void 0:p.message)??""})))??[]}},x=e=>{var b,p;const n=(p=(b=e.data)==null?void 0:b.placeOrderForPurchaseOrder)==null?void 0:p.order,u=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)||""}),i=r=>({code:(r==null?void 0:r.code)||"",appliedBalance:u(r==null?void 0:r.applied_balance),currentBalance:u(r==null?void 0:r.current_balance)}),l=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)||""}),o=r=>({name:(r==null?void 0:r.name)||"",type:(r==null?void 0:r.type)||"",additionalData:(r==null?void 0:r.additional_data)||{}}),_=r=>({id:(r==null?void 0:r.id)||"",productName:(r==null?void 0:r.product_name)||"",productSku:(r==null?void 0:r.product_sku)||"",quantityOrdered:(r==null?void 0:r.quantity_ordered)||0,quantityShipped:(r==null?void 0:r.quantity_shipped)||0,quantityInvoiced:(r==null?void 0:r.quantity_invoiced)||0,quantityRefunded:(r==null?void 0:r.quantity_refunded)||0,price:u(r==null?void 0:r.price),total:u(r==null?void 0:r.total)}),c=r=>({number:(r==null?void 0:r.number)||"",carrier:(r==null?void 0:r.carrier)||"",title:(r==null?void 0:r.title)||""}),t=r=>({message:(r==null?void 0:r.message)||"",timestamp:(r==null?void 0:r.timestamp)||""}),O=r=>({id:(r==null?void 0:r.id)||"",productName:(r==null?void 0:r.product_name)||"",productSku:(r==null?void 0:r.product_sku)||"",quantityShipped:(r==null?void 0:r.quantity_shipped)||0}),f=r=>({id:(r==null?void 0:r.id)||"",number:(r==null?void 0:r.number)||"",tracking:((r==null?void 0:r.tracking)||[]).map(c),comments:((r==null?void 0:r.comments)||[]).map(t),items:((r==null?void 0:r.items)||[]).map(O)}),E=r=>({firstname:(r==null?void 0:r.firstname)||"",lastname:(r==null?void 0:r.lastname)||"",email:(r==null?void 0:r.email)||""}),g=r=>({label:(r==null?void 0:r.label)||"",amount:u(r==null?void 0:r.amount)}),R=r=>({baseGrandTotal:u(r==null?void 0:r.base_grand_total),grandTotal:u(r==null?void 0:r.grand_total),subtotal:u(r==null?void 0:r.subtotal),totalTax:u(r==null?void 0:r.total_tax),totalShipping:u(r==null?void 0:r.total_shipping),discounts:((r==null?void 0:r.discounts)||[]).map(g)}),h=r=>({appliedCoupons:((r==null?void 0:r.applied_coupons)||[]).map(s),appliedGiftCards:((r==null?void 0:r.applied_gift_cards)||[]).map(i),availableActions:(r==null?void 0:r.available_actions)||[],billingAddress:r!=null&&r.billing_address?l(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(_),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(o),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(f),shippingAddress:r!=null&&r.shipping_address?l(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:u(null),grandTotal:u(null),subtotal:u(null),totalTax:u(null),totalShipping:u(null),discounts:[]}});return h(n||null)},I=e=>{var n,u,s,i,l,o,_,c,t,O,f,E,g,R,h;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:((n=e==null?void 0:e.author)==null?void 0:n.allow_remote_shopping_assistance)??!1,confirmationStatus:((u=e==null?void 0:e.author)==null?void 0:u.confirmation_status)??"",createdAt:((s=e==null?void 0:e.author)==null?void 0:s.created_at)??"",dateOfBirth:((i=e==null?void 0:e.author)==null?void 0:i.date_of_birth)??"",email:((l=e==null?void 0:e.author)==null?void 0:l.email)??"",firstname:((o=e==null?void 0:e.author)==null?void 0:o.firstname)??"",gender:((_=e==null?void 0:e.author)==null?void 0:_.gender)??0,jobTitle:((c=e==null?void 0:e.author)==null?void 0:c.job_title)??"",lastname:((t=e==null?void 0:e.author)==null?void 0:t.lastname)??"",middlename:((O=e==null?void 0:e.author)==null?void 0:O.middlename)??"",prefix:((f=e==null?void 0:e.author)==null?void 0:f.prefix)??"",status:((E=e==null?void 0:e.author)==null?void 0:E.status)??"",structureId:((g=e==null?void 0:e.author)==null?void 0:g.structure_id)??"",suffix:((R=e==null?void 0:e.author)==null?void 0:R.suffix)??"",telephone:((h=e==null?void 0:e.author)==null?void 0:h.telephone)??""}}},X=async(e,n)=>{if(!e)throw new Error("Purchase Order ID is required");if(!n)throw new Error("Comment text is required");return P(q,{variables:{purchaseOrderUid:e,comment:n}}).then(s=>{var i,l,o;return(i=s.errors)!=null&&i.length&&a(s.errors),I((o=(l=s.data)==null?void 0:l.addPurchaseOrderComment)==null?void 0:o.comment)}).catch(A)},H=`
|
|
62
62
|
mutation ADD_PURCHASE_ORDER_ITEMS_TO_CART(
|
|
63
63
|
$purchaseOrderUid: ID!
|
|
64
64
|
$cartId: String!
|
|
@@ -93,94 +93,7 @@ import{Initializer as U}from"@dropins/tools/lib.js";import{P as D,f as a,h as p,
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
`,
|
|
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
|
-
`,m=async e=>{if(!e.name||e.name.trim()==="")throw new Error("Rule name is required");return a(F,{variables:{input:e}}).then(u=>{var s,t;if((s=u.errors)!=null&&s.length&&p(u.errors),!((t=u.data)==null?void 0:t.createPurchaseOrderApprovalRule))throw new Error("Failed to create purchase order approval rule");return w(u.data.createPurchaseOrderApprovalRule)}).catch(E)},M=`
|
|
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
|
-
`,rr=async e=>{const u=Array.isArray(e)?e:[e];if(!u||u.length===0)throw new Error("Approval Rule UID(s) are required");if(u.some(s=>!s||s.trim()===""))throw new Error("All Approval Rule UIDs must be valid");return a(M,{variables:{input:{approval_rule_uids:u}}}).then(s=>{var c,h,_;if((c=s.errors)!=null&&c.length&&p(s.errors),!((h=s.data)==null?void 0:h.deletePurchaseOrderApprovalRule))throw new Error("Failed to delete purchase order approval rule");const n=(_=s==null?void 0:s.data)==null?void 0:_.deletePurchaseOrderApprovalRule;return{deletePurchaseOrderApprovalRule:{errors:((n==null?void 0:n.errors)??[]).map(l=>({message:l==null?void 0:l.message,type:l==null?void 0:l.type}))}}}).catch(E)},V=`
|
|
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
|
-
`,er=async e=>{if(!e.uid||e.uid.trim()==="")throw new Error("Approval Rule UID is required");return a(V,{variables:{input:e}}).then(u=>{var i,s;return(i=u.errors)!=null&&i.length&&p(u.errors),w(((s=u.data)==null?void 0:s.updatePurchaseOrderApprovalRule)||{})}).catch(E)},G=`
|
|
96
|
+
`,Y=async(e,n,u=!1)=>{if(!e)throw new Error("Purchase Order UID is required");if(!n)throw new Error("Cart ID is required");return P(H,{variables:{purchaseOrderUid:e,cartId:n,replaceExistingCartItems:u}}).then(i=>{var o,_;(o=i.errors)!=null&&o.length&&a(i.errors);const l=(_=i.data)==null?void 0:_.addPurchaseOrderItemsToCart;if(!(l!=null&&l.cart))throw new Error("Failed to add purchase order items to cart");return $(l)}).catch(A)},F=`
|
|
184
97
|
query GET_PURCHASE_ORDER($uid: ID!) {
|
|
185
98
|
customer {
|
|
186
99
|
purchase_order(uid: $uid) {
|
|
@@ -216,7 +129,7 @@ import{Initializer as U}from"@dropins/tools/lib.js";import{P as D,f as a,h as p,
|
|
|
216
129
|
}
|
|
217
130
|
}
|
|
218
131
|
}
|
|
219
|
-
`,
|
|
132
|
+
`,Z=async e=>{if(!e||e.trim()==="")throw new Error("Purchase Order UID is required");return P(F,{variables:{uid:e}}).then(n=>{var s,i,l;(s=n.errors)!=null&&s.length&&a(n.errors);const u=(l=(i=n.data)==null?void 0:i.customer)==null?void 0:l.purchase_order;if(!u)throw new Error("Failed to get purchase order");return{purchaseOrder:D(u)}}).catch(A)},M=`
|
|
220
133
|
mutation PLACE_ORDER_FOR_PURCHASE_ORDER(
|
|
221
134
|
$input: PlaceOrderForPurchaseOrderInput!
|
|
222
135
|
) {
|
|
@@ -238,7 +151,7 @@ import{Initializer as U}from"@dropins/tools/lib.js";import{P as D,f as a,h as p,
|
|
|
238
151
|
}
|
|
239
152
|
}
|
|
240
153
|
}
|
|
241
|
-
`,
|
|
154
|
+
`,d=async e=>{var u;if(!e||e.trim()==="")throw new Error("Purchase Order UID is required");const n={purchase_order_uid:e};try{const s=await P(M,{variables:{input:n}});return(u=s.errors)!=null&&u.length&&a(s.errors),x(s)}catch(s){throw A(s)}},G=`
|
|
242
155
|
mutation PLACE_PURCHASE_ORDER($input: PlacePurchaseOrderInput!) {
|
|
243
156
|
placePurchaseOrder(input: $input) {
|
|
244
157
|
purchase_order {
|
|
@@ -246,43 +159,6 @@ import{Initializer as U}from"@dropins/tools/lib.js";import{P as D,f as a,h as p,
|
|
|
246
159
|
}
|
|
247
160
|
}
|
|
248
161
|
}
|
|
249
|
-
${
|
|
250
|
-
`,
|
|
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
|
-
`,ir=async()=>a(B,{variables:{}}).then(e=>{var u;return(u=e.errors)!=null&&u.length&&p(e.errors),I(e)}).catch(E);export{Y as addPurchaseOrderComment,Z as addPurchaseOrderItemsToCart,cr as approvePurchaseOrders,K as cancelPurchaseOrders,J as config,m as createPurchaseOrderApprovalRule,rr as deletePurchaseOrderApprovalRule,a as fetchGraphQl,hr as getConfig,sr as getPurchaseOrder,ir as getPurchaseOrderApprovalRuleMetadata,or as getPurchaseOrders,S as initialize,ur as placeOrderForPurchaseOrder,tr as placePurchaseOrder,lr as rejectPurchaseOrders,ar as removeFetchGraphQlHeader,pr as setEndpoint,Er as setFetchGraphQlHeader,Ar as setFetchGraphQlHeaders,er as updatePurchaseOrderApprovalRule,X as validatePurchaseOrders};
|
|
162
|
+
${C}
|
|
163
|
+
`,m=async e=>{if(!e||e.trim()==="")throw new Error("Cart ID is required");return P(G,{variables:{input:{cart_id:e}}}).then(u=>{var i,l,o;(i=u.errors)!=null&&i.length&&a(u.errors);const s=(o=(l=u.data)==null?void 0:l.placePurchaseOrder)==null?void 0:o.purchase_order;return{purchaseOrder:D(s)}}).catch(A)};export{X as addPurchaseOrderComment,Y as addPurchaseOrderItemsToCart,pr as approvePurchaseOrders,J as cancelPurchaseOrders,k as config,tr as createPurchaseOrderApprovalRule,Or as currencyInfo,Rr as deletePurchaseOrderApprovalRule,P as fetchGraphQl,sr as getConfig,Z as getPurchaseOrder,ar as getPurchaseOrderApprovalRule,fr as getPurchaseOrderApprovalRuleMetadata,Pr as getPurchaseOrderApprovalRules,_r as getPurchaseOrders,v as initialize,d as placeOrderForPurchaseOrder,m as placePurchaseOrder,cr as rejectPurchaseOrders,ur as removeFetchGraphQlHeader,ir as setEndpoint,nr as setFetchGraphQlHeader,lr as setFetchGraphQlHeaders,Er as updatePurchaseOrderApprovalRule,K as validatePurchaseOrders};
|
|
288
164
|
//# sourceMappingURL=api.js.map
|