@dropins/storefront-requisition-list 1.0.0-beta2 → 1.0.0-beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/index.d.ts CHANGED
@@ -16,6 +16,7 @@
16
16
  *******************************************************************/
17
17
  export * from './initialize';
18
18
  export * from './fetch-graphql';
19
+ export * from './refineProduct';
19
20
  export * from './getStoreConfig';
20
21
  export * from './getRequisitionLists';
21
22
  export * from './getRequisitionList';
@@ -0,0 +1,10 @@
1
+ import { Item } from '../../data/models/item';
2
+
3
+ /**
4
+ * Enriches configurable products with variant data by calling the refineProduct query
5
+ *
6
+ * @param items - Array of requisition list items
7
+ * @returns Promise resolving to array of items with configured_product populated for configurable items
8
+ */
9
+ export declare const enrichConfigurableProducts: (items: Item[]) => Promise<Item[]>;
10
+ //# sourceMappingURL=enrichConfigurableProducts.d.ts.map
@@ -0,0 +1,18 @@
1
+ /********************************************************************
2
+ * ADOBE CONFIDENTIAL
3
+ * __________________
4
+ *
5
+ * Copyright 2025 Adobe
6
+ * All Rights Reserved.
7
+ *
8
+ * NOTICE: All information contained herein is, and remains
9
+ * the property of Adobe and its suppliers, if any. The intellectual
10
+ * and technical concepts contained herein are proprietary to Adobe
11
+ * and its suppliers and are protected by all applicable intellectual
12
+ * property laws, including trade secret and copyright laws.
13
+ * Dissemination of this information or reproduction of this material
14
+ * is strictly forbidden unless prior written permission is obtained
15
+ * from Adobe.
16
+ *******************************************************************/
17
+ export * from './enrichConfigurableProducts';
18
+ //# sourceMappingURL=index.d.ts.map
package/api.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{f as o,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 a}from"@dropins/tools/event-bus.js";import{g as Q}from"./chunks/getRequisitionLists.js";import{a as v,d as x,b as O,g as w,u as z}from"./chunks/addRequisitionListItemsToCart.js";import{d as S}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=`
3
+ import{f as o,h as r}from"./chunks/updateRequisitionList.js";import{e as R,g as y,r as F,s as L,a as b,b as E,u as G}from"./chunks/updateRequisitionList.js";import{events as a}from"@dropins/tools/event-bus.js";import{g as Q}from"./chunks/getRequisitionLists.js";import{a as x,d as O,b as w,g as z,u as H}from"./chunks/addRequisitionListItemsToCart.js";import{d as T}from"./chunks/deleteRequisitionList.js";import{Initializer as c}from"@dropins/tools/lib.js";import{s as t}from"./chunks/state.js";import"@dropins/tools/fetch-graphql.js";const f=`
4
4
  query STORE_CONFIG_QUERY {
5
5
  storeConfig {
6
6
  is_requisition_list_active
7
7
  company_enabled
8
8
  }
9
9
  }
10
- `,u=async()=>{try{const{errors:e,data:i}=await o(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}}},n=new c({init:async e=>{const i={};t.config||(t.config=await u(),a.emit("requisitionList/initialized",t.config)),n.config.setConfig({...i,...e})},listeners:()=>[a.on("authenticated",e=>{t.authenticated=e})]}),_=n.config;export{v as addRequisitionListItemsToCart,_ as config,S as deleteRequisitionList,x as deleteRequisitionListItems,o as fetchGraphQl,R as getConfig,O as getProductData,w as getRequisitionList,Q as getRequisitionLists,u as getStoreConfig,n as initialize,y as removeFetchGraphQlHeader,F as setEndpoint,L as setFetchGraphQlHeader,E as setFetchGraphQlHeaders,G as updateRequisitionList,z as updateRequisitionListItems};
10
+ `,u=async()=>{try{const{errors:e,data:i}=await o(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}}},n=new c({init:async e=>{const i={};t.config||(t.config=await u(),a.emit("requisitionList/initialized",t.config)),n.config.setConfig({...i,...e})},listeners:()=>[a.on("authenticated",e=>{t.authenticated=e})]}),_=n.config;export{x as addRequisitionListItemsToCart,_ as config,T as deleteRequisitionList,O as deleteRequisitionListItems,R as enrichConfigurableProducts,o as fetchGraphQl,y as getConfig,w as getProductData,z as getRequisitionList,Q as getRequisitionLists,u as getStoreConfig,n as initialize,F as removeFetchGraphQlHeader,L as setEndpoint,b as setFetchGraphQlHeader,E as setFetchGraphQlHeaders,G as updateRequisitionList,H as updateRequisitionListItems};
11
11
  //# sourceMappingURL=api.js.map
package/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sources":["/@dropins/storefront-requisition-list/src/api/getStoreConfig/graphql/storeConfigQuery.ts","/@dropins/storefront-requisition-list/src/api/getStoreConfig/getStoreConfig.ts","/@dropins/storefront-requisition-list/src/api/initialize/initialize.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const STORE_CONFIG_QUERY = `\nquery STORE_CONFIG_QUERY {\n storeConfig {\n is_requisition_list_active\n company_enabled\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/requisitionList/api';\n\nimport { STORE_CONFIG_QUERY } from './graphql/storeConfigQuery';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { StoreConfig } from '@/requisitionList/lib/state';\n\nexport const getStoreConfig = async (): Promise<any> => {\n try {\n const { errors, data } = await fetchGraphQl(STORE_CONFIG_QUERY, {\n cache: 'force-cache',\n });\n\n if (errors) {\n const missingField = errors.some(\n (error) =>\n (error.message &&\n error.message.includes(\n 'Cannot query field \"is_requisition_list_active\"'\n )) ||\n error.message.includes('Cannot query field \"company_enabled\"')\n );\n if (missingField) {\n return false;\n }\n return handleFetchError(errors);\n }\n\n return data?.storeConfig;\n } catch {\n return {\n is_requisition_list_active: '0',\n company_enabled: false,\n } as StoreConfig;\n }\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Initializer } from '@adobe-commerce/elsie/lib';\nimport { Lang } from '@adobe-commerce/elsie/i18n';\nimport { events } from '@adobe-commerce/event-bus';\nimport { state } from '@/requisitionList/lib/state';\nimport { getStoreConfig } from '@/requisitionList/api/getStoreConfig';\n\ntype ConfigProps = {\n langDefinitions?: Lang;\n};\n\nexport const initialize = new Initializer<ConfigProps>({\n init: async (config) => {\n const defaultConfig = {};\n\n // set config\n if (!state.config) {\n state.config = await getStoreConfig();\n // Emit event to notify listeners that requisition list has been initialized\n events.emit('requisitionList/initialized', state.config);\n }\n\n initialize.config.setConfig({ ...defaultConfig, ...config });\n },\n\n listeners: () => [\n events.on('authenticated', (authenticated) => {\n state.authenticated = authenticated;\n }),\n ],\n});\n\nexport const config = initialize.config;\n"],"names":["STORE_CONFIG_QUERY","getStoreConfig","errors","data","fetchGraphQl","error","handleFetchError","initialize","Initializer","config","defaultConfig","state","events","authenticated"],"mappings":"ihBAiBO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMrBC,EAAiB,SAA0B,CACtD,GAAI,CACF,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAA,EAAS,MAAMC,EAAaJ,EAAoB,CAC9D,MAAO,aAAA,CACR,EAED,OAAIE,EACmBA,EAAO,KACzBG,GACEA,EAAM,SACLA,EAAM,QAAQ,SACZ,iDAAA,GAEJA,EAAM,QAAQ,SAAS,sCAAsC,CAAA,EAGxD,GAEFC,EAAiBJ,CAAM,EAGzBC,GAAA,YAAAA,EAAM,WACf,MAAQ,CACN,MAAO,CACL,2BAA4B,IAC5B,gBAAiB,EAAA,CAErB,CACF,ECxBaI,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAA,EAGjBC,EAAM,SACTA,EAAM,OAAS,MAAMV,EAAA,EAErBW,EAAO,KAAK,8BAA+BD,EAAM,MAAM,GAGzDJ,EAAW,OAAO,UAAU,CAAE,GAAGG,EAAe,GAAGD,EAAQ,CAC7D,EAEA,UAAW,IAAM,CACfG,EAAO,GAAG,gBAAkBC,GAAkB,CAC5CF,EAAM,cAAgBE,CACxB,CAAC,CAAA,CAEL,CAAC,EAEYJ,EAASF,EAAW"}
1
+ {"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":"whBAiBO,MAAMA,EAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECMrBC,EAAiB,SAA0B,CACtD,GAAI,CACF,KAAM,CAAE,OAAAC,EAAQ,KAAAC,CAAA,EAAS,MAAMC,EAAaJ,EAAoB,CAC9D,MAAO,aAAA,CACR,EAED,OAAIE,EACmBA,EAAO,KACzBG,GACEA,EAAM,SACLA,EAAM,QAAQ,SACZ,iDAAA,GAEJA,EAAM,QAAQ,SAAS,sCAAsC,CAAA,EAGxD,GAEFC,EAAiBJ,CAAM,EAGzBC,GAAA,YAAAA,EAAM,WACf,MAAQ,CACN,MAAO,CACL,2BAA4B,IAC5B,gBAAiB,EAAA,CAErB,CACF,ECxBaI,EAAa,IAAIC,EAAyB,CACrD,KAAM,MAAOC,GAAW,CACtB,MAAMC,EAAgB,CAAA,EAGjBC,EAAM,SACTA,EAAM,OAAS,MAAMV,EAAA,EAErBW,EAAO,KAAK,8BAA+BD,EAAM,MAAM,GAGzDJ,EAAW,OAAO,UAAU,CAAE,GAAGG,EAAe,GAAGD,EAAQ,CAC7D,EAEA,UAAW,IAAM,CACfG,EAAO,GAAG,gBAAkBC,GAAkB,CAC5CF,EAAM,cAAgBE,CACxB,CAAC,CAAA,CAEL,CAAC,EAEYJ,EAASF,EAAW"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{c,R as m,f as a,h as I,t as T}from"./updateRequisitionList.js";import{events as p}from"@dropins/tools/event-bus.js";function S(i){var r;return{sku:i.sku,parent_sku:i.sku,name:i.name,price:i.price,shortDescription:i.shortDescription||"",metaDescription:i.metaDescription||"",metaKeyword:i.metaKeyword||"",metaTitle:i.metaTitle||"",description:i.description||"",addToCartAllowed:i.addToCartAllowed,url:i.url||"",urlKey:i.urlKey||"",externalId:i.externalId||"",images:((r=i.images)==null?void 0:r.map(t=>({url:t.url,label:t.label||"",roles:t.roles||[]})))||[]}}function U(i){return i!=null&&i.length?i.map(S):[]}const L=`
3
+ import{c as _,R as a,f as I,h as m,e as T,t as c}from"./updateRequisitionList.js";import{events as q}from"@dropins/tools/event-bus.js";function R(i){var r;return{sku:i.sku,parent_sku:i.sku,name:i.name,price:i.price,shortDescription:i.shortDescription||"",metaDescription:i.metaDescription||"",metaKeyword:i.metaKeyword||"",metaTitle:i.metaTitle||"",description:i.description||"",addToCartAllowed:i.addToCartAllowed,url:i.url||"",urlKey:i.urlKey||"",externalId:i.externalId||"",images:((r=i.images)==null?void 0:r.map(t=>({url:t.url,label:t.label||"",roles:t.roles||[]})))||[]}}function L(i){return i!=null&&i.length?i.map(R):[]}const E=`
4
4
  query GET_REQUISITION_LIST_QUERY(
5
5
  $requisitionListUid: String,
6
6
  $currentPage: Int = 1,
@@ -23,35 +23,9 @@ import{c,R as m,f as a,h as I,t as T}from"./updateRequisitionList.js";import{eve
23
23
  }
24
24
  }
25
25
  }
26
- ${c}
27
- ${m}
28
- `,f=`
29
- query REFINE_PRODUCT(
30
- $optionIds: [String!]!,
31
- $sku: String!
32
- ) {
33
- refineProduct(
34
- optionIds: $optionIds
35
- sku: $sku
36
- ) {
37
- sku
38
- name
39
- images {
40
- url
41
- }
42
- ... on SimpleProductView {
43
- price {
44
- final {
45
- amount {
46
- value
47
- currency
48
- }
49
- }
50
- }
51
- }
52
- }
53
- }
54
- `;function g(i){return!i||typeof i!="string"||i.length<2||!/^[A-Za-z0-9+/]+(==|=)?$/.test(i)?!1:i.length%4===0}const M=async(i,r,t)=>{if(!g(i))return console.error("Invalid requisition list UID format:",i),null;const n=s=>s.configurable_options.map(e=>btoa(`configurable/${atob(e.configurable_product_option_uid)}/${atob(e.configurable_product_option_value_uid)}`));return a(L,{variables:{requisitionListUid:i,currentPage:r,pageSize:t}}).then(async({errors:s,data:e})=>{var d,R;if(s)return I(s);if(!((d=e==null?void 0:e.customer)!=null&&d.requisition_lists))return null;const l=await Promise.all((R=e==null?void 0:e.customer)==null?void 0:R.requisition_lists.items[0].items.items.map(async o=>{if(!o.product||!o.configurable_options)return o;const q=n(o),{errors:E,data:_}=await a(f,{variables:{optionIds:q,sku:o.product.sku}});return E?(console.error("Failed to refine product:",E),o):_!=null&&_.refineProduct?{...o,configured_product:_.refineProduct}:o}));e.customer.requisition_lists.items[0].items.items=l;const u=T(e.customer.requisition_lists.items[0]);return p.emit("requisitionList/data",u),u})},N=`
26
+ ${_}
27
+ ${a}
28
+ `;function p(i){return!i||typeof i!="string"||i.length<2||!/^[A-Za-z0-9+/]+(==|=)?$/.test(i)?!1:i.length%4===0}const O=async(i,r,t)=>p(i)?I(E,{variables:{requisitionListUid:i,currentPage:r,pageSize:t}}).then(async({errors:n,data:s})=>{var u,o;if(n)return m(n);if(!((u=s==null?void 0:s.customer)!=null&&u.requisition_lists))return null;(o=s.customer.requisition_lists.items[0].items)!=null&&o.items&&(s.customer.requisition_lists.items[0].items.items=await T(s.customer.requisition_lists.items[0].items.items));const e=c(s.customer.requisition_lists.items[0]);return q.emit("requisitionList/data",e),e}):(console.error("Invalid requisition list UID format:",i),null),S=`
55
29
  mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(
56
30
  $requisitionListUid: ID!,
57
31
  $requisitionListItems: [UpdateRequisitionListItemsInput!]!,
@@ -70,9 +44,9 @@ ${m}
70
44
  }
71
45
  }
72
46
  }
73
- ${m}
74
- ${c}
75
- `,b=async(i,r,t,n)=>a(N,{variables:{requisitionListUid:i,requisitionListItems:r,pageSize:t,currentPage:n}}).then(({errors:s,data:e})=>{var u;if(s)return I(s);if(!((u=e==null?void 0:e.updateRequisitionListItems)!=null&&u.requisition_list))return null;const l=T(e.updateRequisitionListItems.requisition_list);return p.emit("requisitionList/data",l),l}),P=`
47
+ ${a}
48
+ ${_}
49
+ `,A=async(i,r,t,n)=>I(S,{variables:{requisitionListUid:i,requisitionListItems:r,pageSize:t,currentPage:n}}).then(async({errors:s,data:e})=>{var o,l;if(s)return m(s);if(!((o=e==null?void 0:e.updateRequisitionListItems)!=null&&o.requisition_list))return null;(l=e.updateRequisitionListItems.requisition_list.items)!=null&&l.items&&(e.updateRequisitionListItems.requisition_list.items.items=await T(e.updateRequisitionListItems.requisition_list.items.items));const u=c(e.updateRequisitionListItems.requisition_list);return q.emit("requisitionList/data",u),u}),U=`
76
50
  mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(
77
51
  $requisitionListUid: ID!,
78
52
  $requisitionListItemUids: [ID!]!,
@@ -91,9 +65,9 @@ ${c}
91
65
  }
92
66
  }
93
67
  }
94
- ${m}
95
- ${c}
96
- `,v=async(i,r,t,n)=>a(P,{variables:{requisitionListUid:i,requisitionListItemUids:r,pageSize:t,currentPage:n}}).then(({errors:s,data:e})=>{var u;if(s)return I(s);if(!((u=e==null?void 0:e.deleteRequisitionListItems)!=null&&u.requisition_list))return null;const l=T(e.deleteRequisitionListItems.requisition_list);return p.emit("requisitionList/data",l),l}),$=`
68
+ ${a}
69
+ ${_}
70
+ `,P=async(i,r,t,n)=>I(U,{variables:{requisitionListUid:i,requisitionListItemUids:r,pageSize:t,currentPage:n}}).then(async({errors:s,data:e})=>{var o,l;if(s)return m(s);if(!((o=e==null?void 0:e.deleteRequisitionListItems)!=null&&o.requisition_list))return null;(l=e.deleteRequisitionListItems.requisition_list.items)!=null&&l.items&&(e.deleteRequisitionListItems.requisition_list.items.items=await T(e.deleteRequisitionListItems.requisition_list.items.items));const u=c(e.deleteRequisitionListItems.requisition_list);return q.emit("requisitionList/data",u),u}),d=`
97
71
  fragment PRODUCT_FRAGMENT on ProductView {
98
72
  __typename
99
73
  id
@@ -226,14 +200,14 @@ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
226
200
  }
227
201
  }
228
202
  }
229
- `,O=`
203
+ `,f=`
230
204
  query GET_PRODUCT_DATA($skus: [String]) {
231
205
  products(skus: $skus) {
232
206
  ...PRODUCT_FRAGMENT
233
207
  }
234
208
  }
235
- ${$}
236
- `,C=async i=>a(O,{variables:{skus:i}}).then(({errors:r,data:t})=>r?I(r):t!=null&&t.products?U(t.products):null),y=`
209
+ ${d}
210
+ `,$=async i=>I(f,{variables:{skus:i}}).then(({errors:r,data:t})=>r?m(r):t!=null&&t.products?L(t.products):null),N=`
237
211
  mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(
238
212
  $requisitionListUid: ID!,
239
213
  $requisitionListItemUids: [ID!]!
@@ -263,5 +237,5 @@ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
263
237
  }
264
238
  }
265
239
  }
266
- `,G=async(i,r)=>a(y,{variables:{requisitionListUid:i,requisitionListItemUids:r}}).then(({errors:t,data:n})=>{var s;return t?I(t):(s=n.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors)!=null&&s.length?n.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(e=>e.type):null});export{G as a,C as b,v as d,M as g,g as i,b as u};
240
+ `,D=async(i,r)=>I(N,{variables:{requisitionListUid:i,requisitionListItemUids:r}}).then(({errors:t,data:n})=>{var s;return t?m(t):(s=n.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors)!=null&&s.length?n.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(e=>e.type):null});export{D as a,$ as b,P as d,O as g,p as i,A as u};
267
241
  //# sourceMappingURL=addRequisitionListItemsToCart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addRequisitionListItemsToCart.js","sources":["/@dropins/storefront-requisition-list/src/data/transforms/transform-product.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/graphql/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/graphql/refineProduct.ts","/@dropins/storefront-requisition-list/src/lib/validate-uid.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/graphql/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/fragments/ProductFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/getProductData/graphql/getProductData.ts","/@dropins/storefront-requisition-list/src/api/getProductData/getProductData.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/addRequisitionListItemsToCart.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Product } from '@/requisitionList/data/models';\n\n// Interface for raw product data from GraphQL API\nexport interface RawProductData {\n __typename: string;\n id: string;\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n description?: string;\n inStock: boolean;\n addToCartAllowed: boolean;\n url?: string;\n urlKey?: string;\n externalId?: string;\n images?: {\n url: string;\n label?: string;\n roles?: string[];\n }[];\n attributes?: {\n name: string;\n label: string;\n value: string;\n roles?: string[];\n }[];\n price?: {\n roles?: string[];\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n };\n priceRange?: {\n maximum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n minimum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n options?: {\n id: string;\n title: string;\n required: boolean;\n multi: boolean;\n values: {\n id: string;\n title: string;\n inStock: boolean;\n __typename: string;\n quantity?: number;\n isDefault?: boolean;\n type?: string;\n value?: string;\n product?: {\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n price?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n }[];\n }[];\n}\n\nexport function transformProduct(data: RawProductData): Product {\n return {\n sku: data.sku,\n parent_sku: data.sku, // Use same SKU as parent for simple products\n name: data.name,\n price: data.price,\n shortDescription: data.shortDescription || '',\n metaDescription: data.metaDescription || '',\n metaKeyword: data.metaKeyword || '',\n metaTitle: data.metaTitle || '',\n description: data.description || '',\n addToCartAllowed: data.addToCartAllowed,\n url: data.url || '',\n urlKey: data.urlKey || '',\n externalId: data.externalId || '',\n images:\n data.images?.map((image) => ({\n url: image.url,\n label: image.label || '',\n roles: image.roles || [],\n })) || [],\n };\n}\n\nexport function transformProducts(products: RawProductData[]): Product[] {\n if (!products?.length) return [];\n\n return products.map(transformProduct);\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const GET_REQUISITION_LIST_QUERY = `\n query GET_REQUISITION_LIST_QUERY(\n $requisitionListUid: String,\n $currentPage: Int = 1,\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists (\n filter: {\n uids: {\n eq: $requisitionListUid\n }\n }\n ){\n items {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n }\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REFINE_PRODUCT = `\n query REFINE_PRODUCT(\n $optionIds: [String!]!,\n $sku: String!\n ) {\n refineProduct(\n optionIds: $optionIds\n sku: $sku\n ) {\n sku\n name\n images {\n url\n }\n ... on SimpleProductView {\n price {\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\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 { REFINE_PRODUCT } from '@/requisitionList/api/getRequisitionList/graphql/refineProduct';\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, ConfigurableOption } 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): 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 // encodes option UID string into base64 string for refineProduct query\n // 'configurable/93/13' -> 'Y29uZmlndXJhYmxlLzkzLzEz'\n const encodeOptionUids = (item: Item): string[] => {\n return item.configurable_options.map((option: ConfigurableOption) => {\n return btoa(\n `configurable/${atob(option.configurable_product_option_uid)}/${atob(\n option.configurable_product_option_value_uid\n )}`\n );\n });\n };\n\n return fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n const itemsWithConfigurableProducts = await Promise.all(\n data?.customer?.requisition_lists.items[0].items.items.map(\n async (item: Item) => {\n if (!item.product || !item.configurable_options) return item;\n\n const optionIds = encodeOptionUids(item);\n\n const { errors, data: refineData } = await fetchGraphQl(\n REFINE_PRODUCT,\n {\n variables: {\n optionIds,\n sku: item.product.sku,\n },\n }\n );\n\n if (errors) {\n console.error('Failed to refine product:', errors);\n return item;\n }\n\n if (!refineData?.refineProduct) {\n return item;\n }\n\n return {\n ...item,\n configured_product: refineData.refineProduct,\n };\n }\n )\n );\n\n // Update the items in the data structure\n data.customer.requisition_lists.items[0].items.items =\n itemsWithConfigurableProducts;\n\n const payload = transformRequisitionList(\n data.customer.requisition_lists.items[0]\n );\n\n events.emit('requisitionList/data', payload);\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItems: [UpdateRequisitionListItemsInput!]!,\n $pageSize: Int = 20,\n $currentPage: Int = 1\n ) {\n updateRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItems: $requisitionListItems\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/updateRequisitionListItems/graphql/updateRequisitionListItems';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionListItems = async (\n requisitionListUid: string,\n requisitionListItems: Array<UpdateRequisitionListItemsInput>,\n pageSize: number,\n currentPage: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItems,\n pageSize,\n currentPage,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionListItems?.requisition_list) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.updateRequisitionListItems.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n\ntype UpdateRequisitionListItemsInput = {\n item_id: string;\n quantity?: number;\n entered_options?: Array<{ uid: string; value: string }>;\n selected_options?: Array<string>;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!,\n $pageSize: Int = 20,\n $currentPage: Int = 1\n ) {\n deleteRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { DELETE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionListItems = async (\n requisitionListUid: string,\n items: Array<string>,\n pageSize: number,\n currentPage: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids: items,\n pageSize,\n currentPage,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionListItems?.requisition_list) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.deleteRequisitionListItems.requisition_list\n );\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const PRODUCT_FRAGMENT = `\nfragment PRODUCT_FRAGMENT on ProductView {\n __typename\n id\n sku\n name\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n description\n inStock\n addToCartAllowed\n url\n urlKey\n externalId\n images(roles: []) {\n url\n label\n roles\n }\n attributes(roles: []) {\n name\n label\n value\n roles\n }\n ... on SimpleProductView {\n price {\n roles\n regular {\n amount {\n value\n currency\n }\n }\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n ... on ComplexProductView {\n options {\n ...PRODUCT_OPTION_FRAGMENT\n }\n ...PRICE_RANGE_FRAGMENT\n }\n}\nfragment PRODUCT_OPTION_FRAGMENT on ProductViewOption {\n id\n title\n required\n multi\n values {\n id\n title\n inStock\n __typename\n ... on ProductViewOptionValueProduct {\n title\n quantity\n isDefault\n __typename\n product {\n sku\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n name\n price {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n }\n ... on ProductViewOptionValueSwatch {\n id\n title\n type\n value\n inStock\n }\n }\n}\nfragment PRICE_RANGE_FRAGMENT on ComplexProductView {\n priceRange {\n maximum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n minimum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { PRODUCT_FRAGMENT } from '@/requisitionList/api/fragments/ProductFragment.graphql';\n\nexport const GET_PRODUCT_DATA_QUERY = `\n query GET_PRODUCT_DATA($skus: [String]) {\n products(skus: $skus) {\n ...PRODUCT_FRAGMENT\n }\n }\n ${PRODUCT_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformProducts } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { GET_PRODUCT_DATA_QUERY } from './graphql/getProductData';\nimport { Product } from '@/requisitionList/data/models/item';\n\nexport const getProductData = async (\n skus: string[]\n): Promise<Product[] | null> => {\n return fetchGraphQl(GET_PRODUCT_DATA_QUERY, {\n variables: {\n skus,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.products) {\n return null;\n }\n\n return transformProducts(data.products);\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION = `\n mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!\n ) {\n addRequisitionListItemsToCart(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n status\n add_requisition_list_items_to_cart_user_errors {\n message\n type\n }\n cart {\n id\n itemsV2 {\n items {\n uid\n quantity\n is_available\n }\n total_count\n }\n email\n total_quantity\n is_virtual\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION } from '@/requisitionList/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart';\n\nexport const addRequisitionListItemsToCart = async (\n requisitionListUid: string,\n requisitionListItemUids: Array<string>\n): Promise<Array<string> | null> => {\n return fetchGraphQl(ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (\n data.addRequisitionListItemsToCart\n .add_requisition_list_items_to_cart_user_errors?.length\n ) {\n return data.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(\n (e: any) => e.type\n );\n }\n return null;\n });\n};\n"],"names":["transformProduct","data","_a","image","transformProducts","products","GET_REQUISITION_LIST_QUERY","REQUISITION_LIST_ITEMS_FRAGMENT","REQUISITION_LIST_FRAGMENT","REFINE_PRODUCT","isValidBase64Uid","uid","getRequisitionList","requisitionListID","currentPage","pageSize","encodeOptionUids","item","option","fetchGraphQl","errors","handleFetchError","itemsWithConfigurableProducts","_b","optionIds","refineData","payload","transformRequisitionList","events","UPDATE_REQUISITION_LIST_ITEMS_MUTATION","updateRequisitionListItems","requisitionListUid","requisitionListItems","DELETE_REQUISITION_LIST_ITEMS_MUTATION","deleteRequisitionListItems","items","PRODUCT_FRAGMENT","GET_PRODUCT_DATA_QUERY","getProductData","skus","ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION","addRequisitionListItemsToCart","requisitionListItemUids"],"mappings":"2HAsIO,SAASA,EAAiBC,EAA+B,OAC9D,MAAO,CACL,IAAKA,EAAK,IACV,WAAYA,EAAK,IACjB,KAAMA,EAAK,KACX,MAAOA,EAAK,MACZ,iBAAkBA,EAAK,kBAAoB,GAC3C,gBAAiBA,EAAK,iBAAmB,GACzC,YAAaA,EAAK,aAAe,GACjC,UAAWA,EAAK,WAAa,GAC7B,YAAaA,EAAK,aAAe,GACjC,iBAAkBA,EAAK,iBACvB,IAAKA,EAAK,KAAO,GACjB,OAAQA,EAAK,QAAU,GACvB,WAAYA,EAAK,YAAc,GAC/B,SACEC,EAAAD,EAAK,SAAL,YAAAC,EAAa,IAAKC,IAAW,CAC3B,IAAKA,EAAM,IACX,MAAOA,EAAM,OAAS,GACtB,MAAOA,EAAM,OAAS,CAAA,CAAC,MAClB,CAAA,CAAC,CAE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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECEnBC,EAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMlCD,CAAgB;AAAA,ECFPE,EAAiB,MAC5BC,GAEOpB,EAAakB,EAAwB,CAC1C,UAAW,CACT,KAAAE,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAnB,EAAQ,KAAAnB,KACbmB,EAAeC,EAAiBD,CAAM,EAErCnB,GAAA,MAAAA,EAAM,SAIJG,EAAkBH,EAAK,QAAQ,EAH7B,IAIV,ECrBUuC,EAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECI9CC,EAAgC,MAC3CV,EACAW,IAEOvB,EAAaqB,EAA6C,CAC/D,UAAW,CACT,mBAAAT,EACA,wBAAAW,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAtB,EAAQ,KAAAnB,KAAW,OAC5B,OAAImB,EAAeC,EAAiBD,CAAM,GAGxClB,EAAAD,EAAK,8BACF,iDADH,MAAAC,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtF,GAAW,EAAE,IAAA,EAGX,IACT,CAAC"}
1
+ {"version":3,"file":"addRequisitionListItemsToCart.js","sources":["/@dropins/storefront-requisition-list/src/data/transforms/transform-product.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/graphql/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/lib/validate-uid.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/graphql/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/fragments/ProductFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/getProductData/graphql/getProductData.ts","/@dropins/storefront-requisition-list/src/api/getProductData/getProductData.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/addRequisitionListItemsToCart.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Product } from '@/requisitionList/data/models';\n\n// Interface for raw product data from GraphQL API\nexport interface RawProductData {\n __typename: string;\n id: string;\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n description?: string;\n inStock: boolean;\n addToCartAllowed: boolean;\n url?: string;\n urlKey?: string;\n externalId?: string;\n images?: {\n url: string;\n label?: string;\n roles?: string[];\n }[];\n attributes?: {\n name: string;\n label: string;\n value: string;\n roles?: string[];\n }[];\n price?: {\n roles?: string[];\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n };\n priceRange?: {\n maximum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n minimum?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n options?: {\n id: string;\n title: string;\n required: boolean;\n multi: boolean;\n values: {\n id: string;\n title: string;\n inStock: boolean;\n __typename: string;\n quantity?: number;\n isDefault?: boolean;\n type?: string;\n value?: string;\n product?: {\n sku: string;\n name: string;\n shortDescription?: string;\n metaDescription?: string;\n metaKeyword?: string;\n metaTitle?: string;\n price?: {\n final?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n regular?: {\n amount: {\n value: number;\n currency: string;\n };\n };\n roles?: string[];\n };\n };\n }[];\n }[];\n}\n\nexport function transformProduct(data: RawProductData): Product {\n return {\n sku: data.sku,\n parent_sku: data.sku, // Use same SKU as parent for simple products\n name: data.name,\n price: data.price,\n shortDescription: data.shortDescription || '',\n metaDescription: data.metaDescription || '',\n metaKeyword: data.metaKeyword || '',\n metaTitle: data.metaTitle || '',\n description: data.description || '',\n addToCartAllowed: data.addToCartAllowed,\n url: data.url || '',\n urlKey: data.urlKey || '',\n externalId: data.externalId || '',\n images:\n data.images?.map((image) => ({\n url: image.url,\n label: image.label || '',\n roles: image.roles || [],\n })) || [],\n };\n}\n\nexport function transformProducts(products: RawProductData[]): Product[] {\n if (!products?.length) return [];\n\n return products.map(transformProduct);\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const GET_REQUISITION_LIST_QUERY = `\n query GET_REQUISITION_LIST_QUERY(\n $requisitionListUid: String,\n $currentPage: Int = 1,\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists (\n filter: {\n uids: {\n eq: $requisitionListUid\n }\n }\n ){\n items {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n }\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/**\n * Validates if a string is a valid base64-encoded UID\n * Adobe Commerce/Magento UIDs are base64 encoded\n *\n * @param uid - The UID to validate\n * @returns true if the UID appears to be valid base64 encoding\n */\nexport function isValidBase64Uid(uid: string | undefined | null): boolean {\n if (!uid || typeof uid !== 'string' || uid.length < 2) {\n return false;\n }\n\n // Base64 pattern: alphanumeric, +, /\n // Valid base64 can end with 0, 1, or 2 '=' padding characters\n // But the length must be a multiple of 4 when padded\n const base64Pattern = /^[A-Za-z0-9+/]+(==|=)?$/;\n\n if (!base64Pattern.test(uid)) {\n return false;\n }\n\n // Check that the total length is a multiple of 4 (valid base64 requirement)\n return uid.length % 4 === 0;\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LIST_QUERY } from '@/requisitionList/api/getRequisitionList/graphql/getRequisitionList';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { isValidBase64Uid } from '@/requisitionList/lib/validate-uid';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionList = async (\n requisitionListID: string,\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList | null> => {\n // Validate UID format before making API call\n if (!isValidBase64Uid(requisitionListID)) {\n console.error('Invalid requisition list UID format:', requisitionListID);\n return null;\n }\n\n return fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.customer.requisition_lists.items[0].items?.items) {\n data.customer.requisition_lists.items[0].items.items =\n await enrichConfigurableProducts(\n data.customer.requisition_lists.items[0].items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.customer.requisition_lists.items[0]\n );\n\n events.emit('requisitionList/data', payload);\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItems: [UpdateRequisitionListItemsInput!]!,\n $pageSize: Int = 20,\n $currentPage: Int = 1\n ) {\n updateRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItems: $requisitionListItems\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/updateRequisitionListItems/graphql/updateRequisitionListItems';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionListItems = async (\n requisitionListUid: string,\n requisitionListItems: Array<UpdateRequisitionListItemsInput>,\n pageSize: number,\n currentPage: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItems,\n pageSize,\n currentPage,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionListItems?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.updateRequisitionListItems.requisition_list.items?.items) {\n data.updateRequisitionListItems.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.updateRequisitionListItems.requisition_list.items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.updateRequisitionListItems.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n\ntype UpdateRequisitionListItemsInput = {\n item_id: string;\n quantity?: number;\n entered_options?: Array<{ uid: string; value: string }>;\n selected_options?: Array<string>;\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!,\n $pageSize: Int = 20,\n $currentPage: Int = 1\n ) {\n deleteRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { DELETE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionListItems = async (\n requisitionListUid: string,\n items: Array<string>,\n pageSize: number,\n currentPage: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids: items,\n pageSize,\n currentPage,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionListItems?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.deleteRequisitionListItems.requisition_list.items?.items) {\n data.deleteRequisitionListItems.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.deleteRequisitionListItems.requisition_list.items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.deleteRequisitionListItems.requisition_list\n );\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const PRODUCT_FRAGMENT = `\nfragment PRODUCT_FRAGMENT on ProductView {\n __typename\n id\n sku\n name\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n description\n inStock\n addToCartAllowed\n url\n urlKey\n externalId\n images(roles: []) {\n url\n label\n roles\n }\n attributes(roles: []) {\n name\n label\n value\n roles\n }\n ... on SimpleProductView {\n price {\n roles\n regular {\n amount {\n value\n currency\n }\n }\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n ... on ComplexProductView {\n options {\n ...PRODUCT_OPTION_FRAGMENT\n }\n ...PRICE_RANGE_FRAGMENT\n }\n}\nfragment PRODUCT_OPTION_FRAGMENT on ProductViewOption {\n id\n title\n required\n multi\n values {\n id\n title\n inStock\n __typename\n ... on ProductViewOptionValueProduct {\n title\n quantity\n isDefault\n __typename\n product {\n sku\n shortDescription\n metaDescription\n metaKeyword\n metaTitle\n name\n price {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n }\n ... on ProductViewOptionValueSwatch {\n id\n title\n type\n value\n inStock\n }\n }\n}\nfragment PRICE_RANGE_FRAGMENT on ComplexProductView {\n priceRange {\n maximum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n minimum {\n final {\n amount {\n value\n currency\n }\n }\n regular {\n amount {\n value\n currency\n }\n }\n roles\n }\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { PRODUCT_FRAGMENT } from '@/requisitionList/api/fragments/ProductFragment.graphql';\n\nexport const GET_PRODUCT_DATA_QUERY = `\n query GET_PRODUCT_DATA($skus: [String]) {\n products(skus: $skus) {\n ...PRODUCT_FRAGMENT\n }\n }\n ${PRODUCT_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformProducts } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { GET_PRODUCT_DATA_QUERY } from './graphql/getProductData';\nimport { Product } from '@/requisitionList/data/models/item';\n\nexport const getProductData = async (\n skus: string[]\n): Promise<Product[] | null> => {\n return fetchGraphQl(GET_PRODUCT_DATA_QUERY, {\n variables: {\n skus,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.products) {\n return null;\n }\n\n return transformProducts(data.products);\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION = `\n mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!\n ) {\n addRequisitionListItemsToCart(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n status\n add_requisition_list_items_to_cart_user_errors {\n message\n type\n }\n cart {\n id\n itemsV2 {\n items {\n uid\n quantity\n is_available\n }\n total_count\n }\n email\n total_quantity\n is_virtual\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION } from '@/requisitionList/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart';\n\nexport const addRequisitionListItemsToCart = async (\n requisitionListUid: string,\n requisitionListItemUids: Array<string>\n): Promise<Array<string> | null> => {\n return fetchGraphQl(ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (\n data.addRequisitionListItemsToCart\n .add_requisition_list_items_to_cart_user_errors?.length\n ) {\n return data.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(\n (e: any) => e.type\n );\n }\n return null;\n });\n};\n"],"names":["transformProduct","data","_a","image","transformProducts","products","GET_REQUISITION_LIST_QUERY","REQUISITION_LIST_ITEMS_FRAGMENT","REQUISITION_LIST_FRAGMENT","isValidBase64Uid","uid","getRequisitionList","requisitionListID","currentPage","pageSize","fetchGraphQl","errors","handleFetchError","_b","enrichConfigurableProducts","payload","transformRequisitionList","events","UPDATE_REQUISITION_LIST_ITEMS_MUTATION","updateRequisitionListItems","requisitionListUid","requisitionListItems","DELETE_REQUISITION_LIST_ITEMS_MUTATION","deleteRequisitionListItems","items","PRODUCT_FRAGMENT","GET_PRODUCT_DATA_QUERY","getProductData","skus","ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION","addRequisitionListItemsToCart","requisitionListItemUids"],"mappings":"uIAsIO,SAASA,EAAiBC,EAA+B,OAC9D,MAAO,CACL,IAAKA,EAAK,IACV,WAAYA,EAAK,IACjB,KAAMA,EAAK,KACX,MAAOA,EAAK,MACZ,iBAAkBA,EAAK,kBAAoB,GAC3C,gBAAiBA,EAAK,iBAAmB,GACzC,YAAaA,EAAK,aAAe,GACjC,UAAWA,EAAK,WAAa,GAC7B,YAAaA,EAAK,aAAe,GACjC,iBAAkBA,EAAK,iBACvB,IAAKA,EAAK,KAAO,GACjB,OAAQA,EAAK,QAAU,GACvB,WAAYA,EAAK,YAAc,GAC/B,SACEC,EAAAD,EAAK,SAAL,YAAAC,EAAa,IAAKC,IAAW,CAC3B,IAAKA,EAAM,IACX,MAAOA,EAAM,OAAS,GACtB,MAAOA,EAAM,OAAS,CAAA,CAAC,MAClB,CAAA,CAAC,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CAAC,CAAE,OAAAjB,EAAQ,KAAAf,KACbe,EAAeC,EAAiBD,CAAM,EAErCf,GAAA,MAAAA,EAAM,SAIJG,EAAkBH,EAAK,QAAQ,EAH7B,IAIV,ECrBUiC,EAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECI9CC,EAAgC,MAC3CV,EACAW,IAEOrB,EAAamB,EAA6C,CAC/D,UAAW,CACT,mBAAAT,EACA,wBAAAW,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAApB,EAAQ,KAAAf,KAAW,OAC5B,OAAIe,EAAeC,EAAiBD,CAAM,GAGxCd,EAAAD,EAAK,8BACF,iDADH,MAAAC,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtF,GAAW,EAAE,IAAA,EAGX,IACT,CAAC"}
@@ -1,6 +1,32 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{events as _}from"@dropins/tools/event-bus.js";import{FetchGraphQL as l}from"@dropins/tools/fetch-graphql.js";const p=t=>{const e=t.map(o=>o.message).join(" ");throw Error(e)},{setEndpoint:R,setFetchGraphQlHeader:q,removeFetchGraphQlHeader:L,setFetchGraphQlHeaders:S,fetchGraphQl:c,getConfig:E}=new l().getMethods(),d=`
3
+ import{events as c}from"@dropins/tools/event-bus.js";import{FetchGraphQL as p}from"@dropins/tools/fetch-graphql.js";const d=e=>{const i=e.map(r=>r.message).join(" ");throw Error(i)},{setEndpoint:E,setFetchGraphQlHeader:v,removeFetchGraphQlHeader:y,setFetchGraphQlHeaders:h,fetchGraphQl:l,getConfig:N}=new p().getMethods(),f=`
4
+ query REFINE_PRODUCT(
5
+ $optionIds: [String!]!,
6
+ $sku: String!
7
+ ) {
8
+ refineProduct(
9
+ optionIds: $optionIds
10
+ sku: $sku
11
+ ) {
12
+ sku
13
+ name
14
+ images {
15
+ url
16
+ }
17
+ ... on SimpleProductView {
18
+ price {
19
+ final {
20
+ amount {
21
+ value
22
+ currency
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ `,g=e=>e.configurable_options.map(i=>btoa(`configurable/${atob(i.configurable_product_option_uid)}/${atob(i.configurable_product_option_value_uid)}`)),I=async e=>Promise.all(e.map(async i=>{if(!i.product||!i.configurable_options||i.configurable_options.length===0)return i;const r=g(i),{errors:u,data:n}=await l(f,{variables:{optionIds:r,sku:i.product.sku}});return u?(console.error("Failed to refine product:",u),i):n!=null&&n.refineProduct?{...i,configured_product:n.refineProduct}:i})),m=`
4
30
  fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
5
31
  uid
6
32
  name
@@ -8,7 +34,7 @@ fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
8
34
  items_count
9
35
  updated_at
10
36
  }
11
- `;function I(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:m((e=t.items)==null?void 0:e.items),page_info:(o=t.items)==null?void 0:o.page_info}:null}function m(t){return t!=null&&t.length?t.map(e=>{var n,u;const o={uid:e.uid,sku:(n=e.product)==null?void 0:n.sku,quantity:e.quantity,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 g=`
37
+ `;function b(e){var i,r;return e?{uid:e.uid,name:e.name,description:e.description,updated_at:e.updated_at,items_count:e.items_count,items:R((i=e.items)==null?void 0:i.items),page_info:(r=e.items)==null?void 0:r.page_info}:null}function R(e){return e!=null&&e.length?e.map(i=>{var u,n;const r={uid:i.uid,sku:(u=i.product)==null?void 0:u.sku,quantity:i.quantity,customizable_options:i.customizable_options?i.customizable_options.map(t=>({uid:t.customizable_option_uid,is_required:t.is_required,label:t.label,sort_order:t.sort_order,type:t.type,values:t.values.map(o=>({uid:o.customizable_option_value_uid,label:o.label,price:o.price,value:o.value}))})):[],bundle_options:i.bundle_options||[],configurable_options:i.configurable_options?i.configurable_options.map(t=>({option_uid:t.configurable_product_option_uid,option_label:t.option_label,value_uid:t.configurable_product_option_value_uid,value_label:t.value_label})):[],samples:i.samples?i.samples.map(t=>({url:t.sample_url,sort_order:t.sort_order,title:t.title})):[],gift_card_options:i.gift_card_options||{}};return(n=i.configured_product)!=null&&n.name?{...r,configured_product:i.configured_product}:r}):[]}const T=`
12
38
  fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
13
39
  items {
14
40
  uid
@@ -99,7 +125,7 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
99
125
  total_pages
100
126
  }
101
127
  }
102
- `,b=`
128
+ `,q=`
103
129
  mutation UPDATE_REQUISITION_LIST_MUTATION(
104
130
  $requisitionListUid: ID!,
105
131
  $name: String!,
@@ -122,7 +148,7 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
122
148
  }
123
149
  }
124
150
  }
125
- ${d}
126
- ${g}
127
- `,v=async(t,e,o,n,u)=>c(b,{variables:{requisitionListUid:t,name:e,description:o,pageSize:n,currentPage:u}}).then(({errors:i,data:r})=>{var a;if(i)return p(i);if(!((a=r==null?void 0:r.updateRequisitionList)!=null&&a.requisition_list))return null;const s=I(r.updateRequisitionList.requisition_list);return _.emit("requisitionList/data",s),s});export{d as R,q as a,S as b,g as c,c as f,E as g,p as h,L as r,R as s,I as t,v as u};
151
+ ${m}
152
+ ${T}
153
+ `,U=async(e,i,r,u,n)=>l(q,{variables:{requisitionListUid:e,name:i,description:r,pageSize:u,currentPage:n}}).then(async({errors:t,data:o})=>{var a,_;if(t)return d(t);if(!((a=o==null?void 0:o.updateRequisitionList)!=null&&a.requisition_list))return null;(_=o.updateRequisitionList.requisition_list.items)!=null&&_.items&&(o.updateRequisitionList.requisition_list.items.items=await I(o.updateRequisitionList.requisition_list.items.items));const s=b(o.updateRequisitionList.requisition_list);return c.emit("requisitionList/data",s),s});export{m as R,v as a,h as b,T as c,I as e,l as f,N as g,d as h,y as r,E as s,b as t,U as u};
128
154
  //# 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 CustomizableOption,\n GiftCardOption,\n} from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n if (!data) {\n return null;\n }\n\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n };\n quantity: number;\n customizable_options?: CustomizableOption[];\n bundle_options?: BundleOption[];\n configurable_options?: ConfigurableOption[];\n configured_product?: ConfiguredProduct;\n links?: Link[];\n samples?: Sample[];\n gift_card_options?: GiftCardOption;\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n const transformedItem = {\n uid: item.uid,\n sku: item.product?.sku,\n quantity: item.quantity,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map((value) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n\n if (item.configured_product?.name) {\n return {\n ...transformedItem,\n configured_product: item.configured_product,\n };\n }\n return transformedItem;\n });\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_ITEMS_FRAGMENT = `\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n $name: String!,\n $description: String,\n $pageSize: Int,\n $currentPage: Int\n ) {\n updateRequisitionList(\n requisitionListUid: $requisitionListUid\n input: {\n name: $name\n description: $description\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/updateRequisitionList/graphql/updateRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionList = async (\n requisitionListUid: string,\n name: string,\n description?: string,\n pageSize?: number,\n currentPage?: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n name,\n description,\n pageSize,\n currentPage,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionList?.requisition_list) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.updateRequisitionList.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n"],"names":["handleFetchError","errors","errorMessage","e","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","items","item","transformedItem","option","value","sample","REQUISITION_LIST_ITEMS_FRAGMENT","UPDATE_REQUISITION_LIST_MUTATION","updateRequisitionList","requisitionListUid","name","description","pageSize","currentPage","payload","events"],"mappings":"oHAkBO,MAAMA,EAAoBC,GAAuC,CACtE,MAAMC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECHa,CACX,YAAAE,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECTVC,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,SAAA,EAVhB,IAYX,CAkBA,SAASF,EAAeG,EAA8B,CACpD,OAAKA,GAAA,MAAAA,EAAO,OAELA,EAAM,IAAKC,GAAsB,SACtC,MAAMC,EAAkB,CACtB,IAAKD,EAAK,IACV,KAAKH,EAAAG,EAAK,UAAL,YAAAH,EA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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,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,EAuB9Cb,CAAyB;AAAA,EACzBY,CAA+B;AAAA,ECnBpBE,EAAwB,MACnCC,EACAC,EACAC,EACAC,EACAC,IAEOtB,EAAagB,EAAkC,CACpD,UAAW,CACT,mBAAAE,EACA,KAAAC,EACA,YAAAC,EACA,SAAAC,EACA,YAAAC,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAA7B,EAAQ,KAAAY,KAAW,OAC5B,GAAIZ,EAAQ,OAAOD,EAAiBC,CAAM,EAE1C,GAAI,GAACc,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,kBAChC,OAAO,KAGT,MAAMgB,EAAUnB,EACdC,EAAK,sBAAsB,gBAAA,EAG7B,OAAAmB,EAAO,KAAK,uBAAwBD,CAAO,EAEpCA,CACT,CAAC"}
1
+ {"version":3,"file":"updateRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/api/refineProduct/graphql/refineProduct.ts","/@dropins/storefront-requisition-list/src/api/refineProduct/enrichConfigurableProducts.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListItemsFragment.graphql.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/graphql/updateRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionList/updateRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REFINE_PRODUCT = `\n query REFINE_PRODUCT(\n $optionIds: [String!]!,\n $sku: String!\n ) {\n refineProduct(\n optionIds: $optionIds\n sku: $sku\n ) {\n sku\n name\n images {\n url\n }\n ... on SimpleProductView {\n price {\n final {\n amount {\n value\n currency\n }\n }\n }\n }\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { Item, ConfigurableOption } from '@/requisitionList/data/models/item';\nimport { REFINE_PRODUCT } from '@/requisitionList/api/refineProduct/graphql/refineProduct';\n\n/**\n * Encodes option UID string into base64 string for refineProduct query\n * Example: 'configurable/93/13' -> 'Y29uZmlndXJhYmxlLzkzLzEz'\n */\nconst encodeOptionUids = (item: Item): string[] => {\n return item.configurable_options.map((option: ConfigurableOption) => {\n return btoa(\n `configurable/${atob(option.configurable_product_option_uid)}/${atob(\n option.configurable_product_option_value_uid\n )}`\n );\n });\n};\n\n/**\n * Enriches configurable products with variant data by calling the refineProduct query\n *\n * @param items - Array of requisition list items\n * @returns Promise resolving to array of items with configured_product populated for configurable items\n */\nexport const enrichConfigurableProducts = async (\n items: Item[]\n): Promise<Item[]> => {\n return Promise.all(\n items.map(async (item: Item) => {\n // Skip non-configurable items or items with no options selected\n if (\n !item.product ||\n !item.configurable_options ||\n item.configurable_options.length === 0\n ) {\n return item;\n }\n\n const optionIds = encodeOptionUids(item);\n\n const { errors, data: refineData } = await fetchGraphQl(REFINE_PRODUCT, {\n variables: {\n optionIds,\n sku: item.product.sku,\n },\n });\n\n if (errors) {\n console.error('Failed to refine product:', errors);\n return item;\n }\n\n if (!refineData?.refineProduct) {\n return item;\n }\n\n return {\n ...item,\n configured_product: refineData.refineProduct,\n };\n })\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_FRAGMENT = `\nfragment REQUISITION_LIST_FRAGMENT on RequisitionList {\n uid\n name\n description\n items_count\n updated_at\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { RequisitionList } from '../models/requisitionList';\nimport {\n Item,\n ConfiguredProduct,\n Link,\n Sample,\n BundleOption,\n ConfigurableOption,\n CustomizableOption,\n GiftCardOption,\n} from '@/requisitionList/data/models/item';\n\n// Interface for raw API response data for a requisition list\nexport interface RawRequisitionListData {\n name: string;\n description: string;\n uid: string;\n updated_at: string;\n items_count: number;\n items: {\n items: RawItemData[];\n page_info: {\n total_pages: number;\n current_page: number;\n page_size: number;\n };\n };\n}\n\nexport function transformRequisitionList(\n data: RawRequisitionListData\n): RequisitionList | null {\n if (!data) {\n return null;\n }\n\n return {\n uid: data.uid,\n name: data.name,\n description: data.description,\n updated_at: data.updated_at,\n items_count: data.items_count,\n items: transformItems(data.items?.items),\n page_info: data.items?.page_info,\n };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n product: {\n sku: string;\n };\n quantity: number;\n customizable_options?: CustomizableOption[];\n bundle_options?: BundleOption[];\n configurable_options?: ConfigurableOption[];\n configured_product?: ConfiguredProduct;\n links?: Link[];\n samples?: Sample[];\n gift_card_options?: GiftCardOption;\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n const transformedItem = {\n uid: item.uid,\n sku: item.product?.sku,\n quantity: item.quantity,\n customizable_options: item.customizable_options\n ? item.customizable_options.map((option) => ({\n uid: option.customizable_option_uid,\n is_required: option.is_required,\n label: option.label,\n sort_order: option.sort_order,\n type: option.type,\n values: option.values.map((value) => ({\n uid: value.customizable_option_value_uid,\n label: value.label,\n price: value.price,\n value: value.value,\n })),\n }))\n : [],\n bundle_options: item.bundle_options || [],\n configurable_options: item.configurable_options\n ? item.configurable_options.map((option) => ({\n option_uid: option.configurable_product_option_uid,\n option_label: option.option_label,\n value_uid: option.configurable_product_option_value_uid,\n value_label: option.value_label,\n }))\n : [],\n samples: item.samples\n ? item.samples.map((sample) => ({\n url: sample.sample_url,\n sort_order: sample.sort_order,\n title: sample.title,\n }))\n : [],\n gift_card_options: item.gift_card_options || {},\n };\n\n if (item.configured_product?.name) {\n return {\n ...transformedItem,\n configured_product: item.configured_product,\n };\n }\n return transformedItem;\n });\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const REQUISITION_LIST_ITEMS_FRAGMENT = `\nfragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {\n items {\n uid\n quantity\n product {\n sku\n }\n customizable_options {\n customizable_option_uid\n is_required\n label\n sort_order\n type\n values {\n customizable_option_value_uid\n label\n value\n price {\n type\n units\n value\n }\n }\n }\n ... on ConfigurableRequisitionListItem {\n configurable_options {\n configurable_product_option_uid\n configurable_product_option_value_uid\n option_label\n value_label\n }\n }\n ... on DownloadableRequisitionListItem {\n links {\n price\n sample_url\n sort_order\n title\n uid\n }\n samples {\n sample_url\n sort_order\n title\n }\n }\n ... on BundleRequisitionListItem {\n bundle_options {\n uid\n type\n label\n values {\n uid\n label\n quantity\n priceV2 {\n value\n currency\n }\n original_price {\n value\n currency\n }\n }\n }\n }\n ... on GiftCardRequisitionListItem {\n gift_card_options {\n amount {\n currency\n value\n }\n custom_giftcard_amount {\n currency\n value\n }\n message\n recipient_email\n recipient_name\n sender_name\n sender_email\n }\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n $name: String!,\n $description: String,\n $pageSize: Int,\n $currentPage: Int\n ) {\n updateRequisitionList(\n requisitionListUid: $requisitionListUid\n input: {\n name: $name\n description: $description\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { enrichConfigurableProducts } from '@/requisitionList/api/refineProduct';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/updateRequisitionList/graphql/updateRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const updateRequisitionList = async (\n requisitionListUid: string,\n name: string,\n description?: string,\n pageSize?: number,\n currentPage?: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n name,\n description,\n pageSize,\n currentPage,\n },\n }).then(async ({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.updateRequisitionList?.requisition_list) {\n return null;\n }\n\n // Enrich configurable products with variant data if items are present\n if (data.updateRequisitionList.requisition_list.items?.items) {\n data.updateRequisitionList.requisition_list.items.items =\n await enrichConfigurableProducts(\n data.updateRequisitionList.requisition_list.items.items\n );\n }\n\n const payload = transformRequisitionList(\n data.updateRequisitionList.requisition_list\n );\n\n events.emit('requisitionList/data', payload);\n\n return payload;\n });\n};\n"],"names":["handleFetchError","errors","errorMessage","e","setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","REFINE_PRODUCT","encodeOptionUids","item","option","enrichConfigurableProducts","items","optionIds","refineData","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","transformedItem","value","sample","REQUISITION_LIST_ITEMS_FRAGMENT","UPDATE_REQUISITION_LIST_MUTATION","updateRequisitionList","requisitionListUid","name","description","pageSize","currentPage","payload","events"],"mappings":"oHAkBO,MAAMA,EAAoBC,GAAuC,CACtE,MAAMC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECHa,CACX,YAAAE,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECTVC,EAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQxBC,EAAoBC,GACjBA,EAAK,qBAAqB,IAAKC,GAC7B,KACL,gBAAgB,KAAKA,EAAO,+BAA+B,CAAC,IAAI,KAC9DA,EAAO,qCAAA,CACR,EAAA,CAEJ,EASUC,EAA6B,MACxCC,GAEO,QAAQ,IACbA,EAAM,IAAI,MAAOH,GAAe,CAE9B,GACE,CAACA,EAAK,SACN,CAACA,EAAK,sBACNA,EAAK,qBAAqB,SAAW,EAErC,OAAOA,EAGT,MAAMI,EAAYL,EAAiBC,CAAI,EAEjC,CAAE,OAAAZ,EAAQ,KAAMiB,GAAe,MAAMV,EAAaG,EAAgB,CACtE,UAAW,CACT,UAAAM,EACA,IAAKJ,EAAK,QAAQ,GAAA,CACpB,CACD,EAED,OAAIZ,GACF,QAAQ,MAAM,4BAA6BA,CAAM,EAC1CY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AF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,kBAChC,OAAO,MAILC,EAAAH,EAAK,sBAAsB,iBAAiB,QAA5C,MAAAG,EAAmD,QACrDH,EAAK,sBAAsB,iBAAiB,MAAM,MAChD,MAAMN,EACJM,EAAK,sBAAsB,iBAAiB,MAAM,KAAA,GAIxD,MAAMe,EAAUhB,EACdC,EAAK,sBAAsB,gBAAA,EAG7B,OAAAgB,EAAO,KAAK,uBAAwBD,CAAO,EAEpCA,CACT,CAAC"}
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as L,jsx as i,Fragment as de}from"@dropins/tools/preact-jsx-runtime.js";import*as d from"@dropins/tools/preact-compat.js";import{useState as A,useEffect as te,useCallback as T}from"@dropins/tools/preact-compat.js";import{b as be,a as ke,d as ve,u as ye,g as ie,i as Ce}from"../chunks/addRequisitionListItemsToCart.js";import{Icon as Q,Button as U,Price as pe,Field as Re,Input as Se,Image as Ie,Checkbox as Pe,Table as Ae,ProgressSpinner as Ee,InLineAlert as Ne,Pagination as xe}from"@dropins/tools/components.js";import{events as me}from"@dropins/tools/event-bus.js";import{useState as ge,useCallback as ne}from"@dropins/tools/preact-hooks.js";import{classes as he,VComponent as Te}from"@dropins/tools/lib.js";import{D as G}from"../chunks/RequisitionListForm.js";import"../chunks/state.js";import{u as Ve,E as Me}from"../chunks/RequisitionListView.js";import{h as De}from"@dropins/tools/preact.js";import{useText as oe}from"@dropins/tools/i18n.js";import{R as He}from"../chunks/RequisitionListHeader.js";import{R as Be}from"../chunks/RequisitionListModal.js";import{P as ze}from"../chunks/PageSizePicker.js";import"../chunks/updateRequisitionList.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/deleteRequisitionList.js";function Fe(){const[s,S]=ge(null),[h,p]=ge(new Set),y=ne((b,I)=>{p(g=>{const k=new Set(g);return I?k.add(b):k.delete(b),k})},[]),C=ne(()=>{var I;const b=(I=s==null?void 0:s.items)==null?void 0:I.map(g=>g.uid);p(new Set(b))},[s]),E=ne(()=>{p(new Set)},[]);return{currentRequisitionList:s,setCurrentRequisitionList:S,selectedItems:h,setSelectedItems:p,handleItemSelection:y,handleSelectAll:C,handleSelectNone:E}}const $e=s=>d.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},d.createElement("g",{clipPath:"url(#clip0_102_196)"},d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z",stroke:"currentColor",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.25 6.37L20.89 8.06L20.14 14.8H6.19",stroke:"currentColor",strokeLinejoin:"round"})),d.createElement("defs",null,d.createElement("clipPath",{id:"clip0_102_196"},d.createElement("rect",{vectorEffect:"non-scaling-stroke",width:19.29,height:19.5,fill:"white",transform:"translate(2.3501 2.25)"})))),We=s=>d.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},d.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),je=s=>d.createElement("svg",{id:"Icon_Search_Base","data-name":"Icon \\u2013 Search \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",...s},d.createElement("g",{id:"Large"},d.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),d.createElement("g",{id:"Search_icon","data-name":"Search icon",transform:"translate(3.75 3.75)"},d.createElement("circle",{vectorEffect:"non-scaling-stroke",id:"Ellipse_186","data-name":"Ellipse 186",cx:6,cy:6,r:6,fill:"none",stroke:"currentColor"}),d.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_556","data-name":"Line 556",x2:6,y2:6,transform:"translate(10.5 10.5)",fill:"none",stroke:"currentColor"})))),fe=s=>d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...s},d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1 5H23",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.87402 8.58057L9.39348 17.682",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.6673 8.58057L14.146 17.682",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10})),Qe=({className:s,title:S="404 - Not Found",message:h="The requisition list you are looking for does not exist.",actionLabel:p,onAction:y,...C})=>L("div",{className:he(["not-found",s]),"data-testid":"not-found",...C,children:[i(Q,{source:je,size:"64",stroke:"2"}),i("h2",{children:S}),h&&i("p",{children:h}),p&&y&&i(U,{variant:"primary",onClick:y,children:p})]}),Ze=({className:s,items:S,selectedItems:h,currentPage:p,pageSize:y,canEdit:C=!0,handleItemSelection:E,handleUpdateQuantity:b,onAddToCart:I,onDeleteItem:g,...k})=>{const f=oe({productNameHeader:"RequisitionList.RequisitionListView.productListTable.headers.productName",skuHeader:"RequisitionList.RequisitionListView.productListTable.headers.sku",priceHeader:"RequisitionList.RequisitionListView.productListTable.headers.price",quantityHeader:"RequisitionList.RequisitionListView.productListTable.headers.quantity",subtotalHeader:"RequisitionList.RequisitionListView.productListTable.headers.subtotal",actionsHeader:"RequisitionList.RequisitionListView.productListTable.headers.actions",actionAddToCart:"RequisitionList.RequisitionListView.actionAddToCart",actionDelete:"RequisitionList.RequisitionListView.actionDelete",itemQuantity:"RequisitionList.RequisitionListView.productListTable.itemQuantity"}),z=[{label:"#",key:"index"},{label:"item",key:"item"},{label:f.priceHeader,key:"price"},{label:f.quantityHeader,key:"quantity"},{label:f.subtotalHeader,key:"subtotal"}];C&&(z.unshift({label:"",key:"selector"}),z.push({label:f.actionsHeader,key:"actions"}));const Z=(e,a)=>{const c=e.target.checked;E(a.uid,c)},O=e=>(p-1)*y+e+1,H=e=>{var a,c;return((a=e.configured_product)==null?void 0:a.name)||((c=e.product)==null?void 0:c.name)||e.sku},x=e=>{var a,c,w,P;return(a=e.configured_product)!=null&&a.images?(c=e.configured_product.images[0])==null?void 0:c.url:(w=e.product)!=null&&w.images?(P=e.product.images[0])==null?void 0:P.url:""},J=e=>{var a;return((a=e.product)==null?void 0:a.name)||e.sku},ee=e=>{var a;return(a=e.configured_product)==null?void 0:a.name},F=e=>e.bundle_options?e.bundle_options.map((c,w)=>L("span",{className:"requisition-list-view-product-list-table__product-configurable-name",children:[c.values[0].label," x ",c.values[0].quantity]},c.values[0].label||w)):void 0,K=e=>{var a;return((a=e.configured_product)==null?void 0:a.sku)||e.sku},B=e=>{var a,c,w,P,r,N,M,l;return Array.isArray(e.bundle_options)&&e.bundle_options.length>0?e.bundle_options.reduce((_,W)=>{var j,X,Y;return _+(((X=(j=W.values[0])==null?void 0:j.priceV2)==null?void 0:X.value)||0)*(((Y=W.values[0])==null?void 0:Y.quantity)||0)},0):((P=(w=(c=(a=e.configured_product)==null?void 0:a.price)==null?void 0:c.final)==null?void 0:w.amount)==null?void 0:P.value)||((l=(M=(N=(r=e.product)==null?void 0:r.price)==null?void 0:N.final)==null?void 0:M.amount)==null?void 0:l.value)||0},V=e=>{var a,c,w,P,r,N,M,l;return((P=(w=(c=(a=e.configured_product)==null?void 0:a.price)==null?void 0:c.final)==null?void 0:w.amount)==null?void 0:P.currency)||((l=(M=(N=(r=e.product)==null?void 0:r.price)==null?void 0:N.final)==null?void 0:M.amount)==null?void 0:l.currency)},$=e=>B(e)*e.quantity,t=S.map((e,a)=>({selector:i(Pe,{className:"requisition-list-view-product-list-table__checkbox",name:"itemSelected","data-testid":`item-checkbox-${e.sku}`,onChange:c=>Z(c,e),value:e.sku,checked:h.has(e.uid)}),index:i("div",{className:"requisition-list-view-product-list-table__index-container",children:O(a)}),item:L("div",{className:"requisition-list-view-product-list-table__item-container",children:[i(Ie,{className:"requisition-list-view-product-list-table__thumbnail",alt:H(e),src:x(e)}),L("div",{className:"requisition-list-view-product-list-table__item-details",children:[i("div",{className:"requisition-list-view-product-list-table__product-name",children:J(e)}),i("span",{className:"requisition-list-view-product-list-table__product-configurable-name",children:ee(e)}),i("div",{className:"requisition-list-view-product-list-table__sku",children:K(e)}),F(e)]})]}),price:i(pe,{className:"requisition-list-view-product-list-table__price",amount:B(e),currency:V(e)}),quantity:i("span",{className:"requisition-list-view-product-list-table__quantity",children:i(Re,{disabled:!1,children:i(Se,{id:`requisition-list-item-quantity-${e.sku}`,"data-testid":`requisition-list-item-quantity-${e.sku}`,name:"quantity",type:"text",value:e.quantity,onBlur:c=>{const w=Number.parseInt(c.target.value,10);b(e.uid,w)}})})}),subtotal:i(pe,{className:"requisition-list-view-product-list-table__price",amount:$(e),currency:V(e)}),actions:L("div",{className:"requisition-list-view__bulk-actions",children:[i(U,{type:"button",onClick:()=>I([e.uid]),icon:i(Q,{source:$e}),"data-testid":"product-list-table-add-to-cart-button"}),i(U,{type:"button",variant:"secondary",icon:i(Q,{source:fe}),onClick:()=>g([e.uid]),"data-testid":"product-list-table-delete-button"})]})})),m=i(Ae,{columns:z,rowData:t,"data-testid":"product-list-table",mobileLayout:"stacked"});return i(Te,{node:De("div",{}),className:he(["requisition-list-view-product-list-table-container",s]),"data-testid":"product-list-table-container",...k,children:m})},Oe=({selectedItems:s,deletingItemId:S,addingToCartItemId:h,bulkAddingToCart:p,updatingQuantityItemId:y,onSelectAll:C,onSelectNone:E,onBulkAddToCart:b,onBulkDelete:I})=>{const g=oe({statusDeleting:"RequisitionList.RequisitionListView.statusDeleting",actionSelectAll:"RequisitionList.RequisitionListView.actionSelectAll",actionSelectNone:"RequisitionList.RequisitionListView.actionSelectNone",actionAddToCart:"RequisitionList.RequisitionListView.actionAddToCart",actionDeleteSelectedItems:"RequisitionList.RequisitionListView.actionDeleteSelectedItems",statusBulkAddingToCart:"RequisitionList.RequisitionListView.statusBulkAddingToCart"}),k=S!==null||h!==null||p||y!==null,f=s.size>0;return L("div",{className:"requisition-list-view__batch-actions",children:[L("div",{className:"requisition-list-view__batch-actions-left",children:[i("button",{"data-testid":"bulk-actions-select-toggle-btn",type:"button",className:`requisition-list-view__batch-actions-select-toggle ${f?"requisition-list-view__batch-actions-select-toggle--active":""}`,onClick:f?E:C,disabled:k,"aria-label":f?g.actionSelectNone:g.actionSelectAll,children:i(Q,{source:We})}),i("button",{type:"button",className:"requisition-list-view__batch-actions-select-label",onClick:f?E:C,disabled:k,children:g.actionSelectAll})]}),f&&L("div",{className:"requisition-list-view__batch-actions-buttons",children:[i("span",{className:"requisition-list-view__batch-actions-count-badge","aria-label":`${s.size} items selected`,children:s.size}),i(U,{"data-testid":"bulk-actions-add-to-cart-btn",type:"button",variant:"secondary",onClick:b,disabled:k,children:p?g.statusBulkAddingToCart:g.actionAddToCart}),i("button",{"data-testid":"bulk-actions-delete-btn",type:"button",className:"requisition-list-view__batch-actions-delete-icon",onClick:I,disabled:k,"aria-label":g.actionDeleteSelectedItems,children:i(Q,{source:fe})})]})]})},pt=({requisitionListUid:s,skipProductLoading:S=!1,pageSize:h=G,routeRequisitionListGrid:p})=>{var se,ae,re,ce,le;const[y,C]=A(!1),[E,b]=A(null),[I,g]=A(null),[k,f]=A(!1),[z,Z]=A(null),[O,H]=A(!1),[x,J]=A(h),[ee,F]=A(!0),[K,B]=A(!1),[V,$]=A([]),{currentRequisitionList:t,setCurrentRequisitionList:m,selectedItems:e,setSelectedItems:a,handleItemSelection:c,handleSelectAll:w,handleSelectNone:P}=Fe(),r=oe({emptyRequisitionList:"RequisitionList.RequisitionListView.emptyRequisitionList",errorLoadingProducts:"RequisitionList.RequisitionListView.errorLoadingProducts",errorLoadPage:"RequisitionList.RequisitionListView.errorLoadPage",notFoundTitle:"RequisitionList.RequisitionListView.notFoundTitle",notFoundMessage:"RequisitionList.RequisitionListView.notFoundMessage",notFoundActionLabel:"RequisitionList.RequisitionListView.notFoundActionLabel",show:"RequisitionList.RequisitionListView.show",itemsCounter:"RequisitionList.RequisitionListView.itemsCounter",deleteItemsTitle:"RequisitionList.RequisitionListView.deleteItemsTitle",deleteItemsMessage:"RequisitionList.RequisitionListView.deleteItemsMessage",confirmAction:"RequisitionList.RequisitionListView.confirmAction",cancelAction:"RequisitionList.RequisitionListView.cancelAction"}),{alert:N,setAlert:M,handleRequisitionListAlert:l}=Ve();te(()=>{const n=me.on("requisitionList/data",u=>{(u==null?void 0:u.uid)===s&&(m(u),a(new Set))}),o=me.on("requisitionList/alert",l);return()=>{n==null||n.off(),o==null||o.off()}},[l,s,m,a]),te(()=>{J(h)},[h]);const _=T(async n=>{var u,v;const o=((u=n.items)==null?void 0:u.map(R=>R.sku))||[];if(o.length===0)return n;C(!0);try{const R=await be(o);if(R){const D=new Map;return R.forEach(q=>{D.set(q.sku,q)}),{...n,items:(v=n.items)==null?void 0:v.map(q=>({...q,product:D.get(q.sku)||q.product}))}}return console.warn("No products found"),n}catch(R){return console.warn(R instanceof Error?R.message:r.errorLoadingProducts),n}finally{C(!1)}},[r.errorLoadingProducts]);te(()=>{if(!s){F(!1);return}if(t&&t.uid===s)return;F(!0),(async()=>{try{const o=await ie(s,1,h);if(o)if(S)m(o);else{const u=await _(o);m(u)}}catch(o){console.error("Failed to initialize requisition list from UID:",o)}finally{F(!1)}})()},[s,h,S,_,m,t]);const W=T(async n=>{n&&n.length===1?(f(!1),g(n)):(f(!0),g(null));try{const o=await ke(t.uid,n);o&&o.length>0?l({action:"move",type:"error",context:"product",message:o.map(u=>u.message)}):l({action:"move",type:"success",context:"product"})}catch{l({action:"move",type:"error",context:"product"})}finally{g(null),f(!1)}},[t,l]),j=T(n=>{n&&n.length>0&&($(n),B(!0))},[]),X=T(async()=>{V.length===1?b(V[0]):b("bulk");try{const n=await ve(t.uid,V,x,t.page_info.current_page);if(n){const o=await _(n);m(o),l({action:"delete",type:"success",context:"product"})}else l({action:"delete",type:"error",context:"product"})}catch{l({action:"delete",type:"error",context:"product"})}finally{b(null),B(!1),$([])}},[V,t,x,_,m,l]),Y=T(async(n,o)=>{var u;Z(n);try{const v=(u=t.items)==null?void 0:u.find(q=>q.uid===n);if(!v){l({action:"update",type:"error",context:"product"});return}const R={item_id:v.uid,entered_options:v.entered_options,selected_options:v.selected_options,quantity:o},D=await ye(t.uid,[R],x,t.page_info.current_page);if(D){const q=await _(D);m(q),l({action:"update",type:"success",context:"product"})}else l({action:"update",type:"error",context:"product"})}catch{l({action:"update",type:"error",context:"product"})}finally{Z(null)}},[t,_,m,x,l]),we=T(async n=>{H(!0);try{const o=await ie(t.uid,n,x);if(o){const u=await _(o);m(u)}else console.warn(r.errorLoadPage)}catch(o){console.warn(o instanceof Error?o.message:r.errorLoadPage)}finally{H(!1)}},[t==null?void 0:t.uid,_,x,r,m]),_e=T(async n=>{J(n),H(!0);try{const o=await ie(t.uid,1,n);if(o){const u=await _(o);m(u)}else console.warn(r.errorLoadPage)}catch{console.warn(r.errorLoadPage)}finally{H(!1)}},[t==null?void 0:t.uid,_,r,m]),qe=T(async n=>{const o=await _(n);m(o)},[m,_]),Le=()=>{var q,ue;const n=((q=t.page_info)==null?void 0:q.page_size)??G,o=((ue=t.page_info)==null?void 0:ue.current_page)??1,u=n*o,v=(t==null?void 0:t.items_count)??0,R=u-n+1,D=u>v?v:u;return i("span",{className:"requisition-list-view__pagination-items",children:r.itemsCounter.replace("{from}",R.toString()).replace("{to}",D.toString()).replace("{total}",v.toString())})};return L("div",{className:"requisition-list-view__container",children:[ee?i("div",{className:"requisition-list-view__loading",children:i(Ee,{stroke:"4",size:"large"})}):!t||!Ce(t==null?void 0:t.uid)?i(Qe,{title:r.notFoundTitle,message:r.notFoundMessage,actionLabel:p?r.notFoundActionLabel:void 0,onAction:p?()=>{const n=p();n&&typeof n=="string"&&(window.location.href=n)}:void 0}):L(de,{children:[i(He,{requisitionList:t,routeRequisitionListGrid:p,onUpdate:qe,onAlert:l}),N&&i("div",{className:"requisition-list__alert-wrapper",children:i(Ne,{heading:N.description,type:N.type,variant:"primary",onDismiss:()=>M(null)})}),t.items_count===0?i(Me,{textContent:`${t.name} ${r.emptyRequisitionList}`}):L(de,{children:[i(Oe,{selectedItems:e,deletingItemId:E,addingToCartItemId:I,bulkAddingToCart:k,updatingQuantityItemId:z,onSelectAll:w,onSelectNone:P,onBulkAddToCart:()=>W(Array.from(e)),onBulkDelete:()=>j(Array.from(e))}),i(Ze,{items:t.items,selectedItems:e,currentPage:((se=t.page_info)==null?void 0:se.current_page)||1,pageSize:((ae=t.page_info)==null?void 0:ae.page_size)||G,handleItemSelection:c,handleUpdateQuantity:Y,onAddToCart:W,onDeleteItem:j}),t.page_info&&L("div",{className:"requisition-list-view__pagination",children:[Le(),(((re=t.page_info)==null?void 0:re.total_pages)||0)>1&&i(xe,{totalPages:t.page_info.total_pages,currentPage:((ce=t.page_info)==null?void 0:ce.current_page)||1,onChange:we,disabled:O||y}),L("div",{className:"requisition-list-view__pagination-picker",children:[i("span",{children:r.show}),i(ze,{currentPageSize:((le=t.page_info)==null?void 0:le.page_size)||G,onPageSizeChange:_e,disabled:O||y})]})]})]})]}),K&&i(Be,{isOpen:K,isLoading:E!==null,title:r.deleteItemsTitle,modalContent:r.deleteItemsMessage,confirmBtnCaption:r.confirmAction,closeBtnCaption:r.cancelAction,handleModalOnClose:()=>{B(!1),$([])},handleModalOnConfirm:X})]})};export{pt as RequisitionListView,pt as default};
3
+ import{jsxs as b,jsx as i,Fragment as pe}from"@dropins/tools/preact-jsx-runtime.js";import*as d from"@dropins/tools/preact-compat.js";import{useState as A,useEffect as ie,useCallback as T}from"@dropins/tools/preact-compat.js";import{b as be,a as ke,d as ve,u as ye,g as ne,i as Ce}from"../chunks/addRequisitionListItemsToCart.js";import{Icon as Z,Button as ee,Price as me,Field as Re,Input as Se,Image as Ie,Checkbox as Pe,Table as Ae,ProgressSpinner as Ee,InLineAlert as Ne,Pagination as xe}from"@dropins/tools/components.js";import{events as Q}from"@dropins/tools/event-bus.js";import{useState as ge,useCallback as oe}from"@dropins/tools/preact-hooks.js";import{classes as he,VComponent as Te}from"@dropins/tools/lib.js";import{D as U}from"../chunks/RequisitionListForm.js";import"../chunks/state.js";import{u as Ve,E as Me}from"../chunks/RequisitionListView.js";import{h as De}from"@dropins/tools/preact.js";import{useText as se}from"@dropins/tools/i18n.js";import{R as He}from"../chunks/RequisitionListHeader.js";import{R as Be}from"../chunks/RequisitionListModal.js";import{P as ze}from"../chunks/PageSizePicker.js";import"../chunks/updateRequisitionList.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/deleteRequisitionList.js";function Fe(){const[a,S]=ge(null),[h,p]=ge(new Set),y=oe((k,I)=>{p(g=>{const v=new Set(g);return I?v.add(k):v.delete(k),v})},[]),C=oe(()=>{var I;const k=(I=a==null?void 0:a.items)==null?void 0:I.map(g=>g.uid);p(new Set(k))},[a]),E=oe(()=>{p(new Set)},[]);return{currentRequisitionList:a,setCurrentRequisitionList:S,selectedItems:h,setSelectedItems:p,handleItemSelection:y,handleSelectAll:C,handleSelectNone:E}}const $e=a=>d.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},d.createElement("g",{clipPath:"url(#clip0_102_196)"},d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z",stroke:"currentColor",strokeLinejoin:"round"}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M5.25 6.37L20.89 8.06L20.14 14.8H6.19",stroke:"currentColor",strokeLinejoin:"round"})),d.createElement("defs",null,d.createElement("clipPath",{id:"clip0_102_196"},d.createElement("rect",{vectorEffect:"non-scaling-stroke",width:19.29,height:19.5,fill:"white",transform:"translate(2.3501 2.25)"})))),We=a=>d.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...a},d.createElement("path",{d:"M17.3332 11.75H6.6665",strokeWidth:1,strokeLinecap:"square",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke",fill:"none",stroke:"currentColor"})),je=a=>d.createElement("svg",{id:"Icon_Search_Base","data-name":"Icon \\u2013 Search \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none",viewBox:"0 0 24 24",...a},d.createElement("g",{id:"Large"},d.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),d.createElement("g",{id:"Search_icon","data-name":"Search icon",transform:"translate(3.75 3.75)"},d.createElement("circle",{vectorEffect:"non-scaling-stroke",id:"Ellipse_186","data-name":"Ellipse 186",cx:6,cy:6,r:6,fill:"none",stroke:"currentColor"}),d.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_556","data-name":"Line 556",x2:6,y2:6,transform:"translate(10.5 10.5)",fill:"none",stroke:"currentColor"})))),fe=a=>d.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",...a},d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M1 5H23",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M8.87402 8.58057L9.39348 17.682",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10}),d.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M14.6673 8.58057L14.146 17.682",stroke:"currentColor",strokeWidth:1,strokeMiterlimit:10})),Qe=({className:a,title:S="404 - Not Found",message:h="The requisition list you are looking for does not exist.",actionLabel:p,onAction:y,...C})=>b("div",{className:he(["not-found",a]),"data-testid":"not-found",...C,children:[i(Z,{source:je,size:"64",stroke:"2"}),i("h2",{children:S}),h&&i("p",{children:h}),p&&y&&i(ee,{variant:"primary",onClick:y,children:p})]}),Ze=({className:a,items:S,selectedItems:h,currentPage:p,pageSize:y,canEdit:C=!0,handleItemSelection:E,handleUpdateQuantity:k,onAddToCart:I,onDeleteItem:g,...v})=>{const f=se({productNameHeader:"RequisitionList.RequisitionListView.productListTable.headers.productName",skuHeader:"RequisitionList.RequisitionListView.productListTable.headers.sku",priceHeader:"RequisitionList.RequisitionListView.productListTable.headers.price",quantityHeader:"RequisitionList.RequisitionListView.productListTable.headers.quantity",subtotalHeader:"RequisitionList.RequisitionListView.productListTable.headers.subtotal",actionsHeader:"RequisitionList.RequisitionListView.productListTable.headers.actions",actionAddToCart:"RequisitionList.RequisitionListView.actionAddToCart",actionDelete:"RequisitionList.RequisitionListView.actionDelete",itemQuantity:"RequisitionList.RequisitionListView.productListTable.itemQuantity"}),z=[{label:"#",key:"index"},{label:"item",key:"item"},{label:f.priceHeader,key:"price"},{label:f.quantityHeader,key:"quantity"},{label:f.subtotalHeader,key:"subtotal"}];C&&(z.unshift({label:"",key:"selector"}),z.push({label:f.actionsHeader,key:"actions"}));const O=(e,r)=>{const l=e.target.checked;E(r.uid,l)},J=e=>(p-1)*y+e+1,H=e=>{var r,l;return((r=e.configured_product)==null?void 0:r.name)||((l=e.product)==null?void 0:l.name)||e.sku},x=e=>{var r,l,w,P;return(r=e.configured_product)!=null&&r.images?(l=e.configured_product.images[0])==null?void 0:l.url:(w=e.product)!=null&&w.images?(P=e.product.images[0])==null?void 0:P.url:""},K=e=>{var r;return((r=e.product)==null?void 0:r.name)||e.sku},te=e=>{var r;return(r=e.configured_product)==null?void 0:r.name},F=e=>e.bundle_options?e.bundle_options.map((l,w)=>b("span",{className:"requisition-list-view-product-list-table__product-configurable-name",children:[l.values[0].label," x ",l.values[0].quantity]},l.values[0].label||w)):void 0,X=e=>{var r;return((r=e.configured_product)==null?void 0:r.sku)||e.sku},B=e=>{var r,l,w,P,c,N,M,u;return Array.isArray(e.bundle_options)&&e.bundle_options.length>0?e.bundle_options.reduce((q,W)=>{var j,Y,G;return q+(((Y=(j=W.values[0])==null?void 0:j.priceV2)==null?void 0:Y.value)||0)*(((G=W.values[0])==null?void 0:G.quantity)||0)},0):((P=(w=(l=(r=e.configured_product)==null?void 0:r.price)==null?void 0:l.final)==null?void 0:w.amount)==null?void 0:P.value)||((u=(M=(N=(c=e.product)==null?void 0:c.price)==null?void 0:N.final)==null?void 0:M.amount)==null?void 0:u.value)||0},V=e=>{var r,l,w,P,c,N,M,u;return((P=(w=(l=(r=e.configured_product)==null?void 0:r.price)==null?void 0:l.final)==null?void 0:w.amount)==null?void 0:P.currency)||((u=(M=(N=(c=e.product)==null?void 0:c.price)==null?void 0:N.final)==null?void 0:M.amount)==null?void 0:u.currency)},$=e=>B(e)*e.quantity,t=S.map((e,r)=>({selector:i(Pe,{className:"requisition-list-view-product-list-table__checkbox",name:"itemSelected","data-testid":`item-checkbox-${e.sku}`,onChange:l=>O(l,e),value:e.sku,checked:h.has(e.uid)}),index:i("div",{className:"requisition-list-view-product-list-table__index-container",children:J(r)}),item:b("div",{className:"requisition-list-view-product-list-table__item-container",children:[i(Ie,{className:"requisition-list-view-product-list-table__thumbnail",alt:H(e),src:x(e)}),b("div",{className:"requisition-list-view-product-list-table__item-details",children:[i("div",{className:"requisition-list-view-product-list-table__product-name",children:K(e)}),i("span",{className:"requisition-list-view-product-list-table__product-configurable-name",children:te(e)}),i("div",{className:"requisition-list-view-product-list-table__sku",children:X(e)}),F(e)]})]}),price:i(me,{className:"requisition-list-view-product-list-table__price",amount:B(e),currency:V(e)}),quantity:i("span",{className:"requisition-list-view-product-list-table__quantity",children:i(Re,{disabled:!1,children:i(Se,{id:`requisition-list-item-quantity-${e.sku}`,"data-testid":`requisition-list-item-quantity-${e.sku}`,name:"quantity",type:"text",value:e.quantity,onBlur:l=>{const w=Number.parseInt(l.target.value,10);k(e.uid,w)}})})}),subtotal:i(me,{className:"requisition-list-view-product-list-table__price",amount:$(e),currency:V(e)}),actions:b("div",{className:"requisition-list-view__bulk-actions",children:[i(ee,{type:"button",onClick:()=>I([e.uid]),icon:i(Z,{source:$e}),"data-testid":"product-list-table-add-to-cart-button"}),i(ee,{type:"button",variant:"secondary",icon:i(Z,{source:fe}),onClick:()=>g([e.uid]),"data-testid":"product-list-table-delete-button"})]})})),m=i(Ae,{columns:z,rowData:t,"data-testid":"product-list-table",mobileLayout:"stacked"});return i(Te,{node:De("div",{}),className:he(["requisition-list-view-product-list-table-container",a]),"data-testid":"product-list-table-container",...v,children:m})},Oe=({selectedItems:a,deletingItemId:S,addingToCartItemId:h,bulkAddingToCart:p,updatingQuantityItemId:y,onSelectAll:C,onSelectNone:E,onBulkAddToCart:k,onBulkDelete:I})=>{const g=se({statusDeleting:"RequisitionList.RequisitionListView.statusDeleting",actionSelectAll:"RequisitionList.RequisitionListView.actionSelectAll",actionSelectNone:"RequisitionList.RequisitionListView.actionSelectNone",actionAddToCart:"RequisitionList.RequisitionListView.actionAddToCart",actionDeleteSelectedItems:"RequisitionList.RequisitionListView.actionDeleteSelectedItems",statusBulkAddingToCart:"RequisitionList.RequisitionListView.statusBulkAddingToCart"}),v=S!==null||h!==null||p||y!==null,f=a.size>0;return b("div",{className:"requisition-list-view__batch-actions",children:[b("div",{className:"requisition-list-view__batch-actions-left",children:[i("button",{"data-testid":"bulk-actions-select-toggle-btn",type:"button",className:`requisition-list-view__batch-actions-select-toggle ${f?"requisition-list-view__batch-actions-select-toggle--active":""}`,onClick:f?E:C,disabled:v,"aria-label":f?g.actionSelectNone:g.actionSelectAll,children:i(Z,{source:We})}),i("button",{type:"button",className:"requisition-list-view__batch-actions-select-label",onClick:f?E:C,disabled:v,children:g.actionSelectAll})]}),f&&b("div",{className:"requisition-list-view__batch-actions-buttons",children:[i("span",{className:"requisition-list-view__batch-actions-count-badge","aria-label":`${a.size} items selected`,children:a.size}),i(ee,{"data-testid":"bulk-actions-add-to-cart-btn",type:"button",variant:"secondary",onClick:k,disabled:v,children:p?g.statusBulkAddingToCart:g.actionAddToCart}),i("button",{"data-testid":"bulk-actions-delete-btn",type:"button",className:"requisition-list-view__batch-actions-delete-icon",onClick:I,disabled:v,"aria-label":g.actionDeleteSelectedItems,children:i(Z,{source:fe})})]})]})},pt=({requisitionListUid:a,skipProductLoading:S=!1,pageSize:h=U,routeRequisitionListGrid:p})=>{var ae,re,ce,le,ue;const[y,C]=A(!1),[E,k]=A(null),[I,g]=A(null),[v,f]=A(!1),[z,O]=A(null),[J,H]=A(!1),[x,K]=A(h),[te,F]=A(!0),[X,B]=A(!1),[V,$]=A([]),{currentRequisitionList:t,setCurrentRequisitionList:m,selectedItems:e,setSelectedItems:r,handleItemSelection:l,handleSelectAll:w,handleSelectNone:P}=Fe(),c=se({emptyRequisitionList:"RequisitionList.RequisitionListView.emptyRequisitionList",errorLoadingProducts:"RequisitionList.RequisitionListView.errorLoadingProducts",errorLoadPage:"RequisitionList.RequisitionListView.errorLoadPage",notFoundTitle:"RequisitionList.RequisitionListView.notFoundTitle",notFoundMessage:"RequisitionList.RequisitionListView.notFoundMessage",notFoundActionLabel:"RequisitionList.RequisitionListView.notFoundActionLabel",show:"RequisitionList.RequisitionListView.show",itemsCounter:"RequisitionList.RequisitionListView.itemsCounter",deleteItemsTitle:"RequisitionList.RequisitionListView.deleteItemsTitle",deleteItemsMessage:"RequisitionList.RequisitionListView.deleteItemsMessage",confirmAction:"RequisitionList.RequisitionListView.confirmAction",cancelAction:"RequisitionList.RequisitionListView.cancelAction"}),{alert:N,setAlert:M,handleRequisitionListAlert:u}=Ve();ie(()=>{const n=Q.on("requisitionList/data",s=>{(s==null?void 0:s.uid)===a&&(m(s),r(new Set))}),o=Q.on("requisitionList/alert",u);return()=>{n==null||n.off(),o==null||o.off()}},[u,a,m,r]),ie(()=>{K(h)},[h]);const q=T(async n=>{var s,_;const o=((s=n.items)==null?void 0:s.map(R=>R.sku))||[];if(o.length===0)return n;C(!0);try{const R=await be(o);if(R){const D=new Map;return R.forEach(L=>{D.set(L.sku,L)}),{...n,items:(_=n.items)==null?void 0:_.map(L=>({...L,product:D.get(L.sku)||L.product}))}}return console.warn("No products found"),n}catch(R){return console.warn(R instanceof Error?R.message:c.errorLoadingProducts),n}finally{C(!1)}},[c.errorLoadingProducts]);ie(()=>{if(!a){F(!1);return}if(t&&t.uid===a)return;F(!0),(async()=>{try{const o=await ne(a,1,h);if(o)if(S)m(o);else{const s=await q(o);m(s)}}catch(o){console.error("Failed to initialize requisition list from UID:",o)}finally{F(!1)}})()},[a,h,S,q,m,t]);const W=T(async n=>{n&&n.length===1?(f(!1),g(n)):(f(!0),g(null));try{const o=await ke(t.uid,n);if(o&&o.length>0){const s={action:"move",type:"error",context:"product",message:o.map(_=>_.message)};u(s),Q.emit("requisitionList/alert",s)}else{const s={action:"move",type:"success",context:"product"};u(s),Q.emit("requisitionList/alert",s)}}catch{const s={action:"move",type:"error",context:"product"};u(s),Q.emit("requisitionList/alert",s)}finally{g(null),f(!1)}},[t,u]),j=T(n=>{n&&n.length>0&&($(n),B(!0))},[]),Y=T(async()=>{V.length===1?k(V[0]):k("bulk");try{const n=await ve(t.uid,V,x,t.page_info.current_page);if(n){const o=await q(n);m(o),u({action:"delete",type:"success",context:"product"})}else u({action:"delete",type:"error",context:"product"})}catch{u({action:"delete",type:"error",context:"product"})}finally{k(null),B(!1),$([])}},[V,t,x,q,m,u]),G=T(async(n,o)=>{var s;O(n);try{const _=(s=t.items)==null?void 0:s.find(L=>L.uid===n);if(!_){u({action:"update",type:"error",context:"product"});return}const R={item_id:_.uid,entered_options:_.entered_options,selected_options:_.selected_options,quantity:o},D=await ye(t.uid,[R],x,t.page_info.current_page);if(D){const L=await q(D);m(L),u({action:"update",type:"success",context:"product"})}else u({action:"update",type:"error",context:"product"})}catch{u({action:"update",type:"error",context:"product"})}finally{O(null)}},[t,q,m,x,u]),we=T(async n=>{H(!0);try{const o=await ne(t.uid,n,x);if(o){const s=await q(o);m(s)}else console.warn(c.errorLoadPage)}catch(o){console.warn(o instanceof Error?o.message:c.errorLoadPage)}finally{H(!1)}},[t==null?void 0:t.uid,q,x,c,m]),qe=T(async n=>{K(n),H(!0);try{const o=await ne(t.uid,1,n);if(o){const s=await q(o);m(s)}else console.warn(c.errorLoadPage)}catch{console.warn(c.errorLoadPage)}finally{H(!1)}},[t==null?void 0:t.uid,q,c,m]),_e=T(async n=>{const o=await q(n);m(o)},[m,q]),Le=()=>{var L,de;const n=((L=t.page_info)==null?void 0:L.page_size)??U,o=((de=t.page_info)==null?void 0:de.current_page)??1,s=n*o,_=(t==null?void 0:t.items_count)??0,R=s-n+1,D=s>_?_:s;return i("span",{className:"requisition-list-view__pagination-items",children:c.itemsCounter.replace("{from}",R.toString()).replace("{to}",D.toString()).replace("{total}",_.toString())})};return b("div",{className:"requisition-list-view__container",children:[te?i("div",{className:"requisition-list-view__loading",children:i(Ee,{stroke:"4",size:"large"})}):!t||!Ce(t==null?void 0:t.uid)?i(Qe,{title:c.notFoundTitle,message:c.notFoundMessage,actionLabel:p?c.notFoundActionLabel:void 0,onAction:p?()=>{const n=p();n&&typeof n=="string"&&(window.location.href=n)}:void 0}):b(pe,{children:[i(He,{requisitionList:t,routeRequisitionListGrid:p,onUpdate:_e,onAlert:u}),N&&i("div",{className:"requisition-list__alert-wrapper",children:i(Ne,{heading:N.description,type:N.type,variant:"primary",onDismiss:()=>M(null)})}),t.items_count===0?i(Me,{textContent:`${t.name} ${c.emptyRequisitionList}`}):b(pe,{children:[i(Oe,{selectedItems:e,deletingItemId:E,addingToCartItemId:I,bulkAddingToCart:v,updatingQuantityItemId:z,onSelectAll:w,onSelectNone:P,onBulkAddToCart:()=>W(Array.from(e)),onBulkDelete:()=>j(Array.from(e))}),i(Ze,{items:t.items,selectedItems:e,currentPage:((ae=t.page_info)==null?void 0:ae.current_page)||1,pageSize:((re=t.page_info)==null?void 0:re.page_size)||U,handleItemSelection:l,handleUpdateQuantity:G,onAddToCart:W,onDeleteItem:j}),t.page_info&&b("div",{className:"requisition-list-view__pagination",children:[Le(),(((ce=t.page_info)==null?void 0:ce.total_pages)||0)>1&&i(xe,{totalPages:t.page_info.total_pages,currentPage:((le=t.page_info)==null?void 0:le.current_page)||1,onChange:we,disabled:J||y}),b("div",{className:"requisition-list-view__pagination-picker",children:[i("span",{children:c.show}),i(ze,{currentPageSize:((ue=t.page_info)==null?void 0:ue.page_size)||U,onPageSizeChange:qe,disabled:J||y})]})]})]})]}),X&&i(Be,{isOpen:X,isLoading:E!==null,title:c.deleteItemsTitle,modalContent:c.deleteItemsMessage,confirmBtnCaption:c.confirmAction,closeBtnCaption:c.cancelAction,handleModalOnClose:()=>{B(!1),$([])},handleModalOnConfirm:Y})]})};export{pt as RequisitionListView,pt as default};
4
4
  //# sourceMappingURL=RequisitionListView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RequisitionListView.js","sources":["/@dropins/storefront-requisition-list/src/hooks/useRequisitionListSelectedItems.ts","../../node_modules/@adobe-commerce/elsie/src/icons/Cart.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Minus.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Search.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Trash.svg","/@dropins/storefront-requisition-list/src/components/NotFound/NotFound.tsx","/@dropins/storefront-requisition-list/src/components/ProductListTable/ProductListTable.tsx","/@dropins/storefront-requisition-list/src/components/BatchActions/BatchActions.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListView/RequisitionListView.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { Item } from '@/requisitionList/data/models/item';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\ntype UseRequisitionListSelectedItems = {\n currentRequisitionList: RequisitionList | null;\n setCurrentRequisitionList: (\n value:\n | RequisitionList\n | null\n | ((prev: RequisitionList | null) => RequisitionList | null)\n ) => void;\n selectedItems: Set<string>;\n setSelectedItems: (\n value: Set<string> | ((prev: Set<string>) => Set<string>)\n ) => void;\n handleItemSelection: (itemUid: string, isSelected: boolean) => void;\n handleSelectAll: () => void;\n handleSelectNone: () => void;\n};\n\nexport function useRequisitionListSelectedItems(): UseRequisitionListSelectedItems {\n const [currentRequisitionList, setCurrentRequisitionList] =\n useState<RequisitionList | null>(null);\n const [selectedItems, setSelectedItems] = useState<Set<string>>(new Set());\n\n const handleItemSelection = useCallback(\n (itemUid: string, isSelected: boolean) => {\n setSelectedItems((prev: Set<string>) => {\n const newSet = new Set(prev);\n if (isSelected) {\n newSet.add(itemUid);\n } else {\n newSet.delete(itemUid);\n }\n return newSet;\n });\n },\n []\n );\n\n const handleSelectAll = useCallback(() => {\n const allItemUids = currentRequisitionList?.items?.map(\n (item: Item) => item.uid\n );\n setSelectedItems(new Set(allItemUids));\n }, [currentRequisitionList]);\n\n const handleSelectNone = useCallback(() => {\n setSelectedItems(new Set());\n }, []);\n\n return {\n currentRequisitionList,\n setCurrentRequisitionList,\n selectedItems,\n setSelectedItems,\n handleItemSelection,\n handleSelectAll,\n handleSelectNone,\n };\n}\n","import * as React from \"react\";\nconst SvgCart = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_102_196)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z\", stroke: \"currentColor\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M5.25 6.37L20.89 8.06L20.14 14.8H6.19\", stroke: \"currentColor\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_102_196\" }, /* @__PURE__ */ React.createElement(\"rect\", { vectorEffect: \"non-scaling-stroke\", width: 19.29, height: 19.5, fill: \"white\", transform: \"translate(2.3501 2.25)\" }))));\nexport default SvgCart;\n","import * as React from \"react\";\nconst SvgMinus = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M17.3332 11.75H6.6665\", strokeWidth: 1, strokeLinecap: \"square\", strokeLinejoin: \"round\", vectorEffect: \"non-scaling-stroke\", fill: \"none\", stroke: \"currentColor\" }));\nexport default SvgMinus;\n","import * as React from \"react\";\nconst SvgSearch = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Search_Base\", \"data-name\": \"Icon \\\\u2013 Search \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, fill: \"none\", viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Search_icon\", \"data-name\": \"Search icon\", transform: \"translate(3.75 3.75)\" }, /* @__PURE__ */ React.createElement(\"circle\", { vectorEffect: \"non-scaling-stroke\", id: \"Ellipse_186\", \"data-name\": \"Ellipse 186\", cx: 6, cy: 6, r: 6, fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_556\", \"data-name\": \"Line 556\", x2: 6, y2: 6, transform: \"translate(10.5 10.5)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgSearch;\n","import * as React from \"react\";\nconst SvgTrash = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M1 5H23\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M8.87402 8.58057L9.39348 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M14.6673 8.58057L14.146 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }));\nexport default SvgTrash;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Icon, Button } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Search } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/NotFound/NotFound.css';\n\nexport interface NotFoundProps {\n className?: string;\n title?: string;\n message?: string;\n actionLabel?: string;\n onAction?: () => void;\n}\n\nexport const NotFound: FunctionComponent<NotFoundProps> = ({\n className,\n title = '404 - Not Found',\n message = 'The requisition list you are looking for does not exist.',\n actionLabel,\n onAction,\n ...props\n}) => {\n return (\n <div\n className={classes(['not-found', className])}\n data-testid=\"not-found\"\n {...props}\n >\n <Icon source={Search} size={'64'} stroke={'2'} />\n <h2>{title}</h2>\n {message && <p>{message}</p>}\n {actionLabel && onAction && (\n <Button variant=\"primary\" onClick={onAction}>\n {actionLabel}\n </Button>\n )}\n </div>\n );\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, h } from 'preact';\nimport { HTMLAttributes, ChangeEvent } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport {\n Icon,\n Table,\n Checkbox,\n Price,\n Button,\n Field,\n Input,\n Image,\n} from '@adobe-commerce/elsie/components';\nimport { Trash, Cart } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/ProductListTable/ProductListTable.css';\nimport { RequisitionListModel } from '@/requisitionList/data/models/requisitionList';\nimport { Item, BundleOption } from '@/requisitionList/data/models/item';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ProductListTableProps\n extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n className?: string;\n items: RequisitionListModel['items'];\n selectedItems: Set<string>;\n currentPage: number;\n pageSize: number;\n canEdit?: boolean;\n handleItemSelection: (itemUid: string, isSelected: boolean) => void;\n handleUpdateQuantity: (itemUid: string, newQuantity: number) => void;\n onAddToCart: (itemUids: string[] | undefined) => void;\n onDeleteItem: (itemUids: string[] | undefined) => void;\n}\n\nexport const ProductListTable: FunctionComponent<ProductListTableProps> = ({\n className,\n items,\n selectedItems,\n currentPage,\n pageSize,\n canEdit = true,\n handleItemSelection,\n handleUpdateQuantity,\n onAddToCart,\n onDeleteItem,\n ...props\n}) => {\n const translations = useText({\n productNameHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.productName',\n skuHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.sku',\n priceHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.price',\n quantityHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.quantity',\n subtotalHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.subtotal',\n actionsHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.actions',\n actionAddToCart: 'RequisitionList.RequisitionListView.actionAddToCart',\n actionDelete: 'RequisitionList.RequisitionListView.actionDelete',\n itemQuantity:\n 'RequisitionList.RequisitionListView.productListTable.itemQuantity',\n });\n const columns = [\n {\n label: '#',\n key: 'index',\n },\n {\n label: 'item',\n key: 'item',\n },\n {\n label: translations.priceHeader,\n key: 'price',\n },\n {\n label: translations.quantityHeader,\n key: 'quantity',\n },\n {\n label: translations.subtotalHeader,\n key: 'subtotal',\n },\n ];\n\n if (canEdit) {\n columns.unshift({\n label: '',\n key: 'selector',\n });\n columns.push({\n label: translations.actionsHeader,\n key: 'actions',\n });\n }\n\n const handleItemCheckboxChange = (\n event: ChangeEvent<HTMLInputElement>,\n item: Item\n ) => {\n const isSelected = (event.target as HTMLInputElement).checked;\n handleItemSelection(item.uid, isSelected);\n };\n\n const getRowIndex = (index: number): number => {\n return (currentPage - 1) * pageSize + index + 1;\n };\n\n const getImageAlt = (item: Item): string => {\n return item.configured_product?.name || item.product?.name || item.sku;\n };\n\n const getImageSrc = (item: Item): string => {\n return item.configured_product?.images\n ? item.configured_product.images[0]?.url\n : item.product?.images\n ? item.product.images[0]?.url\n : '';\n };\n\n const getProductName = (item: Item): string | undefined => {\n return item.product?.name || item.sku;\n };\n\n const getConfiguredProductName = (item: Item): string | undefined => {\n return item.configured_product?.name;\n };\n\n const getBundleProducts = (\n item: Item\n ): h.JSX<HTMLSpanElement>[] | undefined => {\n if (!item.bundle_options) {\n return;\n }\n\n const bundleProducts = item.bundle_options.map(\n (option: BundleOption, index: number): h.JSX<HTMLSpanElement> => {\n return (\n <span\n key={option.values[0].label || index}\n className=\"requisition-list-view-product-list-table__product-configurable-name\"\n >\n {option.values[0]!.label} x {option.values[0]!.quantity}\n </span>\n );\n }\n );\n return bundleProducts;\n };\n\n const getSku = (item: Item): string | undefined => {\n return item.configured_product?.sku || item.sku;\n };\n\n const getPriceAmount = (item: Item): number => {\n if (Array.isArray(item.bundle_options) && item.bundle_options.length > 0) {\n return item.bundle_options.reduce(\n (previousValue: number, option: BundleOption): number => {\n return (\n previousValue +\n (option.values[0]?.priceV2?.value || 0) *\n (option.values[0]?.quantity || 0)\n );\n },\n 0\n );\n }\n return (\n item.configured_product?.price?.final?.amount?.value ||\n item.product?.price?.final?.amount?.value ||\n 0\n );\n };\n\n const getPriceCurrency = (item: Item): string | undefined => {\n return (\n item.configured_product?.price?.final?.amount?.currency ||\n item.product?.price?.final?.amount?.currency\n );\n };\n\n const getSubtotal = (item: Item): number => {\n return getPriceAmount(item) * item.quantity;\n };\n\n const rowData = items.map((item: Item, index: number) => {\n return {\n selector: (\n <Checkbox\n className=\"requisition-list-view-product-list-table__checkbox\"\n name=\"itemSelected\"\n data-testid={`item-checkbox-${item.sku}`}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n handleItemCheckboxChange(e, item)\n }\n value={item.sku}\n checked={selectedItems.has(item.uid)}\n />\n ),\n index: (\n <div className=\"requisition-list-view-product-list-table__index-container\">\n {getRowIndex(index)}\n </div>\n ),\n item: (\n <div className=\"requisition-list-view-product-list-table__item-container\">\n <Image\n className=\"requisition-list-view-product-list-table__thumbnail\"\n alt={getImageAlt(item)}\n src={getImageSrc(item)}\n />\n <div className=\"requisition-list-view-product-list-table__item-details\">\n <div className=\"requisition-list-view-product-list-table__product-name\">\n {getProductName(item)}\n </div>\n <span className=\"requisition-list-view-product-list-table__product-configurable-name\">\n {getConfiguredProductName(item)}\n </span>\n <div className=\"requisition-list-view-product-list-table__sku\">\n {getSku(item)}\n </div>\n {getBundleProducts(item)}\n </div>\n </div>\n ),\n price: (\n <Price\n className=\"requisition-list-view-product-list-table__price\"\n amount={getPriceAmount(item)}\n currency={getPriceCurrency(item)}\n />\n ),\n quantity: (\n <span className=\"requisition-list-view-product-list-table__quantity\">\n <Field disabled={false}>\n <Input\n id={`requisition-list-item-quantity-${item.sku}`}\n data-testid={`requisition-list-item-quantity-${item.sku}`}\n name=\"quantity\"\n type=\"text\"\n value={item.quantity}\n onBlur={(e: FocusEvent) => {\n const newValue = Number.parseInt(\n (e.target as HTMLInputElement).value,\n 10\n );\n handleUpdateQuantity(item.uid, newValue);\n }}\n />\n </Field>\n </span>\n ),\n subtotal: (\n <Price\n className=\"requisition-list-view-product-list-table__price\"\n amount={getSubtotal(item)}\n currency={getPriceCurrency(item)}\n />\n ),\n actions: (\n <div className=\"requisition-list-view__bulk-actions\">\n <Button\n type=\"button\"\n onClick={() => onAddToCart([item.uid])}\n icon={<Icon source={Cart} />}\n data-testid=\"product-list-table-add-to-cart-button\"\n />\n <Button\n type=\"button\"\n variant=\"secondary\"\n icon={<Icon source={Trash} />}\n onClick={() => onDeleteItem([item.uid])}\n data-testid=\"product-list-table-delete-button\"\n />\n </div>\n ),\n };\n });\n\n const table = (\n <Table\n columns={columns}\n rowData={rowData}\n data-testid=\"product-list-table\"\n mobileLayout=\"stacked\"\n />\n );\n\n return (\n <VComponent\n node={h('div', {})}\n className={classes([\n 'requisition-list-view-product-list-table-container',\n className,\n ])}\n data-testid=\"product-list-table-container\"\n {...props}\n >\n {table}\n </VComponent>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Button, Icon } from '@adobe-commerce/elsie/components';\nimport { Trash, Minus } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/BatchActions/BatchActions.css';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface BatchActionsProps\n extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n selectedItems: Set<string>;\n deletingItemId: string | null;\n addingToCartItemId: string | null;\n bulkAddingToCart: boolean;\n updatingQuantityItemId: string | null;\n onSelectAll: () => void;\n onSelectNone: () => void;\n onBulkAddToCart: () => void;\n onBulkDelete: () => void;\n}\n\nexport const BatchActions: FunctionComponent<BatchActionsProps> = ({\n selectedItems,\n deletingItemId,\n addingToCartItemId,\n bulkAddingToCart,\n updatingQuantityItemId,\n onSelectAll,\n onSelectNone,\n onBulkAddToCart,\n onBulkDelete,\n}) => {\n const translations = useText({\n statusDeleting: `RequisitionList.RequisitionListView.statusDeleting`,\n actionSelectAll: `RequisitionList.RequisitionListView.actionSelectAll`,\n actionSelectNone: `RequisitionList.RequisitionListView.actionSelectNone`,\n actionAddToCart: `RequisitionList.RequisitionListView.actionAddToCart`,\n actionDeleteSelectedItems: `RequisitionList.RequisitionListView.actionDeleteSelectedItems`,\n statusBulkAddingToCart: `RequisitionList.RequisitionListView.statusBulkAddingToCart`,\n });\n\n const isDisabled =\n deletingItemId !== null ||\n addingToCartItemId !== null ||\n bulkAddingToCart ||\n updatingQuantityItemId !== null;\n\n const hasSelectedItems = selectedItems.size > 0;\n\n return (\n <div className=\"requisition-list-view__batch-actions\">\n <div className=\"requisition-list-view__batch-actions-left\">\n <button\n data-testid=\"bulk-actions-select-toggle-btn\"\n type=\"button\"\n className={`requisition-list-view__batch-actions-select-toggle ${hasSelectedItems ? 'requisition-list-view__batch-actions-select-toggle--active' : ''}`}\n onClick={hasSelectedItems ? onSelectNone : onSelectAll}\n disabled={isDisabled}\n aria-label={hasSelectedItems ? translations.actionSelectNone : translations.actionSelectAll}\n >\n <Icon source={Minus} />\n </button>\n <button\n type=\"button\"\n className=\"requisition-list-view__batch-actions-select-label\"\n onClick={hasSelectedItems ? onSelectNone : onSelectAll}\n disabled={isDisabled}\n >\n {translations.actionSelectAll}\n </button>\n </div>\n\n {hasSelectedItems && (\n <div className=\"requisition-list-view__batch-actions-buttons\">\n <span\n className=\"requisition-list-view__batch-actions-count-badge\"\n aria-label={`${selectedItems.size} items selected`}\n >\n {selectedItems.size}\n </span>\n <Button\n data-testid=\"bulk-actions-add-to-cart-btn\"\n type=\"button\"\n variant=\"secondary\"\n onClick={onBulkAddToCart}\n disabled={isDisabled}\n >\n {bulkAddingToCart\n ? translations.statusBulkAddingToCart\n : translations.actionAddToCart}\n </Button>\n <button\n data-testid=\"bulk-actions-delete-btn\"\n type=\"button\"\n className=\"requisition-list-view__batch-actions-delete-icon\"\n onClick={onBulkDelete}\n disabled={isDisabled}\n aria-label={translations.actionDeleteSelectedItems}\n >\n <Icon source={Trash} />\n </button>\n </div>\n )}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport {\n HTMLAttributes,\n useState,\n useCallback,\n useEffect,\n} from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { addRequisitionListItemsToCart } from '@/requisitionList/api/addRequisitionListItemsToCart';\nimport { deleteRequisitionListItems } from '@/requisitionList/api/deleteRequisitionListItems';\nimport { getProductData } from '@/requisitionList/api/getProductData';\nimport { updateRequisitionListItems } from '@/requisitionList/api/updateRequisitionListItems';\nimport { getRequisitionList } from '@/requisitionList/api/getRequisitionList';\nimport {\n Pagination,\n InLineAlert,\n ProgressSpinner,\n} from '@adobe-commerce/elsie/components';\nimport { Item, Product } from '@/requisitionList/data/models/item';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n PageSizePicker,\n EmptyList,\n NotFound,\n RequisitionListModal,\n} from '@/requisitionList/components';\nimport { ProductListTable } from '@/requisitionList/components/ProductListTable/ProductListTable';\nimport { BatchActions } from '@/requisitionList/components/BatchActions/BatchActions';\nimport { RequisitionListHeader } from '@/requisitionList/containers/RequisitionListHeader';\nimport { useRequisitionListSelectedItems } from '@/requisitionList/hooks/useRequisitionListSelectedItems';\nimport { useRequisitionListAlert } from '@/requisitionList/hooks/useRequisitionListAlert';\nimport { isValidBase64Uid } from '@/requisitionList/lib/validate-uid';\nimport { DEFAULT_PAGE_SIZE } from '@/requisitionList/lib/constants';\nimport '@/requisitionList/containers/RequisitionListView/RequisitionListView.css';\n\nexport interface RequisitionListViewProps\n extends HTMLAttributes<HTMLDivElement> {\n /**\n * The UID of the requisition list to display.\n * The UID must be a base64-encoded string.\n * If an invalid UID is provided, the component will render the NotFound state.\n * The component will fetch the requisition list data internally.\n */\n requisitionListUid: string;\n /**\n * When true, skips automatic product data fetching on component mount.\n * Used in tests to prevent API calls.\n */\n skipProductLoading?: boolean;\n /**\n * Number of items per page for pagination.\n * Defaults to DEFAULT_PAGE_SIZE.\n */\n pageSize?: number;\n selectedItems: Set<string>;\n /**\n * Function that returns the URL to the requisition list grid view or performs navigation\n */\n routeRequisitionListGrid?: () => string | void;\n}\n\nexport const RequisitionListView: Container<RequisitionListViewProps> = ({\n requisitionListUid,\n skipProductLoading = false,\n pageSize = DEFAULT_PAGE_SIZE,\n routeRequisitionListGrid,\n}: RequisitionListViewProps) => {\n const [loadingProducts, setLoadingProducts] = useState<boolean>(false);\n const [deletingItemId, setDeletingItemId] = useState<string | null>(null);\n const [addingToCartItemId, setAddingToCartItemId] = useState<\n string[] | undefined\n >(null);\n const [bulkAddingToCart, setBulkAddingToCart] = useState<boolean>(false);\n const [updatingQuantityItemId, setUpdatingQuantityItemId] = useState<\n string | null\n >(null);\n const [loadingPage, setLoadingPage] = useState<boolean>(false);\n const [currentPageSize, setCurrentPageSize] = useState<number>(pageSize);\n const [initializing, setInitializing] = useState<boolean>(true);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [itemsToDelete, setItemsToDelete] = useState<string[]>([]);\n\n const {\n currentRequisitionList,\n setCurrentRequisitionList,\n selectedItems,\n setSelectedItems,\n handleItemSelection,\n handleSelectAll,\n handleSelectNone,\n } = useRequisitionListSelectedItems();\n\n const translations = useText({\n emptyRequisitionList: `RequisitionList.RequisitionListView.emptyRequisitionList`,\n errorLoadingProducts: `RequisitionList.RequisitionListView.errorLoadingProducts`,\n errorLoadPage: `RequisitionList.RequisitionListView.errorLoadPage`,\n notFoundTitle: `RequisitionList.RequisitionListView.notFoundTitle`,\n notFoundMessage: `RequisitionList.RequisitionListView.notFoundMessage`,\n notFoundActionLabel: `RequisitionList.RequisitionListView.notFoundActionLabel`,\n show: `RequisitionList.RequisitionListView.show`,\n itemsCounter: `RequisitionList.RequisitionListView.itemsCounter`,\n deleteItemsTitle: `RequisitionList.RequisitionListView.deleteItemsTitle`,\n deleteItemsMessage: `RequisitionList.RequisitionListView.deleteItemsMessage`,\n confirmAction: `RequisitionList.RequisitionListView.confirmAction`,\n cancelAction: `RequisitionList.RequisitionListView.cancelAction`,\n });\n\n const { alert, setAlert, handleRequisitionListAlert } =\n useRequisitionListAlert();\n\n useEffect(() => {\n const requisitionListEvent = events.on(\n 'requisitionList/data',\n (payload: RequisitionList) => {\n // Only update from events if it matches our current UID\n if (payload?.uid === requisitionListUid) {\n setCurrentRequisitionList(payload);\n setSelectedItems(new Set());\n }\n }\n );\n // Keep event listener for cross-component alert communication\n const alertEvent = events.on(\n 'requisitionList/alert',\n handleRequisitionListAlert\n );\n return () => {\n requisitionListEvent?.off();\n alertEvent?.off();\n };\n }, [\n handleRequisitionListAlert,\n requisitionListUid,\n setCurrentRequisitionList,\n setSelectedItems,\n ]);\n\n // Sync pageSize prop changes to local state\n useEffect(() => {\n setCurrentPageSize(pageSize);\n }, [pageSize]);\n\n // Function to fetch and merge product data\n const fetchAndMergeProducts = useCallback(\n async (baseRequisitionList: RequisitionList) => {\n // Extract SKUs from requisition list items\n const productSkus =\n baseRequisitionList.items?.map((item: Item) => item.sku) || [];\n\n if (productSkus.length === 0) {\n return baseRequisitionList;\n }\n\n setLoadingProducts(true);\n\n try {\n const fetchedProducts = await getProductData(productSkus);\n if (fetchedProducts) {\n // Create a map of SKU to Product for easy lookup\n const productMap = new Map<string, Product>();\n fetchedProducts.forEach((product: Product) => {\n productMap.set(product.sku, product);\n });\n\n // Update requisition list items with fetched product data\n return {\n ...baseRequisitionList,\n items: baseRequisitionList.items?.map((item: Item) => ({\n ...item,\n product: productMap.get(item.sku) || item.product, // Use fetched product or keep existing\n })),\n };\n }\n console.warn('No products found');\n return baseRequisitionList;\n } catch (error) {\n console.warn(\n error instanceof Error\n ? error.message\n : translations.errorLoadingProducts\n );\n return baseRequisitionList;\n } finally {\n setLoadingProducts(false);\n }\n },\n [translations.errorLoadingProducts]\n );\n\n // Initialize requisition list from UID\n // Only triggers initial load when UID changes. Page size changes trigger pagination, not re-initialization.\n useEffect(() => {\n if (!requisitionListUid) {\n setInitializing(false);\n return;\n }\n\n // Only initialize if we don't have a list or if the UID changed\n if (\n currentRequisitionList &&\n currentRequisitionList.uid === requisitionListUid\n ) {\n // Same list already loaded, don't re-initialize\n return;\n }\n\n setInitializing(true);\n\n const initializeFromUid = async () => {\n try {\n const fetchedList = await getRequisitionList(\n requisitionListUid,\n 1,\n pageSize\n );\n\n if (fetchedList) {\n // Fetch and merge product data\n if (!skipProductLoading) {\n const enrichedList = await fetchAndMergeProducts(fetchedList);\n setCurrentRequisitionList(enrichedList);\n } else {\n setCurrentRequisitionList(fetchedList);\n }\n }\n } catch (error) {\n console.error('Failed to initialize requisition list from UID:', error);\n } finally {\n setInitializing(false);\n }\n };\n\n initializeFromUid();\n }, [\n requisitionListUid,\n pageSize,\n skipProductLoading,\n fetchAndMergeProducts,\n setCurrentRequisitionList,\n currentRequisitionList,\n ]);\n\n const handleAddItemsToCart = useCallback(\n async (itemUids: string[] | undefined) => {\n if (itemUids && itemUids.length === 1) {\n setBulkAddingToCart(false);\n setAddingToCartItemId(itemUids);\n } else {\n setBulkAddingToCart(true);\n setAddingToCartItemId(null);\n }\n\n try {\n const errors = await addRequisitionListItemsToCart(\n currentRequisitionList.uid,\n itemUids\n );\n\n if (errors && errors.length > 0) {\n handleRequisitionListAlert({\n action: 'move',\n type: 'error',\n context: 'product',\n message: errors.map((e: any) => e.message),\n });\n } else {\n handleRequisitionListAlert({\n action: 'move',\n type: 'success',\n context: 'product',\n });\n }\n } catch (error) {\n handleRequisitionListAlert({\n action: 'move',\n type: 'error',\n context: 'product',\n });\n } finally {\n setAddingToCartItemId(null);\n setBulkAddingToCart(false);\n }\n },\n [currentRequisitionList, handleRequisitionListAlert]\n );\n\n const handleDeleteItems = useCallback((itemUids: string[] | undefined) => {\n if (itemUids && itemUids.length > 0) {\n setItemsToDelete(itemUids);\n setShowDeleteModal(true);\n }\n }, []);\n\n const handleConfirmDelete = useCallback(async () => {\n if (itemsToDelete.length === 1) {\n setDeletingItemId(itemsToDelete[0]);\n } else {\n setDeletingItemId('bulk');\n }\n\n try {\n const updatedRequisitionList = await deleteRequisitionListItems(\n currentRequisitionList.uid,\n itemsToDelete,\n currentPageSize,\n currentRequisitionList.page_info.current_page\n );\n\n if (updatedRequisitionList) {\n // Fetch and merge product data to ensure prices are loaded\n const enrichedRequisitionList = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(enrichedRequisitionList);\n handleRequisitionListAlert({\n action: 'delete',\n type: 'success',\n context: 'product',\n });\n } else {\n handleRequisitionListAlert({\n action: 'delete',\n type: 'error',\n context: 'product',\n });\n }\n } catch (error) {\n handleRequisitionListAlert({\n action: 'delete',\n type: 'error',\n context: 'product',\n });\n } finally {\n setDeletingItemId(null);\n setShowDeleteModal(false);\n setItemsToDelete([]);\n }\n }, [\n itemsToDelete,\n currentRequisitionList,\n currentPageSize,\n fetchAndMergeProducts,\n setCurrentRequisitionList,\n handleRequisitionListAlert,\n ]);\n\n const handleUpdateQuantity = useCallback(\n async (itemUid: string, newQuantity: number) => {\n setUpdatingQuantityItemId(itemUid);\n\n try {\n // Find the current item to update\n const currentItem = currentRequisitionList.items?.find(\n (item: Item) => item.uid === itemUid\n );\n if (!currentItem) {\n handleRequisitionListAlert({\n action: 'update',\n type: 'error',\n context: 'product',\n });\n return;\n }\n\n // Create updated item with new quantity\n const updatedItem = {\n item_id: currentItem.uid,\n entered_options: currentItem.entered_options,\n selected_options: currentItem.selected_options,\n quantity: newQuantity,\n };\n\n const updatedRequisitionList = await updateRequisitionListItems(\n currentRequisitionList.uid,\n [updatedItem],\n currentPageSize,\n currentRequisitionList.page_info.current_page\n );\n\n if (updatedRequisitionList) {\n // Reload product data with updated quantities\n const enrichedRequisitionList = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(enrichedRequisitionList);\n handleRequisitionListAlert({\n action: 'update',\n type: 'success',\n context: 'product',\n });\n } else {\n handleRequisitionListAlert({\n action: 'update',\n type: 'error',\n context: 'product',\n });\n }\n } catch (error) {\n handleRequisitionListAlert({\n action: 'update',\n type: 'error',\n context: 'product',\n });\n } finally {\n setUpdatingQuantityItemId(null);\n }\n },\n [\n currentRequisitionList,\n fetchAndMergeProducts,\n setCurrentRequisitionList,\n currentPageSize,\n handleRequisitionListAlert,\n ]\n );\n\n const handlePageChange = useCallback(\n async (page: number) => {\n setLoadingPage(true);\n\n try {\n const updatedRequisitionList = await getRequisitionList(\n currentRequisitionList.uid,\n page,\n currentPageSize\n );\n\n if (updatedRequisitionList) {\n // Fetch product data for the new page\n const updatedListWithProducts = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(updatedListWithProducts);\n } else {\n console.warn(translations.errorLoadPage);\n }\n } catch (error) {\n console.warn(\n error instanceof Error ? error.message : translations.errorLoadPage\n );\n } finally {\n setLoadingPage(false);\n }\n },\n [\n currentRequisitionList?.uid,\n fetchAndMergeProducts,\n currentPageSize,\n translations,\n setCurrentRequisitionList,\n ]\n );\n\n const handlePageSizeChange = useCallback(\n async (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setLoadingPage(true);\n\n try {\n // Reset to page 1 when changing page size\n const updatedRequisitionList = await getRequisitionList(\n currentRequisitionList.uid,\n 1,\n newPageSize\n );\n\n if (updatedRequisitionList) {\n // Fetch product data for the new page\n const updatedListWithProducts = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(updatedListWithProducts);\n } else {\n console.warn(translations.errorLoadPage);\n }\n } catch (error) {\n console.warn(translations.errorLoadPage);\n } finally {\n setLoadingPage(false);\n }\n },\n [\n currentRequisitionList?.uid,\n fetchAndMergeProducts,\n translations,\n setCurrentRequisitionList,\n ]\n );\n\n const handleUpdate = useCallback(\n async (updatedList: RequisitionList) => {\n // With the updated API, the response includes items and page_info\n // but we need to fetch and merge full product data (prices, images, etc.)\n const enrichedList = await fetchAndMergeProducts(updatedList);\n setCurrentRequisitionList(enrichedList);\n },\n [setCurrentRequisitionList, fetchAndMergeProducts]\n );\n\n const itemsCounter = () => {\n const pageSize =\n currentRequisitionList.page_info?.page_size ?? DEFAULT_PAGE_SIZE;\n const currentPage = currentRequisitionList.page_info?.current_page ?? 1;\n const currentPageSize = pageSize * currentPage;\n const total = currentRequisitionList?.items_count ?? 0;\n const from = currentPageSize - pageSize + 1;\n const to = currentPageSize > total ? total : currentPageSize;\n\n return (\n <span className=\"requisition-list-view__pagination-items\">\n {translations.itemsCounter\n .replace('{from}', from.toString())\n .replace('{to}', to.toString())\n .replace('{total}', total.toString())}\n </span>\n );\n };\n\n return (\n <div className=\"requisition-list-view__container\">\n {initializing ? (\n <div className=\"requisition-list-view__loading\">\n <ProgressSpinner stroke={'4'} size={'large'} />\n </div>\n ) : !currentRequisitionList ||\n !isValidBase64Uid(currentRequisitionList?.uid) ? (\n <NotFound\n title={translations.notFoundTitle}\n message={translations.notFoundMessage}\n actionLabel={\n routeRequisitionListGrid\n ? translations.notFoundActionLabel\n : undefined\n }\n onAction={\n routeRequisitionListGrid\n ? () => {\n const url = routeRequisitionListGrid();\n if (url && typeof url === 'string') {\n window.location.href = url;\n }\n }\n : undefined\n }\n />\n ) : (\n <>\n <RequisitionListHeader\n requisitionList={currentRequisitionList}\n routeRequisitionListGrid={routeRequisitionListGrid}\n onUpdate={handleUpdate}\n onAlert={handleRequisitionListAlert}\n />\n\n {alert && (\n <div className=\"requisition-list__alert-wrapper\">\n <InLineAlert\n heading={alert.description}\n type={alert.type}\n variant=\"primary\"\n onDismiss={() => setAlert(null)}\n />\n </div>\n )}\n\n {currentRequisitionList.items_count === 0 ? (\n <EmptyList\n textContent={`${currentRequisitionList.name} ${translations.emptyRequisitionList}`}\n />\n ) : (\n <>\n <BatchActions\n selectedItems={selectedItems}\n deletingItemId={deletingItemId}\n addingToCartItemId={addingToCartItemId}\n bulkAddingToCart={bulkAddingToCart}\n updatingQuantityItemId={updatingQuantityItemId}\n onSelectAll={handleSelectAll}\n onSelectNone={handleSelectNone}\n onBulkAddToCart={() =>\n handleAddItemsToCart(Array.from(selectedItems))\n }\n onBulkDelete={() =>\n handleDeleteItems(Array.from(selectedItems))\n }\n />\n\n <ProductListTable\n items={currentRequisitionList.items}\n selectedItems={selectedItems}\n currentPage={\n currentRequisitionList.page_info?.current_page || 1\n }\n pageSize={\n currentRequisitionList.page_info?.page_size ||\n DEFAULT_PAGE_SIZE\n }\n handleItemSelection={handleItemSelection}\n handleUpdateQuantity={handleUpdateQuantity}\n onAddToCart={handleAddItemsToCart}\n onDeleteItem={handleDeleteItems}\n />\n\n {/* Pagination */}\n {currentRequisitionList.page_info && (\n <div className=\"requisition-list-view__pagination\">\n {itemsCounter()}\n {(currentRequisitionList.page_info?.total_pages || 0) > 1 && (\n <Pagination\n totalPages={currentRequisitionList.page_info.total_pages}\n currentPage={\n currentRequisitionList.page_info?.current_page || 1\n }\n onChange={handlePageChange}\n disabled={loadingPage || loadingProducts}\n />\n )}\n <div className=\"requisition-list-view__pagination-picker\">\n <span>{translations.show}</span>\n <PageSizePicker\n currentPageSize={\n currentRequisitionList.page_info?.page_size ||\n DEFAULT_PAGE_SIZE\n }\n onPageSizeChange={handlePageSizeChange}\n disabled={loadingPage || loadingProducts}\n />\n </div>\n </div>\n )}\n </>\n )}\n </>\n )}\n\n {/* Delete Confirmation Modal */}\n {showDeleteModal && (\n <RequisitionListModal\n isOpen={showDeleteModal}\n isLoading={deletingItemId !== null}\n title={translations.deleteItemsTitle}\n modalContent={translations.deleteItemsMessage}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={() => {\n setShowDeleteModal(false);\n setItemsToDelete([]);\n }}\n handleModalOnConfirm={handleConfirmDelete}\n />\n )}\n </div>\n );\n};\n"],"names":["useRequisitionListSelectedItems","currentRequisitionList","setCurrentRequisitionList","useState","selectedItems","setSelectedItems","handleItemSelection","useCallback","itemUid","isSelected","prev","newSet","handleSelectAll","allItemUids","_a","item","handleSelectNone","SvgCart","props","React","SvgMinus","SvgSearch","SvgTrash","NotFound","className","title","message","actionLabel","onAction","jsxs","classes","jsx","Icon","Search","Button","ProductListTable","items","currentPage","pageSize","canEdit","handleUpdateQuantity","onAddToCart","onDeleteItem","translations","useText","columns","handleItemCheckboxChange","event","getRowIndex","index","getImageAlt","_b","getImageSrc","_c","_d","getProductName","getConfiguredProductName","getBundleProducts","option","getSku","getPriceAmount","previousValue","_h","_g","_f","_e","getPriceCurrency","getSubtotal","rowData","Checkbox","e","Image","Price","Field","Input","newValue","Cart","Trash","table","Table","VComponent","h","BatchActions","deletingItemId","addingToCartItemId","bulkAddingToCart","updatingQuantityItemId","onSelectAll","onSelectNone","onBulkAddToCart","onBulkDelete","isDisabled","hasSelectedItems","Minus","RequisitionListView","requisitionListUid","skipProductLoading","DEFAULT_PAGE_SIZE","routeRequisitionListGrid","loadingProducts","setLoadingProducts","setDeletingItemId","setAddingToCartItemId","setBulkAddingToCart","setUpdatingQuantityItemId","loadingPage","setLoadingPage","currentPageSize","setCurrentPageSize","initializing","setInitializing","showDeleteModal","setShowDeleteModal","itemsToDelete","setItemsToDelete","alert","setAlert","handleRequisitionListAlert","useRequisitionListAlert","useEffect","requisitionListEvent","events","payload","alertEvent","fetchAndMergeProducts","baseRequisitionList","productSkus","fetchedProducts","getProductData","productMap","product","error","fetchedList","getRequisitionList","enrichedList","handleAddItemsToCart","itemUids","errors","addRequisitionListItemsToCart","handleDeleteItems","handleConfirmDelete","updatedRequisitionList","deleteRequisitionListItems","enrichedRequisitionList","newQuantity","currentItem","updatedItem","updateRequisitionListItems","handlePageChange","page","updatedListWithProducts","handlePageSizeChange","newPageSize","handleUpdate","updatedList","itemsCounter","total","from","to","ProgressSpinner","isValidBase64Uid","url","Fragment","RequisitionListHeader","InLineAlert","EmptyList","Pagination","PageSizePicker","RequisitionListModal"],"mappings":"+tCAsCO,SAASA,IAAmE,CACjF,KAAM,CAACC,EAAwBC,CAAyB,EACtDC,GAAiC,IAAI,EACjC,CAACC,EAAeC,CAAgB,EAAIF,GAAsB,IAAI,GAAK,EAEnEG,EAAsBC,GAC1B,CAACC,EAAiBC,IAAwB,CACxCJ,EAAkBK,GAAsB,CACtC,MAAMC,EAAS,IAAI,IAAID,CAAI,EAC3B,OAAID,EACFE,EAAO,IAAIH,CAAO,EAElBG,EAAO,OAAOH,CAAO,EAEhBG,CACT,CAAC,CACH,EACA,CAAA,CAAC,EAGGC,EAAkBL,GAAY,IAAM,OACxC,MAAMM,GAAcC,EAAAb,GAAA,YAAAA,EAAwB,QAAxB,YAAAa,EAA+B,IAChDC,GAAeA,EAAK,KAEvBV,EAAiB,IAAI,IAAIQ,CAAW,CAAC,CACvC,EAAG,CAACZ,CAAsB,CAAC,EAErBe,EAAmBT,GAAY,IAAM,CACzCF,EAAiB,IAAI,GAAK,CAC5B,EAAG,CAAA,CAAE,EAEL,MAAO,CACL,uBAAAJ,EACA,0BAAAC,EACA,cAAAE,EACA,iBAAAC,EACA,oBAAAC,EACA,gBAAAM,EACA,iBAAAI,CAAA,CAEJ,CC7EA,MAAMC,GAAWC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,IAAK,CAAE,SAAU,qBAAqB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,oZAAqZ,OAAQ,eAAgB,eAAgB,OAAO,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,wCAAyC,OAAQ,eAAgB,e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AAvB,YAAAkD,GAAkC,YAClC8C,EAEF,oBAAA3F,EACA,qBAAAkC,EACA,YAAa+F,EACb,aAAcI,CAAA,CAAA,EAIf1I,EAAuB,WACtB4B,EAAC,MAAA,CAAI,UAAU,oCACZ,SAAA,CAAA8H,GAAA,KACCtG,GAAApD,EAAuB,YAAvB,YAAAoD,GAAkC,cAAe,GAAK,GACtDtB,EAACuI,GAAA,CACC,WAAYrK,EAAuB,UAAU,YAC7C,cACEqD,GAAArD,EAAuB,YAAvB,YAAAqD,GAAkC,eAAgB,EAEpD,SAAU8F,GACV,SAAU3C,GAAeN,CAAA,CAAA,EAG7BtE,EAAC,MAAA,CAAI,UAAU,2CACb,SAAA,CAAAE,EAAC,OAAA,CAAM,WAAa,IAAA,CAAK,EACzBA,EAACwI,GAAA,CACC,kBACEtG,GAAAhE,EAAuB,YAAvB,YAAAgE,GAAkC,YAClCgC,EAEF,iBAAkBsD,GAClB,SAAU9C,GAAeN,CAAA,CAAA,CAC3B,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,EAEJ,EAIDY,GACChF,EAACyI,GAAA,CACC,OAAQzD,EACR,UAAW5B,IAAmB,KAC9B,MAAOxC,EAAa,iBACpB,aAAcA,EAAa,mBAC3B,kBAAmBA,EAAa,cAChC,gBAAiBA,EAAa,aAC9B,mBAAoB,IAAM,CACxBqE,EAAmB,EAAK,EACxBE,EAAiB,CAAA,CAAE,CACrB,EACA,qBAAsB0B,CAAA,CAAA,CACxB,EAEJ,CAEJ","x_google_ignoreList":[1,2,3,4]}
1
+ {"version":3,"file":"RequisitionListView.js","sources":["/@dropins/storefront-requisition-list/src/hooks/useRequisitionListSelectedItems.ts","../../node_modules/@adobe-commerce/elsie/src/icons/Cart.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Minus.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Search.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Trash.svg","/@dropins/storefront-requisition-list/src/components/NotFound/NotFound.tsx","/@dropins/storefront-requisition-list/src/components/ProductListTable/ProductListTable.tsx","/@dropins/storefront-requisition-list/src/components/BatchActions/BatchActions.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListView/RequisitionListView.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { Item } from '@/requisitionList/data/models/item';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\ntype UseRequisitionListSelectedItems = {\n currentRequisitionList: RequisitionList | null;\n setCurrentRequisitionList: (\n value:\n | RequisitionList\n | null\n | ((prev: RequisitionList | null) => RequisitionList | null)\n ) => void;\n selectedItems: Set<string>;\n setSelectedItems: (\n value: Set<string> | ((prev: Set<string>) => Set<string>)\n ) => void;\n handleItemSelection: (itemUid: string, isSelected: boolean) => void;\n handleSelectAll: () => void;\n handleSelectNone: () => void;\n};\n\nexport function useRequisitionListSelectedItems(): UseRequisitionListSelectedItems {\n const [currentRequisitionList, setCurrentRequisitionList] =\n useState<RequisitionList | null>(null);\n const [selectedItems, setSelectedItems] = useState<Set<string>>(new Set());\n\n const handleItemSelection = useCallback(\n (itemUid: string, isSelected: boolean) => {\n setSelectedItems((prev: Set<string>) => {\n const newSet = new Set(prev);\n if (isSelected) {\n newSet.add(itemUid);\n } else {\n newSet.delete(itemUid);\n }\n return newSet;\n });\n },\n []\n );\n\n const handleSelectAll = useCallback(() => {\n const allItemUids = currentRequisitionList?.items?.map(\n (item: Item) => item.uid\n );\n setSelectedItems(new Set(allItemUids));\n }, [currentRequisitionList]);\n\n const handleSelectNone = useCallback(() => {\n setSelectedItems(new Set());\n }, []);\n\n return {\n currentRequisitionList,\n setCurrentRequisitionList,\n selectedItems,\n setSelectedItems,\n handleItemSelection,\n handleSelectAll,\n handleSelectNone,\n };\n}\n","import * as React from \"react\";\nconst SvgCart = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_102_196)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M18.3601 18.16H6.5601L4.8801 3H2.3501M19.6701 19.59C19.6701 20.3687 19.0388 21 18.2601 21C17.4814 21 16.8501 20.3687 16.8501 19.59C16.8501 18.8113 17.4814 18.18 18.2601 18.18C19.0388 18.18 19.6701 18.8113 19.6701 19.59ZM7.42986 19.59C7.42986 20.3687 6.79858 21 6.01986 21C5.24114 21 4.60986 20.3687 4.60986 19.59C4.60986 18.8113 5.24114 18.18 6.01986 18.18C6.79858 18.18 7.42986 18.8113 7.42986 19.59Z\", stroke: \"currentColor\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M5.25 6.37L20.89 8.06L20.14 14.8H6.19\", stroke: \"currentColor\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_102_196\" }, /* @__PURE__ */ React.createElement(\"rect\", { vectorEffect: \"non-scaling-stroke\", width: 19.29, height: 19.5, fill: \"white\", transform: \"translate(2.3501 2.25)\" }))));\nexport default SvgCart;\n","import * as React from \"react\";\nconst SvgMinus = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { d: \"M17.3332 11.75H6.6665\", strokeWidth: 1, strokeLinecap: \"square\", strokeLinejoin: \"round\", vectorEffect: \"non-scaling-stroke\", fill: \"none\", stroke: \"currentColor\" }));\nexport default SvgMinus;\n","import * as React from \"react\";\nconst SvgSearch = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Search_Base\", \"data-name\": \"Icon \\\\u2013 Search \\\\u2013 Base\", xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, fill: \"none\", viewBox: \"0 0 24 24\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { id: \"Large\" }, /* @__PURE__ */ React.createElement(\"rect\", { id: \"Placement_area\", \"data-name\": \"Placement area\", width: 24, height: 24, fill: \"#fff\", opacity: 0 }), /* @__PURE__ */ React.createElement(\"g\", { id: \"Search_icon\", \"data-name\": \"Search icon\", transform: \"translate(3.75 3.75)\" }, /* @__PURE__ */ React.createElement(\"circle\", { vectorEffect: \"non-scaling-stroke\", id: \"Ellipse_186\", \"data-name\": \"Ellipse 186\", cx: 6, cy: 6, r: 6, fill: \"none\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"line\", { vectorEffect: \"non-scaling-stroke\", id: \"Line_556\", \"data-name\": \"Line 556\", x2: 6, y2: 6, transform: \"translate(10.5 10.5)\", fill: \"none\", stroke: \"currentColor\" }))));\nexport default SvgSearch;\n","import * as React from \"react\";\nconst SvgTrash = (props) => /* @__PURE__ */ React.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M1 5H23\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M17.3674 22H6.63446C5.67952 22 4.88992 21.2688 4.8379 20.3338L4 5H20L19.1621 20.3338C19.1119 21.2688 18.3223 22 17.3655 22H17.3674Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M9.87189 2H14.1281C14.6085 2 15 2.39766 15 2.88889V5H9V2.88889C9 2.39912 9.39006 2 9.87189 2Z\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M8.87402 8.58057L9.39348 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M14.6673 8.58057L14.146 17.682\", stroke: \"currentColor\", strokeWidth: 1, strokeMiterlimit: 10 }));\nexport default SvgTrash;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Icon, Button } from '@adobe-commerce/elsie/components';\nimport { classes } from '@adobe-commerce/elsie/lib';\nimport { Search } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/NotFound/NotFound.css';\n\nexport interface NotFoundProps {\n className?: string;\n title?: string;\n message?: string;\n actionLabel?: string;\n onAction?: () => void;\n}\n\nexport const NotFound: FunctionComponent<NotFoundProps> = ({\n className,\n title = '404 - Not Found',\n message = 'The requisition list you are looking for does not exist.',\n actionLabel,\n onAction,\n ...props\n}) => {\n return (\n <div\n className={classes(['not-found', className])}\n data-testid=\"not-found\"\n {...props}\n >\n <Icon source={Search} size={'64'} stroke={'2'} />\n <h2>{title}</h2>\n {message && <p>{message}</p>}\n {actionLabel && onAction && (\n <Button variant=\"primary\" onClick={onAction}>\n {actionLabel}\n </Button>\n )}\n </div>\n );\n};\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent, h } from 'preact';\nimport { HTMLAttributes, ChangeEvent } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport {\n Icon,\n Table,\n Checkbox,\n Price,\n Button,\n Field,\n Input,\n Image,\n} from '@adobe-commerce/elsie/components';\nimport { Trash, Cart } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/ProductListTable/ProductListTable.css';\nimport { RequisitionListModel } from '@/requisitionList/data/models/requisitionList';\nimport { Item, BundleOption } from '@/requisitionList/data/models/item';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface ProductListTableProps\n extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n className?: string;\n items: RequisitionListModel['items'];\n selectedItems: Set<string>;\n currentPage: number;\n pageSize: number;\n canEdit?: boolean;\n handleItemSelection: (itemUid: string, isSelected: boolean) => void;\n handleUpdateQuantity: (itemUid: string, newQuantity: number) => void;\n onAddToCart: (itemUids: string[] | undefined) => void;\n onDeleteItem: (itemUids: string[] | undefined) => void;\n}\n\nexport const ProductListTable: FunctionComponent<ProductListTableProps> = ({\n className,\n items,\n selectedItems,\n currentPage,\n pageSize,\n canEdit = true,\n handleItemSelection,\n handleUpdateQuantity,\n onAddToCart,\n onDeleteItem,\n ...props\n}) => {\n const translations = useText({\n productNameHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.productName',\n skuHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.sku',\n priceHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.price',\n quantityHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.quantity',\n subtotalHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.subtotal',\n actionsHeader:\n 'RequisitionList.RequisitionListView.productListTable.headers.actions',\n actionAddToCart: 'RequisitionList.RequisitionListView.actionAddToCart',\n actionDelete: 'RequisitionList.RequisitionListView.actionDelete',\n itemQuantity:\n 'RequisitionList.RequisitionListView.productListTable.itemQuantity',\n });\n const columns = [\n {\n label: '#',\n key: 'index',\n },\n {\n label: 'item',\n key: 'item',\n },\n {\n label: translations.priceHeader,\n key: 'price',\n },\n {\n label: translations.quantityHeader,\n key: 'quantity',\n },\n {\n label: translations.subtotalHeader,\n key: 'subtotal',\n },\n ];\n\n if (canEdit) {\n columns.unshift({\n label: '',\n key: 'selector',\n });\n columns.push({\n label: translations.actionsHeader,\n key: 'actions',\n });\n }\n\n const handleItemCheckboxChange = (\n event: ChangeEvent<HTMLInputElement>,\n item: Item\n ) => {\n const isSelected = (event.target as HTMLInputElement).checked;\n handleItemSelection(item.uid, isSelected);\n };\n\n const getRowIndex = (index: number): number => {\n return (currentPage - 1) * pageSize + index + 1;\n };\n\n const getImageAlt = (item: Item): string => {\n return item.configured_product?.name || item.product?.name || item.sku;\n };\n\n const getImageSrc = (item: Item): string => {\n return item.configured_product?.images\n ? item.configured_product.images[0]?.url\n : item.product?.images\n ? item.product.images[0]?.url\n : '';\n };\n\n const getProductName = (item: Item): string | undefined => {\n return item.product?.name || item.sku;\n };\n\n const getConfiguredProductName = (item: Item): string | undefined => {\n return item.configured_product?.name;\n };\n\n const getBundleProducts = (\n item: Item\n ): h.JSX<HTMLSpanElement>[] | undefined => {\n if (!item.bundle_options) {\n return;\n }\n\n const bundleProducts = item.bundle_options.map(\n (option: BundleOption, index: number): h.JSX<HTMLSpanElement> => {\n return (\n <span\n key={option.values[0].label || index}\n className=\"requisition-list-view-product-list-table__product-configurable-name\"\n >\n {option.values[0]!.label} x {option.values[0]!.quantity}\n </span>\n );\n }\n );\n return bundleProducts;\n };\n\n const getSku = (item: Item): string | undefined => {\n return item.configured_product?.sku || item.sku;\n };\n\n const getPriceAmount = (item: Item): number => {\n if (Array.isArray(item.bundle_options) && item.bundle_options.length > 0) {\n return item.bundle_options.reduce(\n (previousValue: number, option: BundleOption): number => {\n return (\n previousValue +\n (option.values[0]?.priceV2?.value || 0) *\n (option.values[0]?.quantity || 0)\n );\n },\n 0\n );\n }\n return (\n item.configured_product?.price?.final?.amount?.value ||\n item.product?.price?.final?.amount?.value ||\n 0\n );\n };\n\n const getPriceCurrency = (item: Item): string | undefined => {\n return (\n item.configured_product?.price?.final?.amount?.currency ||\n item.product?.price?.final?.amount?.currency\n );\n };\n\n const getSubtotal = (item: Item): number => {\n return getPriceAmount(item) * item.quantity;\n };\n\n const rowData = items.map((item: Item, index: number) => {\n return {\n selector: (\n <Checkbox\n className=\"requisition-list-view-product-list-table__checkbox\"\n name=\"itemSelected\"\n data-testid={`item-checkbox-${item.sku}`}\n onChange={(e: ChangeEvent<HTMLInputElement>) =>\n handleItemCheckboxChange(e, item)\n }\n value={item.sku}\n checked={selectedItems.has(item.uid)}\n />\n ),\n index: (\n <div className=\"requisition-list-view-product-list-table__index-container\">\n {getRowIndex(index)}\n </div>\n ),\n item: (\n <div className=\"requisition-list-view-product-list-table__item-container\">\n <Image\n className=\"requisition-list-view-product-list-table__thumbnail\"\n alt={getImageAlt(item)}\n src={getImageSrc(item)}\n />\n <div className=\"requisition-list-view-product-list-table__item-details\">\n <div className=\"requisition-list-view-product-list-table__product-name\">\n {getProductName(item)}\n </div>\n <span className=\"requisition-list-view-product-list-table__product-configurable-name\">\n {getConfiguredProductName(item)}\n </span>\n <div className=\"requisition-list-view-product-list-table__sku\">\n {getSku(item)}\n </div>\n {getBundleProducts(item)}\n </div>\n </div>\n ),\n price: (\n <Price\n className=\"requisition-list-view-product-list-table__price\"\n amount={getPriceAmount(item)}\n currency={getPriceCurrency(item)}\n />\n ),\n quantity: (\n <span className=\"requisition-list-view-product-list-table__quantity\">\n <Field disabled={false}>\n <Input\n id={`requisition-list-item-quantity-${item.sku}`}\n data-testid={`requisition-list-item-quantity-${item.sku}`}\n name=\"quantity\"\n type=\"text\"\n value={item.quantity}\n onBlur={(e: FocusEvent) => {\n const newValue = Number.parseInt(\n (e.target as HTMLInputElement).value,\n 10\n );\n handleUpdateQuantity(item.uid, newValue);\n }}\n />\n </Field>\n </span>\n ),\n subtotal: (\n <Price\n className=\"requisition-list-view-product-list-table__price\"\n amount={getSubtotal(item)}\n currency={getPriceCurrency(item)}\n />\n ),\n actions: (\n <div className=\"requisition-list-view__bulk-actions\">\n <Button\n type=\"button\"\n onClick={() => onAddToCart([item.uid])}\n icon={<Icon source={Cart} />}\n data-testid=\"product-list-table-add-to-cart-button\"\n />\n <Button\n type=\"button\"\n variant=\"secondary\"\n icon={<Icon source={Trash} />}\n onClick={() => onDeleteItem([item.uid])}\n data-testid=\"product-list-table-delete-button\"\n />\n </div>\n ),\n };\n });\n\n const table = (\n <Table\n columns={columns}\n rowData={rowData}\n data-testid=\"product-list-table\"\n mobileLayout=\"stacked\"\n />\n );\n\n return (\n <VComponent\n node={h('div', {})}\n className={classes([\n 'requisition-list-view-product-list-table-container',\n className,\n ])}\n data-testid=\"product-list-table-container\"\n {...props}\n >\n {table}\n </VComponent>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { Button, Icon } from '@adobe-commerce/elsie/components';\nimport { Trash, Minus } from '@adobe-commerce/elsie/icons';\nimport '@/requisitionList/components/BatchActions/BatchActions.css';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nexport interface BatchActionsProps\n extends HTMLAttributes<HTMLDivElement | HTMLFormElement> {\n selectedItems: Set<string>;\n deletingItemId: string | null;\n addingToCartItemId: string | null;\n bulkAddingToCart: boolean;\n updatingQuantityItemId: string | null;\n onSelectAll: () => void;\n onSelectNone: () => void;\n onBulkAddToCart: () => void;\n onBulkDelete: () => void;\n}\n\nexport const BatchActions: FunctionComponent<BatchActionsProps> = ({\n selectedItems,\n deletingItemId,\n addingToCartItemId,\n bulkAddingToCart,\n updatingQuantityItemId,\n onSelectAll,\n onSelectNone,\n onBulkAddToCart,\n onBulkDelete,\n}) => {\n const translations = useText({\n statusDeleting: `RequisitionList.RequisitionListView.statusDeleting`,\n actionSelectAll: `RequisitionList.RequisitionListView.actionSelectAll`,\n actionSelectNone: `RequisitionList.RequisitionListView.actionSelectNone`,\n actionAddToCart: `RequisitionList.RequisitionListView.actionAddToCart`,\n actionDeleteSelectedItems: `RequisitionList.RequisitionListView.actionDeleteSelectedItems`,\n statusBulkAddingToCart: `RequisitionList.RequisitionListView.statusBulkAddingToCart`,\n });\n\n const isDisabled =\n deletingItemId !== null ||\n addingToCartItemId !== null ||\n bulkAddingToCart ||\n updatingQuantityItemId !== null;\n\n const hasSelectedItems = selectedItems.size > 0;\n\n return (\n <div className=\"requisition-list-view__batch-actions\">\n <div className=\"requisition-list-view__batch-actions-left\">\n <button\n data-testid=\"bulk-actions-select-toggle-btn\"\n type=\"button\"\n className={`requisition-list-view__batch-actions-select-toggle ${hasSelectedItems ? 'requisition-list-view__batch-actions-select-toggle--active' : ''}`}\n onClick={hasSelectedItems ? onSelectNone : onSelectAll}\n disabled={isDisabled}\n aria-label={hasSelectedItems ? translations.actionSelectNone : translations.actionSelectAll}\n >\n <Icon source={Minus} />\n </button>\n <button\n type=\"button\"\n className=\"requisition-list-view__batch-actions-select-label\"\n onClick={hasSelectedItems ? onSelectNone : onSelectAll}\n disabled={isDisabled}\n >\n {translations.actionSelectAll}\n </button>\n </div>\n\n {hasSelectedItems && (\n <div className=\"requisition-list-view__batch-actions-buttons\">\n <span\n className=\"requisition-list-view__batch-actions-count-badge\"\n aria-label={`${selectedItems.size} items selected`}\n >\n {selectedItems.size}\n </span>\n <Button\n data-testid=\"bulk-actions-add-to-cart-btn\"\n type=\"button\"\n variant=\"secondary\"\n onClick={onBulkAddToCart}\n disabled={isDisabled}\n >\n {bulkAddingToCart\n ? translations.statusBulkAddingToCart\n : translations.actionAddToCart}\n </Button>\n <button\n data-testid=\"bulk-actions-delete-btn\"\n type=\"button\"\n className=\"requisition-list-view__batch-actions-delete-icon\"\n onClick={onBulkDelete}\n disabled={isDisabled}\n aria-label={translations.actionDeleteSelectedItems}\n >\n <Icon source={Trash} />\n </button>\n </div>\n )}\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport {\n HTMLAttributes,\n useState,\n useCallback,\n useEffect,\n} from 'preact/compat';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { addRequisitionListItemsToCart } from '@/requisitionList/api/addRequisitionListItemsToCart';\nimport { deleteRequisitionListItems } from '@/requisitionList/api/deleteRequisitionListItems';\nimport { getProductData } from '@/requisitionList/api/getProductData';\nimport { updateRequisitionListItems } from '@/requisitionList/api/updateRequisitionListItems';\nimport { getRequisitionList } from '@/requisitionList/api/getRequisitionList';\nimport {\n Pagination,\n InLineAlert,\n ProgressSpinner,\n} from '@adobe-commerce/elsie/components';\nimport { Item, Product } from '@/requisitionList/data/models/item';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\nimport {\n PageSizePicker,\n EmptyList,\n NotFound,\n RequisitionListModal,\n} from '@/requisitionList/components';\nimport { ProductListTable } from '@/requisitionList/components/ProductListTable/ProductListTable';\nimport { BatchActions } from '@/requisitionList/components/BatchActions/BatchActions';\nimport { RequisitionListHeader } from '@/requisitionList/containers/RequisitionListHeader';\nimport { useRequisitionListSelectedItems } from '@/requisitionList/hooks/useRequisitionListSelectedItems';\nimport { useRequisitionListAlert } from '@/requisitionList/hooks/useRequisitionListAlert';\nimport { isValidBase64Uid } from '@/requisitionList/lib/validate-uid';\nimport { DEFAULT_PAGE_SIZE } from '@/requisitionList/lib/constants';\nimport '@/requisitionList/containers/RequisitionListView/RequisitionListView.css';\n\nexport interface RequisitionListViewProps\n extends HTMLAttributes<HTMLDivElement> {\n /**\n * The UID of the requisition list to display.\n * The UID must be a base64-encoded string.\n * If an invalid UID is provided, the component will render the NotFound state.\n * The component will fetch the requisition list data internally.\n */\n requisitionListUid: string;\n /**\n * When true, skips automatic product data fetching on component mount.\n * Used in tests to prevent API calls.\n */\n skipProductLoading?: boolean;\n /**\n * Number of items per page for pagination.\n * Defaults to DEFAULT_PAGE_SIZE.\n */\n pageSize?: number;\n selectedItems: Set<string>;\n /**\n * Function that returns the URL to the requisition list grid view or performs navigation\n */\n routeRequisitionListGrid?: () => string | void;\n}\n\nexport const RequisitionListView: Container<RequisitionListViewProps> = ({\n requisitionListUid,\n skipProductLoading = false,\n pageSize = DEFAULT_PAGE_SIZE,\n routeRequisitionListGrid,\n}: RequisitionListViewProps) => {\n const [loadingProducts, setLoadingProducts] = useState<boolean>(false);\n const [deletingItemId, setDeletingItemId] = useState<string | null>(null);\n const [addingToCartItemId, setAddingToCartItemId] = useState<\n string[] | undefined\n >(null);\n const [bulkAddingToCart, setBulkAddingToCart] = useState<boolean>(false);\n const [updatingQuantityItemId, setUpdatingQuantityItemId] = useState<\n string | null\n >(null);\n const [loadingPage, setLoadingPage] = useState<boolean>(false);\n const [currentPageSize, setCurrentPageSize] = useState<number>(pageSize);\n const [initializing, setInitializing] = useState<boolean>(true);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [itemsToDelete, setItemsToDelete] = useState<string[]>([]);\n\n const {\n currentRequisitionList,\n setCurrentRequisitionList,\n selectedItems,\n setSelectedItems,\n handleItemSelection,\n handleSelectAll,\n handleSelectNone,\n } = useRequisitionListSelectedItems();\n\n const translations = useText({\n emptyRequisitionList: `RequisitionList.RequisitionListView.emptyRequisitionList`,\n errorLoadingProducts: `RequisitionList.RequisitionListView.errorLoadingProducts`,\n errorLoadPage: `RequisitionList.RequisitionListView.errorLoadPage`,\n notFoundTitle: `RequisitionList.RequisitionListView.notFoundTitle`,\n notFoundMessage: `RequisitionList.RequisitionListView.notFoundMessage`,\n notFoundActionLabel: `RequisitionList.RequisitionListView.notFoundActionLabel`,\n show: `RequisitionList.RequisitionListView.show`,\n itemsCounter: `RequisitionList.RequisitionListView.itemsCounter`,\n deleteItemsTitle: `RequisitionList.RequisitionListView.deleteItemsTitle`,\n deleteItemsMessage: `RequisitionList.RequisitionListView.deleteItemsMessage`,\n confirmAction: `RequisitionList.RequisitionListView.confirmAction`,\n cancelAction: `RequisitionList.RequisitionListView.cancelAction`,\n });\n\n const { alert, setAlert, handleRequisitionListAlert } =\n useRequisitionListAlert();\n\n useEffect(() => {\n const requisitionListEvent = events.on(\n 'requisitionList/data',\n (payload: RequisitionList) => {\n // Only update from events if it matches our current UID\n if (payload?.uid === requisitionListUid) {\n setCurrentRequisitionList(payload);\n setSelectedItems(new Set());\n }\n }\n );\n // Keep event listener for cross-component alert communication\n const alertEvent = events.on(\n 'requisitionList/alert',\n handleRequisitionListAlert\n );\n return () => {\n requisitionListEvent?.off();\n alertEvent?.off();\n };\n }, [\n handleRequisitionListAlert,\n requisitionListUid,\n setCurrentRequisitionList,\n setSelectedItems,\n ]);\n\n // Sync pageSize prop changes to local state\n useEffect(() => {\n setCurrentPageSize(pageSize);\n }, [pageSize]);\n\n // Function to fetch and merge product data\n const fetchAndMergeProducts = useCallback(\n async (baseRequisitionList: RequisitionList) => {\n // Extract SKUs from requisition list items\n const productSkus =\n baseRequisitionList.items?.map((item: Item) => item.sku) || [];\n\n if (productSkus.length === 0) {\n return baseRequisitionList;\n }\n\n setLoadingProducts(true);\n\n try {\n const fetchedProducts = await getProductData(productSkus);\n if (fetchedProducts) {\n // Create a map of SKU to Product for easy lookup\n const productMap = new Map<string, Product>();\n fetchedProducts.forEach((product: Product) => {\n productMap.set(product.sku, product);\n });\n\n // Update requisition list items with fetched product data\n return {\n ...baseRequisitionList,\n items: baseRequisitionList.items?.map((item: Item) => ({\n ...item,\n product: productMap.get(item.sku) || item.product, // Use fetched product or keep existing\n })),\n };\n }\n console.warn('No products found');\n return baseRequisitionList;\n } catch (error) {\n console.warn(\n error instanceof Error\n ? error.message\n : translations.errorLoadingProducts\n );\n return baseRequisitionList;\n } finally {\n setLoadingProducts(false);\n }\n },\n [translations.errorLoadingProducts]\n );\n\n // Initialize requisition list from UID\n // Only triggers initial load when UID changes. Page size changes trigger pagination, not re-initialization.\n useEffect(() => {\n if (!requisitionListUid) {\n setInitializing(false);\n return;\n }\n\n // Only initialize if we don't have a list or if the UID changed\n if (\n currentRequisitionList &&\n currentRequisitionList.uid === requisitionListUid\n ) {\n // Same list already loaded, don't re-initialize\n return;\n }\n\n setInitializing(true);\n\n const initializeFromUid = async () => {\n try {\n const fetchedList = await getRequisitionList(\n requisitionListUid,\n 1,\n pageSize\n );\n\n if (fetchedList) {\n // Fetch and merge product data\n if (!skipProductLoading) {\n const enrichedList = await fetchAndMergeProducts(fetchedList);\n setCurrentRequisitionList(enrichedList);\n } else {\n setCurrentRequisitionList(fetchedList);\n }\n }\n } catch (error) {\n console.error('Failed to initialize requisition list from UID:', error);\n } finally {\n setInitializing(false);\n }\n };\n\n initializeFromUid();\n }, [\n requisitionListUid,\n pageSize,\n skipProductLoading,\n fetchAndMergeProducts,\n setCurrentRequisitionList,\n currentRequisitionList,\n ]);\n\n const handleAddItemsToCart = useCallback(\n async (itemUids: string[] | undefined) => {\n if (itemUids && itemUids.length === 1) {\n setBulkAddingToCart(false);\n setAddingToCartItemId(itemUids);\n } else {\n setBulkAddingToCart(true);\n setAddingToCartItemId(null);\n }\n\n try {\n const errors = await addRequisitionListItemsToCart(\n currentRequisitionList.uid,\n itemUids\n );\n\n if (errors && errors.length > 0) {\n const alertPayload = {\n action: 'move',\n type: 'error',\n context: 'product',\n message: errors.map((e: any) => e.message),\n };\n handleRequisitionListAlert(alertPayload);\n events.emit('requisitionList/alert', alertPayload);\n } else {\n const alertPayload = {\n action: 'move',\n type: 'success',\n context: 'product',\n };\n handleRequisitionListAlert(alertPayload);\n events.emit('requisitionList/alert', alertPayload);\n }\n } catch (error) {\n const alertPayload = {\n action: 'move',\n type: 'error',\n context: 'product',\n };\n handleRequisitionListAlert(alertPayload);\n events.emit('requisitionList/alert', alertPayload);\n } finally {\n setAddingToCartItemId(null);\n setBulkAddingToCart(false);\n }\n },\n [currentRequisitionList, handleRequisitionListAlert]\n );\n\n const handleDeleteItems = useCallback((itemUids: string[] | undefined) => {\n if (itemUids && itemUids.length > 0) {\n setItemsToDelete(itemUids);\n setShowDeleteModal(true);\n }\n }, []);\n\n const handleConfirmDelete = useCallback(async () => {\n if (itemsToDelete.length === 1) {\n setDeletingItemId(itemsToDelete[0]);\n } else {\n setDeletingItemId('bulk');\n }\n\n try {\n const updatedRequisitionList = await deleteRequisitionListItems(\n currentRequisitionList.uid,\n itemsToDelete,\n currentPageSize,\n currentRequisitionList.page_info.current_page\n );\n\n if (updatedRequisitionList) {\n // Fetch and merge product data to ensure prices are loaded\n const enrichedRequisitionList = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(enrichedRequisitionList);\n handleRequisitionListAlert({\n action: 'delete',\n type: 'success',\n context: 'product',\n });\n } else {\n handleRequisitionListAlert({\n action: 'delete',\n type: 'error',\n context: 'product',\n });\n }\n } catch (error) {\n handleRequisitionListAlert({\n action: 'delete',\n type: 'error',\n context: 'product',\n });\n } finally {\n setDeletingItemId(null);\n setShowDeleteModal(false);\n setItemsToDelete([]);\n }\n }, [\n itemsToDelete,\n currentRequisitionList,\n currentPageSize,\n fetchAndMergeProducts,\n setCurrentRequisitionList,\n handleRequisitionListAlert,\n ]);\n\n const handleUpdateQuantity = useCallback(\n async (itemUid: string, newQuantity: number) => {\n setUpdatingQuantityItemId(itemUid);\n\n try {\n // Find the current item to update\n const currentItem = currentRequisitionList.items?.find(\n (item: Item) => item.uid === itemUid\n );\n if (!currentItem) {\n handleRequisitionListAlert({\n action: 'update',\n type: 'error',\n context: 'product',\n });\n return;\n }\n\n // Create updated item with new quantity\n const updatedItem = {\n item_id: currentItem.uid,\n entered_options: currentItem.entered_options,\n selected_options: currentItem.selected_options,\n quantity: newQuantity,\n };\n\n const updatedRequisitionList = await updateRequisitionListItems(\n currentRequisitionList.uid,\n [updatedItem],\n currentPageSize,\n currentRequisitionList.page_info.current_page\n );\n\n if (updatedRequisitionList) {\n // Reload product data with updated quantities\n const enrichedRequisitionList = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(enrichedRequisitionList);\n handleRequisitionListAlert({\n action: 'update',\n type: 'success',\n context: 'product',\n });\n } else {\n handleRequisitionListAlert({\n action: 'update',\n type: 'error',\n context: 'product',\n });\n }\n } catch (error) {\n handleRequisitionListAlert({\n action: 'update',\n type: 'error',\n context: 'product',\n });\n } finally {\n setUpdatingQuantityItemId(null);\n }\n },\n [\n currentRequisitionList,\n fetchAndMergeProducts,\n setCurrentRequisitionList,\n currentPageSize,\n handleRequisitionListAlert,\n ]\n );\n\n const handlePageChange = useCallback(\n async (page: number) => {\n setLoadingPage(true);\n\n try {\n const updatedRequisitionList = await getRequisitionList(\n currentRequisitionList.uid,\n page,\n currentPageSize\n );\n\n if (updatedRequisitionList) {\n // Fetch product data for the new page\n const updatedListWithProducts = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(updatedListWithProducts);\n } else {\n console.warn(translations.errorLoadPage);\n }\n } catch (error) {\n console.warn(\n error instanceof Error ? error.message : translations.errorLoadPage\n );\n } finally {\n setLoadingPage(false);\n }\n },\n [\n currentRequisitionList?.uid,\n fetchAndMergeProducts,\n currentPageSize,\n translations,\n setCurrentRequisitionList,\n ]\n );\n\n const handlePageSizeChange = useCallback(\n async (newPageSize: number) => {\n setCurrentPageSize(newPageSize);\n setLoadingPage(true);\n\n try {\n // Reset to page 1 when changing page size\n const updatedRequisitionList = await getRequisitionList(\n currentRequisitionList.uid,\n 1,\n newPageSize\n );\n\n if (updatedRequisitionList) {\n // Fetch product data for the new page\n const updatedListWithProducts = await fetchAndMergeProducts(\n updatedRequisitionList\n );\n setCurrentRequisitionList(updatedListWithProducts);\n } else {\n console.warn(translations.errorLoadPage);\n }\n } catch (error) {\n console.warn(translations.errorLoadPage);\n } finally {\n setLoadingPage(false);\n }\n },\n [\n currentRequisitionList?.uid,\n fetchAndMergeProducts,\n translations,\n setCurrentRequisitionList,\n ]\n );\n\n const handleUpdate = useCallback(\n async (updatedList: RequisitionList) => {\n // With the updated API, the response includes items and page_info\n // but we need to fetch and merge full product data (prices, images, etc.)\n const enrichedList = await fetchAndMergeProducts(updatedList);\n setCurrentRequisitionList(enrichedList);\n },\n [setCurrentRequisitionList, fetchAndMergeProducts]\n );\n\n const itemsCounter = () => {\n const pageSize =\n currentRequisitionList.page_info?.page_size ?? DEFAULT_PAGE_SIZE;\n const currentPage = currentRequisitionList.page_info?.current_page ?? 1;\n const currentPageSize = pageSize * currentPage;\n const total = currentRequisitionList?.items_count ?? 0;\n const from = currentPageSize - pageSize + 1;\n const to = currentPageSize > total ? total : currentPageSize;\n\n return (\n <span className=\"requisition-list-view__pagination-items\">\n {translations.itemsCounter\n .replace('{from}', from.toString())\n .replace('{to}', to.toString())\n .replace('{total}', total.toString())}\n </span>\n );\n };\n\n return (\n <div className=\"requisition-list-view__container\">\n {initializing ? (\n <div className=\"requisition-list-view__loading\">\n <ProgressSpinner stroke={'4'} size={'large'} />\n </div>\n ) : !currentRequisitionList ||\n !isValidBase64Uid(currentRequisitionList?.uid) ? (\n <NotFound\n title={translations.notFoundTitle}\n message={translations.notFoundMessage}\n actionLabel={\n routeRequisitionListGrid\n ? translations.notFoundActionLabel\n : undefined\n }\n onAction={\n routeRequisitionListGrid\n ? () => {\n const url = routeRequisitionListGrid();\n if (url && typeof url === 'string') {\n window.location.href = url;\n }\n }\n : undefined\n }\n />\n ) : (\n <>\n <RequisitionListHeader\n requisitionList={currentRequisitionList}\n routeRequisitionListGrid={routeRequisitionListGrid}\n onUpdate={handleUpdate}\n onAlert={handleRequisitionListAlert}\n />\n\n {alert && (\n <div className=\"requisition-list__alert-wrapper\">\n <InLineAlert\n heading={alert.description}\n type={alert.type}\n variant=\"primary\"\n onDismiss={() => setAlert(null)}\n />\n </div>\n )}\n\n {currentRequisitionList.items_count === 0 ? (\n <EmptyList\n textContent={`${currentRequisitionList.name} ${translations.emptyRequisitionList}`}\n />\n ) : (\n <>\n <BatchActions\n selectedItems={selectedItems}\n deletingItemId={deletingItemId}\n addingToCartItemId={addingToCartItemId}\n bulkAddingToCart={bulkAddingToCart}\n updatingQuantityItemId={updatingQuantityItemId}\n onSelectAll={handleSelectAll}\n onSelectNone={handleSelectNone}\n onBulkAddToCart={() =>\n handleAddItemsToCart(Array.from(selectedItems))\n }\n onBulkDelete={() =>\n handleDeleteItems(Array.from(selectedItems))\n }\n />\n\n <ProductListTable\n items={currentRequisitionList.items}\n selectedItems={selectedItems}\n currentPage={\n currentRequisitionList.page_info?.current_page || 1\n }\n pageSize={\n currentRequisitionList.page_info?.page_size ||\n DEFAULT_PAGE_SIZE\n }\n handleItemSelection={handleItemSelection}\n handleUpdateQuantity={handleUpdateQuantity}\n onAddToCart={handleAddItemsToCart}\n onDeleteItem={handleDeleteItems}\n />\n\n {/* Pagination */}\n {currentRequisitionList.page_info && (\n <div className=\"requisition-list-view__pagination\">\n {itemsCounter()}\n {(currentRequisitionList.page_info?.total_pages || 0) > 1 && (\n <Pagination\n totalPages={currentRequisitionList.page_info.total_pages}\n currentPage={\n currentRequisitionList.page_info?.current_page || 1\n }\n onChange={handlePageChange}\n disabled={loadingPage || loadingProducts}\n />\n )}\n <div className=\"requisition-list-view__pagination-picker\">\n <span>{translations.show}</span>\n <PageSizePicker\n currentPageSize={\n currentRequisitionList.page_info?.page_size ||\n DEFAULT_PAGE_SIZE\n }\n onPageSizeChange={handlePageSizeChange}\n disabled={loadingPage || loadingProducts}\n />\n </div>\n </div>\n )}\n </>\n )}\n </>\n )}\n\n {/* Delete Confirmation Modal */}\n {showDeleteModal && (\n <RequisitionListModal\n isOpen={showDeleteModal}\n isLoading={deletingItemId !== null}\n title={translations.deleteItemsTitle}\n modalContent={translations.deleteItemsMessage}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={() => {\n setShowDeleteModal(false);\n setItemsToDelete([]);\n }}\n handleModalOnConfirm={handleConfirmDelete}\n />\n )}\n </div>\n );\n};\n"],"names":["useRequisitionListSelectedItems","currentRequisitionList","setCurrentRequisitionList","useState","selectedItems","setSelectedItems","handleItemSelection","useCallback","itemUid","isSelected","prev","newSet","handleSelectAll","allItemUids","_a","item","handleSelectNone","SvgCart","props","React","SvgMinus","SvgSearch","SvgTrash","NotFound","className","title","message","actionLabel","onAction","jsxs","classes","jsx","Icon","Search","Button","ProductListTable","items","currentPage","pageSize","canEdit","handleUpdateQuantity","onAddToCart","onDeleteItem","translations","useText","columns","handleItemCheckboxChange","event","getRowIndex","index","getImageAlt","_b","getImageSrc","_c","_d","getProductName","getConfiguredProductName","getBundleProducts","option","getSku","getPriceAmount","previousValue","_h","_g","_f","_e","getPriceCurrency","getSubtotal","rowData","Checkbox","e","Image","Price","Field","Input","newValue","Cart","Trash","table","Table","VComponent","h","BatchActions","deletingItemId","addingToCartItemId","bulkAddingToCart","updatingQuantityItemId","onSelectAll","onSelectNone","onBulkAddToCart","onBulkDelete","isDisabled","hasSelectedItems","Minus","RequisitionListView","requisitionListUid","skipProductLoading","DEFAULT_PAGE_SIZE","routeRequisitionListGrid","loadingProducts","setLoadingProducts","setDeletingItemId","setAddingToCartItemId","setBulkAddingToCart","setUpdatingQuantityItemId","loadingPage","setLoadingPage","currentPageSize","setCurrentPageSize","initializing","setInitializing","showDeleteModal","setShowDeleteModal","itemsToDelete","setItemsToDelete","alert","setAlert","handleRequisitionListAlert","useRequisitionListAlert","useEffect","requisitionListEvent","events","payload","alertEvent","fetchAndMergeProducts","baseRequisitionList","productSkus","fetchedProducts","getProductData","productMap","product","error","fetchedList","getRequisitionList","enrichedList","handleAddItemsToCart","itemUids","errors","addRequisitionListItemsToCart","alertPayload","handleDeleteItems","handleConfirmDelete","updatedRequisitionList","deleteRequisitionListItems","enrichedRequisitionList","newQuantity","currentItem","updatedItem","updateRequisitionListItems","handlePageChange","page","updatedListWithProducts","handlePageSizeChange","newPageSize","handleUpdate","updatedList","itemsCounter","total","from","to","ProgressSpinner","isValidBase64Uid","url","Fragment","RequisitionListHeader","InLineAlert","EmptyList","Pagination","PageSizePicker","RequisitionListModal"],"mappings":"+tCAsCO,SAASA,IAAmE,CACjF,KAAM,CAACC,EAAwBC,CAAyB,EACtDC,GAAiC,IAAI,EACjC,CAACC,EAAeC,CAAgB,EAAIF,GAAsB,IAAI,GAAK,EAEnEG,EAAsBC,GAC1B,CAACC,EAAiBC,IAAwB,CACxCJ,EAAkBK,GAAsB,CACtC,MAAMC,EAAS,IAAI,IAAID,CAAI,EAC3B,OAAID,EACFE,EAAO,IAAIH,CAAO,EAElBG,EAAO,OAAOH,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AACwI,GAAA,CACC,WAAYtK,EAAuB,UAAU,YAC7C,cACEqD,GAAArD,EAAuB,YAAvB,YAAAqD,GAAkC,eAAgB,EAEpD,SAAU+F,GACV,SAAU5C,GAAeN,CAAA,CAAA,EAG7BtE,EAAC,MAAA,CAAI,UAAU,2CACb,SAAA,CAAAE,EAAC,OAAA,CAAM,WAAa,IAAA,CAAK,EACzBA,EAACyI,GAAA,CACC,kBACEvG,GAAAhE,EAAuB,YAAvB,YAAAgE,GAAkC,YAClCgC,EAEF,iBAAkBuD,GAClB,SAAU/C,GAAeN,CAAA,CAAA,CAC3B,CAAA,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,EAEJ,EAIDY,GACChF,EAAC0I,GAAA,CACC,OAAQ1D,EACR,UAAW5B,IAAmB,KAC9B,MAAOxC,EAAa,iBACpB,aAAcA,EAAa,mBAC3B,kBAAmBA,EAAa,cAChC,gBAAiBA,EAAa,aAC9B,mBAAoB,IAAM,CACxBqE,EAAmB,EAAK,EACxBE,EAAiB,CAAA,CAAE,CACrB,EACA,qBAAsB2B,CAAA,CAAA,CACxB,EAEJ,CAEJ","x_google_ignoreList":[1,2,3,4]}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-requisition-list", "version": "1.0.0-beta2", "@dropins/tools": "~1.6.0-beta3", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-requisition-list", "version": "1.0.0-beta3", "@dropins/tools": "~1.6.0-beta3", "license": "SEE LICENSE IN LICENSE.md"}