@kanda-libs/ks-component-ts 0.2.327 → 0.2.329

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kanda-libs/ks-component-ts",
3
- "version": "0.2.327",
3
+ "version": "0.2.329",
4
4
  "description": "Kanda form component library",
5
5
  "main": "dist/index.esm.js",
6
6
  "module": "dist/index.esm.js",
@@ -0,0 +1,38 @@
1
+ import * as t from "io-ts";
2
+
3
+ export const Category = t.type({
4
+ section: t.union([
5
+ t.literal("introduction_to_regulators"),
6
+ t.literal("what_is_an_i/ar"),
7
+ t.literal("fca_expectations_of_i/ars"),
8
+ t.literal("our_permissions"),
9
+ t.literal("conduct"),
10
+ t.literal("consumer_duty"),
11
+ t.literal("financial_promotions"),
12
+ t.literal("kyc"),
13
+ t.literal("abc"),
14
+ t.literal("whilstblowing"),
15
+ t.literal("vulnerable_customers"),
16
+ t.literal("customer_data"),
17
+ t.literal("customer_complaints"),
18
+ ]),
19
+ number_of_quizzes: t.number,
20
+ });
21
+
22
+ export interface Category {
23
+ section:
24
+ | "introduction_to_regulators"
25
+ | "what_is_an_i/ar"
26
+ | "fca_expectations_of_i/ars"
27
+ | "our_permissions"
28
+ | "conduct"
29
+ | "consumer_duty"
30
+ | "financial_promotions"
31
+ | "kyc"
32
+ | "abc"
33
+ | "whilstblowing"
34
+ | "vulnerable_customers"
35
+ | "customer_data"
36
+ | "customer_complaints";
37
+ number_of_quizzes: number;
38
+ }
@@ -0,0 +1,24 @@
1
+ import * as t from "io-ts";
2
+ import { Category } from "./Category";
3
+
4
+ export const Quiz = t.intersection([
5
+ t.type({
6
+ question: t.string,
7
+ answers: t.array(t.string),
8
+ }),
9
+ t.partial({
10
+ category: Category,
11
+ videoId: t.string,
12
+ user_answer: t.string,
13
+ correct_answer: t.string,
14
+ }),
15
+ ]);
16
+
17
+ export interface Quiz {
18
+ category?: Category;
19
+ question: string;
20
+ videoId?: string;
21
+ answers: Array<string>;
22
+ user_answer?: string;
23
+ correct_answer?: string;
24
+ }
@@ -0,0 +1,39 @@
1
+ import * as t from "io-ts";
2
+ import { Category } from "./Category";
3
+ import { Metadata } from "./Metadata";
4
+ import { Quiz } from "./Quiz";
5
+
6
+ export const Training = t.intersection([
7
+ t.type({
8
+ categories: t.array(Category),
9
+ }),
10
+ t.partial({
11
+ id: t.string,
12
+ cid: t.string,
13
+ eid: t.string,
14
+ bid: t.string,
15
+ aid: t.string,
16
+ oid: t.string,
17
+ quizzes: t.array(Quiz),
18
+ result: t.union([
19
+ t.literal("MISSING"),
20
+ t.literal("PASSED"),
21
+ t.literal("FAILED"),
22
+ t.literal("VOIDED"),
23
+ ]),
24
+ metadata: Metadata,
25
+ }),
26
+ ]);
27
+
28
+ export interface Training {
29
+ id?: string;
30
+ cid?: string;
31
+ eid?: string;
32
+ bid?: string;
33
+ aid?: string;
34
+ oid?: string;
35
+ categories: Array<Category>;
36
+ quizzes?: Array<Quiz>;
37
+ result?: "MISSING" | "PASSED" | "FAILED" | "VOIDED";
38
+ metadata?: Metadata;
39
+ }
@@ -1,12 +1,14 @@
1
1
  import * as t from "io-ts";
2
2
 
3
3
  export const WelcomeSkipBanner = t.partial({
4
+ director_verification: t.union([t.literal("yes"), t.literal("no")]),
4
5
  invite_team_member: t.union([t.literal("yes"), t.literal("no")]),
5
6
  update_website: t.union([t.literal("yes"), t.literal("no")]),
6
7
  advert_finance_calculator: t.union([t.literal("yes"), t.literal("no")]),
7
8
  });
8
9
 
9
10
  export interface WelcomeSkipBanner {
11
+ director_verification?: "yes" | "no";
10
12
  invite_team_member?: "yes" | "no";
11
13
  update_website?: "yes" | "no";
12
14
  advert_finance_calculator?: "yes" | "no";
@@ -7,6 +7,7 @@ export * from "./AuthUser";
7
7
  export * from "./BankAccount";
8
8
  export * from "./Branding";
9
9
  export * from "./Cache";
10
+ export * from "./Category";
10
11
  export * from "./CheckoutOption";
11
12
  export * from "./CommContext";
12
13
  export * from "./CommPreferences";
@@ -82,6 +83,7 @@ export * from "./PaymentOption";
82
83
  export * from "./Pence";
83
84
  export * from "./PreferenceOption";
84
85
  export * from "./PurchaseEvent";
86
+ export * from "./Quiz";
85
87
  export * from "./Rate";
86
88
  export * from "./RedirectURLs";
87
89
  export * from "./Referral";
@@ -99,6 +101,7 @@ export * from "./Tally";
99
101
  export * from "./Title";
100
102
  export * from "./TradeFilter";
101
103
  export * from "./TradeSummary";
104
+ export * from "./Training";
102
105
  export * from "./UserEvent";
103
106
  export * from "./UserType";
104
107
  export * from "./UTM";
@@ -0,0 +1,29 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type DeleteTrainingRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const deleteTrainingOperation = {
9
+ path: "/api/training/{id}",
10
+ method: "delete",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Training },
13
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
14
+ },
15
+ parameters: [
16
+ {
17
+ _tag: "FormParameter",
18
+ explode: false,
19
+ in: "path",
20
+ name: "id",
21
+ },
22
+ ],
23
+ requestDefaultHeaders: { Accept: "application/json" },
24
+ } as const;
25
+
26
+ export type DeleteTrainingRequestFunction = RequestFunction<
27
+ { params: DeleteTrainingRequestParameters },
28
+ schemas.Training
29
+ >;
@@ -0,0 +1,29 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type GetTrainingRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const getTrainingOperation = {
9
+ path: "/api/training/{id}",
10
+ method: "get",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Training },
13
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
14
+ },
15
+ parameters: [
16
+ {
17
+ _tag: "FormParameter",
18
+ explode: false,
19
+ in: "path",
20
+ name: "id",
21
+ },
22
+ ],
23
+ requestDefaultHeaders: { Accept: "application/json" },
24
+ } as const;
25
+
26
+ export type GetTrainingRequestFunction = RequestFunction<
27
+ { params: GetTrainingRequestParameters },
28
+ schemas.Training
29
+ >;
@@ -0,0 +1,25 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as t from "io-ts";
3
+ import * as parameters from "../components/parameters";
4
+ import * as schemas from "../components/schemas";
5
+
6
+ export type GetTrainingsRequestParameters = {
7
+ format?: "reduced" | "full";
8
+ q?: string;
9
+ };
10
+
11
+ export const getTrainingsOperation = {
12
+ path: "/api/training",
13
+ method: "get",
14
+ responses: {
15
+ "200": { _tag: "JsonResponse", decoder: t.array(schemas.Training) },
16
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
17
+ },
18
+ parameters: [parameters.format, parameters.q],
19
+ requestDefaultHeaders: { Accept: "application/json" },
20
+ } as const;
21
+
22
+ export type GetTrainingsRequestFunction = RequestFunction<
23
+ { params: GetTrainingsRequestParameters },
24
+ Array<schemas.Training>
25
+ >;
@@ -76,6 +76,10 @@ import {
76
76
  deleteSubscriptionOperation,
77
77
  DeleteSubscriptionRequestFunction,
78
78
  } from "./deleteSubscription";
79
+ import {
80
+ deleteTrainingOperation,
81
+ DeleteTrainingRequestFunction,
82
+ } from "./deleteTraining";
79
83
  import {
80
84
  directorCompanyOperation,
81
85
  DirectorCompanyRequestFunction,
@@ -152,6 +156,14 @@ import {
152
156
  getSubscriptionsOperation,
153
157
  GetSubscriptionsRequestFunction,
154
158
  } from "./getSubscriptions";
159
+ import {
160
+ getTrainingOperation,
161
+ GetTrainingRequestFunction,
162
+ } from "./getTraining";
163
+ import {
164
+ getTrainingsOperation,
165
+ GetTrainingsRequestFunction,
166
+ } from "./getTrainings";
155
167
  import { infoAuthOperation, InfoAuthRequestFunction } from "./infoAuth";
156
168
  import {
157
169
  infoCheckoutRedirectOperation,
@@ -327,6 +339,10 @@ import {
327
339
  postSubscriptionOperation,
328
340
  PostSubscriptionRequestFunction,
329
341
  } from "./postSubscription";
342
+ import {
343
+ postTrainingOperation,
344
+ PostTrainingRequestFunction,
345
+ } from "./postTraining";
330
346
  import {
331
347
  providerCheckWebhookOperation,
332
348
  ProviderCheckWebhookRequestFunction,
@@ -360,6 +376,10 @@ import {
360
376
  putSubscriptionOperation,
361
377
  PutSubscriptionRequestFunction,
362
378
  } from "./putSubscription";
379
+ import {
380
+ putTrainingOperation,
381
+ PutTrainingRequestFunction,
382
+ } from "./putTraining";
363
383
  import {
364
384
  quoteCreditOperation,
365
385
  QuoteCreditRequestFunction,
@@ -519,6 +539,11 @@ export const operations: Operations = {
519
539
  putSubscription: putSubscriptionOperation,
520
540
  deleteSubscription: deleteSubscriptionOperation,
521
541
  pendingSubscription: pendingSubscriptionOperation,
542
+ getTrainings: getTrainingsOperation,
543
+ postTraining: postTrainingOperation,
544
+ getTraining: getTrainingOperation,
545
+ putTraining: putTrainingOperation,
546
+ deleteTraining: deleteTrainingOperation,
522
547
  getRates: getRatesOperation,
523
548
  postRate: postRateOperation,
524
549
  getRate: getRateOperation,
@@ -661,6 +686,11 @@ export interface OperationRequestFunctionMap {
661
686
  putSubscription: PutSubscriptionRequestFunction;
662
687
  deleteSubscription: DeleteSubscriptionRequestFunction;
663
688
  pendingSubscription: PendingSubscriptionRequestFunction;
689
+ getTrainings: GetTrainingsRequestFunction;
690
+ postTraining: PostTrainingRequestFunction;
691
+ getTraining: GetTrainingRequestFunction;
692
+ putTraining: PutTrainingRequestFunction;
693
+ deleteTraining: DeleteTrainingRequestFunction;
664
694
  getRates: GetRatesRequestFunction;
665
695
  postRate: PostRateRequestFunction;
666
696
  getRate: GetRateRequestFunction;
@@ -961,6 +991,14 @@ export const requestFunctionsBuilder = (
961
991
  operations.pendingSubscription,
962
992
  requestAdapter
963
993
  ),
994
+ getTrainings: requestFunctionBuilder(operations.getTrainings, requestAdapter),
995
+ postTraining: requestFunctionBuilder(operations.postTraining, requestAdapter),
996
+ getTraining: requestFunctionBuilder(operations.getTraining, requestAdapter),
997
+ putTraining: requestFunctionBuilder(operations.putTraining, requestAdapter),
998
+ deleteTraining: requestFunctionBuilder(
999
+ operations.deleteTraining,
1000
+ requestAdapter
1001
+ ),
964
1002
  getRates: requestFunctionBuilder(operations.getRates, requestAdapter),
965
1003
  postRate: requestFunctionBuilder(operations.postRate, requestAdapter),
966
1004
  getRate: requestFunctionBuilder(operations.getRate, requestAdapter),
@@ -1266,6 +1304,16 @@ export const subscriptionServiceBuilder = (
1266
1304
  pendingSubscription: requestFunctions.pendingSubscription,
1267
1305
  });
1268
1306
 
1307
+ export const trainingServiceBuilder = (
1308
+ requestFunctions: OperationRequestFunctionMap
1309
+ ) => ({
1310
+ getTrainings: requestFunctions.getTrainings,
1311
+ postTraining: requestFunctions.postTraining,
1312
+ getTraining: requestFunctions.getTraining,
1313
+ putTraining: requestFunctions.putTraining,
1314
+ deleteTraining: requestFunctions.deleteTraining,
1315
+ });
1316
+
1269
1317
  export const monitorServiceBuilder = (
1270
1318
  requestFunctions: OperationRequestFunctionMap
1271
1319
  ) => ({
@@ -1421,6 +1469,11 @@ export interface Operations {
1421
1469
  putSubscription: typeof putSubscriptionOperation;
1422
1470
  deleteSubscription: typeof deleteSubscriptionOperation;
1423
1471
  pendingSubscription: typeof pendingSubscriptionOperation;
1472
+ getTrainings: typeof getTrainingsOperation;
1473
+ postTraining: typeof postTrainingOperation;
1474
+ getTraining: typeof getTrainingOperation;
1475
+ putTraining: typeof putTrainingOperation;
1476
+ deleteTraining: typeof deleteTrainingOperation;
1424
1477
  getRates: typeof getRatesOperation;
1425
1478
  postRate: typeof postRateOperation;
1426
1479
  getRate: typeof getRateOperation;
@@ -0,0 +1,24 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export const postTrainingOperation = {
5
+ path: "/api/training",
6
+ method: "post",
7
+ responses: {
8
+ "200": { _tag: "JsonResponse", decoder: schemas.Training },
9
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
10
+ },
11
+ parameters: [],
12
+ requestDefaultHeaders: {
13
+ "Content-Type": "application/json",
14
+ Accept: "application/json",
15
+ },
16
+ body: {
17
+ _tag: "JsonBody",
18
+ },
19
+ } as const;
20
+
21
+ export type PostTrainingRequestFunction = RequestFunction<
22
+ { body: schemas.Training },
23
+ schemas.Training
24
+ >;
@@ -0,0 +1,35 @@
1
+ import type { RequestFunction } from "@openapi-io-ts/runtime";
2
+ import * as schemas from "../components/schemas";
3
+
4
+ export type PutTrainingRequestParameters = {
5
+ id: string;
6
+ };
7
+
8
+ export const putTrainingOperation = {
9
+ path: "/api/training/{id}",
10
+ method: "put",
11
+ responses: {
12
+ "200": { _tag: "JsonResponse", decoder: schemas.Training },
13
+ default: { _tag: "JsonResponse", decoder: schemas.Error },
14
+ },
15
+ parameters: [
16
+ {
17
+ _tag: "FormParameter",
18
+ explode: false,
19
+ in: "path",
20
+ name: "id",
21
+ },
22
+ ],
23
+ requestDefaultHeaders: {
24
+ "Content-Type": "application/json",
25
+ Accept: "application/json",
26
+ },
27
+ body: {
28
+ _tag: "JsonBody",
29
+ },
30
+ } as const;
31
+
32
+ export type PutTrainingRequestFunction = RequestFunction<
33
+ { params: PutTrainingRequestParameters; body: schemas.Training },
34
+ schemas.Training
35
+ >;