@dropins/storefront-company-management 1.0.0-beta13 → 1.0.0-beta14
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/deleteCompanyTeam/deleteCompanyTeam.d.ts +1 -1
- package/api/deleteCompanyUser/deleteCompanyUser.d.ts +1 -1
- package/api/getCompanyTeam/getCompanyTeam.d.ts +1 -1
- package/api/getCompanyUser/getCompanyUser.d.ts +1 -1
- package/api/getCompanyUsers/getCompanyUsers.d.ts +1 -1
- package/api/updateCompanyTeam/updateCompanyTeam.d.ts +1 -1
- package/api/updateCompanyUser/updateCompanyUser.d.ts +1 -1
- package/api/updateCompanyUserStatus/updateCompanyUserStatus.d.ts +1 -1
- package/api.js +3 -3
- package/chunks/updateCompanyTeam.js +7 -7
- package/chunks/updateCompanyTeam.js.map +1 -1
- package/chunks/updateCompanyUser.js +6 -6
- package/chunks/updateCompanyUser.js.map +1 -1
- package/chunks/updateCompanyUserStatus.js +3 -3
- package/chunks/updateCompanyUserStatus.js.map +1 -1
- package/containers/CompanyStructure.js +1 -1
- package/containers/CompanyStructure.js.map +1 -1
- package/containers/CompanyUsers.js +1 -1
- package/containers/CompanyUsers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deletes a company team by their ID
|
|
3
3
|
*
|
|
4
|
-
* @param id - The ID of the company team to delete
|
|
4
|
+
* @param id - The ID of the company team to delete (base64 encoded UID from GraphQL)
|
|
5
5
|
* @returns Promise resolving to boolean indicating success
|
|
6
6
|
* @throws {Error} When network errors or GraphQL errors occur
|
|
7
7
|
*/
|
|
@@ -3,7 +3,7 @@ import { DeleteCompanyUserParams, DeleteCompanyUserResponse } from '../../types'
|
|
|
3
3
|
/**
|
|
4
4
|
* Deletes a company user by their ID
|
|
5
5
|
* @param params - The parameters containing user ID
|
|
6
|
-
* @param params.id - The ID of the user to delete (
|
|
6
|
+
* @param params.id - The ID of the user to delete (base64 encoded UID from GraphQL)
|
|
7
7
|
* @returns Promise<DeleteCompanyUserResponse> - Object containing success status
|
|
8
8
|
*/
|
|
9
9
|
export declare const deleteCompanyUser: (params: DeleteCompanyUserParams) => Promise<DeleteCompanyUserResponse>;
|
|
@@ -3,7 +3,7 @@ import { CompanyTeamModel } from '../../data/models';
|
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves a specific company team by their ID
|
|
5
5
|
*
|
|
6
|
-
* @param id - The ID of the company team to retrieve
|
|
6
|
+
* @param id - The ID of the company team to retrieve (base64 encoded UID from GraphQL)
|
|
7
7
|
* @returns Promise resolving to CompanyTeamModel or null if team not found
|
|
8
8
|
* @throws {Error} When network errors or GraphQL errors occur
|
|
9
9
|
*/
|
|
@@ -2,7 +2,7 @@ import { CompanyUserModel } from '../../data/models';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves a specific company user by their ID
|
|
5
|
-
* @param id - The ID of the company user to retrieve (
|
|
5
|
+
* @param id - The ID of the company user to retrieve (base64 encoded UID from GraphQL)
|
|
6
6
|
* @returns Promise resolving to CompanyUserModel or null if user not found
|
|
7
7
|
*/
|
|
8
8
|
export declare function getCompanyUser(id: string): Promise<CompanyUserModel | null>;
|
|
@@ -6,7 +6,7 @@ import { CompanyUsersParams, CompanyUsersResponse } from '../../types';
|
|
|
6
6
|
* @param params.pageSize - Number of items per page (default: 20)
|
|
7
7
|
* @param params.currentPage - Current page number (default: 1)
|
|
8
8
|
* @param params.filter - Optional filter to apply (e.g., { status: 'ACTIVE' })
|
|
9
|
-
* @returns Promise<CompanyUsersResponse> - Object containing array of company users and pagination info
|
|
9
|
+
* @returns Promise<CompanyUsersResponse> - Object containing array of company users with base64-encoded IDs and pagination info
|
|
10
10
|
*/
|
|
11
11
|
export declare const getCompanyUsers: (params?: CompanyUsersParams) => Promise<CompanyUsersResponse>;
|
|
12
12
|
//# sourceMappingURL=getCompanyUsers.d.ts.map
|
|
@@ -3,7 +3,7 @@ import { UpdateCompanyTeamInput } from '../../types/api/updateCompanyTeam.types'
|
|
|
3
3
|
/**
|
|
4
4
|
* Updates an existing company team with the provided information
|
|
5
5
|
*
|
|
6
|
-
* @param input - Team information including ID and fields to update
|
|
6
|
+
* @param input - Team information including ID (base64 encoded UID) and fields to update
|
|
7
7
|
* @returns Promise resolving to boolean indicating success
|
|
8
8
|
* @throws {Error} When network errors or GraphQL errors occur
|
|
9
9
|
*/
|
|
@@ -2,7 +2,7 @@ import { UpdateCompanyUserInput } from '../../types';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Updates an existing company user with the provided information
|
|
5
|
-
* @param input - User information including ID and fields to update
|
|
5
|
+
* @param input - User information including ID (base64 encoded UID) and fields to update
|
|
6
6
|
* @returns Promise resolving to boolean indicating success
|
|
7
7
|
*/
|
|
8
8
|
export declare function updateCompanyUser(input: UpdateCompanyUserInput): Promise<boolean>;
|
|
@@ -3,7 +3,7 @@ import { UpdateCompanyUserStatusParams, UpdateCompanyUserStatusResponse } from '
|
|
|
3
3
|
/**
|
|
4
4
|
* Updates a company user's status (Active/Inactive)
|
|
5
5
|
* @param params - The parameters containing user ID and new status
|
|
6
|
-
* @param params.id - The ID of the user to update (
|
|
6
|
+
* @param params.id - The ID of the user to update (base64 encoded UID from GraphQL)
|
|
7
7
|
* @param params.status - The new status for the user (ACTIVE or INACTIVE)
|
|
8
8
|
* @returns Promise<UpdateCompanyUserStatusResponse> - Object containing success status and updated user data
|
|
9
9
|
*/
|
package/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{f as m,h as c}from"./chunks/network-error.js";import{g as I,r as P,s as G,a as L,b as M}from"./chunks/network-error.js";import{f as D}from"./chunks/fetchUserPermissions.js";import{a as w,i as F}from"./chunks/isCompanyUser.js";import{c as B,g as Q}from"./chunks/getCustomerCompany.js";import{D as q,S as K,c as W,g as z}from"./chunks/transform-store-config.js";import{c as J,d as V,g as X,a as Z,u as $,b as ee}from"./chunks/updateCompanyTeam.js";import{c as
|
|
3
|
+
import{f as m,h as c}from"./chunks/network-error.js";import{g as I,r as P,s as G,a as L,b as M}from"./chunks/network-error.js";import{f as D}from"./chunks/fetchUserPermissions.js";import{a as w,i as F}from"./chunks/isCompanyUser.js";import{c as B,g as Q}from"./chunks/getCustomerCompany.js";import{D as q,S as K,c as W,g as z}from"./chunks/transform-store-config.js";import{c as J,d as V,g as X,a as Z,u as $,b as ee}from"./chunks/updateCompanyTeam.js";import{c as ae,d as te,g as oe,i as ne,u as se}from"./chunks/updateCompanyUser.js";import{g as ie,u as ce}from"./chunks/updateCompany.js";import{g as pe,u as de}from"./chunks/updateCompanyUserStatus.js";import{g as ue,v as ye}from"./chunks/validateCompanyEmail.js";import{a as Ee,g as ge}from"./chunks/getCompanyCreditHistory.js";import{G as l,t as p}from"./chunks/isCompanyRoleNameAvailable.js";import{c as Re,d as Te,a as Ae,g as _e,i as Ue,u as Se}from"./chunks/isCompanyRoleNameAvailable.js";import{a as d}from"./chunks/company-permissions.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/event-bus.js";import"./chunks/fetch-error.js";const A=async e=>{try{const r=await m(l,{variables:e,method:"GET",cache:"no-cache"});return p(r)}catch(r){return c(r)}},_=e=>d(e),U=(e,r)=>{const n=new Set(r),a=t=>{var o;const s=((o=t.children)==null?void 0:o.map(a).filter(i=>i!==null))||[];return n.has(t.id)||s.length>0?{...t,children:s}:null};return e.map(a).filter(t=>t!==null)},S=async(e={})=>({success:!0,config:e}),C=`
|
|
4
4
|
query GET_CUSTOMER_COMPANIES_WITH_ROLES {
|
|
5
5
|
customer {
|
|
6
6
|
companies(input: {}) {
|
|
@@ -15,11 +15,11 @@ import{f as m,h as c}from"./chunks/network-error.js";import{g as I,r as P,s as G
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
`,b=async()=>{var e,
|
|
18
|
+
`,b=async()=>{var e,r,n;try{const a=await m(C,{method:"POST"});if((e=a.errors)!=null&&e.length)return!1;const t=(r=a.data)==null?void 0:r.customer;if(!t)return!1;const s=((n=t.companies)==null?void 0:n.items)??[];if(!Array.isArray(s)||s.length===0)return!1;const o=t.role;return o?o.id==="0"||typeof o.id=="number"&&o.id===0||o.name==="Company Administrator":!1}catch(a){return console.error("Error checking if customer is company admin:",a),!1}};var u=(e=>(e.ALLOCATION="ALLOCATION",e.UPDATE="UPDATE",e.PURCHASE="PURCHASE",e.REIMBURSEMENT="REIMBURSEMENT",e))(u||{});const y=`
|
|
19
19
|
query CHECK_COMPANY_CREDIT_ENABLED {
|
|
20
20
|
storeConfig{
|
|
21
21
|
company_credit_enabled
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
`,N=async()=>{var e,
|
|
24
|
+
`,N=async()=>{var e,r,n;try{const a=await m(y,{method:"GET",cache:"no-cache"});return(e=a.errors)!=null&&e.length?{creditEnabled:!1,error:"Unable to check company credit configuration"}:((n=(r=a.data)==null?void 0:r.storeConfig)==null?void 0:n.company_credit_enabled)===!0?{creditEnabled:!0}:{creditEnabled:!1,error:"Company credit is not enabled in store configuration"}}catch{return{creditEnabled:!1,error:"Company credit functionality not available"}}};export{u as CompanyCreditOperationType,q as DEFAULT_COUNTRY,K as STORE_CONFIG_DEFAULTS,w as allowCompanyRegistration,U as buildPermissionTree,N as checkCompanyCreditEnabled,B as companyEnabled,W as createCompany,Re as createCompanyRole,J as createCompanyTeam,ae as createCompanyUser,Te as deleteCompanyRole,V as deleteCompanyTeam,te as deleteCompanyUser,m as fetchGraphQl,D as fetchUserPermissions,_ as flattenPermissionIds,ie as getCompany,Ae as getCompanyAclResources,Ee as getCompanyCredit,ge as getCompanyCreditHistory,A as getCompanyRole,_e as getCompanyRoles,X as getCompanyStructure,Z as getCompanyTeam,oe as getCompanyUser,pe as getCompanyUsers,I as getConfig,ue as getCountries,Q as getCustomerCompany,z as getStoreConfig,S as initialize,b as isCompanyAdmin,Ue as isCompanyRoleNameAvailable,F as isCompanyUser,ne as isCompanyUserEmailAvailable,P as removeFetchGraphQlHeader,G as setEndpoint,L as setFetchGraphQlHeader,M as setFetchGraphQlHeaders,ce as updateCompany,Se as updateCompanyRole,$ as updateCompanyStructure,ee as updateCompanyTeam,se as updateCompanyUser,de as updateCompanyUserStatus,ye as validateCompanyEmail};
|
|
25
25
|
//# sourceMappingURL=api.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{f as o,h as
|
|
3
|
+
import{f as o,h as u}from"./network-error.js";import{h as i}from"./fetch-error.js";const d=`
|
|
4
4
|
mutation createCompanyTeam($input: CompanyTeamCreateInput!) {
|
|
5
5
|
createCompanyTeam(input: $input) { __typename team { id structure_id name } }
|
|
6
6
|
}
|
|
7
|
-
`;async function
|
|
7
|
+
`;async function f(a){const n={name:a.name,description:a.description,target_id:a.targetId};return await o(d,{variables:{input:n}}).then(e=>{var r,m,p;if((r=e.errors)!=null&&r.length)return i(e.errors);const t=(p=(m=e==null?void 0:e.data)==null?void 0:m.createCompanyTeam)==null?void 0:p.team;return t?{id:t.id,structureId:t.structure_id,name:t.name}:null}).catch(u)}const c=`
|
|
8
8
|
mutation deleteCompanyTeam($id: ID!) {
|
|
9
9
|
deleteCompanyTeam(id: $id) { __typename }
|
|
10
10
|
}
|
|
11
|
-
`;async function
|
|
11
|
+
`;async function E(a){return await o(c,{variables:{id:a}}).then(n=>{var e,t;return(e=n.errors)!=null&&e.length?i(n.errors):!!((t=n==null?void 0:n.data)!=null&&t.deleteCompanyTeam)}).catch(u)}function y(a){return a.items.map(t=>({structureId:t.entity.structure_id,parentStructureId:t.parent_id||null,label:t.entity.__typename==="CompanyTeam"?t.entity.name||"":`${t.entity.firstname||""} ${t.entity.lastname||""}`.trim(),type:t.entity.__typename==="CompanyTeam"?"team":"user",entityId:(t.entity.__typename==="CompanyTeam"?t.entity.companyTeamId:t.entity.customerId)||"",description:t.entity.__typename==="CompanyTeam"&&t.entity.description||null})).map(t=>{const r=t.parentStructureId||null,m=!r||r==="MA=="?null:r;return{id:t.structureId,parentId:m,label:t.label,type:t.type,entityId:t.entityId,description:t.description}})}const s=a=>{if(!a)throw new Error("Invalid response: missing team data");return{id:a.id,name:a.name,description:a.description}},T=`
|
|
12
12
|
query getCompanyStructure {
|
|
13
13
|
company {
|
|
14
14
|
structure {
|
|
@@ -24,19 +24,19 @@ import{f as o,h as i}from"./network-error.js";import{h as u}from"./fetch-error.j
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
`;async function
|
|
27
|
+
`;async function g(){return await o(T,{method:"GET",cache:"no-cache"}).then(a=>{var e;if((e=a.errors)!=null&&e.length)return i(a.errors);const n=a.data.company.structure;return y(n)}).catch(u)}const l=`
|
|
28
28
|
query getCompanyTeam($id: ID!) {
|
|
29
29
|
company { team(id: $id) { id name description } }
|
|
30
30
|
}
|
|
31
|
-
`;async function
|
|
31
|
+
`;async function A(a){return await o(l,{variables:{id:a}}).then(n=>{var t,r,m;if((t=n.errors)!=null&&t.length)return i(n.errors);const e=(m=(r=n==null?void 0:n.data)==null?void 0:r.company)==null?void 0:m.team;return e?s(e):null}).catch(u)}const _=`
|
|
32
32
|
mutation updateCompanyStructure($treeId: ID!, $parentTreeId: ID!) {
|
|
33
33
|
updateCompanyStructure(input: { tree_id: $treeId, parent_tree_id: $parentTreeId }) {
|
|
34
34
|
__typename
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
`;async function
|
|
37
|
+
`;async function $(a){const n={treeId:a.id,parentTreeId:a.parentId};return await o(_,{variables:n}).then(e=>{var t,r;return(t=e.errors)!=null&&t.length?i(e.errors):!!((r=e==null?void 0:e.data)!=null&&r.updateCompanyStructure)}).catch(u)}const C=`
|
|
38
38
|
mutation updateCompanyTeam($input: CompanyTeamUpdateInput!) {
|
|
39
39
|
updateCompanyTeam(input: $input) { __typename team { id name } }
|
|
40
40
|
}
|
|
41
|
-
`;async function
|
|
41
|
+
`;async function M(a){const n={id:a.id,name:a.name,description:a.description};return await o(C,{variables:{input:n}}).then(e=>{var t,r,m,p;return(t=e.errors)!=null&&t.length?i(e.errors):!!((p=(m=(r=e==null?void 0:e.data)==null?void 0:r.updateCompanyTeam)==null?void 0:m.team)!=null&&p.id)}).catch(u)}export{A as a,M as b,f as c,E as d,g,$ as u};
|
|
42
42
|
//# sourceMappingURL=updateCompanyTeam.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateCompanyTeam.js","sources":["/@dropins/storefront-company-management/src/api/createCompanyTeam/graphql/createCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/createCompanyTeam/createCompanyTeam.ts","/@dropins/storefront-company-management/src/api/deleteCompanyTeam/graphql/deleteCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/deleteCompanyTeam/deleteCompanyTeam.ts","/@dropins/storefront-company-management/src/data/transforms/transform-company-structure.ts","/@dropins/storefront-company-management/src/data/transforms/transform-company-team.ts","/@dropins/storefront-company-management/src/api/getCompanyStructure/graphql/getCompanyStructure.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyStructure/getCompanyStructure.ts","/@dropins/storefront-company-management/src/api/getCompanyTeam/graphql/getCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyTeam/getCompanyTeam.ts","/@dropins/storefront-company-management/src/api/updateCompanyStructure/graphql/updateCompanyStructure.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyStructure/updateCompanyStructure.ts","/@dropins/storefront-company-management/src/api/updateCompanyTeam/graphql/updateCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyTeam/updateCompanyTeam.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_COMPANY_TEAM = /* GraphQL */ `\n mutation createCompanyTeam($input: CompanyTeamCreateInput!) {\n createCompanyTeam(input: $input) { __typename team { id structure_id name } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { CreateCompanyTeamInput, CreateCompanyTeamResult } from '../../types/api/createCompanyTeam.types';\nimport { CREATE_COMPANY_TEAM } from './graphql/createCompanyTeam.graphql';\n\n/**\n * Creates a new company team with the provided information\n * \n * @param input - Team information including name, description, and target location\n * @returns Promise resolving to created team result or null if creation failed\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function createCompanyTeam(input: CreateCompanyTeamInput): Promise<CreateCompanyTeamResult | null> {\n // Transform camelCase input to GraphQL snake_case format\n const transformedInput = {\n name: input.name,\n description: input.description,\n target_id: input.targetId,\n };\n\n return await fetchGraphQl<{ createCompanyTeam?: { team?: { id: string; structure_id?: string; name: string } } }>(CREATE_COMPANY_TEAM, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const team = res?.data?.createCompanyTeam?.team;\n if (!team) return null;\n \n // Transform GraphQL snake_case response to camelCase\n return {\n id: team.id,\n structureId: team.structure_id,\n name: team.name,\n };\n })\n .catch(handleNetworkError);\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 DELETE_COMPANY_TEAM = /* GraphQL */ `\n mutation deleteCompanyTeam($id: ID!) {\n deleteCompanyTeam(id: $id) { __typename }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { DELETE_COMPANY_TEAM } from './graphql/deleteCompanyTeam.graphql';\n\n/**\n * Deletes a company team by their ID\n * \n * @param id - The ID of the company team to delete\n * @returns Promise resolving to boolean indicating success\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function deleteCompanyTeam(id: string): Promise<boolean> {\n return await fetchGraphQl<{ deleteCompanyTeam?: { __typename: string } }>(DELETE_COMPANY_TEAM, { variables: { id } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.deleteCompanyTeam;\n })\n .catch(handleNetworkError);\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport type { CompanyStructureNode } from '../models/company-structure';\nimport { decodeUserId } from '../../lib/encoding';\n\n// Internal GraphQL response interface (snake_case for direct GraphQL mapping)\ninterface CompanyStructureResponse {\n items: CompanyStructureItemResponse[];\n}\n\ninterface CompanyStructureItemResponse {\n id: string;\n parent_id: string | null;\n entity: {\n __typename: 'CompanyTeam' | 'Customer';\n companyTeamId?: string;\n customerId?: string;\n structure_id: string;\n firstname?: string;\n lastname?: string;\n name?: string;\n description?: string | null;\n };\n}\n\nexport function transformCompanyStructure(response: CompanyStructureResponse): CompanyStructureNode[] {\n const typed = response.items.map((i) => ({\n structureId: i.entity.structure_id,\n parentStructureId: i.parent_id || null,\n label: i.entity.__typename === 'CompanyTeam' ? (i.entity.name || '') : `${i.entity.firstname || ''} ${i.entity.lastname || ''}`.trim(),\n type: i.entity.__typename === 'CompanyTeam' ? ('team' as const) : ('user' as const),\n entityId: decodeUserId((i.entity.__typename === 'CompanyTeam' ? i.entity.companyTeamId : i.entity.customerId) || ''),\n description: i.entity.__typename === 'CompanyTeam' ? i.entity.description || null : null,\n }));\n\n const mapped: CompanyStructureNode[] = typed.map((t) => {\n const parentRaw = t.parentStructureId || null;\n const parentTyped = !parentRaw || parentRaw === 'MA==' ? null : parentRaw;\n return { id: t.structureId, parentId: parentTyped, label: t.label, type: t.type, entityId: t.entityId, description: t.description };\n });\n return mapped;\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 { CompanyTeamModel } from '../models/company-team';\n\n// GraphQL response interface (snake_case for direct GraphQL mapping)\ninterface CompanyTeamResponse {\n id: string;\n name: string;\n description?: string | null;\n}\n\nexport const transformCompanyTeam = (response: CompanyTeamResponse): CompanyTeamModel => {\n // Validate response structure\n if (!response) {\n throw new Error('Invalid response: missing team data');\n }\n\n // Transform GraphQL snake_case response to camelCase model\n return {\n id: response.id,\n name: response.name,\n description: response.description,\n // Extended properties for UI and business logic\n // Note: memberCount should be calculated from structure data in components when needed\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_COMPANY_STRUCTURE = /* GraphQL */ `\n query getCompanyStructure {\n company {\n structure {\n items {\n id\n parent_id\n entity {\n __typename\n ... on CompanyTeam { companyTeamId: id structure_id name description }\n ... on Customer { customerId: id structure_id firstname lastname }\n }\n }\n }\n }\n }\n`;\n\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { CompanyStructureNode } from '../../data/models';\nimport { transformCompanyStructure } from '../../data/transforms';\nimport { CompanyStructureResponse } from '../../types/api/getCompanyStructure.types';\nimport { GET_COMPANY_STRUCTURE } from './graphql/getCompanyStructure.graphql';\n\n/**\n * Retrieves the company organizational structure as a tree of nodes\n * \n * @returns Promise resolving to array of CompanyStructureNode representing the company hierarchy\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function getCompanyStructure(): Promise<CompanyStructureNode[]> {\n return await fetchGraphQl<{ company: { structure: CompanyStructureResponse } }>(GET_COMPANY_STRUCTURE, { method: 'GET', cache: 'no-cache' })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const structure = res.data.company.structure;\n \n // Use transformer to convert GraphQL response to model\n return transformCompanyStructure(structure);\n })\n .catch(handleNetworkError);\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_COMPANY_TEAM = /* GraphQL */ `\n query getCompanyTeam($id: ID!) {\n company { team(id: $id) { id name description } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { CompanyTeamModel } from '../../data/models';\nimport { transformCompanyTeam } from '../../data/transforms';\nimport { GET_COMPANY_TEAM } from './graphql/getCompanyTeam.graphql';\n\n/**\n * Retrieves a specific company team by their ID\n * \n * @param id - The ID of the company team to retrieve\n * @returns Promise resolving to CompanyTeamModel or null if team not found\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function getCompanyTeam(id: string): Promise<CompanyTeamModel | null> {\n return await fetchGraphQl<{ company: { team?: { id: string; name: string; description?: string | null } } }>(GET_COMPANY_TEAM, { variables: { id } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const team = res?.data?.company?.team;\n if (!team) return null;\n \n // Pure data transformation (no permissions)\n return transformCompanyTeam(team);\n })\n .catch(handleNetworkError);\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 UPDATE_COMPANY_STRUCTURE = /* GraphQL */ `\n mutation updateCompanyStructure($treeId: ID!, $parentTreeId: ID!) {\n updateCompanyStructure(input: { tree_id: $treeId, parent_tree_id: $parentTreeId }) {\n __typename\n }\n }\n`;\n\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { UpdateCompanyStructureInput } from '../../types/api/updateCompanyStructure.types';\nimport { UPDATE_COMPANY_STRUCTURE } from './graphql/updateCompanyStructure.graphql';\n\n/**\n * Updates the company structure by moving a node to a new parent\n * \n * @param input - Object containing the node ID and new parent ID\n * @returns Promise resolving to boolean indicating success\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function updateCompanyStructure(input: UpdateCompanyStructureInput): Promise<boolean> {\n // Transform camelCase input to GraphQL snake_case format\n const transformedInput = {\n treeId: input.id,\n parentTreeId: input.parentId,\n };\n\n return await fetchGraphQl<{ updateCompanyStructure?: { __typename: string } }>(UPDATE_COMPANY_STRUCTURE, {\n variables: transformedInput,\n })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.updateCompanyStructure;\n })\n .catch(handleNetworkError);\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 UPDATE_COMPANY_TEAM = /* GraphQL */ `\n mutation updateCompanyTeam($input: CompanyTeamUpdateInput!) {\n updateCompanyTeam(input: $input) { __typename team { id name } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { UpdateCompanyTeamInput } from '../../types/api/updateCompanyTeam.types';\nimport { UPDATE_COMPANY_TEAM } from './graphql/updateCompanyTeam.graphql';\n\n/**\n * Updates an existing company team with the provided information\n * \n * @param input - Team information including ID and fields to update\n * @returns Promise resolving to boolean indicating success\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function updateCompanyTeam(input: UpdateCompanyTeamInput): Promise<boolean> {\n // Transform camelCase input to GraphQL snake_case format\n const transformedInput = {\n id: input.id,\n name: input.name,\n description: input.description,\n };\n\n return await fetchGraphQl<{ updateCompanyTeam?: { team?: { id: string } } }>(UPDATE_COMPANY_TEAM, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.updateCompanyTeam?.team?.id;\n })\n .catch(handleNetworkError);\n}\n"],"names":["CREATE_COMPANY_TEAM","createCompanyTeam","input","transformedInput","fetchGraphQl","res","_a","handleFetchError","team","_c","_b","handleNetworkError","DELETE_COMPANY_TEAM","deleteCompanyTeam","id","transformCompanyStructure","response","i","decodeUserId","parentRaw","parentTyped","transformCompanyTeam","GET_COMPANY_STRUCTURE","getCompanyStructure","structure","GET_COMPANY_TEAM","getCompanyTeam","UPDATE_COMPANY_STRUCTURE","updateCompanyStructure","UPDATE_COMPANY_TEAM","updateCompanyTeam","_d"],"mappings":"8HAiBO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA,ECYjD,eAAsBC,EAAkBC,EAAwE,CAE9G,MAAMC,EAAmB,CACvB,KAAMD,EAAM,KACZ,YAAaA,EAAM,YACnB,UAAWA,EAAM,QAAA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xBO,MAAMgB,EAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECYtD,eAAsBC,EAAuB1B,EAAsD,CAEjG,MAAMC,EAAmB,CACvB,OAAQD,EAAM,GACd,aAAcA,EAAM,QAAA,EAGtB,OAAO,MAAME,EAAkEuB,EAA0B,CACvG,UAAWxB,CAAA,CACZ,EACE,KAAME,GAAQ,SACb,OAAIC,EAAAD,EAAI,SAAJ,MAAAC,EAAY,OAAeC,EAAiBF,EAAI,MAAM,EACnD,CAAC,GAACK,EAAAL,GAAA,YAAAA,EAAK,OAAL,MAAAK,EAAW,uBACtB,CAAC,EACA,MAAMC,CAAkB,CAC7B,CC3BO,MAAMkB,EAAoC;AAAA;AAAA;AAAA;AAAA,ECYjD,eAAsBC,EAAkB5B,EAAiD,CAEvF,MAAMC,EAAmB,CACvB,GAAID,EAAM,GACV,KAAMA,EAAM,KACZ,YAAaA,EAAM,WAAA,EAGrB,OAAO,MAAME,EAAgEyB,EAAqB,CAAE,UAAW,CAAE,MAAO1B,EAAiB,CAAG,EACzI,KAAME,GAAQ,aACb,OAAIC,EAAAD,EAAI,SAAJ,MAAAC,EAAY,OAAeC,EAAiBF,EAAI,MAAM,EACnD,CAAC,GAAC0B,GAAAtB,GAAAC,EAAAL,GAAA,YAAAA,EAAK,OAAL,YAAAK,EAAW,oBAAX,YAAAD,EAA8B,OAA9B,MAAAsB,EAAoC,GAC/C,CAAC,EACA,MAAMpB,CAAkB,CAC7B"}
|
|
1
|
+
{"version":3,"file":"updateCompanyTeam.js","sources":["/@dropins/storefront-company-management/src/api/createCompanyTeam/graphql/createCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/createCompanyTeam/createCompanyTeam.ts","/@dropins/storefront-company-management/src/api/deleteCompanyTeam/graphql/deleteCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/deleteCompanyTeam/deleteCompanyTeam.ts","/@dropins/storefront-company-management/src/data/transforms/transform-company-structure.ts","/@dropins/storefront-company-management/src/data/transforms/transform-company-team.ts","/@dropins/storefront-company-management/src/api/getCompanyStructure/graphql/getCompanyStructure.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyStructure/getCompanyStructure.ts","/@dropins/storefront-company-management/src/api/getCompanyTeam/graphql/getCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyTeam/getCompanyTeam.ts","/@dropins/storefront-company-management/src/api/updateCompanyStructure/graphql/updateCompanyStructure.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyStructure/updateCompanyStructure.ts","/@dropins/storefront-company-management/src/api/updateCompanyTeam/graphql/updateCompanyTeam.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyTeam/updateCompanyTeam.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_COMPANY_TEAM = /* GraphQL */ `\n mutation createCompanyTeam($input: CompanyTeamCreateInput!) {\n createCompanyTeam(input: $input) { __typename team { id structure_id name } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { CreateCompanyTeamInput, CreateCompanyTeamResult } from '../../types/api/createCompanyTeam.types';\nimport { CREATE_COMPANY_TEAM } from './graphql/createCompanyTeam.graphql';\n\n/**\n * Creates a new company team with the provided information\n * \n * @param input - Team information including name, description, and target location\n * @returns Promise resolving to created team result or null if creation failed\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function createCompanyTeam(input: CreateCompanyTeamInput): Promise<CreateCompanyTeamResult | null> {\n // Transform camelCase input to GraphQL snake_case format\n const transformedInput = {\n name: input.name,\n description: input.description,\n target_id: input.targetId,\n };\n\n return await fetchGraphQl<{ createCompanyTeam?: { team?: { id: string; structure_id?: string; name: string } } }>(CREATE_COMPANY_TEAM, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const team = res?.data?.createCompanyTeam?.team;\n if (!team) return null;\n \n // Transform GraphQL snake_case response to camelCase\n return {\n id: team.id,\n structureId: team.structure_id,\n name: team.name,\n };\n })\n .catch(handleNetworkError);\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 DELETE_COMPANY_TEAM = /* GraphQL */ `\n mutation deleteCompanyTeam($id: ID!) {\n deleteCompanyTeam(id: $id) { __typename }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { DELETE_COMPANY_TEAM } from './graphql/deleteCompanyTeam.graphql';\n\n/**\n * Deletes a company team by their ID\n * \n * @param id - The ID of the company team to delete (base64 encoded UID from GraphQL)\n * @returns Promise resolving to boolean indicating success\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function deleteCompanyTeam(id: string): Promise<boolean> {\n return await fetchGraphQl<{ deleteCompanyTeam?: { __typename: string } }>(DELETE_COMPANY_TEAM, { variables: { id } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.deleteCompanyTeam;\n })\n .catch(handleNetworkError);\n}\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport type { CompanyStructureNode } from '../models/company-structure';\n\n// Internal GraphQL response interface (snake_case for direct GraphQL mapping)\ninterface CompanyStructureResponse {\n items: CompanyStructureItemResponse[];\n}\n\ninterface CompanyStructureItemResponse {\n id: string;\n parent_id: string | null;\n entity: {\n __typename: 'CompanyTeam' | 'Customer';\n companyTeamId?: string;\n customerId?: string;\n structure_id: string;\n firstname?: string;\n lastname?: string;\n name?: string;\n description?: string | null;\n };\n}\n\nexport function transformCompanyStructure(response: CompanyStructureResponse): CompanyStructureNode[] {\n const typed = response.items.map((i) => ({\n structureId: i.entity.structure_id,\n parentStructureId: i.parent_id || null,\n label: i.entity.__typename === 'CompanyTeam' ? (i.entity.name || '') : `${i.entity.firstname || ''} ${i.entity.lastname || ''}`.trim(),\n type: i.entity.__typename === 'CompanyTeam' ? ('team' as const) : ('user' as const),\n entityId: (i.entity.__typename === 'CompanyTeam' ? i.entity.companyTeamId : i.entity.customerId) || '',\n description: i.entity.__typename === 'CompanyTeam' ? i.entity.description || null : null,\n }));\n\n const mapped: CompanyStructureNode[] = typed.map((t) => {\n const parentRaw = t.parentStructureId || null;\n const parentTyped = !parentRaw || parentRaw === 'MA==' ? null : parentRaw;\n return { id: t.structureId, parentId: parentTyped, label: t.label, type: t.type, entityId: t.entityId, description: t.description };\n });\n return mapped;\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 { CompanyTeamModel } from '../models/company-team';\n\n// GraphQL response interface (snake_case for direct GraphQL mapping)\ninterface CompanyTeamResponse {\n id: string;\n name: string;\n description?: string | null;\n}\n\nexport const transformCompanyTeam = (response: CompanyTeamResponse): CompanyTeamModel => {\n // Validate response structure\n if (!response) {\n throw new Error('Invalid response: missing team data');\n }\n\n // Transform GraphQL snake_case response to camelCase model\n return {\n id: response.id,\n name: response.name,\n description: response.description,\n // Extended properties for UI and business logic\n // Note: memberCount should be calculated from structure data in components when needed\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_COMPANY_STRUCTURE = /* GraphQL */ `\n query getCompanyStructure {\n company {\n structure {\n items {\n id\n parent_id\n entity {\n __typename\n ... on CompanyTeam { companyTeamId: id structure_id name description }\n ... on Customer { customerId: id structure_id firstname lastname }\n }\n }\n }\n }\n }\n`;\n\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { CompanyStructureNode } from '../../data/models';\nimport { transformCompanyStructure } from '../../data/transforms';\nimport { CompanyStructureResponse } from '../../types/api/getCompanyStructure.types';\nimport { GET_COMPANY_STRUCTURE } from './graphql/getCompanyStructure.graphql';\n\n/**\n * Retrieves the company organizational structure as a tree of nodes\n * \n * @returns Promise resolving to array of CompanyStructureNode representing the company hierarchy\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function getCompanyStructure(): Promise<CompanyStructureNode[]> {\n return await fetchGraphQl<{ company: { structure: CompanyStructureResponse } }>(GET_COMPANY_STRUCTURE, { method: 'GET', cache: 'no-cache' })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const structure = res.data.company.structure;\n \n // Use transformer to convert GraphQL response to model\n return transformCompanyStructure(structure);\n })\n .catch(handleNetworkError);\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_COMPANY_TEAM = /* GraphQL */ `\n query getCompanyTeam($id: ID!) {\n company { team(id: $id) { id name description } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { CompanyTeamModel } from '../../data/models';\nimport { transformCompanyTeam } from '../../data/transforms';\nimport { GET_COMPANY_TEAM } from './graphql/getCompanyTeam.graphql';\n\n/**\n * Retrieves a specific company team by their ID\n * \n * @param id - The ID of the company team to retrieve (base64 encoded UID from GraphQL)\n * @returns Promise resolving to CompanyTeamModel or null if team not found\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function getCompanyTeam(id: string): Promise<CompanyTeamModel | null> {\n return await fetchGraphQl<{ company: { team?: { id: string; name: string; description?: string | null } } }>(GET_COMPANY_TEAM, { variables: { id } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const team = res?.data?.company?.team;\n if (!team) return null;\n \n // Pure data transformation (no permissions)\n return transformCompanyTeam(team);\n })\n .catch(handleNetworkError);\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 UPDATE_COMPANY_STRUCTURE = /* GraphQL */ `\n mutation updateCompanyStructure($treeId: ID!, $parentTreeId: ID!) {\n updateCompanyStructure(input: { tree_id: $treeId, parent_tree_id: $parentTreeId }) {\n __typename\n }\n }\n`;\n\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { UpdateCompanyStructureInput } from '../../types/api/updateCompanyStructure.types';\nimport { UPDATE_COMPANY_STRUCTURE } from './graphql/updateCompanyStructure.graphql';\n\n/**\n * Updates the company structure by moving a node to a new parent\n * \n * @param input - Object containing the node ID and new parent ID\n * @returns Promise resolving to boolean indicating success\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function updateCompanyStructure(input: UpdateCompanyStructureInput): Promise<boolean> {\n // Transform camelCase input to GraphQL snake_case format\n const transformedInput = {\n treeId: input.id,\n parentTreeId: input.parentId,\n };\n\n return await fetchGraphQl<{ updateCompanyStructure?: { __typename: string } }>(UPDATE_COMPANY_STRUCTURE, {\n variables: transformedInput,\n })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.updateCompanyStructure;\n })\n .catch(handleNetworkError);\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 UPDATE_COMPANY_TEAM = /* GraphQL */ `\n mutation updateCompanyTeam($input: CompanyTeamUpdateInput!) {\n updateCompanyTeam(input: $input) { __typename team { id name } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { UpdateCompanyTeamInput } from '../../types/api/updateCompanyTeam.types';\nimport { UPDATE_COMPANY_TEAM } from './graphql/updateCompanyTeam.graphql';\n\n/**\n * Updates an existing company team with the provided information\n * \n * @param input - Team information including ID (base64 encoded UID) and fields to update\n * @returns Promise resolving to boolean indicating success\n * @throws {Error} When network errors or GraphQL errors occur\n */\nexport async function updateCompanyTeam(input: UpdateCompanyTeamInput): Promise<boolean> {\n // Transform camelCase input to GraphQL snake_case format\n const transformedInput = {\n id: input.id,\n name: input.name,\n description: input.description,\n };\n\n return await fetchGraphQl<{ updateCompanyTeam?: { team?: { id: string } } }>(UPDATE_COMPANY_TEAM, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.updateCompanyTeam?.team?.id;\n })\n .catch(handleNetworkError);\n}\n"],"names":["CREATE_COMPANY_TEAM","createCompanyTeam","input","transformedInput","fetchGraphQl","res","_a","handleFetchError","team","_c","_b","handleNetworkError","DELETE_COMPANY_TEAM","deleteCompanyTeam","id","transformCompanyStructure","response","i","parentRaw","parentTyped","transformCompanyTeam","GET_COMPANY_STRUCTURE","getCompanyStructure","structure","GET_COMPANY_TEAM","getCompanyTeam","UPDATE_COMPANY_STRUCTURE","updateCompanyStructure","UPDATE_COMPANY_TEAM","updateCompanyTeam","_d"],"mappings":"mFAiBO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA,ECYjD,eAAsBC,EAAkBC,EAAwE,CAE9G,MAAMC,EAAmB,CACvB,KAAMD,EAAM,KACZ,YAAaA,EAAM,YACnB,UAAWA,EAAM,QAAA,EAGnB,OAAO,MAAME,EAAqGJ,EAAqB,CAAE,UAAW,CAAE,MAAOG,EAAiB,CAAG,EAC9K,KAAME,GAAQ,WACb,IAAIC,EAAAD,EAAI,SAAJ,MAAAC,EAAY,OAAQ,OAAOC,EAAiBF,EAAI,MAAM,EAC1D,MAAMG,GAAOC,GAAAC,EAAAL,GAAA,YAAAA,EAAK,OAAL,YAAAK,EAAW,oBAAX,YAAAD,EAA8B,KAC3C,OAAKD,EAGE,CACL,GAAIA,EAAK,GACT,YAAaA,EAAK,aAClB,KAAMA,EAAK,IAAA,EANK,IAQpB,CAAC,EACA,MAAMG,CAAkB,CAC7B,CClCO,MAAMC,EAAoC;AAAA;AAAA;AAAA;AAAA,ECUjD,eAAsBC,EAAkBC,EAA8B,CACpE,OAAO,MAAMV,EAA6DQ,EAAqB,CAAE,UAAW,CAAE,GAAAE,CAAA,EAAM,EACjH,KAAMT,GAAQ,SACb,OAAIC,EAAAD,EAAI,SAAJ,MAAAC,EAAY,OAAeC,EAAiBF,EAAI,MAAM,EACnD,CAAC,GAACK,EAAAL,GAAA,YAAAA,EAAK,OAAL,MAAAK,EAAW,kBACtB,CAAC,EACA,MAAMC,C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EACnD,CAAC,GAACyB,GAAArB,GAAAC,EAAAL,GAAA,YAAAA,EAAK,OAAL,YAAAK,EAAW,oBAAX,YAAAD,EAA8B,OAA9B,MAAAqB,EAAoC,GAC/C,CAAC,EACA,MAAMnB,CAAkB,CAC7B"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*! Copyright 2025 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{h as
|
|
3
|
+
import{h as o}from"./fetch-error.js";import{f as l,h as m}from"./network-error.js";import{i as u}from"./company-permissions.js";const c=`
|
|
4
4
|
mutation createCompanyUser($input: CompanyUserCreateInput!) {
|
|
5
5
|
createCompanyUser(input: $input) { __typename user { id structure_id email firstname lastname } }
|
|
6
6
|
}
|
|
7
|
-
`;async function
|
|
7
|
+
`;async function E(a){const t={email:a.email,firstname:a.firstName,lastname:a.lastName,job_title:a.jobTitle,telephone:a.telephone,role_id:a.roleId,status:a.status,target_id:a.targetId};return await l(c,{variables:{input:t}}).then(e=>{var n,i,s;if((n=e.errors)!=null&&n.length)return o(e.errors);const r=(s=(i=e==null?void 0:e.data)==null?void 0:i.createCompanyUser)==null?void 0:s.user;return r?{id:r.id,structureId:r.structure_id}:null}).catch(m)}const d=`
|
|
8
8
|
mutation DELETE_COMPANY_USER($id: ID!) {
|
|
9
9
|
deleteCompanyUserV2(id: $id) {
|
|
10
10
|
success
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`,
|
|
13
|
+
`,A=async a=>{var r,n;const{id:t}=a;if(!t)throw new Error("User ID is required to delete a company user");const e=await l(d,{method:"POST",cache:"no-cache",variables:{id:t}}).catch(m);return(r=e.errors)!=null&&r.length&&o(e.errors),(n=e.data)!=null&&n.deleteCompanyUserV2?{success:e.data.deleteCompanyUserV2.success}:{success:!1}},p=a=>{if(!a)throw new Error("Invalid response: missing user data");return{id:a.id,email:a.email,firstName:a.firstname,lastName:a.lastname,jobTitle:a.job_title,telephone:a.telephone,status:a.status,role:a.role,isCompanyAdmin:u(a.role)}},y=`
|
|
14
14
|
query getCompanyUser($id: ID!) {
|
|
15
15
|
company {
|
|
16
16
|
user(id: $id) {
|
|
@@ -25,13 +25,13 @@ import{h as s}from"./fetch-error.js";import{f as l,h as m}from"./network-error.j
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
`;async function
|
|
28
|
+
`;async function b(a){return await l(y,{variables:{id:a}}).then(t=>{var r,n,i;if((r=t.errors)!=null&&r.length)return o(t.errors);const e=(i=(n=t==null?void 0:t.data)==null?void 0:n.company)==null?void 0:i.user;return e?p(e):null}).catch(m)}const h=`
|
|
29
29
|
query isCompanyUserEmailAvailable($email: String!) {
|
|
30
30
|
isCompanyUserEmailAvailable(email: $email) { is_email_available }
|
|
31
31
|
}
|
|
32
|
-
`;async function
|
|
32
|
+
`;async function I(a){return await l(h,{variables:{email:a}}).then(t=>{var e,r,n;return(e=t.errors)!=null&&e.length?o(t.errors):((n=(r=t==null?void 0:t.data)==null?void 0:r.isCompanyUserEmailAvailable)==null?void 0:n.is_email_available)??null}).catch(m)}const _=`
|
|
33
33
|
mutation updateCompanyUser($input: CompanyUserUpdateInput!) {
|
|
34
34
|
updateCompanyUser(input: $input) { __typename user { id } }
|
|
35
35
|
}
|
|
36
|
-
`;async function
|
|
36
|
+
`;async function N(a){const t={id:a.id,email:a.email,firstname:a.firstName,lastname:a.lastName,job_title:a.jobTitle,telephone:a.telephone,role_id:a.roleId,status:a.status};return await l(_,{variables:{input:t}}).then(e=>{var r,n,i,s;return(r=e.errors)!=null&&r.length?o(e.errors):!!((s=(i=(n=e==null?void 0:e.data)==null?void 0:n.updateCompanyUser)==null?void 0:i.user)!=null&&s.id)}).catch(m)}export{E as c,A as d,b as g,I as i,N as u};
|
|
37
37
|
//# sourceMappingURL=updateCompanyUser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateCompanyUser.js","sources":["/@dropins/storefront-company-management/src/lib/encoding.ts","/@dropins/storefront-company-management/src/api/createCompanyUser/graphql/createCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/createCompanyUser/createCompanyUser.ts","/@dropins/storefront-company-management/src/api/deleteCompanyUser/graphql/deleteCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/deleteCompanyUser/deleteCompanyUser.ts","/@dropins/storefront-company-management/src/data/transforms/transform-company-user.ts","/@dropins/storefront-company-management/src/api/getCompanyUser/graphql/getCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyUser/getCompanyUser.ts","/@dropins/storefront-company-management/src/api/isCompanyUserEmailAvailable/graphql/isCompanyUserEmailAvailable.graphql.ts","/@dropins/storefront-company-management/src/api/isCompanyUserEmailAvailable/isCompanyUserEmailAvailable.ts","/@dropins/storefront-company-management/src/api/updateCompanyUser/graphql/updateCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyUser/updateCompanyUser.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 * Encodes a string to base64\n * @param value - The string to encode\n * @returns The base64 encoded string\n * @throws Error if encoding fails\n */\nexport const encodeBase64 = (value: string): string => {\n try {\n return btoa(value);\n } catch (error) {\n throw new Error(`Failed to encode base64: ${error}`);\n }\n};\n\n/**\n * Decodes a base64 encoded string\n * @param encoded - The base64 encoded string to decode\n * @returns The decoded string, or the original string if decoding fails\n */\nexport const decodeBase64 = (encoded: string): string => {\n try {\n return atob(encoded);\n } catch {\n // Return original if decoding fails (graceful fallback)\n return encoded;\n }\n};\n\n/**\n * Safely encodes a user ID to base64 for API transmission\n * @param userId - The user ID to encode\n * @returns The base64 encoded user ID\n * @throws Error if userId is empty or encoding fails\n */\nexport const encodeUserId = (userId: string): string => {\n if (!userId || typeof userId !== 'string') {\n throw new Error('User ID must be a non-empty string');\n }\n \n return encodeBase64(userId);\n};\n\n/**\n * Safely decodes a base64 encoded user ID from API response\n * @param encodedUserId - The base64 encoded user ID\n * @returns The decoded user ID, or the original string if decoding fails\n */\nexport const decodeUserId = (encodedUserId: string): string => {\n if (!encodedUserId || typeof encodedUserId !== 'string') {\n return encodedUserId;\n }\n \n return decodeBase64(encodedUserId);\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 CREATE_COMPANY_USER = /* GraphQL */ `\n mutation createCompanyUser($input: CompanyUserCreateInput!) {\n createCompanyUser(input: $input) { __typename user { id structure_id email firstname lastname } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { CreateCompanyUserInput, CreateCompanyUserResult } from '@/company-management/types';\nimport { CREATE_COMPANY_USER } from './graphql/createCompanyUser.graphql';\n\n/**\n * Creates a new company user with the provided information\n * @param input - User information including email, name, job title, and role\n * @returns Promise resolving to created user result or null if creation failed\n */\nexport async function createCompanyUser(input: CreateCompanyUserInput): Promise<CreateCompanyUserResult | null> {\n const transformedInput = {\n email: input.email,\n firstname: input.firstName,\n lastname: input.lastName,\n job_title: input.jobTitle,\n telephone: input.telephone,\n role_id: input.roleId,\n status: input.status,\n target_id: input.targetId,\n };\n\n return await fetchGraphQl<{ createCompanyUser?: { user?: { id: string; structure_id?: string } } }>(CREATE_COMPANY_USER, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const user = res?.data?.createCompanyUser?.user;\n if (!user) return null;\n\n return {\n id: user.id,\n structureId: user.structure_id,\n };\n })\n .catch(handleNetworkError);\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 *******************************************************************/\nexport const DELETE_COMPANY_USER_MUTATION = /* GraphQL */ `\n mutation DELETE_COMPANY_USER($id: ID!) {\n deleteCompanyUserV2(id: $id) {\n success\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError, encodeUserId } from '@/company-management/lib';\nimport { DELETE_COMPANY_USER_MUTATION } from './graphql/deleteCompanyUser.graphql';\nimport { DeleteCompanyUserMutation, DeleteCompanyUserParams, DeleteCompanyUserResponse } from '@/company-management/types';\n\n/**\n * Deletes a company user by their ID\n * @param params - The parameters containing user ID\n * @param params.id - The ID of the user to delete (will be base64 encoded)\n * @returns Promise<DeleteCompanyUserResponse> - Object containing success status\n */\nexport const deleteCompanyUser = async (params: DeleteCompanyUserParams): Promise<DeleteCompanyUserResponse> => {\n const { id } = params;\n\n if (!id) {\n throw new Error('User ID is required to delete a company user');\n }\n\n const encodedId = encodeUserId(id);\n\n const response = await fetchGraphQl<DeleteCompanyUserMutation>(\n DELETE_COMPANY_USER_MUTATION,\n {\n method: 'POST',\n cache: 'no-cache',\n variables: {\n id: encodedId\n }\n }\n ).catch(handleNetworkError);\n\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n if (!response.data?.deleteCompanyUserV2) {\n return {\n success: false\n };\n }\n\n return {\n success: response.data.deleteCompanyUserV2.success\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 { CompanyUserModel } from '@/company-management/data/models/company-user';\nimport { isCompanyAdministrator } from '@/company-management/lib';\n\ninterface CompanyUserResponse {\n id: string;\n email: string;\n firstname: string;\n lastname: string;\n job_title?: string | null;\n telephone?: string | null;\n status?: string | null;\n role?: {\n id: string;\n name: string;\n } | null;\n}\n\nexport const transformCompanyUser = (response: CompanyUserResponse): CompanyUserModel => {\n if (!response) {\n throw new Error('Invalid response: missing user data');\n }\n\n return {\n id: response.id,\n email: response.email,\n firstName: response.firstname,\n lastName: response.lastname,\n jobTitle: response.job_title,\n telephone: response.telephone,\n status: response.status,\n role: response.role,\n isCompanyAdmin: isCompanyAdministrator(response.role),\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_COMPANY_USER = /* GraphQL */ `\n query getCompanyUser($id: ID!) {\n company {\n user(id: $id) {\n id\n email\n firstname\n lastname\n job_title\n telephone\n status\n role { id 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 *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError, encodeUserId } from '@/company-management/lib';\nimport { CompanyUserModel } from '@/company-management/data/models';\nimport { transformCompanyUser } from '@/company-management/data/transforms';\nimport { GET_COMPANY_USER } from './graphql/getCompanyUser.graphql';\n\n/**\n * Retrieves a specific company user by their ID\n * @param id - The ID of the company user to retrieve (will be base64 encoded)\n * @returns Promise resolving to CompanyUserModel or null if user not found\n */\nexport async function getCompanyUser(id: string): Promise<CompanyUserModel | null> {\n const encodedId = encodeUserId(id);\n\n return await fetchGraphQl<{ company: { user?: { id: string; email: string; firstname: string; lastname: string; job_title?: string | null; telephone?: string | null; status?: string | null; role?: { id: string; name: string } | null } } }>(GET_COMPANY_USER, { variables: { id: encodedId } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const user = res?.data?.company?.user;\n if (!user) return null;\n\n return transformCompanyUser(user);\n })\n .catch(handleNetworkError);\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 IS_COMPANY_USER_EMAIL_AVAILABLE = /* GraphQL */ `\n query isCompanyUserEmailAvailable($email: String!) {\n isCompanyUserEmailAvailable(email: $email) { is_email_available }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { IS_COMPANY_USER_EMAIL_AVAILABLE } from './graphql/isCompanyUserEmailAvailable.graphql';\n\n/**\n * Checks if an email address is available for use by a new company user\n * @param email - The email address to check for availability\n * @returns Promise resolving to boolean indicating availability or null if check failed\n */\nexport async function isCompanyUserEmailAvailable(email: string): Promise<boolean | null> {\n return await fetchGraphQl<{ isCompanyUserEmailAvailable?: { is_email_available: boolean } }>(IS_COMPANY_USER_EMAIL_AVAILABLE, { variables: { email } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return res?.data?.isCompanyUserEmailAvailable?.is_email_available ?? null;\n })\n .catch(handleNetworkError);\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 UPDATE_COMPANY_USER = /* GraphQL */ `\n mutation updateCompanyUser($input: CompanyUserUpdateInput!) {\n updateCompanyUser(input: $input) { __typename user { id } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError, encodeUserId } from '@/company-management/lib';\nimport { UpdateCompanyUserInput } from '@/company-management/types';\nimport { UPDATE_COMPANY_USER } from './graphql/updateCompanyUser.graphql';\n\n/**\n * Updates an existing company user with the provided information\n * @param input - User information including ID and fields to update\n * @returns Promise resolving to boolean indicating success\n */\nexport async function updateCompanyUser(input: UpdateCompanyUserInput): Promise<boolean> {\n const transformedInput = {\n id: encodeUserId(input.id),\n email: input.email,\n firstname: input.firstName,\n lastname: input.lastName,\n job_title: input.jobTitle,\n telephone: input.telephone,\n role_id: input.roleId,\n status: input.status,\n };\n\n return await fetchGraphQl<{ updateCompanyUser?: { user?: { id: string } } }>(UPDATE_COMPANY_USER, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.updateCompanyUser?.user?.id;\n })\n .catch(handleNetworkError);\n}\n"],"names":["encodeBase64","value","error","decodeBase64","encoded","encodeUserId","userId","decodeUserId","encodedUserId","CREATE_COMPANY_USER","createCompanyUser","input","transformedInput","fetchGraphQl","res","_a","handleFetchError","user","_c","_b","handleNetworkError","DELETE_COMPANY_USER_MUTATION","deleteCompanyUser","params","id","encodedId","response","transformCompanyUser","isCompanyAdministrator","GET_COMPANY_USER","getCompanyUser","IS_COMPANY_USER_EMAIL_AVAILABLE","isCompanyUserEmailAvailable","email","UPDATE_COMPANY_USER","updateCompanyUser","_d"],"mappings":"gIAuBO,MAAMA,EAAgBC,GAA0B,CACrD,GAAI,CACF,OAAO,KAAKA,CAAK,CACnB,OAASC,EAAO,CACd,MAAM,IAAI,MAAM,4BAA4BA,CAAK,EAAE,CACrD,CACF,EAOaC,EAAgBC,GAA4B,CACvD,GAAI,CACF,OAAO,KAAKA,CAAO,CACrB,MAAQ,CAEN,OAAOA,CACT,CACF,EAQaC,EAAgBC,GAA2B,CACtD,GAAI,CAACA,GAAU,OAAOA,GAAW,SAC/B,MAAM,IAAI,MAAM,oCAAoC,EAGtD,OAAON,EAAaM,CAAM,CAC5B,EAOaC,EAAgBC,GACvB,CAACA,GAAiB,OAAOA,GAAkB,SACtCA,EAGFL,EAAaK,CAAa,ECpDtBC,EAAoC;AAAA;AAAA;AAAA;AAAA,ECSjD,eAAsBC,EAAkBC,EAAwE,CAC9G,MAAMC,EAAmB,CACvB,MAAOD,EAAM,MACb,UAAWA,EAAM,UACjB,SAAUA,EAAM,SAChB,UAAWA,EAAM,SACjB,UAAWA,EAAM,UACjB,QAASA,EAAM,OACf,OAAQA,EAAM,OACd,UAAWA,EAAM,QAAA,EAGnB,OAAO,MAAME,EAAuFJ,EAAqB,CAAE,UAAW,CAAE,MAAOG,EAAiB,CAAG,EAChK,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AAAL,GAAA,YAAAA,EAAK,OAAL,YAAAK,EAAW,oBAAX,YAAAD,EAA8B,OAA9B,MAAAkB,EAAoC,GAC/C,CAAC,EACA,MAAMhB,CAAkB,CAC7B"}
|
|
1
|
+
{"version":3,"file":"updateCompanyUser.js","sources":["/@dropins/storefront-company-management/src/api/createCompanyUser/graphql/createCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/createCompanyUser/createCompanyUser.ts","/@dropins/storefront-company-management/src/api/deleteCompanyUser/graphql/deleteCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/deleteCompanyUser/deleteCompanyUser.ts","/@dropins/storefront-company-management/src/data/transforms/transform-company-user.ts","/@dropins/storefront-company-management/src/api/getCompanyUser/graphql/getCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyUser/getCompanyUser.ts","/@dropins/storefront-company-management/src/api/isCompanyUserEmailAvailable/graphql/isCompanyUserEmailAvailable.graphql.ts","/@dropins/storefront-company-management/src/api/isCompanyUserEmailAvailable/isCompanyUserEmailAvailable.ts","/@dropins/storefront-company-management/src/api/updateCompanyUser/graphql/updateCompanyUser.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyUser/updateCompanyUser.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nexport const CREATE_COMPANY_USER = /* GraphQL */ `\n mutation createCompanyUser($input: CompanyUserCreateInput!) {\n createCompanyUser(input: $input) { __typename user { id structure_id email firstname lastname } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { CreateCompanyUserInput, CreateCompanyUserResult } from '@/company-management/types';\nimport { CREATE_COMPANY_USER } from './graphql/createCompanyUser.graphql';\n\n/**\n * Creates a new company user with the provided information\n * @param input - User information including email, name, job title, and role\n * @returns Promise resolving to created user result or null if creation failed\n */\nexport async function createCompanyUser(input: CreateCompanyUserInput): Promise<CreateCompanyUserResult | null> {\n const transformedInput = {\n email: input.email,\n firstname: input.firstName,\n lastname: input.lastName,\n job_title: input.jobTitle,\n telephone: input.telephone,\n role_id: input.roleId,\n status: input.status,\n target_id: input.targetId,\n };\n\n return await fetchGraphQl<{ createCompanyUser?: { user?: { id: string; structure_id?: string } } }>(CREATE_COMPANY_USER, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const user = res?.data?.createCompanyUser?.user;\n if (!user) return null;\n\n return {\n id: user.id,\n structureId: user.structure_id,\n };\n })\n .catch(handleNetworkError);\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 *******************************************************************/\nexport const DELETE_COMPANY_USER_MUTATION = /* GraphQL */ `\n mutation DELETE_COMPANY_USER($id: ID!) {\n deleteCompanyUserV2(id: $id) {\n success\n }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { DELETE_COMPANY_USER_MUTATION } from './graphql/deleteCompanyUser.graphql';\nimport { DeleteCompanyUserMutation, DeleteCompanyUserParams, DeleteCompanyUserResponse } from '@/company-management/types';\n\n/**\n * Deletes a company user by their ID\n * @param params - The parameters containing user ID\n * @param params.id - The ID of the user to delete (base64 encoded UID from GraphQL)\n * @returns Promise<DeleteCompanyUserResponse> - Object containing success status\n */\nexport const deleteCompanyUser = async (params: DeleteCompanyUserParams): Promise<DeleteCompanyUserResponse> => {\n const { id } = params;\n\n if (!id) {\n throw new Error('User ID is required to delete a company user');\n }\n\n const response = await fetchGraphQl<DeleteCompanyUserMutation>(\n DELETE_COMPANY_USER_MUTATION,\n {\n method: 'POST',\n cache: 'no-cache',\n variables: {\n id\n }\n }\n ).catch(handleNetworkError);\n\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n if (!response.data?.deleteCompanyUserV2) {\n return {\n success: false\n };\n }\n\n return {\n success: response.data.deleteCompanyUserV2.success\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 { CompanyUserModel } from '@/company-management/data/models/company-user';\nimport { isCompanyAdministrator } from '@/company-management/lib';\n\ninterface CompanyUserResponse {\n id: string;\n email: string;\n firstname: string;\n lastname: string;\n job_title?: string | null;\n telephone?: string | null;\n status?: string | null;\n role?: {\n id: string;\n name: string;\n } | null;\n}\n\nexport const transformCompanyUser = (response: CompanyUserResponse): CompanyUserModel => {\n if (!response) {\n throw new Error('Invalid response: missing user data');\n }\n\n return {\n id: response.id,\n email: response.email,\n firstName: response.firstname,\n lastName: response.lastname,\n jobTitle: response.job_title,\n telephone: response.telephone,\n status: response.status,\n role: response.role,\n isCompanyAdmin: isCompanyAdministrator(response.role),\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_COMPANY_USER = /* GraphQL */ `\n query getCompanyUser($id: ID!) {\n company {\n user(id: $id) {\n id\n email\n firstname\n lastname\n job_title\n telephone\n status\n role { id 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 *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { CompanyUserModel } from '@/company-management/data/models';\nimport { transformCompanyUser } from '@/company-management/data/transforms';\nimport { GET_COMPANY_USER } from './graphql/getCompanyUser.graphql';\n\n/**\n * Retrieves a specific company user by their ID\n * @param id - The ID of the company user to retrieve (base64 encoded UID from GraphQL)\n * @returns Promise resolving to CompanyUserModel or null if user not found\n */\nexport async function getCompanyUser(id: string): Promise<CompanyUserModel | null> {\n return await fetchGraphQl<{ company: { user?: { id: string; email: string; firstname: string; lastname: string; job_title?: string | null; telephone?: string | null; status?: string | null; role?: { id: string; name: string } | null } } }>(GET_COMPANY_USER, { variables: { id } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n const user = res?.data?.company?.user;\n if (!user) return null;\n\n return transformCompanyUser(user);\n })\n .catch(handleNetworkError);\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 IS_COMPANY_USER_EMAIL_AVAILABLE = /* GraphQL */ `\n query isCompanyUserEmailAvailable($email: String!) {\n isCompanyUserEmailAvailable(email: $email) { is_email_available }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { IS_COMPANY_USER_EMAIL_AVAILABLE } from './graphql/isCompanyUserEmailAvailable.graphql';\n\n/**\n * Checks if an email address is available for use by a new company user\n * @param email - The email address to check for availability\n * @returns Promise resolving to boolean indicating availability or null if check failed\n */\nexport async function isCompanyUserEmailAvailable(email: string): Promise<boolean | null> {\n return await fetchGraphQl<{ isCompanyUserEmailAvailable?: { is_email_available: boolean } }>(IS_COMPANY_USER_EMAIL_AVAILABLE, { variables: { email } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return res?.data?.isCompanyUserEmailAvailable?.is_email_available ?? null;\n })\n .catch(handleNetworkError);\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 UPDATE_COMPANY_USER = /* GraphQL */ `\n mutation updateCompanyUser($input: CompanyUserUpdateInput!) {\n updateCompanyUser(input: $input) { __typename user { id } }\n }\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { UpdateCompanyUserInput } from '@/company-management/types';\nimport { UPDATE_COMPANY_USER } from './graphql/updateCompanyUser.graphql';\n\n/**\n * Updates an existing company user with the provided information\n * @param input - User information including ID (base64 encoded UID) and fields to update\n * @returns Promise resolving to boolean indicating success\n */\nexport async function updateCompanyUser(input: UpdateCompanyUserInput): Promise<boolean> {\n const transformedInput = {\n id: input.id,\n email: input.email,\n firstname: input.firstName,\n lastname: input.lastName,\n job_title: input.jobTitle,\n telephone: input.telephone,\n role_id: input.roleId,\n status: input.status,\n };\n\n return await fetchGraphQl<{ updateCompanyUser?: { user?: { id: string } } }>(UPDATE_COMPANY_USER, { variables: { input: transformedInput } })\n .then((res) => {\n if (res.errors?.length) return handleFetchError(res.errors);\n return !!res?.data?.updateCompanyUser?.user?.id;\n })\n .catch(handleNetworkError);\n}\n"],"names":["CREATE_COMPANY_USER","createCompanyUser","input","transformedInput","fetchGraphQl","res","_a","handleFetchError","user","_c","_b","handleNetworkError","DELETE_COMPANY_USER_MUTATION","deleteCompanyUser","params","id","response","transformCompanyUser","isCompanyAdministrator","GET_COMPANY_USER","getCompanyUser","IS_COMPANY_USER_EMAIL_AVAILABLE","isCompanyUserEmailAvailable","email","UPDATE_COMPANY_USER","updateCompanyUser","_d"],"mappings":"gIAiBO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA,ECSjD,eAAsBC,EAAkBC,EAAwE,CAC9G,MAAMC,EAAmB,CACvB,MAAOD,EAAM,MACb,UAAWA,EAAM,UACjB,SAAUA,EAAM,SAChB,UAAWA,EAAM,SACjB,UAAWA,EAAM,UACjB,QAASA,EAAM,OACf,OAAQA,EAAM,OACd,UAAWA,EAAM,QAAA,EAGnB,OAAO,MAAME,EAAuFJ,EAAqB,CAAE,UAAW,CAAE,MAAOG,EAAiB,CAAG,EAChK,KAAME,GAAQ,WACb,IAAIC,EAAAD,EAAI,SAAJ,MAAAC,EAAY,OAAQ,OAAOC,EAAiBF,EAAI,MAAM,EAC1D,MAAMG,GAAOC,GAAAC,EAAAL,GAAA,YAAAA,EAAK,OAAL,YAAAK,E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h as i}from"./fetch-error.js";import{f as m,h as d}from"./network-error.js";const l=`
|
|
4
4
|
query COMPANY_USERS($pageSize: Int!, $currentPage: Int!, $filter: CompanyUsersFilterInput) {
|
|
5
5
|
company {
|
|
6
6
|
users(pageSize: $pageSize, currentPage: $currentPage, filter: $filter) {
|
|
@@ -26,7 +26,7 @@ import{d as l,e as g}from"./updateCompanyUser.js";import{h as i}from"./fetch-err
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
`,
|
|
29
|
+
`,h=async(p={})=>{var n,o,u,c;const{pageSize:s=20,currentPage:a=1,filter:r}=p;try{const e=await m(l,{method:"GET",cache:"no-cache",variables:{pageSize:s,currentPage:a,filter:r}}).catch(d);return(n=e.errors)!=null&&n.length&&i(e.errors),(c=(u=(o=e.data)==null?void 0:o.company)==null?void 0:u.users)!=null&&c.items?{users:e.data.company.users.items.map(t=>({id:t.id,firstName:t.firstname,lastName:t.lastname,email:t.email,role:t.role.name,status:t.status,...t.team&&{team:t.team.name}})),pageInfo:{pageSize:e.data.company.users.page_info.page_size,currentPage:e.data.company.users.page_info.current_page,totalPages:e.data.company.users.page_info.total_pages},totalCount:e.data.company.users.total_count}:{users:[],pageInfo:{pageSize:s,currentPage:a,totalPages:1}}}catch{return{users:[],pageInfo:{pageSize:s,currentPage:a,totalPages:1}}}},g=`
|
|
30
30
|
mutation UPDATE_COMPANY_USER_STATUS($input: CompanyUserUpdateInput!) {
|
|
31
31
|
updateCompanyUser(input: $input) {
|
|
32
32
|
user {
|
|
@@ -35,5 +35,5 @@ import{d as l,e as g}from"./updateCompanyUser.js";import{h as i}from"./fetch-err
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
`,
|
|
38
|
+
`,U=async p=>{var n,o,u;const{id:s,status:a}=p;if(!s)throw new Error("User ID is required to update company user status");if(!a||a!=="ACTIVE"&&a!=="INACTIVE")throw new Error("Valid status (ACTIVE or INACTIVE) is required to update company user status");const r=await m(g,{method:"POST",cache:"no-cache",variables:{input:{id:s,status:a}}}).catch(d);return(n=r.errors)!=null&&n.length&&i(r.errors),(u=(o=r.data)==null?void 0:o.updateCompanyUser)!=null&&u.user?{success:!0,user:{id:r.data.updateCompanyUser.user.id,status:r.data.updateCompanyUser.user.status}}:{success:!1}};export{h as g,U as u};
|
|
39
39
|
//# sourceMappingURL=updateCompanyUserStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateCompanyUserStatus.js","sources":["/@dropins/storefront-company-management/src/api/getCompanyUsers/graphql/companyUsers.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyUsers/getCompanyUsers.ts","/@dropins/storefront-company-management/src/api/updateCompanyUserStatus/graphql/updateCompanyUserStatus.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyUserStatus/updateCompanyUserStatus.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 *******************************************************************/\nexport const COMPANY_USERS_QUERY = /* GraphQL */ `\n query COMPANY_USERS($pageSize: Int!, $currentPage: Int!, $filter: CompanyUsersFilterInput) {\n company {\n users(pageSize: $pageSize, currentPage: $currentPage, filter: $filter) {\n items {\n id\n firstname\n lastname\n email\n role {\n name\n }\n status\n team {\n name\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\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 *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError, decodeUserId } from '@/company-management/lib';\nimport { COMPANY_USERS_QUERY } from './graphql/companyUsers.graphql';\nimport { CompanyUsersQuery, CompanyUser, CompanyUsersParams, CompanyUsersResponse } from '@/company-management/types';\n\n/**\n * Fetches the list of company users with pagination and optional filtering\n * @param params - Query parameters\n * @param params.pageSize - Number of items per page (default: 20)\n * @param params.currentPage - Current page number (default: 1)\n * @param params.filter - Optional filter to apply (e.g., { status: 'ACTIVE' })\n * @returns Promise<CompanyUsersResponse> - Object containing array of company users and pagination info\n */\nexport const getCompanyUsers = async (params: CompanyUsersParams = {}): Promise<CompanyUsersResponse> => {\n const { pageSize = 20, currentPage = 1, filter } = params;\n\n try {\n const response = await fetchGraphQl<CompanyUsersQuery>(\n COMPANY_USERS_QUERY,\n {\n method: 'GET',\n cache: 'no-cache',\n variables: {\n pageSize,\n currentPage,\n filter\n }\n }\n ).catch(handleNetworkError);\n\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n if (!response.data?.company?.users?.items) {\n return {\n users: [],\n pageInfo: {\n pageSize,\n currentPage,\n totalPages: 1\n }\n };\n }\n\n // Transform the GraphQL response to CompanyUser interface\n const users: CompanyUser[] = response.data.company.users.items.map((item) => {\n return {\n id: decodeUserId(item.id),\n firstName: item.firstname,\n lastName: item.lastname,\n email: item.email,\n role: item.role.name,\n status: item.status,\n ...(item.team && { team: item.team.name })\n };\n });\n\n return {\n users,\n pageInfo: {\n pageSize: response.data.company.users.page_info.page_size,\n currentPage: response.data.company.users.page_info.current_page,\n totalPages: response.data.company.users.page_info.total_pages\n },\n totalCount: response.data.company.users.total_count\n };\n } catch (error) {\n // Both handleNetworkError and handleFetchError throw errors\n // We return empty users array with default page info as fallback\n return {\n users: [],\n pageInfo: {\n pageSize,\n currentPage,\n totalPages: 1\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 *******************************************************************/\nexport const UPDATE_COMPANY_USER_STATUS_MUTATION = /* GraphQL */ `\n mutation UPDATE_COMPANY_USER_STATUS($input: CompanyUserUpdateInput!) {\n updateCompanyUser(input: $input) {\n user {\n id\n status\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 *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError, encodeUserId } from '@/company-management/lib';\nimport { UPDATE_COMPANY_USER_STATUS_MUTATION } from './graphql/updateCompanyUserStatus.graphql';\nimport {\n UpdateCompanyUserStatusMutation,\n UpdateCompanyUserStatusParams,\n UpdateCompanyUserStatusResponse,\n} from '@/company-management/types';\n\n/**\n * Updates a company user's status (Active/Inactive)\n * @param params - The parameters containing user ID and new status\n * @param params.id - The ID of the user to update (will be base64 encoded)\n * @param params.status - The new status for the user (ACTIVE or INACTIVE)\n * @returns Promise<UpdateCompanyUserStatusResponse> - Object containing success status and updated user data\n */\nexport const updateCompanyUserStatus = async (params: UpdateCompanyUserStatusParams): Promise<UpdateCompanyUserStatusResponse> => {\n const { id, status } = params;\n \n if (!id) {\n throw new Error('User ID is required to update company user status');\n }\n \n if (!status || (status !== 'ACTIVE' && status !== 'INACTIVE')) {\n throw new Error('Valid status (ACTIVE or INACTIVE) is required to update company user status');\n }\n\n const encodedId = encodeUserId(id);\n \n const response = await fetchGraphQl<UpdateCompanyUserStatusMutation>(\n UPDATE_COMPANY_USER_STATUS_MUTATION,\n {\n method: 'POST',\n cache: 'no-cache',\n variables: {\n input: {\n id: encodedId,\n status\n }\n }\n }\n ).catch(handleNetworkError);\n\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n if (!response.data?.updateCompanyUser?.user) {\n return {\n success: false\n };\n }\n\n return {\n success: true,\n user: {\n id: response.data.updateCompanyUser.user.id,\n status: response.data.updateCompanyUser.user.status\n }\n };\n};\n"],"names":["COMPANY_USERS_QUERY","getCompanyUsers","params","pageSize","currentPage","filter","response","fetchGraphQl","handleNetworkError","_a","handleFetchError","_d","_c","_b","item","decodeUserId","UPDATE_COMPANY_USER_STATUS_MUTATION","updateCompanyUserStatus","id","status","encodedId","encodeUserId"],"mappings":"qIAgBO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECapCC,EAAkB,MAAOC,EAA6B,KAAsC,aACvG,KAAM,CAAE,SAAAC,EAAW,GAAI,YAAAC,EAAc,EAAG,OAAAC,GAAWH,EAEnD,GAAI,CACF,MAAMI,EAAW,MAAMC,EACrBP,EACA,CACE,OAAQ,MACR,MAAO,WACP,UAAW,CACT,SAAAG,EACA,YAAAC,EACA,OAAAC,CAAA,CACF,CACF,EACA,MAAMG,CAAkB,EAM1B,OAJIC,EAAAH,EAAS,SAAT,MAAAG,EAAiB,QACnBC,EAAiBJ,EAAS,MAAM,GAG7BK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AH,EAAS,SAAT,MAAAG,EAAiB,QACnBC,EAAiBJ,EAAS,MAAM,GAG7BM,GAAAC,EAAAP,EAAS,OAAT,YAAAO,EAAe,oBAAf,MAAAD,EAAkC,KAMhC,CACL,QAAS,GACT,KAAM,CACJ,GAAIN,EAAS,KAAK,kBAAkB,KAAK,GACzC,OAAQA,EAAS,KAAK,kBAAkB,KAAK,MAAA,CAC/C,EAVO,CACL,QAAS,EAAA,CAWf"}
|
|
1
|
+
{"version":3,"file":"updateCompanyUserStatus.js","sources":["/@dropins/storefront-company-management/src/api/getCompanyUsers/graphql/companyUsers.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyUsers/getCompanyUsers.ts","/@dropins/storefront-company-management/src/api/updateCompanyUserStatus/graphql/updateCompanyUserStatus.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyUserStatus/updateCompanyUserStatus.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 *******************************************************************/\nexport const COMPANY_USERS_QUERY = /* GraphQL */ `\n query COMPANY_USERS($pageSize: Int!, $currentPage: Int!, $filter: CompanyUsersFilterInput) {\n company {\n users(pageSize: $pageSize, currentPage: $currentPage, filter: $filter) {\n items {\n id\n firstname\n lastname\n email\n role {\n name\n }\n status\n team {\n name\n }\n }\n page_info {\n page_size\n current_page\n total_pages\n }\n total_count\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 *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { COMPANY_USERS_QUERY } from './graphql/companyUsers.graphql';\nimport { CompanyUsersQuery, CompanyUser, CompanyUsersParams, CompanyUsersResponse } from '@/company-management/types';\n\n/**\n * Fetches the list of company users with pagination and optional filtering\n * @param params - Query parameters\n * @param params.pageSize - Number of items per page (default: 20)\n * @param params.currentPage - Current page number (default: 1)\n * @param params.filter - Optional filter to apply (e.g., { status: 'ACTIVE' })\n * @returns Promise<CompanyUsersResponse> - Object containing array of company users with base64-encoded IDs and pagination info\n */\nexport const getCompanyUsers = async (params: CompanyUsersParams = {}): Promise<CompanyUsersResponse> => {\n const { pageSize = 20, currentPage = 1, filter } = params;\n\n try {\n const response = await fetchGraphQl<CompanyUsersQuery>(\n COMPANY_USERS_QUERY,\n {\n method: 'GET',\n cache: 'no-cache',\n variables: {\n pageSize,\n currentPage,\n filter\n }\n }\n ).catch(handleNetworkError);\n\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n if (!response.data?.company?.users?.items) {\n return {\n users: [],\n pageInfo: {\n pageSize,\n currentPage,\n totalPages: 1\n }\n };\n }\n\n // Transform the GraphQL response to CompanyUser interface\n // Keep IDs base64-encoded for consistency with other APIs\n const users: CompanyUser[] = response.data.company.users.items.map((item) => {\n return {\n id: item.id,\n firstName: item.firstname,\n lastName: item.lastname,\n email: item.email,\n role: item.role.name,\n status: item.status,\n ...(item.team && { team: item.team.name })\n };\n });\n\n return {\n users,\n pageInfo: {\n pageSize: response.data.company.users.page_info.page_size,\n currentPage: response.data.company.users.page_info.current_page,\n totalPages: response.data.company.users.page_info.total_pages\n },\n totalCount: response.data.company.users.total_count\n };\n } catch (error) {\n // Both handleNetworkError and handleFetchError throw errors\n // We return empty users array with default page info as fallback\n return {\n users: [],\n pageInfo: {\n pageSize,\n currentPage,\n totalPages: 1\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 *******************************************************************/\nexport const UPDATE_COMPANY_USER_STATUS_MUTATION = /* GraphQL */ `\n mutation UPDATE_COMPANY_USER_STATUS($input: CompanyUserUpdateInput!) {\n updateCompanyUser(input: $input) {\n user {\n id\n status\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 *******************************************************************/\nimport { fetchGraphQl } from '@/company-management/api';\nimport { handleNetworkError, handleFetchError } from '@/company-management/lib';\nimport { UPDATE_COMPANY_USER_STATUS_MUTATION } from './graphql/updateCompanyUserStatus.graphql';\nimport {\n UpdateCompanyUserStatusMutation,\n UpdateCompanyUserStatusParams,\n UpdateCompanyUserStatusResponse,\n} from '@/company-management/types';\n\n/**\n * Updates a company user's status (Active/Inactive)\n * @param params - The parameters containing user ID and new status\n * @param params.id - The ID of the user to update (base64 encoded UID from GraphQL)\n * @param params.status - The new status for the user (ACTIVE or INACTIVE)\n * @returns Promise<UpdateCompanyUserStatusResponse> - Object containing success status and updated user data\n */\nexport const updateCompanyUserStatus = async (params: UpdateCompanyUserStatusParams): Promise<UpdateCompanyUserStatusResponse> => {\n const { id, status } = params;\n \n if (!id) {\n throw new Error('User ID is required to update company user status');\n }\n \n if (!status || (status !== 'ACTIVE' && status !== 'INACTIVE')) {\n throw new Error('Valid status (ACTIVE or INACTIVE) is required to update company user status');\n }\n \n const response = await fetchGraphQl<UpdateCompanyUserStatusMutation>(\n UPDATE_COMPANY_USER_STATUS_MUTATION,\n {\n method: 'POST',\n cache: 'no-cache',\n variables: {\n input: {\n id,\n status\n }\n }\n }\n ).catch(handleNetworkError);\n\n if (response.errors?.length) {\n handleFetchError(response.errors);\n }\n\n if (!response.data?.updateCompanyUser?.user) {\n return {\n success: false\n };\n }\n\n return {\n success: true,\n user: {\n id: response.data.updateCompanyUser.user.id,\n status: response.data.updateCompanyUser.user.status\n }\n };\n};\n"],"names":["COMPANY_USERS_QUERY","getCompanyUsers","params","pageSize","currentPage","filter","response","fetchGraphQl","handleNetworkError","_a","handleFetchError","_d","_c","_b","item","UPDATE_COMPANY_USER_STATUS_MUTATION","updateCompanyUserStatus","id","status"],"mappings":"mFAgBO,MAAMA,EAAoC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECapCC,EAAkB,MAAOC,EAA6B,KAAsC,aACvG,KAAM,CAAE,SAAAC,EAAW,GAAI,YAAAC,EAAc,EAAG,OAAAC,GAAWH,EAEnD,GAAI,CACF,MAAMI,EAAW,MAAMC,EACrBP,EACA,CACE,OAAQ,MACR,MAAO,WACP,UAAW,CACT,SAAAG,EACA,YAAAC,EACA,OAAAC,CAAA,CACF,CACF,EACA,MAAMG,CAAkB,EAM1B,OAJIC,EAAAH,EAAS,SAAT,MAAAG,EAAiB,QACnBC,EAAiBJ,EAAS,MAAM,GAG7BK,GAAAC,GAAAC,EAAAP,E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