@star-insure/sdk 1.1.0 → 1.1.3

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.
Files changed (94) hide show
  1. package/{dist/index.d.ts → index.js} +4 -3
  2. package/package.json +5 -11
  3. package/src/components/forms/RegistrationSearchField.tsx +2 -1
  4. package/dist/components/common/Button.d.ts +0 -14
  5. package/dist/components/common/Card.d.ts +0 -7
  6. package/dist/components/common/Modal.d.ts +0 -9
  7. package/dist/components/common/Pagination.d.ts +0 -9
  8. package/dist/components/common/ToastItem.d.ts +0 -3
  9. package/dist/components/common/Toasts.d.ts +0 -2
  10. package/dist/components/common/index.d.ts +0 -7
  11. package/dist/components/forms/DateOfBirthField.d.ts +0 -7
  12. package/dist/components/forms/Errors.d.ts +0 -10
  13. package/dist/components/forms/FormTester.d.ts +0 -6
  14. package/dist/components/forms/MoneyField.d.ts +0 -11
  15. package/dist/components/forms/RegistrationSearchField.d.ts +0 -23
  16. package/dist/components/forms/index.d.ts +0 -6
  17. package/dist/components/index.d.ts +0 -3
  18. package/dist/components/tables/Table.d.ts +0 -6
  19. package/dist/components/tables/TableActions.d.ts +0 -7
  20. package/dist/components/tables/TableBody.d.ts +0 -7
  21. package/dist/components/tables/TableCell.d.ts +0 -7
  22. package/dist/components/tables/TableHead.d.ts +0 -7
  23. package/dist/components/tables/TableHeader.d.ts +0 -9
  24. package/dist/components/tables/TableRow.d.ts +0 -8
  25. package/dist/components/tables/index.d.ts +0 -8
  26. package/dist/index.js +0 -8
  27. package/dist/lib/addressFinder.d.ts +0 -54
  28. package/dist/lib/auth.d.ts +0 -2
  29. package/dist/lib/calculateAge.d.ts +0 -5
  30. package/dist/lib/clickOutside.d.ts +0 -1
  31. package/dist/lib/dates.d.ts +0 -8
  32. package/dist/lib/index.d.ts +0 -12
  33. package/dist/lib/inertiaOptions.d.ts +0 -6
  34. package/dist/lib/localStorage.d.ts +0 -1
  35. package/dist/lib/money.d.ts +0 -32
  36. package/dist/lib/quoteRequestForm.d.ts +0 -19
  37. package/dist/lib/quoteRequestOptions.d.ts +0 -11
  38. package/dist/lib/toast.d.ts +0 -10
  39. package/dist/lib/vehicles.d.ts +0 -2
  40. package/dist/sdk.cjs.development.js +0 -2005
  41. package/dist/sdk.cjs.development.js.map +0 -1
  42. package/dist/sdk.cjs.production.min.js +0 -2
  43. package/dist/sdk.cjs.production.min.js.map +0 -1
  44. package/dist/sdk.esm.js +0 -1955
  45. package/dist/sdk.esm.js.map +0 -1
  46. package/dist/types/api/auth.d.ts +0 -9
  47. package/dist/types/api/enums.d.ts +0 -4
  48. package/dist/types/api/index.d.ts +0 -31
  49. package/dist/types/api/responses/claimRequestActions.d.ts +0 -12
  50. package/dist/types/api/responses/index.d.ts +0 -1
  51. package/dist/types/index.d.ts +0 -3
  52. package/dist/types/misc/index.d.ts +0 -8
  53. package/dist/types/misc/inertia.d.ts +0 -8
  54. package/dist/types/models/auth/Group.d.ts +0 -10
  55. package/dist/types/models/auth/Permission.d.ts +0 -4
  56. package/dist/types/models/auth/Role.d.ts +0 -6
  57. package/dist/types/models/auth/User.d.ts +0 -12
  58. package/dist/types/models/auth/index.d.ts +0 -4
  59. package/dist/types/models/claims/ClaimRequest.d.ts +0 -287
  60. package/dist/types/models/claims/index.d.ts +0 -1
  61. package/dist/types/models/index.d.ts +0 -6
  62. package/dist/types/models/oracle/Risk.d.ts +0 -8
  63. package/dist/types/models/oracle/TableData.d.ts +0 -9
  64. package/dist/types/models/oracle/index.d.ts +0 -2
  65. package/dist/types/models/payments/Gateways.d.ts +0 -1
  66. package/dist/types/models/payments/Payment.d.ts +0 -35
  67. package/dist/types/models/payments/index.d.ts +0 -2
  68. package/dist/types/models/quotes/Club.d.ts +0 -4
  69. package/dist/types/models/quotes/EmailContentOption.d.ts +0 -7
  70. package/dist/types/models/quotes/InformationRequest.d.ts +0 -34
  71. package/dist/types/models/quotes/Lead.d.ts +0 -17
  72. package/dist/types/models/quotes/MotorwebVehicle.d.ts +0 -120
  73. package/dist/types/models/quotes/PolicyBenefit.d.ts +0 -16
  74. package/dist/types/models/quotes/PolicyEnhancement.d.ts +0 -11
  75. package/dist/types/models/quotes/PostalAddress.d.ts +0 -7
  76. package/dist/types/models/quotes/PromoCode.d.ts +0 -18
  77. package/dist/types/models/quotes/QuoteRequest.d.ts +0 -88
  78. package/dist/types/models/quotes/QuoteRequestDeclaration.d.ts +0 -22
  79. package/dist/types/models/quotes/QuoteRequestForm.d.ts +0 -112
  80. package/dist/types/models/quotes/QuoteRequestIncident.d.ts +0 -5
  81. package/dist/types/models/quotes/QuoteRequestLog.d.ts +0 -10
  82. package/dist/types/models/quotes/QuoteRequestOptions.d.ts +0 -59
  83. package/dist/types/models/quotes/QuoteRequestPurchaseOption.d.ts +0 -35
  84. package/dist/types/models/quotes/QuoteRequestReferrer.d.ts +0 -7
  85. package/dist/types/models/quotes/QuoteRequestReferrerCategory.d.ts +0 -4
  86. package/dist/types/models/quotes/QuoteRequestVehicle.d.ts +0 -20
  87. package/dist/types/models/quotes/QuoteRequestVehicleDriver.d.ts +0 -10
  88. package/dist/types/models/quotes/RedbookVehicle.d.ts +0 -55
  89. package/dist/types/models/quotes/StreetAddress.d.ts +0 -8
  90. package/dist/types/models/quotes/index.d.ts +0 -22
  91. package/dist/types/models/sms-messages/SmsContentOption.d.ts +0 -7
  92. package/dist/types/models/sms-messages/SmsMessage.d.ts +0 -18
  93. package/dist/types/models/sms-messages/SmsMessageReply.d.ts +0 -10
  94. package/dist/types/models/sms-messages/index.d.ts +0 -3
@@ -1,3 +1,4 @@
1
- export * from './types';
2
- export * from './lib';
3
- export * from './components';
1
+ export * from './types';
2
+ export * from './lib';
3
+ export * from './components';
4
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "name": "@star-insure/sdk",
3
3
  "description": "The SDK for Star Insure client apps with shared helper functions and TypeScript definitions.",
4
4
  "author": "alexclark_nz",
5
- "version": "1.1.0",
5
+ "version": "1.1.3",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/star-insure/sdk"
10
10
  },
11
- "main": "dist/index.js",
12
- "typings": "dist/index.d.ts",
11
+ "main": "index.js",
12
+ "typings": "index.d.ts",
13
13
  "files": [
14
14
  "dist",
15
15
  "src"
@@ -18,14 +18,8 @@
18
18
  "node": ">=10"
19
19
  },
20
20
  "scripts": {
21
- "dev": "tsdx watch",
22
- "start": "tsdx watch",
23
- "build": "tsdx build",
24
- "test": "tsdx test",
25
- "lint": "tsdx lint",
26
- "prepare": "tsdx build",
27
- "size": "size-limit",
28
- "analyze": "size-limit --why"
21
+ "dev": "tsc",
22
+ "build": "tsc"
29
23
  },
30
24
  "husky": {
31
25
  "hooks": {
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { ApiResponse, FormStatus, MotorwebVehicleResponse, sanitiseVehicleType, VehicleType } from '../../';
2
+ import { sanitiseVehicleType } from '../../lib';
3
+ import { ApiResponse, FormStatus, MotorwebVehicleResponse, VehicleType } from '../../types';
3
4
  import { useToast } from '../../lib/toast';
4
5
 
5
6
  export interface VehicleData extends MotorwebVehicleResponse {
@@ -1,14 +0,0 @@
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 {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- className?: string;
4
- children: React.ReactNode;
5
- }
6
- export default function Card({ className, children }: Props): JSX.Element;
7
- export {};
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- children: React.ReactNode;
4
- isActive?: boolean;
5
- onClose: () => void;
6
- title?: string;
7
- }
8
- export default function Modal({ children, isActive, onClose, title }: Props): JSX.Element;
9
- export {};
@@ -1,9 +0,0 @@
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 {};
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import type { Toast } from '../../types';
3
- export default function ToastItem({ _id, message, status }: Toast): JSX.Element;
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export default function Toasts(): JSX.Element;
@@ -1,7 +0,0 @@
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, };
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- interface Props {
3
- value?: string;
4
- onChange: (newValue: string) => void;
5
- }
6
- export default function DateOfBirthField({ value, onChange }: Props): JSX.Element;
7
- export {};
@@ -1,10 +0,0 @@
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 {};
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- interface Props {
3
- populatePurchaseOptions: boolean;
4
- }
5
- export default function FormTester({ populatePurchaseOptions }: Props): JSX.Element;
6
- export {};
@@ -1,11 +0,0 @@
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 {};
@@ -1,23 +0,0 @@
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 {};
@@ -1,6 +0,0 @@
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, };
@@ -1,3 +0,0 @@
1
- export * from './common';
2
- export * from './tables';
3
- export * from './forms';
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- children: React.ReactNode;
4
- }
5
- export default function Table({ children }: Props): JSX.Element;
6
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- children: React.ReactNode;
4
- className?: string;
5
- }
6
- export default function TableActions({ children, className }: Props): JSX.Element;
7
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- children: React.ReactNode;
4
- className?: string;
5
- }
6
- export default function TableBody({ children, className }: Props): JSX.Element;
7
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- children: React.ReactNode;
4
- className?: string;
5
- }
6
- export default function TableCell({ children, className }: Props): JSX.Element;
7
- export {};
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- children: React.ReactNode;
4
- className?: string;
5
- }
6
- export default function TableHead({ children, className }: Props): JSX.Element;
7
- export {};
@@ -1,9 +0,0 @@
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 {};
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- interface Props {
3
- children: React.ReactNode;
4
- className?: string;
5
- onClick?: () => void;
6
- }
7
- export default function TableRow({ children, className, onClick }: Props): JSX.Element;
8
- export {};
@@ -1,8 +0,0 @@
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.js DELETED
@@ -1,8 +0,0 @@
1
-
2
- 'use strict'
3
-
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./sdk.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./sdk.cjs.development.js')
8
- }
@@ -1,54 +0,0 @@
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>;
@@ -1,2 +0,0 @@
1
- import type { AuthContext } from '../types';
2
- export declare function useAuth(): AuthContext;
@@ -1,5 +0,0 @@
1
- /**
2
- * Calculate someone's age from a date of birth.
3
- * @param date YYYY-MM-DD
4
- */
5
- export declare function calculateAge(date: string): number;
@@ -1 +0,0 @@
1
- export declare function useClickOutside(ref: any, handler: (e: Event) => void): void;
@@ -1,8 +0,0 @@
1
- /**
2
- * Formats a date like "Jan 1, 2022 at 9:50am"
3
- */
4
- export declare function formatDateNice(date: string, includeTime?: boolean): string;
5
- /**
6
- * Formats a date like "01/01/2022 9:50AM"
7
- */
8
- export declare function formatDateForTable(date: string, includeTime?: boolean): string;
@@ -1,12 +0,0 @@
1
- export * from './dates';
2
- export * from './money';
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';
@@ -1,6 +0,0 @@
1
- import type { VisitOptions } from '@inertiajs/inertia/types';
2
- interface Options {
3
- successMessage?: string;
4
- }
5
- export declare function useInertiaOptions({ successMessage }: Options): VisitOptions;
6
- export {};
@@ -1 +0,0 @@
1
- export declare function useLocalStorage<T>(key: string, initialValue: T): readonly [T, (value: T | ((val: T) => T)) => void];
@@ -1,32 +0,0 @@
1
- /**
2
- * Safely rounds a number
3
- */
4
- export declare function round(value: number): number;
5
- /**
6
- * Gets the GST value from a number
7
- */
8
- export declare function getGst(value: number): number;
9
- /**
10
- * Adds GST to a number
11
- */
12
- export declare function addGst(value: number): number;
13
- /**
14
- * Subtracts GST from a number
15
- */
16
- export declare function subtractGst(value: number): number;
17
- /**
18
- * Calculates the various GST values on a figure
19
- */
20
- export declare function gstCalc(input: number | string): {
21
- gst: number;
22
- amountInclusive: number;
23
- amountExclusive: number;
24
- };
25
- /**
26
- * Formats a value nicely
27
- */
28
- export declare function formatMoney(value: string | number, decimals?: number): string;
29
- /**
30
- * Turns a formatted value in to a float
31
- */
32
- export declare function formatNumber(value: string): number;
@@ -1,19 +0,0 @@
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 {};
@@ -1,11 +0,0 @@
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 {};
@@ -1,10 +0,0 @@
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 {};
@@ -1,2 +0,0 @@
1
- import { VehicleType } from "../types";
2
- export declare function sanitiseVehicleType(inputType: string): VehicleType;