@bigbinary/neeto-commons-frontend 2.0.62 → 2.0.64

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/utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Subscription } from "@rails/actioncable";
1
2
  import dayjs from "dayjs";
2
3
  import React from "react";
3
4
  export function resetAuthTokens(): void;
@@ -300,4 +301,30 @@ export function hasAnyPermission(...permissions: string[]): boolean;
300
301
  * hasAllPermissions("user.view_settings", "user.edit_settings");
301
302
  * @endexample
302
303
  */
303
- export function hasAllPermissions(...permissions: string[]): boolean;
304
+ export function hasAllPermissions(...permissions: string[]): boolean;
305
+ type ChannelNameWithParams = {
306
+ channel: string;
307
+ [key: string]: any;
308
+ };
309
+ /**
310
+ *
311
+ * Curried: false
312
+ *
313
+ * This function will create subscription were consumer is subscribed to rails
314
+ *
315
+ * action cable channel.
316
+ *
317
+ * Usage:
318
+ *
319
+ * @example
320
+ *
321
+ * const subscription = createSubscription(
322
+ * {
323
+ * channel: "testChannel",
324
+ * deployment_id: "deploymentId",
325
+ * },
326
+ * value => handleValue(value)
327
+ * );
328
+ * @endexample
329
+ */
330
+ export function createSubscription(channelName: string | ChannelNameWithParams, callback: (value: string) => void): Subscription;