{"version":3,"sources":["../../../src/actions/submit/submit.ts"],"names":[],"mappings":";;AAyBO,MAAM,qBAAqB,MAAgC,CAAA;AAAA,EAChE,IAAA;AAAA;AAAA;AAAA;AAAA,EAKA,gBAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA,EAEA,WAAA,CAAY,OAA+B,GAAA,EAAI,EAAA;AAC7C,IAAM,KAAA,EAAA;AACN,IAAA,IAAA,CAAK,IAAO,GAAA,eAAA;AACZ,IAAO,MAAA,CAAA,MAAA,CAAO,MAAM,OAAO,CAAA;AAAA;AAC7B,EAEA,OAAO,KAAK,OAAsC,EAAA;AAChD,IAAO,OAAA,IAAI,aAAa,OAAO,CAAA;AAAA;AACjC,EAEA,qBAAqB,KAAyB,EAAA;AAC5C,IAAA,IAAA,CAAK,gBAAmB,GAAA,KAAA;AACxB,IAAO,OAAA,IAAA;AAAA;AACT,EAEA,SAAS,KAA6B,GAAA,EAAE,OAAS,EAAA,IAAM,EAAA;AACrD,IAAA,MAAM,EAAE,OAAA,EAAS,GAAG,IAAA,EAAS,GAAA,KAAA;AAC7B,IAAI,IAAA,CAAC,KAAK,IAAM,EAAA;AACd,MAAK,IAAA,CAAA,IAAA,GAAO,EAAE,OAAQ,EAAA;AAAA;AAGxB,IAAO,MAAA,CAAA,MAAA,CAAO,KAAK,IAAM,EAAA;AAAA,MACvB,OAAS,EAAA;AAAA,QACP,GAAG,KAAK,IAAK,CAAA,OAAA;AAAA,QACb,GAAG;AAAA,OACL;AAAA,MACA,GAAG;AAAA,KACJ,CAAA;AACD,IAAO,OAAA,IAAA;AAAA;AAEX","file":"submit.mjs","sourcesContent":["import { AssociatedInputs } from '../../common';\nimport { Action, IAction } from '../base';\n\nexport type SubmitActionOptions = Omit<ISubmitAction, 'type' | 'data'>;\n\n/**\n * Gathers input fields, merges with optional data field, and sends an event to the client. It is up to the client to determine how this data is processed. For example: With BotFramework bots, the client would send an activity through the messaging medium to the bot. The inputs that are gathered are those on the current card, and in the case of a show card those on any parent cards. See https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/input-validation for more details.\n */\nexport interface ISubmitAction extends IAction {\n  type: 'Action.Submit';\n\n  /**\n   * Controls which inputs are associated with the action.\n   */\n  associatedInputs?: AssociatedInputs;\n\n  /**\n   * Initial data that input fields will be combined with. These are essentially ‘hidden’ properties.\n   */\n  data?: MSTeamsData<Record<string, any>>;\n}\n\n/**\n * Gathers input fields, merges with optional data field, and sends an event to the client. It is up to the client to determine how this data is processed. For example: With BotFramework bots, the client would send an activity through the messaging medium to the bot. The inputs that are gathered are those on the current card, and in the case of a show card those on any parent cards. See https://docs.microsoft.com/en-us/adaptive-cards/authoring-cards/input-validation for more details.\n */\nexport class SubmitAction extends Action implements ISubmitAction {\n  type: 'Action.Submit';\n\n  /**\n   * Controls which inputs are associated with the action.\n   */\n  associatedInputs?: AssociatedInputs;\n\n  /**\n   * Initial data that input fields will be combined with. These are essentially ‘hidden’ properties.\n   */\n  data?: MSTeamsData<Record<string, any>>;\n\n  constructor(options: SubmitActionOptions = {}) {\n    super();\n    this.type = 'Action.Submit';\n    Object.assign(this, options);\n  }\n\n  static from(options: Omit<ISubmitAction, 'type'>) {\n    return new SubmitAction(options);\n  }\n\n  withAssociatedInputs(value: AssociatedInputs) {\n    this.associatedInputs = value;\n    return this;\n  }\n\n  withData(value: Record<string, any> = { msteams: {} }) {\n    const { msteams, ...rest } = value;\n    if (!this.data) {\n      this.data = { msteams };\n    }\n\n    Object.assign(this.data, {\n      msteams: {\n        ...this.data.msteams,\n        ...msteams,\n      },\n      ...rest,\n    });\n    return this;\n  }\n}\n\n/**\n * Initial data that input fields will be combined with. These are essentially ‘hidden’ properties.\n */\nexport type MSTeamsData<T> = {\n  /**\n   * Teams specific payload data.\n   */\n  msteams: T;\n\n  /**\n   * Other\n   */\n  [key: string]: any;\n};\n"]}