@wix/notifications 1.0.47 → 1.0.49

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.
@@ -1,803 +0,0 @@
1
- type HostModule<T, H extends Host> = {
2
- __type: 'host';
3
- create(host: H): T;
4
- };
5
- type HostModuleAPI<T extends HostModule<any, any>> = T extends HostModule<infer U, any> ? U : never;
6
- type Host<Environment = unknown> = {
7
- channel: {
8
- observeState(callback: (props: unknown, environment: Environment) => unknown): {
9
- disconnect: () => void;
10
- } | Promise<{
11
- disconnect: () => void;
12
- }>;
13
- };
14
- environment?: Environment;
15
- /**
16
- * Optional name of the environment, use for logging
17
- */
18
- name?: string;
19
- /**
20
- * Optional bast url to use for API requests, for example `www.wixapis.com`
21
- */
22
- apiBaseUrl?: string;
23
- /**
24
- * Possible data to be provided by every host, for cross cutting concerns
25
- * like internationalization, billing, etc.
26
- */
27
- essentials?: {
28
- /**
29
- * The language of the currently viewed session
30
- */
31
- language?: string;
32
- /**
33
- * The locale of the currently viewed session
34
- */
35
- locale?: string;
36
- /**
37
- * Any headers that should be passed through to the API requests
38
- */
39
- passThroughHeaders?: Record<string, string>;
40
- };
41
- };
42
-
43
- type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
44
- interface HttpClient {
45
- request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
46
- fetchWithAuth: typeof fetch;
47
- wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
48
- getActiveToken?: () => string | undefined;
49
- }
50
- type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
51
- type HttpResponse<T = any> = {
52
- data: T;
53
- status: number;
54
- statusText: string;
55
- headers: any;
56
- request?: any;
57
- };
58
- type RequestOptions<_TResponse = any, Data = any> = {
59
- method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
60
- url: string;
61
- data?: Data;
62
- params?: URLSearchParams;
63
- } & APIMetadata;
64
- type APIMetadata = {
65
- methodFqn?: string;
66
- entityFqdn?: string;
67
- packageName?: string;
68
- };
69
- type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
70
- type EventDefinition<Payload = unknown, Type extends string = string> = {
71
- __type: 'event-definition';
72
- type: Type;
73
- isDomainEvent?: boolean;
74
- transformations?: (envelope: unknown) => Payload;
75
- __payload: Payload;
76
- };
77
- declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
78
- type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
79
- type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
80
-
81
- type ServicePluginMethodInput = {
82
- request: any;
83
- metadata: any;
84
- };
85
- type ServicePluginContract = Record<string, (payload: ServicePluginMethodInput) => unknown | Promise<unknown>>;
86
- type ServicePluginMethodMetadata = {
87
- name: string;
88
- primaryHttpMappingPath: string;
89
- transformations: {
90
- fromREST: (...args: unknown[]) => ServicePluginMethodInput;
91
- toREST: (...args: unknown[]) => unknown;
92
- };
93
- };
94
- type ServicePluginDefinition<Contract extends ServicePluginContract> = {
95
- __type: 'service-plugin-definition';
96
- componentType: string;
97
- methods: ServicePluginMethodMetadata[];
98
- __contract: Contract;
99
- };
100
- declare function ServicePluginDefinition<Contract extends ServicePluginContract>(componentType: string, methods: ServicePluginMethodMetadata[]): ServicePluginDefinition<Contract>;
101
- type BuildServicePluginDefinition<T extends ServicePluginDefinition<any>> = (implementation: T['__contract']) => void;
102
- declare const SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
103
-
104
- type RequestContext = {
105
- isSSR: boolean;
106
- host: string;
107
- protocol?: string;
108
- };
109
- type ResponseTransformer = (data: any, headers?: any) => any;
110
- /**
111
- * Ambassador request options types are copied mostly from AxiosRequestConfig.
112
- * They are copied and not imported to reduce the amount of dependencies (to reduce install time).
113
- * https://github.com/axios/axios/blob/3f53eb6960f05a1f88409c4b731a40de595cb825/index.d.ts#L307-L315
114
- */
115
- type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
116
- type AmbassadorRequestOptions<T = any> = {
117
- _?: T;
118
- url?: string;
119
- method?: Method;
120
- params?: any;
121
- data?: any;
122
- transformResponse?: ResponseTransformer | ResponseTransformer[];
123
- };
124
- type AmbassadorFactory<Request, Response> = (payload: Request) => ((context: RequestContext) => AmbassadorRequestOptions<Response>) & {
125
- __isAmbassador: boolean;
126
- };
127
- type AmbassadorFunctionDescriptor<Request = any, Response = any> = AmbassadorFactory<Request, Response>;
128
- type BuildAmbassadorFunction<T extends AmbassadorFunctionDescriptor> = T extends AmbassadorFunctionDescriptor<infer Request, infer Response> ? (req: Request) => Promise<Response> : never;
129
-
130
- declare global {
131
- // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
132
- interface SymbolConstructor {
133
- readonly observable: symbol;
134
- }
135
- }
136
-
137
- declare const emptyObjectSymbol: unique symbol;
138
-
139
- /**
140
- Represents a strictly empty plain object, the `{}` value.
141
-
142
- When you annotate something as the type `{}`, it can be anything except `null` and `undefined`. This means that you cannot use `{}` to represent an empty plain object ([read more](https://stackoverflow.com/questions/47339869/typescript-empty-object-and-any-difference/52193484#52193484)).
143
-
144
- @example
145
- ```
146
- import type {EmptyObject} from 'type-fest';
147
-
148
- // The following illustrates the problem with `{}`.
149
- const foo1: {} = {}; // Pass
150
- const foo2: {} = []; // Pass
151
- const foo3: {} = 42; // Pass
152
- const foo4: {} = {a: 1}; // Pass
153
-
154
- // With `EmptyObject` only the first case is valid.
155
- const bar1: EmptyObject = {}; // Pass
156
- const bar2: EmptyObject = 42; // Fail
157
- const bar3: EmptyObject = []; // Fail
158
- const bar4: EmptyObject = {a: 1}; // Fail
159
- ```
160
-
161
- Unfortunately, `Record<string, never>`, `Record<keyof any, never>` and `Record<never, never>` do not work. See {@link https://github.com/sindresorhus/type-fest/issues/395 #395}.
162
-
163
- @category Object
164
- */
165
- type EmptyObject = {[emptyObjectSymbol]?: never};
166
-
167
- /**
168
- Returns a boolean for whether the two given types are equal.
169
-
170
- @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
171
- @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
172
-
173
- Use-cases:
174
- - If you want to make a conditional branch based on the result of a comparison of two types.
175
-
176
- @example
177
- ```
178
- import type {IsEqual} from 'type-fest';
179
-
180
- // This type returns a boolean for whether the given array includes the given item.
181
- // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
182
- type Includes<Value extends readonly any[], Item> =
183
- Value extends readonly [Value[0], ...infer rest]
184
- ? IsEqual<Value[0], Item> extends true
185
- ? true
186
- : Includes<rest, Item>
187
- : false;
188
- ```
189
-
190
- @category Type Guard
191
- @category Utilities
192
- */
193
- type IsEqual<A, B> =
194
- (<G>() => G extends A ? 1 : 2) extends
195
- (<G>() => G extends B ? 1 : 2)
196
- ? true
197
- : false;
198
-
199
- /**
200
- Filter out keys from an object.
201
-
202
- Returns `never` if `Exclude` is strictly equal to `Key`.
203
- Returns `never` if `Key` extends `Exclude`.
204
- Returns `Key` otherwise.
205
-
206
- @example
207
- ```
208
- type Filtered = Filter<'foo', 'foo'>;
209
- //=> never
210
- ```
211
-
212
- @example
213
- ```
214
- type Filtered = Filter<'bar', string>;
215
- //=> never
216
- ```
217
-
218
- @example
219
- ```
220
- type Filtered = Filter<'bar', 'foo'>;
221
- //=> 'bar'
222
- ```
223
-
224
- @see {Except}
225
- */
226
- type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
227
-
228
- type ExceptOptions = {
229
- /**
230
- Disallow assigning non-specified properties.
231
-
232
- Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
233
-
234
- @default false
235
- */
236
- requireExactProps?: boolean;
237
- };
238
-
239
- /**
240
- Create a type from an object type without certain keys.
241
-
242
- We recommend setting the `requireExactProps` option to `true`.
243
-
244
- This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
245
-
246
- This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
247
-
248
- @example
249
- ```
250
- import type {Except} from 'type-fest';
251
-
252
- type Foo = {
253
- a: number;
254
- b: string;
255
- };
256
-
257
- type FooWithoutA = Except<Foo, 'a'>;
258
- //=> {b: string}
259
-
260
- const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
261
- //=> errors: 'a' does not exist in type '{ b: string; }'
262
-
263
- type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
264
- //=> {a: number} & Partial<Record<"b", never>>
265
-
266
- const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
267
- //=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
268
- ```
269
-
270
- @category Object
271
- */
272
- type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
273
- [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
274
- } & (Options['requireExactProps'] extends true
275
- ? Partial<Record<KeysType, never>>
276
- : {});
277
-
278
- /**
279
- Returns a boolean for whether the given type is `never`.
280
-
281
- @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
282
- @link https://stackoverflow.com/a/53984913/10292952
283
- @link https://www.zhenghao.io/posts/ts-never
284
-
285
- Useful in type utilities, such as checking if something does not occur.
286
-
287
- @example
288
- ```
289
- import type {IsNever, And} from 'type-fest';
290
-
291
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
292
- type AreStringsEqual<A extends string, B extends string> =
293
- And<
294
- IsNever<Exclude<A, B>> extends true ? true : false,
295
- IsNever<Exclude<B, A>> extends true ? true : false
296
- >;
297
-
298
- type EndIfEqual<I extends string, O extends string> =
299
- AreStringsEqual<I, O> extends true
300
- ? never
301
- : void;
302
-
303
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
304
- if (input === output) {
305
- process.exit(0);
306
- }
307
- }
308
-
309
- endIfEqual('abc', 'abc');
310
- //=> never
311
-
312
- endIfEqual('abc', '123');
313
- //=> void
314
- ```
315
-
316
- @category Type Guard
317
- @category Utilities
318
- */
319
- type IsNever<T> = [T] extends [never] ? true : false;
320
-
321
- /**
322
- An if-else-like type that resolves depending on whether the given type is `never`.
323
-
324
- @see {@link IsNever}
325
-
326
- @example
327
- ```
328
- import type {IfNever} from 'type-fest';
329
-
330
- type ShouldBeTrue = IfNever<never>;
331
- //=> true
332
-
333
- type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
334
- //=> 'bar'
335
- ```
336
-
337
- @category Type Guard
338
- @category Utilities
339
- */
340
- type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (
341
- IsNever<T> extends true ? TypeIfNever : TypeIfNotNever
342
- );
343
-
344
- /**
345
- Extract the keys from a type where the value type of the key extends the given `Condition`.
346
-
347
- Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
348
-
349
- @example
350
- ```
351
- import type {ConditionalKeys} from 'type-fest';
352
-
353
- interface Example {
354
- a: string;
355
- b: string | number;
356
- c?: string;
357
- d: {};
358
- }
359
-
360
- type StringKeysOnly = ConditionalKeys<Example, string>;
361
- //=> 'a'
362
- ```
363
-
364
- To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
365
-
366
- @example
367
- ```
368
- import type {ConditionalKeys} from 'type-fest';
369
-
370
- type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
371
- //=> 'a' | 'c'
372
- ```
373
-
374
- @category Object
375
- */
376
- type ConditionalKeys<Base, Condition> =
377
- {
378
- // Map through all the keys of the given base type.
379
- [Key in keyof Base]-?:
380
- // Pick only keys with types extending the given `Condition` type.
381
- Base[Key] extends Condition
382
- // Retain this key
383
- // If the value for the key extends never, only include it if `Condition` also extends never
384
- ? IfNever<Base[Key], IfNever<Condition, Key, never>, Key>
385
- // Discard this key since the condition fails.
386
- : never;
387
- // Convert the produced object into a union type of the keys which passed the conditional test.
388
- }[keyof Base];
389
-
390
- /**
391
- Exclude keys from a shape that matches the given `Condition`.
392
-
393
- This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
394
-
395
- @example
396
- ```
397
- import type {Primitive, ConditionalExcept} from 'type-fest';
398
-
399
- class Awesome {
400
- name: string;
401
- successes: number;
402
- failures: bigint;
403
-
404
- run() {}
405
- }
406
-
407
- type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
408
- //=> {run: () => void}
409
- ```
410
-
411
- @example
412
- ```
413
- import type {ConditionalExcept} from 'type-fest';
414
-
415
- interface Example {
416
- a: string;
417
- b: string | number;
418
- c: () => void;
419
- d: {};
420
- }
421
-
422
- type NonStringKeysOnly = ConditionalExcept<Example, string>;
423
- //=> {b: string | number; c: () => void; d: {}}
424
- ```
425
-
426
- @category Object
427
- */
428
- type ConditionalExcept<Base, Condition> = Except<
429
- Base,
430
- ConditionalKeys<Base, Condition>
431
- >;
432
-
433
- /**
434
- * Descriptors are objects that describe the API of a module, and the module
435
- * can either be a REST module or a host module.
436
- * This type is recursive, so it can describe nested modules.
437
- */
438
- type Descriptors = RESTFunctionDescriptor | AmbassadorFunctionDescriptor | HostModule<any, any> | EventDefinition<any> | ServicePluginDefinition<any> | {
439
- [key: string]: Descriptors | PublicMetadata | any;
440
- };
441
- /**
442
- * This type takes in a descriptors object of a certain Host (including an `unknown` host)
443
- * and returns an object with the same structure, but with all descriptors replaced with their API.
444
- * Any non-descriptor properties are removed from the returned object, including descriptors that
445
- * do not match the given host (as they will not work with the given host).
446
- */
447
- type BuildDescriptors<T extends Descriptors, H extends Host<any> | undefined, Depth extends number = 5> = {
448
- done: T;
449
- recurse: T extends {
450
- __type: typeof SERVICE_PLUGIN_ERROR_TYPE;
451
- } ? never : T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition<any> ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
452
- [Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [
453
- -1,
454
- 0,
455
- 1,
456
- 2,
457
- 3,
458
- 4,
459
- 5
460
- ][Depth]> : never;
461
- }, EmptyObject>;
462
- }[Depth extends -1 ? 'done' : 'recurse'];
463
- type PublicMetadata = {
464
- PACKAGE_NAME?: string;
465
- };
466
-
467
- declare global {
468
- interface ContextualClient {
469
- }
470
- }
471
- /**
472
- * A type used to create concerete types from SDK descriptors in
473
- * case a contextual client is available.
474
- */
475
- type MaybeContext<T extends Descriptors> = globalThis.ContextualClient extends {
476
- host: Host;
477
- } ? BuildDescriptors<T, globalThis.ContextualClient['host']> : T;
478
-
479
- interface Public_notification {
480
- /** Notification ID. */
481
- _id?: string | null;
482
- }
483
- interface PublicNotifyRequest extends PublicNotifyRequestRecipientsFilterOneOf, PublicNotifyRequestActionTargetOneOf {
484
- /** Send to [site contributors]((https://support.wix.com/en/article/roles-permissions-overview)). This includes site administrators, website managers, and back office managers. */
485
- toSiteContributors?: ToSiteContributors;
486
- /** Send to [site contacts](https://support.wix.com/en/article/about-your-contact-list). */
487
- toContacts?: ToContacts;
488
- /** URL to navigate to when the `action` text is clicked. */
489
- targetUrl?: string | null;
490
- /** Dashboard page to open when the notification action is clicked. */
491
- targetDashboardPage?: DashboardPages;
492
- /** Title of the notification. Max: 512 characters. */
493
- title?: string | null;
494
- /**
495
- * Body of the notification. This contains the main content of the notification.
496
- * Max: 512 characters
497
- */
498
- body?: string | null;
499
- /** Title of the notification action. Clicking the action refers the user to a target URL or a dashboard page. */
500
- action?: string | null;
501
- /**
502
- * Channel through which users receive the notification.
503
- * - `"Mobile"`: Sends the notification to the Wix App.
504
- * - `"Dashboard"`: Sends the notification to the collaborator's Wix Dashboard.
505
- * - `"Browser"`: Sends the notification to the collaborator's browser.
506
- */
507
- channels?: Channel[];
508
- }
509
- /** @oneof */
510
- interface PublicNotifyRequestRecipientsFilterOneOf {
511
- /** Send to [site contributors]((https://support.wix.com/en/article/roles-permissions-overview)). This includes site administrators, website managers, and back office managers. */
512
- toSiteContributors?: ToSiteContributors;
513
- /** Send to [site contacts](https://support.wix.com/en/article/about-your-contact-list). */
514
- toContacts?: ToContacts;
515
- }
516
- /** @oneof */
517
- interface PublicNotifyRequestActionTargetOneOf {
518
- /** URL to navigate to when the `action` text is clicked. */
519
- targetUrl?: string | null;
520
- /** Dashboard page to open when the notification action is clicked. */
521
- targetDashboardPage?: DashboardPages;
522
- }
523
- interface ToSiteContributors {
524
- /**
525
- * Role assigned to site contributors. Only contributors with the specified roles receive the notification:
526
- * - `"All_Contributors"`: All site collaborators (default).
527
- * - `"Owner"`: Site owner only.
528
- */
529
- withRole?: Role;
530
- }
531
- declare enum Role {
532
- /** All site contributors. */
533
- All_Contributors = "All_Contributors",
534
- /** Site owner only. */
535
- Owner = "Owner"
536
- }
537
- interface ToContacts {
538
- /** Contacts that receive the notification. */
539
- contactIds?: string[];
540
- }
541
- interface ToTopicsSubscribers {
542
- /** Notification topics to which the recipients have subscribed. Only contacts who subscribed to the specified topics receive the notification. */
543
- topics?: string[];
544
- /** Excluded contact IDs. Contacts with these IDs don't receive the notification. */
545
- excludedContactIds?: string[];
546
- }
547
- declare enum Channel {
548
- /** No default channel. */
549
- Undefined = "Undefined",
550
- /** Site dashboard. */
551
- Dashboard = "Dashboard",
552
- /** [Wix Owner](https://www.wix.com/mobile/wix-app) mobile app. */
553
- Mobile = "Mobile",
554
- /** Active browser. Supported on Chrome and Safari only. */
555
- Browser = "Browser"
556
- }
557
- declare enum DashboardPages {
558
- Undefined_Page = "Undefined_Page",
559
- /** Site dashboard home. */
560
- Home = "Home"
561
- }
562
- interface Empty {
563
- }
564
- interface NotifyOptions$1 extends PublicNotifyRequestRecipientsFilterOneOf, PublicNotifyRequestActionTargetOneOf {
565
- /** Send to [site contributors]((https://support.wix.com/en/article/roles-permissions-overview)). This includes site administrators, website managers, and back office managers. */
566
- toSiteContributors?: ToSiteContributors;
567
- /** Send to [site contacts](https://support.wix.com/en/article/about-your-contact-list). */
568
- toContacts?: ToContacts;
569
- /** Title of the notification. Max: 512 characters. */
570
- title?: string | null;
571
- /**
572
- * Title of the notification action. Clicking the action refers the user to a target URL or a dashboard page.
573
- *
574
- * Max: 512 characters.
575
- */
576
- action?: string | null;
577
- /** External URL to open when the notification action is clicked. */
578
- targetUrl?: string | null;
579
- /** Dashboard page to open when the notification action is clicked. */
580
- targetDashboardPage?: DashboardPages;
581
- }
582
-
583
- declare function notify$3(httpClient: HttpClient): NotifySignature$1;
584
- interface NotifySignature$1 {
585
- /**
586
- * Sends a notification.
587
- *
588
- *
589
- * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.
590
- *
591
- * List the the channels for the notification in the `channels` parameter .
592
- *
593
- * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.
594
- * @param - Notification options.
595
- * @param - Body of the notification. This contains the main content of the notification.
596
- * @param - Channel through which users receive the notification.
597
- * - `"Mobile"`: Sends the notification to the Wix App.
598
- * - `"Dashboard"`: Sends the notification to the collaborator's Wix Dashboard.
599
- * - `"Browser"`: Sends the notification to the collaborator's browser.
600
- * @returns Fulfilled when the send notification request is received.
601
- */
602
- (body: string | null, channels: Channel[], options?: NotifyOptions$1 | undefined): Promise<void>;
603
- }
604
-
605
- declare const notify$2: MaybeContext<BuildRESTFunction<typeof notify$3> & typeof notify$3>;
606
-
607
- type index_d$1_Channel = Channel;
608
- declare const index_d$1_Channel: typeof Channel;
609
- type index_d$1_DashboardPages = DashboardPages;
610
- declare const index_d$1_DashboardPages: typeof DashboardPages;
611
- type index_d$1_Empty = Empty;
612
- type index_d$1_PublicNotifyRequest = PublicNotifyRequest;
613
- type index_d$1_PublicNotifyRequestActionTargetOneOf = PublicNotifyRequestActionTargetOneOf;
614
- type index_d$1_PublicNotifyRequestRecipientsFilterOneOf = PublicNotifyRequestRecipientsFilterOneOf;
615
- type index_d$1_Public_notification = Public_notification;
616
- type index_d$1_Role = Role;
617
- declare const index_d$1_Role: typeof Role;
618
- type index_d$1_ToContacts = ToContacts;
619
- type index_d$1_ToSiteContributors = ToSiteContributors;
620
- type index_d$1_ToTopicsSubscribers = ToTopicsSubscribers;
621
- declare namespace index_d$1 {
622
- export { index_d$1_Channel as Channel, index_d$1_DashboardPages as DashboardPages, type index_d$1_Empty as Empty, type NotifyOptions$1 as NotifyOptions, type index_d$1_PublicNotifyRequest as PublicNotifyRequest, type index_d$1_PublicNotifyRequestActionTargetOneOf as PublicNotifyRequestActionTargetOneOf, type index_d$1_PublicNotifyRequestRecipientsFilterOneOf as PublicNotifyRequestRecipientsFilterOneOf, type index_d$1_Public_notification as Public_notification, index_d$1_Role as Role, type index_d$1_ToContacts as ToContacts, type index_d$1_ToSiteContributors as ToSiteContributors, type index_d$1_ToTopicsSubscribers as ToTopicsSubscribers, notify$2 as notify };
623
- }
624
-
625
- interface Notification {
626
- /** The id of the notification */
627
- _id?: string;
628
- }
629
- interface NotifyRequest {
630
- /**
631
- * Notification template ID. A notification template specifies the text and recipients for notifications.
632
- * To obtain a notification template ID, create a notification template in your app's dashboard.
633
- */
634
- notificationTemplateId: string;
635
- /**
636
- * Each key is a placeholder name you specify when creating a notification template.
637
- * The value is an object containing the text to replace the placeholder in the notifications.
638
- */
639
- dynamicValues?: Record<string, DynamicValue>;
640
- }
641
- interface DynamicValue extends DynamicValueOfTypeOneOf {
642
- /** Text to be integrated into the notification. */
643
- text?: string;
644
- }
645
- /** @oneof */
646
- interface DynamicValueOfTypeOneOf {
647
- /** Text to be integrated into the notification. */
648
- text?: string;
649
- }
650
- /**
651
- * Money.
652
- * Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003.
653
- */
654
- interface Money {
655
- /** Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. */
656
- value?: string;
657
- /** Currency code. Must be valid ISO 4217 currency code (e.g., USD). */
658
- currency?: string;
659
- /** Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. */
660
- formattedValue?: string | null;
661
- }
662
- interface MapDynamicValue {
663
- /** items */
664
- items?: Record<string, DynamicValue>;
665
- }
666
- interface ArrayDynamicValue {
667
- /** items */
668
- items?: DynamicValue[];
669
- }
670
- interface AttachmentDynamicValue {
671
- /** file name */
672
- fileName?: string;
673
- /** download url */
674
- downloadUrl?: string;
675
- }
676
- interface NotifyResponse {
677
- /** ID of the batch of notifications triggered by one request. */
678
- notificationBatchId?: string;
679
- }
680
- interface NotifyByAppRequest {
681
- /** notification_template_id */
682
- notificationTemplateId?: string;
683
- /** app_def_id */
684
- appDefId?: string;
685
- /** dynamic_values */
686
- dynamicValues?: Record<string, DynamicValue>;
687
- /** template tenant */
688
- templateTenant?: string | null;
689
- /** overrides */
690
- overrides?: Overrides;
691
- /** channels content */
692
- channelsData?: ChannelsData;
693
- }
694
- interface Overrides {
695
- /** excluded_channels */
696
- excludedChannels?: TemplateChannel[];
697
- /** excluded_audiences */
698
- excludedAudiences?: ExcludedAudiences;
699
- /** content overrides */
700
- content?: ChannelsContent;
701
- }
702
- declare enum TemplateChannel {
703
- WEB_FEED = "WEB_FEED",
704
- MOBILE_FEED = "MOBILE_FEED",
705
- MOBILE_PUSH = "MOBILE_PUSH",
706
- BROWSER = "BROWSER",
707
- SMS = "SMS",
708
- EMAIL = "EMAIL",
709
- KAFKA = "KAFKA",
710
- VOICE = "VOICE"
711
- }
712
- interface ExcludedAudiences {
713
- /** audience_key */
714
- audienceKey?: string[];
715
- }
716
- interface ChannelsContent {
717
- /** mobile push override */
718
- mobileContent?: MobileContent;
719
- }
720
- interface MobileContent {
721
- /** title override of mobile push content */
722
- title?: string;
723
- /** body override of mobile push content */
724
- body?: string;
725
- }
726
- interface ChannelsData {
727
- /** email data */
728
- emailData?: EmailData;
729
- }
730
- interface EmailData {
731
- /** shoutout action config */
732
- shoutoutActionConfig?: Record<string, any> | null;
733
- }
734
- interface NotifyByAppResponse {
735
- /** notification_batch_id */
736
- notificationBatchId?: string;
737
- }
738
- interface ResolveRequest {
739
- /** template id */
740
- notificationTemplateId?: string;
741
- /** values */
742
- dynamicValues?: Record<string, DynamicValue>;
743
- }
744
- interface ResolveResponse {
745
- }
746
- interface NotifyResponseNonNullableFields {
747
- notificationBatchId: string;
748
- }
749
- interface NotifyOptions {
750
- /**
751
- * Each key is a placeholder name you specify when creating a notification template.
752
- * The value is an object containing the text to replace the placeholder in the notifications.
753
- */
754
- dynamicValues?: Record<string, DynamicValue>;
755
- }
756
-
757
- declare function notify$1(httpClient: HttpClient): NotifySignature;
758
- interface NotifySignature {
759
- /**
760
- * Sends notifications based on the template and dynamic values provided.
761
- *
762
- * > **Note**: An app can call this endpoint up to 100,000 times per month for each site.
763
- *
764
- * When you [create a notification template](https://dev.wix.com/docs/rest/business-management/notifications/notifications/creating-a-notification-template), you are provided a notification template ID. Call the Notify endpoint with this ID as `notificationTemplateID` to trigger notifications based on that template.
765
- *
766
- * If the notification template contains placeholders for dynamic values, provide those values as key-value pairs in the `dynamicValues` array. The values you specify are incorporated in the notifications sent out.
767
- * @param - Notification template ID. A notification template specifies the text and recipients for notifications.
768
- * To obtain a notification template ID, create a notification template in your app's dashboard.
769
- */
770
- (notificationTemplateId: string, options?: NotifyOptions | undefined): Promise<NotifyResponse & NotifyResponseNonNullableFields>;
771
- }
772
-
773
- declare const notify: MaybeContext<BuildRESTFunction<typeof notify$1> & typeof notify$1>;
774
-
775
- type index_d_ArrayDynamicValue = ArrayDynamicValue;
776
- type index_d_AttachmentDynamicValue = AttachmentDynamicValue;
777
- type index_d_ChannelsContent = ChannelsContent;
778
- type index_d_ChannelsData = ChannelsData;
779
- type index_d_DynamicValue = DynamicValue;
780
- type index_d_DynamicValueOfTypeOneOf = DynamicValueOfTypeOneOf;
781
- type index_d_EmailData = EmailData;
782
- type index_d_ExcludedAudiences = ExcludedAudiences;
783
- type index_d_MapDynamicValue = MapDynamicValue;
784
- type index_d_MobileContent = MobileContent;
785
- type index_d_Money = Money;
786
- type index_d_Notification = Notification;
787
- type index_d_NotifyByAppRequest = NotifyByAppRequest;
788
- type index_d_NotifyByAppResponse = NotifyByAppResponse;
789
- type index_d_NotifyOptions = NotifyOptions;
790
- type index_d_NotifyRequest = NotifyRequest;
791
- type index_d_NotifyResponse = NotifyResponse;
792
- type index_d_NotifyResponseNonNullableFields = NotifyResponseNonNullableFields;
793
- type index_d_Overrides = Overrides;
794
- type index_d_ResolveRequest = ResolveRequest;
795
- type index_d_ResolveResponse = ResolveResponse;
796
- type index_d_TemplateChannel = TemplateChannel;
797
- declare const index_d_TemplateChannel: typeof TemplateChannel;
798
- declare const index_d_notify: typeof notify;
799
- declare namespace index_d {
800
- export { type index_d_ArrayDynamicValue as ArrayDynamicValue, type index_d_AttachmentDynamicValue as AttachmentDynamicValue, type index_d_ChannelsContent as ChannelsContent, type index_d_ChannelsData as ChannelsData, type index_d_DynamicValue as DynamicValue, type index_d_DynamicValueOfTypeOneOf as DynamicValueOfTypeOneOf, type index_d_EmailData as EmailData, type index_d_ExcludedAudiences as ExcludedAudiences, type index_d_MapDynamicValue as MapDynamicValue, type index_d_MobileContent as MobileContent, type index_d_Money as Money, type index_d_Notification as Notification, type index_d_NotifyByAppRequest as NotifyByAppRequest, type index_d_NotifyByAppResponse as NotifyByAppResponse, type index_d_NotifyOptions as NotifyOptions, type index_d_NotifyRequest as NotifyRequest, type index_d_NotifyResponse as NotifyResponse, type index_d_NotifyResponseNonNullableFields as NotifyResponseNonNullableFields, type index_d_Overrides as Overrides, type index_d_ResolveRequest as ResolveRequest, type index_d_ResolveResponse as ResolveResponse, index_d_TemplateChannel as TemplateChannel, index_d_notify as notify };
801
- }
802
-
803
- export { index_d$1 as notifications, index_d as notificationsV3 };