{"version":3,"sources":["../../../src/loyalty-transaction-v1-loyalty-transaction-transactions.universal.ts","../../../src/loyalty-transaction-v1-loyalty-transaction-transactions.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport { queryBuilder } from '@wix/sdk-runtime/query-builder';\nimport {\n  renameKeysFromSDKRequestToRESTRequest,\n  renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport {\n  HttpClient,\n  HttpResponse,\n  NonNullablePaths,\n  QuerySpec,\n  Query as QuerySdkType,\n} from '@wix/sdk-types';\nimport * as ambassadorWixLoyaltyTransactionV1LoyaltyTransaction from './loyalty-transaction-v1-loyalty-transaction-transactions.http.js';\n// @ts-ignore\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { createQueryUtils } from '@wix/sdk-runtime/query-builder-utils';\n\n/** Loyalty transaction. */\nexport interface LoyaltyTransaction\n  extends LoyaltyTransactionTransactionTypeInfoOneOf {\n  /** Information on points earned. */\n  earnInfo?: EarnInfo;\n  /** Information on points redeemed. */\n  redeemInfo?: RedeemInfo;\n  /** Information on points adjusted. */\n  adjustInfo?: AdjustInfo;\n  /** Information on points refunded. */\n  refundInfo?: RefundInfo;\n  /** Information on points expired. */\n  expireInfo?: ExpireInfo;\n  /** Information on a limited earn attempt recorded with 0 points. */\n  earnAttemptInfo?: EarnAttemptInfo;\n  /**\n   * Transaction ID.\n   * @format GUID\n   */\n  _id?: string | null;\n  /**\n   * Account ID.\n   * @format GUID\n   */\n  accountId?: string;\n  /**\n   * Date and time the transaction was created.\n   * @readonly\n   */\n  _createdDate?: Date | null;\n  /**\n   * The number of points earned, adjusted, redeemed, or expired in the transaction.\n   *\n   * + `EARN`: Number of points earned by a customer taking an action.\n   * + `REDEEM`: The number of points redeemed by a customer for a reward.\n   * + `ADJUST`: The number of points adjusted to a customer's balance.\n   * + `REFUND`: The number of points refunded for a previously redeemed reward.\n   * + `EXPIRE`: The number of points that expired due to customer inactivity for a configured period.\n   */\n  amount?: number;\n  /** Type of transaction. */\n  transactionType?: TransactionTypeWithLiterals;\n  /**\n   * Transaction description.\n   * @maxLength 100\n   */\n  description?: string;\n  /**\n   * Unique identifier, generated by the client. Used to recognize repeated attempts of the same request. Only present when manually adding points with [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points).\n   * @maxLength 128\n   */\n  idempotencyKey?: string;\n}\n\n/** @oneof */\nexport interface LoyaltyTransactionTransactionTypeInfoOneOf {\n  /** Information on points earned. */\n  earnInfo?: EarnInfo;\n  /** Information on points redeemed. */\n  redeemInfo?: RedeemInfo;\n  /** Information on points adjusted. */\n  adjustInfo?: AdjustInfo;\n  /** Information on points refunded. */\n  refundInfo?: RefundInfo;\n  /** Information on points expired. */\n  expireInfo?: ExpireInfo;\n  /** Information on a limited earn attempt recorded with 0 points. */\n  earnAttemptInfo?: EarnAttemptInfo;\n}\n\nexport enum TransactionType {\n  /** Unknown transaction type. */\n  UNKNOWN = 'UNKNOWN',\n  /** Number of points earned by a customer taking an action. See [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points). */\n  EARN = 'EARN',\n  /** Number of points redeemed by a customer for a reward. */\n  REDEEM = 'REDEEM',\n  /** Number of points adjusted to a customer's balance. See [Adjust Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/adjust-points). */\n  ADJUST = 'ADJUST',\n  /** Number of points refunded for a previously redeemed reward. */\n  REFUND = 'REFUND',\n  /** Number of points that expired due to customer inactivity for a configured period. */\n  EXPIRE = 'EXPIRE',\n  /** Record of an earn attempt that was limited to 0 points. */\n  EARN_ATTEMPT = 'EARN_ATTEMPT',\n}\n\n/** @enumType */\nexport type TransactionTypeWithLiterals =\n  | TransactionType\n  | 'UNKNOWN'\n  | 'EARN'\n  | 'REDEEM'\n  | 'ADJUST'\n  | 'REFUND'\n  | 'EXPIRE'\n  | 'EARN_ATTEMPT';\n\nexport interface EarnInfo extends EarnInfoActivityDetailsOneOf {\n  /** Details on following on social media. */\n  followedSocialMedia?: FollowedSocialMedia;\n  /**\n   * ID of the app that generated the earned points.\n   * @minLength 1\n   * @readonly\n   */\n  appId?: string;\n  /** Activity type. */\n  activityType?: string;\n  /**\n   * Order ID.\n   * @maxLength 512\n   */\n  orderId?: string | null;\n  /**\n   * Whether the points amount was adjusted by an earn points limit provider.\n   * @readonly\n   */\n  limitApplied?: boolean;\n}\n\n/** @oneof */\nexport interface EarnInfoActivityDetailsOneOf {\n  /** Details on following on social media. */\n  followedSocialMedia?: FollowedSocialMedia;\n}\n\nexport interface FollowedSocialMedia {\n  /**\n   * Social media channel.\n   * For example, `\"FACEBOOK\"` or `\"INSTAGRAM\"`.\n   * @maxLength 32\n   */\n  channel?: string;\n}\n\nexport interface RedeemInfo {\n  /**\n   * ID of the reward that was redeemed.\n   * @format GUID\n   * @readonly\n   */\n  rewardId?: string;\n  /**\n   * Type of reward that was redeemed.\n   * @readonly\n   */\n  rewardType?: string | null;\n  /**\n   * ID of the specific item that was redeemed in this transaction.\n   *\n   * Each reward that's redeemed has a unique `referenceEntityId`.\n   * @format GUID\n   * @readonly\n   */\n  referenceEntityId?: string | null;\n}\n\nexport interface AdjustInfo {\n  /**\n   * ID of the app that initiated the points adjustment.\n   * @minLength 1\n   * @readonly\n   */\n  appId?: string;\n  /** Amount before adjustment. */\n  amountBefore?: number;\n  /** Amount after adjustment. */\n  amountAfter?: number;\n}\n\nexport interface RefundInfo {\n  /**\n   * ID of the app that refunded points.\n   * @minLength 1\n   * @readonly\n   */\n  appId?: string;\n  /**\n   * ID of the transaction that was refunded.\n   * @format GUID\n   * @readonly\n   */\n  refundedTransactionId?: string | null;\n}\n\nexport interface ExpireInfo {\n  /** Amount before expiration. */\n  amountBefore?: number;\n  /** Amount after expiration. */\n  amountAfter?: number;\n}\n\nexport interface EarnAttemptInfo {\n  /**\n   * ID of the app that generated the earn operation.\n   * @minLength 1\n   * @readonly\n   */\n  appId?: string;\n  /** Activity type. */\n  activityType?: string;\n  /**\n   * Order ID.\n   * @maxLength 512\n   */\n  orderId?: string | null;\n}\n\nexport interface CreateLoyaltyTransactionRequest {\n  /** LoyaltyTransaction to be created. */\n  loyaltyTransaction?: LoyaltyTransaction;\n  /** If true, deduct points from the account before creating the transaction. */\n  deductPoints?: boolean;\n}\n\nexport interface CreateLoyaltyTransactionResponse {\n  /** The created LoyaltyTransaction. */\n  loyaltyTransaction?: LoyaltyTransaction;\n}\n\nexport interface BulkCreateLoyaltyTransactionsRequest {\n  /**\n   * Transactions to create.\n   * @minSize 1\n   * @maxSize 100\n   */\n  loyaltyTransactions?: LoyaltyTransaction[];\n  /** Determines if entities must be returned in response. */\n  returnEntity?: boolean;\n}\n\nexport interface BulkCreateLoyaltyTransactionsResponse {\n  /**\n   * Results of bulk creation.\n   * @minSize 1\n   * @maxSize 100\n   */\n  results?: BulkLoyaltyTransactionResult[];\n  /** Bulk action metadata. */\n  bulkActionMetadata?: BulkActionMetadata;\n}\n\nexport interface ItemMetadata {\n  /** Item ID. Should always be available, unless it's impossible (for example, when failing to create an item). */\n  _id?: string | null;\n  /** Index of the item within the request array. Allows for correlation between request and response items. */\n  originalIndex?: number;\n  /** Whether the requested action was successful for this item. When `false`, the `error` field is populated. */\n  success?: boolean;\n  /** Details about the error in case of failure. */\n  error?: ApplicationError;\n}\n\nexport interface ApplicationError {\n  /** Error code. */\n  code?: string;\n  /** Description of the error. */\n  description?: string;\n  /** Data related to the error. */\n  data?: Record<string, any> | null;\n}\n\nexport interface BulkLoyaltyTransactionResult {\n  /** Individual loyalty transaction metadata. */\n  itemMetadata?: ItemMetadata;\n  /** Only exists if `returnEntity` was set to true in the request. */\n  item?: LoyaltyTransaction;\n}\n\nexport interface BulkActionMetadata {\n  /** Number of items that were successfully processed. */\n  totalSuccesses?: number;\n  /** Number of items that couldn't be processed. */\n  totalFailures?: number;\n  /** Number of failures without details because detailed failure threshold was exceeded. */\n  undetailedFailures?: number;\n}\n\nexport interface GetLoyaltyTransactionRequest {\n  /**\n   * ID of the loyalty transaction to retrieve.\n   * @format GUID\n   */\n  loyaltyTransactionId: string;\n}\n\nexport interface GetLoyaltyTransactionResponse {\n  /** Retrieved loyalty transaction. */\n  loyaltyTransaction?: LoyaltyTransaction;\n}\n\nexport interface QueryLoyaltyTransactionsRequest {\n  /** Query options. */\n  query?: CursorQuery;\n}\n\nexport interface CursorQuery extends CursorQueryPagingMethodOneOf {\n  /**\n   * Cursor paging options.\n   *\n   * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).\n   */\n  cursorPaging?: CursorPaging;\n  /**\n   * Filter object.\n   *\n   * Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).\n   */\n  filter?: Record<string, any> | null;\n  /**\n   * Sort object.\n   *\n   * Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting).\n   * @maxSize 5\n   */\n  sort?: Sorting[];\n}\n\n/** @oneof */\nexport interface CursorQueryPagingMethodOneOf {\n  /**\n   * Cursor paging options.\n   *\n   * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).\n   */\n  cursorPaging?: CursorPaging;\n}\n\nexport interface Sorting {\n  /**\n   * Name of the field to sort by.\n   * @maxLength 512\n   */\n  fieldName?: string;\n  /** Sort order. */\n  order?: SortOrderWithLiterals;\n}\n\nexport enum SortOrder {\n  ASC = 'ASC',\n  DESC = 'DESC',\n}\n\n/** @enumType */\nexport type SortOrderWithLiterals = SortOrder | 'ASC' | 'DESC';\n\nexport interface CursorPaging {\n  /**\n   * Maximum number of items to return in the results.\n   * @max 100\n   */\n  limit?: number | null;\n  /**\n   * Pointer to the next or previous page in the list of results.\n   *\n   * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.\n   * Not relevant for the first request.\n   * @maxLength 16000\n   */\n  cursor?: string | null;\n}\n\nexport interface QueryLoyaltyTransactionsResponse {\n  /** Retrieved loyalty transactions. */\n  loyaltyTransactions?: LoyaltyTransaction[];\n  /** Paging metadata. */\n  pagingMetadata?: CursorPagingMetadata;\n}\n\nexport interface CursorPagingMetadata {\n  /** Number of items returned in current page. */\n  count?: number | null;\n  /** Cursor strings that point to the next page, previous page, or both. */\n  cursors?: Cursors;\n  /**\n   * Whether there are more pages to retrieve following the current page.\n   *\n   * + `true`: Another page of results can be retrieved.\n   * + `false`: This is the last page.\n   */\n  hasNext?: boolean | null;\n}\n\nexport interface Cursors {\n  /**\n   * Cursor string pointing to the next page in the list of results.\n   * @maxLength 16000\n   */\n  next?: string | null;\n  /**\n   * Cursor pointing to the previous page in the list of results.\n   * @maxLength 16000\n   */\n  prev?: string | null;\n}\n\nexport interface DomainEvent extends DomainEventBodyOneOf {\n  createdEvent?: EntityCreatedEvent;\n  updatedEvent?: EntityUpdatedEvent;\n  deletedEvent?: EntityDeletedEvent;\n  actionEvent?: ActionEvent;\n  /** Event ID. With this ID you can easily spot duplicated events and ignore them. */\n  _id?: string;\n  /**\n   * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities.\n   * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.\n   */\n  entityFqdn?: string;\n  /**\n   * Event action name, placed at the top level to make it easier for users to dispatch messages.\n   * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.\n   */\n  slug?: string;\n  /** ID of the entity associated with the event. */\n  entityId?: string;\n  /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */\n  eventTime?: Date | null;\n  /**\n   * Whether the event was triggered as a result of a privacy regulation application\n   * (for example, GDPR).\n   */\n  triggeredByAnonymizeRequest?: boolean | null;\n  /** If present, indicates the action that triggered the event. */\n  originatedFrom?: string | null;\n  /**\n   * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at 16:00 and then again at 16:01, the second update will always have a higher sequence number.\n   * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.\n   */\n  entityEventSequence?: string | null;\n}\n\n/** @oneof */\nexport interface DomainEventBodyOneOf {\n  createdEvent?: EntityCreatedEvent;\n  updatedEvent?: EntityUpdatedEvent;\n  deletedEvent?: EntityDeletedEvent;\n  actionEvent?: ActionEvent;\n}\n\nexport interface EntityCreatedEvent {\n  entity?: string;\n}\n\nexport interface RestoreInfo {\n  deletedDate?: Date | null;\n}\n\nexport interface EntityUpdatedEvent {\n  /**\n   * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff.\n   * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects.\n   * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it.\n   */\n  currentEntity?: string;\n}\n\nexport interface EntityDeletedEvent {\n  /** Entity that was deleted. */\n  deletedEntity?: string | null;\n}\n\nexport interface ActionEvent {\n  body?: string;\n}\n\nexport interface Empty {}\n\nexport interface GetTransactionSumRequest {\n  /** Filter loyalty transactions to sum */\n  filter?: Record<string, any> | null;\n}\n\nexport interface GetTransactionSumResponse {\n  /**\n   * Total amount of all filtered loyalty transactions\n   * @max 9999999\n   */\n  totalAmount?: number;\n}\n\nexport interface RevertTransactionRequest {\n  /**\n   * ID of the EARN transaction to revert.\n   * @format GUID\n   */\n  transactionId?: string;\n}\n\nexport interface RevertTransactionResponse {}\n\nexport interface MessageEnvelope {\n  /**\n   * App instance ID.\n   * @format GUID\n   */\n  instanceId?: string | null;\n  /**\n   * Event type.\n   * @maxLength 150\n   */\n  eventType?: string;\n  /** The identification type and identity data. */\n  identity?: IdentificationData;\n  /** Stringify payload. */\n  data?: string;\n  /** Details related to the account */\n  accountInfo?: AccountInfo;\n}\n\nexport interface IdentificationData extends IdentificationDataIdOneOf {\n  /**\n   * ID of a site visitor that has not logged in to the site.\n   * @format GUID\n   */\n  anonymousVisitorId?: string;\n  /**\n   * ID of a site visitor that has logged in to the site.\n   * @format GUID\n   */\n  memberId?: string;\n  /**\n   * ID of a Wix user (site owner, contributor, etc.).\n   * @format GUID\n   */\n  wixUserId?: string;\n  /**\n   * ID of an app.\n   * @format GUID\n   */\n  appId?: string;\n  /** @readonly */\n  identityType?: WebhookIdentityTypeWithLiterals;\n}\n\n/** @oneof */\nexport interface IdentificationDataIdOneOf {\n  /**\n   * ID of a site visitor that has not logged in to the site.\n   * @format GUID\n   */\n  anonymousVisitorId?: string;\n  /**\n   * ID of a site visitor that has logged in to the site.\n   * @format GUID\n   */\n  memberId?: string;\n  /**\n   * ID of a Wix user (site owner, contributor, etc.).\n   * @format GUID\n   */\n  wixUserId?: string;\n  /**\n   * ID of an app.\n   * @format GUID\n   */\n  appId?: string;\n}\n\nexport enum WebhookIdentityType {\n  UNKNOWN = 'UNKNOWN',\n  ANONYMOUS_VISITOR = 'ANONYMOUS_VISITOR',\n  MEMBER = 'MEMBER',\n  WIX_USER = 'WIX_USER',\n  APP = 'APP',\n}\n\n/** @enumType */\nexport type WebhookIdentityTypeWithLiterals =\n  | WebhookIdentityType\n  | 'UNKNOWN'\n  | 'ANONYMOUS_VISITOR'\n  | 'MEMBER'\n  | 'WIX_USER'\n  | 'APP';\n\nexport interface AccountInfo {\n  /**\n   * ID of the Wix account associated with the event.\n   * @format GUID\n   */\n  accountId?: string | null;\n  /**\n   * ID of the parent Wix account. Only included when accountId belongs to a child account.\n   * @format GUID\n   */\n  parentAccountId?: string | null;\n  /**\n   * ID of the Wix site associated with the event. Only included when the event is tied to a specific site.\n   * @format GUID\n   */\n  siteId?: string | null;\n}\n\n/**\n * Retrieves a transaction.\n * @param loyaltyTransactionId - ID of the loyalty transaction to retrieve.\n * @public\n * @requiredField loyaltyTransactionId\n * @permissionId LOYALTY.READ_TRANSACTIONS\n * @applicableIdentity APP\n * @returns Retrieved loyalty transaction.\n * @fqn wix.loyalty.transaction.v1.LoyaltyTransactions.GetLoyaltyTransaction\n */\nexport async function getLoyaltyTransaction(\n  loyaltyTransactionId: string\n): Promise<\n  NonNullablePaths<\n    LoyaltyTransaction,\n    | `earnInfo.followedSocialMedia.channel`\n    | `earnInfo.appId`\n    | `earnInfo.activityType`\n    | `earnInfo.limitApplied`\n    | `redeemInfo.rewardId`\n    | `adjustInfo.appId`\n    | `adjustInfo.amountBefore`\n    | `adjustInfo.amountAfter`\n    | `refundInfo.appId`\n    | `expireInfo.amountBefore`\n    | `expireInfo.amountAfter`\n    | `earnAttemptInfo.appId`\n    | `earnAttemptInfo.activityType`\n    | `accountId`\n    | `amount`\n    | `transactionType`\n    | `description`\n    | `idempotencyKey`,\n    4\n  >\n> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[1] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({\n    loyaltyTransactionId: loyaltyTransactionId,\n  });\n\n  const reqOpts =\n    ambassadorWixLoyaltyTransactionV1LoyaltyTransaction.getLoyaltyTransaction(\n      payload\n    );\n\n  sideEffects?.onSiteCall?.();\n  try {\n    const result = await httpClient.request(reqOpts);\n    sideEffects?.onSuccess?.(result);\n\n    return renameKeysFromRESTResponseToSDKResponse(result.data)\n      ?.loyaltyTransaction!;\n  } catch (err: any) {\n    const transformedError = sdkTransformError(\n      err,\n      {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: { loyaltyTransactionId: '$[0]' },\n        singleArgumentUnchanged: false,\n      },\n      ['loyaltyTransactionId']\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n\n/**\n * Retrieves a list of loyalty transactions with the specified paging, filtering, and sorting.\n *\n * To learn about working with _Query_ methods, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language),\n * [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging),\n * and [Field Projection](https://dev.wix.com/docs/rest/articles/get-started/field-projection).\n * @public\n * @permissionId LOYALTY.READ_TRANSACTIONS\n * @applicableIdentity APP\n * @fqn wix.loyalty.transaction.v1.LoyaltyTransactions.QueryLoyaltyTransactions\n */\nexport function queryLoyaltyTransactions(): LoyaltyTransactionsQueryBuilder {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[0] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  return queryBuilder<\n    LoyaltyTransaction,\n    'CURSOR',\n    QueryLoyaltyTransactionsRequest,\n    QueryLoyaltyTransactionsResponse\n  >({\n    func: async (payload: QueryLoyaltyTransactionsRequest) => {\n      const reqOpts =\n        ambassadorWixLoyaltyTransactionV1LoyaltyTransaction.queryLoyaltyTransactions(\n          payload\n        );\n\n      sideEffects?.onSiteCall?.();\n      try {\n        const result = await httpClient.request(reqOpts);\n        sideEffects?.onSuccess?.(result);\n        return result;\n      } catch (err) {\n        sideEffects?.onError?.(err);\n        throw err;\n      }\n    },\n    requestTransformer: (query: QueryLoyaltyTransactionsRequest['query']) => {\n      const args = [query, {}] as [\n        QueryLoyaltyTransactionsRequest['query'],\n        {}\n      ];\n      return renameKeysFromSDKRequestToRESTRequest({\n        ...args?.[1],\n        query: args?.[0],\n      });\n    },\n    responseTransformer: ({\n      data,\n    }: HttpResponse<QueryLoyaltyTransactionsResponse>) => {\n      const transformedData = renameKeysFromRESTResponseToSDKResponse(\n        transformPaths(data, [])\n      );\n\n      return {\n        items: transformedData?.loyaltyTransactions,\n        pagingMetadata: transformedData?.pagingMetadata,\n      };\n    },\n    errorTransformer: (err: unknown) => {\n      const transformedError = sdkTransformError(err, {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: { query: '$[0]' },\n        singleArgumentUnchanged: false,\n      });\n\n      throw transformedError;\n    },\n    pagingMethod: 'CURSOR',\n    transformationPaths: {},\n  });\n}\n\ninterface QueryCursorResult {\n  cursors: Cursors;\n  hasNext: () => boolean;\n  hasPrev: () => boolean;\n  length: number;\n  pageSize: number;\n}\n\nexport interface LoyaltyTransactionsQueryResult extends QueryCursorResult {\n  items: LoyaltyTransaction[];\n  query: LoyaltyTransactionsQueryBuilder;\n  next: () => Promise<LoyaltyTransactionsQueryResult>;\n  prev: () => Promise<LoyaltyTransactionsQueryResult>;\n}\n\nexport interface LoyaltyTransactionsQueryBuilder {\n  /** @param propertyName - Property whose value is compared with `value`.\n   * @param value - Value to compare against.\n   */\n  eq: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'transactionType'\n      | 'description'\n      | 'idempotencyKey',\n    value: any\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyName - Property whose value is compared with `value`.\n   * @param value - Value to compare against.\n   */\n  ne: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'transactionType'\n      | 'description'\n      | 'idempotencyKey',\n    value: any\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyName - Property whose value is compared with `value`.\n   * @param value - Value to compare against.\n   */\n  ge: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'description'\n      | 'idempotencyKey',\n    value: any\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyName - Property whose value is compared with `value`.\n   * @param value - Value to compare against.\n   */\n  gt: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'description'\n      | 'idempotencyKey',\n    value: any\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyName - Property whose value is compared with `value`.\n   * @param value - Value to compare against.\n   */\n  le: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'description'\n      | 'idempotencyKey',\n    value: any\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyName - Property whose value is compared with `value`.\n   * @param value - Value to compare against.\n   */\n  lt: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'description'\n      | 'idempotencyKey',\n    value: any\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyName - Property whose value is compared with `string`.\n   * @param string - String to compare against. Case-insensitive.\n   */\n  startsWith: (\n    propertyName: '_id' | 'accountId' | 'description' | 'idempotencyKey',\n    value: string\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyName - Property whose value is compared with `values`.\n   * @param values - List of values to compare against.\n   */\n  hasSome: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'transactionType'\n      | 'description'\n      | 'idempotencyKey',\n    value: any[]\n  ) => LoyaltyTransactionsQueryBuilder;\n  in: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'transactionType'\n      | 'description'\n      | 'idempotencyKey',\n    value: any\n  ) => LoyaltyTransactionsQueryBuilder;\n  exists: (\n    propertyName:\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'transactionType'\n      | 'description'\n      | 'idempotencyKey',\n    value: boolean\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */\n  ascending: (\n    ...propertyNames: Array<\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'transactionType'\n      | 'description'\n      | 'idempotencyKey'\n    >\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments. */\n  descending: (\n    ...propertyNames: Array<\n      | '_id'\n      | 'accountId'\n      | '_createdDate'\n      | 'amount'\n      | 'transactionType'\n      | 'description'\n      | 'idempotencyKey'\n    >\n  ) => LoyaltyTransactionsQueryBuilder;\n  /** @param limit - Number of items to return, which is also the `pageSize` of the results object. */\n  limit: (limit: number) => LoyaltyTransactionsQueryBuilder;\n  /** @param cursor - A pointer to specific record */\n  skipTo: (cursor: string) => LoyaltyTransactionsQueryBuilder;\n  find: () => Promise<LoyaltyTransactionsQueryResult>;\n}\n\n/**\n * @hidden\n * @fqn wix.loyalty.transaction.v1.LoyaltyTransactions.QueryLoyaltyTransactions\n * @requiredField query\n */\nexport async function typedQueryLoyaltyTransactions(\n  query: LoyaltyTransactionQuery\n): Promise<\n  NonNullablePaths<\n    QueryLoyaltyTransactionsResponse,\n    | `loyaltyTransactions`\n    | `loyaltyTransactions.${number}.earnInfo.followedSocialMedia.channel`\n    | `loyaltyTransactions.${number}.earnInfo.appId`\n    | `loyaltyTransactions.${number}.earnInfo.activityType`\n    | `loyaltyTransactions.${number}.earnInfo.limitApplied`\n    | `loyaltyTransactions.${number}.redeemInfo.rewardId`\n    | `loyaltyTransactions.${number}.adjustInfo.appId`\n    | `loyaltyTransactions.${number}.adjustInfo.amountBefore`\n    | `loyaltyTransactions.${number}.adjustInfo.amountAfter`\n    | `loyaltyTransactions.${number}.refundInfo.appId`\n    | `loyaltyTransactions.${number}.expireInfo.amountBefore`\n    | `loyaltyTransactions.${number}.expireInfo.amountAfter`\n    | `loyaltyTransactions.${number}.earnAttemptInfo.appId`\n    | `loyaltyTransactions.${number}.earnAttemptInfo.activityType`\n    | `loyaltyTransactions.${number}.accountId`\n    | `loyaltyTransactions.${number}.amount`\n    | `loyaltyTransactions.${number}.transactionType`\n    | `loyaltyTransactions.${number}.description`\n    | `loyaltyTransactions.${number}.idempotencyKey`,\n    6\n  >\n> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[1] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({ query: query });\n\n  const reqOpts =\n    ambassadorWixLoyaltyTransactionV1LoyaltyTransaction.queryLoyaltyTransactions(\n      payload\n    );\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: { query: '$[0]' },\n        singleArgumentUnchanged: false,\n      },\n      ['query']\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n\nexport interface LoyaltyTransactionQuerySpec extends QuerySpec {\n  paging: 'cursor';\n  wql: [\n    {\n      fields: [\n        '_createdDate',\n        '_id',\n        'accountId',\n        'amount',\n        'description',\n        'idempotencyKey',\n        'transactionType'\n      ];\n      operators: '*';\n      sort: 'BOTH';\n    }\n  ];\n}\n\nexport type CommonQueryWithEntityContext = QuerySdkType<\n  LoyaltyTransaction,\n  LoyaltyTransactionQuerySpec\n>;\nexport type LoyaltyTransactionQuery = {\n  /** \n  Cursor paging options.\n\n  Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging).  \n  */\n  cursorPaging?: {\n    /** \n  Maximum number of items to return in the results. \n  @max: 100 \n  */\n    limit?:\n      | NonNullable<CommonQueryWithEntityContext['cursorPaging']>['limit']\n      | null;\n    /** \n  Pointer to the next or previous page in the list of results.\n\n  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response.\n  Not relevant for the first request. \n  @maxLength: 16000 \n  */\n    cursor?:\n      | NonNullable<CommonQueryWithEntityContext['cursorPaging']>['cursor']\n      | null;\n  };\n  /** \n  Filter object.\n\n  Learn more about [filtering](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#filters).  \n  */\n  filter?: CommonQueryWithEntityContext['filter'] | null;\n  /** \n  Sort object.\n\n  Learn more about [sorting](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#sorting). \n  @maxSize: 5 \n  */\n  sort?: {\n    /** \n  Name of the field to sort by. \n  @maxLength: 512 \n  */\n    fieldName?: NonNullable<\n      CommonQueryWithEntityContext['sort']\n    >[number]['fieldName'];\n    /** \n  Sort order.  \n  */\n    order?: NonNullable<CommonQueryWithEntityContext['sort']>[number]['order'];\n  }[];\n};\n\nexport const utils = {\n  query: {\n    ...createQueryUtils<\n      LoyaltyTransaction,\n      LoyaltyTransactionQuerySpec,\n      LoyaltyTransactionQuery\n    >(),\n  },\n};\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixLoyaltyTransactionV1LoyaltyTransactionsUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'api._api_base_domain_': [\n      {\n        srcPath: '/loyalty-transactions',\n        destPath: '',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/_api/loyalty-transactions',\n        destPath: '',\n      },\n    ],\n    'www.wixapis.com': [\n      {\n        srcPath: '/loyalty-transactions',\n        destPath: '',\n      },\n    ],\n    _: [\n      {\n        srcPath: '/_api/loyalty-transactions',\n        destPath: '',\n      },\n    ],\n    '*.dev.wix-code.com': [\n      {\n        srcPath: '/_api/loyalty-transactions',\n        destPath: '',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_loyalty_transactions';\n\n/** Retrieves a transaction. */\nexport function getLoyaltyTransaction(\n  payload: object\n): RequestOptionsFactory<any> {\n  function __getLoyaltyTransaction({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.loyalty.transaction.v1.loyalty_transaction',\n      method: 'GET' as any,\n      methodFqn:\n        'wix.loyalty.transaction.v1.LoyaltyTransactions.GetLoyaltyTransaction',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveWixLoyaltyTransactionV1LoyaltyTransactionsUrl({\n        protoPath: '/v1/loyalty-transactions/{loyaltyTransactionId}',\n        data: payload,\n        host,\n      }),\n      params: toURLSearchParams(payload),\n      transformResponse: (payload: any) =>\n        transformPaths(payload, [\n          {\n            transformFn: transformRESTTimestampToSDKTimestamp,\n            paths: [{ path: 'loyaltyTransaction.createdDate' }],\n          },\n        ]),\n    };\n\n    return metadata;\n  }\n\n  return __getLoyaltyTransaction;\n}\n\n/**\n * Retrieves a list of loyalty transactions with the specified paging, filtering, and sorting.\n *\n * To learn about working with _Query_ methods, see [API Query Language](https://dev.wix.com/docs/rest/articles/get-started/api-query-language),\n * [Sorting and Paging](https://dev.wix.com/docs/rest/articles/get-started/sorting-and-paging),\n * and [Field Projection](https://dev.wix.com/docs/rest/articles/get-started/field-projection).\n */\nexport function queryLoyaltyTransactions(\n  payload: object\n): RequestOptionsFactory<any> {\n  function __queryLoyaltyTransactions({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.loyalty.transaction.v1.loyalty_transaction',\n      method: 'POST' as any,\n      methodFqn:\n        'wix.loyalty.transaction.v1.LoyaltyTransactions.QueryLoyaltyTransactions',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveWixLoyaltyTransactionV1LoyaltyTransactionsUrl({\n        protoPath: '/v1/loyalty-transactions/query',\n        data: payload,\n        host,\n      }),\n      data: payload,\n      transformResponse: (payload: any) =>\n        transformPaths(payload, [\n          {\n            transformFn: transformRESTTimestampToSDKTimestamp,\n            paths: [{ path: 'loyaltyTransactions.createdDate' }],\n          },\n        ]),\n    };\n\n    return metadata;\n  }\n\n  return __queryLoyaltyTransactions;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACLP,SAAS,yBAAyB;AAClC,SAAS,4CAA4C;AACrD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,qDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,S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;AAAA,EACxB,CAAC;AACH;AAiLA,eAAsB,8BACpB,OAyBA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC,EAAE,MAAa,CAAC;AAEtE,QAAM,UACgD;AAAA,IAClD;AAAA,EACF;AAEF,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO,wCAAwC,OAAO,IAAI;AAAA,EAC5D,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B,EAAE,OAAO,OAAO;AAAA,QAC1C,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,OAAO;AAAA,IACV;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;AA6EO,IAAM,QAAQ;AAAA,EACnB,OAAO;AAAA,IACL,GAAG,iBAID;AAAA,EACJ;AACF;","names":["payload","transformPaths","TransactionType","SortOrder","WebhookIdentityType","getLoyaltyTransaction","queryLoyaltyTransactions"]}