@stripchatdev/ext-helper 0.1.44 → 0.1.46

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.
@@ -0,0 +1,16 @@
1
+ import { useState as a, useSyncExternalStore as n } from "react";
2
+ import { createSlotStateClient as r } from "./index.js";
3
+ const c = ({
4
+ channel: s,
5
+ extHelper: o
6
+ }) => {
7
+ const [t] = a(() => r({ channel: s, extHelper: o })), e = n(t.subscribe, t.getSnapshot);
8
+ return {
9
+ isLoading: e.isLoading,
10
+ setState: t.setState,
11
+ state: e.state
12
+ };
13
+ };
14
+ export {
15
+ c as useSlotState
16
+ };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare const createExtHelper: () => ExtHelper;
2
2
 
3
- declare class ExtHelper {
3
+ declare class ExtHelper implements TExtHelper {
4
4
  private rpcClient;
5
5
  private subscriber;
6
6
  private crashReporter;
@@ -42,6 +42,13 @@ export declare type TEvents = TV1Events;
42
42
  /** UUID */
43
43
  export declare type TExtensionId = string;
44
44
 
45
+ declare type TExtHelper = {
46
+ bootstrap(): void;
47
+ makeRequest<M extends Extract<keyof TApiContract['methods'], string>>(method: M, params: TApiContract['methods'][M]['params']): Promise<TApiContract['methods'][M]['result']>;
48
+ subscribe<E extends Extract<keyof TApiContract['events'], string>>(eventName: E, handler: TAnyPubSubHandler<TApiContract['events'][E]>): void;
49
+ unsubscribe<E extends Extract<keyof TApiContract['events'], string>>(eventName: E, handler?: TAnyPubSubHandler<TApiContract['events'][E]>): void;
50
+ };
51
+
45
52
  declare type TExtHelperProps = {
46
53
  frameId: string;
47
54
  serverId: string;
@@ -74,8 +81,8 @@ export declare type TModelId = TUserId;
74
81
  /**
75
82
  * Status of the movable overlay.
76
83
  * `active` - pulsing green
77
- * `inactive` - orange
78
- * `connecting` - green
84
+ * `inactive` - green
85
+ * `connecting` - orange
79
86
  * `error` - red
80
87
  */
81
88
  export declare type TMovableOverlayStatus = 'active' | 'inactive' | 'connecting' | 'error';
@@ -461,7 +468,8 @@ declare type TV1ModelMethods = {
461
468
  };
462
469
  };
463
470
 
464
- export declare type TV1ModelStatus = Exclude<(typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES], 'spy'>;
471
+ /** Status that indicates which type of show model is producing now */
472
+ export declare type TV1ModelStatus = Exclude<TV1ShowStatus, 'spy'>;
465
473
 
466
474
  declare type TV1MonitoringMethods = {
467
475
  'v1.monitoring.report.error': {
@@ -627,6 +635,8 @@ export declare type TV1SessionUpdate = {
627
635
 
628
636
  export declare type TV1SessionWhisperData = TUnknownDictionary;
629
637
 
638
+ export declare type TV1ShowStatus = (typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES];
639
+
630
640
  declare type TV1StorageMethods = {
631
641
  'v1.storage.int.get': {
632
642
  params: {
@@ -970,18 +980,27 @@ export declare type TV1UsersFanClubSubscribed = {
970
980
  tier: TV1FanClubTier;
971
981
  };
972
982
 
973
- export declare type TV1UserStatus = Exclude<(typeof V1_SHOW_STATUSES)[keyof typeof V1_SHOW_STATUSES], 'idle'>;
983
+ /** Status that indicates which type of show user is watching now */
984
+ export declare type TV1UserStatus = Exclude<TV1ShowStatus, 'idle'>;
974
985
 
975
986
  export declare type TV1WhisperData = TUnknownDictionary;
976
987
 
977
988
  export declare const V1_SHOW_STATUSES: {
989
+ /** Ticket show */
978
990
  readonly STATUS_TICKET_SHOW: "ticketShow";
991
+ /** Group show */
979
992
  readonly STATUS_GROUP_SHOW: "groupShow";
993
+ /** Model is not on the site */
980
994
  readonly STATUS_OFF: "off";
995
+ /** Private show */
981
996
  readonly STATUS_PRIVATE: "private";
997
+ /** Exclusive private show */
982
998
  readonly STATUS_EXCLUSIVE_PRIVATE: "exclusivePrivate";
999
+ /** Public show */
983
1000
  readonly STATUS_PUBLIC: "public";
1001
+ /** Model is idle but on the site */
984
1002
  readonly STATUS_IDLE: "idle";
1003
+ /** In spy mode */
985
1004
  readonly STATUS_SPY: "spy";
986
1005
  };
987
1006
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stripchatdev/ext-helper",
3
3
  "private": false,
4
- "version": "0.1.44",
4
+ "version": "0.1.46",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "module": "./dist/ext-helper.js",
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "build:code": "vite build",
11
11
  "build:clean": "rm -rf ./dist ./dist-types",
12
- "build:types": "tsc -b --force && api-extractor run --local",
12
+ "build:types": "tsc -b --force && api-extractor run --local -c api-extractor.json && api-extractor run --local -c api-extractor.helpers.json && api-extractor run --local -c api-extractor.helpers-react.json",
13
13
  "build:clean-artefacts": "rm -rf ./dist-types",
14
14
  "build": "npm run build:clean && npm run build:code && npm run build:types && npm run build:clean-artefacts"
15
15
  },
@@ -27,9 +27,27 @@
27
27
  "types": "./dist/index.d.ts",
28
28
  "import": "./dist/ext-helper.js",
29
29
  "default": "./dist/ext-helper.js"
30
+ },
31
+ "./helpers": {
32
+ "types": "./dist/helpers/index.d.ts",
33
+ "import": "./dist/helpers/index.js",
34
+ "default": "./dist/helpers/index.js"
35
+ },
36
+ "./helpers/react": {
37
+ "types": "./dist/helpers/react.d.ts",
38
+ "import": "./dist/helpers/react.js",
39
+ "default": "./dist/helpers/react.js"
30
40
  }
31
41
  },
32
42
  "dependencies": {
33
43
  "ulid": "*"
44
+ },
45
+ "peerDependencies": {
46
+ "react": ">=18"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "react": {
50
+ "optional": true
51
+ }
34
52
  }
35
53
  }