@dropins/storefront-requisition-list 1.2.0-beta.1 → 1.2.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+ # @dropins/storefront-requisition-list
2
+
3
+ ## 1.2.0-beta.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 2f02836: Bump "@adobe-commerce/elsie" from 1.7.0 to 1.8.0-beta.1
8
+
9
+ ## 1.2.0-beta.2
10
+
11
+ ### Patch Changes
12
+
13
+ - c26676c: fix: merge user-provided langDefinitions in Provider
14
+
15
+ The Provider now imports `config` and uses `deepmerge` to merge user-provided `langDefinitions` with the drop-in's bundled defaults before passing them to `UIProvider`. This enables label/placeholder overrides via the initializer API.
16
+
17
+ ## 1.2.0-beta.1
18
+
19
+ ### Minor Changes
20
+
21
+ - a23ab81: Replaced API catalog functions with props that must be injected from the integration layer
22
+
23
+ ## 1.1.1-beta.0
24
+
25
+ ### Patch Changes
26
+
27
+ - 13f4ea9: Add Changesets-based release automation with branch-aware workflows (alpha/beta/stable), PR changeset validation, and contributor helper scripts.
28
+ - b8e1dbe: Fix RequisitionListSelector Storybook stories: WhenRequisitionListIsDisabled now correctly shows disabled behavior via loaders and state; WithoutExistingRequisitionLists shows empty lists via loader; Docs overview uses iframe isolation (docs.story.inline: false) so all stories appear and work correctly together.
package/api.js CHANGED
@@ -1,11 +1,4 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
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
- query STORE_CONFIG_QUERY {
5
- storeConfig {
6
- is_requisition_list_active
7
- company_enabled
8
- }
9
- }
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};
3
+ import{c as r,g as p,i as m}from"./chunks/initialize.js";import{g as d}from"./chunks/getRequisitionLists.js";import{a as g,d as u,g as h,u as l}from"./chunks/addRequisitionListItemsToCart.js";import{u as L}from"./chunks/updateRequisitionList.js";import{d as c}from"./chunks/deleteRequisitionList.js";import{f as G,g as Q,r as C,s as F,a as H,b as I}from"./chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"./chunks/state.js";import"@dropins/tools/fetch-graphql.js";export{g as addRequisitionListItemsToCart,r as config,c as deleteRequisitionList,u as deleteRequisitionListItems,G as fetchGraphQl,Q as getConfig,h as getRequisitionList,d as getRequisitionLists,p as getStoreConfig,m as initialize,C as removeFetchGraphQlHeader,F as setEndpoint,H as setFetchGraphQlHeader,I as setFetchGraphQlHeaders,L as updateRequisitionList,l as updateRequisitionListItems};
11
4
  //# 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":"0gBAiBO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMrBC,EAAiB,SAA0B,CAClD,GAAA,CACF,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAS,EAAA,MAAMC,EAAaJ,EAAoB,CAC9D,MAAO,aAAA,CACR,EAED,OAAIE,EACmBA,EAAO,KACzBG,GACEA,EAAM,SACLA,EAAM,QAAQ,SACZ,iDAAA,GAEJA,EAAM,QAAQ,SAAS,sCAAsC,CACjE,EAES,GAEFC,EAAiBJ,CAAM,EAGzBC,GAAA,YAAAA,EAAM,WAAA,MACP,CACC,MAAA,CACL,2BAA4B,IAC5B,gBAAiB,EACnB,CAAA,CAEJ,ECxBaI,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAC,EAGlBC,EAAM,SACHA,EAAA,OAAS,MAAMV,EAAe,EAE7BW,EAAA,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,CACvB,CAAA,CAAA,CAEL,CAAC,EAEYJ,EAASF,EAAW"}
1
+ {"version":3,"file":"api.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{R}from"./RequisitionListForm.js";import{useState as p}from"@dropins/tools/preact-hooks.js";import{R as L,f as q,h as I,t as l,u as T}from"./updateRequisitionList.js";import{events as _}from"@dropins/tools/event-bus.js";const f=`
3
+ import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{R as p}from"./RequisitionListForm.js";import{useState as R}from"@dropins/tools/preact-hooks.js";import{R as L,t as q,u as I}from"./updateRequisitionList.js";import{f as l,h as T}from"./fetch-graphql.js";import{events as f}from"@dropins/tools/event-bus.js";const _=`
4
4
  mutation CREATE_REQUISITION_LIST_MUTATION(
5
5
  $requisitionListName: String!,
6
6
  $requisitionListDescription: String,
@@ -17,5 +17,5 @@ import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{R}from"./Requi
17
17
  }
18
18
  }
19
19
  ${L}
20
- `,N=async(r,o)=>q(f,{variables:{requisitionListName:r,requisitionListDescription:o}}).then(({errors:t,data:i})=>{var e;if(t)return I(t);if(!((e=i==null?void 0:i.createRequisitionList)!=null&&e.requisition_list))return null;const u=l(i.createRequisitionList.requisition_list);return _.emit("requisitionList/data",u),u});function S(r,o,t,i){const[u,e]=p(null);return{error:u,submit:async a=>{e(null);try{const n=a.description??"",s=r==="update"&&o?await T(o,a.name,n):await N(a.name,n);return s&&(t==null||t(s)),s}catch(n){const s=(n==null?void 0:n.message)||"Unexpected error";return e(s),i==null||i(s),null}}}}const O=({mode:r,requisitionListUid:o,defaultValues:t={name:"",description:""},onSuccess:i,onError:u,onCancel:e})=>{const{error:m,submit:a}=S(r,o,i,u);return c(R,{mode:r,defaultValues:t,error:m,onSubmit:async s=>{await a(s)},onCancel:e})};export{O as R};
20
+ `,N=async(r,o)=>l(_,{variables:{requisitionListName:r,requisitionListDescription:o}}).then(({errors:t,data:i})=>{var e;if(t)return T(t);if(!((e=i==null?void 0:i.createRequisitionList)!=null&&e.requisition_list))return null;const u=q(i.createRequisitionList.requisition_list);return f.emit("requisitionList/data",u),u});function S(r,o,t,i){const[u,e]=R(null);return{error:u,submit:async a=>{e(null);try{const n=a.description??"",s=r==="update"&&o?await I(o,a.name,n):await N(a.name,n);return s&&(t==null||t(s)),s}catch(n){const s=(n==null?void 0:n.message)||"Unexpected error";return e(s),i==null||i(s),null}}}}const U=({mode:r,requisitionListUid:o,defaultValues:t={name:"",description:""},onSuccess:i,onError:u,onCancel:e})=>{const{error:m,submit:a}=S(r,o,i,u);return c(p,{mode:r,defaultValues:t,error:m,onSubmit:async s=>{await a(s)},onCancel:e})};export{U as R};
21
21
  //# sourceMappingURL=RequisitionListForm2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequisitionListForm2.js","sources":["/@dropins/storefront-requisition-list/src/api/createRequisitionList/graphql/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/createRequisitionList/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/hooks/useRequisitionListForm.ts","/@dropins/storefront-requisition-list/src/containers/RequisitionListForm/RequisitionListForm.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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const CREATE_REQUISITION_LIST_MUTATION = `\n mutation CREATE_REQUISITION_LIST_MUTATION(\n $requisitionListName: String!,\n $requisitionListDescription: String,\n ) {\n createRequisitionList(\n input: {\n name: $requisitionListName\n description: $requisitionListDescription\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { 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 { CREATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/createRequisitionList/graphql/createRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const createRequisitionList = async (\n name: string,\n description?: string\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(CREATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListName: name,\n requisitionListDescription: description,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.createRequisitionList?.requisition_list) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.createRequisitionList.requisition_list\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 *******************************************************************/\n\nimport { useState } from 'preact/hooks';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { createRequisitionList } from '@/requisitionList/api/createRequisitionList/createRequisitionList';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList/updateRequisitionList';\n\nexport type RequisitionListFormMode = 'create' | 'update';\nexport type RequisitionListFormValues = { name: string; description?: string };\n\ntype UseRequisitionListFormReturn = {\n error: string | null;\n submit: (\n values: RequisitionListFormValues\n ) => Promise<RequisitionList | null>;\n};\n\nexport function useRequisitionListForm(\n mode: RequisitionListFormMode,\n requisitionListUid?: string,\n onSuccess?: (rl: RequisitionList) => void,\n onError?: (msg: string) => void\n): UseRequisitionListFormReturn {\n const [error, setError] = useState<string | null>(null);\n\n const submit = async (\n values: RequisitionListFormValues\n ): Promise<RequisitionList | null> => {\n setError(null);\n try {\n const description = values.description ?? '';\n const result =\n mode === 'update' && requisitionListUid\n ? await updateRequisitionList(\n requisitionListUid,\n values.name,\n description\n )\n : await createRequisitionList(values.name, description);\n if (result) onSuccess?.(result);\n return result;\n } catch (e: any) {\n const msg = e?.message || 'Unexpected error';\n setError(msg);\n onError?.(msg);\n return null;\n }\n };\n\n return { error, submit };\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 { Container } from '@adobe-commerce/elsie/lib';\nimport { RequisitionListForm as RequisitionListFormComponent } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport {\n useRequisitionListForm,\n RequisitionListFormMode,\n RequisitionListFormValues,\n} from '@/requisitionList/hooks/useRequisitionListForm';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport interface RequisitionListFormProps {\n mode: RequisitionListFormMode;\n requisitionListUid?: string;\n defaultValues?: RequisitionListFormValues;\n onSuccess?: (newList: RequisitionList) => void;\n onError?: (message: string) => void;\n onCancel: () => void;\n}\n\nexport const RequisitionListForm: Container<RequisitionListFormProps> = ({\n mode,\n requisitionListUid,\n defaultValues = { name: '', description: '' },\n onSuccess,\n onError,\n onCancel,\n}) => {\n const { error, submit } = useRequisitionListForm(\n mode,\n requisitionListUid,\n onSuccess,\n onError\n );\n\n const handleSubmit = async (values: RequisitionListFormValues) => {\n await submit(values);\n };\n\n return (\n <RequisitionListFormComponent\n mode={mode}\n defaultValues={defaultValues}\n error={error}\n onSubmit={handleSubmit}\n onCancel={onCancel}\n />\n );\n};\n"],"names":["CREATE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","createRequisitionList","name","description","fetchGraphQl","errors","data","handleFetchError","_a","payload","transformRequisitionList","events","useRequisitionListForm","mode","requisitionListUid","onSuccess","onError","error","setError","useState","values","result","updateRequisitionList","e","msg","RequisitionListForm","defaultValues","onCancel","submit","jsx","RequisitionListFormComponent"],"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CAAA,EAAWhB,EACxBC,EACAC,EACAC,EACAC,CACF,EAOE,OAAAa,EAACC,EAAA,CACC,KAAAjB,EACA,cAAAa,EACA,MAAAT,EACA,SATiB,MAAOG,GAAsC,CAChE,MAAMQ,EAAOR,CAAM,CACrB,EAQI,SAAAO,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"RequisitionListForm2.js","sources":["/@dropins/storefront-requisition-list/src/api/createRequisitionList/graphql/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/createRequisitionList/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/hooks/useRequisitionListForm.ts","/@dropins/storefront-requisition-list/src/containers/RequisitionListForm/RequisitionListForm.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 { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const CREATE_REQUISITION_LIST_MUTATION = `\n mutation CREATE_REQUISITION_LIST_MUTATION(\n $requisitionListName: String!,\n $requisitionListDescription: String,\n ) {\n createRequisitionList(\n input: {\n name: $requisitionListName\n description: $requisitionListDescription\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { 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 { CREATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/createRequisitionList/graphql/createRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const createRequisitionList = async (\n name: string,\n description?: string\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(CREATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListName: name,\n requisitionListDescription: description,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.createRequisitionList?.requisition_list) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.createRequisitionList.requisition_list\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 *******************************************************************/\n\nimport { useState } from 'preact/hooks';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { createRequisitionList } from '@/requisitionList/api/createRequisitionList/createRequisitionList';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList/updateRequisitionList';\n\nexport type RequisitionListFormMode = 'create' | 'update';\nexport type RequisitionListFormValues = { name: string; description?: string };\n\ntype UseRequisitionListFormReturn = {\n error: string | null;\n submit: (\n values: RequisitionListFormValues\n ) => Promise<RequisitionList | null>;\n};\n\nexport function useRequisitionListForm(\n mode: RequisitionListFormMode,\n requisitionListUid?: string,\n onSuccess?: (rl: RequisitionList) => void,\n onError?: (msg: string) => void\n): UseRequisitionListFormReturn {\n const [error, setError] = useState<string | null>(null);\n\n const submit = async (\n values: RequisitionListFormValues\n ): Promise<RequisitionList | null> => {\n setError(null);\n try {\n const description = values.description ?? '';\n const result =\n mode === 'update' && requisitionListUid\n ? await updateRequisitionList(\n requisitionListUid,\n values.name,\n description\n )\n : await createRequisitionList(values.name, description);\n if (result) onSuccess?.(result);\n return result;\n } catch (e: any) {\n const msg = e?.message || 'Unexpected error';\n setError(msg);\n onError?.(msg);\n return null;\n }\n };\n\n return { error, submit };\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 { Container } from '@adobe-commerce/elsie/lib';\nimport { RequisitionListForm as RequisitionListFormComponent } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport {\n useRequisitionListForm,\n RequisitionListFormMode,\n RequisitionListFormValues,\n} from '@/requisitionList/hooks/useRequisitionListForm';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport interface RequisitionListFormProps {\n mode: RequisitionListFormMode;\n requisitionListUid?: string;\n defaultValues?: RequisitionListFormValues;\n onSuccess?: (newList: RequisitionList) => void;\n onError?: (message: string) => void;\n onCancel: () => void;\n}\n\nexport const RequisitionListForm: Container<RequisitionListFormProps> = ({\n mode,\n requisitionListUid,\n defaultValues = { name: '', description: '' },\n onSuccess,\n onError,\n onCancel,\n}) => {\n const { error, submit } = useRequisitionListForm(\n mode,\n requisitionListUid,\n onSuccess,\n onError\n );\n\n const handleSubmit = async (values: RequisitionListFormValues) => {\n await submit(values);\n };\n\n return (\n <RequisitionListFormComponent\n mode={mode}\n defaultValues={defaultValues}\n error={error}\n onSubmit={handleSubmit}\n onCancel={onCancel}\n />\n );\n};\n"],"names":["CREATE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","createRequisitionList","name","description","fetchGraphQl","errors","data","handleFetchError","_a","payload","transformRequisitionList","events","useRequisitionListForm","mode","requisitionListUid","onSuccess","onError","error","setError","useState","values","result","updateRequisitionList","e","msg","RequisitionListForm","defaultValues","onCancel","submit","jsx","RequisitionListFormComponent"],"mappings":"kUAmBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgB9CC,CAAyB;AAAA,ECXdC,EAAwB,MACnCC,EACAC,IAEOC,EAAaL,EAAkC,CACpD,UAAW,CACT,oBAAqBG,EACrB,2BAA4BC,CAAA,CAE/B,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,OACxB,GAAAD,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,kBACzB,OAAA,KAGT,MAAMC,EAAUC,EACdJ,EAAK,sBAAsB,gBAC7B,EACO,OAAAK,EAAA,KAAK,uBAAwBF,CAAO,EACpCA,CAAA,CACR,ECbI,SAASG,EACdC,EACAC,EACAC,EACAC,EAC8B,CAC9B,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAwB,IAAI,EA0B/C,MAAA,CAAE,MAAAF,EAAO,OAxBD,MACbG,GACoC,CACpCF,EAAS,IAAI,EACT,GAAA,CACI,MAAAf,EAAciB,EAAO,aAAe,GACpCC,EACJR,IAAS,UAAYC,EACjB,MAAMQ,EACJR,EACAM,EAAO,KACPjB,CAEF,EAAA,MAAMF,EAAsBmB,EAAO,KAAMjB,CAAW,EACtD,OAAAkB,eAAoBA,IACjBA,QACAE,EAAQ,CACT,MAAAC,GAAMD,GAAA,YAAAA,EAAG,UAAW,mBAC1B,OAAAL,EAASM,CAAG,EACZR,GAAA,MAAAA,EAAUQ,GACH,IAAA,CAEX,CAEuB,CACzB,CC9BO,MAAMC,EAA2D,CAAC,CACvE,KAAAZ,EACA,mBAAAC,EACA,cAAAY,EAAgB,CAAE,KAAM,GAAI,YAAa,EAAG,EAC5C,UAAAX,EACA,QAAAC,EACA,SAAAW,CACF,IAAM,CACE,KAAA,CAAE,MAAAV,EAAO,OAAAW,CAAA,EAAWhB,EACxBC,EACAC,EACAC,EACAC,CACF,EAOE,OAAAa,EAACC,EAAA,CACC,KAAAjB,EACA,cAAAa,EACA,MAAAT,EACA,SATiB,MAAOG,GAAsC,CAChE,MAAMQ,EAAOR,CAAM,CACrB,EAQI,SAAAO,CAAA,CACF,CAEJ"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
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=`
3
+ import{a as L,R as q,t as S}from"./updateRequisitionList.js";import{f as T,h as m}from"./fetch-graphql.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,
@@ -25,7 +25,7 @@ import{c as L,R as q,f as T,h as m,t as S}from"./updateRequisitionList.js";impor
25
25
  }
26
26
  ${L}
27
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=`
28
+ `;function R(t){return!t||typeof t!="string"||t.length<2||!/^[A-Za-z0-9+/]+(==|=)?$/.test(t)?!1:t.length%4===0}const O=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!]!,
@@ -46,7 +46,7 @@ ${q}
46
46
  }
47
47
  ${q}
48
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=`
49
+ `,f=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!]!,
@@ -67,7 +67,7 @@ ${L}
67
67
  }
68
68
  ${q}
69
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},$=`
70
+ `,p=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},$=`
71
71
  mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(
72
72
  $requisitionListUid: ID!,
73
73
  $requisitionListItemUids: [ID!]!
@@ -97,5 +97,5 @@ ${L}
97
97
  }
98
98
  }
99
99
  }
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};
100
+ `,A=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{A as a,p as d,O as g,R as i,f as u};
101
101
  //# sourceMappingURL=addRequisitionListItemsToCart.js.map
@@ -1 +1 @@
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,GAIFA,EAAI,OAAS,IAAM,CAC5B,CCdO,MAAMC,EAAqB,MAChCC,EACAC,EACAC,EACAC,IACoC,aAEhC,GAAA,CAACN,EAAiBG,CAAiB,EAC7B,eAAA,MAAM,uCAAwCA,CAAiB,EAChE,KAGT,KAAM,CAAE,OAAAI,EAAQ,KAAAC,CAAS,EAA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CAAM,GAGxCM,EAAAL,EAAK,8BACF,iDADH,MAAAK,EACmD,OAE5CL,EAAK,8BAA8B,+CAA+C,IACtF,IAAY,CACX,KAAM,EAAE,KACR,QAAS,EAAE,SAAW,EACxB,EACF,EAEK,IAAA,CACR"}
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":"gKAmBO,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,GAIFA,EAAI,OAAS,IAAM,CAC5B,CCdO,MAAMC,EAAqB,MAChCC,EACAC,EACAC,EACAC,IACoC,aAEhC,GAAA,CAACN,EAAiBG,CAAiB,EAC7B,eAAA,MAAM,uCAAwCA,CAAiB,EAChE,KAGT,KAAM,CAAE,OAAAI,EAAQ,KAAAC,CAAS,EAAA,MAAMC,EAAaZ,EAA4B,CACtE,UAAW,CACT,mBAAoBM,EACpB,YAAAC,EACA,SAAAC,CAAA,CACF,CACD,EAEG,GAAAE,EAAe,O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KACR,QAAS,EAAE,SAAW,EACxB,EACF,EAEK,IAAA,CACR"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{R as L,f as T,h as q,t as R}from"./updateRequisitionList.js";import{events as E}from"@dropins/tools/event-bus.js";const a=`
3
+ import{R as L,t as T}from"./updateRequisitionList.js";import{f as q,h as R}from"./fetch-graphql.js";import{events as m}from"@dropins/tools/event-bus.js";const E=`
4
4
  mutation DELETE_REQUISITION_LIST_MUTATION(
5
5
  $requisitionListUid: ID!,
6
6
  ) {
@@ -22,5 +22,5 @@ import{R as L,f as T,h as q,t as R}from"./updateRequisitionList.js";import{event
22
22
  }
23
23
  }
24
24
  ${L}
25
- `,p=async t=>T(a,{variables:{requisitionListUid:t}}).then(({errors:e,data:i})=>{var n,o,r,u,_,l;if(!t)return null;if(e)return q(e);if(!((n=i==null?void 0:i.deleteRequisitionList)!=null&&n.requisition_lists))return null;const s=((r=(o=i.deleteRequisitionList.requisition_lists)==null?void 0:o.items)==null?void 0:r.map(I=>R(I)))||[];return E.emit("requisitionLists/data",s),{items:s,page_info:(_=(u=i.deleteRequisitionList)==null?void 0:u.requisition_lists)==null?void 0:_.page_info,status:(l=i.deleteRequisitionList)==null?void 0:l.status}});export{p as d};
25
+ `,c=async t=>q(E,{variables:{requisitionListUid:t}}).then(({errors:e,data:i})=>{var n,o,r,u,_,l;if(!t)return null;if(e)return R(e);if(!((n=i==null?void 0:i.deleteRequisitionList)!=null&&n.requisition_lists))return null;const s=((r=(o=i.deleteRequisitionList.requisition_lists)==null?void 0:o.items)==null?void 0:r.map(I=>T(I)))||[];return m.emit("requisitionLists/data",s),{items:s,page_info:(_=(u=i.deleteRequisitionList)==null?void 0:u.requisition_lists)==null?void 0:_.page_info,status:(l=i.deleteRequisitionList)==null?void 0:l.status}});export{c as d};
26
26
  //# sourceMappingURL=deleteRequisitionList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deleteRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/graphql/deleteRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/deleteRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_MUTATION = `\n mutation DELETE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n ) {\n deleteRequisitionList(\n requisitionListUid: $requisitionListUid\n ) {\n status\n requisition_lists {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { 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 { DELETE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/deleteRequisitionList/graphql/deleteRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionList = async (\n requisitionListUid: string\n): Promise<{\n items: RequisitionList[];\n page_info: any;\n status: any;\n} | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n },\n }).then(({ errors, data }) => {\n if (!requisitionListUid) return null;\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionList?.requisition_lists) {\n return null;\n }\n\n const reqLists =\n data.deleteRequisitionList.requisition_lists?.items?.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n ) || [];\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.deleteRequisitionList?.requisition_lists?.page_info,\n status: data.deleteRequisitionList?.status,\n };\n });\n};\n"],"names":["DELETE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","deleteRequisitionList","requisitionListUid","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","_c","_b","requisitionList","transformRequisitionList","events","_e","_d","_f"],"mappings":"yHAkBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqB9CC,CAAyB;AAAA,ECfdC,EAAwB,MACnCC,GAMOC,EAAaJ,EAAkC,CACpD,UAAW,CACT,mBAAAG,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,iBACxB,GAAA,CAACH,EAA2B,OAAA,KAC5B,GAAAE,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,mBACzB,OAAA,KAGT,MAAMC,IACJC,GAAAC,EAAAL,EAAK,sBAAsB,oBAA3B,YAAAK,EAA8C,QAA9C,YAAAD,EAAqD,IAClDE,GAAyBC,EAAyBD,CAAe,KAC/D,CAAC,EAED,OAAAE,EAAA,KAAK,wBAAyBL,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWM,GAAAC,EAAAV,EAAK,wBAAL,YAAAU,EAA4B,oBAA5B,YAAAD,EAA+C,UAC1D,QAAQE,EAAAX,EAAK,wBAAL,YAAAW,EAA4B,MACtC,CAAA,CACD"}
1
+ {"version":3,"file":"deleteRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/graphql/deleteRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/deleteRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_MUTATION = `\n mutation DELETE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n ) {\n deleteRequisitionList(\n requisitionListUid: $requisitionListUid\n ) {\n status\n requisition_lists {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { 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 { DELETE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/deleteRequisitionList/graphql/deleteRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionList = async (\n requisitionListUid: string\n): Promise<{\n items: RequisitionList[];\n page_info: any;\n status: any;\n} | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n },\n }).then(({ errors, data }) => {\n if (!requisitionListUid) return null;\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionList?.requisition_lists) {\n return null;\n }\n\n const reqLists =\n data.deleteRequisitionList.requisition_lists?.items?.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n ) || [];\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.deleteRequisitionList?.requisition_lists?.page_info,\n status: data.deleteRequisitionList?.status,\n };\n });\n};\n"],"names":["DELETE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","deleteRequisitionList","requisitionListUid","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","_c","_b","requisitionList","transformRequisitionList","events","_e","_d","_f"],"mappings":"yJAkBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqB9CC,CAAyB;AAAA,ECfdC,EAAwB,MACnCC,GAMOC,EAAaJ,EAAkC,CACpD,UAAW,CACT,mBAAAG,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,iBACxB,GAAA,CAACH,EAA2B,OAAA,KAC5B,GAAAE,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,mBACzB,OAAA,KAGT,MAAMC,IACJC,GAAAC,EAAAL,EAAK,sBAAsB,oBAA3B,YAAAK,EAA8C,QAA9C,YAAAD,EAAqD,IAClDE,GAAyBC,EAAyBD,CAAe,KAC/D,CAAC,EAED,OAAAE,EAAA,KAAK,wBAAyBL,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWM,GAAAC,EAAAV,EAAK,wBAAL,YAAAU,EAA4B,oBAA5B,YAAAD,EAA+C,UAC1D,QAAQE,EAAAX,EAAK,wBAAL,YAAAW,EAA4B,MACtC,CAAA,CACD"}
@@ -0,0 +1,4 @@
1
+ /*! Copyright 2026 Adobe
2
+ All Rights Reserved. */
3
+ import{FetchGraphQL as s}from"@dropins/tools/fetch-graphql.js";const h=e=>{const r=e.map(a=>a.message).join(" ");throw Error(r)},{setEndpoint:o,setFetchGraphQlHeader:c,removeFetchGraphQlHeader:n,setFetchGraphQlHeaders:p,fetchGraphQl:d,getConfig:g}=new s().getMethods();export{c as a,p as b,d as f,g,h,n as r,o as s};
4
+ //# sourceMappingURL=fetch-graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-graphql.js","sources":["/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n"],"names":["handleFetchError","errors","errorMessage","e","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL"],"mappings":"+DAkBa,MAAAA,EAAoBC,GAAuC,CAChE,MAAAC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECHa,CACX,YAAAE,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAa,EAAE,WAAW"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{R as a,f as m,h as g,t as l}from"./updateRequisitionList.js";import{events as p}from"@dropins/tools/event-bus.js";const S=`
3
+ import{R as m,t as a}from"./updateRequisitionList.js";import{f as p,h as g}from"./fetch-graphql.js";import{events as l}from"@dropins/tools/event-bus.js";const S=`
4
4
  query GET_REQUISITION_LISTS_QUERY(
5
5
  $currentPage: Int = 1
6
6
  $pageSize: Int = 10,
@@ -19,6 +19,6 @@ import{R as a,f as m,h as g,t as l}from"./updateRequisitionList.js";import{event
19
19
  }
20
20
  }
21
21
  }
22
- ${a}
23
- `,R=async(_,c)=>m(S,{variables:{currentPage:_,pageSize:c}}).then(({errors:e,data:t})=>{var s,r,n,o,u;if(e)return g(e);if(!((s=t==null?void 0:t.customer)!=null&&s.requisition_lists))return null;const i=t.customer.requisition_lists.items.map(I=>l(I));return p.emit("requisitionLists/data",i),{items:i,page_info:(n=(r=t.customer)==null?void 0:r.requisition_lists)==null?void 0:n.page_info,total_count:(u=(o=t.customer)==null?void 0:o.requisition_lists)==null?void 0:u.total_count}});export{R as g};
22
+ ${m}
23
+ `,R=async(_,c)=>p(S,{variables:{currentPage:_,pageSize:c}}).then(({errors:e,data:t})=>{var s,r,o,n,u;if(e)return g(e);if(!((s=t==null?void 0:t.customer)!=null&&s.requisition_lists))return null;const i=t.customer.requisition_lists.items.map(I=>a(I));return l.emit("requisitionLists/data",i),{items:i,page_info:(o=(r=t.customer)==null?void 0:r.requisition_lists)==null?void 0:o.page_info,total_count:(u=(n=t.customer)==null?void 0:n.requisition_lists)==null?void 0:u.total_count}});export{R as g};
24
24
  //# sourceMappingURL=getRequisitionLists.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n const reqLists = data.customer.requisition_lists.items.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n );\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.customer?.requisition_lists?.page_info,\n total_count: data.customer?.requisition_lists?.total_count,\n };\n });\n};\n"],"names":["GET_REQUISITION_LISTS_QUERY","REQUISITION_LIST_FRAGMENT","getRequisitionLists","currentPage","pageSize","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","requisitionList","transformRequisitionList","events","_c","_b","_e","_d"],"mappings":"yHAkBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzCC,CAAyB;AAAA,ECbdC,EAAsB,MACjCC,EACAC,IAEOC,EAAaL,EAA6B,CAC/C,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,eACxB,GAAAD,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,WAAN,MAAAE,EAAgB,mBACZ,OAAA,KAGT,MAAMC,EAAWH,EAAK,SAAS,kBAAkB,MAAM,IACpDI,GAAyBC,EAAyBD,CAAe,CACpE,EAEO,OAAAE,EAAA,KAAK,wBAAyBH,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWI,GAAAC,EAAAR,EAAK,WAAL,YAAAQ,EAAe,oBAAf,YAAAD,EAAkC,UAC7C,aAAaE,GAAAC,EAAAV,EAAK,WAAL,YAAAU,EAAe,oBAAf,YAAAD,EAAkC,WACjD,CAAA,CACD"}
1
+ {"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n const reqLists = data.customer.requisition_lists.items.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n );\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.customer?.requisition_lists?.page_info,\n total_count: data.customer?.requisition_lists?.total_count,\n };\n });\n};\n"],"names":["GET_REQUISITION_LISTS_QUERY","REQUISITION_LIST_FRAGMENT","getRequisitionLists","currentPage","pageSize","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","requisitionList","transformRequisitionList","events","_c","_b","_e","_d"],"mappings":"yJAkBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzCC,CAAyB;AAAA,ECbdC,EAAsB,MACjCC,EACAC,IAEOC,EAAaL,EAA6B,CAC/C,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,eACxB,GAAAD,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,WAAN,MAAAE,EAAgB,mBACZ,OAAA,KAGT,MAAMC,EAAWH,EAAK,SAAS,kBAAkB,MAAM,IACpDI,GAAyBC,EAAyBD,CAAe,CACpE,EAEO,OAAAE,EAAA,KAAK,wBAAyBH,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWI,GAAAC,EAAAR,EAAK,WAAL,YAAAQ,EAAe,oBAAf,YAAAD,EAAkC,UAC7C,aAAaE,GAAAC,EAAAV,EAAK,WAAL,YAAAU,EAAe,oBAAf,YAAAD,EAAkC,WACjD,CAAA,CACD"}
@@ -0,0 +1,11 @@
1
+ /*! Copyright 2026 Adobe
2
+ All Rights Reserved. */
3
+ import{Initializer as a}from"@dropins/tools/lib.js";import{events as s}from"@dropins/tools/event-bus.js";import{s as t}from"./state.js";import{f as c,h as r}from"./fetch-graphql.js";const f=`
4
+ query STORE_CONFIG_QUERY {
5
+ storeConfig {
6
+ is_requisition_list_active
7
+ company_enabled
8
+ }
9
+ }
10
+ `,l=async()=>{try{const{errors:i,data:e}=await c(f,{cache:"force-cache"});return i?i.some(n=>n.message&&n.message.includes('Cannot query field "is_requisition_list_active"')||n.message.includes('Cannot query field "company_enabled"'))?!1:r(i):e==null?void 0:e.storeConfig}catch{return{is_requisition_list_active:"0",company_enabled:!1}}},o=new a({init:async i=>{const e={};t.config||(t.config=await l(),s.emit("requisitionList/initialized",t.config)),o.config.setConfig({...e,...i})},listeners:()=>[s.on("authenticated",i=>{t.authenticated=i})]}),h=o.config;export{h as c,l as g,o as i};
11
+ //# sourceMappingURL=initialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initialize.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":"sLAiBO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMrBC,EAAiB,SAA0B,CAClD,GAAA,CACF,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAS,EAAA,MAAMC,EAAaJ,EAAoB,CAC9D,MAAO,aAAA,CACR,EAED,OAAIE,EACmBA,EAAO,KACzBG,GACEA,EAAM,SACLA,EAAM,QAAQ,SACZ,iDAAA,GAEJA,EAAM,QAAQ,SAAS,sCAAsC,CACjE,EAES,GAEFC,EAAiBJ,CAAM,EAGzBC,GAAA,YAAAA,EAAM,WAAA,MACP,CACC,MAAA,CACL,2BAA4B,IAC5B,gBAAiB,EACnB,CAAA,CAEJ,ECxBaI,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAC,EAGlBC,EAAM,SACHA,EAAA,OAAS,MAAMV,EAAe,EAE7BW,EAAA,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,CACvB,CAAA,CAAA,CAEL,CAAC,EAEYJ,EAASF,EAAW"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{events as p}from"@dropins/tools/event-bus.js";import{FetchGraphQL as d}from"@dropins/tools/fetch-graphql.js";const I=t=>{const e=t.map(o=>o.message).join(" ");throw Error(e)},{setEndpoint:S,setFetchGraphQlHeader:E,removeFetchGraphQlHeader:v,setFetchGraphQlHeaders:N,fetchGraphQl:m,getConfig:h}=new d().getMethods(),g=`
3
+ import{f as p,h as d}from"./fetch-graphql.js";import{events as I}from"@dropins/tools/event-bus.js";const m=`
4
4
  fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
5
5
  uid
6
6
  name
@@ -8,7 +8,7 @@ fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
8
8
  items_count
9
9
  updated_at
10
10
  }
11
- `;function f(t){var e,o;return t?{uid:t.uid,name:t.name,description:t.description,updated_at:t.updated_at,items_count:t.items_count,items:b((e=t.items)==null?void 0:e.items),page_info:(o=t.items)==null?void 0:o.page_info}:null}function b(t){return t!=null&&t.length?t.map(e=>{var a,_,n,u;const o={uid:e.uid,sku:(a=e.product)==null?void 0:a.sku,quantity:e.quantity,stock_status:((_=e.product)==null?void 0:_.stock_status)||"IN_STOCK",only_x_left_in_stock:((n=e.product)==null?void 0:n.only_x_left_in_stock)??null,customizable_options:e.customizable_options?e.customizable_options.map(i=>({uid:i.customizable_option_uid,is_required:i.is_required,label:i.label,sort_order:i.sort_order,type:i.type,values:i.values.map(r=>({uid:r.customizable_option_value_uid,label:r.label,price:r.price,value:r.value}))})):[],bundle_options:e.bundle_options||[],configurable_options:e.configurable_options?e.configurable_options.map(i=>({option_uid:i.configurable_product_option_uid,option_label:i.option_label,value_uid:i.configurable_product_option_value_uid,value_label:i.value_label})):[],samples:e.samples?e.samples.map(i=>({url:i.sample_url,sort_order:i.sort_order,title:i.title})):[],gift_card_options:e.gift_card_options||{}};return(u=e.configured_product)!=null&&u.name?{...o,configured_product:e.configured_product}:o}):[]}const T=`
11
+ `;function f(t){var i,u;return t?{uid:t.uid,name:t.name,description:t.description,updated_at:t.updated_at,items_count:t.items_count,items:b((i=t.items)==null?void 0:i.items),page_info:(u=t.items)==null?void 0:u.page_info}:null}function b(t){return t!=null&&t.length?t.map(i=>{var _,a,s,r;const u={uid:i.uid,sku:(_=i.product)==null?void 0:_.sku,quantity:i.quantity,stock_status:((a=i.product)==null?void 0:a.stock_status)||"IN_STOCK",only_x_left_in_stock:((s=i.product)==null?void 0:s.only_x_left_in_stock)??null,customizable_options:i.customizable_options?i.customizable_options.map(e=>({uid:e.customizable_option_uid,is_required:e.is_required,label:e.label,sort_order:e.sort_order,type:e.type,values:e.values.map(n=>({uid:n.customizable_option_value_uid,label:n.label,price:n.price,value:n.value}))})):[],bundle_options:i.bundle_options||[],configurable_options:i.configurable_options?i.configurable_options.map(e=>({option_uid:e.configurable_product_option_uid,option_label:e.option_label,value_uid:e.configurable_product_option_value_uid,value_label:e.value_label})):[],samples:i.samples?i.samples.map(e=>({url:e.sample_url,sort_order:e.sort_order,title:e.title})):[],gift_card_options:i.gift_card_options||{}};return(r=i.configured_product)!=null&&r.name?{...u,configured_product:i.configured_product}:u}):[]}const g=`
12
12
  fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
13
13
  items {
14
14
  uid
@@ -101,7 +101,7 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
101
101
  total_pages
102
102
  }
103
103
  }
104
- `,R=`
104
+ `,T=`
105
105
  mutation UPDATE_REQUISITION_LIST_MUTATION(
106
106
  $requisitionListUid: ID!,
107
107
  $name: String!,
@@ -124,7 +124,7 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
124
124
  }
125
125
  }
126
126
  }
127
+ ${m}
127
128
  ${g}
128
- ${T}
129
- `,y=async(t,e,o,a,_,n)=>{var l,c;const{errors:u,data:i}=await m(R,{variables:{requisitionListUid:t,name:e,description:o,pageSize:a,currentPage:_}});if(u)return I(u);if(!((l=i==null?void 0:i.updateRequisitionList)!=null&&l.requisition_list))return null;const r=i.updateRequisitionList.requisition_list;let s=f(r);return(c=s==null?void 0:s.items)!=null&&c.length&&n&&(s={...s,items:await n(s.items)}),p.emit("requisitionList/data",s),s};export{g as R,E as a,N as b,T as c,m as f,h as g,I as h,v as r,S as s,f as t,y as u};
129
+ `,S=async(t,i,u,_,a,s)=>{var l,c;const{errors:r,data:e}=await p(T,{variables:{requisitionListUid:t,name:i,description:u,pageSize:_,currentPage:a}});if(r)return d(r);if(!((l=e==null?void 0:e.updateRequisitionList)!=null&&l.requisition_list))return null;const n=e.updateRequisitionList.requisition_list;let o=f(n);return(c=o==null?void 0:o.items)!=null&&c.length&&s&&(o={...o,items:await s(o.items)}),I.emit("requisitionList/data",o),o};export{m as R,g as a,f as t,S as u};
130
130
  //# sourceMappingURL=updateRequisitionList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"updateRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListItemsFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/graphql/updateRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/updateRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_FRAGMENT = `\nfragment REQUISITION_LIST_FRAGMENT on RequisitionList {\n uid\n name\n description\n items_count\n updated_at\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { RequisitionList } from '../models/requisitionList';\nimport {\n Item,\n ConfiguredProduct,\n Link,\n Sample,\n BundleOption,\n ConfigurableOption,\n RawCustomizableOption,\n GiftCardOption,\n} from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n if (!data) {\n return null;\n }\n\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n stock_status?: string;\n only_x_left_in_stock?: number | null;\n };\n quantity: number;\n customizable_options?: RawCustomizableOption[];\n bundle_options?: BundleOption[];\n configurable_options?: ConfigurableOption[];\n configured_product?: ConfiguredProduct;\n links?: Link[];\n samples?: Sample[];\n gift_card_options?: GiftCardOption;\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n const transformedItem = {\n uid: item.uid,\n sku: item.product?.sku,\n quantity: item.quantity,\n stock_status: (item.product?.stock_status || 'IN_STOCK') as\n | 'IN_STOCK'\n | 'OUT_OF_STOCK',\n only_x_left_in_stock: item.product?.only_x_left_in_stock ?? null,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map(\n (value: RawCustomizableOption['values'][number]) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })\n ),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n\n if (item.configured_product?.name) {\n return {\n ...transformedItem,\n configured_product: item.configured_product,\n };\n }\n return transformedItem;\n });\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_ITEMS_FRAGMENT = `\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n stock_status\n only_x_left_in_stock\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n $name: String!,\n $description: String,\n $pageSize: Int,\n $currentPage: Int\n ) {\n updateRequisitionList(\n requisitionListUid: $requisitionListUid\n input: {\n name: $name\n description: $description\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\nimport { UPDATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/updateRequisitionList/graphql/updateRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionList = async (\n requisitionListUid: string,\n name: string,\n description?: string,\n pageSize?: number,\n currentPage?: number,\n enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>\n): Promise<RequisitionList | null> => {\n const { errors, data } = await fetchGraphQl(UPDATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n name,\n description,\n pageSize,\n currentPage,\n },\n });\n\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionList?.requisition_list) {\n return null;\n }\n\n const rawList = data.updateRequisitionList.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"],"names":["handleFetchError","errors","errorMessage","e","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","items","item","transformedItem","_c","option","value","sample","_d","REQUISITION_LIST_ITEMS_FRAGMENT","UPDATE_REQUISITION_LIST_MUTATION","updateRequisitionList","requisitionListUid","name","description","pageSize","currentPage","enrichConfigurableProducts","rawList","payload","events"],"mappings":"oHAkBa,MAAAA,EAAoBC,GAAuC,CAChE,MAAAC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECHa,CACX,YAAAE,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAa,EAAE,WAAW,ECTrBC,EAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EC4BlC,SAASC,EACdC,EACwB,SACxB,OAAKA,EAIE,CACL,IAAKA,EAAK,IACV,KAAMA,EAAK,KACX,YAAaA,EAAK,YAClB,WAAYA,EAAK,WACjB,YAAaA,EAAK,YAClB,MAAOC,GAAeC,EAAAF,EAAK,QAAL,YAAAE,EAAY,KAAK,EACvC,WAAWC,EAAAH,EAAK,QAAL,YAAAG,EAAY,SACzB,EAXS,IAYX,CAoBA,SAASF,EAAeG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AO,EACpCA,CACT"}
1
+ {"version":3,"file":"updateRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListItemsFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/graphql/updateRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/updateRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_FRAGMENT = `\nfragment REQUISITION_LIST_FRAGMENT on RequisitionList {\n uid\n name\n description\n items_count\n updated_at\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { RequisitionList } from '../models/requisitionList';\nimport {\n Item,\n ConfiguredProduct,\n Link,\n Sample,\n BundleOption,\n ConfigurableOption,\n RawCustomizableOption,\n GiftCardOption,\n} from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n if (!data) {\n return null;\n }\n\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n stock_status?: string;\n only_x_left_in_stock?: number | null;\n };\n quantity: number;\n customizable_options?: RawCustomizableOption[];\n bundle_options?: BundleOption[];\n configurable_options?: ConfigurableOption[];\n configured_product?: ConfiguredProduct;\n links?: Link[];\n samples?: Sample[];\n gift_card_options?: GiftCardOption;\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n const transformedItem = {\n uid: item.uid,\n sku: item.product?.sku,\n quantity: item.quantity,\n stock_status: (item.product?.stock_status || 'IN_STOCK') as\n | 'IN_STOCK'\n | 'OUT_OF_STOCK',\n only_x_left_in_stock: item.product?.only_x_left_in_stock ?? null,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map(\n (value: RawCustomizableOption['values'][number]) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })\n ),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n\n if (item.configured_product?.name) {\n return {\n ...transformedItem,\n configured_product: item.configured_product,\n };\n }\n return transformedItem;\n });\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_ITEMS_FRAGMENT = `\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n stock_status\n only_x_left_in_stock\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n $name: String!,\n $description: String,\n $pageSize: Int,\n $currentPage: Int\n ) {\n updateRequisitionList(\n requisitionListUid: $requisitionListUid\n input: {\n name: $name\n description: $description\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\nimport { UPDATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/updateRequisitionList/graphql/updateRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionList = async (\n requisitionListUid: string,\n name: string,\n description?: string,\n pageSize?: number,\n currentPage?: number,\n enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>\n): Promise<RequisitionList | null> => {\n const { errors, data } = await fetchGraphQl(UPDATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n name,\n description,\n pageSize,\n currentPage,\n },\n });\n\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionList?.requisition_list) {\n return null;\n }\n\n const rawList = data.updateRequisitionList.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"],"names":["REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","items","item","transformedItem","_c","option","value","sample","_d","REQUISITION_LIST_ITEMS_FRAGMENT","UPDATE_REQUISITION_LIST_MUTATION","updateRequisitionList","requisitionListUid","name","description","pageSize","currentPage","enrichConfigurableProducts","errors","fetchGraphQl","handleFetchError","rawList","payload","events"],"mappings":"mGAiBO,MAAMA,EAA4B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EC4BlC,SAASC,EACdC,EACwB,SACxB,OAAKA,EAIE,CACL,IAAKA,EAAK,IACV,KAAMA,EAAK,KACX,YAAaA,EAAK,YAClB,WAAYA,EAAK,WACjB,YAAaA,EAAK,YAClB,MAAOC,GAAeC,EAAAF,EAAK,QAAL,YAAAE,EAAY,KAAK,EACvC,WAAWC,EAAAH,EAAK,QAAL,YAAAG,EAAY,SACzB,EAXS,IAYX,CAoBA,SAASF,EAAeG,EAA8B,CACpD,OAAKA,GAAA,MAAAA,EAAO,OAELA,EAAM,IAAKC,GAAsB,aACtC,MAAMC,EAAkB,CACtB,IAAKD,EAAK,IACV,KAAKH,EAAAG,EAAK,UAAL,YAAAH,EAAc,IACnB,SAAUG,EAAK,SACf,eAAeF,EAAAE,EAAK,UAAL,YAAAF,EAAc,eAAgB,WAG7C,uBAAsBI,EAAAF,EAAK,UAAL,YA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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECElCC,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuB9Cf,CAAyB;AAAA,EACzBc,CAA+B;AAAA,EClBpBE,EAAwB,MACnCC,EACAC,EACAC,EACAC,EACAC,EACAC,IACoC,SACpC,KAAM,CAAE,OAAAC,EAAQ,KAAArB,CAAS,EAAA,MAAMsB,EAAaT,EAAkC,CAC5E,UAAW,CACT,mBAAAE,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,EACA,YAAAC,CAAA,CACF,CACD,EAEG,GAAAE,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACnB,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,kBACzB,OAAA,KAGH,MAAAsB,EAAUxB,EAAK,sBAAsB,iBACvC,IAAAyB,EAAU1B,EAAyByB,CAAO,EAC1C,OAAArB,EAAAsB,GAAA,YAAAA,EAAS,QAAT,MAAAtB,EAAgB,QAAUiB,IAClBK,EAAA,CACR,GAAGA,EACH,MAAO,MAAML,EAA2BK,EAAQ,KAAK,CACvD,GAEKC,EAAA,KAAK,uBAAwBD,CAAO,EACpCA,CACT"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2026 Adobe
2
2
  All Rights Reserved. */
3
- import{R as u,R as d}from"../chunks/RequisitionListForm2.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/RequisitionListForm.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"../chunks/updateRequisitionList.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";export{u as RequisitionListForm,d as default};
3
+ import{R as d,R as l}from"../chunks/RequisitionListForm2.js";import"@dropins/tools/preact-jsx-runtime.js";import"../chunks/RequisitionListForm.js";import"@dropins/tools/preact-hooks.js";import"@dropins/tools/components.js";import"@dropins/tools/lib.js";import"@dropins/tools/i18n.js";import"../chunks/updateRequisitionList.js";import"../chunks/fetch-graphql.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/event-bus.js";export{d as RequisitionListForm,l as default};
4
4
  //# sourceMappingURL=RequisitionListForm.js.map