Skip to content

Commit

Permalink
Add mobile config types
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherminh committed Dec 7, 2023
1 parent 563ebfd commit 99a33df
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/airgap.js-types",
"description": "TypeScript types for airgap.js interoperability with custom consent UIs",
"version": "10.10.0",
"version": "10.11.0",
"homepage": "https://github.com/transcend-io/airgap.js-types",
"repository": {
"type": "git",
Expand Down Expand Up @@ -48,4 +48,4 @@
"typescript": "^5.3.2"
},
"packageManager": "[email protected]"
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export * from './ui';
export * from './enums';
export * from './constants';
export * from './experience';
export * from './mobile';
36 changes: 36 additions & 0 deletions src/mobile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as t from 'io-ts';

export const ConsentSDK = t.type({
/** Unique identifier for the SDK */
id: t.string,
/** airgap purposes applicable to this SDK */
purposes: t.array(t.string)
});

/**
* Type override
*/
export type ConsentSDK = t.TypeOf<typeof ConsentSDK>;

export const ConsentService = t.intersection([
t.type({
name: t.string,
}),
t.partial({
sdks: t.array(ConsentSDK)
}),
]);

/**
* Type override
*/
export type ConsentService = t.TypeOf<typeof ConsentService>;

export const MobileConfig = t.type({
services: t.array(ConsentService)
});

/**
* Type override
*/
export type MobileConfig = t.TypeOf<typeof MobileConfig>;

0 comments on commit 99a33df

Please sign in to comment.