@dropins/storefront-purchase-order 0.0.5-alpha1 → 0.0.5-alpha11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fetch-graphql/fetch-graphql.d.ts +16 -0
- package/api/fetch-graphql/index.d.ts +16 -0
- package/api/getPurchaseOrder/graphql/getPurchaseOrder.graphql.d.ts +1 -1
- package/api/graphql/PurchaseOrderQuoteFragment.d.ts +22 -0
- package/api/graphql/PurchaseOrdersFragment.graphql.d.ts +1 -1
- package/api/index.d.ts +1 -0
- package/api/initialize/index.d.ts +16 -0
- package/api/initialize/initialize.d.ts +1 -0
- package/api/permissions.d.ts +27 -0
- package/api.js +12 -74
- package/api.js.map +1 -1
- package/chunks/FormLoader.js +1 -1
- package/chunks/FormLoader.js.map +1 -1
- package/chunks/PurchaseOrderHistoryLogContent.js +4 -0
- package/chunks/PurchaseOrderHistoryLogContent.js.map +1 -0
- package/chunks/PurchaseOrdersHeader.js +1 -1
- package/chunks/PurchaseOrdersHeader.js.map +1 -1
- package/chunks/PurchaseOrdersTableActions.js +1 -1
- package/chunks/PurchaseOrdersTableActions.js.map +1 -1
- package/chunks/fetch-graphql.js.map +1 -1
- package/chunks/formatDate.js +4 -0
- package/chunks/formatDate.js.map +1 -0
- package/chunks/getPurchaseOrders.js +3 -77
- package/chunks/getPurchaseOrders.js.map +1 -1
- package/chunks/pageSize.config.js +1 -1
- package/chunks/pageSize.config.js.map +1 -1
- package/chunks/permissions.js +4 -0
- package/chunks/permissions.js.map +1 -0
- package/chunks/placeOrderForPurchaseOrder.js +39 -0
- package/chunks/placeOrderForPurchaseOrder.js.map +1 -0
- package/chunks/rejectPurchaseOrders.js +439 -0
- package/chunks/rejectPurchaseOrders.js.map +1 -0
- package/chunks/transform-purchase-order-approval-rule.js.map +1 -1
- package/chunks/useCustomerRolePermissions.js +1 -1
- package/chunks/useCustomerRolePermissions.js.map +1 -1
- package/chunks/usePurchaseOrders.js +1 -1
- package/chunks/usePurchaseOrders.js.map +1 -1
- package/components/ApprovalRuleDetailsContent/index.d.ts +11 -3
- package/components/ApprovalRuleForm/index.d.ts +11 -3
- package/components/PurchaseOrderHistoryLogContent/PurchaseOrderHistoryLogContent.d.ts +5 -0
- package/components/PurchaseOrderHistoryLogContent/index.d.ts +19 -0
- package/components/PurchaseOrderStatusContent/PurchaseOrderStatusContent.d.ts +5 -0
- package/components/PurchaseOrderStatusContent/index.d.ts +19 -0
- package/components/index.d.ts +2 -0
- package/containers/ApprovalRuleDetails/index.d.ts +11 -3
- package/containers/ApprovalRuleDetails.js +1 -1
- package/containers/ApprovalRuleDetails.js.map +1 -1
- package/containers/ApprovalRuleForm/index.d.ts +11 -3
- 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/PurchaseOrderConfirmation.js +1 -1
- package/containers/PurchaseOrderConfirmation.js.map +1 -1
- package/containers/PurchaseOrderHistoryLog/PurchaseOrderHistoryLog.d.ts +5 -0
- package/containers/PurchaseOrderHistoryLog/index.d.ts +19 -0
- package/containers/PurchaseOrderHistoryLog.d.ts +3 -0
- package/containers/PurchaseOrderHistoryLog.js +4 -0
- package/containers/PurchaseOrderHistoryLog.js.map +1 -0
- package/containers/PurchaseOrderStatus/PurchaseOrderStatus.d.ts +5 -0
- package/containers/PurchaseOrderStatus/index.d.ts +19 -0
- package/containers/PurchaseOrderStatus.d.ts +3 -0
- package/containers/PurchaseOrderStatus.js +4 -0
- package/containers/PurchaseOrderStatus.js.map +1 -0
- package/containers/RequireApprovalPurchaseOrders.js +1 -1
- package/containers/RequireApprovalPurchaseOrders.js.map +1 -1
- package/containers/index.d.ts +2 -0
- package/data/models/customer-order-model.d.ts +0 -1
- package/data/models/purchase-order-model.d.ts +228 -14
- package/hooks/index.d.ts +2 -0
- package/hooks/usePurchaseOrderData.d.ts +7 -0
- package/hooks/usePurchaseOrderStatus.d.ts +4 -0
- package/i18n/en_US.json.d.ts +78 -0
- package/lib/cleanAndDeep.d.ts +16 -0
- package/lib/getRange.d.ts +16 -0
- package/lib/index.d.ts +16 -0
- package/lib/isValidUrl.d.ts +16 -0
- package/mocks/index.d.ts +16 -0
- package/mocks/storybook/events-data.d.ts +17 -5
- package/package.json +1 -1
- package/render/index.d.ts +16 -0
- package/render.js +2 -2
- package/render.js.map +1 -1
- package/types/api/api.enums.types.d.ts +16 -0
- package/types/api/index.d.ts +16 -0
- package/types/components/index.d.ts +18 -0
- package/types/components/purchaseOrderHistoryLogContent.types.d.ts +7 -0
- package/types/components/purchaseOrderStatusContent.types.d.ts +17 -0
- package/types/components/purchaseOrdersTableActions.d.ts +16 -0
- package/types/containers/approvalRuleDetailsProps.types.d.ts +16 -0
- package/types/containers/index.d.ts +18 -0
- package/types/containers/purchaseOrderHistoryLog.types.d.ts +23 -0
- package/types/containers/purchaseOrderStatus.types.d.ts +18 -0
- package/types/hooks/index.d.ts +17 -0
- package/types/hooks/useApprovalRuleDetails.types.d.ts +16 -0
- package/types/hooks/usePurchaseOrderStatus.types.d.ts +19 -0
- package/chunks/FormLoader2.js +0 -4
- package/chunks/FormLoader2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PurchaseOrderConfirmation.js","sources":["/@dropins/storefront-purchase-order/src/components/PurchaseOrderConfirmationContent/PurchaseOrderConfirmationContent.tsx","/@dropins/storefront-purchase-order/src/containers/PurchaseOrderConfirmation/PurchaseOrderConfirmation.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 { PurchaseOrderConfirmationContentProps } from '@/b2b-purchase-order/types/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/b2b-purchase-order/components/PurchaseOrderConfirmationContent/PurchaseOrderConfirmationContent.css';\n\nexport const PurchaseOrderConfirmationContent: FunctionComponent<\n PurchaseOrderConfirmationContentProps\n> = ({\n className,\n purchaseOrderNumber,\n routePurchaseOrderDetails,\n ...props\n}) => {\n const t = useText({\n title: 'PurchaseOrders.purchaseOrderConfirmation.title',\n messagePrefix: 'PurchaseOrders.purchaseOrderConfirmation.messagePrefix',\n messageSuffix: 'PurchaseOrders.purchaseOrderConfirmation.messageSuffix',\n });\n\n return (\n <div\n {...props}\n className={classes(['purchase-orders-confirmation-content', className])}\n >\n <h2 className=\"purchase-orders-confirmation-content__title\">{t.title}</h2>\n <p className=\"purchase-orders-confirmation-content__message\">\n {t.messagePrefix}{' '}\n <a\n className=\"purchase-orders-confirmation-content__link\"\n href={routePurchaseOrderDetails() ?? ''}\n >\n #{purchaseOrderNumber}\n </a>\n . {t.messageSuffix}\n </p>\n </div>\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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { PurchaseOrderConfirmationContent } from '@/b2b-purchase-order/components';\nimport { PurchaseOrderConfirmationProps } from '@/b2b-purchase-order/types/containers';\n\nexport const PurchaseOrderConfirmation: Container<\n PurchaseOrderConfirmationProps\n> = ({\n className,\n purchaseOrderNumber,\n routePurchaseOrderDetails,\n ...props\n}) => {\n if (!purchaseOrderNumber) return null;\n\n return (\n <div\n {...props}\n className={classes(['b2b-purchase-order-confirmation', className])}\n >\n <PurchaseOrderConfirmationContent\n purchaseOrderNumber={purchaseOrderNumber}\n routePurchaseOrderDetails={routePurchaseOrderDetails}\n />\n </div>\n );\n};\n"],"names":["PurchaseOrderConfirmationContent","className","purchaseOrderNumber","routePurchaseOrderDetails","props","useText","jsxs","classes","jsx","PurchaseOrderConfirmation"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PurchaseOrderConfirmation.js","sources":["/@dropins/storefront-purchase-order/src/components/PurchaseOrderConfirmationContent/PurchaseOrderConfirmationContent.tsx","/@dropins/storefront-purchase-order/src/containers/PurchaseOrderConfirmation/PurchaseOrderConfirmation.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 { PurchaseOrderConfirmationContentProps } from '@/b2b-purchase-order/types/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/b2b-purchase-order/components/PurchaseOrderConfirmationContent/PurchaseOrderConfirmationContent.css';\n\nexport const PurchaseOrderConfirmationContent: FunctionComponent<\n PurchaseOrderConfirmationContentProps\n> = ({\n className,\n purchaseOrderNumber,\n routePurchaseOrderDetails,\n ...props\n}) => {\n const t = useText({\n title: 'PurchaseOrders.purchaseOrderConfirmation.title',\n messagePrefix: 'PurchaseOrders.purchaseOrderConfirmation.messagePrefix',\n messageSuffix: 'PurchaseOrders.purchaseOrderConfirmation.messageSuffix',\n });\n\n return (\n <div\n {...props}\n className={classes(['purchase-orders-confirmation-content', className])}\n >\n <h2 className=\"purchase-orders-confirmation-content__title\">{t.title}</h2>\n <p className=\"purchase-orders-confirmation-content__message\">\n {t.messagePrefix}{' '}\n <a\n className=\"purchase-orders-confirmation-content__link\"\n href={routePurchaseOrderDetails() ?? ''}\n >\n #{purchaseOrderNumber}\n </a>\n . {t.messageSuffix}\n </p>\n </div>\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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { PurchaseOrderConfirmationContent } from '@/b2b-purchase-order/components';\nimport { PurchaseOrderConfirmationProps } from '@/b2b-purchase-order/types/containers';\n\nexport const PurchaseOrderConfirmation: Container<\n PurchaseOrderConfirmationProps\n> = ({\n className,\n purchaseOrderNumber,\n routePurchaseOrderDetails,\n ...props\n}) => {\n if (!purchaseOrderNumber) return null;\n\n return (\n <div\n {...props}\n className={classes(['b2b-purchase-order-confirmation', className])}\n >\n <PurchaseOrderConfirmationContent\n purchaseOrderNumber={purchaseOrderNumber}\n routePurchaseOrderDetails={routePurchaseOrderDetails}\n />\n </div>\n );\n};\n"],"names":["PurchaseOrderConfirmationContent","className","purchaseOrderNumber","routePurchaseOrderDetails","props","useText","jsxs","classes","jsx","PurchaseOrderConfirmation"],"mappings":"2WAuBO,MAAMA,EAET,CAAC,CACH,UAAAC,EACA,oBAAAC,EACA,0BAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAM,EAAIC,EAAQ,CAChB,MAAO,iDACP,cAAe,yDACf,cAAe,wDAAA,CAChB,EAED,OACEC,EAAC,MAAA,CACE,GAAGF,EACJ,UAAWG,EAAQ,CAAC,uCAAwCN,CAAS,CAAC,EAEtE,SAAA,CAAAO,EAAC,KAAA,CAAG,UAAU,8CAA+C,SAAA,EAAE,MAAM,EACrEF,EAAC,IAAA,CAAE,UAAU,gDACV,SAAA,CAAA,EAAE,cAAe,IAClBA,EAAC,IAAA,CACC,UAAU,6CACV,KAAMH,KAA+B,GACtC,SAAA,CAAA,IACGD,CAAA,CAAA,CAAA,EACA,KACD,EAAE,aAAA,CAAA,CACP,CAAA,CAAA,CAAA,CAGN,EClCaO,EAET,CAAC,CACH,UAAAR,EACA,oBAAAC,EACA,0BAAAC,EACA,GAAGC,CACL,IACOF,EAGHM,EAAC,MAAA,CACE,GAAGJ,EACJ,UAAWG,EAAQ,CAAC,kCAAmCN,CAAS,CAAC,EAEjE,SAAAO,EAACR,EAAA,CACC,oBAAAE,EACA,0BAAAC,CAAA,CAAA,CACF,CAAA,EAV6B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Container } from '@dropins/tools/types/elsie/src/lib';
|
|
2
|
+
import { PurchaseOrderHistoryLogProps } from '../../types/containers';
|
|
3
|
+
|
|
4
|
+
export declare const PurchaseOrderHistoryLog: Container<PurchaseOrderHistoryLogProps>;
|
|
5
|
+
//# sourceMappingURL=PurchaseOrderHistoryLog.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './PurchaseOrderHistoryLog';
|
|
18
|
+
export { PurchaseOrderHistoryLog as default } from './PurchaseOrderHistoryLog';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as e,jsxs as d}from"@dropins/tools/preact-jsx-runtime.js";import{classes as p}from"@dropins/tools/lib.js";import{Button as f,Card as y,Skeleton as L,SkeletonRow as m}from"@dropins/tools/components.js";import{events as v}from"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{P as w}from"../chunks/PurchaseOrdersHeader.js";import{useState as u,useEffect as P}from"@dropins/tools/preact-hooks.js";import{Fragment as x}from"@dropins/tools/preact.js";import{f as _}from"../chunks/formatDate.js";import{useText as g,Text as h}from"@dropins/tools/i18n.js";const O=()=>{const[r,o]=u(!0),[a,n]=u(null);return P(()=>{const t=v.on("purchase-order/data",s=>{s!=null&&s.uid&&n(s),o(!1)},{eager:!0});return()=>{t==null||t.off()}},[]),{poDataLoading:r,purchaseOrderData:a}},N=({historyLogRecords:r=[],visibleRecordsLimit:o})=>{const[a,n]=u(o),t=r.length>a,s=r.length<=o,c=g({showMoreLabel:"PurchaseOrders.historyLog.ariaLabel.showMore",showLessLabel:"PurchaseOrders.historyLog.ariaLabel.showLess"});return r.length?d("div",{className:"b2b-purchase-order-history-log-content",children:[e("ul",{className:"b2b-purchase-order-history-log-content__list",role:"list",children:r.slice(0,a).map((i,l)=>{const b=Math.min(a,r.length);return d(x,{children:[d("li",{className:"b2b-purchase-order-history-log-content__item",children:[e("div",{className:"b2b-purchase-order-history-log-content__title",children:e(h,{id:`PurchaseOrders.historyLog.status.${i.activity}`,fields:{date:_(i.createdAt)}})}),e("div",{className:"b2b-purchase-order-history-log-content__description",children:i.message})]}),l<b-1&&e("hr",{className:"b2b-purchase-order-history-log-content__divider"})]},i.uid)})}),!s&&e("div",{className:"b2b-purchase-order-history-log-content__actions",children:e(f,{variant:"secondary","aria-expanded":!t,"aria-label":t?c.showMoreLabel:c.showLessLabel,onClick:()=>{n(t?r.length:o)},children:e(h,{id:`PurchaseOrders.historyLog.buttons.${t?"viewMore":"viewLess"}`})})})]}):e("div",{className:"b2b-purchase-order-history-log-content",children:e(h,{id:"PurchaseOrders.historyLog.emptyText"})})},$=({withHeader:r=!0,withWrapper:o=!0,visibleRecordsLimit:a=5,className:n})=>{const{poDataLoading:t,purchaseOrderData:s}=O(),c=g({headerText:"PurchaseOrders.historyLog.headerText"}),i=(s==null?void 0:s.historyLog)||[],l=t?d(L,{rowGap:"medium","data-testid":"comment-list-loader",children:[e(m,{size:"small",variant:"row",fullWidth:!0,lines:1,style:{maxWidth:300}}),e(m,{size:"medium",variant:"row",fullWidth:!0,lines:1})]}):e(N,{historyLogRecords:i,visibleRecordsLimit:a});return d("div",{className:p(["b2b-purchase-order-history-log",n]),"data-testid":"order-history-log-container",children:[r?e(w,{headerText:c.headerText}):null,o?e(y,{variant:"secondary","data-testid":"orderHistoryLogCard",children:l}):l]})};export{$ as PurchaseOrderHistoryLog,$ as default};
|
|
4
|
+
//# sourceMappingURL=PurchaseOrderHistoryLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PurchaseOrderHistoryLog.js","sources":["/@dropins/storefront-purchase-order/src/hooks/usePurchaseOrderData.tsx","/@dropins/storefront-purchase-order/src/components/PurchaseOrderHistoryLogContent/PurchaseOrderHistoryLogContent.tsx","/@dropins/storefront-purchase-order/src/containers/PurchaseOrderHistoryLog/PurchaseOrderHistoryLog.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 { useEffect, useState } from 'preact/hooks';\nimport { PurchaseOrderModel } from '../data/models';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const usePurchaseOrderData = () => {\n const [poDataLoading, setPoDataLoading] = useState(true);\n const [purchaseOrderData, setPurchaseOrderData] =\n useState<PurchaseOrderModel | null>(null);\n\n useEffect(() => {\n const event = events.on(\n 'purchase-order/data',\n (po: PurchaseOrderModel) => {\n if (po?.uid) {\n setPurchaseOrderData(po);\n }\n\n setPoDataLoading(false);\n },\n { eager: true }\n );\n\n return () => {\n event?.off();\n };\n }, []);\n\n return { poDataLoading, purchaseOrderData };\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 { Fragment, FunctionComponent } from 'preact';\nimport '@/b2b-purchase-order/components/PurchaseOrderHistoryLogContent/PurchaseOrderHistoryLogContent.css';\nimport { PurchaseOrderHistoryLogContentProps } from '@/b2b-purchase-order/types/components';\nimport { Text, useText } from '@adobe-commerce/elsie/i18n';\nimport { formatDate } from '@/b2b-purchase-order/lib/formatDate';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { useState } from 'preact/hooks';\n\nexport const PurchaseOrderHistoryLogContent: FunctionComponent<\n PurchaseOrderHistoryLogContentProps\n> = ({ historyLogRecords = [], visibleRecordsLimit }) => {\n const [visibleRecordsCount, setVisibleRecordsCount] =\n useState<number>(visibleRecordsLimit);\n const showMore = historyLogRecords.length > visibleRecordsCount;\n const buttonIsHidden = historyLogRecords.length <= visibleRecordsLimit;\n\n const t = useText({\n showMoreLabel: 'PurchaseOrders.historyLog.ariaLabel.showMore',\n showLessLabel: 'PurchaseOrders.historyLog.ariaLabel.showLess',\n });\n\n if (!historyLogRecords.length) {\n return (\n <div className={'b2b-purchase-order-history-log-content'}>\n <Text id=\"PurchaseOrders.historyLog.emptyText\" />\n </div>\n );\n }\n\n return (\n <div className={'b2b-purchase-order-history-log-content'}>\n <ul\n className={'b2b-purchase-order-history-log-content__list'}\n role=\"list\"\n >\n {historyLogRecords.slice(0, visibleRecordsCount).map((item, index) => {\n const slicedLength = Math.min(\n visibleRecordsCount,\n historyLogRecords.length\n );\n return (\n <Fragment key={item.uid}>\n <li className={'b2b-purchase-order-history-log-content__item'}>\n <div\n className={'b2b-purchase-order-history-log-content__title'}\n >\n <Text\n id={`PurchaseOrders.historyLog.status.${item.activity}`}\n fields={{ date: formatDate(item.createdAt) }}\n />\n </div>\n <div\n className={\n 'b2b-purchase-order-history-log-content__description'\n }\n >\n {item.message}\n </div>\n </li>\n {index < slicedLength - 1 && (\n <hr\n className={'b2b-purchase-order-history-log-content__divider'}\n />\n )}\n </Fragment>\n );\n })}\n </ul>\n {!buttonIsHidden && (\n <div className={'b2b-purchase-order-history-log-content__actions'}>\n <Button\n variant=\"secondary\"\n aria-expanded={!showMore}\n aria-label={showMore ? t.showMoreLabel : t.showLessLabel}\n onClick={() => {\n setVisibleRecordsCount(\n showMore ? historyLogRecords.length : visibleRecordsLimit\n );\n }}\n >\n <Text\n id={`PurchaseOrders.historyLog.buttons.${\n showMore ? 'viewMore' : 'viewLess'\n }`}\n />\n </Button>\n </div>\n )}\n </div>\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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport {\n PurchaseOrderHistoryLogContent,\n PurchaseOrdersHeader,\n} from '@/b2b-purchase-order/components';\nimport { PurchaseOrderHistoryLogProps } from '@/b2b-purchase-order/types/containers';\nimport { Card, Skeleton, SkeletonRow } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { usePurchaseOrderData } from '@/b2b-purchase-order/hooks';\n\nexport const PurchaseOrderHistoryLog: Container<\n PurchaseOrderHistoryLogProps\n> = ({\n withHeader = true,\n withWrapper = true,\n visibleRecordsLimit = 5,\n className,\n}) => {\n const { poDataLoading, purchaseOrderData } = usePurchaseOrderData();\n const t = useText({\n headerText: 'PurchaseOrders.historyLog.headerText',\n });\n\n const historyLogRecords = purchaseOrderData?.historyLog || [];\n\n const renderHistoryLog = !poDataLoading ? (\n <PurchaseOrderHistoryLogContent\n historyLogRecords={historyLogRecords}\n visibleRecordsLimit={visibleRecordsLimit}\n />\n ) : (\n <Skeleton rowGap=\"medium\" data-testid=\"comment-list-loader\">\n <SkeletonRow\n size=\"small\"\n variant=\"row\"\n fullWidth\n lines={1}\n style={{ maxWidth: 300 }}\n />\n <SkeletonRow size=\"medium\" variant=\"row\" fullWidth lines={1} />\n </Skeleton>\n );\n\n return (\n <div\n className={classes(['b2b-purchase-order-history-log', className])}\n data-testid=\"order-history-log-container\"\n >\n {withHeader ? <PurchaseOrdersHeader headerText={t.headerText} /> : null}\n {withWrapper ? (\n <Card variant={'secondary'} data-testid=\"orderHistoryLogCard\">\n {renderHistoryLog}\n </Card>\n ) : (\n renderHistoryLog\n )}\n </div>\n );\n};\n"],"names":["usePurchaseOrderData","poDataLoading","setPoDataLoading","useState","purchaseOrderData","setPurchaseOrderData","useEffect","event","events","po","PurchaseOrderHistoryLogContent","historyLogRecords","visibleRecordsLimit","visibleRecordsCount","setVisibleRecordsCount","showMore","buttonIsHidden","t","useText","jsxs","jsx","item","index","slicedLength","Fragment","Text","formatDate","Button","PurchaseOrderHistoryLog","withHeader","withWrapper","className","renderHistoryLog","Skeleton","SkeletonRow","classes","PurchaseOrdersHeader","Card"],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './PurchaseOrderStatus';
|
|
18
|
+
export { PurchaseOrderStatus as default } from './PurchaseOrderStatus';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as s,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{classes as T,Slot as B}from"@dropins/tools/lib.js";import{Button as S,InLineAlert as D,Card as N,Header as w,Skeleton as _,SkeletonRow as x}from"@dropins/tools/components.js";import{useState as p,useEffect as I,useCallback as m}from"@dropins/tools/preact-hooks.js";import{events as z}from"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import{a as J,r as V}from"../chunks/rejectPurchaseOrders.js";import{c as H,p as W}from"../chunks/placeOrderForPurchaseOrder.js";import{useText as R}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/fetch-error.js";const $=()=>{const e=R({approvalSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.approval",rejectSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.reject",cancelSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.cancel",placeOrderSuccessMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.success.placeOrder",approvalErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.approval",rejectErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.reject",cancelErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.cancel",placeOrderErrorMessage:"PurchaseOrders.purchaseOrderStatus.alertMessages.errors.placeOrder"}),[a,t]=p([]),[c,d]=p(null),[i,O]=p("PENDING"),[g,l]=p("success"),[P,n]=p(""),[f,b]=p(!1),[v,E]=p(!0),A=()=>{E(!0)};I(()=>{const h=z.on("purchase-order/data",r=>{r!=null&&r.uid&&(d(r.uid),O(r.status),t(r.availableActions))},{eager:!0});return()=>{h==null||h.off()}},[]);const C=m((h,r)=>{let u="";if(h){switch(r){case"APPROVE":u=e.approvalSuccessMessage;break;case"REJECT":u=e.rejectSuccessMessage;break;case"CANCEL":u=e.cancelSuccessMessage;break;case"PLACE_ORDER":u=e.placeOrderSuccessMessage;break}l("success")}else{switch(r){case"APPROVE":u=e.approvalErrorMessage;break;case"REJECT":u=e.rejectErrorMessage;break;case"CANCEL":u=e.cancelErrorMessage;break;case"PLACE_ORDER":u=e.placeOrderErrorMessage;break}l("error")}n(u),E(!1)},[e]),o=m(async(h,r)=>{if(c){b(!0);try{await h(c),C(!0,r)}catch{C(!1,r)}finally{b(!1)}}},[c,C]),k=m(()=>o(J,"APPROVE"),[o]),y=m(()=>o(V,"REJECT"),[o]),j=m(()=>o(H,"CANCEL"),[o]),L=m(()=>o(W,"PLACE_ORDER"),[o]);return{poId:c,status:i,availableActions:a,alertType:g,loading:f,isDismissed:v,alertMessage:P,handleOnDismiss:A,handleApprove:k,handleReject:y,handleCancel:j,handlePlaceOrder:L}},F=({slots:e,t:a,loading:t,children:c,availableActions:d=[],handleApprove:i,handleReject:O,handleCancel:g,handlePlaceOrder:l})=>{const P=d.map(n=>{switch(n){case"APPROVE":return s(S,{variant:"secondary",disabled:t,type:"button",onClick:i,children:a.approveButtonText},n);case"PLACE_ORDER":return s(S,{variant:"secondary",disabled:t,type:"button",onClick:l,children:a.placeOrderButtonText},n);case"REJECT":return s(S,{variant:"secondary",disabled:t,type:"button",onClick:O,children:a.rejectButtonText},n);case"CANCEL":return s(S,{variant:"secondary",disabled:t,type:"button",onClick:g,children:a.cancelButtonText},n);default:return null}});return M("div",{className:T(["b2b-purchase-order-status-content"]),children:[s("div",{className:"b2b-purchase-order-status-content__message",children:a.statusMessageText}),c,s("div",{className:"b2b-purchase-order-status-content__actions",children:s(B,{"data-testid":"PurchaseOrderActions",name:"PurchaseOrderActions",slot:e==null?void 0:e.PurchaseOrderActions,context:{loading:t,availableActions:d,handleApprove:i,handleReject:O,handleCancel:g,handlePlaceOrder:l},children:P})})]})},ce=({className:e,slots:a})=>{const{poId:t,status:c,availableActions:d,alertType:i,loading:O,isDismissed:g,alertMessage:l,handleOnDismiss:P,handleApprove:n,handleReject:f,handleCancel:b,handlePlaceOrder:v}=$(),E=R({statusHeadingText:`PurchaseOrders.purchaseOrderStatus.status.${c.toLowerCase()}.title`,statusMessageText:`PurchaseOrders.purchaseOrderStatus.status.${c.toLowerCase()}.message`,approveButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.approve",cancelButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.cancel",rejectButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.reject",placeOrderButtonText:"PurchaseOrders.purchaseOrderStatus.buttons.placeOrder"}),A=d.length>0;return t?M("div",{className:T(["purchase-order-status",e]),children:[!g&&l?s(D,{style:{marginBottom:"1rem",textTransform:"capitalize"},heading:i,onDismiss:P,description:l,type:i}):null,M(N,{variant:"secondary",children:[s(w,{title:E.statusHeadingText}),A?s(F,{t:E,loading:O,handleApprove:n,handleReject:f,handleCancel:b,handlePlaceOrder:v,availableActions:d,slots:a}):M(_,{"data-testid":"status-content-loader-skeleton-test-id",children:[s(x,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),s(x,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),s(x,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]})]})]}):null};export{ce as PurchaseOrderStatus,ce as default};
|
|
4
|
+
//# sourceMappingURL=PurchaseOrderStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PurchaseOrderStatus.js","sources":["/@dropins/storefront-purchase-order/src/hooks/usePurchaseOrderStatus.tsx","/@dropins/storefront-purchase-order/src/components/PurchaseOrderStatusContent/PurchaseOrderStatusContent.tsx","/@dropins/storefront-purchase-order/src/containers/PurchaseOrderStatus/PurchaseOrderStatus.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 { useState, useCallback, useEffect } from 'preact/hooks';\nimport {\n approvePurchaseOrders,\n cancelPurchaseOrders,\n placeOrderForPurchaseOrder,\n rejectPurchaseOrders,\n} from '@/b2b-purchase-order/api';\nimport { InLineAlertProps } from '@adobe-commerce/elsie/components';\nimport {\n UsePurchaseOrderStatusReturn,\n PURCHASE_ORDER_ACTION,\n PURCHASE_ORDER_STATUS,\n} from '@/b2b-purchase-order/types/hooks';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { PurchaseOrderModel } from '../data/models';\n\nexport const usePurchaseOrderStatus = (): UsePurchaseOrderStatusReturn => {\n const t = useText({\n approvalSuccessMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.success.approval',\n rejectSuccessMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.success.reject',\n cancelSuccessMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.success.cancel',\n placeOrderSuccessMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.success.placeOrder',\n approvalErrorMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.errors.approval',\n rejectErrorMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.errors.reject',\n cancelErrorMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.errors.cancel',\n placeOrderErrorMessage:\n 'PurchaseOrders.purchaseOrderStatus.alertMessages.errors.placeOrder',\n });\n\n const [availableActions, setAvailableActions] = useState<\n PURCHASE_ORDER_ACTION[] | []\n >([]);\n const [poId, setPoId] = useState<string | null>(null);\n const [status, setStatus] = useState<PURCHASE_ORDER_STATUS>('PENDING');\n const [alertType, setAlertType] =\n useState<NonNullable<InLineAlertProps['type']>>('success');\n const [alertMessage, setAlertMessage] = useState('');\n const [loading, setLoading] = useState(false);\n const [isDismissed, setIsDismissed] = useState(true);\n const handleOnDismiss = () => {\n setIsDismissed(true);\n };\n\n useEffect(() => {\n const event = events.on(\n 'purchase-order/data',\n (po: PurchaseOrderModel) => {\n if (po?.uid) {\n setPoId(po.uid);\n setStatus(po.status as PURCHASE_ORDER_STATUS);\n setAvailableActions(po.availableActions as PURCHASE_ORDER_ACTION[]);\n }\n },\n { eager: true }\n );\n\n return () => {\n event?.off();\n };\n }, []);\n\n const showAlert = useCallback(\n (isSuccess: boolean, actionType: PURCHASE_ORDER_ACTION) => {\n let message = '';\n if (isSuccess) {\n switch (actionType) {\n case 'APPROVE':\n message = t.approvalSuccessMessage;\n break;\n case 'REJECT':\n message = t.rejectSuccessMessage;\n break;\n case 'CANCEL':\n message = t.cancelSuccessMessage;\n break;\n case 'PLACE_ORDER':\n message = t.placeOrderSuccessMessage;\n break;\n }\n setAlertType('success');\n } else {\n switch (actionType) {\n case 'APPROVE':\n message = t.approvalErrorMessage;\n break;\n case 'REJECT':\n message = t.rejectErrorMessage;\n break;\n case 'CANCEL':\n message = t.cancelErrorMessage;\n break;\n case 'PLACE_ORDER':\n message = t.placeOrderErrorMessage;\n break;\n }\n setAlertType('error');\n }\n\n setAlertMessage(message);\n setIsDismissed(false);\n },\n [t]\n );\n\n const handleAction = useCallback(\n async (\n apiFn: (id: string) => Promise<any>,\n actionType: PURCHASE_ORDER_ACTION\n ) => {\n if (!poId) return;\n setLoading(true);\n try {\n await apiFn(poId);\n showAlert(true, actionType);\n } catch {\n showAlert(false, actionType);\n } finally {\n setLoading(false);\n }\n },\n [poId, showAlert]\n );\n\n const handleApprove = useCallback(\n () => handleAction(approvePurchaseOrders, 'APPROVE'),\n [handleAction]\n );\n const handleReject = useCallback(\n () => handleAction(rejectPurchaseOrders, 'REJECT'),\n [handleAction]\n );\n const handleCancel = useCallback(\n () => handleAction(cancelPurchaseOrders, 'CANCEL'),\n [handleAction]\n );\n const handlePlaceOrder = useCallback(\n () => handleAction(placeOrderForPurchaseOrder, 'PLACE_ORDER'),\n [handleAction]\n );\n\n return {\n poId,\n status,\n availableActions,\n alertType,\n loading,\n isDismissed,\n alertMessage,\n handleOnDismiss,\n handleApprove,\n handleReject,\n handleCancel,\n handlePlaceOrder,\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 { FunctionComponent } from 'preact';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport '@/b2b-purchase-order/components/PurchaseOrderStatusContent/PurchaseOrderStatusContent.css';\nimport { PurchaseOrderStatusContentProps } from '@/b2b-purchase-order/types/components';\nimport { Button } from '@adobe-commerce/elsie/components';\nimport { PURCHASE_ORDER_ACTION } from '@/b2b-purchase-order/types/hooks';\n\nexport const PurchaseOrderStatusContent: FunctionComponent<\n PurchaseOrderStatusContentProps\n> = ({\n slots,\n t,\n loading,\n children,\n availableActions = [],\n handleApprove,\n handleReject,\n handleCancel,\n handlePlaceOrder,\n}) => {\n const renderButtons = availableActions.map((action) => {\n switch (action as PURCHASE_ORDER_ACTION) {\n case 'APPROVE':\n return (\n <Button\n variant=\"secondary\"\n disabled={loading}\n type=\"button\"\n key={action}\n onClick={handleApprove}\n >\n {t.approveButtonText}\n </Button>\n );\n case 'PLACE_ORDER':\n return (\n <Button\n variant=\"secondary\"\n disabled={loading}\n type=\"button\"\n key={action}\n onClick={handlePlaceOrder}\n >\n {t.placeOrderButtonText}\n </Button>\n );\n case 'REJECT':\n return (\n <Button\n variant=\"secondary\"\n disabled={loading}\n type=\"button\"\n key={action}\n onClick={handleReject}\n >\n {t.rejectButtonText}\n </Button>\n );\n case 'CANCEL':\n return (\n <Button\n variant=\"secondary\"\n disabled={loading}\n type=\"button\"\n key={action}\n onClick={handleCancel}\n >\n {t.cancelButtonText}\n </Button>\n );\n default:\n return null;\n }\n });\n\n return (\n <div className={classes(['b2b-purchase-order-status-content'])}>\n <div className={'b2b-purchase-order-status-content__message'}>\n {t.statusMessageText}\n </div>\n {children}\n <div className={'b2b-purchase-order-status-content__actions'}>\n <Slot\n data-testid=\"PurchaseOrderActions\"\n name=\"PurchaseOrderActions\"\n slot={slots?.PurchaseOrderActions}\n context={{\n loading,\n availableActions,\n handleApprove,\n handleReject,\n handleCancel,\n handlePlaceOrder,\n }}\n >\n {renderButtons}\n </Slot>\n </div>\n </div>\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 { useText } from '@adobe-commerce/elsie/i18n';\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport {\n Card,\n Header,\n InLineAlert,\n Skeleton,\n SkeletonRow,\n} from '@adobe-commerce/elsie/components';\nimport { usePurchaseOrderStatus } from '@/b2b-purchase-order/hooks';\nimport { PurchaseOrderStatusProps } from '@/b2b-purchase-order/types/containers';\nimport { PurchaseOrderStatusContent } from '@/b2b-purchase-order/components';\n\nexport const PurchaseOrderStatus: Container<PurchaseOrderStatusProps> = ({\n className,\n slots,\n}) => {\n const {\n poId,\n status,\n availableActions,\n alertType,\n loading,\n isDismissed,\n alertMessage,\n handleOnDismiss,\n handleApprove,\n handleReject,\n handleCancel,\n handlePlaceOrder,\n } = usePurchaseOrderStatus();\n\n const t = useText({\n statusHeadingText: `PurchaseOrders.purchaseOrderStatus.status.${status.toLowerCase()}.title`,\n statusMessageText: `PurchaseOrders.purchaseOrderStatus.status.${status.toLowerCase()}.message`,\n approveButtonText: 'PurchaseOrders.purchaseOrderStatus.buttons.approve',\n cancelButtonText: 'PurchaseOrders.purchaseOrderStatus.buttons.cancel',\n rejectButtonText: 'PurchaseOrders.purchaseOrderStatus.buttons.reject',\n placeOrderButtonText:\n 'PurchaseOrders.purchaseOrderStatus.buttons.placeOrder',\n });\n\n const isActionAvailable = availableActions.length > 0;\n\n if (!poId) return null;\n\n return (\n <div className={classes(['purchase-order-status', className])}>\n {!isDismissed && alertMessage ? (\n <InLineAlert\n style={{ marginBottom: '1rem', textTransform: 'capitalize' }}\n heading={alertType}\n onDismiss={handleOnDismiss}\n description={alertMessage}\n type={alertType}\n />\n ) : null}\n <Card variant=\"secondary\">\n <Header title={t.statusHeadingText} />\n {isActionAvailable ? (\n <PurchaseOrderStatusContent\n t={t}\n loading={loading}\n handleApprove={handleApprove}\n handleReject={handleReject}\n handleCancel={handleCancel}\n handlePlaceOrder={handlePlaceOrder}\n availableActions={availableActions}\n slots={slots}\n />\n ) : (\n <Skeleton data-testid={'status-content-loader-skeleton-test-id'}>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={true}\n lines={1}\n />\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={true}\n lines={1}\n />\n </Skeleton>\n )}\n </Card>\n </div>\n );\n};\n"],"names":["usePurchaseOrderStatus","t","useText","availableActions","setAvailableActions","useState","poId","setPoId","status","setStatus","alertType","setAlertType","alertMessage","setAlertMessage","loading","setLoading","isDismissed","setIsDismissed","handleOnDismiss","useEffect","event","events","po","showAlert","useCallback","isSuccess","actionType","message","handleAction","apiFn","handleApprove","approvePurchaseOrders","handleReject","rejectPurchaseOrders","handleCancel","cancelPurchaseOrders","handlePlaceOrder","placeOrderForPurchaseOrder","PurchaseOrderStatusContent","slots","children","renderButtons","action","jsx","Button","classes","Slot","PurchaseOrderStatus","className","isActionAvailable","jsxs","InLineAlert","Card","Header","Skeleton","SkeletonRow"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as v,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as R}from"@dropins/tools/lib.js";import{P as D,d as M}from"../chunks/pageSize.config.js";import{P as j}from"../chunks/PurchaseOrdersHeader.js";import{P as w}from"../chunks/PurchaseOrdersTableActions.js";import"@dropins/tools/components.js";import{E as x,u as E}from"../chunks/usePurchaseOrders.js";import{u as S}from"../chunks/useCustomerRolePermissions.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../chunks/
|
|
3
|
+
import{jsxs as v,jsx as r}from"@dropins/tools/preact-jsx-runtime.js";import{classes as R}from"@dropins/tools/lib.js";import{P as D,d as M}from"../chunks/pageSize.config.js";import{P as j}from"../chunks/PurchaseOrdersHeader.js";import{P as w}from"../chunks/PurchaseOrdersTableActions.js";import"@dropins/tools/components.js";import{E as x,u as E}from"../chunks/usePurchaseOrders.js";import{u as S}from"../chunks/useCustomerRolePermissions.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/event-bus.js";import"../chunks/PurchaseOrderHistoryLogContent.js";import"@dropins/tools/preact.js";import{useText as q}from"@dropins/tools/i18n.js";import"../chunks/formatDate.js";import"../chunks/rejectPurchaseOrders.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/fetch-error.js";import"../chunks/getPurchaseOrders.js";import"../chunks/case-converter.js";import"../chunks/permissions.js";const ee=({initialPageSize:o=M,routePurchaseOrderDetails:l,setColumns:d,setRowsData:u,className:c="",withHeader:i=!0,withWrapper:p=!0,skeletonRowCount:n=5})=>{const h=x.CUSTOMER_APPROVAL_PURCHASE_ORDERS,e=q({headerText:"PurchaseOrders.requireApprovalPurchaseOrders.containerTitle",actionView:"PurchaseOrders.purchaseOrdersTable.actionView",poNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.poNumber",orderNumber:"PurchaseOrders.purchaseOrdersTable.tableColumns.orderNumber",createdDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdDate",updatedDate:"PurchaseOrders.purchaseOrdersTable.tableColumns.updatedDate",createdBy:"PurchaseOrders.purchaseOrdersTable.tableColumns.createdBy",status:"PurchaseOrders.purchaseOrdersTable.tableColumns.status",total:"PurchaseOrders.purchaseOrdersTable.tableColumns.total",action:"PurchaseOrders.purchaseOrdersTable.tableColumns.action",selectAllAriaLabel:"PurchaseOrders.purchaseOrdersTable.tableColumns.selectAllAriaLabel",noPurchaseOrders:"PurchaseOrders.requireApprovalPurchaseOrders.noPurchaseOrders",alertHeaderApprove:"PurchaseOrders.alertMessages.header.approve",alertHeaderReject:"PurchaseOrders.alertMessages.header.reject",alertHeaderError:"PurchaseOrders.alertMessages.header.error",alertDescriptionApprove:"PurchaseOrders.alertMessages.description.approve",alertDescriptionReject:"PurchaseOrders.alertMessages.description.reject",alertDescriptionError:"PurchaseOrders.alertMessages.description.error"}),{permissions:m,loadingPermissions:O}=S(),{totalCount:s,loading:a,tableConfig:t,paginationConfig:P,pageSizeConfig:b,selectedOrderIds:C,handleRejectSelected:T,handleApproveSelected:g,isRequireApprovalPOsView:f,alertMessageConfig:A}=E({view:h,routePurchaseOrderDetails:l,setColumns:d,setRowsData:u,initialPageSize:o,permissions:m,loadingPermissions:O,t:e});return v("div",{className:R(["require-approval-purchase-orders",c]),"data-testid":"require-approval-purchase-orders-container",children:[i?r(j,{headerText:e.headerText}):null,r(D,{header:f&&s>0?r(w,{loading:a,selectedCount:C.length,handleRejectSelected:T,handleApproveSelected:g}):null,totalCount:s,columns:t.columns,rows:t.rows,paginationConfig:P,loading:a,skeletonRowCount:n,pageSizeConfig:b,emptyTitle:e.noPurchaseOrders,alertMessageConfig:A,withWrapper:p})]})};export{ee as RequireApprovalPurchaseOrders,ee as default};
|
|
4
4
|
//# sourceMappingURL=RequireApprovalPurchaseOrders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequireApprovalPurchaseOrders.js","sources":["/@dropins/storefront-purchase-order/src/containers/RequireApprovalPurchaseOrders/RequireApprovalPurchaseOrders.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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport {\n PurchaseOrdersTable,\n PurchaseOrdersHeader,\n PurchaseOrdersTableActions,\n} from '@/b2b-purchase-order/components';\nimport {\n usePurchaseOrders,\n useCustomerRolePermissions,\n} from '@/b2b-purchase-order/hooks';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { defaultPageSizeConfig } from '@/b2b-purchase-order/configs';\nimport { EnumPurchaseOrdersView } from '@/b2b-purchase-order/types/api';\nimport { RequireApprovalPurchaseOrdersProps } from '@/b2b-purchase-order/types/containers';\n\nexport const RequireApprovalPurchaseOrders: Container<\n RequireApprovalPurchaseOrdersProps\n> = ({\n initialPageSize = defaultPageSizeConfig,\n routePurchaseOrderDetails,\n setColumns,\n setRowsData,\n className = '',\n withHeader = true,\n withWrapper = true,\n skeletonRowCount = 5,\n}) => {\n const view = EnumPurchaseOrdersView.CUSTOMER_APPROVAL_PURCHASE_ORDERS;\n\n const t = useText({\n headerText: 'PurchaseOrders.requireApprovalPurchaseOrders.containerTitle',\n actionView: 'PurchaseOrders.purchaseOrdersTable.actionView',\n poNumber: 'PurchaseOrders.purchaseOrdersTable.tableColumns.poNumber',\n orderNumber: 'PurchaseOrders.purchaseOrdersTable.tableColumns.orderNumber',\n createdDate: 'PurchaseOrders.purchaseOrdersTable.tableColumns.createdDate',\n updatedDate: 'PurchaseOrders.purchaseOrdersTable.tableColumns.updatedDate',\n createdBy: 'PurchaseOrders.purchaseOrdersTable.tableColumns.createdBy',\n status: 'PurchaseOrders.purchaseOrdersTable.tableColumns.status',\n total: 'PurchaseOrders.purchaseOrdersTable.tableColumns.total',\n action: 'PurchaseOrders.purchaseOrdersTable.tableColumns.action',\n selectAllAriaLabel:\n 'PurchaseOrders.purchaseOrdersTable.tableColumns.selectAllAriaLabel',\n noPurchaseOrders:\n 'PurchaseOrders.requireApprovalPurchaseOrders.noPurchaseOrders',\n alertHeaderApprove: 'PurchaseOrders.alertMessages.header.approve',\n alertHeaderReject: 'PurchaseOrders.alertMessages.header.reject',\n alertHeaderError: 'PurchaseOrders.alertMessages.header.error',\n alertDescriptionApprove: 'PurchaseOrders.alertMessages.description.approve',\n alertDescriptionReject: 'PurchaseOrders.alertMessages.description.reject',\n alertDescriptionError: 'PurchaseOrders.alertMessages.description.error',\n });\n\n const { permissions, loadingPermissions } = useCustomerRolePermissions();\n const {\n totalCount,\n loading,\n tableConfig,\n paginationConfig,\n pageSizeConfig,\n selectedOrderIds,\n handleRejectSelected,\n handleApproveSelected,\n isRequireApprovalPOsView,\n alertMessageConfig,\n } = usePurchaseOrders({\n view,\n routePurchaseOrderDetails,\n setColumns,\n setRowsData,\n initialPageSize,\n permissions,\n loadingPermissions,\n t,\n });\n\n return (\n <div\n className={classes(['require-approval-purchase-orders', className])}\n data-testid=\"require-approval-purchase-orders-container\"\n >\n {withHeader ? <PurchaseOrdersHeader headerText={t.headerText} /> : null}\n <PurchaseOrdersTable\n header={\n isRequireApprovalPOsView && totalCount > 0 ? (\n <PurchaseOrdersTableActions\n loading={loading}\n selectedCount={selectedOrderIds.length}\n handleRejectSelected={handleRejectSelected}\n handleApproveSelected={handleApproveSelected}\n />\n ) : null\n }\n totalCount={totalCount}\n columns={tableConfig.columns}\n rows={tableConfig.rows}\n paginationConfig={paginationConfig}\n loading={loading}\n skeletonRowCount={skeletonRowCount}\n pageSizeConfig={pageSizeConfig}\n emptyTitle={t.noPurchaseOrders}\n alertMessageConfig={alertMessageConfig}\n withWrapper={withWrapper}\n />\n </div>\n );\n};\n"],"names":["RequireApprovalPurchaseOrders","initialPageSize","defaultPageSizeConfig","routePurchaseOrderDetails","setColumns","setRowsData","className","withHeader","withWrapper","skeletonRowCount","view","EnumPurchaseOrdersView","t","useText","permissions","loadingPermissions","useCustomerRolePermissions","totalCount","loading","tableConfig","paginationConfig","pageSizeConfig","selectedOrderIds","handleRejectSelected","handleApproveSelected","isRequireApprovalPOsView","alertMessageConfig","usePurchaseOrders","jsxs","classes","jsx","PurchaseOrdersHeader","PurchaseOrdersTable","PurchaseOrdersTableActions"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequireApprovalPurchaseOrders.js","sources":["/@dropins/storefront-purchase-order/src/containers/RequireApprovalPurchaseOrders/RequireApprovalPurchaseOrders.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 { classes, Container } from '@adobe-commerce/elsie/lib';\nimport {\n PurchaseOrdersTable,\n PurchaseOrdersHeader,\n PurchaseOrdersTableActions,\n} from '@/b2b-purchase-order/components';\nimport {\n usePurchaseOrders,\n useCustomerRolePermissions,\n} from '@/b2b-purchase-order/hooks';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { defaultPageSizeConfig } from '@/b2b-purchase-order/configs';\nimport { EnumPurchaseOrdersView } from '@/b2b-purchase-order/types/api';\nimport { RequireApprovalPurchaseOrdersProps } from '@/b2b-purchase-order/types/containers';\n\nexport const RequireApprovalPurchaseOrders: Container<\n RequireApprovalPurchaseOrdersProps\n> = ({\n initialPageSize = defaultPageSizeConfig,\n routePurchaseOrderDetails,\n setColumns,\n setRowsData,\n className = '',\n withHeader = true,\n withWrapper = true,\n skeletonRowCount = 5,\n}) => {\n const view = EnumPurchaseOrdersView.CUSTOMER_APPROVAL_PURCHASE_ORDERS;\n\n const t = useText({\n headerText: 'PurchaseOrders.requireApprovalPurchaseOrders.containerTitle',\n actionView: 'PurchaseOrders.purchaseOrdersTable.actionView',\n poNumber: 'PurchaseOrders.purchaseOrdersTable.tableColumns.poNumber',\n orderNumber: 'PurchaseOrders.purchaseOrdersTable.tableColumns.orderNumber',\n createdDate: 'PurchaseOrders.purchaseOrdersTable.tableColumns.createdDate',\n updatedDate: 'PurchaseOrders.purchaseOrdersTable.tableColumns.updatedDate',\n createdBy: 'PurchaseOrders.purchaseOrdersTable.tableColumns.createdBy',\n status: 'PurchaseOrders.purchaseOrdersTable.tableColumns.status',\n total: 'PurchaseOrders.purchaseOrdersTable.tableColumns.total',\n action: 'PurchaseOrders.purchaseOrdersTable.tableColumns.action',\n selectAllAriaLabel:\n 'PurchaseOrders.purchaseOrdersTable.tableColumns.selectAllAriaLabel',\n noPurchaseOrders:\n 'PurchaseOrders.requireApprovalPurchaseOrders.noPurchaseOrders',\n alertHeaderApprove: 'PurchaseOrders.alertMessages.header.approve',\n alertHeaderReject: 'PurchaseOrders.alertMessages.header.reject',\n alertHeaderError: 'PurchaseOrders.alertMessages.header.error',\n alertDescriptionApprove: 'PurchaseOrders.alertMessages.description.approve',\n alertDescriptionReject: 'PurchaseOrders.alertMessages.description.reject',\n alertDescriptionError: 'PurchaseOrders.alertMessages.description.error',\n });\n\n const { permissions, loadingPermissions } = useCustomerRolePermissions();\n const {\n totalCount,\n loading,\n tableConfig,\n paginationConfig,\n pageSizeConfig,\n selectedOrderIds,\n handleRejectSelected,\n handleApproveSelected,\n isRequireApprovalPOsView,\n alertMessageConfig,\n } = usePurchaseOrders({\n view,\n routePurchaseOrderDetails,\n setColumns,\n setRowsData,\n initialPageSize,\n permissions,\n loadingPermissions,\n t,\n });\n\n return (\n <div\n className={classes(['require-approval-purchase-orders', className])}\n data-testid=\"require-approval-purchase-orders-container\"\n >\n {withHeader ? <PurchaseOrdersHeader headerText={t.headerText} /> : null}\n <PurchaseOrdersTable\n header={\n isRequireApprovalPOsView && totalCount > 0 ? (\n <PurchaseOrdersTableActions\n loading={loading}\n selectedCount={selectedOrderIds.length}\n handleRejectSelected={handleRejectSelected}\n handleApproveSelected={handleApproveSelected}\n />\n ) : null\n }\n totalCount={totalCount}\n columns={tableConfig.columns}\n rows={tableConfig.rows}\n paginationConfig={paginationConfig}\n loading={loading}\n skeletonRowCount={skeletonRowCount}\n pageSizeConfig={pageSizeConfig}\n emptyTitle={t.noPurchaseOrders}\n alertMessageConfig={alertMessageConfig}\n withWrapper={withWrapper}\n />\n </div>\n );\n};\n"],"names":["RequireApprovalPurchaseOrders","initialPageSize","defaultPageSizeConfig","routePurchaseOrderDetails","setColumns","setRowsData","className","withHeader","withWrapper","skeletonRowCount","view","EnumPurchaseOrdersView","t","useText","permissions","loadingPermissions","useCustomerRolePermissions","totalCount","loading","tableConfig","paginationConfig","pageSizeConfig","selectedOrderIds","handleRejectSelected","handleApproveSelected","isRequireApprovalPOsView","alertMessageConfig","usePurchaseOrders","jsxs","classes","jsx","PurchaseOrdersHeader","PurchaseOrdersTable","PurchaseOrdersTableActions"],"mappings":"66BAgCO,MAAMA,GAET,CAAC,CACH,gBAAAC,EAAkBC,EAClB,0BAAAC,EACA,WAAAC,EACA,YAAAC,EACA,UAAAC,EAAY,GACZ,WAAAC,EAAa,GACb,YAAAC,EAAc,GACd,iBAAAC,EAAmB,CACrB,IAAM,CACJ,MAAMC,EAAOC,EAAuB,kCAE9BC,EAAIC,EAAQ,CAChB,WAAY,8DACZ,WAAY,gDACZ,SAAU,2DACV,YAAa,8DACb,YAAa,8DACb,YAAa,8DACb,UAAW,4DACX,OAAQ,yDACR,MAAO,wDACP,OAAQ,yDACR,mBACE,qEACF,iBACE,gEACF,mBAAoB,8CACpB,kBAAmB,6CACnB,iBAAkB,4CAClB,wBAAyB,mDACzB,uBAAwB,kDACxB,sBAAuB,gDAAA,CACxB,EAEK,CAAE,YAAAC,EAAa,mBAAAC,CAAA,EAAuBC,EAAA,EACtC,CACJ,WAAAC,EACA,QAAAC,EACA,YAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,qBAAAC,EACA,sBAAAC,EACA,yBAAAC,EACA,mBAAAC,CAAA,EACEC,EAAkB,CACpB,KAAAjB,EACA,0BAAAP,EACA,WAAAC,EACA,YAAAC,EACA,gBAAAJ,EACA,YAAAa,EACA,mBAAAC,EACA,EAAAH,CAAA,CACD,EAED,OACEgB,EAAC,MAAA,CACC,UAAWC,EAAQ,CAAC,mCAAoCvB,CAAS,CAAC,EAClE,cAAY,6CAEX,SAAA,CAAAC,EAAauB,EAACC,EAAA,CAAqB,WAAYnB,EAAE,WAAY,EAAK,KACnEkB,EAACE,EAAA,CACC,OACEP,GAA4BR,EAAa,EACvCa,EAACG,EAAA,CACC,QAAAf,EACA,cAAeI,EAAiB,OAChC,qBAAAC,EACA,sBAAAC,CAAA,CAAA,EAEA,KAEN,WAAAP,EACA,QAASE,EAAY,QACrB,KAAMA,EAAY,KAClB,iBAAAC,EACA,QAAAF,EACA,iBAAAT,EACA,eAAAY,EACA,WAAYT,EAAE,iBACd,mBAAAc,EACA,YAAAlB,CAAA,CAAA,CACF,CAAA,CAAA,CAGN"}
|
package/containers/index.d.ts
CHANGED
|
@@ -20,5 +20,7 @@ export * from './RequireApprovalPurchaseOrders';
|
|
|
20
20
|
export * from './ApprovalRuleForm';
|
|
21
21
|
export * from './ApprovalRulesList';
|
|
22
22
|
export * from './PurchaseOrderConfirmation';
|
|
23
|
+
export * from './PurchaseOrderStatus';
|
|
23
24
|
export * from './ApprovalRuleDetails';
|
|
25
|
+
export * from './PurchaseOrderHistoryLog';
|
|
24
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -52,24 +52,238 @@ export interface PurchaseOrderModel {
|
|
|
52
52
|
message: string;
|
|
53
53
|
uid: string;
|
|
54
54
|
}>;
|
|
55
|
+
quote: QuoteProps | null;
|
|
55
56
|
order: {
|
|
56
57
|
orderNumber: string;
|
|
57
58
|
id: string;
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
}
|
|
61
|
+
type MoneyProps = {
|
|
62
|
+
value: number;
|
|
63
|
+
currency: string;
|
|
64
|
+
};
|
|
65
|
+
type OrderAddressProps = {
|
|
66
|
+
firstName: string;
|
|
67
|
+
lastName: string;
|
|
68
|
+
middleName: string;
|
|
69
|
+
city: string;
|
|
70
|
+
company: string;
|
|
71
|
+
country: string;
|
|
72
|
+
countryCode: string;
|
|
73
|
+
fax: string;
|
|
74
|
+
postCode: string;
|
|
75
|
+
prefix: string;
|
|
76
|
+
region: string;
|
|
77
|
+
regionId: string;
|
|
78
|
+
street: string[];
|
|
79
|
+
suffix: string;
|
|
80
|
+
telephone: string;
|
|
81
|
+
vatId: string;
|
|
82
|
+
customAttributes: any[];
|
|
83
|
+
};
|
|
84
|
+
type OrderItemProductProps = {
|
|
85
|
+
__typename: string;
|
|
86
|
+
uid: string;
|
|
87
|
+
onlyXLeftInStock: number;
|
|
88
|
+
stockStatus: string;
|
|
89
|
+
priceRange: {
|
|
90
|
+
maximumPrice: {
|
|
91
|
+
regularPrice: MoneyProps;
|
|
72
92
|
};
|
|
93
|
+
};
|
|
94
|
+
canonicalUrl: string;
|
|
95
|
+
urlKey: string;
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
sku: string;
|
|
99
|
+
image: string;
|
|
100
|
+
imageAlt: string;
|
|
101
|
+
productType: string;
|
|
102
|
+
thumbnail: {
|
|
103
|
+
label: string;
|
|
104
|
+
url: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
type GiftMessageProps = {
|
|
108
|
+
senderName: string;
|
|
109
|
+
recipientName: string;
|
|
110
|
+
message: string;
|
|
111
|
+
};
|
|
112
|
+
type GiftWrappingProps = {
|
|
113
|
+
design: string;
|
|
114
|
+
uid: string;
|
|
115
|
+
selected: boolean;
|
|
116
|
+
image: {
|
|
117
|
+
url: string;
|
|
118
|
+
label: string;
|
|
119
|
+
};
|
|
120
|
+
price: MoneyProps;
|
|
121
|
+
};
|
|
122
|
+
type TaxCalculationsProps = {
|
|
123
|
+
includeAndExcludeTax: {
|
|
124
|
+
originalPrice: MoneyProps;
|
|
125
|
+
baseOriginalPrice: MoneyProps;
|
|
126
|
+
baseDiscountedPrice: MoneyProps;
|
|
127
|
+
baseExcludingTax: MoneyProps;
|
|
128
|
+
};
|
|
129
|
+
excludeTax: {
|
|
130
|
+
originalPrice: MoneyProps;
|
|
131
|
+
baseOriginalPrice: MoneyProps;
|
|
132
|
+
baseDiscountedPrice: MoneyProps;
|
|
133
|
+
baseExcludingTax: MoneyProps;
|
|
134
|
+
};
|
|
135
|
+
includeTax: {
|
|
136
|
+
singleItemPrice: MoneyProps;
|
|
137
|
+
baseOriginalPrice: MoneyProps;
|
|
138
|
+
baseDiscountedPrice: MoneyProps;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
type ItemPricesProps = {
|
|
142
|
+
price: MoneyProps;
|
|
143
|
+
priceIncludingTax: MoneyProps;
|
|
144
|
+
originalPrice: MoneyProps;
|
|
145
|
+
originalPriceIncludingTax: MoneyProps;
|
|
146
|
+
discounts: any[];
|
|
147
|
+
};
|
|
148
|
+
type OrderItemProps = {
|
|
149
|
+
giftMessage: GiftMessageProps;
|
|
150
|
+
giftWrappingPrice: MoneyProps;
|
|
151
|
+
productGiftWrapping: GiftWrappingProps[];
|
|
152
|
+
taxCalculations: TaxCalculationsProps;
|
|
153
|
+
productSalePrice: MoneyProps;
|
|
154
|
+
status: string;
|
|
155
|
+
currentReturnOrderQuantity: number;
|
|
156
|
+
eligibleForReturn: boolean;
|
|
157
|
+
productSku: string;
|
|
158
|
+
type: string;
|
|
159
|
+
discounted: boolean;
|
|
160
|
+
id: string;
|
|
161
|
+
productName: string;
|
|
162
|
+
productUrlKey: string;
|
|
163
|
+
regularPrice: MoneyProps;
|
|
164
|
+
price: MoneyProps;
|
|
165
|
+
product: OrderItemProductProps;
|
|
166
|
+
selectedOptions: any[];
|
|
167
|
+
thumbnail: {
|
|
168
|
+
label: string;
|
|
169
|
+
url: string;
|
|
170
|
+
};
|
|
171
|
+
downloadableLinks: {
|
|
172
|
+
count: number;
|
|
173
|
+
result: string;
|
|
73
174
|
} | null;
|
|
74
|
-
|
|
175
|
+
prices: ItemPricesProps;
|
|
176
|
+
itemPrices: ItemPricesProps;
|
|
177
|
+
bundleOptions: Record<string, any> | null;
|
|
178
|
+
totalInclTax: MoneyProps;
|
|
179
|
+
priceInclTax: MoneyProps;
|
|
180
|
+
total: MoneyProps;
|
|
181
|
+
configurableOptions: Record<string, string> | undefined;
|
|
182
|
+
giftCard?: {
|
|
183
|
+
senderName: string;
|
|
184
|
+
senderEmail: string;
|
|
185
|
+
recipientEmail: string;
|
|
186
|
+
recipientName: string;
|
|
187
|
+
message: string;
|
|
188
|
+
};
|
|
189
|
+
quantityCanceled: number;
|
|
190
|
+
quantityInvoiced: number;
|
|
191
|
+
quantityOrdered: number;
|
|
192
|
+
quantityRefunded: number;
|
|
193
|
+
quantityReturned: number;
|
|
194
|
+
quantityShipped: number;
|
|
195
|
+
requestQuantity: number;
|
|
196
|
+
totalQuantity: number;
|
|
197
|
+
returnableQuantity: number;
|
|
198
|
+
quantityReturnRequested: number;
|
|
199
|
+
};
|
|
200
|
+
type PaymentMethodProps = {
|
|
201
|
+
code: string;
|
|
202
|
+
name: string;
|
|
203
|
+
};
|
|
204
|
+
type ShippingProps = {
|
|
205
|
+
code: string;
|
|
206
|
+
amount: number;
|
|
207
|
+
currency: string;
|
|
208
|
+
};
|
|
209
|
+
type TaxProps = {
|
|
210
|
+
amount: MoneyProps;
|
|
211
|
+
rate: number;
|
|
212
|
+
title: string;
|
|
213
|
+
};
|
|
214
|
+
type AppliedGiftCardProps = {
|
|
215
|
+
code: string;
|
|
216
|
+
appliedBalance: MoneyProps;
|
|
217
|
+
};
|
|
218
|
+
type GiftOptionsProps = {
|
|
219
|
+
giftWrappingForItems: MoneyProps;
|
|
220
|
+
giftWrappingForItemsInclTax: MoneyProps;
|
|
221
|
+
giftWrappingForOrder: MoneyProps;
|
|
222
|
+
giftWrappingForOrderInclTax: MoneyProps;
|
|
223
|
+
printedCard: MoneyProps;
|
|
224
|
+
printedCardInclTax: MoneyProps;
|
|
225
|
+
};
|
|
226
|
+
type ShipmentItemProps = {
|
|
227
|
+
id: string;
|
|
228
|
+
productName: string;
|
|
229
|
+
productSku: string;
|
|
230
|
+
quantityShipped: number;
|
|
231
|
+
orderItem: OrderItemProps;
|
|
232
|
+
};
|
|
233
|
+
type ShipmentTrackingProps = {
|
|
234
|
+
carrier: string;
|
|
235
|
+
number: string;
|
|
236
|
+
title: string;
|
|
237
|
+
};
|
|
238
|
+
type ShipmentProps = {
|
|
239
|
+
id: string;
|
|
240
|
+
number: string;
|
|
241
|
+
tracking: ShipmentTrackingProps[];
|
|
242
|
+
comments: {
|
|
243
|
+
message: string;
|
|
244
|
+
timestamp: string;
|
|
245
|
+
}[];
|
|
246
|
+
items: ShipmentItemProps[];
|
|
247
|
+
};
|
|
248
|
+
type QuoteProps = {
|
|
249
|
+
giftReceiptIncluded: boolean;
|
|
250
|
+
printedCardIncluded: boolean;
|
|
251
|
+
giftWrappingOrder: {
|
|
252
|
+
price: MoneyProps;
|
|
253
|
+
uid: string;
|
|
254
|
+
};
|
|
255
|
+
placeholderImage: string;
|
|
256
|
+
returnNumber: string | undefined;
|
|
257
|
+
id: string;
|
|
258
|
+
orderStatusChangeDate: string | undefined;
|
|
259
|
+
number: string;
|
|
260
|
+
email: string;
|
|
261
|
+
token: string | undefined;
|
|
262
|
+
status: string;
|
|
263
|
+
isVirtual: boolean;
|
|
264
|
+
totalQuantity: number;
|
|
265
|
+
shippingMethod: string;
|
|
266
|
+
carrier: string;
|
|
267
|
+
orderDate: string;
|
|
268
|
+
returns: any[];
|
|
269
|
+
discounts: any[];
|
|
270
|
+
coupons: any[];
|
|
271
|
+
payments: PaymentMethodProps[];
|
|
272
|
+
shipping: ShippingProps;
|
|
273
|
+
shipments: ShipmentProps[];
|
|
274
|
+
items: OrderItemProps[];
|
|
275
|
+
totalGiftCard: MoneyProps;
|
|
276
|
+
grandTotal: MoneyProps;
|
|
277
|
+
totalShipping: MoneyProps;
|
|
278
|
+
subtotalExclTax: MoneyProps;
|
|
279
|
+
subtotalInclTax: MoneyProps;
|
|
280
|
+
totalTax: MoneyProps;
|
|
281
|
+
shippingAddress: OrderAddressProps | null;
|
|
282
|
+
totalGiftOptions: GiftOptionsProps;
|
|
283
|
+
billingAddress: OrderAddressProps | null;
|
|
284
|
+
availableActions: string[];
|
|
285
|
+
taxes: TaxProps[];
|
|
286
|
+
appliedGiftCards: AppliedGiftCardProps[];
|
|
287
|
+
};
|
|
288
|
+
export {};
|
|
75
289
|
//# sourceMappingURL=purchase-order-model.d.ts.map
|
package/hooks/index.d.ts
CHANGED
|
@@ -19,4 +19,6 @@ export * from './useCustomerRolePermissions';
|
|
|
19
19
|
export * from './useApprovalRuleForm';
|
|
20
20
|
export * from './useApprovalRuleDetails';
|
|
21
21
|
export * from './useApprovalRulesList';
|
|
22
|
+
export * from './usePurchaseOrderStatus';
|
|
23
|
+
export * from './usePurchaseOrderData';
|
|
22
24
|
//# sourceMappingURL=index.d.ts.map
|