@dropins/storefront-requisition-list 1.0.0-beta3 → 1.0.0-beta4
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/fragments/RequisitionListItemsFragment.graphql.d.ts +1 -1
- package/chunks/PaginationItemsCounter.js +4 -0
- package/chunks/PaginationItemsCounter.js.map +1 -0
- package/chunks/RequisitionListView.js +1 -1
- package/chunks/RequisitionListView.js.map +1 -1
- package/chunks/addRequisitionListItemsToCart.js +9 -9
- package/chunks/addRequisitionListItemsToCart.js.map +1 -1
- package/chunks/getRequisitionLists.js +3 -3
- package/chunks/getRequisitionLists.js.map +1 -1
- package/chunks/updateRequisitionList.js +7 -5
- package/chunks/updateRequisitionList.js.map +1 -1
- package/components/PaginationItemsCounter/PaginationItemsCounter.d.ts +10 -0
- package/components/PaginationItemsCounter/index.d.ts +19 -0
- package/components/ProductListTable/ProductListTable.d.ts +1 -1
- package/components/RequisitionListGridWrapper/RequisitionListGridWrapper.d.ts +4 -3
- package/components/index.d.ts +1 -0
- package/containers/RequisitionListGrid/RequisitionListGrid.d.ts +5 -0
- package/containers/RequisitionListGrid.js +1 -1
- package/containers/RequisitionListGrid.js.map +1 -1
- package/containers/RequisitionListSelector.js +2 -2
- package/containers/RequisitionListSelector.js.map +1 -1
- package/containers/RequisitionListView/RequisitionListView.d.ts +5 -0
- package/containers/RequisitionListView.js +1 -1
- package/containers/RequisitionListView.js.map +1 -1
- package/data/models/item.d.ts +22 -1
- package/data/transforms/transform-requisition-list.d.ts +4 -2
- package/hooks/useRequisitionListGrid.d.ts +1 -0
- package/i18n/en_US.json.d.ts +12 -3
- package/package.json +1 -1
- package/render.js +3 -3
- package/render.js.map +1 -1
- package/chunks/PageSizePicker.js +0 -4
- package/chunks/PageSizePicker.js.map +0 -1
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const REQUISITION_LIST_ITEMS_FRAGMENT = "\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n";
|
|
17
|
+
export declare const REQUISITION_LIST_ITEMS_FRAGMENT = "\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n stock_status\n only_x_left_in_stock\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n";
|
|
18
18
|
//# sourceMappingURL=RequisitionListItemsFragment.graphql.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsxs as d,jsx as s}from"@dropins/tools/preact-jsx-runtime.js";import{Icon as p,Button as f,Picker as h}from"@dropins/tools/components.js";import{classes as P}from"@dropins/tools/lib.js";import"./RequisitionListView.js";import*as o from"@dropins/tools/preact-compat.js";import{useText as u}from"@dropins/tools/i18n.js";import{D as S}from"./RequisitionListForm.js";const E=e=>o.createElement("svg",{id:"Icon_Search_Base","data-name":"Icon \\u2013 Search \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",...e},o.createElement("g",{id:"Large"},o.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),o.createElement("g",{id:"Search_icon","data-name":"Search icon",transform:"translate(3.75 3.75)"},o.createElement("circle",{vectorEffect:"non-scaling-stroke",id:"Ellipse_186","data-name":"Ellipse 186",cx:6,cy:6,r:6,fill:"none",stroke:"currentColor"}),o.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_556","data-name":"Line 556",x2:6,y2:6,transform:"translate(10.5 10.5)",fill:"none",stroke:"currentColor"})))),C=({className:e,title:n="404 - Not Found",message:a="The requisition list you are looking for does not exist.",actionLabel:i,onAction:r,...c})=>d("div",{className:P(["not-found",e]),"data-testid":"not-found",...c,children:[s(p,{source:E,size:"64",stroke:"2"}),s("h2",{children:n}),a&&s("p",{children:a}),i&&r&&s(f,{variant:"primary",onClick:r,children:i})]}),y=({currentPageSize:e,onPageSizeChange:n,disabled:a=!1,pageSizeOptions:i=[10,25,50,100]})=>{const r=u({itemsPerPage:"RequisitionList.PageSizePicker.itemsPerPage"}),c=t=>{const m=t.target,g=parseInt(m.value,10);n(g)},l=i.map(t=>({value:t.toString(),text:t.toString()}));return s(h,{disabled:a,"data-testid":"page-size-picker",variant:"primary",size:"medium",value:e.toString(),options:l,handleSelect:c,"aria-label":r.itemsPerPage})},I=({pageInfo:e,totalCount:n,className:a=""})=>{const i=u({itemsCounter:"RequisitionList.PaginationItemsCounter.itemsCounter"});if(!e||!n)return null;const r=e.page_size??S,c=e.current_page??1,l=r*c,t=n,m=l-r+1,g=l>t?t:l;return s("span",{className:`pagination-items-counter ${a}`.trim(),children:i.itemsCounter.replace("{from}",m.toString()).replace("{to}",g.toString()).replace("{total}",t.toString())})};export{C as N,I as P,y as a};
|
|
4
|
+
//# sourceMappingURL=PaginationItemsCounter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaginationItemsCounter.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Search.svg","/@dropins/storefront-requisition-list/src/components/NotFound/NotFound.tsx","/@dropins/storefront-requisition-list/src/components/PageSizePicker/PageSizePicker.tsx","/@dropins/storefront-requisition-list/src/components/PaginationItemsCounter/PaginationItemsCounter.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgSearch = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Search_Base\", \"data-name\": \"Icon \\\\u2013 Search \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, fill: \"none\", viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Search_icon\", \"data-name\": \"Search icon\", transform: \"translate(3.75 3.75)\" }, /* @__PURE__ */ React.createElement(\"circle\", { vectorEffect: \"non-scaling-stroke\", id: \"Ellipse_186\", \"data-name\": \"Ellipse 186\", cx: 6, cy: 6, r: 6, fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_556\", \"data-name\": \"Line 556\", x2: 6, y2: 6, transform: \"translate(10.5 10.5)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgSearch;\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, Button } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Search } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/NotFound/NotFound.css';\n\nexport interface NotFoundProps {\n className?: string;\n title?: string;\n message?: string;\n actionLabel?: string;\n onAction?: () => void;\n}\n\nexport const NotFound: FunctionComponent<NotFoundProps> = ({\n className,\n title = '404 - Not Found',\n message = 'The requisition list you are looking for does not exist.',\n actionLabel,\n onAction,\n ...props\n}) => {\n return (\n <div\n className={classes(['not-found', className])}\n data-testid=\"not-found\"\n {...props}\n >\n <Icon source={Search} size={'64'} stroke={'2'} />\n <h2>{title}</h2>\n {message && <p>{message}</p>}\n {actionLabel && onAction && (\n <Button variant=\"primary\" onClick={onAction}>\n {actionLabel}\n </Button>\n )}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\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 <Picker\n disabled={disabled}\n data-testid=\"page-size-picker\"\n variant=\"primary\"\n size=\"medium\"\n value={currentPageSize.toString()}\n options={options}\n handleSelect={handlePageSizeChange}\n aria-label={translations.itemsPerPage}\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 { FunctionComponent } from 'preact';\n\nimport { PageInfo } from '@/requisitionList/data/models';\nimport { DEFAULT_PAGE_SIZE } from '@/requisitionList/lib/constants';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport '@/requisitionList/components/PaginationItemsCounter/PaginationItemsCounter.css';\n\nexport interface PaginationItemsCounterProps {\n pageInfo?: PageInfo;\n totalCount?: number;\n className?: string;\n}\n\nexport const PaginationItemsCounter: FunctionComponent<\n PaginationItemsCounterProps\n> = ({ pageInfo, totalCount, className = '' }) => {\n const translations = useText({\n itemsCounter: `RequisitionList.PaginationItemsCounter.itemsCounter`,\n });\n\n // Don't show counter if no pageInfo or if there's no total count\n if (!pageInfo || !totalCount) {\n return null;\n }\n\n const pageSize = pageInfo.page_size ?? DEFAULT_PAGE_SIZE;\n const currentPage = pageInfo.current_page ?? 1;\n const currentPageSize = pageSize * currentPage;\n const total = totalCount;\n\n const from = currentPageSize - pageSize + 1;\n const to = currentPageSize > total ? total : currentPageSize;\n\n return (\n <span className={`pagination-items-counter ${className}`.trim()}>\n {translations.itemsCounter\n .replace('{from}', from.toString())\n .replace('{to}', to.toString())\n .replace('{total}', total.toString())}\n </span>\n );\n};\n"],"names":["SvgSearch","props","React","NotFound","className","title","message","actionLabel","onAction","jsxs","classes","jsx","Icon","Search","Button","PageSizePicker","currentPageSize","onPageSizeChange","disabled","pageSizeOptions","translations","useText","handlePageSizeChange","event","target","newPageSize","options","size","Picker","PaginationItemsCounter","pageInfo","totalCount","pageSize","DEFAULT_PAGE_SIZE","currentPage","total","from","to"],"mappings":"kXACA,MAAMA,EAAaC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,mBAAoB,YAAa,mCAAoC,MAAO,6BAA8B,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,YAAa,GAAGD,CAAK,EAAoBC,EAAM,cAAc,IAAK,CAAE,GAAI,OAAO,EAAoBA,EAAM,cAAc,OAAQ,CAAE,GAAI,iBAAkB,YAAa,iBAAkB,MAAO,GAAI,OAAQ,GAAI,KAAM,OAAQ,QAAS,EAAG,EAAmBA,EAAM,cAAc,IAAK,CAAE,GAAI,cAAe,YAA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AAAV,EACA,cAAY,mBACZ,QAAQ,UACR,KAAK,SACL,MAAOF,EAAgB,SAAA,EACvB,QAAAU,EACA,aAAcJ,EACd,aAAYF,EAAa,YAAA,CAAA,CAG/B,EC9BaS,EAET,CAAC,CAAE,SAAAC,EAAU,WAAAC,EAAY,UAAA3B,EAAY,MAAS,CAChD,MAAMgB,EAAeC,EAAQ,CAC3B,aAAc,qDAAA,CACf,EAGD,GAAI,CAACS,GAAY,CAACC,EAChB,OAAO,KAGT,MAAMC,EAAWF,EAAS,WAAaG,EACjCC,EAAcJ,EAAS,cAAgB,EACvCd,EAAkBgB,EAAWE,EAC7BC,EAAQJ,EAERK,EAAOpB,EAAkBgB,EAAW,EACpCK,EAAKrB,EAAkBmB,EAAQA,EAAQnB,EAE7C,OACEL,EAAC,OAAA,CAAK,UAAW,4BAA4BP,CAAS,GAAG,KAAA,EACtD,SAAAgB,EAAa,aACX,QAAQ,SAAUgB,EAAK,SAAA,CAAU,EACjC,QAAQ,OAAQC,EAAG,UAAU,EAC7B,QAAQ,UAAWF,EAAM,SAAA,CAAU,CAAA,CACxC,CAEJ","x_google_ignoreList":[0]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import*as
|
|
3
|
+
import*as i from"@dropins/tools/preact-compat.js";import{useState as L,useEffect as y,useMemo as d,useCallback as f}from"@dropins/tools/preact-compat.js";import{s as n}from"./state.js";import{events as x}from"@dropins/tools/event-bus.js";import{useText as C}from"@dropins/tools/i18n.js";import{jsxs as h,jsx as q}from"@dropins/tools/preact-jsx-runtime.js";import{Icon as v}from"@dropins/tools/components.js";import{classes as E}from"@dropins/tools/lib.js";const M=()=>{var s,o;const[t,r]=L(((s=n.config)==null?void 0:s.is_requisition_list_active)==="1"&&((o=n.config)==null?void 0:o.company_enabled)===!0);return y(()=>{const e=x.on("requisitionList/initialized",()=>{var c,u;r(((c=n.config)==null?void 0:c.is_requisition_list_active)==="1"&&((u=n.config)==null?void 0:u.company_enabled)===!0)});return()=>e==null?void 0:e.off()},[]),{isEnabled:t}},T=t=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},i.createElement("rect",{x:4.89282,y:2.75,width:14.2143,height:18.5,rx:2.25,stroke:"currentColor",strokeWidth:1}),i.createElement("line",{x1:9.85718,y1:7.67871,x2:16.2857,y2:7.67871,stroke:"currentColor",strokeWidth:1}),i.createElement("line",{x1:9.85718,y1:11.9644,x2:16.2857,y2:11.9644,stroke:"currentColor",strokeWidth:1}),i.createElement("line",{x1:9.85718,y1:16.25,x2:16.2857,y2:16.25,stroke:"currentColor",strokeWidth:1}),i.createElement("circle",{cx:7.71429,cy:7.71429,r:.714286,fill:"currentColor"}),i.createElement("circle",{cx:7.71429,cy:11.9999,r:.714286,fill:"currentColor"}),i.createElement("circle",{cx:7.71429,cy:16.2856,r:.714286,fill:"currentColor"}));function b(t){const[r,s]=L(null),o=C({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=d(()=>({...o,...t}),[o,t]),c=d(()=>({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]),u=f(R=>{const{type:a,action:m,context:p,skus:l}=R;s({type:a,description:c[m][p][a],sku:l==null?void 0:l[0]});const A=setTimeout(()=>{s(null)},5e3);return()=>clearTimeout(A)},[c]);return{alert:r,setAlert:s,handleRequisitionListAlert:u}}const Q=({className:t,textContent:r,...s})=>h("div",{className:E(["empty-list",t]),"data-testid":"empty-list",...s,children:[q(v,{source:T,size:"64",stroke:"2"}),r&&q("h4",{children:r})]});export{Q as E,T as S,b as a,M as u};
|
|
4
4
|
//# sourceMappingURL=RequisitionListView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequisitionListView.js","sources":["/@dropins/storefront-requisition-list/src/hooks/useRequisitionListAlert.tsx","../../node_modules/@adobe-commerce/elsie/src/icons/List.svg","/@dropins/storefront-requisition-list/src/components/EmptyList/EmptyList.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","import * as React from \"react\";\nconst SvgList = (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(\"rect\", { x: 4.89282, y: 2.75, width: 14.2143, height: 18.5, rx: 2.25, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"line\", { x1: 9.85718, y1: 7.67871, x2: 16.2857, y2: 7.67871, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"line\", { x1: 9.85718, y1: 11.9644, x2: 16.2857, y2: 11.9644, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"line\", { x1: 9.85718, y1: 16.25, x2: 16.2857, y2: 16.25, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"circle\", { cx: 7.71429, cy: 7.71429, r: 0.714286, fill: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"circle\", { cx: 7.71429, cy: 11.9999, r: 0.714286, fill: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"circle\", { cx: 7.71429, cy: 16.2856, r: 0.714286, fill: \"currentColor\" }));\nexport default SvgList;\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 { List } 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={List} size={'64'} stroke={'2'} />\n {textContent && <h4>{textContent}</h4>}\n </div>\n );\n};\n"],"names":["useRequisitionListAlert","translationsOverride","alert","setAlert","useState","defaultTranslations","useText","translations","useMemo","messages","handleRequisitionListAlert","useCallback","payload","type","action","context","skus","timer","SvgList","props","React","EmptyList","className","textContent","jsxs","classes","jsx","Icon","List"],"mappings":"qWA4BO,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,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Q,KAAM,GAAI,KAAM,OAAQ,eAAgB,YAAa,CAAC,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,GAAI,QAAS,GAAI,QAAS,GAAI,QAAS,GAAI,QAAS,OAAQ,eAAgB,YAAa,CAAC,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,GAAI,QAAS,GAAI,QAAS,GAAI,QAAS,GAAI,QAAS,OAAQ,eAAgB,YAAa,CAAC,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,GAAI,QAAS,GAAI,MAAO,GAAI,QAAS,GAAI,MAAO,OAAQ,eAAgB,YAAa,CAAC,CAAE,EAAmBA,EAAM,cAAc,SAAU,CAAE,GAAI,QAAS,GAAI,QAAS,EAAG,QAAU,KAAM,cAAc,CAAE,EAAmBA,EAAM,cAAc,SAAU,CAAE,GAAI,QAAS,GAAI,QAAS,EAAG,QAAU,KAAM,cAAc,CAAE,EAAmBA,EAAM,cAAc,SAAU,CAAE,GAAI,QAAS,GAAI,QAAS,EAAG,QAAU,KAAM,cAAc,CAAE,CAAC,EC0B9iCC,EAA+C,CAAC,CAC3D,UAAAC,EACA,YAAAC,EACA,GAAGJ,CACL,IAEIK,EAAC,MAAA,CACC,UAAWC,EAAQ,CAAC,aAAcH,CAAS,CAAC,EAC5C,cAAY,aACX,GAAGH,EAEJ,SAAA,CAAAO,EAACC,GAAK,OAAQC,EAAM,KAAM,KAAM,OAAQ,IAAK,EAC5CL,GAAeG,EAAC,KAAA,CAAI,SAAAH,CAAA,CAAY,CAAA,CAAA,CAAA","x_google_ignoreList":[1]}
|
|
1
|
+
{"version":3,"file":"RequisitionListView.js","sources":["/@dropins/storefront-requisition-list/src/hooks/useRequisitionListEnabled.ts","../../node_modules/@adobe-commerce/elsie/src/icons/List.svg","/@dropins/storefront-requisition-list/src/hooks/useRequisitionListAlert.tsx","/@dropins/storefront-requisition-list/src/components/EmptyList/EmptyList.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useEffect, useState } from 'preact/compat';\nimport { state } from '@/requisitionList/lib/state';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const useRequisitionListEnabled = () => {\n const [isEnabled, setIsEnabled] = useState<boolean>(\n state.config?.is_requisition_list_active === '1' &&\n state.config?.company_enabled === true\n );\n\n useEffect(() => {\n // Listen for requisition list initialization via event bus\n const configListener = events.on('requisitionList/initialized', () => {\n setIsEnabled(\n state.config?.is_requisition_list_active === '1' &&\n state.config?.company_enabled === true\n );\n });\n\n return () => configListener?.off();\n }, []);\n\n return { isEnabled };\n};\n","import * as React from \"react\";\nconst SvgList = (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(\"rect\", { x: 4.89282, y: 2.75, width: 14.2143, height: 18.5, rx: 2.25, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"line\", { x1: 9.85718, y1: 7.67871, x2: 16.2857, y2: 7.67871, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"line\", { x1: 9.85718, y1: 11.9644, x2: 16.2857, y2: 11.9644, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"line\", { x1: 9.85718, y1: 16.25, x2: 16.2857, y2: 16.25, stroke: \"currentColor\", strokeWidth: 1 }), /* @__PURE__ */ React.createElement(\"circle\", { cx: 7.71429, cy: 7.71429, r: 0.714286, fill: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"circle\", { cx: 7.71429, cy: 11.9999, r: 0.714286, fill: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"circle\", { cx: 7.71429, cy: 16.2856, r: 0.714286, fill: \"currentColor\" }));\nexport default SvgList;\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 { 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","/********************************************************************\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 { List } 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={List} size={'64'} stroke={'2'} />\n {textContent && <h4>{textContent}</h4>}\n </div>\n );\n};\n"],"names":["useRequisitionListEnabled","isEnabled","setIsEnabled","useState","_a","state","_b","useEffect","configListener","events","SvgList","props","React","useRequisitionListAlert","translationsOverride","alert","setAlert","defaultTranslations","useText","translations","useMemo","messages","handleRequisitionListAlert","useCallback","payload","type","action","context","skus","timer","EmptyList","className","textContent","jsxs","classes","jsx","Icon","List"],"mappings":"wcAqBO,MAAMA,EAA4B,IAAM,SAC7C,KAAM,CAACC,EAAWC,CAAY,EAAIC,IAChCC,EAAAC,EAAM,SAAN,YAAAD,EAAc,8BAA+B,OAC3CE,EAAAD,EAAM,SAAN,YAAAC,EAAc,mBAAoB,EAAA,EAGtC,OAAAC,EAAU,IAAM,CAEd,MAAMC,EAAiBC,EAAO,GAAG,8BAA+B,IAAM,SACpEP,IACEE,EAAAC,EAAM,SAAN,YAAAD,EAAc,8BAA+B,OAC3CE,EAAAD,EAAM,SAAN,YAAAC,EAAc,mBAAoB,EAAA,CAExC,CAAC,EAED,MAAO,IAAME,GAAA,YAAAA,EAAgB,KAC/B,EAAG,CAAA,CAAE,EAEE,CAAE,UAAAP,CAAA,CACX,ECvCMS,EAAWC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ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
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{c as
|
|
3
|
+
import{c as m,R as a,f as I,h as _,e as T,t as c}from"./updateRequisitionList.js";import{events as q}from"@dropins/tools/event-bus.js";function R(i){var r;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,stock_status:i.inStock?"IN_STOCK":"OUT_OF_STOCK",only_x_left_in_stock:null,url:i.url||"",urlKey:i.urlKey||"",externalId:i.externalId||"",images:((r=i.images)==null?void 0:r.map(t=>({url:t.url,label:t.label||"",roles:t.roles||[]})))||[]}}function L(i){return i!=null&&i.length?i.map(R):[]}const E=`
|
|
4
4
|
query GET_REQUISITION_LIST_QUERY(
|
|
5
5
|
$requisitionListUid: String,
|
|
6
6
|
$currentPage: Int = 1,
|
|
@@ -23,9 +23,9 @@ import{c as _,R as a,f as I,h as m,e as T,t as c}from"./updateRequisitionList.js
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
${
|
|
26
|
+
${m}
|
|
27
27
|
${a}
|
|
28
|
-
`;function
|
|
28
|
+
`;function S(i){return!i||typeof i!="string"||i.length<2||!/^[A-Za-z0-9+/]+(==|=)?$/.test(i)?!1:i.length%4===0}const y=async(i,r,t)=>S(i)?I(E,{variables:{requisitionListUid:i,currentPage:r,pageSize:t}}).then(async({errors:n,data:s})=>{var u,o;if(n)return _(n);if(!((u=s==null?void 0:s.customer)!=null&&u.requisition_lists))return null;(o=s.customer.requisition_lists.items[0].items)!=null&&o.items&&(s.customer.requisition_lists.items[0].items.items=await T(s.customer.requisition_lists.items[0].items.items));const e=c(s.customer.requisition_lists.items[0]);return q.emit("requisitionList/data",e),e}):(console.error("Invalid requisition list UID format:",i),null),p=`
|
|
29
29
|
mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(
|
|
30
30
|
$requisitionListUid: ID!,
|
|
31
31
|
$requisitionListItems: [UpdateRequisitionListItemsInput!]!,
|
|
@@ -45,8 +45,8 @@ ${a}
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
${a}
|
|
48
|
-
${
|
|
49
|
-
`,A=async(i,r,t,n)=>I(
|
|
48
|
+
${m}
|
|
49
|
+
`,A=async(i,r,t,n)=>I(p,{variables:{requisitionListUid:i,requisitionListItems:r,pageSize:t,currentPage:n}}).then(async({errors:s,data:e})=>{var o,l;if(s)return _(s);if(!((o=e==null?void 0:e.updateRequisitionListItems)!=null&&o.requisition_list))return null;(l=e.updateRequisitionListItems.requisition_list.items)!=null&&l.items&&(e.updateRequisitionListItems.requisition_list.items.items=await T(e.updateRequisitionListItems.requisition_list.items.items));const u=c(e.updateRequisitionListItems.requisition_list);return q.emit("requisitionList/data",u),u}),U=`
|
|
50
50
|
mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(
|
|
51
51
|
$requisitionListUid: ID!,
|
|
52
52
|
$requisitionListItemUids: [ID!]!,
|
|
@@ -66,8 +66,8 @@ ${_}
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
${a}
|
|
69
|
-
${
|
|
70
|
-
`,P=async(i,r,t,n)=>I(U,{variables:{requisitionListUid:i,requisitionListItemUids:r,pageSize:t,currentPage:n}}).then(async({errors:s,data:e})=>{var o,l;if(s)return
|
|
69
|
+
${m}
|
|
70
|
+
`,P=async(i,r,t,n)=>I(U,{variables:{requisitionListUid:i,requisitionListItemUids:r,pageSize:t,currentPage:n}}).then(async({errors:s,data:e})=>{var o,l;if(s)return _(s);if(!((o=e==null?void 0:e.deleteRequisitionListItems)!=null&&o.requisition_list))return null;(l=e.deleteRequisitionListItems.requisition_list.items)!=null&&l.items&&(e.deleteRequisitionListItems.requisition_list.items.items=await T(e.deleteRequisitionListItems.requisition_list.items.items));const u=c(e.deleteRequisitionListItems.requisition_list);return q.emit("requisitionList/data",u),u}),d=`
|
|
71
71
|
fragment PRODUCT_FRAGMENT on ProductView {
|
|
72
72
|
__typename
|
|
73
73
|
id
|
|
@@ -207,7 +207,7 @@ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
${d}
|
|
210
|
-
`,$=async i=>I(f,{variables:{skus:i}}).then(({errors:r,data:t})=>r?
|
|
210
|
+
`,$=async i=>I(f,{variables:{skus:i}}).then(({errors:r,data:t})=>r?_(r):t!=null&&t.products?L(t.products):null),N=`
|
|
211
211
|
mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(
|
|
212
212
|
$requisitionListUid: ID!,
|
|
213
213
|
$requisitionListItemUids: [ID!]!
|
|
@@ -237,5 +237,5 @@ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
-
`,D=async(i,r)=>I(N,{variables:{requisitionListUid:i,requisitionListItemUids:r}}).then(({errors:t,data:n})=>{var s;return t?
|
|
240
|
+
`,D=async(i,r)=>I(N,{variables:{requisitionListUid:i,requisitionListItemUids:r}}).then(({errors:t,data:n})=>{var s;return t?_(t):(s=n.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors)!=null&&s.length?n.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(e=>e.type):null});export{D as a,$ as b,P as d,y as g,S as i,A as u};
|
|
241
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/lib/validate-uid.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\n/**\n * Validates if a string is a valid base64-encoded UID\n * Adobe Commerce/Magento UIDs are base64 encoded\n *\n * @param uid - The UID to validate\n * @returns true if the UID appears to be valid base64 encoding\n */\nexport function isValidBase64Uid(uid: string | undefined | null): boolean {\n if (!uid || typeof uid !== 'string' || uid.length < 2) {\n return false;\n }\n\n // Base64 pattern: alphanumeric, +, /\n // Valid base64 can end with 0, 1, or 2 '=' padding characters\n // But the length must be a multiple of 4 when padded\n const base64Pattern = /^[A-Za-z0-9+/]+(==|=)?$/;\n\n if (!base64Pattern.test(uid)) {\n return false;\n }\n\n // Check that the total length is a multiple of 4 (valid base64 requirement)\n return uid.length % 4 === 0;\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { isValidBase64Uid } from '@/requisitionList/lib/validate-uid';\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 // Validate UID format before making API call\n if (!isValidBase64Uid(requisitionListID)) {\n console.error('Invalid requisition list UID format:', requisitionListID);\n return null;\n }\n\n return fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.customer.requisition_lists.items[0].items?.items) {\n data.customer.requisition_lists.items[0].items.items =\n await enrichConfigurableProducts(\n data.customer.requisition_lists.items[0].items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.customer.requisition_lists.items[0]\n );\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\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(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionListItems?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.updateRequisitionListItems.requisition_list.items?.items) {\n data.updateRequisitionListItems.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.updateRequisitionListItems.requisition_list.items.items\n );\n }\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\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(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionListItems?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.deleteRequisitionListItems.requisition_list.items?.items) {\n data.deleteRequisitionListItems.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.deleteRequisitionListItems.requisition_list.items.items\n );\n }\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","isValidBase64Uid","uid","getRequisitionList","requisitionListID","currentPage","pageSize","fetchGraphQl","errors","handleFetchError","_b","enrichConfigurableProducts","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"],"mappings":"uIAsIO,SAASA,EAAiBC,EAA+B,OAC9D,MAAO,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,CAAC,MAClB,CAAA,CAAC,CAEd,CAEO,SAASC,EAAkBC,EAAuC,CACvE,OAAKA,GAAA,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BD,CAAM,EAErCf,GAAA,MAAAA,EAAM,SAIJG,EAAkBH,EAAK,QAAQ,EAH7B,IAIV,ECrBUiC,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,IAEOrB,EAAamB,EAA6C,CAC/D,UAAW,CACT,mBAAAT,EACA,wBAAAW,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAApB,EAAQ,KAAAf,KAAW,OAC5B,OAAIe,EAAeC,EAAiBD,CAAM,GAGxCd,EAAAD,EAAK,8BACF,iDADH,MAAAC,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtF,GAAW,EAAE,IAAA,EAGX,IACT,CAAC"}
|
|
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/lib/validate-uid.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 stock_status: data.inStock ? 'IN_STOCK' : 'OUT_OF_STOCK',\n only_x_left_in_stock: null,\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\n/**\n * Validates if a string is a valid base64-encoded UID\n * Adobe Commerce/Magento UIDs are base64 encoded\n *\n * @param uid - The UID to validate\n * @returns true if the UID appears to be valid base64 encoding\n */\nexport function isValidBase64Uid(uid: string | undefined | null): boolean {\n if (!uid || typeof uid !== 'string' || uid.length < 2) {\n return false;\n }\n\n // Base64 pattern: alphanumeric, +, /\n // Valid base64 can end with 0, 1, or 2 '=' padding characters\n // But the length must be a multiple of 4 when padded\n const base64Pattern = /^[A-Za-z0-9+/]+(==|=)?$/;\n\n if (!base64Pattern.test(uid)) {\n return false;\n }\n\n // Check that the total length is a multiple of 4 (valid base64 requirement)\n return uid.length % 4 === 0;\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { isValidBase64Uid } from '@/requisitionList/lib/validate-uid';\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 // Validate UID format before making API call\n if (!isValidBase64Uid(requisitionListID)) {\n console.error('Invalid requisition list UID format:', requisitionListID);\n return null;\n }\n\n return fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.customer.requisition_lists.items[0].items?.items) {\n data.customer.requisition_lists.items[0].items.items =\n await enrichConfigurableProducts(\n data.customer.requisition_lists.items[0].items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.customer.requisition_lists.items[0]\n );\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\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(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionListItems?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.updateRequisitionListItems.requisition_list.items?.items) {\n data.updateRequisitionListItems.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.updateRequisitionListItems.requisition_list.items.items\n );\n }\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\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(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionListItems?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.deleteRequisitionListItems.requisition_list.items?.items) {\n data.deleteRequisitionListItems.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.deleteRequisitionListItems.requisition_list.items.items\n );\n }\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","isValidBase64Uid","uid","getRequisitionList","requisitionListID","currentPage","pageSize","fetchGraphQl","errors","handleFetchError","_b","enrichConfigurableProducts","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"],"mappings":"uIAsIO,SAASA,EAAiBC,EAA+B,OAC9D,MAAO,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,aAAcA,EAAK,QAAU,WAAa,eAC1C,qBAAsB,KACtB,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,CAAC,MAClB,CAAA,CAAC,CAEd,CAEO,SAASC,EAAkBC,EAAuC,CACvE,OAAKA,GAAA,MAAAA,EAAU,OAERA,EAAS,IAAIL,CAAgB,EAFN,CAAA,CAGhC,CCjJO,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,ECnBpB,SAASC,EAAiBC,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AgC,MAC3CV,EACAW,IAEOrB,EAAamB,EAA6C,CAC/D,UAAW,CACT,mBAAAT,EACA,wBAAAW,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAApB,EAAQ,KAAAf,KAAW,OAC5B,OAAIe,EAAeC,EAAiBD,CAAM,GAGxCd,EAAAD,EAAK,8BACF,iDADH,MAAAC,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtF,GAAW,EAAE,IAAA,EAGX,IACT,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{R as
|
|
3
|
+
import{R as a,f as m,h as g,t as l}from"./updateRequisitionList.js";import{events as p}from"@dropins/tools/event-bus.js";const S=`
|
|
4
4
|
query GET_REQUISITION_LISTS_QUERY(
|
|
5
5
|
$currentPage: Int = 1
|
|
6
6
|
$pageSize: Int = 10,
|
|
@@ -19,6 +19,6 @@ import{R as I,f as a,h as c,t as g}from"./updateRequisitionList.js";import{event
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
${
|
|
23
|
-
`,
|
|
22
|
+
${a}
|
|
23
|
+
`,R=async(_,c)=>m(S,{variables:{currentPage:_,pageSize:c}}).then(({errors:e,data:t})=>{var s,r,n,o,u;if(e)return g(e);if(!((s=t==null?void 0:t.customer)!=null&&s.requisition_lists))return null;const i=t.customer.requisition_lists.items.map(I=>l(I));return p.emit("requisitionLists/data",i),{items:i,page_info:(n=(r=t.customer)==null?void 0:r.requisition_lists)==null?void 0:n.page_info,total_count:(u=(o=t.customer)==null?void 0:o.requisition_lists)==null?void 0:u.total_count}});export{R as g};
|
|
24
24
|
//# sourceMappingURL=getRequisitionLists.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.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 *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\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_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\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 getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\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 reqLists = data.customer.requisition_lists.items.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n );\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.customer?.requisition_lists?.page_info,\n };\n });\n};\n"],"names":["GET_REQUISITION_LISTS_QUERY","REQUISITION_LIST_FRAGMENT","getRequisitionLists","currentPage","pageSize","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","requisitionList","transformRequisitionList","events","_c","_b"],"mappings":"yHAkBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzCC,CAAyB;AAAA,ECbdC,EAAsB,MACjCC,EACAC,IAEOC,EAAaL,EAA6B,CAC/C,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,
|
|
1
|
+
{"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.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 *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\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_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\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 getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\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 reqLists = data.customer.requisition_lists.items.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n );\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.customer?.requisition_lists?.page_info,\n total_count: data.customer?.requisition_lists?.total_count,\n };\n });\n};\n"],"names":["GET_REQUISITION_LISTS_QUERY","REQUISITION_LIST_FRAGMENT","getRequisitionLists","currentPage","pageSize","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","requisitionList","transformRequisitionList","events","_c","_b","_e","_d"],"mappings":"yHAkBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzCC,CAAyB;AAAA,ECbdC,EAAsB,MACjCC,EACAC,IAEOC,EAAaL,EAA6B,CAC/C,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,eAC5B,GAAID,EAAQ,OAAOE,EAAiBF,CAAM,EAE1C,GAAI,GAACG,EAAAF,GAAA,YAAAA,EAAM,WAAN,MAAAE,EAAgB,mBACnB,OAAO,KAGT,MAAMC,EAAWH,EAAK,SAAS,kBAAkB,MAAM,IACpDI,GAAyBC,EAAyBD,CAAe,CAAA,EAGpE,OAAAE,EAAO,KAAK,wBAAyBH,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWI,GAAAC,EAAAR,EAAK,WAAL,YAAAQ,EAAe,oBAAf,YAAAD,EAAkC,UAC7C,aAAaE,GAAAC,EAAAV,EAAK,WAAL,YAAAU,EAAe,oBAAf,YAAAD,EAAkC,WAAA,CAEnD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{events as c}from"@dropins/tools/event-bus.js";import{FetchGraphQL as p}from"@dropins/tools/fetch-graphql.js";const d=e=>{const i=e.map(
|
|
3
|
+
import{events as c}from"@dropins/tools/event-bus.js";import{FetchGraphQL as p}from"@dropins/tools/fetch-graphql.js";const d=e=>{const i=e.map(o=>o.message).join(" ");throw Error(i)},{setEndpoint:E,setFetchGraphQlHeader:v,removeFetchGraphQlHeader:y,setFetchGraphQlHeaders:h,fetchGraphQl:l,getConfig:N}=new p().getMethods(),f=`
|
|
4
4
|
query REFINE_PRODUCT(
|
|
5
5
|
$optionIds: [String!]!,
|
|
6
6
|
$sku: String!
|
|
@@ -26,7 +26,7 @@ import{events as c}from"@dropins/tools/event-bus.js";import{FetchGraphQL as p}fr
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`,
|
|
29
|
+
`,I=e=>e.configurable_options.map(i=>btoa(`configurable/${atob(i.configurable_product_option_uid)}/${atob(i.configurable_product_option_value_uid)}`)),g=async e=>Promise.all(e.map(async i=>{if(!i.product||!i.configurable_options||i.configurable_options.length===0)return i;const o=I(i),{errors:s,data:n}=await l(f,{variables:{optionIds:o,sku:i.product.sku}});return s?(console.error("Failed to refine product:",s),i):n!=null&&n.refineProduct?{...i,configured_product:n.refineProduct}:i})),m=`
|
|
30
30
|
fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
|
|
31
31
|
uid
|
|
32
32
|
name
|
|
@@ -34,13 +34,15 @@ fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
|
|
|
34
34
|
items_count
|
|
35
35
|
updated_at
|
|
36
36
|
}
|
|
37
|
-
`;function b(e){var i,
|
|
37
|
+
`;function b(e){var i,o;return e?{uid:e.uid,name:e.name,description:e.description,updated_at:e.updated_at,items_count:e.items_count,items:T((i=e.items)==null?void 0:i.items),page_info:(o=e.items)==null?void 0:o.page_info}:null}function T(e){return e!=null&&e.length?e.map(i=>{var s,n,a,r;const o={uid:i.uid,sku:(s=i.product)==null?void 0:s.sku,quantity:i.quantity,stock_status:((n=i.product)==null?void 0:n.stock_status)||"IN_STOCK",only_x_left_in_stock:((a=i.product)==null?void 0:a.only_x_left_in_stock)??null,customizable_options:i.customizable_options?i.customizable_options.map(t=>({uid:t.customizable_option_uid,is_required:t.is_required,label:t.label,sort_order:t.sort_order,type:t.type,values:t.values.map(u=>({uid:u.customizable_option_value_uid,label:u.label,price:u.price,value:u.value}))})):[],bundle_options:i.bundle_options||[],configurable_options:i.configurable_options?i.configurable_options.map(t=>({option_uid:t.configurable_product_option_uid,option_label:t.option_label,value_uid:t.configurable_product_option_value_uid,value_label:t.value_label})):[],samples:i.samples?i.samples.map(t=>({url:t.sample_url,sort_order:t.sort_order,title:t.title})):[],gift_card_options:i.gift_card_options||{}};return(r=i.configured_product)!=null&&r.name?{...o,configured_product:i.configured_product}:o}):[]}const R=`
|
|
38
38
|
fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
|
|
39
39
|
items {
|
|
40
40
|
uid
|
|
41
41
|
quantity
|
|
42
42
|
product {
|
|
43
43
|
sku
|
|
44
|
+
stock_status
|
|
45
|
+
only_x_left_in_stock
|
|
44
46
|
}
|
|
45
47
|
customizable_options {
|
|
46
48
|
customizable_option_uid
|
|
@@ -149,6 +151,6 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
|
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
${m}
|
|
152
|
-
${
|
|
153
|
-
`,U=async(e,i,
|
|
154
|
+
${R}
|
|
155
|
+
`,U=async(e,i,o,s,n)=>l(q,{variables:{requisitionListUid:e,name:i,description:o,pageSize:s,currentPage:n}}).then(async({errors:a,data:r})=>{var u,_;if(a)return d(a);if(!((u=r==null?void 0:r.updateRequisitionList)!=null&&u.requisition_list))return null;(_=r.updateRequisitionList.requisition_list.items)!=null&&_.items&&(r.updateRequisitionList.requisition_list.items.items=await g(r.updateRequisitionList.requisition_list.items.items));const t=b(r.updateRequisitionList.requisition_list);return c.emit("requisitionList/data",t),t});export{m as R,v as a,h as b,R as c,g as e,l as f,N as g,d as h,y as r,E as s,b as t,U as u};
|
|
154
156
|
//# sourceMappingURL=updateRequisitionList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/api/refineProduct/graphql/refineProduct.ts","/@dropins/storefront-requisition-list/src/api/refineProduct/enrichConfigurableProducts.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListItemsFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/graphql/updateRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/updateRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\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 '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REFINE_PRODUCT = `\n query REFINE_PRODUCT(\n $optionIds: [String!]!,\n $sku: String!\n ) {\n refineProduct(\n optionIds: $optionIds\n sku: $sku\n ) {\n sku\n name\n images {\n url\n }\n ... on SimpleProductView {\n price {\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { Item, ConfigurableOption } from '@/requisitionList/data/models/item';\nimport { REFINE_PRODUCT } from '@/requisitionList/api/refineProduct/graphql/refineProduct';\n\n/**\n * Encodes option UID string into base64 string for refineProduct query\n * Example: 'configurable/93/13' -> 'Y29uZmlndXJhYmxlLzkzLzEz'\n */\nconst encodeOptionUids = (item: Item): string[] => {\n return item.configurable_options.map((option: ConfigurableOption) => {\n return btoa(\n `configurable/${atob(option.configurable_product_option_uid)}/${atob(\n option.configurable_product_option_value_uid\n )}`\n );\n });\n};\n\n/**\n * Enriches configurable products with variant data by calling the refineProduct query\n *\n * @param items - Array of requisition list items\n * @returns Promise resolving to array of items with configured_product populated for configurable items\n */\nexport const enrichConfigurableProducts = async (\n items: Item[]\n): Promise<Item[]> => {\n return Promise.all(\n items.map(async (item: Item) => {\n // Skip non-configurable items or items with no options selected\n if (\n !item.product ||\n !item.configurable_options ||\n item.configurable_options.length === 0\n ) {\n return item;\n }\n\n const optionIds = encodeOptionUids(item);\n\n const { errors, data: refineData } = await fetchGraphQl(REFINE_PRODUCT, {\n variables: {\n optionIds,\n sku: item.product.sku,\n },\n });\n\n if (errors) {\n console.error('Failed to refine product:', errors);\n return item;\n }\n\n if (!refineData?.refineProduct) {\n return item;\n }\n\n return {\n ...item,\n configured_product: refineData.refineProduct,\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\nexport const REQUISITION_LIST_FRAGMENT = `\nfragment REQUISITION_LIST_FRAGMENT on RequisitionList {\n uid\n name\n description\n items_count\n updated_at\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 { RequisitionList } from '../models/requisitionList';\nimport {\n Item,\n ConfiguredProduct,\n Link,\n Sample,\n BundleOption,\n ConfigurableOption,\n CustomizableOption,\n GiftCardOption,\n} from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n if (!data) {\n return null;\n }\n\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n };\n quantity: number;\n customizable_options?: CustomizableOption[];\n bundle_options?: BundleOption[];\n configurable_options?: ConfigurableOption[];\n configured_product?: ConfiguredProduct;\n links?: Link[];\n samples?: Sample[];\n gift_card_options?: GiftCardOption;\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n const transformedItem = {\n uid: item.uid,\n sku: item.product?.sku,\n quantity: item.quantity,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map((value) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n\n if (item.configured_product?.name) {\n return {\n ...transformedItem,\n configured_product: item.configured_product,\n };\n }\n return transformedItem;\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 REQUISITION_LIST_ITEMS_FRAGMENT = `\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { 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_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n $name: String!,\n $description: String,\n $pageSize: Int,\n $currentPage: Int\n ) {\n updateRequisitionList(\n requisitionListUid: $requisitionListUid\n input: {\n name: $name\n description: $description\n }\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/updateRequisitionList/graphql/updateRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionList = async (\n requisitionListUid: string,\n name: string,\n description?: string,\n pageSize?: number,\n currentPage?: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n name,\n description,\n pageSize,\n currentPage,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionList?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.updateRequisitionList.requisition_list.items?.items) {\n data.updateRequisitionList.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.updateRequisitionList.requisition_list.items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.updateRequisitionList.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n"],"names":["handleFetchError","errors","errorMessage","e","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","REFINE_PRODUCT","encodeOptionUids","item","option","enrichConfigurableProducts","items","optionIds","refineData","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","transformedItem","value","sample","REQUISITION_LIST_ITEMS_FRAGMENT","UPDATE_REQUISITION_LIST_MUTATION","updateRequisitionList","requisitionListUid","name","description","pageSize","currentPage","payload","events"],"mappings":"oHAkBO,MAAMA,EAAoBC,GAAuC,CACtE,MAAMC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECHa,CACX,YAAAE,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECTVC,EAAiB;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,ECQxBC,EAAoBC,GACjBA,EAAK,qBAAqB,IAAKC,GAC7B,KACL,gBAAgB,KAAKA,EAAO,+BAA+B,CAAC,IAAI,KAC9DA,EAAO,qCAAA,CACR,EAAA,CAEJ,EASUC,EAA6B,MACxCC,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AAA;AAAA;AAAA;AAAA,EAuB9CV,CAAyB;AAAA,EACzBS,CAA+B;AAAA,EClBpBE,EAAwB,MACnCC,EACAC,EACAC,EACAC,EACAC,IAEO3B,EAAaqB,EAAkC,CACpD,UAAW,CACT,mBAAAE,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,EACA,YAAAC,CAAA,CACF,CACD,EAAE,KAAK,MAAO,CAAE,OAAAlC,EAAQ,KAAAoB,KAAW,SAClC,GAAIpB,EAAQ,OAAOD,EAAiBC,CAAM,EAE1C,GAAI,GAACsB,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,kBAChC,OAAO,MAILC,EAAAH,EAAK,sBAAsB,iBAAiB,QAA5C,MAAAG,EAAmD,QACrDH,EAAK,sBAAsB,iBAAiB,MAAM,MAChD,MAAMN,EACJM,EAAK,sBAAsB,iBAAiB,MAAM,KAAA,GAIxD,MAAMe,EAAUhB,EACdC,EAAK,sBAAsB,gBAAA,EAG7B,OAAAgB,EAAO,KAAK,uBAAwBD,CAAO,EAEpCA,CACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"updateRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/api/refineProduct/graphql/refineProduct.ts","/@dropins/storefront-requisition-list/src/api/refineProduct/enrichConfigurableProducts.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListItemsFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/graphql/updateRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/updateRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\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 '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REFINE_PRODUCT = `\n query REFINE_PRODUCT(\n $optionIds: [String!]!,\n $sku: String!\n ) {\n refineProduct(\n optionIds: $optionIds\n sku: $sku\n ) {\n sku\n name\n images {\n url\n }\n ... on SimpleProductView {\n price {\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { Item, ConfigurableOption } from '@/requisitionList/data/models/item';\nimport { REFINE_PRODUCT } from '@/requisitionList/api/refineProduct/graphql/refineProduct';\n\n/**\n * Encodes option UID string into base64 string for refineProduct query\n * Example: 'configurable/93/13' -> 'Y29uZmlndXJhYmxlLzkzLzEz'\n */\nconst encodeOptionUids = (item: Item): string[] => {\n return item.configurable_options.map((option: ConfigurableOption) => {\n return btoa(\n `configurable/${atob(option.configurable_product_option_uid)}/${atob(\n option.configurable_product_option_value_uid\n )}`\n );\n });\n};\n\n/**\n * Enriches configurable products with variant data by calling the refineProduct query\n *\n * @param items - Array of requisition list items\n * @returns Promise resolving to array of items with configured_product populated for configurable items\n */\nexport const enrichConfigurableProducts = async (\n items: Item[]\n): Promise<Item[]> => {\n return Promise.all(\n items.map(async (item: Item) => {\n // Skip non-configurable items or items with no options selected\n if (\n !item.product ||\n !item.configurable_options ||\n item.configurable_options.length === 0\n ) {\n return item;\n }\n\n const optionIds = encodeOptionUids(item);\n\n const { errors, data: refineData } = await fetchGraphQl(REFINE_PRODUCT, {\n variables: {\n optionIds,\n sku: item.product.sku,\n },\n });\n\n if (errors) {\n console.error('Failed to refine product:', errors);\n return item;\n }\n\n if (!refineData?.refineProduct) {\n return item;\n }\n\n return {\n ...item,\n configured_product: refineData.refineProduct,\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\nexport const REQUISITION_LIST_FRAGMENT = `\nfragment REQUISITION_LIST_FRAGMENT on RequisitionList {\n uid\n name\n description\n items_count\n updated_at\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 { RequisitionList } from '../models/requisitionList';\nimport {\n Item,\n ConfiguredProduct,\n Link,\n Sample,\n BundleOption,\n ConfigurableOption,\n RawCustomizableOption,\n GiftCardOption,\n} from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n if (!data) {\n return null;\n }\n\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n stock_status?: string;\n only_x_left_in_stock?: number | null;\n };\n quantity: number;\n customizable_options?: RawCustomizableOption[];\n bundle_options?: BundleOption[];\n configurable_options?: ConfigurableOption[];\n configured_product?: ConfiguredProduct;\n links?: Link[];\n samples?: Sample[];\n gift_card_options?: GiftCardOption;\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n const transformedItem = {\n uid: item.uid,\n sku: item.product?.sku,\n quantity: item.quantity,\n stock_status: (item.product?.stock_status || 'IN_STOCK') as\n | 'IN_STOCK'\n | 'OUT_OF_STOCK',\n only_x_left_in_stock: item.product?.only_x_left_in_stock ?? null,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map(\n (value: RawCustomizableOption['values'][number]) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })\n ),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n\n if (item.configured_product?.name) {\n return {\n ...transformedItem,\n configured_product: item.configured_product,\n };\n }\n return transformedItem;\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 REQUISITION_LIST_ITEMS_FRAGMENT = `\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n stock_status\n only_x_left_in_stock\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { 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_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n $name: String!,\n $description: String,\n $pageSize: Int,\n $currentPage: Int\n ) {\n updateRequisitionList(\n requisitionListUid: $requisitionListUid\n input: {\n name: $name\n description: $description\n }\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 { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/updateRequisitionList/graphql/updateRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionList = async (\n requisitionListUid: string,\n name: string,\n description?: string,\n pageSize?: number,\n currentPage?: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n name,\n description,\n pageSize,\n currentPage,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionList?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.updateRequisitionList.requisition_list.items?.items) {\n data.updateRequisitionList.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.updateRequisitionList.requisition_list.items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.updateRequisitionList.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n"],"names":["handleFetchError","errors","errorMessage","e","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","REFINE_PRODUCT","encodeOptionUids","item","option","enrichConfigurableProducts","items","optionIds","refineData","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","transformedItem","_c","value","sample","_d","REQUISITION_LIST_ITEMS_FRAGMENT","UPDATE_REQUISITION_LIST_MUTATION","updateRequisitionList","requisitionListUid","name","description","pageSize","currentPage","payload","events"],"mappings":"oHAkBO,MAAMA,EAAoBC,GAAuC,CACtE,MAAMC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECHa,CACX,YAAAE,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECTVC,EAAiB;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,ECQxBC,EAAoBC,GACjBA,EAAK,qBAAqB,IAAKC,GAC7B,KACL,gBAAgB,KAAKA,EAAO,+BAA+B,CAAC,IAAI,KAC9DA,EAAO,qCAAA,CACR,EAAA,CAEJ,EASUC,EAA6B,MACxCC,GAEO,QAAQ,IACbA,EAAM,IAAI,MAAOH,GAAe,CAE9B,GACE,CAACA,EAAK,SACN,CAACA,EAAK,sBACNA,EAAK,qBAAqB,SAAW,EAErC,OAAOA,EAGT,MAAMI,EAAYL,EAAiBC,CAAI,EAEjC,CAAE,OAAAZ,EAAQ,KAAMiB,GAAe,MAAMV,EAAaG,EAAgB,CACtE,UAAW,CACT,UAAAM,EACA,IAAKJ,EAAK,QAAQ,GAA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