@concord-consortium/lara-interactive-api 1.4.0-pre.1 → 1.5.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/hooks.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { ISupportedFeatures } from "@concord-consortium/interactive-api-host";
2
1
  import { ICustomMessageHandler, ICustomMessagesHandledMap, IInitInteractive, ITextDecorationHandler } from "./types";
3
2
  declare type UpdateFunc<S> = (prevState: S | null) => S;
4
3
  export declare const useInteractiveState: <InteractiveState>() => {
@@ -17,5 +16,4 @@ export declare const useInitMessage: <InteractiveState = {}, AuthoredState = {},
17
16
  export declare const useCustomMessages: (callback: ICustomMessageHandler, handles?: ICustomMessagesHandledMap | undefined) => void;
18
17
  export declare const useDecorateContent: (callback: ITextDecorationHandler) => void;
19
18
  export declare const useAutoSetHeight: () => void;
20
- export declare const useSetSupportedFeatures: (features: ISupportedFeatures) => void;
21
19
  export {};
package/index-bundle.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ISupportedFeatures as ISupportedFeatures$1 } from '@concord-consortium/interactive-api-host';
1
+ import * as iframePhone from 'iframe-phone';
2
2
 
3
3
  interface IEventListener {
4
4
  type: string;
@@ -273,6 +273,7 @@ interface IAttachmentUrlRequest extends IBaseRequestResponse {
273
273
  interactiveId?: string;
274
274
  contentType?: string;
275
275
  expiresIn?: number;
276
+ platformUserId?: string;
276
277
  }
277
278
  interface IWriteAttachmentRequest extends IAttachmentUrlRequest {
278
279
  content: any;
@@ -573,6 +574,49 @@ declare const useInitMessage: <InteractiveState = {}, AuthoredState = {}, Global
573
574
  declare const useCustomMessages: (callback: ICustomMessageHandler, handles?: ICustomMessagesHandledMap | undefined) => void;
574
575
  declare const useDecorateContent: (callback: ITextDecorationHandler) => void;
575
576
  declare const useAutoSetHeight: () => void;
576
- declare const useSetSupportedFeatures: (features: ISupportedFeatures$1) => void;
577
577
 
578
- export { ChoiceId, ClientMessage, DeprecatedRuntimeClientMessage, DeprecatedRuntimeServerMessage, GetAttachmentUrlParams, GlobalIFrameSaverClientMessage, GlobalIFrameSaverServerMessage, IAddLinkedInteractiveStateListenerOptions, IAddLinkedInteractiveStateListenerRequest, IAttachmentUrlRequest, IAttachmentUrlResponse, IAuthInfo, IAuthoringClientMessage, IAuthoringCustomReportField, IAuthoringCustomReportFields, IAuthoringImageQuestionMetadata, IAuthoringInitInteractive, IAuthoringInteractiveMetadata, IAuthoringMetadata, IAuthoringMetadataBase, IAuthoringMultipleChoiceChoiceMetadata, IAuthoringMultipleChoiceMetadata, IAuthoringOpenResponseMetadata, IAuthoringServerMessage, IBaseShowModal, ICloseModal, IContextMember, IContextMembership, ICustomMessage, ICustomMessageHandler, ICustomMessageOptions, ICustomMessagesHandledMap, ICustomReportFieldsAuthoredState, ICustomReportFieldsAuthoredStateField, ICustomReportFieldsInteractiveState, IDataset, IDecoratedContentEvent, IGetAuthInfoRequest, IGetAuthInfoResponse, IGetFirebaseJwtRequest, IGetFirebaseJwtResponse, IGetInteractiveListOptions, IGetInteractiveListRequest, IGetInteractiveListResponse, IGetInteractiveSnapshotOptions, IGetInteractiveSnapshotRequest, IGetInteractiveSnapshotResponse, IGetLibraryInteractiveListOptions, IGetLibraryInteractiveListRequest, IGetLibraryInteractiveListResponse, IGetReportItemAnswer, IGetReportItemAnswerHandler, IHintRequest, IHostFeatureSupport, IHostFeatures, IHostModalSupport, IInitInteractive, IInteractiveListResponseItem, IInteractiveStateProps, IInteractiveStateWithDataset, IJwtClaims, IJwtResponse, ILibraryInteractiveListResponseItem, ILinkedInteractive, ILinkedInteractiveStateResponse, INavigationOptions, IPortalClaims, IRemoveLinkedInteractiveStateListenerRequest, IReportInitInteractive, IReportItemAnswer, IReportItemClientMessage, IReportItemInitInteractive, IReportItemServerMessage, IRuntimeClientMessage, IRuntimeCustomReportValues, IRuntimeImageQuestionMetadata, IRuntimeInitInteractive, IRuntimeInteractiveMetadata, IRuntimeMetadata, IRuntimeMetadataBase, IRuntimeMultipleChoiceMetadata, IRuntimeOpenResponseMetadata, IRuntimeServerMessage, ISetLinkedInteractives, IShowAlert, IShowDialog, IShowLightbox, IShowModal, ISupportedFeatures, ISupportedFeaturesRequest, ITextDecorationHandler, ITextDecorationHandlerInfo, ITextDecorationInfo, IThemeInfo, IWriteAttachmentRequest, IframePhoneServerMessage, InitInteractiveMode, InteractiveItemId, LoggerClientMessage, ModalType, ReadAttachmentParams, ServerMessage, WriteAttachmentParams, addAuthoredStateListener, addCustomMessageListener, addDecorateContentListener, addGetReportItemAnswerListener, addGlobalInteractiveStateListener, addInteractiveStateListener, addLinkedInteractiveStateListener, closeModal, flushStateUpdates, getAttachmentUrl, getAuthInfo, getAuthoredState, getFirebaseJwt, getGlobalInteractiveState, getInitInteractiveMessage, getInteractiveList, getInteractiveSnapshot, getInteractiveState, getLibraryInteractiveList, getMode, inIframe, log, postDecoratedContentEvent, readAttachment, removeAuthoredStateListener, removeCustomMessageListener, removeDecorateContentListener, removeGetReportItemAnswerListener, removeGlobalInteractiveStateListener, removeInteractiveStateListener, removeLinkedInteractiveStateListener, sendReportItemAnswer, setAuthoredState, setGlobalInteractiveState, setHeight, setHint, setInteractiveState, setInteractiveStateTimeout, setLinkedInteractives, setNavigation, setSupportedFeatures, showModal, useAuthoredState, useAutoSetHeight, useCustomMessages, useDecorateContent, useGlobalInteractiveState, useInitMessage, useInteractiveState, useSetSupportedFeatures, writeAttachment };
578
+ declare type ManagedStateEvent = "interactiveStateUpdated" | "globalInteractiveStateUpdated" | "authoredStateUpdated" | "initInteractive";
579
+ declare class ManagedState {
580
+ interactiveStateDirty: boolean;
581
+ private _initMessage;
582
+ private _interactiveState;
583
+ private _authoredState;
584
+ private _globalInteractiveState;
585
+ private emitter;
586
+ get initMessage(): any;
587
+ set initMessage(value: any);
588
+ get interactiveState(): any;
589
+ set interactiveState(value: any);
590
+ get authoredState(): any;
591
+ set authoredState(value: any);
592
+ get globalInteractiveState(): any;
593
+ set globalInteractiveState(value: any);
594
+ emit(event: ManagedStateEvent, content?: any): void;
595
+ on(event: ManagedStateEvent, handler: any): void;
596
+ off(event: ManagedStateEvent, handler: any): void;
597
+ once(event: ManagedStateEvent, handler: any): void;
598
+ }
599
+
600
+ declare const getClient: () => Client;
601
+ declare class Client {
602
+ phone: iframePhone.IFrameEndpoint;
603
+ managedState: ManagedState;
604
+ private customMessagesHandled;
605
+ private listeners;
606
+ private requestId;
607
+ constructor();
608
+ getNextRequestId(): number;
609
+ post(message: ClientMessage, content?: any): void;
610
+ addListener(message: ServerMessage, callback: iframePhone.ListenerCallback, requestId?: number): boolean;
611
+ removeListener(message: ServerMessage, requestId?: number, callback?: iframePhone.ListenerCallback): boolean;
612
+ addCustomMessageListener(callback: ICustomMessageHandler, handles?: ICustomMessagesHandledMap): void;
613
+ removeCustomMessageListener(): boolean;
614
+ addDecorateContentListener(callback: ITextDecorationHandler): void;
615
+ removeDecorateContentListener(): boolean;
616
+ addGetReportItemAnswerListener(callback: IGetReportItemAnswerHandler): void;
617
+ removeGetReportItemAnswerListener(): boolean;
618
+ setSupportedFeatures: (request: ISupportedFeaturesRequest) => void;
619
+ private connect;
620
+ }
621
+
622
+ export { ChoiceId, Client, ClientMessage, DeprecatedRuntimeClientMessage, DeprecatedRuntimeServerMessage, GetAttachmentUrlParams, GlobalIFrameSaverClientMessage, GlobalIFrameSaverServerMessage, IAddLinkedInteractiveStateListenerOptions, IAddLinkedInteractiveStateListenerRequest, IAttachmentUrlRequest, IAttachmentUrlResponse, IAuthInfo, IAuthoringClientMessage, IAuthoringCustomReportField, IAuthoringCustomReportFields, IAuthoringImageQuestionMetadata, IAuthoringInitInteractive, IAuthoringInteractiveMetadata, IAuthoringMetadata, IAuthoringMetadataBase, IAuthoringMultipleChoiceChoiceMetadata, IAuthoringMultipleChoiceMetadata, IAuthoringOpenResponseMetadata, IAuthoringServerMessage, IBaseShowModal, ICloseModal, IContextMember, IContextMembership, ICustomMessage, ICustomMessageHandler, ICustomMessageOptions, ICustomMessagesHandledMap, ICustomReportFieldsAuthoredState, ICustomReportFieldsAuthoredStateField, ICustomReportFieldsInteractiveState, IDataset, IDecoratedContentEvent, IGetAuthInfoRequest, IGetAuthInfoResponse, IGetFirebaseJwtRequest, IGetFirebaseJwtResponse, IGetInteractiveListOptions, IGetInteractiveListRequest, IGetInteractiveListResponse, IGetInteractiveSnapshotOptions, IGetInteractiveSnapshotRequest, IGetInteractiveSnapshotResponse, IGetLibraryInteractiveListOptions, IGetLibraryInteractiveListRequest, IGetLibraryInteractiveListResponse, IGetReportItemAnswer, IGetReportItemAnswerHandler, IHintRequest, IHostFeatureSupport, IHostFeatures, IHostModalSupport, IInitInteractive, IInteractiveListResponseItem, IInteractiveStateProps, IInteractiveStateWithDataset, IJwtClaims, IJwtResponse, ILibraryInteractiveListResponseItem, ILinkedInteractive, ILinkedInteractiveStateResponse, INavigationOptions, IPortalClaims, IRemoveLinkedInteractiveStateListenerRequest, IReportInitInteractive, IReportItemAnswer, IReportItemClientMessage, IReportItemInitInteractive, IReportItemServerMessage, IRuntimeClientMessage, IRuntimeCustomReportValues, IRuntimeImageQuestionMetadata, IRuntimeInitInteractive, IRuntimeInteractiveMetadata, IRuntimeMetadata, IRuntimeMetadataBase, IRuntimeMultipleChoiceMetadata, IRuntimeOpenResponseMetadata, IRuntimeServerMessage, ISetLinkedInteractives, IShowAlert, IShowDialog, IShowLightbox, IShowModal, ISupportedFeatures, ISupportedFeaturesRequest, ITextDecorationHandler, ITextDecorationHandlerInfo, ITextDecorationInfo, IThemeInfo, IWriteAttachmentRequest, IframePhoneServerMessage, InitInteractiveMode, InteractiveItemId, LoggerClientMessage, ModalType, ReadAttachmentParams, ServerMessage, WriteAttachmentParams, addAuthoredStateListener, addCustomMessageListener, addDecorateContentListener, addGetReportItemAnswerListener, addGlobalInteractiveStateListener, addInteractiveStateListener, addLinkedInteractiveStateListener, closeModal, flushStateUpdates, getAttachmentUrl, getAuthInfo, getAuthoredState, getClient, getFirebaseJwt, getGlobalInteractiveState, getInitInteractiveMessage, getInteractiveList, getInteractiveSnapshot, getInteractiveState, getLibraryInteractiveList, getMode, inIframe, log, postDecoratedContentEvent, readAttachment, removeAuthoredStateListener, removeCustomMessageListener, removeDecorateContentListener, removeGetReportItemAnswerListener, removeGlobalInteractiveStateListener, removeInteractiveStateListener, removeLinkedInteractiveStateListener, sendReportItemAnswer, setAuthoredState, setGlobalInteractiveState, setHeight, setHint, setInteractiveState, setInteractiveStateTimeout, setLinkedInteractives, setNavigation, setSupportedFeatures, showModal, useAuthoredState, useAutoSetHeight, useCustomMessages, useDecorateContent, useGlobalInteractiveState, useInitMessage, useInteractiveState, writeAttachment };
package/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from "./metadata-types";
3
3
  export * from "./in-frame";
4
4
  export * from "./api";
5
5
  export * from "./hooks";
6
+ export * from "./client";
package/index.js CHANGED
@@ -4846,7 +4846,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
4846
4846
  }
4847
4847
  };
4848
4848
  Object.defineProperty(exports, "__esModule", { value: true });
4849
- exports.useSetSupportedFeatures = exports.useAutoSetHeight = exports.useDecorateContent = exports.useCustomMessages = exports.useInitMessage = exports.useGlobalInteractiveState = exports.useAuthoredState = exports.useInteractiveState = void 0;
4849
+ exports.useAutoSetHeight = exports.useDecorateContent = exports.useCustomMessages = exports.useInitMessage = exports.useGlobalInteractiveState = exports.useAuthoredState = exports.useInteractiveState = void 0;
4850
4850
  var react_1 = __webpack_require__(/*! react */ "react");
4851
4851
  var resize_observer_polyfill_1 = __webpack_require__(/*! resize-observer-polyfill */ "./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js");
4852
4852
  var client = __webpack_require__(/*! ./api */ "./src/interactive-api-client/api.ts");
@@ -4989,15 +4989,6 @@ var useAutoSetHeight = function () {
4989
4989
  }, [initMessage]);
4990
4990
  };
4991
4991
  exports.useAutoSetHeight = useAutoSetHeight;
4992
- var useSetSupportedFeatures = function (features) {
4993
- var initMessage = (0, exports.useInitMessage)();
4994
- (0, react_1.useEffect)(function () {
4995
- if (initMessage) {
4996
- client.setSupportedFeatures(features);
4997
- }
4998
- }, [initMessage]);
4999
- };
5000
- exports.useSetSupportedFeatures = useSetSupportedFeatures;
5001
4992
 
5002
4993
 
5003
4994
  /***/ }),
@@ -5052,6 +5043,7 @@ __exportStar(__webpack_require__(/*! ./metadata-types */ "./src/interactive-api-
5052
5043
  __exportStar(__webpack_require__(/*! ./in-frame */ "./src/interactive-api-client/in-frame.ts"), exports);
5053
5044
  __exportStar(__webpack_require__(/*! ./api */ "./src/interactive-api-client/api.ts"), exports);
5054
5045
  __exportStar(__webpack_require__(/*! ./hooks */ "./src/interactive-api-client/hooks.ts"), exports);
5046
+ __exportStar(__webpack_require__(/*! ./client */ "./src/interactive-api-client/client.ts"), exports);
5055
5047
 
5056
5048
 
5057
5049
  /***/ }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@concord-consortium/lara-interactive-api",
3
- "version": "1.4.0-pre.1",
3
+ "version": "1.5.0",
4
4
  "description": "LARA Interactive API client and types",
5
5
  "main": "./index.js",
6
6
  "types": "./index-bundle.d.ts",