@dropins/storefront-company-management 1.0.0-alpha1000
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/LICENSE.md +128 -0
- package/api/checkIsCompanyEnabled/checkIsCompanyEnabled.d.ts +4 -0
- package/api/checkIsCompanyEnabled/index.d.ts +18 -0
- package/api/deleteCompanyUser/deleteCompanyUser.d.ts +10 -0
- package/api/deleteCompanyUser/graphql/deleteCompanyUser.graphql.d.ts +18 -0
- package/api/deleteCompanyUser/graphql/index.d.ts +18 -0
- package/api/deleteCompanyUser/index.d.ts +18 -0
- package/api/fetch-graphql/fetch-graphql.d.ts +24 -0
- package/api/fetch-graphql/index.d.ts +18 -0
- package/api/fetchUserPermissions/fetchUserPermissions.d.ts +9 -0
- package/api/fetchUserPermissions/graphql/getCustomerRole.graphql.d.ts +18 -0
- package/api/fetchUserPermissions/index.d.ts +18 -0
- package/api/getCompany/getCompany.d.ts +4 -0
- package/api/getCompany/index.d.ts +18 -0
- package/api/getCompanyUsers/getCompanyUsers.d.ts +12 -0
- package/api/getCompanyUsers/graphql/companyUsers.graphql.d.ts +18 -0
- package/api/getCompanyUsers/graphql/index.d.ts +18 -0
- package/api/getCompanyUsers/index.d.ts +18 -0
- package/api/getCountries/getCountries.d.ts +9 -0
- package/api/getCountries/graphql/getCountries.graphql.d.ts +18 -0
- package/api/getCountries/index.d.ts +18 -0
- package/api/graphql/CompanyFragment.graphql.d.ts +22 -0
- package/api/graphql/buildCompanyQueries.d.ts +9 -0
- package/api/index.d.ts +28 -0
- package/api/initialize/index.d.ts +18 -0
- package/api/initialize/initialize.d.ts +25 -0
- package/api/updateCompany/graphql/updateCompany.graphql.d.ts +2 -0
- package/api/updateCompany/index.d.ts +18 -0
- package/api/updateCompany/updateCompany.d.ts +5 -0
- package/api/updateCompanyUserStatus/graphql/index.d.ts +18 -0
- package/api/updateCompanyUserStatus/graphql/updateCompanyUserStatus.graphql.d.ts +18 -0
- package/api/updateCompanyUserStatus/index.d.ts +18 -0
- package/api/updateCompanyUserStatus/updateCompanyUserStatus.d.ts +11 -0
- package/api/validateCompanyEmail/graphql/validateCompanyEmail.graphql.d.ts +18 -0
- package/api/validateCompanyEmail/index.d.ts +18 -0
- package/api/validateCompanyEmail/validateCompanyEmail.d.ts +4 -0
- package/api.d.ts +1 -0
- package/api.js +4 -0
- package/api.js.map +1 -0
- package/chunks/CompanyLoaders.js +4 -0
- package/chunks/CompanyLoaders.js.map +1 -0
- package/chunks/fetch-error.js +4 -0
- package/chunks/fetch-error.js.map +1 -0
- package/chunks/getCompanyUsers.js +45 -0
- package/chunks/getCompanyUsers.js.map +1 -0
- package/chunks/getCountries.js +117 -0
- package/chunks/getCountries.js.map +1 -0
- package/components/CompanyLoaders/CompanyLoaders.d.ts +9 -0
- package/components/CompanyLoaders/index.d.ts +18 -0
- package/components/CompanyProfileCard/CompanyProfileCard.d.ts +5 -0
- package/components/CompanyProfileCard/index.d.ts +19 -0
- package/components/CompanyUsersManagementModal/CompanyUsersManagementModal.d.ts +16 -0
- package/components/CompanyUsersManagementModal/index.d.ts +19 -0
- package/components/EditCompanyProfile/CompanyAccountFields.d.ts +22 -0
- package/components/EditCompanyProfile/EditCompanyProfile.d.ts +5 -0
- package/components/EditCompanyProfile/LegalAddressFields.d.ts +50 -0
- package/components/EditCompanyProfile/index.d.ts +19 -0
- package/components/Tree/Tree.d.ts +60 -0
- package/components/Tree/index.d.ts +18 -0
- package/components/index.d.ts +21 -0
- package/containers/CompanyProfile/CompanyProfile.d.ts +5 -0
- package/containers/CompanyProfile/index.d.ts +19 -0
- package/containers/CompanyProfile.d.ts +3 -0
- package/containers/CompanyProfile.js +4 -0
- package/containers/CompanyProfile.js.map +1 -0
- package/containers/CompanyUsers/CompanyUsers.d.ts +7 -0
- package/containers/CompanyUsers/index.d.ts +19 -0
- package/containers/CompanyUsers.d.ts +3 -0
- package/containers/CompanyUsers.js +4 -0
- package/containers/CompanyUsers.js.map +1 -0
- package/containers/index.d.ts +19 -0
- package/data/models/company-address.d.ts +29 -0
- package/data/models/company.d.ts +65 -0
- package/data/models/country.d.ts +26 -0
- package/data/models/index.d.ts +20 -0
- package/data/transforms/index.d.ts +19 -0
- package/data/transforms/transform-company.d.ts +6 -0
- package/data/transforms/transform-countries.d.ts +10 -0
- package/hooks/containers/index.d.ts +18 -0
- package/hooks/containers/useCompanyProfile.d.ts +27 -0
- package/hooks/index.d.ts +19 -0
- package/hooks/useCountries.d.ts +15 -0
- package/hooks/useInLineAlert.d.ts +20 -0
- package/i18n/en_US.json.d.ts +173 -0
- package/lib/acdl.d.ts +43 -0
- package/lib/company-permissions.d.ts +42 -0
- package/lib/convertCase.d.ts +20 -0
- package/lib/convertToBoolean.d.ts +18 -0
- package/lib/convertToInputDateFormat.d.ts +18 -0
- package/lib/cookies.d.ts +18 -0
- package/lib/fetch-error.d.ts +21 -0
- package/lib/index.d.ts +25 -0
- package/lib/network-error.d.ts +6 -0
- package/lib/validationFields.d.ts +49 -0
- package/package.json +1 -0
- package/render/Provider.d.ts +8 -0
- package/render/index.d.ts +18 -0
- package/render/render.d.ts +4 -0
- package/render.d.ts +1 -0
- package/render.js +7 -0
- package/render.js.map +1 -0
- package/types/api/checkIsCompanyEnabled.types.d.ts +21 -0
- package/types/api/companyUsers.types.d.ts +70 -0
- package/types/api/deleteCompanyUser.types.d.ts +28 -0
- package/types/api/getCompany.types.d.ts +83 -0
- package/types/api/getCountries.types.d.ts +37 -0
- package/types/api/index.d.ts +25 -0
- package/types/api/updateCompany.types.d.ts +73 -0
- package/types/api/updateCompanyUserStatus.types.d.ts +22 -0
- package/types/api/validateCompanyEmail.types.d.ts +26 -0
- package/types/index.d.ts +19 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export { UPDATE_COMPANY_USER_STATUS_MUTATION } from './updateCompanyUserStatus.graphql';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const UPDATE_COMPANY_USER_STATUS_MUTATION = "\n mutation UPDATE_COMPANY_USER_STATUS($input: CompanyUserUpdateInput!) {\n updateCompanyUser(input: $input) {\n user {\n id\n status\n }\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=updateCompanyUserStatus.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './updateCompanyUserStatus';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UpdateCompanyUserStatusParams, UpdateCompanyUserStatusResponse } from '../../types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Updates a company user's status (Active/Inactive)
|
|
5
|
+
* @param params - The parameters containing user ID and new status
|
|
6
|
+
* @param params.id - The ID of the user to update (will be base64 encoded)
|
|
7
|
+
* @param params.status - The new status for the user (ACTIVE or INACTIVE)
|
|
8
|
+
* @returns Promise<UpdateCompanyUserStatusResponse> - Object containing success status and updated user data
|
|
9
|
+
*/
|
|
10
|
+
export declare const updateCompanyUserStatus: (params: UpdateCompanyUserStatusParams) => Promise<UpdateCompanyUserStatusResponse>;
|
|
11
|
+
//# sourceMappingURL=updateCompanyUserStatus.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export declare const VALIDATE_COMPANY_EMAIL_QUERY = "\n query validateCompanyEmail($email: String!) {\n isCompanyEmailAvailable(email: $email) {\n is_email_available\n }\n }\n";
|
|
18
|
+
//# sourceMappingURL=validateCompanyEmail.graphql.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './validateCompanyEmail';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/api.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api/index'
|
package/api.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as c,g as i,r as l,s as y,a as u,b as d}from"./chunks/fetch-error.js";import{v as e}from"./chunks/getCountries.js";import{f as h,a as C,g,u as b}from"./chunks/getCountries.js";import{d as v,g as x,u as G}from"./chunks/getCompanyUsers.js";import"@dropins/tools/fetch-graphql.js";import"@dropins/tools/event-bus.js";const o=async(a={})=>({success:!0,config:a}),n=async()=>{try{return await e("test@test.com"),{companyEnabled:!0}}catch{return{companyEnabled:!1,error:"Company functionality not available"}}};export{n as checkIsCompanyEnabled,v as deleteCompanyUser,c as fetchGraphQl,h as fetchUserPermissions,C as getCompany,x as getCompanyUsers,i as getConfig,g as getCountries,o as initialize,l as removeFetchGraphQlHeader,y as setEndpoint,u as setFetchGraphQlHeader,d as setFetchGraphQlHeaders,b as updateCompany,G as updateCompanyUserStatus,e as validateCompanyEmail};
|
|
4
|
+
//# sourceMappingURL=api.js.map
|
package/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sources":["/@dropins/storefront-company-management/src/api/initialize/initialize.ts","/@dropins/storefront-company-management/src/api/checkIsCompanyEnabled/checkIsCompanyEnabled.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\n// import { events } from '@adobe-commerce/event-bus';\n\n\nexport interface CompanyDropinConfig {\n langDefinitions?: Record<string, Record<string, string>>;\n models?: Record<string, any>;\n}\n\nexport const initialize = async (config: CompanyDropinConfig = {}) => {\n return {\n success: true,\n config,\n };\n};\n","/********************************************************************\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 { validateCompanyEmail } from '../validateCompanyEmail';\nimport { CheckIsCompanyEnabledResponse } from '../../types/api/checkIsCompanyEnabled.types';\n\nexport const checkIsCompanyEnabled = async (): Promise<CheckIsCompanyEnabledResponse> => {\n try {\n // Use validateCompanyEmail with a dummy email to check if Company functionality is available\n await validateCompanyEmail('test@test.com');\n \n // If the validation API works (regardless of email availability), Company functionality is enabled\n return {\n companyEnabled: true\n };\n } catch (error) {\n return {\n companyEnabled: false,\n error: 'Company functionality not available'\n };\n }\n};"],"names":["initialize","config","checkIsCompanyEnabled","validateCompanyEmail"],"mappings":"mUAyBO,MAAMA,EAAa,MAAOC,EAA8B,MACtD,CACL,QAAS,GACT,OAAAA,CACF,GCVWC,EAAwB,SAAoD,CACnF,GAAA,CAEF,aAAMC,EAAqB,eAAe,EAGnC,CACL,eAAgB,EAClB,OACc,CACP,MAAA,CACL,eAAgB,GAChB,MAAO,qCACT,CAAA,CAEJ"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as s,jsxs as v}from"@dropins/tools/preact-jsx-runtime.js";import{useState as u,useCallback as c,useEffect as C}from"@dropins/tools/preact-hooks.js";import*as t from"@dropins/tools/preact-compat.js";import{Skeleton as m,SkeletonRow as d,Card as E}from"@dropins/tools/components.js";import{classes as L}from"@dropins/tools/lib.js";const y=n=>t.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},t.createElement("g",{clipPath:"url(#clip0_841_1324)"},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),t.createElement("defs",null,t.createElement("clipPath",{id:"clip0_841_1324"},t.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),x=n=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),H=n=>t.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n},t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),t.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),S={success:s(x,{}),warning:s(y,{}),error:s(H,{})},Z=()=>{const[n,a]=u({}),[r,i]=u(null),h=c(()=>{a({}),r&&(clearTimeout(r),i(null))},[r]),o=c(e=>{if(r&&(clearTimeout(r),i(null)),!(e!=null&&e.type)){a({});return}const l=S[e.type];if(a({type:e.type,text:e.text,icon:l}),e.autoHide!==!1){const w=e.autoHideDelay||(e.type==="success"?3e3:5e3),k=setTimeout(()=>{a({}),i(null)},w);i(k)}},[r]),p=c((e,l=!0)=>{o({type:"success",text:e,autoHide:l})},[o]),g=c((e,l=!1)=>{o({type:"warning",text:e,autoHide:l})},[o]),f=c((e,l=!1)=>{o({type:"error",text:e,autoHide:l})},[o]);return C(()=>()=>{r&&clearTimeout(r)},[r]),{inLineAlertProps:n,handleSetInLineAlert:o,clearAlert:h,showSuccess:p,showWarning:g,showError:f}},A=({testId:n,withCard:a=!0})=>{const r=v(m,{"data-testid":n||"companySkeletonLoader",children:[s(d,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),s(d,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),s(d,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return a?r:s(E,{variant:"secondary",className:L(["company-company-loaders","company-company-loaders--card-loader"]),children:r})},_=({testId:n})=>s("div",{className:"company-users-skeleton-loader","data-testid":n||"companyUsersSkeletonLoader",children:s(m,{children:s(d,{variant:"row",size:"small",fullWidth:!0,lines:3})})});export{_ as C,A as a,Z as u};
|
|
4
|
+
//# sourceMappingURL=CompanyLoaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompanyLoaders.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-company-management/src/hooks/useInLineAlert.tsx","/@dropins/storefront-company-management/src/components/CompanyLoaders/CompanyLoaders.tsx"],"sourcesContent":["import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\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 { useState, useCallback, useEffect } from 'preact/hooks';\nimport { InLineAlertProps } from '../types/companyProfile.types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nexport type AlertType = 'success' | 'warning' | 'error';\n\nexport interface AlertOptions {\n type: AlertType;\n text: string;\n autoHide?: boolean;\n autoHideDelay?: number;\n}\n\nexport interface UseInLineAlertReturn {\n inLineAlertProps: InLineAlertProps;\n handleSetInLineAlert: (notification?: AlertOptions) => void;\n clearAlert: () => void;\n showSuccess: (text: string, autoHide?: boolean) => void;\n showWarning: (text: string, autoHide?: boolean) => void;\n showError: (text: string, autoHide?: boolean) => void;\n}\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = (): UseInLineAlertReturn => {\n const [inLineAlertProps, setInLineAlertProps] = useState<InLineAlertProps>({});\n const [autoHideTimer, setAutoHideTimer] = useState<ReturnType<typeof setTimeout> | null>(null);\n\n const clearAlert = useCallback(() => {\n setInLineAlertProps({});\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n setAutoHideTimer(null);\n }\n }, [autoHideTimer]);\n\n const handleSetInLineAlert = useCallback(\n (notification?: AlertOptions) => {\n // Clear existing timer\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n setAutoHideTimer(null);\n }\n\n if (!notification?.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n type: notification.type,\n text: notification.text,\n icon,\n });\n\n // Auto-hide if requested\n if (notification.autoHide !== false) {\n const delay = notification.autoHideDelay || (notification.type === 'success' ? 3000 : 5000);\n const timer = setTimeout(() => {\n setInLineAlertProps({});\n setAutoHideTimer(null);\n }, delay);\n setAutoHideTimer(timer);\n }\n },\n [autoHideTimer]\n );\n\n const showSuccess = useCallback(\n (text: string, autoHide: boolean = true) => {\n handleSetInLineAlert({ type: 'success', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n const showWarning = useCallback(\n (text: string, autoHide: boolean = false) => {\n handleSetInLineAlert({ type: 'warning', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n const showError = useCallback(\n (text: string, autoHide: boolean = false) => {\n handleSetInLineAlert({ type: 'error', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n // Cleanup timer on unmount\n useEffect(() => {\n return () => {\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n }\n };\n }, [autoHideTimer]);\n\n return {\n inLineAlertProps,\n handleSetInLineAlert,\n clearAlert,\n showSuccess,\n showWarning,\n showError,\n };\n};\n\nexport default useInLineAlert;\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 { Skeleton, SkeletonRow, Card } from '@adobe-commerce/elsie/components';\nimport './CompanyLoaders.css';\nimport { classes } from '@adobe-commerce/elsie/lib';\n\nexport const CompanyCardLoader = ({\n testId,\n withCard = true,\n}: {\n testId?: string;\n withCard?: boolean;\n}) => {\n const defaultSkeleton = (\n <Skeleton data-testid={testId || 'companySkeletonLoader'}>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n </Skeleton>\n );\n\n if (withCard) {\n return defaultSkeleton;\n }\n\n return (\n <Card\n variant=\"secondary\"\n className={classes([\n 'company-company-loaders',\n 'company-company-loaders--card-loader',\n ])}\n >\n {defaultSkeleton}\n </Card>\n );\n};\n\nexport const CompanyUsersTableLoader = ({ testId }: { testId?: string }) => {\n return (\n <div className=\"company-users-skeleton-loader\" data-testid={testId || 'companyUsersSkeletonLoader'}>\n <Skeleton>\n <SkeletonRow variant=\"row\" size=\"small\" fullWidth={true} lines={3} />\n </Skeleton>\n </div>\n );\n};\n"],"names":["SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","useState","autoHideTimer","setAutoHideTimer","clearAlert","useCallback","handleSetInLineAlert","notification","icon","delay","timer","showSuccess","text","autoHide","showWarning","showError","useEffect","CompanyCardLoader","testId","withCard","defaultSkeleton","jsxs","Skeleton","jsx","SkeletonRow","Card","classes","CompanyUsersTableLoader"],"mappings":"oVACA,MAAMA,EAAcC,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAO,EAAkBC,EAAM,cAAc,IAAK,CAAE,SAAU,wBAA0CA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,6DAA8D,OAAQ,eAAgB,cAA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JC,EAACC,EAAS,CAAA,cAAaJ,GAAU,wBAC/B,SAAA,CAAAK,EAACC,EAAA,CACC,QAAQ,UACR,KAAK,SACL,UAAW,GACX,MAAO,CAAA,CACT,EACAD,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAG,CAAA,EACxED,EAACC,GAAY,QAAQ,UAAU,KAAK,SAAS,UAAW,GAAM,MAAO,CAAG,CAAA,CAAA,EAC1E,EAGF,OAAIL,EACKC,EAIPG,EAACE,EAAA,CACC,QAAQ,YACR,UAAWC,EAAQ,CACjB,0BACA,sCAAA,CACD,EAEA,SAAAN,CAAA,CACH,CAEJ,EAEaO,EAA0B,CAAC,CAAE,OAAAT,KAEtCK,EAAC,OAAI,UAAU,gCAAgC,cAAaL,GAAU,6BAClE,WAACI,EACC,CAAA,SAAAC,EAACC,GAAY,QAAQ,MAAM,KAAK,QAAQ,UAAW,GAAM,MAAO,EAAG,EACrE,CACJ,CAAA","x_google_ignoreList":[0,1,2]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{FetchGraphQL as o}from"@dropins/tools/fetch-graphql.js";import{events as s}from"@dropins/tools/event-bus.js";const{setEndpoint:h,setFetchGraphQlHeader:c,removeFetchGraphQlHeader:p,setFetchGraphQlHeaders:i,fetchGraphQl:m,getConfig:E}=new o().getMethods(),d=r=>{throw r instanceof DOMException&&r.name==="AbortError"||s.emit("error",{source:"company",type:"network",error:r}),r},f=r=>{const e=r.map(t=>t.message).join(" ");throw Error(e)};export{c as a,i as b,f as c,m as f,E as g,d as h,p as r,h as s};
|
|
4
|
+
//# sourceMappingURL=fetch-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-error.js","sources":["/@dropins/storefront-company-management/src/api/fetch-graphql/fetch-graphql.ts","/@dropins/storefront-company-management/src/lib/network-error.ts","/@dropins/storefront-company-management/src/lib/fetch-error.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { FetchGraphQL } from '@adobe-commerce/fetch-graphql';\n\nexport const {\n setEndpoint,\n setFetchGraphQlHeader,\n removeFetchGraphQlHeader,\n setFetchGraphQlHeaders,\n fetchGraphQl,\n getConfig,\n} = new FetchGraphQL().getMethods();\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { events } from '@adobe-commerce/event-bus';\n\n/**\n * A function which can be attached to fetchGraphQL to handle thrown errors in\n * a generic way.\n */\nexport const handleNetworkError = (error: Error) => {\n const isAbortError =\n error instanceof DOMException && error.name === 'AbortError';\n\n if (!isAbortError) {\n // @ts-ignore\n events.emit('error', {\n source: 'company',\n type: 'network',\n error,\n });\n }\n throw error;\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/** Actions */\nexport const handleFetchError = (errors: Array<{ message: string }>) => {\n const errorMessage = errors.map((e: any) => e.message).join(' ');\n\n throw Error(errorMessage);\n};\n"],"names":["setEndpoint","setFetchGraphQlHeader","removeFetchGraphQlHeader","setFetchGraphQlHeaders","fetchGraphQl","getConfig","FetchGraphQL","handleNetworkError","error","events","handleFetchError","errors","errorMessage","e"],"mappings":"oHAmBa,KAAA,CACX,YAAAA,EACA,sBAAAC,EACA,yBAAAC,EACA,uBAAAC,EACA,aAAAC,EACA,UAAAC,CACF,EAAI,IAAIC,EAAa,EAAE,WAAW,ECJrBC,EAAsBC,GAAiB,CAIlD,MAFEA,aAAiB,cAAgBA,EAAM,OAAS,cAIhDC,EAAO,KAAK,QAAS,CACnB,OAAQ,UACR,KAAM,UACN,MAAAD,CAAA,CACD,EAEGA,CACR,EClBaE,EAAoBC,GAAuC,CAChE,MAAAC,EAAeD,EAAO,IAAKE,GAAWA,EAAE,OAAO,EAAE,KAAK,GAAG,EAE/D,MAAM,MAAMD,CAAY,CAC1B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as i,h as d,c as m}from"./fetch-error.js";const l=`
|
|
4
|
+
mutation DELETE_COMPANY_USER($id: ID!) {
|
|
5
|
+
deleteCompanyUserV2(id: $id) {
|
|
6
|
+
success
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`,f=e=>btoa(e),C=async e=>{var a,u;const{id:s}=e;if(!s)throw new Error("User ID is required to delete a company user");try{const n=f(s),t=await i(l,{method:"POST",cache:"no-cache",variables:{id:n}}).catch(d);return(a=t.errors)!=null&&a.length&&m(t.errors),(u=t.data)!=null&&u.deleteCompanyUserV2?{success:t.data.deleteCompanyUserV2.success}:{success:!1}}catch{return{success:!1}}},y=`
|
|
10
|
+
mutation UPDATE_COMPANY_USER_STATUS($input: CompanyUserUpdateInput!) {
|
|
11
|
+
updateCompanyUser(input: $input) {
|
|
12
|
+
user {
|
|
13
|
+
id
|
|
14
|
+
status
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`,g=e=>btoa(e),I=async e=>{var u,n,t;const{id:s,status:a}=e;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");try{const p=g(s),o=await i(y,{method:"POST",cache:"no-cache",variables:{input:{id:p,status:a}}}).catch(d);return(u=o.errors)!=null&&u.length&&m(o.errors),(t=(n=o.data)==null?void 0:n.updateCompanyUser)!=null&&t.user?{success:!0,user:{id:o.data.updateCompanyUser.user.id,status:o.data.updateCompanyUser.user.status}}:{success:!1}}catch{return{success:!1}}},h=`
|
|
19
|
+
query COMPANY_USERS($pageSize: Int!, $currentPage: Int!, $filter: CompanyUsersFilterInput) {
|
|
20
|
+
company {
|
|
21
|
+
users(pageSize: $pageSize, currentPage: $currentPage, filter: $filter) {
|
|
22
|
+
items {
|
|
23
|
+
id
|
|
24
|
+
firstname
|
|
25
|
+
lastname
|
|
26
|
+
email
|
|
27
|
+
role {
|
|
28
|
+
name
|
|
29
|
+
}
|
|
30
|
+
status
|
|
31
|
+
team {
|
|
32
|
+
name
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
page_info {
|
|
36
|
+
page_size
|
|
37
|
+
current_page
|
|
38
|
+
total_pages
|
|
39
|
+
}
|
|
40
|
+
total_count
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`,U=e=>{try{return atob(e)}catch{return e}},S=async(e={})=>{var n,t,p,o;const{pageSize:s=20,currentPage:a=1,filter:u}=e;try{const r=await i(h,{method:"GET",cache:"no-cache",variables:{pageSize:s,currentPage:a,filter:u}}).catch(d);return(n=r.errors)!=null&&n.length&&m(r.errors),(o=(p=(t=r.data)==null?void 0:t.company)==null?void 0:p.users)!=null&&o.items?{users:r.data.company.users.items.map(c=>({id:U(c.id),firstName:c.firstname,lastName:c.lastname,email:c.email,role:c.role.name,status:c.status,...c.team&&{team:c.team.name}})),pageInfo:{pageSize:r.data.company.users.page_info.page_size,currentPage:r.data.company.users.page_info.current_page,totalPages:r.data.company.users.page_info.total_pages},totalCount:r.data.company.users.total_count}:{users:[],pageInfo:{pageSize:s,currentPage:a}}}catch{return{users:[],pageInfo:{pageSize:s,currentPage:a}}}};export{C as d,S as g,I as u};
|
|
45
|
+
//# sourceMappingURL=getCompanyUsers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCompanyUsers.js","sources":["/@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/api/updateCompanyUserStatus/graphql/updateCompanyUserStatus.graphql.ts","/@dropins/storefront-company-management/src/api/updateCompanyUserStatus/updateCompanyUserStatus.ts","/@dropins/storefront-company-management/src/api/getCompanyUsers/graphql/companyUsers.graphql.ts","/@dropins/storefront-company-management/src/api/getCompanyUsers/getCompanyUsers.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 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 '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { DELETE_COMPANY_USER_MUTATION } from './graphql';\nimport { DeleteCompanyUserMutation, DeleteCompanyUserParams, DeleteCompanyUserResponse } from '../../types';\n\n/**\n * Encodes a string to base64\n */\nconst encodeBase64 = (value: string): string => {\n return btoa(value);\n};\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 try {\n const encodedId = encodeBase64(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 } catch (error) {\n // Both handleNetworkError and handleFetchError throw errors\n // We return failure status as fallback\n return {\n success: false\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 '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { UPDATE_COMPANY_USER_STATUS_MUTATION } from './graphql';\nimport { UpdateCompanyUserStatusMutation, UpdateCompanyUserStatusParams, UpdateCompanyUserStatusResponse } from '../../types';\n\n/**\n * Encodes a string to base64\n */\nconst encodeBase64 = (value: string): string => {\n return btoa(value);\n};\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 try {\n const encodedId = encodeBase64(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 } catch (error) {\n // Both handleNetworkError and handleFetchError throw errors\n // We return failure status as fallback\n return {\n success: false\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 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 '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { COMPANY_USERS_QUERY } from './graphql';\nimport { CompanyUsersQuery, CompanyUser, CompanyUsersParams, CompanyUsersResponse } from '../../types';\n\n/**\n * Decodes a base64 encoded string\n */\nconst decodeBase64 = (encoded: string): string => {\n try {\n return atob(encoded);\n } catch {\n return encoded; // Return original if decoding fails\n }\n};\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 }\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: decodeBase64(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 }\n };\n }\n};\n"],"names":["DELETE_COMPANY_USER_MUTATION","encodeBase64","value","deleteCompanyUser","params","id","encodedId","response","fetchGraphQl","handleNetworkError","_a","handleFetchError","_b","UPDATE_COMPANY_USER_STATUS_MUTATION","updateCompanyUserStatus","status","_c","COMPANY_USERS_QUERY","decodeBase64","encoded","getCompanyUsers","pageSize","currentPage","filter","_d","item"],"mappings":"mDAgBa,MAAAA,EAA6C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECSpDC,EAAgBC,GACb,KAAKA,CAAK,EASNC,EAAoB,MAAOC,GAAwE,SACxG,KAAA,CAAE,GAAAC,GAAOD,EAEf,GAAI,CAACC,EACG,MAAA,IAAI,MAAM,8CAA8C,EAG5D,GAAA,CACI,MAAAC,EAAYL,EAAaI,CAAE,EAE3BE,EAAW,MAAMC,EACrBR,EACA,CACE,OAAQ,OACR,MAAO,WACP,UAAW,CACT,GAAIM,CAAA,CACN,CACF,EACA,MAAMG,CAAkB,EAMtB,OAJAC,EAAAH,EAAS,SAAT,MAAAG,EAAiB,QACnBC,EAAiBJ,EAAS,MAAM,GAG7BK,EAAAL,EAAS,OAAT,MAAAK,EAAe,oBAMb,CACL,QAASL,EAAS,KAAK,oBAAoB,OAC7C,EAPS,CACL,QAAS,EACX,OAMY,CAGP,MAAA,CACL,QAAS,EACX,CAAA,CAEJ,EC5DaM,EAAoD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECS3DZ,EAAgBC,GACb,KAAKA,CAAK,EAUNY,EAA0B,MAAOV,GAAoF,WAC1H,KAAA,CAAE,GAAAC,EAAI,OAAAU,CAAA,EAAWX,EAEvB,GAAI,CAACC,EACG,MAAA,IAAI,MAAM,mDAAmD,EAGrE,GAAI,CAACU,GAAWA,IAAW,UAAYA,IAAW,WAC1C,MAAA,IAAI,MAAM,6EAA6E,EAG3F,GAAA,CACI,MAAAT,EAAYL,EAAaI,CAAE,EAE3BE,EAAW,MAAMC,EACrBK,EACA,CACE,OAAQ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AAaO,EAAK,EAAE,EACxB,UAAWA,EAAK,UAChB,SAAUA,EAAK,SACf,MAAOA,EAAK,MACZ,KAAMA,EAAK,KAAK,KAChB,OAAQA,EAAK,OACb,GAAIA,EAAK,MAAQ,CAAE,KAAMA,EAAK,KAAK,IAAK,CAC1C,EACD,EAIC,SAAU,CACR,SAAUlB,EAAS,KAAK,QAAQ,MAAM,UAAU,UAChD,YAAaA,EAAS,KAAK,QAAQ,MAAM,UAAU,aACnD,WAAYA,EAAS,KAAK,QAAQ,MAAM,UAAU,WACpD,EACA,WAAYA,EAAS,KAAK,QAAQ,MAAM,WAC1C,EA9BS,CACL,MAAO,CAAC,EACR,SAAU,CACR,SAAAc,EACA,YAAAC,CAAA,CAEJ,OAyBY,CAGP,MAAA,CACL,MAAO,CAAC,EACR,SAAU,CACR,SAAAD,EACA,YAAAC,CAAA,CAEJ,CAAA,CAEJ"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{f as c,c as _,h as g}from"./fetch-error.js";const E=`
|
|
4
|
+
query GET_CUSTOMER_ROLE_PERMISSIONS {
|
|
5
|
+
customer {
|
|
6
|
+
role {
|
|
7
|
+
id
|
|
8
|
+
name
|
|
9
|
+
permissions {
|
|
10
|
+
id
|
|
11
|
+
children {
|
|
12
|
+
id
|
|
13
|
+
children {
|
|
14
|
+
id
|
|
15
|
+
children {
|
|
16
|
+
id
|
|
17
|
+
children { id }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
status
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`,A=(e=[])=>{const a=new Set,t=[...e];for(;t.length;){const n=t.pop();if(n&&(typeof n.id=="string"&&a.add(n.id),Array.isArray(n.children)&&n.children.length))for(const r of n.children)t.push(r)}return a},p=e=>(e==null?void 0:e.id)==="0"||typeof(e==null?void 0:e.id)=="number"&&(e==null?void 0:e.id)===0||(e==null?void 0:e.name)==="Company Administrator",v=e=>{const a=A((e==null?void 0:e.permissions)||[]),t=p(e);return{canViewAccount:t||a.has("Magento_Company::view_account"),canEditAccount:t||a.has("Magento_Company::edit_account"),canViewAddress:t||a.has("Magento_Company::view_address"),canEditAddress:t||a.has("Magento_Company::edit_address"),canViewContacts:t||a.has("Magento_Company::contacts"),canViewPaymentInformation:t||a.has("Magento_Company::payment_information"),canViewShippingInformation:t||a.has("Magento_Company::shipping_information")}},h=async()=>await c(E,{method:"GET",cache:"no-cache"}).then(e=>{var r,d,o;if((r=e.errors)!=null&&r.length)return _(e.errors);const a=(o=(d=e==null?void 0:e.data)==null?void 0:d.customer)==null?void 0:o.role,t=A((a==null?void 0:a.permissions)||[]);return p(a)&&["Magento_Company::view_account","Magento_Company::edit_account","Magento_Company::view_address","Magento_Company::edit_address","Magento_Company::contacts","Magento_Company::payment_information","Magento_Company::shipping_information"].forEach(s=>t.add(s)),{allowedIds:t,roleResponse:e}}).catch(g),M=`
|
|
27
|
+
query validateCompanyEmail($email: String!) {
|
|
28
|
+
isCompanyEmailAvailable(email: $email) {
|
|
29
|
+
is_email_available
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`,G=async e=>{try{const a=await c(M,{variables:{email:e}});return a.errors?{isValid:!1,error:"Unable to validate email"}:{isValid:a.data.isCompanyEmailAvailable.is_email_available,error:a.data.isCompanyEmailAvailable.is_email_available?void 0:"This email is already used by another company"}}catch{return{isValid:!1,error:"Unable to validate email"}}},u=e=>{var s;if(!(e!=null&&e.data))throw new Error("Invalid response: missing data");const a="updateCompany"in e.data?(s=e.data.updateCompany)==null?void 0:s.company:e.data.company;if(!a)throw new Error("Invalid response: missing company data");const t="customer"in e.data?e.data.customer:void 0,n=a.legal_address?{street:Array.isArray(a.legal_address.street)?a.legal_address.street.filter(i=>i&&i.trim()!==""):[],city:(a.legal_address.city||"").trim(),region:a.legal_address.region?{region:(a.legal_address.region.region||"").trim(),regionCode:(a.legal_address.region.region_code||"").trim(),regionId:a.legal_address.region.region_id?Number(a.legal_address.region.region_id):0}:void 0,countryCode:(a.legal_address.country_code||"").toUpperCase().trim(),postcode:(a.legal_address.postcode||"").trim(),telephone:a.legal_address.telephone?a.legal_address.telephone.trim():void 0}:void 0,r=t==null?void 0:t.role,d=v(r),o={id:(a.id||"").toString(),name:(a.name||"").trim(),email:(a.email||"").trim().toLowerCase(),legalName:a.legal_name?a.legal_name.trim():void 0,vatTaxId:a.vat_tax_id?a.vat_tax_id.trim():void 0,resellerId:a.reseller_id?a.reseller_id.trim():void 0,legalAddress:n,companyAdmin:a.company_admin?{id:(a.company_admin.id||"").toString(),firstname:(a.company_admin.firstname||"").trim(),lastname:(a.company_admin.lastname||"").trim(),email:(a.company_admin.email||"").trim().toLowerCase(),jobTitle:a.company_admin.job_title?a.company_admin.job_title.trim():void 0}:void 0,salesRepresentative:a.sales_representative?{firstname:(a.sales_representative.firstname||"").trim(),lastname:(a.sales_representative.lastname||"").trim(),email:(a.sales_representative.email||"").trim().toLowerCase()}:void 0,availablePaymentMethods:Array.isArray(a.available_payment_methods)?a.available_payment_methods.filter(i=>i&&typeof i.code=="string"&&typeof i.title=="string").map(i=>({code:i.code.trim(),title:i.title.trim()})).filter(i=>i.code.length>0&&i.title.length>0):void 0,availableShippingMethods:Array.isArray(a.available_shipping_methods)?a.available_shipping_methods.filter(i=>i&&typeof i.code=="string"&&typeof i.title=="string").map(i=>({code:i.code.trim(),title:i.title.trim()})).filter(i=>i.code.length>0&&i.title.length>0):void 0,canEditAccount:d.canEditAccount,canEditAddress:d.canEditAddress,permissionsFlags:d,customerRole:r,customerStatus:t==null?void 0:t.status};if(d.canViewAccount){if(!o.id)throw new Error("Company ID is required");if(!o.name)throw new Error("Company name is required");if(!o.email)throw new Error("Company email is required")}return o},N=e=>{var o,s;if(!((s=(o=e==null?void 0:e.data)==null?void 0:o.countries)!=null&&s.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:a,storeConfig:t}=e.data,n=t==null?void 0:t.countries_with_required_region.split(","),r=t==null?void 0:t.optional_zip_countries.split(",");return{availableCountries:a.filter(({two_letter_abbreviation:i,full_name_locale:m})=>!!(i&&m)).map(i=>{const{two_letter_abbreviation:m,full_name_locale:l,available_regions:y}=i,f=Array.isArray(y)&&y.length>0;return{value:m,text:l,availableRegions:f?y:void 0}}).sort((i,m)=>i.text.localeCompare(m.text)),countriesWithRequiredRegion:n,optionalZipCountries:r}},b=`
|
|
33
|
+
fragment COMPANY_LEGAL_ADDRESS_FRAGMENT on CompanyLegalAddress {
|
|
34
|
+
street
|
|
35
|
+
city
|
|
36
|
+
region {
|
|
37
|
+
region
|
|
38
|
+
region_code
|
|
39
|
+
region_id
|
|
40
|
+
}
|
|
41
|
+
country_code
|
|
42
|
+
postcode
|
|
43
|
+
telephone
|
|
44
|
+
}
|
|
45
|
+
`,I=`
|
|
46
|
+
fragment COMPANY_BASIC_INFO_FRAGMENT on Company {
|
|
47
|
+
id
|
|
48
|
+
name
|
|
49
|
+
email
|
|
50
|
+
legal_name
|
|
51
|
+
vat_tax_id
|
|
52
|
+
reseller_id
|
|
53
|
+
}
|
|
54
|
+
`,S=`
|
|
55
|
+
fragment COMPANY_SALES_REPRESENTATIVE_FRAGMENT on CompanySalesRepresentative {
|
|
56
|
+
firstname
|
|
57
|
+
lastname
|
|
58
|
+
email
|
|
59
|
+
}
|
|
60
|
+
`,w=`
|
|
61
|
+
fragment COMPANY_ADMIN_FRAGMENT on Customer {
|
|
62
|
+
firstname
|
|
63
|
+
lastname
|
|
64
|
+
email
|
|
65
|
+
job_title
|
|
66
|
+
}
|
|
67
|
+
`,C=e=>{const a=e.has("Magento_Company::view_account"),t=e.has("Magento_Company::view_address"),n=e.has("Magento_Company::contacts"),r=e.has("Magento_Company::payment_information"),d=e.has("Magento_Company::shipping_information"),o=[],s=[];return a&&(o.push("...COMPANY_BASIC_INFO_FRAGMENT"),s.push(I)),t&&(o.push("legal_address { ...COMPANY_LEGAL_ADDRESS_FRAGMENT }"),s.push(b)),n&&(o.push("company_admin { ...COMPANY_ADMIN_FRAGMENT }"),o.push("sales_representative { ...COMPANY_SALES_REPRESENTATIVE_FRAGMENT }"),s.push(w),s.push(S)),r&&o.push("available_payment_methods { code title }"),d&&o.push("available_shipping_methods { code title }"),{fields:o,usedFragments:s}},T=e=>{const{fields:a,usedFragments:t}=C(e);return a.length===0?`
|
|
68
|
+
query GET_COMPANY_DYNAMIC {
|
|
69
|
+
company { __typename }
|
|
70
|
+
}
|
|
71
|
+
`:`${`
|
|
72
|
+
query GET_COMPANY_DYNAMIC {
|
|
73
|
+
company {
|
|
74
|
+
${a.join(`
|
|
75
|
+
`)}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`}
|
|
79
|
+
${t.join(`
|
|
80
|
+
`)}`},O=e=>{const{fields:a,usedFragments:t}=C(e);return a.length===0?`
|
|
81
|
+
mutation UPDATE_COMPANY_DYNAMIC($input: CompanyUpdateInput!) {
|
|
82
|
+
updateCompany(input: $input) {
|
|
83
|
+
company { __typename }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`:`${`
|
|
87
|
+
mutation UPDATE_COMPANY_DYNAMIC($input: CompanyUpdateInput!) {
|
|
88
|
+
updateCompany(input: $input) {
|
|
89
|
+
company {
|
|
90
|
+
${a.join(`
|
|
91
|
+
`)}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`}
|
|
96
|
+
${t.join(`
|
|
97
|
+
`)}`},F=async()=>await h().then(async({allowedIds:e,roleResponse:a})=>{var o,s,i;const t=T(e),n=await c(t,{method:"GET",cache:"no-cache"});if((o=n.errors)!=null&&o.length)return _(n.errors);const r=(s=n==null?void 0:n.data)==null?void 0:s.company;return r&&Object.keys(r).some(m=>m!=="__typename")?(n.data.customer=(i=a==null?void 0:a.data)==null?void 0:i.customer,u(n)):null}).catch(g),R=async e=>await h().then(async({allowedIds:a,roleResponse:t})=>{var o,s;const n=O(a),r={};if(e.name!==void 0&&(r.company_name=e.name),e.email!==void 0&&(r.company_email=e.email),e.legalName!==void 0&&(r.legal_name=e.legalName),e.vatTaxId!==void 0&&(r.vat_tax_id=e.vatTaxId),e.resellerId!==void 0&&(r.reseller_id=e.resellerId),e.legalAddress!==void 0&&a.has("Magento_Company::edit_address")){let i;Array.isArray(e.legalAddress.street)?(i=[...e.legalAddress.street],e.legalAddress.street2&&i.push(e.legalAddress.street2)):i=[e.legalAddress.street,e.legalAddress.street2].filter(l=>typeof l=="string"&&l.trim().length>0),i=i.filter(l=>l&&typeof l=="string"&&l.trim().length>0);let m;if(e.legalAddress.region&&typeof e.legalAddress.region=="object"){const l=e.legalAddress.region;l.region===l.regionCode?m={region:l.region,region_code:l.regionCode,region_id:0}:m={region:l.region,region_code:l.regionCode}}else e.legalAddress.regionCode&&e.legalAddress.region!==e.legalAddress.regionCode?m={region:e.legalAddress.region||e.legalAddress.regionCode,region_code:e.legalAddress.regionCode}:e.legalAddress.region&&(m={region:e.legalAddress.region,region_code:e.legalAddress.region,region_id:0});r.legal_address={street:i,city:e.legalAddress.city,region:m,country_id:e.legalAddress.countryCode,postcode:e.legalAddress.postcode,telephone:e.legalAddress.telephone}}const d=await c(n,{method:"POST",variables:{input:r}});return(o=d.errors)!=null&&o.length?_(d.errors):(d.data.customer=(s=t==null?void 0:t.data)==null?void 0:s.customer,u(d))}).catch(g),P=`
|
|
98
|
+
query getCountries {
|
|
99
|
+
countries {
|
|
100
|
+
id
|
|
101
|
+
two_letter_abbreviation
|
|
102
|
+
three_letter_abbreviation
|
|
103
|
+
full_name_locale
|
|
104
|
+
full_name_english
|
|
105
|
+
available_regions {
|
|
106
|
+
id
|
|
107
|
+
code
|
|
108
|
+
name
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
storeConfig {
|
|
112
|
+
countries_with_required_region
|
|
113
|
+
optional_zip_countries
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`,D=async()=>{const e="_company_countries",a=sessionStorage.getItem(e);return a?JSON.parse(a):await c(P,{method:"GET"}).then(t=>{var r;if((r=t.errors)!=null&&r.length)return _(t.errors);const n=N(t);return sessionStorage.setItem(e,JSON.stringify(n)),n}).catch(g)};export{F as a,h as f,D as g,R as u,G as v};
|
|
117
|
+
//# sourceMappingURL=getCountries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCountries.js","sources":["/@dropins/storefront-company-management/src/api/fetchUserPermissions/graphql/getCustomerRole.graphql.ts","/@dropins/storefront-company-management/src/lib/company-permissions.ts","/@dropins/storefront-company-management/src/api/fetchUserPermissions/fetchUserPermissions.ts","/@dropins/storefront-company-management/src/api/validateCompanyEmail/graphql/validateCompanyEmail.graphql.ts","/@dropins/storefront-company-management/src/api/validateCompanyEmail/validateCompanyEmail.ts","/@dropins/storefront-company-management/src/data/transforms/transform-company.ts","/@dropins/storefront-company-management/src/data/transforms/transform-countries.ts","/@dropins/storefront-company-management/src/api/graphql/CompanyFragment.graphql.ts","/@dropins/storefront-company-management/src/api/graphql/buildCompanyQueries.ts","/@dropins/storefront-company-management/src/api/getCompany/getCompany.ts","/@dropins/storefront-company-management/src/api/updateCompany/updateCompany.ts","/@dropins/storefront-company-management/src/api/getCountries/graphql/getCountries.graphql.ts","/@dropins/storefront-company-management/src/api/getCountries/getCountries.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 GET_CUSTOMER_ROLE_PERMISSIONS = /* GraphQL */ `\n query GET_CUSTOMER_ROLE_PERMISSIONS {\n customer {\n role {\n id\n name\n permissions {\n id\n children {\n id\n children {\n id\n children {\n id\n children { id }\n }\n }\n }\n }\n }\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 *******************************************************************/\n\n/**\n * Permission flags interface for company operations\n */\nexport interface CompanyPermissionFlags {\n canViewAccount: boolean;\n canEditAccount: boolean;\n canViewAddress: boolean;\n canEditAddress: boolean;\n canViewContacts: boolean;\n canViewPaymentInformation: boolean;\n canViewShippingInformation: boolean;\n}\n\n/**\n * Flattens a nested permissions tree into a Set of permission IDs\n * This is a pure utility function that can be used across the application\n */\nexport const flattenIds = (nodes: any[] = []): Set<string> => {\n const set = new Set<string>();\n const stack = [...nodes];\n while (stack.length) {\n const node = stack.pop();\n if (!node) continue;\n if (typeof node.id === 'string') set.add(node.id);\n if (Array.isArray(node.children) && node.children.length) {\n for (const child of node.children) stack.push(child);\n }\n }\n return set;\n};\n\n/**\n * Determines if a role is a Company Administrator\n */\nexport const isCompanyAdministrator = (role: any): boolean => {\n return role?.id === '0' || \n (typeof role?.id === 'number' && role?.id === 0) || \n role?.name === 'Company Administrator';\n};\n\n/**\n * Builds permission flags from role data\n */\nexport const buildPermissionFlags = (role: any): CompanyPermissionFlags => {\n const allowedIds = flattenIds(role?.permissions || []);\n const isAdmin = isCompanyAdministrator(role);\n\n return {\n canViewAccount: isAdmin || allowedIds.has('Magento_Company::view_account'),\n canEditAccount: isAdmin || allowedIds.has('Magento_Company::edit_account'),\n canViewAddress: isAdmin || allowedIds.has('Magento_Company::view_address'),\n canEditAddress: isAdmin || allowedIds.has('Magento_Company::edit_address'),\n canViewContacts: isAdmin || allowedIds.has('Magento_Company::contacts'),\n canViewPaymentInformation: isAdmin || allowedIds.has('Magento_Company::payment_information'),\n canViewShippingInformation: isAdmin || allowedIds.has('Magento_Company::shipping_information'),\n };\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 { handleNetworkError } from '../../lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { GET_CUSTOMER_ROLE_PERMISSIONS } from './graphql/getCustomerRole.graphql';\nimport { flattenIds, isCompanyAdministrator } from '../../lib/company-permissions';\n\n/**\n * Fetches user permissions and returns both the allowed permission IDs and the role response\n * This is a general-purpose API function that can be used across the application\n */\nexport const fetchUserPermissions = async (): Promise<{ allowedIds: Set<string>; roleResponse: any }> => {\n return await fetchGraphQl(GET_CUSTOMER_ROLE_PERMISSIONS, { \n method: 'GET', \n cache: 'no-cache' \n })\n .then((roleResponse: any) => {\n if (roleResponse.errors?.length) {\n return handleFetchError(roleResponse.errors);\n }\n\n const role = roleResponse?.data?.customer?.role;\n const allowedIds = flattenIds(role?.permissions || []);\n \n // Treat Company Administrator as having all permissions even if the permissions tree is empty\n const isAdmin = isCompanyAdministrator(role);\n if (isAdmin) {\n [\n 'Magento_Company::view_account',\n 'Magento_Company::edit_account',\n 'Magento_Company::view_address',\n 'Magento_Company::edit_address',\n 'Magento_Company::contacts',\n 'Magento_Company::payment_information',\n 'Magento_Company::shipping_information',\n ].forEach((id) => allowedIds.add(id));\n }\n\n return { allowedIds, roleResponse };\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 VALIDATE_COMPANY_EMAIL_QUERY = /* GraphQL */ `\n query validateCompanyEmail($email: String!) {\n isCompanyEmailAvailable(email: $email) {\n 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 '../fetch-graphql';\nimport { VALIDATE_COMPANY_EMAIL_QUERY } from './graphql/validateCompanyEmail.graphql';\nimport { ValidateCompanyEmailQuery, ValidateCompanyEmailResponse } from '../../types/api/validateCompanyEmail.types';\n\nexport const validateCompanyEmail = async (email: string): Promise<ValidateCompanyEmailResponse> => {\n try {\n const response = await fetchGraphQl<ValidateCompanyEmailQuery>(VALIDATE_COMPANY_EMAIL_QUERY, {\n variables: { email },\n });\n\n if (response.errors) {\n return {\n isValid: false,\n error: 'Unable to validate email'\n };\n }\n\n return {\n isValid: response.data.isCompanyEmailAvailable.is_email_available,\n error: response.data.isCompanyEmailAvailable.is_email_available \n ? undefined \n : 'This email is already used by another company'\n };\n } catch (error) {\n return {\n isValid: false,\n error: 'Unable to validate email'\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 { getCompanyResponse } from '../../types/api/getCompany.types';\nimport { updateCompanyResponse } from '../../types/api/updateCompany.types';\nimport { CompanyModel } from '../models/company';\nimport { buildPermissionFlags } from '../../lib/company-permissions';\n\nexport const transformCompany = (\n response: getCompanyResponse | updateCompanyResponse\n): CompanyModel => {\n // Validate response structure\n if (!response?.data) {\n throw new Error('Invalid response: missing data');\n }\n\n // Handle both getCompany and updateCompany response structures\n const companyData: any = 'updateCompany' in response.data \n ? response.data.updateCompany?.company \n : response.data.company;\n \n if (!companyData) {\n throw new Error('Invalid response: missing company data');\n }\n \n const customerData = 'customer' in response.data ? response.data.customer : undefined;\n\n // Transform legal address with validation\n const legalAddress = companyData.legal_address ? {\n street: Array.isArray(companyData.legal_address.street) \n ? companyData.legal_address.street.filter((line: string) => line && line.trim() !== '') \n : [],\n city: (companyData.legal_address.city || '').trim(),\n region: companyData.legal_address.region ? {\n region: (companyData.legal_address.region.region || '').trim(),\n regionCode: (companyData.legal_address.region.region_code || '').trim(),\n regionId: companyData.legal_address.region.region_id ? Number(companyData.legal_address.region.region_id) : 0,\n } : undefined,\n countryCode: (companyData.legal_address.country_code || '').toUpperCase().trim(),\n postcode: (companyData.legal_address.postcode || '').trim(),\n telephone: companyData.legal_address.telephone ? \n companyData.legal_address.telephone.trim() : undefined,\n } : undefined;\n\n // Determine permissions using shared utility\n const customerRole = customerData?.role;\n const permissionsFlags = buildPermissionFlags(customerRole);\n\n // Build the model with proper validation\n const model: CompanyModel = {\n id: (companyData.id || '').toString(),\n name: (companyData.name || '').trim(),\n email: (companyData.email || '').trim().toLowerCase(),\n legalName: companyData.legal_name ? companyData.legal_name.trim() : undefined,\n vatTaxId: companyData.vat_tax_id ? companyData.vat_tax_id.trim() : undefined,\n resellerId: companyData.reseller_id ? companyData.reseller_id.trim() : undefined,\n legalAddress,\n companyAdmin: companyData.company_admin ? {\n id: (companyData.company_admin.id || '').toString(),\n firstname: (companyData.company_admin.firstname || '').trim(),\n lastname: (companyData.company_admin.lastname || '').trim(),\n email: (companyData.company_admin.email || '').trim().toLowerCase(),\n jobTitle: companyData.company_admin.job_title ? companyData.company_admin.job_title.trim() : undefined,\n } : undefined,\n\n // Transform sales representative\n salesRepresentative: companyData.sales_representative ? {\n firstname: (companyData.sales_representative.firstname || '').trim(),\n lastname: (companyData.sales_representative.lastname || '').trim(),\n email: (companyData.sales_representative.email || '').trim().toLowerCase(),\n } : undefined,\n\n // New comprehensive payment methods with code and title\n availablePaymentMethods: Array.isArray(companyData.available_payment_methods)\n ? companyData.available_payment_methods\n .filter((m: any) => m && typeof m.code === 'string' && typeof m.title === 'string')\n .map((m: any) => ({ code: m.code.trim(), title: m.title.trim() }))\n .filter((m: any) => m.code.length > 0 && m.title.length > 0)\n : undefined,\n\n // New available shipping methods\n availableShippingMethods: Array.isArray(companyData.available_shipping_methods)\n ? companyData.available_shipping_methods\n .filter((m: any) => m && typeof m.code === 'string' && typeof m.title === 'string')\n .map((m: any) => ({ code: m.code.trim(), title: m.title.trim() }))\n .filter((m: any) => m.code.length > 0 && m.title.length > 0)\n : undefined,\n \n // Computed permission flags (single source of truth)\n canEditAccount: permissionsFlags.canEditAccount,\n canEditAddress: permissionsFlags.canEditAddress,\n permissionsFlags,\n customerRole,\n customerStatus: customerData?.status,\n };\n\n // Validate only when profile fields are permitted\n if (permissionsFlags.canViewAccount) {\n if (!model.id) {\n throw new Error('Company ID is required');\n }\n if (!model.name) {\n throw new Error('Company name is required');\n }\n if (!model.email) {\n throw new Error('Company email is required');\n }\n }\n\n return model;\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 { CountriesFormResponse } from '../../types/api/getCountries.types';\nimport { Country } from '../models/country';\n\nexport const transformCountries = (\n response: CountriesFormResponse\n): {\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n} => {\n if (!response?.data?.countries?.length) {\n return {\n availableCountries: [],\n countriesWithRequiredRegion: [],\n optionalZipCountries: [],\n };\n }\n\n const { countries, storeConfig } = response.data;\n\n const countriesWithRequiredRegion =\n storeConfig?.countries_with_required_region.split(',');\n const optionalZipCountries = storeConfig?.optional_zip_countries.split(',');\n\n const availableCountries = countries\n .filter(({ two_letter_abbreviation, full_name_locale }) =>\n Boolean(two_letter_abbreviation && full_name_locale)\n )\n .map((country) => {\n const { two_letter_abbreviation, full_name_locale, available_regions } = country;\n\n const hasRegions = Array.isArray(available_regions) && available_regions.length > 0;\n return {\n value: two_letter_abbreviation,\n text: full_name_locale,\n availableRegions: hasRegions ? available_regions : undefined,\n };\n })\n .sort((a, b) => a.text.localeCompare(b.text));\n\n return {\n availableCountries,\n countriesWithRequiredRegion,\n optionalZipCountries,\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 COMPANY_LEGAL_ADDRESS_FRAGMENT = /* GraphQL */ `\n fragment COMPANY_LEGAL_ADDRESS_FRAGMENT on CompanyLegalAddress {\n street\n city\n region {\n region\n region_code\n region_id\n }\n country_code\n postcode\n telephone\n }\n`;\n\nexport const COMPANY_BASIC_INFO_FRAGMENT = /* GraphQL */ `\n fragment COMPANY_BASIC_INFO_FRAGMENT on Company {\n id\n name\n email\n legal_name\n vat_tax_id\n reseller_id\n }\n`;\n\nexport const COMPANY_SALES_REPRESENTATIVE_FRAGMENT = /* GraphQL */ `\n fragment COMPANY_SALES_REPRESENTATIVE_FRAGMENT on CompanySalesRepresentative {\n firstname\n lastname\n email\n }\n`;\n\nexport const COMPANY_ADMIN_FRAGMENT = /* GraphQL */ `\n fragment COMPANY_ADMIN_FRAGMENT on Customer {\n firstname\n lastname\n email\n job_title\n }\n`;\n\nexport const COMPANY_FULL_FRAGMENT = /* GraphQL */ `\n fragment COMPANY_FULL_FRAGMENT on Company {\n ...COMPANY_BASIC_INFO_FRAGMENT\n legal_address {\n ...COMPANY_LEGAL_ADDRESS_FRAGMENT\n }\n company_admin {\n ...COMPANY_ADMIN_FRAGMENT\n }\n sales_representative {\n ...COMPANY_SALES_REPRESENTATIVE_FRAGMENT\n }\n available_payment_methods {\n code\n title\n }\n available_shipping_methods {\n code\n title\n }\n }\n ${COMPANY_BASIC_INFO_FRAGMENT}\n ${COMPANY_LEGAL_ADDRESS_FRAGMENT}\n ${COMPANY_ADMIN_FRAGMENT}\n ${COMPANY_SALES_REPRESENTATIVE_FRAGMENT}\n`;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport {\n COMPANY_BASIC_INFO_FRAGMENT,\n COMPANY_LEGAL_ADDRESS_FRAGMENT,\n COMPANY_ADMIN_FRAGMENT,\n COMPANY_SALES_REPRESENTATIVE_FRAGMENT,\n} from './CompanyFragment.graphql';\n\n/**\n * Builds company fields based on user permissions\n */\nconst buildCompanyFields = (allowed: Set<string>): { fields: string[]; usedFragments: string[] } => {\n const wantProfile = allowed.has('Magento_Company::view_account');\n const wantAddress = allowed.has('Magento_Company::view_address');\n const wantContacts = allowed.has('Magento_Company::contacts');\n const wantPayment = allowed.has('Magento_Company::payment_information');\n const wantShipping = allowed.has('Magento_Company::shipping_information');\n\n const fields: string[] = [];\n const usedFragments: string[] = [];\n\n if (wantProfile) {\n fields.push('...COMPANY_BASIC_INFO_FRAGMENT');\n usedFragments.push(COMPANY_BASIC_INFO_FRAGMENT);\n }\n if (wantAddress) {\n fields.push(`legal_address { ...COMPANY_LEGAL_ADDRESS_FRAGMENT }`);\n usedFragments.push(COMPANY_LEGAL_ADDRESS_FRAGMENT);\n }\n if (wantContacts) {\n fields.push(`company_admin { ...COMPANY_ADMIN_FRAGMENT }`);\n fields.push(`sales_representative { ...COMPANY_SALES_REPRESENTATIVE_FRAGMENT }`);\n usedFragments.push(COMPANY_ADMIN_FRAGMENT);\n usedFragments.push(COMPANY_SALES_REPRESENTATIVE_FRAGMENT);\n }\n if (wantPayment) {\n fields.push(`available_payment_methods { code title }`);\n }\n if (wantShipping) {\n fields.push(`available_shipping_methods { code title }`);\n }\n\n return { fields, usedFragments };\n};\n\n/**\n * Builds a dynamic company query based on user permissions\n */\nexport const buildCompanyQuery = (allowed: Set<string>): string => {\n const { fields, usedFragments } = buildCompanyFields(allowed);\n\n // If no allowed company fields, still query company with __typename to keep response shape\n if (fields.length === 0) {\n return `\n query GET_COMPANY_DYNAMIC {\n company { __typename }\n }\n `;\n }\n\n const query = `\n query GET_COMPANY_DYNAMIC {\n company {\n ${fields.join('\\n ')}\n }\n }\n `;\n\n return `${query}\\n${usedFragments.join('\\n')}`;\n};\n\n/**\n * Builds a dynamic company update mutation based on user permissions\n */\nexport const buildUpdateCompanyMutation = (allowed: Set<string>): string => {\n const { fields, usedFragments } = buildCompanyFields(allowed);\n\n // If no allowed company fields, still query company with __typename to keep response shape\n if (fields.length === 0) {\n return `\n mutation UPDATE_COMPANY_DYNAMIC($input: CompanyUpdateInput!) {\n updateCompany(input: $input) {\n company { __typename }\n }\n }\n `;\n }\n\n const mutation = `\n mutation UPDATE_COMPANY_DYNAMIC($input: CompanyUpdateInput!) {\n updateCompany(input: $input) {\n company {\n ${fields.join('\\n ')}\n }\n }\n }\n `;\n\n return `${mutation}\\n${usedFragments.join('\\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 { handleNetworkError } from '../../lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { transformCompany } from '../../data/transforms';\nimport { CompanyModel } from '../../data/models/company';\nimport { getCompanyResponse } from '../../types/api/getCompany.types';\nimport { fetchUserPermissions } from '../fetchUserPermissions';\nimport { buildCompanyQuery } from '../graphql/buildCompanyQueries';\nimport { handleFetchError } from '../../lib/fetch-error';\n\nexport const getCompany = async (): Promise<CompanyModel | null> => {\n return await fetchUserPermissions()\n .then(async ({ allowedIds, roleResponse }) => {\n // Build a company query that requests only allowed fields\n const GET_COMPANY_DYNAMIC = buildCompanyQuery(allowedIds);\n\n // Fetch company with dynamic selection\n const companyResponse: getCompanyResponse = await fetchGraphQl(GET_COMPANY_DYNAMIC, { method: 'GET', cache: 'no-cache' });\n if (companyResponse.errors?.length) return handleFetchError(companyResponse.errors);\n\n const companyNode: any = companyResponse?.data?.company;\n const hasAnyCompanyField = companyNode && Object.keys(companyNode).some((k) => k !== '__typename');\n if (!hasAnyCompanyField) {\n return null;\n }\n\n // Merge back minimal customer role info so transform can compute flags\n (companyResponse as any).data.customer = roleResponse?.data?.customer;\n\n return transformCompany(companyResponse);\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 { handleNetworkError } from '../../lib/network-error';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { transformCompany } from '../../data/transforms';\nimport { CompanyModel } from '../../data/models/company';\nimport { updateCompanyResponse, UpdateCompanyDto } from '../../types';\nimport { fetchUserPermissions } from '../fetchUserPermissions';\nimport { buildUpdateCompanyMutation } from '../graphql/buildCompanyQueries';\n\n\nexport const updateCompany = async (input: UpdateCompanyDto): Promise<CompanyModel> => {\n return await fetchUserPermissions()\n .then(async ({ allowedIds, roleResponse }) => {\n // Build a dynamic mutation that requests only allowed fields in response\n const UPDATE_COMPANY_DYNAMIC = buildUpdateCompanyMutation(allowedIds);\n\n // Transform input (keep original logic for what to send)\n const transformedInput: Record<string, unknown> = {};\n \n // Map frontend field names to GraphQL schema field names\n if (input.name !== undefined) {\n transformedInput.company_name = input.name;\n }\n if (input.email !== undefined) {\n transformedInput.company_email = input.email;\n }\n if (input.legalName !== undefined) {\n transformedInput.legal_name = input.legalName;\n }\n if (input.vatTaxId !== undefined) {\n transformedInput.vat_tax_id = input.vatTaxId;\n }\n if (input.resellerId !== undefined) {\n transformedInput.reseller_id = input.resellerId;\n }\n \n // Transform legal address (only if user has edit_address permission)\n if (input.legalAddress !== undefined && allowedIds.has('Magento_Company::edit_address')) {\n // Handle street field - ensure it's always a flat array of strings\n let streetArray: string[];\n if (Array.isArray(input.legalAddress.street)) {\n // If street is already an array, use it directly and add street_2 if present\n streetArray = [...input.legalAddress.street];\n if (input.legalAddress.street2) {\n streetArray.push(input.legalAddress.street2);\n }\n } else {\n // If street is a string, create array normally with type guard\n streetArray = [input.legalAddress.street, input.legalAddress.street2].filter(\n (s): s is string => typeof s === 'string' && s.trim().length > 0\n );\n }\n \n // Remove any empty strings and ensure all elements are strings\n streetArray = streetArray.filter(street => street && typeof street === 'string' && street.trim().length > 0);\n \n // Handle region - different approaches for dropdown vs custom regions\n let regionValue: { region: string; region_code: string; region_id?: number } | undefined;\n if (input.legalAddress.region && typeof input.legalAddress.region === 'object') {\n const regionObj = input.legalAddress.region;\n \n // Check if this is a custom region (region === regionCode) or predefined region\n if (regionObj.region === regionObj.regionCode) {\n // Custom region - send as object with region_id: 0\n regionValue = {\n region: regionObj.region,\n region_code: regionObj.regionCode,\n region_id: 0\n };\n } else {\n // Predefined region - send as object\n regionValue = {\n region: regionObj.region,\n region_code: regionObj.regionCode,\n };\n }\n } else if (input.legalAddress.regionCode && input.legalAddress.region !== input.legalAddress.regionCode) {\n // If we have different region and regionCode (dropdown case)\n regionValue = {\n region: input.legalAddress.region || input.legalAddress.regionCode,\n region_code: input.legalAddress.regionCode,\n };\n } else if (input.legalAddress.region) {\n // If we only have region string (fallback case)\n regionValue = {\n region: input.legalAddress.region,\n region_code: input.legalAddress.region,\n region_id: 0\n };\n }\n \n transformedInput.legal_address = {\n street: streetArray,\n city: input.legalAddress.city,\n region: regionValue,\n country_id: input.legalAddress.countryCode, // GraphQL expects country_id, not countryCode\n postcode: input.legalAddress.postcode,\n telephone: input.legalAddress.telephone,\n };\n }\n\n // Execute the dynamic mutation\n const response: updateCompanyResponse = await fetchGraphQl(UPDATE_COMPANY_DYNAMIC, {\n method: 'POST',\n variables: { input: transformedInput },\n });\n\n if (response.errors?.length) return handleFetchError(response.errors);\n\n // Merge back minimal customer role info so transform can compute flags\n (response as any).data.customer = roleResponse?.data?.customer;\n\n return transformCompany(response);\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 GET_COUNTRIES_QUERY = `\n query getCountries {\n countries {\n id\n two_letter_abbreviation\n three_letter_abbreviation\n full_name_locale\n full_name_english\n available_regions {\n id\n code\n name\n }\n }\n storeConfig {\n countries_with_required_region\n optional_zip_countries\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 { GET_COUNTRIES_QUERY } from './graphql/getCountries.graphql';\nimport { fetchGraphQl } from '../fetch-graphql';\nimport { handleNetworkError } from '../../lib/network-error';\nimport { handleFetchError } from '../../lib/fetch-error';\nimport { transformCountries } from '../../data/transforms/transform-countries';\nimport { CountriesFormResponse } from '../../types/api/getCountries.types';\nimport { Country } from '../../data/models/country';\n\nexport const getCountries = async (): Promise<{\n availableCountries: Country[] | [];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n}> => {\n const sessionStorageKey = '_company_countries';\n\n const sessionStorageCache = sessionStorage.getItem(sessionStorageKey);\n\n if (sessionStorageCache) {\n return JSON.parse(sessionStorageCache);\n }\n\n return await fetchGraphQl(GET_COUNTRIES_QUERY, {\n method: 'GET',\n })\n .then((response: CountriesFormResponse) => {\n if (response.errors?.length) return handleFetchError(response.errors);\n\n const transformedData = transformCountries(response);\n\n sessionStorage.setItem(\n sessionStorageKey,\n JSON.stringify(transformedData)\n );\n\n return transformedData;\n })\n .catch(handleNetworkError);\n};\n"],"names":["GET_CUSTOMER_ROLE_PERMISSIONS","flattenIds","nodes","set","stack","node","child","isCompanyAdministrator","role","buildPermissionFlags","allowedIds","isAdmin","fetchUserPermissions","fetchGraphQl","roleResponse","_a","handleFetchError","_c","_b","id","handleNetworkError","VALIDATE_COMPANY_EMAIL_QUERY","validateCompanyEmail","email","response","transformCompany","companyData","customerData","legalAddress","line","customerRole","permissionsFlags","model","m","transformCountries","countries","storeConfig","countriesWithRequiredRegion","optionalZipCountries","two_letter_abbreviation","full_name_locale","country","available_regions","hasRegions","a","b","COMPANY_LEGAL_ADDRESS_FRAGMENT","COMPANY_BASIC_INFO_FRAGMENT","COMPANY_SALES_REPRESENTATIVE_FRAGMENT","COMPANY_ADMIN_FRAGMENT","buildCompanyFields","allowed","wantProfile","wantAddress","wantContacts","wantPayment","wantShipping","fields","usedFragments","buildCompanyQuery","buildUpdateCompanyMutation","getCompany","GET_COMPANY_DYNAMIC","companyResponse","companyNode","k","updateCompany","input","UPDATE_COMPANY_DYNAMIC","transformedInput","streetArray","s","street","regionValue","regionObj","GET_COUNTRIES_QUERY","getCountries","sessionStorageKey","sessionStorageCache","transformedData"],"mappings":"mDAgBa,MAAAA,EAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECkB9CC,EAAa,CAACC,EAAe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AC3B,YAAaA,EAAM,aAAa,OAChC,UAAW,CACb,GAGFE,EAAiB,cAAgB,CAC/B,OAAQC,EACR,KAAMH,EAAM,aAAa,KACzB,OAAQM,EACR,WAAYN,EAAM,aAAa,YAC/B,SAAUA,EAAM,aAAa,SAC7B,UAAWA,EAAM,aAAa,SAChC,CAAA,CAII,MAAA3C,EAAkC,MAAMX,EAAauD,EAAwB,CACjF,OAAQ,OACR,UAAW,CAAE,MAAOC,CAAiB,CAAA,CACtC,EAED,OAAItD,EAAAS,EAAS,SAAT,MAAAT,EAAiB,OAAeC,EAAiBQ,EAAS,MAAM,GAGnEA,EAAiB,KAAK,UAAWN,EAAAJ,GAAA,YAAAA,EAAc,OAAd,YAAAI,EAAoB,SAE/CO,EAAiBD,CAAQ,EAAA,CACjC,EACA,MAAMJ,CAAkB,EClHhBuD,EAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECQtBC,EAAe,SAItB,CACJ,MAAMC,EAAoB,qBAEpBC,EAAsB,eAAe,QAAQD,CAAiB,EAEpE,OAAIC,EACK,KAAK,MAAMA,CAAmB,EAGhC,MAAMjE,EAAa8D,EAAqB,CAC7C,OAAQ,KAAA,CACT,EACE,KAAMnD,GAAoC,OACzC,IAAIT,EAAAS,EAAS,SAAT,MAAAT,EAAiB,OAAe,OAAAC,EAAiBQ,EAAS,MAAM,EAE9D,MAAAuD,EAAkB7C,EAAmBV,CAAQ,EAEpC,sBAAA,QACbqD,EACA,KAAK,UAAUE,CAAe,CAChC,EAEOA,CAAA,CACR,EACA,MAAM3D,CAAkB,CAC7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
export declare const CompanyCardLoader: ({ testId, withCard, }: {
|
|
3
|
+
testId?: string | undefined;
|
|
4
|
+
withCard?: boolean | undefined;
|
|
5
|
+
}) => import("preact").JSX.Element;
|
|
6
|
+
export declare const CompanyUsersTableLoader: ({ testId }: {
|
|
7
|
+
testId?: string | undefined;
|
|
8
|
+
}) => import("preact").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=CompanyLoaders.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './CompanyLoaders';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './CompanyProfileCard';
|
|
18
|
+
export { CompanyProfileCard as default } from './CompanyProfileCard';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
import { CompanyUserStatus } from '../../types';
|
|
4
|
+
|
|
5
|
+
export interface CompanyUsersManagementModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onClose'> {
|
|
6
|
+
/** The ID of the user to manage */
|
|
7
|
+
userId: string;
|
|
8
|
+
/** The current status of the user */
|
|
9
|
+
userStatus: CompanyUserStatus;
|
|
10
|
+
/** Callback function called when the modal should be closed */
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
/** Whether the modal is currently open */
|
|
13
|
+
isOpen?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const CompanyUsersManagementModal: FunctionComponent<CompanyUsersManagementModalProps>;
|
|
16
|
+
//# sourceMappingURL=CompanyUsersManagementModal.d.ts.map
|