@dropins/storefront-company-management 1.0.0-beta2 → 1.0.0-beta21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/allowCompanyRegistration/allowCompanyRegistration.d.ts +18 -0
- package/api/allowCompanyRegistration/graphql/allowCompanyRegistration.graphql.d.ts +18 -0
- package/api/allowCompanyRegistration/index.d.ts +18 -0
- package/api/checkCompanyCreditEnabled/checkCompanyCreditEnabled.d.ts +4 -0
- package/api/checkCompanyCreditEnabled/graphql/checkCompanyCreditEnabled.graphql.d.ts +18 -0
- package/api/checkCompanyCreditEnabled/index.d.ts +18 -0
- package/api/companyEnabled/companyEnabled.d.ts +18 -0
- package/api/companyEnabled/graphql/companyEnabled.graphql.d.ts +18 -0
- package/api/{checkIsCompanyEnabled → companyEnabled}/index.d.ts +1 -1
- package/api/companyRoles/createCompanyRole.d.ts +7 -0
- package/api/companyRoles/deleteCompanyRole.d.ts +7 -0
- package/api/companyRoles/getCompanyAclResources.d.ts +7 -0
- package/api/companyRoles/getCompanyRole.d.ts +8 -0
- package/api/companyRoles/getCompanyRoles.d.ts +8 -0
- package/api/companyRoles/graphql/fragments.d.ts +18 -0
- package/api/companyRoles/graphql/index.d.ts +20 -0
- package/api/companyRoles/graphql/mutations.d.ts +20 -0
- package/api/companyRoles/graphql/queries.d.ts +21 -0
- package/api/companyRoles/index.d.ts +27 -0
- package/api/companyRoles/isCompanyRoleNameAvailable.d.ts +7 -0
- package/api/companyRoles/updateCompanyRole.d.ts +7 -0
- package/api/companyRoles/utils.d.ts +11 -0
- package/api/createCompany/createCompany.d.ts +39 -0
- package/api/createCompany/graphql/createCompany.graphql.d.ts +18 -0
- package/api/createCompany/index.d.ts +18 -0
- package/api/createCompanyTeam/createCompanyTeam.d.ts +11 -0
- package/api/createCompanyTeam/graphql/createCompanyTeam.graphql.d.ts +18 -0
- package/api/createCompanyTeam/index.d.ts +18 -0
- package/api/createCompanyUser/createCompanyUser.d.ts +9 -0
- package/api/createCompanyUser/graphql/createCompanyUser.graphql.d.ts +18 -0
- package/api/createCompanyUser/index.d.ts +18 -0
- package/api/deleteCompanyTeam/deleteCompanyTeam.d.ts +9 -0
- package/api/deleteCompanyTeam/graphql/deleteCompanyTeam.graphql.d.ts +18 -0
- package/api/deleteCompanyTeam/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/index.d.ts +18 -0
- package/api/fetchUserPermissions/fetchUserPermissions.d.ts +11 -0
- package/api/{getCompany → fetchUserPermissions}/graphql/getCustomerRole.graphql.d.ts +1 -1
- package/api/fetchUserPermissions/index.d.ts +18 -0
- package/api/getCompany/getCompany.d.ts +9 -3
- package/api/getCompanyCredit/getCompanyCredit.d.ts +4 -0
- package/api/getCompanyCredit/graphql/getCompanyCredit.graphql.d.ts +18 -0
- package/api/getCompanyCredit/index.d.ts +18 -0
- package/api/getCompanyCreditHistory/getCompanyCreditHistory.d.ts +5 -0
- package/api/getCompanyCreditHistory/graphql/getCompanyCreditHistory.graphql.d.ts +18 -0
- package/api/getCompanyCreditHistory/index.d.ts +19 -0
- package/api/getCompanyStructure/getCompanyStructure.d.ts +10 -0
- package/api/getCompanyStructure/graphql/getCompanyStructure.graphql.d.ts +18 -0
- package/api/getCompanyStructure/index.d.ts +18 -0
- package/api/getCompanyTeam/getCompanyTeam.d.ts +11 -0
- package/api/getCompanyTeam/graphql/getCompanyTeam.graphql.d.ts +18 -0
- package/api/getCompanyTeam/index.d.ts +18 -0
- package/api/getCompanyUser/getCompanyUser.d.ts +9 -0
- package/api/getCompanyUser/graphql/getCompanyUser.graphql.d.ts +18 -0
- package/api/getCompanyUser/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/index.d.ts +18 -0
- package/api/getCustomerCompany/getCustomerCompany.d.ts +12 -0
- package/api/getCustomerCompany/graphql/getCustomerCompanyInfo.graphql.d.ts +18 -0
- package/api/getCustomerCompany/index.d.ts +18 -0
- package/api/getStoreConfig/getStoreConfig.d.ts +6 -0
- package/api/getStoreConfig/graphql/getStoreConfig.graphql.d.ts +18 -0
- package/api/getStoreConfig/index.d.ts +18 -0
- package/api/graphql/buildCompanyQueries.d.ts +9 -0
- package/api/index.d.ts +26 -2
- package/api/initialize/initialize.d.ts +2 -20
- package/api/isCompanyAdmin/graphql/isCompanyAdmin.graphql.d.ts +18 -0
- package/api/isCompanyAdmin/index.d.ts +18 -0
- package/api/isCompanyAdmin/isCompanyAdmin.d.ts +22 -0
- package/api/isCompanyUser/graphql/isCompanyUser.graphql.d.ts +18 -0
- package/api/isCompanyUser/index.d.ts +18 -0
- package/api/isCompanyUser/isCompanyUser.d.ts +22 -0
- package/api/isCompanyUserEmailAvailable/graphql/isCompanyUserEmailAvailable.graphql.d.ts +18 -0
- package/api/isCompanyUserEmailAvailable/index.d.ts +18 -0
- package/api/isCompanyUserEmailAvailable/isCompanyUserEmailAvailable.d.ts +7 -0
- package/api/updateCompanyStructure/graphql/updateCompanyStructure.graphql.d.ts +18 -0
- package/api/updateCompanyStructure/index.d.ts +18 -0
- package/api/updateCompanyStructure/updateCompanyStructure.d.ts +11 -0
- package/api/updateCompanyTeam/graphql/updateCompanyTeam.graphql.d.ts +18 -0
- package/api/updateCompanyTeam/index.d.ts +18 -0
- package/api/updateCompanyTeam/updateCompanyTeam.d.ts +11 -0
- package/api/updateCompanyUser/graphql/updateCompanyUser.graphql.d.ts +18 -0
- package/api/updateCompanyUser/index.d.ts +18 -0
- package/api/updateCompanyUser/updateCompanyUser.d.ts +9 -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.js +22 -1
- package/api.js.map +1 -1
- package/chunks/CompanyLoaders.js +4 -0
- package/chunks/CompanyLoaders.js.map +1 -0
- package/chunks/CompanyUserForm.js +4 -0
- package/chunks/CompanyUserForm.js.map +1 -0
- package/chunks/Tree.js +4 -0
- package/chunks/Tree.js.map +1 -0
- package/chunks/acdl.js +4 -0
- package/chunks/acdl.js.map +1 -0
- package/chunks/company-permissions.js +4 -0
- package/chunks/company-permissions.js.map +1 -0
- package/chunks/fetch-error.js +4 -0
- package/chunks/fetch-error.js.map +1 -0
- package/chunks/fetchUserPermissions.js +34 -0
- package/chunks/fetchUserPermissions.js.map +1 -0
- package/chunks/getCompanyCreditHistory.js +68 -0
- package/chunks/getCompanyCreditHistory.js.map +1 -0
- package/chunks/getCustomerCompany.js +26 -0
- package/chunks/getCustomerCompany.js.map +1 -0
- package/chunks/isCompanyRoleNameAvailable.js +121 -0
- package/chunks/isCompanyRoleNameAvailable.js.map +1 -0
- package/chunks/isCompanyUser.js +21 -0
- package/chunks/isCompanyUser.js.map +1 -0
- package/chunks/network-error.js +4 -0
- package/chunks/network-error.js.map +1 -0
- package/chunks/transform-store-config.js +44 -0
- package/chunks/transform-store-config.js.map +1 -0
- package/chunks/updateCompany.js +70 -0
- package/chunks/updateCompany.js.map +1 -0
- package/chunks/updateCompanyTeam.js +42 -0
- package/chunks/updateCompanyTeam.js.map +1 -0
- package/chunks/updateCompanyUser.js +37 -0
- package/chunks/updateCompanyUser.js.map +1 -0
- package/chunks/updateCompanyUserStatus.js +39 -0
- package/chunks/updateCompanyUserStatus.js.map +1 -0
- package/chunks/useCompanyContextListener.js +4 -0
- package/chunks/useCompanyContextListener.js.map +1 -0
- package/chunks/useCompanyRoles.js +4 -0
- package/chunks/useCompanyRoles.js.map +1 -0
- package/chunks/useCustomerCompanyInfo.js +4 -0
- package/chunks/useCustomerCompanyInfo.js.map +1 -0
- package/chunks/useInLineAlert.js +4 -0
- package/chunks/useInLineAlert.js.map +1 -0
- package/chunks/useUserPermissions.js +4 -0
- package/chunks/useUserPermissions.js.map +1 -0
- package/chunks/validateCompanyEmail.js +29 -0
- package/chunks/validateCompanyEmail.js.map +1 -0
- package/components/CompanyCreditDisplay/CompanyCreditDisplay.d.ts +7 -0
- package/components/CompanyCreditDisplay/index.d.ts +19 -0
- package/components/CompanyCreditHistoryDisplay/CompanyCreditHistoryDisplay.d.ts +15 -0
- package/components/CompanyCreditHistoryDisplay/index.d.ts +19 -0
- package/components/CompanyLoaders/CompanyLoaders.d.ts +14 -0
- package/components/CompanyRegistrationForm/CompanyRegistrationForm.d.ts +13 -0
- package/components/CompanyRegistrationForm/Form/Form.d.ts +5 -0
- package/components/CompanyRegistrationForm/Form/FormInputs/FormInputs.d.ts +5 -0
- package/components/CompanyRegistrationForm/Form/FormInputs/index.d.ts +18 -0
- package/components/CompanyRegistrationForm/Form/fieldHandlers.d.ts +26 -0
- package/components/CompanyRegistrationForm/Form/fieldValidationRules.d.ts +63 -0
- package/components/CompanyRegistrationForm/Form/formValidation.d.ts +17 -0
- package/components/CompanyRegistrationForm/Form/getCompanyFieldsConfig.d.ts +13 -0
- package/components/CompanyRegistrationForm/Form/index.d.ts +18 -0
- package/components/CompanyRegistrationForm/index.d.ts +20 -0
- package/components/CompanyRegistrationSuccess/CompanyRegistrationSuccess.d.ts +8 -0
- package/components/CompanyRegistrationSuccess/index.d.ts +18 -0
- package/components/CompanyStructureCard/CompanyStructureCard.d.ts +12 -0
- package/components/CompanyStructureCard/index.d.ts +18 -0
- package/components/CompanyStructureEmpty/CompanyStructureEmpty.d.ts +9 -0
- package/components/CompanyStructureEmpty/index.d.ts +19 -0
- package/components/CompanyTeamForm/CompanyTeamForm.d.ts +17 -0
- package/components/CompanyTeamForm/index.d.ts +18 -0
- package/components/CompanyUserForm/CompanyUserForm.d.ts +10 -0
- package/components/CompanyUserForm/index.d.ts +18 -0
- package/components/CompanyUsersFilters/CompanyUsersFilters.d.ts +29 -0
- package/components/CompanyUsersFilters/index.d.ts +18 -0
- package/components/CompanyUsersManagementModal/CompanyUsersManagementModal.d.ts +18 -0
- package/components/CompanyUsersManagementModal/index.d.ts +19 -0
- package/components/CustomerCompanyInfoCard/CustomerCompanyInfoCard.d.ts +9 -0
- package/components/CustomerCompanyInfoCard/index.d.ts +18 -0
- package/components/DeleteRoleModal/DeleteRoleModal.d.ts +9 -0
- package/components/DeleteRoleModal/index.d.ts +19 -0
- package/components/EditCompanyProfile/CompanyAccountFields.d.ts +1 -2
- package/components/EditCompanyProfile/LegalAddressFields.d.ts +1 -1
- package/components/EditRoleAndPermission/EditRoleAndPermission.d.ts +24 -0
- package/components/EditRoleAndPermission/index.d.ts +19 -0
- package/components/RoleAndPermissionTable/RoleAndPermissionTable.d.ts +23 -0
- package/components/RoleAndPermissionTable/index.d.ts +19 -0
- package/components/Tree/Tree.d.ts +62 -0
- package/components/Tree/index.d.ts +18 -0
- package/components/index.d.ts +15 -0
- package/containers/CompanyCredit/CompanyCredit.d.ts +16 -0
- package/containers/CompanyCredit/index.d.ts +19 -0
- package/containers/CompanyCredit.d.ts +3 -0
- package/containers/CompanyCredit.js +4 -0
- package/containers/CompanyCredit.js.map +1 -0
- package/containers/CompanyProfile.js +1 -1
- package/containers/CompanyProfile.js.map +1 -1
- package/containers/CompanyRegistration/CompanyRegistration.d.ts +15 -0
- package/containers/CompanyRegistration/index.d.ts +19 -0
- package/containers/CompanyRegistration.d.ts +3 -0
- package/containers/CompanyRegistration.js +4 -0
- package/containers/CompanyRegistration.js.map +1 -0
- package/containers/CompanyStructure/CompanyStructure.d.ts +5 -0
- package/containers/CompanyStructure/index.d.ts +19 -0
- package/containers/CompanyStructure.d.ts +3 -0
- package/containers/CompanyStructure.js +4 -0
- package/containers/CompanyStructure.js.map +1 -0
- package/containers/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/CustomerCompanyInfo/CustomerCompanyInfo.d.ts +9 -0
- package/containers/CustomerCompanyInfo/index.d.ts +19 -0
- package/containers/CustomerCompanyInfo.d.ts +1 -0
- package/containers/CustomerCompanyInfo.js +4 -0
- package/containers/CustomerCompanyInfo.js.map +1 -0
- package/containers/RolesAndPermissions/RolesAndPermissions.d.ts +8 -0
- package/containers/RolesAndPermissions/index.d.ts +19 -0
- package/containers/RolesAndPermissions.d.ts +3 -0
- package/containers/RolesAndPermissions.js +4 -0
- package/containers/RolesAndPermissions.js.map +1 -0
- package/containers/index.d.ts +7 -0
- package/data/models/company-credit-history.d.ts +54 -0
- package/data/models/company-credit-info.d.ts +33 -0
- package/data/models/company-role.d.ts +48 -0
- package/data/models/company-structure.d.ts +26 -0
- package/data/models/company-team.d.ts +24 -0
- package/data/models/company-user.d.ts +33 -0
- package/data/models/company.d.ts +58 -17
- package/data/models/customer-company-info.d.ts +23 -0
- package/data/models/index.d.ts +7 -0
- package/data/transforms/company.d.ts +5 -0
- package/data/transforms/index.d.ts +8 -0
- package/data/transforms/transform-company-credit-history.d.ts +5 -0
- package/data/transforms/transform-company-credit.d.ts +5 -0
- package/data/transforms/transform-company-roles.d.ts +15 -0
- package/data/transforms/transform-company-structure.d.ts +22 -0
- package/data/transforms/transform-company-team.d.ts +10 -0
- package/data/transforms/transform-company-user.d.ts +18 -0
- package/data/transforms/transform-company.d.ts +5 -1
- package/data/transforms/transform-customer-company-info.d.ts +10 -0
- package/data/transforms/transform-store-config.d.ts +4 -0
- package/hooks/containers/index.d.ts +3 -0
- package/hooks/containers/useCompanyCreditHistory.d.ts +32 -0
- package/hooks/containers/useCompanyProfile.d.ts +2 -8
- package/hooks/containers/useCompanyUsers.d.ts +34 -0
- package/hooks/containers/useCustomerCompanyInfo.d.ts +12 -0
- package/hooks/index.d.ts +9 -0
- package/hooks/useCompanyContextListener.d.ts +62 -0
- package/hooks/useCompanyRegistrationForm.d.ts +37 -0
- package/hooks/useCompanyRoles.d.ts +28 -0
- package/hooks/useCompanyStructureCard.d.ts +36 -0
- package/hooks/useCompanyTeamForm.d.ts +30 -0
- package/hooks/useCompanyUserForm.d.ts +37 -0
- package/hooks/useCountryAndRegionFields.d.ts +20 -0
- package/hooks/useModal.d.ts +24 -0
- package/hooks/usePermissions.d.ts +31 -0
- package/hooks/useUserPermissions.d.ts +26 -0
- package/i18n/en_US.json.d.ts +345 -4
- package/lib/acdl.d.ts +2 -1
- package/lib/company-permissions.d.ts +25 -0
- package/lib/encoding.d.ts +43 -0
- package/lib/fetch-error.d.ts +6 -1
- package/lib/index.d.ts +3 -0
- package/lib/network-error.d.ts +4 -0
- package/lib/userHelpers.d.ts +47 -0
- package/lib/validationFields.d.ts +16 -0
- package/package.json +1 -1
- package/render.js +12 -2
- package/render.js.map +1 -1
- package/types/api/{checkIsCompanyEnabled.types.d.ts → checkCompanyCreditEnabled.types.d.ts} +3 -3
- package/types/api/companyRoles.types.d.ts +137 -0
- package/types/api/companyUsers.types.d.ts +70 -0
- package/types/api/createCompanyTeam.types.d.ts +27 -0
- package/types/api/createCompanyUser.types.d.ts +31 -0
- package/types/api/deleteCompanyTeam.types.d.ts +20 -0
- package/types/api/deleteCompanyUser.types.d.ts +28 -0
- package/types/api/fetchUserPermissions.types.d.ts +43 -0
- package/types/api/getCompany.types.d.ts +1 -1
- package/types/api/getCompanyCredit.types.d.ts +40 -0
- package/types/api/getCompanyCreditHistory.types.d.ts +61 -0
- package/types/api/getCompanyCreditHistoryParams.types.d.ts +53 -0
- package/types/api/getCompanyStructure.types.d.ts +33 -0
- package/types/api/getCompanyTeam.types.d.ts +20 -0
- package/types/api/getCompanyUser.types.d.ts +20 -0
- package/types/api/getCustomerCompanyInfo.types.d.ts +40 -0
- package/types/api/getStoreConfig.types.d.ts +33 -0
- package/types/api/index.d.ts +29 -0
- package/types/api/initialize.types.d.ts +21 -0
- package/types/api/isCompanyUserEmailAvailable.types.d.ts +20 -0
- package/types/api/updateCompany.types.d.ts +1 -1
- package/types/api/updateCompanyStructure.types.d.ts +21 -0
- package/types/api/updateCompanyTeam.types.d.ts +22 -0
- package/types/api/updateCompanyUser.types.d.ts +27 -0
- package/types/api/updateCompanyUserStatus.types.d.ts +22 -0
- package/types/companyForm.types.d.ts +33 -0
- package/types/companyPermission.types.d.ts +33 -0
- package/types/companyProfile.types.d.ts +43 -0
- package/types/companyStructure.types.d.ts +28 -0
- package/types/customerCompanyInfo.types.d.ts +11 -0
- package/types/events.d.ts +21 -0
- package/types/form.types.d.ts +93 -0
- package/types/hook.types.d.ts +18 -0
- package/types/index.d.ts +25 -2
- package/api/checkIsCompanyEnabled/checkIsCompanyEnabled.d.ts +0 -4
- package/api/updateCompany/graphql/updateCompany.graphql.d.ts +0 -2
- package/chunks/getCountries.js +0 -135
- package/chunks/getCountries.js.map +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as i}from"@dropins/tools/preact-jsx-runtime.js";import{useState as u,useCallback as l,useEffect as f}from"@dropins/tools/preact-hooks.js";import*as t from"@dropins/tools/preact-compat.js";const k=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"})),E=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",strokeWidth:1,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",strokeWidth:1,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)",strokeWidth:1})))),v=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"})),C={success:i(k,{}),warning:i(E,{}),error:i(v,{})},x=()=>{const[n,c]=u({}),[r,a]=u(null),h=l(()=>{c({}),r&&(clearTimeout(r),a(null))},[r]),s=l(e=>{if(r&&(clearTimeout(r),a(null)),!(e!=null&&e.type)){c({});return}const o=C[e.type];if(c({type:e.type,text:e.text,icon:o}),e.autoHide!==!1){const d=e.autoHideDelay||(e.type==="success"?3e3:5e3),w=setTimeout(()=>{c({}),a(null)},d);a(w)}},[r]),m=l((e,o=!0)=>{s({type:"success",text:e,autoHide:o})},[s]),g=l((e,o=!1)=>{s({type:"warning",text:e,autoHide:o})},[s]),p=l((e,o=!1)=>{s({type:"error",text:e,autoHide:o})},[s]);return f(()=>()=>{r&&clearTimeout(r)},[r]),{inLineAlertProps:n,handleSetInLineAlert:s,clearAlert:h,showSuccess:m,showWarning:g,showError:p}};export{x as u};
|
|
4
|
+
//# sourceMappingURL=useInLineAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInLineAlert.js","sources":["../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-company-management/src/hooks/useInLineAlert.tsx"],"sourcesContent":["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 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\", strokeWidth: 1, 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\", strokeWidth: 1, 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)\", strokeWidth: 1 }))));\nexport default SvgWarning;\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"],"names":["SvgCheckWithCircle","props","React","SvgWarning","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","inLineAlertProps","setInLineAlertProps","useState","autoHideTimer","setAutoHideTimer","clearAlert","useCallback","handleSetInLineAlert","notification","icon","delay","timer","showSuccess","text","autoHide","showWarning","showError","useEffect"],"mappings":"uMACA,MAAMA,EAAsBC,GAA0BC,EAAM,cAAc,MAAO,CAAE,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,CAAK,EAAoBC,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,0JAA2J,OAAQ,cAAc,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,qCAAsC,OAAQ,cAAc,CAAE,CAAC,ECAxlBC,EAAcF,GAA0BC,EAAM,cAAc,MAAO,CAAE,GAAI,oBAAqB,MAAO,GAAI,OAAQ,GAAI,QAAS,YAAa,KAAM,OAAQ,MAAO,6BAA8B,GAAGD,GAAyBC,EAAM,cAAc,IAAK,CAAE,SAAU,sBAAsB,EAAoBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG,6DAA8D,OAAQ,eAAgB,YAAa,EAAG,cAAe,QAAS,eAAgB,OAAO,CAAE,EAAmBA,EAAM,cAAc,OAAQ,CAAE,aAAc,qBAAsB,EAAG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,GAAO,CACnC,MAAME,EAAQF,EAAa,gBAAkBA,EAAa,OAAS,UAAY,IAAO,KAChFG,EAAQ,WAAW,IAAM,CAC7BV,EAAoB,CAAA,CAAE,EACtBG,EAAiB,IAAI,CACvB,EAAGM,CAAK,EACRN,EAAiBO,CAAK,CACxB,CACF,EACA,CAACR,CAAa,CAAA,EAGVS,EAAcN,EAClB,CAACO,EAAcC,EAAoB,KAAS,CAC1CP,EAAqB,CAAE,KAAM,UAAW,KAAAM,EAAM,SAAAC,EAAU,CAC1D,EACA,CAACP,CAAoB,CAAA,EAGjBQ,EAAcT,EAClB,CAACO,EAAcC,EAAoB,KAAU,CAC3CP,EAAqB,CAAE,KAAM,UAAW,KAAAM,EAAM,SAAAC,EAAU,CAC1D,EACA,CAACP,CAAoB,CAAA,EAGjBS,EAAYV,EAChB,CAACO,EAAcC,EAAoB,KAAU,CAC3CP,EAAqB,CAAE,KAAM,QAAS,KAAAM,EAAM,SAAAC,EAAU,CACxD,EACA,CAACP,CAAoB,CAAA,EAIvB,OAAAU,EAAU,IACD,IAAM,CACPd,GACF,aAAaA,CAAa,CAE9B,EACC,CAACA,CAAa,CAAC,EAEX,CACL,iBAAAH,EACA,qBAAAO,EACA,WAAAF,EACA,YAAAO,EACA,YAAAG,EACA,UAAAC,CAAA,CAEJ","x_google_ignoreList":[0,1,2]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{jsx as r,jsxs as B}from"@dropins/tools/preact-jsx-runtime.js";import{Fragment as T}from"@dropins/tools/preact.js";import{classes as D,VComponent as v}from"@dropins/tools/lib.js";import{Button as x,Icon as A,Skeleton as P,SkeletonRow as R}from"@dropins/tools/components.js";import{useText as $}from"@dropins/tools/i18n.js";import{useState as N,useRef as S,useCallback as E,useEffect as U}from"@dropins/tools/preact-hooks.js";import{b as j}from"./company-permissions.js";import{u as z}from"./useCompanyContextListener.js";import{f as V}from"./fetchUserPermissions.js";const X=({className:y,children:w,columns:i=[],rowData:b=[],mobileLayout:m="none",caption:n,expandedRows:d=new Set,loading:p=!1,skeletonRowCount:o=10,onSortChange:c,...f})=>{const s=$({sortedAscending:"Dropin.Table.sortedAscending",sortedDescending:"Dropin.Table.sortedDescending",sortBy:"Dropin.Table.sortBy"}),u=e=>{if(!c)return;let t;e.sortBy===!0?t="asc":e.sortBy==="asc"?t="desc":t=!0,c(e.key,t)},g=e=>{if(e.sortBy===void 0)return null;const t=e.ariaLabel??e.label;let a,l;return e.sortBy==="asc"?(a="ChevronUp",l=s.sortedAscending.replace("{label}",t)):e.sortBy==="desc"?(a="ChevronDown",l=s.sortedDescending.replace("{label}",t)):(a="ChevronDown",l=s.sortBy.replace("{label}",t)),r(x,{variant:"tertiary",size:"medium",className:"dropin-table__header__sort-button",icon:r(A,{source:a}),"aria-label":l,onClick:()=>u(e)})},C=()=>Array.from({length:o},(e,t)=>r("tr",{className:"dropin-table__body__row",children:i.map(a=>r("td",{className:"dropin-table__body__cell","data-label":a.ariaLabel??a.label,children:r(P,{children:r(R,{variant:"row",size:"small",fullWidth:!0})})},a.key))},`skeleton-${t}`)),F=()=>b.map((e,t)=>{const a=e._rowDetails!==void 0,l=d.has(t);return B(T,{children:[r("tr",{className:D(["dropin-table__body__row",["dropin-table__body__row--expanded",l&&a]]),children:i.map(_=>{const h=e[_.key],k=_.ariaLabel??_.label;return typeof h=="string"||typeof h=="number"?r("td",{className:"dropin-table__body__cell","data-label":k,children:h},_.key):r("td",{className:"dropin-table__body__cell","data-label":k,children:r(v,{node:h})},_.key)})}),a&&l&&r("tr",{className:"dropin-table__row-details dropin-table__row-details--expanded",id:`row-${t}-details`,children:r("td",{className:"dropin-table__row-details__cell",colSpan:i.length,role:"region","aria-labelledby":`row-${t}-details`,children:typeof e._rowDetails=="string"?e._rowDetails:r(v,{node:e._rowDetails})})},`${t}-details`)]},t)}),L=e=>{if(e.sortBy===!0)return"none";if(e.sortBy==="asc")return"ascending";if(e.sortBy==="desc")return"descending"};return r("div",{className:D(["dropin-table",`dropin-table--mobile-layout-${m}`,y]),children:B("table",{...f,className:"dropin-table__table",children:[n&&r("caption",{className:"dropin-table__caption",children:n}),r("thead",{className:"dropin-table__header",children:r("tr",{className:"dropin-table__header__row",children:i.map(e=>B("th",{className:D(["dropin-table__header__cell",["dropin-table__header__cell--sorted",e.sortBy==="asc"||e.sortBy==="desc"],["dropin-table__header__cell--sortable",e.sortBy!==void 0]]),"aria-sort":L(e),children:[e.label,g(e)]},e.key))})}),r("tbody",{className:"dropin-table__body",children:p?C():F()})]})})},Y=()=>{const[y,w]=N(null),[i,b]=N(!0),[m,n]=N(null),d=S(!1),p=S(!1),o=E(async()=>{var c,f;if(!d.current){d.current=!0,b(!0),n(null);try{const{roleResponse:s}=await V(),u=(f=(c=s==null?void 0:s.data)==null?void 0:c.customer)==null?void 0:f.role,g=j(u);w(g)}catch(s){console.error("Failed to fetch user permissions:",s),n(s)}finally{b(!1),d.current=!1}}},[]);return U(()=>{p.current||(p.current=!0,o())},[o]),z(o,{eager:!0}),{permissions:y,loading:i,error:m,refetch:o}};export{X as T,Y as u};
|
|
4
|
+
//# sourceMappingURL=useUserPermissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserPermissions.js","sources":["../../node_modules/@adobe-commerce/elsie/src/components/Table/Table.tsx","/@dropins/storefront-company-management/src/hooks/useUserPermissions.ts"],"sourcesContent":["/********************************************************************\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: Adobe permits you to use, modify, and distribute this\n * file in accordance with the terms of the Adobe license agreement\n * accompanying it.\n *******************************************************************/\n\nimport { FunctionComponent, VNode, Fragment } from 'preact';\nimport { HTMLAttributes } from 'preact/compat';\nimport { classes, VComponent } from '@adobe-commerce/elsie/lib';\nimport {\n Icon,\n Button,\n Skeleton,\n SkeletonRow,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\nimport '@adobe-commerce/elsie/components/Table/Table.css';\n\ntype Sortable = 'asc' | 'desc' | true;\n\ntype Column =\n | { label: string; key: string; ariaLabel?: string; sortBy?: Sortable }\n | {\n label: VNode<HTMLAttributes<HTMLElement>>;\n key: string;\n ariaLabel: string;\n sortBy?: Sortable;\n };\n\ntype RowData = {\n [key: string]: VNode | string | number | undefined;\n _rowDetails?: VNode | string; // Special property for expandable row content\n};\n\nexport interface TableProps\n extends Omit<HTMLAttributes<HTMLTableElement>, 'loading'> {\n columns: Column[];\n rowData: RowData[];\n mobileLayout?: 'stacked' | 'none';\n caption?: string;\n expandedRows?: Set<number>;\n loading?: boolean;\n skeletonRowCount?: number;\n onSortChange?: (columnKey: string, direction: Sortable) => void;\n}\n\nexport const Table: FunctionComponent<TableProps> = ({\n className,\n children,\n columns = [],\n rowData = [],\n mobileLayout = 'none',\n caption,\n expandedRows = new Set(),\n loading = false,\n skeletonRowCount = 10,\n onSortChange,\n ...props\n}) => {\n const translations = useText({\n sortedAscending: 'Dropin.Table.sortedAscending',\n sortedDescending: 'Dropin.Table.sortedDescending',\n sortBy: 'Dropin.Table.sortBy',\n });\n\n const handleSort = (column: Column) => {\n if (!onSortChange) return;\n\n // Determine next sort direction\n let nextDirection: Sortable;\n if (column.sortBy === true) {\n nextDirection = 'asc';\n } else if (column.sortBy === 'asc') {\n nextDirection = 'desc';\n } else {\n nextDirection = true;\n }\n\n onSortChange(column.key, nextDirection);\n };\n\n const renderSortButton = (column: Column) => {\n if (column.sortBy === undefined) return null;\n const label = column.ariaLabel ?? (column.label as string);\n\n let iconSource: string;\n let ariaLabel: string;\n\n if (column.sortBy === 'asc') {\n iconSource = 'ChevronUp';\n ariaLabel = translations.sortedAscending.replace('{label}', label);\n } else if (column.sortBy === 'desc') {\n iconSource = 'ChevronDown';\n ariaLabel = translations.sortedDescending.replace('{label}', label);\n } else {\n // Show chevron down when sortable but not sorted\n iconSource = 'ChevronDown';\n ariaLabel = translations.sortBy.replace('{label}', label);\n }\n\n return (\n <Button\n variant=\"tertiary\"\n size=\"medium\"\n className=\"dropin-table__header__sort-button\"\n icon={<Icon source={iconSource} />}\n aria-label={ariaLabel}\n onClick={() => handleSort(column)}\n />\n );\n };\n\n const renderSkeletonRows = () => {\n return Array.from({ length: skeletonRowCount }, (_, rowIndex) => (\n <tr key={`skeleton-${rowIndex}`} className=\"dropin-table__body__row\">\n {columns.map((column) => (\n <td\n key={column.key}\n className=\"dropin-table__body__cell\"\n data-label={column.ariaLabel ?? column.label}\n >\n <Skeleton>\n <SkeletonRow variant=\"row\" size=\"small\" fullWidth />\n </Skeleton>\n </td>\n ))}\n </tr>\n ));\n };\n\n const renderDataRows = () => {\n return rowData.map((row, rowIndex) => {\n const hasDetails = row._rowDetails !== undefined;\n const isExpanded = expandedRows.has(rowIndex);\n\n return (\n <Fragment key={rowIndex}>\n <tr className={classes([\n 'dropin-table__body__row',\n ['dropin-table__body__row--expanded', isExpanded && hasDetails],\n ])}>\n {columns.map((column) => {\n const cell = row[column.key];\n const label = column.ariaLabel ?? column.label;\n\n if (typeof cell === 'string' || typeof cell === 'number') {\n return (\n <td\n key={column.key}\n className=\"dropin-table__body__cell\"\n data-label={label}\n >\n {cell}\n </td>\n );\n }\n\n return (\n <td\n key={column.key}\n className=\"dropin-table__body__cell\"\n data-label={label}\n >\n <VComponent node={cell!} />\n </td>\n );\n })}\n </tr>\n {hasDetails && isExpanded && (\n <tr\n key={`${rowIndex}-details`}\n className=\"dropin-table__row-details dropin-table__row-details--expanded\"\n id={`row-${rowIndex}-details`}\n >\n <td\n className=\"dropin-table__row-details__cell\"\n colSpan={columns.length}\n role=\"region\"\n aria-labelledby={`row-${rowIndex}-details`}\n >\n {typeof row._rowDetails === 'string' ? (\n row._rowDetails\n ) : (\n <VComponent node={row._rowDetails!} />\n )}\n </td>\n </tr>\n )}\n </Fragment>\n );\n });\n };\n\n const getAriaSort = (\n column: Column\n ): 'none' | 'ascending' | 'descending' | 'other' | undefined => {\n if (column.sortBy === true) return 'none';\n if (column.sortBy === 'asc') return 'ascending';\n if (column.sortBy === 'desc') return 'descending';\n return undefined;\n };\n\n return (\n <div\n className={classes([\n 'dropin-table',\n `dropin-table--mobile-layout-${mobileLayout}`,\n className,\n ])}\n >\n <table {...props} className=\"dropin-table__table\">\n {caption && (\n <caption className=\"dropin-table__caption\">{caption}</caption>\n )}\n <thead className=\"dropin-table__header\">\n <tr className=\"dropin-table__header__row\">\n {columns.map((column) => (\n <th\n key={column.key}\n className={classes([\n 'dropin-table__header__cell',\n [\n 'dropin-table__header__cell--sorted',\n column.sortBy === 'asc' || column.sortBy === 'desc',\n ],\n [\n 'dropin-table__header__cell--sortable',\n column.sortBy !== undefined,\n ],\n ])}\n aria-sort={getAriaSort(column)}\n >\n {column.label}\n {renderSortButton(column)}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"dropin-table__body\">\n {loading\n ? // Render skeleton rows when loading\n renderSkeletonRows()\n : // Render actual data when not loading\n renderDataRows()}\n </tbody>\n </table>\n </div>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\n\nimport { useState, useEffect, useCallback, useRef } from 'preact/hooks';\nimport { fetchUserPermissions } from '../api/fetchUserPermissions';\nimport { buildPermissionFlags, CompanyPermissionFlags } from '../lib/company-permissions';\nimport { useCompanyContextListener } from './useCompanyContextListener';\n\n/**\n * Hook to fetch user permissions without requiring full company profile access\n */\nexport const useUserPermissions = () => {\n const [permissions, setPermissions] = useState<CompanyPermissionFlags | null>(null);\n const [loading, setLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n \n const inFlightRef = useRef<boolean>(false);\n const didInitialFetchRef = useRef<boolean>(false);\n\n const fetchPermissions = useCallback(async () => {\n if (inFlightRef.current) {\n return;\n }\n \n inFlightRef.current = true;\n setLoading(true);\n setError(null);\n \n try {\n const { roleResponse } = await fetchUserPermissions();\n const role = roleResponse?.data?.customer?.role;\n const permissionFlags = buildPermissionFlags(role);\n setPermissions(permissionFlags);\n } catch (err) {\n console.error('Failed to fetch user permissions:', err);\n setError(err as Error);\n } finally {\n setLoading(false);\n inFlightRef.current = false;\n }\n }, []);\n\n useEffect(() => {\n if (!didInitialFetchRef.current) {\n didInitialFetchRef.current = true;\n fetchPermissions();\n }\n }, [fetchPermissions]);\n\n // Re-fetch permissions when company context changes\n useCompanyContextListener(fetchPermissions, { eager: true });\n\n return {\n permissions,\n loading,\n error,\n refetch: fetchPermissions,\n };\n};\n"],"names":["Table","className","children","columns","rowData","mobileLayout","caption","expandedRows","loading","skeletonRowCount","onSortChange","props","translations","useText","handleSort","column","nextDirection","renderSortButton","label","iconSource","ariaLabel","jsx","Button","Icon","renderSkeletonRows","_","rowIndex","Skeleton","SkeletonRow","renderDataRows","row","hasDetails","isExpanded","Fragment","classes","cell","VComponent","getAriaSort","jsxs","useUserPermissions","permissions","setPermissions","useState","setLoading","error","setError","inFlightRef","useRef","didInitialFetchRef","fetchPermissions","useCallback","roleResponse","fetchUserPermissions","role","_b","_a","permissionFlags","buildPermissionFlags","err","useEffect","useCompanyContextListener"],"mappings":"6jBAkDO,MAAMA,EAAuC,CAAC,CACnD,UAAAC,EACA,SAAAC,EACA,QAAAC,EAAU,CAAA,EACV,QAAAC,EAAU,CAAA,EACV,aAAAC,EAAe,OACf,QAAAC,EACA,aAAAC,MAAmB,IACnB,QAAAC,EAAU,GACV,iBAAAC,EAAmB,GACnB,aAAAC,EACA,GAAGC,CACL,IAAM,CACJ,MAAMC,EAAeC,EAAQ,CAC3B,gBAAiB,+BACjB,iBAAkB,gCAClB,OAAQ,qBAAA,C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,EAAA,EAEJ,EAAG,CAACA,CAAgB,CAAC,EAGrBW,EAA0BX,EAAkB,CAAE,MAAO,EAAA,CAAM,EAEpD,CACL,YAAAT,EACA,QAAAhC,EACA,MAAAoC,EACA,QAASK,CAAA,CAEb","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*! Copyright 2025 Adobe
|
|
2
|
+
All Rights Reserved. */
|
|
3
|
+
import{b as p}from"./company-permissions.js";import{f as c,h as y}from"./network-error.js";import{h as u}from"./fetch-error.js";const E=i=>{var s;if(!(i!=null&&i.data))throw new Error("Invalid response: missing data");const e="updateCompany"in i.data?(s=i.data.updateCompany)==null?void 0:s.company:i.data.company;if(!e)throw new Error("Invalid response: missing company data");const t="customer"in i.data?i.data.customer:void 0,n=e.legal_address?{street:Array.isArray(e.legal_address.street)?e.legal_address.street.filter(a=>a&&a.trim()!==""):[],city:(e.legal_address.city||"").trim(),region:e.legal_address.region?{region:(e.legal_address.region.region||"").trim(),regionCode:(e.legal_address.region.region_code||"").trim(),regionId:e.legal_address.region.region_id?Number(e.legal_address.region.region_id):0}:void 0,countryCode:(e.legal_address.country_code||"").toUpperCase().trim(),postcode:(e.legal_address.postcode||"").trim(),telephone:e.legal_address.telephone?e.legal_address.telephone.trim():void 0}:void 0,r=t==null?void 0:t.role,l=p(r),o={id:(e.id||"").toString(),name:(e.name||"").trim(),email:(e.email||"").trim().toLowerCase(),legalName:e.legal_name?e.legal_name.trim():void 0,vatTaxId:e.vat_tax_id?e.vat_tax_id.trim():void 0,resellerId:e.reseller_id?e.reseller_id.trim():void 0,legalAddress:n,companyAdmin:e.company_admin?{id:(e.company_admin.id||"").toString(),firstname:(e.company_admin.firstname||"").trim(),lastname:(e.company_admin.lastname||"").trim(),email:(e.company_admin.email||"").trim().toLowerCase(),jobTitle:e.company_admin.job_title?e.company_admin.job_title.trim():void 0}:void 0,salesRepresentative:e.sales_representative?{firstname:(e.sales_representative.firstname||"").trim(),lastname:(e.sales_representative.lastname||"").trim(),email:(e.sales_representative.email||"").trim().toLowerCase()}:void 0,availablePaymentMethods:Array.isArray(e.available_payment_methods)?e.available_payment_methods.filter(a=>a&&typeof a.code=="string"&&typeof a.title=="string").map(a=>({code:a.code.trim(),title:a.title.trim()})).filter(a=>a.code.length>0&&a.title.length>0):void 0,availableShippingMethods:Array.isArray(e.available_shipping_methods)?e.available_shipping_methods.filter(a=>a&&typeof a.code=="string"&&typeof a.title=="string").map(a=>({code:a.code.trim(),title:a.title.trim()})).filter(a=>a.code.length>0&&a.title.length>0):void 0,canEditAccount:l.canEditAccount,canEditAddress:l.canEditAddress,permissionsFlags:l,customerRole:r,customerStatus:t==null?void 0:t.status};if(l.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},A=i=>{var n,r,l,o,s;if(!((r=(n=i==null?void 0:i.data)==null?void 0:n.createCompany)!=null&&r.company))throw new Error("Invalid createCompany response: missing company data");const e=i.data.createCompany.company;if(!e.legal_address)throw new Error("Legal address is required for company registration");if(!e.company_admin)throw new Error("Company admin is required for company registration");return{id:e.id,name:e.name,email:e.email,legalName:e.legal_name,vatTaxId:e.vat_tax_id,resellerId:e.reseller_id,legalAddress:{street:e.legal_address.street||[],city:e.legal_address.city||"",region:{regionCode:((l=e.legal_address.region)==null?void 0:l.region_code)||"",region:(o=e.legal_address.region)==null?void 0:o.region,regionId:(s=e.legal_address.region)==null?void 0:s.region_id},countryCode:e.legal_address.country_code||"",postcode:e.legal_address.postcode||"",telephone:e.legal_address.telephone},companyAdmin:{id:e.company_admin.id,firstname:e.company_admin.firstname,lastname:e.company_admin.lastname,email:e.company_admin.email,jobTitle:e.company_admin.job_title,telephone:e.company_admin.telephone}}},v=i=>{var o,s;if(!((s=(o=i==null?void 0:i.data)==null?void 0:o.countries)!=null&&s.length))return{availableCountries:[],countriesWithRequiredRegion:[],optionalZipCountries:[]};const{countries:e,storeConfig:t}=i.data,n=t==null?void 0:t.countries_with_required_region.split(","),r=t==null?void 0:t.optional_zip_countries.split(",");return{availableCountries:e.filter(({two_letter_abbreviation:a,full_name_locale:d})=>!!(a&&d)).map(a=>{const{two_letter_abbreviation:d,full_name_locale:_,available_regions:m}=a,g=Array.isArray(m)&&m.length>0;return{value:d,text:_,availableRegions:g?m:void 0}}).sort((a,d)=>a.text.localeCompare(d.text)),countriesWithRequiredRegion:n,optionalZipCountries:r}},h=`
|
|
4
|
+
query getCountries {
|
|
5
|
+
countries {
|
|
6
|
+
id
|
|
7
|
+
two_letter_abbreviation
|
|
8
|
+
three_letter_abbreviation
|
|
9
|
+
full_name_locale
|
|
10
|
+
full_name_english
|
|
11
|
+
available_regions {
|
|
12
|
+
id
|
|
13
|
+
code
|
|
14
|
+
name
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
storeConfig {
|
|
18
|
+
countries_with_required_region
|
|
19
|
+
optional_zip_countries
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`,I=async()=>{const i="_company_countries",e=sessionStorage.getItem(i);return e?JSON.parse(e):await c(h,{method:"GET"}).then(t=>{var r;if((r=t.errors)!=null&&r.length)return u(t.errors);const n=v(t);return sessionStorage.setItem(i,JSON.stringify(n)),n}).catch(y)},f=`
|
|
23
|
+
query validateCompanyEmail($email: String!) {
|
|
24
|
+
isCompanyEmailAvailable(email: $email) {
|
|
25
|
+
is_email_available
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
`,R=async i=>{try{const e=await c(f,{variables:{email:i}});return e.errors?{isValid:!1,error:"Unable to validate email"}:{isValid:e.data.isCompanyEmailAvailable.is_email_available,error:e.data.isCompanyEmailAvailable.is_email_available?void 0:"This email is already used by another company"}}catch{return{isValid:!1,error:"Unable to validate email"}}};export{E as a,I as g,A as t,R as v};
|
|
29
|
+
//# sourceMappingURL=validateCompanyEmail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateCompanyEmail.js","sources":["/@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/getCountries/graphql/getCountries.graphql.ts","/@dropins/storefront-company-management/src/api/getCountries/getCountries.ts","/@dropins/storefront-company-management/src/api/validateCompanyEmail/graphql/validateCompanyEmail.graphql.ts","/@dropins/storefront-company-management/src/api/validateCompanyEmail/validateCompanyEmail.ts"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { getCompanyResponse } from '../../types/api/getCompany.types';\nimport { updateCompanyResponse } from '../../types/api/updateCompany.types';\nimport { CompanyModel, CompanyRegistrationModel } 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/**\n * Transform createCompany GraphQL response to Company model\n */\nexport const transformCreateCompanyResponse = (response: any): CompanyRegistrationModel => {\n // Validate response structure\n if (!response?.data?.createCompany?.company) {\n throw new Error('Invalid createCompany response: missing company data');\n }\n\n const rawCompany = response.data.createCompany.company;\n\n // Validate required fields\n if (!rawCompany.legal_address) {\n throw new Error('Legal address is required for company registration');\n }\n if (!rawCompany.company_admin) {\n throw new Error('Company admin is required for company registration');\n }\n\n // Transform the GraphQL response to match the CompanyRegistrationModel\n const transformedCompany: CompanyRegistrationModel = {\n id: rawCompany.id,\n name: rawCompany.name,\n email: rawCompany.email,\n legalName: rawCompany.legal_name,\n vatTaxId: rawCompany.vat_tax_id,\n resellerId: rawCompany.reseller_id,\n legalAddress: {\n street: rawCompany.legal_address.street || [],\n city: rawCompany.legal_address.city || '',\n region: {\n regionCode: rawCompany.legal_address.region?.region_code || '',\n region: rawCompany.legal_address.region?.region,\n regionId: rawCompany.legal_address.region?.region_id,\n },\n countryCode: rawCompany.legal_address.country_code || '',\n postcode: rawCompany.legal_address.postcode || '',\n telephone: rawCompany.legal_address.telephone,\n },\n companyAdmin: {\n id: rawCompany.company_admin.id,\n firstname: rawCompany.company_admin.firstname,\n lastname: rawCompany.company_admin.lastname,\n email: rawCompany.company_admin.email,\n jobTitle: rawCompany.company_admin.job_title,\n telephone: rawCompany.company_admin.telephone,\n },\n };\n\n return transformedCompany;\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 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","/********************************************************************\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};"],"names":["transformCompany","response","companyData","_a","customerData","legalAddress","line","customerRole","permissionsFlags","buildPermissionFlags","model","m","transformCreateCompanyResponse","_b","rawCompany","_c","_d","_e","transformCountries","countries","storeConfig","countriesWithRequiredRegion","optionalZipCountries","two_letter_abbreviation","full_name_locale","country","available_regions","hasRegions","b","GET_COUNTRIES_QUERY","getCountries","sessionStorageKey","sessionStorageCache","fetchGraphQl","handleFet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AAM,EAEpE,MAAMkC,EAAkBjB,EAAmBjB,CAAQ,EAEnD,sBAAe,QACb8B,EACA,KAAK,UAAUI,CAAe,CAAA,EAGzBA,CACT,CAAC,EACA,MAAMC,CAAkB,CAC7B,ECrCaC,EAA6C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,ECI7CC,EAAuB,MAAOC,GAAyD,CAClG,GAAI,CACF,MAAMtC,EAAW,MAAMgC,EAAwCI,EAA8B,CAC3F,UAAW,CAAE,MAAAE,CAAA,CAAM,CACpB,EAED,OAAItC,EAAS,OACJ,CACL,QAAS,GACT,MAAO,0BAAA,EAIJ,CACL,QAASA,EAAS,KAAK,wBAAwB,mBAC/C,MAAOA,EAAS,KAAK,wBAAwB,mBACzC,OACA,+CAAA,CAER,MAAgB,CACd,MAAO,CACL,QAAS,GACT,MAAO,0BAAA,CAEX,CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface CompanyCreditDisplayProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
}
|
|
6
|
+
export declare const CompanyCreditDisplay: FunctionComponent<CompanyCreditDisplayProps>;
|
|
7
|
+
//# sourceMappingURL=CompanyCreditDisplay.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 './CompanyCreditDisplay';
|
|
18
|
+
export { CompanyCreditDisplay as default } from './CompanyCreditDisplay';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export interface CompanyCreditHistoryDisplayProps extends Omit<HTMLAttributes<HTMLDivElement>, 'loading'> {
|
|
5
|
+
/**
|
|
6
|
+
* Optional initial parameters for credit history filtering and pagination
|
|
7
|
+
*/
|
|
8
|
+
initialParams?: {
|
|
9
|
+
pageSize?: number;
|
|
10
|
+
currentPage?: number;
|
|
11
|
+
filter?: any;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare const CompanyCreditHistoryDisplay: FunctionComponent<CompanyCreditHistoryDisplayProps>;
|
|
15
|
+
//# sourceMappingURL=CompanyCreditHistoryDisplay.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 './CompanyCreditHistoryDisplay';
|
|
18
|
+
export { CompanyCreditHistoryDisplay as default } from './CompanyCreditHistoryDisplay';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -3,4 +3,18 @@ export declare const CompanyCardLoader: ({ testId, withCard, }: {
|
|
|
3
3
|
testId?: string | undefined;
|
|
4
4
|
withCard?: boolean | undefined;
|
|
5
5
|
}) => import("preact").JSX.Element;
|
|
6
|
+
export declare const CompanyUsersTableLoader: ({ testId }: {
|
|
7
|
+
testId?: string | undefined;
|
|
8
|
+
}) => import("preact").JSX.Element;
|
|
9
|
+
export declare const CompanyCreditLoader: ({ testId }: {
|
|
10
|
+
testId?: string | undefined;
|
|
11
|
+
}) => import("preact").JSX.Element;
|
|
12
|
+
export declare const CompanyCreditHistoryLoader: ({ testId }: {
|
|
13
|
+
testId?: string | undefined;
|
|
14
|
+
}) => import("preact").JSX.Element;
|
|
15
|
+
export declare const CompanyStructureLoader: ({ rows }: {
|
|
16
|
+
rows?: number | undefined;
|
|
17
|
+
}) => import("preact").JSX.Element;
|
|
18
|
+
export declare const CompanyUserFormLoader: () => import("preact").JSX.Element;
|
|
19
|
+
export declare const CompanyTeamFormLoader: () => import("preact").JSX.Element;
|
|
6
20
|
//# sourceMappingURL=CompanyLoaders.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { CompanyFormSlots } from '../../types/form.types';
|
|
3
|
+
import { Company } from '../../data/models/company';
|
|
4
|
+
|
|
5
|
+
export interface CompanyRegistrationFormProps {
|
|
6
|
+
onSuccess?: (company: Company) => void;
|
|
7
|
+
onError?: (errors: string[]) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
slots?: CompanyFormSlots;
|
|
10
|
+
hideActionFormButtons?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const CompanyRegistrationForm: FunctionComponent<CompanyRegistrationFormProps>;
|
|
13
|
+
//# sourceMappingURL=CompanyRegistrationForm.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 './FormInputs';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from '../../../../preact/compat';
|
|
2
|
+
import { CompanyFormData } from '../../../data/models/company';
|
|
3
|
+
import { FieldsProps } from '../../../types/form.types';
|
|
4
|
+
|
|
5
|
+
export type FieldChangeHandler = (key: string, value: string | string[] | number | boolean) => void;
|
|
6
|
+
export type ValidationHandler = (fieldCode: string, value: string | string[] | number | boolean) => void;
|
|
7
|
+
export interface FieldHandlersConfig {
|
|
8
|
+
setFormData: React.Dispatch<React.SetStateAction<CompanyFormData>>;
|
|
9
|
+
hasRegions: boolean;
|
|
10
|
+
regionOptions: any[];
|
|
11
|
+
fieldsConfig: FieldsProps[];
|
|
12
|
+
formTranslations: any;
|
|
13
|
+
setFieldErrors?: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
14
|
+
}
|
|
15
|
+
export declare const createFieldHandlers: (config: FieldHandlersConfig) => {
|
|
16
|
+
handleInputChange: (event: Event) => void;
|
|
17
|
+
handleInputChangeFromValues: (values: Record<string, string | string[] | number | boolean>) => void;
|
|
18
|
+
handleStreetChange: (value: string | string[]) => void;
|
|
19
|
+
handleStreetLine2Change: (value: string) => void;
|
|
20
|
+
handleRegionTextChange: (value: string) => void;
|
|
21
|
+
handleRegionCodeChange: (value: string) => void;
|
|
22
|
+
handleRegionDropdownChange: (value: string | number) => void;
|
|
23
|
+
handleCountryChange: (value: string) => void;
|
|
24
|
+
handleGenericFieldChange: (key: string, value: string | string[] | number | boolean) => void;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=fieldHandlers.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
type ErrorsList = Record<string, string>;
|
|
18
|
+
export type ValidationFieldsConfig = {
|
|
19
|
+
validateRules?: Record<string, string | number | boolean>[];
|
|
20
|
+
code?: string;
|
|
21
|
+
customUpperCode: string;
|
|
22
|
+
required: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type TranslationList = {
|
|
25
|
+
requiredFieldError: string;
|
|
26
|
+
lengthTextError: string;
|
|
27
|
+
numericError: string;
|
|
28
|
+
alphaNumWithSpacesError: string;
|
|
29
|
+
alphaNumericError: string;
|
|
30
|
+
alphaError: string;
|
|
31
|
+
emailError: string;
|
|
32
|
+
phoneError: string;
|
|
33
|
+
postalCodeError: string;
|
|
34
|
+
urlError: string;
|
|
35
|
+
nameError: string;
|
|
36
|
+
};
|
|
37
|
+
export declare enum InputValidation {
|
|
38
|
+
Numeric = "numeric",
|
|
39
|
+
AlphanumWithSpaces = "alphanum-with-spaces",
|
|
40
|
+
Alphanumeric = "alphanumeric",
|
|
41
|
+
Alpha = "alpha",
|
|
42
|
+
Email = "email",
|
|
43
|
+
Phone = "phone",
|
|
44
|
+
PostalCode = "postal-code",
|
|
45
|
+
Length = "length",
|
|
46
|
+
Url = "url",
|
|
47
|
+
Name = "name"
|
|
48
|
+
}
|
|
49
|
+
export declare const validateNumeric: (value: string) => boolean;
|
|
50
|
+
export declare const validateAlphanumeric: (value: string) => boolean;
|
|
51
|
+
export declare const validateAlphanumWithSpaces: (value: string) => boolean;
|
|
52
|
+
export declare const validateAlpha: (value: string) => boolean;
|
|
53
|
+
export declare const validateEmail: (value: string) => boolean;
|
|
54
|
+
export declare const validatePhone: (value: string) => boolean;
|
|
55
|
+
export declare const validateUrl: (value: string) => boolean;
|
|
56
|
+
export declare const validatePostalCode: (value: string) => boolean;
|
|
57
|
+
export declare const validateName: (value: string) => boolean;
|
|
58
|
+
export declare const validateLength: (value: string, minLength: number, maxLength: number) => boolean;
|
|
59
|
+
export declare const validationFields: (value: string, configs: ValidationFieldsConfig, translations: TranslationList, errorsList: ErrorsList) => {
|
|
60
|
+
[x: string]: string;
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=fieldValidationRules.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TranslationList } from './fieldValidationRules';
|
|
2
|
+
import { FieldsProps } from '../../../types/form.types';
|
|
3
|
+
|
|
4
|
+
export type ValidationResult = {
|
|
5
|
+
isValid: boolean;
|
|
6
|
+
fieldErrors: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
export type FormValidationConfig = {
|
|
9
|
+
fieldsConfig: FieldsProps[];
|
|
10
|
+
translations: TranslationList;
|
|
11
|
+
};
|
|
12
|
+
export declare const validateField: (fieldCode: string, value: string | string[] | number | boolean, config: FormValidationConfig) => string;
|
|
13
|
+
export declare const validateAllFields: (formData: Record<string, string | string[] | number | boolean>, config: FormValidationConfig) => ValidationResult;
|
|
14
|
+
export declare const updateFieldError: (currentErrors: Record<string, string>, fieldCode: string, errorMessage: string) => Record<string, string>;
|
|
15
|
+
export declare const validateSingleField: (fieldCode: string, value: string | string[] | number | boolean, fieldsConfig: FieldsProps[], translations: any) => string;
|
|
16
|
+
export declare const validateFormData: (formData: Record<string, string | string[] | number | boolean>, fieldsConfig: FieldsProps[], translations: any) => ValidationResult;
|
|
17
|
+
//# sourceMappingURL=formValidation.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FieldsProps } from '../../../types/form.types';
|
|
2
|
+
import { CompanyFormData } from '../../../data/models/company';
|
|
3
|
+
|
|
4
|
+
export interface CompanyFieldsConfigOptions {
|
|
5
|
+
formData?: Partial<CompanyFormData>;
|
|
6
|
+
isRequiredRegion?: boolean;
|
|
7
|
+
isRequiredPostCode?: boolean;
|
|
8
|
+
hasRegions?: boolean;
|
|
9
|
+
disableField?: boolean;
|
|
10
|
+
translations: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
export declare const getCompanyFieldsConfig: (options: CompanyFieldsConfigOptions) => FieldsProps[];
|
|
13
|
+
//# sourceMappingURL=getCompanyFieldsConfig.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 './Form';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/********************************************************************
|
|
2
|
+
* ADOBE CONFIDENTIAL
|
|
3
|
+
* __________________
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2025 Adobe
|
|
6
|
+
* All Rights Reserved.
|
|
7
|
+
*
|
|
8
|
+
* NOTICE: All information contained herein is, and remains
|
|
9
|
+
* the property of Adobe and its suppliers, if any. The intellectual
|
|
10
|
+
* and technical concepts contained herein are proprietary to Adobe
|
|
11
|
+
* and its suppliers and are protected by all applicable intellectual
|
|
12
|
+
* property laws, including trade secret and copyright laws.
|
|
13
|
+
* Dissemination of this information or reproduction of this material
|
|
14
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
15
|
+
* from Adobe.
|
|
16
|
+
*******************************************************************/
|
|
17
|
+
export * from './CompanyRegistrationForm';
|
|
18
|
+
export * from './Form';
|
|
19
|
+
export { CompanyRegistrationForm as default } from './CompanyRegistrationForm';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { Company } from '../../data/models/company';
|
|
3
|
+
|
|
4
|
+
export interface CompanyRegistrationSuccessProps {
|
|
5
|
+
company: Company;
|
|
6
|
+
}
|
|
7
|
+
export declare const CompanyRegistrationSuccess: FunctionComponent<CompanyRegistrationSuccessProps>;
|
|
8
|
+
//# sourceMappingURL=CompanyRegistrationSuccess.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 './CompanyRegistrationSuccess';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { CompanyStructureCardProps } from '../../types/companyStructure.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CompanyStructureCard component for managing company organizational structure
|
|
6
|
+
* Displays a tree view of company users and teams with CRUD operations
|
|
7
|
+
*
|
|
8
|
+
* @param permissions - User permissions for editing company structure
|
|
9
|
+
* @param slots - Customizable rendering slots for different parts of the component
|
|
10
|
+
*/
|
|
11
|
+
export declare const CompanyStructureCard: FunctionComponent<CompanyStructureCardProps>;
|
|
12
|
+
//# sourceMappingURL=CompanyStructureCard.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 './CompanyStructureCard';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { HTMLAttributes } from 'preact/compat';
|
|
3
|
+
|
|
4
|
+
export declare const COMPANY_CREATE_URL = "/customer/company/create";
|
|
5
|
+
export interface CompanyStructureEmptyProps extends HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
createCompanyAccountUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const CompanyStructureEmpty: FunctionComponent<CompanyStructureEmptyProps>;
|
|
9
|
+
//# sourceMappingURL=CompanyStructureEmpty.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 './CompanyStructureEmpty';
|
|
18
|
+
export { CompanyStructureEmpty as default } from './CompanyStructureEmpty';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FunctionComponent } from 'preact';
|
|
2
|
+
import { CompanyTeamFormProps } from '../../types/companyForm.types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CompanyTeamForm component for creating and editing company teams
|
|
6
|
+
* Provides form fields for team information including name and description
|
|
7
|
+
*
|
|
8
|
+
* @param mode - Whether this is an 'add' or 'edit' operation
|
|
9
|
+
* @param entityId - ID of the team being edited (for edit mode)
|
|
10
|
+
* @param parentStructureId - ID of the parent structure node
|
|
11
|
+
* @param permissions - User permissions for editing teams
|
|
12
|
+
* @param onSaved - Callback when team is successfully saved
|
|
13
|
+
* @param onCancel - Callback when form is cancelled
|
|
14
|
+
*/
|
|
15
|
+
export declare const CompanyTeamForm: FunctionComponent<CompanyTeamFormProps>;
|
|
16
|
+
export default CompanyTeamForm;
|
|
17
|
+
//# sourceMappingURL=CompanyTeamForm.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 './CompanyTeamForm';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|