@dropins/storefront-requisition-list 0.5.0-beta → 0.6.0-beta
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/deleteRequisitionListItems/deleteRequisitionListItems.d.ts +1 -1
- package/api/updateRequisitionListItems/updateRequisitionListItems.d.ts +1 -1
- package/chunks/PageSizePicker.js +4 -0
- package/chunks/PageSizePicker.js.map +1 -0
- package/chunks/PageSizePicker2.js +1 -1
- package/chunks/PageSizePicker2.js.map +1 -1
- package/chunks/addRequisitionListItemsToCart.js +18 -14
- package/chunks/addRequisitionListItemsToCart.js.map +1 -1
- package/containers/RequisitionListGrid.js +1 -1
- package/containers/RequisitionListGrid.js.map +1 -1
- package/containers/RequisitionListNames/RequisitionListNames.d.ts +1 -0
- package/containers/RequisitionListNames.js +4 -4
- package/containers/RequisitionListNames.js.map +1 -1
- package/containers/RequisitionListView.js +1 -1
- package/containers/RequisitionListView.js.map +1 -1
- package/hooks/useRequisitionListAlert.d.ts +1 -0
- package/i18n/en_US.json.d.ts +3 -1
- package/package.json +1 -1
- package/render.js +3 -3
- package/render.js.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
2
|
|
|
3
|
-
export declare const deleteRequisitionListItems: (requisitionListUid: string, items: Array<string
|
|
3
|
+
export declare const deleteRequisitionListItems: (requisitionListUid: string, items: Array<string>, pageSize: number, currentPage: number) => Promise<RequisitionList | null>;
|
|
4
4
|
//# sourceMappingURL=deleteRequisitionListItems.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
2
|
|
|
3
|
-
export declare const updateRequisitionListItems: (requisitionListUid: string, requisitionListItems: Array<UpdateRequisitionListItemsInput
|
|
3
|
+
export declare const updateRequisitionListItems: (requisitionListUid: string, requisitionListItems: Array<UpdateRequisitionListItemsInput>, pageSize: number, currentPage: number) => Promise<RequisitionList | null>;
|
|
4
4
|
type UpdateRequisitionListItemsInput = {
|
|
5
5
|
item_id: string;
|
|
6
6
|
quantity?: number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsxs as i,jsx as a}from"@dropins/tools/preact-jsx-runtime.js";import{Icon as n,Picker as m}from"@dropins/tools/components.js";import{classes as p}from"@dropins/tools/lib.js";import"./PageSizePicker2.js";import*as r from"@dropins/tools/preact-compat.js";import{useText as g}from"@dropins/tools/i18n.js";const d=L=>r.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...L},r.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"currentColor"})),V=({className:L,textContent:e,...s})=>i("div",{className:p(["empty-list",L]),"data-testid":"empty-list",...s,children:[a(n,{source:d,size:"64",stroke:"2"}),e&&a("h4",{children:e})]}),u=({currentPageSize:L,onPageSizeChange:e,disabled:s=!1,pageSizeOptions:M=[10,25,50,100]})=>{const Z=g({itemsPerPage:"RequisitionList.PageSizePicker.itemsPerPage"}),l=t=>{const c=t.target,C=parseInt(c.value,10);e(C)},o=M.map(t=>({value:t.toString(),text:t.toString()}));return i("div",{className:"page-size-picker",children:[i("label",{htmlFor:"page-size-select",className:"page-size-picker__label",children:[Z.itemsPerPage,":"]}),a(m,{id:"page-size-select",value:L.toString(),handleSelect:l,disabled:s,className:"page-size-picker__select","data-testid":"page-size-picker-select",options:o,placeholder:"",variant:"secondary",size:"small"})]})};export{V as E,u as P};
|
|
4
|
+
//# sourceMappingURL=PageSizePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageSizePicker.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/EmptyBox.svg","/@dropins/storefront-requisition-list/src/components/EmptyList/EmptyList.tsx","/@dropins/storefront-requisition-list/src/components/PageSizePicker/PageSizePicker.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgEmptyBox = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z\", fill: \"currentColor\" }));\nexport default SvgEmptyBox;\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 { FunctionComponent } from 'preact';\nimport { Icon } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { EmptyBox } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/EmptyList/EmptyList.css';\n\nexport interface EmptyListProps {\n className?: string;\n textContent?: string | null;\n}\n\nexport const EmptyList: FunctionComponent<EmptyListProps> = ({\n className,\n textContent,\n ...props\n}) => {\n return (\n <div\n className={classes(['empty-list', className])}\n data-testid=\"empty-list\"\n {...props}\n >\n <Icon source={EmptyBox} size={'64'} stroke={'2'} />\n {textContent && <h4>{textContent}</h4>}\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 *******************************************************************/\nimport { HTMLAttributes } from 'preact/compat';\nimport { Picker } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/requisitionList/components/PageSizePicker/PageSizePicker.css';\n\nexport interface PageSizePickerProps extends HTMLAttributes<HTMLDivElement> {\n currentPageSize: number;\n onPageSizeChange: (pageSize: number) => void;\n disabled?: boolean;\n pageSizeOptions?: number[];\n}\n\nexport const PageSizePicker = ({\n currentPageSize,\n onPageSizeChange,\n disabled = false,\n pageSizeOptions = [10, 25, 50, 100],\n}: PageSizePickerProps) => {\n const translations = useText({\n itemsPerPage: `RequisitionList.PageSizePicker.itemsPerPage`,\n });\n\n const handlePageSizeChange = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const newPageSize = parseInt(target.value, 10);\n onPageSizeChange(newPageSize);\n };\n\n const options = pageSizeOptions.map((size) => ({\n value: size.toString(),\n text: size.toString(),\n }));\n\n return (\n <div className=\"page-size-picker\">\n <label htmlFor=\"page-size-select\" className=\"page-size-picker__label\">\n {translations.itemsPerPage}:\n </label>\n <Picker\n id=\"page-size-select\"\n value={currentPageSize.toString()}\n handleSelect={handlePageSizeChange}\n disabled={disabled}\n className=\"page-size-picker__select\"\n data-testid=\"page-size-picker-select\"\n options={options}\n placeholder=\"\"\n variant=\"secondary\"\n size=\"small\"\n />\n </div>\n );\n};\n"],"names":["SvgEmptyBox","props","React","EmptyList","className","textContent","jsxs","classes","jsx","Icon","EmptyBox","PageSizePicker","currentPageSize","onPageSizeChange","disabled","pageSizeOptions","translations","useText","handlePageSizeChange","event","target","newPageSize","options","size","Picker"],"mappings":"qTACA,MAAMA,EAAeC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAA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1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import
|
|
3
|
+
import{useState as d,useMemo as c,useCallback as A}from"@dropins/tools/preact-compat.js";import{useText as p}from"@dropins/tools/i18n.js";function D(i){const[n,s]=d(null),r=p({errorCreate:"RequisitionList.RequisitionListAlert.errorCreate",successCreate:"RequisitionList.RequisitionListAlert.successCreate",errorDeleteItem:"RequisitionList.RequisitionListAlert.errorDeleteItem",successDeleteItem:"RequisitionList.RequisitionListAlert.successDeleteItem",errorDeleteReqList:"RequisitionList.RequisitionListAlert.errorDeleteReqList",successDeleteReqList:"RequisitionList.RequisitionListAlert.successDeleteReqList",errorAddToCart:"RequisitionList.RequisitionListAlert.errorAddToCart",successAddToCart:"RequisitionList.RequisitionListAlert.successAddToCart",errorUpdateQuantity:"RequisitionList.RequisitionListAlert.errorUpdateQuantity",successUpdateQuantity:"RequisitionList.RequisitionListAlert.successUpdateQuantity",errorUpdate:"RequisitionList.RequisitionListAlert.errorUpdate",successUpdate:"RequisitionList.RequisitionListAlert.successUpdate",errorMove:"RequisitionList.RequisitionListAlert.errorMove",successMove:"RequisitionList.RequisitionListAlert.successMove",errorAddToRequisitionList:"RequisitionList.RequisitionListAlert.errorAddToRequisitionList",successAddToRequisitionList:"RequisitionList.RequisitionListAlert.successAddToRequisitionList"}),e=c(()=>({...r,...i}),[r,i]),o=c(()=>({create:{requisitionList:{success:e.successCreate,error:e.errorCreate}},add:{product:{success:e.successAddToRequisitionList,error:e.errorAddToRequisitionList}},update:{product:{success:e.successUpdateQuantity,error:e.errorUpdateQuantity},requisitionList:{success:e.successUpdate,error:e.errorUpdate}},delete:{product:{success:e.successDeleteItem,error:e.errorDeleteItem},requisitionList:{success:e.successDeleteReqList,error:e.errorDeleteReqList}},move:{product:{success:e.successMove,error:e.errorMove}}}),[e]),q=A(L=>{const{type:u,action:R,context:a,skus:t}=L;s({type:u,description:o[R][a][u],sku:t==null?void 0:t[0]});const l=setTimeout(()=>{s(null)},5e3);return()=>clearTimeout(l)},[o]);return{alert:n,setAlert:s,handleRequisitionListAlert:q}}export{D as u};
|
|
4
4
|
//# sourceMappingURL=PageSizePicker2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageSizePicker2.js","sources":["/@dropins/storefront-requisition-list/src/hooks/useRequisitionListAlert.tsx","../../node_modules/@adobe-commerce/elsie/src/icons/EmptyBox.svg","/@dropins/storefront-requisition-list/src/components/EmptyList/EmptyList.tsx","/@dropins/storefront-requisition-list/src/components/PageSizePicker/PageSizePicker.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 { useCallback, useMemo, useState } from 'preact/compat';\nimport { RequisitionListActionPayload } from 'adobe-commerce/event-bus';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface Alert {\n type: string;\n description: string;\n action?: string;\n}\n\nexport function useRequisitionListAlert(\n translationsOverride?: Record<string, string>\n) {\n const [alert, setAlert] = useState<Alert | null>(null);\n\n const defaultTranslations = useText({\n errorCreate: `RequisitionList.RequisitionListAlert.errorCreate`,\n successCreate: `RequisitionList.RequisitionListAlert.successCreate`,\n errorDeleteItem: `RequisitionList.RequisitionListAlert.errorDeleteItem`,\n successDeleteItem: `RequisitionList.RequisitionListAlert.successDeleteItem`,\n errorDeleteReqList: `RequisitionList.RequisitionListAlert.errorDeleteReqList`,\n successDeleteReqList: `RequisitionList.RequisitionListAlert.successDeleteReqList`,\n errorAddToCart: `RequisitionList.RequisitionListAlert.errorAddToCart`,\n successAddToCart: `RequisitionList.RequisitionListAlert.successAddToCart`,\n errorUpdateQuantity: `RequisitionList.RequisitionListAlert.errorUpdateQuantity`,\n successUpdateQuantity: `RequisitionList.RequisitionListAlert.successUpdateQuantity`,\n errorUpdate: `RequisitionList.RequisitionListAlert.errorUpdate`,\n successUpdate: `RequisitionList.RequisitionListAlert.successUpdate`,\n errorMove: `RequisitionList.RequisitionListAlert.errorMove`,\n successMove: `RequisitionList.RequisitionListAlert.successMove`,\n });\n\n const translations = useMemo(\n () => ({\n ...defaultTranslations,\n ...translationsOverride,\n }),\n [defaultTranslations, translationsOverride]\n );\n\n const messages = useMemo(\n () => ({\n create: {\n // adding context for consistency, although 'create' action only applies to requisition lists\n requisitionList: {\n success: translations.successCreate,\n error: translations.errorCreate,\n },\n },\n add: {\n product: {\n success: translations.successAddToRequisitionList,\n error: translations.errorAddToRequisitionList,\n },\n },\n update: {\n product: {\n success: translations.successUpdateQuantity,\n error: translations.errorUpdateQuantity,\n },\n requisitionList: {\n success: translations.successUpdate,\n error: translations.errorUpdate,\n },\n },\n delete: {\n product: {\n success: translations.successDeleteItem,\n error: translations.errorDeleteItem,\n },\n requisitionList: {\n success: translations.successDeleteReqList,\n error: translations.errorDeleteReqList,\n },\n },\n move: {\n // adding context for consistency, although 'move' action only applies to products\n product: {\n success: translations.successMove,\n error: translations.errorMove,\n },\n },\n }),\n [translations]\n );\n\n const handleRequisitionListAlert = useCallback(\n (payload: RequisitionListActionPayload) => {\n const { type, action, context } = payload;\n setAlert({ type, description: messages[action][context][type] });\n\n const timer = setTimeout(() => {\n setAlert(null);\n }, 5000);\n\n return () => clearTimeout(timer);\n },\n [messages]\n );\n\n return { alert, setAlert, handleRequisitionListAlert };\n}\n","import * as React from \"react\";\nconst SvgEmptyBox = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z\", fill: \"currentColor\" }));\nexport default SvgEmptyBox;\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 { FunctionComponent } from 'preact';\nimport { Icon } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { EmptyBox } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/EmptyList/EmptyList.css';\n\nexport interface EmptyListProps {\n className?: string;\n textContent?: string | null;\n}\n\nexport const EmptyList: FunctionComponent<EmptyListProps> = ({\n className,\n textContent,\n ...props\n}) => {\n return (\n <div\n className={classes(['empty-list', className])}\n data-testid=\"empty-list\"\n {...props}\n >\n <Icon source={EmptyBox} size={'64'} stroke={'2'} />\n {textContent && <h4>{textContent}</h4>}\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 *******************************************************************/\nimport { HTMLAttributes } from 'preact/compat';\nimport { Picker } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport '@/requisitionList/components/PageSizePicker/PageSizePicker.css';\n\nexport interface PageSizePickerProps extends HTMLAttributes<HTMLDivElement> {\n currentPageSize: number;\n onPageSizeChange: (pageSize: number) => void;\n disabled?: boolean;\n pageSizeOptions?: number[];\n}\n\nexport const PageSizePicker = ({\n currentPageSize,\n onPageSizeChange,\n disabled = false,\n pageSizeOptions = [10, 25, 50, 100],\n}: PageSizePickerProps) => {\n const translations = useText({\n itemsPerPage: `RequisitionList.PageSizePicker.itemsPerPage`,\n });\n\n const handlePageSizeChange = (event: Event) => {\n const target = event.target as HTMLSelectElement;\n const newPageSize = parseInt(target.value, 10);\n onPageSizeChange(newPageSize);\n };\n\n const options = pageSizeOptions.map((size) => ({\n value: size.toString(),\n text: size.toString(),\n }));\n\n return (\n <div className=\"page-size-picker\">\n <label htmlFor=\"page-size-select\" className=\"page-size-picker__label\">\n {translations.itemsPerPage}:\n </label>\n <Picker\n id=\"page-size-select\"\n value={currentPageSize.toString()}\n handleSelect={handlePageSizeChange}\n disabled={disabled}\n className=\"page-size-picker__select\"\n data-testid=\"page-size-picker-select\"\n options={options}\n placeholder=\"\"\n variant=\"secondary\"\n size=\"small\"\n />\n </div>\n );\n};\n"],"names":["useRequisitionListAlert","translationsOverride","alert","setAlert","useState","defaultTranslations","useText","translations","useMemo","messages","handleRequisitionListAlert","useCallback","payload","type","action","context","timer","SvgEmptyBox","props","React","EmptyList","className","textContent","jsxs","classes","jsx","Icon","EmptyBox","PageSizePicker","currentPageSize","onPageSizeChange","disabled","pageSizeOptions","handlePageSizeChange","event","target","newPageSize","options","size","Picker"],"mappings":"6YA2BO,SAASA,EACdC,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAuB,IAAI,EAE/CC,EAAsBC,EAAQ,CAClC,YAAa,mDACb,cAAe,qDACf,gBAAiB,uDACjB,kBAAmB,yDACnB,mBAAoB,0DACpB,qBAAsB,4DACtB,eAAgB,sDAChB,iBAAkB,wDAClB,oBAAqB,2DACrB,sBAAuB,6DACvB,YAAa,mDACb,cAAe,qDACf,UAAW,iDACX,YAAa,kDAAA,CACd,EAEKC,EAAeC,EACnB,KAAO,CACL,GAAGH,EACH,GAAGJ,CAAA,GAEL,CAACI,EAAqBJ,CAAoB,CAC5C,EAEMQ,EAAWD,EACf,KAAO,CACL,OAAQ,CAEN,gBAAiB,CACf,QAASD,EAAa,cACtB,MAAOA,EAAa,WAAA,CAExB,EACA,IAAK,CACH,QAAS,CACP,QAASA,EAAa,4BACtB,MAAOA,EAAa,yBAAA,CAExB,EACA,OAAQ,CACN,QAAS,CACP,QAASA,EAAa,sBACtB,MAAOA,EAAa,mBACtB,EACA,gBAAiB,CACf,QAASA,EAAa,cACtB,MAAOA,EAAa,WAAA,CAExB,EACA,OAAQ,CACN,QAAS,CACP,QAASA,EAAa,kBACtB,MAAOA,EAAa,eACtB,EACA,gBAAiB,CACf,QAASA,EAAa,qBACtB,MAAOA,EAAa,kBAAA,CAExB,EACA,KAAM,CAEJ,QAAS,CACP,QAASA,EAAa,YACtB,MAAOA,E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EMC,EAAUL,EAAgB,IAAKM,IAAU,CAC7C,MAAOA,EAAK,SAAS,EACrB,KAAMA,EAAK,SAAS,CAAA,EACpB,EAGA,OAAAf,EAAC,MAAI,CAAA,UAAU,mBACb,SAAA,CAAAA,EAAC,QAAM,CAAA,QAAQ,mBAAmB,UAAU,0BACzC,SAAA,CAAahB,EAAA,aAAa,GAAA,EAC7B,EACAkB,EAACc,EAAA,CACC,GAAG,mBACH,MAAOV,EAAgB,SAAS,EAChC,aAAcI,EACd,SAAAF,EACA,UAAU,2BACV,cAAY,0BACZ,QAAAM,EACA,YAAY,GACZ,QAAQ,YACR,KAAK,OAAA,CAAA,CACP,EACF,CAEJ","x_google_ignoreList":[1]}
|
|
1
|
+
{"version":3,"file":"PageSizePicker2.js","sources":["/@dropins/storefront-requisition-list/src/hooks/useRequisitionListAlert.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 { useCallback, useMemo, useState } from 'preact/compat';\nimport { RequisitionListActionPayload } from 'adobe-commerce/event-bus';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface Alert {\n type: string;\n description: string;\n action?: string;\n sku?: string;\n}\n\nexport function useRequisitionListAlert(\n translationsOverride?: Record<string, string>\n) {\n const [alert, setAlert] = useState<Alert | null>(null);\n\n const defaultTranslations = useText({\n errorCreate: `RequisitionList.RequisitionListAlert.errorCreate`,\n successCreate: `RequisitionList.RequisitionListAlert.successCreate`,\n errorDeleteItem: `RequisitionList.RequisitionListAlert.errorDeleteItem`,\n successDeleteItem: `RequisitionList.RequisitionListAlert.successDeleteItem`,\n errorDeleteReqList: `RequisitionList.RequisitionListAlert.errorDeleteReqList`,\n successDeleteReqList: `RequisitionList.RequisitionListAlert.successDeleteReqList`,\n errorAddToCart: `RequisitionList.RequisitionListAlert.errorAddToCart`,\n successAddToCart: `RequisitionList.RequisitionListAlert.successAddToCart`,\n errorUpdateQuantity: `RequisitionList.RequisitionListAlert.errorUpdateQuantity`,\n successUpdateQuantity: `RequisitionList.RequisitionListAlert.successUpdateQuantity`,\n errorUpdate: `RequisitionList.RequisitionListAlert.errorUpdate`,\n successUpdate: `RequisitionList.RequisitionListAlert.successUpdate`,\n errorMove: `RequisitionList.RequisitionListAlert.errorMove`,\n successMove: `RequisitionList.RequisitionListAlert.successMove`,\n errorAddToRequisitionList: `RequisitionList.RequisitionListAlert.errorAddToRequisitionList`,\n successAddToRequisitionList: `RequisitionList.RequisitionListAlert.successAddToRequisitionList`,\n });\n\n const translations = useMemo(\n () => ({\n ...defaultTranslations,\n ...translationsOverride,\n }),\n [defaultTranslations, translationsOverride]\n );\n\n const messages = useMemo(\n () => ({\n create: {\n // adding context for consistency, although 'create' action only applies to requisition lists\n requisitionList: {\n success: translations.successCreate,\n error: translations.errorCreate,\n },\n },\n add: {\n product: {\n success: translations.successAddToRequisitionList,\n error: translations.errorAddToRequisitionList,\n },\n },\n update: {\n product: {\n success: translations.successUpdateQuantity,\n error: translations.errorUpdateQuantity,\n },\n requisitionList: {\n success: translations.successUpdate,\n error: translations.errorUpdate,\n },\n },\n delete: {\n product: {\n success: translations.successDeleteItem,\n error: translations.errorDeleteItem,\n },\n requisitionList: {\n success: translations.successDeleteReqList,\n error: translations.errorDeleteReqList,\n },\n },\n move: {\n // adding context for consistency, although 'move' action only applies to products\n product: {\n success: translations.successMove,\n error: translations.errorMove,\n },\n },\n }),\n [translations]\n );\n\n const handleRequisitionListAlert = useCallback(\n (payload: RequisitionListActionPayload) => {\n const { type, action, context, skus } = payload;\n setAlert({\n type,\n description: messages[action][context][type],\n sku: skus?.[0],\n });\n\n const timer = setTimeout(() => {\n setAlert(null);\n }, 5000);\n\n return () => clearTimeout(timer);\n },\n [messages]\n );\n\n return { alert, setAlert, handleRequisitionListAlert };\n}\n"],"names":["useRequisitionListAlert","translationsOverride","alert","setAlert","useState","defaultTranslations","useText","translations","useMemo","messages","handleRequisitionListAlert","useCallback","payload","type","action","context","skus","timer"],"mappings":"0IA4BO,SAASA,EACdC,EACA,CACA,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAuB,IAAI,EAE/CC,EAAsBC,EAAQ,CAClC,YAAa,mDACb,cAAe,qDACf,gBAAiB,uDACjB,kBAAmB,yDACnB,mBAAoB,0DACpB,qBAAsB,4DACtB,eAAgB,sDAChB,iBAAkB,wDAClB,oBAAqB,2DACrB,sBAAuB,6DACvB,YAAa,mDACb,cAAe,qDACf,UAAW,iDACX,YAAa,mDACb,0BAA2B,iEAC3B,4BAA6B,kEAAA,CAC9B,EAEKC,EAAeC,EACnB,KAAO,CACL,GAAGH,EACH,GAAGJ,CAAA,GAEL,CAACI,EAAqBJ,CAAoB,CAC5C,EAEMQ,EAAWD,EACf,KAAO,CACL,OAAQ,CAEN,gBAAiB,CACf,QAASD,EAAa,cACtB,MAAOA,EAAa,WAAA,CAExB,EACA,IAAK,CACH,QAAS,CACP,QAASA,EAAa,4BACtB,MAAOA,EAAa,yBAAA,CAExB,EACA,OAAQ,CACN,QAAS,CACP,QAASA,EAAa,sBACtB,MAAOA,EAAa,mBACtB,EACA,gBAAiB,CACf,QAASA,EAAa,cACtB,MAAOA,EAAa,WAAA,CAExB,EACA,OAAQ,CACN,QAAS,CACP,QAASA,EAAa,kBACtB,MAAOA,EAAa,eACtB,EACA,gBAAiB,CACf,QAASA,EAAa,qBACtB,MAAOA,EAAa,kBAAA,CAExB,EACA,KAAM,CAEJ,QAAS,CACP,QAASA,EAAa,YACtB,MAAOA,EAAa,SAAA,CACtB,CACF,GAEF,CAACA,CAAY,CACf,EAEMG,EAA6BC,EAChCC,GAA0C,CACzC,KAAM,CAAE,KAAAC,EAAM,OAAAC,EAAQ,QAAAC,EAAS,KAAAC,CAAS,EAAAJ,EAC/BT,EAAA,CACP,KAAAU,EACA,YAAaJ,EAASK,CAAM,EAAEC,CAAO,EAAEF,CAAI,EAC3C,IAAKG,GAAA,YAAAA,EAAO,EAAC,CACd,EAEK,MAAAC,EAAQ,WAAW,IAAM,CAC7Bd,EAAS,IAAI,GACZ,GAAI,EAEA,MAAA,IAAM,aAAac,CAAK,CACjC,EACA,CAACR,CAAQ,CACX,EAEO,MAAA,CAAE,MAAAP,EAAO,SAAAC,EAAU,2BAAAO,CAA2B,CACvD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{R as I,f as
|
|
3
|
+
import{R as I,f as o,h as a,t as _}from"./transform-requisition-list.js";import{R as l}from"./RequisitionListItemsFragment.graphql.js";import{events as T}from"@dropins/tools/event-bus.js";function m(i){var e;return{sku:i.sku,parent_sku:i.sku,name:i.name,price:i.price,shortDescription:i.shortDescription||"",metaDescription:i.metaDescription||"",metaKeyword:i.metaKeyword||"",metaTitle:i.metaTitle||"",description:i.description||"",addToCartAllowed:i.addToCartAllowed,url:i.url||"",urlKey:i.urlKey||"",externalId:i.externalId||"",images:((e=i.images)==null?void 0:e.map(t=>({url:t.url,label:t.label||"",roles:t.roles||[]})))||[]}}function c(i){return i!=null&&i.length?i.map(m):[]}const R=`
|
|
4
4
|
query GET_REQUISITION_LIST_QUERY(
|
|
5
5
|
$requisitionListUid: String,
|
|
6
6
|
$currentPage: Int = 1,
|
|
@@ -23,12 +23,14 @@ import{R as I,f as n,h as u,t as a}from"./transform-requisition-list.js";import{
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
${
|
|
26
|
+
${l}
|
|
27
27
|
${I}
|
|
28
|
-
`,O=async(i,e,t)=>
|
|
28
|
+
`,O=async(i,e,t)=>o(R,{variables:{requisitionListUid:i,currentPage:e,pageSize:t}}).then(({errors:r,data:s})=>{var u;if(r)return a(r);if(!((u=s==null?void 0:s.customer)!=null&&u.requisition_lists))return null;const n=_(s.customer.requisition_lists.items[0]);return T.emit("requisitionList/data",n),n}),d=`
|
|
29
29
|
mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(
|
|
30
30
|
$requisitionListUid: ID!,
|
|
31
31
|
$requisitionListItems: [UpdateRequisitionListItemsInput!]!,
|
|
32
|
+
$pageSize: Int = 20,
|
|
33
|
+
$currentPage: Int = 1
|
|
32
34
|
) {
|
|
33
35
|
updateRequisitionListItems(
|
|
34
36
|
requisitionListUid: $requisitionListUid
|
|
@@ -36,18 +38,20 @@ ${I}
|
|
|
36
38
|
) {
|
|
37
39
|
requisition_list {
|
|
38
40
|
...REQUISITION_LIST_FRAGMENT
|
|
39
|
-
items {
|
|
41
|
+
items(pageSize: $pageSize, currentPage: $currentPage) {
|
|
40
42
|
...REQUISITION_LIST_ITEMS_FRAGMENT
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
${I}
|
|
46
|
-
${
|
|
47
|
-
`,A=async(i,e)=>
|
|
48
|
+
${l}
|
|
49
|
+
`,A=async(i,e,t,r)=>o(d,{variables:{requisitionListUid:i,requisitionListItems:e,pageSize:t,currentPage:r}}).then(({errors:s,data:n})=>{if(s)return a(s);const u=_(n.updateRequisitionListItems.requisition_list);return T.emit("requisitionList/data",u),u}),E=`
|
|
48
50
|
mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(
|
|
49
51
|
$requisitionListUid: ID!,
|
|
50
|
-
$requisitionListItemUids: [ID!]
|
|
52
|
+
$requisitionListItemUids: [ID!]!,
|
|
53
|
+
$pageSize: Int = 20,
|
|
54
|
+
$currentPage: Int = 1
|
|
51
55
|
) {
|
|
52
56
|
deleteRequisitionListItems(
|
|
53
57
|
requisitionListUid: $requisitionListUid
|
|
@@ -55,15 +59,15 @@ ${_}
|
|
|
55
59
|
) {
|
|
56
60
|
requisition_list {
|
|
57
61
|
...REQUISITION_LIST_FRAGMENT
|
|
58
|
-
items {
|
|
62
|
+
items(pageSize: $pageSize, currentPage: $currentPage) {
|
|
59
63
|
...REQUISITION_LIST_ITEMS_FRAGMENT
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
${I}
|
|
65
|
-
${
|
|
66
|
-
`,
|
|
69
|
+
${l}
|
|
70
|
+
`,g=async(i,e,t,r)=>o(E,{variables:{requisitionListUid:i,requisitionListItemUids:e,pageSize:t,currentPage:r}}).then(({errors:s,data:n})=>{if(s)return a(s);const u=_(n.deleteRequisitionListItems.requisition_list);return T.emit("requisitionList/data",u),u}),S=`
|
|
67
71
|
fragment PRODUCT_FRAGMENT on ProductView {
|
|
68
72
|
__typename
|
|
69
73
|
id
|
|
@@ -196,14 +200,14 @@ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
|
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
}
|
|
199
|
-
`,
|
|
203
|
+
`,L=`
|
|
200
204
|
query GET_PRODUCT_DATA($skus: [String]) {
|
|
201
205
|
products(skus: $skus) {
|
|
202
206
|
...PRODUCT_FRAGMENT
|
|
203
207
|
}
|
|
204
208
|
}
|
|
205
|
-
${
|
|
206
|
-
|
|
209
|
+
${S}
|
|
210
|
+
`,$=async i=>o(L,{variables:{skus:i}}).then(({errors:e,data:t})=>e?a(e):t!=null&&t.products?c(t.products):null),q=`
|
|
207
211
|
mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(
|
|
208
212
|
$requisitionListUid: ID!,
|
|
209
213
|
$requisitionListItemUids: [ID!]!
|
|
@@ -233,5 +237,5 @@ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
|
|
|
233
237
|
}
|
|
234
238
|
}
|
|
235
239
|
}
|
|
236
|
-
`,
|
|
240
|
+
`,y=async(i,e)=>o(q,{variables:{requisitionListUid:i,requisitionListItemUids:e}}).then(({errors:t,data:r})=>{var s;return t?a(t):(s=r.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors)!=null&&s.length?r.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(n=>n.type):null});export{y as a,$ as b,g as d,O as g,A as u};
|
|
237
241
|
//# sourceMappingURL=addRequisitionListItemsToCart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addRequisitionListItemsToCart.js","sources":["/@dropins/storefront-requisition-list/src/data/transforms/transform-product.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/graphql/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/graphql/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/fragments/ProductFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/getProductData/graphql/getProductData.ts","/@dropins/storefront-requisition-list/src/api/getProductData/getProductData.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/addRequisitionListItemsToCart.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 { Product } from '@/requisitionList/data/models';\n\n// Interface for raw product data from GraphQL API\nexport interface RawProductData {\n __typename: string;\n id: string;\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n description?: string;\n inStock: boolean;\n addToCartAllowed: boolean;\n url?: string;\n urlKey?: string;\n externalId?: string;\n images?: {\n url: string;\n label?: string;\n roles?: string[];\n }[];\n attributes?: {\n name: string;\n label: string;\n value: string;\n roles?: string[];\n }[];\n price?: {\n roles?: string[];\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n };\n priceRange?: {\n maximum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n minimum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n options?: {\n id: string;\n title: string;\n required: boolean;\n multi: boolean;\n values: {\n id: string;\n title: string;\n inStock: boolean;\n __typename: string;\n quantity?: number;\n isDefault?: boolean;\n type?: string;\n value?: string;\n product?: {\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n price?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n }[];\n }[];\n}\n\nexport function transformProduct(data: RawProductData): Product {\n return {\n sku: data.sku,\n parent_sku: data.sku, // Use same SKU as parent for simple products\n name: data.name,\n price: data.price,\n shortDescription: data.shortDescription || '',\n metaDescription: data.metaDescription || '',\n metaKeyword: data.metaKeyword || '',\n metaTitle: data.metaTitle || '',\n description: data.description || '',\n addToCartAllowed: data.addToCartAllowed,\n url: data.url || '',\n urlKey: data.urlKey || '',\n externalId: data.externalId || '',\n images:\n data.images?.map((image) => ({\n url: image.url,\n label: image.label || '',\n roles: image.roles || [],\n })) || [],\n };\n}\n\nexport function transformProducts(products: RawProductData[]): Product[] {\n if (!products?.length) return [];\n\n return products.map(transformProduct);\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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const GET_REQUISITION_LIST_QUERY = `\n query GET_REQUISITION_LIST_QUERY(\n $requisitionListUid: String,\n $currentPage: Int = 1,\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists (\n filter: {\n uids: {\n eq: $requisitionListUid\n }\n }\n ){\n items {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n }\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n${REQUISITION_LIST_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 { GET_REQUISITION_LIST_QUERY } from '@/requisitionList/api/getRequisitionList/graphql/getRequisitionList';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionList = async (\n requisitionListID: string,\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.customer.requisition_lists.items[0]\n );\n events.emit('requisitionList/data', payload);\n return payload;\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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItems: [UpdateRequisitionListItemsInput!]!,\n ) {\n updateRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItems: $requisitionListItems\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_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 { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/updateRequisitionListItems/graphql/updateRequisitionListItems';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionListItems = async (\n requisitionListUid: string,\n requisitionListItems: Array<UpdateRequisitionListItemsInput>\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItems,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n const payload = transformRequisitionList(\n data.updateRequisitionListItems.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n\ntype UpdateRequisitionListItemsInput = {\n item_id: string;\n quantity?: number;\n entered_options?: Array<{ uid: string; value: string }>;\n selected_options?: Array<string>;\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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!\n ) {\n deleteRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_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 { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { DELETE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionListItems = async (\n requisitionListUid: string,\n items: Array<string>\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids: items,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n const payload = transformRequisitionList(\n data.deleteRequisitionListItems.requisition_list\n );\n events.emit('requisitionList/data', payload);\n\n return payload;\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 PRODUCT_FRAGMENT = `\nfragment PRODUCT_FRAGMENT on ProductView {\n __typename\n id\n sku\n name\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n description\n inStock\n addToCartAllowed\n url\n urlKey\n externalId\n images(roles: []) {\n url\n label\n roles\n }\n attributes(roles: []) {\n name\n label\n value\n roles\n }\n ... on SimpleProductView {\n price {\n roles\n regular {\n amount {\n value\n currency\n }\n }\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n ... on ComplexProductView {\n options {\n ...PRODUCT_OPTION_FRAGMENT\n }\n ...PRICE_RANGE_FRAGMENT\n }\n}\nfragment PRODUCT_OPTION_FRAGMENT on ProductViewOption {\n id\n title\n required\n multi\n values {\n id\n title\n inStock\n __typename\n ... on ProductViewOptionValueProduct {\n title\n quantity\n isDefault\n __typename\n product {\n sku\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n name\n price {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n }\n ... on ProductViewOptionValueSwatch {\n id\n title\n type\n value\n inStock\n }\n }\n}\nfragment PRICE_RANGE_FRAGMENT on ComplexProductView {\n priceRange {\n maximum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n minimum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\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 { PRODUCT_FRAGMENT } from '@/requisitionList/api/fragments/ProductFragment.graphql';\n\nexport const GET_PRODUCT_DATA_QUERY = `\n query GET_PRODUCT_DATA($skus: [String]) {\n products(skus: $skus) {\n ...PRODUCT_FRAGMENT\n }\n }\n ${PRODUCT_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 { transformProducts } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { GET_PRODUCT_DATA_QUERY } from './graphql/getProductData';\nimport { Product } from '@/requisitionList/data/models/item';\n\nexport const getProductData = async (\n skus: string[]\n): Promise<Product[] | null> => {\n return fetchGraphQl(GET_PRODUCT_DATA_QUERY, {\n variables: {\n skus,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.products) {\n return null;\n }\n\n return transformProducts(data.products);\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 ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION = `\n mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!\n ) {\n addRequisitionListItemsToCart(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n status\n add_requisition_list_items_to_cart_user_errors {\n message\n type\n }\n cart {\n id\n itemsV2 {\n items {\n uid\n quantity\n is_available\n }\n total_count\n }\n email\n total_quantity\n is_virtual\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 '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION } from '@/requisitionList/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart';\n\nexport const addRequisitionListItemsToCart = async (\n requisitionListUid: string,\n requisitionListItemUids: Array<string>\n): Promise<Array<string> | null> => {\n return fetchGraphQl(ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (\n data.addRequisitionListItemsToCart\n .add_requisition_list_items_to_cart_user_errors?.length\n ) {\n return data.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(\n (e: any) => e.type\n );\n }\n return null;\n });\n};\n"],"names":["transformProduct","data","_a","image","transformProducts","products","GET_REQUISITION_LIST_QUERY","REQUISITION_LIST_ITEMS_FRAGMENT","REQUISITION_LIST_FRAGMENT","getRequisitionList","requisitionListID","currentPage","pageSize","fetchGraphQl","errors","handleFetchError","payload","transformRequisitionList","events","UPDATE_REQUISITION_LIST_ITEMS_MUTATION","updateRequisitionListItems","requisitionListUid","requisitionListItems","DELETE_REQUISITION_LIST_ITEMS_MUTATION","deleteRequisitionListItems","items","PRODUCT_FRAGMENT","GET_PRODUCT_DATA_QUERY","getProductData","skus","ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION","addRequisitionListItemsToCart","requisitionListItemUids","e"],"mappings":"4LAsIO,SAASA,EAAiBC,EAA+B,OACvD,MAAA,CACL,IAAKA,EAAK,IACV,WAAYA,EAAK,IACjB,KAAMA,EAAK,KACX,MAAOA,EAAK,MACZ,iBAAkBA,EAAK,kBAAoB,GAC3C,gBAAiBA,EAAK,iBAAmB,GACzC,YAAaA,EAAK,aAAe,GACjC,UAAWA,EAAK,WAAa,GAC7B,YAAaA,EAAK,aAAe,GACjC,iBAAkBA,EAAK,iBACvB,IAAKA,EAAK,KAAO,GACjB,OAAQA,EAAK,QAAU,GACvB,WAAYA,EAAK,YAAc,GAC/B,SACEC,EAAAD,EAAK,SAAL,YAAAC,EAAa,IAAKC,IAAW,CAC3B,IAAKA,EAAM,IACX,MAAOA,EAAM,OAAS,GACtB,MAAOA,EAAM,OAAS,CAAA,CACxB,MAAO,CAAA,CACX,CACF,CAEO,SAASC,EAAkBC,EAAuC,CACvE,OAAKA,GAAA,M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AyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMlCD,CAAgB;AAAA,ECFPE,EAAiB,MAC5BC,GAEOhB,EAAac,EAAwB,CAC1C,UAAW,CACT,KAAAE,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAf,EAAQ,KAAAb,KACba,EAAeC,EAAiBD,CAAM,EAErCb,GAAA,MAAAA,EAAM,SAIJG,EAAkBH,EAAK,QAAQ,EAH7B,IAIV,ECrBU6B,EAA8C;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,ECI9CC,EAAgC,MAC3CV,EACAW,IAEOnB,EAAaiB,EAA6C,CAC/D,UAAW,CACT,mBAAAT,EACA,wBAAAW,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAlB,EAAQ,KAAAb,KAAW,OACxB,OAAAa,EAAeC,EAAiBD,CAAM,GAGxCZ,EAAAD,EAAK,8BACF,iDADH,MAAAC,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtFgC,GAAWA,EAAE,IAChB,EAEK,IAAA,CACR"}
|
|
1
|
+
{"version":3,"file":"addRequisitionListItemsToCart.js","sources":["/@dropins/storefront-requisition-list/src/data/transforms/transform-product.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/graphql/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/graphql/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/fragments/ProductFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/getProductData/graphql/getProductData.ts","/@dropins/storefront-requisition-list/src/api/getProductData/getProductData.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/addRequisitionListItemsToCart.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 { Product } from '@/requisitionList/data/models';\n\n// Interface for raw product data from GraphQL API\nexport interface RawProductData {\n __typename: string;\n id: string;\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n description?: string;\n inStock: boolean;\n addToCartAllowed: boolean;\n url?: string;\n urlKey?: string;\n externalId?: string;\n images?: {\n url: string;\n label?: string;\n roles?: string[];\n }[];\n attributes?: {\n name: string;\n label: string;\n value: string;\n roles?: string[];\n }[];\n price?: {\n roles?: string[];\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n };\n priceRange?: {\n maximum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n minimum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n options?: {\n id: string;\n title: string;\n required: boolean;\n multi: boolean;\n values: {\n id: string;\n title: string;\n inStock: boolean;\n __typename: string;\n quantity?: number;\n isDefault?: boolean;\n type?: string;\n value?: string;\n product?: {\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n price?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n }[];\n }[];\n}\n\nexport function transformProduct(data: RawProductData): Product {\n return {\n sku: data.sku,\n parent_sku: data.sku, // Use same SKU as parent for simple products\n name: data.name,\n price: data.price,\n shortDescription: data.shortDescription || '',\n metaDescription: data.metaDescription || '',\n metaKeyword: data.metaKeyword || '',\n metaTitle: data.metaTitle || '',\n description: data.description || '',\n addToCartAllowed: data.addToCartAllowed,\n url: data.url || '',\n urlKey: data.urlKey || '',\n externalId: data.externalId || '',\n images:\n data.images?.map((image) => ({\n url: image.url,\n label: image.label || '',\n roles: image.roles || [],\n })) || [],\n };\n}\n\nexport function transformProducts(products: RawProductData[]): Product[] {\n if (!products?.length) return [];\n\n return products.map(transformProduct);\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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const GET_REQUISITION_LIST_QUERY = `\n query GET_REQUISITION_LIST_QUERY(\n $requisitionListUid: String,\n $currentPage: Int = 1,\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists (\n filter: {\n uids: {\n eq: $requisitionListUid\n }\n }\n ){\n items {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n }\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n${REQUISITION_LIST_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 { GET_REQUISITION_LIST_QUERY } from '@/requisitionList/api/getRequisitionList/graphql/getRequisitionList';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionList = async (\n requisitionListID: string,\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.customer.requisition_lists.items[0]\n );\n events.emit('requisitionList/data', payload);\n return payload;\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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItems: [UpdateRequisitionListItemsInput!]!,\n $pageSize: Int = 20,\n $currentPage: Int = 1\n ) {\n updateRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItems: $requisitionListItems\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_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 { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/updateRequisitionListItems/graphql/updateRequisitionListItems';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionListItems = async (\n requisitionListUid: string,\n requisitionListItems: Array<UpdateRequisitionListItemsInput>,\n pageSize: number,\n currentPage: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItems,\n pageSize,\n currentPage,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n const payload = transformRequisitionList(\n data.updateRequisitionListItems.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n\ntype UpdateRequisitionListItemsInput = {\n item_id: string;\n quantity?: number;\n entered_options?: Array<{ uid: string; value: string }>;\n selected_options?: Array<string>;\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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!,\n $pageSize: Int = 20,\n $currentPage: Int = 1\n ) {\n deleteRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_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 { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { DELETE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionListItems = async (\n requisitionListUid: string,\n items: Array<string>,\n pageSize: number,\n currentPage: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids: items,\n pageSize,\n currentPage,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n const payload = transformRequisitionList(\n data.deleteRequisitionListItems.requisition_list\n );\n events.emit('requisitionList/data', payload);\n\n return payload;\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 PRODUCT_FRAGMENT = `\nfragment PRODUCT_FRAGMENT on ProductView {\n __typename\n id\n sku\n name\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n description\n inStock\n addToCartAllowed\n url\n urlKey\n externalId\n images(roles: []) {\n url\n label\n roles\n }\n attributes(roles: []) {\n name\n label\n value\n roles\n }\n ... on SimpleProductView {\n price {\n roles\n regular {\n amount {\n value\n currency\n }\n }\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n ... on ComplexProductView {\n options {\n ...PRODUCT_OPTION_FRAGMENT\n }\n ...PRICE_RANGE_FRAGMENT\n }\n}\nfragment PRODUCT_OPTION_FRAGMENT on ProductViewOption {\n id\n title\n required\n multi\n values {\n id\n title\n inStock\n __typename\n ... on ProductViewOptionValueProduct {\n title\n quantity\n isDefault\n __typename\n product {\n sku\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n name\n price {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n }\n ... on ProductViewOptionValueSwatch {\n id\n title\n type\n value\n inStock\n }\n }\n}\nfragment PRICE_RANGE_FRAGMENT on ComplexProductView {\n priceRange {\n maximum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n minimum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\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 { PRODUCT_FRAGMENT } from '@/requisitionList/api/fragments/ProductFragment.graphql';\n\nexport const GET_PRODUCT_DATA_QUERY = `\n query GET_PRODUCT_DATA($skus: [String]) {\n products(skus: $skus) {\n ...PRODUCT_FRAGMENT\n }\n }\n ${PRODUCT_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 { transformProducts } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { GET_PRODUCT_DATA_QUERY } from './graphql/getProductData';\nimport { Product } from '@/requisitionList/data/models/item';\n\nexport const getProductData = async (\n skus: string[]\n): Promise<Product[] | null> => {\n return fetchGraphQl(GET_PRODUCT_DATA_QUERY, {\n variables: {\n skus,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.products) {\n return null;\n }\n\n return transformProducts(data.products);\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 ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION = `\n mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!\n ) {\n addRequisitionListItemsToCart(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n status\n add_requisition_list_items_to_cart_user_errors {\n message\n type\n }\n cart {\n id\n itemsV2 {\n items {\n uid\n quantity\n is_available\n }\n total_count\n }\n email\n total_quantity\n is_virtual\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 '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION } from '@/requisitionList/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart';\n\nexport const addRequisitionListItemsToCart = async (\n requisitionListUid: string,\n requisitionListItemUids: Array<string>\n): Promise<Array<string> | null> => {\n return fetchGraphQl(ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (\n data.addRequisitionListItemsToCart\n .add_requisition_list_items_to_cart_user_errors?.length\n ) {\n return data.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(\n (e: any) => e.type\n );\n }\n return null;\n });\n};\n"],"names":["transformProduct","data","_a","image","transformProducts","products","GET_REQUISITION_LIST_QUERY","REQUISITION_LIST_ITEMS_FRAGMENT","REQUISITION_LIST_FRAGMENT","getRequisitionList","requisitionListID","currentPage","pageSize","fetchGraphQl","errors","handleFetchError","payload","transformRequisitionList","events","UPDATE_REQUISITION_LIST_ITEMS_MUTATION","updateRequisitionListItems","requisitionListUid","requisitionListItems","DELETE_REQUISITION_LIST_ITEMS_MUTATION","deleteRequisitionListItems","items","PRODUCT_FRAGMENT","GET_PRODUCT_DATA_QUERY","getProductData","skus","ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION","addRequisitionListItemsToCart","requisitionListItemUids","e"],"mappings":"4LAsIO,SAASA,EAAiBC,EAA+B,OACvD,MAAA,CACL,IAAKA,EAAK,IACV,WAAYA,EAAK,IACjB,KAAMA,EAAK,KACX,MAAOA,EAAK,MACZ,iBAAkBA,EAAK,kBAAoB,GAC3C,gBAAiBA,EAAK,iBAAmB,GACzC,YAAaA,EAAK,aAAe,GACjC,UAAWA,EAAK,WAAa,GAC7B,YAAaA,EAAK,aAAe,GACjC,iBAAkBA,EAAK,iBACvB,IAAKA,EAAK,KAAO,GACjB,OAAQA,EAAK,QAAU,GACvB,WAAYA,EAAK,YAAc,GAC/B,SACEC,EAAAD,EAAK,SAAL,YAAAC,EAAa,IAAKC,IAAW,CAC3B,IAAKA,EAAM,IACX,MAAOA,EAAM,OAAS,GACtB,MAAOA,EAAM,OAAS,CAAA,CACxB,MAAO,CAAA,CACX,CACF,CAEO,SAASC,EAAkBC,EAAuC,CACvE,OAAKA,GAAA,MAAAA,EAAU,OAERA,EAAS,IAAIL,CAAgB,EAFN,CAAC,CAGjC,CC/IO,MAAMM,EAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBxCC,CAA+B;AAAA,EAC/BC,CAAyB;AAAA,ECnBdC,EAAqB,MAChCC,EACAC,EACAC,IAEOC,EAAaP,EAA4B,CAC9C,UAAW,CACT,mBAAoBI,EACpB,YAAAC,EACA,SAAAC,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAb,KAAW,OACxB,GAAAa,EAAe,OAAAC,EAAiBD,CAAM,EAEtC,GAAA,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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECI9CC,EAAgC,MAC3CV,EACAW,IAEOnB,EAAaiB,EAA6C,CAC/D,UAAW,CACT,mBAAAT,EACA,wBAAAW,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAlB,EAAQ,KAAAb,KAAW,OACxB,OAAAa,EAAeC,EAAiBD,CAAM,GAGxCZ,EAAAD,EAAK,8BACF,iDADH,MAAAC,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtFgC,GAAWA,EAAE,IAChB,EAEK,IAAA,CACR"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as i,jsxs as g,Fragment as U}from"@dropins/tools/preact-jsx-runtime.js";import*as v from"@dropins/tools/preact-compat.js";import{useState as P,useCallback as h,useEffect as H,useMemo as W}from"@dropins/tools/preact-compat.js";import{Card as F,Button as E,Header as Q,InLineAlert as X,Table as Y,Pagination as Z,Icon as $,Modal as I,ProgressSpinner as ii}from"@dropins/tools/components.js";import{Slot as ei,classes as x,VComponent as ti}from"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{R as G}from"../chunks/RequisitionListForm.js";import{u as ni
|
|
3
|
+
import{jsx as i,jsxs as g,Fragment as U}from"@dropins/tools/preact-jsx-runtime.js";import*as v from"@dropins/tools/preact-compat.js";import{useState as P,useCallback as h,useEffect as H,useMemo as W}from"@dropins/tools/preact-compat.js";import{Card as F,Button as E,Header as Q,InLineAlert as X,Table as Y,Pagination as Z,Icon as $,Modal as I,ProgressSpinner as ii}from"@dropins/tools/components.js";import{Slot as ei,classes as x,VComponent as ti}from"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";/* empty css */import{R as G}from"../chunks/RequisitionListForm.js";import{u as ni}from"../chunks/PageSizePicker2.js";import{events as _}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{E as si,P as ai}from"../chunks/PageSizePicker.js";import{useText as T}from"@dropins/tools/i18n.js";import{d as oi}from"../chunks/deleteRequisitionList.js";import{g as O}from"../chunks/getRequisitionLists.js";import"../chunks/transform-requisition-list.js";import"@dropins/tools/fetch-graphql.js";function ri(l,r,s){const a=T({actionDelete:"RequisitionList.RequisitionListItem.actionDelete",actionUpdate:"RequisitionList.RequisitionListItem.actionUpdate"}),[e,q]=P(l),[n,d]=P(null),[C,f]=P(!1),[b,R]=P(!1),L=h(t=>{d(t),f(!1)},[]),w=h(()=>d(null),[]),m=h(()=>{f(!0),d(null)},[]),A=h(()=>f(!1),[]),c=h(async(t=(S=>(S=e==null?void 0:e.page_info)==null?void 0:S.current_page)()??1,y=(k=>(k=e==null?void 0:e.page_info)==null?void 0:k.page_size)()??10)=>{var z,B,M;R(!0);try{const p=await O(t,y),D=((z=p==null?void 0:p.page_info)==null?void 0:z.current_page)??1,V=((B=p==null?void 0:p.page_info)==null?void 0:B.total_pages)??0;if(!((((M=p==null?void 0:p.items)==null?void 0:M.length)??0)>0)&&D>1&&V>=D-1){const J=D-1,K=await O(J,y);q(K)}else q(p)}finally{R(!1)}},[e]);H(()=>{e||c(1)},[e,c]);const o=h(t=>c(t),[c]),N=h(async t=>{await c(1,t)},[c]),u=W(()=>((e==null?void 0:e.items)??[]).map(t=>{const y=n===t.uid;return{name:g("div",{className:"requisition-list-grid-wrapper__name",children:[i("div",{className:"requisition-list-grid-wrapper__name__title",children:i("a",{href:"#",onClick:S=>{if(S.preventDefault(),s){const k=s(t.uid);typeof k=="string"&&(window.location.href=k)}},children:t.name})}),t.description&&i("div",{className:"requisition-list-grid-wrapper__name__description",children:t.description})]}),items_count:t.items_count,last_updated:new Date(t.updated_at).toLocaleString(),actions:g("div",{className:"requisition-list-grid-wrapper__actions",children:[i(E,{variant:"tertiary",type:"button","data-testid":"update-button",onClick:()=>L(t.uid),children:a.actionUpdate}),i(E,{variant:"tertiary",type:"button","data-testid":"delete-button",onClick:()=>r==null?void 0:r.handleOpenModal(t),children:a.actionDelete})]}),_rowDetails:y?i(F,{variant:"secondary",className:"requisition-list-grid-wrapper__form-row",children:i(G,{mode:"update",requisitionListUid:t.uid,defaultValues:{name:t.name,description:t.description},onSuccess:async()=>{await o(),_.emit("requisitionList/alert",{action:"update",type:"success",context:"requisitionList"}),d(null)},onError:()=>{_.emit("requisitionList/alert",{action:"update",type:"error",context:"requisitionList"})},onCancel:w})}):void 0}}),[e==null?void 0:e.items,n,L,w,a.actionUpdate,a.actionDelete,r,o,s]),j=W(()=>new Set(u.map((t,y)=>t._rowDetails?y:-1).filter(t=>t>=0)),[u]);return{rows:u,expandedRows:j,isLoading:b||!e,pageInfo:e==null?void 0:e.page_info,handlePageChange:o,handlePageSizeChange:N,isAdding:C,handleAddNew:m,handleCancelCreate:A}}const xi=({requisitionLists:l,routeRequisitionListDetails:r,slots:s})=>{const[a,e]=P({isOpen:!1,isLoading:!1,rl:null}),q=u=>e({isOpen:!0,isLoading:!1,rl:u}),n=()=>e({isOpen:!1,isLoading:!1,rl:null}),d=async()=>{a.rl&&(e(u=>({...u,isLoading:!0})),await oi(a.rl.uid).then(async()=>{_.emit("requisitionList/alert",{type:"success",action:"delete",context:"requisitionList"})}).catch(()=>{_.emit("requisitionList/alert",{type:"error",action:"delete",context:"requisitionList"})}).finally(async()=>{await L(),n()}))},{rows:C,expandedRows:f,isLoading:b,pageInfo:R,handlePageChange:L,handlePageSizeChange:w,isAdding:m,handleAddNew:A,handleCancelCreate:c}=ri(l,{handleOpenModal:q},r),o=T({containerTitle:"RequisitionList.containerTitle",deleteRequisitionListTitle:"RequisitionList.RequisitionListWrapper.deleteRequisitionListTitle",deleteRequisitionListMessage:"RequisitionList.RequisitionListWrapper.deleteRequisitionListMessage",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction"}),N=h(()=>s!=null&&s.Header?i(ei,{name:"Header","aria-label":o.containerTitle,title:o.containerTitle,slot:s.Header}):i(Q,{"aria-label":o.containerTitle,role:"region",title:o.containerTitle}),[s,o.containerTitle]);return g(U,{children:[i(di,{header:N(),rows:C,expandedRows:f,skeletonRowCount:10,isLoading:b,pageInfo:R,handlePageChange:L,handlePageSizeChange:w,defaultPageSize:10,isAdding:m,handleAddNew:A,handleCancelCreate:c}),a.isOpen&&i(ui,{isOpen:!0,isLoading:a.isLoading,title:o.deleteRequisitionListTitle,modalContent:o.deleteRequisitionListMessage,confirmBtnCaption:o.confirmAction,closeBtnCaption:o.cancelAction,handleModalOnClose:n,handleModalOnConfirm:d})]})},li=l=>v.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...l},v.createElement("g",{id:"Large"},v.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),v.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),v.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),di=({className:l,isLoading:r=!1,header:s,rows:a=[],expandedRows:e,skeletonRowCount:q=10,pageInfo:n,handlePageChange:d,handlePageSizeChange:C,defaultPageSize:f=10,isAdding:b,handleAddNew:R,handleCancelCreate:L,...w})=>{const m=T({name:"RequisitionList.RequisitionListWrapper.name",itemsCount:"RequisitionList.RequisitionListWrapper.itemsCount",lastUpdated:"RequisitionList.RequisitionListWrapper.lastUpdated",actions:"RequisitionList.RequisitionListWrapper.actions",emptyList:"RequisitionList.RequisitionListWrapper.emptyList"}),A=((n==null?void 0:n.total_pages)??0)>0,c=!r&&a.length===0&&!A,{alert:o,setAlert:N,handleRequisitionListAlert:u}=ni();return H(()=>{_.on("requisitionList/alert",u)},[u]),g("div",{...w,className:x(["requisition-list-grid-wrapper",l]),"data-testid":"requisition-list-grid-wrapper",children:[s&&i("div",{className:x(["requisition-list-grid-wrapper__header",l]),"data-testid":"requisition-list-grid-wrapper-header",children:i(ti,{node:s})}),o&&i(U,{children:i(X,{heading:o.description,type:o.type,variant:"primary",onDismiss:()=>N(null)})}),c?i(si,{textContent:m.emptyList}):g(U,{children:[i(Y,{columns:[{key:"name",label:m.name},{key:"items_count",label:m.itemsCount},{key:"last_updated",label:m.lastUpdated},{key:"actions",label:m.actions}],rowData:a,expandedRows:e,loading:r,skeletonRowCount:q}),i("div",{className:x(["requisition-list-grid-wrapper__pagination",l]),children:g("div",{className:"requisition-list-grid-wrapper__pagination-controls",children:[i(ai,{currentPageSize:(n==null?void 0:n.page_size)||f,onPageSizeChange:C||(()=>Promise.resolve()),disabled:r}),n&&n.total_pages>1&&i(Z,{totalPages:n.total_pages,currentPage:n.current_page,onChange:d})]})})]}),i("div",{className:x(["requisition-list-grid-wrapper__add-new",l]),children:b?i(F,{variant:"secondary",children:i(G,{mode:"create",onSuccess:async()=>{await d(),L(),_.emit("requisitionList/alert",{type:"success",action:"create",context:"requisitionList"})},onError:()=>{_.emit("requisitionList/alert",{type:"error",action:"create",context:"requisitionList"})},onCancel:L})}):i(ci,{onAddNew:R})})]})},ci=({selectable:l,className:r,onAddNew:s})=>{const a=T({addNewReqListBtn:"RequisitionList.AddNewReqList.addNewReqListBtn"});return g("button",{type:"button","aria-label":a.addNewReqListBtn,role:"button",className:x(["requisition-list-actions",["requisition-list-actions--selectable",l],r]),"data-testid":"requisition-list-actions-button",onClick:s,children:[i("span",{className:"requisition-list-actions__title","data-testid":"requisition-list-actions-button-text",children:a.addNewReqListBtn}),i($,{source:li,size:"32"})]})},ui=({isOpen:l,isLoading:r,title:s,modalContent:a,closeBtnCaption:e,confirmBtnCaption:q,handleModalOnClose:n,handleModalOnConfirm:d})=>l?i(I,{className:"requisition-list-modal--overlay","data-testid":"requisition-list-modal",size:"medium",centered:!1,title:s,onClose:n,backgroundDim:!0,clickToDismiss:!0,escapeToDismiss:!0,role:"dialog","aria-label":s,children:g("div",{className:"requisition-list-modal",children:[r?i("div",{className:"requisition-list-modal__spinner","data-testid":"progress-spinner",children:i(ii,{stroke:"4",size:"large"})}):null,i("p",{children:a}),g("div",{className:"requisition-list-modal__buttons",children:[n&&i(E,{"data-testid":"rl-modal-close-button",type:"button",onClick:n,variant:"secondary",disabled:r,children:e}),d&&i(E,{"data-testid":"rl-modal-confirm-button",type:"button",onClick:d,disabled:r,children:q})]})]})}):null;export{xi as RequisitionListGrid,xi as default};
|
|
4
4
|
//# sourceMappingURL=RequisitionListGrid.js.map
|