@dropins/storefront-purchase-order 0.0.4-alpha1 → 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/{containers/PurchaseOrderApprovalRulesList → api/currencyInfo}/index.d.ts +1 -2
- 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/index.d.ts +2 -0
- package/api.js +11 -124
- 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 +1 -1
- package/chunks/fetch-graphql.js.map +1 -1
- package/chunks/getPurchaseOrderApprovalRule.js +45 -0
- package/chunks/getPurchaseOrderApprovalRule.js.map +1 -0
- package/chunks/getPurchaseOrderApprovalRules.js +3 -3
- package/chunks/getPurchaseOrderApprovalRules.js.map +1 -1
- package/chunks/getPurchaseOrders.js +8 -8
- 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 +1 -1
- package/chunks/usePurchaseOrders.js.map +1 -1
- 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 -1
- package/data/models/purchase-order-approval-rule-model.d.ts +5 -0
- package/hooks/index.d.ts +2 -0
- package/hooks/useApprovalRuleDetails.d.ts +14 -0
- package/hooks/useApprovalRuleForm.d.ts +4 -0
- package/i18n/en_US.json.d.ts +84 -0
- 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 +67 -0
- package/mocks/storybook/events-data.d.ts +12 -0
- package/mocks/storybook/index.d.ts +2 -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/containers/approvalRuleDetailsProps.types.d.ts +8 -0
- package/types/containers/approvalRuleForm.types.d.ts +12 -0
- package/types/containers/{purchaseOrderApprovalRulesList.types.d.ts → approvalRulesList.types.d.ts} +2 -2
- package/types/containers/index.d.ts +3 -1
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/useApprovalRuleDetails.types.d.ts +5 -0
- package/types/hooks/useApprovalRuleForm.types.d.ts +121 -0
- package/containers/PurchaseOrderApprovalRulesList/PurchaseOrderApprovalRulesList.d.ts +0 -5
- package/containers/PurchaseOrderApprovalRulesList.d.ts +0 -3
- package/containers/PurchaseOrderApprovalRulesList.js +0 -4
- package/containers/PurchaseOrderApprovalRulesList.js.map +0 -1
|
@@ -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
|
|
@@ -14,6 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export * from './
|
|
18
|
-
export { PurchaseOrderApprovalRulesList as default } from './PurchaseOrderApprovalRulesList';
|
|
17
|
+
export * from './currencyInfo';
|
|
19
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
|
package/api/index.d.ts
CHANGED
|
@@ -30,5 +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';
|
|
33
35
|
export * from './getPurchaseOrderApprovalRules';
|
|
34
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 y}from"@dropins/tools/lib.js";import{f 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 y}from"@dropins/tools/lib.js";import{f as a,h,a as R}from"
|
|
|
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 y}from"@dropins/tools/lib.js";import{f as a,h,a as R}from"
|
|
|
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 y}from"@dropins/tools/lib.js";import{f as a,h,a as R}from"
|
|
|
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,83 +93,7 @@ import{Initializer as y}from"@dropins/tools/lib.js";import{f as a,h,a as R}from"
|
|
|
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
|
-
`,rr=async e=>{if(!e.name||e.name.trim()==="")throw new Error("Rule name is required");return a(L,{variables:{input:e}}).then(s=>{var u,_;if((u=s.errors)!=null&&u.length&&h(s.errors),!((_=s.data)==null?void 0:_.createPurchaseOrderApprovalRule))throw new Error("Failed to create purchase order approval rule");return S(s.data.createPurchaseOrderApprovalRule)}).catch(R)},M=`
|
|
135
|
-
mutation UPDATE_PURCHASE_ORDER_APPROVAL_RULE(
|
|
136
|
-
$input: UpdatePurchaseOrderApprovalRuleInput!
|
|
137
|
-
) {
|
|
138
|
-
updatePurchaseOrderApprovalRule(input: $input) {
|
|
139
|
-
created_at
|
|
140
|
-
created_by
|
|
141
|
-
description
|
|
142
|
-
name
|
|
143
|
-
status
|
|
144
|
-
uid
|
|
145
|
-
updated_at
|
|
146
|
-
applies_to_roles {
|
|
147
|
-
id
|
|
148
|
-
name
|
|
149
|
-
users_count
|
|
150
|
-
permissions {
|
|
151
|
-
id
|
|
152
|
-
sort_order
|
|
153
|
-
text
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
condition {
|
|
157
|
-
attribute
|
|
158
|
-
operator
|
|
159
|
-
}
|
|
160
|
-
approver_roles {
|
|
161
|
-
id
|
|
162
|
-
name
|
|
163
|
-
users_count
|
|
164
|
-
permissions {
|
|
165
|
-
id
|
|
166
|
-
sort_order
|
|
167
|
-
text
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
`,er=async e=>{if(!e.uid||e.uid.trim()==="")throw new Error("Approval Rule UID is required");return a(M,{variables:{input:e}}).then(s=>{var i,u;return(i=s.errors)!=null&&i.length&&h(s.errors),S(((u=s.data)==null?void 0:u.updatePurchaseOrderApprovalRule)||{})}).catch(R)},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=`
|
|
173
97
|
query GET_PURCHASE_ORDER($uid: ID!) {
|
|
174
98
|
customer {
|
|
175
99
|
purchase_order(uid: $uid) {
|
|
@@ -205,7 +129,7 @@ import{Initializer as y}from"@dropins/tools/lib.js";import{f as a,h,a as R}from"
|
|
|
205
129
|
}
|
|
206
130
|
}
|
|
207
131
|
}
|
|
208
|
-
`,
|
|
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=`
|
|
209
133
|
mutation PLACE_ORDER_FOR_PURCHASE_ORDER(
|
|
210
134
|
$input: PlaceOrderForPurchaseOrderInput!
|
|
211
135
|
) {
|
|
@@ -227,7 +151,7 @@ import{Initializer as y}from"@dropins/tools/lib.js";import{f as a,h,a as R}from"
|
|
|
227
151
|
}
|
|
228
152
|
}
|
|
229
153
|
}
|
|
230
|
-
`,
|
|
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=`
|
|
231
155
|
mutation PLACE_PURCHASE_ORDER($input: PlacePurchaseOrderInput!) {
|
|
232
156
|
placePurchaseOrder(input: $input) {
|
|
233
157
|
purchase_order {
|
|
@@ -235,43 +159,6 @@ import{Initializer as y}from"@dropins/tools/lib.js";import{f as a,h,a as R}from"
|
|
|
235
159
|
}
|
|
236
160
|
}
|
|
237
161
|
}
|
|
238
|
-
${
|
|
239
|
-
`,
|
|
240
|
-
query GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA {
|
|
241
|
-
customer {
|
|
242
|
-
purchase_order_approval_rule_metadata {
|
|
243
|
-
available_applies_to {
|
|
244
|
-
id
|
|
245
|
-
name
|
|
246
|
-
users_count
|
|
247
|
-
permissions {
|
|
248
|
-
id
|
|
249
|
-
sort_order
|
|
250
|
-
text
|
|
251
|
-
children {
|
|
252
|
-
id
|
|
253
|
-
sort_order
|
|
254
|
-
text
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
available_requires_approval_from {
|
|
259
|
-
id
|
|
260
|
-
name
|
|
261
|
-
users_count
|
|
262
|
-
permissions {
|
|
263
|
-
id
|
|
264
|
-
sort_order
|
|
265
|
-
text
|
|
266
|
-
children {
|
|
267
|
-
id
|
|
268
|
-
sort_order
|
|
269
|
-
text
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
`,nr=async()=>a(z,{variables:{}}).then(e=>{var s;return(s=e.errors)!=null&&s.length&&h(e.errors),$(e)}).catch(R);export{Z as addPurchaseOrderComment,m as addPurchaseOrderItemsToCart,Rr as approvePurchaseOrders,X as cancelPurchaseOrders,K as config,rr as createPurchaseOrderApprovalRule,Pr as deletePurchaseOrderApprovalRule,a as fetchGraphQl,or as getConfig,sr as getPurchaseOrder,nr as getPurchaseOrderApprovalRuleMetadata,fr as getPurchaseOrderApprovalRules,Er as getPurchaseOrders,w as initialize,ur as placeOrderForPurchaseOrder,ir as placePurchaseOrder,Or as rejectPurchaseOrders,lr as removeFetchGraphQlHeader,cr as setEndpoint,pr as setFetchGraphQlHeader,ar as setFetchGraphQlHeaders,er as updatePurchaseOrderApprovalRule,Y 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};
|
|
277
164
|
//# sourceMappingURL=api.js.map
|