@streamscloud/embeddable 2.8.2 → 3.0.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/dist/core/graphql.d.ts +2 -3
- package/dist/core/graphql.js +5 -9
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte +3 -3
- package/dist/short-videos/short-videos-player/cmp.short-videos-player.svelte.d.ts +1 -0
- package/dist/short-videos/short-videos-player/index.js +2 -1
- package/dist/short-videos/short-videos-player/operations.generated.d.ts +1 -1
- package/dist/short-videos/short-videos-player/operations.generated.js +2 -2
- package/dist/short-videos/short-videos-player/operations.graphql +2 -2
- package/dist/short-videos/short-videos-player/types.d.ts +2 -0
- package/dist/streams/stream-player/cmp.stream-player.svelte +4 -4
- package/dist/streams/stream-player/cmp.stream-player.svelte.d.ts +1 -0
- package/dist/streams/stream-player/index.d.ts +1 -0
- package/dist/streams/stream-player/index.js +2 -1
- package/dist/streams/stream-player/operations.generated.d.ts +1 -1
- package/dist/streams/stream-player/operations.generated.js +5 -3
- package/dist/streams/stream-player/operations.graphql +3 -3
- package/dist/streams/stream-player/stream-player-buffer.svelte.js +2 -2
- package/package.json +1 -1
package/dist/core/graphql.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare const createLocalGQLClient: (graphqlOrigin?: string, customFetch?: typeof fetch) => import("@urql/core").Client;
|
|
1
|
+
export declare const createLocalGQLClient: (graphqlOrigin?: string, headers?: HeadersInit, customFetch?: typeof fetch) => import("@urql/core").Client;
|
|
2
2
|
export declare const resolveGraphQLOrigin: (origin?: string) => string;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const constructExternalGraphQLUrl: (graphqlOrigin?: string) => string;
|
|
3
|
+
export declare const constructGraphQLUrl: (graphqlOrigin?: string) => string;
|
package/dist/core/graphql.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createClient, fetchExchange } from '@urql/core';
|
|
2
|
-
export const createLocalGQLClient = (graphqlOrigin, customFetch) => createClient({
|
|
3
|
-
url:
|
|
2
|
+
export const createLocalGQLClient = (graphqlOrigin, headers, customFetch) => createClient({
|
|
3
|
+
url: constructGraphQLUrl(resolveGraphQLOrigin(graphqlOrigin)),
|
|
4
4
|
requestPolicy: 'network-only',
|
|
5
5
|
fetchOptions: {
|
|
6
|
-
credentials: 'include'
|
|
6
|
+
credentials: 'include',
|
|
7
|
+
headers: headers
|
|
7
8
|
},
|
|
8
9
|
fetch: customFetch || fetch,
|
|
9
10
|
exchanges: [fetchExchange]
|
|
@@ -11,12 +12,7 @@ export const createLocalGQLClient = (graphqlOrigin, customFetch) => createClient
|
|
|
11
12
|
export const resolveGraphQLOrigin = (origin) => {
|
|
12
13
|
return origin || 'https://api.streamscloud.com';
|
|
13
14
|
};
|
|
14
|
-
export const
|
|
15
|
-
let baseUrl = resolveGraphQLOrigin(graphqlOrigin);
|
|
16
|
-
baseUrl = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
|
|
17
|
-
return `${baseUrl}graphql`;
|
|
18
|
-
};
|
|
19
|
-
export const constructExternalGraphQLUrl = (graphqlOrigin) => {
|
|
15
|
+
export const constructGraphQLUrl = (graphqlOrigin) => {
|
|
20
16
|
let baseUrl = resolveGraphQLOrigin(graphqlOrigin);
|
|
21
17
|
baseUrl = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;
|
|
22
18
|
return `${baseUrl}external/graphql`;
|
|
@@ -19,7 +19,7 @@ import { GetShortVideosDocument } from './operations.generated';
|
|
|
19
19
|
import { ShortVideosPlayerLocalization } from './short-videos-player-localization';
|
|
20
20
|
import { ShortVideosPlayerUiManager } from './ui-manager.svelte';
|
|
21
21
|
import { onMount, untrack } from 'svelte';
|
|
22
|
-
let { input, localization: localizationInit, on } = $props();
|
|
22
|
+
let { input, localization: localizationInit, initiator, on } = $props();
|
|
23
23
|
const localization = $derived(new ShortVideosPlayerLocalization(localizationInit));
|
|
24
24
|
let everTouched = $state(false);
|
|
25
25
|
let buffer = $state(input.type === 'provider' ? new PlayerBuffer(input.provider) : null);
|
|
@@ -35,12 +35,12 @@ const initBuffer = (input) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
35
35
|
var _a, _b;
|
|
36
36
|
try {
|
|
37
37
|
const { graphqlOrigin, ids, initialId } = input;
|
|
38
|
-
const graphql = createLocalGQLClient(graphqlOrigin);
|
|
38
|
+
const graphql = createLocalGQLClient(graphqlOrigin, { 'x-initiator': initiator || 'player/short-videos' });
|
|
39
39
|
const payload = yield graphql
|
|
40
40
|
.query(GetShortVideosDocument, {
|
|
41
41
|
input: {
|
|
42
42
|
filter: {
|
|
43
|
-
|
|
43
|
+
ids
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type * as SchemaTypes from '../../../gql/types';
|
|
2
2
|
import type { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
3
|
export type GetShortVideosQueryVariables = SchemaTypes.Exact<{
|
|
4
|
-
input: SchemaTypes.
|
|
4
|
+
input: SchemaTypes.EmbedPostsInput;
|
|
5
5
|
image_scale?: SchemaTypes.InputMaybe<SchemaTypes.ImageScale>;
|
|
6
6
|
}>;
|
|
7
7
|
export type GetShortVideosQuery = {
|
|
@@ -9,7 +9,7 @@ export const GetShortVideosDocument = {
|
|
|
9
9
|
{
|
|
10
10
|
kind: 'VariableDefinition',
|
|
11
11
|
variable: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
|
|
12
|
-
type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: '
|
|
12
|
+
type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: 'EmbedPostsInput' } } }
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
kind: 'VariableDefinition',
|
|
@@ -24,7 +24,7 @@ export const GetShortVideosDocument = {
|
|
|
24
24
|
{
|
|
25
25
|
kind: 'Field',
|
|
26
26
|
alias: { kind: 'Name', value: 'shortVideos' },
|
|
27
|
-
name: { kind: 'Name', value: '
|
|
27
|
+
name: { kind: 'Name', value: 'embedPosts' },
|
|
28
28
|
arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'input' }, value: { kind: 'Variable', name: { kind: 'Name', value: 'input' } } }],
|
|
29
29
|
selectionSet: {
|
|
30
30
|
kind: 'SelectionSet',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# noinspection GraphQLSchemaValidation
|
|
2
|
-
query GetShortVideos($input:
|
|
3
|
-
shortVideos:
|
|
2
|
+
query GetShortVideos($input: EmbedPostsInput!, $image_scale: ImageScale = ORIGINAL_ENCODED) {
|
|
3
|
+
shortVideos: embedPosts(input: $input) {
|
|
4
4
|
items {
|
|
5
5
|
...ShortVideoViewerPayloadFragment
|
|
6
6
|
}
|
|
@@ -11,6 +11,7 @@ export type IdsPlayerInput = {
|
|
|
11
11
|
ids: string[];
|
|
12
12
|
initialId?: string;
|
|
13
13
|
graphqlOrigin?: string;
|
|
14
|
+
initiator?: string;
|
|
14
15
|
};
|
|
15
16
|
export type OpenShortVideosPlayerInit = ProviderInit | IdsInit;
|
|
16
17
|
type ProviderInit = {
|
|
@@ -25,6 +26,7 @@ type IdsInit = {
|
|
|
25
26
|
graphqlOrigin?: string;
|
|
26
27
|
initialId?: string;
|
|
27
28
|
localization?: IShortVideosPlayerLocalization | 'en' | 'no';
|
|
29
|
+
initiator?: string;
|
|
28
30
|
on?: {
|
|
29
31
|
playerClosed?: () => void;
|
|
30
32
|
};
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
};
|
|
10
10
|
import { getOrCreateProfileId } from '../../core/analytics.profile-id';
|
|
11
11
|
import { handleEsc } from '../../core/document.event-handlers';
|
|
12
|
-
import {
|
|
12
|
+
import { constructGraphQLUrl, createLocalGQLClient } from '../../core/graphql';
|
|
13
13
|
import { toastrWarning } from '../../core/toastr';
|
|
14
14
|
import { ShortVideoViewer } from '../../short-videos/short-video-viewer';
|
|
15
15
|
import { mapToShortVideoViewerModel } from '../layout/models';
|
|
@@ -27,7 +27,7 @@ import { StreamPlayerLocalization } from './stream-player-localization';
|
|
|
27
27
|
import { StreamPlayerUiManager } from './ui-manager.svelte';
|
|
28
28
|
import { AppEventsTracker } from '@streamscloud/streams-analytics-collector';
|
|
29
29
|
import { onMount } from 'svelte';
|
|
30
|
-
let { streamId, graphqlOrigin, localization: localizationInit, showStreamsCloudWatermark, on } = $props();
|
|
30
|
+
let { streamId, graphqlOrigin, localization: localizationInit, showStreamsCloudWatermark, initiator, on } = $props();
|
|
31
31
|
const localization = $derived(new StreamPlayerLocalization(localizationInit));
|
|
32
32
|
let model = $state(null);
|
|
33
33
|
let buffer = $state.raw(null);
|
|
@@ -56,14 +56,14 @@ onMount(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
56
56
|
var _a, _b, _c, _d;
|
|
57
57
|
uiManager.overviewCollapsed = window && window.innerWidth < window.innerHeight;
|
|
58
58
|
try {
|
|
59
|
-
const graphql = createLocalGQLClient(graphqlOrigin);
|
|
59
|
+
const graphql = createLocalGQLClient(graphqlOrigin, { 'x-initiator': initiator !== null && initiator !== void 0 ? initiator : 'player/stream' });
|
|
60
60
|
const streamPayload = yield graphql.query(GetStreamDocument, { id: streamId }).toPromise();
|
|
61
61
|
if (!((_a = streamPayload.data) === null || _a === void 0 ? void 0 : _a.stream)) {
|
|
62
62
|
toastrWarning(localization.streamNotFound);
|
|
63
63
|
(_b = on === null || on === void 0 ? void 0 : on.closePlayer) === null || _b === void 0 ? void 0 : _b.call(on);
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
AppEventsTracker.setEndpoint(
|
|
66
|
+
AppEventsTracker.setEndpoint(constructGraphQLUrl(graphqlOrigin));
|
|
67
67
|
AppEventsTracker.setProfileId(getOrCreateProfileId());
|
|
68
68
|
(_c = on === null || on === void 0 ? void 0 : on.streamActivated) === null || _c === void 0 ? void 0 : _c.call(on, {
|
|
69
69
|
ownerId: streamPayload.data.stream.ownerProfile.id,
|
|
@@ -27,7 +27,7 @@ import { mount, unmount } from 'svelte';
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
export const openStreamPlayer = (init) => {
|
|
30
|
-
const { streamId, graphqlOrigin, localization, showStreamsCloudWatermark } = init;
|
|
30
|
+
const { streamId, graphqlOrigin, localization, showStreamsCloudWatermark, initiator } = init;
|
|
31
31
|
const shadowHost = new ShadowHost();
|
|
32
32
|
const mounted = mount(StreamPlayer, {
|
|
33
33
|
target: shadowHost.shadowRoot,
|
|
@@ -36,6 +36,7 @@ export const openStreamPlayer = (init) => {
|
|
|
36
36
|
graphqlOrigin,
|
|
37
37
|
localization: getLocale(localization),
|
|
38
38
|
showStreamsCloudWatermark,
|
|
39
|
+
initiator,
|
|
39
40
|
on: {
|
|
40
41
|
streamActivated: (data) => {
|
|
41
42
|
AppEventsTracker.setOrganizationId(data.ownerId);
|
|
@@ -27,7 +27,7 @@ export type GetStreamQuery = {
|
|
|
27
27
|
} | null;
|
|
28
28
|
};
|
|
29
29
|
export type GetStreamPagesQueryVariables = SchemaTypes.Exact<{
|
|
30
|
-
input: SchemaTypes.
|
|
30
|
+
input: SchemaTypes.EmbedStreamPagesInput;
|
|
31
31
|
image_scale: SchemaTypes.ImageScale;
|
|
32
32
|
}>;
|
|
33
33
|
export type GetStreamPagesQuery = {
|
|
@@ -67,7 +67,8 @@ export const GetStreamDocument = {
|
|
|
67
67
|
selections: [
|
|
68
68
|
{
|
|
69
69
|
kind: 'Field',
|
|
70
|
-
|
|
70
|
+
alias: { kind: 'Name', value: 'stream' },
|
|
71
|
+
name: { kind: 'Name', value: 'embedStream' },
|
|
71
72
|
arguments: [
|
|
72
73
|
{
|
|
73
74
|
kind: 'Argument',
|
|
@@ -141,7 +142,7 @@ export const GetStreamPagesDocument = {
|
|
|
141
142
|
{
|
|
142
143
|
kind: 'VariableDefinition',
|
|
143
144
|
variable: { kind: 'Variable', name: { kind: 'Name', value: 'input' } },
|
|
144
|
-
type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: '
|
|
145
|
+
type: { kind: 'NonNullType', type: { kind: 'NamedType', name: { kind: 'Name', value: 'EmbedStreamPagesInput' } } }
|
|
145
146
|
},
|
|
146
147
|
{
|
|
147
148
|
kind: 'VariableDefinition',
|
|
@@ -154,7 +155,8 @@ export const GetStreamPagesDocument = {
|
|
|
154
155
|
selections: [
|
|
155
156
|
{
|
|
156
157
|
kind: 'Field',
|
|
157
|
-
|
|
158
|
+
alias: { kind: 'Name', value: 'streamPages' },
|
|
159
|
+
name: { kind: 'Name', value: 'embedStreamPages' },
|
|
158
160
|
arguments: [{ kind: 'Argument', name: { kind: 'Name', value: 'input' }, value: { kind: 'Variable', name: { kind: 'Name', value: 'input' } } }],
|
|
159
161
|
selectionSet: {
|
|
160
162
|
kind: 'SelectionSet',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
query GetStream($id: String!) {
|
|
2
|
-
stream(input: { id: $id }) {
|
|
2
|
+
stream: embedStream(input: { id: $id }) {
|
|
3
3
|
...StreamPlayerPayloadFragment
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
# noinspection GraphQLSchemaValidation
|
|
8
|
-
query GetStreamPages($input:
|
|
9
|
-
streamPages(input: $input) {
|
|
8
|
+
query GetStreamPages($input: EmbedStreamPagesInput!, $image_scale: ImageScale!) {
|
|
9
|
+
streamPages: embedStreamPages(input: $input) {
|
|
10
10
|
items {
|
|
11
11
|
...StreamPageViewerPayloadFragment
|
|
12
12
|
}
|
|
@@ -23,7 +23,7 @@ export class StreamPlayerBuffer {
|
|
|
23
23
|
const payload = await graphql
|
|
24
24
|
.query(GetStreamPagesDocument, {
|
|
25
25
|
input: {
|
|
26
|
-
limit:
|
|
26
|
+
limit: 2,
|
|
27
27
|
continuationToken,
|
|
28
28
|
filter: {
|
|
29
29
|
streamId
|
|
@@ -70,7 +70,7 @@ export class StreamPlayerBuffer {
|
|
|
70
70
|
this._pagesLoader.reset();
|
|
71
71
|
};
|
|
72
72
|
warmUpBuffer = async () => {
|
|
73
|
-
const bufferSize =
|
|
73
|
+
const bufferSize = 2;
|
|
74
74
|
if (this.loaded.length >= this.currentIndex + bufferSize) {
|
|
75
75
|
return;
|
|
76
76
|
}
|