@learnorama/mozaik-sdk 0.14.2-staging.52.1 → 0.15.0-staging.53.1
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 +17 -11
- package/dist/api/account.d.ts +1 -1
- package/dist/api/account.js.map +1 -1
- package/dist/api/admin-catalogue.d.ts +1 -1
- package/dist/api/admin-catalogue.js.map +1 -1
- package/dist/api/admin-consumption.d.ts +1 -1
- package/dist/api/admin-consumption.js.map +1 -1
- package/dist/api/admin-contracts.d.ts +1 -1
- package/dist/api/admin-contracts.js.map +1 -1
- package/dist/api/admin-customer.d.ts +1 -1
- package/dist/api/admin-customer.js.map +1 -1
- package/dist/api/admin-desk.d.ts +1 -1
- package/dist/api/admin-desk.js.map +1 -1
- package/dist/api/admin-licenses.js.map +1 -1
- package/dist/api/admin-partner-selections.d.ts +1 -1
- package/dist/api/admin-partner-selections.js.map +1 -1
- package/dist/api/admin-patrons.d.ts +1 -1
- package/dist/api/admin-patrons.js.map +1 -1
- package/dist/api/admin-reviews.d.ts +1 -1
- package/dist/api/admin-reviews.js.map +1 -1
- package/dist/api/admin-roles.d.ts +1 -1
- package/dist/api/admin-roles.js.map +1 -1
- package/dist/api/admin-support.d.ts +1 -1
- package/dist/api/admin-support.js.map +1 -1
- package/dist/api/admin-tenants.js.map +1 -1
- package/dist/api/admin-tutoring.d.ts +1 -1
- package/dist/api/admin-tutoring.js.map +1 -1
- package/dist/api/auth-device.d.ts +1 -1
- package/dist/api/auth-device.js.map +1 -1
- package/dist/api/auth.d.ts +1 -1
- package/dist/api/auth.js.map +1 -1
- package/dist/api/biblio-billing-webhooks.d.ts +1 -1
- package/dist/api/biblio-billing-webhooks.js.map +1 -1
- package/dist/api/biblio-billing.d.ts +1 -1
- package/dist/api/biblio-billing.js.map +1 -1
- package/dist/api/biblio-catalogue.d.ts +1 -1
- package/dist/api/biblio-catalogue.js.map +1 -1
- package/dist/api/biblio-home.d.ts +1 -1
- package/dist/api/biblio-home.js.map +1 -1
- package/dist/api/biblio-learning-author-profiles.d.ts +1 -1
- package/dist/api/biblio-learning-author-profiles.js.map +1 -1
- package/dist/api/biblio-learning-authoring.d.ts +1 -1
- package/dist/api/biblio-learning-authoring.js.map +1 -1
- package/dist/api/biblio-learning-editorial.d.ts +1 -1
- package/dist/api/biblio-learning-editorial.js.map +1 -1
- package/dist/api/biblio-learning-feedback.d.ts +1 -1
- package/dist/api/biblio-learning-feedback.js.map +1 -1
- package/dist/api/biblio-learning-finance.d.ts +1 -1
- package/dist/api/biblio-learning-finance.js.map +1 -1
- package/dist/api/biblio-learning-integrations.d.ts +1 -1
- package/dist/api/biblio-learning-integrations.js.map +1 -1
- package/dist/api/biblio-learning-membership.d.ts +1 -1
- package/dist/api/biblio-learning-membership.js.map +1 -1
- package/dist/api/biblio-learning.d.ts +1 -1
- package/dist/api/biblio-learning.js.map +1 -1
- package/dist/api/biblio-library.d.ts +1 -1
- package/dist/api/biblio-library.js.map +1 -1
- package/dist/api/biblio-nextory.d.ts +1 -1
- package/dist/api/biblio-nextory.js.map +1 -1
- package/dist/api/biblio-press.d.ts +1 -1
- package/dist/api/biblio-press.js.map +1 -1
- package/dist/api/biblio-search.js.map +1 -1
- package/dist/api/biblio-telemetry.js.map +1 -1
- package/dist/api/biblio-youscribe.d.ts +51 -0
- package/dist/api/biblio-youscribe.js +66 -0
- package/dist/api/biblio-youscribe.js.map +1 -0
- package/dist/api/consumption.d.ts +1 -1
- package/dist/api/consumption.js.map +1 -1
- package/dist/api/cvs-app.d.ts +1 -1
- package/dist/api/cvs-app.js.map +1 -1
- package/dist/api/cvs-documents.d.ts +1 -1
- package/dist/api/cvs-documents.js.map +1 -1
- package/dist/api/cvs-favorites.d.ts +1 -1
- package/dist/api/cvs-favorites.js.map +1 -1
- package/dist/api/cvs-ils.d.ts +1 -1
- package/dist/api/cvs-ils.js.map +1 -1
- package/dist/api/cvs-loans.d.ts +1 -1
- package/dist/api/cvs-loans.js.map +1 -1
- package/dist/api/cvs-payments.d.ts +1 -1
- package/dist/api/cvs-payments.js.map +1 -1
- package/dist/api/cvs-streaming.js.map +1 -1
- package/dist/api/index.d.ts +5 -3
- package/dist/api/index.js +5 -3
- package/dist/api/partner-catalogue.d.ts +21 -1
- package/dist/api/partner-catalogue.js +28 -1
- package/dist/api/partner-catalogue.js.map +1 -1
- package/dist/api/partner-reader-nextory.d.ts +52 -0
- package/dist/api/partner-reader-nextory.js +92 -0
- package/dist/api/partner-reader-nextory.js.map +1 -0
- package/dist/api/partner-reader-youscribe.d.ts +63 -0
- package/dist/api/partner-reader-youscribe.js +97 -0
- package/dist/api/partner-reader-youscribe.js.map +1 -0
- package/dist/api/profiles.d.ts +1 -1
- package/dist/api/profiles.js.map +1 -1
- package/dist/api/search.d.ts +6 -1
- package/dist/api/search.js +10 -1
- package/dist/api/search.js.map +1 -1
- package/dist/api/tutoring-catalogue.d.ts +1 -1
- package/dist/api/tutoring-catalogue.js.map +1 -1
- package/dist/api/tutoring-chat.d.ts +1 -1
- package/dist/api/tutoring-chat.js.map +1 -1
- package/dist/api/tutoring-dispatch.d.ts +1 -1
- package/dist/api/tutoring-dispatch.js.map +1 -1
- package/dist/api/tutoring-practitioner.js.map +1 -1
- package/dist/api/tutoring-requests.d.ts +1 -1
- package/dist/api/tutoring-requests.js.map +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/chunks/client2.d.ts +1 -1
- package/dist/chunks/connection.d.ts +1 -1
- package/dist/chunks/index.d.ts +542 -508
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +2 -2
- package/dist/models.js +7 -1
- package/dist/models.js.map +1 -1
- package/dist/react/account.d.ts +1 -1
- package/dist/react/account.js +1 -1
- package/dist/react/account.js.map +1 -1
- package/dist/react/admin-catalogue.d.ts +1 -1
- package/dist/react/admin-catalogue.js +1 -1
- package/dist/react/admin-catalogue.js.map +1 -1
- package/dist/react/admin-consumption.d.ts +1 -1
- package/dist/react/admin-consumption.js +1 -1
- package/dist/react/admin-consumption.js.map +1 -1
- package/dist/react/admin-contracts.d.ts +1 -1
- package/dist/react/admin-contracts.js +1 -1
- package/dist/react/admin-contracts.js.map +1 -1
- package/dist/react/admin-customer.d.ts +1 -1
- package/dist/react/admin-customer.js +1 -1
- package/dist/react/admin-customer.js.map +1 -1
- package/dist/react/admin-desk.d.ts +1 -1
- package/dist/react/admin-desk.js +1 -1
- package/dist/react/admin-desk.js.map +1 -1
- package/dist/react/admin-licenses.d.ts +1 -1
- package/dist/react/admin-licenses.js +1 -1
- package/dist/react/admin-licenses.js.map +1 -1
- package/dist/react/admin-partner-selections.d.ts +1 -1
- package/dist/react/admin-partner-selections.js +1 -1
- package/dist/react/admin-partner-selections.js.map +1 -1
- package/dist/react/admin-patrons.d.ts +1 -1
- package/dist/react/admin-patrons.js +1 -1
- package/dist/react/admin-patrons.js.map +1 -1
- package/dist/react/admin-reviews.d.ts +1 -1
- package/dist/react/admin-reviews.js +1 -1
- package/dist/react/admin-reviews.js.map +1 -1
- package/dist/react/admin-roles.d.ts +1 -1
- package/dist/react/admin-roles.js +1 -1
- package/dist/react/admin-roles.js.map +1 -1
- package/dist/react/admin-support.d.ts +1 -1
- package/dist/react/admin-support.js +1 -1
- package/dist/react/admin-support.js.map +1 -1
- package/dist/react/admin-tenants.d.ts +1 -1
- package/dist/react/admin-tenants.js +1 -1
- package/dist/react/admin-tenants.js.map +1 -1
- package/dist/react/admin-tutoring.d.ts +1 -1
- package/dist/react/admin-tutoring.js +1 -1
- package/dist/react/admin-tutoring.js.map +1 -1
- package/dist/react/auth-device.d.ts +1 -1
- package/dist/react/auth-device.js +1 -1
- package/dist/react/auth-device.js.map +1 -1
- package/dist/react/auth.d.ts +1 -1
- package/dist/react/auth.js +1 -1
- package/dist/react/auth.js.map +1 -1
- package/dist/react/biblio-billing-webhooks.d.ts +1 -1
- package/dist/react/biblio-billing-webhooks.js +1 -1
- package/dist/react/biblio-billing-webhooks.js.map +1 -1
- package/dist/react/biblio-billing.d.ts +1 -1
- package/dist/react/biblio-billing.js +1 -1
- package/dist/react/biblio-billing.js.map +1 -1
- package/dist/react/biblio-catalogue.d.ts +1 -1
- package/dist/react/biblio-catalogue.js +1 -1
- package/dist/react/biblio-catalogue.js.map +1 -1
- package/dist/react/biblio-home.d.ts +1 -1
- package/dist/react/biblio-home.js +1 -1
- package/dist/react/biblio-home.js.map +1 -1
- package/dist/react/biblio-learning-author-profiles.d.ts +1 -1
- package/dist/react/biblio-learning-author-profiles.js +1 -1
- package/dist/react/biblio-learning-author-profiles.js.map +1 -1
- package/dist/react/biblio-learning-authoring.d.ts +1 -1
- package/dist/react/biblio-learning-authoring.js +1 -1
- package/dist/react/biblio-learning-authoring.js.map +1 -1
- package/dist/react/biblio-learning-editorial.d.ts +1 -1
- package/dist/react/biblio-learning-editorial.js +1 -1
- package/dist/react/biblio-learning-editorial.js.map +1 -1
- package/dist/react/biblio-learning-feedback.d.ts +1 -1
- package/dist/react/biblio-learning-feedback.js +1 -1
- package/dist/react/biblio-learning-feedback.js.map +1 -1
- package/dist/react/biblio-learning-finance.d.ts +1 -1
- package/dist/react/biblio-learning-finance.js +1 -1
- package/dist/react/biblio-learning-finance.js.map +1 -1
- package/dist/react/biblio-learning-integrations.d.ts +1 -1
- package/dist/react/biblio-learning-integrations.js +1 -1
- package/dist/react/biblio-learning-integrations.js.map +1 -1
- package/dist/react/biblio-learning-membership.d.ts +1 -1
- package/dist/react/biblio-learning-membership.js +1 -1
- package/dist/react/biblio-learning-membership.js.map +1 -1
- package/dist/react/biblio-learning.d.ts +1 -1
- package/dist/react/biblio-learning.js +1 -1
- package/dist/react/biblio-learning.js.map +1 -1
- package/dist/react/biblio-library.d.ts +1 -1
- package/dist/react/biblio-library.js +1 -1
- package/dist/react/biblio-library.js.map +1 -1
- package/dist/react/biblio-nextory.d.ts +1 -1
- package/dist/react/biblio-nextory.js +1 -1
- package/dist/react/biblio-nextory.js.map +1 -1
- package/dist/react/biblio-press.d.ts +1 -1
- package/dist/react/biblio-press.js +1 -1
- package/dist/react/biblio-press.js.map +1 -1
- package/dist/react/biblio-search.d.ts +1 -1
- package/dist/react/biblio-search.js +1 -1
- package/dist/react/biblio-search.js.map +1 -1
- package/dist/react/biblio-telemetry.d.ts +1 -1
- package/dist/react/biblio-telemetry.js +1 -1
- package/dist/react/biblio-telemetry.js.map +1 -1
- package/dist/react/biblio-youscribe.d.ts +81 -0
- package/dist/react/biblio-youscribe.js +128 -0
- package/dist/react/biblio-youscribe.js.map +1 -0
- package/dist/react/chat.d.ts +1 -1
- package/dist/react/consumption.d.ts +1 -1
- package/dist/react/consumption.js +1 -1
- package/dist/react/consumption.js.map +1 -1
- package/dist/react/cvs-app.d.ts +1 -1
- package/dist/react/cvs-app.js +1 -1
- package/dist/react/cvs-app.js.map +1 -1
- package/dist/react/cvs-documents.d.ts +1 -1
- package/dist/react/cvs-documents.js +1 -1
- package/dist/react/cvs-documents.js.map +1 -1
- package/dist/react/cvs-favorites.d.ts +1 -1
- package/dist/react/cvs-favorites.js +1 -1
- package/dist/react/cvs-favorites.js.map +1 -1
- package/dist/react/cvs-ils.d.ts +1 -1
- package/dist/react/cvs-ils.js +1 -1
- package/dist/react/cvs-ils.js.map +1 -1
- package/dist/react/cvs-loans.d.ts +1 -1
- package/dist/react/cvs-loans.js +1 -1
- package/dist/react/cvs-loans.js.map +1 -1
- package/dist/react/cvs-payments.d.ts +1 -1
- package/dist/react/cvs-payments.js +1 -1
- package/dist/react/cvs-payments.js.map +1 -1
- package/dist/react/cvs-streaming.d.ts +1 -1
- package/dist/react/cvs-streaming.js +1 -1
- package/dist/react/cvs-streaming.js.map +1 -1
- package/dist/react/index.d.ts +5 -3
- package/dist/react/index.js +5 -3
- package/dist/react/partner-catalogue.d.ts +48 -1
- package/dist/react/partner-catalogue.js +54 -2
- package/dist/react/partner-catalogue.js.map +1 -1
- package/dist/react/partner-reader-nextory.d.ts +127 -0
- package/dist/react/partner-reader-nextory.js +190 -0
- package/dist/react/partner-reader-nextory.js.map +1 -0
- package/dist/react/partner-reader-youscribe.d.ts +152 -0
- package/dist/react/partner-reader-youscribe.js +224 -0
- package/dist/react/partner-reader-youscribe.js.map +1 -0
- package/dist/react/profiles.d.ts +1 -1
- package/dist/react/profiles.js +1 -1
- package/dist/react/profiles.js.map +1 -1
- package/dist/react/search.d.ts +6 -1
- package/dist/react/search.js +11 -2
- package/dist/react/search.js.map +1 -1
- package/dist/react/tutoring-catalogue.d.ts +1 -1
- package/dist/react/tutoring-catalogue.js +1 -1
- package/dist/react/tutoring-catalogue.js.map +1 -1
- package/dist/react/tutoring-chat.d.ts +1 -1
- package/dist/react/tutoring-chat.js +1 -1
- package/dist/react/tutoring-chat.js.map +1 -1
- package/dist/react/tutoring-dispatch.d.ts +1 -1
- package/dist/react/tutoring-dispatch.js +1 -1
- package/dist/react/tutoring-dispatch.js.map +1 -1
- package/dist/react/tutoring-practitioner.d.ts +1 -1
- package/dist/react/tutoring-practitioner.js +1 -1
- package/dist/react/tutoring-practitioner.js.map +1 -1
- package/dist/react/tutoring-requests.d.ts +1 -1
- package/dist/react/tutoring-requests.js +1 -1
- package/dist/react/tutoring-requests.js.map +1 -1
- package/package.json +7 -7
- package/dist/api/partner-reader.d.ts +0 -96
- package/dist/api/partner-reader.js +0 -164
- package/dist/api/partner-reader.js.map +0 -1
- package/dist/react/partner-reader.d.ts +0 -261
- package/dist/react/partner-reader.js +0 -368
- package/dist/react/partner-reader.js.map +0 -1
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Ad as PartnerProvider, Dt as ReadingPositionRead, Mt as ReaderPackageRead, Tt as ReadingPositionWrite, a as ValidationErrorResponse, hl as HTTPExceptionResponse, n as YouScribeAuthRead, sm as CurrentReadingListRead, t as YouScribeReaderRead, xt as ReadPackageParams } from "../chunks/index.js";
|
|
3
|
-
import { a as ErrorType, c as request, n as BodyType } from "../chunks/client.js";
|
|
4
|
-
import { DataTag, DefinedInitialDataOptions, DefinedUseQueryResult, QueryClient, QueryKey, UndefinedInitialDataOptions, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from "@tanstack/react-query";
|
|
5
|
-
//#region src/react/partner-reader/partner-reader.d.ts
|
|
6
|
-
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
7
|
-
export declare const getReadPackageUrl: (provider: PartnerProvider, mediaId: number, params?: ReadPackageParams) => string;
|
|
8
|
-
/**
|
|
9
|
-
* Where to fetch the content itself.
|
|
10
|
-
*
|
|
11
|
-
* The returned URL is a short-lived DRM-wrapped credential. It is not cached
|
|
12
|
-
* here and should not be stored by the client.
|
|
13
|
-
*
|
|
14
|
-
* Opens a consumption lease, so the read appears in the ledger and counts
|
|
15
|
-
* against the establishment's live seats like any other. Its id comes back in
|
|
16
|
-
* ``lease``: keep it alive with ``PUT /consumption/{eventId}`` and drop it with
|
|
17
|
-
* ``DELETE`` when the reader closes. A client that does neither is not broken
|
|
18
|
-
* — the reaper closes the lease about a minute after the last heartbeat — but
|
|
19
|
-
* every such read is a seat held past the end of it.
|
|
20
|
-
*
|
|
21
|
-
* Re-opening the same title returns the lease already held rather than a
|
|
22
|
-
* second one, so a page reload does not leak a seat.
|
|
23
|
-
* @summary Read Package
|
|
24
|
-
*/
|
|
25
|
-
export declare const readPackage: (provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: Parameters<typeof request>[1]) => Promise<ReaderPackageRead>;
|
|
26
|
-
export declare const getReadPackageQueryKey: (provider: PartnerProvider, mediaId: number, params?: ReadPackageParams) => readonly [`/partners/nextory/media/${number}/package` | `/partners/youscribe/media/${number}/package`, ...ReadPackageParams[]];
|
|
27
|
-
export declare const getReadPackageQueryOptions: <TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: {
|
|
28
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>;
|
|
29
|
-
request?: SecondParameter<typeof request>;
|
|
30
|
-
}) => UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData> & {
|
|
31
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
32
|
-
};
|
|
33
|
-
export type ReadPackageQueryResult = NonNullable<Awaited<ReturnType<typeof readPackage>>>;
|
|
34
|
-
export type ReadPackageQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
35
|
-
export declare function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params: undefined | ReadPackageParams, options: {
|
|
36
|
-
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readPackage>>, TError, Awaited<ReturnType<typeof readPackage>>>, 'initialData'>;
|
|
37
|
-
request?: SecondParameter<typeof request>;
|
|
38
|
-
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
39
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
40
|
-
};
|
|
41
|
-
export declare function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: {
|
|
42
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readPackage>>, TError, Awaited<ReturnType<typeof readPackage>>>, 'initialData'>;
|
|
43
|
-
request?: SecondParameter<typeof request>;
|
|
44
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
45
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
46
|
-
};
|
|
47
|
-
export declare function useReadPackage<TData = Awaited<ReturnType<typeof readPackage>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, params?: ReadPackageParams, options?: {
|
|
48
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPackage>>, TError, TData>>;
|
|
49
|
-
request?: SecondParameter<typeof request>;
|
|
50
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
51
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
52
|
-
};
|
|
53
|
-
export declare const getReadPositionUrl: (provider: PartnerProvider, mediaId: number) => string;
|
|
54
|
-
/**
|
|
55
|
-
* The last synchronized local position, or the partner's when none is saved.
|
|
56
|
-
*
|
|
57
|
-
* ``404`` when the partner holds no position — a book never opened has no
|
|
58
|
-
* place to return to, and reporting zero would make a client jump a reader who
|
|
59
|
-
* *is* mid-book back to the start if the call ever failed soft.
|
|
60
|
-
* @summary Read Position
|
|
61
|
-
*/
|
|
62
|
-
export declare const readPosition: (provider: PartnerProvider, mediaId: number, options?: Parameters<typeof request>[1]) => Promise<ReadingPositionRead>;
|
|
63
|
-
export declare const getReadPositionQueryKey: (provider: PartnerProvider, mediaId: number) => readonly [`/partners/nextory/media/${number}/position` | `/partners/youscribe/media/${number}/position`];
|
|
64
|
-
export declare const getReadPositionQueryOptions: <TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options?: {
|
|
65
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>;
|
|
66
|
-
request?: SecondParameter<typeof request>;
|
|
67
|
-
}) => UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData> & {
|
|
68
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
69
|
-
};
|
|
70
|
-
export type ReadPositionQueryResult = NonNullable<Awaited<ReturnType<typeof readPosition>>>;
|
|
71
|
-
export type ReadPositionQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
72
|
-
export declare function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options: {
|
|
73
|
-
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readPosition>>, TError, Awaited<ReturnType<typeof readPosition>>>, 'initialData'>;
|
|
74
|
-
request?: SecondParameter<typeof request>;
|
|
75
|
-
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
76
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
77
|
-
};
|
|
78
|
-
export declare function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options?: {
|
|
79
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readPosition>>, TError, Awaited<ReturnType<typeof readPosition>>>, 'initialData'>;
|
|
80
|
-
request?: SecondParameter<typeof request>;
|
|
81
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
82
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
83
|
-
};
|
|
84
|
-
export declare function useReadPosition<TData = Awaited<ReturnType<typeof readPosition>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, mediaId: number, options?: {
|
|
85
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readPosition>>, TError, TData>>;
|
|
86
|
-
request?: SecondParameter<typeof request>;
|
|
87
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
88
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
89
|
-
};
|
|
90
|
-
export declare const getWritePositionUrl: (provider: PartnerProvider, mediaId: number) => string;
|
|
91
|
-
/**
|
|
92
|
-
* Synchronize and save progress, with the partner's metering alongside it.
|
|
93
|
-
*
|
|
94
|
-
* ``usage_blocks`` is forwarded before a new position, matching the legacy's
|
|
95
|
-
* call order. The two reports are independent: an older position may carry
|
|
96
|
-
* usage the partner has not received yet.
|
|
97
|
-
*
|
|
98
|
-
* Only a strictly newer ``reachedAt`` replaces the saved position. Stale or
|
|
99
|
-
* duplicate writes return that saved position without updating it upstream.
|
|
100
|
-
* Provided usage blocks are still forwarded, including on retries; the
|
|
101
|
-
* partner's deduplication contract is unknown. Conflicting positions at the
|
|
102
|
-
* same instant return 409 before any outbound write.
|
|
103
|
-
* Progress is a resume point, not a measurement of time spent reading.
|
|
104
|
-
* @summary Write Position
|
|
105
|
-
*/
|
|
106
|
-
export declare const writePosition: (provider: PartnerProvider, mediaId: number, readingPositionWrite: ReadingPositionWrite, options?: Parameters<typeof request>[1]) => Promise<ReadingPositionRead>;
|
|
107
|
-
export declare const getWritePositionMutationKey: () => readonly ['writePosition'];
|
|
108
|
-
export declare const getWritePositionMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
109
|
-
mutation?: UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
|
|
110
|
-
request?: SecondParameter<typeof request>;
|
|
111
|
-
}) => UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
|
|
112
|
-
export type WritePositionMutationResult = NonNullable<Awaited<ReturnType<typeof writePosition>>>;
|
|
113
|
-
export type WritePositionMutationBody = BodyType<ReadingPositionWrite>;
|
|
114
|
-
export type WritePositionMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
115
|
-
export type WritePositionMutationVariables = {
|
|
116
|
-
provider: PartnerProvider;
|
|
117
|
-
mediaId: number;
|
|
118
|
-
data: BodyType<ReadingPositionWrite>;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* @summary Write Position
|
|
122
|
-
*/
|
|
123
|
-
export declare const useWritePosition: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
124
|
-
mutation?: UseMutationOptions<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
|
|
125
|
-
request?: SecondParameter<typeof request>;
|
|
126
|
-
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof writePosition>>, TError, WritePositionMutationVariables, TContext>;
|
|
127
|
-
export declare const getOpenNativeReaderUrl: (provider: PartnerProvider, mediaId: number) => string;
|
|
128
|
-
/**
|
|
129
|
-
* Authorize a YouScribe native title and open its consumption lease.
|
|
130
|
-
*
|
|
131
|
-
* Pass externalId and token to the YouScribe SDK. Mozaik requests keep using
|
|
132
|
-
* mediaId. Renew lease.eventId while the reader is open and close it when the
|
|
133
|
-
* reader exits; reopening the same title reuses its active lease.
|
|
134
|
-
* @summary Open Native Reader
|
|
135
|
-
*/
|
|
136
|
-
export declare const openNativeReader: (provider: PartnerProvider, mediaId: number, options?: Parameters<typeof request>[1]) => Promise<YouScribeReaderRead>;
|
|
137
|
-
export declare const getOpenNativeReaderMutationKey: () => readonly ['openNativeReader'];
|
|
138
|
-
export declare const getOpenNativeReaderMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
139
|
-
mutation?: UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError, OpenNativeReaderMutationVariables, TContext>;
|
|
140
|
-
request?: SecondParameter<typeof request>;
|
|
141
|
-
}) => UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError, OpenNativeReaderMutationVariables, TContext>;
|
|
142
|
-
export type OpenNativeReaderMutationResult = NonNullable<Awaited<ReturnType<typeof openNativeReader>>>;
|
|
143
|
-
export type OpenNativeReaderMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
144
|
-
export type OpenNativeReaderMutationVariables = {
|
|
145
|
-
provider: PartnerProvider;
|
|
146
|
-
mediaId: number;
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* @summary Open Native Reader
|
|
150
|
-
*/
|
|
151
|
-
export declare const useOpenNativeReader: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
152
|
-
mutation?: UseMutationOptions<Awaited<ReturnType<typeof openNativeReader>>, TError, OpenNativeReaderMutationVariables, TContext>;
|
|
153
|
-
request?: SecondParameter<typeof request>;
|
|
154
|
-
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof openNativeReader>>, TError, OpenNativeReaderMutationVariables, TContext>;
|
|
155
|
-
export declare const getListCurrentReadingsUrl: (provider: PartnerProvider) => string;
|
|
156
|
-
/**
|
|
157
|
-
* The partner's own "continue reading" list, joined back to our catalogue.
|
|
158
|
-
*
|
|
159
|
-
* Entries the partner knows and our catalogue does not are dropped rather than
|
|
160
|
-
* surfaced with a null id: the import runs nightly and the partner's list is
|
|
161
|
-
* live, so a title added today is genuinely not browsable here yet, and a card
|
|
162
|
-
* that cannot be opened is worse than one that is absent.
|
|
163
|
-
* @summary List Current Readings
|
|
164
|
-
*/
|
|
165
|
-
export declare const listCurrentReadings: (provider: PartnerProvider, options?: Parameters<typeof request>[1]) => Promise<CurrentReadingListRead>;
|
|
166
|
-
export declare const getListCurrentReadingsQueryKey: (provider: PartnerProvider) => readonly ["/partners/nextory/readings" | "/partners/youscribe/readings"];
|
|
167
|
-
export declare const getListCurrentReadingsQueryOptions: <TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
|
|
168
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>>;
|
|
169
|
-
request?: SecondParameter<typeof request>;
|
|
170
|
-
}) => UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData> & {
|
|
171
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
172
|
-
};
|
|
173
|
-
export type ListCurrentReadingsQueryResult = NonNullable<Awaited<ReturnType<typeof listCurrentReadings>>>;
|
|
174
|
-
export type ListCurrentReadingsQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
175
|
-
export declare function useListCurrentReadings<TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options: {
|
|
176
|
-
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, Awaited<ReturnType<typeof listCurrentReadings>>>, 'initialData'>;
|
|
177
|
-
request?: SecondParameter<typeof request>;
|
|
178
|
-
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
179
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
180
|
-
};
|
|
181
|
-
export declare function useListCurrentReadings<TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
|
|
182
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, Awaited<ReturnType<typeof listCurrentReadings>>>, 'initialData'>;
|
|
183
|
-
request?: SecondParameter<typeof request>;
|
|
184
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
185
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
186
|
-
};
|
|
187
|
-
export declare function useListCurrentReadings<TData = Awaited<ReturnType<typeof listCurrentReadings>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
|
|
188
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof listCurrentReadings>>, TError, TData>>;
|
|
189
|
-
request?: SecondParameter<typeof request>;
|
|
190
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
191
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
192
|
-
};
|
|
193
|
-
export declare const getReadNativeAuthUrl: (provider: PartnerProvider) => string;
|
|
194
|
-
/**
|
|
195
|
-
* YouScribe native SDK credentials for the selected, authorized profile.
|
|
196
|
-
*
|
|
197
|
-
* Equivalent to the legacy YouScribe user/auth endpoint. This does not create
|
|
198
|
-
* a licence or a consumption event. Open a title through its reader-auth POST
|
|
199
|
-
* to obtain the lease used for consumption heartbeats. The token is personal:
|
|
200
|
-
* never persist it, log it, or share it between profiles.
|
|
201
|
-
* @summary Read Native Auth
|
|
202
|
-
*/
|
|
203
|
-
export declare const readNativeAuth: (provider: PartnerProvider, options?: Parameters<typeof request>[1]) => Promise<YouScribeAuthRead>;
|
|
204
|
-
export declare const getReadNativeAuthQueryKey: (provider: PartnerProvider) => readonly ["/partners/nextory/user/auth" | "/partners/youscribe/user/auth"];
|
|
205
|
-
export declare const getReadNativeAuthQueryOptions: <TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
|
|
206
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>;
|
|
207
|
-
request?: SecondParameter<typeof request>;
|
|
208
|
-
}) => UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData> & {
|
|
209
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
210
|
-
};
|
|
211
|
-
export type ReadNativeAuthQueryResult = NonNullable<Awaited<ReturnType<typeof readNativeAuth>>>;
|
|
212
|
-
export type ReadNativeAuthQueryError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
213
|
-
export declare function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options: {
|
|
214
|
-
query: Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>> & Pick<DefinedInitialDataOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, Awaited<ReturnType<typeof readNativeAuth>>>, 'initialData'>;
|
|
215
|
-
request?: SecondParameter<typeof request>;
|
|
216
|
-
}, queryClient?: QueryClient): DefinedUseQueryResult<TData, TError> & {
|
|
217
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
218
|
-
};
|
|
219
|
-
export declare function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
|
|
220
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>> & Pick<UndefinedInitialDataOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, Awaited<ReturnType<typeof readNativeAuth>>>, 'initialData'>;
|
|
221
|
-
request?: SecondParameter<typeof request>;
|
|
222
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
223
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
224
|
-
};
|
|
225
|
-
export declare function useReadNativeAuth<TData = Awaited<ReturnType<typeof readNativeAuth>>, TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>>(provider: PartnerProvider, options?: {
|
|
226
|
-
query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof readNativeAuth>>, TError, TData>>;
|
|
227
|
-
request?: SecondParameter<typeof request>;
|
|
228
|
-
}, queryClient?: QueryClient): UseQueryResult<TData, TError> & {
|
|
229
|
-
queryKey: DataTag<QueryKey, TData, TError>;
|
|
230
|
-
};
|
|
231
|
-
export declare const getOpenNativeAuthUrl: (provider: PartnerProvider) => string;
|
|
232
|
-
/**
|
|
233
|
-
* Open the YouScribe reader for this profile, provisioning on first use.
|
|
234
|
-
*
|
|
235
|
-
* Call only on the user's explicit reader-opening action. This can create a
|
|
236
|
-
* paid subscription. Never prefetch it during login, onboarding or browsing.
|
|
237
|
-
* Existing seats are reused; new seats require medium authentication assurance.
|
|
238
|
-
* For a selected title use POST /media/{mediaId}/reader-auth to also obtain
|
|
239
|
-
* the consumption lease. GET /user/auth never provisions.
|
|
240
|
-
* @summary Open Native Auth
|
|
241
|
-
*/
|
|
242
|
-
export declare const openNativeAuth: (provider: PartnerProvider, options?: Parameters<typeof request>[1]) => Promise<YouScribeAuthRead>;
|
|
243
|
-
export declare const getOpenNativeAuthMutationKey: () => readonly ['openNativeAuth'];
|
|
244
|
-
export declare const getOpenNativeAuthMutationOptions: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
245
|
-
mutation?: UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError, OpenNativeAuthMutationVariables, TContext>;
|
|
246
|
-
request?: SecondParameter<typeof request>;
|
|
247
|
-
}) => UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError, OpenNativeAuthMutationVariables, TContext>;
|
|
248
|
-
export type OpenNativeAuthMutationResult = NonNullable<Awaited<ReturnType<typeof openNativeAuth>>>;
|
|
249
|
-
export type OpenNativeAuthMutationError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>;
|
|
250
|
-
export type OpenNativeAuthMutationVariables = {
|
|
251
|
-
provider: PartnerProvider;
|
|
252
|
-
};
|
|
253
|
-
/**
|
|
254
|
-
* @summary Open Native Auth
|
|
255
|
-
*/
|
|
256
|
-
export declare const useOpenNativeAuth: <TError = ErrorType<HTTPExceptionResponse | ValidationErrorResponse>, TContext = unknown>(options?: {
|
|
257
|
-
mutation?: UseMutationOptions<Awaited<ReturnType<typeof openNativeAuth>>, TError, OpenNativeAuthMutationVariables, TContext>;
|
|
258
|
-
request?: SecondParameter<typeof request>;
|
|
259
|
-
}, queryClient?: QueryClient) => UseMutationResult<Awaited<ReturnType<typeof openNativeAuth>>, TError, OpenNativeAuthMutationVariables, TContext>;
|
|
260
|
-
//#endregion
|
|
261
|
-
//# sourceMappingURL=partner-reader.d.ts.map
|
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { r as request } from "../chunks/client.js";
|
|
3
|
-
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
|
-
//#region src/react/partner-reader/partner-reader.ts
|
|
5
|
-
/**
|
|
6
|
-
* Generated by orval 🍺
|
|
7
|
-
* Do not edit manually.
|
|
8
|
-
* Mozaik backend
|
|
9
|
-
* Four products behind one API — Biblio, Médiathèques, the partner catalogues (Nextory and YouScribe) and Prof Express. Authentication is Keycloak SSO only, once, for all of them: see the **auth** section below for the browser flow and the three failure modes.
|
|
10
|
-
* OpenAPI spec version: 0.14.2
|
|
11
|
-
*/
|
|
12
|
-
const withQueryKey = (query, queryKey) => {
|
|
13
|
-
const result = { queryKey };
|
|
14
|
-
for (const key of Object.keys(query)) {
|
|
15
|
-
if (key === "queryKey") continue;
|
|
16
|
-
Object.defineProperty(result, key, {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
configurable: true,
|
|
19
|
-
get: () => query[key]
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
return result;
|
|
23
|
-
};
|
|
24
|
-
const getReadPackageUrl = (provider, mediaId, params) => {
|
|
25
|
-
const normalizedParams = new URLSearchParams();
|
|
26
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
27
|
-
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
28
|
-
});
|
|
29
|
-
const stringifiedParams = normalizedParams.toString();
|
|
30
|
-
return stringifiedParams.length > 0 ? `/partners/${provider}/media/${mediaId}/package?${stringifiedParams}` : `/partners/${provider}/media/${mediaId}/package`;
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Where to fetch the content itself.
|
|
34
|
-
*
|
|
35
|
-
* The returned URL is a short-lived DRM-wrapped credential. It is not cached
|
|
36
|
-
* here and should not be stored by the client.
|
|
37
|
-
*
|
|
38
|
-
* Opens a consumption lease, so the read appears in the ledger and counts
|
|
39
|
-
* against the establishment's live seats like any other. Its id comes back in
|
|
40
|
-
* ``lease``: keep it alive with ``PUT /consumption/{eventId}`` and drop it with
|
|
41
|
-
* ``DELETE`` when the reader closes. A client that does neither is not broken
|
|
42
|
-
* — the reaper closes the lease about a minute after the last heartbeat — but
|
|
43
|
-
* every such read is a seat held past the end of it.
|
|
44
|
-
*
|
|
45
|
-
* Re-opening the same title returns the lease already held rather than a
|
|
46
|
-
* second one, so a page reload does not leak a seat.
|
|
47
|
-
* @summary Read Package
|
|
48
|
-
*/
|
|
49
|
-
const readPackage = async (provider, mediaId, params, options) => {
|
|
50
|
-
return request(getReadPackageUrl(provider, mediaId, params), {
|
|
51
|
-
...options,
|
|
52
|
-
method: "GET"
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
const getReadPackageQueryKey = (provider, mediaId, params) => {
|
|
56
|
-
return [`/partners/${provider}/media/${mediaId}/package`, ...params ? [params] : []];
|
|
57
|
-
};
|
|
58
|
-
const getReadPackageQueryOptions = (provider, mediaId, params, options) => {
|
|
59
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
60
|
-
const queryKey = queryOptions?.queryKey ?? getReadPackageQueryKey(provider, mediaId, params);
|
|
61
|
-
const queryFn = ({ signal }) => readPackage(provider, mediaId, params, {
|
|
62
|
-
signal,
|
|
63
|
-
...requestOptions
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
queryKey,
|
|
67
|
-
queryFn,
|
|
68
|
-
enabled: provider !== null && provider !== void 0 && mediaId !== null && mediaId !== void 0,
|
|
69
|
-
...queryOptions
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* @summary Read Package
|
|
74
|
-
*/
|
|
75
|
-
function useReadPackage(provider, mediaId, params, options, queryClient) {
|
|
76
|
-
const queryOptions = getReadPackageQueryOptions(provider, mediaId, params, options);
|
|
77
|
-
const query = useQuery(queryOptions, queryClient);
|
|
78
|
-
return withQueryKey(query, queryOptions.queryKey);
|
|
79
|
-
}
|
|
80
|
-
const getReadPositionUrl = (provider, mediaId) => {
|
|
81
|
-
return `/partners/${provider}/media/${mediaId}/position`;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* The last synchronized local position, or the partner's when none is saved.
|
|
85
|
-
*
|
|
86
|
-
* ``404`` when the partner holds no position — a book never opened has no
|
|
87
|
-
* place to return to, and reporting zero would make a client jump a reader who
|
|
88
|
-
* *is* mid-book back to the start if the call ever failed soft.
|
|
89
|
-
* @summary Read Position
|
|
90
|
-
*/
|
|
91
|
-
const readPosition = async (provider, mediaId, options) => {
|
|
92
|
-
return request(getReadPositionUrl(provider, mediaId), {
|
|
93
|
-
...options,
|
|
94
|
-
method: "GET"
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
const getReadPositionQueryKey = (provider, mediaId) => {
|
|
98
|
-
return [`/partners/${provider}/media/${mediaId}/position`];
|
|
99
|
-
};
|
|
100
|
-
const getReadPositionQueryOptions = (provider, mediaId, options) => {
|
|
101
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
102
|
-
const queryKey = queryOptions?.queryKey ?? getReadPositionQueryKey(provider, mediaId);
|
|
103
|
-
const queryFn = ({ signal }) => readPosition(provider, mediaId, {
|
|
104
|
-
signal,
|
|
105
|
-
...requestOptions
|
|
106
|
-
});
|
|
107
|
-
return {
|
|
108
|
-
queryKey,
|
|
109
|
-
queryFn,
|
|
110
|
-
enabled: provider !== null && provider !== void 0 && mediaId !== null && mediaId !== void 0,
|
|
111
|
-
...queryOptions
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* @summary Read Position
|
|
116
|
-
*/
|
|
117
|
-
function useReadPosition(provider, mediaId, options, queryClient) {
|
|
118
|
-
const queryOptions = getReadPositionQueryOptions(provider, mediaId, options);
|
|
119
|
-
const query = useQuery(queryOptions, queryClient);
|
|
120
|
-
return withQueryKey(query, queryOptions.queryKey);
|
|
121
|
-
}
|
|
122
|
-
const getWritePositionUrl = (provider, mediaId) => {
|
|
123
|
-
return `/partners/${provider}/media/${mediaId}/position`;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Synchronize and save progress, with the partner's metering alongside it.
|
|
127
|
-
*
|
|
128
|
-
* ``usage_blocks`` is forwarded before a new position, matching the legacy's
|
|
129
|
-
* call order. The two reports are independent: an older position may carry
|
|
130
|
-
* usage the partner has not received yet.
|
|
131
|
-
*
|
|
132
|
-
* Only a strictly newer ``reachedAt`` replaces the saved position. Stale or
|
|
133
|
-
* duplicate writes return that saved position without updating it upstream.
|
|
134
|
-
* Provided usage blocks are still forwarded, including on retries; the
|
|
135
|
-
* partner's deduplication contract is unknown. Conflicting positions at the
|
|
136
|
-
* same instant return 409 before any outbound write.
|
|
137
|
-
* Progress is a resume point, not a measurement of time spent reading.
|
|
138
|
-
* @summary Write Position
|
|
139
|
-
*/
|
|
140
|
-
const writePosition = async (provider, mediaId, readingPositionWrite, options) => {
|
|
141
|
-
const getHeaders = (h) => {
|
|
142
|
-
if (!h) return {};
|
|
143
|
-
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
144
|
-
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
145
|
-
const headers = {};
|
|
146
|
-
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
147
|
-
return headers;
|
|
148
|
-
};
|
|
149
|
-
return request(getWritePositionUrl(provider, mediaId), {
|
|
150
|
-
...options,
|
|
151
|
-
method: "PATCH",
|
|
152
|
-
headers: {
|
|
153
|
-
"Content-Type": "application/json",
|
|
154
|
-
...getHeaders(options?.headers)
|
|
155
|
-
},
|
|
156
|
-
body: JSON.stringify(readingPositionWrite)
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
|
-
const getWritePositionMutationKey = () => ["writePosition"];
|
|
160
|
-
const getWritePositionMutationOptions = (options) => {
|
|
161
|
-
const mutationKey = getWritePositionMutationKey();
|
|
162
|
-
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
163
|
-
...options,
|
|
164
|
-
mutation: {
|
|
165
|
-
...options.mutation,
|
|
166
|
-
mutationKey
|
|
167
|
-
}
|
|
168
|
-
} : {
|
|
169
|
-
mutation: { mutationKey },
|
|
170
|
-
request: void 0
|
|
171
|
-
};
|
|
172
|
-
const mutationFn = (props) => {
|
|
173
|
-
const { provider, mediaId, data } = props ?? {};
|
|
174
|
-
return writePosition(provider, mediaId, data, requestOptions);
|
|
175
|
-
};
|
|
176
|
-
return {
|
|
177
|
-
mutationFn,
|
|
178
|
-
...mutationOptions
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
/**
|
|
182
|
-
* @summary Write Position
|
|
183
|
-
*/
|
|
184
|
-
const useWritePosition = (options, queryClient) => {
|
|
185
|
-
return useMutation(getWritePositionMutationOptions(options), queryClient);
|
|
186
|
-
};
|
|
187
|
-
const getOpenNativeReaderUrl = (provider, mediaId) => {
|
|
188
|
-
return `/partners/${provider}/media/${mediaId}/reader-auth`;
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Authorize a YouScribe native title and open its consumption lease.
|
|
192
|
-
*
|
|
193
|
-
* Pass externalId and token to the YouScribe SDK. Mozaik requests keep using
|
|
194
|
-
* mediaId. Renew lease.eventId while the reader is open and close it when the
|
|
195
|
-
* reader exits; reopening the same title reuses its active lease.
|
|
196
|
-
* @summary Open Native Reader
|
|
197
|
-
*/
|
|
198
|
-
const openNativeReader = async (provider, mediaId, options) => {
|
|
199
|
-
return request(getOpenNativeReaderUrl(provider, mediaId), {
|
|
200
|
-
...options,
|
|
201
|
-
method: "POST"
|
|
202
|
-
});
|
|
203
|
-
};
|
|
204
|
-
const getOpenNativeReaderMutationKey = () => ["openNativeReader"];
|
|
205
|
-
const getOpenNativeReaderMutationOptions = (options) => {
|
|
206
|
-
const mutationKey = getOpenNativeReaderMutationKey();
|
|
207
|
-
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
208
|
-
...options,
|
|
209
|
-
mutation: {
|
|
210
|
-
...options.mutation,
|
|
211
|
-
mutationKey
|
|
212
|
-
}
|
|
213
|
-
} : {
|
|
214
|
-
mutation: { mutationKey },
|
|
215
|
-
request: void 0
|
|
216
|
-
};
|
|
217
|
-
const mutationFn = (props) => {
|
|
218
|
-
const { provider, mediaId } = props ?? {};
|
|
219
|
-
return openNativeReader(provider, mediaId, requestOptions);
|
|
220
|
-
};
|
|
221
|
-
return {
|
|
222
|
-
mutationFn,
|
|
223
|
-
...mutationOptions
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
/**
|
|
227
|
-
* @summary Open Native Reader
|
|
228
|
-
*/
|
|
229
|
-
const useOpenNativeReader = (options, queryClient) => {
|
|
230
|
-
return useMutation(getOpenNativeReaderMutationOptions(options), queryClient);
|
|
231
|
-
};
|
|
232
|
-
const getListCurrentReadingsUrl = (provider) => {
|
|
233
|
-
return `/partners/${provider}/readings`;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* The partner's own "continue reading" list, joined back to our catalogue.
|
|
237
|
-
*
|
|
238
|
-
* Entries the partner knows and our catalogue does not are dropped rather than
|
|
239
|
-
* surfaced with a null id: the import runs nightly and the partner's list is
|
|
240
|
-
* live, so a title added today is genuinely not browsable here yet, and a card
|
|
241
|
-
* that cannot be opened is worse than one that is absent.
|
|
242
|
-
* @summary List Current Readings
|
|
243
|
-
*/
|
|
244
|
-
const listCurrentReadings = async (provider, options) => {
|
|
245
|
-
return request(getListCurrentReadingsUrl(provider), {
|
|
246
|
-
...options,
|
|
247
|
-
method: "GET"
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
|
-
const getListCurrentReadingsQueryKey = (provider) => {
|
|
251
|
-
return [`/partners/${provider}/readings`];
|
|
252
|
-
};
|
|
253
|
-
const getListCurrentReadingsQueryOptions = (provider, options) => {
|
|
254
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
255
|
-
const queryKey = queryOptions?.queryKey ?? getListCurrentReadingsQueryKey(provider);
|
|
256
|
-
const queryFn = ({ signal }) => listCurrentReadings(provider, {
|
|
257
|
-
signal,
|
|
258
|
-
...requestOptions
|
|
259
|
-
});
|
|
260
|
-
return {
|
|
261
|
-
queryKey,
|
|
262
|
-
queryFn,
|
|
263
|
-
enabled: provider !== null && provider !== void 0,
|
|
264
|
-
...queryOptions
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
/**
|
|
268
|
-
* @summary List Current Readings
|
|
269
|
-
*/
|
|
270
|
-
function useListCurrentReadings(provider, options, queryClient) {
|
|
271
|
-
const queryOptions = getListCurrentReadingsQueryOptions(provider, options);
|
|
272
|
-
const query = useQuery(queryOptions, queryClient);
|
|
273
|
-
return withQueryKey(query, queryOptions.queryKey);
|
|
274
|
-
}
|
|
275
|
-
const getReadNativeAuthUrl = (provider) => {
|
|
276
|
-
return `/partners/${provider}/user/auth`;
|
|
277
|
-
};
|
|
278
|
-
/**
|
|
279
|
-
* YouScribe native SDK credentials for the selected, authorized profile.
|
|
280
|
-
*
|
|
281
|
-
* Equivalent to the legacy YouScribe user/auth endpoint. This does not create
|
|
282
|
-
* a licence or a consumption event. Open a title through its reader-auth POST
|
|
283
|
-
* to obtain the lease used for consumption heartbeats. The token is personal:
|
|
284
|
-
* never persist it, log it, or share it between profiles.
|
|
285
|
-
* @summary Read Native Auth
|
|
286
|
-
*/
|
|
287
|
-
const readNativeAuth = async (provider, options) => {
|
|
288
|
-
return request(getReadNativeAuthUrl(provider), {
|
|
289
|
-
...options,
|
|
290
|
-
method: "GET"
|
|
291
|
-
});
|
|
292
|
-
};
|
|
293
|
-
const getReadNativeAuthQueryKey = (provider) => {
|
|
294
|
-
return [`/partners/${provider}/user/auth`];
|
|
295
|
-
};
|
|
296
|
-
const getReadNativeAuthQueryOptions = (provider, options) => {
|
|
297
|
-
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
298
|
-
const queryKey = queryOptions?.queryKey ?? getReadNativeAuthQueryKey(provider);
|
|
299
|
-
const queryFn = ({ signal }) => readNativeAuth(provider, {
|
|
300
|
-
signal,
|
|
301
|
-
...requestOptions
|
|
302
|
-
});
|
|
303
|
-
return {
|
|
304
|
-
queryKey,
|
|
305
|
-
queryFn,
|
|
306
|
-
enabled: provider !== null && provider !== void 0,
|
|
307
|
-
...queryOptions
|
|
308
|
-
};
|
|
309
|
-
};
|
|
310
|
-
/**
|
|
311
|
-
* @summary Read Native Auth
|
|
312
|
-
*/
|
|
313
|
-
function useReadNativeAuth(provider, options, queryClient) {
|
|
314
|
-
const queryOptions = getReadNativeAuthQueryOptions(provider, options);
|
|
315
|
-
const query = useQuery(queryOptions, queryClient);
|
|
316
|
-
return withQueryKey(query, queryOptions.queryKey);
|
|
317
|
-
}
|
|
318
|
-
const getOpenNativeAuthUrl = (provider) => {
|
|
319
|
-
return `/partners/${provider}/user/auth`;
|
|
320
|
-
};
|
|
321
|
-
/**
|
|
322
|
-
* Open the YouScribe reader for this profile, provisioning on first use.
|
|
323
|
-
*
|
|
324
|
-
* Call only on the user's explicit reader-opening action. This can create a
|
|
325
|
-
* paid subscription. Never prefetch it during login, onboarding or browsing.
|
|
326
|
-
* Existing seats are reused; new seats require medium authentication assurance.
|
|
327
|
-
* For a selected title use POST /media/{mediaId}/reader-auth to also obtain
|
|
328
|
-
* the consumption lease. GET /user/auth never provisions.
|
|
329
|
-
* @summary Open Native Auth
|
|
330
|
-
*/
|
|
331
|
-
const openNativeAuth = async (provider, options) => {
|
|
332
|
-
return request(getOpenNativeAuthUrl(provider), {
|
|
333
|
-
...options,
|
|
334
|
-
method: "POST"
|
|
335
|
-
});
|
|
336
|
-
};
|
|
337
|
-
const getOpenNativeAuthMutationKey = () => ["openNativeAuth"];
|
|
338
|
-
const getOpenNativeAuthMutationOptions = (options) => {
|
|
339
|
-
const mutationKey = getOpenNativeAuthMutationKey();
|
|
340
|
-
const { mutation: mutationOptions, request: requestOptions } = options ? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey ? options : {
|
|
341
|
-
...options,
|
|
342
|
-
mutation: {
|
|
343
|
-
...options.mutation,
|
|
344
|
-
mutationKey
|
|
345
|
-
}
|
|
346
|
-
} : {
|
|
347
|
-
mutation: { mutationKey },
|
|
348
|
-
request: void 0
|
|
349
|
-
};
|
|
350
|
-
const mutationFn = (props) => {
|
|
351
|
-
const { provider } = props ?? {};
|
|
352
|
-
return openNativeAuth(provider, requestOptions);
|
|
353
|
-
};
|
|
354
|
-
return {
|
|
355
|
-
mutationFn,
|
|
356
|
-
...mutationOptions
|
|
357
|
-
};
|
|
358
|
-
};
|
|
359
|
-
/**
|
|
360
|
-
* @summary Open Native Auth
|
|
361
|
-
*/
|
|
362
|
-
const useOpenNativeAuth = (options, queryClient) => {
|
|
363
|
-
return useMutation(getOpenNativeAuthMutationOptions(options), queryClient);
|
|
364
|
-
};
|
|
365
|
-
//#endregion
|
|
366
|
-
export { getListCurrentReadingsQueryKey, getListCurrentReadingsQueryOptions, getListCurrentReadingsUrl, getOpenNativeAuthMutationKey, getOpenNativeAuthMutationOptions, getOpenNativeAuthUrl, getOpenNativeReaderMutationKey, getOpenNativeReaderMutationOptions, getOpenNativeReaderUrl, getReadNativeAuthQueryKey, getReadNativeAuthQueryOptions, getReadNativeAuthUrl, getReadPackageQueryKey, getReadPackageQueryOptions, getReadPackageUrl, getReadPositionQueryKey, getReadPositionQueryOptions, getReadPositionUrl, getWritePositionMutationKey, getWritePositionMutationOptions, getWritePositionUrl, listCurrentReadings, openNativeAuth, openNativeReader, readNativeAuth, readPackage, readPosition, useListCurrentReadings, useOpenNativeAuth, useOpenNativeReader, useReadNativeAuth, useReadPackage, useReadPosition, useWritePosition, writePosition };
|
|
367
|
-
|
|
368
|
-
//# sourceMappingURL=partner-reader.js.map
|