@dropins/storefront-requisition-list 0.8.0-beta → 1.0.0-beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/fragments/RequisitionListItemsFragment.graphql.d.ts +1 -1
- package/api.js.map +1 -1
- package/chunks/PageSizePicker.js.map +1 -1
- package/chunks/RequisitionListActions.js.map +1 -1
- package/chunks/RequisitionListForm.js +1 -1
- package/chunks/RequisitionListForm.js.map +1 -1
- package/chunks/RequisitionListForm2.js.map +1 -1
- package/chunks/RequisitionListHeader.js +1 -1
- package/chunks/RequisitionListHeader.js.map +1 -1
- package/chunks/RequisitionListModal.js.map +1 -1
- package/chunks/RequisitionListView.js +1 -1
- package/chunks/RequisitionListView.js.map +1 -1
- package/chunks/addRequisitionListItemsToCart.js.map +1 -1
- package/chunks/deleteRequisitionList.js.map +1 -1
- package/chunks/getRequisitionLists.js.map +1 -1
- package/chunks/state.js.map +1 -1
- package/chunks/updateRequisitionList.js +24 -4
- package/chunks/updateRequisitionList.js.map +1 -1
- package/components/RequisitionListGridWrapper/RequisitionListGridWrapper.d.ts +0 -1
- package/containers/RequisitionListGrid.js +1 -1
- package/containers/RequisitionListGrid.js.map +1 -1
- package/containers/RequisitionListHeader/RequisitionListHeader.d.ts +5 -0
- package/containers/RequisitionListHeader.js +1 -1
- package/containers/RequisitionListSelector.js +2 -2
- package/containers/RequisitionListSelector.js.map +1 -1
- package/containers/RequisitionListView.js +1 -1
- package/containers/RequisitionListView.js.map +1 -1
- package/hooks/useRequisitionListGrid.d.ts +3 -3
- package/package.json +1 -1
- package/render.js +1 -1
- package/render.js.map +1 -1
|
@@ -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,OACvD,MAAA,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,CACxB,MAAO,CAAA,CACX,CACF,CAEO,SAASC,EAAkBC,EAAuC,CACvE,OAAKA,GAAA,MAAAA,EAAU,OAERA,EAAS,IAAIL,CAAgB,EAFN,CAAC,CAGjC,CC/IO,MAAMM,EAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBxCC,CAA+B;AAAA,EAC/BC,CAAyB;AAAA,EC1BdC,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,ECOvB,SA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M,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,CAEH,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAtB,EAAQ,KAAAnB,KAAW,OACxB,OAAAmB,EAAeC,EAAiBD,CAAM,GAGxClB,EAAAD,EAAK,8BACF,iDADH,MAAAC,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtF,GAAW,EAAE,IAChB,EAEK,IAAA,CACR"}
|
|
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,aAA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C,EACmD,OAE5CD,EAAK,8BAA8B,+CAA+C,IACtF,GAAW,EAAE,IAAA,EAGX,IACT,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/graphql/deleteRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/deleteRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_MUTATION = `\n mutation DELETE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n ) {\n deleteRequisitionList(\n requisitionListUid: $requisitionListUid\n ) {\n status\n requisition_lists {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { DELETE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/deleteRequisitionList/graphql/deleteRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionList = async (\n requisitionListUid: string\n): Promise<{\n items: RequisitionList[];\n page_info: any;\n status: any;\n} | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n },\n }).then(({ errors, data }) => {\n if (!requisitionListUid) return null;\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionList?.requisition_lists) {\n return null;\n }\n\n const reqLists =\n data.deleteRequisitionList.requisition_lists?.items?.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n ) || [];\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.deleteRequisitionList?.requisition_lists?.page_info,\n status: data.deleteRequisitionList?.status,\n };\n });\n};\n"],"names":["DELETE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","deleteRequisitionList","requisitionListUid","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","_c","_b","requisitionList","transformRequisitionList","events","_e","_d","_f"],"mappings":"yHAkBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqB9CC,CAAyB;AAAA,ECfdC,EAAwB,MACnCC,GAMOC,EAAaJ,EAAkC,CACpD,UAAW,CACT,mBAAAG,CAAA,
|
|
1
|
+
{"version":3,"file":"deleteRequisitionList.js","sources":["/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/graphql/deleteRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/deleteRequisitionList/deleteRequisitionList.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const DELETE_REQUISITION_LIST_MUTATION = `\n mutation DELETE_REQUISITION_LIST_MUTATION(\n $requisitionListUid: ID!,\n ) {\n deleteRequisitionList(\n requisitionListUid: $requisitionListUid\n ) {\n status\n requisition_lists {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { DELETE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/deleteRequisitionList/graphql/deleteRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const deleteRequisitionList = async (\n requisitionListUid: string\n): Promise<{\n items: RequisitionList[];\n page_info: any;\n status: any;\n} | null> => {\n return fetchGraphQl(DELETE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListUid,\n },\n }).then(({ errors, data }) => {\n if (!requisitionListUid) return null;\n if (errors) return handleFetchError(errors);\n\n if (!data?.deleteRequisitionList?.requisition_lists) {\n return null;\n }\n\n const reqLists =\n data.deleteRequisitionList.requisition_lists?.items?.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n ) || [];\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.deleteRequisitionList?.requisition_lists?.page_info,\n status: data.deleteRequisitionList?.status,\n };\n });\n};\n"],"names":["DELETE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","deleteRequisitionList","requisitionListUid","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","_c","_b","requisitionList","transformRequisitionList","events","_e","_d","_f"],"mappings":"yHAkBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAqB9CC,CAAyB;AAAA,ECfdC,EAAwB,MACnCC,GAMOC,EAAaJ,EAAkC,CACpD,UAAW,CACT,mBAAAG,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,iBAC5B,GAAI,CAACH,EAAoB,OAAO,KAChC,GAAIE,EAAQ,OAAOE,EAAiBF,CAAM,EAE1C,GAAI,GAACG,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,mBAChC,OAAO,KAGT,MAAMC,IACJC,GAAAC,EAAAL,EAAK,sBAAsB,oBAA3B,YAAAK,EAA8C,QAA9C,YAAAD,EAAqD,IAClDE,GAAyBC,EAAyBD,CAAe,KAC/D,CAAA,EAEP,OAAAE,EAAO,KAAK,wBAAyBL,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWM,GAAAC,EAAAV,EAAK,wBAAL,YAAAU,EAA4B,oBAA5B,YAAAD,EAA+C,UAC1D,QAAQE,EAAAX,EAAK,wBAAL,YAAAW,EAA4B,MAAA,CAExC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n const reqLists = data.customer.requisition_lists.items.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n );\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.customer?.requisition_lists?.page_info,\n };\n });\n};\n"],"names":["GET_REQUISITION_LISTS_QUERY","REQUISITION_LIST_FRAGMENT","getRequisitionLists","currentPage","pageSize","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","requisitionList","transformRequisitionList","events","_c","_b"],"mappings":"yHAkBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzCC,CAAyB;AAAA,ECbdC,EAAsB,MACjCC,EACAC,IAEOC,EAAaL,EAA6B,CAC/C,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,
|
|
1
|
+
{"version":3,"file":"getRequisitionLists.js","sources":["/@dropins/storefront-requisition-list/src/api/getRequisitionLists/graphql/getRequisitionLists.ts","/@dropins/storefront-requisition-list/src/api/getRequisitionLists/getRequisitionLists.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const GET_REQUISITION_LISTS_QUERY = `\n query GET_REQUISITION_LISTS_QUERY(\n $currentPage: Int = 1\n $pageSize: Int = 10,\n ) {\n customer {\n requisition_lists(pageSize: $pageSize, currentPage: $currentPage) {\n items {\n ...REQUISITION_LIST_FRAGMENT\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { GET_REQUISITION_LISTS_QUERY } from '@/requisitionList/api/getRequisitionLists/graphql/getRequisitionLists';\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const getRequisitionLists = async (\n currentPage?: number,\n pageSize?: number\n): Promise<RequisitionList[] | null> => {\n return fetchGraphQl(GET_REQUISITION_LISTS_QUERY, {\n variables: {\n currentPage,\n pageSize,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.customer?.requisition_lists) {\n return null;\n }\n\n const reqLists = data.customer.requisition_lists.items.map(\n (requisitionList: any) => transformRequisitionList(requisitionList)\n );\n\n events.emit('requisitionLists/data', reqLists);\n\n return {\n items: reqLists,\n page_info: data.customer?.requisition_lists?.page_info,\n };\n });\n};\n"],"names":["GET_REQUISITION_LISTS_QUERY","REQUISITION_LIST_FRAGMENT","getRequisitionLists","currentPage","pageSize","fetchGraphQl","errors","data","handleFetchError","_a","reqLists","requisitionList","transformRequisitionList","events","_c","_b"],"mappings":"yHAkBO,MAAMA,EAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAmBzCC,CAAyB;AAAA,ECbdC,EAAsB,MACjCC,EACAC,IAEOC,EAAaL,EAA6B,CAC/C,UAAW,CACT,YAAAG,EACA,SAAAC,CAAA,CACF,CACD,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,WAC5B,GAAID,EAAQ,OAAOE,EAAiBF,CAAM,EAE1C,GAAI,GAACG,EAAAF,GAAA,YAAAA,EAAM,WAAN,MAAAE,EAAgB,mBACnB,OAAO,KAGT,MAAMC,EAAWH,EAAK,SAAS,kBAAkB,MAAM,IACpDI,GAAyBC,EAAyBD,CAAe,CAAA,EAGpE,OAAAE,EAAO,KAAK,wBAAyBH,CAAQ,EAEtC,CACL,MAAOA,EACP,WAAWI,GAAAC,EAAAR,EAAK,WAAL,YAAAQ,EAAe,oBAAf,YAAAD,EAAkC,SAAA,CAEjD,CAAC"}
|
package/chunks/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sources":["/@dropins/storefront-requisition-list/src/lib/state.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 { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport type StoreConfig = {\n is_requisition_list_active?: string;\n company_enabled?: boolean;\n [key: string]: any; // Allow additional config properties\n};\n\ntype State = {\n authenticated: boolean;\n config: StoreConfig | undefined;\n requisitionLists: RequisitionList[];\n requisitionListsLoading: boolean;\n requisitionListsVersion: number;\n};\n\nconst _state: State = (() => {\n return {\n authenticated: false,\n config: undefined,\n requisitionLists: [],\n requisitionListsLoading: false,\n requisitionListsVersion: 0,\n };\n})();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n return Reflect.set(target, key, value);\n },\n get(target, key) {\n return target[key as keyof State];\n },\n});\n\n// Helper functions for managing requisition lists\nexport const setRequisitionLists = (lists: RequisitionList[]) => {\n state.requisitionLists = lists;\n state.requisitionListsVersion++;\n};\n\nexport const addRequisitionList = (list: RequisitionList) => {\n state.requisitionLists = [...state.requisitionLists, list];\n state.requisitionListsVersion++;\n};\n\nexport const updateRequisitionList = (list: RequisitionList) => {\n const exists = state.requisitionLists.some(\n (l: RequisitionList) => l.uid === list.uid\n );\n\n if (exists) {\n state.requisitionLists = state.requisitionLists.map((l: RequisitionList) =>\n l.uid === list.uid ? list : l\n );\n } else {\n state.requisitionLists = [...state.requisitionLists, list];\n }\n state.requisitionListsVersion++;\n};\n\nexport const getRequisitionListsFromState = () => {\n return state.requisitionLists;\n};\n\nexport const setRequisitionListsLoading = (loading: boolean) => {\n state.requisitionListsLoading = loading;\n};\n"],"names":["_state","state","target","key","value","setRequisitionLists","lists","updateRequisitionList","list","l","setRequisitionListsLoading","loading"],"mappings":"AAiCA,MAAMA,EACG,CACL,cAAe,GACf,OAAQ,OACR,iBAAkB,
|
|
1
|
+
{"version":3,"file":"state.js","sources":["/@dropins/storefront-requisition-list/src/lib/state.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 { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport type StoreConfig = {\n is_requisition_list_active?: string;\n company_enabled?: boolean;\n [key: string]: any; // Allow additional config properties\n};\n\ntype State = {\n authenticated: boolean;\n config: StoreConfig | undefined;\n requisitionLists: RequisitionList[];\n requisitionListsLoading: boolean;\n requisitionListsVersion: number;\n};\n\nconst _state: State = (() => {\n return {\n authenticated: false,\n config: undefined,\n requisitionLists: [],\n requisitionListsLoading: false,\n requisitionListsVersion: 0,\n };\n})();\n\n// Proxy state to allow reactivity\nexport const state = new Proxy(_state, {\n set(target, key, value) {\n return Reflect.set(target, key, value);\n },\n get(target, key) {\n return target[key as keyof State];\n },\n});\n\n// Helper functions for managing requisition lists\nexport const setRequisitionLists = (lists: RequisitionList[]) => {\n state.requisitionLists = lists;\n state.requisitionListsVersion++;\n};\n\nexport const addRequisitionList = (list: RequisitionList) => {\n state.requisitionLists = [...state.requisitionLists, list];\n state.requisitionListsVersion++;\n};\n\nexport const updateRequisitionList = (list: RequisitionList) => {\n const exists = state.requisitionLists.some(\n (l: RequisitionList) => l.uid === list.uid\n );\n\n if (exists) {\n state.requisitionLists = state.requisitionLists.map((l: RequisitionList) =>\n l.uid === list.uid ? list : l\n );\n } else {\n state.requisitionLists = [...state.requisitionLists, list];\n }\n state.requisitionListsVersion++;\n};\n\nexport const getRequisitionListsFromState = () => {\n return state.requisitionLists;\n};\n\nexport const setRequisitionListsLoading = (loading: boolean) => {\n state.requisitionListsLoading = loading;\n};\n"],"names":["_state","state","target","key","value","setRequisitionLists","lists","updateRequisitionList","list","l","setRequisitionListsLoading","loading"],"mappings":"AAiCA,MAAMA,EACG,CACL,cAAe,GACf,OAAQ,OACR,iBAAkB,CAAA,EAClB,wBAAyB,GACzB,wBAAyB,CAAA,EAKhBC,EAAQ,IAAI,MAAMD,EAAQ,CACrC,IAAIE,EAAQC,EAAKC,EAAO,CACtB,OAAO,QAAQ,IAAIF,EAAQC,EAAKC,CAAK,CACvC,EACA,IAAIF,EAAQC,EAAK,CACf,OAAOD,EAAOC,CAAkB,CAClC,CACF,CAAC,EAGYE,EAAuBC,GAA6B,CAC/DL,EAAM,iBAAmBK,EACzBL,EAAM,yBACR,EAOaM,EAAyBC,GAA0B,CAC/CP,EAAM,iBAAiB,KACnCQ,GAAuBA,EAAE,MAAQD,EAAK,GAAA,EAIvCP,EAAM,iBAAmBA,EAAM,iBAAiB,IAAKQ,GACnDA,EAAE,MAAQD,EAAK,IAAMA,EAAOC,CAAA,EAG9BR,EAAM,iBAAmB,CAAC,GAAGA,EAAM,iBAAkBO,CAAI,EAE3DP,EAAM,yBACR,EAMaS,EAA8BC,GAAqB,CAC9DV,EAAM,wBAA0BU,CAClC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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:
|
|
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=`
|
|
4
4
|
fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
|
|
5
5
|
uid
|
|
6
6
|
name
|
|
@@ -8,7 +8,7 @@ fragment REQUISITION_LIST_FRAGMENT on RequisitionList {
|
|
|
8
8
|
items_count
|
|
9
9
|
updated_at
|
|
10
10
|
}
|
|
11
|
-
`;function 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,
|
|
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=`
|
|
12
12
|
fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
|
|
13
13
|
items {
|
|
14
14
|
uid
|
|
@@ -55,6 +55,26 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
|
|
|
55
55
|
title
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
... on BundleRequisitionListItem {
|
|
59
|
+
bundle_options {
|
|
60
|
+
uid
|
|
61
|
+
type
|
|
62
|
+
label
|
|
63
|
+
values {
|
|
64
|
+
uid
|
|
65
|
+
label
|
|
66
|
+
quantity
|
|
67
|
+
priceV2 {
|
|
68
|
+
value
|
|
69
|
+
currency
|
|
70
|
+
}
|
|
71
|
+
original_price {
|
|
72
|
+
value
|
|
73
|
+
currency
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
58
78
|
... on GiftCardRequisitionListItem {
|
|
59
79
|
gift_card_options {
|
|
60
80
|
amount {
|
|
@@ -79,7 +99,7 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
|
|
|
79
99
|
total_pages
|
|
80
100
|
}
|
|
81
101
|
}
|
|
82
|
-
`,
|
|
102
|
+
`,b=`
|
|
83
103
|
mutation UPDATE_REQUISITION_LIST_MUTATION(
|
|
84
104
|
$requisitionListUid: ID!,
|
|
85
105
|
$name: String!,
|
|
@@ -104,5 +124,5 @@ fragment REQUISITION_LIST_ITEMS_FRAGMENT on RequistionListItems {
|
|
|
104
124
|
}
|
|
105
125
|
${d}
|
|
106
126
|
${g}
|
|
107
|
-
`,
|
|
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};
|
|
108
128
|
//# 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 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":"oHAkBa,MAAAA,EAAoBC,GAAuC,CAChE,MAAAC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B,ECHa,CACX,YAAAE,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAa,EAAE,WAAW,EC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efront-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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K,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"}
|
|
@@ -6,7 +6,6 @@ export interface RequisitionListGridWrapperProps extends HTMLAttributes<HTMLDivE
|
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
header?: VNode;
|
|
8
8
|
rows: Array<Record<string, VNode | string | number | undefined>>;
|
|
9
|
-
expandedRows: Set<number>;
|
|
10
9
|
skeletonRowCount: number;
|
|
11
10
|
pageInfo?: {
|
|
12
11
|
total_pages: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{
|
|
3
|
+
import{jsxs as C,jsx as s,Fragment as F}from"@dropins/tools/preact-jsx-runtime.js";import{useState as M,useCallback as L,useMemo as x,useEffect as T}from"@dropins/tools/preact-compat.js";import{Button as N,Header as G,InLineAlert as U,Table as V,Pagination as B,Card as j}from"@dropins/tools/components.js";import{Slot as J,classes as v,VComponent as Z}from"@dropins/tools/lib.js";import{D as W,R as $}from"../chunks/RequisitionListForm.js";import"@dropins/tools/preact-hooks.js";import{R as K}from"../chunks/RequisitionListForm2.js";import"../chunks/state.js";import{events as w}from"@dropins/tools/event-bus.js";import{u as Q,E as X}from"../chunks/RequisitionListView.js";import"@dropins/tools/preact.js";import{R as Y}from"../chunks/RequisitionListActions.js";import{R as b}from"../chunks/RequisitionListModal.js";import{P as I}from"../chunks/PageSizePicker.js";import{useText as D}from"@dropins/tools/i18n.js";import{u as ii}from"../chunks/updateRequisitionList.js";import{d as ei}from"../chunks/deleteRequisitionList.js";import{g as z}from"../chunks/getRequisitionLists.js";import"@dropins/tools/fetch-graphql.js";function ti(c,l,t){const d=D({actionRename:"RequisitionList.RequisitionListView.actionRename",actionDeleteList:"RequisitionList.RequisitionListView.actionDeleteList"}),[e,a]=M(null),[f,g]=M(!1),[A,R]=M(!1),q=L(()=>{t&&t(),g(!0)},[t]),y=L(()=>g(!1),[]),u=x(()=>{if(c)return{handleOpenRenameModal:i=>{g(n=>n&&!1),c.handleOpenRenameModal(i)},handleOpenDeleteModal:i=>{g(n=>n&&!1),c.handleOpenDeleteModal(i)}}},[c]),r=L(async(i,n)=>{var o,p,h;R(!0);try{const m=await z(i,n),S=((o=m==null?void 0:m.page_info)==null?void 0:o.current_page)??1,E=((p=m==null?void 0:m.page_info)==null?void 0:p.total_pages)??0;if(!((((h=m==null?void 0:m.items)==null?void 0:h.length)??0)>0)&&S>1&&E>=S-1){const H=S-1,k=await z(H,n);a(k)}else a(m)}finally{R(!1)}},[]);T(()=>{const i=w.on("requisitionLists/data",n=>{n&&n.items&&a(n)},{eager:!0});return()=>{i==null||i.off()}},[]),T(()=>{e||r(1,W)},[e,r]);const O=L(i=>{var p,h;const n=i??((p=e==null?void 0:e.page_info)==null?void 0:p.current_page)??1,o=((h=e==null?void 0:e.page_info)==null?void 0:h.page_size)??W;return r(n,o)},[r,e]),P=L(async i=>{await r(1,i)},[r]);return{rows:x(()=>((e==null?void 0:e.items)??[]).map(i=>({name:C("div",{className:"requisition-list-grid-wrapper__name",children:[s("div",{className:"requisition-list-grid-wrapper__name__title",children:s("a",{href:"#",onClick:n=>{if(n.preventDefault(),l){const o=l(i.uid);typeof o=="string"&&(window.location.href=o)}},children:i.name})}),i.description&&s("div",{className:"requisition-list-grid-wrapper__name__description",children:i.description})]}),items_count:i.items_count,last_updated:new Date(i.updated_at).toLocaleString(),actions:C("div",{className:"requisition-list-grid-wrapper__actions",children:[s(N,{variant:"tertiary",type:"button","data-testid":"rename-button",onClick:()=>u==null?void 0:u.handleOpenRenameModal(i),children:d.actionRename}),s(N,{variant:"tertiary",type:"button","data-testid":"delete-button",onClick:()=>u==null?void 0:u.handleOpenDeleteModal(i),children:d.actionDeleteList})]})})),[e==null?void 0:e.items,d.actionRename,d.actionDeleteList,u,l]),isLoading:A||!e,pageInfo:e==null?void 0:e.page_info,handlePageChange:O,handlePageSizeChange:P,isAdding:f,handleAddNew:q,handleCancelCreate:y}}const Ai=({routeRequisitionListDetails:c,slots:l})=>{const[t,d]=M({type:null,isOpen:!1,isLoading:!1,requisitionList:null}),e=L(()=>{d({type:null,isOpen:!1,isLoading:!1,requisitionList:null})},[]),a=L(o=>{d({type:"rename",isOpen:!0,isLoading:!1,requisitionList:o})},[]),f=L(o=>{d({type:"delete",isOpen:!0,isLoading:!1,requisitionList:o})},[]),{rows:g,isLoading:A,pageInfo:R,handlePageChange:q,handlePageSizeChange:y,isAdding:u,handleAddNew:r,handleCancelCreate:O}=ti({handleOpenRenameModal:a,handleOpenDeleteModal:f},c,e),P=L(async o=>{if(t.requisitionList)try{await ii(t.requisitionList.uid,o.name,o.description),w.emit("requisitionList/alert",{action:"update",type:"success",context:"requisitionList"}),await q(),e()}catch{w.emit("requisitionList/alert",{action:"update",type:"error",context:"requisitionList"})}},[t.requisitionList,q,e]),_=async()=>{t.requisitionList&&(d({...t,isLoading:!0}),await ei(t.requisitionList.uid).then(async()=>{w.emit("requisitionList/alert",{type:"success",action:"delete",context:"requisitionList"})}).catch(()=>{w.emit("requisitionList/alert",{type:"error",action:"delete",context:"requisitionList"})}).finally(async()=>{await q(),e()}))},i=D({containerTitle:"RequisitionList.containerTitle",updateTitle:"RequisitionList.RequisitionListForm.updateTitle",deleteRequisitionListTitle:"RequisitionList.RequisitionListWrapper.deleteRequisitionListTitle",deleteRequisitionListMessage:"RequisitionList.RequisitionListWrapper.deleteRequisitionListMessage",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction"}),n=L(()=>l!=null&&l.Header?s(J,{name:"Header","aria-label":i.containerTitle,title:i.containerTitle,slot:l.Header}):s(G,{"aria-label":i.containerTitle,role:"region",title:i.containerTitle}),[l,i.containerTitle]);return C(F,{children:[s(ni,{header:n(),rows:g,skeletonRowCount:10,isLoading:A,pageInfo:R,handlePageChange:q,handlePageSizeChange:y,defaultPageSize:10,isAdding:u,handleAddNew:r,handleCancelCreate:O}),t.type==="rename"&&t.isOpen&&t.requisitionList&&s(b,{isOpen:t.isOpen,isLoading:t.isLoading,title:i.updateTitle,modalContent:s($,{mode:"update",defaultValues:{name:t.requisitionList.name,description:t.requisitionList.description||""},onSubmit:P,onCancel:e}),handleModalOnClose:e}),t.type==="delete"&&t.isOpen&&s(b,{isOpen:t.isOpen,isLoading:t.isLoading,title:i.deleteRequisitionListTitle,modalContent:i.deleteRequisitionListMessage,confirmBtnCaption:i.confirmAction,closeBtnCaption:i.cancelAction,handleModalOnClose:e,handleModalOnConfirm:_})]})},ni=({className:c,isLoading:l=!1,header:t,rows:d=[],skeletonRowCount:e=10,pageInfo:a,handlePageChange:f,handlePageSizeChange:g,defaultPageSize:A=10,isAdding:R,handleAddNew:q,handleCancelCreate:y,...u})=>{const r=D({name:"RequisitionList.RequisitionListWrapper.name",itemsCount:"RequisitionList.RequisitionListWrapper.itemsCount",lastUpdated:"RequisitionList.RequisitionListWrapper.lastUpdated",actions:"RequisitionList.RequisitionListWrapper.actions",emptyList:"RequisitionList.RequisitionListWrapper.emptyList"}),O=((a==null?void 0:a.total_pages)??0)>0,P=!l&&d.length===0&&!O,{alert:_,setAlert:i,handleRequisitionListAlert:n}=Q();return T(()=>{const o=w.on("requisitionList/alert",n);try{const p=localStorage.getItem("requisitionListPendingAlert");if(p){const h=JSON.parse(p);n(h),localStorage.removeItem("requisitionListPendingAlert")}}catch{}return()=>{o==null||o.off()}},[n]),C("div",{...u,className:v(["requisition-list-grid-wrapper",c]),"data-testid":"requisition-list-grid-wrapper",children:[t&&s("div",{className:v(["requisition-list-grid-wrapper__header",c]),"data-testid":"requisition-list-grid-wrapper-header",children:s(Z,{node:t})}),_&&s("div",{className:"requisition-list__alert-wrapper",children:s(U,{heading:_.description,type:_.type,variant:"primary",onDismiss:()=>i(null)})}),P?s(X,{textContent:r.emptyList}):C(F,{children:[s(V,{columns:[{key:"name",label:r.name},{key:"items_count",label:r.itemsCount},{key:"last_updated",label:r.lastUpdated},{key:"actions",label:r.actions}],rowData:d,loading:l,skeletonRowCount:e}),s("div",{className:v(["requisition-list-grid-wrapper__pagination",c]),children:C("div",{className:"requisition-list-grid-wrapper__pagination-controls",children:[s(I,{currentPageSize:(a==null?void 0:a.page_size)||A,onPageSizeChange:g||(()=>Promise.resolve()),disabled:l}),a&&a.total_pages>1&&s(B,{totalPages:a.total_pages,currentPage:a.current_page,onChange:f})]})})]}),s("div",{className:v(["requisition-list-grid-wrapper__add-new",c]),children:R?s(j,{variant:"secondary",children:s(K,{mode:"create",onSuccess:async()=>{await f(),y(),n({type:"success",action:"create",context:"requisitionList"})},onError:()=>{n({type:"error",action:"create",context:"requisitionList"})},onCancel:y})}):s(Y,{onAddNew:q})})]})};export{Ai as RequisitionListGrid,Ai as default};
|
|
4
4
|
//# sourceMappingURL=RequisitionListGrid.js.map
|