@tiledev/sdk-apptile-live-selling 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -14,11 +14,19 @@ supply, so there is no Shopify dependency.
14
14
  npm i @tiledev/sdk-apptile-live-selling
15
15
  ```
16
16
 
17
- Peers, all optional: `expo`, `react`, `react-native`, `zego-express-engine-reactnative`. Off-device the
18
- engine and PIP resolve to no-ops, so a web or Node bundle needs none of them.
17
+ Peers: `react` and `react-native` are needed by the main entry, which re-exports the React layer;
18
+ `expo` and `zego-express-engine-reactnative` stay optional — off-device the engine and PIP resolve to
19
+ no-ops.
19
20
 
20
- Three entry points: `.` (client, session machine, types), `./react` (providers, hooks, the one
21
- component), `./types` (types alone, for a package that only needs the shapes).
21
+ **Everything ships from the package root**, including the providers, the hooks and `LiveVideoTarget`.
22
+ There is no `./react` subpath — a subpath is reachable only through the `exports` map, which a
23
+ resolver that ignores it (node10, some test runners and bundlers) cannot see at all. What remains
24
+ beside the root is `./types` (types alone) and a wildcard for any module in `dist` — `/session`,
25
+ `/streams`, `/polls` — the escape hatch below.
26
+
27
+ > The root entry pulls in `react-native`, so it no longer loads in a plain Node runtime. Driving the
28
+ > pure data layer from Node — `sessionReducer`, the wire mappers — goes through the module subpaths
29
+ > (`@tiledev/sdk-apptile-live-selling/session`), which stay free of React and react-native.
22
30
 
23
31
  ## 1. Add the config plugin
24
32
 
@@ -95,7 +103,7 @@ player). Own it per screen and whichever unmounts first kills the other's video.
95
103
  ```tsx
96
104
  import {
97
105
  LiveSellingProvider, LiveSessionProvider, useLiveSession, LiveVideoTarget,
98
- } from '@tiledev/sdk-apptile-live-selling/react';
106
+ } from '@tiledev/sdk-apptile-live-selling';
99
107
 
100
108
  <LiveSellingProvider config={config}>
101
109
  <LiveSessionProvider onPipRestore={() => navigate('Live')}>
@@ -293,7 +301,8 @@ Subscribe via `LiveSellingProvider`'s `onEvent` or `liveSelling.engine.subscribe
293
301
  | `npm pack` | The publish tarball — use it to verify `dist`, `ios/`, `android/`, `expo-module.config.json`, `app.plugin.js` and `plugin/build` all ship |
294
302
 
295
303
  The reducer is exported on its own (`sessionReducer`, `deriveStatus`, `timeLeftMs`) and is pure, so it
296
- can be driven with no room, socket or React.
304
+ can be driven with no room, socket or React — from Node, import it as
305
+ `@tiledev/sdk-apptile-live-selling/session` rather than off the root.
297
306
 
298
307
  ## Gotchas
299
308
 
package/dist/index.d.ts CHANGED
@@ -2,8 +2,9 @@
2
2
  * `@tiledev/sdk-apptile-live-selling` — the live-selling integration as a standalone package.
3
3
  *
4
4
  * A typed, imperative client for the Apptile live-selling gateway (streams, auctions, polls, clips,
5
- * replays, co-host guest) driven by one `companyId` brand-id config, plus an optional native Zego
6
- * engine kept behind a platform boundary and optional React helpers under `./react`.
5
+ * replays, co-host guest) driven by one `companyId` brand-id config, plus a native Zego engine kept
6
+ * behind a platform boundary and the React helpers — providers, hooks and `LiveVideoTarget` — all of
7
+ * which ship from this one entry.
7
8
  *
8
9
  * ```ts
9
10
  * import { liveSelling } from '@tiledev/sdk-apptile-live-selling';
@@ -28,4 +29,18 @@ export { livePip, isLivePipSupported } from './pip';
28
29
  export { COMMENT_SOURCES } from './types';
29
30
  export type * from './types';
30
31
  export type * from './sessionTypes';
32
+ /**
33
+ * The React layer — providers, hooks and `LiveVideoTarget`.
34
+ *
35
+ * Exported from here rather than a `./react` subpath: a subpath is reachable only through the
36
+ * package's `exports` map, which a consumer resolving the old way (node10, a bundler or test runner
37
+ * that ignores `exports`) cannot see at all, and one entry every resolver agrees on beats two.
38
+ *
39
+ * It costs this entry its purity — `react` and `react-native` are now loaded with it, so it is no
40
+ * longer importable from a plain Node runtime (react-native ships Flow source). Anything that needs
41
+ * the data layer alone (a replay reducer, a test of `sessionReducer`) imports the module it lives in
42
+ * instead: `@tiledev/sdk-apptile-live-selling/session`, `/streams`, `/polls`, which the package's
43
+ * wildcard subpath serves straight out of `dist`.
44
+ */
45
+ export * from './react/index';
31
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,WAAW,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AAGpE,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAG1D,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,mBAAmB,SAAS,CAAC;AAC7B,mBAAmB,gBAAgB,CAAC"}
1
+ {"version":3,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3
3
  * `@tiledev/sdk-apptile-live-selling` — the live-selling integration as a standalone package.
4
4
  *
5
5
  * A typed, imperative client for the Apptile live-selling gateway (streams, auctions, polls, clips,
6
- * replays, co-host guest) driven by one `companyId` brand-id config, plus an optional native Zego
7
- * engine kept behind a platform boundary and optional React helpers under `./react`.
6
+ * replays, co-host guest) driven by one `companyId` brand-id config, plus a native Zego engine kept
7
+ * behind a platform boundary and the React helpers — providers, hooks and `LiveVideoTarget` — all of
8
+ * which ship from this one entry.
8
9
  *
9
10
  * ```ts
10
11
  * import { liveSelling } from '@tiledev/sdk-apptile-live-selling';
@@ -14,6 +15,20 @@
14
15
  * const { replays } = await liveSelling.replays.list();
15
16
  * ```
16
17
  */
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
31
+ };
17
32
  Object.defineProperty(exports, "__esModule", { value: true });
18
33
  exports.COMMENT_SOURCES = exports.isLivePipSupported = exports.livePip = exports.IDLE_GIVEAWAY = exports.IDLE_AUCTION = exports.REPLAY_CAPABILITIES = exports.AUCTION_CAPABILITIES = exports.LIVE_CAPABILITIES = exports.capabilitiesFor = exports.REACTION_MS = exports.SOLD_CARD_MS = exports.timeLeftMs = exports.remainingMs = exports.deriveStatus = exports.initialSessionState = exports.sessionReducer = exports.displayHost = exports.toUrlPreview = exports.classifyCommentLink = exports.hasCommentLink = exports.toCommentSegments = exports.MAX_VIEWER_NAME = exports.resetCompanyFlagsCache = exports.toMixerLayout = exports.toEmbeddedResults = exports.toLivePollResults = exports.toLivePoll = exports.toGiveawayEntries = exports.toLiveGiveaway = exports.toLiveStreamProduct = exports.toLiveStreams = exports.toLiveStream = exports.toProductGid = exports.LiveSellingError = exports.liveEngine = exports.default = exports.liveSelling = void 0;
19
34
  // The imperative client (default + named).
@@ -67,14 +82,24 @@ Object.defineProperty(exports, "REPLAY_CAPABILITIES", { enumerable: true, get: f
67
82
  Object.defineProperty(exports, "IDLE_AUCTION", { enumerable: true, get: function () { return sessionTypes_1.IDLE_AUCTION; } });
68
83
  Object.defineProperty(exports, "IDLE_GIVEAWAY", { enumerable: true, get: function () { return sessionTypes_1.IDLE_GIVEAWAY; } });
69
84
  // Picture-in-picture, for a host that drives the window itself. No-op off-device.
70
- //
71
- // `nativeViewTag` is deliberately NOT re-exported here: it imports react-native, and this entry has to
72
- // stay loadable in a plain JavaScript runtime (Node, SSR, a test) the way the rest of the data layer is.
73
- // It ships from `/react` instead.
74
85
  var pip_1 = require("./pip");
75
86
  Object.defineProperty(exports, "livePip", { enumerable: true, get: function () { return pip_1.livePip; } });
76
87
  Object.defineProperty(exports, "isLivePipSupported", { enumerable: true, get: function () { return pip_1.isLivePipSupported; } });
77
88
  // The whole public type surface.
78
89
  var types_1 = require("./types");
79
90
  Object.defineProperty(exports, "COMMENT_SOURCES", { enumerable: true, get: function () { return types_1.COMMENT_SOURCES; } });
91
+ /**
92
+ * The React layer — providers, hooks and `LiveVideoTarget`.
93
+ *
94
+ * Exported from here rather than a `./react` subpath: a subpath is reachable only through the
95
+ * package's `exports` map, which a consumer resolving the old way (node10, a bundler or test runner
96
+ * that ignores `exports`) cannot see at all, and one entry every resolver agrees on beats two.
97
+ *
98
+ * It costs this entry its purity — `react` and `react-native` are now loaded with it, so it is no
99
+ * longer importable from a plain Node runtime (react-native ships Flow source). Anything that needs
100
+ * the data layer alone (a replay reducer, a test of `sessionReducer`) imports the module it lives in
101
+ * instead: `@tiledev/sdk-apptile-live-selling/session`, `/streams`, `/polls`, which the package's
102
+ * wildcard subpath serves straight out of `dist`.
103
+ */
104
+ __exportStar(require("./react/index"), exports);
80
105
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2CAA2C;AAC3C,6CAAoE;AAA3D,0GAAA,WAAW,OAAA;AAAE,sGAAA,WAAW,OAAW;AAE5C,0EAA0E;AAC1E,mCAAgD;AAAvC,oGAAA,MAAM,OAAc;AAE7B,uGAAuG;AACvG,mCAA0D;AAAjD,0GAAA,gBAAgB,OAAA;AAAE,sGAAA,YAAY,OAAA;AAEvC,yGAAyG;AACzG,qCAMmB;AALjB,uGAAA,YAAY,OAAA;AACZ,wGAAA,aAAa,OAAA;AACb,8GAAA,mBAAmB,OAAA;AACnB,yGAAA,cAAc,OAAA;AACd,4GAAA,iBAAiB,OAAA;AAEnB,iCAA2E;AAAlE,mGAAA,UAAU,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AACzD,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AACtB,iCAAiD;AAAxC,+GAAA,sBAAsB,OAAA;AAC/B,mCAA2C;AAAlC,yGAAA,eAAe,OAAA;AACxB,+CAQwB;AAPtB,iHAAA,iBAAiB,OAAA;AACjB,8GAAA,cAAc,OAAA;AACd,mHAAA,mBAAmB,OAAA;AACnB,4GAAA,YAAY,OAAA;AACZ,2GAAA,WAAW,OAAA;AAKb,yFAAyF;AACzF,qCAQmB;AAPjB,yGAAA,cAAc,OAAA;AACd,8GAAA,mBAAmB,OAAA;AACnB,uGAAA,YAAY,OAAA;AACZ,sGAAA,WAAW,OAAA;AACX,qGAAA,UAAU,OAAA;AACV,uGAAA,YAAY,OAAA;AACZ,sGAAA,WAAW,OAAA;AAEb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FAAyF;AACzF,qCAQmB;AAPjB,yGAAA,cAAc,OAAA;AACd,8GAAA,mBAAmB,OAAA;AACnB,uGAAA,YAAY,OAAA;AACZ,sGAAA,WAAW,OAAA;AACX,qGAAA,UAAU,OAAA;AACV,uGAAA,YAAY,OAAA;AACZ,sGAAA,WAAW,OAAA;AAEb,+CAOwB;AANtB,+GAAA,eAAe,OAAA;AACf,iHAAA,iBAAiB,OAAA;AACjB,oHAAA,oBAAoB,OAAA;AACpB,mHAAA,mBAAmB,OAAA;AACnB,4GAAA,YAAY,OAAA;AACZ,6GAAA,aAAa,OAAA;AAGf,kFAAkF;AAClF,6BAAoD;AAA3C,8FAAA,OAAO,OAAA;AAAE,yGAAA,kBAAkB,OAAA;AAEpC,iCAAiC;AACjC,iCAA0C;AAAjC,wGAAA,eAAe,OAAA;AAIxB;;;;;;;;;;;;GAYG;AACH,gDAA8B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledev/sdk-apptile-live-selling",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Live selling, auctions and giveaways for React Native \u2014 the Apptile live-selling gateway as a typed singleton, a Zego room engine behind a platform boundary, an assembled session state machine, and system picture-in-picture with its own config plugin. Commerce comes from an adapter.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -13,21 +13,22 @@
13
13
  "types": "./dist/index.d.ts",
14
14
  "default": "./dist/index.js"
15
15
  },
16
- "./react": {
17
- "types": "./dist/react/index.d.ts",
18
- "default": "./dist/react/index.js"
19
- },
20
16
  "./types": {
21
17
  "types": "./dist/types.d.ts",
22
18
  "default": "./dist/types.js"
23
19
  },
24
20
  "./app.plugin.js": "./app.plugin.js",
25
21
  "./expo-module.config.json": "./expo-module.config.json",
26
- "./package.json": "./package.json"
22
+ "./package.json": "./package.json",
23
+ "./*": {
24
+ "types": "./dist/*.d.ts",
25
+ "default": "./dist/*.js"
26
+ }
27
27
  },
28
28
  "files": [
29
29
  "dist",
30
- "react",
30
+ "types",
31
+ "session",
31
32
  "ios",
32
33
  "android",
33
34
  "!android/build",
@@ -70,12 +71,6 @@
70
71
  "expo": {
71
72
  "optional": true
72
73
  },
73
- "react": {
74
- "optional": true
75
- },
76
- "react-native": {
77
- "optional": true
78
- },
79
74
  "zego-express-engine-reactnative": {
80
75
  "optional": true
81
76
  }
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../dist/session.js",
3
+ "module": "../dist/session.js",
4
+ "types": "../dist/session.d.ts",
5
+ "sideEffects": false
6
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../dist/types.js",
3
+ "module": "../dist/types.js",
4
+ "types": "../dist/types.d.ts",
5
+ "sideEffects": false
6
+ }
@@ -1,6 +0,0 @@
1
- {
2
- "main": "../dist/react/index.js",
3
- "module": "../dist/react/index.js",
4
- "types": "../dist/react/index.d.ts",
5
- "sideEffects": false
6
- }