@dropins/storefront-requisition-list 1.1.0-beta1 → 1.2.0-alpha1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/deleteRequisitionListItems/deleteRequisitionListItems.d.ts +2 -1
- package/api/fragments.d.ts +0 -1
- package/api/getRequisitionList/getRequisitionList.d.ts +2 -1
- package/api/index.d.ts +0 -2
- package/api/updateRequisitionList/updateRequisitionList.d.ts +2 -1
- package/api/updateRequisitionListItems/updateRequisitionListItems.d.ts +2 -1
- package/api.js +2 -2
- package/api.js.map +1 -1
- package/chunks/RequisitionListHeader.js +1 -1
- package/chunks/RequisitionListHeader.js.map +1 -1
- package/chunks/addRequisitionListItemsToCart.js +11 -151
- package/chunks/addRequisitionListItemsToCart.js.map +1 -1
- package/chunks/updateRequisitionList.js +6 -32
- package/chunks/updateRequisitionList.js.map +1 -1
- package/containers/RequisitionListHeader/RequisitionListHeader.d.ts +2 -0
- package/containers/RequisitionListView/RequisitionListView.d.ts +3 -0
- package/containers/RequisitionListView.js +1 -1
- package/containers/RequisitionListView.js.map +1 -1
- package/package.json +1 -1
- package/api/fragments/ProductFragment.graphql.d.ts +0 -18
- package/api/getProductData/getProductData.d.ts +0 -4
- package/api/getProductData/graphql/getProductData.d.ts +0 -18
- package/api/getProductData/index.d.ts +0 -18
- package/api/refineProduct/enrichConfigurableProducts.d.ts +0 -10
- package/api/refineProduct/graphql/refineProduct.d.ts +0 -18
- package/api/refineProduct/index.d.ts +0 -18
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
|
+
import { Item } from '../../data/models/item';
|
|
2
3
|
|
|
3
|
-
export declare const deleteRequisitionListItems: (requisitionListUid: string, items: Array<string>, pageSize: number, currentPage: number) => Promise<RequisitionList | null>;
|
|
4
|
+
export declare const deleteRequisitionListItems: (requisitionListUid: string, items: Array<string>, pageSize: number, currentPage: number, enrichConfigurableProducts?: ((items: Item[]) => Promise<Item[]>) | undefined) => Promise<RequisitionList | null>;
|
|
4
5
|
//# sourceMappingURL=deleteRequisitionListItems.d.ts.map
|
package/api/fragments.d.ts
CHANGED
|
@@ -16,5 +16,4 @@
|
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export { REQUISITION_LIST_ITEMS_FRAGMENT } from './fragments/RequisitionListItemsFragment.graphql';
|
|
18
18
|
export { REQUISITION_LIST_FRAGMENT } from './fragments/RequisitionListFragment.graphql';
|
|
19
|
-
export { PRODUCT_FRAGMENT } from './fragments/ProductFragment.graphql';
|
|
20
19
|
//# sourceMappingURL=fragments.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
|
+
import { Item } from '../../data/models/item';
|
|
2
3
|
|
|
3
|
-
export declare const getRequisitionList: (requisitionListID: string, currentPage?: number, pageSize?: number) => Promise<RequisitionList | null>;
|
|
4
|
+
export declare const getRequisitionList: (requisitionListID: string, currentPage?: number, pageSize?: number, enrichConfigurableProducts?: ((items: Item[]) => Promise<Item[]>) | undefined) => Promise<RequisitionList | null>;
|
|
4
5
|
//# sourceMappingURL=getRequisitionList.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*******************************************************************/
|
|
17
17
|
export * from './initialize';
|
|
18
18
|
export * from './fetch-graphql';
|
|
19
|
-
export * from './refineProduct';
|
|
20
19
|
export * from './getStoreConfig';
|
|
21
20
|
export * from './getRequisitionLists';
|
|
22
21
|
export * from './getRequisitionList';
|
|
@@ -27,5 +26,4 @@ export * from './updateRequisitionListItems';
|
|
|
27
26
|
export * from './deleteRequisitionListItems';
|
|
28
27
|
export * from './addProductsToRequisitionList';
|
|
29
28
|
export * from './addRequisitionListItemsToCart';
|
|
30
|
-
export * from './getProductData';
|
|
31
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
|
+
import { Item } from '../../data/models/item';
|
|
2
3
|
|
|
3
|
-
export declare const updateRequisitionList: (requisitionListUid: string, name: string, description?: string, pageSize?: number, currentPage?: number) => Promise<RequisitionList | null>;
|
|
4
|
+
export declare const updateRequisitionList: (requisitionListUid: string, name: string, description?: string, pageSize?: number, currentPage?: number, enrichConfigurableProducts?: ((items: Item[]) => Promise<Item[]>) | undefined) => Promise<RequisitionList | null>;
|
|
4
5
|
//# sourceMappingURL=updateRequisitionList.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
|
+
import { Item } from '../../data/models/item';
|
|
2
3
|
|
|
3
|
-
export declare const updateRequisitionListItems: (requisitionListUid: string, requisitionListItems: Array<UpdateRequisitionListItemsInput>, pageSize: number, currentPage: number) => Promise<RequisitionList | null>;
|
|
4
|
+
export declare const updateRequisitionListItems: (requisitionListUid: string, requisitionListItems: Array<UpdateRequisitionListItemsInput>, pageSize: number, currentPage: number, enrichConfigurableProducts?: ((items: Item[]) => Promise<Item[]>) | undefined) => Promise<RequisitionList | null>;
|
|
4
5
|
type UpdateRequisitionListItemsInput = {
|
|
5
6
|
item_id: string;
|
|
6
7
|
quantity?: number;
|
package/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{f as
|
|
3
|
+
import{f as a,h as r}from"./chunks/updateRequisitionList.js";import{g as R,r as y,s as F,a as L,b as E,u as G}from"./chunks/updateRequisitionList.js";import{events as n}from"@dropins/tools/event-bus.js";import{g as Q}from"./chunks/getRequisitionLists.js";import{a as x,d as b,g as O,u as w}from"./chunks/addRequisitionListItemsToCart.js";import{d as H}from"./chunks/deleteRequisitionList.js";import{Initializer as c}from"@dropins/tools/lib.js";import{s as t}from"./chunks/state.js";import"@dropins/tools/fetch-graphql.js";const f=`
|
|
4
4
|
query STORE_CONFIG_QUERY {
|
|
5
5
|
storeConfig {
|
|
6
6
|
is_requisition_list_active
|
|
7
7
|
company_enabled
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
`,
|
|
10
|
+
`,m=async()=>{try{const{errors:e,data:i}=await a(f,{cache:"force-cache"});return e?e.some(s=>s.message&&s.message.includes('Cannot query field "is_requisition_list_active"')||s.message.includes('Cannot query field "company_enabled"'))?!1:r(e):i==null?void 0:i.storeConfig}catch{return{is_requisition_list_active:"0",company_enabled:!1}}},o=new c({init:async e=>{const i={};t.config||(t.config=await m(),n.emit("requisitionList/initialized",t.config)),o.config.setConfig({...i,...e})},listeners:()=>[n.on("authenticated",e=>{t.authenticated=e})]}),_=o.config;export{x as addRequisitionListItemsToCart,_ as config,H as deleteRequisitionList,b as deleteRequisitionListItems,a as fetchGraphQl,R as getConfig,O as getRequisitionList,Q as getRequisitionLists,m as getStoreConfig,o as initialize,y as removeFetchGraphQlHeader,F as setEndpoint,L as setFetchGraphQlHeader,E as setFetchGraphQlHeaders,G as updateRequisitionList,w as updateRequisitionListItems};
|
|
11
11
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-requisition-list/src/api/getStoreConfig/graphql/storeConfigQuery.ts","/@dropins/storefront-requisition-list/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-requisition-list/src/api/initialize/initialize.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const STORE_CONFIG_QUERY = `\nquery STORE_CONFIG_QUERY {\n storeConfig {\n is_requisition_list_active\n company_enabled\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';\n\nimport { STORE_CONFIG_QUERY } from './graphql/storeConfigQuery';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { StoreConfig } from '@/requisitionList/lib/state';\n\nexport const getStoreConfig = async (): Promise<any> => {\n try {\n const { errors, data } = await fetchGraphQl(STORE_CONFIG_QUERY, {\n cache: 'force-cache',\n });\n\n if (errors) {\n const missingField = errors.some(\n (error) =>\n (error.message &&\n error.message.includes(\n 'Cannot query field \"is_requisition_list_active\"'\n )) ||\n error.message.includes('Cannot query field \"company_enabled\"')\n );\n if (missingField) {\n return false;\n }\n return handleFetchError(errors);\n }\n\n return data?.storeConfig;\n } catch {\n return {\n is_requisition_list_active: '0',\n company_enabled: false,\n } as StoreConfig;\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/requisitionList/lib/state';\nimport { getStoreConfig } from '@/requisitionList/api/getStoreConfig';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n // set config\n if (!state.config) {\n state.config = await getStoreConfig();\n // Emit event to notify listeners that requisition list has been initialized\n events.emit('requisitionList/initialized', state.config);\n }\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', (authenticated) => {\n state.authenticated = authenticated;\n }),\n ],\n});\n\nexport const config = initialize.config;\n"],"names":["STORE_CONFIG_QUERY","getStoreConfig","errors","data","fetchGraphQl","error","handleFetchError","initialize","Initializer","config","defaultConfig","state","events","authenticated"],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-requisition-list/src/api/getStoreConfig/graphql/storeConfigQuery.ts","/@dropins/storefront-requisition-list/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-requisition-list/src/api/initialize/initialize.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const STORE_CONFIG_QUERY = `\nquery STORE_CONFIG_QUERY {\n storeConfig {\n is_requisition_list_active\n company_enabled\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';\n\nimport { STORE_CONFIG_QUERY } from './graphql/storeConfigQuery';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { StoreConfig } from '@/requisitionList/lib/state';\n\nexport const getStoreConfig = async (): Promise<any> => {\n try {\n const { errors, data } = await fetchGraphQl(STORE_CONFIG_QUERY, {\n cache: 'force-cache',\n });\n\n if (errors) {\n const missingField = errors.some(\n (error) =>\n (error.message &&\n error.message.includes(\n 'Cannot query field \"is_requisition_list_active\"'\n )) ||\n error.message.includes('Cannot query field \"company_enabled\"')\n );\n if (missingField) {\n return false;\n }\n return handleFetchError(errors);\n }\n\n return data?.storeConfig;\n } catch {\n return {\n is_requisition_list_active: '0',\n company_enabled: false,\n } as StoreConfig;\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 { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/requisitionList/lib/state';\nimport { getStoreConfig } from '@/requisitionList/api/getStoreConfig';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n // set config\n if (!state.config) {\n state.config = await getStoreConfig();\n // Emit event to notify listeners that requisition list has been initialized\n events.emit('requisitionList/initialized', state.config);\n }\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', (authenticated) => {\n state.authenticated = authenticated;\n }),\n ],\n});\n\nexport const config = initialize.config;\n"],"names":["STORE_CONFIG_QUERY","getStoreConfig","errors","data","fetchGraphQl","error","handleFetchError","initialize","Initializer","config","defaultConfig","state","events","authenticated"],"mappings":"0gBAiBO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMrBC,EAAiB,SAA0B,CACtD,GAAI,CACF,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAA,EAAS,MAAMC,EAAaJ,EAAoB,CAC9D,MAAO,aAAA,CACR,EAED,OAAIE,EACmBA,EAAO,KACzBG,GACEA,EAAM,SACLA,EAAM,QAAQ,SACZ,iDAAA,GAEJA,EAAM,QAAQ,SAAS,sCAAsC,CAAA,EAGxD,GAEFC,EAAiBJ,CAAM,EAGzBC,GAAA,YAAAA,EAAM,WACf,MAAQ,CACN,MAAO,CACL,2BAA4B,IAC5B,gBAAiB,EAAA,CAErB,CACF,ECxBaI,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAA,EAGjBC,EAAM,SACTA,EAAM,OAAS,MAAMV,EAAA,EAErBW,EAAO,KAAK,8BAA+BD,EAAM,MAAM,GAGzDJ,EAAW,OAAO,UAAU,CAAE,GAAGG,EAAe,GAAGD,EAAQ,CAC7D,EAEA,UAAW,IAAM,CACfG,EAAO,GAAG,gBAAkBC,GAAkB,CAC5CF,EAAM,cAAgBE,CACxB,CAAC,CAAA,CAEL,CAAC,EAEYJ,EAASF,EAAW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as m,jsx as t,Fragment as
|
|
3
|
+
import{jsxs as m,jsx as t,Fragment as N}from"@dropins/tools/preact-jsx-runtime.js";import{useState as L,useCallback as p}from"@dropins/tools/preact-hooks.js";import{R as _}from"./RequisitionListModal.js";import{R as b}from"./RequisitionListForm.js";import{u as k}from"./updateRequisitionList.js";import{d as M}from"./deleteRequisitionList.js";import{useText as x}from"@dropins/tools/i18n.js";const T=({name:i,description:a,backLink:s,actions:e,className:u,...f})=>m("div",{...f,className:`requisition-list-header ${u||""}`,children:[s&&t("div",{className:"requisition-list-header__back",children:m("a",{href:s.url,className:"requisition-list-header__back-link",onClick:s.onClick,children:[t("span",{className:"requisition-list-header__back-arrow",children:"<"}),s.label]})}),m("div",{className:"requisition-list-header__main",children:[m("div",{className:"requisition-list-header__title-section",children:[t("h1",{className:"requisition-list-header__title",children:i}),a&&t("p",{className:"requisition-list-header__description",children:a})]}),e&&(e.onRename||e.onDelete)&&m("div",{className:"requisition-list-header__actions",children:[e.onRename&&t("a",{href:"#",onClick:n=>{var l;n.preventDefault(),(l=e.onRename)==null||l.call(e)},className:"requisition-list-header__action-link","data-testid":"rename-list-btn",children:e.renameLabel}),e.onDelete&&t("a",{href:"#",onClick:n=>{var l;n.preventDefault(),(l=e.onDelete)==null||l.call(e)},className:"requisition-list-header__action-link","data-testid":"delete-list-btn",children:e.deleteLabel})]})]})]}),H=({requisitionList:i,routeRequisitionListGrid:a,onUpdate:s,onAlert:e,enrichConfigurableProducts:u})=>{const[f,n]=L(!1),[l,h]=L(!1),[g,q]=L(!1),o=x({actionBackToRequisitionLists:"RequisitionList.RequisitionListView.actionBackToRequisitionLists",actionRename:"RequisitionList.RequisitionListView.actionRename",actionDeleteList:"RequisitionList.RequisitionListView.actionDeleteList",deleteListTitle:"RequisitionList.RequisitionListView.deleteListTitle",deleteListMessage:"RequisitionList.RequisitionListView.deleteListMessage",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",updateTitle:"RequisitionList.RequisitionListForm.updateTitle"}),w=p(()=>{n(!0)},[]),y=p(async d=>{var c,r;try{const R=await k(i.uid,d.name,d.description,(c=i.page_info)==null?void 0:c.page_size,(r=i.page_info)==null?void 0:r.current_page,u);R?(s==null||s(R),n(!1),e==null||e({action:"update",type:"success",context:"requisitionList"})):e==null||e({action:"update",type:"error",context:"requisitionList"})}catch{e==null||e({action:"update",type:"error",context:"requisitionList"})}},[i.uid,i.page_info,s,e,u]),D=p(()=>{h(!0)},[]),C=p(async()=>{q(!0);try{if(await M(i.uid)){const c={action:"delete",type:"success",context:"requisitionList"};try{localStorage.setItem("requisitionListPendingAlert",JSON.stringify(c))}catch{}if(a){const r=a();r&&typeof r=="string"&&(window.location.href=r)}}else e==null||e({action:"delete",type:"error",context:"requisitionList"})}catch{e==null||e({action:"delete",type:"error",context:"requisitionList"})}finally{q(!1),h(!1)}},[i.uid,a,e]);return m(N,{children:[t(T,{name:i.name,description:i.description,backLink:a?{url:"#",label:o.actionBackToRequisitionLists,onClick:d=>{d.preventDefault();const c=a();c&&typeof c=="string"&&(window.location.href=c)}}:void 0,actions:{onRename:w,onDelete:D,renameLabel:o.actionRename,deleteLabel:o.actionDeleteList}}),f&&t(_,{isOpen:f,isLoading:!1,title:o.updateTitle,modalContent:t(b,{mode:"update",defaultValues:{name:i.name,description:i.description||""},onSubmit:y,onCancel:()=>n(!1)}),handleModalOnClose:()=>n(!1)}),l&&t(_,{isOpen:l,isLoading:g,title:o.deleteListTitle,modalContent:o.deleteListMessage,confirmBtnCaption:o.confirmAction,closeBtnCaption:o.cancelAction,handleModalOnClose:()=>h(!1),handleModalOnConfirm:C})]})};export{H as R};
|
|
4
4
|
//# sourceMappingURL=RequisitionListHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequisitionListHeader.js","sources":["/@dropins/storefront-requisition-list/src/components/RequisitionListHeader/RequisitionListHeader.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListHeader/RequisitionListHeader.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader.css';\n\nexport interface RequisitionListHeaderProps\n extends HTMLAttributes<HTMLDivElement> {\n name: string;\n description?: string;\n backLink?: {\n url: string;\n label: string;\n onClick?: (e: Event) => void;\n };\n actions?: {\n onRename?: () => void;\n onDelete?: () => void;\n renameLabel?: string;\n deleteLabel?: string;\n };\n}\n\nexport const RequisitionListHeader: FunctionComponent<\n RequisitionListHeaderProps\n> = ({ name, description, backLink, actions, className, ...props }) => {\n return (\n <div {...props} className={`requisition-list-header ${className || ''}`}>\n {/* Back Link */}\n {backLink && (\n <div className=\"requisition-list-header__back\">\n <a\n href={backLink.url}\n className=\"requisition-list-header__back-link\"\n onClick={backLink.onClick}\n >\n <span className=\"requisition-list-header__back-arrow\"><</span>\n {backLink.label}\n </a>\n </div>\n )}\n\n {/* Title and Actions Row */}\n <div className=\"requisition-list-header__main\">\n <div className=\"requisition-list-header__title-section\">\n <h1 className=\"requisition-list-header__title\">{name}</h1>\n {description && (\n <p className=\"requisition-list-header__description\">\n {description}\n </p>\n )}\n </div>\n\n {/* Action Links */}\n {actions && (actions.onRename || actions.onDelete) && (\n <div className=\"requisition-list-header__actions\">\n {actions.onRename && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onRename?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"rename-list-btn\"\n >\n {actions.renameLabel}\n </a>\n )}\n {actions.onDelete && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onDelete?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"delete-list-btn\"\n >\n {actions.deleteLabel}\n </a>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { RequisitionListHeader as RequisitionListHeaderComponent } from '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader';\nimport { RequisitionListForm } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport { RequisitionListModal } from '@/requisitionList/components/RequisitionListModal/RequisitionListModal';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList';\nimport { deleteRequisitionList } from '@/requisitionList/api/deleteRequisitionList';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport interface RequisitionListHeaderProps {\n requisitionList: RequisitionList;\n routeRequisitionListGrid?: () => string | void;\n onUpdate?: (updatedList: RequisitionList) => void | Promise<void>;\n onAlert?: (payload: {\n action: string;\n type: string;\n context: string;\n }) => void;\n}\n\nexport const RequisitionListHeader: Container<RequisitionListHeaderProps> = ({\n requisitionList,\n routeRequisitionListGrid,\n onUpdate,\n onAlert,\n}) => {\n const [showRenameModal, setShowRenameModal] = useState<boolean>(false);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [isDeleting, setIsDeleting] = useState<boolean>(false);\n\n const translations = useText({\n actionBackToRequisitionLists: `RequisitionList.RequisitionListView.actionBackToRequisitionLists`,\n actionRename: `RequisitionList.RequisitionListView.actionRename`,\n actionDeleteList: `RequisitionList.RequisitionListView.actionDeleteList`,\n deleteListTitle: `RequisitionList.RequisitionListView.deleteListTitle`,\n deleteListMessage: `RequisitionList.RequisitionListView.deleteListMessage`,\n confirmAction: `RequisitionList.RequisitionListWrapper.confirmAction`,\n cancelAction: `RequisitionList.RequisitionListWrapper.cancelAction`,\n updateTitle: `RequisitionList.RequisitionListForm.updateTitle`,\n });\n\n const handleRename = useCallback(() => {\n setShowRenameModal(true);\n }, []);\n\n const handleRenameSubmit = useCallback(\n async (values: { name: string; description?: string }) => {\n try {\n const updatedList = await updateRequisitionList(\n requisitionList.uid,\n values.name,\n values.description,\n requisitionList.page_info?.page_size,\n requisitionList.page_info?.current_page\n );\n if (updatedList) {\n onUpdate?.(updatedList);\n setShowRenameModal(false);\n onAlert?.({\n action: 'update',\n type: 'success',\n context: 'requisitionList',\n });\n } else {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n },\n [requisitionList.uid, requisitionList.page_info, onUpdate, onAlert]\n );\n\n const handleDeleteList = useCallback(() => {\n setShowDeleteModal(true);\n }, []);\n\n const handleDeleteConfirm = useCallback(async () => {\n setIsDeleting(true);\n try {\n const result = await deleteRequisitionList(requisitionList.uid);\n if (result) {\n const alertPayload = {\n action: 'delete',\n type: 'success',\n context: 'requisitionList',\n };\n\n // Store alert in localStorage before redirecting\n // This ensures the alert is shown after redirect to grid view\n try {\n localStorage.setItem(\n 'requisitionListPendingAlert',\n JSON.stringify(alertPayload)\n );\n } catch (e) {\n // Ignore localStorage errors (e.g., in private browsing mode)\n }\n\n if (routeRequisitionListGrid) {\n const url = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (url && typeof url === 'string') {\n window.location.href = url;\n }\n }\n } else {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n } finally {\n setIsDeleting(false);\n setShowDeleteModal(false);\n }\n }, [requisitionList.uid, routeRequisitionListGrid, onAlert]);\n\n return (\n <>\n <RequisitionListHeaderComponent\n name={requisitionList.name}\n description={requisitionList.description}\n backLink={\n routeRequisitionListGrid\n ? {\n url: '#',\n label: translations.actionBackToRequisitionLists,\n onClick: (e: Event) => {\n e.preventDefault();\n const result = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (result && typeof result === 'string') {\n window.location.href = result;\n }\n },\n }\n : undefined\n }\n actions={{\n onRename: handleRename,\n onDelete: handleDeleteList,\n renameLabel: translations.actionRename,\n deleteLabel: translations.actionDeleteList,\n }}\n />\n\n {/* Rename Modal */}\n {showRenameModal && (\n <RequisitionListModal\n isOpen={showRenameModal}\n isLoading={false}\n title={translations.updateTitle}\n modalContent={\n <RequisitionListForm\n mode=\"update\"\n defaultValues={{\n name: requisitionList.name,\n description: requisitionList.description || '',\n }}\n onSubmit={handleRenameSubmit}\n onCancel={() => setShowRenameModal(false)}\n />\n }\n handleModalOnClose={() => setShowRenameModal(false)}\n />\n )}\n\n {/* Delete Confirmation Modal */}\n {showDeleteModal && (\n <RequisitionListModal\n isOpen={showDeleteModal}\n isLoading={isDeleting}\n title={translations.deleteListTitle}\n modalContent={translations.deleteListMessage}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={() => setShowDeleteModal(false)}\n handleModalOnConfirm={handleDeleteConfirm}\n />\n )}\n </>\n );\n};\n"],"names":["RequisitionListHeader","name","description","backLink","actions","className","props","jsxs","jsx","e","_a","requisitionList","routeRequisitionListGrid","onUpdate","onAlert","showRenameModal","setShowRenameModal","useState","showDeleteModal","setShowDeleteModal","isDeleting","setIsDeleting","translations","useText","handleRename","useCallback","handleRenameSubmit","values","updatedList","updateRequisitionList","_b","handleDeleteList","handleDeleteConfirm","deleteRequisitionList","alertPayload","url","Fragment","RequisitionListHeaderComponent","result","Requisit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CACxB,EAEJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"RequisitionListHeader.js","sources":["/@dropins/storefront-requisition-list/src/components/RequisitionListHeader/RequisitionListHeader.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListHeader/RequisitionListHeader.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader.css';\n\nexport interface RequisitionListHeaderProps\n extends HTMLAttributes<HTMLDivElement> {\n name: string;\n description?: string;\n backLink?: {\n url: string;\n label: string;\n onClick?: (e: Event) => void;\n };\n actions?: {\n onRename?: () => void;\n onDelete?: () => void;\n renameLabel?: string;\n deleteLabel?: string;\n };\n}\n\nexport const RequisitionListHeader: FunctionComponent<\n RequisitionListHeaderProps\n> = ({ name, description, backLink, actions, className, ...props }) => {\n return (\n <div {...props} className={`requisition-list-header ${className || ''}`}>\n {/* Back Link */}\n {backLink && (\n <div className=\"requisition-list-header__back\">\n <a\n href={backLink.url}\n className=\"requisition-list-header__back-link\"\n onClick={backLink.onClick}\n >\n <span className=\"requisition-list-header__back-arrow\"><</span>\n {backLink.label}\n </a>\n </div>\n )}\n\n {/* Title and Actions Row */}\n <div className=\"requisition-list-header__main\">\n <div className=\"requisition-list-header__title-section\">\n <h1 className=\"requisition-list-header__title\">{name}</h1>\n {description && (\n <p className=\"requisition-list-header__description\">\n {description}\n </p>\n )}\n </div>\n\n {/* Action Links */}\n {actions && (actions.onRename || actions.onDelete) && (\n <div className=\"requisition-list-header__actions\">\n {actions.onRename && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onRename?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"rename-list-btn\"\n >\n {actions.renameLabel}\n </a>\n )}\n {actions.onDelete && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onDelete?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"delete-list-btn\"\n >\n {actions.deleteLabel}\n </a>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { RequisitionListHeader as RequisitionListHeaderComponent } from '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader';\nimport { RequisitionListForm } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport { RequisitionListModal } from '@/requisitionList/components/RequisitionListModal/RequisitionListModal';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList';\nimport { deleteRequisitionList } from '@/requisitionList/api/deleteRequisitionList';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\n\nexport interface RequisitionListHeaderProps {\n requisitionList: RequisitionList;\n routeRequisitionListGrid?: () => string | void;\n onUpdate?: (updatedList: RequisitionList) => void | Promise<void>;\n onAlert?: (payload: {\n action: string;\n type: string;\n context: string;\n }) => void;\n enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>;\n}\n\nexport const RequisitionListHeader: Container<RequisitionListHeaderProps> = ({\n requisitionList,\n routeRequisitionListGrid,\n onUpdate,\n onAlert,\n enrichConfigurableProducts,\n}) => {\n const [showRenameModal, setShowRenameModal] = useState<boolean>(false);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [isDeleting, setIsDeleting] = useState<boolean>(false);\n\n const translations = useText({\n actionBackToRequisitionLists: `RequisitionList.RequisitionListView.actionBackToRequisitionLists`,\n actionRename: `RequisitionList.RequisitionListView.actionRename`,\n actionDeleteList: `RequisitionList.RequisitionListView.actionDeleteList`,\n deleteListTitle: `RequisitionList.RequisitionListView.deleteListTitle`,\n deleteListMessage: `RequisitionList.RequisitionListView.deleteListMessage`,\n confirmAction: `RequisitionList.RequisitionListWrapper.confirmAction`,\n cancelAction: `RequisitionList.RequisitionListWrapper.cancelAction`,\n updateTitle: `RequisitionList.RequisitionListForm.updateTitle`,\n });\n\n const handleRename = useCallback(() => {\n setShowRenameModal(true);\n }, []);\n\n const handleRenameSubmit = useCallback(\n async (values: { name: string; description?: string }) => {\n try {\n const updatedList = await updateRequisitionList(\n requisitionList.uid,\n values.name,\n values.description,\n requisitionList.page_info?.page_size,\n requisitionList.page_info?.current_page,\n enrichConfigurableProducts\n );\n if (updatedList) {\n onUpdate?.(updatedList);\n setShowRenameModal(false);\n onAlert?.({\n action: 'update',\n type: 'success',\n context: 'requisitionList',\n });\n } else {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n },\n [\n requisitionList.uid,\n requisitionList.page_info,\n onUpdate,\n onAlert,\n enrichConfigurableProducts,\n ]\n );\n\n const handleDeleteList = useCallback(() => {\n setShowDeleteModal(true);\n }, []);\n\n const handleDeleteConfirm = useCallback(async () => {\n setIsDeleting(true);\n try {\n const result = await deleteRequisitionList(requisitionList.uid);\n if (result) {\n const alertPayload = {\n action: 'delete',\n type: 'success',\n context: 'requisitionList',\n };\n\n // Store alert in localStorage before redirecting\n // This ensures the alert is shown after redirect to grid view\n try {\n localStorage.setItem(\n 'requisitionListPendingAlert',\n JSON.stringify(alertPayload)\n );\n } catch (e) {\n // Ignore localStorage errors (e.g., in private browsing mode)\n }\n\n if (routeRequisitionListGrid) {\n const url = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (url && typeof url === 'string') {\n window.location.href = url;\n }\n }\n } else {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n } finally {\n setIsDeleting(false);\n setShowDeleteModal(false);\n }\n }, [requisitionList.uid, routeRequisitionListGrid, onAlert]);\n\n return (\n <>\n <RequisitionListHeaderComponent\n name={requisitionList.name}\n description={requisitionList.description}\n backLink={\n routeRequisitionListGrid\n ? {\n url: '#',\n label: translations.actionBackToRequisitionLists,\n onClick: (e: Event) => {\n e.preventDefault();\n const result = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (result && typeof result === 'string') {\n window.location.href = result;\n }\n },\n }\n : undefined\n }\n actions={{\n onRename: handleRename,\n onDelete: handleDeleteList,\n renameLabel: translations.actionRename,\n deleteLabel: translations.actionDeleteList,\n }}\n />\n\n {/* Rename Modal */}\n {showRenameModal && (\n <RequisitionListModal\n isOpen={showRenameModal}\n isLoading={false}\n title={translations.updateTitle}\n modalContent={\n <RequisitionListForm\n mode=\"update\"\n defaultValues={{\n name: requisitionList.name,\n description: requisitionList.description || '',\n }}\n onSubmit={handleRenameSubmit}\n onCancel={() => setShowRenameModal(false)}\n />\n }\n handleModalOnClose={() => setShowRenameModal(false)}\n />\n )}\n\n {/* Delete Confirmation Modal */}\n {showDeleteModal && (\n <RequisitionListModal\n isOpen={showDeleteModal}\n isLoading={isDeleting}\n title={translations.deleteListTitle}\n modalContent={translations.deleteListMessage}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={() => setShowDeleteModal(false)}\n handleModalOnConfirm={handleDeleteConfirm}\n />\n )}\n </>\n );\n};\n"],"names":["RequisitionListHeader","name","description","backLink","actions","className","props","jsxs","jsx","e","_a","requisitionList","routeRequisitionListGrid","onUpdate","onAlert","enrichConfigurableProducts","showRenameModal","setShowRenameModal","useState","showDeleteModal","setShowDeleteModal","isDeleting","setIsDeleting","translations","useText","handleRename","useCallback","handleRenameSubmit","values","updatedList","updateRequisitionList","_b","handleDeleteList","handleDeleteConfirm","deleteRequisitionList","alertPayload","url","Fragment","RequisitionListHeaderComponent","result","RequisitionListModal","RequisitionListForm"],"mappings":"wYAsCO,MAAMA,EAET,CAAC,CAAE,KAAAC,EAAM,YAAAC,EAAa,SAAAC,EAAU,QAAAC,EAAS,UAAAC,EAAW,GAAGC,KAEvDC,EAAC,OAAK,GAAGD,EAAO,UAAW,2BAA2BD,GAAa,EAAE,GAElE,SAAA,CAAAF,GACCK,EAAC,MAAA,CAAI,UAAU,gCACb,SAAAD,EAAC,IAAA,CACC,KAAMJ,EAAS,IACf,UAAU,qCACV,QAASA,EAAS,QAElB,SAAA,CAAAK,EAAC,OAAA,CAAK,UAAU,sCAAsC,SAAA,IAAI,EACzDL,EAAS,KAAA,CAAA,CAAA,EAEd,EAIFI,EAAC,MAAA,CAAI,UAAU,gCACb,SAAA,CAAAA,EAAC,MAAA,CAAI,UAAU,yCACb,SAAA,CAAAC,EAAC,KAAA,CAAG,UAAU,iCAAkC,SAAAP,EAAK,EACpDC,GACCM,EAAC,IAAA,CAAE,UAAU,uCACV,SAAAN,CAAA,CACH,CAAA,EAEJ,EAGCE,IAAYA,EAAQ,UAAYA,EAAQ,WACvCG,EAAC,MAAA,CAAI,UAAU,mCACZ,SAAA,CAAAH,EAAQ,UACPI,EAAC,IAAA,CACC,KAAK,IACL,QAAUC,GAAM,OACdA,EAAE,eAAA,GACFC,EAAAN,EAAQ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,CACC,OAAQxB,EACR,UAAW,GACX,MAAOO,EAAa,YACpB,aACEf,EAACiC,EAAA,CACC,KAAK,SACL,cAAe,CACb,KAAM9B,EAAgB,KACtB,YAAaA,EAAgB,aAAe,EAAA,EAE9C,SAAUgB,EACV,SAAU,IAAMV,EAAmB,EAAK,CAAA,CAAA,EAG5C,mBAAoB,IAAMA,EAAmB,EAAK,CAAA,CAAA,EAKrDE,GACCX,EAACgC,EAAA,CACC,OAAQrB,EACR,UAAWE,EACX,MAAOE,EAAa,gBACpB,aAAcA,EAAa,kBAC3B,kBAAmBA,EAAa,cAChC,gBAAiBA,EAAa,aAC9B,mBAAoB,IAAMH,EAAmB,EAAK,EAClD,qBAAsBa,CAAA,CAAA,CACxB,EAEJ,CAEJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{c as
|
|
3
|
+
import{c as L,R as q,f as T,h as m,t as S}from"./updateRequisitionList.js";import{events as l}from"@dropins/tools/event-bus.js";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 m,h as I,e as T,t as c}from"./updateRequisitionList.js
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
`;function
|
|
26
|
+
${L}
|
|
27
|
+
${q}
|
|
28
|
+
`;function R(t){return!t||typeof t!="string"||t.length<2||!/^[A-Za-z0-9+/]+(==|=)?$/.test(t)?!1:t.length%4===0}const M=async(t,a,u,I)=>{var i,o,_,U;if(!R(t))return console.error("Invalid requisition list UID format:",t),null;const{errors:r,data:e}=await T(E,{variables:{requisitionListUid:t,currentPage:a,pageSize:u}});if(r)return m(r);if(!((_=(o=(i=e==null?void 0:e.customer)==null?void 0:i.requisition_lists)==null?void 0:o.items)!=null&&_[0]))return null;const n=e.customer.requisition_lists.items[0];let s=S(n);return(U=s==null?void 0:s.items)!=null&&U.length&&I&&(s={...s,items:await I(s.items)}),l.emit("requisitionList/data",s),s},d=`
|
|
29
29
|
mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(
|
|
30
30
|
$requisitionListUid: ID!,
|
|
31
31
|
$requisitionListItems: [UpdateRequisitionListItemsInput!]!,
|
|
@@ -44,9 +44,9 @@ ${a}
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
${
|
|
48
|
-
${
|
|
49
|
-
`,
|
|
47
|
+
${q}
|
|
48
|
+
${L}
|
|
49
|
+
`,O=async(t,a,u,I,r)=>{var o,_;const{errors:e,data:n}=await T(d,{variables:{requisitionListUid:t,requisitionListItems:a,pageSize:u,currentPage:I}});if(e)return m(e);if(!((o=n==null?void 0:n.updateRequisitionListItems)!=null&&o.requisition_list))return null;const s=n.updateRequisitionListItems.requisition_list;let i=S(s);return(_=i==null?void 0:i.items)!=null&&_.length&&r&&(i={...i,items:await r(i.items)}),l.emit("requisitionList/data",i),i},c=`
|
|
50
50
|
mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(
|
|
51
51
|
$requisitionListUid: ID!,
|
|
52
52
|
$requisitionListItemUids: [ID!]!,
|
|
@@ -65,149 +65,9 @@ ${_}
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
${
|
|
69
|
-
${
|
|
70
|
-
`,
|
|
71
|
-
fragment PRODUCT_FRAGMENT on ProductView {
|
|
72
|
-
__typename
|
|
73
|
-
id
|
|
74
|
-
sku
|
|
75
|
-
name
|
|
76
|
-
shortDescription
|
|
77
|
-
metaDescription
|
|
78
|
-
metaKeyword
|
|
79
|
-
metaTitle
|
|
80
|
-
description
|
|
81
|
-
inStock
|
|
82
|
-
addToCartAllowed
|
|
83
|
-
url
|
|
84
|
-
urlKey
|
|
85
|
-
externalId
|
|
86
|
-
images(roles: []) {
|
|
87
|
-
url
|
|
88
|
-
label
|
|
89
|
-
roles
|
|
90
|
-
}
|
|
91
|
-
attributes(roles: []) {
|
|
92
|
-
name
|
|
93
|
-
label
|
|
94
|
-
value
|
|
95
|
-
roles
|
|
96
|
-
}
|
|
97
|
-
... on SimpleProductView {
|
|
98
|
-
price {
|
|
99
|
-
roles
|
|
100
|
-
regular {
|
|
101
|
-
amount {
|
|
102
|
-
value
|
|
103
|
-
currency
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
final {
|
|
107
|
-
amount {
|
|
108
|
-
value
|
|
109
|
-
currency
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
... on ComplexProductView {
|
|
115
|
-
options {
|
|
116
|
-
...PRODUCT_OPTION_FRAGMENT
|
|
117
|
-
}
|
|
118
|
-
...PRICE_RANGE_FRAGMENT
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
fragment PRODUCT_OPTION_FRAGMENT on ProductViewOption {
|
|
122
|
-
id
|
|
123
|
-
title
|
|
124
|
-
required
|
|
125
|
-
multi
|
|
126
|
-
values {
|
|
127
|
-
id
|
|
128
|
-
title
|
|
129
|
-
inStock
|
|
130
|
-
__typename
|
|
131
|
-
... on ProductViewOptionValueProduct {
|
|
132
|
-
title
|
|
133
|
-
quantity
|
|
134
|
-
isDefault
|
|
135
|
-
__typename
|
|
136
|
-
product {
|
|
137
|
-
sku
|
|
138
|
-
shortDescription
|
|
139
|
-
metaDescription
|
|
140
|
-
metaKeyword
|
|
141
|
-
metaTitle
|
|
142
|
-
name
|
|
143
|
-
price {
|
|
144
|
-
final {
|
|
145
|
-
amount {
|
|
146
|
-
value
|
|
147
|
-
currency
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
regular {
|
|
151
|
-
amount {
|
|
152
|
-
value
|
|
153
|
-
currency
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
roles
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
... on ProductViewOptionValueSwatch {
|
|
161
|
-
id
|
|
162
|
-
title
|
|
163
|
-
type
|
|
164
|
-
value
|
|
165
|
-
inStock
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
|
|
170
|
-
priceRange {
|
|
171
|
-
maximum {
|
|
172
|
-
final {
|
|
173
|
-
amount {
|
|
174
|
-
value
|
|
175
|
-
currency
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
regular {
|
|
179
|
-
amount {
|
|
180
|
-
value
|
|
181
|
-
currency
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
roles
|
|
185
|
-
}
|
|
186
|
-
minimum {
|
|
187
|
-
final {
|
|
188
|
-
amount {
|
|
189
|
-
value
|
|
190
|
-
currency
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
regular {
|
|
194
|
-
amount {
|
|
195
|
-
value
|
|
196
|
-
currency
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
roles
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
`,f=`
|
|
204
|
-
query GET_PRODUCT_DATA($skus: [String]) {
|
|
205
|
-
products(skus: $skus) {
|
|
206
|
-
...PRODUCT_FRAGMENT
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
${d}
|
|
210
|
-
`,$=async i=>m(f,{variables:{skus:i}}).then(({errors:r,data:t})=>r?I(r):t!=null&&t.products?L(t.products):null),N=`
|
|
68
|
+
${q}
|
|
69
|
+
${L}
|
|
70
|
+
`,f=async(t,a,u,I,r)=>{var o,_;const{errors:e,data:n}=await T(c,{variables:{requisitionListUid:t,requisitionListItemUids:a,pageSize:u,currentPage:I}});if(e)return m(e);if(!((o=n==null?void 0:n.deleteRequisitionListItems)!=null&&o.requisition_list))return null;const s=n.deleteRequisitionListItems.requisition_list;let i=S(s);return(_=i==null?void 0:i.items)!=null&&_.length&&r&&(i={...i,items:await r(i.items)}),l.emit("requisitionList/data",i),i},$=`
|
|
211
71
|
mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(
|
|
212
72
|
$requisitionListUid: ID!,
|
|
213
73
|
$requisitionListItemUids: [ID!]!
|
|
@@ -237,5 +97,5 @@ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
|
|
|
237
97
|
}
|
|
238
98
|
}
|
|
239
99
|
}
|
|
240
|
-
`,
|
|
100
|
+
`,p=async(t,a)=>T($,{variables:{requisitionListUid:t,requisitionListItemUids:a}}).then(({errors:u,data:I})=>{var r;return u?m(u):(r=I.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors)!=null&&r.length?I.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(e=>({type:e.type,message:e.message||""})):null});export{p as a,f as d,M as g,R as i,O as u};
|
|
241
101
|
//# 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 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 interface AddToCartError {\n type: string;\n message: string;\n}\n\nexport const addRequisitionListItemsToCart = async (\n requisitionListUid: string,\n requisitionListItemUids: Array<string>\n): Promise<Array<AddToCartError> | 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) => ({\n type: e.type,\n message: e.message || '',\n })\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;AA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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECS9CC,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,IAAY,CACX,KAAM,EAAE,KACR,QAAS,EAAE,SAAW,EAAA,EACxB,EAGG,IACT,CAAC"}
|
|
1
|
+
{"version":3,"file":"addRequisitionListItemsToCart.js","sources":["/@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/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 *******************************************************************/\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 { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { isValidBase64Uid } from '@/requisitionList/lib/validate-uid';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionList = async (\n requisitionListID: string,\n currentPage?: number,\n pageSize?: number,\n enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>\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 const { errors, data } = await fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n });\n\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists?.items?.[0]) {\n return null;\n }\n\n const rawList = data.customer.requisition_lists.items[0];\n let payload = transformRequisitionList(rawList);\n if (payload?.items?.length && enrichConfigurableProducts) {\n payload = {\n ...payload,\n items: await enrichConfigurableProducts(payload.items),\n };\n }\n events.emit('requisitionList/data', payload);\n return payload;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItems: [UpdateRequisitionListItemsInput!]!,\n $pageSize: Int = 20,\n $currentPage: Int = 1\n ) {\n updateRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItems: $requisitionListItems\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\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 enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>\n): Promise<RequisitionList | null> => {\n const { errors, data } = await fetchGraphQl(\n UPDATE_REQUISITION_LIST_ITEMS_MUTATION,\n {\n variables: {\n requisitionListUid,\n requisitionListItems,\n pageSize,\n currentPage,\n },\n }\n );\n\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionListItems?.requisition_list) {\n return null;\n }\n\n const rawList = data.updateRequisitionListItems.requisition_list;\n let payload = transformRequisitionList(rawList);\n if (payload?.items?.length && enrichConfigurableProducts) {\n payload = {\n ...payload,\n items: await enrichConfigurableProducts(payload.items),\n };\n }\n events.emit('requisitionList/data', payload);\n return payload;\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 { Item } from '@/requisitionList/data/models/item';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { DELETE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionListItems = async (\n requisitionListUid: string,\n items: Array<string>,\n pageSize: number,\n currentPage: number,\n enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>\n): Promise<RequisitionList | null> => {\n const { errors, data } = await fetchGraphQl(\n DELETE_REQUISITION_LIST_ITEMS_MUTATION,\n {\n variables: {\n requisitionListUid,\n requisitionListItemUids: items,\n pageSize,\n currentPage,\n },\n }\n );\n\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionListItems?.requisition_list) {\n return null;\n }\n\n const rawList = data.deleteRequisitionListItems.requisition_list;\n let payload = transformRequisitionList(rawList);\n if (payload?.items?.length && enrichConfigurableProducts) {\n payload = {\n ...payload,\n items: await enrichConfigurableProducts(payload.items),\n };\n }\n events.emit('requisitionList/data', payload);\n return payload;\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 interface AddToCartError {\n type: string;\n message: string;\n}\n\nexport const addRequisitionListItemsToCart = async (\n requisitionListUid: string,\n requisitionListItemUids: Array<string>\n): Promise<Array<AddToCartError> | 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) => ({\n type: e.type,\n message: e.message || '',\n })\n );\n }\n return null;\n });\n};\n"],"names":["GET_REQUISITION_LIST_QUERY","REQUISITION_LIST_ITEMS_FRAGMENT","REQUISITION_LIST_FRAGMENT","isValidBase64Uid","uid","getRequisitionList","requisitionListID","currentPage","pageSize","enrichConfigurableProducts","errors","data","fetchGraphQl","handleFetchError","_c","_b","_a","rawList","payload","transformRequisitionList","_d","events","UPDATE_REQUISITION_LIST_ITEMS_MUTATION","updateRequisitionListItems","requisitionListUid","requisitionListItems","DELETE_REQUISITION_LIST_ITEMS_MUTATION","deleteRequisitionListItems","items","ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION","addRequisitionListItemsToCart","requisitionListItemUids"],"mappings":"gIAmBO,MAAMA,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,EAAyC,CAUxE,MATI,CAACA,GAAO,OAAOA,GAAQ,UAAYA,EAAI,OAAS,GAShD,CAFkB,0BAEH,KAAKA,CAAG,EAClB,GAIF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