{"version":3,"sources":["../../src/ping-notifications-v3-notification-notifications-v-3.universal.ts","../../src/ping-notifications-v3-notification-notifications-v-3.http.ts","../../src/ping-notifications-v3-notification-notifications-v-3.public.ts","../../src/ping-notifications-v3-notification-notifications-v-3.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n  renameKeysFromSDKRequestToRESTRequest,\n  renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixPingNotificationsV3Notification from './ping-notifications-v3-notification-notifications-v-3.http.js';\n\nexport interface Notification {\n  /**\n   * The id of the notification\n   * @immutable\n   */\n  _id?: string;\n}\n\nexport interface NotifyRequest {\n  /**\n   * Notification template ID. A notification template specifies the text and recipients for notifications.\n   * To obtain a notification template ID, create a notification template in your [app's dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-dashboard-setup/about-the-app-dashboard).\n   * @format GUID\n   */\n  notificationTemplateId: string;\n  /**\n   * Each key is a placeholder name you specify when creating a notification template.\n   * The value is an object containing the text to replace the placeholder in the notifications.\n   */\n  dynamicValues?: Record<string, DynamicValue>;\n}\n\nexport interface DynamicValue extends DynamicValueOfTypeOneOf {\n  /** Text to be integrated into the notification. */\n  text?: string;\n}\n\n/** @oneof */\nexport interface DynamicValueOfTypeOneOf {\n  /** Text to be integrated into the notification. */\n  text?: string;\n}\n\n/**\n * Money.\n * Default format to use. Sufficiently compliant with majority of standards: w3c, ISO 4217, ISO 20022, ISO 8583:2003.\n */\nexport interface Money {\n  /**\n   * 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.\n   * @format DECIMAL_VALUE\n   */\n  value?: string;\n  /**\n   * Currency code. Must be valid ISO 4217 currency code (e.g., USD).\n   * @format CURRENCY\n   */\n  currency?: string;\n  /** Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. */\n  formattedValue?: string | null;\n}\n\nexport interface MapDynamicValue {\n  /** items */\n  items?: Record<string, DynamicValue>;\n}\n\nexport interface ArrayDynamicValue {\n  /**\n   * items\n   * @maxSize 100\n   */\n  items?: DynamicValue[];\n}\n\nexport interface AttachmentDynamicValue {\n  /** file name */\n  fileName?: string;\n  /** download url */\n  downloadUrl?: string;\n}\n\nexport interface NotifyResponse {\n  /** ID of the batch of notifications triggered by one request. */\n  notificationBatchId?: string;\n}\n\nexport interface NotifyByAppRequest {\n  /**\n   * notification_template_id\n   * @format GUID\n   */\n  notificationTemplateId?: string;\n  /**\n   * app_def_id\n   * @format GUID\n   */\n  appDefId?: string;\n  /** dynamic_values */\n  dynamicValues?: Record<string, DynamicValue>;\n  /** template tenant */\n  templateTenant?: string | null;\n  /** overrides */\n  overrides?: Overrides;\n  /** channels content */\n  channelsData?: ChannelsData;\n}\n\nexport interface Overrides {\n  /**\n   * excluded_channels\n   * @maxSize 20\n   */\n  excludedChannels?: TemplateChannelWithLiterals[];\n  /** excluded_audiences */\n  excludedAudiences?: ExcludedAudiences;\n  /** content overrides */\n  content?: ChannelsContent;\n}\n\nexport enum TemplateChannel {\n  WEB_FEED = 'WEB_FEED',\n  MOBILE_FEED = 'MOBILE_FEED',\n  MOBILE_PUSH = 'MOBILE_PUSH',\n  BROWSER = 'BROWSER',\n  SMS = 'SMS',\n  EMAIL = 'EMAIL',\n  KAFKA = 'KAFKA',\n  VOICE = 'VOICE',\n}\n\n/** @enumType */\nexport type TemplateChannelWithLiterals =\n  | TemplateChannel\n  | 'WEB_FEED'\n  | 'MOBILE_FEED'\n  | 'MOBILE_PUSH'\n  | 'BROWSER'\n  | 'SMS'\n  | 'EMAIL'\n  | 'KAFKA'\n  | 'VOICE';\n\nexport interface ExcludedAudiences {\n  /**\n   * audience_key\n   * @maxSize 20\n   */\n  audienceKey?: string[];\n}\n\nexport interface ChannelsContent {\n  /** mobile push override */\n  mobileContent?: MobileContent;\n}\n\nexport interface MobileContent {\n  /** title override of mobile push content */\n  title?: string;\n  /** body override of mobile push content */\n  body?: string;\n}\n\nexport interface ChannelsData {\n  /** email data */\n  emailData?: EmailData;\n}\n\nexport interface EmailData {\n  /** shoutout action config */\n  shoutoutActionConfig?: Record<string, any> | null;\n}\n\nexport interface NotifyByAppResponse {\n  /** notification_batch_id */\n  notificationBatchId?: string;\n}\n\nexport interface ResolveRequest {\n  /**\n   * template id\n   * @format GUID\n   */\n  notificationTemplateId?: string;\n  /** values */\n  dynamicValues?: Record<string, DynamicValue>;\n}\n\nexport interface ResolveResponse {}\n\n/**\n * Sends notifications based on the template and dynamic values provided.\n *\n * > **Note**: An app can call this method up to 100,000 times per month for each site.\n *\n * When you create a [notification template](https://dev.wix.com/docs/rest/business-management/notifications/notifications/creating-a-notification-template), you are provided with a notification template ID. Call the Notify method with this ID as `notificationTemplateID` to trigger notifications based on that template.\n *\n * 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.\n * @param notificationTemplateId - Notification template ID. A notification template specifies the text and recipients for notifications.\n * To obtain a notification template ID, create a notification template in your [app's dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-dashboard-setup/about-the-app-dashboard).\n * @public\n * @requiredField notificationTemplateId\n * @permissionId NOTIFICATIONS.SEND_NOTIFICATION\n * @applicableIdentity APP\n * @fqn com.wixpress.ping.hub.api.v3.NotificationsServiceV3.Notify\n */\nexport async function notify(\n  notificationTemplateId: string,\n  options?: NotifyOptions\n): Promise<NonNullablePaths<NotifyResponse, `notificationBatchId`, 2>> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[2] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({\n    notificationTemplateId: notificationTemplateId,\n    dynamicValues: options?.dynamicValues,\n  });\n\n  const reqOpts = ambassadorWixPingNotificationsV3Notification.notify(payload);\n\n  sideEffects?.onSiteCall?.();\n  try {\n    const result = await httpClient.request(reqOpts);\n    sideEffects?.onSuccess?.(result);\n\n    return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n  } catch (err: any) {\n    const transformedError = sdkTransformError(\n      err,\n      {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: {\n          notificationTemplateId: '$[0]',\n          dynamicValues: '$[1].dynamicValues',\n        },\n        singleArgumentUnchanged: false,\n      },\n      ['notificationTemplateId', 'options']\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n\nexport interface NotifyOptions {\n  /**\n   * Each key is a placeholder name you specify when creating a notification template.\n   * The value is an object containing the text to replace the placeholder in the notifications.\n   */\n  dynamicValues?: Record<string, DynamicValue>;\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 resolveComWixpressPingHubApiV3NotificationsServiceV3Url(\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-v-3';\n\n/**\n * Sends notifications based on the template and dynamic values provided.\n *\n * > **Note**: An app can call this method up to 100,000 times per month for each site.\n *\n * When you create a [notification template](https://dev.wix.com/docs/rest/business-management/notifications/notifications/creating-a-notification-template), you are provided with a notification template ID. Call the Notify method with this ID as `notificationTemplateID` to trigger notifications based on that template.\n *\n * 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.\n */\nexport function notify(payload: object): RequestOptionsFactory<any> {\n  function __notify({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.ping.notifications.v3.notification',\n      method: 'POST' as any,\n      methodFqn: 'com.wixpress.ping.hub.api.v3.NotificationsServiceV3.Notify',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveComWixpressPingHubApiV3NotificationsServiceV3Url({\n        protoPath: '/v3/notify',\n        data: payload,\n        host,\n      }),\n      data: payload,\n    };\n\n    return metadata;\n  }\n\n  return __notify;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n  NotifyOptions,\n  NotifyResponse,\n  notify as universalNotify,\n} from './ping-notifications-v3-notification-notifications-v-3.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/notifications' };\n\nexport function notify(httpClient: HttpClient): NotifySignature {\n  return (notificationTemplateId: string, options?: NotifyOptions) =>\n    universalNotify(\n      notificationTemplateId,\n      options,\n      // @ts-ignore\n      { httpClient }\n    );\n}\n\ninterface NotifySignature {\n  /**\n   * Sends notifications based on the template and dynamic values provided.\n   *\n   * > **Note**: An app can call this method up to 100,000 times per month for each site.\n   *\n   * When you create a [notification template](https://dev.wix.com/docs/rest/business-management/notifications/notifications/creating-a-notification-template), you are provided with a notification template ID. Call the Notify method with this ID as `notificationTemplateID` to trigger notifications based on that template.\n   *\n   * 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.\n   * @param - Notification template ID. A notification template specifies the text and recipients for notifications.\n   * To obtain a notification template ID, create a notification template in your [app's dashboard](https://dev.wix.com/docs/build-apps/develop-your-app/app-dashboard-setup/about-the-app-dashboard).\n   */\n  (notificationTemplateId: string, options?: NotifyOptions): Promise<\n    NonNullablePaths<NotifyResponse, `notificationBatchId`, 2>\n  >;\n}\n\nexport {\n  ArrayDynamicValue,\n  AttachmentDynamicValue,\n  ChannelsContent,\n  ChannelsData,\n  DynamicValue,\n  DynamicValueOfTypeOneOf,\n  EmailData,\n  ExcludedAudiences,\n  MapDynamicValue,\n  MobileContent,\n  Money,\n  Notification,\n  NotifyByAppRequest,\n  NotifyByAppResponse,\n  NotifyOptions,\n  NotifyRequest,\n  NotifyResponse,\n  Overrides,\n  ResolveRequest,\n  ResolveResponse,\n  TemplateChannel,\n} from './ping-notifications-v3-notification-notifications-v-3.universal.js';\n","import { notify as publicNotify } from './ping-notifications-v3-notification-notifications-v-3.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 { TemplateChannel } from './ping-notifications-v3-notification-notifications-v-3.universal.js';\nexport {\n  Notification,\n  NotifyRequest,\n  DynamicValue,\n  DynamicValueOfTypeOneOf,\n  Money,\n  MapDynamicValue,\n  ArrayDynamicValue,\n  AttachmentDynamicValue,\n  NotifyResponse,\n  NotifyByAppRequest,\n  Overrides,\n  ExcludedAudiences,\n  ChannelsContent,\n  MobileContent,\n  ChannelsData,\n  EmailData,\n  NotifyByAppResponse,\n  ResolveRequest,\n  ResolveResponse,\n  NotifyOptions,\n} from './ping-notifications-v3-notification-notifications-v-3.universal.js';\nexport { TemplateChannelWithLiterals } from './ping-notifications-v3-notification-notifications-v-3.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,kBAAkB;AAI3B,SAAS,wDACP,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;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,sBAAsB;AAAA,MACpB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAWd,SAAS,OAAO,SAA6C;AAClE,WAAS,SAAS,EAAE,KAAK,GAAQ;AAC/B,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,wDAAwD;AAAA,QAC3D,WAAW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