@wix/notifications 1.0.12 → 1.0.14

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 (59) hide show
  1. package/build/cjs/index.d.ts +1 -1
  2. package/build/cjs/index.js +1 -1
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +1 -0
  5. package/build/cjs/index.typings.js +24 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/src/ping-notifications-v1-public-notification.http.d.ts +13 -0
  8. package/build/cjs/src/{ping-notifications-v3-notification.http.js → ping-notifications-v1-public-notification.http.js} +15 -24
  9. package/build/cjs/src/ping-notifications-v1-public-notification.http.js.map +1 -0
  10. package/build/cjs/src/ping-notifications-v1-public-notification.public.d.ts +8 -0
  11. package/build/cjs/src/ping-notifications-v1-public-notification.public.js +16 -0
  12. package/build/cjs/src/ping-notifications-v1-public-notification.public.js.map +1 -0
  13. package/build/cjs/src/ping-notifications-v1-public-notification.types.d.ts +77 -0
  14. package/build/cjs/src/ping-notifications-v1-public-notification.types.js +28 -0
  15. package/build/cjs/src/ping-notifications-v1-public-notification.types.js.map +1 -0
  16. package/build/cjs/src/ping-notifications-v1-public-notification.universal.d.ts +155 -0
  17. package/build/cjs/src/{ping-notifications-v3-notification.universal.js → ping-notifications-v1-public-notification.universal.js} +64 -41
  18. package/build/cjs/src/ping-notifications-v1-public-notification.universal.js.map +1 -0
  19. package/build/es/index.d.ts +1 -1
  20. package/build/es/index.js +1 -1
  21. package/build/es/index.js.map +1 -1
  22. package/build/es/index.typings.d.ts +1 -0
  23. package/build/es/index.typings.js +2 -0
  24. package/build/es/index.typings.js.map +1 -0
  25. package/build/es/src/ping-notifications-v1-public-notification.http.d.ts +13 -0
  26. package/build/es/src/ping-notifications-v1-public-notification.http.js +74 -0
  27. package/build/es/src/ping-notifications-v1-public-notification.http.js.map +1 -0
  28. package/build/es/src/ping-notifications-v1-public-notification.public.d.ts +8 -0
  29. package/build/es/src/ping-notifications-v1-public-notification.public.js +9 -0
  30. package/build/es/src/ping-notifications-v1-public-notification.public.js.map +1 -0
  31. package/build/es/src/ping-notifications-v1-public-notification.types.d.ts +77 -0
  32. package/build/es/src/ping-notifications-v1-public-notification.types.js +25 -0
  33. package/build/es/src/ping-notifications-v1-public-notification.types.js.map +1 -0
  34. package/build/es/src/ping-notifications-v1-public-notification.universal.d.ts +155 -0
  35. package/build/es/src/ping-notifications-v1-public-notification.universal.js +132 -0
  36. package/build/es/src/ping-notifications-v1-public-notification.universal.js.map +1 -0
  37. package/package.json +4 -4
  38. package/build/cjs/src/ping-notifications-v3-notification.http.d.ts +0 -15
  39. package/build/cjs/src/ping-notifications-v3-notification.http.js.map +0 -1
  40. package/build/cjs/src/ping-notifications-v3-notification.public.d.ts +0 -8
  41. package/build/cjs/src/ping-notifications-v3-notification.public.js +0 -14
  42. package/build/cjs/src/ping-notifications-v3-notification.public.js.map +0 -1
  43. package/build/cjs/src/ping-notifications-v3-notification.types.d.ts +0 -113
  44. package/build/cjs/src/ping-notifications-v3-notification.types.js +0 -15
  45. package/build/cjs/src/ping-notifications-v3-notification.types.js.map +0 -1
  46. package/build/cjs/src/ping-notifications-v3-notification.universal.d.ts +0 -146
  47. package/build/cjs/src/ping-notifications-v3-notification.universal.js.map +0 -1
  48. package/build/es/src/ping-notifications-v3-notification.http.d.ts +0 -15
  49. package/build/es/src/ping-notifications-v3-notification.http.js +0 -83
  50. package/build/es/src/ping-notifications-v3-notification.http.js.map +0 -1
  51. package/build/es/src/ping-notifications-v3-notification.public.d.ts +0 -8
  52. package/build/es/src/ping-notifications-v3-notification.public.js +0 -9
  53. package/build/es/src/ping-notifications-v3-notification.public.js.map +0 -1
  54. package/build/es/src/ping-notifications-v3-notification.types.d.ts +0 -113
  55. package/build/es/src/ping-notifications-v3-notification.types.js +0 -12
  56. package/build/es/src/ping-notifications-v3-notification.types.js.map +0 -1
  57. package/build/es/src/ping-notifications-v3-notification.universal.d.ts +0 -146
  58. package/build/es/src/ping-notifications-v3-notification.universal.js +0 -109
  59. package/build/es/src/ping-notifications-v3-notification.universal.js.map +0 -1
@@ -1 +1 @@
1
- export * as notifications from './src/ping-notifications-v3-notification.public';
1
+ export * as notifications from './src/ping-notifications-v1-public-notification.public';
@@ -20,5 +20,5 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.notifications = void 0;
23
- exports.notifications = __importStar(require("./src/ping-notifications-v3-notification.public"));
23
+ exports.notifications = __importStar(require("./src/ping-notifications-v1-public-notification.public"));
24
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iGAAiF"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,wGAAwF"}
@@ -0,0 +1 @@
1
+ export * as notifications from './src/ping-notifications-v1-public-notification.universal';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.notifications = void 0;
23
+ exports.notifications = __importStar(require("./src/ping-notifications-v1-public-notification.universal"));
24
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../index.typings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,2GAA2F"}
@@ -0,0 +1,13 @@
1
+ import { RequestOptionsFactory } from '@wix/sdk-types';
2
+ import { PublicNotifyRequest, Empty } from './ping-notifications-v1-public-notification.types';
3
+ /**
4
+ * Sends a notification.
5
+ *
6
+ *
7
+ * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.
8
+ *
9
+ * List the the channels for the notification in the `channels` parameter .
10
+ *
11
+ * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.
12
+ */
13
+ export declare function notify(payload: PublicNotifyRequest): RequestOptionsFactory<Empty>;
@@ -3,12 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.notify = void 0;
4
4
  const ambassador_1 = require("@wix/metro-runtime/ambassador");
5
5
  const metro_runtime_1 = require("@wix/metro-runtime");
6
- const _arrayDynamicValue = { items: '_dynamicValue' };
7
- const _dynamicValue = { map: '_mapDynamicValue', array: '_arrayDynamicValue' };
8
- const _mapDynamicValue = { items: 'Map#_dynamicValue' };
9
- const _notifyRequest = { dynamicValues: 'Map#_dynamicValue' };
10
- const _notifyResponse = {};
11
- function resolveComWixpressPingHubApiV3NotificationsServiceV3Url(opts) {
6
+ const _empty = {};
7
+ const _publicNotifyRequest = {};
8
+ function resolveComWixpressPingHubApiPublicNotificationsServiceUrl(opts) {
12
9
  const domainToMappings = {
13
10
  'api._api_base_domain_': [
14
11
  {
@@ -46,32 +43,26 @@ function resolveComWixpressPingHubApiV3NotificationsServiceV3Url(opts) {
46
43
  return (0, metro_runtime_1.resolveUrl)(Object.assign(opts, { domainToMappings }));
47
44
  }
48
45
  /**
49
- * Sends notifications based on the template and dynamic values provided.
46
+ * Sends a notification.
50
47
  *
51
- * > This feature is not yet available to all users.
52
48
  *
53
- * An app can call this endpoint up to 100,000 times per month for each site.
49
+ * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.
54
50
  *
55
- * When you [create a notification template](https://dev.wix.com/api/rest/wix-notifications/notifications/creating-a-notification-template) in the Wix Dev Center, you are given a notification template ID.
56
- * Call the Notify endpoint with this ID as `notificationTemplateID` to trigger notifications based on the notification template.
57
- * If the notification template contains placeholders for dynamic values, provide those values as key-value pairs in the `dynamicValues` array.
58
- * The values you specify are incorporated seamlessly in the notifications sent out.
51
+ * List the the channels for the notification in the `channels` parameter .
52
+ *
53
+ * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.
59
54
  */
60
55
  function notify(payload) {
61
- const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_notifyRequest, {
62
- _arrayDynamicValue,
63
- _dynamicValue,
64
- _mapDynamicValue,
65
- });
66
- const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_notifyResponse, {});
56
+ const { toJSON: toReq, fromJSON: fromReq } = (0, ambassador_1.serializer)(_publicNotifyRequest, {});
57
+ const { fromJSON: fromRes } = (0, ambassador_1.serializer)(_empty, {});
67
58
  function __notify({ host }) {
68
59
  const serializedData = toReq(payload);
69
60
  const metadata = {
70
- entityFqdn: 'wix.ping.notifications.v3.notification',
61
+ entityFqdn: 'wix.ping.notifications.v1.public_notification',
71
62
  method: 'POST',
72
- methodFqn: 'com.wixpress.ping.hub.api.v3.NotificationsServiceV3.Notify',
73
- url: resolveComWixpressPingHubApiV3NotificationsServiceV3Url({
74
- protoPath: '/v3/notify',
63
+ methodFqn: 'com.wixpress.ping.hub.api.PublicNotificationsService.Notify',
64
+ url: resolveComWixpressPingHubApiPublicNotificationsServiceUrl({
65
+ protoPath: '/api/v1/notify',
75
66
  data: serializedData,
76
67
  host,
77
68
  }),
@@ -84,4 +75,4 @@ function notify(payload) {
84
75
  return __notify;
85
76
  }
86
77
  exports.notify = notify;
87
- //# sourceMappingURL=ping-notifications-v3-notification.http.js.map
78
+ //# sourceMappingURL=ping-notifications-v1-public-notification.http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping-notifications-v1-public-notification.http.js","sourceRoot":"","sources":["../../../src/ping-notifications-v1-public-notification.http.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAC3D,sDAAgD;AAQhD,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAS,yDAAyD,CAChE,IAA8C;IAE9C,MAAM,gBAAgB,GAAG;QACvB,uBAAuB,EAAE;YACvB;gBACE,OAAO,EAAE,2BAA2B;gBACpC,QAAQ,EAAE,EAAE;aACb;SACF;QACD,mBAAmB,EAAE;YACnB;gBACE,OAAO,EAAE,gBAAgB;gBACzB,QAAQ,EAAE,EAAE;aACb;YACD;gBACE,OAAO,EAAE,0BAA0B;gBACnC,QAAQ,EAAE,EAAE;aACb;SACF;QACD,sBAAsB,EAAE;YACtB;gBACE,OAAO,EAAE,gBAAgB;gBACzB,QAAQ,EAAE,EAAE;aACb;YACD;gBACE,OAAO,EAAE,0BAA0B;gBACnC,QAAQ,EAAE,EAAE;aACb;SACF;QACD,iBAAiB,EAAE;YACjB;gBACE,OAAO,EAAE,0BAA0B;gBACnC,QAAQ,EAAE,YAAY;aACvB;SACF;KACF,CAAC;IAEF,OAAO,IAAA,0BAAU,EAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,MAAM,CACpB,OAA4B;IAE5B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,uBAAU,EACrD,oBAAoB,EACpB,EAAE,CACH,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,uBAAU,EAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAErD,SAAS,QAAQ,CAAC,EAAE,IAAI,EAAO;QAC7B,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG;YACf,UAAU,EAAE,+CAA+C;YAC3D,MAAM,EAAE,MAAa;YACrB,SAAS,EAAE,6DAA6D;YACxE,GAAG,EAAE,yDAAyD,CAAC;gBAC7D,SAAS,EAAE,gBAAgB;gBAC3B,IAAI,EAAE,cAAc;gBACpB,IAAI;aACL,CAAC;YACF,IAAI,EAAE,cAAc;YACpB,iBAAiB,EAAE,OAAO;SAC3B,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;IAE3B,OAAO,QAAQ,CAAC;AAClB,CAAC;AA9BD,wBA8BC"}
@@ -0,0 +1,8 @@
1
+ import { HttpClient } from '@wix/sdk-types';
2
+ import { Channel, NotifyOptions } from './ping-notifications-v1-public-notification.universal';
3
+ export declare const __metadata: {
4
+ PACKAGE_NAME: string;
5
+ };
6
+ export declare function notify(httpClient: HttpClient): (body: string | null, channels: Channel[], options?: NotifyOptions | undefined) => Promise<void>;
7
+ export { Role, Channel, DashboardPages, } from './ping-notifications-v1-public-notification.universal';
8
+ export { Public_notification, PublicNotifyRequest, PublicNotifyRequestRecipientsFilterOneOf, PublicNotifyRequestActionTargetOneOf, ToSiteContributors, ToContacts, ToTopicsSubscribers, Empty, NotifyOptions, } from './ping-notifications-v1-public-notification.universal';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DashboardPages = exports.Channel = exports.Role = exports.notify = exports.__metadata = void 0;
4
+ const ping_notifications_v1_public_notification_universal_1 = require("./ping-notifications-v1-public-notification.universal");
5
+ exports.__metadata = { PACKAGE_NAME: '@wix/notifications' };
6
+ function notify(httpClient) {
7
+ return (body, channels, options) => (0, ping_notifications_v1_public_notification_universal_1.notify)(body, channels, options,
8
+ // @ts-ignore
9
+ { httpClient });
10
+ }
11
+ exports.notify = notify;
12
+ var ping_notifications_v1_public_notification_universal_2 = require("./ping-notifications-v1-public-notification.universal");
13
+ Object.defineProperty(exports, "Role", { enumerable: true, get: function () { return ping_notifications_v1_public_notification_universal_2.Role; } });
14
+ Object.defineProperty(exports, "Channel", { enumerable: true, get: function () { return ping_notifications_v1_public_notification_universal_2.Channel; } });
15
+ Object.defineProperty(exports, "DashboardPages", { enumerable: true, get: function () { return ping_notifications_v1_public_notification_universal_2.DashboardPages; } });
16
+ //# sourceMappingURL=ping-notifications-v1-public-notification.public.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping-notifications-v1-public-notification.public.js","sourceRoot":"","sources":["../../../src/ping-notifications-v1-public-notification.public.ts"],"names":[],"mappings":";;;AACA,+HAI+D;AAElD,QAAA,UAAU,GAAG,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAEjE,SAAgB,MAAM,CAAC,UAAsB;IAC3C,OAAO,CAAC,IAAmB,EAAE,QAAmB,EAAE,OAAuB,EAAE,EAAE,CAC3E,IAAA,4DAAe,EACb,IAAI,EACJ,QAAQ,EACR,OAAO;IACP,aAAa;IACb,EAAE,UAAU,EAAE,CACf,CAAC;AACN,CAAC;AATD,wBASC;AAED,6HAI+D;AAH7D,2IAAA,IAAI,OAAA;AACJ,8IAAA,OAAO,OAAA;AACP,qJAAA,cAAc,OAAA"}
@@ -0,0 +1,77 @@
1
+ export interface Public_notification {
2
+ /** id */
3
+ id?: string | null;
4
+ }
5
+ export interface PublicNotifyRequest extends PublicNotifyRequestRecipientsFilterOneOf, PublicNotifyRequestActionTargetOneOf {
6
+ /** Send to site contributors */
7
+ toSiteContributors?: ToSiteContributors;
8
+ /** Send to contacts */
9
+ toContacts?: ToContacts;
10
+ /** Send to topic subscribers */
11
+ toTopicsSubscribers?: ToTopicsSubscribers;
12
+ /** an open url as an action target */
13
+ targetUrl?: string | null;
14
+ /** target_dashboard_page */
15
+ targetDashboardPage?: DashboardPages;
16
+ /** The title of the notification */
17
+ title?: string | null;
18
+ /** The body of the notification */
19
+ body?: string | null;
20
+ /** The Action of the notification */
21
+ action?: string | null;
22
+ /** The channel to which send the notification */
23
+ channels?: Channel[];
24
+ }
25
+ /** @oneof */
26
+ export interface PublicNotifyRequestRecipientsFilterOneOf {
27
+ /** Send to site contributors */
28
+ toSiteContributors?: ToSiteContributors;
29
+ /** Send to contacts */
30
+ toContacts?: ToContacts;
31
+ /** Send to topic subscribers */
32
+ toTopicsSubscribers?: ToTopicsSubscribers;
33
+ }
34
+ /** @oneof */
35
+ export interface PublicNotifyRequestActionTargetOneOf {
36
+ /** an open url as an action target */
37
+ targetUrl?: string | null;
38
+ /** target_dashboard_page */
39
+ targetDashboardPage?: DashboardPages;
40
+ }
41
+ export interface ToSiteContributors {
42
+ /** with_role */
43
+ withRole?: Role;
44
+ }
45
+ export declare enum Role {
46
+ /** All contributors with any role */
47
+ All_Contributors = "All_Contributors",
48
+ /** Only the owner */
49
+ Owner = "Owner"
50
+ }
51
+ export interface ToContacts {
52
+ /** contact_ids */
53
+ contactIds?: string[];
54
+ }
55
+ export interface ToTopicsSubscribers {
56
+ /** topics */
57
+ topics?: string[];
58
+ /** excluded_contact_ids */
59
+ excludedContactIds?: string[];
60
+ }
61
+ export declare enum Channel {
62
+ /** No Default Channel - need to expilicitly decide on channel */
63
+ Undefined = "Undefined",
64
+ /** The widget inside Wix */
65
+ Dashboard = "Dashboard",
66
+ /** Mobile push to WixApp */
67
+ Mobile = "Mobile",
68
+ /** Browser push to the active browser (Chrome/Safari only) */
69
+ Browser = "Browser"
70
+ }
71
+ export declare enum DashboardPages {
72
+ Undefined_Page = "Undefined_Page",
73
+ /** goes to business manager home */
74
+ Home = "Home"
75
+ }
76
+ export interface Empty {
77
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DashboardPages = exports.Channel = exports.Role = void 0;
4
+ var Role;
5
+ (function (Role) {
6
+ /** All contributors with any role */
7
+ Role["All_Contributors"] = "All_Contributors";
8
+ /** Only the owner */
9
+ Role["Owner"] = "Owner";
10
+ })(Role = exports.Role || (exports.Role = {}));
11
+ var Channel;
12
+ (function (Channel) {
13
+ /** No Default Channel - need to expilicitly decide on channel */
14
+ Channel["Undefined"] = "Undefined";
15
+ /** The widget inside Wix */
16
+ Channel["Dashboard"] = "Dashboard";
17
+ /** Mobile push to WixApp */
18
+ Channel["Mobile"] = "Mobile";
19
+ /** Browser push to the active browser (Chrome/Safari only) */
20
+ Channel["Browser"] = "Browser";
21
+ })(Channel = exports.Channel || (exports.Channel = {}));
22
+ var DashboardPages;
23
+ (function (DashboardPages) {
24
+ DashboardPages["Undefined_Page"] = "Undefined_Page";
25
+ /** goes to business manager home */
26
+ DashboardPages["Home"] = "Home";
27
+ })(DashboardPages = exports.DashboardPages || (exports.DashboardPages = {}));
28
+ //# sourceMappingURL=ping-notifications-v1-public-notification.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping-notifications-v1-public-notification.types.js","sourceRoot":"","sources":["../../../src/ping-notifications-v1-public-notification.types.ts"],"names":[],"mappings":";;;AAmDA,IAAY,IAKX;AALD,WAAY,IAAI;IACd,qCAAqC;IACrC,6CAAqC,CAAA;IACrC,qBAAqB;IACrB,uBAAe,CAAA;AACjB,CAAC,EALW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAKf;AAcD,IAAY,OASX;AATD,WAAY,OAAO;IACjB,iEAAiE;IACjE,kCAAuB,CAAA;IACvB,4BAA4B;IAC5B,kCAAuB,CAAA;IACvB,4BAA4B;IAC5B,4BAAiB,CAAA;IACjB,8DAA8D;IAC9D,8BAAmB,CAAA;AACrB,CAAC,EATW,OAAO,GAAP,eAAO,KAAP,eAAO,QASlB;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mDAAiC,CAAA;IACjC,oCAAoC;IACpC,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"}
@@ -0,0 +1,155 @@
1
+ export declare const __debug: {
2
+ verboseLogging: {
3
+ on: () => boolean;
4
+ off: () => boolean;
5
+ };
6
+ };
7
+ export interface Public_notification {
8
+ /** id */
9
+ _id?: string | null;
10
+ }
11
+ export interface PublicNotifyRequest extends PublicNotifyRequestRecipientsFilterOneOf, PublicNotifyRequestActionTargetOneOf {
12
+ /** List of site contributors to notify. */
13
+ toSiteContributors?: ToSiteContributors;
14
+ /** List of contacts to notify. */
15
+ toContacts?: ToContacts;
16
+ /** Notify contacts who are subscribed to specific topics. */
17
+ toTopicsSubscribers?: ToTopicsSubscribers;
18
+ /** URL to navigate to when the `action` text is clicked. */
19
+ targetUrl?: string | null;
20
+ /** URL of Dashboard page to navigate to when the `action` text is clicked. */
21
+ targetDashboardPage?: DashboardPages;
22
+ /**
23
+ * Notification title. Only displayed on mobile and browser notifications.
24
+ *
25
+ * Max: 512 characters
26
+ */
27
+ title?: string | null;
28
+ /**
29
+ * Contents of the notification.
30
+ *
31
+ * Max: 512 characters
32
+ */
33
+ body?: string | null;
34
+ /**
35
+ * Clickable text that links to the `targetUrl` or `targetDashboardPage`. For example, "Click this!".
36
+ *
37
+ * Max: 512 characters
38
+ */
39
+ action?: string | null;
40
+ /**
41
+ * The channels to send the notification on. One or more of:
42
+ *
43
+ * - `"Mobile"`: Sends the notification to the Wix App.
44
+ * - `"Dashboard"`: Sends the notification to the contributor's Wix Dashboard.
45
+ * - `"Browser"`: Sends the notification to the contributor's browser.
46
+ */
47
+ channels?: Channel[];
48
+ }
49
+ /** @oneof */
50
+ export interface PublicNotifyRequestRecipientsFilterOneOf {
51
+ /** List of site contributors to notify. */
52
+ toSiteContributors?: ToSiteContributors;
53
+ /** List of contacts to notify. */
54
+ toContacts?: ToContacts;
55
+ /** Notify contacts who are subscribed to specific topics. */
56
+ toTopicsSubscribers?: ToTopicsSubscribers;
57
+ }
58
+ /** @oneof */
59
+ export interface PublicNotifyRequestActionTargetOneOf {
60
+ /** URL to navigate to when the `action` text is clicked. */
61
+ targetUrl?: string | null;
62
+ /** URL of Dashboard page to navigate to when the `action` text is clicked. */
63
+ targetDashboardPage?: DashboardPages;
64
+ }
65
+ export interface ToSiteContributors {
66
+ /**
67
+ * Roles to receive the notification. One of:
68
+ *
69
+ * - `"All_Contributors"`: All site contributors (default).
70
+ * - `"Owner"`: Only the site owner.
71
+ */
72
+ withRole?: Role;
73
+ }
74
+ export declare enum Role {
75
+ /** All contributors with any role */
76
+ All_Contributors = "All_Contributors",
77
+ /** Only the owner */
78
+ Owner = "Owner"
79
+ }
80
+ export interface ToContacts {
81
+ /** List of contact IDs. */
82
+ contactIds?: string[];
83
+ }
84
+ export interface ToTopicsSubscribers {
85
+ /** List of topics. */
86
+ topics?: string[];
87
+ /** List of contact IDs to exclude from notification. */
88
+ excludedContactIds?: string[];
89
+ }
90
+ export declare enum Channel {
91
+ /** No Default Channel - need to expilicitly decide on channel */
92
+ Undefined = "Undefined",
93
+ /** The widget inside Wix */
94
+ Dashboard = "Dashboard",
95
+ /** Mobile push to WixApp */
96
+ Mobile = "Mobile",
97
+ /** Browser push to the active browser (Chrome/Safari only) */
98
+ Browser = "Browser"
99
+ }
100
+ export declare enum DashboardPages {
101
+ Undefined_Page = "Undefined_Page",
102
+ /** goes to business manager home */
103
+ Home = "Home"
104
+ }
105
+ export interface Empty {
106
+ }
107
+ /**
108
+ * Sends a notification.
109
+ *
110
+ *
111
+ * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.
112
+ *
113
+ * List the the channels for the notification in the `channels` parameter .
114
+ *
115
+ * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.
116
+ * @public
117
+ * @documentationMaturity preview
118
+ * @requiredField body
119
+ * @requiredField channels
120
+ * @param options - Notification options.
121
+ * @param body - The body of the notification.
122
+ *
123
+ * Max: 512 characters
124
+ * @param channels - The channels to send the notification on. One or more of:
125
+ *
126
+ * - `"Mobile"`: Sends the notification to the Wix App.
127
+ * - `"Dashboard"`: Sends the notification to the contributor's Wix Dashboard.
128
+ * - `"Browser"`: Sends the notification to the contributor's browser.
129
+ * @returns Fulfilled when the send notification request is received.
130
+ */
131
+ export declare function notify(body: string | null, channels: Channel[], options?: NotifyOptions): Promise<void>;
132
+ export interface NotifyOptions extends PublicNotifyRequestRecipientsFilterOneOf, PublicNotifyRequestActionTargetOneOf {
133
+ /** List of site contributors to notify. */
134
+ toSiteContributors?: ToSiteContributors;
135
+ /** List of contacts to notify. */
136
+ toContacts?: ToContacts;
137
+ /** Notify contacts who are subscribed to specific topics. */
138
+ toTopicsSubscribers?: ToTopicsSubscribers;
139
+ /**
140
+ * Notification title. Only displayed on mobile and browser notifications.
141
+ *
142
+ * Max: 512 characters
143
+ */
144
+ title?: string | null;
145
+ /**
146
+ * Clickable text that links to the `targetUrl` or `targetDashboardPage`. For example, "Click this!".
147
+ *
148
+ * Max: 512 characters
149
+ */
150
+ action?: string | null;
151
+ /** URL to navigate to when the `action` text is clicked. */
152
+ targetUrl?: string | null;
153
+ /** URL of Dashboard page to navigate to when the `action` text is clicked. */
154
+ targetDashboardPage?: DashboardPages;
155
+ }
@@ -28,9 +28,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
28
28
  });
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.notify = exports.TemplateChannel = exports.__debug = void 0;
31
+ exports.notify = exports.DashboardPages = exports.Channel = exports.Role = exports.__debug = void 0;
32
32
  const velo_1 = require("@wix/metro-runtime/velo");
33
- const ambassadorWixPingNotificationsV3Notification = __importStar(require("./ping-notifications-v3-notification.http"));
33
+ const ambassadorWixPingNotificationsV1PublicNotification = __importStar(require("./ping-notifications-v1-public-notification.http"));
34
34
  let __verbose = false;
35
35
  function __log(...args) {
36
36
  __verbose && console.log(...args);
@@ -46,54 +46,76 @@ exports.__debug = {
46
46
  };
47
47
  const _toVeloEntity = '$';
48
48
  const _fromVeloEntity = '$';
49
- var TemplateChannel;
50
- (function (TemplateChannel) {
51
- TemplateChannel["WEB_FEED"] = "WEB_FEED";
52
- TemplateChannel["MOBILE_FEED"] = "MOBILE_FEED";
53
- TemplateChannel["MOBILE_PUSH"] = "MOBILE_PUSH";
54
- TemplateChannel["BROWSER"] = "BROWSER";
55
- TemplateChannel["SMS"] = "SMS";
56
- TemplateChannel["EMAIL"] = "EMAIL";
57
- TemplateChannel["KAFKA"] = "KAFKA";
58
- TemplateChannel["VOICE"] = "VOICE";
59
- })(TemplateChannel = exports.TemplateChannel || (exports.TemplateChannel = {}));
60
- const _arrayDynamicValue = { items: '_dynamicValue' };
61
- const _dynamicValue = { map: '_mapDynamicValue', array: '_arrayDynamicValue' };
62
- const _mapDynamicValue = { items: 'Map#_dynamicValue' };
63
- const _notifyRequest = { dynamicValues: 'Map#_dynamicValue' };
64
- const _notifyResponse = {};
49
+ var Role;
50
+ (function (Role) {
51
+ /** All contributors with any role */
52
+ Role["All_Contributors"] = "All_Contributors";
53
+ /** Only the owner */
54
+ Role["Owner"] = "Owner";
55
+ })(Role = exports.Role || (exports.Role = {}));
56
+ var Channel;
57
+ (function (Channel) {
58
+ /** No Default Channel - need to expilicitly decide on channel */
59
+ Channel["Undefined"] = "Undefined";
60
+ /** The widget inside Wix */
61
+ Channel["Dashboard"] = "Dashboard";
62
+ /** Mobile push to WixApp */
63
+ Channel["Mobile"] = "Mobile";
64
+ /** Browser push to the active browser (Chrome/Safari only) */
65
+ Channel["Browser"] = "Browser";
66
+ })(Channel = exports.Channel || (exports.Channel = {}));
67
+ var DashboardPages;
68
+ (function (DashboardPages) {
69
+ DashboardPages["Undefined_Page"] = "Undefined_Page";
70
+ /** goes to business manager home */
71
+ DashboardPages["Home"] = "Home";
72
+ })(DashboardPages = exports.DashboardPages || (exports.DashboardPages = {}));
73
+ const _empty = {};
74
+ const _publicNotifyRequest = {};
65
75
  /**
66
- * Sends notifications based on the template and dynamic values provided.
76
+ * Sends a notification.
67
77
  *
68
- * > This feature is not yet available to all users.
69
78
  *
70
- * An app can call this endpoint up to 100,000 times per month for each site.
79
+ * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.
71
80
  *
72
- * When you [create a notification template](https://dev.wix.com/api/rest/wix-notifications/notifications/creating-a-notification-template) in the Wix Dev Center, you are given a notification template ID.
73
- * Call the Notify endpoint with this ID as `notificationTemplateID` to trigger notifications based on the notification template.
74
- * If the notification template contains placeholders for dynamic values, provide those values as key-value pairs in the `dynamicValues` array.
75
- * The values you specify are incorporated seamlessly in the notifications sent out.
76
- * @param notificationTemplateId - Notification template ID. A notification template specifies the text and recipients for notifications.
77
- * To obtain a notification template ID, [create a notification template](https://dev.wix.com/api/rest/wix-notifications/notifications/creating-a-notification-template) in the Wix Dev Center.
81
+ * List the the channels for the notification in the `channels` parameter .
82
+ *
83
+ * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.
78
84
  * @public
79
85
  * @documentationMaturity preview
80
- * @requiredField notificationTemplateId
81
- * @permissionScope Manage Notifications
82
- * @applicableIdentity APP
86
+ * @requiredField body
87
+ * @requiredField channels
88
+ * @param options - Notification options.
89
+ * @param body - The body of the notification.
90
+ *
91
+ * Max: 512 characters
92
+ * @param channels - The channels to send the notification on. One or more of:
93
+ *
94
+ * - `"Mobile"`: Sends the notification to the Wix App.
95
+ * - `"Dashboard"`: Sends the notification to the contributor's Wix Dashboard.
96
+ * - `"Browser"`: Sends the notification to the contributor's browser.
97
+ * @returns Fulfilled when the send notification request is received.
83
98
  */
84
- function notify(notificationTemplateId, options) {
99
+ function notify(body, channels, options) {
85
100
  var _a, _b, _c;
86
101
  return __awaiter(this, arguments, void 0, function* () {
87
102
  const requestTransformation = {
88
- notificationTemplateId: '$[0]',
89
- dynamicValues: '$[1].dynamicValues',
103
+ body: '$[0]',
104
+ channels: '$[1]',
105
+ toSiteContributors: '$[2].toSiteContributors',
106
+ toContacts: '$[2].toContacts',
107
+ toTopicsSubscribers: '$[2].toTopicsSubscribers',
108
+ title: '$[2].title',
109
+ action: '$[2].action',
110
+ targetUrl: '$[2].targetUrl',
111
+ targetDashboardPage: '$[2].targetDashboardPage',
90
112
  };
91
113
  const responseTransformation = '$';
92
114
  // @ts-ignore
93
- const { httpClient, sideEffects } = arguments[2];
115
+ const { httpClient, sideEffects } = arguments[3];
94
116
  const { toAmbassadorRequest } = (0, velo_1.serializer)({
95
- rootSchema: _notifyRequest,
96
- depSchemas: { _arrayDynamicValue, _dynamicValue, _mapDynamicValue },
117
+ rootSchema: _publicNotifyRequest,
118
+ depSchemas: {},
97
119
  fqdnTransformation: {
98
120
  paths: [],
99
121
  transformation: _fromVeloEntity,
@@ -101,7 +123,7 @@ function notify(notificationTemplateId, options) {
101
123
  customTransformation: requestTransformation,
102
124
  });
103
125
  const { fromJSON } = (0, velo_1.serializer)({
104
- rootSchema: _notifyResponse,
126
+ rootSchema: _empty,
105
127
  depSchemas: {},
106
128
  fqdnTransformation: {
107
129
  paths: [],
@@ -109,8 +131,8 @@ function notify(notificationTemplateId, options) {
109
131
  },
110
132
  customTransformation: responseTransformation,
111
133
  });
112
- const payload = toAmbassadorRequest([notificationTemplateId, options]);
113
- const reqOpts = ambassadorWixPingNotificationsV3Notification.notify(payload);
134
+ const payload = toAmbassadorRequest([body, channels, options]);
135
+ const reqOpts = ambassadorWixPingNotificationsV1PublicNotification.notify(payload);
114
136
  __log(`"Notify" sending request with: ${__inspect(reqOpts)}`);
115
137
  (_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
116
138
  try {
@@ -120,7 +142,8 @@ function notify(notificationTemplateId, options) {
120
142
  }
121
143
  catch (err) {
122
144
  const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
123
- 'notificationTemplateId',
145
+ 'body',
146
+ 'channels',
124
147
  'options',
125
148
  ]);
126
149
  (_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
@@ -129,4 +152,4 @@ function notify(notificationTemplateId, options) {
129
152
  });
130
153
  }
131
154
  exports.notify = notify;
132
- //# sourceMappingURL=ping-notifications-v3-notification.universal.js.map
155
+ //# sourceMappingURL=ping-notifications-v1-public-notification.universal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping-notifications-v1-public-notification.universal.js","sourceRoot":"","sources":["../../../src/ping-notifications-v1-public-notification.universal.ts"],"names":[],"mappings":"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"}
@@ -1 +1 @@
1
- export * as notifications from './src/ping-notifications-v3-notification.public';
1
+ export * as notifications from './src/ping-notifications-v1-public-notification.public';
package/build/es/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * as notifications from './src/ping-notifications-v3-notification.public';
1
+ export * as notifications from './src/ping-notifications-v1-public-notification.public';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,iDAAiD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,wDAAwD,CAAC"}
@@ -0,0 +1 @@
1
+ export * as notifications from './src/ping-notifications-v1-public-notification.universal';
@@ -0,0 +1,2 @@
1
+ export * as notifications from './src/ping-notifications-v1-public-notification.universal';
2
+ //# sourceMappingURL=index.typings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.typings.js","sourceRoot":"","sources":["../../index.typings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,2DAA2D,CAAC"}