@amazon-devices/kepler-parental-controls 1.0.8
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/LICENSE +7 -0
- package/LICENSE.TXT +8 -0
- package/SystemBundles/769c9bbaf8d8b9d87ee60e838e9198ec534452e488850274aa9c0c38b87c343a.bundle +1113 -0
- package/SystemBundles/769c9bbaf8d8b9d87ee60e838e9198ec534452e488850274aa9c0c38b87c343a.bundle.map +1 -0
- package/SystemModules/amzn__kepler-parental-controls-1.modules.txt +5 -0
- package/SystemModules/amzn__kepler-parental-controls-1.private.modules.txt +12 -0
- package/SystemModules/keplerscript-system-bundle-config.json +7 -0
- package/THIRD_PARTY_NOTICES.txt +6512 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +17 -0
- package/dist/kepler/tm-manifest.json +1 -0
- package/dist/lib/KeplerParentalControls.d.ts +23 -0
- package/dist/lib/KeplerParentalControls.js +57 -0
- package/dist/models/ParentalControlsComponent.d.ts +59 -0
- package/dist/models/ParentalControlsComponent.js +15 -0
- package/dist/models/ParentalControlsModel.d.ts +80 -0
- package/dist/models/ParentalControlsModel.js +15 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +15 -0
- package/dist/turbo-modules/KeplerPconJs.d.ts +14 -0
- package/dist/turbo-modules/KeplerPconJs.js +19 -0
- package/dist/turbo-modules/KeplerPconResultWrapper.d.ts +9 -0
- package/dist/turbo-modules/KeplerPconResultWrapper.js +37 -0
- package/dist/turbo-modules/__mocks__/KeplerPconJs.d.ts +10 -0
- package/dist/turbo-modules/__mocks__/KeplerPconJs.js +25 -0
- package/dist/turbo-modules/lib/TurboModuleResult.d.ts +57 -0
- package/dist/turbo-modules/lib/TurboModuleResult.js +82 -0
- package/dist/turbo-modules/lib/index.d.ts +2 -0
- package/dist/turbo-modules/lib/index.js +20 -0
- package/kepler-compatibility.json +13 -0
- package/kepler-transformed-package-info.json +3 -0
- package/package.json +1 -0
- package/react-native.config.js +14 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default as ParentalControlsComponent } from './lib/KeplerParentalControls';
|
|
2
|
+
export type { IParentalControlsComponent } from './models/ParentalControlsComponent';
|
|
3
|
+
export type { IContentRestrictionLevel, IGateContentPlaybackResponse, IParentalControlsPreferenceReader, } from './models';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var KeplerParentalControls_1 = require("./lib/KeplerParentalControls");
|
|
17
|
+
Object.defineProperty(exports, "ParentalControlsComponent", { enumerable: true, get: function () { return KeplerParentalControls_1.default; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schema":1,"fileSets":{"native":[{"arch":"aarch64","variant":"release","directoryPath":"aarch64-release"},{"arch":"armv7","variant":"release","directoryPath":"armv7-release"},{"arch":"x86_64","variant":"release","directoryPath":"x86_64-release"},{"arch":"aarch64","variant":"debug","directoryPath":"aarch64-debug"},{"arch":"armv7","variant":"debug","directoryPath":"armv7-debug"},{"arch":"x86_64","variant":"debug","directoryPath":"x86_64-debug"}]}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IContentRating } from '@amazon-devices/kepler-media-content-metadata';
|
|
2
|
+
import { IContentRestrictionLevel, IGateContentPlaybackResponse, IParentalControlsPreferenceReader } from '../models';
|
|
3
|
+
import { IParentalControlsComponent } from '../models';
|
|
4
|
+
/**
|
|
5
|
+
* A module-private implementation of IParentalControlsComponent that invokes the TM.
|
|
6
|
+
* Factory-constructed by ParentalControlsComponent.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ParentalControlsPreferenceReaderTmGlue implements IParentalControlsPreferenceReader {
|
|
9
|
+
isEnabled(): Promise<boolean>;
|
|
10
|
+
getContentRestrictionLevel(): Promise<IContentRestrictionLevel>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Concrete implementation of IParentalControlsComponent.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ParentalControlsComponentTmGlue implements IParentalControlsComponent {
|
|
16
|
+
makePreferenceReader(): IParentalControlsPreferenceReader;
|
|
17
|
+
gateContentPlayback(contentRating?: IContentRating): Promise<IGateContentPlaybackResponse>;
|
|
18
|
+
getMajorVersion(): number;
|
|
19
|
+
getMinorVersion(): number;
|
|
20
|
+
getPatchVersion(): number;
|
|
21
|
+
}
|
|
22
|
+
declare const instance: IParentalControlsComponent;
|
|
23
|
+
export default instance;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.ParentalControlsComponentTmGlue = exports.ParentalControlsPreferenceReaderTmGlue = void 0;
|
|
20
|
+
const KeplerPconJs_1 = __importDefault(require("../turbo-modules/KeplerPconJs"));
|
|
21
|
+
const KeplerPconResultWrapper_1 = require("../turbo-modules/KeplerPconResultWrapper");
|
|
22
|
+
/**
|
|
23
|
+
* A module-private implementation of IParentalControlsComponent that invokes the TM.
|
|
24
|
+
* Factory-constructed by ParentalControlsComponent.
|
|
25
|
+
*/
|
|
26
|
+
class ParentalControlsPreferenceReaderTmGlue {
|
|
27
|
+
isEnabled() {
|
|
28
|
+
return KeplerPconResultWrapper_1.translatePconAsyncTurboModuleResponse(KeplerPconJs_1.default.preferenceReader_isEnabled());
|
|
29
|
+
}
|
|
30
|
+
getContentRestrictionLevel() {
|
|
31
|
+
return KeplerPconResultWrapper_1.translatePconAsyncTurboModuleResponse(KeplerPconJs_1.default.preferenceReader_getContentRestrictionLevel());
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ParentalControlsPreferenceReaderTmGlue = ParentalControlsPreferenceReaderTmGlue;
|
|
35
|
+
/**
|
|
36
|
+
* Concrete implementation of IParentalControlsComponent.
|
|
37
|
+
*/
|
|
38
|
+
class ParentalControlsComponentTmGlue {
|
|
39
|
+
makePreferenceReader() {
|
|
40
|
+
return new ParentalControlsPreferenceReaderTmGlue();
|
|
41
|
+
}
|
|
42
|
+
gateContentPlayback(contentRating) {
|
|
43
|
+
return KeplerPconResultWrapper_1.translatePconAsyncTurboModuleResponse(KeplerPconJs_1.default.gateContentPlayback(contentRating ?? {}));
|
|
44
|
+
}
|
|
45
|
+
getMajorVersion() {
|
|
46
|
+
return KeplerPconJs_1.default.getMajorVersion();
|
|
47
|
+
}
|
|
48
|
+
getMinorVersion() {
|
|
49
|
+
return KeplerPconJs_1.default.getMinorVersion();
|
|
50
|
+
}
|
|
51
|
+
getPatchVersion() {
|
|
52
|
+
return KeplerPconJs_1.default.getPatchVersion();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.ParentalControlsComponentTmGlue = ParentalControlsComponentTmGlue;
|
|
56
|
+
const instance = new ParentalControlsComponentTmGlue();
|
|
57
|
+
exports.default = instance;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { IContentRating } from '@amazon-devices/kepler-media-content-metadata';
|
|
2
|
+
import { IGateContentPlaybackResponse, IParentalControlsPreferenceReader } from './ParentalControlsModel';
|
|
3
|
+
/**
|
|
4
|
+
* This is the top-level component used for interfacing with parental controls.
|
|
5
|
+
*/
|
|
6
|
+
export interface IParentalControlsComponent {
|
|
7
|
+
/**
|
|
8
|
+
* Construct an IParentalControlsPreferenceReader object, used for getting
|
|
9
|
+
* the current state of Parental Controls preference settings and
|
|
10
|
+
* determining whether Parental Controls is enabled.
|
|
11
|
+
*/
|
|
12
|
+
makePreferenceReader(): IParentalControlsPreferenceReader;
|
|
13
|
+
/**
|
|
14
|
+
* @brief Invoke PIN challenge for viewing potentially restricted content.
|
|
15
|
+
*
|
|
16
|
+
* This method delegates to parental controls to decide whether a PIN
|
|
17
|
+
* challenge is required before permitting the viewing of content with the
|
|
18
|
+
* passed rating information. The ratings parameter is optional; if ratings
|
|
19
|
+
* information is not supplied (such as in the case that it is not
|
|
20
|
+
* available) this method defaults to requiring the PIN challenge.
|
|
21
|
+
*
|
|
22
|
+
* If the rating information passed is *more restrictive* than permitted by
|
|
23
|
+
* the current restriction level preference, this method will present a PIN
|
|
24
|
+
* challenge to the user in the form of an unescapable modal dialog; that
|
|
25
|
+
* is, the user must either successfully validate their PIN or cancel the
|
|
26
|
+
* validation. Attempts to navigate away from the PIN challenge (such as by
|
|
27
|
+
* pressing back or a provider shortcut on the remote) will implicitly
|
|
28
|
+
* cancel PIN validation. The action that should be taken by the caller is
|
|
29
|
+
* relayed in the resolved IGateContentPlaybackResponse#canPlaybackProceed
|
|
30
|
+
* value.
|
|
31
|
+
*
|
|
32
|
+
* The returned Promise is resolved once the request has been resolved by
|
|
33
|
+
* parental controls (either because the PIN challenge was successfully
|
|
34
|
+
* validated or was unnecessary). The modal dialog has *no timeout*, so
|
|
35
|
+
* integrators should take into account that the Promise may not be resolved
|
|
36
|
+
* immediately. The parental controls dialog will remain in the foreground
|
|
37
|
+
* (as an overlay over the calling app) until it is resolved.
|
|
38
|
+
*
|
|
39
|
+
* @param contentRating rating for the content that is a
|
|
40
|
+
* candidate for playback. This field is optional and may be ommitted such
|
|
41
|
+
* as in the case that ratings information is unavailable; in that case parental controls
|
|
42
|
+
* will require a PIN challenge irrespective of the current restriction
|
|
43
|
+
* level.
|
|
44
|
+
*
|
|
45
|
+
* @returns a Promise that resolves to an IGateContentPlaybackResponse indicating
|
|
46
|
+
* the outcome of the request (and PIN challenge if it was required).
|
|
47
|
+
*
|
|
48
|
+
* @pre caller requires privilege
|
|
49
|
+
* `com.amazon.kepler.parental_controls.gates.restricted-content-playback`
|
|
50
|
+
* to invoke this method.
|
|
51
|
+
*
|
|
52
|
+
* @pre caller must be an interactive application that is presently running in the
|
|
53
|
+
* foreground.
|
|
54
|
+
*/
|
|
55
|
+
gateContentPlayback(contentRating?: IContentRating): Promise<IGateContentPlaybackResponse>;
|
|
56
|
+
getMajorVersion(): number;
|
|
57
|
+
getMinorVersion(): number;
|
|
58
|
+
getPatchVersion(): number;
|
|
59
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { IContentRating } from '@amazon-devices/kepler-media-content-metadata';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the concept of Parental Controls' content restriction level
|
|
4
|
+
* preference, a set of ratings for which content with a rating that is equally
|
|
5
|
+
* or less restrictive may be played without a PIN challenge.
|
|
6
|
+
* Restriction levels are defined per region.
|
|
7
|
+
* Information about restriction levels, including their names and allowed ratings,
|
|
8
|
+
* should always be queried (not assumed or hardcoded).
|
|
9
|
+
*/
|
|
10
|
+
export interface IContentRestrictionLevel {
|
|
11
|
+
/**
|
|
12
|
+
* Get the name used to identify this restriction level.
|
|
13
|
+
* Restriction level `name`s are non-localized identifiers that are
|
|
14
|
+
* unique within a region.
|
|
15
|
+
*/
|
|
16
|
+
readonly name: string;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the list of content ratings that are the *upper bound* of what is
|
|
19
|
+
* permissible for viewing *without* a PIN challenge when this restriction
|
|
20
|
+
* level is not blocked. It is implied that content with less restrictive
|
|
21
|
+
* ratings in the same ratings system is also permissible.
|
|
22
|
+
*
|
|
23
|
+
* @returns an unsorted array of content ratings
|
|
24
|
+
*
|
|
25
|
+
* @see getContentRestrictionLevel for the most restrictive restriction level
|
|
26
|
+
* that is currently blocked for the device.
|
|
27
|
+
*/
|
|
28
|
+
readonly allowedContentRatings: IContentRating[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Interface for reading parental controls preferences including the overall
|
|
32
|
+
* enablement state as well as the current media content restriction level.
|
|
33
|
+
*
|
|
34
|
+
* However, regardless of whether parental controls is enabled, querying the
|
|
35
|
+
* *preference* state of getContentRestrictionLevel returns the user's
|
|
36
|
+
* preference for when parental controls is enabled. When `isEnabled() == false`
|
|
37
|
+
* , content restrictions are not actively enforced by Parental Controls.
|
|
38
|
+
*
|
|
39
|
+
* All parental controls preferences are device-local.
|
|
40
|
+
*/
|
|
41
|
+
export interface IParentalControlsPreferenceReader {
|
|
42
|
+
/**
|
|
43
|
+
* Returns the device-local state for whether parental controls is enabled.
|
|
44
|
+
* Parental controls must be enabled for any of the sub-features (such as
|
|
45
|
+
* PIN-protecting app launches or purchases) to take effect.
|
|
46
|
+
*
|
|
47
|
+
* @returns `true` if parental controls is enabled for the device else
|
|
48
|
+
* `false`.
|
|
49
|
+
*/
|
|
50
|
+
isEnabled(): Promise<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Gets the most restrictive restriction level that is currently blocked
|
|
53
|
+
* for the device.
|
|
54
|
+
*
|
|
55
|
+
* Returns the user's device-local preference of what media content playback
|
|
56
|
+
* on this device should be gated by a PIN challenge.
|
|
57
|
+
*
|
|
58
|
+
* @note when `isEnabled() == false`, content restrictions will not be
|
|
59
|
+
* actively enforced by Parental Controls.
|
|
60
|
+
*/
|
|
61
|
+
getContentRestrictionLevel(): Promise<IContentRestrictionLevel>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Response to a IParentalControlsComponent#gateContentPlayback request.
|
|
65
|
+
*/
|
|
66
|
+
export interface IGateContentPlaybackResponse {
|
|
67
|
+
/**
|
|
68
|
+
* Signifies whether content playback should proceed. An application that
|
|
69
|
+
* correctly supports Parental Controls integration must halt playback of
|
|
70
|
+
* the associated requested content.
|
|
71
|
+
*
|
|
72
|
+
* @returns `true` if parental controls's determination is that the playback
|
|
73
|
+
* action may proceed (i.e. PIN validation was successful else not required)
|
|
74
|
+
* else `false`.
|
|
75
|
+
*
|
|
76
|
+
* @note the user's decision to cancel PIN validation is not
|
|
77
|
+
* treated as a failure; instead this accessor will indicate `false`.
|
|
78
|
+
*/
|
|
79
|
+
canPlaybackProceed: boolean;
|
|
80
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
|
+
import { IContentRestrictionLevel, IGateContentPlaybackResponse } from '../models';
|
|
3
|
+
import { IContentRating } from '@amazon-devices/kepler-media-content-metadata';
|
|
4
|
+
import { TurboModuleAsyncResult } from './lib';
|
|
5
|
+
export interface KeplerPconJs extends KeplerTurboModule {
|
|
6
|
+
preferenceReader_isEnabled: () => TurboModuleAsyncResult<boolean>;
|
|
7
|
+
preferenceReader_getContentRestrictionLevel: () => TurboModuleAsyncResult<IContentRestrictionLevel>;
|
|
8
|
+
gateContentPlayback: (contentRating: IContentRating) => TurboModuleAsyncResult<IGateContentPlaybackResponse>;
|
|
9
|
+
getMajorVersion: () => number;
|
|
10
|
+
getMinorVersion: () => number;
|
|
11
|
+
getPatchVersion: () => number;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: KeplerPconJs;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
//@ts-ignore
|
|
17
|
+
const keplerscript_turbomodule_api_1 = require("@amazon-devices/keplerscript-turbomodule-api");
|
|
18
|
+
// prettier-ignore
|
|
19
|
+
exports.default = keplerscript_turbomodule_api_1.TurboModuleRegistry.getEnforcing('AmazonParentalControls');
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TurboModuleAsyncResult, TurboModuleResult } from './lib/TurboModuleResult';
|
|
2
|
+
/**
|
|
3
|
+
* Unwraps an async result, applying the specific error mapping for KeplerPcon-Js.
|
|
4
|
+
*/
|
|
5
|
+
export declare function translatePconAsyncTurboModuleResponse<T>(asyncResult: TurboModuleAsyncResult<T>): Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Unwraps a (synchronous) result, applying the specific error mapping for KeplerPcon-Js.
|
|
8
|
+
*/
|
|
9
|
+
export declare function unwrapPconTurboModuleResponse<T>(result: TurboModuleResult<T>): T;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.unwrapPconTurboModuleResponse = exports.translatePconAsyncTurboModuleResponse = void 0;
|
|
17
|
+
const TurboModuleResult_1 = require("./lib/TurboModuleResult");
|
|
18
|
+
/**
|
|
19
|
+
* @module Contains KeplerMediaContentMetadata-specific configuration of TurboModuleResult's
|
|
20
|
+
* wrapper concept.
|
|
21
|
+
*/
|
|
22
|
+
// Empty to start; derived errors go here
|
|
23
|
+
const pconErrorNameToConstructor = {};
|
|
24
|
+
/**
|
|
25
|
+
* Unwraps an async result, applying the specific error mapping for KeplerPcon-Js.
|
|
26
|
+
*/
|
|
27
|
+
async function translatePconAsyncTurboModuleResponse(asyncResult) {
|
|
28
|
+
return TurboModuleResult_1.translateAsyncTurboModuleResponse(asyncResult, pconErrorNameToConstructor);
|
|
29
|
+
}
|
|
30
|
+
exports.translatePconAsyncTurboModuleResponse = translatePconAsyncTurboModuleResponse;
|
|
31
|
+
/**
|
|
32
|
+
* Unwraps a (synchronous) result, applying the specific error mapping for KeplerPcon-Js.
|
|
33
|
+
*/
|
|
34
|
+
function unwrapPconTurboModuleResponse(result) {
|
|
35
|
+
return TurboModuleResult_1.unwrapResult(result, pconErrorNameToConstructor);
|
|
36
|
+
}
|
|
37
|
+
exports.unwrapPconTurboModuleResponse = unwrapPconTurboModuleResponse;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
getMajorVersion: jest.Mock<any, any>;
|
|
4
|
+
getMinorVersion: jest.Mock<any, any>;
|
|
5
|
+
getPatchVersion: jest.Mock<any, any>;
|
|
6
|
+
preferenceReader_isEnabled: jest.Mock<any, any>;
|
|
7
|
+
preferenceReader_getContentRestrictionLevel: jest.Mock<any, any>;
|
|
8
|
+
gateContentPlayback: jest.Mock<any, any>;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.default = {
|
|
17
|
+
getMajorVersion: jest.fn().mockReturnValue(111),
|
|
18
|
+
getMinorVersion: jest.fn().mockReturnValue(222),
|
|
19
|
+
getPatchVersion: jest.fn().mockReturnValue(333),
|
|
20
|
+
// TM bindings for IParentalControlsPreferenceReader/V2
|
|
21
|
+
preferenceReader_isEnabled: jest.fn(),
|
|
22
|
+
preferenceReader_getContentRestrictionLevel: jest.fn(),
|
|
23
|
+
// TM bindings for IParentalControlsComponent/V2
|
|
24
|
+
gateContentPlayback: jest.fn(),
|
|
25
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Generic result wrapper for Turbo Modules to faciliate returning both values
|
|
3
|
+
* and errors in-band as an ADT-like enum.
|
|
4
|
+
*
|
|
5
|
+
* @todo This code is identical to that used in Parental Controls TM and should be factored.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Wraps a result of type T. This interface is always downcast-able to either:
|
|
9
|
+
* - TurboModuleResultOk<T> on `isSuccess == true`
|
|
10
|
+
* - TurboModuleResultErr on `isSuccess == false`
|
|
11
|
+
*/
|
|
12
|
+
export interface TurboModuleResult<T> {
|
|
13
|
+
readonly isSuccess: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Wraps value of type T on success.
|
|
17
|
+
*/
|
|
18
|
+
export interface TurboModuleResultOk<T> extends TurboModuleResult<T> {
|
|
19
|
+
readonly value: T;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wraps information for mapping error information to an Error type on failure.
|
|
23
|
+
*/
|
|
24
|
+
export interface TurboModuleResultErr extends TurboModuleResult<any> {
|
|
25
|
+
readonly errorName: string;
|
|
26
|
+
readonly errorMessage: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Convenience wrapper for wrapped values within a Promise.
|
|
30
|
+
*/
|
|
31
|
+
export declare type TurboModuleAsyncResult<T> = Promise<TurboModuleResult<T>>;
|
|
32
|
+
export declare type TurboModuleErrorConstructor = new (message: string) => Error;
|
|
33
|
+
export declare type ErrorNameToConstructorMapping = Record<string, TurboModuleErrorConstructor>;
|
|
34
|
+
export declare function makeError(errorName: string, errorMessage: string, errorNameToConstructorMapping: ErrorNameToConstructorMapping): Error;
|
|
35
|
+
/**
|
|
36
|
+
* Unwrap value of type T on success else throw mapped Error type.
|
|
37
|
+
*/
|
|
38
|
+
export declare function unwrapResult<T>(result: TurboModuleResult<T>, errorNameToConstructorMapping: ErrorNameToConstructorMapping): T;
|
|
39
|
+
export declare function translateAsyncTurboModuleResponse<T>(asyncResult: TurboModuleAsyncResult<T>, errorNameToConstructorMapping: ErrorNameToConstructorMapping): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Wraps a value in success-case TurboModuleResult. Since these values are typically
|
|
42
|
+
* constructed on the Turbo Module implementation side (C++), this method is generally
|
|
43
|
+
* only used for mocking/faking Turbo Modules.
|
|
44
|
+
*
|
|
45
|
+
* @param value wrapped value to ensconse in a TurboModuleResultOk<T>.
|
|
46
|
+
* @returns wrapped TurboModuleResultOk<T>
|
|
47
|
+
*/
|
|
48
|
+
export declare function makeTurboModuleResultOk<T>(value: T): TurboModuleResultOk<T>;
|
|
49
|
+
/**
|
|
50
|
+
* Wraps a value in failure-case TurboModuleResult. Since these values are typically
|
|
51
|
+
* constructed on the Turbo Module implementation side (C++), this method is generally
|
|
52
|
+
* only used for mocking/faking Turbo Modules.
|
|
53
|
+
*
|
|
54
|
+
* @param value wrapped value to ensconse in a TurboModuleResultErr.
|
|
55
|
+
* @returns wrapped TurboModuleResultErr
|
|
56
|
+
*/
|
|
57
|
+
export declare function makeTurboModuleResultErr(errorName: string, errorMessage: string): TurboModuleResultErr;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.makeTurboModuleResultErr = exports.makeTurboModuleResultOk = exports.translateAsyncTurboModuleResponse = exports.unwrapResult = exports.makeError = void 0;
|
|
17
|
+
function makeError(errorName, errorMessage, errorNameToConstructorMapping) {
|
|
18
|
+
if (errorName in errorNameToConstructorMapping) {
|
|
19
|
+
const ErrorConstructor = errorNameToConstructorMapping[errorName];
|
|
20
|
+
return new ErrorConstructor(errorMessage);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return new Error(errorName + ': ' + errorMessage);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.makeError = makeError;
|
|
27
|
+
/**
|
|
28
|
+
* Unwrap value of type T on success else throw mapped Error type.
|
|
29
|
+
*/
|
|
30
|
+
function unwrapResult(result, errorNameToConstructorMapping) {
|
|
31
|
+
if (result.isSuccess) {
|
|
32
|
+
return result.value;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const err = result;
|
|
36
|
+
throw makeError(err.errorName, err.errorMessage, errorNameToConstructorMapping);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.unwrapResult = unwrapResult;
|
|
40
|
+
async function translateAsyncTurboModuleResponse(asyncResult, errorNameToConstructorMapping) {
|
|
41
|
+
let result;
|
|
42
|
+
try {
|
|
43
|
+
result = await asyncResult;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw new Error('Unknown error in module Kepler Parental Controls');
|
|
47
|
+
}
|
|
48
|
+
// Returns wrapped value if successful or throws (rejecting Promise) if failure.
|
|
49
|
+
return unwrapResult(result, errorNameToConstructorMapping);
|
|
50
|
+
}
|
|
51
|
+
exports.translateAsyncTurboModuleResponse = translateAsyncTurboModuleResponse;
|
|
52
|
+
/**
|
|
53
|
+
* Wraps a value in success-case TurboModuleResult. Since these values are typically
|
|
54
|
+
* constructed on the Turbo Module implementation side (C++), this method is generally
|
|
55
|
+
* only used for mocking/faking Turbo Modules.
|
|
56
|
+
*
|
|
57
|
+
* @param value wrapped value to ensconse in a TurboModuleResultOk<T>.
|
|
58
|
+
* @returns wrapped TurboModuleResultOk<T>
|
|
59
|
+
*/
|
|
60
|
+
function makeTurboModuleResultOk(value) {
|
|
61
|
+
return {
|
|
62
|
+
isSuccess: true,
|
|
63
|
+
value: value,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.makeTurboModuleResultOk = makeTurboModuleResultOk;
|
|
67
|
+
/**
|
|
68
|
+
* Wraps a value in failure-case TurboModuleResult. Since these values are typically
|
|
69
|
+
* constructed on the Turbo Module implementation side (C++), this method is generally
|
|
70
|
+
* only used for mocking/faking Turbo Modules.
|
|
71
|
+
*
|
|
72
|
+
* @param value wrapped value to ensconse in a TurboModuleResultErr.
|
|
73
|
+
* @returns wrapped TurboModuleResultErr
|
|
74
|
+
*/
|
|
75
|
+
function makeTurboModuleResultErr(errorName, errorMessage) {
|
|
76
|
+
return {
|
|
77
|
+
isSuccess: false,
|
|
78
|
+
errorName: errorName,
|
|
79
|
+
errorMessage: errorMessage,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
exports.makeTurboModuleResultErr = makeTurboModuleResultErr;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { TurboModuleResult, TurboModuleResultOk, TurboModuleAsyncResult, TurboModuleResultErr, TurboModuleErrorConstructor, ErrorNameToConstructorMapping, } from './TurboModuleResult';
|
|
2
|
+
export { unwrapResult, translateAsyncTurboModuleResponse, makeTurboModuleResultOk, makeTurboModuleResultErr, } from './TurboModuleResult';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023-2024 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* AMAZON PROPRIETARY/CONFIDENTIAL
|
|
6
|
+
*
|
|
7
|
+
* You may not use this file except in compliance with the terms and
|
|
8
|
+
* conditions set forth in the accompanying LICENSE.TXT file.
|
|
9
|
+
*
|
|
10
|
+
* THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
11
|
+
* DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
12
|
+
* IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
13
|
+
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
var TurboModuleResult_1 = require("./TurboModuleResult");
|
|
17
|
+
Object.defineProperty(exports, "unwrapResult", { enumerable: true, get: function () { return TurboModuleResult_1.unwrapResult; } });
|
|
18
|
+
Object.defineProperty(exports, "translateAsyncTurboModuleResponse", { enumerable: true, get: function () { return TurboModuleResult_1.translateAsyncTurboModuleResponse; } });
|
|
19
|
+
Object.defineProperty(exports, "makeTurboModuleResultOk", { enumerable: true, get: function () { return TurboModuleResult_1.makeTurboModuleResultOk; } });
|
|
20
|
+
Object.defineProperty(exports, "makeTurboModuleResultErr", { enumerable: true, get: function () { return TurboModuleResult_1.makeTurboModuleResultErr; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"versions": {
|
|
3
|
+
"1.0.0": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
4
|
+
"1.0.1": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
5
|
+
"1.0.2": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
6
|
+
"1.0.3": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
7
|
+
"1.0.4": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
8
|
+
"1.0.5": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
9
|
+
"1.0.6": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
10
|
+
"1.0.7": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0",
|
|
11
|
+
"1.0.8": "/com.amazon.kepler.kepler_parental_controls_1@IKeplerParentalControls_0"
|
|
12
|
+
}
|
|
13
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "@amazon-devices/kepler-parental-controls", "version": "1.0.8", "licence": "SEE LICENSE IN LICENSE.TXT", "main": "dist/index.js", "types": "dist/index.d.ts", "files": ["dist", "react-native.config.js", "THIRD_PARTY_NOTICES.txt", "kepler-compatibility.json", "SystemModules", "SystemBundles", "kepler-transformed-package-info.json"], "scripts": {"clean": "rm -rf bundle kepler-build assets dist", "test:snapshot": "jest --colors --updateSnapshot", "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest --colors", "lint": "eslint src --ext .ts,.tsx --fix && eslint tst --ext .ts,.tsx --fix", "compile": "tsc -p tsconfig-build.json", "checkLicenses": "license-checker --production --exclude MIT,Apache-2.0,BSD-2-Clause,BSD-3-Clause,ISC,0BSD", "generate-attribution": "generate-attribution -o ./.attr && mv .attr/attribution.txt THIRD_PARTY_NOTICES.txt && rm -rf .attr", "build": "npm-run-all lint test compile checkLicenses generate-attribution", "prepublishOnly_DISABLED": "$(brazil-path '[DebugSourceReferenceCheck]pkg.bin')/check_dbg_syms -b build -s kepler", "prepublishOnly_DISABLED_COMMENT": "https://issues.labcollab.net/browse/VEGATV-36457", "prepublishOnly": "KEPLER_NPM_COMMAND=npm-pretty-much react-native build-system-bundle-kepler"}, "dependencies": {"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0", "@amazon-devices/kepler-media-content-metadata": "^1.0.0"}, "devDependencies": {"@react-native-community/eslint-config": "^3.0.1", "@types/jest": "^26.0.20", "@types/node": "^14", "@types/react-native": "0.66.15", "@typescript-eslint/eslint-plugin": "^5.18.0", "@typescript-eslint/parser": "*", "eslint": "^8.12.0", "jest": "^26.6.3", "license-checker": "^25.0.1", "npm-run-all": "^4.1.5", "oss-attribution-generator": "^1.0.0", "prettier": "^2.6.2", "react": ">=17.0.2", "react-native": ">=0.67.3", "ts-jest": "^26", "typescript": "^3.8.3", "@amazon-devices/kepler-cli-platform": "^0", "@react-native-community/cli": "^11.2.0"}, "kepler": {"projectType": "turbomodule", "targets": ["tv"], "features": ["vega"], "api": 0.1, "keplerInitializationSharedLibrary": "AmazonParentalControlsLib"}, "eslintConfig": {"extends": "@react-native-community", "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], "root": true}, "prettier": {"arrowParens": "avoid", "bracketSameLine": true, "bracketSpacing": false, "singleQuote": true, "trailingComma": "all"}, "license": "See license in LICENSE"}
|