{"version":3,"file":"discussionTopic.f648c681.js","sources":["../../../frontend/api/v3/private/discussionTopic.js"],"sourcesContent":["// Helpers\nimport { privateApiUrl } from 'api/v3';\nimport { postRequest } from 'api/v3/helpers';\n\n/**\n * Get discussion topic\n * @param {(string|number)} id\n * @param {Object} params\n * @param {string[]} params.include\n * @returns {string}\n */\nexport const getDiscussionTopicUrl = (id, params = { include: ['hero_image', 'project'] }) => {\n  return privateApiUrl(`discussion_topics/${id}`, params);\n};\n\n/**\n * Get discussions of the discussion topic\n * @param {(number|string)} discussionTopId\n * @param {number} [pageNumber=1]\n * @param {number} [pageSize=25]\n * @param {string} [sort=-created_at]  - most_popular, -created_at, created_at\n * @param {object} filter\n * @param {boolean} [filter.approved=true]\n * @param {boolean} [filter.require_moderation=false]\n * @returns {string}\n */\nexport const getDiscussionTopicDiscussionsURL = (\n  discussionTopId,\n  pageNumber = 1,\n  pageSize = 25,\n  sort = '-created_at',\n  filter = {\n    require_moderation: false,\n  }\n) => {\n  const params = {\n    page: {\n      number: pageNumber,\n      size: pageSize,\n    },\n    sort,\n    filter,\n  };\n\n  return privateApiUrl(`discussion_topics/${discussionTopId}/discussions`, params);\n};\n\n/**\n * Export comments for a DiscussionTopic\n * @param {(string|number)} discussionTopicId\n * @param {string} defaultLocale\n * @returns\n */\nexport const exportDiscussionTopicComments = (discussionTopicId, defaultLocale) => {\n  const url = privateApiUrl(`discussion_topics/${discussionTopicId}/export_discussions`);\n\n  return postRequest(url, {\n    data: {\n      type: 'export_discussions',\n      attributes: {\n        ...(defaultLocale && { defaultLocale }),\n      },\n    },\n  });\n};\n"],"names":["getDiscussionTopicUrl","id","params","privateApiUrl","getDiscussionTopicDiscussionsURL","discussionTopId","pageNumber","pageSize","sort","filter","exportDiscussionTopicComments","discussionTopicId","defaultLocale","url","postRequest"],"mappings":"6ZAWa,MAAAA,EAAwB,CAACC,EAAIC,EAAS,CAAE,QAAS,CAAC,aAAc,SAAS,KAC7EC,EAAc,qBAAqBF,IAAMC,CAAM,EAc3CE,EAAmC,CAC9CC,EACAC,EAAa,EACbC,EAAW,GACXC,EAAO,cACPC,EAAS,CACP,mBAAoB,EACtB,IACG,CACH,MAAMP,EAAS,CACb,KAAM,CACJ,OAAQI,EACR,KAAMC,CACR,EACA,KAAAC,EACA,OAAAC,CAAA,EAGK,OAAAN,EAAc,qBAAqBE,gBAA+BH,CAAM,CACjF,EAQaQ,EAAgC,CAACC,EAAmBC,IAAkB,CAC3E,MAAAC,EAAMV,EAAc,qBAAqBQ,sBAAsC,EAErF,OAAOG,EAAYD,EAAK,CACtB,KAAM,CACJ,KAAM,qBACN,WAAY,CACV,GAAID,GAAiB,CAAE,cAAAA,CAAc,CACvC,CACF,CAAA,CACD,CACH"}