@azure/communication-react 1.18.0-alpha-202406250013 → 1.18.0-alpha-202406260014

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.
Files changed (18) hide show
  1. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-D8CIuj9U.js → ChatMessageComponentAsRichTextEditBox-_hqOwT_h.js} +2 -2
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-D8CIuj9U.js.map → ChatMessageComponentAsRichTextEditBox-_hqOwT_h.js.map} +1 -1
  3. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D0jx96DX.js → RichTextSendBoxWrapper-D-KYGmZ9.js} +2 -2
  4. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-D0jx96DX.js.map → RichTextSendBoxWrapper-D-KYGmZ9.js.map} +1 -1
  5. package/dist/dist-cjs/communication-react/{index-D40Kfey5.js → index-DCf8u3Nr.js} +33 -9
  6. package/dist/dist-cjs/communication-react/index-DCf8u3Nr.js.map +1 -0
  7. package/dist/dist-cjs/communication-react/index.js +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  10. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js +1 -1
  11. package/dist/dist-esm/react-components/src/components/styles/RichTextInputBoxComponent.styles.js.map +1 -1
  12. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +6 -2
  13. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  14. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.d.ts +2 -0
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.js +20 -0
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.js.map +1 -1
  17. package/package.json +6 -6
  18. package/dist/dist-cjs/communication-react/index-D40Kfey5.js.map +0 -1
@@ -8,10 +8,12 @@ export declare class CallingSoundSubscriber {
8
8
  private call;
9
9
  private soundsLoaded?;
10
10
  private callee;
11
+ playingSounds: boolean;
11
12
  constructor(call: CallCommon, callee?: CommunicationIdentifier[], sounds?: CallingSounds);
12
13
  private onCallStateChanged;
13
14
  private subscribeCallSoundEvents;
14
15
  unsubscribeAll(): void;
16
+ pauseSounds(): void;
15
17
  private loadSounds;
16
18
  private playSound;
17
19
  }
@@ -9,25 +9,30 @@ const CALL_TRANSFER_SUBCODE = 7015;
9
9
  */
10
10
  export class CallingSoundSubscriber {
11
11
  constructor(call, callee, sounds) {
12
+ this.playingSounds = false;
12
13
  this.onCallStateChanged = () => {
13
14
  this.call.on('stateChanged', () => {
14
15
  var _a, _b, _c, _d, _e, _f, _g;
15
16
  if (shouldPlayRinging(this.call, this.callee) && ((_a = this.soundsLoaded) === null || _a === void 0 ? void 0 : _a.callRingingSound)) {
16
17
  this.soundsLoaded.callRingingSound.loop = true;
17
18
  this.playSound(this.soundsLoaded.callRingingSound);
19
+ this.playingSounds = true;
18
20
  }
19
21
  if (!shouldPlayRinging(this.call, this.callee) && ((_b = this.soundsLoaded) === null || _b === void 0 ? void 0 : _b.callRingingSound)) {
20
22
  this.soundsLoaded.callRingingSound.loop = false;
21
23
  this.soundsLoaded.callRingingSound.pause();
24
+ this.playingSounds = false;
22
25
  }
23
26
  if (this.call.state === 'Disconnected') {
24
27
  if (((_c = this.soundsLoaded) === null || _c === void 0 ? void 0 : _c.callBusySound) && ((_d = this.call.callEndReason) === null || _d === void 0 ? void 0 : _d.code) === CALL_REJECTED_CODE) {
25
28
  this.playSound(this.soundsLoaded.callBusySound);
29
+ this.playingSounds = true;
26
30
  }
27
31
  else if (((_e = this.soundsLoaded) === null || _e === void 0 ? void 0 : _e.callEndedSound) &&
28
32
  ((_f = this.call.callEndReason) === null || _f === void 0 ? void 0 : _f.code) === CALL_ENDED_CODE &&
29
33
  ((_g = this.call.callEndReason) === null || _g === void 0 ? void 0 : _g.subCode) !== CALL_TRANSFER_SUBCODE) {
30
34
  this.playSound(this.soundsLoaded.callEndedSound);
35
+ this.playingSounds = true;
31
36
  }
32
37
  }
33
38
  });
@@ -49,6 +54,21 @@ export class CallingSoundSubscriber {
49
54
  this.soundsLoaded.callRingingSound.pause();
50
55
  }
51
56
  }
57
+ pauseSounds() {
58
+ var _a, _b, _c;
59
+ if ((_a = this.soundsLoaded) === null || _a === void 0 ? void 0 : _a.callRingingSound) {
60
+ this.soundsLoaded.callRingingSound.pause();
61
+ this.playingSounds = false;
62
+ }
63
+ if ((_b = this.soundsLoaded) === null || _b === void 0 ? void 0 : _b.callEndedSound) {
64
+ this.soundsLoaded.callEndedSound.pause();
65
+ this.playingSounds = false;
66
+ }
67
+ if ((_c = this.soundsLoaded) === null || _c === void 0 ? void 0 : _c.callBusySound) {
68
+ this.soundsLoaded.callBusySound.pause();
69
+ this.playingSounds = false;
70
+ }
71
+ }
52
72
  loadSounds(sounds) {
53
73
  var _a, _b, _c;
54
74
  let callEndedSound;
@@ -1 +1 @@
1
- {"version":3,"file":"CallingSoundSubscriber.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAStE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAKjC,YAAY,IAAgB,EAAE,MAAkC,EAAE,MAAsB;QAShF,uBAAkB,GAAG,GAAS,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;;g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aAAa,GAAG,IAAI,KAAK,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,0CAAE,GAAG,CAAC,CAAC;YACjD,aAAa,CAAC,OAAO,GAAG,MAAM,CAAC;QACjC,CAAC;QACD,OAAO;YACL,cAAc;YACd,gBAAgB;YAChB,aAAa;SACd,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,KAAuB;QACvC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;YACvB,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,sEAAsE,CAAC,CAAC;QAC3F,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,IAAgB,EAAE,MAAkC,EAAW,EAAE;IAC1F,IACE,MAAM;QACN,MAAM,CAAC,MAAM,IAAI,CAAC;QAClB,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,YAAY,CAAC,EACzD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CallCommon } from '@azure/communication-calling';\nimport { CallingSounds } from './CallAdapter';\nimport { isPhoneNumberIdentifier } from '@azure/communication-common';\nimport { CommunicationIdentifier } from '@azure/communication-common';\n\ntype CallingSoundsLoaded = {\n callEndedSound?: HTMLAudioElement;\n callRingingSound?: HTMLAudioElement;\n callBusySound?: HTMLAudioElement;\n};\n\nconst CALL_REJECTED_CODE = 603;\n\nconst CALL_ENDED_CODE = 0;\nconst CALL_TRANSFER_SUBCODE = 7015;\n\n/**\n * @private\n */\nexport class CallingSoundSubscriber {\n private call: CallCommon;\n private soundsLoaded?: CallingSoundsLoaded;\n private callee: CommunicationIdentifier[] | undefined;\n\n constructor(call: CallCommon, callee?: CommunicationIdentifier[], sounds?: CallingSounds) {\n this.call = call;\n this.callee = callee;\n if (sounds) {\n this.soundsLoaded = this.loadSounds(sounds);\n this.subscribeCallSoundEvents();\n }\n }\n\n private onCallStateChanged = (): void => {\n this.call.on('stateChanged', () => {\n if (shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {\n this.soundsLoaded.callRingingSound.loop = true;\n this.playSound(this.soundsLoaded.callRingingSound);\n }\n if (!shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {\n this.soundsLoaded.callRingingSound.loop = false;\n this.soundsLoaded.callRingingSound.pause();\n }\n if (this.call.state === 'Disconnected') {\n if (this.soundsLoaded?.callBusySound && this.call.callEndReason?.code === CALL_REJECTED_CODE) {\n this.playSound(this.soundsLoaded.callBusySound);\n } else if (\n this.soundsLoaded?.callEndedSound &&\n this.call.callEndReason?.code === CALL_ENDED_CODE &&\n this.call.callEndReason?.subCode !== CALL_TRANSFER_SUBCODE\n ) {\n this.playSound(this.soundsLoaded.callEndedSound);\n }\n }\n });\n };\n\n private subscribeCallSoundEvents(): void {\n this.onCallStateChanged();\n }\n\n public unsubscribeAll(): void {\n this.call?.off('stateChanged', this.onCallStateChanged);\n if (this.soundsLoaded?.callRingingSound) {\n this.soundsLoaded.callRingingSound.pause();\n }\n }\n\n private loadSounds(sounds?: CallingSounds): CallingSoundsLoaded | undefined {\n let callEndedSound;\n if (sounds?.callEnded) {\n callEndedSound = new Audio(sounds?.callEnded?.url);\n callEndedSound.preload = 'auto';\n }\n let callRingingSound;\n if (sounds?.callRinging) {\n callRingingSound = new Audio(sounds?.callRinging?.url);\n callRingingSound.preload = 'auto';\n }\n let callBusySound;\n if (sounds?.callBusy) {\n callBusySound = new Audio(sounds?.callBusy?.url);\n callBusySound.preload = 'auto';\n }\n return {\n callEndedSound,\n callRingingSound,\n callBusySound\n };\n }\n\n private playSound(sound: HTMLAudioElement): void {\n sound.play().catch((e) => {\n console.error(e, 'Failed to play sound, check loader config to make sure it is correct');\n });\n }\n}\n\n/**\n * Helper function to allow the calling sound subscriber to determine when to play the ringing\n * sound when making an outbound call.\n */\nconst shouldPlayRinging = (call: CallCommon, callee?: CommunicationIdentifier[]): boolean => {\n if (\n callee &&\n callee.length >= 1 &&\n !isPhoneNumberIdentifier(callee[0]) &&\n (call.state === 'Ringing' || call.state === 'Connecting')\n ) {\n return true;\n } else {\n return false;\n }\n return false;\n};\n"]}
1
+ {"version":3,"file":"CallingSoundSubscriber.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/CallComposite/adapter/CallingSoundSubscriber.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAStE,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAMjC,YAAY,IAAgB,EAAE,MAAkC,EAAE,MAAsB;QAFjF,kBAAa,GAAY,KAAK,CAAC;QAW9B,uBAAkB,GAAG,GAAS,EAAE;YACtC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,GAAG,EAAE;;gBAChC,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,KAAI,MAAA,IAAI,CAAC,YAAY,0CAAE,gBAAgB,CAAA,EAAE,CAAC;oBACrF,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,GAAG,IAAI,CAAC;oBAC/C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;oBACnD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;gBAC5B,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sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CallCommon } from '@azure/communication-calling';\nimport { CallingSounds } from './CallAdapter';\nimport { isPhoneNumberIdentifier } from '@azure/communication-common';\nimport { CommunicationIdentifier } from '@azure/communication-common';\n\ntype CallingSoundsLoaded = {\n callEndedSound?: HTMLAudioElement;\n callRingingSound?: HTMLAudioElement;\n callBusySound?: HTMLAudioElement;\n};\n\nconst CALL_REJECTED_CODE = 603;\n\nconst CALL_ENDED_CODE = 0;\nconst CALL_TRANSFER_SUBCODE = 7015;\n\n/**\n * @private\n */\nexport class CallingSoundSubscriber {\n private call: CallCommon;\n private soundsLoaded?: CallingSoundsLoaded;\n private callee: CommunicationIdentifier[] | undefined;\n public playingSounds: boolean = false;\n\n constructor(call: CallCommon, callee?: CommunicationIdentifier[], sounds?: CallingSounds) {\n this.call = call;\n this.callee = callee;\n if (sounds) {\n this.soundsLoaded = this.loadSounds(sounds);\n this.subscribeCallSoundEvents();\n }\n }\n\n private onCallStateChanged = (): void => {\n this.call.on('stateChanged', () => {\n if (shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {\n this.soundsLoaded.callRingingSound.loop = true;\n this.playSound(this.soundsLoaded.callRingingSound);\n this.playingSounds = true;\n }\n if (!shouldPlayRinging(this.call, this.callee) && this.soundsLoaded?.callRingingSound) {\n this.soundsLoaded.callRingingSound.loop = false;\n this.soundsLoaded.callRingingSound.pause();\n this.playingSounds = false;\n }\n if (this.call.state === 'Disconnected') {\n if (this.soundsLoaded?.callBusySound && this.call.callEndReason?.code === CALL_REJECTED_CODE) {\n this.playSound(this.soundsLoaded.callBusySound);\n this.playingSounds = true;\n } else if (\n this.soundsLoaded?.callEndedSound &&\n this.call.callEndReason?.code === CALL_ENDED_CODE &&\n this.call.callEndReason?.subCode !== CALL_TRANSFER_SUBCODE\n ) {\n this.playSound(this.soundsLoaded.callEndedSound);\n this.playingSounds = true;\n }\n }\n });\n };\n\n private subscribeCallSoundEvents(): void {\n this.onCallStateChanged();\n }\n\n public unsubscribeAll(): void {\n this.call?.off('stateChanged', this.onCallStateChanged);\n if (this.soundsLoaded?.callRingingSound) {\n this.soundsLoaded.callRingingSound.pause();\n }\n }\n\n public pauseSounds(): void {\n if (this.soundsLoaded?.callRingingSound) {\n this.soundsLoaded.callRingingSound.pause();\n this.playingSounds = false;\n }\n if (this.soundsLoaded?.callEndedSound) {\n this.soundsLoaded.callEndedSound.pause();\n this.playingSounds = false;\n }\n if (this.soundsLoaded?.callBusySound) {\n this.soundsLoaded.callBusySound.pause();\n this.playingSounds = false;\n }\n }\n\n private loadSounds(sounds?: CallingSounds): CallingSoundsLoaded | undefined {\n let callEndedSound;\n if (sounds?.callEnded) {\n callEndedSound = new Audio(sounds?.callEnded?.url);\n callEndedSound.preload = 'auto';\n }\n let callRingingSound;\n if (sounds?.callRinging) {\n callRingingSound = new Audio(sounds?.callRinging?.url);\n callRingingSound.preload = 'auto';\n }\n let callBusySound;\n if (sounds?.callBusy) {\n callBusySound = new Audio(sounds?.callBusy?.url);\n callBusySound.preload = 'auto';\n }\n return {\n callEndedSound,\n callRingingSound,\n callBusySound\n };\n }\n\n private playSound(sound: HTMLAudioElement): void {\n sound.play().catch((e) => {\n console.error(e, 'Failed to play sound, check loader config to make sure it is correct');\n });\n }\n}\n\n/**\n * Helper function to allow the calling sound subscriber to determine when to play the ringing\n * sound when making an outbound call.\n */\nconst shouldPlayRinging = (call: CallCommon, callee?: CommunicationIdentifier[]): boolean => {\n if (\n callee &&\n callee.length >= 1 &&\n !isPhoneNumberIdentifier(callee[0]) &&\n (call.state === 'Ringing' || call.state === 'Connecting')\n ) {\n return true;\n } else {\n return false;\n }\n return false;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/communication-react",
3
- "version": "1.18.0-alpha-202406250013",
3
+ "version": "1.18.0-alpha-202406260014",
4
4
  "sideEffects": false,
5
5
  "description": "React library for building modern communication user experiences utilizing Azure Communication Services",
6
6
  "keywords": [
@@ -28,18 +28,18 @@
28
28
  "@azure/logger": "^1.0.4",
29
29
  "@fluentui/react-components": "^9.47.3",
30
30
  "@fluentui/react": "^8.117.1",
31
- "@fluentui/react-file-type-icons": "8.11.9",
31
+ "@fluentui/react-file-type-icons": "8.11.16",
32
32
  "@fluentui/react-hooks": "^8.7.0",
33
- "@fluentui/react-icons": "^2.0.239",
34
- "@fluentui/react-window-provider": "^2.2.21",
33
+ "@fluentui/react-icons": "^2.0.245",
34
+ "@fluentui/react-window-provider": "^2.2.27",
35
35
  "@fluentui-contrib/react-chat": "0.1.9",
36
- "@griffel/react": "^1.5.22",
36
+ "@griffel/react": "^1.5.23",
37
37
  "copy-to-clipboard": "^3.3.1",
38
38
  "dompurify": "^3.1.5",
39
39
  "events": "^3.3.0",
40
40
  "html-react-parser": "^5.1.10",
41
41
  "immer": "10.1.1",
42
- "libphonenumber-js": "^1.11.3",
42
+ "libphonenumber-js": "^1.11.4",
43
43
  "memoize-one": "^5.2.1",
44
44
  "nanoid": "3.3.6",
45
45
  "react-linkify": "^1.0.0-alpha",