{"version":3,"sources":["../../src/ping-notifications-v1-public-notification-notifications.universal.ts","../../src/ping-notifications-v1-public-notification-notifications.http.ts","../../src/ping-notifications-v1-public-notification-notifications.public.ts","../../src/ping-notifications-v1-public-notification-notifications.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { renameKeysFromSDKRequestToRESTRequest } from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient } from '@wix/sdk-types';\nimport * as ambassadorWixPingNotificationsV1PublicNotification from './ping-notifications-v1-public-notification-notifications.http.js';\n\nexport interface Public_notification {\n  /** Notification ID. */\n  _id?: string | null;\n}\n\nexport interface PublicNotifyRequest\n  extends PublicNotifyRequestRecipientsFilterOneOf,\n    PublicNotifyRequestActionTargetOneOf {\n  /** Send to [site contributors]((https://support.wix.com/en/article/roles-permissions-overview)). This includes site administrators, website managers, and back office managers. */\n  toSiteContributors?: ToSiteContributors;\n  /** Send to [site contacts](https://support.wix.com/en/article/about-your-contact-list). */\n  toContacts?: ToContacts;\n  /**\n   * Send to site members who subscribed to a [notification topic](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/notifications/add-notification-extensions#step-1--create-a-notification-topic-extension).\n   * @internal\n   */\n  toTopicsSubscribers?: ToTopicsSubscribers;\n  /** URL to navigate to when the `action` text is clicked. */\n  targetUrl?: string | null;\n  /** Dashboard page to open when the notification action is clicked. */\n  targetDashboardPage?: DashboardPagesWithLiterals;\n  /** Title of the notification. Max: 512 characters. */\n  title?: string | null;\n  /**\n   * Body of the notification. This contains the main content of the notification.\n   * Max: 512 characters\n   */\n  body?: string | null;\n  /** Title of the notification action. Clicking the action refers the user to a target URL or a dashboard page. */\n  action?: string | null;\n  /**\n   * Channel through which users receive the notification.\n   * - `\"Mobile\"`: Sends the notification to the Wix App.\n   * - `\"Dashboard\"`: Sends the notification to the collaborator's Wix Dashboard.\n   * - `\"Browser\"`: Sends the notification to the collaborator's browser.\n   * @maxSize 20\n   */\n  channels?: ChannelWithLiterals[];\n}\n\n/** @oneof */\nexport interface PublicNotifyRequestRecipientsFilterOneOf {\n  /** Send to [site contributors]((https://support.wix.com/en/article/roles-permissions-overview)). This includes site administrators, website managers, and back office managers. */\n  toSiteContributors?: ToSiteContributors;\n  /** Send to [site contacts](https://support.wix.com/en/article/about-your-contact-list). */\n  toContacts?: ToContacts;\n  /**\n   * Notify contacts who are subscribed to specific topics.\n   * @internal\n   */\n  toTopicsSubscribers?: ToTopicsSubscribers;\n}\n\n/** @oneof */\nexport interface PublicNotifyRequestActionTargetOneOf {\n  /** URL to navigate to when the `action` text is clicked. */\n  targetUrl?: string | null;\n  /** Dashboard page to open when the notification action is clicked. */\n  targetDashboardPage?: DashboardPagesWithLiterals;\n}\n\nexport interface ToSiteContributors {\n  /**\n   * Role assigned to site contributors. Only contributors with the specified roles receive the notification:\n   * - `\"All_Contributors\"`: All site collaborators (default).\n   * - `\"Owner\"`: Site owner only.\n   */\n  withRole?: RoleWithLiterals;\n}\n\nexport enum Role {\n  /** All site contributors. */\n  All_Contributors = 'All_Contributors',\n  /** Site owner only. */\n  Owner = 'Owner',\n}\n\n/** @enumType */\nexport type RoleWithLiterals = Role | 'All_Contributors' | 'Owner';\n\nexport interface ToContacts {\n  /**\n   * Contacts that receive the notification.\n   * @format GUID\n   * @maxSize 1000\n   */\n  contactIds?: string[];\n}\n\nexport interface ToTopicsSubscribers {\n  /**\n   * Notification topics to which the recipients have subscribed. Only contacts who subscribed to the specified topics receive the notification.\n   * @maxSize 100\n   */\n  topics?: string[];\n  /**\n   * Excluded contact IDs. Contacts with these IDs don't receive the notification.\n   * @maxSize 1000\n   */\n  excludedContactIds?: string[];\n}\n\nexport enum Channel {\n  /** No default channel. */\n  Undefined = 'Undefined',\n  /** Site dashboard. */\n  Dashboard = 'Dashboard',\n  /** [Wix Owner](https://www.wix.com/mobile/wix-app) mobile app. */\n  Mobile = 'Mobile',\n  /** Active browser. Supported on Chrome and Safari only. */\n  Browser = 'Browser',\n}\n\n/** @enumType */\nexport type ChannelWithLiterals =\n  | Channel\n  | 'Undefined'\n  | 'Dashboard'\n  | 'Mobile'\n  | 'Browser';\n\nexport enum DashboardPages {\n  Undefined_Page = 'Undefined_Page',\n  /** Site dashboard home. */\n  Home = 'Home',\n}\n\n/** @enumType */\nexport type DashboardPagesWithLiterals =\n  | DashboardPages\n  | 'Undefined_Page'\n  | 'Home';\n\nexport interface Empty {}\n\n/**\n * Sends a notification.\n *\n *\n * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.\n *\n * List the the channels for the notification in the `channels` parameter .\n *\n * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.\n * @public\n * @documentationMaturity preview\n * @requiredField body\n * @requiredField channels\n * @param options - Notification options.\n * @param body - Body of the notification. This contains the main content of the notification.\n * @param channels - Channel through which users receive the notification.\n * - `\"Mobile\"`: Sends the notification to the Wix App.\n * - `\"Dashboard\"`: Sends the notification to the collaborator's Wix Dashboard.\n * - `\"Browser\"`: Sends the notification to the collaborator's browser.\n * @returns Fulfilled when the send notification request is received.\n * @fqn com.wixpress.ping.hub.api.PublicNotificationsService.Notify\n */\nexport async function notify(\n  body: string,\n  channels: ChannelWithLiterals[],\n  options?: NotifyOptions\n): Promise<void> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[3] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({\n    body: body,\n    channels: channels,\n    toSiteContributors: options?.toSiteContributors,\n    toContacts: options?.toContacts,\n    title: options?.title,\n    action: options?.action,\n    targetUrl: options?.targetUrl,\n    targetDashboardPage: options?.targetDashboardPage,\n  });\n\n  const reqOpts =\n    ambassadorWixPingNotificationsV1PublicNotification.notify(payload);\n\n  sideEffects?.onSiteCall?.();\n  try {\n    const result = await httpClient.request(reqOpts);\n    sideEffects?.onSuccess?.(result);\n  } catch (err: any) {\n    const transformedError = sdkTransformError(\n      err,\n      {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: {\n          body: '$[0]',\n          channels: '$[1]',\n          toSiteContributors: '$[2].toSiteContributors',\n          toContacts: '$[2].toContacts',\n          title: '$[2].title',\n          action: '$[2].action',\n          targetUrl: '$[2].targetUrl',\n          targetDashboardPage: '$[2].targetDashboardPage',\n        },\n        singleArgumentUnchanged: false,\n      },\n      ['body', 'channels', 'options']\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n\nexport interface NotifyOptions\n  extends NotifyOptionsRecipientsFilterOneOf,\n    NotifyOptionsActionTargetOneOf {\n  /** Send to [site contributors]((https://support.wix.com/en/article/roles-permissions-overview)). This includes site administrators, website managers, and back office managers. */\n  toSiteContributors?: ToSiteContributors;\n  /** Send to [site contacts](https://support.wix.com/en/article/about-your-contact-list). */\n  toContacts?: ToContacts;\n  /** Title of the notification. Max: 512 characters. */\n  title?: string | null;\n  /**\n   *  Title of the notification action. Clicking the action refers the user to a target URL or a dashboard page.\n   *\n   * Max: 512 characters.\n   */\n  action?: string | null;\n  /** External URL to open when the notification action is clicked. */\n  targetUrl?: string | null;\n  /** Dashboard page to open when the notification action is clicked. */\n  targetDashboardPage?: DashboardPagesWithLiterals;\n}\n\n/** @oneof */\nexport interface NotifyOptionsRecipientsFilterOneOf {\n  /** Send to [site contributors]((https://support.wix.com/en/article/roles-permissions-overview)). This includes site administrators, website managers, and back office managers. */\n  toSiteContributors?: ToSiteContributors;\n  /** Send to [site contacts](https://support.wix.com/en/article/about-your-contact-list). */\n  toContacts?: ToContacts;\n  /**\n   * Notify contacts who are subscribed to specific topics.\n   * @internal\n   */\n  toTopicsSubscribers?: ToTopicsSubscribers;\n}\n\n/** @oneof */\nexport interface NotifyOptionsActionTargetOneOf {\n  /** URL to navigate to when the `action` text is clicked. */\n  targetUrl?: string | null;\n  /** Dashboard page to open when the notification action is clicked. */\n  targetDashboardPage?: DashboardPagesWithLiterals;\n}\n","import { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressPingHubApiPublicNotificationsServiceUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'api._api_base_domain_': [\n      {\n        srcPath: '/notifications-hub-server',\n        destPath: '',\n      },\n    ],\n    'www._base_domain_': [\n      {\n        srcPath: '/_api/ping/hub',\n        destPath: '',\n      },\n      {\n        srcPath: '/_api/ping/notifications',\n        destPath: '',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/_api/ping/hub',\n        destPath: '',\n      },\n      {\n        srcPath: '/_api/ping/notifications',\n        destPath: '',\n      },\n    ],\n    'www.wixapis.com': [\n      {\n        srcPath: '/notifications/v3/notify',\n        destPath: '/v3/notify',\n      },\n      {\n        srcPath: '/notifications/v2/notify',\n        destPath: '/v2/notifications/notify',\n      },\n    ],\n    '*.dev.wix-code.com': [\n      {\n        srcPath: '/ping/notifications/v3/notify',\n        destPath: '/v3/notify',\n      },\n    ],\n    _: [\n      {\n        srcPath: '/ping/notifications/v3/notify',\n        destPath: '/v3/notify',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_notifications_notifications';\n\n/**\n * Sends a notification.\n *\n *\n * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.\n *\n * List the the channels for the notification in the `channels` parameter .\n *\n * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.\n */\nexport function notify(payload: object): RequestOptionsFactory<any> {\n  function __notify({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.ping.notifications.v1.public_notification',\n      method: 'POST' as any,\n      methodFqn: 'com.wixpress.ping.hub.api.PublicNotificationsService.Notify',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveComWixpressPingHubApiPublicNotificationsServiceUrl({\n        protoPath: '/api/v1/notify',\n        data: payload,\n        host,\n      }),\n      data: payload,\n    };\n\n    return metadata;\n  }\n\n  return __notify;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n  ChannelWithLiterals,\n  NotifyOptions,\n  notify as universalNotify,\n} from './ping-notifications-v1-public-notification-notifications.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/notifications' };\n\nexport function notify(httpClient: HttpClient): NotifySignature {\n  return (\n    body: string,\n    channels: ChannelWithLiterals[],\n    options?: NotifyOptions\n  ) =>\n    universalNotify(\n      body,\n      channels,\n      options,\n      // @ts-ignore\n      { httpClient }\n    );\n}\n\ninterface NotifySignature {\n  /**\n   * Sends a notification.\n   *\n   *\n   * The `notify()` function sends a [notification](https://support.wix.com/en/article/about-your-dashboard-notifications) to the specified recipients on the specified channels.\n   *\n   * List the the channels for the notification in the `channels` parameter .\n   *\n   * List the recipients for the notification in the `toContacts`, `toSiteContributors`, and `toTopicsSubscribers` parameters.\n   * @param - Notification options.\n   * @param - Body of the notification. This contains the main content of the notification.\n   * @param - Channel through which users receive the notification.\n   * - `\"Mobile\"`: Sends the notification to the Wix App.\n   * - `\"Dashboard\"`: Sends the notification to the collaborator's Wix Dashboard.\n   * - `\"Browser\"`: Sends the notification to the collaborator's browser.\n   * @returns Fulfilled when the send notification request is received.\n   */\n  (\n    body: string,\n    channels: ChannelWithLiterals[],\n    options?: NotifyOptions\n  ): Promise<void>;\n}\n\nexport {\n  Channel,\n  DashboardPages,\n  Empty,\n  NotifyOptions,\n  NotifyOptionsActionTargetOneOf,\n  NotifyOptionsRecipientsFilterOneOf,\n  PublicNotifyRequest,\n  PublicNotifyRequestActionTargetOneOf,\n  PublicNotifyRequestRecipientsFilterOneOf,\n  Public_notification,\n  Role,\n  ToContacts,\n  ToSiteContributors,\n  ToTopicsSubscribers,\n} from './ping-notifications-v1-public-notification-notifications.universal.js';\n","import { notify as publicNotify } from './ping-notifications-v1-public-notification-notifications.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const notify: MaybeContext<\n  BuildRESTFunction<typeof publicNotify> & typeof publicNotify\n> = /*#__PURE__*/ createRESTModule(publicNotify);\n\nexport {\n  Role,\n  Channel,\n  DashboardPages,\n} from './ping-notifications-v1-public-notification-notifications.universal.js';\nexport {\n  Public_notification,\n  PublicNotifyRequest,\n  PublicNotifyRequestRecipientsFilterOneOf,\n  PublicNotifyRequestActionTargetOneOf,\n  ToSiteContributors,\n  ToContacts,\n  ToTopicsSubscribers,\n  Empty,\n  NotifyOptions,\n  NotifyOptionsRecipientsFilterOneOf,\n  NotifyOptionsActionTargetOneOf,\n} from './ping-notifications-v1-public-notification-notifications.universal.js';\nexport {\n  RoleWithLiterals,\n  ChannelWithLiterals,\n  DashboardPagesWithLiterals,\n} from './ping-notifications-v1-public-notification-notifications.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,6CAA6C;;;ACDtD,SAAS,kBAAkB;AAI3B,SAAS,0DACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AA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