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AOlB,EAASO,GAG/B,CA+EA,OADA2B,EAAAA,EAAAA,GAAM,oBAAoBC,KAAKC,UAAU7B,MAClCF,EAAUE,EAAWC,WAChC,CAEA6B,OAAAA,GACI/B,KAAKD,UAAY,CAAC,CACtB,E,qBCzHJ,IAJ4B,CACxBS,UAAW,EACXwB,eAAgB,E","sources":["webpack://apexchatwidgets/./widgets/questiontypes/QuestionTypeRendererFactory.js","webpack://apexchatwidgets/./widgets/questiontypes/QuestionTypeVersion.js"],"sourcesContent":["/*\r\n * A factory class used to create renderers for a specific Question type\r\n */\r\nimport QuestionTypeVersion from './QuestionTypeVersion';\r\nimport { ScriptsQuestionType } from '../core/enums/Enum';\r\nimport logIt from '../../logIt';\r\n\r\nexport default class QuestionTypeRendererFactory {\r\n async create(options) {\r\n if (!options) throw 'must specify valid options of QR Renderer to create';\r\n const type = options.msg.questionType;\r\n if (!type && !options.msg.agentScriptDocuments) throw 'must specify which type of QR Renderer to create';\r\n const renderers = this.renderers || (this.renderers = {});\r\n const uniqueness = {\r\n rendererId: `${type}_${options.msg.id}`\r\n };\r\n // if (renderers[uniqueness.rendererId])\r\n // return renderers[uniqueness.rendererId];\r\n if (type == ScriptsQuestionType.TrueOrFalse) {\r\n if (options.version == QuestionTypeVersion.Classical) {\r\n\r\n const module = await import(/* webpackChunkName: \"trueFalseMessageRenderer\" */ './TrueFalseMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n } else {\r\n\r\n const module = await import(/* webpackChunkName: \"rDTrueFalseMessageRenderer\" */ './RDTrueFalseMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n }\r\n } else if (type == ScriptsQuestionType.Text && !ApexChat.options.aiBotEnabled) {\r\n\r\n // if (options.version !== ApexChat.QuestionTypeVersion.Classical) {\r\n // TODO: Proper check required to run the contact info form, I will handle that in integration related ticket\r\n const module = await import(/* webpackChunkName: \"contactInfoMessageRenderer\" */ './ContactInfoMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n // }\r\n } else if (type == ScriptsQuestionType.Text && ApexChat.options.aiBotEnabled) {\r\n const module = await import(/* webpackChunkName: \"userInfoMessageRenderer\" */ './UserInfoMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n // }\r\n }\r\n else if (type == ScriptsQuestionType.AppointmentScheduler) {\r\n\r\n const module = await import(/* webpackChunkName: \"appointmentScheduleRenderer\" */ './AppointmentScheduleRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n } else if (type == ScriptsQuestionType.MultipleChoice) {\r\n if (options.msg.questionTypeDisplayListForVisitor && options.isBottomSheetSupported) {\r\n\r\n const module = await import(/* webpackChunkName: \"mcBottomListMessageRenderer\" */ './MCBottomListMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n } else {\r\n const module = await import(/* webpackChunkName: \"mcListMessageRenderer\" */ './MCListMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n }\r\n } else if (\r\n type == ScriptsQuestionType.TimeCalendar ||\r\n type == ScriptsQuestionType.CalendarDate ||\r\n type == ScriptsQuestionType.Time\r\n ) {\r\n if (options.isBottomSheetSupported && options.applyNewDateTime) {\r\n\r\n const module = await import(/* webpackChunkName: \"dateTimeBottomListMessageRenderer\" */ './DateTimeBottomListMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n }\r\n } else if (type == ScriptsQuestionType.AllThatApply) {\r\n if (options.msg.questionTypeDisplayListForVisitor && options.isBottomSheetSupported) {\r\n\r\n const module = await import(/* webpackChunkName: \"ataBottomListMessageRenderer\" */ './ATABottomListMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n } else {\r\n\r\n const module = await import(/* webpackChunkName: \"ataMessageRenderer\" */ './ATAMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n }\r\n } else if (type == ScriptsQuestionType.VideoGreet) {\r\n\r\n const module = await import(/* webpackChunkName: \"greetVideoRenderer\" */ './GreetVideoRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n\r\n } else if (type === ScriptsQuestionType.None) { // QT None renderer in files/documents attached case\r\n\r\n const module = await import(/* webpackChunkName: \"guestionTypeNoneRenderer\" */ './QuestionTypeNoneRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n } else if (type === ScriptsQuestionType.ContinueChat) {\r\n\r\n const module = await import(/* webpackChunkName: \"questionTypeContinueToChatRenderer\" */ './QuestionTypeContinueToChatRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n } else {\r\n // return default renderer if type is not known Or is of type: Plain text\r\n const module = await import(/* webpackChunkName: \"qtMessageRenderer\" */ './QTMessageRenderer')\r\n renderers[uniqueness.rendererId] = new module.default(\r\n Object.assign(options, uniqueness)\r\n );\r\n }\r\n logIt(`renderer created:${JSON.stringify(uniqueness)}`);\r\n return renderers[uniqueness.rendererId];\r\n }\r\n\r\n destroy() {\r\n this.renderers = {};\r\n }\r\n}\r\n","const QuestionTypeVersion = {\r\n Classical: 0,\r\n RoundedDynamic: 1\r\n};\r\nexport default QuestionTypeVersion;\r\n"],"names":["QuestionTypeRendererFactory","create","options","type","msg","questionType","agentScriptDocuments","renderers","this","uniqueness","rendererId","id","ScriptsQuestionType","TrueOrFalse","version","QuestionTypeVersion","Classical","module","default","Object","assign","Text","ApexChat","aiBotEnabled","AppointmentScheduler","MultipleChoice","questionTypeDisplayListForVisitor","isBottomSheetSupported","TimeCalendar","CalendarDate","Time","applyNewDateTime","AllThatApply","VideoGreet","None","ContinueChat","logIt","JSON","stringify","destroy","RoundedDynamic"],"sourceRoot":""}