botframework-webchat-core 4.18.2 → 4.19.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/LICENSE +21 -0
- package/activity.js +3 -0
- package/boot/deprecated/activity.js +7 -0
- package/boot/deprecated/activity.mjs +5 -0
- package/boot/deprecated/graph.js +7 -0
- package/boot/deprecated/graph.mjs +5 -0
- package/boot/deprecated/internal.js +7 -0
- package/boot/deprecated/internal.mjs +5 -0
- package/dist/WebChatActivity-CYqxBG_4.d.mts +271 -0
- package/dist/WebChatActivity-CYqxBG_4.d.ts +271 -0
- package/dist/_dtsroll-chunks/B7Whm73Q-tagged.d.ts +71 -0
- package/dist/_dtsroll-chunks/C-MxR98A-botframework-webchat-core-debug-api.d.ts +135 -0
- package/dist/_dtsroll-chunks/CAquHfZK-botframework-webchat-base.utils.d.ts +17 -0
- package/dist/_dtsroll-chunks/CDVed0Q--botframework-webchat-core.org-schema.d.ts +601 -0
- package/dist/_dtsroll-chunks/vlDgTKWF-botframework-webchat-core-graph.d.ts +239 -0
- package/dist/botframework-webchat-core.activity.d.mts +23 -0
- package/dist/botframework-webchat-core.activity.d.ts +23 -0
- package/dist/botframework-webchat-core.activity.js +2 -0
- package/dist/botframework-webchat-core.activity.js.map +1 -0
- package/dist/botframework-webchat-core.activity.mjs +2 -0
- package/dist/botframework-webchat-core.activity.mjs.map +1 -0
- package/dist/botframework-webchat-core.d.mts +267 -662
- package/dist/botframework-webchat-core.d.ts +556 -0
- package/dist/botframework-webchat-core.graph.d.mts +9 -0
- package/dist/botframework-webchat-core.graph.d.ts +9 -0
- package/dist/botframework-webchat-core.graph.js +2 -0
- package/dist/botframework-webchat-core.graph.js.map +1 -0
- package/dist/botframework-webchat-core.graph.mjs +2 -0
- package/dist/botframework-webchat-core.graph.mjs.map +1 -0
- package/dist/botframework-webchat-core.internal.d.mts +61 -0
- package/dist/botframework-webchat-core.internal.d.ts +61 -0
- package/dist/botframework-webchat-core.internal.js +2 -0
- package/dist/botframework-webchat-core.internal.js.map +1 -0
- package/dist/botframework-webchat-core.internal.mjs +2 -0
- package/dist/botframework-webchat-core.internal.mjs.map +1 -0
- package/dist/botframework-webchat-core.js +2 -0
- package/dist/botframework-webchat-core.js.map +1 -0
- package/dist/botframework-webchat-core.json-ld.d.mts +2 -0
- package/dist/botframework-webchat-core.json-ld.d.ts +2 -0
- package/dist/botframework-webchat-core.json-ld.js +2 -0
- package/dist/botframework-webchat-core.json-ld.js.map +1 -0
- package/dist/botframework-webchat-core.json-ld.mjs +2 -0
- package/dist/botframework-webchat-core.json-ld.mjs.map +1 -0
- package/dist/botframework-webchat-core.mjs +1 -2
- package/dist/botframework-webchat-core.mjs.map +1 -1
- package/dist/botframework-webchat-core.org-schema.d.mts +2 -0
- package/dist/botframework-webchat-core.org-schema.d.ts +2 -0
- package/dist/botframework-webchat-core.org-schema.js +2 -0
- package/dist/botframework-webchat-core.org-schema.js.map +1 -0
- package/dist/botframework-webchat-core.org-schema.mjs +2 -0
- package/dist/botframework-webchat-core.org-schema.mjs.map +1 -0
- package/dist/chunk-A4GEFYZJ.mjs +2 -0
- package/dist/chunk-A4GEFYZJ.mjs.map +1 -0
- package/dist/chunk-HZWWJL43.mjs +2 -0
- package/dist/chunk-HZWWJL43.mjs.map +1 -0
- package/dist/chunk-ICNZKQJW.mjs +2 -0
- package/dist/chunk-ICNZKQJW.mjs.map +1 -0
- package/dist/chunk-K6E6QQMQ.js +2 -0
- package/dist/chunk-K6E6QQMQ.js.map +1 -0
- package/dist/chunk-KPT5FBH2.mjs +2 -0
- package/dist/chunk-KPT5FBH2.mjs.map +1 -0
- package/dist/chunk-LO5BZSVE.js +2 -0
- package/dist/chunk-LO5BZSVE.js.map +1 -0
- package/dist/chunk-LP2X2JTR.js +2 -0
- package/dist/chunk-LP2X2JTR.js.map +1 -0
- package/dist/chunk-RUERYYZO.js +2 -0
- package/dist/chunk-RUERYYZO.js.map +1 -0
- package/dist/chunk-XOE3AOSM.js +2 -0
- package/dist/chunk-XOE3AOSM.js.map +1 -0
- package/dist/chunk-Y6ZDNVRT.mjs +2 -0
- package/dist/chunk-Y6ZDNVRT.mjs.map +1 -0
- package/{lib/createStore.d.ts → dist/createStore-CcvouBrW.d.mts} +29 -7
- package/dist/createStore-CcvouBrW.d.ts +65 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -1
- package/graph.js +3 -0
- package/internal.js +3 -0
- package/json-ld.js +3 -0
- package/org-schema.js +3 -0
- package/package.json +147 -73
- package/src/__tests__/activityFromBot.spec.js +2 -0
- package/src/__tests__/addMetaTag.spec.js +8 -0
- package/src/__tests__/addMetaTag.spec.mjs +8 -0
- package/src/__tests__/connectSaga.spec.js +2 -0
- package/src/__tests__/deleteKey.spec.js +2 -0
- package/src/__tests__/detectSlowConnectionSaga.spec.js +3 -1
- package/src/__tests__/observeOnce.spec.js +2 -0
- package/src/__tests__/speakableActivity.spec.js +2 -0
- package/src/__tests__/uniqueID.spec.js +2 -0
- package/src/actions/clearSuggestedActions.ts +20 -0
- package/src/actions/{connect.js → connect.ts} +9 -1
- package/src/actions/muteVoiceRecording.ts +17 -0
- package/src/actions/postVoiceActivity.ts +21 -0
- package/src/actions/registerActionSink.ts +29 -0
- package/src/actions/registerVoiceHandler.ts +24 -0
- package/src/actions/{sendEvent.js → sendEvent.ts} +1 -1
- package/src/actions/{sendMessageBack.js → sendMessageBack.ts} +1 -1
- package/src/actions/{sendPostBack.js → sendPostBack.ts} +1 -1
- package/src/actions/{setDictateInterims.js → setDictateInterims.ts} +1 -1
- package/src/actions/{setDictateState.js → setDictateState.ts} +1 -1
- package/src/actions/{setLanguage.js → setLanguage.ts} +1 -1
- package/src/actions/{setSendBox.js → setSendBox.ts} +1 -1
- package/src/actions/{setSendTimeout.js → setSendTimeout.ts} +1 -1
- package/src/actions/setSendTypingIndicator.ts +1 -1
- package/src/actions/setSuggestedActions.ts +35 -0
- package/src/actions/setVoiceState.ts +21 -0
- package/src/actions/startVoiceRecording.ts +17 -0
- package/src/actions/stopVoiceRecording.ts +17 -0
- package/src/actions/{submitSendBox.js → submitSendBox.ts} +1 -1
- package/src/actions/unmuteVoiceRecording.ts +17 -0
- package/src/actions/unregisterActionSink.ts +29 -0
- package/src/actions/unregisterVoiceHandler.ts +19 -0
- package/src/boot/activity.ts +19 -0
- package/src/boot/graph.ts +18 -0
- package/src/boot/internal.ts +11 -0
- package/src/boot/json-ld.ts +6 -0
- package/src/boot/org-schema.ts +29 -0
- package/src/buildInfo.ts +9 -0
- package/src/constants/{ActivityClientState.js → ActivityClientState.ts} +3 -3
- package/src/constants/DictateState.ts +10 -0
- package/src/createPromiseQueue.js +8 -6
- package/src/createReducer.ts +28 -20
- package/src/createSagas.ts +6 -3
- package/src/createStore.ts +26 -10
- package/src/env.d.ts +12 -0
- package/src/graph/createGraphFromStore.ts +121 -0
- package/src/index.ts +62 -45
- package/src/internal/StoreDebugAPIRegistry.ts +4 -0
- package/src/internal/actions/setRawState.ts +48 -0
- package/src/internal/types/suggestedActions.ts +11 -0
- package/src/internal/types/suggestedActionsOriginActivity.ts +16 -0
- package/src/reducers/activities/combineActivitiesReducer.ts +58 -0
- package/src/reducers/activities/createGroupedActivitiesReducer.ts +297 -0
- package/src/reducers/activities/patchActivity.ts +37 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.activity.spec.ts +144 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.howTo.spec.ts +148 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.howToWithLivestream.spec.ts +248 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.livestream.spec.ts +156 -0
- package/src/reducers/activities/sort/deleteActivityByLocalId.ts +177 -0
- package/src/reducers/activities/sort/private/computePartListTimestamp.ts +9 -0
- package/src/reducers/activities/sort/private/computeSortedActivities.ts +51 -0
- package/src/reducers/activities/sort/private/getLogicalTimestamp.spec.ts +49 -0
- package/src/reducers/activities/sort/private/getLogicalTimestamp.ts +33 -0
- package/src/reducers/activities/sort/private/getPartGroupingMetadataMap.spec.ts +92 -0
- package/src/reducers/activities/sort/private/getPartGroupingMetadataMap.ts +37 -0
- package/src/reducers/activities/sort/private/insertSorted.spec.ts +106 -0
- package/src/reducers/activities/sort/private/insertSorted.ts +18 -0
- package/src/reducers/activities/sort/property/LocalId.ts +60 -0
- package/src/reducers/activities/sort/property/Position.ts +39 -0
- package/src/reducers/activities/sort/property/ReceivedAt.ts +45 -0
- package/src/reducers/activities/sort/property/SendStatus.ts +51 -0
- package/src/reducers/activities/sort/queryLocalIdByActivityId.ts +6 -0
- package/src/reducers/activities/sort/queryLocalIdByClientActivityId.ts +6 -0
- package/src/reducers/activities/sort/types.ts +80 -0
- package/src/reducers/activities/sort/updateActivityChannelData.ts +101 -0
- package/src/reducers/activities/sort/updateSendState.ts +22 -0
- package/src/reducers/activities/sort/upsert.activity.spec.ts +500 -0
- package/src/reducers/activities/sort/upsert.howTo.spec.ts +368 -0
- package/src/reducers/activities/sort/upsert.howToWithLivestream.spec.ts +384 -0
- package/src/reducers/activities/sort/upsert.livestream.spec.ts +418 -0
- package/src/reducers/activities/sort/upsert.ts +498 -0
- package/src/reducers/activities/tsconfig.json +4 -0
- package/src/reducers/createNotificationsReducer.ts +4 -4
- package/src/reducers/suggestedActions.ts +21 -0
- package/src/reducers/suggestedActionsOriginActivity.ts +24 -0
- package/src/reducers/voiceActivity.ts +102 -0
- package/src/sagas/actionSinkSaga.ts +39 -0
- package/src/sagas/observeActivitySaga.ts +51 -1
- package/src/sagas/postActivitySaga.ts +17 -10
- package/src/sagas/postVoiceActivitySaga.ts +76 -0
- package/src/sagas/queueIncomingActivitySaga.ts +10 -4
- package/src/sagas/sendMessageToPostActivitySaga.ts +4 -1
- package/src/sagas/speakActivityAndStartDictateOnIncomingActivityFromOthersSaga.js +10 -4
- package/src/sagas/startDictateOnSpeakCompleteSaga.js +3 -3
- package/src/sagas/startSpeakActivityOnPostActivitySaga.js +15 -5
- package/src/sagas/stopDictateOnCardActionSaga.js +11 -3
- package/src/sagas/stopSpeakingActivityOnInputSaga.js +22 -4
- package/src/selectors/combineSelectors.ts +1 -1
- package/src/tsconfig.json +3 -15
- package/src/types/StoreDebugAPI.ts +25 -0
- package/src/types/WebChatActivity.ts +31 -14
- package/src/types/external/DirectLineActivity.ts +1 -1
- package/src/types/external/Observable.ts +4 -1
- package/src/types/internal/GlobalScopeClock.ts +10 -10
- package/src/types/internal/ReduxState.ts +2 -0
- package/src/types/internal/WebChatOutgoingActivity.ts +1 -1
- package/src/utils/dateToLocaleISOString.chatham.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.japan.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.newfoundland.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.pacific.spec.js +1 -2
- package/src/utils/dateToLocaleISOString.utc.spec.js +1 -3
- package/src/utils/deleteKey.ts +1 -1
- package/src/utils/getActivityLivestreamingMetadata.spec.ts +297 -0
- package/src/utils/getActivityLivestreamingMetadata.ts +197 -0
- package/src/utils/getOrgSchemaMessage.spec.ts +4 -1
- package/src/utils/getOrgSchemaMessage.ts +16 -16
- package/src/utils/onErrorResumeNext.ts +1 -1
- package/src/utils/voiceActivity/getVoiceActivityRole.spec.ts +150 -0
- package/src/utils/voiceActivity/getVoiceActivityRole.ts +16 -0
- package/src/utils/voiceActivity/getVoiceActivityText.spec.ts +100 -0
- package/src/utils/voiceActivity/getVoiceActivityText.ts +11 -0
- package/src/utils/voiceActivity/isVoiceActivity.spec.ts +202 -0
- package/src/utils/voiceActivity/isVoiceActivity.ts +21 -0
- package/src/utils/voiceActivity/isVoiceTranscriptActivity.spec.ts +224 -0
- package/src/utils/voiceActivity/isVoiceTranscriptActivity.ts +24 -0
- package/dist/botframework-webchat-core.mjs.LEGAL.txt +0 -0
- package/lib/actions/clearSuggestedActions.js +0 -15
- package/lib/actions/connect.js +0 -33
- package/lib/actions/connectionStatusUpdate.js +0 -20
- package/lib/actions/deleteActivity.d.ts +0 -13
- package/lib/actions/deleteActivity.d.ts.map +0 -1
- package/lib/actions/deleteActivity.js +0 -19
- package/lib/actions/disconnect.js +0 -21
- package/lib/actions/dismissNotification.d.ts +0 -12
- package/lib/actions/dismissNotification.d.ts.map +0 -1
- package/lib/actions/dismissNotification.js +0 -19
- package/lib/actions/emitTypingIndicator.js +0 -15
- package/lib/actions/incomingActivity.d.ts +0 -14
- package/lib/actions/incomingActivity.d.ts.map +0 -1
- package/lib/actions/incomingActivity.js +0 -19
- package/lib/actions/markActivity.d.ts +0 -17
- package/lib/actions/markActivity.d.ts.map +0 -1
- package/lib/actions/markActivity.js +0 -22
- package/lib/actions/postActivity.d.ts +0 -64
- package/lib/actions/postActivity.d.ts.map +0 -1
- package/lib/actions/postActivity.js +0 -31
- package/lib/actions/queueIncomingActivity.js +0 -18
- package/lib/actions/reconnect.js +0 -17
- package/lib/actions/sagaError.d.ts +0 -8
- package/lib/actions/sagaError.d.ts.map +0 -1
- package/lib/actions/sagaError.js +0 -15
- package/lib/actions/sendEvent.js +0 -19
- package/lib/actions/sendFiles.d.ts +0 -19
- package/lib/actions/sendFiles.d.ts.map +0 -1
- package/lib/actions/sendFiles.js +0 -20
- package/lib/actions/sendMessage.d.ts +0 -19
- package/lib/actions/sendMessage.d.ts.map +0 -1
- package/lib/actions/sendMessage.js +0 -24
- package/lib/actions/sendMessageBack.js +0 -20
- package/lib/actions/sendPostBack.js +0 -18
- package/lib/actions/setClockSkewAdjustment.js +0 -12
- package/lib/actions/setDictateInterims.js +0 -18
- package/lib/actions/setDictateState.js +0 -18
- package/lib/actions/setLanguage.js +0 -18
- package/lib/actions/setNotification.d.ts +0 -10
- package/lib/actions/setNotification.d.ts.map +0 -1
- package/lib/actions/setNotification.js +0 -37
- package/lib/actions/setReferenceGrammarID.js +0 -18
- package/lib/actions/setSendBox.js +0 -18
- package/lib/actions/setSendBoxAttachments.d.ts +0 -13
- package/lib/actions/setSendBoxAttachments.d.ts.map +0 -1
- package/lib/actions/setSendBoxAttachments.js +0 -18
- package/lib/actions/setSendTimeout.js +0 -18
- package/lib/actions/setSendTypingIndicator.d.ts +0 -11
- package/lib/actions/setSendTypingIndicator.d.ts.map +0 -1
- package/lib/actions/setSendTypingIndicator.js +0 -18
- package/lib/actions/setSuggestedActions.js +0 -20
- package/lib/actions/startDictate.js +0 -15
- package/lib/actions/startSpeakingActivity.js +0 -15
- package/lib/actions/stopDictate.js +0 -15
- package/lib/actions/stopSpeakingActivity.js +0 -15
- package/lib/actions/submitSendBox.js +0 -22
- package/lib/actions/updateConnectionStatus.js +0 -18
- package/lib/constants/ActivityClientState.js +0 -16
- package/lib/constants/DictateState.js +0 -17
- package/lib/createPromiseQueue.js +0 -30
- package/lib/createReducer.d.ts +0 -60
- package/lib/createReducer.d.ts.map +0 -1
- package/lib/createReducer.js +0 -45
- package/lib/createSagas.d.ts +0 -8
- package/lib/createSagas.d.ts.map +0 -1
- package/lib/createSagas.js +0 -112
- package/lib/createStore.d.ts.map +0 -1
- package/lib/createStore.js +0 -131
- package/lib/definitions/activityFromBot.js +0 -11
- package/lib/definitions/speakableActivity.js +0 -10
- package/lib/definitions/speakingActivity.js +0 -13
- package/lib/index.d.ts +0 -76
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -309
- package/lib/reducers/connectivityStatus.js +0 -49
- package/lib/reducers/createActivitiesReducer.d.ts +0 -12
- package/lib/reducers/createActivitiesReducer.d.ts.map +0 -1
- package/lib/reducers/createActivitiesReducer.js +0 -267
- package/lib/reducers/createInternalReducer.d.ts +0 -10
- package/lib/reducers/createInternalReducer.d.ts.map +0 -1
- package/lib/reducers/createInternalReducer.js +0 -19
- package/lib/reducers/createNotificationsReducer.d.ts +0 -11
- package/lib/reducers/createNotificationsReducer.d.ts.map +0 -1
- package/lib/reducers/createNotificationsReducer.js +0 -55
- package/lib/reducers/createTypingReducer.d.ts +0 -14
- package/lib/reducers/createTypingReducer.d.ts.map +0 -1
- package/lib/reducers/createTypingReducer.js +0 -50
- package/lib/reducers/dictateInterims.js +0 -23
- package/lib/reducers/dictateState.js +0 -38
- package/lib/reducers/language.js +0 -23
- package/lib/reducers/private/findBeforeAfter.d.ts +0 -4
- package/lib/reducers/private/findBeforeAfter.d.ts.map +0 -1
- package/lib/reducers/private/findBeforeAfter.js +0 -24
- package/lib/reducers/readyState.js +0 -23
- package/lib/reducers/referenceGrammarID.js +0 -23
- package/lib/reducers/sendBoxAttachments.d.ts +0 -9
- package/lib/reducers/sendBoxAttachments.d.ts.map +0 -1
- package/lib/reducers/sendBoxAttachments.js +0 -23
- package/lib/reducers/sendBoxValue.js +0 -23
- package/lib/reducers/sendTimeout.js +0 -23
- package/lib/reducers/sendTypingIndicator.js +0 -23
- package/lib/reducers/shouldSpeakIncomingActivity.js +0 -25
- package/lib/reducers/suggestedActions.js +0 -32
- package/lib/sagas/clearSuggestedActionsOnPostActivitySaga.js +0 -62
- package/lib/sagas/connectSaga.js +0 -445
- package/lib/sagas/connectionStatusToNotificationSaga.js +0 -107
- package/lib/sagas/connectionStatusUpdateSaga.js +0 -63
- package/lib/sagas/detectSlowConnectionSaga.d.ts +0 -5
- package/lib/sagas/detectSlowConnectionSaga.d.ts.map +0 -1
- package/lib/sagas/detectSlowConnectionSaga.js +0 -50
- package/lib/sagas/effects/forever.js +0 -19
- package/lib/sagas/effects/forkPut.js +0 -51
- package/lib/sagas/effects/observeEach.js +0 -45
- package/lib/sagas/effects/observeOnce.d.ts +0 -3
- package/lib/sagas/effects/observeOnce.d.ts.map +0 -1
- package/lib/sagas/effects/observeOnce.js +0 -42
- package/lib/sagas/effects/whileConnected.d.ts +0 -7
- package/lib/sagas/effects/whileConnected.d.ts.map +0 -1
- package/lib/sagas/effects/whileConnected.js +0 -55
- package/lib/sagas/emitTypingIndicatorToPostActivitySaga.js +0 -63
- package/lib/sagas/markAllAsSpokenOnStopSpeakActivitySaga.js +0 -78
- package/lib/sagas/observeActivitySaga.d.ts +0 -2
- package/lib/sagas/observeActivitySaga.d.ts.map +0 -1
- package/lib/sagas/observeActivitySaga.js +0 -117
- package/lib/sagas/postActivitySaga.d.ts +0 -3
- package/lib/sagas/postActivitySaga.d.ts.map +0 -1
- package/lib/sagas/postActivitySaga.js +0 -264
- package/lib/sagas/queueIncomingActivitySaga.d.ts +0 -3
- package/lib/sagas/queueIncomingActivitySaga.d.ts.map +0 -1
- package/lib/sagas/queueIncomingActivitySaga.js +0 -197
- package/lib/sagas/sendEventToPostActivitySaga.js +0 -68
- package/lib/sagas/sendFilesToPostActivitySaga.js +0 -85
- package/lib/sagas/sendMessageBackToPostActivitySaga.js +0 -70
- package/lib/sagas/sendMessageToPostActivitySaga.d.ts +0 -2
- package/lib/sagas/sendMessageToPostActivitySaga.d.ts.map +0 -1
- package/lib/sagas/sendMessageToPostActivitySaga.js +0 -91
- package/lib/sagas/sendPostBackToPostActivitySaga.js +0 -69
- package/lib/sagas/sendTypingIndicatorOnSetSendBoxSaga.d.ts +0 -3
- package/lib/sagas/sendTypingIndicatorOnSetSendBoxSaga.d.ts.map +0 -1
- package/lib/sagas/sendTypingIndicatorOnSetSendBoxSaga.js +0 -145
- package/lib/sagas/speakActivityAndStartDictateOnIncomingActivityFromOthersSaga.js +0 -106
- package/lib/sagas/startDictateOnSpeakCompleteSaga.js +0 -65
- package/lib/sagas/startSpeakActivityOnPostActivitySaga.js +0 -62
- package/lib/sagas/stopDictateOnCardActionSaga.js +0 -65
- package/lib/sagas/stopSpeakingActivityOnInputSaga.js +0 -68
- package/lib/sagas/submitSendBoxSaga.js +0 -84
- package/lib/selectors/activities.d.ts +0 -9
- package/lib/selectors/activities.d.ts.map +0 -1
- package/lib/selectors/activities.js +0 -33
- package/lib/selectors/combineSelectors.js +0 -31
- package/lib/selectors/dictateState.js +0 -12
- package/lib/selectors/language.d.ts +0 -4
- package/lib/selectors/language.d.ts.map +0 -1
- package/lib/selectors/language.js +0 -12
- package/lib/selectors/notifications.js +0 -13
- package/lib/selectors/sendBoxAttachments.js +0 -11
- package/lib/selectors/sendBoxValue.js +0 -12
- package/lib/selectors/sendTimeout.d.ts +0 -4
- package/lib/selectors/sendTimeout.d.ts.map +0 -1
- package/lib/selectors/sendTimeout.js +0 -12
- package/lib/selectors/sendTypingIndicator.d.ts +0 -4
- package/lib/selectors/sendTypingIndicator.d.ts.map +0 -1
- package/lib/selectors/sendTypingIndicator.js +0 -12
- package/lib/selectors/shouldSpeakIncomingActivity.js +0 -12
- package/lib/types/AnyAnd.d.ts +0 -2
- package/lib/types/AnyAnd.d.ts.map +0 -1
- package/lib/types/AnyAnd.js +0 -6
- package/lib/types/GlobalScopePonyfill.d.ts +0 -8
- package/lib/types/GlobalScopePonyfill.d.ts.map +0 -1
- package/lib/types/GlobalScopePonyfill.js +0 -6
- package/lib/types/OneOrMany.d.ts +0 -3
- package/lib/types/OneOrMany.d.ts.map +0 -1
- package/lib/types/OneOrMany.js +0 -6
- package/lib/types/SendBoxAttachment.d.ts +0 -5
- package/lib/types/SendBoxAttachment.d.ts.map +0 -1
- package/lib/types/SendBoxAttachment.js +0 -6
- package/lib/types/WebChatActivity.d.ts +0 -128
- package/lib/types/WebChatActivity.d.ts.map +0 -1
- package/lib/types/WebChatActivity.js +0 -6
- package/lib/types/external/DirectLineActivity.d.ts +0 -3
- package/lib/types/external/DirectLineActivity.d.ts.map +0 -1
- package/lib/types/external/DirectLineActivity.js +0 -6
- package/lib/types/external/DirectLineAnimationCard.d.ts +0 -6
- package/lib/types/external/DirectLineAnimationCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineAnimationCard.js +0 -6
- package/lib/types/external/DirectLineAttachment.d.ts +0 -9
- package/lib/types/external/DirectLineAttachment.d.ts.map +0 -1
- package/lib/types/external/DirectLineAttachment.js +0 -6
- package/lib/types/external/DirectLineAudioCard.d.ts +0 -6
- package/lib/types/external/DirectLineAudioCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineAudioCard.js +0 -6
- package/lib/types/external/DirectLineBasicCardEssence.d.ts +0 -12
- package/lib/types/external/DirectLineBasicCardEssence.d.ts.map +0 -1
- package/lib/types/external/DirectLineBasicCardEssence.js +0 -6
- package/lib/types/external/DirectLineCardAction.d.ts +0 -110
- package/lib/types/external/DirectLineCardAction.d.ts.map +0 -1
- package/lib/types/external/DirectLineCardAction.js +0 -6
- package/lib/types/external/DirectLineCardImage.d.ts +0 -8
- package/lib/types/external/DirectLineCardImage.d.ts.map +0 -1
- package/lib/types/external/DirectLineCardImage.js +0 -6
- package/lib/types/external/DirectLineHeroCard.d.ts +0 -6
- package/lib/types/external/DirectLineHeroCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineHeroCard.js +0 -6
- package/lib/types/external/DirectLineJSBotConnection.d.ts +0 -3
- package/lib/types/external/DirectLineJSBotConnection.d.ts.map +0 -1
- package/lib/types/external/DirectLineJSBotConnection.js +0 -6
- package/lib/types/external/DirectLineMediaCardEssence.d.ts +0 -21
- package/lib/types/external/DirectLineMediaCardEssence.d.ts.map +0 -1
- package/lib/types/external/DirectLineMediaCardEssence.js +0 -6
- package/lib/types/external/DirectLineOAuthCard.d.ts +0 -8
- package/lib/types/external/DirectLineOAuthCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineOAuthCard.js +0 -6
- package/lib/types/external/DirectLineReceiptCard.d.ts +0 -28
- package/lib/types/external/DirectLineReceiptCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineReceiptCard.js +0 -6
- package/lib/types/external/DirectLineSignInCard.d.ts +0 -8
- package/lib/types/external/DirectLineSignInCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineSignInCard.js +0 -6
- package/lib/types/external/DirectLineSuggestedAction.d.ts +0 -7
- package/lib/types/external/DirectLineSuggestedAction.d.ts.map +0 -1
- package/lib/types/external/DirectLineSuggestedAction.js +0 -6
- package/lib/types/external/DirectLineThumbnailCard.d.ts +0 -6
- package/lib/types/external/DirectLineThumbnailCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineThumbnailCard.js +0 -6
- package/lib/types/external/DirectLineVideoCard.d.ts +0 -6
- package/lib/types/external/DirectLineVideoCard.d.ts.map +0 -1
- package/lib/types/external/DirectLineVideoCard.js +0 -6
- package/lib/types/external/Observable.d.ts +0 -49
- package/lib/types/external/Observable.d.ts.map +0 -1
- package/lib/types/external/Observable.js +0 -6
- package/lib/types/external/OrgSchema/Action.d.ts +0 -29
- package/lib/types/external/OrgSchema/Action.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Action.js +0 -38
- package/lib/types/external/OrgSchema/Claim.d.ts +0 -35
- package/lib/types/external/OrgSchema/Claim.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Claim.js +0 -41
- package/lib/types/external/OrgSchema/CreativeWork.d.ts +0 -57
- package/lib/types/external/OrgSchema/CreativeWork.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/CreativeWork.js +0 -52
- package/lib/types/external/OrgSchema/DefinedTerm.d.ts +0 -26
- package/lib/types/external/OrgSchema/DefinedTerm.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/DefinedTerm.js +0 -33
- package/lib/types/external/OrgSchema/Project.d.ts +0 -20
- package/lib/types/external/OrgSchema/Project.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Project.js +0 -32
- package/lib/types/external/OrgSchema/Thing.d.ts +0 -53
- package/lib/types/external/OrgSchema/Thing.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/Thing.js +0 -54
- package/lib/types/external/OrgSchema/VoteAction.d.ts +0 -22
- package/lib/types/external/OrgSchema/VoteAction.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/VoteAction.js +0 -34
- package/lib/types/external/OrgSchema/private/orgSchemaProperties.d.ts +0 -3
- package/lib/types/external/OrgSchema/private/orgSchemaProperties.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/private/orgSchemaProperties.js +0 -22
- package/lib/types/external/OrgSchema/private/orgSchemaProperty.d.ts +0 -4
- package/lib/types/external/OrgSchema/private/orgSchemaProperty.d.ts.map +0 -1
- package/lib/types/external/OrgSchema/private/orgSchemaProperty.js +0 -15
- package/lib/types/internal/GlobalScopeClock.d.ts +0 -15
- package/lib/types/internal/GlobalScopeClock.d.ts.map +0 -1
- package/lib/types/internal/GlobalScopeClock.js +0 -6
- package/lib/types/internal/Notification.d.ts +0 -10
- package/lib/types/internal/Notification.d.ts.map +0 -1
- package/lib/types/internal/Notification.js +0 -6
- package/lib/types/internal/ReduxState.d.ts +0 -19
- package/lib/types/internal/ReduxState.d.ts.map +0 -1
- package/lib/types/internal/ReduxState.js +0 -6
- package/lib/types/internal/SendStatus.d.ts +0 -7
- package/lib/types/internal/SendStatus.d.ts.map +0 -1
- package/lib/types/internal/SendStatus.js +0 -19
- package/lib/types/internal/WebChatOutgoingActivity.d.ts +0 -49
- package/lib/types/internal/WebChatOutgoingActivity.d.ts.map +0 -1
- package/lib/types/internal/WebChatOutgoingActivity.js +0 -6
- package/lib/utils/dateToLocaleISOString.d.ts +0 -2
- package/lib/utils/dateToLocaleISOString.d.ts.map +0 -1
- package/lib/utils/dateToLocaleISOString.js +0 -52
- package/lib/utils/deleteKey.d.ts +0 -2
- package/lib/utils/deleteKey.d.ts.map +0 -1
- package/lib/utils/deleteKey.js +0 -30
- package/lib/utils/getOrgSchemaMessage.d.ts +0 -4
- package/lib/utils/getOrgSchemaMessage.d.ts.map +0 -1
- package/lib/utils/getOrgSchemaMessage.js +0 -21
- package/lib/utils/isForbiddenPropertyName.d.ts +0 -2
- package/lib/utils/isForbiddenPropertyName.d.ts.map +0 -1
- package/lib/utils/isForbiddenPropertyName.js +0 -16
- package/lib/utils/onErrorResumeNext.d.ts +0 -3
- package/lib/utils/onErrorResumeNext.d.ts.map +0 -1
- package/lib/utils/onErrorResumeNext.js +0 -19
- package/lib/utils/once.d.ts +0 -2
- package/lib/utils/once.d.ts.map +0 -1
- package/lib/utils/once.js +0 -16
- package/lib/utils/singleToArray.d.ts +0 -2
- package/lib/utils/singleToArray.d.ts.map +0 -1
- package/lib/utils/singleToArray.js +0 -10
- package/lib/utils/sleep.d.ts +0 -3
- package/lib/utils/sleep.d.ts.map +0 -1
- package/lib/utils/sleep.js +0 -12
- package/lib/utils/uniqueID.d.ts +0 -2
- package/lib/utils/uniqueID.d.ts.map +0 -1
- package/lib/utils/uniqueID.js +0 -14
- package/lib/utils/warnOnce.d.ts +0 -2
- package/lib/utils/warnOnce.d.ts.map +0 -1
- package/lib/utils/warnOnce.js +0 -14
- package/src/actions/clearSuggestedActions.js +0 -9
- package/src/actions/setSuggestedActions.js +0 -12
- package/src/constants/DictateState.js +0 -7
- package/src/reducers/createActivitiesReducer.ts +0 -304
- package/src/reducers/private/findBeforeAfter.spec.ts +0 -90
- package/src/reducers/private/findBeforeAfter.ts +0 -30
- package/src/reducers/suggestedActions.js +0 -23
- package/src/types/OneOrMany.ts +0 -3
- package/src/types/external/OrgSchema/Action.spec.ts +0 -35
- package/src/types/external/OrgSchema/Action.ts +0 -52
- package/src/types/external/OrgSchema/Claim.spec.ts +0 -45
- package/src/types/external/OrgSchema/Claim.ts +0 -48
- package/src/types/external/OrgSchema/CreativeWork.parseCreativeWork.spec.ts +0 -51
- package/src/types/external/OrgSchema/CreativeWork.ts +0 -83
- package/src/types/external/OrgSchema/DefinedTerm.ts +0 -37
- package/src/types/external/OrgSchema/Project.parseProject.spec.ts +0 -17
- package/src/types/external/OrgSchema/Project.ts +0 -29
- package/src/types/external/OrgSchema/Thing.parseThing.spec.ts +0 -54
- package/src/types/external/OrgSchema/Thing.ts +0 -94
- package/src/types/external/OrgSchema/VoteAction.spec.ts +0 -35
- package/src/types/external/OrgSchema/VoteAction.ts +0 -31
- package/src/types/external/OrgSchema/private/orgSchemaProperties.spec.ts +0 -41
- package/src/types/external/OrgSchema/private/orgSchemaProperties.ts +0 -23
- package/src/types/external/OrgSchema/private/orgSchemaProperty.spec.ts +0 -21
- package/src/types/external/OrgSchema/private/orgSchemaProperty.ts +0 -6
- package/src/utils/isForbiddenPropertyName.spec.js +0 -6
- package/src/utils/isForbiddenPropertyName.ts +0 -33
- package/src/utils/singleToArray.ts +0 -3
- package/src/utils/warnOnce.ts +0 -5
- /package/src/actions/{connectionStatusUpdate.js → connectionStatusUpdate.ts} +0 -0
- /package/src/actions/{disconnect.js → disconnect.ts} +0 -0
- /package/src/actions/{emitTypingIndicator.js → emitTypingIndicator.ts} +0 -0
- /package/src/actions/{queueIncomingActivity.js → queueIncomingActivity.ts} +0 -0
- /package/src/actions/{reconnect.js → reconnect.ts} +0 -0
- /package/src/actions/{startDictate.js → startDictate.ts} +0 -0
- /package/src/actions/{startSpeakingActivity.js → startSpeakingActivity.ts} +0 -0
- /package/src/actions/{stopDictate.js → stopDictate.ts} +0 -0
- /package/src/actions/{stopSpeakingActivity.js → stopSpeakingActivity.ts} +0 -0
- /package/src/actions/{updateConnectionStatus.js → updateConnectionStatus.ts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"uniqueID.d.ts","sourceRoot":"","sources":["../../src/utils/uniqueID.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,QAAQ,IAAI,MAAM,CAEzC"}
|
package/lib/utils/uniqueID.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = uniqueID;
|
|
8
|
-
var _mathRandom = _interopRequireDefault(require("math-random"));
|
|
9
|
-
/* eslint no-magic-numbers: ["error", { "ignore": [2, 36] }] */
|
|
10
|
-
|
|
11
|
-
function uniqueID() {
|
|
12
|
-
return (0, _mathRandom["default"])().toString(36).substring(2);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfbWF0aFJhbmRvbSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwidW5pcXVlSUQiLCJyYW5kb20iLCJ0b1N0cmluZyIsInN1YnN0cmluZyJdLCJzb3VyY2VSb290IjoiY29yZTovLy8iLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy91bmlxdWVJRC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQgbm8tbWFnaWMtbnVtYmVyczogW1wiZXJyb3JcIiwgeyBcImlnbm9yZVwiOiBbMiwgMzZdIH1dICovXG5cbmltcG9ydCByYW5kb20gZnJvbSAnbWF0aC1yYW5kb20nO1xuXG5leHBvcnQgZGVmYXVsdCBmdW5jdGlvbiB1bmlxdWVJRCgpOiBzdHJpbmcge1xuICByZXR1cm4gcmFuZG9tKCkudG9TdHJpbmcoMzYpLnN1YnN0cmluZygyKTtcbn1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUVBLElBQUFBLFdBQUEsR0FBQUMsc0JBQUEsQ0FBQUMsT0FBQTtBQUZBOztBQUllLFNBQVNDLFFBQVFBLENBQUEsRUFBVztFQUN6QyxPQUFPLElBQUFDLHNCQUFNLEVBQUMsQ0FBQyxDQUFDQyxRQUFRLENBQUMsRUFBRSxDQUFDLENBQUNDLFNBQVMsQ0FBQyxDQUFDLENBQUM7QUFDM0MifQ==
|
package/lib/utils/warnOnce.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"warnOnce.d.ts","sourceRoot":"","sources":["../../src/utils/warnOnce.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,IAAI,CAE5D"}
|
package/lib/utils/warnOnce.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = warnOnce;
|
|
8
|
-
var _once = _interopRequireDefault(require("./once"));
|
|
9
|
-
function warnOnce(message) {
|
|
10
|
-
return (0, _once["default"])(function () {
|
|
11
|
-
return console.warn("botframework-webchat: ".concat(message, "."));
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfb25jZSIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJyZXF1aXJlIiwid2Fybk9uY2UiLCJtZXNzYWdlIiwib25jZSIsImNvbnNvbGUiLCJ3YXJuIiwiY29uY2F0Il0sInNvdXJjZVJvb3QiOiJjb3JlOi8vLyIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL3dhcm5PbmNlLnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBvbmNlIGZyb20gJy4vb25jZSc7XG5cbmV4cG9ydCBkZWZhdWx0IGZ1bmN0aW9uIHdhcm5PbmNlKG1lc3NhZ2U6IHN0cmluZyk6ICgpID0+IHZvaWQge1xuICByZXR1cm4gb25jZSgoKSA9PiBjb25zb2xlLndhcm4oYGJvdGZyYW1ld29yay13ZWJjaGF0OiAke21lc3NhZ2V9LmApKTtcbn1cbiJdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUFBLElBQUFBLEtBQUEsR0FBQUMsc0JBQUEsQ0FBQUMsT0FBQTtBQUVlLFNBQVNDLFFBQVFBLENBQUNDLE9BQWUsRUFBYztFQUM1RCxPQUFPLElBQUFDLGdCQUFJLEVBQUM7SUFBQSxPQUFNQyxPQUFPLENBQUNDLElBQUksMEJBQUFDLE1BQUEsQ0FBMEJKLE9BQU8sTUFBRyxDQUFDO0VBQUEsRUFBQztBQUN0RSJ9
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const EMPTY_ARRAY = [];
|
|
2
|
-
|
|
3
|
-
const SET_SUGGESTED_ACTIONS = 'WEB_CHAT/SET_SUGGESTED_ACTIONS';
|
|
4
|
-
|
|
5
|
-
export default function setSuggestedActions(suggestedActions = EMPTY_ARRAY) {
|
|
6
|
-
return {
|
|
7
|
-
type: SET_SUGGESTED_ACTIONS,
|
|
8
|
-
payload: { suggestedActions }
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { SET_SUGGESTED_ACTIONS };
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/* eslint no-magic-numbers: ["error", { "ignore": [0, 1, -1] }] */
|
|
2
|
-
|
|
3
|
-
import updateIn from 'simple-update-in';
|
|
4
|
-
|
|
5
|
-
import { DELETE_ACTIVITY } from '../actions/deleteActivity';
|
|
6
|
-
import { INCOMING_ACTIVITY } from '../actions/incomingActivity';
|
|
7
|
-
import { MARK_ACTIVITY } from '../actions/markActivity';
|
|
8
|
-
import {
|
|
9
|
-
POST_ACTIVITY_FULFILLED,
|
|
10
|
-
POST_ACTIVITY_IMPEDED,
|
|
11
|
-
POST_ACTIVITY_PENDING,
|
|
12
|
-
POST_ACTIVITY_REJECTED
|
|
13
|
-
} from '../actions/postActivity';
|
|
14
|
-
import { SENDING, SEND_FAILED, SENT } from '../types/internal/SendStatus';
|
|
15
|
-
import findBeforeAfter from './private/findBeforeAfter';
|
|
16
|
-
|
|
17
|
-
import type { Reducer } from 'redux';
|
|
18
|
-
import type { DeleteActivityAction } from '../actions/deleteActivity';
|
|
19
|
-
import type { IncomingActivityAction } from '../actions/incomingActivity';
|
|
20
|
-
import type { MarkActivityAction } from '../actions/markActivity';
|
|
21
|
-
import type {
|
|
22
|
-
PostActivityFulfilledAction,
|
|
23
|
-
PostActivityImpededAction,
|
|
24
|
-
PostActivityPendingAction,
|
|
25
|
-
PostActivityRejectedAction
|
|
26
|
-
} from '../actions/postActivity';
|
|
27
|
-
import type { GlobalScopePonyfill } from '../types/GlobalScopePonyfill';
|
|
28
|
-
import type { WebChatActivity } from '../types/WebChatActivity';
|
|
29
|
-
|
|
30
|
-
type ActivitiesAction =
|
|
31
|
-
| DeleteActivityAction
|
|
32
|
-
| IncomingActivityAction
|
|
33
|
-
| MarkActivityAction
|
|
34
|
-
| PostActivityFulfilledAction
|
|
35
|
-
| PostActivityImpededAction
|
|
36
|
-
| PostActivityPendingAction
|
|
37
|
-
| PostActivityRejectedAction;
|
|
38
|
-
|
|
39
|
-
type ActivitiesState = WebChatActivity[];
|
|
40
|
-
|
|
41
|
-
const DEFAULT_STATE: ActivitiesState = [];
|
|
42
|
-
const DIRECT_LINE_PLACEHOLDER_URL =
|
|
43
|
-
'https://docs.botframework.com/static/devportal/client/images/bot-framework-default-placeholder.png';
|
|
44
|
-
|
|
45
|
-
function getClientActivityID(activity: WebChatActivity): string | undefined {
|
|
46
|
-
return activity.channelData?.clientActivityID;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function findByClientActivityID(clientActivityID: string): (activity: WebChatActivity) => boolean {
|
|
50
|
-
return (activity: WebChatActivity) => getClientActivityID(activity) === clientActivityID;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function isPartOfLivestreamSession(
|
|
54
|
-
activity: WebChatActivity
|
|
55
|
-
): activity is WebChatActivity & { text: string; type: 'typing' } {
|
|
56
|
-
return activity.type === 'typing' && 'text' in activity && typeof activity.text === 'string';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function patchActivity(
|
|
60
|
-
activity: WebChatActivity,
|
|
61
|
-
activities: WebChatActivity[],
|
|
62
|
-
{ Date }: GlobalScopePonyfill
|
|
63
|
-
): WebChatActivity {
|
|
64
|
-
// Direct Line channel will return a placeholder image for the user-uploaded image.
|
|
65
|
-
// As observed, the URL for the placeholder image is https://docs.botframework.com/static/devportal/client/images/bot-framework-default-placeholder.png.
|
|
66
|
-
// To make our code simpler, we are removing the value if "contentUrl" is pointing to a placeholder image.
|
|
67
|
-
|
|
68
|
-
// TODO: [P2] #2869 This "contentURL" removal code should be moved to DirectLineJS adapter.
|
|
69
|
-
|
|
70
|
-
// Also, if the "contentURL" starts with "blob:", this means the user is uploading a file (the URL is constructed by URL.createObjectURL)
|
|
71
|
-
// Although the copy/reference of the file is temporary in-memory, to make the UX consistent across page refresh, we do not allow the user to re-download the file either.
|
|
72
|
-
|
|
73
|
-
activity = updateIn(activity, ['attachments', () => true, 'contentUrl'], (contentUrl: string) => {
|
|
74
|
-
if (contentUrl !== DIRECT_LINE_PLACEHOLDER_URL && !/^blob:/iu.test(contentUrl)) {
|
|
75
|
-
return contentUrl;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
activity = updateIn(activity, ['channelData'], channelData => ({ ...channelData }));
|
|
80
|
-
activity = updateIn(activity, ['channelData', 'webChat', 'receivedAt'], () => Date.now());
|
|
81
|
-
|
|
82
|
-
const {
|
|
83
|
-
channelData: { 'webchat:sequence-id': sequenceId }
|
|
84
|
-
} = activity;
|
|
85
|
-
|
|
86
|
-
// TODO: [P1] #3953 We should move this patching logic to a DLJS wrapper for simplicity.
|
|
87
|
-
// If the message does not have sequence ID, use these fallback values:
|
|
88
|
-
// 1. "channelData.streamSequence" field (if available)
|
|
89
|
-
// - 0.0001 * streamSequence should be good
|
|
90
|
-
// 2. "timestamp" field
|
|
91
|
-
// - outgoing activity will not have "timestamp" field
|
|
92
|
-
// 3. last activity sequence ID (or 0) + 0.001
|
|
93
|
-
// - best effort to put this message the last one in the chat history
|
|
94
|
-
if (typeof sequenceId !== 'number') {
|
|
95
|
-
let after: WebChatActivity;
|
|
96
|
-
let before: WebChatActivity;
|
|
97
|
-
|
|
98
|
-
if (isPartOfLivestreamSession(activity) && typeof activity.channelData.streamSequence === 'number') {
|
|
99
|
-
[before, after] = findBeforeAfter(activities, target => {
|
|
100
|
-
if (target.type === 'typing' && target.channelData.streamId === activity.channelData.streamId) {
|
|
101
|
-
return target.channelData.streamSequence < activity.channelData.streamSequence ? 'before' : 'after';
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return 'unknown';
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
let sequenceId: number;
|
|
109
|
-
|
|
110
|
-
if (before) {
|
|
111
|
-
// eslint-disable-next-line no-magic-numbers
|
|
112
|
-
sequenceId = before.channelData['webchat:sequence-id'] + 0.001;
|
|
113
|
-
} else if (after) {
|
|
114
|
-
// eslint-disable-next-line no-magic-numbers
|
|
115
|
-
sequenceId = after.channelData['webchat:sequence-id'] - 0.001;
|
|
116
|
-
} else if (typeof activity.timestamp !== 'undefined') {
|
|
117
|
-
sequenceId = +new Date(activity.timestamp);
|
|
118
|
-
} else {
|
|
119
|
-
// We assume there will be no more than 1,000 messages sent before receiving server response.
|
|
120
|
-
// If there are more than 1,000 messages, some messages will get reordered and appear jumpy after receiving server response.
|
|
121
|
-
// eslint-disable-next-line no-magic-numbers
|
|
122
|
-
sequenceId = (activities[activities.length - 1]?.channelData['webchat:sequence-id'] || 0) + 0.001;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
activity = updateIn(activity, ['channelData', 'webchat:sequence-id'], () => sequenceId);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return activity;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function upsertActivityWithSort(
|
|
132
|
-
activities: WebChatActivity[],
|
|
133
|
-
nextActivity: WebChatActivity,
|
|
134
|
-
ponyfill: GlobalScopePonyfill
|
|
135
|
-
): WebChatActivity[] {
|
|
136
|
-
nextActivity = patchActivity(nextActivity, activities, ponyfill);
|
|
137
|
-
|
|
138
|
-
const { channelData: { clientActivityID: nextClientActivityID, 'webchat:sequence-id': nextSequenceId } = {} } =
|
|
139
|
-
nextActivity;
|
|
140
|
-
|
|
141
|
-
const nextActivities = activities.filter(
|
|
142
|
-
({ channelData: { clientActivityID } = {}, id }) =>
|
|
143
|
-
// We will remove all "sending messages" activities and activities with same ID
|
|
144
|
-
// "clientActivityID" is unique and used to track if the message has been sent and echoed back from the server
|
|
145
|
-
!(nextClientActivityID && clientActivityID === nextClientActivityID) && !(id && id === nextActivity.id)
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
// Then, find the right (sorted) place to insert the new activity at, based on sequence ID.
|
|
149
|
-
const indexToInsert = nextActivities.findIndex(
|
|
150
|
-
({ channelData: { 'webchat:sequence-id': sequenceId } = {} }) => (sequenceId || 0) > (nextSequenceId || 0)
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
// If no right place are found, append it
|
|
154
|
-
nextActivities.splice(~indexToInsert ? indexToInsert : nextActivities.length, 0, nextActivity);
|
|
155
|
-
|
|
156
|
-
return nextActivities;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export default function createActivitiesReducer(
|
|
160
|
-
ponyfill: GlobalScopePonyfill
|
|
161
|
-
): Reducer<ActivitiesState, ActivitiesAction> {
|
|
162
|
-
return function activities(state: ActivitiesState = DEFAULT_STATE, action: ActivitiesAction): ActivitiesState {
|
|
163
|
-
switch (action.type) {
|
|
164
|
-
case DELETE_ACTIVITY:
|
|
165
|
-
state = updateIn(state, [({ id }: WebChatActivity) => id === action.payload.activityID]);
|
|
166
|
-
break;
|
|
167
|
-
|
|
168
|
-
case MARK_ACTIVITY:
|
|
169
|
-
{
|
|
170
|
-
const { payload } = action;
|
|
171
|
-
|
|
172
|
-
state = updateIn(
|
|
173
|
-
state,
|
|
174
|
-
[({ id }: WebChatActivity) => id === payload.activityID, 'channelData', payload.name],
|
|
175
|
-
() => payload.value
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
break;
|
|
180
|
-
|
|
181
|
-
case POST_ACTIVITY_PENDING:
|
|
182
|
-
{
|
|
183
|
-
let {
|
|
184
|
-
payload: { activity }
|
|
185
|
-
} = action;
|
|
186
|
-
|
|
187
|
-
// `channelData.state` is being deprecated in favor of `channelData['webchat:send-status']`.
|
|
188
|
-
// Please refer to #4362 for details. Remove on or after 2024-07-31.
|
|
189
|
-
activity = updateIn(activity, ['channelData', 'state'], () => SENDING);
|
|
190
|
-
activity = updateIn(activity, ['channelData', 'webchat:send-status'], () => SENDING);
|
|
191
|
-
|
|
192
|
-
state = upsertActivityWithSort(state, activity, ponyfill);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
break;
|
|
196
|
-
|
|
197
|
-
case POST_ACTIVITY_IMPEDED:
|
|
198
|
-
state = updateIn(
|
|
199
|
-
state,
|
|
200
|
-
// `channelData.state` is being deprecated in favor of `channelData['webchat:send-status']`.
|
|
201
|
-
// Please refer to #4362 for details. Remove on or after 2024-07-31.
|
|
202
|
-
[findByClientActivityID(action.meta.clientActivityID), 'channelData', 'state'],
|
|
203
|
-
() => SEND_FAILED
|
|
204
|
-
);
|
|
205
|
-
|
|
206
|
-
break;
|
|
207
|
-
|
|
208
|
-
case POST_ACTIVITY_REJECTED:
|
|
209
|
-
state = updateIn(state, [findByClientActivityID(action.meta.clientActivityID)], activity => {
|
|
210
|
-
activity = updateIn(activity, ['channelData', 'state'], () => SEND_FAILED);
|
|
211
|
-
|
|
212
|
-
return updateIn(activity, ['channelData', 'webchat:send-status'], () => SEND_FAILED);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
break;
|
|
216
|
-
|
|
217
|
-
case POST_ACTIVITY_FULFILLED:
|
|
218
|
-
{
|
|
219
|
-
// We will replace the activity with the version from the server
|
|
220
|
-
const activity = updateIn(
|
|
221
|
-
updateIn(
|
|
222
|
-
patchActivity(action.payload.activity, state, ponyfill),
|
|
223
|
-
// `channelData.state` is being deprecated in favor of `channelData['webchat:send-status']`.
|
|
224
|
-
// Please refer to #4362 for details. Remove on or after 2024-07-31.
|
|
225
|
-
['channelData', 'state'],
|
|
226
|
-
() => SENT
|
|
227
|
-
),
|
|
228
|
-
['channelData', 'webchat:send-status'],
|
|
229
|
-
() => SENT
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
state = updateIn(state, [findByClientActivityID(action.meta.clientActivityID)], () => activity);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
break;
|
|
236
|
-
|
|
237
|
-
case INCOMING_ACTIVITY:
|
|
238
|
-
{
|
|
239
|
-
let {
|
|
240
|
-
payload: { activity }
|
|
241
|
-
} = action;
|
|
242
|
-
|
|
243
|
-
// If the incoming activity is an echo back, we should keep the existing `channelData['webchat:send-status']` field.
|
|
244
|
-
//
|
|
245
|
-
// Otherwise, it will fail following scenario:
|
|
246
|
-
//
|
|
247
|
-
// 1. Send an activity to the service
|
|
248
|
-
// 2. Service echoed back the activity
|
|
249
|
-
// 3. Service did NOT return `postActivity` call
|
|
250
|
-
// - EXPECT: `channelData['webchat:send-status']` should be "sending".
|
|
251
|
-
// - ACTUAL: `channelData['webchat:send-status']` is `undefined` because the activity get overwritten by the echo back activity.
|
|
252
|
-
// The echo back activity contains no `channelData['webchat:send-status']`.
|
|
253
|
-
//
|
|
254
|
-
// While we are looking out for the scenario above, we should also look at the following scenarios:
|
|
255
|
-
//
|
|
256
|
-
// 1. Service restore chat history, including activities sent from the user. These activities has the following characteristics:
|
|
257
|
-
// - They do not have `channelData['webchat:send-status']`;
|
|
258
|
-
// - They do not have an ongoing `postActivitySaga`;
|
|
259
|
-
// - They should not previously appear in the chat history.
|
|
260
|
-
// 2. We need to mark these activities as "sent".
|
|
261
|
-
//
|
|
262
|
-
// In the future, when we revamp our object model, we could use a different signal so we don't need the code below, for example:
|
|
263
|
-
//
|
|
264
|
-
// - If `activity.id` is set, it is "sent", because the chat service assigned an ID to the activity;
|
|
265
|
-
// - If `activity.id` is not set, it is either "sending" or "send failed";
|
|
266
|
-
// - If `activity.channelData['webchat:send-failed-reason']` is set, it is "send failed" with the reason, otherwise;
|
|
267
|
-
// - It is sending.
|
|
268
|
-
if (activity.from.role === 'user') {
|
|
269
|
-
const { id } = activity;
|
|
270
|
-
const clientActivityID = getClientActivityID(activity);
|
|
271
|
-
|
|
272
|
-
const existingActivity = state.find(
|
|
273
|
-
activity =>
|
|
274
|
-
(clientActivityID && getClientActivityID(activity) === clientActivityID) || (id && activity.id === id)
|
|
275
|
-
);
|
|
276
|
-
|
|
277
|
-
if (existingActivity) {
|
|
278
|
-
const {
|
|
279
|
-
channelData: { 'webchat:send-status': sendStatus }
|
|
280
|
-
} = existingActivity;
|
|
281
|
-
|
|
282
|
-
if (sendStatus === SENDING || sendStatus === SEND_FAILED || sendStatus === SENT) {
|
|
283
|
-
activity = updateIn(activity, ['channelData', 'webchat:send-status'], () => sendStatus);
|
|
284
|
-
}
|
|
285
|
-
} else {
|
|
286
|
-
// If there are no existing activity, probably this activity is restored from chat history.
|
|
287
|
-
// All outgoing activities restored from service means they arrived at the service successfully.
|
|
288
|
-
// Thus, we are marking them as "sent".
|
|
289
|
-
activity = updateIn(activity, ['channelData', 'webchat:send-status'], () => SENT);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
state = upsertActivityWithSort(state, activity, ponyfill);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
break;
|
|
297
|
-
|
|
298
|
-
default:
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
return state;
|
|
303
|
-
};
|
|
304
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* eslint no-magic-numbers: "off" */
|
|
2
|
-
|
|
3
|
-
import findBeforeAfter from './findBeforeAfter';
|
|
4
|
-
|
|
5
|
-
let before: number | string | undefined;
|
|
6
|
-
let after: number | string | undefined;
|
|
7
|
-
let index: number | undefined;
|
|
8
|
-
const getPosition = jest.fn<'after' | 'before' | 'unknown', [unknown]>().mockImplementation(() => {
|
|
9
|
-
throw new Error('This function should not be called.');
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
describe('when passing an empty array', () => {
|
|
13
|
-
beforeEach(() => ([before, after, index] = findBeforeAfter([] as (number | string)[], getPosition)));
|
|
14
|
-
|
|
15
|
-
test('before should be undefined', () => expect(before).toBeUndefined());
|
|
16
|
-
test('after should be undefined', () => expect(after).toBeUndefined());
|
|
17
|
-
test('index should be undefined', () => expect(index).toBeUndefined());
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
describe('when passing a value of 2 to [a, 1, 3, b]', () => {
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
getPosition.mockImplementation(value => (typeof value === 'number' ? (value < 2 ? 'before' : 'after') : 'unknown'));
|
|
23
|
-
|
|
24
|
-
[before, after, index] = findBeforeAfter(['a', 1, 3, 'b'], getPosition);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('before should be 1', () => expect(before).toBe(1));
|
|
28
|
-
test('after should be 3', () => expect(after).toBe(3));
|
|
29
|
-
test('index should be 2', () => expect(index).toBe(2));
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('when passing a value of 2 to [3, b]', () => {
|
|
33
|
-
beforeEach(() => {
|
|
34
|
-
getPosition.mockImplementation(value => (typeof value === 'number' ? (value < 2 ? 'before' : 'after') : 'unknown'));
|
|
35
|
-
|
|
36
|
-
[before, after, index] = findBeforeAfter([3, 'b'], getPosition);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test('before should be undefined', () => expect(before).toBeUndefined());
|
|
40
|
-
test('after should be 3', () => expect(after).toBe(3));
|
|
41
|
-
test('index should be 0', () => expect(index).toBe(0));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
describe('when passing a value of 2 to [a, 1]', () => {
|
|
45
|
-
beforeEach(() => {
|
|
46
|
-
getPosition.mockImplementation(value => (typeof value === 'number' ? (value < 2 ? 'before' : 'after') : 'unknown'));
|
|
47
|
-
|
|
48
|
-
[before, after, index] = findBeforeAfter(['a', 1], getPosition);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('before should be 1', () => expect(before).toBe(1));
|
|
52
|
-
test('after should be undefined', () => expect(after).toBeUndefined());
|
|
53
|
-
test('index should be 2', () => expect(index).toBe(2));
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
describe('when passing a value of 2 to [a, 1, b]', () => {
|
|
57
|
-
beforeEach(() => {
|
|
58
|
-
getPosition.mockImplementation(value => (typeof value === 'number' ? (value < 2 ? 'before' : 'after') : 'unknown'));
|
|
59
|
-
|
|
60
|
-
[before, after, index] = findBeforeAfter(['a', 1, 'b'], getPosition);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('before should be 1', () => expect(before).toBe(1));
|
|
64
|
-
test('after should be "b"', () => expect(after).toBe('b'));
|
|
65
|
-
test('index should be 2', () => expect(index).toBe(2));
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
describe('when passing a value of 2 to [a, 3, b]', () => {
|
|
69
|
-
beforeEach(() => {
|
|
70
|
-
getPosition.mockImplementation(value => (typeof value === 'number' ? (value < 2 ? 'before' : 'after') : 'unknown'));
|
|
71
|
-
|
|
72
|
-
[before, after, index] = findBeforeAfter(['a', 3, 'b'], getPosition);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test('before should be "a"', () => expect(before).toBe('a'));
|
|
76
|
-
test('after should be 3', () => expect(after).toBe(3));
|
|
77
|
-
test('index should be 1', () => expect(index).toBe(1));
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe('when passing a value of 2 to [a, b]', () => {
|
|
81
|
-
beforeEach(() => {
|
|
82
|
-
getPosition.mockImplementation(value => (typeof value === 'number' ? (value < 2 ? 'before' : 'after') : 'unknown'));
|
|
83
|
-
|
|
84
|
-
[before, after, index] = findBeforeAfter(['a', 'b'], getPosition);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('before should be undefined', () => expect(before).toBeUndefined());
|
|
88
|
-
test('after should be undefined', () => expect(after).toBeUndefined());
|
|
89
|
-
test('index should be undefined', () => expect(index).toBeUndefined());
|
|
90
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
type Position = 'after' | 'before' | 'unknown';
|
|
2
|
-
|
|
3
|
-
export default function findBeforeAfter<T>(
|
|
4
|
-
array: T[],
|
|
5
|
-
getPosition: (value: T) => Position
|
|
6
|
-
): [T | undefined, T | undefined, number | undefined] {
|
|
7
|
-
let lastValue: T | undefined;
|
|
8
|
-
let lastPosition: Position = 'unknown';
|
|
9
|
-
|
|
10
|
-
for (let index = 0; index < array.length; index++) {
|
|
11
|
-
const value = array[+index];
|
|
12
|
-
const currentPosition = getPosition(value);
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
((lastPosition === 'before' || lastPosition === 'unknown') && currentPosition === 'after') ||
|
|
16
|
-
(lastPosition === 'before' && (currentPosition === 'after' || currentPosition === 'unknown'))
|
|
17
|
-
) {
|
|
18
|
-
return [lastValue, value, index];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
lastValue = value;
|
|
22
|
-
lastPosition = currentPosition;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (lastPosition === 'before') {
|
|
26
|
-
return [lastValue, undefined, array.length];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return [undefined, undefined, undefined];
|
|
30
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CLEAR_SUGGESTED_ACTIONS } from '../actions/clearSuggestedActions';
|
|
2
|
-
import { SET_SUGGESTED_ACTIONS } from '../actions/setSuggestedActions';
|
|
3
|
-
|
|
4
|
-
const DEFAULT_STATE = [];
|
|
5
|
-
|
|
6
|
-
export default function suggestedActions(state = DEFAULT_STATE, { payload = {}, type }) {
|
|
7
|
-
switch (type) {
|
|
8
|
-
case SET_SUGGESTED_ACTIONS:
|
|
9
|
-
if ((payload.suggestedActions || []).length) {
|
|
10
|
-
state = [].slice.call(payload.suggestedActions);
|
|
11
|
-
} else {
|
|
12
|
-
state = DEFAULT_STATE;
|
|
13
|
-
}
|
|
14
|
-
break;
|
|
15
|
-
case CLEAR_SUGGESTED_ACTIONS:
|
|
16
|
-
state = DEFAULT_STATE;
|
|
17
|
-
break;
|
|
18
|
-
default:
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return state;
|
|
23
|
-
}
|
package/src/types/OneOrMany.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { parseAction } from './Action';
|
|
2
|
-
|
|
3
|
-
describe('Action', () => {
|
|
4
|
-
describe('actionStatus', () => {
|
|
5
|
-
test('should parse', () =>
|
|
6
|
-
expect(
|
|
7
|
-
parseAction({
|
|
8
|
-
'@type': 'Action',
|
|
9
|
-
actionStatus: 'ActiveActionStatus'
|
|
10
|
-
})
|
|
11
|
-
).toEqual({
|
|
12
|
-
'@type': 'Action',
|
|
13
|
-
actionStatus: 'ActiveActionStatus'
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
test('should change invalid into undefined', () => {
|
|
17
|
-
try {
|
|
18
|
-
expect(
|
|
19
|
-
parseAction({
|
|
20
|
-
'@type': 'Action',
|
|
21
|
-
actionStatus: 'ABC'
|
|
22
|
-
})
|
|
23
|
-
).toEqual({
|
|
24
|
-
'@type': 'Action',
|
|
25
|
-
actionStatus: undefined
|
|
26
|
-
});
|
|
27
|
-
} catch (err) {
|
|
28
|
-
console.error(err);
|
|
29
|
-
console.error(err.issues[0].input);
|
|
30
|
-
|
|
31
|
-
throw err;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { lazy, parse, string, union, value, type ObjectEntries, type StringSchema } from 'valibot';
|
|
2
|
-
|
|
3
|
-
import orgSchemaProperty from './private/orgSchemaProperty';
|
|
4
|
-
import { project, type Project } from './Project';
|
|
5
|
-
import { thing, type Thing } from './Thing';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* An action performed by a direct agent and indirect participants upon a direct object. Optionally happens at a location with the help of an inanimate instrument. The execution of the action may produce a result. Specific action sub-type documentation specifies the exact expectation of each argument/role.
|
|
9
|
-
*
|
|
10
|
-
* See also [blog post](http://blog.schema.org/2014/04/announcing-schemaorg-actions.html) and [Actions overview document](https://schema.org/docs/actions.html).
|
|
11
|
-
*
|
|
12
|
-
* This is partial implementation of https://schema.org/Action.
|
|
13
|
-
*
|
|
14
|
-
* @see https://schema.org/Action
|
|
15
|
-
*/
|
|
16
|
-
export type Action = Thing & {
|
|
17
|
-
/**
|
|
18
|
-
* Indicates the current disposition of the Action.
|
|
19
|
-
*
|
|
20
|
-
* @see https://schema.org/actionStatus
|
|
21
|
-
*/
|
|
22
|
-
actionStatus?:
|
|
23
|
-
| 'ActiveActionStatus'
|
|
24
|
-
| 'CompletedActionStatu'
|
|
25
|
-
| 'FailedActionStatus'
|
|
26
|
-
| 'PotentialActionStatus'
|
|
27
|
-
| undefined;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The service provider, service operator, or service performer; the goods producer. Another party (a seller) may offer those services or goods on behalf of the provider. A provider may also serve as the seller. Supersedes [carrier](https://schema.org/carrier).
|
|
31
|
-
*
|
|
32
|
-
* @see https://schema.org/provider
|
|
33
|
-
*/
|
|
34
|
-
provider?: Project | undefined;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const action = <TEntries extends ObjectEntries>(entries?: TEntries | undefined) =>
|
|
38
|
-
thing({
|
|
39
|
-
actionStatus: orgSchemaProperty(
|
|
40
|
-
union([
|
|
41
|
-
string([value('ActiveActionStatus')]) as StringSchema<'ActiveActionStatus'>,
|
|
42
|
-
string([value('CompletedActionStatus')]) as StringSchema<'CompletedActionStatus'>,
|
|
43
|
-
string([value('FailedActionStatus')]) as StringSchema<'FailedActionStatus'>,
|
|
44
|
-
string([value('PotentialActionStatus')]) as StringSchema<'PotentialActionStatus'>
|
|
45
|
-
])
|
|
46
|
-
),
|
|
47
|
-
provider: orgSchemaProperty(lazy(() => project())),
|
|
48
|
-
|
|
49
|
-
...entries
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export const parseAction = (data: unknown): Action => parse(action(), data);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { parseClaim } from './Claim';
|
|
2
|
-
|
|
3
|
-
describe('Claim', () => {
|
|
4
|
-
test('should parse appearance', () =>
|
|
5
|
-
expect(
|
|
6
|
-
parseClaim({
|
|
7
|
-
'@type': 'Claim',
|
|
8
|
-
appearance: {
|
|
9
|
-
'@type': 'Book',
|
|
10
|
-
name: 'Business @ the Speed of Thought'
|
|
11
|
-
}
|
|
12
|
-
})
|
|
13
|
-
).toEqual({
|
|
14
|
-
'@type': 'Claim',
|
|
15
|
-
appearance: {
|
|
16
|
-
'@type': 'Book',
|
|
17
|
-
name: 'Business @ the Speed of Thought'
|
|
18
|
-
}
|
|
19
|
-
}));
|
|
20
|
-
|
|
21
|
-
test('should parse claimInterpreter', () =>
|
|
22
|
-
expect(
|
|
23
|
-
parseClaim({
|
|
24
|
-
'@type': 'Claim',
|
|
25
|
-
claimInterpreter: {
|
|
26
|
-
'@type': 'Project',
|
|
27
|
-
slogan: 'Empower every person and every organization on the planet to achieve more.'
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
).toEqual({
|
|
31
|
-
'@type': 'Claim',
|
|
32
|
-
claimInterpreter: {
|
|
33
|
-
'@type': 'Project',
|
|
34
|
-
slogan: 'Empower every person and every organization on the planet to achieve more.'
|
|
35
|
-
}
|
|
36
|
-
}));
|
|
37
|
-
|
|
38
|
-
describe('should parse position', () => {
|
|
39
|
-
test('as a number', () =>
|
|
40
|
-
expect(parseClaim({ '@type': 'Claim', position: 1 })).toEqual({ '@type': 'Claim', position: 1 }));
|
|
41
|
-
|
|
42
|
-
test('as a string', () =>
|
|
43
|
-
expect(parseClaim({ '@type': 'Claim', position: 'First' })).toEqual({ '@type': 'Claim', position: 'First' }));
|
|
44
|
-
});
|
|
45
|
-
});
|