@dropins/storefront-company-management 1.0.0-alpha2001 → 1.0.0-alpha3000
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/allowCompanyRegistration/allowCompanyRegistration.d.ts +18 -0
- package/api/allowCompanyRegistration/graphql/allowCompanyRegistration.graphql.d.ts +18 -0
- package/api/allowCompanyRegistration/index.d.ts +18 -0
- package/api/companyEnabled/companyEnabled.d.ts +18 -0
- package/api/companyEnabled/graphql/companyEnabled.graphql.d.ts +18 -0
- package/api/{getCompanyUsers → companyEnabled}/index.d.ts +1 -1
- package/api/companyRoles/createCompanyRole.d.ts +7 -0
- package/api/companyRoles/deleteCompanyRole.d.ts +7 -0
- package/api/companyRoles/getCompanyAclResources.d.ts +7 -0
- package/api/companyRoles/getCompanyRole.d.ts +8 -0
- package/api/companyRoles/getCompanyRoles.d.ts +8 -0
- package/api/companyRoles/graphql/fragments.d.ts +18 -0
- package/api/companyRoles/graphql/index.d.ts +20 -0
- package/api/companyRoles/graphql/mutations.d.ts +20 -0
- package/api/companyRoles/graphql/queries.d.ts +21 -0
- package/api/companyRoles/index.d.ts +27 -0
- package/api/companyRoles/isCompanyRoleNameAvailable.d.ts +7 -0
- package/api/companyRoles/updateCompanyRole.d.ts +7 -0
- package/api/companyRoles/utils.d.ts +11 -0
- package/api/createCompany/createCompany.d.ts +39 -0
- package/api/{getCompanyUsers/graphql/companyUsers.graphql.d.ts → createCompany/graphql/createCompany.graphql.d.ts} +2 -2
- package/api/{deleteCompanyUser → createCompany}/index.d.ts +1 -1
- package/api/getStoreConfig/getStoreConfig.d.ts +6 -0
- package/api/{deleteCompanyUser/graphql/deleteCompanyUser.graphql.d.ts → getStoreConfig/graphql/getStoreConfig.graphql.d.ts} +2 -2
- package/api/getStoreConfig/index.d.ts +18 -0
- package/api/index.d.ts +7 -4
- package/api/isCompanyAdmin/graphql/isCompanyAdmin.graphql.d.ts +18 -0
- package/api/{checkIsCompanyEnabled → isCompanyAdmin}/index.d.ts +1 -1
- package/api/isCompanyAdmin/isCompanyAdmin.d.ts +22 -0
- package/api/isCompanyUser/graphql/isCompanyUser.graphql.d.ts +18 -0
- package/api/{updateCompanyUserStatus → isCompanyUser}/index.d.ts +1 -1
- package/api/isCompanyUser/isCompanyUser.d.ts +22 -0
- package/api.js +16 -1
- package/api.js.map +1 -1
- package/chunks/company-permissions.js +4 -0
- package/chunks/company-permissions.js.map +1 -0
- package/chunks/createCompany.js +44 -0
- package/chunks/createCompany.js.map +1 -0
- package/chunks/fetch-error.js +1 -1
- package/chunks/fetch-error.js.map +1 -1
- package/chunks/fetch-graphql.js +4 -0
- package/chunks/fetch-graphql.js.map +1 -0
- package/chunks/fetchUserPermissions.js +2 -2
- package/chunks/fetchUserPermissions.js.map +1 -1
- package/chunks/getCustomerCompany.js +8 -2
- package/chunks/getCustomerCompany.js.map +1 -1
- package/chunks/isCompanyRoleNameAvailable.js +121 -0
- package/chunks/isCompanyRoleNameAvailable.js.map +1 -0
- package/chunks/isCompanyUser.js +21 -0
- package/chunks/isCompanyUser.js.map +1 -0
- package/chunks/updateCompany.js +69 -0
- package/chunks/updateCompany.js.map +1 -0
- package/chunks/useInLineAlert.js +1 -1
- package/chunks/useInLineAlert.js.map +1 -1
- package/chunks/validateCompanyEmail.js +21 -2
- package/chunks/validateCompanyEmail.js.map +1 -1
- package/components/CompanyLoaders/CompanyLoaders.d.ts +0 -3
- package/components/CompanyRegistrationForm/CompanyRegistrationForm.d.ts +13 -0
- package/components/CompanyRegistrationForm/Form/Form.d.ts +5 -0
- package/components/CompanyRegistrationForm/Form/FormInputs/FormInputs.d.ts +5 -0
- package/components/CompanyRegistrationForm/Form/FormInputs/index.d.ts +18 -0
- package/components/CompanyRegistrationForm/Form/fieldHandlers.d.ts +26 -0
- package/components/CompanyRegistrationForm/Form/fieldValidationRules.d.ts +63 -0
- package/components/CompanyRegistrationForm/Form/formValidation.d.ts +17 -0
- package/components/CompanyRegistrationForm/Form/getCompanyFieldsConfig.d.ts +13 -0
- package/components/CompanyRegistrationForm/Form/index.d.ts +18 -0
- package/components/CompanyRegistrationForm/index.d.ts +20 -0
- package/components/CompanyRegistrationSuccess/CompanyRegistrationSuccess.d.ts +8 -0
- package/components/CompanyRegistrationSuccess/index.d.ts +18 -0
- package/components/CompanyStructureEmpty/CompanyStructureEmpty.d.ts +9 -0
- package/components/CompanyStructureEmpty/index.d.ts +19 -0
- package/components/DeleteRoleModal/DeleteRoleModal.d.ts +9 -0
- package/components/DeleteRoleModal/index.d.ts +19 -0
- package/components/EditRoleAndPermission/EditRoleAndPermission.d.ts +24 -0
- package/components/EditRoleAndPermission/index.d.ts +19 -0
- package/components/RoleAndPermissionTable/RoleAndPermissionTable.d.ts +20 -0
- package/components/RoleAndPermissionTable/index.d.ts +19 -0
- package/components/Tree/Tree.d.ts +2 -0
- package/components/index.d.ts +6 -1
- package/containers/CompanyProfile.js +1 -1
- package/containers/CompanyProfile.js.map +1 -1
- package/containers/CompanyRegistration/CompanyRegistration.d.ts +15 -0
- package/containers/CompanyRegistration/index.d.ts +19 -0
- package/containers/CompanyRegistration.d.ts +3 -0
- package/containers/CompanyRegistration.js +4 -0
- package/containers/CompanyRegistration.js.map +1 -0
- package/containers/CompanyStructure/CompanyStructure.d.ts +10 -0
- package/containers/CompanyStructure/index.d.ts +19 -0
- package/containers/CompanyStructure.d.ts +3 -0
- package/containers/CompanyStructure.js +4 -0
- package/containers/CompanyStructure.js.map +1 -0
- package/containers/CustomerCompanyInfo.js +1 -1
- package/containers/CustomerCompanyInfo.js.map +1 -1
- package/containers/RolesAndPermissions/RolesAndPermissions.d.ts +8 -0
- package/containers/RolesAndPermissions/index.d.ts +19 -0
- package/containers/RolesAndPermissions.d.ts +3 -0
- package/containers/RolesAndPermissions.js +4 -0
- package/containers/RolesAndPermissions.js.map +1 -0
- package/containers/index.d.ts +3 -1
- package/data/models/company-role.d.ts +48 -0
- package/data/models/company.d.ts +56 -17
- package/data/models/index.d.ts +1 -0
- package/data/transforms/company.d.ts +5 -0
- package/data/transforms/index.d.ts +2 -0
- package/data/transforms/transform-company-roles.d.ts +15 -0
- package/data/transforms/transform-company.d.ts +5 -1
- package/data/transforms/transform-store-config.d.ts +4 -0
- package/hooks/containers/index.d.ts +0 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/useCompanyRegistrationForm.d.ts +37 -0
- package/hooks/useCompanyRoles.d.ts +27 -0
- package/hooks/useCountryAndRegionFields.d.ts +20 -0
- package/hooks/useUserPermissions.d.ts +12 -0
- package/i18n/en_US.json.d.ts +105 -73
- package/lib/company-permissions.d.ts +7 -0
- package/lib/index.d.ts +0 -2
- package/package.json +1 -1
- package/render.js +6 -5
- package/render.js.map +1 -1
- package/types/api/companyRoles.types.d.ts +137 -0
- package/types/api/{deleteCompanyUser.types.d.ts → getStoreConfig.types.d.ts} +14 -9
- package/types/form.types.d.ts +93 -0
- package/types/index.d.ts +8 -2
- package/api/checkIsCompanyEnabled/checkIsCompanyEnabled.d.ts +0 -4
- package/api/deleteCompanyUser/deleteCompanyUser.d.ts +0 -10
- package/api/getCompanyUsers/getCompanyUsers.d.ts +0 -12
- package/api/updateCompanyUserStatus/graphql/updateCompanyUserStatus.graphql.d.ts +0 -18
- package/api/updateCompanyUserStatus/updateCompanyUserStatus.d.ts +0 -11
- package/chunks/getCompanyUsers.js +0 -45
- package/chunks/getCompanyUsers.js.map +0 -1
- package/chunks/getCountries.js +0 -88
- package/chunks/getCountries.js.map +0 -1
- package/components/CompanyUsersManagementModal/CompanyUsersManagementModal.d.ts +0 -16
- package/components/CompanyUsersManagementModal/index.d.ts +0 -19
- package/containers/CompanyUsers/CompanyUsers.d.ts +0 -7
- package/containers/CompanyUsers/index.d.ts +0 -19
- package/containers/CompanyUsers.d.ts +0 -3
- package/containers/CompanyUsers.js +0 -4
- package/containers/CompanyUsers.js.map +0 -1
- package/hooks/containers/useCompanyUsers.d.ts +0 -33
- package/lib/encoding.d.ts +0 -43
- package/lib/userHelpers.d.ts +0 -47
- package/types/api/checkIsCompanyEnabled.types.d.ts +0 -21
- package/types/api/companyUsers.types.d.ts +0 -70
- package/types/api/index.d.ts +0 -26
- package/types/api/updateCompanyUserStatus.types.d.ts +0 -22
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const allowCompanyRegistration: () => Promise<boolean>;
|
|
18
|
+
//# sourceMappingURL=allowCompanyRegistration.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const GET_ALLOW_COMPANY_REGISTRATION = "\n query GET_ALLOW_COMPANY_REGISTRATION {\n storeConfig {\n allow_company_registration\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=allowCompanyRegistration.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './allowCompanyRegistration';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const companyEnabled: () => Promise<boolean>;
|
|
18
|
+
//# sourceMappingURL=companyEnabled.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const GET_COMPANY_ENABLED = "\n query GET_COMPANY_ENABLED {\n storeConfig {\n company_enabled\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=companyEnabled.graphql.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 * from './
|
|
17
|
+
export * from './companyEnabled';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CompanyRoleModel, CompanyRoleCreateInputModel } from '../../data/models/company-role';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a new company role
|
|
5
|
+
*/
|
|
6
|
+
export declare const createCompanyRole: (input: CompanyRoleCreateInputModel) => Promise<CompanyRoleModel>;
|
|
7
|
+
//# sourceMappingURL=createCompanyRole.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DeleteCompanyRoleVariables } from '../../types/api/companyRoles.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Delete a company role
|
|
5
|
+
*/
|
|
6
|
+
export declare const deleteCompanyRole: (variables: DeleteCompanyRoleVariables) => Promise<boolean>;
|
|
7
|
+
//# sourceMappingURL=deleteCompanyRole.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CompanyAclResourceModel } from '../../data/models/company-role';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fetch all available ACL resources (permissions)
|
|
5
|
+
*/
|
|
6
|
+
export declare const getCompanyAclResources: () => Promise<CompanyAclResourceModel[]>;
|
|
7
|
+
//# sourceMappingURL=getCompanyAclResources.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetCompanyRoleVariables } from '../../types/api/companyRoles.types';
|
|
2
|
+
import { CompanyRoleModel } from '../../data/models/company-role';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fetch a single company role by ID
|
|
6
|
+
*/
|
|
7
|
+
export declare const getCompanyRole: (variables: GetCompanyRoleVariables) => Promise<CompanyRoleModel>;
|
|
8
|
+
//# sourceMappingURL=getCompanyRole.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GetCompanyRolesVariables } from '../../types/api/companyRoles.types';
|
|
2
|
+
import { CompanyRolesResponseModel } from '../../data/models/company-role';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fetch all company roles with pagination
|
|
6
|
+
*/
|
|
7
|
+
export declare const getCompanyRoles: (variables?: GetCompanyRolesVariables) => Promise<CompanyRolesResponseModel>;
|
|
8
|
+
//# sourceMappingURL=getCompanyRoles.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const COMPANY_ROLE_FRAGMENT = "\n fragment CompanyRoleFragment on CompanyRole {\n id\n name\n users_count\n permissions {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n }\n }\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=fragments.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './fragments';
|
|
18
|
+
export * from './queries';
|
|
19
|
+
export * from './mutations';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const CREATE_COMPANY_ROLE: string;
|
|
18
|
+
export declare const UPDATE_COMPANY_ROLE: string;
|
|
19
|
+
export declare const DELETE_COMPANY_ROLE = "\n mutation DeleteCompanyRole($id: ID!) {\n deleteCompanyRole(id: $id) {\n success\n }\n }\n";
|
|
20
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const GET_COMPANY_ROLES: string;
|
|
18
|
+
export declare const GET_COMPANY_ROLE: string;
|
|
19
|
+
export declare const GET_COMPANY_ACL_RESOURCES = "\n query GetCompanyAclResources {\n company {\n acl_resources {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n children {\n id\n text\n sort_order\n }\n }\n }\n }\n }\n }\n }\n";
|
|
20
|
+
export declare const IS_COMPANY_ROLE_NAME_AVAILABLE = "\n query IsCompanyRoleNameAvailable($name: String!) {\n isCompanyRoleNameAvailable(name: $name) {\n is_role_name_available\n }\n }\n";
|
|
21
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export { getCompanyRoles } from './getCompanyRoles';
|
|
18
|
+
export { getCompanyRole } from './getCompanyRole';
|
|
19
|
+
export { getCompanyAclResources } from './getCompanyAclResources';
|
|
20
|
+
export { createCompanyRole } from './createCompanyRole';
|
|
21
|
+
export { updateCompanyRole } from './updateCompanyRole';
|
|
22
|
+
export { deleteCompanyRole } from './deleteCompanyRole';
|
|
23
|
+
export { isCompanyRoleNameAvailable } from './isCompanyRoleNameAvailable';
|
|
24
|
+
export { flattenPermissionIds, buildPermissionTree } from './utils';
|
|
25
|
+
export type { CompanyAclResourceModel, CompanyRoleModel, PageInfoModel, CompanyRolesResponseModel, CompanyRoleCreateInputModel, CompanyRoleUpdateInputModel, } from '../../data/models/company-role';
|
|
26
|
+
export type { GetCompanyRolesVariables, GetCompanyRoleVariables, DeleteCompanyRoleVariables, IsCompanyRoleNameAvailableVariables, } from '../../types/api/companyRoles.types';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IsCompanyRoleNameAvailableVariables } from '../../types/api/companyRoles.types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if a role name is available
|
|
5
|
+
*/
|
|
6
|
+
export declare const isCompanyRoleNameAvailable: (variables: IsCompanyRoleNameAvailableVariables) => Promise<boolean>;
|
|
7
|
+
//# sourceMappingURL=isCompanyRoleNameAvailable.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CompanyRoleModel, CompanyRoleUpdateInputModel } from '../../data/models/company-role';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Update an existing company role
|
|
5
|
+
*/
|
|
6
|
+
export declare const updateCompanyRole: (input: CompanyRoleUpdateInputModel) => Promise<CompanyRoleModel>;
|
|
7
|
+
//# sourceMappingURL=updateCompanyRole.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CompanyAclResourceModel } from '../../data/models/company-role';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Helper function to flatten ACL resources into a list of permission IDs
|
|
5
|
+
*/
|
|
6
|
+
export declare const flattenPermissionIds: (resources: CompanyAclResourceModel[]) => string[];
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to build a permission tree from flat permission IDs
|
|
9
|
+
*/
|
|
10
|
+
export declare const buildPermissionTree: (allResources: CompanyAclResourceModel[], selectedIds: string[]) => CompanyAclResourceModel[];
|
|
11
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CompanyRegistrationModel } from '../../data/models/company';
|
|
2
|
+
|
|
3
|
+
export interface CompanyCreateInput {
|
|
4
|
+
company_name: string;
|
|
5
|
+
company_email: string;
|
|
6
|
+
legal_name?: string;
|
|
7
|
+
vat_tax_id?: string;
|
|
8
|
+
reseller_id?: string;
|
|
9
|
+
legal_address: {
|
|
10
|
+
street: string[];
|
|
11
|
+
city: string;
|
|
12
|
+
region: {
|
|
13
|
+
region_code: string;
|
|
14
|
+
region?: string;
|
|
15
|
+
region_id?: number;
|
|
16
|
+
};
|
|
17
|
+
postcode: string;
|
|
18
|
+
country_id: string;
|
|
19
|
+
telephone?: string;
|
|
20
|
+
};
|
|
21
|
+
company_admin: {
|
|
22
|
+
email: string;
|
|
23
|
+
firstname: string;
|
|
24
|
+
lastname: string;
|
|
25
|
+
job_title?: string;
|
|
26
|
+
telephone?: string;
|
|
27
|
+
gender?: number;
|
|
28
|
+
custom_attributes?: Array<{
|
|
29
|
+
attribute_code: string;
|
|
30
|
+
value: string;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare const createCompany: (formData: any) => Promise<{
|
|
35
|
+
success: boolean;
|
|
36
|
+
company?: CompanyRegistrationModel;
|
|
37
|
+
errors?: string[];
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=createCompany.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
|
|
18
|
-
//# sourceMappingURL=
|
|
17
|
+
export declare const CREATE_COMPANY_MUTATION = "\n mutation CreateCompany($input: CompanyCreateInput!) {\n createCompany(input: $input) {\n company {\n id\n name\n email\n legal_name\n vat_tax_id\n reseller_id\n legal_address {\n street\n city\n region {\n region_code\n region\n region_id\n }\n postcode\n country_code\n telephone\n }\n company_admin {\n id\n firstname\n lastname\n email\n job_title\n telephone\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=createCompany.graphql.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 * from './
|
|
17
|
+
export * from './createCompany';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StoreConfigModel } from '../../types';
|
|
2
|
+
|
|
3
|
+
export declare const DEFAULT_COUNTRY = "US";
|
|
4
|
+
export declare const STORE_CONFIG_DEFAULTS: StoreConfigModel;
|
|
5
|
+
export declare const getStoreConfig: () => Promise<StoreConfigModel>;
|
|
6
|
+
//# sourceMappingURL=getStoreConfig.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
|
|
18
|
-
//# sourceMappingURL=
|
|
17
|
+
export declare const GET_STORE_CONFIG_QUERY = "\n query getStoreConfig {\n storeConfig {\n default_country\n store_code\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=getStoreConfig.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export { getStoreConfig, STORE_CONFIG_DEFAULTS, DEFAULT_COUNTRY } from './getStoreConfig';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/api/index.d.ts
CHANGED
|
@@ -17,13 +17,16 @@
|
|
|
17
17
|
export * from './initialize';
|
|
18
18
|
export * from './fetch-graphql';
|
|
19
19
|
export * from './fetchUserPermissions';
|
|
20
|
-
export * from './checkIsCompanyEnabled';
|
|
21
|
-
export * from './deleteCompanyUser';
|
|
22
20
|
export * from './getCompany';
|
|
23
21
|
export * from './updateCompany';
|
|
24
|
-
export * from './updateCompanyUserStatus';
|
|
25
22
|
export * from './getCountries';
|
|
23
|
+
export * from './getStoreConfig';
|
|
26
24
|
export * from './validateCompanyEmail';
|
|
27
25
|
export * from './getCustomerCompany';
|
|
28
|
-
export * from './
|
|
26
|
+
export * from './companyEnabled';
|
|
27
|
+
export * from './allowCompanyRegistration';
|
|
28
|
+
export * from './createCompany';
|
|
29
|
+
export * from './isCompanyUser';
|
|
30
|
+
export * from './isCompanyAdmin';
|
|
31
|
+
export * from './companyRoles';
|
|
29
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const GET_CUSTOMER_COMPANIES_WITH_ROLES = "\n query GET_CUSTOMER_COMPANIES_WITH_ROLES {\n customer {\n companies(input: {}) {\n items {\n id\n name\n }\n }\n role {\n id\n name\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=isCompanyAdmin.graphql.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 * from './
|
|
17
|
+
export * from './isCompanyAdmin';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
/**
|
|
18
|
+
* Check if the current authenticated customer is a company administrator in any company
|
|
19
|
+
* @returns Promise<boolean> - true if customer is a company admin in at least one company, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
export declare const isCompanyAdmin: () => Promise<boolean>;
|
|
22
|
+
//# sourceMappingURL=isCompanyAdmin.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const GET_CUSTOMER_COMPANIES = "\n query GET_CUSTOMER_COMPANIES {\n customer {\n companies(input: {}) {\n items {\n id\n name\n }\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=isCompanyUser.graphql.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 * from './
|
|
17
|
+
export * from './isCompanyUser';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
/**
|
|
18
|
+
* Check if the current authenticated customer belongs to any company
|
|
19
|
+
* @returns Promise<boolean> - true if customer belongs to one or more companies, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
export declare const isCompanyUser: () => Promise<boolean>;
|
|
22
|
+
//# sourceMappingURL=isCompanyUser.d.ts.map
|
package/api.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{f as
|
|
3
|
+
import{f as m}from"./chunks/fetch-graphql.js";import{g as x,r as I,s as N,a as P,b as U}from"./chunks/fetch-graphql.js";import{f as b}from"./chunks/fetchUserPermissions.js";import{g as H,u as L}from"./chunks/updateCompany.js";import{g as v,v as Q}from"./chunks/validateCompanyEmail.js";import{D as k,S as W,c as Y,g as q}from"./chunks/createCompany.js";import{c as j,g as B}from"./chunks/getCustomerCompany.js";import{a as K,i as V}from"./chunks/isCompanyUser.js";import{G as c,t as l}from"./chunks/isCompanyRoleNameAvailable.js";import{c as Z,d as $,a as ee,g as re,i as ae,u as te}from"./chunks/isCompanyRoleNameAvailable.js";import{a as p}from"./chunks/fetch-error.js";import{a as f}from"./chunks/company-permissions.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/event-bus.js";const R=async e=>{try{const a=await m(c,{variables:e,method:"GET",cache:"no-cache"});return l(a)}catch(a){return p(a)}},T=e=>f(e),S=(e,a)=>{const n=new Set(a),o=r=>{var t;const s=((t=r.children)==null?void 0:t.map(o).filter(i=>i!==null))||[];return n.has(r.id)||s.length>0?{...r,children:s}:null};return e.map(o).filter(r=>r!==null)},_=async(e={})=>({success:!0,config:e}),u=`
|
|
4
|
+
query GET_CUSTOMER_COMPANIES_WITH_ROLES {
|
|
5
|
+
customer {
|
|
6
|
+
companies(input: {}) {
|
|
7
|
+
items {
|
|
8
|
+
id
|
|
9
|
+
name
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
role {
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`,A=async()=>{var e,a,n;try{const o=await m(u,{method:"POST"});if((e=o.errors)!=null&&e.length)return!1;const r=(a=o.data)==null?void 0:a.customer;if(!r)return!1;const s=((n=r.companies)==null?void 0:n.items)??[];if(!Array.isArray(s)||s.length===0)return!1;const t=r.role;return t?t.id==="0"||typeof t.id=="number"&&t.id===0||t.name==="Company Administrator":!1}catch(o){return console.error("Error checking if customer is company admin:",o),!1}};export{k as DEFAULT_COUNTRY,W as STORE_CONFIG_DEFAULTS,K as allowCompanyRegistration,S as buildPermissionTree,j as companyEnabled,Y as createCompany,Z as createCompanyRole,$ as deleteCompanyRole,m as fetchGraphQl,b as fetchUserPermissions,T as flattenPermissionIds,H as getCompany,ee as getCompanyAclResources,R as getCompanyRole,re as getCompanyRoles,x as getConfig,v as getCountries,B as getCustomerCompany,q as getStoreConfig,_ as initialize,A as isCompanyAdmin,ae as isCompanyRoleNameAvailable,V as isCompanyUser,I as removeFetchGraphQlHeader,N as setEndpoint,P as setFetchGraphQlHeader,U as setFetchGraphQlHeaders,L as updateCompany,te as updateCompanyRole,Q as validateCompanyEmail};
|
|
4
19
|
//# sourceMappingURL=api.js.map
|
package/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sources":["/@dropins/storefront-company-management/src/api/initialize/initialize.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n// import { events } from '@adobe-commerce/event-bus';\n\n\nexport interface CompanyDropinConfig {\n langDefinitions?: Record<string, Record<string, string>>;\n models?: Record<string, any>;\n}\n\nexport const initialize = async (config: CompanyDropinConfig = {}) => {\n return {\n success: true,\n config,\n };\n};\n"],"names":["initialize","config"],"mappings":"wbAyBO,MAAMA,EAAa,MAAOC,EAA8B,MACtD,CACL,QAAS,GACT,OAAAA,CACF"}
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-company-management/src/api/companyRoles/getCompanyRole.ts","/@dropins/storefront-company-management/src/api/companyRoles/utils.ts","/@dropins/storefront-company-management/src/api/initialize/initialize.ts","/@dropins/storefront-company-management/src/api/isCompanyAdmin/graphql/isCompanyAdmin.graphql.ts","/@dropins/storefront-company-management/src/api/isCompanyAdmin/isCompanyAdmin.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { GET_COMPANY_ROLE } from './graphql/queries';\nimport { GetCompanyRoleVariables, GetCompanyRoleResponse } from '../../types/api/companyRoles.types';\nimport { CompanyRoleModel } from '../../data/models/company-role';\nimport { transformGetCompanyRoleResponse } from '../../data/transforms/transform-company-roles';\n\n/**\n * Fetch a single company role by ID\n */\nexport const getCompanyRole = async (\n variables: GetCompanyRoleVariables\n): Promise<CompanyRoleModel> => {\n try {\n const response: GetCompanyRoleResponse = await fetchGraphQl(GET_COMPANY_ROLE, {\n variables,\n method: 'GET',\n cache: 'no-cache',\n });\n\n return transformGetCompanyRoleResponse(response);\n } catch (error) {\n return handleNetworkError(error as Error);\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 { flattenIdsToArray } from '../../lib/company-permissions';\nimport { CompanyAclResourceModel } from '../../data/models/company-role';\n\n/**\n * Helper function to flatten ACL resources into a list of permission IDs\n */\nexport const flattenPermissionIds = (resources: CompanyAclResourceModel[]): string[] => {\n return flattenIdsToArray(resources);\n};\n\n/**\n * Helper function to build a permission tree from flat permission IDs\n */\nexport const buildPermissionTree = (\n allResources: CompanyAclResourceModel[],\n selectedIds: string[]\n): CompanyAclResourceModel[] => {\n const selectedSet = new Set(selectedIds);\n \n const filterTree = (resource: CompanyAclResourceModel): CompanyAclResourceModel | null => {\n const filteredChildren = resource.children\n ?.map(filterTree)\n .filter((child): child is CompanyAclResourceModel => child !== null) || [];\n \n if (selectedSet.has(resource.id) || filteredChildren.length > 0) {\n return {\n ...resource,\n children: filteredChildren,\n };\n }\n \n return null;\n };\n \n return allResources\n .map(filterTree)\n .filter((resource): resource is CompanyAclResourceModel => resource !== null);\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// import { events } from '@adobe-commerce/event-bus';\n\n\nexport interface CompanyDropinConfig {\n langDefinitions?: Record<string, Record<string, string>>;\n models?: Record<string, any>;\n}\n\nexport const initialize = async (config: CompanyDropinConfig = {}) => {\n return {\n success: true,\n config,\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 GET_CUSTOMER_COMPANIES_WITH_ROLES = /* GraphQL */ `\n query GET_CUSTOMER_COMPANIES_WITH_ROLES {\n customer {\n companies(input: {}) {\n items {\n id\n name\n }\n }\n role {\n id\n name\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 '../fetch-graphql';\nimport { GET_CUSTOMER_COMPANIES_WITH_ROLES } from './graphql/isCompanyAdmin.graphql';\n\ninterface CompanyRole {\n id: string;\n name: string;\n}\n\ninterface CompanyBasicInfo {\n id: string;\n name: string;\n}\n\ninterface CustomerCompaniesWithRolesResponse {\n customer: {\n companies: {\n items: CompanyBasicInfo[];\n };\n role: CompanyRole | null;\n } | null;\n}\n\n/**\n * Check if the current authenticated customer is a company administrator in any company\n * @returns Promise<boolean> - true if customer is a company admin in at least one company, false otherwise\n */\nexport const isCompanyAdmin = async (): Promise<boolean> => {\n try {\n const response = await fetchGraphQl<CustomerCompaniesWithRolesResponse>(GET_CUSTOMER_COMPANIES_WITH_ROLES, {\n method: 'POST',\n });\n\n if (response.errors?.length) {\n return false;\n }\n\n const customer = response.data?.customer;\n if (!customer) {\n return false;\n }\n\n // Check if user is part of at least one company\n const companies = customer.companies?.items ?? [];\n if (!Array.isArray(companies) || companies.length === 0) {\n return false;\n }\n\n // Check if user has admin role\n const customerRole = customer.role;\n if (!customerRole) {\n return false;\n }\n\n // Check if user is company administrator by role ID or name\n return customerRole.id === '0' || \n (typeof customerRole.id === 'number' && customerRole.id === 0) ||\n customerRole.name === 'Company Administrator';\n } catch (error) {\n console.error('Error checking if customer is company admin:', error);\n return false;\n }\n};\n"],"names":["getCompanyRole","variables","response","fetchGraphQl","GET_COMPANY_ROLE","transformGetCompanyRoleResponse","error","handleNetworkError","flattenPermissionIds","resources","flattenIdsToArray","buildPermissionTree","allResources","selectedIds","selectedSet","filterTree","resource","filteredChildren","_a","child","initialize","config","GET_CUSTOMER_COMPANIES_WITH_ROLES","isCompanyAdmin","customer","_b","companies","_c","customerRole"],"mappings":"gyBA2Ba,MAAAA,EAAiB,MAC5BC,GAC8B,CAC1B,GAAA,CACI,MAAAC,EAAmC,MAAMC,EAAaC,EAAkB,CAC5E,UAAAH,EACA,OAAQ,MACR,MAAO,UAAA,CACR,EAED,OAAOI,EAAgCH,CAAQ,QACxCI,EAAO,CACd,OAAOC,EAAmBD,CAAc,CAAA,CAE5C,EClBaE,EAAwBC,GAC5BC,EAAkBD,CAAS,EAMvBE,EAAsB,CACjCC,EACAC,IAC8B,CACxB,MAAAC,EAAc,IAAI,IAAID,CAAW,EAEjCE,EAAcC,GAAsE,OACxF,MAAMC,IAAmBC,EAAAF,EAAS,WAAT,YAAAE,EACrB,IAAIH,GACL,OAAQI,GAA4CA,IAAU,QAAS,CAAC,EAE3E,OAAIL,EAAY,IAAIE,EAAS,EAAE,GAAKC,EAAiB,OAAS,EACrD,CACL,GAAGD,EACH,SAAUC,CACZ,EAGK,IACT,EAEO,OAAAL,EACJ,IAAIG,CAAU,EACd,OAAQC,GAAkDA,IAAa,IAAI,CAChF,EC7BaI,EAAa,MAAOC,EAA8B,MACtD,CACL,QAAS,GACT,OAAAA,CACF,GCZWC,EAAkD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EC0BlDC,EAAiB,SAA8B,WACtD,GAAA,CACI,MAAArB,EAAW,MAAMC,EAAiDmB,EAAmC,CACzG,OAAQ,MAAA,CACT,EAEG,IAAAJ,EAAAhB,EAAS,SAAT,MAAAgB,EAAiB,OACZ,MAAA,GAGH,MAAAM,GAAWC,EAAAvB,EAAS,OAAT,YAAAuB,EAAe,SAChC,GAAI,CAACD,EACI,MAAA,GAIT,MAAME,IAAYC,EAAAH,EAAS,YAAT,YAAAG,EAAoB,QAAS,CAAC,EAChD,GAAI,CAAC,MAAM,QAAQD,CAAS,GAAKA,EAAU,SAAW,EAC7C,MAAA,GAIT,MAAME,EAAeJ,EAAS,KAC9B,OAAKI,EAKEA,EAAa,KAAO,KACnB,OAAOA,EAAa,IAAO,UAAYA,EAAa,KAAO,GAC5DA,EAAa,OAAS,wBANpB,SAOFtB,EAAO,CACN,eAAA,MAAM,+CAAgDA,CAAK,EAC5D,EAAA,CAEX"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
const i=(n=[])=>{const t=new Set,a=[...n];for(;a.length;){const s=a.pop();if(s&&(typeof s.id=="string"&&t.add(s.id),Array.isArray(s.children)&&s.children.length))for(const o of s.children)a.push(o)}return t},d=(n=[])=>Array.from(i(n)),c=n=>(n==null?void 0:n.id)==="0"||typeof(n==null?void 0:n.id)=="number"&&(n==null?void 0:n.id)===0||(n==null?void 0:n.name)==="Company Administrator",e=n=>{const t=i((n==null?void 0:n.permissions)||[]),a=c(n);return{canViewAccount:a||t.has("Magento_Company::view_account"),canEditAccount:a||t.has("Magento_Company::edit_account"),canViewAddress:a||t.has("Magento_Company::view_address"),canEditAddress:a||t.has("Magento_Company::edit_address"),canViewContacts:a||t.has("Magento_Company::contacts"),canViewPaymentInformation:a||t.has("Magento_Company::payment_information"),canViewShippingInformation:a||t.has("Magento_Company::shipping_information"),canViewRoles:a||t.has("Magento_Company::roles_view"),canManageRoles:a||t.has("Magento_Company::roles_edit")}};export{d as a,e as b,i as f,c as i};
|
|
4
|
+
//# sourceMappingURL=company-permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"company-permissions.js","sources":["/@dropins/storefront-company-management/src/lib/company-permissions.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/**\n * Permission flags interface for company operations\n */\nexport interface CompanyPermissionFlags {\n canViewAccount: boolean;\n canEditAccount: boolean;\n canViewAddress: boolean;\n canEditAddress: boolean;\n canViewContacts: boolean;\n canViewPaymentInformation: boolean;\n canViewShippingInformation: boolean;\n canViewRoles: boolean;\n canManageRoles: boolean;\n}\n\n/**\n * Flattens a nested permissions tree into a Set of permission IDs\n * This is a pure utility function that can be used across the application\n */\nexport const flattenIds = (nodes: any[] = []): Set<string> => {\n const set = new Set<string>();\n const stack = [...nodes];\n while (stack.length) {\n const node = stack.pop();\n if (!node) continue;\n if (typeof node.id === 'string') set.add(node.id);\n if (Array.isArray(node.children) && node.children.length) {\n for (const child of node.children) stack.push(child);\n }\n }\n return set;\n};\n\n/**\n * Flattens a nested permissions tree into an Array of permission IDs\n * Convenience function that returns an array instead of a Set\n */\nexport const flattenIdsToArray = (nodes: any[] = []): string[] => {\n return Array.from(flattenIds(nodes));\n};\n\n/**\n * Determines if a role is a Company Administrator\n */\nexport const isCompanyAdministrator = (role: any): boolean => {\n return role?.id === '0' || \n (typeof role?.id === 'number' && role?.id === 0) || \n role?.name === 'Company Administrator';\n};\n\n/**\n * Builds permission flags from role data\n */\nexport const buildPermissionFlags = (role: any): CompanyPermissionFlags => {\n const allowedIds = flattenIds(role?.permissions || []);\n const isAdmin = isCompanyAdministrator(role);\n\n return {\n canViewAccount: isAdmin || allowedIds.has('Magento_Company::view_account'),\n canEditAccount: isAdmin || allowedIds.has('Magento_Company::edit_account'),\n canViewAddress: isAdmin || allowedIds.has('Magento_Company::view_address'),\n canEditAddress: isAdmin || allowedIds.has('Magento_Company::edit_address'),\n canViewContacts: isAdmin || allowedIds.has('Magento_Company::contacts'),\n canViewPaymentInformation: isAdmin || allowedIds.has('Magento_Company::payment_information'),\n canViewShippingInformation: isAdmin || allowedIds.has('Magento_Company::shipping_information'),\n canViewRoles: isAdmin || allowedIds.has('Magento_Company::roles_view'),\n canManageRoles: isAdmin || allowedIds.has('Magento_Company::roles_edit'),\n };\n};\n"],"names":["flattenIds","nodes","set","stack","node","child","flattenIdsToArray","isCompanyAdministrator","role","buildPermissionFlags","allowedIds","isAdmin"],"mappings":"AAoCO,MAAMA,EAAa,CAACC,EAAe,KAAoB,CACtD,MAAAC,MAAU,IACVC,EAAQ,CAAC,GAAGF,CAAK,EACvB,KAAOE,EAAM,QAAQ,CACb,MAAAC,EAAOD,EAAM,IAAI,EACvB,GAAKC,IACD,OAAOA,EAAK,IAAO,UAAcF,EAAA,IAAIE,EAAK,EAAE,EAC5C,MAAM,QAAQA,EAAK,QAAQ,GAAKA,EAAK,SAAS,QAChD,UAAWC,KAASD,EAAK,SAAUD,EAAM,KAAKE,CAAK,CACrD,CAEK,OAAAH,CACT,EAMaI,EAAoB,CAACL,EAAe,KACxC,MAAM,KAAKD,EAAWC,CAAK,CAAC,EAMxBM,EAA0BC,IAC9BA,GAAA,YAAAA,EAAM,MAAO,KACZ,OAAOA,GAAA,YAAAA,EAAM,KAAO,WAAYA,GAAA,YAAAA,EAAM,MAAO,IAC9CA,GAAA,YAAAA,EAAM,QAAS,wBAMXC,EAAwBD,GAAsC,CACzE,MAAME,EAAaV,GAAWQ,GAAA,YAAAA,EAAM,cAAe,CAAA,CAAE,EAC/CG,EAAUJ,EAAuBC,CAAI,EAEpC,MAAA,CACL,eAAgBG,GAAWD,EAAW,IAAI,+BAA+B,EACzE,eAAgBC,GAAWD,EAAW,IAAI,+BAA+B,EACzE,eAAgBC,GAAWD,EAAW,IAAI,+BAA+B,EACzE,eAAgBC,GAAWD,EAAW,IAAI,+BAA+B,EACzE,gBAAiBC,GAAWD,EAAW,IAAI,2BAA2B,EACtE,0BAA2BC,GAAWD,EAAW,IAAI,sCAAsC,EAC3F,2BAA4BC,GAAWD,EAAW,IAAI,uCAAuC,EAC7F,aAAcC,GAAWD,EAAW,IAAI,6BAA6B,EACrE,eAAgBC,GAAWD,EAAW,IAAI,6BAA6B,CACzE,CACF"}
|