@dropins/storefront-requisition-list 1.3.0 → 1.4.0-alpha-20260522092614
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/api/getCompanyUsers/getCompanyUsers.d.ts +24 -0
- package/api/getCompanyUsers/graphql/getCompanyUsers.d.ts +18 -0
- package/api/getCompanyUsers/index.d.ts +18 -0
- package/api/getSharedRequisitionList/getSharedRequisitionList.d.ts +9 -0
- package/api/getSharedRequisitionList/graphql/getSharedRequisitionList.d.ts +18 -0
- package/api/getSharedRequisitionList/index.d.ts +18 -0
- package/api/getStoreConfig/graphql/storeConfigQuery.d.ts +1 -1
- package/api/importSharedRequisitionList/graphql/importSharedRequisitionList.d.ts +18 -0
- package/api/importSharedRequisitionList/importSharedRequisitionList.d.ts +12 -0
- package/api/importSharedRequisitionList/index.d.ts +18 -0
- package/api/index.d.ts +5 -0
- package/api/shareRequisitionListByEmail/graphql/shareRequisitionListByEmail.d.ts +18 -0
- package/api/shareRequisitionListByEmail/index.d.ts +18 -0
- package/api/shareRequisitionListByEmail/shareRequisitionListByEmail.d.ts +22 -0
- package/api/shareRequisitionListByToken/graphql/shareRequisitionListByToken.d.ts +18 -0
- package/api/shareRequisitionListByToken/index.d.ts +18 -0
- package/api/shareRequisitionListByToken/shareRequisitionListByToken.d.ts +22 -0
- package/api.js +1 -1
- package/chunks/RequisitionListForm2.js +2 -2
- package/chunks/RequisitionListForm2.js.map +1 -1
- package/chunks/RequisitionListHeader.js +1 -1
- package/chunks/RequisitionListHeader.js.map +1 -1
- package/chunks/RequisitionListView.js +1 -1
- package/chunks/RequisitionListView.js.map +1 -1
- package/chunks/ShareRequisitionListContent.js +4 -0
- package/chunks/ShareRequisitionListContent.js.map +1 -0
- package/chunks/copyItemsBetweenRequisitionLists.js +6 -6
- package/chunks/copyItemsBetweenRequisitionLists.js.map +1 -1
- package/chunks/deleteRequisitionList.js +2 -2
- package/chunks/deleteRequisitionList.js.map +1 -1
- package/chunks/fetch-error.js +4 -0
- package/chunks/fetch-error.js.map +1 -0
- package/chunks/fetch-graphql.js +1 -1
- package/chunks/fetch-graphql.js.map +1 -1
- package/chunks/getRequisitionLists.js +4 -4
- package/chunks/getRequisitionLists.js.map +1 -1
- package/chunks/importSharedRequisitionList.js +35 -0
- package/chunks/importSharedRequisitionList.js.map +1 -0
- package/chunks/initialize.js +5 -2
- package/chunks/initialize.js.map +1 -1
- package/chunks/shareRequisitionListByEmail.js +22 -0
- package/chunks/shareRequisitionListByEmail.js.map +1 -0
- package/chunks/shareRequisitionListByToken.js +38 -0
- package/chunks/shareRequisitionListByToken.js.map +1 -0
- package/chunks/state.js +1 -1
- package/chunks/state.js.map +1 -1
- package/chunks/transform-requisition-list.js +105 -0
- package/chunks/transform-requisition-list.js.map +1 -0
- package/chunks/updateRequisitionList.js +3 -104
- package/chunks/updateRequisitionList.js.map +1 -1
- package/components/RequisitionListHeader/RequisitionListHeader.d.ts +4 -0
- package/components/ShareRequisitionListContent/ShareRequisitionListContent.d.ts +26 -0
- package/components/SharedRequisitionList/SharedRequisitionList.d.ts +26 -0
- package/components/SharedRequisitionList/index.d.ts +19 -0
- package/components/index.d.ts +2 -0
- package/containers/RequisitionListForm.js +1 -1
- package/containers/RequisitionListGrid.js +1 -1
- package/containers/RequisitionListGrid.js.map +1 -1
- package/containers/RequisitionListHeader/RequisitionListHeader.d.ts +2 -0
- package/containers/RequisitionListHeader.js +1 -1
- package/containers/RequisitionListSelector.js +3 -3
- package/containers/RequisitionListSelector.js.map +1 -1
- package/containers/RequisitionListView/RequisitionListView.d.ts +2 -0
- package/containers/RequisitionListView.js +1 -1
- package/containers/RequisitionListView.js.map +1 -1
- package/containers/ShareRequisitionListContent/ShareRequisitionListContent.d.ts +17 -0
- package/containers/ShareRequisitionListContent/index.d.ts +19 -0
- package/containers/ShareRequisitionListContent.d.ts +3 -0
- package/containers/ShareRequisitionListContent.js +4 -0
- package/containers/ShareRequisitionListContent.js.map +1 -0
- package/containers/SharedRequisitionList/SharedRequisitionList.d.ts +19 -0
- package/containers/SharedRequisitionList/index.d.ts +19 -0
- package/containers/SharedRequisitionList.d.ts +3 -0
- package/containers/SharedRequisitionList.js +4 -0
- package/containers/SharedRequisitionList.js.map +1 -0
- package/containers/index.d.ts +2 -0
- package/i18n/en_US.json.d.ts +35 -1
- package/lib/state.d.ts +4 -0
- package/package.json +1 -1
- package/render.js +4 -2
- package/render.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @dropins/storefront-requisition-list
|
|
2
2
|
|
|
3
|
+
## 1.4.0-alpha-20260522092614
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 22f378f: feat: add requisition list sharing feature (USF-3911)
|
|
8
|
+
|
|
9
|
+
Introduces the ability for authenticated company users to share requisition lists with colleagues, either via a generated link or by email. Recipients can preview and import the shared list into their own account.
|
|
10
|
+
|
|
11
|
+
- Add `shareRequisitionListByToken` and `shareRequisitionListByEmail` APIs to generate share links and notify colleagues
|
|
12
|
+
- Add `getSharedRequisitionList` API to preview a shared list by token (read-only, sender info included)
|
|
13
|
+
- Add `importSharedRequisitionList` API to copy a shared list into the current customer's account
|
|
14
|
+
- Add `ShareRequisitionListContent` component and container with copy-link and email recipient selection UI
|
|
15
|
+
- Add `SharedRequisitionList` component and container to preview and import a shared requisition list by token and redirect to the list detail page on success
|
|
16
|
+
- Extend `useRequisitionListAlert` with `import` action for success/error feedback after import
|
|
17
|
+
- Extend `getStoreConfig` with sharing-related store config fields
|
|
18
|
+
- Emit `auth/permissions` in sandbox on login/logout to correctly enable the share button for company users
|
|
19
|
+
- Added `SharedRequisitionList` button in sandbox
|
|
20
|
+
|
|
21
|
+
- 66b8852: Migrate to Node.js 24 LTS
|
|
22
|
+
|
|
23
|
+
Minimum required Node.js version is now 24. Updated engines.node from >=20 to >=24.
|
|
24
|
+
|
|
3
25
|
## 1.3.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export interface CompanyUser {
|
|
18
|
+
id: string;
|
|
19
|
+
firstname: string;
|
|
20
|
+
lastname: string;
|
|
21
|
+
email: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const getCompanyUsers: () => Promise<CompanyUser[]>;
|
|
24
|
+
//# sourceMappingURL=getCompanyUsers.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const GET_COMPANY_USERS_QUERY = "\n query GET_COMPANY_USERS_QUERY(\n $pageSize: Int = 100\n $currentPage: Int = 1\n ) {\n company {\n users(\n filter: { status: ACTIVE }\n pageSize: $pageSize\n currentPage: $currentPage\n ) {\n items {\n id\n firstname\n lastname\n email\n }\n page_info {\n total_pages\n current_page\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=getCompanyUsers.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './getCompanyUsers';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
|
+
import { Item } from '../../data/models/item';
|
|
3
|
+
|
|
4
|
+
export interface SharedRequisitionListResult {
|
|
5
|
+
senderName: string;
|
|
6
|
+
requisitionList: RequisitionList;
|
|
7
|
+
}
|
|
8
|
+
export declare const getSharedRequisitionList: (token: string, currentPage?: number, pageSize?: number, enrichConfigurableProducts?: ((items: Item[]) => Promise<Item[]>) | undefined) => Promise<SharedRequisitionListResult | null>;
|
|
9
|
+
//# sourceMappingURL=getSharedRequisitionList.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const GET_SHARED_REQUISITION_LIST_QUERY: string;
|
|
18
|
+
//# sourceMappingURL=getSharedRequisitionList.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './getSharedRequisitionList';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
* is strictly forbidden unless prior written permission is obtained
|
|
15
15
|
* from Adobe.
|
|
16
16
|
*******************************************************************/
|
|
17
|
-
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n is_requisition_list_active\n company_enabled\n }\n}\n";
|
|
17
|
+
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n is_requisition_list_active\n company_enabled\n requisition_list_sharing_enabled\n requisition_list_share_max_recipients\n requisition_list_share_storefront_path\n }\n}\n";
|
|
18
18
|
//# sourceMappingURL=storeConfigQuery.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const IMPORT_SHARED_REQUISITION_LIST_MUTATION: string;
|
|
18
|
+
//# sourceMappingURL=importSharedRequisitionList.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RequisitionList } from '../../data/models/requisitionList';
|
|
2
|
+
|
|
3
|
+
export interface ImportSharedRequisitionListUserError {
|
|
4
|
+
message: string;
|
|
5
|
+
code: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ImportSharedRequisitionListResult {
|
|
8
|
+
requisitionList: RequisitionList | null;
|
|
9
|
+
userErrors: ImportSharedRequisitionListUserError[];
|
|
10
|
+
}
|
|
11
|
+
export declare const importSharedRequisitionList: (token: string) => Promise<ImportSharedRequisitionListResult>;
|
|
12
|
+
//# sourceMappingURL=importSharedRequisitionList.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './importSharedRequisitionList';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -28,4 +28,9 @@ export * from './addProductsToRequisitionList';
|
|
|
28
28
|
export * from './addRequisitionListItemsToCart';
|
|
29
29
|
export * from './moveItemsBetweenRequisitionLists';
|
|
30
30
|
export * from './copyItemsBetweenRequisitionLists';
|
|
31
|
+
export * from './getCompanyUsers';
|
|
32
|
+
export * from './shareRequisitionListByEmail';
|
|
33
|
+
export * from './shareRequisitionListByToken';
|
|
34
|
+
export * from './getSharedRequisitionList';
|
|
35
|
+
export * from './importSharedRequisitionList';
|
|
31
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const SHARE_REQUISITION_LIST_BY_EMAIL_MUTATION = "\n mutation SHARE_REQUISITION_LIST_BY_EMAIL_MUTATION(\n $requisitionListUid: ID!\n $customerUids: [ID!]!\n ) {\n shareRequisitionListByEmail(\n input: {\n requisitionListUid: $requisitionListUid\n customerUids: $customerUids\n }\n ) {\n sent_count\n user_errors {\n message\n code\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=shareRequisitionListByEmail.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './shareRequisitionListByEmail';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export interface ShareRequisitionListByEmailError {
|
|
18
|
+
message: string;
|
|
19
|
+
code: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const shareRequisitionListByEmail: (requisitionListUid: string, customerUids: string[]) => Promise<Array<ShareRequisitionListByEmailError> | null>;
|
|
22
|
+
//# sourceMappingURL=shareRequisitionListByEmail.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const SHARE_REQUISITION_LIST_BY_TOKEN_MUTATION = "\n mutation SHARE_REQUISITION_LIST_BY_TOKEN_MUTATION(\n $requisitionListUid: ID!\n ) {\n shareRequisitionListByToken(\n requisitionListUid: $requisitionListUid\n ) {\n token\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=shareRequisitionListByToken.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './shareRequisitionListByToken';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2026 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export interface ShareRequisitionListByTokenResult {
|
|
18
|
+
token: string | null;
|
|
19
|
+
errorMessage: string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare const shareRequisitionListByToken: (requisitionListUid: string) => Promise<ShareRequisitionListByTokenResult>;
|
|
22
|
+
//# sourceMappingURL=shareRequisitionListByToken.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{c as
|
|
3
|
+
import{c as p,g as n,i as u}from"./chunks/initialize.js";import{g as d}from"./chunks/getRequisitionLists.js";import{a as q,c as L,d as R,g as h,m as x,u as c}from"./chunks/copyItemsBetweenRequisitionLists.js";import{u as I}from"./chunks/updateRequisitionList.js";import{d as B}from"./chunks/deleteRequisitionList.js";import{g as G,s as Q}from"./chunks/shareRequisitionListByToken.js";import{s as H}from"./chunks/shareRequisitionListByEmail.js";import{g as v,i as w}from"./chunks/importSharedRequisitionList.js";import{f as T,g as b,r as k,s as z,a as U,b as j}from"./chunks/fetch-graphql.js";import"@dropins/tools/lib.js";import"@dropins/tools/event-bus.js";import"./chunks/state.js";import"./chunks/fetch-error.js";import"./chunks/transform-requisition-list.js";import"@dropins/tools/fetch-graphql.js";export{q as addRequisitionListItemsToCart,p as config,L as copyItemsBetweenRequisitionLists,B as deleteRequisitionList,R as deleteRequisitionListItems,T as fetchGraphQl,G as getCompanyUsers,b as getConfig,h as getRequisitionList,d as getRequisitionLists,v as getSharedRequisitionList,n as getStoreConfig,w as importSharedRequisitionList,u as initialize,x as moveItemsBetweenRequisitionLists,k as removeFetchGraphQlHeader,z as setEndpoint,U as setFetchGraphQlHeader,j as setFetchGraphQlHeaders,H as shareRequisitionListByEmail,Q as shareRequisitionListByToken,I as updateRequisitionList,c as updateRequisitionListItems};
|
|
4
4
|
//# sourceMappingURL=api.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{R as p}from"./RequisitionListForm.js";import{useState as R}from"@dropins/tools/preact-hooks.js";import{R as L,t as q
|
|
3
|
+
import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{R as p}from"./RequisitionListForm.js";import{useState as R}from"@dropins/tools/preact-hooks.js";import{R as L,t as q}from"./transform-requisition-list.js";import{h as I}from"./fetch-error.js";import{events as l}from"@dropins/tools/event-bus.js";import{f as T}from"./fetch-graphql.js";import{u as f}from"./updateRequisitionList.js";const _=`
|
|
4
4
|
mutation CREATE_REQUISITION_LIST_MUTATION(
|
|
5
5
|
$requisitionListName: String!,
|
|
6
6
|
$requisitionListDescription: String,
|
|
@@ -17,5 +17,5 @@ import{jsx as c}from"@dropins/tools/preact-jsx-runtime.js";import{R as p}from"./
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
${L}
|
|
20
|
-
`,N=async(
|
|
20
|
+
`,N=async(n,o)=>T(_,{variables:{requisitionListName:n,requisitionListDescription:o}}).then(({errors:t,data:i})=>{var e;if(t)return I(t);if(!((e=i==null?void 0:i.createRequisitionList)!=null&&e.requisition_list))return null;const u=q(i.createRequisitionList.requisition_list);return l.emit("requisitionList/data",u),u});function S(n,o,t,i){const[u,e]=R(null);return{error:u,submit:async m=>{e(null);try{const r=m.description??"",s=n==="update"&&o?await f(o,m.name,r):await N(m.name,r);return s&&(t==null||t(s)),s}catch(r){const s=(r==null?void 0:r.message)||"Unexpected error";return e(s),i==null||i(s),null}}}}const d=({mode:n,requisitionListUid:o,defaultValues:t={name:"",description:""},onSuccess:i,onError:u,onCancel:e})=>{const{error:a,submit:m}=S(n,o,i,u);return c(p,{mode:n,defaultValues:t,error:a,onSubmit:async s=>{await m(s)},onCancel:e})};export{d as R};
|
|
21
21
|
//# sourceMappingURL=RequisitionListForm2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequisitionListForm2.js","sources":["/@dropins/storefront-requisition-list/src/api/createRequisitionList/graphql/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/createRequisitionList/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/hooks/useRequisitionListForm.ts","/@dropins/storefront-requisition-list/src/containers/RequisitionListForm/RequisitionListForm.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const CREATE_REQUISITION_LIST_MUTATION = `\n mutation CREATE_REQUISITION_LIST_MUTATION(\n $requisitionListName: String!,\n $requisitionListDescription: String,\n ) {\n createRequisitionList(\n input: {\n name: $requisitionListName\n description: $requisitionListDescription\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { CREATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/createRequisitionList/graphql/createRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const createRequisitionList = async (\n name: string,\n description?: string\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(CREATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListName: name,\n requisitionListDescription: description,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.createRequisitionList?.requisition_list) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.createRequisitionList.requisition_list\n );\n events.emit('requisitionList/data', payload);\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState } from 'preact/hooks';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { createRequisitionList } from '@/requisitionList/api/createRequisitionList/createRequisitionList';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList/updateRequisitionList';\n\nexport type RequisitionListFormMode = 'create' | 'update';\nexport type RequisitionListFormValues = { name: string; description?: string };\n\ntype UseRequisitionListFormReturn = {\n error: string | null;\n submit: (\n values: RequisitionListFormValues\n ) => Promise<RequisitionList | null>;\n};\n\nexport function useRequisitionListForm(\n mode: RequisitionListFormMode,\n requisitionListUid?: string,\n onSuccess?: (rl: RequisitionList) => void,\n onError?: (msg: string) => void\n): UseRequisitionListFormReturn {\n const [error, setError] = useState<string | null>(null);\n\n const submit = async (\n values: RequisitionListFormValues\n ): Promise<RequisitionList | null> => {\n setError(null);\n try {\n const description = values.description ?? '';\n const result =\n mode === 'update' && requisitionListUid\n ? await updateRequisitionList(\n requisitionListUid,\n values.name,\n description\n )\n : await createRequisitionList(values.name, description);\n if (result) onSuccess?.(result);\n return result;\n } catch (e: any) {\n const msg = e?.message || 'Unexpected error';\n setError(msg);\n onError?.(msg);\n return null;\n }\n };\n\n return { error, submit };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { RequisitionListForm as RequisitionListFormComponent } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport {\n useRequisitionListForm,\n RequisitionListFormMode,\n RequisitionListFormValues,\n} from '@/requisitionList/hooks/useRequisitionListForm';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport interface RequisitionListFormProps {\n mode: RequisitionListFormMode;\n requisitionListUid?: string;\n defaultValues?: RequisitionListFormValues;\n onSuccess?: (newList: RequisitionList) => void;\n onError?: (message: string) => void;\n onCancel: () => void;\n}\n\nexport const RequisitionListForm: Container<RequisitionListFormProps> = ({\n mode,\n requisitionListUid,\n defaultValues = { name: '', description: '' },\n onSuccess,\n onError,\n onCancel,\n}) => {\n const { error, submit } = useRequisitionListForm(\n mode,\n requisitionListUid,\n onSuccess,\n onError\n );\n\n const handleSubmit = async (values: RequisitionListFormValues) => {\n await submit(values);\n };\n\n return (\n <RequisitionListFormComponent\n mode={mode}\n defaultValues={defaultValues}\n error={error}\n onSubmit={handleSubmit}\n onCancel={onCancel}\n />\n );\n};\n"],"names":["CREATE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","createRequisitionList","name","description","fetchGraphQl","errors","data","handleFetchError","_a","payload","transformRequisitionList","events","useRequisitionListForm","mode","requisitionListUid","onSuccess","onError","error","setError","useState","values","result","updateRequisitionList","e","msg","RequisitionListForm","defaultValues","onCancel","submit","jsx","RequisitionListFormComponent"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequisitionListForm2.js","sources":["/@dropins/storefront-requisition-list/src/api/createRequisitionList/graphql/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/api/createRequisitionList/createRequisitionList.ts","/@dropins/storefront-requisition-list/src/hooks/useRequisitionListForm.ts","/@dropins/storefront-requisition-list/src/containers/RequisitionListForm/RequisitionListForm.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { REQUISITION_LIST_FRAGMENT } from '@/requisitionList/api/fragments/RequisitionListFragment.graphql';\n\nexport const CREATE_REQUISITION_LIST_MUTATION = `\n mutation CREATE_REQUISITION_LIST_MUTATION(\n $requisitionListName: String!,\n $requisitionListDescription: String,\n ) {\n createRequisitionList(\n input: {\n name: $requisitionListName\n description: $requisitionListDescription\n }\n ) {\n requisition_list {\n ...REQUISITION_LIST_FRAGMENT\n }\n }\n }\n${REQUISITION_LIST_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { transformRequisitionList } from '@/requisitionList/data/transforms';\nimport { fetchGraphQl } from '@/requisitionList/api';\nimport { handleFetchError } from '@/requisitionList/lib/fetch-error';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { CREATE_REQUISITION_LIST_MUTATION } from '@/requisitionList/api/createRequisitionList/graphql/createRequisitionList';\nimport { events } from '@adobe-commerce/event-bus';\n\nexport const createRequisitionList = async (\n name: string,\n description?: string\n): Promise<RequisitionList | null> => {\n return fetchGraphQl(CREATE_REQUISITION_LIST_MUTATION, {\n variables: {\n requisitionListName: name,\n requisitionListDescription: description,\n },\n }).then(({ errors, data }) => {\n if (errors) return handleFetchError(errors);\n\n if (!data?.createRequisitionList?.requisition_list) {\n return null;\n }\n\n const payload = transformRequisitionList(\n data.createRequisitionList.requisition_list\n );\n events.emit('requisitionList/data', payload);\n return payload;\n });\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState } from 'preact/hooks';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { createRequisitionList } from '@/requisitionList/api/createRequisitionList/createRequisitionList';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList/updateRequisitionList';\n\nexport type RequisitionListFormMode = 'create' | 'update';\nexport type RequisitionListFormValues = { name: string; description?: string };\n\ntype UseRequisitionListFormReturn = {\n error: string | null;\n submit: (\n values: RequisitionListFormValues\n ) => Promise<RequisitionList | null>;\n};\n\nexport function useRequisitionListForm(\n mode: RequisitionListFormMode,\n requisitionListUid?: string,\n onSuccess?: (rl: RequisitionList) => void,\n onError?: (msg: string) => void\n): UseRequisitionListFormReturn {\n const [error, setError] = useState<string | null>(null);\n\n const submit = async (\n values: RequisitionListFormValues\n ): Promise<RequisitionList | null> => {\n setError(null);\n try {\n const description = values.description ?? '';\n const result =\n mode === 'update' && requisitionListUid\n ? await updateRequisitionList(\n requisitionListUid,\n values.name,\n description\n )\n : await createRequisitionList(values.name, description);\n if (result) onSuccess?.(result);\n return result;\n } catch (e: any) {\n const msg = e?.message || 'Unexpected error';\n setError(msg);\n onError?.(msg);\n return null;\n }\n };\n\n return { error, submit };\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { RequisitionListForm as RequisitionListFormComponent } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport {\n useRequisitionListForm,\n RequisitionListFormMode,\n RequisitionListFormValues,\n} from '@/requisitionList/hooks/useRequisitionListForm';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\n\nexport interface RequisitionListFormProps {\n mode: RequisitionListFormMode;\n requisitionListUid?: string;\n defaultValues?: RequisitionListFormValues;\n onSuccess?: (newList: RequisitionList) => void;\n onError?: (message: string) => void;\n onCancel: () => void;\n}\n\nexport const RequisitionListForm: Container<RequisitionListFormProps> = ({\n mode,\n requisitionListUid,\n defaultValues = { name: '', description: '' },\n onSuccess,\n onError,\n onCancel,\n}) => {\n const { error, submit } = useRequisitionListForm(\n mode,\n requisitionListUid,\n onSuccess,\n onError\n );\n\n const handleSubmit = async (values: RequisitionListFormValues) => {\n await submit(values);\n };\n\n return (\n <RequisitionListFormComponent\n mode={mode}\n defaultValues={defaultValues}\n error={error}\n onSubmit={handleSubmit}\n onCancel={onCancel}\n />\n );\n};\n"],"names":["CREATE_REQUISITION_LIST_MUTATION","REQUISITION_LIST_FRAGMENT","createRequisitionList","name","description","fetchGraphQl","errors","data","handleFetchError","_a","payload","transformRequisitionList","events","useRequisitionListForm","mode","requisitionListUid","onSuccess","onError","error","setError","useState","values","result","updateRequisitionList","e","msg","RequisitionListForm","defaultValues","onCancel","submit","jsx","RequisitionListFormComponent"],"mappings":"6YAmBO,MAAMA,EAAmC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgB9CC,CAAyB;AAAA,ECXdC,EAAwB,MACnCC,EACAC,IAEOC,EAAaL,EAAkC,CACpD,UAAW,CACT,oBAAqBG,EACrB,2BAA4BC,CAAA,CAE/B,CAAA,EAAE,KAAK,CAAC,CAAE,OAAAE,EAAQ,KAAAC,KAAW,OACxB,GAAAD,EAAe,OAAAE,EAAiBF,CAAM,EAEtC,GAAA,GAACG,EAAAF,GAAA,YAAAA,EAAM,wBAAN,MAAAE,EAA6B,kBACzB,OAAA,KAGT,MAAMC,EAAUC,EACdJ,EAAK,sBAAsB,gBAC7B,EACO,OAAAK,EAAA,KAAK,uBAAwBF,CAAO,EACpCA,CAAA,CACR,ECbI,SAASG,EACdC,EACAC,EACAC,EACAC,EAC8B,CAC9B,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAwB,IAAI,EA0B/C,MAAA,CAAE,MAAAF,EAAO,OAxBD,MACbG,GACoC,CACpCF,EAAS,IAAI,EACT,GAAA,CACI,MAAAf,EAAciB,EAAO,aAAe,GACpCC,EACJR,IAAS,UAAYC,EACjB,MAAMQ,EACJR,EACAM,EAAO,KACPjB,CAEF,EAAA,MAAMF,EAAsBmB,EAAO,KAAMjB,CAAW,EACtD,OAAAkB,eAAoBA,IACjBA,QACAE,EAAQ,CACT,MAAAC,GAAMD,GAAA,YAAAA,EAAG,UAAW,mBAC1B,OAAAL,EAASM,CAAG,EACZR,GAAA,MAAAA,EAAUQ,GACH,IAAA,CAEX,CAEuB,CACzB,CC9BO,MAAMC,EAA2D,CAAC,CACvE,KAAAZ,EACA,mBAAAC,EACA,cAAAY,EAAgB,CAAE,KAAM,GAAI,YAAa,EAAG,EAC5C,UAAAX,EACA,QAAAC,EACA,SAAAW,CACF,IAAM,CACE,KAAA,CAAE,MAAAV,EAAO,OAAAW,CAAA,EAAWhB,EACxBC,EACAC,EACAC,EACAC,CACF,EAOE,OAAAa,EAACC,EAAA,CACC,KAAAjB,EACA,cAAAa,EACA,MAAAT,EACA,SATiB,MAAOG,GAAsC,CAChE,MAAMQ,EAAOR,CAAM,CACrB,EAQI,SAAAO,CAAA,CACF,CAEJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsxs as
|
|
3
|
+
import{jsxs as u,jsx as s,Fragment as H}from"@dropins/tools/preact-jsx-runtime.js";import{useState as f,useCallback as h}from"@dropins/tools/preact-hooks.js";import{R as _}from"./RequisitionListModal.js";import{R as j}from"./RequisitionListForm.js";import{u as W}from"./updateRequisitionList.js";import{d as z}from"./deleteRequisitionList.js";import{s as J}from"./shareRequisitionListByEmail.js";import{S as P}from"./ShareRequisitionListContent.js";import{s as V}from"./state.js";import{useText as K}from"@dropins/tools/i18n.js";const Q=({name:i,description:o,backLink:n,actions:e,className:R,...L})=>u("div",{...L,className:`requisition-list-header ${R||""}`,children:[n&&s("div",{className:"requisition-list-header__back",children:u("a",{href:n.url,className:"requisition-list-header__back-link",onClick:n.onClick,children:[s("span",{className:"requisition-list-header__back-arrow",children:"<"}),n.label]})}),u("div",{className:"requisition-list-header__main",children:[u("div",{className:"requisition-list-header__title-section",children:[s("h1",{className:"requisition-list-header__title",children:i}),o&&s("p",{className:"requisition-list-header__description",children:o})]}),e&&(e.onRename||e.onDelete||e.onShare||e.shareDisabled)&&u("div",{className:"requisition-list-header__actions",children:[(e.onShare||e.shareDisabled)&&s("a",{href:"#",onClick:d=>{var t;d.preventDefault(),!e.shareDisabled&&((t=e.onShare)==null||t.call(e))},className:`requisition-list-header__action-link ${e.shareDisabled?"requisition-list-header__action-link--disabled":""}`,"data-testid":"share-list-btn","aria-disabled":e.shareDisabled?"true":"false","aria-label":e.shareDisabled&&e.shareDisabledReason?`${e.shareLabel} – ${e.shareDisabledReason}`:void 0,"data-disabled-reason":e.shareDisabled?e.shareDisabledReason:void 0,children:e.shareLabel}),e.onRename&&s("a",{href:"#",onClick:d=>{var t;d.preventDefault(),(t=e.onRename)==null||t.call(e)},className:"requisition-list-header__action-link","data-testid":"rename-list-btn",children:e.renameLabel}),e.onDelete&&s("a",{href:"#",onClick:d=>{var t;d.preventDefault(),(t=e.onDelete)==null||t.call(e)},className:"requisition-list-header__action-link","data-testid":"delete-list-btn",children:e.deleteLabel})]})]})]}),te=({requisitionList:i,routeRequisitionListGrid:o,onUpdate:n,onAlert:e,enrichConfigurableProducts:R,currentCustomerEmail:L,routeSharedRequisitionList:d})=>{var M,T;const[t,p]=f(!1),[S,b]=f(!1),[g,y]=f(!1),[x,C]=f(!1),[w,N]=f(!1),k=(M=V.config)==null?void 0:M.requisition_list_sharing_enabled,m=k!==!1&&k!=="0",v=Number(i.items_count??((T=i.items)==null?void 0:T.length)??0),q=v<=0||!V.isCompanyUser,a=K({actionBackToRequisitionLists:"RequisitionList.RequisitionListView.actionBackToRequisitionLists",actionRename:"RequisitionList.RequisitionListView.actionRename",actionDeleteList:"RequisitionList.RequisitionListView.actionDeleteList",actionShare:"RequisitionList.RequisitionListView.actionShare",shareDisabledReason:"RequisitionList.RequisitionListView.shareDisabledReason",shareDisabledNoCompany:"RequisitionList.RequisitionListView.shareDisabledNoCompany",shareListTitle:"RequisitionList.RequisitionListView.shareListTitle",deleteListTitle:"RequisitionList.RequisitionListView.deleteListTitle",deleteListMessage:"RequisitionList.RequisitionListView.deleteListMessage",confirmAction:"RequisitionList.RequisitionListWrapper.confirmAction",cancelAction:"RequisitionList.RequisitionListWrapper.cancelAction",updateTitle:"RequisitionList.RequisitionListForm.updateTitle"}),O=h(()=>{p(!0)},[]),B=h(async r=>{var l,c;try{const D=await W(i.uid,r.name,r.description,(l=i.page_info)==null?void 0:l.page_size,(c=i.page_info)==null?void 0:c.current_page,R);D?(n==null||n(D),p(!1),e==null||e({action:"update",type:"success",context:"requisitionList"})):e==null||e({action:"update",type:"error",context:"requisitionList"})}catch{e==null||e({action:"update",type:"error",context:"requisitionList"})}},[i.uid,i.page_info,n,e,R]),$=h(()=>{b(!0)},[]),E=h(async()=>{C(!0);try{if(await z(i.uid)){const l={action:"delete",type:"success",context:"requisitionList"};try{localStorage.setItem("requisitionListPendingAlert",JSON.stringify(l))}catch{}if(o){const c=o();c&&typeof c=="string"&&(window.location.href=c)}}else e==null||e({action:"delete",type:"error",context:"requisitionList"})}catch{e==null||e({action:"delete",type:"error",context:"requisitionList"})}finally{C(!1),b(!1)}},[i.uid,o,e]),F=h(()=>{y(!0)},[]),I=h(async r=>{N(!0);try{return await J(i.uid,r)}catch{return[{code:"SHARE_FAILED",message:"Unable to share list."}]}finally{N(!1)}},[i.uid]);return u(H,{children:[s(Q,{name:i.name,description:i.description,backLink:o?{url:"#",label:a.actionBackToRequisitionLists,onClick:r=>{r.preventDefault();const l=o();l&&typeof l=="string"&&(window.location.href=l)}}:void 0,actions:{onRename:O,onDelete:$,onShare:m&&!q?F:void 0,renameLabel:a.actionRename,deleteLabel:a.actionDeleteList,shareLabel:m?a.actionShare:void 0,shareDisabled:m&&q,shareDisabledReason:m&&q?v<=0?a.shareDisabledReason:a.shareDisabledNoCompany:void 0}}),t&&s(_,{isOpen:t,isLoading:!1,title:a.updateTitle,modalContent:s(j,{mode:"update",defaultValues:{name:i.name,description:i.description||""},onSubmit:B,onCancel:()=>p(!1)}),handleModalOnClose:()=>p(!1)}),S&&s(_,{isOpen:S,isLoading:x,title:a.deleteListTitle,modalContent:a.deleteListMessage,confirmBtnCaption:a.confirmAction,closeBtnCaption:a.cancelAction,handleModalOnClose:()=>b(!1),handleModalOnConfirm:E}),m&&g&&s(_,{isOpen:g,isLoading:w,title:a.shareListTitle,modalContent:s(P,{requisitionListUid:i.uid,isSubmitting:w,onSubmit:I,currentCustomerEmail:L,routeSharedRequisitionList:d}),handleModalOnClose:()=>y(!1)})]})};export{te as R};
|
|
4
4
|
//# sourceMappingURL=RequisitionListHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequisitionListHeader.js","sources":["/@dropins/storefront-requisition-list/src/components/RequisitionListHeader/RequisitionListHeader.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListHeader/RequisitionListHeader.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader.css';\n\nexport interface RequisitionListHeaderProps\n extends HTMLAttributes<HTMLDivElement> {\n name: string;\n description?: string;\n backLink?: {\n url: string;\n label: string;\n onClick?: (e: Event) => void;\n };\n actions?: {\n onRename?: () => void;\n onDelete?: () => void;\n renameLabel?: string;\n deleteLabel?: string;\n };\n}\n\nexport const RequisitionListHeader: FunctionComponent<\n RequisitionListHeaderProps\n> = ({ name, description, backLink, actions, className, ...props }) => {\n return (\n <div {...props} className={`requisition-list-header ${className || ''}`}>\n {/* Back Link */}\n {backLink && (\n <div className=\"requisition-list-header__back\">\n <a\n href={backLink.url}\n className=\"requisition-list-header__back-link\"\n onClick={backLink.onClick}\n >\n <span className=\"requisition-list-header__back-arrow\"><</span>\n {backLink.label}\n </a>\n </div>\n )}\n\n {/* Title and Actions Row */}\n <div className=\"requisition-list-header__main\">\n <div className=\"requisition-list-header__title-section\">\n <h1 className=\"requisition-list-header__title\">{name}</h1>\n {description && (\n <p className=\"requisition-list-header__description\">\n {description}\n </p>\n )}\n </div>\n\n {/* Action Links */}\n {actions && (actions.onRename || actions.onDelete) && (\n <div className=\"requisition-list-header__actions\">\n {actions.onRename && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onRename?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"rename-list-btn\"\n >\n {actions.renameLabel}\n </a>\n )}\n {actions.onDelete && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onDelete?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"delete-list-btn\"\n >\n {actions.deleteLabel}\n </a>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { RequisitionListHeader as RequisitionListHeaderComponent } from '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader';\nimport { RequisitionListForm } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport { RequisitionListModal } from '@/requisitionList/components/RequisitionListModal/RequisitionListModal';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList';\nimport { deleteRequisitionList } from '@/requisitionList/api/deleteRequisitionList';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\n\nexport interface RequisitionListHeaderProps {\n requisitionList: RequisitionList;\n routeRequisitionListGrid?: () => string | void;\n onUpdate?: (updatedList: RequisitionList) => void | Promise<void>;\n onAlert?: (payload: {\n action: string;\n type: string;\n context: string;\n }) => void;\n enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>;\n}\n\nexport const RequisitionListHeader: Container<RequisitionListHeaderProps> = ({\n requisitionList,\n routeRequisitionListGrid,\n onUpdate,\n onAlert,\n enrichConfigurableProducts,\n}) => {\n const [showRenameModal, setShowRenameModal] = useState<boolean>(false);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [isDeleting, setIsDeleting] = useState<boolean>(false);\n\n const translations = useText({\n actionBackToRequisitionLists: `RequisitionList.RequisitionListView.actionBackToRequisitionLists`,\n actionRename: `RequisitionList.RequisitionListView.actionRename`,\n actionDeleteList: `RequisitionList.RequisitionListView.actionDeleteList`,\n deleteListTitle: `RequisitionList.RequisitionListView.deleteListTitle`,\n deleteListMessage: `RequisitionList.RequisitionListView.deleteListMessage`,\n confirmAction: `RequisitionList.RequisitionListWrapper.confirmAction`,\n cancelAction: `RequisitionList.RequisitionListWrapper.cancelAction`,\n updateTitle: `RequisitionList.RequisitionListForm.updateTitle`,\n });\n\n const handleRename = useCallback(() => {\n setShowRenameModal(true);\n }, []);\n\n const handleRenameSubmit = useCallback(\n async (values: { name: string; description?: string }) => {\n try {\n const updatedList = await updateRequisitionList(\n requisitionList.uid,\n values.name,\n values.description,\n requisitionList.page_info?.page_size,\n requisitionList.page_info?.current_page,\n enrichConfigurableProducts\n );\n if (updatedList) {\n onUpdate?.(updatedList);\n setShowRenameModal(false);\n onAlert?.({\n action: 'update',\n type: 'success',\n context: 'requisitionList',\n });\n } else {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n },\n [\n requisitionList.uid,\n requisitionList.page_info,\n onUpdate,\n onAlert,\n enrichConfigurableProducts,\n ]\n );\n\n const handleDeleteList = useCallback(() => {\n setShowDeleteModal(true);\n }, []);\n\n const handleDeleteConfirm = useCallback(async () => {\n setIsDeleting(true);\n try {\n const result = await deleteRequisitionList(requisitionList.uid);\n if (result) {\n const alertPayload = {\n action: 'delete',\n type: 'success',\n context: 'requisitionList',\n };\n\n // Store alert in localStorage before redirecting\n // This ensures the alert is shown after redirect to grid view\n try {\n localStorage.setItem(\n 'requisitionListPendingAlert',\n JSON.stringify(alertPayload)\n );\n } catch (e) {\n // Ignore localStorage errors (e.g., in private browsing mode)\n }\n\n if (routeRequisitionListGrid) {\n const url = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (url && typeof url === 'string') {\n window.location.href = url;\n }\n }\n } else {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n } finally {\n setIsDeleting(false);\n setShowDeleteModal(false);\n }\n }, [requisitionList.uid, routeRequisitionListGrid, onAlert]);\n\n return (\n <>\n <RequisitionListHeaderComponent\n name={requisitionList.name}\n description={requisitionList.description}\n backLink={\n routeRequisitionListGrid\n ? {\n url: '#',\n label: translations.actionBackToRequisitionLists,\n onClick: (e: Event) => {\n e.preventDefault();\n const result = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (result && typeof result === 'string') {\n window.location.href = result;\n }\n },\n }\n : undefined\n }\n actions={{\n onRename: handleRename,\n onDelete: handleDeleteList,\n renameLabel: translations.actionRename,\n deleteLabel: translations.actionDeleteList,\n }}\n />\n\n {/* Rename Modal */}\n {showRenameModal && (\n <RequisitionListModal\n isOpen={showRenameModal}\n isLoading={false}\n title={translations.updateTitle}\n modalContent={\n <RequisitionListForm\n mode=\"update\"\n defaultValues={{\n name: requisitionList.name,\n description: requisitionList.description || '',\n }}\n onSubmit={handleRenameSubmit}\n onCancel={() => setShowRenameModal(false)}\n />\n }\n handleModalOnClose={() => setShowRenameModal(false)}\n />\n )}\n\n {/* Delete Confirmation Modal */}\n {showDeleteModal && (\n <RequisitionListModal\n isOpen={showDeleteModal}\n isLoading={isDeleting}\n title={translations.deleteListTitle}\n modalContent={translations.deleteListMessage}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={() => setShowDeleteModal(false)}\n handleModalOnConfirm={handleDeleteConfirm}\n />\n )}\n </>\n );\n};\n"],"names":["RequisitionListHeader","name","description","backLink","actions","className","props","jsxs","jsx","e","_a","requisitionList","routeRequisitionListGrid","onUpdate","onAlert","enrichConfigurableProducts","showRenameModal","setShowRenameModal","useState","showDeleteModal","setShowDeleteModal","isDeleting","setIsDeleting","translations","useText","handleRename","useCallback","handleRenameSubmit","values","updatedList","updateRequisitionList","_b","handleDeleteList","handleDeleteConfirm","deleteRequisitionList","alertPayload","url","Fragment","RequisitionListHeaderComponent","result","RequisitionListModal","RequisitionListForm"],"mappings":"wYAsCa,MAAAA,EAET,CAAC,CAAE,KAAAC,EAAM,YAAAC,EAAa,SAAAC,EAAU,QAAAC,EAAS,UAAAC,EAAW,GAAGC,KAEvDC,EAAC,OAAK,GAAGD,EAAO,UAAW,2BAA2BD,GAAa,EAAE,GAElE,SAAA,CACCF,GAAAK,EAAC,MAAI,CAAA,UAAU,gCACb,SAAAD,EAAC,IAAA,CACC,KAAMJ,EAAS,IACf,UAAU,qCACV,QAASA,EAAS,QAElB,SAAA,CAACK,EAAA,OAAA,CAAK,UAAU,sCAAsC,SAAI,IAAA,EACzDL,EAAS,KAAA,CAAA,CAAA,EAEd,EAIFI,EAAC,MAAI,CAAA,UAAU,gCACb,SAAA,CAACA,EAAA,MAAA,CAAI,UAAU,yCACb,SAAA,CAACC,EAAA,KAAA,CAAG,UAAU,iCAAkC,SAAKP,EAAA,EACpDC,GACCM,EAAC,IAAE,CAAA,UAAU,uCACV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,GAAW,WAC9B,OAAO,SAAS,KAAOA,EACzB,CACF,EAEF,OAEN,QAAS,CACP,SAAUd,EACV,SAAUO,EACV,YAAaT,EAAa,aAC1B,YAAaA,EAAa,gBAAA,CAC5B,CACF,EAGCP,GACCR,EAACgC,EAAA,CACC,OAAQxB,EACR,UAAW,GACX,MAAOO,EAAa,YACpB,aACEf,EAACiC,EAAA,CACC,KAAK,SACL,cAAe,CACb,KAAM9B,EAAgB,KACtB,YAAaA,EAAgB,aAAe,EAC9C,EACA,SAAUgB,EACV,SAAU,IAAMV,EAAmB,EAAK,CAAA,CAC1C,EAEF,mBAAoB,IAAMA,EAAmB,EAAK,CAAA,CACpD,EAIDE,GACCX,EAACgC,EAAA,CACC,OAAQrB,EACR,UAAWE,EACX,MAAOE,EAAa,gBACpB,aAAcA,EAAa,kBAC3B,kBAAmBA,EAAa,cAChC,gBAAiBA,EAAa,aAC9B,mBAAoB,IAAMH,EAAmB,EAAK,EAClD,qBAAsBa,CAAA,CAAA,CACxB,EAEJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"RequisitionListHeader.js","sources":["/@dropins/storefront-requisition-list/src/components/RequisitionListHeader/RequisitionListHeader.tsx","/@dropins/storefront-requisition-list/src/containers/RequisitionListHeader/RequisitionListHeader.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FunctionComponent } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader.css';\n\nexport interface RequisitionListHeaderProps\n extends HTMLAttributes<HTMLDivElement> {\n name: string;\n description?: string;\n backLink?: {\n url: string;\n label: string;\n onClick?: (e: Event) => void;\n };\n actions?: {\n onRename?: () => void;\n onDelete?: () => void;\n onShare?: () => void;\n renameLabel?: string;\n deleteLabel?: string;\n shareLabel?: string;\n shareDisabled?: boolean;\n shareDisabledReason?: string;\n };\n}\n\nexport const RequisitionListHeader: FunctionComponent<\n RequisitionListHeaderProps\n> = ({ name, description, backLink, actions, className, ...props }) => {\n return (\n <div {...props} className={`requisition-list-header ${className || ''}`}>\n {/* Back Link */}\n {backLink && (\n <div className=\"requisition-list-header__back\">\n <a\n href={backLink.url}\n className=\"requisition-list-header__back-link\"\n onClick={backLink.onClick}\n >\n <span className=\"requisition-list-header__back-arrow\"><</span>\n {backLink.label}\n </a>\n </div>\n )}\n\n {/* Title and Actions Row */}\n <div className=\"requisition-list-header__main\">\n <div className=\"requisition-list-header__title-section\">\n <h1 className=\"requisition-list-header__title\">{name}</h1>\n {description && (\n <p className=\"requisition-list-header__description\">\n {description}\n </p>\n )}\n </div>\n\n {/* Action Links */}\n {actions &&\n (actions.onRename ||\n actions.onDelete ||\n actions.onShare ||\n actions.shareDisabled) && (\n <div className=\"requisition-list-header__actions\">\n {(actions.onShare || actions.shareDisabled) && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n if (actions.shareDisabled) {\n return;\n }\n actions.onShare?.();\n }}\n className={`requisition-list-header__action-link ${\n actions.shareDisabled\n ? 'requisition-list-header__action-link--disabled'\n : ''\n }`}\n data-testid=\"share-list-btn\"\n aria-disabled={actions.shareDisabled ? 'true' : 'false'}\n aria-label={\n actions.shareDisabled && actions.shareDisabledReason\n ? `${actions.shareLabel} – ${actions.shareDisabledReason}`\n : undefined\n }\n data-disabled-reason={\n actions.shareDisabled\n ? actions.shareDisabledReason\n : undefined\n }\n >\n {actions.shareLabel}\n </a>\n )}\n {actions.onRename && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onRename?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"rename-list-btn\"\n >\n {actions.renameLabel}\n </a>\n )}\n {actions.onDelete && (\n <a\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n actions.onDelete?.();\n }}\n className=\"requisition-list-header__action-link\"\n data-testid=\"delete-list-btn\"\n >\n {actions.deleteLabel}\n </a>\n )}\n </div>\n )}\n </div>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useCallback } from 'preact/hooks';\nimport { Container } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { RequisitionListHeader as RequisitionListHeaderComponent } from '@/requisitionList/components/RequisitionListHeader/RequisitionListHeader';\nimport { RequisitionListForm } from '@/requisitionList/components/RequisitionListForm/RequisitionListForm';\nimport { RequisitionListModal } from '@/requisitionList/components/RequisitionListModal/RequisitionListModal';\nimport { updateRequisitionList } from '@/requisitionList/api/updateRequisitionList';\nimport { deleteRequisitionList } from '@/requisitionList/api/deleteRequisitionList';\nimport {\n shareRequisitionListByEmail,\n ShareRequisitionListByEmailError,\n} from '@/requisitionList/api/shareRequisitionListByEmail';\nimport { RequisitionList } from '@/requisitionList/data/models/requisitionList';\nimport { Item } from '@/requisitionList/data/models/item';\nimport { ShareRequisitionListContent } from '@/requisitionList/containers/ShareRequisitionListContent';\nimport { state } from '@/requisitionList/lib/state';\n\nexport interface RequisitionListHeaderProps {\n requisitionList: RequisitionList;\n routeRequisitionListGrid?: () => string | void;\n onUpdate?: (updatedList: RequisitionList) => void | Promise<void>;\n onAlert?: (payload: {\n action: string;\n type: string;\n context: string;\n }) => void;\n enrichConfigurableProducts?: (items: Item[]) => Promise<Item[]>;\n currentCustomerEmail?: string;\n routeSharedRequisitionList?: (token: string) => string;\n}\n\nexport const RequisitionListHeader: Container<RequisitionListHeaderProps> = ({\n requisitionList,\n routeRequisitionListGrid,\n onUpdate,\n onAlert,\n enrichConfigurableProducts,\n currentCustomerEmail,\n routeSharedRequisitionList,\n}: RequisitionListHeaderProps) => {\n const [showRenameModal, setShowRenameModal] = useState<boolean>(false);\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [showShareModal, setShowShareModal] = useState<boolean>(false);\n const [isDeleting, setIsDeleting] = useState<boolean>(false);\n const [isSharing, setIsSharing] = useState<boolean>(false);\n const sharingConfigValue = state.config?.requisition_list_sharing_enabled;\n const isShareEnabled =\n sharingConfigValue !== false && sharingConfigValue !== '0';\n const itemsCount = Number(\n requisitionList.items_count ?? requisitionList.items?.length ?? 0\n );\n const isShareDisabled = itemsCount <= 0 || !state.isCompanyUser;\n\n const translations = useText({\n actionBackToRequisitionLists: `RequisitionList.RequisitionListView.actionBackToRequisitionLists`,\n actionRename: `RequisitionList.RequisitionListView.actionRename`,\n actionDeleteList: `RequisitionList.RequisitionListView.actionDeleteList`,\n actionShare: `RequisitionList.RequisitionListView.actionShare`,\n shareDisabledReason: `RequisitionList.RequisitionListView.shareDisabledReason`,\n shareDisabledNoCompany: `RequisitionList.RequisitionListView.shareDisabledNoCompany`,\n shareListTitle: `RequisitionList.RequisitionListView.shareListTitle`,\n deleteListTitle: `RequisitionList.RequisitionListView.deleteListTitle`,\n deleteListMessage: `RequisitionList.RequisitionListView.deleteListMessage`,\n confirmAction: `RequisitionList.RequisitionListWrapper.confirmAction`,\n cancelAction: `RequisitionList.RequisitionListWrapper.cancelAction`,\n updateTitle: `RequisitionList.RequisitionListForm.updateTitle`,\n });\n\n const handleRename = useCallback(() => {\n setShowRenameModal(true);\n }, []);\n\n const handleRenameSubmit = useCallback(\n async (values: { name: string; description?: string }) => {\n try {\n const updatedList = await updateRequisitionList(\n requisitionList.uid,\n values.name,\n values.description,\n requisitionList.page_info?.page_size,\n requisitionList.page_info?.current_page,\n enrichConfigurableProducts\n );\n if (updatedList) {\n onUpdate?.(updatedList);\n setShowRenameModal(false);\n onAlert?.({\n action: 'update',\n type: 'success',\n context: 'requisitionList',\n });\n } else {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'update',\n type: 'error',\n context: 'requisitionList',\n });\n }\n },\n [\n requisitionList.uid,\n requisitionList.page_info,\n onUpdate,\n onAlert,\n enrichConfigurableProducts,\n ]\n );\n\n const handleDeleteList = useCallback(() => {\n setShowDeleteModal(true);\n }, []);\n\n const handleDeleteConfirm = useCallback(async () => {\n setIsDeleting(true);\n try {\n const result = await deleteRequisitionList(requisitionList.uid);\n if (result) {\n const alertPayload = {\n action: 'delete',\n type: 'success',\n context: 'requisitionList',\n };\n\n // Store alert in localStorage before redirecting\n // This ensures the alert is shown after redirect to grid view\n try {\n localStorage.setItem(\n 'requisitionListPendingAlert',\n JSON.stringify(alertPayload)\n );\n } catch (e) {\n // Ignore localStorage errors (e.g., in private browsing mode)\n }\n\n if (routeRequisitionListGrid) {\n const url = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (url && typeof url === 'string') {\n window.location.href = url;\n }\n }\n } else {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n }\n } catch (error) {\n onAlert?.({\n action: 'delete',\n type: 'error',\n context: 'requisitionList',\n });\n } finally {\n setIsDeleting(false);\n setShowDeleteModal(false);\n }\n }, [requisitionList.uid, routeRequisitionListGrid, onAlert]);\n\n const handleShare = useCallback(() => {\n setShowShareModal(true);\n }, []);\n\n const handleShareSubmit = useCallback(\n async (\n customerUids: string[]\n ): Promise<Array<ShareRequisitionListByEmailError> | null> => {\n setIsSharing(true);\n try {\n const errors = await shareRequisitionListByEmail(\n requisitionList.uid,\n customerUids\n );\n return errors;\n } catch {\n return [{ code: 'SHARE_FAILED', message: 'Unable to share list.' }];\n } finally {\n setIsSharing(false);\n }\n },\n [requisitionList.uid]\n );\n\n return (\n <>\n <RequisitionListHeaderComponent\n name={requisitionList.name}\n description={requisitionList.description}\n backLink={\n routeRequisitionListGrid\n ? {\n url: '#',\n label: translations.actionBackToRequisitionLists,\n onClick: (e: Event) => {\n e.preventDefault();\n const result = routeRequisitionListGrid();\n // If a URL is returned, navigate to it\n if (result && typeof result === 'string') {\n window.location.href = result;\n }\n },\n }\n : undefined\n }\n actions={{\n onRename: handleRename,\n onDelete: handleDeleteList,\n onShare: isShareEnabled && !isShareDisabled ? handleShare : undefined,\n renameLabel: translations.actionRename,\n deleteLabel: translations.actionDeleteList,\n shareLabel: isShareEnabled ? translations.actionShare : undefined,\n shareDisabled: isShareEnabled && isShareDisabled,\n shareDisabledReason:\n isShareEnabled && isShareDisabled\n ? itemsCount <= 0\n ? translations.shareDisabledReason\n : translations.shareDisabledNoCompany\n : undefined,\n }}\n />\n\n {/* Rename Modal */}\n {showRenameModal && (\n <RequisitionListModal\n isOpen={showRenameModal}\n isLoading={false}\n title={translations.updateTitle}\n modalContent={\n <RequisitionListForm\n mode=\"update\"\n defaultValues={{\n name: requisitionList.name,\n description: requisitionList.description || '',\n }}\n onSubmit={handleRenameSubmit}\n onCancel={() => setShowRenameModal(false)}\n />\n }\n handleModalOnClose={() => setShowRenameModal(false)}\n />\n )}\n\n {/* Delete Confirmation Modal */}\n {showDeleteModal && (\n <RequisitionListModal\n isOpen={showDeleteModal}\n isLoading={isDeleting}\n title={translations.deleteListTitle}\n modalContent={translations.deleteListMessage}\n confirmBtnCaption={translations.confirmAction}\n closeBtnCaption={translations.cancelAction}\n handleModalOnClose={() => setShowDeleteModal(false)}\n handleModalOnConfirm={handleDeleteConfirm}\n />\n )}\n\n {/* Share Modal */}\n {isShareEnabled && showShareModal && (\n <RequisitionListModal\n isOpen={showShareModal}\n isLoading={isSharing}\n title={translations.shareListTitle}\n modalContent={\n <ShareRequisitionListContent\n requisitionListUid={requisitionList.uid}\n isSubmitting={isSharing}\n onSubmit={handleShareSubmit}\n currentCustomerEmail={currentCustomerEmail}\n routeSharedRequisitionList={routeSharedRequisitionList}\n />\n }\n handleModalOnClose={() => setShowShareModal(false)}\n />\n )}\n </>\n );\n};\n"],"names":["RequisitionListHeader","name","description","backLink","actions","className","props","jsxs","jsx","e","_a","requisitionList","routeRequisitionListGrid","onUpdate","onAlert","enrichConfigurableProducts","currentCustomerEmail","routeSharedRequisitionList","showRenameModal","setShowRenameModal","useState","showDeleteModal","setShowDeleteModal","showShareModal","setShowShareModal","isDeleting","setIsDeleting","isSharing","setIsSharing","sharingConfigValue","state","isShareEnabled","itemsCount","_b","isShareDisabled","translations","useText","handleRename","useCallback","handleRenameSubmit","values","updatedList","updateRequisitionList","handleDeleteList","handleDeleteConfirm","deleteRequisitionList","alertPayload","url","handleShare","handleShareSubmit","customerUids","shareRequisitionListByEmail","Fragment","RequisitionListHeaderComponent","result","RequisitionListModal","RequisitionListForm","ShareRequisitionListContent"],"mappings":"ihBA0Ca,MAAAA,EAET,CAAC,CAAE,KAAAC,EAAM,YAAAC,EAAa,SAAAC,EAAU,QAAAC,EAAS,UAAAC,EAAW,GAAGC,KAEvDC,EAAC,OAAK,GAAGD,EAAO,UAAW,2BAA2BD,GAAa,EAAE,GAElE,SAAA,CACCF,GAAAK,EAAC,MAAI,CAAA,UAAU,gCACb,SAAAD,EAAC,IAAA,CACC,KAAMJ,EAAS,IACf,UAAU,qCACV,QAASA,EAAS,QAElB,SAAA,CAACK,EAAA,OAAA,CAAK,UAAU,sCAAsC,SAAI,IAAA,EACzDL,EAAS,KAAA,CAAA,CAAA,EAEd,EAIFI,EAAC,MAAI,CAAA,UAAU,gCACb,SAAA,CAACA,EAAA,MAAA,CAAI,UAAU,yCACb,SAAA,CAACC,EAAA,KAAA,CAAG,UAAU,iCAAkC,SAAKP,EAAA,EACpDC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OA,EACzB,CACF,EAEF,OAEN,QAAS,CACP,SAAUjB,EACV,SAAUM,EACV,QAASZ,GAAkB,CAACG,EAAkBc,EAAc,OAC5D,YAAab,EAAa,aAC1B,YAAaA,EAAa,iBAC1B,WAAYJ,EAAiBI,EAAa,YAAc,OACxD,cAAeJ,GAAkBG,EACjC,oBACEH,GAAkBG,EACdF,GAAc,EACZG,EAAa,oBACbA,EAAa,uBACf,MAAA,CACR,CACF,EAGCjB,GACCV,EAAC+C,EAAA,CACC,OAAQrC,EACR,UAAW,GACX,MAAOiB,EAAa,YACpB,aACE3B,EAACgD,EAAA,CACC,KAAK,SACL,cAAe,CACb,KAAM7C,EAAgB,KACtB,YAAaA,EAAgB,aAAe,EAC9C,EACA,SAAU4B,EACV,SAAU,IAAMpB,EAAmB,EAAK,CAAA,CAC1C,EAEF,mBAAoB,IAAMA,EAAmB,EAAK,CAAA,CACpD,EAIDE,GACCb,EAAC+C,EAAA,CACC,OAAQlC,EACR,UAAWI,EACX,MAAOU,EAAa,gBACpB,aAAcA,EAAa,kBAC3B,kBAAmBA,EAAa,cAChC,gBAAiBA,EAAa,aAC9B,mBAAoB,IAAMb,EAAmB,EAAK,EAClD,qBAAsBsB,CAAA,CACxB,EAIDb,GAAkBR,GACjBf,EAAC+C,EAAA,CACC,OAAQhC,EACR,UAAWI,EACX,MAAOQ,EAAa,eACpB,aACE3B,EAACiD,EAAA,CACC,mBAAoB9C,EAAgB,IACpC,aAAcgB,EACd,SAAUsB,EACV,qBAAAjC,EACA,2BAAAC,CAAA,CACF,EAEF,mBAAoB,IAAMO,EAAkB,EAAK,CAAA,CAAA,CACnD,EAEJ,CAEJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! Copyright 2026 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import*as i from"@dropins/tools/preact-compat.js";import{useState as
|
|
3
|
+
import*as i from"@dropins/tools/preact-compat.js";import{useState as m,useEffect as v,useMemo as q,useCallback as x}from"@dropins/tools/preact-compat.js";import{s as p}from"./state.js";import{events as h}from"@dropins/tools/event-bus.js";import{useText as E}from"@dropins/tools/i18n.js";import{jsxs as I,jsx as d}from"@dropins/tools/preact-jsx-runtime.js";import{Icon as M}from"@dropins/tools/components.js";import{classes as D}from"@dropins/tools/lib.js";function R(){const t=p.config;return t?t.is_requisition_list_active==="1"&&t.company_enabled===!0:!1}const j=()=>{const[t,r]=m(R);return v(()=>{const s=h.on("requisitionList/initialized",()=>{const o=R();r(e=>p.config!=null?o:e)});return()=>s==null?void 0:s.off()},[]),{isEnabled:t}},U=t=>i.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},i.createElement("rect",{x:4.89282,y:2.75,width:14.2143,height:18.5,rx:2.25,stroke:"currentColor",strokeWidth:1}),i.createElement("line",{x1:9.85718,y1:7.67871,x2:16.2857,y2:7.67871,stroke:"currentColor",strokeWidth:1}),i.createElement("line",{x1:9.85718,y1:11.9644,x2:16.2857,y2:11.9644,stroke:"currentColor",strokeWidth:1}),i.createElement("line",{x1:9.85718,y1:16.25,x2:16.2857,y2:16.25,stroke:"currentColor",strokeWidth:1}),i.createElement("circle",{cx:7.71429,cy:7.71429,r:.714286,fill:"currentColor"}),i.createElement("circle",{cx:7.71429,cy:11.9999,r:.714286,fill:"currentColor"}),i.createElement("circle",{cx:7.71429,cy:16.2856,r:.714286,fill:"currentColor"}));function N(t){const[r,s]=m(null),o=E({errorCreate:"RequisitionList.RequisitionListAlert.errorCreate",successCreate:"RequisitionList.RequisitionListAlert.successCreate",errorDeleteItem:"RequisitionList.RequisitionListAlert.errorDeleteItem",successDeleteItem:"RequisitionList.RequisitionListAlert.successDeleteItem",errorDeleteReqList:"RequisitionList.RequisitionListAlert.errorDeleteReqList",successDeleteReqList:"RequisitionList.RequisitionListAlert.successDeleteReqList",errorAddToCart:"RequisitionList.RequisitionListAlert.errorAddToCart",successAddToCart:"RequisitionList.RequisitionListAlert.successAddToCart",errorUpdateQuantity:"RequisitionList.RequisitionListAlert.errorUpdateQuantity",successUpdateQuantity:"RequisitionList.RequisitionListAlert.successUpdateQuantity",errorUpdate:"RequisitionList.RequisitionListAlert.errorUpdate",successUpdate:"RequisitionList.RequisitionListAlert.successUpdate",errorMove:"RequisitionList.RequisitionListAlert.errorMove",successMove:"RequisitionList.RequisitionListAlert.successMove",errorAddToRequisitionList:"RequisitionList.RequisitionListAlert.errorAddToRequisitionList",successAddToRequisitionList:"RequisitionList.RequisitionListAlert.successAddToRequisitionList",errorMoveToList:"RequisitionList.RequisitionListAlert.errorMoveToList",successMoveToList:"RequisitionList.RequisitionListAlert.successMoveToList",errorCopyToList:"RequisitionList.RequisitionListAlert.errorCopyToList",successCopyToList:"RequisitionList.RequisitionListAlert.successCopyToList",errorImport:"RequisitionList.RequisitionListAlert.errorImport",successImport:"RequisitionList.RequisitionListAlert.successImport"}),e=q(()=>({...o,...t}),[o,t]),l=q(()=>({create:{requisitionList:{success:e.successCreate,error:e.errorCreate}},add:{product:{success:e.successAddToRequisitionList,error:e.errorAddToRequisitionList}},update:{product:{success:e.successUpdateQuantity,error:e.errorUpdateQuantity},requisitionList:{success:e.successUpdate,error:e.errorUpdate}},delete:{product:{success:e.successDeleteItem,error:e.errorDeleteItem},requisitionList:{success:e.successDeleteReqList,error:e.errorDeleteReqList}},move:{product:{success:e.successMove,error:e.errorMove}},moveToList:{product:{success:e.successMoveToList,error:e.errorMoveToList}},copyToList:{product:{success:e.successCopyToList,error:e.errorCopyToList}},import:{requisitionList:{success:e.successImport,error:e.errorImport}}}),[e]),A=x(y=>{const{type:L,action:T,context:f,skus:c,message:u,listName:a}=y;let n=u&&u.length>0?u.join(". "):l[T][f][L];a&&(n=n.replace("{listName}",a)),s({type:L,description:n,sku:c==null?void 0:c[0]});const C=setTimeout(()=>{s(null)},5e3);return()=>clearTimeout(C)},[l]);return{alert:r,setAlert:s,handleRequisitionListAlert:A}}const S=({className:t,textContent:r,...s})=>I("div",{className:D(["empty-list",t]),"data-testid":"empty-list",...s,children:[d(M,{source:U,size:"64",stroke:"2"}),r&&d("h4",{children:r})]});export{S as E,U as S,N as a,j as u};
|
|
4
4
|
//# sourceMappingURL=RequisitionListView.js.map
|