import { submissionService } from '@oneblink/sdk-core'; /** * Get the locale (e.g. `en-AU`) for the current tenant. * * #### Example * * ```js * const locale = localisationService.getLocale() * ``` * * @returns */ export declare function getLocale(): "en-AU" | "en-US"; /** * Get the distance units (e.g. `feet` & 'ft) for the current tenant. * * #### Example * * ```js * const { distanceUnit, distanceUnitShortName } = * localisationService.getDistanceUnits() * ``` * * @returns */ export declare function getDistanceUnits(): { distanceUnit: string; distanceUnitShortName: string; }; export declare function getDateFnsFormats(): { time: string; shortDate: string; shortYearlessDate: string; longDate: string; longYearlessDate: string; shortDateTime: string; longDateTime: string; }; /** * Format a `Date` as a `string` that just contains the date portion e.g. * _31/01/2020_ * * #### Example * * ```js * const date = new Date() * const text = localisationService.formatDate(date) * // Display text * ``` * * @param value * @returns */ export declare function formatDate(value: Date): string; /** * Format a `Date` as a `string` that just contains the date portion in a long * format e.g. _Thursday, 2 January 2020_ * * #### Example * * ```js * const date = new Date() * const text = localisationService.formatDateLong(date) * // Display text * ``` * * @param value * @returns */ export declare function formatDateLong(value: Date): string; /** * Format a `Date` as a `string` that just contains the time portion e.g. _5:31 * pm_ * * #### Example * * ```js * const date = new Date() * const text = localisationService.formatTime(date) * // Display text * ``` * * @param value * @returns */ export declare function formatTime(value: Date): string; /** * Format a `Date` as a `string` that contains the date and time portions e.g. * _31/01/2020 5:31 pm_ * * #### Example * * ```js * const date = new Date() * const text = localisationService.formatDatetime(date) * // Display text * ``` * * @param value * @returns */ export declare function formatDatetime(value: Date): string; /** * Format a `Date` as a `string` that contains the date and time portions in a * long format e.g. _Thursday, 2 January 2020 5:31 pm_ * * #### Example * * ```js * const date = new Date() * const text = localisationService.formatDatetime(date) * // Display text * ``` * * @param value * @returns */ export declare function formatDatetimeLong(value: Date): string; /** * Format a `number` as a `string` represented as a readable number e.g. * _123,321.123_ * * #### Example * * ```js * const amount = 1234.4321 * const text = localisationService.formatCurrency(amount) * // Display text * ``` * * @param value * @returns */ export declare function formatNumber(value: number): string; /** * Format a `number` as a `string` represented as a currency e.g. _$123.31_ * * #### Example * * ```js * const amount = 123.321 * const text = localisationService.formatCurrency(amount) * // Display text * ``` * * @param value * @returns */ export declare function formatCurrency(value: number): string; /** * Generate a `Date` based a `string` while adding/subtracting a number of days. * Use this function to generate a date with the correct time if only the date * part is required to be formatted for display purposes. Also supports passing * `'NOW'` as the value to get the current date with an offset. * * #### Example * * ```js * const dateOnly = localisationService.generateDate({ * value: '2023-05-04', * dateOnly: true, * daysOffset: undefined, * }) * * const date = localisationService.generateDate({ * value: '2023-05-04T02:49:23.616Z', * dateOnly: false, * daysOffset: undefined, * }) * * const now = localisationService.generateDate({ * value: 'NOW', * dateOnly: false, * daysOffset: undefined, * }) * ``` * * @param options * @returns */ export declare function generateDate({ daysOffset, value, }: { daysOffset: number | undefined; value: string; }): Date | undefined; export declare const replaceSubmissionFormatters: submissionService.ReplaceInjectablesFormatters; /** * Replace the `{ELEMENT:}` values in text after a successful form * submission as well as other replaceable parameters e.g. `submissionId`. The * replacements are suppose to be user friendly and for display purposes, e.g. * dates should be displayed in the user's desired format and timezone. * * @param text * @param options * @returns */ export declare function replaceInjectablesWithSubmissionValues(text: string, options: Omit[1], keyof submissionService.ReplaceInjectablesFormatters>): ReturnType; /** * Replace the `{ELEMENT:}` values in text while a form is being * filled out. The replacements are suppose to be user friendly and for display * purposes, e.g. dates should be displayed in the user's desired format and * timezone. * * @param text * @param options * @returns */ export declare function replaceInjectablesWithElementValues(text: string, options: Omit[1], keyof submissionService.ReplaceInjectablesFormatters>): ReturnType;