@cometchat/chat-uikit-angular 5.0.2 → 5.0.3

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.
@@ -26148,6 +26148,211 @@ class CometChatLocalize {
26148
26148
  */
26149
26149
  const getLocalizedString = (key) => CometChatLocalize.getLocalizedString(key);
26150
26150
 
26151
+ /**
26152
+ * Represents the settings required to initialize the CometChat UIKit.
26153
+ * Use `UIKitSettingsBuilder` to create an instance of this class.
26154
+ *
26155
+ * @example
26156
+ * const settings = new UIKitSettingsBuilder()
26157
+ * .setAppId('YOUR_APP_ID')
26158
+ * .setRegion('us')
26159
+ * .setAuthKey('YOUR_AUTH_KEY')
26160
+ * .build();
26161
+ *
26162
+ * CometChatUIKit.init(settings);
26163
+ */
26164
+ class UIKitSettings {
26165
+ appId;
26166
+ region;
26167
+ subscriptionType;
26168
+ autoEstablishSocketConnection;
26169
+ authKey;
26170
+ roles;
26171
+ adminHost;
26172
+ clientHost;
26173
+ storageMode;
26174
+ /**
26175
+ * Whether calling features (voice/video) are enabled.
26176
+ * When `false` (default), the Calls SDK is not initialized and
26177
+ * call buttons are hidden across all components.
26178
+ * @default false
26179
+ */
26180
+ callingEnabled;
26181
+ /**
26182
+ * Custom CallAppSettings to use when initializing the Calls SDK.
26183
+ * If not provided, the UIKit builds default settings from appId and region.
26184
+ * Typed as `any` because `@cometchat/calls-sdk-javascript` is an optional dependency.
26185
+ */
26186
+ callAppSettings;
26187
+ /**
26188
+ * Creates a new UIKitSettings instance.
26189
+ * Prefer using UIKitSettingsBuilder for a fluent API.
26190
+ */
26191
+ constructor(builder) {
26192
+ if (builder) {
26193
+ this.appId = builder.appId;
26194
+ this.region = builder.region;
26195
+ this.subscriptionType = builder.subscriptionType;
26196
+ this.autoEstablishSocketConnection = builder.autoEstablishSocketConnection ?? true;
26197
+ this.authKey = builder.authKey;
26198
+ this.adminHost = builder.adminHost;
26199
+ this.clientHost = builder.clientHost;
26200
+ this.roles = builder.roles;
26201
+ this.storageMode = builder.storageMode ?? CometChat.StorageMode.LOCAL;
26202
+ this.callingEnabled = builder.callingEnabled ?? false;
26203
+ this.callAppSettings = builder.callAppSettings;
26204
+ }
26205
+ else {
26206
+ this.autoEstablishSocketConnection = true;
26207
+ this.storageMode = CometChat.StorageMode.LOCAL;
26208
+ this.callingEnabled = false;
26209
+ }
26210
+ }
26211
+ static fromBuilder(builder) {
26212
+ return new UIKitSettings(builder);
26213
+ }
26214
+ getAppId() {
26215
+ return this.appId;
26216
+ }
26217
+ getRegion() {
26218
+ return this.region;
26219
+ }
26220
+ getRoles() {
26221
+ return this.roles;
26222
+ }
26223
+ getSubscriptionType() {
26224
+ return this.subscriptionType;
26225
+ }
26226
+ getAuthKey() {
26227
+ return this.authKey;
26228
+ }
26229
+ isAutoEstablishSocketConnection() {
26230
+ return this.autoEstablishSocketConnection;
26231
+ }
26232
+ getAdminHost() {
26233
+ return this.adminHost;
26234
+ }
26235
+ getClientHost() {
26236
+ return this.clientHost;
26237
+ }
26238
+ getStorageMode() {
26239
+ return this.storageMode;
26240
+ }
26241
+ isCallingEnabled() {
26242
+ return this.callingEnabled;
26243
+ }
26244
+ getCallAppSettings() {
26245
+ return this.callAppSettings;
26246
+ }
26247
+ }
26248
+ /**
26249
+ * Builder class for creating UIKitSettings instances.
26250
+ * Provides a fluent API for configuring CometChat UIKit settings.
26251
+ *
26252
+ * @example
26253
+ * const settings = new UIKitSettingsBuilder()
26254
+ * .setAppId('YOUR_APP_ID')
26255
+ * .setRegion('us')
26256
+ * .setAuthKey('YOUR_AUTH_KEY')
26257
+ * .build();
26258
+ */
26259
+ class UIKitSettingsBuilder {
26260
+ appId;
26261
+ region;
26262
+ subscriptionType;
26263
+ roles;
26264
+ autoEstablishSocketConnection;
26265
+ authKey;
26266
+ adminHost;
26267
+ clientHost;
26268
+ storageMode;
26269
+ callingEnabled;
26270
+ callAppSettings;
26271
+ build() {
26272
+ return UIKitSettings.fromBuilder(this);
26273
+ }
26274
+ setAppId(appId) {
26275
+ this.appId = appId;
26276
+ return this;
26277
+ }
26278
+ setRegion(region) {
26279
+ this.region = region;
26280
+ return this;
26281
+ }
26282
+ setAuthKey(authKey) {
26283
+ this.authKey = authKey;
26284
+ return this;
26285
+ }
26286
+ subscribePresenceForAllUsers() {
26287
+ this.subscriptionType = 'ALL_USERS';
26288
+ return this;
26289
+ }
26290
+ subscribePresenceForFriends() {
26291
+ this.subscriptionType = 'FRIENDS';
26292
+ return this;
26293
+ }
26294
+ subscribePresenceForRoles(roles) {
26295
+ this.subscriptionType = 'ROLES';
26296
+ this.roles = roles;
26297
+ return this;
26298
+ }
26299
+ setRoles(roles) {
26300
+ this.roles = roles;
26301
+ return this;
26302
+ }
26303
+ setAutoEstablishSocketConnection(autoEstablish) {
26304
+ this.autoEstablishSocketConnection = autoEstablish;
26305
+ return this;
26306
+ }
26307
+ setAdminHost(adminHost) {
26308
+ this.adminHost = adminHost;
26309
+ return this;
26310
+ }
26311
+ setClientHost(clientHost) {
26312
+ this.clientHost = clientHost;
26313
+ return this;
26314
+ }
26315
+ setStorageMode(storageMode) {
26316
+ this.storageMode = storageMode;
26317
+ return this;
26318
+ }
26319
+ /**
26320
+ * Enables or disables calling features (voice/video).
26321
+ * When `true`, the Calls SDK is initialized after login and call buttons
26322
+ * become visible in components like MessageHeader and CallLogs.
26323
+ * @default false
26324
+ */
26325
+ setCallingEnabled(enabled) {
26326
+ this.callingEnabled = enabled;
26327
+ return this;
26328
+ }
26329
+ /**
26330
+ * Sets a custom `CallAppSettings` object to use when initializing the Calls SDK.
26331
+ * If not set, the UIKit builds default settings from `appId` and `region`.
26332
+ *
26333
+ * Build the settings using `CometChatUIKitCalls.CallAppSettingsBuilder`.
26334
+ *
26335
+ * @example
26336
+ * import { CometChatUIKitCalls } from '@cometchat/calls-sdk-javascript';
26337
+ *
26338
+ * const callAppSettings = new CometChatUIKitCalls.CallAppSettingsBuilder()
26339
+ * .setAppId('APP_ID')
26340
+ * .setRegion('REGION')
26341
+ * .build();
26342
+ *
26343
+ * const settings = new UIKitSettingsBuilder()
26344
+ * .setAppId('APP_ID')
26345
+ * .setRegion('REGION')
26346
+ * .setCallingEnabled(true)
26347
+ * .setCallAppSettings(callAppSettings)
26348
+ * .build();
26349
+ */
26350
+ setCallAppSettings(callAppSettings) {
26351
+ this.callAppSettings = callAppSettings;
26352
+ return this;
26353
+ }
26354
+ }
26355
+
26151
26356
  /**
26152
26357
  * Log level enum defining verbosity levels.
26153
26358
  * Ordered from least verbose (none) to most verbose (debug).
@@ -27598,7 +27803,7 @@ class CometChatUIKit {
27598
27803
  }
27599
27804
  CometChatLocalize.setCurrentLanguage(CometChatLocalize.getBrowserLanguage());
27600
27805
  return new Promise((resolve, reject) => {
27601
- window.CometChatUiKit = { name: '@cometchat/chat-uikit-angular', version: '5.0.2' };
27806
+ window.CometChatUiKit = { name: '@cometchat/chat-uikit-angular', version: '5.0.3' };
27602
27807
  CometChat.init(uiKitSettings?.appId, appSettings)
27603
27808
  .then(() => {
27604
27809
  CometChat.getLoggedinUser()
@@ -27616,6 +27821,63 @@ class CometChatUIKit {
27616
27821
  });
27617
27822
  }
27618
27823
  init(uiKitSettings) { return CometChatUIKit.init(uiKitSettings); }
27824
+ /**
27825
+ * File-based init for AI agent skills.
27826
+ * Accepts a parsed `cometchat-settings.json` object and delegates to the
27827
+ * Chat SDK's file-based init, which internally sets
27828
+ * `integrationSource = "ai-agent"` for telemetry.
27829
+ *
27830
+ * This method is independent of `init()` — it does NOT call `init()`.
27831
+ * It builds UIKitSettings internally so login/createUser/updateUser keep working.
27832
+ *
27833
+ * @internal — excluded from public API docs
27834
+ */
27835
+ static initFromSettings(settings) {
27836
+ // Extract UIKit-specific config from the settings JSON
27837
+ const authKey = settings.credentials?.authKey;
27838
+ const subscribeAll = settings.uiKit?.['subscribePresenceForAllUsers'] ?? true;
27839
+ // Build UIKitSettings so downstream code (login, enableCalling, etc.) works unchanged
27840
+ const builder = new UIKitSettingsBuilder()
27841
+ .setAppId(settings.appId)
27842
+ .setRegion(settings.region);
27843
+ if (authKey) {
27844
+ builder.setAuthKey(authKey);
27845
+ }
27846
+ if (subscribeAll) {
27847
+ builder.subscribePresenceForAllUsers();
27848
+ }
27849
+ CometChatUIKit._uiKitSettings = builder.build();
27850
+ // Set source for telemetry
27851
+ if (CometChat.setSource) {
27852
+ CometChat.setSource('uikit-v5', 'web', 'angular');
27853
+ }
27854
+ CometChatLocalize.setCurrentLanguage(CometChatLocalize.getBrowserLanguage());
27855
+ // CRITICAL: Call CometChat.initFromSettings() (NOT CometChat.init()).
27856
+ // This is the SDK's file-based init path which sets
27857
+ // integrationSource = "ai-agent" for telemetry.
27858
+ return new Promise((resolve, reject) => {
27859
+ window.CometChatUiKit = { name: '@cometchat/chat-uikit-angular', version: '5.0.3' };
27860
+ CometChat.initFromSettings(settings)
27861
+ .then(() => {
27862
+ CometChat.getLoggedinUser()
27863
+ .then((user) => {
27864
+ if (user) {
27865
+ CometChatUIKitLoginListener.setLoggedInUser(user);
27866
+ CometChatUIKit._loggedInUser.next(user);
27867
+ this.initiateAfterLogin();
27868
+ }
27869
+ return resolve({ user });
27870
+ })
27871
+ .catch((error) => {
27872
+ CometChatLogger.error('CometChatUIKit', 'Initialization failed:', error);
27873
+ return reject(error);
27874
+ });
27875
+ })
27876
+ .catch((error) => {
27877
+ return reject(error);
27878
+ });
27879
+ });
27880
+ }
27619
27881
  static isInitialized() {
27620
27882
  try {
27621
27883
  return CometChat.isInitialized();
@@ -27771,211 +28033,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.12", ngImpo
27771
28033
  args: [{ providedIn: 'root' }]
27772
28034
  }] });
27773
28035
 
27774
- /**
27775
- * Represents the settings required to initialize the CometChat UIKit.
27776
- * Use `UIKitSettingsBuilder` to create an instance of this class.
27777
- *
27778
- * @example
27779
- * const settings = new UIKitSettingsBuilder()
27780
- * .setAppId('YOUR_APP_ID')
27781
- * .setRegion('us')
27782
- * .setAuthKey('YOUR_AUTH_KEY')
27783
- * .build();
27784
- *
27785
- * CometChatUIKit.init(settings);
27786
- */
27787
- class UIKitSettings {
27788
- appId;
27789
- region;
27790
- subscriptionType;
27791
- autoEstablishSocketConnection;
27792
- authKey;
27793
- roles;
27794
- adminHost;
27795
- clientHost;
27796
- storageMode;
27797
- /**
27798
- * Whether calling features (voice/video) are enabled.
27799
- * When `false` (default), the Calls SDK is not initialized and
27800
- * call buttons are hidden across all components.
27801
- * @default false
27802
- */
27803
- callingEnabled;
27804
- /**
27805
- * Custom CallAppSettings to use when initializing the Calls SDK.
27806
- * If not provided, the UIKit builds default settings from appId and region.
27807
- * Typed as `any` because `@cometchat/calls-sdk-javascript` is an optional dependency.
27808
- */
27809
- callAppSettings;
27810
- /**
27811
- * Creates a new UIKitSettings instance.
27812
- * Prefer using UIKitSettingsBuilder for a fluent API.
27813
- */
27814
- constructor(builder) {
27815
- if (builder) {
27816
- this.appId = builder.appId;
27817
- this.region = builder.region;
27818
- this.subscriptionType = builder.subscriptionType;
27819
- this.autoEstablishSocketConnection = builder.autoEstablishSocketConnection ?? true;
27820
- this.authKey = builder.authKey;
27821
- this.adminHost = builder.adminHost;
27822
- this.clientHost = builder.clientHost;
27823
- this.roles = builder.roles;
27824
- this.storageMode = builder.storageMode ?? CometChat.StorageMode.LOCAL;
27825
- this.callingEnabled = builder.callingEnabled ?? false;
27826
- this.callAppSettings = builder.callAppSettings;
27827
- }
27828
- else {
27829
- this.autoEstablishSocketConnection = true;
27830
- this.storageMode = CometChat.StorageMode.LOCAL;
27831
- this.callingEnabled = false;
27832
- }
27833
- }
27834
- static fromBuilder(builder) {
27835
- return new UIKitSettings(builder);
27836
- }
27837
- getAppId() {
27838
- return this.appId;
27839
- }
27840
- getRegion() {
27841
- return this.region;
27842
- }
27843
- getRoles() {
27844
- return this.roles;
27845
- }
27846
- getSubscriptionType() {
27847
- return this.subscriptionType;
27848
- }
27849
- getAuthKey() {
27850
- return this.authKey;
27851
- }
27852
- isAutoEstablishSocketConnection() {
27853
- return this.autoEstablishSocketConnection;
27854
- }
27855
- getAdminHost() {
27856
- return this.adminHost;
27857
- }
27858
- getClientHost() {
27859
- return this.clientHost;
27860
- }
27861
- getStorageMode() {
27862
- return this.storageMode;
27863
- }
27864
- isCallingEnabled() {
27865
- return this.callingEnabled;
27866
- }
27867
- getCallAppSettings() {
27868
- return this.callAppSettings;
27869
- }
27870
- }
27871
- /**
27872
- * Builder class for creating UIKitSettings instances.
27873
- * Provides a fluent API for configuring CometChat UIKit settings.
27874
- *
27875
- * @example
27876
- * const settings = new UIKitSettingsBuilder()
27877
- * .setAppId('YOUR_APP_ID')
27878
- * .setRegion('us')
27879
- * .setAuthKey('YOUR_AUTH_KEY')
27880
- * .build();
27881
- */
27882
- class UIKitSettingsBuilder {
27883
- appId;
27884
- region;
27885
- subscriptionType;
27886
- roles;
27887
- autoEstablishSocketConnection;
27888
- authKey;
27889
- adminHost;
27890
- clientHost;
27891
- storageMode;
27892
- callingEnabled;
27893
- callAppSettings;
27894
- build() {
27895
- return UIKitSettings.fromBuilder(this);
27896
- }
27897
- setAppId(appId) {
27898
- this.appId = appId;
27899
- return this;
27900
- }
27901
- setRegion(region) {
27902
- this.region = region;
27903
- return this;
27904
- }
27905
- setAuthKey(authKey) {
27906
- this.authKey = authKey;
27907
- return this;
27908
- }
27909
- subscribePresenceForAllUsers() {
27910
- this.subscriptionType = 'ALL_USERS';
27911
- return this;
27912
- }
27913
- subscribePresenceForFriends() {
27914
- this.subscriptionType = 'FRIENDS';
27915
- return this;
27916
- }
27917
- subscribePresenceForRoles(roles) {
27918
- this.subscriptionType = 'ROLES';
27919
- this.roles = roles;
27920
- return this;
27921
- }
27922
- setRoles(roles) {
27923
- this.roles = roles;
27924
- return this;
27925
- }
27926
- setAutoEstablishSocketConnection(autoEstablish) {
27927
- this.autoEstablishSocketConnection = autoEstablish;
27928
- return this;
27929
- }
27930
- setAdminHost(adminHost) {
27931
- this.adminHost = adminHost;
27932
- return this;
27933
- }
27934
- setClientHost(clientHost) {
27935
- this.clientHost = clientHost;
27936
- return this;
27937
- }
27938
- setStorageMode(storageMode) {
27939
- this.storageMode = storageMode;
27940
- return this;
27941
- }
27942
- /**
27943
- * Enables or disables calling features (voice/video).
27944
- * When `true`, the Calls SDK is initialized after login and call buttons
27945
- * become visible in components like MessageHeader and CallLogs.
27946
- * @default false
27947
- */
27948
- setCallingEnabled(enabled) {
27949
- this.callingEnabled = enabled;
27950
- return this;
27951
- }
27952
- /**
27953
- * Sets a custom `CallAppSettings` object to use when initializing the Calls SDK.
27954
- * If not set, the UIKit builds default settings from `appId` and `region`.
27955
- *
27956
- * Build the settings using `CometChatUIKitCalls.CallAppSettingsBuilder`.
27957
- *
27958
- * @example
27959
- * import { CometChatUIKitCalls } from '@cometchat/calls-sdk-javascript';
27960
- *
27961
- * const callAppSettings = new CometChatUIKitCalls.CallAppSettingsBuilder()
27962
- * .setAppId('APP_ID')
27963
- * .setRegion('REGION')
27964
- * .build();
27965
- *
27966
- * const settings = new UIKitSettingsBuilder()
27967
- * .setAppId('APP_ID')
27968
- * .setRegion('REGION')
27969
- * .setCallingEnabled(true)
27970
- * .setCallAppSettings(callAppSettings)
27971
- * .build();
27972
- */
27973
- setCallAppSettings(callAppSettings) {
27974
- this.callAppSettings = callAppSettings;
27975
- return this;
27976
- }
27977
- }
27978
-
27979
28036
  /**
27980
28037
  * Angular pipe for translating keys to localized strings.
27981
28038
  *