diff --git a/strr-base-web/app/composables/useStrrBaseBusiness.ts b/strr-base-web/app/composables/useStrrBaseBusiness.ts index 5738db88..b59f2547 100644 --- a/strr-base-web/app/composables/useStrrBaseBusiness.ts +++ b/strr-base-web/app/composables/useStrrBaseBusiness.ts @@ -1,6 +1,4 @@ -// TODO: move to strr-base-web layer import { z } from 'zod' -import { getRequiredAddress, getRequiredNonEmptyString, optionalOrEmptyString } from '~/utils/connect-validation' export const useStrrBaseBusiness = () => { const { t } = useI18n() @@ -8,7 +6,7 @@ export const useStrrBaseBusiness = () => { return z.object({ legalName: getRequiredNonEmptyString(t('validation.business.legalName')), homeJurisdiction: optionalOrEmptyString, - businessNumber: optionalOrEmptyString, + businessNumber: getOptionalBn15(t('validation.business.bn15')), mailingAddress: getRequiredAddress( t('validation.address.street'), t('validation.address.city'), diff --git a/strr-base-web/app/locales/en-CA.ts b/strr-base-web/app/locales/en-CA.ts index 1b86478f..181e47d0 100644 --- a/strr-base-web/app/locales/en-CA.ts +++ b/strr-base-web/app/locales/en-CA.ts @@ -433,6 +433,7 @@ export default { site: 'Please enter a valid full url for this brand (i.e. https://www.bcregistry.gov.bc.ca)' }, business: { + bn15: 'Please enter a valid 15-character business number (e.g., 123456789BC0001)', legalName: 'Please enter the legal name', jurisdiction: 'Please enter the business home jurisdiction', cpbc: 'Please enter a valid CPBC number' @@ -492,7 +493,7 @@ export default { hint: { businessLegalNamePlatform: 'The full legal name of the platform service provider', businessLegalNameStrataHotel: 'The full legal name of the business that is operating the strata-titled hotel or motel. Include corporate designations (e.g., “Ltd.”, “Inc.”, “LLC.”)', - businessNumber: 'Canada Revenue Agency (CRA) Business Number', + businessNumber: '15-character business number (e.g., 123456789BC0001)', humeJurisdiction: 'The regional or federal jurisdiction where the business was incorporated or registered, if applicable', position: 'Enter your current job title or position' }, diff --git a/strr-base-web/app/utils/connect-validation/business-number.ts b/strr-base-web/app/utils/connect-validation/business-number.ts new file mode 100644 index 00000000..60a9b2c6 --- /dev/null +++ b/strr-base-web/app/utils/connect-validation/business-number.ts @@ -0,0 +1,12 @@ +import { z } from 'zod' + +export const bn15Rgx = /^\d{9}[A-Za-z]{2}\d{4}$/ + +export const getOptionalBn15 = (message: string) => z + .string() + .refine(val => val === '' || bn15Rgx.test(val), message) + .optional() + +export const getRequiredBn15 = (message: string) => z + .string() + .refine(val => bn15Rgx.test(val), message) diff --git a/strr-base-web/app/utils/connect-validation/index.ts b/strr-base-web/app/utils/connect-validation/index.ts index 8ed6a1c7..83b28103 100644 --- a/strr-base-web/app/utils/connect-validation/index.ts +++ b/strr-base-web/app/utils/connect-validation/index.ts @@ -1,6 +1,7 @@ import { z } from 'zod' export * from './address' +export * from './business-number' export * from './email' export * from './folio-number' export * from './name' diff --git a/strr-host-pm-web/app/components/form/AddOwners/input/Business.vue b/strr-host-pm-web/app/components/form/AddOwners/input/Business.vue index 4c6f5240..2364c39c 100644 --- a/strr-host-pm-web/app/components/form/AddOwners/input/Business.vue +++ b/strr-host-pm-web/app/components/form/AddOwners/input/Business.vue @@ -55,6 +55,8 @@ defineEmits<{ :aria-label="$t('label.busNumOpt')" name="businessNumber" :placeholder="$t('label.busNumOpt')" + :help="$t('strr.hint.businessNumber')" + mask="#########@@####" /> { :title="$t('strr.section.subTitle.individualName')" :error="showErrors && hasFormErrors(ownerFormRef, ['firstName', 'middleName', 'lastName'])" > -
+
{ ])" > -
+

{{ $t('text.unitAddressIntro') }}

{{ $t('text.unitAddressIntroNote') }}

@@ -146,7 +146,7 @@ onMounted(async () => { :form-ref="unitAddressFormRef" :unit-number-required="propStore.isUnitNumberRequired" /> -
+
{ // TODO: pull common pieces of this and useStrrContactStore into base composable @@ -28,7 +29,7 @@ export const useHostOwnerStore = defineStore('host/owner', () => { businessLegalName: type === OwnerType.BUSINESS ? getRequiredNonEmptyString(t('validation.business.legalName')) : optionalOrEmptyString, - businessNumber: optionalOrEmptyString, + businessNumber: getOptionalBn15(t('validation.business.bn15')), dateOfBirth: type === OwnerType.INDIVIDUAL && role === OwnerRole.HOST ? getRequiredNonEmptyString(t('validation.dateOfBirth')) : optionalOrEmptyString, diff --git a/strr-platform-web/app/components/form/platform/BusinessDetails.vue b/strr-platform-web/app/components/form/platform/BusinessDetails.vue index edf5ab2e..a0eed75f 100644 --- a/strr-platform-web/app/components/form/platform/BusinessDetails.vue +++ b/strr-platform-web/app/components/form/platform/BusinessDetails.vue @@ -103,6 +103,8 @@ onMounted(async () => { :aria-label="$t('label.busNumOpt')" name="businessNumber" :placeholder="$t('label.busNumOpt')" + :help="$t('strr.hint.businessNumber')" + mask="#########@@####" /> { :aria-label="$t('label.busNumOpt')" name="businessNumber" :placeholder="$t('label.busNumOpt')" + :help="$t('strr.hint.businessNumber')" + mask="#########@@####" />
diff --git a/strr-strata-web/package.json b/strr-strata-web/package.json index 608d8838..b11e75fd 100644 --- a/strr-strata-web/package.json +++ b/strr-strata-web/package.json @@ -2,7 +2,7 @@ "name": "strr-strata-web", "private": true, "type": "module", - "version": "0.0.16", + "version": "0.0.17", "scripts": { "build-check": "nuxt build", "build": "nuxt generate",