@star-insure/sdk 1.0.1 → 1.1.0
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/dist/components/common/Button.d.ts +14 -0
- package/dist/components/common/Card.d.ts +7 -0
- package/dist/components/common/Modal.d.ts +9 -0
- package/dist/components/common/Pagination.d.ts +9 -0
- package/dist/components/common/ToastItem.d.ts +3 -0
- package/dist/components/common/Toasts.d.ts +2 -0
- package/dist/components/common/index.d.ts +7 -0
- package/dist/components/forms/DateOfBirthField.d.ts +7 -0
- package/dist/components/forms/Errors.d.ts +10 -0
- package/dist/components/forms/FormTester.d.ts +6 -0
- package/dist/components/forms/MoneyField.d.ts +11 -0
- package/dist/components/forms/RegistrationSearchField.d.ts +23 -0
- package/dist/components/forms/index.d.ts +6 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/tables/Table.d.ts +6 -0
- package/dist/components/tables/TableActions.d.ts +7 -0
- package/dist/components/tables/TableBody.d.ts +7 -0
- package/dist/components/tables/TableCell.d.ts +7 -0
- package/dist/components/tables/TableHead.d.ts +7 -0
- package/dist/components/tables/TableHeader.d.ts +9 -0
- package/dist/components/tables/TableRow.d.ts +8 -0
- package/dist/components/tables/index.d.ts +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/lib/addressFinder.d.ts +54 -0
- package/dist/lib/auth.d.ts +2 -0
- package/dist/lib/calculateAge.d.ts +5 -0
- package/dist/lib/clickOutside.d.ts +1 -0
- package/dist/lib/index.d.ts +9 -0
- package/dist/lib/inertiaOptions.d.ts +6 -0
- package/dist/lib/localStorage.d.ts +1 -0
- package/dist/lib/quoteRequestForm.d.ts +19 -0
- package/dist/lib/quoteRequestOptions.d.ts +11 -0
- package/dist/lib/toast.d.ts +10 -0
- package/dist/sdk.cjs.development.js +1844 -0
- package/dist/sdk.cjs.development.js.map +1 -1
- package/dist/sdk.cjs.production.min.js +1 -1
- package/dist/sdk.cjs.production.min.js.map +1 -1
- package/dist/sdk.esm.js +1808 -1
- package/dist/sdk.esm.js.map +1 -1
- package/package.json +12 -2
- package/src/components/common/Button.tsx +60 -0
- package/src/components/common/Card.tsx +14 -0
- package/src/components/common/Modal.tsx +54 -0
- package/src/components/common/Pagination.tsx +77 -0
- package/src/components/common/ToastItem.tsx +54 -0
- package/src/components/common/Toasts.tsx +16 -0
- package/src/components/common/index.ts +15 -0
- package/src/components/forms/DateOfBirthField.tsx +84 -0
- package/src/components/forms/Errors.tsx +32 -0
- package/src/components/forms/FormTester.tsx +170 -0
- package/src/components/forms/MoneyField.tsx +45 -0
- package/src/components/forms/RegistrationSearchField.tsx +186 -0
- package/src/components/forms/index.ts +13 -0
- package/src/components/index.ts +3 -0
- package/src/components/tables/Table.tsx +19 -0
- package/src/components/tables/TableActions.tsx +14 -0
- package/src/components/tables/TableBody.tsx +14 -0
- package/src/components/tables/TableCell.tsx +14 -0
- package/src/components/tables/TableHead.tsx +14 -0
- package/src/components/tables/TableHeader.tsx +49 -0
- package/src/components/tables/TableRow.tsx +17 -0
- package/src/components/tables/index.ts +17 -0
- package/src/index.ts +1 -0
- package/src/lib/addressFinder.tsx +100 -0
- package/src/lib/auth.tsx +8 -0
- package/src/lib/calculateAge.ts +19 -0
- package/src/lib/clickOutside.tsx +24 -0
- package/src/lib/index.ts +9 -0
- package/src/lib/inertiaOptions.tsx +27 -0
- package/src/lib/localStorage.tsx +41 -0
- package/src/lib/quoteRequestForm.tsx +144 -0
- package/src/lib/quoteRequestOptions.tsx +21 -0
- package/src/lib/toast.tsx +55 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
className?: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
target?: '_blank' | '_self';
|
|
6
|
+
onClick?: Function;
|
|
7
|
+
type?: 'button' | 'submit';
|
|
8
|
+
status?: 'primary' | 'danger' | 'warning' | 'info' | 'default';
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
as?: 'link' | 'button' | 'a';
|
|
12
|
+
}
|
|
13
|
+
export default function Button({ className, href, target, onClick, type, children, status, disabled, as }: Props): JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Meta } from "../../types";
|
|
3
|
+
interface Props {
|
|
4
|
+
className?: string;
|
|
5
|
+
meta: Meta;
|
|
6
|
+
showPerPageSelector?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function Pagination({ meta, className, showPerPageSelector }: Props): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Button from './Button';
|
|
2
|
+
import Card from './Card';
|
|
3
|
+
import Pagination from './Pagination';
|
|
4
|
+
import ToastItem from './ToastItem';
|
|
5
|
+
import Toasts from './Toasts';
|
|
6
|
+
import Modal from './Modal';
|
|
7
|
+
export { Button, Card, Pagination, ToastItem, Toasts, Modal, };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ErrorBag, Errors } from "@inertiajs/inertia";
|
|
3
|
+
interface Props {
|
|
4
|
+
heading?: string;
|
|
5
|
+
errors?: Errors & ErrorBag;
|
|
6
|
+
renderKeys?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export default function Errors({ heading, errors, renderKeys, className }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
value?: number;
|
|
4
|
+
onChange: (value: number) => void;
|
|
5
|
+
id?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export default function MoneyField({ value, onChange, name, id, className, required }: Props): JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MotorwebVehicleResponse, VehicleType } from '../../';
|
|
3
|
+
export interface VehicleData extends MotorwebVehicleResponse {
|
|
4
|
+
make: string;
|
|
5
|
+
model: string;
|
|
6
|
+
year: string;
|
|
7
|
+
vehicle_type: VehicleType;
|
|
8
|
+
is_heavy: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface RegistrationSearchOnChange {
|
|
11
|
+
registration: string;
|
|
12
|
+
}
|
|
13
|
+
interface Props {
|
|
14
|
+
onChange?: (values: RegistrationSearchOnChange) => void;
|
|
15
|
+
onVehicleDataFound: (vehicleData: VehicleData) => void;
|
|
16
|
+
apiUrl?: string;
|
|
17
|
+
showOdometerReadingField?: boolean;
|
|
18
|
+
showConditionField?: boolean;
|
|
19
|
+
initialRegistrationValue?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const conditionOptions: string[];
|
|
22
|
+
export default function RegistrationSearchField({ initialRegistrationValue, onVehicleDataFound, apiUrl, showOdometerReadingField, showConditionField, onChange, }: Props): JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import DateOfBirthField from './DateOfBirthField';
|
|
2
|
+
import MoneyField from './MoneyField';
|
|
3
|
+
import RegistrationSearchField from './RegistrationSearchField';
|
|
4
|
+
import FormTester from './FormTester';
|
|
5
|
+
import Errors from './Errors';
|
|
6
|
+
export { DateOfBirthField, MoneyField, RegistrationSearchField, FormTester, Errors, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Props {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
textAlign?: 'left' | 'right' | 'center';
|
|
6
|
+
sort?: string;
|
|
7
|
+
}
|
|
8
|
+
export default function TableHeader({ children, className, sort, textAlign }: Props): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Table from './Table';
|
|
2
|
+
import TableActions from './TableActions';
|
|
3
|
+
import TableBody from './TableBody';
|
|
4
|
+
import TableCell from './TableCell';
|
|
5
|
+
import TableHead from './TableHead';
|
|
6
|
+
import TableHeader from './TableHeader';
|
|
7
|
+
import TableRow from './TableRow';
|
|
8
|
+
export { Table, TableActions, TableBody, TableCell, TableHead, TableHeader, TableRow, };
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface AddressCompletion {
|
|
2
|
+
a: string;
|
|
3
|
+
pxid: string;
|
|
4
|
+
v: number;
|
|
5
|
+
}
|
|
6
|
+
export interface AddressData {
|
|
7
|
+
pxid: string;
|
|
8
|
+
a: string;
|
|
9
|
+
aims_address_id: string;
|
|
10
|
+
sufi: number;
|
|
11
|
+
ta_id: string;
|
|
12
|
+
ta: string;
|
|
13
|
+
tasub_id: string;
|
|
14
|
+
tasub: string;
|
|
15
|
+
number: string;
|
|
16
|
+
x: string;
|
|
17
|
+
y: string;
|
|
18
|
+
postcode: string;
|
|
19
|
+
street: string;
|
|
20
|
+
street_name: string;
|
|
21
|
+
street_type: string;
|
|
22
|
+
city: string;
|
|
23
|
+
suburb: string;
|
|
24
|
+
region_id: string;
|
|
25
|
+
region: string;
|
|
26
|
+
postal_line_1: string;
|
|
27
|
+
postal_line_2: string;
|
|
28
|
+
aims_road_section_id: string;
|
|
29
|
+
rural: string;
|
|
30
|
+
address_line_1: string;
|
|
31
|
+
address_line_2?: string;
|
|
32
|
+
primary_parcel_id: string;
|
|
33
|
+
meshblock: string;
|
|
34
|
+
sa1_id: string;
|
|
35
|
+
sa2_id: string;
|
|
36
|
+
sa2: string;
|
|
37
|
+
cb_id: string;
|
|
38
|
+
cb: string;
|
|
39
|
+
ward_id: string;
|
|
40
|
+
ward: string;
|
|
41
|
+
con_id: string;
|
|
42
|
+
con: string;
|
|
43
|
+
maoricon_id: string;
|
|
44
|
+
maoricon: string;
|
|
45
|
+
iur_id: string;
|
|
46
|
+
iur: string;
|
|
47
|
+
ur_id: string;
|
|
48
|
+
ur: string;
|
|
49
|
+
landwater_id: string;
|
|
50
|
+
landwater: string;
|
|
51
|
+
success: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare function autocomplete(search: string): Promise<AddressCompletion[]>;
|
|
54
|
+
export declare function getAddressData(completion: AddressCompletion): Promise<AddressData | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useClickOutside(ref: any, handler: (e: Event) => void): void;
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export * from './dates';
|
|
2
2
|
export * from './money';
|
|
3
3
|
export * from './vehicles';
|
|
4
|
+
export * from './auth';
|
|
5
|
+
export * from './clickOutside';
|
|
6
|
+
export * from './inertiaOptions';
|
|
7
|
+
export * from './localStorage';
|
|
8
|
+
export * from './toast';
|
|
9
|
+
export * from './quoteRequestForm';
|
|
10
|
+
export * from './quoteRequestOptions';
|
|
11
|
+
export * from './addressFinder';
|
|
12
|
+
export * from './calculateAge';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useLocalStorage<T>(key: string, initialValue: T): readonly [T, (value: T | ((val: T) => T)) => void];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InertiaFormProps } from "@inertiajs/inertia-react";
|
|
3
|
+
import type { QuoteRequest } from '../types';
|
|
4
|
+
interface QuoteRequestFormContextInterface {
|
|
5
|
+
form?: InertiaFormProps<QuoteRequest>;
|
|
6
|
+
handleChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const initialData: QuoteRequest;
|
|
9
|
+
export declare const QuoteRequestFormContext: React.Context<QuoteRequestFormContextInterface>;
|
|
10
|
+
export declare function QuoteRequestFormProvider({ children }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}): JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Takes in a quote request and returns data suitable to populate a form
|
|
15
|
+
* by recursively calling this function, converting null to undefined.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sanitiseQuoteRequestFormData(value: any): any;
|
|
18
|
+
export declare const useQuoteRequestForm: () => QuoteRequestFormContextInterface;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QuoteRequestOptions } from '../';
|
|
3
|
+
interface QuoteRequestFormContextInterface {
|
|
4
|
+
options?: QuoteRequestOptions;
|
|
5
|
+
setOptions: (options: QuoteRequestOptions) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function QuoteRequestOptionsProvider({ children }: {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}): JSX.Element;
|
|
10
|
+
export declare const useQuoteRequestOptions: () => QuoteRequestFormContextInterface;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Toast } from "../types";
|
|
3
|
+
interface ToastContextInterface {
|
|
4
|
+
toasts: Toast[];
|
|
5
|
+
addToast: (toast: Toast) => void;
|
|
6
|
+
removeToast: (id: Toast['_id']) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ToastProvider({ children }: any): JSX.Element;
|
|
9
|
+
export declare const useToast: () => ToastContextInterface;
|
|
10
|
+
export {};
|