@dropins/storefront-requisition-list 0.2.0-beta → 0.4.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/api/addRequisitionListItemsToCart/index.d.ts +1 -1
  2. package/api/deleteRequisitionListItems/index.d.ts +1 -1
  3. package/api/fragments/ProductFragment.graphql.d.ts +18 -0
  4. package/api/fragments/RequisitionListItemsFragment.graphql.d.ts +1 -1
  5. package/api/fragments.d.ts +1 -0
  6. package/api/getProductData/getProductData.d.ts +4 -0
  7. package/api/getProductData/graphql/getProductData.d.ts +18 -0
  8. package/api/getProductData/index.d.ts +18 -0
  9. package/api/getRequisitionList/index.d.ts +1 -1
  10. package/api/index.d.ts +1 -0
  11. package/api/updateRequisitionListItems/index.d.ts +1 -1
  12. package/api/updateRequisitionListItems/updateRequisitionListItems.d.ts +11 -2
  13. package/api.js +2 -2
  14. package/api.js.map +1 -1
  15. package/chunks/RequisitionListForm.js +3 -3
  16. package/chunks/RequisitionListForm.js.map +1 -1
  17. package/chunks/RequisitionListItemsFragment.graphql.js +95 -0
  18. package/chunks/RequisitionListItemsFragment.graphql.js.map +1 -0
  19. package/chunks/deleteRequisitionListItems.js +223 -0
  20. package/chunks/deleteRequisitionListItems.js.map +1 -0
  21. package/chunks/transform-requisition-list.js +2 -2
  22. package/chunks/transform-requisition-list.js.map +1 -1
  23. package/components/EmptyList/EmptyList.d.ts +8 -0
  24. package/components/{RequisitionListItem → EmptyList}/index.d.ts +1 -1
  25. package/components/RequisitionListGridWrapper/RequisitionListGridWrapper.d.ts +8 -2
  26. package/components/RequisitionListView/RequisitionListView.d.ts +29 -0
  27. package/components/RequisitionListView/index.d.ts +3 -0
  28. package/components/index.d.ts +2 -1
  29. package/containers/RequisitionListGrid/RequisitionListGrid.d.ts +3 -2
  30. package/containers/RequisitionListGrid.js +1 -1
  31. package/containers/RequisitionListGrid.js.map +1 -1
  32. package/containers/RequisitionListNames.js +2 -90
  33. package/containers/RequisitionListNames.js.map +1 -1
  34. package/containers/RequisitionListView/RequisitionListView.d.ts +20 -0
  35. package/containers/RequisitionListView/index.d.ts +19 -0
  36. package/containers/RequisitionListView.d.ts +3 -0
  37. package/containers/RequisitionListView.js +4 -0
  38. package/containers/RequisitionListView.js.map +1 -0
  39. package/containers/index.d.ts +1 -0
  40. package/data/models/item.d.ts +16 -5
  41. package/data/models/requisitionList.d.ts +6 -0
  42. package/data/transforms/__fixtures__/requisitionListViewData.d.ts +5 -0
  43. package/data/transforms/index.d.ts +1 -0
  44. package/data/transforms/transform-product.d.ts +118 -0
  45. package/data/transforms/transform-requisition-list.d.ts +3 -0
  46. package/hooks/index.d.ts +19 -0
  47. package/hooks/useRequisitionListGrid.d.ts +21 -0
  48. package/i18n/en_US.json.d.ts +21 -1
  49. package/package.json +1 -1
  50. package/render.js +4 -3
  51. package/render.js.map +1 -1
  52. package/components/RequisitionListItem/RequisitionListItem.d.ts +0 -16
  53. package/data/transforms/__fixtures__/requisitionListItemData.d.ts +0 -5
@@ -0,0 +1,223 @@
1
+ /*! Copyright 2025 Adobe
2
+ All Rights Reserved. */
3
+ import{R as I,f as n,h as u,t as _}from"./transform-requisition-list.js";import{R as T}from"./RequisitionListItemsFragment.graphql.js";function l(i){var e;return{sku:i.sku,parent_sku:i.sku,name:i.name,shortDescription:i.shortDescription||"",metaDescription:i.metaDescription||"",metaKeyword:i.metaKeyword||"",metaTitle:i.metaTitle||"",description:i.description||"",addToCartAllowed:i.addToCartAllowed,url:i.url||"",urlKey:i.urlKey||"",externalId:i.externalId||"",images:((e=i.images)==null?void 0:e.map(t=>({url:t.url,label:t.label||"",roles:t.roles||[]})))||[]}}function a(i){return i!=null&&i.length?i.map(l):[]}const m=`
4
+ query GET_REQUISITION_LIST_QUERY(
5
+ $requisitionListUid: String,
6
+ $currentPage: Int = 1,
7
+ $pageSize: Int = 10,
8
+ ) {
9
+ customer {
10
+ requisition_lists (
11
+ filter: {
12
+ uids: {
13
+ eq: $requisitionListUid
14
+ }
15
+ }
16
+ ){
17
+ items {
18
+ ...REQUISITION_LIST_FRAGMENT
19
+ items(pageSize: $pageSize, currentPage: $currentPage) {
20
+ ...REQUISITION_LIST_ITEMS_FRAGMENT
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ ${T}
27
+ ${I}
28
+ `,q=async(i,e,t)=>n(m,{variables:{requisitionListUid:i,currentPage:e,pageSize:t}}).then(({errors:s,data:r})=>{var o;return s?u(s):(o=r==null?void 0:r.customer)!=null&&o.requisition_lists?_(r.customer.requisition_lists.items[0]):null}),c=`
29
+ mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(
30
+ $requisitionListUid: ID!,
31
+ $requisitionListItems: [UpdateRequisitionListItemsInput!]!,
32
+ ) {
33
+ updateRequisitionListItems(
34
+ requisitionListUid: $requisitionListUid
35
+ requisitionListItems: $requisitionListItems
36
+ ) {
37
+ requisition_list {
38
+ ...REQUISITION_LIST_FRAGMENT
39
+ items {
40
+ ...REQUISITION_LIST_ITEMS_FRAGMENT
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ${I}
46
+ ${T}
47
+ `,p=async(i,e)=>n(c,{variables:{requisitionListUid:i,requisitionListItems:e}}).then(({errors:t,data:s})=>t?u(t):_(s.updateRequisitionListItems.requisition_list)),R=`
48
+ mutation ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION(
49
+ $requisitionListUid: ID!,
50
+ $requisitionListItemUids: [ID!]!
51
+ ) {
52
+ addRequisitionListItemsToCart(
53
+ requisitionListUid: $requisitionListUid
54
+ requisitionListItemUids: $requisitionListItemUids
55
+ ) {
56
+ status
57
+ add_requisition_list_items_to_cart_user_errors {
58
+ message
59
+ type
60
+ }
61
+ }
62
+ }
63
+ `,N=async(i,e)=>n(R,{variables:{requisitionListUid:i,requisitionListItemUids:e}}).then(({errors:t,data:s})=>{var r;return t?u(t):(r=s.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors)!=null&&r.length?s.addRequisitionListItemsToCart.add_requisition_list_items_to_cart_user_errors.map(o=>o.type):null}),E=`
64
+ fragment PRODUCT_FRAGMENT on ProductView {
65
+ __typename
66
+ id
67
+ sku
68
+ name
69
+ shortDescription
70
+ metaDescription
71
+ metaKeyword
72
+ metaTitle
73
+ description
74
+ inStock
75
+ addToCartAllowed
76
+ url
77
+ urlKey
78
+ externalId
79
+ images(roles: []) {
80
+ url
81
+ label
82
+ roles
83
+ }
84
+ attributes(roles: []) {
85
+ name
86
+ label
87
+ value
88
+ roles
89
+ }
90
+ ... on SimpleProductView {
91
+ price {
92
+ roles
93
+ regular {
94
+ amount {
95
+ value
96
+ currency
97
+ }
98
+ }
99
+ final {
100
+ amount {
101
+ value
102
+ currency
103
+ }
104
+ }
105
+ }
106
+ }
107
+ ... on ComplexProductView {
108
+ options {
109
+ ...PRODUCT_OPTION_FRAGMENT
110
+ }
111
+ ...PRICE_RANGE_FRAGMENT
112
+ }
113
+ }
114
+ fragment PRODUCT_OPTION_FRAGMENT on ProductViewOption {
115
+ id
116
+ title
117
+ required
118
+ multi
119
+ values {
120
+ id
121
+ title
122
+ inStock
123
+ __typename
124
+ ... on ProductViewOptionValueProduct {
125
+ title
126
+ quantity
127
+ isDefault
128
+ __typename
129
+ product {
130
+ sku
131
+ shortDescription
132
+ metaDescription
133
+ metaKeyword
134
+ metaTitle
135
+ name
136
+ price {
137
+ final {
138
+ amount {
139
+ value
140
+ currency
141
+ }
142
+ }
143
+ regular {
144
+ amount {
145
+ value
146
+ currency
147
+ }
148
+ }
149
+ roles
150
+ }
151
+ }
152
+ }
153
+ ... on ProductViewOptionValueSwatch {
154
+ id
155
+ title
156
+ type
157
+ value
158
+ inStock
159
+ }
160
+ }
161
+ }
162
+ fragment PRICE_RANGE_FRAGMENT on ComplexProductView {
163
+ priceRange {
164
+ maximum {
165
+ final {
166
+ amount {
167
+ value
168
+ currency
169
+ }
170
+ }
171
+ regular {
172
+ amount {
173
+ value
174
+ currency
175
+ }
176
+ }
177
+ roles
178
+ }
179
+ minimum {
180
+ final {
181
+ amount {
182
+ value
183
+ currency
184
+ }
185
+ }
186
+ regular {
187
+ amount {
188
+ value
189
+ currency
190
+ }
191
+ }
192
+ roles
193
+ }
194
+ }
195
+ }
196
+ `,d=`
197
+ query GET_PRODUCT_DATA($skus: [String]) {
198
+ products(skus: $skus) {
199
+ ...PRODUCT_FRAGMENT
200
+ }
201
+ }
202
+ ${E}
203
+ `,O=async i=>n(d,{variables:{skus:i}}).then(({errors:e,data:t})=>e?u(e):t!=null&&t.products?a(t.products):null),U=`
204
+ mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(
205
+ $requisitionListUid: ID!,
206
+ $requisitionListItemUids: [ID!]!
207
+ ) {
208
+ deleteRequisitionListItems(
209
+ requisitionListUid: $requisitionListUid
210
+ requisitionListItemUids: $requisitionListItemUids
211
+ ) {
212
+ requisition_list {
213
+ ...REQUISITION_LIST_FRAGMENT
214
+ items {
215
+ ...REQUISITION_LIST_ITEMS_FRAGMENT
216
+ }
217
+ }
218
+ }
219
+ }
220
+ ${I}
221
+ ${T}
222
+ `,A=async(i,e)=>n(U,{variables:{requisitionListUid:i,requisitionListItemUids:e}}).then(({errors:t,data:s})=>t?u(t):_(s.deleteRequisitionListItems.requisition_list));export{N as a,q as b,A as d,O as g,p as u};
223
+ //# sourceMappingURL=deleteRequisitionListItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteRequisitionListItems.js","sources":["/@dropins/storefront-requisition-list/src/data/transforms/transform-product.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/graphql/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionList/getRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/graphql/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/updateRequisitionListItems/updateRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/graphql/addRequisitionListItemsToCart.ts","/@dropins/storefront-requisition-list/src/api/addRequisitionListItemsToCart/addRequisitionListItemsToCart.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/deleteRequisitionListItems/graphql/deleteRequisitionListItems.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionListItems/deleteRequisitionListItems.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { Product } from '../models/item';\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 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: data.images?.map((image) => ({\n url: image.url,\n label: image.label || '',\n roles: image.roles || [],\n })) || [],\n };\n}\n\n// Helper function to transform multiple products\nexport function transformProducts(products: RawProductData[]): Product[] {\n if (!products?.length) return [];\n\n return products.map(transformProduct);\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const GET_REQUISITION_LIST_QUERY = `\n query GET_REQUISITION_LIST_QUERY(\n $requisitionListUid: String,\n $currentPage: Int = 1,\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists (\n filter: {\n uids: {\n eq: $requisitionListUid\n }\n }\n ){\n items {\n ...REQUISITION_LIST_FRAGMENT\n items(pageSize: $pageSize, currentPage: $currentPage) {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n }\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LIST_QUERY } from '@/requisitionList/api/getRequisitionList/graphql/getRequisitionList';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport const getRequisitionList = async (\n requisitionListID: string,\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(GET_REQUISITION_LIST_QUERY, {\n variables: {\n requisitionListUid: requisitionListID,\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n return transformRequisitionList(data.customer.requisition_lists.items[0]);\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const UPDATE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation UPDATE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItems: [UpdateRequisitionListItemsInput!]!,\n ) {\n updateRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItems: $requisitionListItems\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { UPDATE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/updateRequisitionListItems/graphql/updateRequisitionListItems';\n\nexport const updateRequisitionListItems = async (\n requisitionListUid: string,\n requisitionListItems: Array<UpdateRequisitionListItemsInput>\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(UPDATE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItems,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n return transformRequisitionList(\n data.updateRequisitionListItems.requisition_list\n );\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 *******************************************************************/\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 }\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\n return null;\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 *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\nimport { REQUISITION_LIST_ITEMS_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListItemsFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_ITEMS_MUTATION = `\n mutation DELETE_REQUISITION_LIST_ITEMS_MUTATION(\n $requisitionListUid: ID!, \n $requisitionListItemUids: [ID!]!\n ) {\n deleteRequisitionListItems(\n requisitionListUid: $requisitionListUid\n requisitionListItemUids: $requisitionListItemUids\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n items {\n ...REQUISITION_LIST_ITEMS_FRAGMENT\n }\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n${REQUISITION_LIST_ITEMS_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { DELETE_REQUISITION_LIST_ITEMS_MUTATION } from '@/requisitionList/api/deleteRequisitionListItems/graphql/deleteRequisitionListItems';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\n\nexport const deleteRequisitionListItems = async (\n requisitionListUid: string,\n items: Array<string>\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_ITEMS_MUTATION, {\n variables: {\n requisitionListUid,\n requisitionListItemUids: items,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n return transformRequisitionList(\n data.deleteRequisitionListItems.requisition_list\n );\n });\n};\n"],"names":["transformProduct","data","_a","image","transformProducts","products","GET_REQUISITION_LIST_QUERY","REQUISITION_LIST_ITEMS_FRAGMENT","REQUISITION_LIST_FRAGMENT","getRequisitionList","requisitionListID","currentPage","pageSize","fetchGraphQl","errors","handleFetchError","transformRequisitionList","UPDATE_REQUISITION_LIST_ITEMS_MUTATION","updateRequisitionListItems","requisitionListUid","requisitionListItems","ADD_REQUISITION_LIST_ITEMS_TO_CART_MUTATION","addRequisitionListItemsToCart","requisitionListItemUids","e","PRODUCT_FRAGMENT","GET_PRODUCT_DATA_QUERY","getProductData","skus","DELETE_REQUISITION_LIST_ITEMS_MUTATION","deleteRequisitionListItems","items"],"mappings":"uIAqIO,SAASA,EAAiBC,EAA+B,OAC9D,MAAO,CACL,IAAKA,EAAK,IACV,WAAYA,EAAK,IACjB,KAAMA,EAAK,KACX,iBAAkBA,EAAK,kBAAoB,GAC3C,gBAAiBA,EAAK,iBAAmB,GACzC,YAAaA,EAAK,aAAe,GACjC,UAAWA,EAAK,WAAa,GAC7B,YAAaA,EAAK,aAAe,GACjC,iBAAkBA,EAAK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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,GAEOf,EAAaa,EAAwB,CAC1C,UAAW,CACT,KAAAE,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAd,EAAQ,KAAAb,KACba,EAAeC,EAAiBD,CAAM,EAErCb,GAAA,MAAAA,EAAM,SAIJG,EAAkBH,EAAK,QAAQ,EAH7B,IAIV,ECnBU4B,EAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBpDrB,CAAyB;AAAA,EACzBD,CAA+B;AAAA,ECdpBuB,EAA6B,MACxCX,EACAY,IAEOlB,EAAagB,EAAwC,CAC1D,UAAW,CACT,mBAAAV,EACA,wBAAyBY,CAAA,CAC3B,CACD,EAAE,KAAK,CAAC,CAAE,OAAAjB,EAAQ,KAAAb,KACba,EAAeC,EAAiBD,CAAM,EAEnCE,EACLf,EAAK,2BAA2B,gBAAA,CAEnC"}
@@ -1,6 +1,6 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{FetchGraphQL as s}from"@dropins/tools/fetch-graphql.js";const{setEndpoint:u,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:_,setFetchGraphQlHeaders:l,fetchGraphQl:p,getConfig:d}=new s().getMethods(),c=o=>{const r=o.map(e=>e.message).join(" ");throw Error(r)},b=`
3
+ import{FetchGraphQL as s}from"@dropins/tools/fetch-graphql.js";const{setEndpoint:u,setFetchGraphQlHeader:n,removeFetchGraphQlHeader:_,setFetchGraphQlHeaders:l,fetchGraphQl:p,getConfig:c}=new s().getMethods(),d=r=>{const o=r.map(e=>e.message).join(" ");throw Error(o)},b=`
4
4
  fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
5
5
  uid
6
6
  name
@@ -8,5 +8,5 @@ fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
8
8
  items_count
9
9
  updated_at
10
10
  }
11
- `;function f(o){var r;return{uid:o.uid,name:o.name,description:o.description,updated_at:o.updated_at,items_count:o.items_count,items:a((r=o.items)==null?void 0:r.items)}}function a(o){return o!=null&&o.length?o.map(r=>({uid:r.uid,quantity:r.quantity,customizable_options:r.customizable_options?r.customizable_options.map(e=>({uid:e.customizable_option_uid,is_required:e.is_required,label:e.label,sort_order:e.sort_order,type:e.type,values:e.values.map(t=>({uid:t.customizable_option_value_uid,label:t.label,price:t.price,value:t.value}))})):[],bundle_options:r.bundle_options||[],configurable_options:r.configurable_options?r.configurable_options.map(e=>({option_uid:e.configurable_product_option_uid,option_label:e.option_label,value_uid:e.configurable_product_option_value_uid,value_label:e.value_label})):[],samples:r.samples?r.samples.map(e=>({url:e.sample_url,sort_order:e.sort_order,title:e.title})):[],gift_card_options:r.gift_card_options||{}})):[]}export{b as R,n as a,l as b,p as f,d as g,c as h,_ as r,u as s,f as t};
11
+ `;function f(r){var o,e;return{uid:r.uid,name:r.name,description:r.description,updated_at:r.updated_at,items_count:r.items_count,items:a((o=r.items)==null?void 0:o.items),page_info:(e=r.items)==null?void 0:e.page_info}}function a(r){return r!=null&&r.length?r.map(o=>({uid:o.uid,sku:o.product.sku,quantity:o.quantity,customizable_options:o.customizable_options?o.customizable_options.map(e=>({uid:e.customizable_option_uid,is_required:e.is_required,label:e.label,sort_order:e.sort_order,type:e.type,values:e.values.map(t=>({uid:t.customizable_option_value_uid,label:t.label,price:t.price,value:t.value}))})):[],bundle_options:o.bundle_options||[],configurable_options:o.configurable_options?o.configurable_options.map(e=>({option_uid:e.configurable_product_option_uid,option_label:e.option_label,value_uid:e.configurable_product_option_value_uid,value_label:e.value_label})):[],samples:o.samples?o.samples.map(e=>({url:e.sample_url,sort_order:e.sort_order,title:e.title})):[],gift_card_options:o.gift_card_options||{}})):[]}export{b as R,n as a,l as b,p as f,c as g,d as h,_ as r,u as s,f as t};
12
12
  //# sourceMappingURL=transform-requisition-list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform-requisition-list.js","sources":["/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.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 { 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\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\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 { Item } 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 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 };\n}\n\n// Interface for raw item data\ninterface RawItemData {\n uid: string;\n quantity: number;\n customizable_options?: {\n customizable_option_uid: string;\n is_required: boolean;\n label: string;\n sort_order: number;\n type: string;\n values: {\n customizable_option_value_uid: string;\n label: string;\n price: { type: string; units: string; value: number };\n value: string;\n }[];\n }[];\n bundle_options?: {\n uid: string;\n label: string;\n type: string;\n values: {\n uid: string;\n label: string;\n original_price: { value: number; currency: string };\n priceV2: { value: number; currency: string };\n quantity: number;\n }[];\n }[];\n configurable_options?: {\n configurable_product_option_uid: string;\n option_label: string;\n configurable_product_option_value_uid: string;\n value_label: string;\n }[];\n links?: {\n uid: string;\n price?: number;\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n samples?: {\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n gift_card_options?: {\n amount?: {\n value?: number;\n currency?: string;\n };\n custom_giftcard_amount?: {\n value?: number;\n currency?: string;\n };\n message?: string;\n recipient_email?: string;\n recipient_name?: string;\n sender_name?: string;\n sender_email?: string;\n };\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n return {\n uid: item.uid,\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}\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleFetchError","errors","errorMessage","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","items","item","option","value","sample"],"mappings":"+DAmBO,KAAM,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,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ition-list.js","sources":["/@dropins/storefront-requisition-list/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-requisition-list/src/lib/fetch-error.ts","/@dropins/storefront-requisition-list/src/api/fragments/RequisitionListFragment.graphql.ts","/@dropins/storefront-requisition-list/src/data/transforms/transform-requisition-list.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 { 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\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\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 { Item } 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 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?: {\n customizable_option_uid: string;\n is_required: boolean;\n label: string;\n sort_order: number;\n type: string;\n values: {\n customizable_option_value_uid: string;\n label: string;\n price: { type: string; units: string; value: number };\n value: string;\n }[];\n }[];\n bundle_options?: {\n uid: string;\n label: string;\n type: string;\n values: {\n uid: string;\n label: string;\n original_price: { value: number; currency: string };\n priceV2: { value: number; currency: string };\n quantity: number;\n }[];\n }[];\n configurable_options?: {\n configurable_product_option_uid: string;\n option_label: string;\n configurable_product_option_value_uid: string;\n value_label: string;\n }[];\n links?: {\n uid: string;\n price?: number;\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n samples?: {\n sample_url?: string;\n sort_order?: number;\n title?: string;\n }[];\n gift_card_options?: {\n amount?: {\n value?: number;\n currency?: string;\n };\n custom_giftcard_amount?: {\n value?: number;\n currency?: string;\n };\n message?: string;\n recipient_email?: string;\n recipient_name?: string;\n sender_name?: string;\n sender_email?: string;\n };\n}\n\nfunction transformItems(items: RawItemData[]): Item[] {\n if (!items?.length) return [];\n\n return items.map((item: RawItemData) => {\n return {\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}\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleFetchError","errors","errorMessage","REQUISITION_LIST_FRAGMENT","transformRequisitionList","data","transformItems","_a","_b","items","item","option","value","sample"],"mappings":"+DAmBO,KAAM,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAA,EAAe,WAAA,ECRVC,EAAoBC,GAAuC,CACtE,MAAMC,EAAeD,EAAO,IAAK,GAAW,EAAE,OAAO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 import { FunctionComponent } from 'preact';
2
+
3
+ export interface EmptyListProps {
4
+ className?: string;
5
+ textContent?: string | null;
6
+ }
7
+ export declare const EmptyList: FunctionComponent<EmptyListProps>;
8
+ //# sourceMappingURL=EmptyList.d.ts.map
@@ -15,5 +15,5 @@
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
17
  export * from '.';
18
- export { RequisitionListItem } from './RequisitionListItem';
18
+ export { EmptyList } from './EmptyList';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1,13 +1,19 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { FunctionComponent, VNode } from 'preact';
3
- import { RequisitionLists as RequisitionListsModel } from '../../data/models/requisitionLists';
4
3
 
5
4
  export interface RequisitionListGridWrapperProps extends HTMLAttributes<HTMLDivElement> {
6
5
  className?: string;
7
- requisitionLists?: RequisitionListsModel;
8
6
  isLoading?: boolean;
9
7
  addReqList?: boolean;
10
8
  header?: VNode;
9
+ rows: Array<Record<string, VNode | string | number | undefined>>;
10
+ expandedRows: Set<number>;
11
+ skeletonRowCount: number;
12
+ pageInfo?: {
13
+ total_pages: number;
14
+ current_page: number;
15
+ };
16
+ handlePageChange: (page?: number) => Promise<void>;
11
17
  }
12
18
  export declare const RequisitionListGridWrapper: FunctionComponent<RequisitionListGridWrapperProps>;
13
19
  //# sourceMappingURL=RequisitionListGridWrapper.d.ts.map
@@ -0,0 +1,29 @@
1
+ import { HTMLAttributes } from 'preact/compat';
2
+ import { RequisitionList } from '../../data/models/requisitionList';
3
+
4
+ export interface RequisitionListViewProps extends HTMLAttributes<HTMLDivElement> {
5
+ currentRequisitionList: RequisitionList;
6
+ loadingProducts?: boolean;
7
+ productError?: string | null;
8
+ selectedItems: Set<string>;
9
+ deletingItemId: string | null;
10
+ deleteError: string | null;
11
+ addingToCartItemId: string | null;
12
+ addToCartError: string | null;
13
+ bulkAddingToCart: boolean;
14
+ updatingQuantityItemId: string | null;
15
+ updateQuantityError: string | null;
16
+ onItemSelection: (itemUid: string, isSelected: boolean) => void;
17
+ onSelectAll: () => void;
18
+ onSelectNone: () => void;
19
+ onAddToCart: (itemUid: string) => void;
20
+ onBulkAddToCart: () => void;
21
+ onBulkDelete: () => void;
22
+ onUpdateQuantity: (itemUid: string, newQuantity: number) => void;
23
+ onDeleteItem: (itemUid: string) => void;
24
+ onPageChange?: (page: number) => void;
25
+ loadingPage?: boolean;
26
+ routeRequisitionListGrid?: () => string | void;
27
+ }
28
+ export declare const RequisitionListView: ({ currentRequisitionList, loadingProducts, productError, selectedItems, deletingItemId, deleteError, addingToCartItemId, addToCartError, bulkAddingToCart, updatingQuantityItemId, updateQuantityError, onItemSelection, onSelectAll, onSelectNone, onAddToCart, onBulkAddToCart, onBulkDelete, onUpdateQuantity, onDeleteItem, onPageChange, loadingPage, routeRequisitionListGrid, }: RequisitionListViewProps) => import("preact/compat").JSX.Element;
29
+ //# sourceMappingURL=RequisitionListView.d.ts.map
@@ -0,0 +1,3 @@
1
+ export { RequisitionListView } from './RequisitionListView';
2
+ export type { RequisitionListViewProps } from './RequisitionListView';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -15,8 +15,9 @@
15
15
  * from Adobe.
16
16
  *******************************************************************/
17
17
  export * from './RequisitionListForm/RequisitionListForm';
18
- export * from './RequisitionListItem/RequisitionListItem';
19
18
  export * from './RequisitionListGridWrapper/RequisitionListGridWrapper';
20
19
  export * from './RequisitionListActions/RequisitionListActions';
21
20
  export * from './RequisitionListModal/RequisitionListModal';
21
+ export * from './RequisitionListView/RequisitionListView';
22
+ export * from './EmptyList/EmptyList';
22
23
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,10 @@
1
1
  import { HTMLAttributes } from 'preact/compat';
2
2
  import { Container, SlotProps } from '@dropins/tools/types/elsie/src/lib';
3
- import { RequisitionList as RequisitionListModel } from '../../data/models/requisitionList';
3
+ import { RequisitionLists as RequisitionListsModel } from '../../data/models/requisitionLists';
4
4
 
5
5
  export interface RequisitionListGridProps extends HTMLAttributes<HTMLDivElement> {
6
- requisitionLists?: RequisitionListModel[] | null;
6
+ requisitionLists?: RequisitionListsModel | null;
7
+ routeRequisitionListDetails?: (uid: string) => string | void;
7
8
  slots?: {
8
9
  Header?: SlotProps;
9
10
  };
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsxs as c,jsx as i}from"@dropins/tools/preact-jsx-runtime.js";import*as f from"@dropins/tools/preact-compat.js";import{useState as p,useCallback as y,useEffect as O}from"@dropins/tools/preact-compat.js";import{Button as _,Card as B,Pagination as S,Icon as H,Modal as M,ProgressSpinner as U,Header as z}from"@dropins/tools/components.js";import{classes as r,VComponent as D,Slot as j}from"@dropins/tools/lib.js";import{g as I}from"../chunks/getRequisitionLists.js";import"@dropins/tools/preact-hooks.js";import{R as E}from"../chunks/RequisitionListForm.js";/* empty css */import{useText as h}from"@dropins/tools/i18n.js";import{d as G}from"../chunks/deleteRequisitionList.js";import"../chunks/transform-requisition-list.js";import"@dropins/tools/fetch-graphql.js";const V=({className:n,requisitionList:e,onEdit:a,onRemoveBtnClick:d,...m})=>{const s=h({actionRemove:"RequisitionList.RequisitionListItem.actionRemove",actionRename:"RequisitionList.RequisitionListItem.actionRename"}),t=()=>{a&&a(e.uid,{name:e.name,description:e.description||""})};return c("div",{...m,"data-testid":"requisition-list-item",className:r(["requisition-list-item__row",n]),children:[c("div",{className:r(["requisition-list-item__cell",n]),children:[i("strong",{className:"requisition-list-item__name",children:e.name}),i("div",{className:"requisition-list-item__description",children:e.description})]}),i("div",{className:r(["requisition-list-item__cell","requisition-list-item__items_count",n]),children:e.items_count}),i("div",{className:r(["requisition-list-item__cell","requisition-list-item__updated_at",n]),children:e.updated_at}),c("div",{className:r(["requisition-list-item__cell","requisition-list-item__actions",n]),children:[i(_,{type:"button",variant:"tertiary",onClick:t,"data-testid":"rename-button",children:s.actionRename}),i(_,{variant:"tertiary",type:"button","data-testid":"remove-button",onClick:()=>d(e,{isOpen:!0}),children:s.actionRemove})]})]})},F=({className:n,requisitionLists:e,header:a,addReqList:d=!1,...m})=>{var A,N,k;const s=h({name:"RequisitionList.RequisitionListWrapper.name",itemsCount:"RequisitionList.RequisitionListWrapper.itemsCount",lastUpdated:"RequisitionList.RequisitionListWrapper.lastUpdated",actions:"RequisitionList.RequisitionListWrapper.actions",loginMsg:"RequisitionList.RequisitionListWrapper.loginMsg",confirmRemove:"RequisitionList.RequisitionListWrapper.confirmRemove",confirmRemoveContent:"RequisitionList.RequisitionListWrapper.confirmRemoveContent",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction"}),[t,l]=p(e),[u,q]=p({isOpen:!1,isLoading:!1}),[g,L]=p(),T=(o,R)=>{L(o),q({...R,isOpen:!0})},v=y(()=>{q({...u,isOpen:!1,isLoading:!1}),L(null)},[u,L,q]),W=y(async()=>{q({...u,isLoading:!0});const o=await G(g==null?void 0:g.uid);l({items:o.items,page_info:o.page_info}),v()},[g,l,u,v]),[P,w]=p(null),[x,C]=p(d),b=async(o=(R=>(R=t==null?void 0:t.page_info)==null?void 0:R.current_page)()??1)=>{l(await I(o))};return c("div",{...m,className:r(["requisition-list-grid-wrapper",n]),"data-testid":"requisition-list-grid-wrapper",children:[a&&i("div",{className:r(["requisition-list-grid-wrapper__header",n]),"data-testid":"requisition-list-grid-wrapper-header",children:i(D,{node:a})}),u.isOpen&&i(Q,{isOpen:u.isOpen,isLoading:u.isLoading,title:s.confirmRemove,modalContent:s.confirmRemoveContent,confirmBtnCaption:s.confirmAction,closeBtnCaption:s.cancelAction,handleModalOnClose:v,handleModalOnConfirm:W}),i("div",{className:r(["requisition-list-grid-wrapper__add-new",n]),children:x?i(B,{variant:"secondary",children:i(E,{mode:"create",onSuccess:async()=>{await b(),C(!1)},onCancel:()=>C(!1)})}):i(K,{onAddNew:()=>C(!0)})}),c("div",{className:r(["dropin-card dropin-card--secondary requisition-list-grid-wrapper__content",n]),children:[c("div",{className:r(["requisition-list-grid-wrapper__list-header",n]),children:[i("h5",{children:s.name}),i("h5",{children:s.itemsCount}),i("h5",{children:s.lastUpdated}),i("h5",{children:s.actions})]}),(A=t==null?void 0:t.items)==null?void 0:A.map(o=>P===o.uid?i(B,{variant:"secondary",className:"requisition-list-grid-wrapper__form-row",children:i(E,{mode:"edit",requisitionListUid:o.uid,defaultValues:{name:o.name,description:o.description},onSuccess:async()=>{await b(),w(null)},onCancel:()=>w(null)})},o.uid):i(V,{requisitionList:o,onEdit:R=>w(R),onRemoveBtnClick:T},o.uid)),i("div",{className:r(["requisition-list-grid-wrapper__pagination",n]),children:i(S,{totalPages:(N=t==null?void 0:t.page_info)==null?void 0:N.total_pages,currentPage:(k=t==null?void 0:t.page_info)==null?void 0:k.current_page,onChange:b})})]})]})},J=n=>f.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...n},f.createElement("g",{id:"Large"},f.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),f.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},f.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),f.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),K=({selectable:n,className:e,onAddNew:a})=>{const d=h({addNewReqListBtn:"RequisitionList.AddNewReqList.addNewReqListBtn"});return c("button",{type:"button","aria-label":d.addNewReqListBtn,role:"button",className:r(["requisition-list-actions",["requisition-list-actions--selectable",n],e]),"data-testid":"requisition-list-actions-button",onClick:a,children:[i("span",{className:"requisition-list-actions__title","data-testid":"requisition-list-actions-button-text",children:d.addNewReqListBtn}),i(H,{source:J,size:"32"})]})},Q=({isOpen:n,isLoading:e,title:a,modalContent:d,closeBtnCaption:m,confirmBtnCaption:s,handleModalOnClose:t,handleModalOnConfirm:l})=>n?i(M,{className:"requisition-list-modal--overlay","data-testid":"requisition-list-modal",size:"medium",centered:!1,title:a,onClose:t,backgroundDim:!0,clickToDismiss:!0,escapeToDismiss:!0,children:c("div",{className:"requisition-list-modal",children:[e?i("div",{className:"requisition-list-modal__spinner","data-testid":"progress-spinner",children:i(U,{stroke:"4",size:"large"})}):null,i("p",{children:d}),c("div",{className:"requisition-list-modal__buttons",children:[t&&i(_,{"data-testid":"rl-modal-close-button",type:"button",onClick:t,variant:"secondary",disabled:e,children:m}),l&&i(_,{"data-testid":"rl-modal-confirm-button",type:"button",onClick:l,disabled:e,children:s})]})]})}):null,di=({requisitionLists:n,slots:e})=>{const[a,d]=p(n),[m,s]=p(!1),t=h({containerTitle:"RequisitionList.containerTitle"});O(()=>{if(a!==null)return;(async()=>{s(!0);const q=await I();d(q),s(!1)})()},[a]);const l=y(()=>e!=null&&e.Header?i(j,{name:"Header","aria-label":t.containerTitle,title:t.containerTitle,slot:e.Header}):i(z,{"aria-label":t.containerTitle,role:"region",title:t.containerTitle}),[e,t.containerTitle]);return i(F,{header:l(),requisitionLists:a,isLoading:m})};export{di as RequisitionListGrid,di as default};
3
+ import{jsxs as u,jsx as i,Fragment as x}from"@dropins/tools/preact-jsx-runtime.js";import*as g from"@dropins/tools/preact-compat.js";import{useState as Z,useCallback as v,useEffect as D,useMemo as E}from"@dropins/tools/preact-compat.js";import{Card as B,Table as z,Pagination as F,Icon as V,Modal as O,ProgressSpinner as U,Button as b,Header as G}from"@dropins/tools/components.js";import{classes as w,VComponent as j,Slot as J}from"@dropins/tools/lib.js";import"@dropins/tools/preact-hooks.js";import{R as T}from"../chunks/RequisitionListForm.js";/* empty css *//* empty css */import{useText as H}from"@dropins/tools/i18n.js";import{g as k}from"../chunks/getRequisitionLists.js";import{d as K}from"../chunks/deleteRequisitionList.js";import"../chunks/transform-requisition-list.js";import"@dropins/tools/fetch-graphql.js";const Q=({className:n,isLoading:s=!1,addReqList:a=!1,header:r,rows:e=[],expandedRows:p,skeletonRowCount:l=10,pageInfo:o,handlePageChange:f,...C})=>{const L=H({name:"RequisitionList.RequisitionListWrapper.name",itemsCount:"RequisitionList.RequisitionListWrapper.itemsCount",lastUpdated:"RequisitionList.RequisitionListWrapper.lastUpdated",actions:"RequisitionList.RequisitionListWrapper.actions",emptyList:"RequisitionList.RequisitionListWrapper.emptyList"}),[h,d]=Z(a),c=((o==null?void 0:o.total_pages)??0)>0,R=!s&&e.length===0&&!c;return u("div",{...C,className:w(["requisition-list-grid-wrapper",n]),"data-testid":"requisition-list-grid-wrapper",children:[r&&i("div",{className:w(["requisition-list-grid-wrapper__header",n]),"data-testid":"requisition-list-grid-wrapper-header",children:i(j,{node:r})}),i("div",{className:w(["requisition-list-grid-wrapper__add-new",n]),children:h?i(B,{variant:"secondary",children:i(T,{mode:"create",onSuccess:async()=>{await f(),d(!1)},onCancel:()=>d(!1)})}):i($,{onAddNew:()=>d(!0)})}),R?i(i1,{textContent:L.emptyList}):u(x,{children:[i(z,{columns:[{key:"name",label:L.name},{key:"items_count",label:L.itemsCount},{key:"last_updated",label:L.lastUpdated},{key:"actions",label:L.actions}],rowData:e,expandedRows:p,loading:s,skeletonRowCount:l}),i("div",{className:w(["requisition-list-grid-wrapper__pagination",n]),children:i(F,{totalPages:o==null?void 0:o.total_pages,currentPage:o==null?void 0:o.current_page,onChange:f})})]})]})},X=n=>g.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...n},g.createElement("g",{id:"Large"},g.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),g.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},g.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),g.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),Y=n=>g.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},g.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"currentColor"})),$=({selectable:n,className:s,onAddNew:a})=>{const r=H({addNewReqListBtn:"RequisitionList.AddNewReqList.addNewReqListBtn"});return u("button",{type:"button","aria-label":r.addNewReqListBtn,role:"button",className:w(["requisition-list-actions",["requisition-list-actions--selectable",n],s]),"data-testid":"requisition-list-actions-button",onClick:a,children:[i("span",{className:"requisition-list-actions__title","data-testid":"requisition-list-actions-button-text",children:r.addNewReqListBtn}),i(V,{source:X,size:"32"})]})},I=({isOpen:n,isLoading:s,title:a,modalContent:r,closeBtnCaption:e,confirmBtnCaption:p,handleModalOnClose:l,handleModalOnConfirm:o})=>n?i(O,{className:"requisition-list-modal--overlay","data-testid":"requisition-list-modal",size:"medium",centered:!1,title:a,onClose:l,backgroundDim:!0,clickToDismiss:!0,escapeToDismiss:!0,children:u("div",{className:"requisition-list-modal",children:[s?i("div",{className:"requisition-list-modal__spinner","data-testid":"progress-spinner",children:i(U,{stroke:"4",size:"large"})}):null,i("p",{children:r}),u("div",{className:"requisition-list-modal__buttons",children:[l&&i(b,{"data-testid":"rl-modal-close-button",type:"button",onClick:l,variant:"secondary",disabled:s,children:e}),o&&i(b,{"data-testid":"rl-modal-confirm-button",type:"button",onClick:o,disabled:s,children:p})]})]})}):null,i1=({className:n,textContent:s,...a})=>u("div",{className:w(["empty-list",n]),"data-testid":"empty-list",...a,children:[i(V,{source:Y,size:"64",stroke:"2"}),s&&i("h4",{children:s})]});function e1(n,s,a){const r=H({actionRemove:"RequisitionList.RequisitionListItem.actionRemove",actionRename:"RequisitionList.RequisitionListItem.actionRename"}),[e,p]=Z(n),[l,o]=Z(null),[f,C]=Z(!1),L=v(t=>o(t),[]),h=v(()=>o(null),[]),d=v(async(t=(_=>(_=e==null?void 0:e.page_info)==null?void 0:_.current_page)()??1)=>{var y,M,A;C(!0);try{const m=await k(t),N=((y=m==null?void 0:m.page_info)==null?void 0:y.current_page)??1,P=((M=m==null?void 0:m.page_info)==null?void 0:M.total_pages)??0;if(!((((A=m==null?void 0:m.items)==null?void 0:A.length)??0)>0)&&N>1&&P>=N-1){const W=N-1,S=await k(W);p(S)}else p(m)}finally{C(!1)}},[e]);D(()=>{e||d(1)},[e,d]);const c=v(t=>d(t),[d]),R=E(()=>((e==null?void 0:e.items)??[]).map(t=>{const _=l===t.uid;return{name:u("div",{className:"requisition-list-grid-wrapper__name",children:[i("div",{className:"requisition-list-grid-wrapper__name__title",children:i("a",{href:"#",onClick:y=>{if(y.preventDefault(),a){const M=a(t.uid);typeof M=="string"&&(window.location.href=M)}},children:t.name})}),t.description&&i("div",{className:"requisition-list-grid-wrapper__name__description",children:t.description})]}),items_count:t.items_count,last_updated:new Date(t.updated_at).toLocaleString(),actions:u("div",{className:"requisition-list-grid-wrapper__actions",children:[i(b,{variant:"tertiary",type:"button","data-testid":"rename-button",onClick:()=>L(t.uid),children:r.actionRename}),i(b,{variant:"tertiary",type:"button","data-testid":"remove-button",onClick:()=>s==null?void 0:s.openRemove(t),children:r.actionRemove})]}),_rowDetails:_?i(B,{variant:"secondary",className:"requisition-list-grid-wrapper__form-row",children:i(T,{mode:"edit",requisitionListUid:t.uid,defaultValues:{name:t.name,description:t.description},onSuccess:async()=>{await c(),o(null)},onCancel:h})}):void 0}}),[e==null?void 0:e.items,l,L,h,r.actionRename,r.actionRemove,s,c,a]),q=E(()=>new Set(R.map((t,_)=>t._rowDetails?_:-1).filter(t=>t>=0)),[R]);return{rows:R,expandedRows:q,isLoading:f||!e,pageInfo:e==null?void 0:e.page_info,handlePageChange:c}}const R1=({requisitionLists:n,routeRequisitionListDetails:s,slots:a})=>{const[r,e]=Z({isOpen:!1,isLoading:!1,rl:null}),p=q=>e({isOpen:!0,isLoading:!1,rl:q}),l=()=>e({isOpen:!1,isLoading:!1,rl:null}),o=async()=>{r.rl&&(e(q=>({...q,isLoading:!0})),await K(r.rl.uid),await d(),l())},{rows:f,expandedRows:C,isLoading:L,pageInfo:h,handlePageChange:d}=e1(n,{openRemove:p},s),c=H({containerTitle:"RequisitionList.containerTitle",confirmRemove:"RequisitionList.RequisitionListWrapper.confirmRemove",confirmRemoveContent:"RequisitionList.RequisitionListWrapper.confirmRemoveContent",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction"}),R=v(()=>a!=null&&a.Header?i(J,{name:"Header","aria-label":c.containerTitle,title:c.containerTitle,slot:a.Header}):i(G,{"aria-label":c.containerTitle,role:"region",title:c.containerTitle}),[a,c.containerTitle]);return u(x,{children:[i(Q,{header:R(),rows:f,expandedRows:C,skeletonRowCount:10,isLoading:L,pageInfo:h,handlePageChange:d}),r.isOpen&&i(I,{isOpen:!0,isLoading:r.isLoading,title:c.confirmRemove,modalContent:c.confirmRemoveContent,confirmBtnCaption:c.confirmAction,closeBtnCaption:c.cancelAction,handleModalOnClose:l,handleModalOnConfirm:o})]})};export{R1 as RequisitionListGrid,R1 as default};
4
4
  //# sourceMappingURL=RequisitionListGrid.js.map