@dropins/storefront-purchase-order 1.1.1 → 1.2.0-beta.0
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/CHANGELOG.md +6 -0
- package/api.js +784 -6
- package/api.js.map +1 -1
- package/chunks/components.js +4 -0
- package/chunks/components.js.map +1 -0
- package/containers/ApprovalRuleDetails.js +1 -1
- package/containers/ApprovalRuleDetails.js.map +1 -1
- package/containers/ApprovalRuleForm.js +1 -1
- package/containers/ApprovalRuleForm.js.map +1 -1
- package/containers/ApprovalRulesList.js +1 -1
- package/containers/ApprovalRulesList.js.map +1 -1
- 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/PurchaseOrderApprovalFlow.js +1 -1
- package/containers/PurchaseOrderApprovalFlow.js.map +1 -1
- package/containers/PurchaseOrderCommentForm.js +1 -1
- package/containers/PurchaseOrderCommentForm.js.map +1 -1
- package/containers/PurchaseOrderCommentsList.js +1 -1
- package/containers/PurchaseOrderCommentsList.js.map +1 -1
- package/containers/PurchaseOrderConfirmation.js +1 -1
- package/containers/PurchaseOrderConfirmation.js.map +1 -1
- package/containers/PurchaseOrderHistoryLog.js +1 -1
- package/containers/PurchaseOrderHistoryLog.js.map +1 -1
- package/containers/PurchaseOrderStatus.js +1 -1
- package/containers/PurchaseOrderStatus.js.map +1 -1
- package/containers/RequireApprovalPurchaseOrders.js +1 -1
- package/containers/RequireApprovalPurchaseOrders.js.map +1 -1
- package/package.json +1 -1
- package/render.js +2 -3
- package/render.js.map +1 -1
- package/chunks/FormLoader.js +0 -4
- package/chunks/FormLoader.js.map +0 -1
- package/chunks/PurchaseOrderHistoryLogContent.js +0 -4
- package/chunks/PurchaseOrderHistoryLogContent.js.map +0 -1
- package/chunks/PurchaseOrdersHeader.js +0 -4
- package/chunks/PurchaseOrdersHeader.js.map +0 -1
- package/chunks/PurchaseOrdersTableActions.js +0 -4
- package/chunks/PurchaseOrdersTableActions.js.map +0 -1
- package/chunks/addPurchaseOrderComment.js +0 -36
- package/chunks/addPurchaseOrderComment.js.map +0 -1
- package/chunks/case-converter.js +0 -4
- package/chunks/case-converter.js.map +0 -1
- package/chunks/currencyInfo.js +0 -124
- package/chunks/currencyInfo.js.map +0 -1
- package/chunks/fetch-error.js +0 -4
- package/chunks/fetch-error.js.map +0 -1
- package/chunks/formatDate.js +0 -4
- package/chunks/formatDate.js.map +0 -1
- package/chunks/getPurchaseOrderApprovalRule.js +0 -45
- package/chunks/getPurchaseOrderApprovalRule.js.map +0 -1
- package/chunks/getPurchaseOrderApprovalRules.js +0 -75
- package/chunks/getPurchaseOrderApprovalRules.js.map +0 -1
- package/chunks/getPurchaseOrders.js +0 -29
- package/chunks/getPurchaseOrders.js.map +0 -1
- package/chunks/initialize.js +0 -13
- package/chunks/initialize.js.map +0 -1
- package/chunks/pageSize.config.js +0 -4
- package/chunks/pageSize.config.js.map +0 -1
- package/chunks/permissions.js +0 -4
- package/chunks/permissions.js.map +0 -1
- package/chunks/placeOrderForPurchaseOrder.js +0 -39
- package/chunks/placeOrderForPurchaseOrder.js.map +0 -1
- package/chunks/rejectPurchaseOrders.js +0 -30
- package/chunks/rejectPurchaseOrders.js.map +0 -1
- package/chunks/transform-purchase-order-approval-rule.js +0 -4
- package/chunks/transform-purchase-order-approval-rule.js.map +0 -1
- package/chunks/transform-purchase-order.js +0 -423
- package/chunks/transform-purchase-order.js.map +0 -1
- package/chunks/useCustomerRolePermissions.js +0 -4
- package/chunks/useCustomerRolePermissions.js.map +0 -1
- package/chunks/usePurchaseOrderData.js +0 -4
- package/chunks/usePurchaseOrderData.js.map +0 -1
- package/chunks/usePurchaseOrders.js +0 -4
- package/chunks/usePurchaseOrders.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PurchaseOrderHistoryLogContent.js","sources":["/@dropins/storefront-purchase-order/src/configs/customerPurchaseOrders.config.ts","/@dropins/storefront-purchase-order/src/configs/companyPurchaseOrders.config.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Column } from '@/b2b-purchase-order/types/components';\n\nexport const defaultColumns: Column[] = [\n { key: 'poNumber', label: 'PO #' },\n { key: 'status', label: 'Status' },\n {\n key: 'createdBy',\n label: 'Created By',\n },\n { key: 'action', label: 'Actions' },\n];\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Column } from '@/b2b-purchase-order/types/components';\nimport { defaultColumns } from '@/b2b-purchase-order/configs/customerPurchaseOrders.config';\n\nexport const defaultCompanyColumns: Column[] = [\n {\n key: 'checkboxView',\n label: '',\n },\n ...defaultColumns,\n];\n"],"names":["defaultColumns","defaultCompanyColumns"],"mappings":"AAmBO,MAAMA,EAA2B,CACtC,CAAE,IAAK,WAAY,MAAO,MAAA,EAC1B,CAAE,IAAK,SAAU,MAAO,QAAA,EACxB,CACE,IAAK,YACL,MAAO,YAAA,EAET,CAAE,IAAK,SAAU,MAAO,SAAA,CAC1B,ECPaC,EAAkC,CAC7C,CACE,IAAK,eACL,MAAO,EAAA,EAET,GAAGD,CACL"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{Header as a}from"@dropins/tools/components.js";import{classes as t}from"@dropins/tools/lib.js";import"./PurchaseOrderHistoryLogContent.js";const p=({headerText:e,divider:r=!1})=>s(a,{title:e,divider:r,className:t(["purchase-orders-header",["purchase-orders-header--with-divider",r]]),"data-testid":"purchase-orders-header"});export{p as P};
|
|
4
|
-
//# sourceMappingURL=PurchaseOrdersHeader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PurchaseOrdersHeader.js","sources":["/@dropins/storefront-purchase-order/src/components/PurchaseOrdersHeader/PurchaseOrdersHeader.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { FunctionComponent } from 'preact';\nimport '@/b2b-purchase-order/components/PurchaseOrdersHeader/PurchaseOrdersHeader.css';\n\nexport const PurchaseOrdersHeader: FunctionComponent<{\n headerText: string;\n divider?: boolean;\n}> = ({ headerText, divider = false }) => {\n return (\n <Header\n title={headerText}\n divider={divider}\n className={classes([\n 'purchase-orders-header',\n ['purchase-orders-header--with-divider', divider],\n ])}\n data-testid=\"purchase-orders-header\"\n />\n );\n};\n"],"names":["PurchaseOrdersHeader","headerText","divider","jsx","Header","classes"],"mappings":"6MAsBO,MAAMA,EAGR,CAAC,CAAE,WAAAC,EAAY,QAAAC,EAAU,MAE1BC,EAACC,EAAA,CACC,MAAOH,EACP,QAAAC,EACA,UAAWG,EAAQ,CACjB,yBACA,CAAC,uCAAwCH,CAAO,CAAA,CACjD,EACD,cAAY,wBAAA,CAAA"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{jsxs as e,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{classes as t}from"@dropins/tools/lib.js";import"./PurchaseOrderHistoryLogContent.js";import{Button as c}from"@dropins/tools/components.js";const h=({loading:s,selectedCount:r,className:i,handleRejectSelected:o,handleApproveSelected:d})=>e("div",{className:t(["b2b-purchase-order-purchase-orders-table-actions",i]),children:[e("div",{children:["Selected ",r]}),e("div",{className:"b2b-purchase-order-purchase-orders-table-actions__buttons",children:[a(c,{variant:"secondary",onClick:o,disabled:s||r===0,children:"Reject selected"}),a(c,{variant:"primary",onClick:d,disabled:s||r===0,children:"Approve selected"})]})]});export{h as P};
|
|
4
|
-
//# sourceMappingURL=PurchaseOrdersTableActions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PurchaseOrdersTableActions.js","sources":["/@dropins/storefront-purchase-order/src/components/PurchaseOrdersTableActions/PurchaseOrdersTableActions.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport '@/b2b-purchase-order/components/PurchaseOrdersTableActions/PurchaseOrdersTableActions.css';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { PurchaseOrdersTableActionsProps } from '@/b2b-purchase-order/types/components';\n\nexport const PurchaseOrdersTableActions: FunctionComponent<\n PurchaseOrdersTableActionsProps\n> = ({\n loading,\n selectedCount,\n className,\n handleRejectSelected,\n handleApproveSelected,\n}) => {\n return (\n <div\n className={classes([\n 'b2b-purchase-order-purchase-orders-table-actions',\n className,\n ])}\n >\n <div>Selected {selectedCount}</div>\n <div\n className={'b2b-purchase-order-purchase-orders-table-actions__buttons'}\n >\n <Button\n variant=\"secondary\"\n onClick={handleRejectSelected}\n disabled={loading || selectedCount === 0}\n >\n Reject selected\n </Button>\n <Button\n variant=\"primary\"\n onClick={handleApproveSelected}\n disabled={loading || selectedCount === 0}\n >\n Approve selected\n </Button>\n </div>\n </div>\n );\n};\n"],"names":["PurchaseOrdersTableActions","loading","selectedCount","className","handleRejectSelected","handleApproveSelected","jsxs","classes","jsx","Button"],"mappings":"uNAuBO,MAAMA,EAET,CAAC,CACH,QAAAC,EACA,cAAAC,EACA,UAAAC,EACA,qBAAAC,EACA,sBAAAC,CACF,IAEIC,EAAC,MAAA,CACC,UAAWC,EAAQ,CACjB,mDACAJ,CAAA,CACD,EAED,SAAA,CAAAG,EAAC,MAAA,CAAI,SAAA,CAAA,YAAUJ,CAAA,EAAc,EAC7BI,EAAC,MAAA,CACC,UAAW,4DAEX,SAAA,CAAAE,EAACC,EAAA,CACC,QAAQ,YACR,QAASL,EACT,SAAUH,GAAWC,IAAkB,EACxC,SAAA,iBAAA,CAAA,EAGDM,EAACC,EAAA,CACC,QAAQ,UACR,QAASJ,EACT,SAAUJ,GAAWC,IAAkB,EACxC,SAAA,kBAAA,CAAA,CAED,CAAA,CAAA,CACF,CAAA,CAAA"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{f as C,h as g,a as w}from"./fetch-error.js";const D=`
|
|
4
|
-
mutation ADD_PURCHASE_ORDER_COMMENT(
|
|
5
|
-
$purchaseOrderUid: ID!
|
|
6
|
-
$comment: String!
|
|
7
|
-
) {
|
|
8
|
-
addPurchaseOrderComment(
|
|
9
|
-
input: { purchase_order_uid: $purchaseOrderUid, comment: $comment }
|
|
10
|
-
) {
|
|
11
|
-
comment {
|
|
12
|
-
created_at
|
|
13
|
-
text
|
|
14
|
-
uid
|
|
15
|
-
author {
|
|
16
|
-
allow_remote_shopping_assistance
|
|
17
|
-
confirmation_status
|
|
18
|
-
created_at
|
|
19
|
-
date_of_birth
|
|
20
|
-
email
|
|
21
|
-
firstname
|
|
22
|
-
gender
|
|
23
|
-
job_title
|
|
24
|
-
lastname
|
|
25
|
-
middlename
|
|
26
|
-
prefix
|
|
27
|
-
status
|
|
28
|
-
structure_id
|
|
29
|
-
suffix
|
|
30
|
-
telephone
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
`,b=r=>{var s,h,a,i,u,d,l,_,t,f,e,p,O,x,E;return{createdAt:(r==null?void 0:r.created_at)??"",text:(r==null?void 0:r.text)??"",uid:(r==null?void 0:r.uid)??"",author:{allowRemoteShoppingAssistance:((s=r==null?void 0:r.author)==null?void 0:s.allow_remote_shopping_assistance)??!1,confirmationStatus:((h=r==null?void 0:r.author)==null?void 0:h.confirmation_status)??"",createdAt:((a=r==null?void 0:r.author)==null?void 0:a.created_at)??"",dateOfBirth:((i=r==null?void 0:r.author)==null?void 0:i.date_of_birth)??"",email:((u=r==null?void 0:r.author)==null?void 0:u.email)??"",firstname:((d=r==null?void 0:r.author)==null?void 0:d.firstname)??"",gender:((l=r==null?void 0:r.author)==null?void 0:l.gender)??0,jobTitle:((_=r==null?void 0:r.author)==null?void 0:_.job_title)??"",lastname:((t=r==null?void 0:r.author)==null?void 0:t.lastname)??"",middlename:((f=r==null?void 0:r.author)==null?void 0:f.middlename)??"",prefix:((e=r==null?void 0:r.author)==null?void 0:e.prefix)??"",status:((p=r==null?void 0:r.author)==null?void 0:p.status)??"",structureId:((O=r==null?void 0:r.author)==null?void 0:O.structure_id)??"",suffix:((x=r==null?void 0:r.author)==null?void 0:x.suffix)??"",telephone:((E=r==null?void 0:r.author)==null?void 0:E.telephone)??""}}},P=async(r,s)=>{if(!r)throw new Error("Purchase Order ID is required");if(!s)throw new Error("Comment text is required");return C(D,{variables:{purchaseOrderUid:r,comment:s}}).then(a=>{var i,u,d;return(i=a.errors)!=null&&i.length&&g(a.errors),b((d=(u=a.data)==null?void 0:u.addPurchaseOrderComment)==null?void 0:d.comment)}).catch(w)};export{P as a};
|
|
36
|
-
//# sourceMappingURL=addPurchaseOrderComment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addPurchaseOrderComment.js","sources":["/@dropins/storefront-purchase-order/src/api/addPurchaseOrderComment/graphql/addPurchaseOrderComment.graphql.ts","/@dropins/storefront-purchase-order/src/data/transforms/transform-purchase-order-comment.ts","/@dropins/storefront-purchase-order/src/api/addPurchaseOrderComment/addPurchaseOrderComment.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const ADD_PURCHASE_ORDER_COMMENT = /* GraphQL */ `\n mutation ADD_PURCHASE_ORDER_COMMENT(\n $purchaseOrderUid: ID!\n $comment: String!\n ) {\n addPurchaseOrderComment(\n input: { purchase_order_uid: $purchaseOrderUid, comment: $comment }\n ) {\n comment {\n created_at\n text\n uid\n author {\n allow_remote_shopping_assistance\n confirmation_status\n created_at\n date_of_birth\n email\n firstname\n gender\n job_title\n lastname\n middlename\n prefix\n status\n structure_id\n suffix\n telephone\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { PurchaseOrderCommentModel } from '@/b2b-purchase-order/data/models';\n\nexport const transformPurchaseOrderComment = (\n comment: any\n): PurchaseOrderCommentModel => {\n return {\n createdAt: comment?.created_at ?? '',\n text: comment?.text ?? '',\n uid: comment?.uid ?? '',\n author: {\n allowRemoteShoppingAssistance:\n comment?.author?.allow_remote_shopping_assistance ?? false,\n confirmationStatus: comment?.author?.confirmation_status ?? '',\n createdAt: comment?.author?.created_at ?? '',\n dateOfBirth: comment?.author?.date_of_birth ?? '',\n email: comment?.author?.email ?? '',\n firstname: comment?.author?.firstname ?? '',\n gender: comment?.author?.gender ?? 0,\n jobTitle: comment?.author?.job_title ?? '',\n lastname: comment?.author?.lastname ?? '',\n middlename: comment?.author?.middlename ?? '',\n prefix: comment?.author?.prefix ?? '',\n status: comment?.author?.status ?? '',\n structureId: comment?.author?.structure_id ?? '',\n suffix: comment?.author?.suffix ?? '',\n telephone: comment?.author?.telephone ?? '',\n },\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { ADD_PURCHASE_ORDER_COMMENT } from '@/b2b-purchase-order/api/addPurchaseOrderComment/graphql/addPurchaseOrderComment.graphql';\nimport { transformPurchaseOrderComment } from '@/b2b-purchase-order/data/transforms';\nimport { PurchaseOrderCommentModel } from '@/b2b-purchase-order/data/models';\n\nexport const addPurchaseOrderComment = async (\n uid: string,\n comment: string\n): Promise<PurchaseOrderCommentModel> => {\n if (!uid) {\n throw new Error('Purchase Order ID is required');\n }\n\n if (!comment) {\n throw new Error('Comment text is required');\n }\n\n const variables = {\n purchaseOrderUid: uid,\n comment,\n };\n\n return fetchGraphQl(ADD_PURCHASE_ORDER_COMMENT, {\n variables,\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n return transformPurchaseOrderComment(\n response.data?.addPurchaseOrderComment?.comment\n );\n })\n .catch(handleNetworkError);\n};\n"],"names":["ADD_PURCHASE_ORDER_COMMENT","transformPurchaseOrderComment","comment","_a","_b","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","_m","_n","_o","addPurchaseOrderComment","uid","fetchGraphQl","response","handleFetchError","handleNetworkError"],"mappings":"mDAiBO,MAAMA,EAA2C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECE3CC,EACXC,GAC8B,mCAC9B,MAAO,CACL,WAAWA,GAAA,YAAAA,EAAS,aAAc,GAClC,MAAMA,GAAA,YAAAA,EAAS,OAAQ,GACvB,KAAKA,GAAA,YAAAA,EAAS,MAAO,GACrB,OAAQ,CACN,gCACEC,EAAAD,GAAA,YAAAA,EAAS,SAAT,YAAAC,EAAiB,mCAAoC,GACvD,qBAAoBC,EAAAF,GAAA,YAAAA,EAAS,SAAT,YAAAE,EAAiB,sBAAuB,GAC5D,YAAWC,EAAAH,GAAA,YAAAA,EAAS,SAAT,YAAAG,EAAiB,aAAc,GAC1C,cAAaC,EAAAJ,GAAA,YAAAA,EAAS,SAAT,YAAAI,EAAiB,gBAAiB,GAC/C,QAAOC,EAAAL,GAAA,YAAAA,EAAS,SAAT,YAAAK,EAAiB,QAAS,GACjC,YAAWC,EAAAN,GAAA,YAAAA,EAAS,SAAT,YAAAM,EAAiB,YAAa,GACzC,SAAQC,EAAAP,GAAA,YAAAA,EAAS,SAAT,YAAAO,EAAiB,SAAU,EACnC,WAAUC,EAAAR,GAAA,YAAAA,EAAS,SAAT,YAAAQ,EAAiB,YAAa,GACxC,WAAUC,EAAAT,GAAA,YAAAA,EAAS,SAAT,YAAAS,EAAiB,WAAY,GACvC,aAAYC,EAAAV,GAAA,YAAAA,EAAS,SAAT,YAAAU,EAAiB,aAAc,GAC3C,SAAQC,EAAAX,GAAA,YAAAA,EAAS,SAAT,YAAAW,EAAiB,SAAU,GACnC,SAAQC,EAAAZ,GAAA,YAAAA,EAAS,SAAT,YAAAY,EAAiB,SAAU,GACnC,cAAaC,EAAAb,GAAA,YAAAA,EAAS,SAAT,YAAAa,EAAiB,eAAgB,GAC9C,SAAQC,EAAAd,GAAA,YAAAA,EAAS,SAAT,YAAAc,EAAiB,SAAU,GACnC,YAAWC,EAAAf,GAAA,YAAAA,EAAS,SAAT,YAAAe,EAAiB,YAAa,EAAA,CAC3C,CAEJ,ECrBaC,EAA0B,MACrCC,EACAjB,IACuC,CACvC,GAAI,CAACiB,EACH,MAAM,IAAI,MAAM,+BAA+B,EAGjD,GAAI,CAACjB,EACH,MAAM,IAAI,MAAM,0BAA0B,EAQ5C,OAAOkB,EAAapB,EAA4B,CAC9C,UANgB,CAChB,iBAAkBmB,EAClB,QAAAjB,CAAA,CAIA,CACD,EACE,KAAMmB,GAAkB,WACvB,OAAIlB,EAAAkB,EAAS,SAAT,MAAAlB,EAAiB,QACnBmB,EAAiBD,EAAS,MAAM,EAG3BpB,GACLI,GAAAD,EAAAiB,EAAS,OAAT,YAAAjB,EAAe,0BAAf,YAAAC,EAAwC,OAAA,CAE5C,CAAC,EACA,MAAMkB,CAAkB,CAC7B"}
|
package/chunks/case-converter.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
const t=e=>{if(e==null||typeof e!="object")return e;if(Array.isArray(e))return e.map(t);const r={};for(const[n,s]of Object.entries(e)){const a=n.replace(/[A-Z]/g,c=>`_${c.toLowerCase()}`);r[a]=t(s)}return r};export{t};
|
|
4
|
-
//# sourceMappingURL=case-converter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"case-converter.js","sources":["/@dropins/storefront-purchase-order/src/lib/case-converter.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Converts camelCase object keys to snake_case recursively\n */\nexport const toSnakeCase = (obj: any): any => {\n if (obj === null || obj === undefined || typeof obj !== 'object') {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(toSnakeCase);\n }\n\n const result: any = {};\n for (const [key, value] of Object.entries(obj)) {\n const snakeKey = key.replace(\n /[A-Z]/g,\n (letter) => `_${letter.toLowerCase()}`\n );\n result[snakeKey] = toSnakeCase(value);\n }\n return result;\n};\n\n/**\n * Converts snake_case object keys to camelCase recursively\n */\nexport const toCamelCase = (obj: any): any => {\n if (obj === null || obj === undefined || typeof obj !== 'object') {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(toCamelCase);\n }\n\n const result: any = {};\n for (const [key, value] of Object.entries(obj)) {\n const camelKey = key.replace(/_([a-z])/g, (_, letter) =>\n letter.toUpperCase()\n );\n result[camelKey] = toCamelCase(value);\n }\n return result;\n};\n"],"names":["toSnakeCase","obj","result","key","value","snakeKey","letter"],"mappings":"AAoBO,MAAMA,EAAeC,GAAkB,CAC5C,GAAIA,GAAQ,MAA6B,OAAOA,GAAQ,SACtD,OAAOA,EAGT,GAAI,MAAM,QAAQA,CAAG,EACnB,OAAOA,EAAI,IAAID,CAAW,EAG5B,MAAME,EAAc,CAAA,EACpB,SAAW,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQH,CAAG,EAAG,CAC9C,MAAMI,EAAWF,EAAI,QACnB,SACCG,GAAW,IAAIA,EAAO,aAAa,EAAA,EAEtCJ,EAAOG,CAAQ,EAAIL,EAAYI,CAAK,CACtC,CACA,OAAOF,CACT"}
|
package/chunks/currencyInfo.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{f as n,h as l,a as i}from"./fetch-error.js";import{t as R}from"./transform-purchase-order-approval-rule.js";const p=a=>{var d,_;const t=(_=(d=a==null?void 0:a.data)==null?void 0:d.customer)==null?void 0:_.purchase_order_approval_rule_metadata,u=r=>{var s;return{id:(r==null?void 0:r.id)||"",sortOrder:(r==null?void 0:r.sort_order)||0,text:(r==null?void 0:r.text)||"",children:((s=r==null?void 0:r.children)==null?void 0:s.map(u))||void 0}},e=r=>({id:(r==null?void 0:r.id)||"",name:(r==null?void 0:r.name)||"",usersCount:(r==null?void 0:r.users_count)||0,permissions:((r==null?void 0:r.permissions)||[]).map(u)}),c=((t==null?void 0:t.available_applies_to)||[]).map(e),o=((t==null?void 0:t.available_requires_approval_from)||[]).map(e);return{availableAppliesTo:c,availableRequiresApprovalFrom:o}},A=`
|
|
4
|
-
mutation CREATE_PURCHASE_ORDER_APPROVAL_RULE(
|
|
5
|
-
$input: PurchaseOrderApprovalRuleInput!
|
|
6
|
-
) {
|
|
7
|
-
createPurchaseOrderApprovalRule(input: $input) {
|
|
8
|
-
created_at
|
|
9
|
-
created_by
|
|
10
|
-
description
|
|
11
|
-
name
|
|
12
|
-
status
|
|
13
|
-
uid
|
|
14
|
-
updated_at
|
|
15
|
-
applies_to_roles {
|
|
16
|
-
id
|
|
17
|
-
name
|
|
18
|
-
users_count
|
|
19
|
-
permissions {
|
|
20
|
-
id
|
|
21
|
-
sort_order
|
|
22
|
-
text
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
condition {
|
|
26
|
-
attribute
|
|
27
|
-
operator
|
|
28
|
-
}
|
|
29
|
-
approver_roles {
|
|
30
|
-
id
|
|
31
|
-
name
|
|
32
|
-
users_count
|
|
33
|
-
permissions {
|
|
34
|
-
id
|
|
35
|
-
sort_order
|
|
36
|
-
text
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`,m=async a=>{if(!a.name||a.name.trim()==="")throw new Error("Rule name is required");return n(A,{variables:{input:a}}).then(t=>{var e,c;if((e=t.errors)!=null&&e.length&&l(t.errors),!((c=t.data)==null?void 0:c.createPurchaseOrderApprovalRule))throw new Error("Failed to create purchase order approval rule");return R(t.data.createPurchaseOrderApprovalRule)}).catch(i)},h=`
|
|
42
|
-
mutation UPDATE_PURCHASE_ORDER_APPROVAL_RULE(
|
|
43
|
-
$input: UpdatePurchaseOrderApprovalRuleInput!
|
|
44
|
-
) {
|
|
45
|
-
updatePurchaseOrderApprovalRule(input: $input) {
|
|
46
|
-
created_at
|
|
47
|
-
created_by
|
|
48
|
-
description
|
|
49
|
-
name
|
|
50
|
-
status
|
|
51
|
-
uid
|
|
52
|
-
updated_at
|
|
53
|
-
applies_to_roles {
|
|
54
|
-
id
|
|
55
|
-
name
|
|
56
|
-
users_count
|
|
57
|
-
permissions {
|
|
58
|
-
id
|
|
59
|
-
sort_order
|
|
60
|
-
text
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
condition {
|
|
64
|
-
attribute
|
|
65
|
-
operator
|
|
66
|
-
}
|
|
67
|
-
approver_roles {
|
|
68
|
-
id
|
|
69
|
-
name
|
|
70
|
-
users_count
|
|
71
|
-
permissions {
|
|
72
|
-
id
|
|
73
|
-
sort_order
|
|
74
|
-
text
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`,C=async a=>{if(!a.uid||a.uid.trim()==="")throw new Error("Approval Rule UID is required");return n(h,{variables:{input:a}}).then(t=>{var u,e;return(u=t.errors)!=null&&u.length&&l(t.errors),R(((e=t.data)==null?void 0:e.updatePurchaseOrderApprovalRule)||{})}).catch(i)},E=`
|
|
80
|
-
query GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA {
|
|
81
|
-
customer {
|
|
82
|
-
purchase_order_approval_rule_metadata {
|
|
83
|
-
available_applies_to {
|
|
84
|
-
id
|
|
85
|
-
name
|
|
86
|
-
users_count
|
|
87
|
-
permissions {
|
|
88
|
-
id
|
|
89
|
-
sort_order
|
|
90
|
-
text
|
|
91
|
-
children {
|
|
92
|
-
id
|
|
93
|
-
sort_order
|
|
94
|
-
text
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
available_requires_approval_from {
|
|
99
|
-
id
|
|
100
|
-
name
|
|
101
|
-
users_count
|
|
102
|
-
permissions {
|
|
103
|
-
id
|
|
104
|
-
sort_order
|
|
105
|
-
text
|
|
106
|
-
children {
|
|
107
|
-
id
|
|
108
|
-
sort_order
|
|
109
|
-
text
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`,y=async()=>n(E,{variables:{}}).then(a=>{var t;return(t=a.errors)!=null&&t.length&&l(a.errors),p(a)}).catch(i),v=`
|
|
117
|
-
query GET_CURRENCY_INFO {
|
|
118
|
-
currency {
|
|
119
|
-
base_currency_code
|
|
120
|
-
available_currency_codes
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
`,b=async()=>n(v,{}).then(a=>{var e,c,o,d,_;if(!a)return{baseCurrencyCode:"USD",availableCurrencyCodes:[]};(e=a.errors)!=null&&e.length&&l(a.errors);const t=((o=(c=a==null?void 0:a.data)==null?void 0:c.currency)==null?void 0:o.available_currency_codes)??[];return{baseCurrencyCode:((_=(d=a==null?void 0:a.data)==null?void 0:d.currency)==null?void 0:_.base_currency_code)||"USD",availableCurrencyCodes:t.length?t.map(r=>({text:String(r),value:String(r)})):[]}}).catch(i);export{m as a,b as c,y as g,C as u};
|
|
124
|
-
//# sourceMappingURL=currencyInfo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"currencyInfo.js","sources":["/@dropins/storefront-purchase-order/src/data/transforms/transform-purchase-order-approval-rule-metadata.ts","/@dropins/storefront-purchase-order/src/api/createPurchaseOrderApprovalRule/graphql/createPurchaseOrderApprovalRule.graphql.ts","/@dropins/storefront-purchase-order/src/api/createPurchaseOrderApprovalRule/createPurchaseOrderApprovalRule.ts","/@dropins/storefront-purchase-order/src/api/updatePurchaseOrderApprovalRule/graphql/updatePurchaseOrderApprovalRule.graphql.ts","/@dropins/storefront-purchase-order/src/api/updatePurchaseOrderApprovalRule/updatePurchaseOrderApprovalRule.ts","/@dropins/storefront-purchase-order/src/api/getPurchaseOrderApprovalRuleMetadata/graphql/getPurchaseOrderApprovalRuleMetadata.graphql.ts","/@dropins/storefront-purchase-order/src/api/getPurchaseOrderApprovalRuleMetadata/getPurchaseOrderApprovalRuleMetadata.ts","/@dropins/storefront-purchase-order/src/api/currencyInfo/graphql/currencyInfo.graphql.ts","/@dropins/storefront-purchase-order/src/api/currencyInfo/currencyInfo.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport {\n PurchaseOrderApprovalRuleMetadataModel,\n CompanyRolePermissionsTree,\n CompanyRole,\n} from '@/b2b-purchase-order/data/models/purchase-order-approval-rule-metadata-model';\n\nexport const transformPurchaseOrderApprovalRuleMetadata = (\n response: any\n): PurchaseOrderApprovalRuleMetadataModel => {\n const metadata =\n response?.data?.customer?.purchase_order_approval_rule_metadata;\n\n const transformCompanyRolePermission = (\n permission: any\n ): CompanyRolePermissionsTree => ({\n id: permission?.id || '',\n sortOrder: permission?.sort_order || 0,\n text: permission?.text || '',\n children:\n permission?.children?.map(transformCompanyRolePermission) || undefined,\n });\n\n const transformCompanyRole = (role: any): CompanyRole => ({\n id: role?.id || '',\n name: role?.name || '',\n usersCount: role?.users_count || 0,\n permissions: (role?.permissions || []).map(transformCompanyRolePermission),\n });\n\n const availableAppliesTo = (metadata?.available_applies_to || []).map(\n transformCompanyRole\n );\n\n const availableRequiresApprovalFrom = (\n metadata?.available_requires_approval_from || []\n ).map(transformCompanyRole);\n\n return {\n availableAppliesTo,\n availableRequiresApprovalFrom,\n };\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_PURCHASE_ORDER_APPROVAL_RULE = /* GraphQL */ `\n mutation CREATE_PURCHASE_ORDER_APPROVAL_RULE(\n $input: PurchaseOrderApprovalRuleInput!\n ) {\n createPurchaseOrderApprovalRule(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`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { CREATE_PURCHASE_ORDER_APPROVAL_RULE } from '@/b2b-purchase-order/api/createPurchaseOrderApprovalRule/graphql/createPurchaseOrderApprovalRule.graphql';\nimport { PurchaseOrderApprovalRuleModel } from '@/b2b-purchase-order/data/models/purchase-order-approval-rule-model';\nimport { transformPurchaseOrderApprovalRule } from '@/b2b-purchase-order/data/transforms';\n\nexport const createPurchaseOrderApprovalRule = async (\n input: any\n): Promise<PurchaseOrderApprovalRuleModel> => {\n if (!input.name || input.name.trim() === '') {\n throw new Error('Rule name is required');\n }\n\n return fetchGraphQl(CREATE_PURCHASE_ORDER_APPROVAL_RULE, {\n variables: { input },\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n const result = response.data?.createPurchaseOrderApprovalRule;\n if (!result) {\n throw new Error('Failed to create purchase order approval rule');\n }\n\n return transformPurchaseOrderApprovalRule(\n response.data.createPurchaseOrderApprovalRule\n );\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const UPDATE_PURCHASE_ORDER_APPROVAL_RULE = /* GraphQL */ `\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`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { UPDATE_PURCHASE_ORDER_APPROVAL_RULE } from '@/b2b-purchase-order/api/updatePurchaseOrderApprovalRule/graphql/updatePurchaseOrderApprovalRule.graphql';\nimport { transformPurchaseOrderApprovalRule } from '@/b2b-purchase-order/data/transforms';\nimport { PurchaseOrderApprovalRuleModel } from '@/b2b-purchase-order/data/models/purchase-order-approval-rule-model';\n\nexport const updatePurchaseOrderApprovalRule = async (\n input: any\n): Promise<PurchaseOrderApprovalRuleModel> => {\n if (!input.uid || input.uid.trim() === '') {\n throw new Error('Approval Rule UID is required');\n }\n\n return fetchGraphQl(UPDATE_PURCHASE_ORDER_APPROVAL_RULE, {\n variables: { input },\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n return transformPurchaseOrderApprovalRule(\n response.data?.updatePurchaseOrderApprovalRule || {}\n );\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA = /* GraphQL */ `\n query GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA {\n customer {\n purchase_order_approval_rule_metadata {\n available_applies_to {\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 available_requires_approval_from {\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 }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA } from '@/b2b-purchase-order/api/getPurchaseOrderApprovalRuleMetadata/graphql/getPurchaseOrderApprovalRuleMetadata.graphql';\nimport { transformPurchaseOrderApprovalRuleMetadata } from '@/b2b-purchase-order/data/transforms/transform-purchase-order-approval-rule-metadata';\nimport { PurchaseOrderApprovalRuleMetadataModel } from '@/b2b-purchase-order/data/models';\n\nexport const getPurchaseOrderApprovalRuleMetadata =\n async (): Promise<PurchaseOrderApprovalRuleMetadataModel> => {\n return fetchGraphQl(GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA, {\n variables: {},\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n return transformPurchaseOrderApprovalRuleMetadata(response);\n })\n .catch(handleNetworkError);\n };\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_CURRENCY_INFO = /* GraphQL */ `\n query GET_CURRENCY_INFO {\n currency {\n base_currency_code\n available_currency_codes\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { GET_CURRENCY_INFO } from './graphql/currencyInfo.graphql';\n\nexport const currencyInfo = async (): Promise<{\n baseCurrencyCode: string;\n availableCurrencyCodes: { text: string; value: string }[];\n}> => {\n return fetchGraphQl(GET_CURRENCY_INFO, {})\n .then((response) => {\n // Handle null/undefined response\n if (!response) {\n return {\n baseCurrencyCode: 'USD',\n availableCurrencyCodes: [],\n };\n }\n\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n const codeList = response?.data?.currency?.available_currency_codes ?? [];\n const baseCurrency = response?.data?.currency?.base_currency_code;\n\n return {\n baseCurrencyCode: baseCurrency || 'USD',\n availableCurrencyCodes: codeList.length\n ? codeList.map((code: any) => ({\n text: String(code),\n value: String(code),\n }))\n : [],\n };\n })\n .catch(handleNetworkError);\n};\n"],"names":["transformPurchaseOrderApprovalRuleMetadata","response","metadata","_b","_a","transformCompanyRolePermission","permission","transformCompanyRole","role","availableAppliesTo","availableRequiresApprovalFrom","CREATE_PURCHASE_ORDER_APPROVAL_RULE","createPurchaseOrderApprovalRule","input","fetchGraphQl","handleFetchError","transformPurchaseOrderApprovalRule","handleNetworkError","UPDATE_PURCHASE_ORDER_APPROVAL_RULE","updatePurchaseOrderApprovalRule","GET_PURCHASE_ORDER_APPROVAL_RULE_METADATA","getPurchaseOrderApprovalRuleMetadata","GET_CURRENCY_INFO","currencyInfo","codeList","_c","_e","_d","code"],"mappings":"mHAuBO,MAAMA,EACXC,GAC2C,SAC3C,MAAMC,GACJC,GAAAC,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAD,EAA0B,sCAEtBE,EACJC,GAAA,OACgC,OAChC,IAAIA,GAAA,YAAAA,EAAY,KAAM,GACtB,WAAWA,GAAA,YAAAA,EAAY,aAAc,EACrC,MAAMA,GAAA,YAAAA,EAAY,OAAQ,GAC1B,WACEF,EAAAE,GAAA,YAAAA,EAAY,WAAZ,YAAAF,EAAsB,IAAIC,KAAmC,MAAA,GAG3DE,EAAwBC,IAA4B,CACxD,IAAIA,GAAA,YAAAA,EAAM,KAAM,GAChB,MAAMA,GAAA,YAAAA,EAAM,OAAQ,GACpB,YAAYA,GAAA,YAAAA,EAAM,cAAe,EACjC,cAAcA,GAAA,YAAAA,EAAM,cAAe,CAAA,GAAI,IAAIH,CAA8B,CAAA,GAGrEI,IAAsBP,GAAA,YAAAA,EAAU,uBAAwB,CAAA,GAAI,IAChEK,CAAA,EAGIG,IACJR,GAAA,YAAAA,EAAU,mCAAoC,CAAA,GAC9C,IAAIK,CAAoB,EAE1B,MAAO,CACL,mBAAAE,EACA,8BAAAC,CAAA,CAEJ,ECzCaC,EAAoD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMpDC,EAAkC,MAC7CC,GAC4C,CAC5C,GAAI,CAACA,EAAM,MAAQA,EAAM,KAAK,KAAA,IAAW,GACvC,MAAM,IAAI,MAAM,uBAAuB,EAGzC,OAAOC,EAAaH,EAAqC,CACvD,UAAW,CAAE,MAAAE,CAAA,CAAM,CACpB,EACE,KAAMZ,GAAkB,SAMvB,IALIG,EAAAH,EAAS,SAAT,MAAAG,EAAiB,QACnBW,EAAiBd,EAAS,MAAM,EAI9B,GADWE,EAAAF,EAAS,OAAT,YAAAE,EAAe,iCAE5B,MAAM,IAAI,MAAM,+CAA+C,EAGjE,OAAOa,EACLf,EAAS,KAAK,+BAAA,CAElB,CAAC,EACA,MAAMgB,CAAkB,CAC7B,EC/BaC,EAAoD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMpDC,EAAkC,MAC7CN,GAC4C,CAC5C,GAAI,CAACA,EAAM,KAAOA,EAAM,IAAI,KAAA,IAAW,GACrC,MAAM,IAAI,MAAM,+BAA+B,EAGjD,OAAOC,EAAaI,EAAqC,CACvD,UAAW,CAAE,MAAAL,CAAA,CAAM,CACpB,EACE,KAAMZ,GAAkB,SACvB,OAAIG,EAAAH,EAAS,SAAT,MAAAG,EAAiB,QACnBW,EAAiBd,EAAS,MAAM,EAG3Be,IACLb,EAAAF,EAAS,OAAT,YAAAE,EAAe,kCAAmC,CAAA,CAAC,CAEvD,CAAC,EACA,MAAMc,CAAkB,CAC7B,EC1BaG,EAA0D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECO1DC,EACX,SACSP,EAAaM,EAA2C,CAC7D,UAAW,CAAA,CAAC,CACb,EACE,KAAMnB,GAAkB,OACvB,OAAIG,EAAAH,EAAS,SAAT,MAAAG,EAAiB,QACnBW,EAAiBd,EAAS,MAAM,EAG3BD,EAA2CC,CAAQ,CAC5D,CAAC,EACA,MAAMgB,CAAkB,ECnBlBK,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECKlCC,EAAe,SAInBT,EAAaQ,EAAmB,CAAA,CAAE,EACtC,KAAMrB,GAAa,eAElB,GAAI,CAACA,EACH,MAAO,CACL,iBAAkB,MAClB,uBAAwB,CAAA,CAAC,GAIzBG,EAAAH,EAAS,SAAT,MAAAG,EAAiB,QACnBW,EAAiBd,EAAS,MAAM,EAGlC,MAAMuB,IAAWC,GAAAtB,EAAAF,GAAA,YAAAA,EAAU,OAAV,YAAAE,EAAgB,WAAhB,YAAAsB,EAA0B,2BAA4B,CAAA,EAGvE,MAAO,CACL,mBAHmBC,GAAAC,EAAA1B,GAAA,YAAAA,EAAU,OAAV,YAAA0B,EAAgB,WAAhB,YAAAD,EAA0B,qBAGX,MAClC,uBAAwBF,EAAS,OAC7BA,EAAS,IAAKI,IAAe,CAC3B,KAAM,OAAOA,CAAI,EACjB,MAAO,OAAOA,CAAI,CAAA,EAClB,EACF,CAAA,CAAC,CAET,CAAC,EACA,MAAMX,CAAkB"}
|
package/chunks/fetch-error.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{FetchGraphQL as r}from"@dropins/tools/fetch-graphql.js";import{events as h}from"@dropins/tools/event-bus.js";const{setEndpoint:i,setFetchGraphQlHeader:d,removeFetchGraphQlHeader:g,setFetchGraphQlHeaders:m,fetchGraphQl:E,getConfig:f}=new r().getMethods(),w=e=>{const s=e instanceof DOMException&&(e==null?void 0:e.name)==="AbortError",t=(e==null?void 0:e.name)==="PlaceOrderError";throw!s&&!t&&h.emit("purchase-order/error",{source:"purchase-order",type:"network",error:e.message}),e},u=e=>{var o,n;if(e.length===1&&((n=(o=e[0])==null?void 0:o.path)==null?void 0:n.length)>0){const a=e[0].path[e[0].path.length-1];if(["applied_coupons","applied_gift_cards","available_payment_methods"].includes(a))return}const t=e.map(a=>a.message).join(" ");throw Error(t)};export{w as a,d as b,m as c,E as f,f as g,u as h,g as r,i as s};
|
|
4
|
-
//# sourceMappingURL=fetch-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-error.js","sources":["/@dropins/storefront-purchase-order/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-purchase-order/src/lib/network-error.ts","/@dropins/storefront-purchase-order/src/lib/fetch-error.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error?.name === 'AbortError';\n\n const isPlaceOrderError = error?.name === 'PlaceOrderError';\n\n if (!isAbortError && !isPlaceOrderError) {\n events.emit('purchase-order/error', {\n source: 'purchase-order',\n type: 'network',\n error: error.message,\n });\n }\n throw error;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (\n errors: Array<{ message: string; path: string[] }>\n) => {\n // We only allow silently skipping the error if it's a SINGLE error.\n const isSingleError = errors.length === 1;\n\n /**\n * TODO: Temporary workaround to avoid UX regressions.\n * Data is still valid even when these specific errors occur.\n * Remove this logic once the following issues are resolved:\n * - https://jira.corp.adobe.com/browse/LYNX-986\n * - https://jira.corp.adobe.com/browse/LYNX-989\n */\n if (isSingleError && errors[0]?.path?.length > 0) {\n const lastStep = errors[0].path[errors[0].path.length - 1];\n\n const allowedErrorPaths = [\n 'applied_coupons',\n 'applied_gift_cards',\n 'available_payment_methods',\n ];\n\n // If the single error's path ends with an allowed step - skip throwing\n if (allowedErrorPaths.includes(lastStep)) {\n return;\n }\n }\n\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleNetworkError","error","isAbortError","isPlaceOrderError","events","handleFetchError","errors","_b","_a","lastStep","errorMessage","e"],"mappings":"oHAmBO,KAAM,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECHVC,EAAsBC,GAAiB,CAClD,MAAMC,EACJD,aAAiB,eAAgBA,GAAA,YAAAA,EAAO,QAAS,aAE7CE,GAAoBF,GAAA,YAAAA,EAAO,QAAS,kBAE1C,KAAI,CAACC,GAAgB,CAACC,GACpBC,EAAO,KAAK,uBAAwB,CAClC,OAAQ,iBACR,KAAM,UACN,MAAOH,EAAM,OAAA,CACd,EAEGA,CACR,ECnBaI,EACXC,GACG,SAWH,GATsBA,EAAO,SAAW,KASnBC,GAAAC,EAAAF,EAAO,CAAC,IAAR,YAAAE,EAAW,OAAX,YAAAD,EAAiB,QAAS,EAAG,CAChD,MAAME,EAAWH,EAAO,CAAC,EAAE,KAAKA,EAAO,CAAC,EAAE,KAAK,OAAS,CAAC,EASzD,GAP0B,CACxB,kBACA,qBACA,2BAAA,EAIoB,SAASG,CAAQ,EACrC,MAEJ,CAEA,MAAMC,EAAeJ,EAAO,IAAKK,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B"}
|
package/chunks/formatDate.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{getGlobalLocale as c}from"@dropins/tools/lib.js";var n={};function i(e){if(e)return e;const r=c();return r||(n.LOCALE&&n.LOCALE!=="undefined"?n.LOCALE:"en-US")}const a=(e,r="en-US")=>{try{const t=new Date(e);if(isNaN(t.getTime()))return e;const o=i(r);return t.toLocaleString(o,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0})}catch{return e}};export{a as f};
|
|
4
|
-
//# sourceMappingURL=formatDate.js.map
|
package/chunks/formatDate.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.js","sources":["/@dropins/storefront-purchase-order/src/lib/formatDate.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { getGlobalLocale } from '@adobe-commerce/elsie/lib';\n\n/**\n * Determines the effective locale to use for price formatting\n * Priority: prop locale > global locale > browser locale > default 'en-US'\n */\nexport function getEffectiveLocale(locale?: string): string {\n if (locale) {\n return locale;\n }\n const globalLocale = getGlobalLocale();\n if (globalLocale) {\n return globalLocale;\n }\n // Fallback to browser locale or default\n return process.env.LOCALE && process.env.LOCALE !== 'undefined'\n ? process.env.LOCALE\n : 'en-US';\n}\n\n/**\n * Format a date string to a localized format like \"Sep 8, 2025 6:32:13 AM\"\n * @param dateString - ISO date string or date string\n * @param locale - Locale for formatting (defaults to 'en-US')\n * @returns Formatted date string\n */\nexport const formatDate = (\n dateString: string,\n locale: string = 'en-US'\n): string => {\n try {\n const date = new Date(dateString);\n\n if (isNaN(date.getTime())) {\n return dateString; // Return original if invalid\n }\n\n const effectiveLocale = getEffectiveLocale(locale);\n\n return date.toLocaleString(effectiveLocale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n minute: '2-digit',\n second: '2-digit',\n hour12: true,\n });\n } catch (error) {\n return dateString; // Return original on error\n }\n};\n"],"names":["getEffectiveLocale","locale","globalLocale","getGlobalLocale","define_process_env_default","formatDate","dateString","date","effectiveLocale"],"mappings":"iEAuBO,SAASA,EAAmBC,EAAyB,CAC1D,GAAIA,EACF,OAAOA,EAET,MAAMC,EAAeC,EAAA,EACrB,OAAID,IAIGE,EAAY,QAAUA,EAAY,SAAW,YAChDA,EAAY,OACZ,QACN,CAQO,MAAMC,EAAa,CACxBC,EACAL,EAAiB,UACN,CACX,GAAI,CACF,MAAMM,EAAO,IAAI,KAAKD,CAAU,EAEhC,GAAI,MAAMC,EAAK,QAAA,CAAS,EACtB,OAAOD,EAGT,MAAME,EAAkBR,EAAmBC,CAAM,EAEjD,OAAOM,EAAK,eAAeC,EAAiB,CAC1C,KAAM,UACN,MAAO,QACP,IAAK,UACL,KAAM,UACN,OAAQ,UACR,OAAQ,UACR,OAAQ,EAAA,CACT,CACH,MAAgB,CACd,OAAOF,CACT,CACF"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{f as i,h as c,a as d}from"./fetch-error.js";import"@dropins/tools/lib.js";import{t as n}from"./transform-purchase-order-approval-rule.js";const l=`
|
|
4
|
-
query GET_PURCHASE_ORDER_APPROVAL_RULE($uid: ID!) {
|
|
5
|
-
customer {
|
|
6
|
-
purchase_order_approval_rule(uid: $uid) {
|
|
7
|
-
created_at
|
|
8
|
-
created_by
|
|
9
|
-
description
|
|
10
|
-
name
|
|
11
|
-
status
|
|
12
|
-
uid
|
|
13
|
-
updated_at
|
|
14
|
-
applies_to_roles {
|
|
15
|
-
id
|
|
16
|
-
name
|
|
17
|
-
users_count
|
|
18
|
-
}
|
|
19
|
-
approver_roles {
|
|
20
|
-
id
|
|
21
|
-
name
|
|
22
|
-
users_count
|
|
23
|
-
}
|
|
24
|
-
condition {
|
|
25
|
-
attribute
|
|
26
|
-
operator
|
|
27
|
-
... on PurchaseOrderApprovalRuleConditionAmount {
|
|
28
|
-
attribute
|
|
29
|
-
operator
|
|
30
|
-
amount {
|
|
31
|
-
currency
|
|
32
|
-
value
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
... on PurchaseOrderApprovalRuleConditionQuantity {
|
|
36
|
-
attribute
|
|
37
|
-
operator
|
|
38
|
-
quantity
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`,h=async o=>i(l,{variables:{uid:o}}).then(r=>{var t,a,e;(t=r.errors)!=null&&t.length&&c(r.errors);const u=(e=(a=r==null?void 0:r.data)==null?void 0:a.customer)==null?void 0:e.purchase_order_approval_rule;return n(u)}).catch(d);export{h as g};
|
|
45
|
-
//# sourceMappingURL=getPurchaseOrderApprovalRule.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPurchaseOrderApprovalRule.js","sources":["/@dropins/storefront-purchase-order/src/api/getPurchaseOrderApprovalRule/graphql/getPurchaseOrderApprovalRule.graphql.ts","/@dropins/storefront-purchase-order/src/api/getPurchaseOrderApprovalRule/getPurchaseOrderApprovalRule.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_PURCHASE_ORDER_APPROVAL_RULE = /* GraphQL */ `\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`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib';\nimport { GET_PURCHASE_ORDER_APPROVAL_RULE } from '@/b2b-purchase-order/api/getPurchaseOrderApprovalRule/graphql/getPurchaseOrderApprovalRule.graphql';\nimport { transformPurchaseOrderApprovalRule } from '@/b2b-purchase-order/data/transforms';\nimport { PurchaseOrderApprovalRuleModel } from '@/b2b-purchase-order/data/models';\n\nexport const getPurchaseOrderApprovalRule = async (\n id: string\n): Promise<PurchaseOrderApprovalRuleModel> => {\n return fetchGraphQl(GET_PURCHASE_ORDER_APPROVAL_RULE, {\n variables: { uid: id },\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n const rulesData = response?.data?.customer?.purchase_order_approval_rule;\n\n return transformPurchaseOrderApprovalRule(rulesData);\n })\n .catch(handleNetworkError);\n};\n"],"names":["GET_PURCHASE_ORDER_APPROVAL_RULE","getPurchaseOrderApprovalRule","id","fetchGraphQl","response","_a","handleFetchError","rulesData","_c","_b","transformPurchaseOrderApprovalRule","handleNetworkError"],"mappings":"iJAiBO,MAAMA,EAAiD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECOjDC,EAA+B,MAC1CC,GAEOC,EAAaH,EAAkC,CACpD,UAAW,CAAE,IAAKE,CAAA,CAAG,CACtB,EACE,KAAME,GAAkB,YACnBC,EAAAD,EAAS,SAAT,MAAAC,EAAiB,QACnBC,EAAiBF,EAAS,MAAM,EAGlC,MAAMG,GAAYC,GAAAC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,WAAhB,YAAAD,EAA0B,6BAE5C,OAAOE,EAAmCH,CAAS,CACrD,CAAC,EACA,MAAMI,CAAkB"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{f as d,h as g,a as P}from"./fetch-error.js";import{t as R}from"./transform-purchase-order-approval-rule.js";const h=`
|
|
4
|
-
mutation DELETE_PURCHASE_ORDER_APPROVAL_RULE(
|
|
5
|
-
$input: DeletePurchaseOrderApprovalRuleInput!
|
|
6
|
-
) {
|
|
7
|
-
deletePurchaseOrderApprovalRule(input: $input) {
|
|
8
|
-
errors {
|
|
9
|
-
message
|
|
10
|
-
type
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
`,v=async o=>{const t=Array.isArray(o)?o:[o];if(!t||t.length===0)throw new Error("Approval Rule UID(s) are required");if(t.some(e=>!e||e.trim()===""))throw new Error("All Approval Rule UIDs must be valid");return d(h,{variables:{input:{approval_rule_uids:t}}}).then(e=>{var i,l,n;if((i=e.errors)!=null&&i.length&&g(e.errors),!((l=e.data)==null?void 0:l.deletePurchaseOrderApprovalRule))throw new Error("Failed to delete purchase order approval rule");const p=(n=e==null?void 0:e.data)==null?void 0:n.deletePurchaseOrderApprovalRule;return{deletePurchaseOrderApprovalRule:{errors:((p==null?void 0:p.errors)??[]).map(r=>({message:r==null?void 0:r.message,type:r==null?void 0:r.type}))}}}).catch(P)},A=`
|
|
15
|
-
query GET_PURCHASE_ORDER_APPROVAL_RULES($currentPage: Int!, $pageSize: Int!) {
|
|
16
|
-
customer {
|
|
17
|
-
email
|
|
18
|
-
purchase_order_approval_rules(
|
|
19
|
-
currentPage: $currentPage
|
|
20
|
-
pageSize: $pageSize
|
|
21
|
-
) {
|
|
22
|
-
items {
|
|
23
|
-
applies_to_roles {
|
|
24
|
-
id
|
|
25
|
-
name
|
|
26
|
-
users_count
|
|
27
|
-
permissions {
|
|
28
|
-
id
|
|
29
|
-
sort_order
|
|
30
|
-
text
|
|
31
|
-
children {
|
|
32
|
-
id
|
|
33
|
-
sort_order
|
|
34
|
-
text
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
approver_roles {
|
|
39
|
-
id
|
|
40
|
-
name
|
|
41
|
-
users_count
|
|
42
|
-
permissions {
|
|
43
|
-
id
|
|
44
|
-
sort_order
|
|
45
|
-
text
|
|
46
|
-
children {
|
|
47
|
-
id
|
|
48
|
-
sort_order
|
|
49
|
-
text
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
condition {
|
|
54
|
-
attribute
|
|
55
|
-
operator
|
|
56
|
-
}
|
|
57
|
-
created_at
|
|
58
|
-
created_by
|
|
59
|
-
description
|
|
60
|
-
name
|
|
61
|
-
status
|
|
62
|
-
uid
|
|
63
|
-
updated_at
|
|
64
|
-
}
|
|
65
|
-
total_count
|
|
66
|
-
page_info {
|
|
67
|
-
page_size
|
|
68
|
-
current_page
|
|
69
|
-
total_pages
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
`,s={currentPage:1,pageSize:20,totalPages:1},O=async(o=s.currentPage,t=s.pageSize)=>d(A,{variables:{currentPage:o,pageSize:t}}).then(a=>{var i,l,n,r,c,_;(i=a.errors)!=null&&i.length&&g(a.errors);const e=(n=(l=a==null?void 0:a.data)==null?void 0:l.customer)==null?void 0:n.purchase_order_approval_rules,u=(e==null?void 0:e.total_count)??0,p={currentPage:((r=e==null?void 0:e.page_info)==null?void 0:r.current_page)??s.currentPage,pageSize:((c=e==null?void 0:e.page_info)==null?void 0:c.page_size)??s.pageSize,totalPages:((_=e==null?void 0:e.page_info)==null?void 0:_.total_pages)??s.totalPages};return{totalCount:u,pageInfo:p,items:((e==null?void 0:e.items)||[]).map(R)}}).catch(P);export{v as d,O as g};
|
|
75
|
-
//# sourceMappingURL=getPurchaseOrderApprovalRules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPurchaseOrderApprovalRules.js","sources":["/@dropins/storefront-purchase-order/src/api/deletePurchaseOrderApprovalRule/graphql/deletePurchaseOrderApprovalRule.graphql.ts","/@dropins/storefront-purchase-order/src/api/deletePurchaseOrderApprovalRule/deletePurchaseOrderApprovalRule.ts","/@dropins/storefront-purchase-order/src/api/getPurchaseOrderApprovalRules/graphql/getPurchaseOrderApprovalRules.graphql.ts","/@dropins/storefront-purchase-order/src/api/getPurchaseOrderApprovalRules/getPurchaseOrderApprovalRules.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const DELETE_PURCHASE_ORDER_APPROVAL_RULE = /* GraphQL */ `\n mutation DELETE_PURCHASE_ORDER_APPROVAL_RULE(\n $input: DeletePurchaseOrderApprovalRuleInput!\n ) {\n deletePurchaseOrderApprovalRule(input: $input) {\n errors {\n message\n type\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { DELETE_PURCHASE_ORDER_APPROVAL_RULE } from '@/b2b-purchase-order/api/deletePurchaseOrderApprovalRule/graphql/deletePurchaseOrderApprovalRule.graphql';\n\nexport const deletePurchaseOrderApprovalRule = async (\n uids: string | string[]\n): Promise<{\n deletePurchaseOrderApprovalRule: {\n errors: { message?: string; type?: string }[];\n };\n}> => {\n const uidArray = Array.isArray(uids) ? uids : [uids];\n\n if (!uidArray || uidArray.length === 0) {\n throw new Error('Approval Rule UID(s) are required');\n }\n\n if (uidArray.some((uid) => !uid || uid.trim() === '')) {\n throw new Error('All Approval Rule UIDs must be valid');\n }\n\n const input = {\n approval_rule_uids: uidArray,\n };\n\n return fetchGraphQl(DELETE_PURCHASE_ORDER_APPROVAL_RULE, {\n variables: { input },\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n const result = response.data?.deletePurchaseOrderApprovalRule;\n if (!result) {\n throw new Error('Failed to delete purchase order approval rule');\n }\n\n const data = response?.data?.deletePurchaseOrderApprovalRule;\n\n return {\n deletePurchaseOrderApprovalRule: {\n errors: (data?.errors ?? []).map((error: any) => ({\n message: error?.message,\n type: error?.type,\n })),\n },\n };\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const GET_PURCHASE_ORDER_APPROVAL_RULES = /* GraphQL */ `\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`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { GET_PURCHASE_ORDER_APPROVAL_RULES } from '@/b2b-purchase-order/api/getPurchaseOrderApprovalRules/graphql/getPurchaseOrderApprovalRules.graphql';\nimport { transformPurchaseOrderApprovalRule } from '@/b2b-purchase-order/data/transforms';\nimport { PurchaseOrderApprovalRuleModel } from '@/b2b-purchase-order/data/models';\n\nconst DEFAULT_PAGE_INFO = {\n currentPage: 1,\n pageSize: 20,\n totalPages: 1,\n};\n\nexport const getPurchaseOrderApprovalRules = async (\n currentPage: number = DEFAULT_PAGE_INFO.currentPage,\n pageSize: number = DEFAULT_PAGE_INFO.pageSize\n): Promise<{\n totalCount: number;\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n items: PurchaseOrderApprovalRuleModel[];\n}> => {\n return fetchGraphQl(GET_PURCHASE_ORDER_APPROVAL_RULES, {\n variables: {\n currentPage,\n pageSize,\n },\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n const rulesData = response?.data?.customer?.purchase_order_approval_rules;\n const totalCount = rulesData?.total_count ?? 0;\n const pageInfo = {\n currentPage:\n rulesData?.page_info?.current_page ?? DEFAULT_PAGE_INFO.currentPage,\n pageSize: rulesData?.page_info?.page_size ?? DEFAULT_PAGE_INFO.pageSize,\n totalPages:\n rulesData?.page_info?.total_pages ?? DEFAULT_PAGE_INFO.totalPages,\n };\n\n return {\n totalCount,\n pageInfo,\n items: (rulesData?.items || []).map(transformPurchaseOrderApprovalRule),\n };\n })\n .catch(handleNetworkError);\n};\n"],"names":["DELETE_PURCHASE_ORDER_APPROVAL_RULE","deletePurchaseOrderApprovalRule","uids","uidArray","uid","fetchGraphQl","response","_a","handleFetchError","_b","data","_c","error","handleNetworkError","GET_PURCHASE_ORDER_APPROVAL_RULES","DEFAULT_PAGE_INFO","getPurchaseOrderApprovalRules","currentPage","pageSize","rulesData","totalCount","pageInfo","_d","_e","_f","transformPurchaseOrderApprovalRule"],"mappings":"mHAiBO,MAAMA,EAAoD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECIpDC,EAAkC,MAC7CC,GAKI,CACJ,MAAMC,EAAW,MAAM,QAAQD,CAAI,EAAIA,EAAO,CAACA,CAAI,EAEnD,GAAI,CAACC,GAAYA,EAAS,SAAW,EACnC,MAAM,IAAI,MAAM,mCAAmC,EAGrD,GAAIA,EAAS,KAAMC,GAAQ,CAACA,GAAOA,EAAI,SAAW,EAAE,EAClD,MAAM,IAAI,MAAM,sCAAsC,EAOxD,OAAOC,EAAaL,EAAqC,CACvD,UAAW,CAAE,MALD,CACZ,mBAAoBG,CAAA,CAIP,CAAM,CACpB,EACE,KAAMG,GAAkB,WAMvB,IALIC,EAAAD,EAAS,SAAT,MAAAC,EAAiB,QACnBC,EAAiBF,EAAS,MAAM,EAI9B,GADWG,EAAAH,EAAS,OAAT,YAAAG,EAAe,iCAE5B,MAAM,IAAI,MAAM,+CAA+C,EAGjE,MAAMC,GAAOC,EAAAL,GAAA,YAAAA,EAAU,OAAV,YAAAK,EAAgB,gCAE7B,MAAO,CACL,gCAAiC,CAC/B,SAASD,GAAA,YAAAA,EAAM,SAAU,CAAA,GAAI,IAAKE,IAAgB,CAChD,QAASA,GAAA,YAAAA,EAAO,QAChB,KAAMA,GAAA,YAAAA,EAAO,IAAA,EACb,CAAA,CACJ,CAEJ,CAAC,EACA,MAAMC,CAAkB,CAC7B,EClDaC,EAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECOzDC,EAAoB,CACxB,YAAa,EACb,SAAU,GACV,WAAY,CACd,EAEaC,EAAgC,MAC3CC,EAAsBF,EAAkB,YACxCG,EAAmBH,EAAkB,WAU9BV,EAAaS,EAAmC,CACrD,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,CACF,CACD,EACE,KAAMZ,GAAkB,kBACnBC,EAAAD,EAAS,SAAT,MAAAC,EAAiB,QACnBC,EAAiBF,EAAS,MAAM,EAGlC,MAAMa,GAAYR,GAAAF,EAAAH,GAAA,YAAAA,EAAU,OAAV,YAAAG,EAAgB,WAAhB,YAAAE,EAA0B,8BACtCS,GAAaD,GAAA,YAAAA,EAAW,cAAe,EACvCE,EAAW,CACf,cACEC,EAAAH,GAAA,YAAAA,EAAW,YAAX,YAAAG,EAAsB,eAAgBP,EAAkB,YAC1D,WAAUQ,EAAAJ,GAAA,YAAAA,EAAW,YAAX,YAAAI,EAAsB,YAAaR,EAAkB,SAC/D,aACES,EAAAL,GAAA,YAAAA,EAAW,YAAX,YAAAK,EAAsB,cAAeT,EAAkB,UAAA,EAG3D,MAAO,CACL,WAAAK,EACA,SAAAC,EACA,QAAQF,GAAA,YAAAA,EAAW,QAAS,CAAA,GAAI,IAAIM,CAAkC,CAAA,CAE1E,CAAC,EACA,MAAMZ,CAAkB"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{f as R,h as P,a as S}from"./fetch-error.js";import{P as p,t as s}from"./transform-purchase-order.js";import"@dropins/tools/lib.js";import{t as h}from"./case-converter.js";const $=`
|
|
4
|
-
query GET_PURCHASE_ORDERS(
|
|
5
|
-
$filter: PurchaseOrdersFilterInput
|
|
6
|
-
$pageSize: Int
|
|
7
|
-
$currentPage: Int
|
|
8
|
-
) {
|
|
9
|
-
customer {
|
|
10
|
-
purchase_orders(
|
|
11
|
-
filter: $filter
|
|
12
|
-
pageSize: $pageSize
|
|
13
|
-
currentPage: $currentPage
|
|
14
|
-
) {
|
|
15
|
-
total_count
|
|
16
|
-
page_info {
|
|
17
|
-
current_page
|
|
18
|
-
page_size
|
|
19
|
-
total_pages
|
|
20
|
-
}
|
|
21
|
-
items {
|
|
22
|
-
...PURCHASE_ORDERS_FRAGMENT
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
${p}
|
|
28
|
-
`,G=async(f,l=20,m=1)=>R($,{variables:{filter:h(f),pageSize:l,currentPage:m}}).then(e=>{var r,o,a,i,n,g,_,c;if((r=e.errors)!=null&&r.length&&P(e.errors),!((a=(o=e.data)==null?void 0:o.customer)!=null&&a.purchase_orders))throw new Error("Failed to get purchase orders");const t=(n=(i=e==null?void 0:e.data)==null?void 0:i.customer)==null?void 0:n.purchase_orders,u=(t==null?void 0:t.total_count)??0,E={currentPage:((g=t==null?void 0:t.page_info)==null?void 0:g.current_page)??1,pageSize:((_=t==null?void 0:t.page_info)==null?void 0:_.page_size)??20,totalPages:((c=t==null?void 0:t.page_info)==null?void 0:c.total_pages)??1};return{totalCount:u,pageInfo:E,purchaseOrderItems:((t==null?void 0:t.items)||[]).map(s)}}).catch(S);export{G as g};
|
|
29
|
-
//# sourceMappingURL=getPurchaseOrders.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPurchaseOrders.js","sources":["/@dropins/storefront-purchase-order/src/api/getPurchaseOrders/graphql/getPurchaseOrders.graphql.ts","/@dropins/storefront-purchase-order/src/api/getPurchaseOrders/getPurchaseOrders.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { PURCHASE_ORDERS_FRAGMENT } from '@/b2b-purchase-order/api/fragments';\n\nexport const GET_PURCHASE_ORDERS = /* GraphQL */ `\n query GET_PURCHASE_ORDERS(\n $filter: PurchaseOrdersFilterInput\n $pageSize: Int\n $currentPage: Int\n ) {\n customer {\n purchase_orders(\n filter: $filter\n pageSize: $pageSize\n currentPage: $currentPage\n ) {\n total_count\n page_info {\n current_page\n page_size\n total_pages\n }\n items {\n ...PURCHASE_ORDERS_FRAGMENT\n }\n }\n }\n }\n ${PURCHASE_ORDERS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { GET_PURCHASE_ORDERS } from '@/b2b-purchase-order/api/getPurchaseOrders/graphql/getPurchaseOrders.graphql';\nimport { transformPurchaseOrder } from '@/b2b-purchase-order/data/transforms/transform-purchase-order';\nimport { PurchaseOrderModel } from '@/b2b-purchase-order/data/models';\nimport { toSnakeCase } from '@/b2b-purchase-order/lib';\n\nexport const getPurchaseOrders = async (\n filter?: any,\n pageSize: number = 20,\n currentPage: number = 1\n): Promise<{\n totalCount: number;\n pageInfo: {\n currentPage: number;\n pageSize: number;\n totalPages: number;\n };\n purchaseOrderItems: PurchaseOrderModel[];\n}> => {\n return fetchGraphQl(GET_PURCHASE_ORDERS, {\n variables: {\n filter: toSnakeCase(filter),\n pageSize,\n currentPage,\n },\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n if (!response.data?.customer?.purchase_orders) {\n throw new Error('Failed to get purchase orders');\n }\n\n const purchaseOrdersData = response?.data?.customer?.purchase_orders;\n const totalCount = purchaseOrdersData?.total_count ?? 0;\n const pageInfo = {\n currentPage: purchaseOrdersData?.page_info?.current_page ?? 1,\n pageSize: purchaseOrdersData?.page_info?.page_size ?? 20,\n totalPages: purchaseOrdersData?.page_info?.total_pages ?? 1,\n };\n\n return {\n totalCount,\n pageInfo,\n purchaseOrderItems: (purchaseOrdersData?.items || []).map(\n transformPurchaseOrder\n ),\n };\n })\n .catch(handleNetworkError);\n};\n"],"names":["GET_PURCHASE_ORDERS","PURCHASE_ORDERS_FRAGMENT","getPurchaseOrders","filter","pageSize","currentPage","fetchGraphQl","toSnakeCase","response","_a","handleFetchError","_c","_b","purchaseOrdersData","_e","_d","totalCount","pageInfo","_f","_g","_h","transformPurchaseOrder","handleNetworkError"],"mappings":"kLAmBO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAwB7CC,CAAwB;AAAA,EClBfC,EAAoB,MAC/BC,EACAC,EAAmB,GACnBC,EAAsB,IAUfC,EAAaN,EAAqB,CACvC,UAAW,CACT,OAAQO,EAAYJ,CAAM,EAC1B,SAAAC,EACA,YAAAC,CAAA,CACF,CACD,EACE,KAAMG,GAAkB,qBAKvB,IAJIC,EAAAD,EAAS,SAAT,MAAAC,EAAiB,QACnBC,EAAiBF,EAAS,MAAM,EAG9B,GAACG,GAAAC,EAAAJ,EAAS,OAAT,YAAAI,EAAe,WAAf,MAAAD,EAAyB,iBAC5B,MAAM,IAAI,MAAM,+BAA+B,EAGjD,MAAME,GAAqBC,GAAAC,EAAAP,GAAA,YAAAA,EAAU,OAAV,YAAAO,EAAgB,WAAhB,YAAAD,EAA0B,gBAC/CE,GAAaH,GAAA,YAAAA,EAAoB,cAAe,EAChDI,EAAW,CACf,cAAaC,EAAAL,GAAA,YAAAA,EAAoB,YAApB,YAAAK,EAA+B,eAAgB,EAC5D,WAAUC,EAAAN,GAAA,YAAAA,EAAoB,YAApB,YAAAM,EAA+B,YAAa,GACtD,aAAYC,EAAAP,GAAA,YAAAA,EAAoB,YAApB,YAAAO,EAA+B,cAAe,CAAA,EAG5D,MAAO,CACL,WAAAJ,EACA,SAAAC,EACA,qBAAqBJ,GAAA,YAAAA,EAAoB,QAAS,CAAA,GAAI,IACpDQ,CAAA,CACF,CAEJ,CAAC,EACA,MAAMC,CAAkB"}
|
package/chunks/initialize.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{Initializer as d}from"@dropins/tools/lib.js";import{f,h,a as u}from"./fetch-error.js";import{P as R,t as p}from"./transform-purchase-order.js";import{events as a}from"@dropins/tools/event-bus.js";const l=`
|
|
4
|
-
query GET_PURCHASE_ORDER($uid: ID!) {
|
|
5
|
-
customer {
|
|
6
|
-
purchase_order(uid: $uid) {
|
|
7
|
-
...PURCHASE_ORDERS_FRAGMENT
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
${R}
|
|
12
|
-
`,m=async r=>{if(!r||r.trim()==="")throw new Error("Purchase Order UID is required");return f(l,{variables:{uid:r}}).then(e=>{var s,i,c;(s=e.errors)!=null&&s.length&&h(e.errors);const t=(c=(i=e.data)==null?void 0:i.customer)==null?void 0:c.purchase_order;if(!t)throw new Error("Failed to get purchase order");return{purchaseOrder:p(t)}}).catch(u)},n=async r=>{var t;const e=await m(r);(t=e==null?void 0:e.purchaseOrder)!=null&&t.quote?(a.emit("order/data",{...e.purchaseOrder.quote}),a.emit("purchase-order/data",{...e.purchaseOrder})):console.error("Failed to fetch purchase order data.")},o=new d({init:async r=>{const e={};o.config.setConfig({...e,...r}),typeof(r==null?void 0:r.poRef)=="string"&&r.poRef.trim()!==""&&await n(r.poRef)},listeners:()=>[a.on("purchase-order/refresh",async()=>{const r=o.config.getConfig();typeof(r==null?void 0:r.poRef)=="string"&&r.poRef.trim()!==""&&await n(r.poRef)})]}),w=o.config;export{w as c,m as g,o as i};
|
|
13
|
-
//# sourceMappingURL=initialize.js.map
|
package/chunks/initialize.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.js","sources":["/@dropins/storefront-purchase-order/src/api/getPurchaseOrder/graphql/getPurchaseOrder.graphql.ts","/@dropins/storefront-purchase-order/src/api/getPurchaseOrder/getPurchaseOrder.ts","/@dropins/storefront-purchase-order/src/api/initialize/initialize.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { PURCHASE_ORDERS_FRAGMENT } from '../../fragments';\n\nexport const GET_PURCHASE_ORDER = /* GraphQL */ `\n query GET_PURCHASE_ORDER($uid: ID!) {\n customer {\n purchase_order(uid: $uid) {\n ...PURCHASE_ORDERS_FRAGMENT\n }\n }\n }\n ${PURCHASE_ORDERS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/b2b-purchase-order/api/fetch-graphql';\nimport { handleNetworkError } from '@/b2b-purchase-order/lib/network-error';\nimport { handleFetchError } from '@/b2b-purchase-order/lib/fetch-error';\nimport { GET_PURCHASE_ORDER } from '@/b2b-purchase-order/api/getPurchaseOrder/graphql/getPurchaseOrder.graphql';\nimport { transformPurchaseOrder } from '@/b2b-purchase-order/data/transforms/transform-purchase-order';\nimport { PurchaseOrderModel } from '@/b2b-purchase-order/data/models';\n\nexport const getPurchaseOrder = async (\n uid: string\n): Promise<{\n purchaseOrder: PurchaseOrderModel;\n}> => {\n if (!uid || uid.trim() === '') {\n throw new Error('Purchase Order UID is required');\n }\n\n return fetchGraphQl(GET_PURCHASE_ORDER, {\n variables: { uid },\n })\n .then((response: any) => {\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n const result = response.data?.customer?.purchase_order;\n if (!result) {\n throw new Error('Failed to get purchase order');\n }\n\n return {\n purchaseOrder: transformPurchaseOrder(result),\n };\n })\n .catch(handleNetworkError);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { getPurchaseOrder } from '../getPurchaseOrder';\nimport { events } from '@adobe-commerce/event-bus';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n poRef?: string;\n};\n\nconst fetchAndEmitPurchaseOrderData = async (poRef: string) => {\n const result = await getPurchaseOrder(poRef);\n\n if (result?.purchaseOrder?.quote) {\n events.emit('order/data', {\n ...result.purchaseOrder.quote,\n });\n events.emit('purchase-order/data', {\n ...result.purchaseOrder,\n });\n } else {\n console.error('Failed to fetch purchase order data.');\n }\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n\n const isValidPoRef =\n typeof config?.poRef === 'string' && config.poRef.trim() !== '';\n\n if (isValidPoRef) {\n await fetchAndEmitPurchaseOrderData(config!.poRef!);\n }\n },\n\n listeners: () => [\n events.on('purchase-order/refresh', async () => {\n const config = initialize.config.getConfig();\n const isValidPoRef =\n typeof config?.poRef === 'string' && config.poRef.trim() !== '';\n\n if (isValidPoRef) {\n await fetchAndEmitPurchaseOrderData(config!.poRef!);\n }\n }),\n ],\n});\n\nexport const config = initialize.config;\n"],"names":["GET_PURCHASE_ORDER","PURCHASE_ORDERS_FRAGMENT","getPurchaseOrder","uid","fetchGraphQl","response","_a","handleFetchError","result","_c","_b","transformPurchaseOrder","handleNetworkError","fetchAndEmitPurchaseOrderData","poRef","events","initialize","Initializer","config","defaultConfig"],"mappings":"2MAmBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ5CC,CAAwB;AAAA,ECHfC,EAAmB,MAC9BC,GAGI,CACJ,GAAI,CAACA,GAAOA,EAAI,KAAA,IAAW,GACzB,MAAM,IAAI,MAAM,gCAAgC,EAGlD,OAAOC,EAAaJ,EAAoB,CACtC,UAAW,CAAE,IAAAG,CAAA,CAAI,CAClB,EACE,KAAME,GAAkB,YACnBC,EAAAD,EAAS,SAAT,MAAAC,EAAiB,QACnBC,EAAiBF,EAAS,MAAM,EAGlC,MAAMG,GAASC,GAAAC,EAAAL,EAAS,OAAT,YAAAK,EAAe,WAAf,YAAAD,EAAyB,eACxC,GAAI,CAACD,EACH,MAAM,IAAI,MAAM,8BAA8B,EAGhD,MAAO,CACL,cAAeG,EAAuBH,CAAM,CAAA,CAEhD,CAAC,EACA,MAAMI,CAAkB,CAC7B,ECxBMC,EAAgC,MAAOC,GAAkB,OAC7D,MAAMN,EAAS,MAAMN,EAAiBY,CAAK,GAEvCR,EAAAE,GAAA,YAAAA,EAAQ,gBAAR,MAAAF,EAAuB,OACzBS,EAAO,KAAK,aAAc,CACxB,GAAGP,EAAO,cAAc,KAAA,CACzB,EACDO,EAAO,KAAK,sBAAuB,CACjC,GAAGP,EAAO,aAAA,CACX,GAED,QAAQ,MAAM,sCAAsC,CAExD,EAEaQ,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAA,EAEtBH,EAAW,OAAO,UAAU,CAAE,GAAGG,EAAe,GAAGD,EAAQ,EAGzD,OAAOA,GAAAA,YAAAA,EAAQ,QAAU,UAAYA,EAAO,MAAM,SAAW,IAG7D,MAAML,EAA8BK,EAAQ,KAAM,CAEtD,EAEA,UAAW,IAAM,CACfH,EAAO,GAAG,yBAA0B,SAAY,CAC9C,MAAMG,EAASF,EAAW,OAAO,UAAA,EAE/B,OAAOE,GAAAA,YAAAA,EAAQ,QAAU,UAAYA,EAAO,MAAM,SAAW,IAG7D,MAAML,EAA8BK,EAAQ,KAAM,CAEtD,CAAC,CAAA,CAEL,CAAC,EAEYA,EAASF,EAAW"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*! Copyright 2026 Adobe
|
|
2
|
-
All Rights Reserved. */
|
|
3
|
-
import{jsxs as p,Fragment as k,jsx as e}from"@dropins/tools/preact-jsx-runtime.js";import{InLineAlert as W,Table as j,Pagination as B,Picker as F,Card as S}from"@dropins/tools/components.js";import{classes as h}from"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"./PurchaseOrderHistoryLogContent.js";import{useText as G,Text as D}from"@dropins/tools/i18n.js";const X=r=>{try{return new URL(r,window.location.origin).origin===window.location.origin}catch{return r.startsWith("/")||r.startsWith("./")||r.startsWith("../")}},H=(r,a,s)=>{if(s<=0)return{from:0,to:0,total:0};const i=Math.max(1,Math.ceil(s/a)),c=Math.min(Math.max(r,1),i),l=(c-1)*a+1,n=Math.min(c*a,s);return{from:l,to:n,total:s}},Z=r=>{const a=r.toUpperCase();return["APPROVED","ORDER_PLACED","APPROVED_PENDING_PAYMENT","ENABLED"].includes(a)?"positive":["REJECTED","CANCELED","ORDER_FAILED","DISABLED"].includes(a)?"negative":"waiting"},$=({pageSizeConfig:r,totalCount:a=0,columns:s=[],rows:i=[],paginationConfig:c,alertMessageConfig:l={heading:"",description:"",type:"success"},loading:n=!1,className:m="",variant:x="secondary",skeletonRowCount:O=10,emptyTitle:T,header:b,footer:g,withWrapper:y,expandedRows:R})=>{var N;const w=G({title:"PurchaseOrders.purchaseOrdersTable.noPurchaseOrders.default"}),{heading:_,description:f,type:A}=l,{currentPage:P,totalPages:v,handlePageChange:C}=c,{pageSizeOptionsList:t,onChange:M}=r,o=t==null?void 0:t.find(u=>u.selected),L=o&&o.value!==void 0?Number(o.value):10,{from:I,to:U,total:V}=H(P,L,a),d=!n&&i.length===0,E=p(k,{children:[_||f?e(W,{heading:_,description:f,type:A}):null,b?e("div",{className:"purchase-orders-table__header",children:b}):null,e(j,{className:"purchase-orders-table__table-wrapper",mobileLayout:"stacked",columns:s,rowData:i,expandedRows:R,loading:n,skeletonRowCount:+O}),d&&e("div",{className:"purchase-orders-table__empty-state",role:"status","aria-live":"polite",children:e("p",{children:T||w.title})}),a>0?p("div",{className:"purchase-orders-table__pagination-wrapper",children:[e("div",{className:"purchase-orders-table__pagination-counter",children:e(D,{id:"PurchaseOrders.purchaseOrdersTable.pagination.status",fields:{from:I,to:U,total:V}})}),v>1&&e(B,{className:h(["purchase-orders-table__pagination",["purchase-orders-table__pagination--loading",n]]),currentPage:P,totalPages:v,onChange:C}),a>0&&t.length?p("div",{className:"purchase-orders-table__pagination-page-size",children:[e(D,{id:"PurchaseOrders.purchaseOrdersTable.pagination.pageSizeLabel.start"}),e(F,{disabled:n,handleSelect:M,options:t,value:((N=t==null?void 0:t.find(u=>u.selected))==null?void 0:N.value)||""})]}):null]}):null,g?e("div",{className:"purchase-orders-table__footer",children:g}):null]});return y?e(S,{variant:x,"data-testid":"purchaseOrdersTable",className:h(["b2b-purchase-order-purchase-orders-table",["b2b-purchase-order-purchase-orders-table--empty-state",d],m]),children:E}):e("div",{"data-testid":"purchaseOrdersTable",className:h(["b2b-purchase-order-purchase-orders-table",["b2b-purchase-order-purchase-orders-table--empty-state",d],m]),children:E})},ee=[{text:"10",value:"10",selected:!1},{text:"20",value:"20",selected:!0},{text:"30",value:"30",selected:!1},{text:"50",value:"50",selected:!1}];export{$ as P,ee as d,Z as g,X as i};
|
|
4
|
-
//# sourceMappingURL=pageSize.config.js.map
|