{"version":3,"sources":["node_modules/dayjs/plugin/utc.js","node_modules/dayjs/plugin/calendar.js","node_modules/highlight.js/lib/core.js","libs/galaxy/ai-icon/src/ai-icon-svg-string.ts","libs/galaxy/ai-icon/src/ai-icon.service.ts","libs/galaxy/contact-info-card/src/contact-info-on-hover/contact-info-on-hover.directive.ts","libs/galaxy/contact-info-card/src/contact-info-card/contact-info-card.component.ts","libs/galaxy/contact-info-card/src/contact-info-card/contact-info-card.component.html","libs/galaxy/contact-info-card/src/contact-info-card.module.ts","libs/conversation/inbox/src/inbox-ai/inbox-ai-button/inbox-ai-button.component.ts","libs/conversation/inbox/src/inbox-ai/inbox-ai-button/inbox-ai-button.component.html","libs/galaxy/chat-composer/src/chat-composer.component.ts","libs/galaxy/chat-composer/src/chat-composer.component.html","libs/galaxy/chat-composer/src/directives/chat-composer-actions.directive.ts","libs/galaxy/chat-composer/src/directives/chat-composer-action-button.directive.ts","libs/galaxy/chat-composer/src/directives/chat-composer-beside-send.directive.ts","libs/galaxy/chat-composer/src/chat-composer.module.ts","libs/galaxy/nav-layout/src/nav-layout.module.ts","libs/galaxy/page-nav/src/page-nav.module.ts","libs/conversation/core/src/lib/inbox-terms-of-service.service.ts","node_modules/@vendasta/customer-voice-service/fesm2020/vendasta-customer-voice-service.mjs","libs/conversation/core/src/lib/listing.service.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-upload-file/inbox-upload.service.ts","libs/conversation/pipes/src/conversation.pipe.ts","libs/conversation/pipes/src/firebase-timestamp-to-date.ts","libs/conversation/pipes/src/in-array.pipe.ts","libs/conversation/pipes/src/message.pipes.ts","libs/conversation/pipes/src/ticket-pane.pipe.ts","libs/conversation/pipes/src/timestamp.pipe.ts","libs/conversation/pipes/src/views.pipe.ts","libs/conversation/pipes/src/pipes.module.ts","libs/conversation/ui/src/components/inbox-conversation-preview/inbox-conversation-preview.component.ts","libs/conversation/ui/src/components/inbox-conversation-preview/inbox-conversation-preview.component.html","libs/conversation/ui/src/components/inbox-conversation-title/inbox-conversation-title.component.ts","libs/conversation/ui/src/components/inbox-conversation-title/inbox-conversation-title.component.html","libs/conversation/core/src/lib/view.service.ts","libs/conversation/core/src/lib/conversation-list.service.ts","libs/conversation/ui/src/constants.ts","libs/conversation/ui/src/components/inbox-pane/inbox-pane.component.ts","libs/conversation/ui/src/components/inbox-pane/inbox-pane.component.html","libs/conversation/ui/src/components/inbox-views-empty/inbox-views-empty.component.ts","libs/conversation/ui/src/components/inbox-views-empty/inbox-views-empty.component.html","libs/conversation/ui/src/components/inbox-zero/inbox-zero.component.ts","libs/conversation/ui/src/components/inbox-zero/inbox-zero.component.html","node_modules/ngx-cookie-service/fesm2020/ngx-cookie-service.mjs","libs/conversation/core/src/lib/inbox-notification.service.ts","libs/conversation/ui/src/components/inbox-views/inbox-views.component.ts","libs/conversation/ui/src/components/inbox-views/inbox-views.component.html","libs/conversation/ui/src/components/inbox-select-contact/inbox-select-contact.component.ts","libs/conversation/ui/src/components/inbox-select-contact/inbox-select-contact.component.html","node_modules/@vendasta/google-my-business/fesm2020/vendasta-google-my-business.mjs","libs/conversation/core/src/lib/channels/conversation-channel.abstract.ts","libs/conversation/core/src/lib/channels/conversation-google.service.ts","libs/conversation/core/src/lib/channels/alert-helpers.ts","libs/conversation/core/src/lib/channels/conversation-webchat.service.ts","libs/conversation/ui/src/components/inbox-welcome/inbox-welcome.component.ts","libs/conversation/ui/src/components/inbox-welcome/inbox-welcome.component.html","libs/conversation/ui/src/conversation-ui.routing.ts","libs/conversation/ui/src/guards/sms-access.guard.ts","libs/conversation/ui/src/guards/web-chat-access.guard.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-insert-payment-link/inbox-insert-payment-link-form.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-insert-payment-link/inbox-insert-payment-link-form.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-insert-payment-link/inbox-insert-payment-link.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-insert-review-link/inbox-insert-review-link.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-insert-review-link/inbox-insert-review-link.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-insert-template/inbox-insert-template.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-insert-template/inbox-insert-template.component.html","libs/conversation/core/src/lib/types.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-upload-file/inbox-upload-file.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-upload-file/inbox-upload-file.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-message-text/inbox-message-text.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-message-text/inbox-message-text.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages/media-dialog.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages/media-dialog.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages/response-evaluation-dialog.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages/response-evaluation-dialog.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages/inbox-messages.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages/inbox-messages.component.html","libs/conversation/ui/src/pages/inbox-ai-chat/inbox-ai-chat.component.ts","libs/conversation/ui/src/pages/inbox-ai-chat/inbox-ai-chat.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-ticket-card/inbox-ticket-card.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-ticket-card/inbox-ticket-card.component.html","node_modules/@vendasta/support/fesm2020/vendasta-support.mjs","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-ticket/ticket-info.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-ticket/inbox-ticket-list.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-ticket/inbox-ticket-list.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-ticket/inbox-ticket.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-ticket/inbox-ticket.component.html","libs/conversation/ui/src/components/inbox-conversation-assignee/inbox-conversation-assignee.component.ts","libs/conversation/ui/src/components/inbox-conversation-assignee/inbox-conversation-assignee.component.html","libs/conversation/ui/src/components/inbox-conversation-subtitle/inbox-conversation-subtitle.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-info-drawer.service.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages-top-bar/summarize-conversation-dialog.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages-top-bar/summarize-conversation-dialog.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages-top-bar/inbox-messages-top-bar.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-messages-top-bar/inbox-messages-top-bar.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-terms-of-service/inbox-terms-of-service.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-terms-of-service/inbox-terms-of-service.component.html","libs/conversation/ui/src/pages/inbox-chat/inbox-chat.component.ts","libs/conversation/ui/src/pages/inbox-chat/inbox-chat.component.html","libs/conversation/ui/src/pages/inbox-create-contact/create-contact-form.component.ts","libs/conversation/ui/src/pages/inbox-create-contact/create-contact-form.component.html","node_modules/@vendasta/contacts/fesm2020/vendasta-contacts.mjs","libs/conversation/ui/src/pages/inbox-new-message/inbox-new-message.component.ts","libs/conversation/ui/src/pages/inbox-new-message/inbox-new-message.component.html","libs/conversation/ui/src/pages/inbox-send-message/inbox-send-message.resolver.ts","libs/conversation/ui/src/i18n/assets/en_devel.json","libs/conversation/ui/src/translation-module.ts","libs/conversation/ui/src/conversation-ui.module.ts","libs/conversation/inbox/src/inbox-ai/inbox-ai-overlay/inbox-ai-overlay.component.ts","libs/conversation/inbox/src/inbox-ai/inbox-ai-overlay/inbox-ai-overlay.component.html","libs/conversation/inbox/src/inbox-alert-banner/inbox-alert-banner.component.ts","libs/conversation/inbox/src/inbox-alert-banner/inbox-alert-banner.component.html","libs/conversation/inbox/src/inbox-button/inbox-button.component.ts","libs/conversation/inbox/src/inbox-button/inbox-button.component.html","libs/conversation/inbox/src/inbox-container/inbox-container.component.ts","libs/conversation/inbox/src/inbox-container/inbox-container.component.html","libs/conversation/inbox/src/inbox/inbox.component.ts","libs/conversation/inbox/src/inbox/inbox.component.html","libs/conversation/ui/src/pages/inbox-home/inbox-home.component.ts","libs/conversation/ui/src/pages/inbox-home/inbox-home.component.html","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/conversation-details/conversation-details.component.ts","libs/conversation/ui/src/pages/inbox-chat/components/inbox-info-pane/conversation-details/conversation-details.component.html","libs/conversation/inbox/src/wrappers/types.ts","libs/conversation/inbox/src/wrappers/chat.component.ts","libs/conversation/inbox/src/wrappers/chat.component.html","libs/conversation/inbox/src/wrappers/create-contact.component.ts","libs/conversation/inbox/src/wrappers/new-message.component.ts","libs/conversation/inbox/src/inbox-preview/inbox-preview.component.ts","libs/conversation/inbox/src/inbox-preview/inbox-preview.component.html","libs/conversation/inbox/src/settings/email-configuration/email-forwarding-info/email-forwarding-info.component.ts","libs/conversation/inbox/src/settings/email-configuration/email-forwarding-info/email-forwarding-info.component.html","libs/conversation/inbox/src/settings/email-configuration/email-settings-card.component.ts","libs/conversation/inbox/src/settings/email-configuration/email-settings-card.component.html","node_modules/@vendasta/facebook/fesm2020/vendasta-facebook.mjs","libs/conversation/inbox/src/settings/facebook-messenger/facebook-messenger.service.ts","libs/conversation/core/src/lib/mobile.ts","node_modules/@capacitor/browser/dist/esm/index.js","node_modules/@vendasta/domain/fesm2020/vendasta-domain.mjs","libs/conversation/inbox/src/settings/manage-on-web/manage-on-web.component.ts","libs/conversation/inbox/src/settings/manage-on-web/manage-on-web.component.html","libs/conversation/inbox/src/settings/facebook-messenger/facebook-messenger.component.ts","libs/conversation/inbox/src/settings/facebook-messenger/facebook-messenger.component.html","libs/conversation/inbox/src/settings/google-business-communication-card/google-business-connections.service.ts","libs/conversation/inbox/src/settings/google-business-communication-card/google-business-communication-card.component.ts","libs/conversation/inbox/src/settings/google-business-communication-card/google-business-communication-card.component.html","node_modules/@vendasta/instagram/fesm2020/vendasta-instagram.mjs","libs/conversation/inbox/src/settings/instagram-messages/instagram-messages.service.ts","libs/conversation/inbox/src/settings/instagram-messages/instagram-messages.component.ts","libs/conversation/inbox/src/settings/instagram-messages/instagram-messages.component.html","libs/conversation/inbox/src/settings/webchat-configuration/webchat-learn-more/webchat-learn-more.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/webchat-learn-more/webchat-learn-more.component.html","libs/conversation/inbox/src/settings/webchat-configuration/webchat-config-card/webchat-config-card.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/webchat-config-card/webchat-config-card.component.html","libs/conversation/inbox/src/settings/settings.component.ts","libs/conversation/inbox/src/settings/settings.component.html","libs/conversation/ui/src/guards/settings-access.guard.ts","libs/conversation/inbox/src/components/sticky-footer/sticky-footer.component.ts","libs/conversation/inbox/src/components/sticky-footer/sticky-footer.component.html","libs/conversation/inbox/src/settings/webchat-configuration/constants.ts","node_modules/@vendasta/embeddings/fesm2020/vendasta-embeddings.mjs","libs/ai-knowledge/src/lib/tokens.ts","libs/ai-knowledge/src/lib/ai-knowledge.service.ts","libs/ai-knowledge/src/lib/assets/i18n/en_devel.json","libs/ai-knowledge/src/lib/assets/i18n/ai-knowledge-i18n.module.ts","libs/ai-knowledge/src/lib/apps-for-knowledge-source/apps-for-knowledge-source.component.ts","libs/ai-knowledge/src/lib/apps-for-knowledge-source/apps-for-knowledge-source.component.html","libs/ai-knowledge/src/lib/learn-more-business-profile/learn-more-business-profile.component.ts","libs/ai-knowledge/src/lib/learn-more-business-profile/learn-more-business-profile.component.html","libs/ai-knowledge/src/lib/knowledge-list/knowledge-list.component.ts","libs/ai-knowledge/src/lib/knowledge-list/knowledge-list.component.html","libs/ai-knowledge/src/lib/knowledge-editor/common/common-knowledge-source-editor.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/custom-data/custom-data.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/custom-data/custom-data.component.html","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/scraped-pages/scraped-pages.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/scraped-pages/scraped-pages.component.html","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/website-scrape.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/website-scrape/website-scrape.component.html","libs/ai-knowledge/src/lib/knowledge-editor/add-knowledge/add-knowledge.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/add-knowledge/add-knowledge.component.html","libs/ai-knowledge/src/lib/knowledge-editor/knowledge-editor.component.ts","libs/ai-knowledge/src/lib/knowledge-editor/knowledge-editor.component.html","libs/ai-knowledge/src/lib/application-knowledge-control/application-knowledge.component.ts","libs/ai-knowledge/src/lib/application-knowledge-control/application-knowledge.component.html","libs/conversation/inbox/src/settings/webchat-configuration/webchat-form/webchat-form.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/webchat-form/webchat-form.component.html","libs/conversation/inbox/src/settings/webchat-configuration/new-webchat/new-webchat.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/new-webchat/new-webchat.component.html","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/webchat-install-instructions-dialog.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/webchat-install-instructions-dialog.component.html","node_modules/highlight.js/es/core.js","node_modules/highlight.js/es/languages/javascript.js","node_modules/highlight.js/es/languages/xml.js","libs/galaxy/code-sample/src/code-sample.component.ts","libs/galaxy/code-sample/src/code-sample.component.html","node_modules/@capacitor/filesystem/dist/esm/index.js","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/web-chat-instructions.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/web-chat-instructions/web-chat-instructions.component.html","libs/conversation/inbox/src/settings/webchat-configuration/show-webchat/show-webchat.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/show-webchat/show-webchat.component.html","libs/conversation/inbox/src/settings/webchat-configuration/edit-webchat/edit-webchat.component.ts","libs/conversation/inbox/src/settings/webchat-configuration/edit-webchat/edit-webchat.component.html","libs/conversation/inbox/src/lib.routes.ts","libs/conversation/inbox/src/settings/message-templates/list-message-templates.component.ts","libs/conversation/inbox/src/settings/message-templates/list-message-templates.component.html","libs/conversation/inbox/src/settings/sms-configuration/sms-configuration.component.ts","libs/conversation/inbox/src/settings/sms-configuration/sms-configuration.component.html"],"sourcesContent":["!function (t, i) {\n \"object\" == typeof exports && \"undefined\" != typeof module ? module.exports = i() : \"function\" == typeof define && define.amd ? define(i) : (t = \"undefined\" != typeof globalThis ? globalThis : t || self).dayjs_plugin_utc = i();\n}(this, function () {\n \"use strict\";\n\n var t = \"minute\",\n i = /[+-]\\d\\d(?::?\\d\\d)?/g,\n e = /([+-]|\\d\\d)/g;\n return function (s, f, n) {\n var u = f.prototype;\n n.utc = function (t) {\n var i = {\n date: t,\n utc: !0,\n args: arguments\n };\n return new f(i);\n }, u.utc = function (i) {\n var e = n(this.toDate(), {\n locale: this.$L,\n utc: !0\n });\n return i ? e.add(this.utcOffset(), t) : e;\n }, u.local = function () {\n return n(this.toDate(), {\n locale: this.$L,\n utc: !1\n });\n };\n var o = u.parse;\n u.parse = function (t) {\n t.utc && (this.$u = !0), this.$utils().u(t.$offset) || (this.$offset = t.$offset), o.call(this, t);\n };\n var r = u.init;\n u.init = function () {\n if (this.$u) {\n var t = this.$d;\n this.$y = t.getUTCFullYear(), this.$M = t.getUTCMonth(), this.$D = t.getUTCDate(), this.$W = t.getUTCDay(), this.$H = t.getUTCHours(), this.$m = t.getUTCMinutes(), this.$s = t.getUTCSeconds(), this.$ms = t.getUTCMilliseconds();\n } else r.call(this);\n };\n var a = u.utcOffset;\n u.utcOffset = function (s, f) {\n var n = this.$utils().u;\n if (n(s)) return this.$u ? 0 : n(this.$offset) ? a.call(this) : this.$offset;\n if (\"string\" == typeof s && (s = function (t) {\n void 0 === t && (t = \"\");\n var s = t.match(i);\n if (!s) return null;\n var f = (\"\" + s[0]).match(e) || [\"-\", 0, 0],\n n = f[0],\n u = 60 * +f[1] + +f[2];\n return 0 === u ? 0 : \"+\" === n ? u : -u;\n }(s), null === s)) return this;\n var u = Math.abs(s) <= 16 ? 60 * s : s,\n o = this;\n if (f) return o.$offset = u, o.$u = 0 === s, o;\n if (0 !== s) {\n var r = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();\n (o = this.local().add(u + r, t)).$offset = u, o.$x.$localOffset = r;\n } else o = this.utc();\n return o;\n };\n var h = u.format;\n u.format = function (t) {\n var i = t || (this.$u ? \"YYYY-MM-DDTHH:mm:ss[Z]\" : \"\");\n return h.call(this, i);\n }, u.valueOf = function () {\n var t = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());\n return this.$d.valueOf() - 6e4 * t;\n }, u.isUTC = function () {\n return !!this.$u;\n }, u.toISOString = function () {\n return this.toDate().toISOString();\n }, u.toString = function () {\n return this.toDate().toUTCString();\n };\n var l = u.toDate;\n u.toDate = function (t) {\n return \"s\" === t && this.$offset ? n(this.format(\"YYYY-MM-DD HH:mm:ss:SSS\")).toDate() : l.call(this);\n };\n var c = u.diff;\n u.diff = function (t, i, e) {\n if (t && this.$u === t.$u) return c.call(this, t, i, e);\n var s = this.local(),\n f = n(t).local();\n return c.call(s, f, i, e);\n };\n };\n});","!function (e, t) {\n \"object\" == typeof exports && \"undefined\" != typeof module ? module.exports = t() : \"function\" == typeof define && define.amd ? define(t) : (e = \"undefined\" != typeof globalThis ? globalThis : e || self).dayjs_plugin_calendar = t();\n}(this, function () {\n \"use strict\";\n\n return function (e, t, a) {\n var n = \"h:mm A\",\n d = {\n lastDay: \"[Yesterday at] \" + n,\n sameDay: \"[Today at] \" + n,\n nextDay: \"[Tomorrow at] \" + n,\n nextWeek: \"dddd [at] \" + n,\n lastWeek: \"[Last] dddd [at] \" + n,\n sameElse: \"MM/DD/YYYY\"\n };\n t.prototype.calendar = function (e, t) {\n var n = t || this.$locale().calendar || d,\n o = a(e || void 0).startOf(\"d\"),\n s = this.diff(o, \"d\", !0),\n i = \"sameElse\",\n f = s < -6 ? i : s < -1 ? \"lastWeek\" : s < 0 ? \"lastDay\" : s < 1 ? \"sameDay\" : s < 2 ? \"nextDay\" : s < 7 ? \"nextWeek\" : i,\n l = n[f] || d[f];\n return \"function\" == typeof l ? l.call(this, a()) : this.format(l);\n };\n };\n});","/* eslint-disable no-multi-assign */\n\nfunction deepFreeze(obj) {\n if (obj instanceof Map) {\n obj.clear = obj.delete = obj.set = function () {\n throw new Error('map is read-only');\n };\n } else if (obj instanceof Set) {\n obj.add = obj.clear = obj.delete = function () {\n throw new Error('set is read-only');\n };\n }\n\n // Freeze self\n Object.freeze(obj);\n Object.getOwnPropertyNames(obj).forEach(name => {\n const prop = obj[name];\n const type = typeof prop;\n\n // Freeze prop if it is an object or function and also not already frozen\n if ((type === 'object' || type === 'function') && !Object.isFrozen(prop)) {\n deepFreeze(prop);\n }\n });\n return obj;\n}\n\n/** @typedef {import('highlight.js').CallbackResponse} CallbackResponse */\n/** @typedef {import('highlight.js').CompiledMode} CompiledMode */\n/** @implements CallbackResponse */\n\nclass Response {\n /**\n * @param {CompiledMode} mode\n */\n constructor(mode) {\n // eslint-disable-next-line no-undefined\n if (mode.data === undefined) mode.data = {};\n this.data = mode.data;\n this.isMatchIgnored = false;\n }\n ignoreMatch() {\n this.isMatchIgnored = true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {string}\n */\nfunction escapeHTML(value) {\n return value.replace(/&/g, '&').replace(//g, '>').replace(/\"/g, '"').replace(/'/g, ''');\n}\n\n/**\n * performs a shallow merge of multiple objects into one\n *\n * @template T\n * @param {T} original\n * @param {Record[]} objects\n * @returns {T} a single new object\n */\nfunction inherit$1(original, ...objects) {\n /** @type Record */\n const result = Object.create(null);\n for (const key in original) {\n result[key] = original[key];\n }\n objects.forEach(function (obj) {\n for (const key in obj) {\n result[key] = obj[key];\n }\n });\n return /** @type {T} */result;\n}\n\n/**\n * @typedef {object} Renderer\n * @property {(text: string) => void} addText\n * @property {(node: Node) => void} openNode\n * @property {(node: Node) => void} closeNode\n * @property {() => string} value\n */\n\n/** @typedef {{scope?: string, language?: string, sublanguage?: boolean}} Node */\n/** @typedef {{walk: (r: Renderer) => void}} Tree */\n/** */\n\nconst SPAN_CLOSE = '';\n\n/**\n * Determines if a node needs to be wrapped in \n *\n * @param {Node} node */\nconst emitsWrappingTags = node => {\n // rarely we can have a sublanguage where language is undefined\n // TODO: track down why\n return !!node.scope;\n};\n\n/**\n *\n * @param {string} name\n * @param {{prefix:string}} options\n */\nconst scopeToCSSClass = (name, {\n prefix\n}) => {\n // sub-language\n if (name.startsWith(\"language:\")) {\n return name.replace(\"language:\", \"language-\");\n }\n // tiered scope: comment.line\n if (name.includes(\".\")) {\n const pieces = name.split(\".\");\n return [`${prefix}${pieces.shift()}`, ...pieces.map((x, i) => `${x}${\"_\".repeat(i + 1)}`)].join(\" \");\n }\n // simple scope\n return `${prefix}${name}`;\n};\n\n/** @type {Renderer} */\nclass HTMLRenderer {\n /**\n * Creates a new HTMLRenderer\n *\n * @param {Tree} parseTree - the parse tree (must support `walk` API)\n * @param {{classPrefix: string}} options\n */\n constructor(parseTree, options) {\n this.buffer = \"\";\n this.classPrefix = options.classPrefix;\n parseTree.walk(this);\n }\n\n /**\n * Adds texts to the output stream\n *\n * @param {string} text */\n addText(text) {\n this.buffer += escapeHTML(text);\n }\n\n /**\n * Adds a node open to the output stream (if needed)\n *\n * @param {Node} node */\n openNode(node) {\n if (!emitsWrappingTags(node)) return;\n const className = scopeToCSSClass(node.scope, {\n prefix: this.classPrefix\n });\n this.span(className);\n }\n\n /**\n * Adds a node close to the output stream (if needed)\n *\n * @param {Node} node */\n closeNode(node) {\n if (!emitsWrappingTags(node)) return;\n this.buffer += SPAN_CLOSE;\n }\n\n /**\n * returns the accumulated buffer\n */\n value() {\n return this.buffer;\n }\n\n // helpers\n\n /**\n * Builds a span element\n *\n * @param {string} className */\n span(className) {\n this.buffer += ``;\n }\n}\n\n/** @typedef {{scope?: string, language?: string, children: Node[]} | string} Node */\n/** @typedef {{scope?: string, language?: string, children: Node[]} } DataNode */\n/** @typedef {import('highlight.js').Emitter} Emitter */\n/** */\n\n/** @returns {DataNode} */\nconst newNode = (opts = {}) => {\n /** @type DataNode */\n const result = {\n children: []\n };\n Object.assign(result, opts);\n return result;\n};\nclass TokenTree {\n constructor() {\n /** @type DataNode */\n this.rootNode = newNode();\n this.stack = [this.rootNode];\n }\n get top() {\n return this.stack[this.stack.length - 1];\n }\n get root() {\n return this.rootNode;\n }\n\n /** @param {Node} node */\n add(node) {\n this.top.children.push(node);\n }\n\n /** @param {string} scope */\n openNode(scope) {\n /** @type Node */\n const node = newNode({\n scope\n });\n this.add(node);\n this.stack.push(node);\n }\n closeNode() {\n if (this.stack.length > 1) {\n return this.stack.pop();\n }\n // eslint-disable-next-line no-undefined\n return undefined;\n }\n closeAllNodes() {\n while (this.closeNode());\n }\n toJSON() {\n return JSON.stringify(this.rootNode, null, 4);\n }\n\n /**\n * @typedef { import(\"./html_renderer\").Renderer } Renderer\n * @param {Renderer} builder\n */\n walk(builder) {\n // this does not\n return this.constructor._walk(builder, this.rootNode);\n // this works\n // return TokenTree._walk(builder, this.rootNode);\n }\n\n /**\n * @param {Renderer} builder\n * @param {Node} node\n */\n static _walk(builder, node) {\n if (typeof node === \"string\") {\n builder.addText(node);\n } else if (node.children) {\n builder.openNode(node);\n node.children.forEach(child => this._walk(builder, child));\n builder.closeNode(node);\n }\n return builder;\n }\n\n /**\n * @param {Node} node\n */\n static _collapse(node) {\n if (typeof node === \"string\") return;\n if (!node.children) return;\n if (node.children.every(el => typeof el === \"string\")) {\n // node.text = node.children.join(\"\");\n // delete node.children;\n node.children = [node.children.join(\"\")];\n } else {\n node.children.forEach(child => {\n TokenTree._collapse(child);\n });\n }\n }\n}\n\n/**\n Currently this is all private API, but this is the minimal API necessary\n that an Emitter must implement to fully support the parser.\n\n Minimal interface:\n\n - addText(text)\n - __addSublanguage(emitter, subLanguageName)\n - startScope(scope)\n - endScope()\n - finalize()\n - toHTML()\n\n*/\n\n/**\n * @implements {Emitter}\n */\nclass TokenTreeEmitter extends TokenTree {\n /**\n * @param {*} options\n */\n constructor(options) {\n super();\n this.options = options;\n }\n\n /**\n * @param {string} text\n */\n addText(text) {\n if (text === \"\") {\n return;\n }\n this.add(text);\n }\n\n /** @param {string} scope */\n startScope(scope) {\n this.openNode(scope);\n }\n endScope() {\n this.closeNode();\n }\n\n /**\n * @param {Emitter & {root: DataNode}} emitter\n * @param {string} name\n */\n __addSublanguage(emitter, name) {\n /** @type DataNode */\n const node = emitter.root;\n if (name) node.scope = `language:${name}`;\n this.add(node);\n }\n toHTML() {\n const renderer = new HTMLRenderer(this, this.options);\n return renderer.value();\n }\n finalize() {\n this.closeAllNodes();\n return true;\n }\n}\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction anyNumberOfTimes(re) {\n return concat('(?:', re, ')*');\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction optional(re) {\n return concat('(?:', re, ')?');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map(x => source(x)).join(\"\");\n return joined;\n}\n\n/**\n * @param { Array } args\n * @returns {object}\n */\nfunction stripOptionsFromArgs(args) {\n const opts = args[args.length - 1];\n if (typeof opts === 'object' && opts.constructor === Object) {\n args.splice(args.length - 1, 1);\n return opts;\n } else {\n return {};\n }\n}\n\n/** @typedef { {capture?: boolean} } RegexEitherOptions */\n\n/**\n * Any of the passed expresssions may match\n *\n * Creates a huge this | this | that | that match\n * @param {(RegExp | string)[] | [...(RegExp | string)[], RegexEitherOptions]} args\n * @returns {string}\n */\nfunction either(...args) {\n /** @type { object & {capture?: boolean} } */\n const opts = stripOptionsFromArgs(args);\n const joined = '(' + (opts.capture ? \"\" : \"?:\") + args.map(x => source(x)).join(\"|\") + \")\";\n return joined;\n}\n\n/**\n * @param {RegExp | string} re\n * @returns {number}\n */\nfunction countMatchGroups(re) {\n return new RegExp(re.toString() + '|').exec('').length - 1;\n}\n\n/**\n * Does lexeme start with a regular expression match at the beginning\n * @param {RegExp} re\n * @param {string} lexeme\n */\nfunction startsWith(re, lexeme) {\n const match = re && re.exec(lexeme);\n return match && match.index === 0;\n}\n\n// BACKREF_RE matches an open parenthesis or backreference. To avoid\n// an incorrect parse, it additionally matches the following:\n// - [...] elements, where the meaning of parentheses and escapes change\n// - other escape sequences, so we do not misparse escape sequences as\n// interesting elements\n// - non-matching or lookahead parentheses, which do not capture. These\n// follow the '(' with a '?'.\nconst BACKREF_RE = /\\[(?:[^\\\\\\]]|\\\\.)*\\]|\\(\\??|\\\\([1-9][0-9]*)|\\\\./;\n\n// **INTERNAL** Not intended for outside usage\n// join logically computes regexps.join(separator), but fixes the\n// backreferences so they continue to match.\n// it also places each individual regular expression into it's own\n// match group, keeping track of the sequencing of those match groups\n// is currently an exercise for the caller. :-)\n/**\n * @param {(string | RegExp)[]} regexps\n * @param {{joinWith: string}} opts\n * @returns {string}\n */\nfunction _rewriteBackreferences(regexps, {\n joinWith\n}) {\n let numCaptures = 0;\n return regexps.map(regex => {\n numCaptures += 1;\n const offset = numCaptures;\n let re = source(regex);\n let out = '';\n while (re.length > 0) {\n const match = BACKREF_RE.exec(re);\n if (!match) {\n out += re;\n break;\n }\n out += re.substring(0, match.index);\n re = re.substring(match.index + match[0].length);\n if (match[0][0] === '\\\\' && match[1]) {\n // Adjust the backreference.\n out += '\\\\' + String(Number(match[1]) + offset);\n } else {\n out += match[0];\n if (match[0] === '(') {\n numCaptures++;\n }\n }\n }\n return out;\n }).map(re => `(${re})`).join(joinWith);\n}\n\n/** @typedef {import('highlight.js').Mode} Mode */\n/** @typedef {import('highlight.js').ModeCallback} ModeCallback */\n\n// Common regexps\nconst MATCH_NOTHING_RE = /\\b\\B/;\nconst IDENT_RE = '[a-zA-Z]\\\\w*';\nconst UNDERSCORE_IDENT_RE = '[a-zA-Z_]\\\\w*';\nconst NUMBER_RE = '\\\\b\\\\d+(\\\\.\\\\d+)?';\nconst C_NUMBER_RE = '(-?)(\\\\b0[xX][a-fA-F0-9]+|(\\\\b\\\\d+(\\\\.\\\\d*)?|\\\\.\\\\d+)([eE][-+]?\\\\d+)?)'; // 0x..., 0..., decimal, float\nconst BINARY_NUMBER_RE = '\\\\b(0b[01]+)'; // 0b...\nconst RE_STARTERS_RE = '!|!=|!==|%|%=|&|&&|&=|\\\\*|\\\\*=|\\\\+|\\\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\\\?|\\\\[|\\\\{|\\\\(|\\\\^|\\\\^=|\\\\||\\\\|=|\\\\|\\\\||~';\n\n/**\n* @param { Partial & {binary?: string | RegExp} } opts\n*/\nconst SHEBANG = (opts = {}) => {\n const beginShebang = /^#![ ]*\\//;\n if (opts.binary) {\n opts.begin = concat(beginShebang, /.*\\b/, opts.binary, /\\b.*/);\n }\n return inherit$1({\n scope: 'meta',\n begin: beginShebang,\n end: /$/,\n relevance: 0,\n /** @type {ModeCallback} */\n \"on:begin\": (m, resp) => {\n if (m.index !== 0) resp.ignoreMatch();\n }\n }, opts);\n};\n\n// Common modes\nconst BACKSLASH_ESCAPE = {\n begin: '\\\\\\\\[\\\\s\\\\S]',\n relevance: 0\n};\nconst APOS_STRING_MODE = {\n scope: 'string',\n begin: '\\'',\n end: '\\'',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst QUOTE_STRING_MODE = {\n scope: 'string',\n begin: '\"',\n end: '\"',\n illegal: '\\\\n',\n contains: [BACKSLASH_ESCAPE]\n};\nconst PHRASAL_WORDS_MODE = {\n begin: /\\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\\b/\n};\n/**\n * Creates a comment mode\n *\n * @param {string | RegExp} begin\n * @param {string | RegExp} end\n * @param {Mode | {}} [modeOptions]\n * @returns {Partial}\n */\nconst COMMENT = function (begin, end, modeOptions = {}) {\n const mode = inherit$1({\n scope: 'comment',\n begin,\n end,\n contains: []\n }, modeOptions);\n mode.contains.push({\n scope: 'doctag',\n // hack to avoid the space from being included. the space is necessary to\n // match here to prevent the plain text rule below from gobbling up doctags\n begin: '[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)',\n end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,\n excludeBegin: true,\n relevance: 0\n });\n const ENGLISH_WORD = either(\n // list of common 1 and 2 letter words in English\n \"I\", \"a\", \"is\", \"so\", \"us\", \"to\", \"at\", \"if\", \"in\", \"it\", \"on\",\n // note: this is not an exhaustive list of contractions, just popular ones\n /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,\n // contractions - can't we'd they're let's, etc\n /[A-Za-z]+[-][a-z]+/,\n // `no-way`, etc.\n /[A-Za-z][a-z]{2,}/ // allow capitalized words at beginning of sentences\n );\n // looking like plain text, more likely to be a comment\n mode.contains.push({\n // TODO: how to include \", (, ) without breaking grammars that use these for\n // comment delimiters?\n // begin: /[ ]+([()\"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()\":]?([.][ ]|[ ]|\\))){3}/\n // ---\n\n // this tries to find sequences of 3 english words in a row (without any\n // \"programming\" type syntax) this gives us a strong signal that we've\n // TRULY found a comment - vs perhaps scanning with the wrong language.\n // It's possible to find something that LOOKS like the start of the\n // comment - but then if there is no readable text - good chance it is a\n // false match and not a comment.\n //\n // for a visual example please see:\n // https://github.com/highlightjs/highlight.js/issues/2827\n\n begin: concat(/[ ]+/,\n // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */\n '(', ENGLISH_WORD, /[.]?[:]?([.][ ]|[ ])/, '){3}') // look for 3 words in a row\n });\n return mode;\n};\nconst C_LINE_COMMENT_MODE = COMMENT('//', '$');\nconst C_BLOCK_COMMENT_MODE = COMMENT('/\\\\*', '\\\\*/');\nconst HASH_COMMENT_MODE = COMMENT('#', '$');\nconst NUMBER_MODE = {\n scope: 'number',\n begin: NUMBER_RE,\n relevance: 0\n};\nconst C_NUMBER_MODE = {\n scope: 'number',\n begin: C_NUMBER_RE,\n relevance: 0\n};\nconst BINARY_NUMBER_MODE = {\n scope: 'number',\n begin: BINARY_NUMBER_RE,\n relevance: 0\n};\nconst REGEXP_MODE = {\n scope: \"regexp\",\n begin: /\\/(?=[^/\\n]*\\/)/,\n end: /\\/[gimuy]*/,\n contains: [BACKSLASH_ESCAPE, {\n begin: /\\[/,\n end: /\\]/,\n relevance: 0,\n contains: [BACKSLASH_ESCAPE]\n }]\n};\nconst TITLE_MODE = {\n scope: 'title',\n begin: IDENT_RE,\n relevance: 0\n};\nconst UNDERSCORE_TITLE_MODE = {\n scope: 'title',\n begin: UNDERSCORE_IDENT_RE,\n relevance: 0\n};\nconst METHOD_GUARD = {\n // excludes method names from keyword processing\n begin: '\\\\.\\\\s*' + UNDERSCORE_IDENT_RE,\n relevance: 0\n};\n\n/**\n * Adds end same as begin mechanics to a mode\n *\n * Your mode must include at least a single () match group as that first match\n * group is what is used for comparison\n * @param {Partial} mode\n */\nconst END_SAME_AS_BEGIN = function (mode) {\n return Object.assign(mode, {\n /** @type {ModeCallback} */\n 'on:begin': (m, resp) => {\n resp.data._beginMatch = m[1];\n },\n /** @type {ModeCallback} */\n 'on:end': (m, resp) => {\n if (resp.data._beginMatch !== m[1]) resp.ignoreMatch();\n }\n });\n};\nvar MODES = /*#__PURE__*/Object.freeze({\n __proto__: null,\n APOS_STRING_MODE: APOS_STRING_MODE,\n BACKSLASH_ESCAPE: BACKSLASH_ESCAPE,\n BINARY_NUMBER_MODE: BINARY_NUMBER_MODE,\n BINARY_NUMBER_RE: BINARY_NUMBER_RE,\n COMMENT: COMMENT,\n C_BLOCK_COMMENT_MODE: C_BLOCK_COMMENT_MODE,\n C_LINE_COMMENT_MODE: C_LINE_COMMENT_MODE,\n C_NUMBER_MODE: C_NUMBER_MODE,\n C_NUMBER_RE: C_NUMBER_RE,\n END_SAME_AS_BEGIN: END_SAME_AS_BEGIN,\n HASH_COMMENT_MODE: HASH_COMMENT_MODE,\n IDENT_RE: IDENT_RE,\n MATCH_NOTHING_RE: MATCH_NOTHING_RE,\n METHOD_GUARD: METHOD_GUARD,\n NUMBER_MODE: NUMBER_MODE,\n NUMBER_RE: NUMBER_RE,\n PHRASAL_WORDS_MODE: PHRASAL_WORDS_MODE,\n QUOTE_STRING_MODE: QUOTE_STRING_MODE,\n REGEXP_MODE: REGEXP_MODE,\n RE_STARTERS_RE: RE_STARTERS_RE,\n SHEBANG: SHEBANG,\n TITLE_MODE: TITLE_MODE,\n UNDERSCORE_IDENT_RE: UNDERSCORE_IDENT_RE,\n UNDERSCORE_TITLE_MODE: UNDERSCORE_TITLE_MODE\n});\n\n/**\n@typedef {import('highlight.js').CallbackResponse} CallbackResponse\n@typedef {import('highlight.js').CompilerExt} CompilerExt\n*/\n\n// Grammar extensions / plugins\n// See: https://github.com/highlightjs/highlight.js/issues/2833\n\n// Grammar extensions allow \"syntactic sugar\" to be added to the grammar modes\n// without requiring any underlying changes to the compiler internals.\n\n// `compileMatch` being the perfect small example of now allowing a grammar\n// author to write `match` when they desire to match a single expression rather\n// than being forced to use `begin`. The extension then just moves `match` into\n// `begin` when it runs. Ie, no features have been added, but we've just made\n// the experience of writing (and reading grammars) a little bit nicer.\n\n// ------\n\n// TODO: We need negative look-behind support to do this properly\n/**\n * Skip a match if it has a preceding dot\n *\n * This is used for `beginKeywords` to prevent matching expressions such as\n * `bob.keyword.do()`. The mode compiler automatically wires this up as a\n * special _internal_ 'on:begin' callback for modes with `beginKeywords`\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\nfunction skipIfHasPrecedingDot(match, response) {\n const before = match.input[match.index - 1];\n if (before === \".\") {\n response.ignoreMatch();\n }\n}\n\n/**\n *\n * @type {CompilerExt}\n */\nfunction scopeClassName(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.className !== undefined) {\n mode.scope = mode.className;\n delete mode.className;\n }\n}\n\n/**\n * `beginKeywords` syntactic sugar\n * @type {CompilerExt}\n */\nfunction beginKeywords(mode, parent) {\n if (!parent) return;\n if (!mode.beginKeywords) return;\n\n // for languages with keywords that include non-word characters checking for\n // a word boundary is not sufficient, so instead we check for a word boundary\n // or whitespace - this does no harm in any case since our keyword engine\n // doesn't allow spaces in keywords anyways and we still check for the boundary\n // first\n mode.begin = '\\\\b(' + mode.beginKeywords.split(' ').join('|') + ')(?!\\\\.)(?=\\\\b|\\\\s)';\n mode.__beforeBegin = skipIfHasPrecedingDot;\n mode.keywords = mode.keywords || mode.beginKeywords;\n delete mode.beginKeywords;\n\n // prevents double relevance, the keywords themselves provide\n // relevance, the mode doesn't need to double it\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 0;\n}\n\n/**\n * Allow `illegal` to contain an array of illegal values\n * @type {CompilerExt}\n */\nfunction compileIllegal(mode, _parent) {\n if (!Array.isArray(mode.illegal)) return;\n mode.illegal = either(...mode.illegal);\n}\n\n/**\n * `match` to match a single expression for readability\n * @type {CompilerExt}\n */\nfunction compileMatch(mode, _parent) {\n if (!mode.match) return;\n if (mode.begin || mode.end) throw new Error(\"begin & end are not supported with match\");\n mode.begin = mode.match;\n delete mode.match;\n}\n\n/**\n * provides the default 1 relevance to all modes\n * @type {CompilerExt}\n */\nfunction compileRelevance(mode, _parent) {\n // eslint-disable-next-line no-undefined\n if (mode.relevance === undefined) mode.relevance = 1;\n}\n\n// allow beforeMatch to act as a \"qualifier\" for the match\n// the full match begin must be [beforeMatch][begin]\nconst beforeMatchExt = (mode, parent) => {\n if (!mode.beforeMatch) return;\n // starts conflicts with endsParent which we need to make sure the child\n // rule is not matched multiple times\n if (mode.starts) throw new Error(\"beforeMatch cannot be used with starts\");\n const originalMode = Object.assign({}, mode);\n Object.keys(mode).forEach(key => {\n delete mode[key];\n });\n mode.keywords = originalMode.keywords;\n mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));\n mode.starts = {\n relevance: 0,\n contains: [Object.assign(originalMode, {\n endsParent: true\n })]\n };\n mode.relevance = 0;\n delete originalMode.beforeMatch;\n};\n\n// keywords that should have no default relevance value\nconst COMMON_KEYWORDS = ['of', 'and', 'for', 'in', 'not', 'or', 'if', 'then', 'parent',\n// common variable name\n'list',\n// common variable name\n'value' // common variable name\n];\nconst DEFAULT_KEYWORD_SCOPE = \"keyword\";\n\n/**\n * Given raw keywords from a language definition, compile them.\n *\n * @param {string | Record | Array} rawKeywords\n * @param {boolean} caseInsensitive\n */\nfunction compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {\n /** @type {import(\"highlight.js/private\").KeywordDict} */\n const compiledKeywords = Object.create(null);\n\n // input can be a string of keywords, an array of keywords, or a object with\n // named keys representing scopeName (which can then point to a string or array)\n if (typeof rawKeywords === 'string') {\n compileList(scopeName, rawKeywords.split(\" \"));\n } else if (Array.isArray(rawKeywords)) {\n compileList(scopeName, rawKeywords);\n } else {\n Object.keys(rawKeywords).forEach(function (scopeName) {\n // collapse all our objects back into the parent object\n Object.assign(compiledKeywords, compileKeywords(rawKeywords[scopeName], caseInsensitive, scopeName));\n });\n }\n return compiledKeywords;\n\n // ---\n\n /**\n * Compiles an individual list of keywords\n *\n * Ex: \"for if when while|5\"\n *\n * @param {string} scopeName\n * @param {Array} keywordList\n */\n function compileList(scopeName, keywordList) {\n if (caseInsensitive) {\n keywordList = keywordList.map(x => x.toLowerCase());\n }\n keywordList.forEach(function (keyword) {\n const pair = keyword.split('|');\n compiledKeywords[pair[0]] = [scopeName, scoreForKeyword(pair[0], pair[1])];\n });\n }\n}\n\n/**\n * Returns the proper score for a given keyword\n *\n * Also takes into account comment keywords, which will be scored 0 UNLESS\n * another score has been manually assigned.\n * @param {string} keyword\n * @param {string} [providedScore]\n */\nfunction scoreForKeyword(keyword, providedScore) {\n // manual scores always win over common keywords\n // so you can force a score of 1 if you really insist\n if (providedScore) {\n return Number(providedScore);\n }\n return commonKeyword(keyword) ? 0 : 1;\n}\n\n/**\n * Determines if a given keyword is common or not\n *\n * @param {string} keyword */\nfunction commonKeyword(keyword) {\n return COMMON_KEYWORDS.includes(keyword.toLowerCase());\n}\n\n/*\n\nFor the reasoning behind this please see:\nhttps://github.com/highlightjs/highlight.js/issues/2880#issuecomment-747275419\n\n*/\n\n/**\n * @type {Record}\n */\nconst seenDeprecations = {};\n\n/**\n * @param {string} message\n */\nconst error = message => {\n console.error(message);\n};\n\n/**\n * @param {string} message\n * @param {any} args\n */\nconst warn = (message, ...args) => {\n console.log(`WARN: ${message}`, ...args);\n};\n\n/**\n * @param {string} version\n * @param {string} message\n */\nconst deprecated = (version, message) => {\n if (seenDeprecations[`${version}/${message}`]) return;\n console.log(`Deprecated as of ${version}. ${message}`);\n seenDeprecations[`${version}/${message}`] = true;\n};\n\n/* eslint-disable no-throw-literal */\n\n/**\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n*/\n\nconst MultiClassError = new Error();\n\n/**\n * Renumbers labeled scope names to account for additional inner match\n * groups that otherwise would break everything.\n *\n * Lets say we 3 match scopes:\n *\n * { 1 => ..., 2 => ..., 3 => ... }\n *\n * So what we need is a clean match like this:\n *\n * (a)(b)(c) => [ \"a\", \"b\", \"c\" ]\n *\n * But this falls apart with inner match groups:\n *\n * (a)(((b)))(c) => [\"a\", \"b\", \"b\", \"b\", \"c\" ]\n *\n * Our scopes are now \"out of alignment\" and we're repeating `b` 3 times.\n * What needs to happen is the numbers are remapped:\n *\n * { 1 => ..., 2 => ..., 5 => ... }\n *\n * We also need to know that the ONLY groups that should be output\n * are 1, 2, and 5. This function handles this behavior.\n *\n * @param {CompiledMode} mode\n * @param {Array} regexes\n * @param {{key: \"beginScope\"|\"endScope\"}} opts\n */\nfunction remapScopeNames(mode, regexes, {\n key\n}) {\n let offset = 0;\n const scopeNames = mode[key];\n /** @type Record */\n const emit = {};\n /** @type Record */\n const positions = {};\n for (let i = 1; i <= regexes.length; i++) {\n positions[i + offset] = scopeNames[i];\n emit[i + offset] = true;\n offset += countMatchGroups(regexes[i - 1]);\n }\n // we use _emit to keep track of which match groups are \"top-level\" to avoid double\n // output from inside match groups\n mode[key] = positions;\n mode[key]._emit = emit;\n mode[key]._multi = true;\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction beginMultiClass(mode) {\n if (!Array.isArray(mode.begin)) return;\n if (mode.skip || mode.excludeBegin || mode.returnBegin) {\n error(\"skip, excludeBegin, returnBegin not compatible with beginScope: {}\");\n throw MultiClassError;\n }\n if (typeof mode.beginScope !== \"object\" || mode.beginScope === null) {\n error(\"beginScope must be object\");\n throw MultiClassError;\n }\n remapScopeNames(mode, mode.begin, {\n key: \"beginScope\"\n });\n mode.begin = _rewriteBackreferences(mode.begin, {\n joinWith: \"\"\n });\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction endMultiClass(mode) {\n if (!Array.isArray(mode.end)) return;\n if (mode.skip || mode.excludeEnd || mode.returnEnd) {\n error(\"skip, excludeEnd, returnEnd not compatible with endScope: {}\");\n throw MultiClassError;\n }\n if (typeof mode.endScope !== \"object\" || mode.endScope === null) {\n error(\"endScope must be object\");\n throw MultiClassError;\n }\n remapScopeNames(mode, mode.end, {\n key: \"endScope\"\n });\n mode.end = _rewriteBackreferences(mode.end, {\n joinWith: \"\"\n });\n}\n\n/**\n * this exists only to allow `scope: {}` to be used beside `match:`\n * Otherwise `beginScope` would necessary and that would look weird\n\n {\n match: [ /def/, /\\w+/ ]\n scope: { 1: \"keyword\" , 2: \"title\" }\n }\n\n * @param {CompiledMode} mode\n */\nfunction scopeSugar(mode) {\n if (mode.scope && typeof mode.scope === \"object\" && mode.scope !== null) {\n mode.beginScope = mode.scope;\n delete mode.scope;\n }\n}\n\n/**\n * @param {CompiledMode} mode\n */\nfunction MultiClass(mode) {\n scopeSugar(mode);\n if (typeof mode.beginScope === \"string\") {\n mode.beginScope = {\n _wrap: mode.beginScope\n };\n }\n if (typeof mode.endScope === \"string\") {\n mode.endScope = {\n _wrap: mode.endScope\n };\n }\n beginMultiClass(mode);\n endMultiClass(mode);\n}\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').CompiledLanguage} CompiledLanguage\n*/\n\n// compilation\n\n/**\n * Compiles a language definition result\n *\n * Given the raw result of a language definition (Language), compiles this so\n * that it is ready for highlighting code.\n * @param {Language} language\n * @returns {CompiledLanguage}\n */\nfunction compileLanguage(language) {\n /**\n * Builds a regex with the case sensitivity of the current language\n *\n * @param {RegExp | string} value\n * @param {boolean} [global]\n */\n function langRe(value, global) {\n return new RegExp(source(value), 'm' + (language.case_insensitive ? 'i' : '') + (language.unicodeRegex ? 'u' : '') + (global ? 'g' : ''));\n }\n\n /**\n Stores multiple regular expressions and allows you to quickly search for\n them all in a string simultaneously - returning the first match. It does\n this by creating a huge (a|b|c) regex - each individual item wrapped with ()\n and joined by `|` - using match groups to track position. When a match is\n found checking which position in the array has content allows us to figure\n out which of the original regexes / match groups triggered the match.\n The match object itself (the result of `Regex.exec`) is returned but also\n enhanced by merging in any meta-data that was registered with the regex.\n This is how we keep track of which mode matched, and what type of rule\n (`illegal`, `begin`, end, etc).\n */\n class MultiRegex {\n constructor() {\n this.matchIndexes = {};\n // @ts-ignore\n this.regexes = [];\n this.matchAt = 1;\n this.position = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n opts.position = this.position++;\n // @ts-ignore\n this.matchIndexes[this.matchAt] = opts;\n this.regexes.push([opts, re]);\n this.matchAt += countMatchGroups(re) + 1;\n }\n compile() {\n if (this.regexes.length === 0) {\n // avoids the need to check length every time exec is called\n // @ts-ignore\n this.exec = () => null;\n }\n const terminators = this.regexes.map(el => el[1]);\n this.matcherRe = langRe(_rewriteBackreferences(terminators, {\n joinWith: '|'\n }), true);\n this.lastIndex = 0;\n }\n\n /** @param {string} s */\n exec(s) {\n this.matcherRe.lastIndex = this.lastIndex;\n const match = this.matcherRe.exec(s);\n if (!match) {\n return null;\n }\n\n // eslint-disable-next-line no-undefined\n const i = match.findIndex((el, i) => i > 0 && el !== undefined);\n // @ts-ignore\n const matchData = this.matchIndexes[i];\n // trim off any earlier non-relevant match groups (ie, the other regex\n // match groups that make up the multi-matcher)\n match.splice(0, i);\n return Object.assign(match, matchData);\n }\n }\n\n /*\n Created to solve the key deficiently with MultiRegex - there is no way to\n test for multiple matches at a single location. Why would we need to do\n that? In the future a more dynamic engine will allow certain matches to be\n ignored. An example: if we matched say the 3rd regex in a large group but\n decided to ignore it - we'd need to started testing again at the 4th\n regex... but MultiRegex itself gives us no real way to do that.\n So what this class creates MultiRegexs on the fly for whatever search\n position they are needed.\n NOTE: These additional MultiRegex objects are created dynamically. For most\n grammars most of the time we will never actually need anything more than the\n first MultiRegex - so this shouldn't have too much overhead.\n Say this is our search group, and we match regex3, but wish to ignore it.\n regex1 | regex2 | regex3 | regex4 | regex5 ' ie, startAt = 0\n What we need is a new MultiRegex that only includes the remaining\n possibilities:\n regex4 | regex5 ' ie, startAt = 3\n This class wraps all that complexity up in a simple API... `startAt` decides\n where in the array of expressions to start doing the matching. It\n auto-increments, so if a match is found at position 2, then startAt will be\n set to 3. If the end is reached startAt will return to 0.\n MOST of the time the parser will be setting startAt manually to 0.\n */\n class ResumableMultiRegex {\n constructor() {\n // @ts-ignore\n this.rules = [];\n // @ts-ignore\n this.multiRegexes = [];\n this.count = 0;\n this.lastIndex = 0;\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n getMatcher(index) {\n if (this.multiRegexes[index]) return this.multiRegexes[index];\n const matcher = new MultiRegex();\n this.rules.slice(index).forEach(([re, opts]) => matcher.addRule(re, opts));\n matcher.compile();\n this.multiRegexes[index] = matcher;\n return matcher;\n }\n resumingScanAtSamePosition() {\n return this.regexIndex !== 0;\n }\n considerAll() {\n this.regexIndex = 0;\n }\n\n // @ts-ignore\n addRule(re, opts) {\n this.rules.push([re, opts]);\n if (opts.type === \"begin\") this.count++;\n }\n\n /** @param {string} s */\n exec(s) {\n const m = this.getMatcher(this.regexIndex);\n m.lastIndex = this.lastIndex;\n let result = m.exec(s);\n\n // The following is because we have no easy way to say \"resume scanning at the\n // existing position but also skip the current rule ONLY\". What happens is\n // all prior rules are also skipped which can result in matching the wrong\n // thing. Example of matching \"booger\":\n\n // our matcher is [string, \"booger\", number]\n //\n // ....booger....\n\n // if \"booger\" is ignored then we'd really need a regex to scan from the\n // SAME position for only: [string, number] but ignoring \"booger\" (if it\n // was the first match), a simple resume would scan ahead who knows how\n // far looking only for \"number\", ignoring potential string matches (or\n // future \"booger\" matches that might be valid.)\n\n // So what we do: We execute two matchers, one resuming at the same\n // position, but the second full matcher starting at the position after:\n\n // /--- resume first regex match here (for [number])\n // |/---- full match here for [string, \"booger\", number]\n // vv\n // ....booger....\n\n // Which ever results in a match first is then used. So this 3-4 step\n // process essentially allows us to say \"match at this position, excluding\n // a prior rule that was ignored\".\n //\n // 1. Match \"booger\" first, ignore. Also proves that [string] does non match.\n // 2. Resume matching for [number]\n // 3. Match at index + 1 for [string, \"booger\", number]\n // 4. If #2 and #3 result in matches, which came first?\n if (this.resumingScanAtSamePosition()) {\n if (result && result.index === this.lastIndex) ;else {\n // use the second matcher result\n const m2 = this.getMatcher(0);\n m2.lastIndex = this.lastIndex + 1;\n result = m2.exec(s);\n }\n }\n if (result) {\n this.regexIndex += result.position + 1;\n if (this.regexIndex === this.count) {\n // wrap-around to considering all matches again\n this.considerAll();\n }\n }\n return result;\n }\n }\n\n /**\n * Given a mode, builds a huge ResumableMultiRegex that can be used to walk\n * the content and find matches.\n *\n * @param {CompiledMode} mode\n * @returns {ResumableMultiRegex}\n */\n function buildModeRegex(mode) {\n const mm = new ResumableMultiRegex();\n mode.contains.forEach(term => mm.addRule(term.begin, {\n rule: term,\n type: \"begin\"\n }));\n if (mode.terminatorEnd) {\n mm.addRule(mode.terminatorEnd, {\n type: \"end\"\n });\n }\n if (mode.illegal) {\n mm.addRule(mode.illegal, {\n type: \"illegal\"\n });\n }\n return mm;\n }\n\n /** skip vs abort vs ignore\n *\n * @skip - The mode is still entered and exited normally (and contains rules apply),\n * but all content is held and added to the parent buffer rather than being\n * output when the mode ends. Mostly used with `sublanguage` to build up\n * a single large buffer than can be parsed by sublanguage.\n *\n * - The mode begin ands ends normally.\n * - Content matched is added to the parent mode buffer.\n * - The parser cursor is moved forward normally.\n *\n * @abort - A hack placeholder until we have ignore. Aborts the mode (as if it\n * never matched) but DOES NOT continue to match subsequent `contains`\n * modes. Abort is bad/suboptimal because it can result in modes\n * farther down not getting applied because an earlier rule eats the\n * content but then aborts.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is added to the mode buffer.\n * - The parser cursor is moved forward accordingly.\n *\n * @ignore - Ignores the mode (as if it never matched) and continues to match any\n * subsequent `contains` modes. Ignore isn't technically possible with\n * the current parser implementation.\n *\n * - The mode does not begin.\n * - Content matched by `begin` is ignored.\n * - The parser cursor is not moved forward.\n */\n\n /**\n * Compiles an individual mode\n *\n * This can raise an error if the mode contains certain detectable known logic\n * issues.\n * @param {Mode} mode\n * @param {CompiledMode | null} [parent]\n * @returns {CompiledMode | never}\n */\n function compileMode(mode, parent) {\n const cmode = /** @type CompiledMode */mode;\n if (mode.isCompiled) return cmode;\n [scopeClassName,\n // do this early so compiler extensions generally don't have to worry about\n // the distinction between match/begin\n compileMatch, MultiClass, beforeMatchExt].forEach(ext => ext(mode, parent));\n language.compilerExtensions.forEach(ext => ext(mode, parent));\n\n // __beforeBegin is considered private API, internal use only\n mode.__beforeBegin = null;\n [beginKeywords,\n // do this later so compiler extensions that come earlier have access to the\n // raw array if they wanted to perhaps manipulate it, etc.\n compileIllegal,\n // default to 1 relevance if not specified\n compileRelevance].forEach(ext => ext(mode, parent));\n mode.isCompiled = true;\n let keywordPattern = null;\n if (typeof mode.keywords === \"object\" && mode.keywords.$pattern) {\n // we need a copy because keywords might be compiled multiple times\n // so we can't go deleting $pattern from the original on the first\n // pass\n mode.keywords = Object.assign({}, mode.keywords);\n keywordPattern = mode.keywords.$pattern;\n delete mode.keywords.$pattern;\n }\n keywordPattern = keywordPattern || /\\w+/;\n if (mode.keywords) {\n mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);\n }\n cmode.keywordPatternRe = langRe(keywordPattern, true);\n if (parent) {\n if (!mode.begin) mode.begin = /\\B|\\b/;\n cmode.beginRe = langRe(cmode.begin);\n if (!mode.end && !mode.endsWithParent) mode.end = /\\B|\\b/;\n if (mode.end) cmode.endRe = langRe(cmode.end);\n cmode.terminatorEnd = source(cmode.end) || '';\n if (mode.endsWithParent && parent.terminatorEnd) {\n cmode.terminatorEnd += (mode.end ? '|' : '') + parent.terminatorEnd;\n }\n }\n if (mode.illegal) cmode.illegalRe = langRe( /** @type {RegExp | string} */mode.illegal);\n if (!mode.contains) mode.contains = [];\n mode.contains = [].concat(...mode.contains.map(function (c) {\n return expandOrCloneMode(c === 'self' ? mode : c);\n }));\n mode.contains.forEach(function (c) {\n compileMode( /** @type Mode */c, cmode);\n });\n if (mode.starts) {\n compileMode(mode.starts, parent);\n }\n cmode.matcher = buildModeRegex(cmode);\n return cmode;\n }\n if (!language.compilerExtensions) language.compilerExtensions = [];\n\n // self is not valid at the top-level\n if (language.contains && language.contains.includes('self')) {\n throw new Error(\"ERR: contains `self` is not supported at the top-level of a language. See documentation.\");\n }\n\n // we need a null object, which inherit will guarantee\n language.classNameAliases = inherit$1(language.classNameAliases || {});\n return compileMode( /** @type Mode */language);\n}\n\n/**\n * Determines if a mode has a dependency on it's parent or not\n *\n * If a mode does have a parent dependency then often we need to clone it if\n * it's used in multiple places so that each copy points to the correct parent,\n * where-as modes without a parent can often safely be re-used at the bottom of\n * a mode chain.\n *\n * @param {Mode | null} mode\n * @returns {boolean} - is there a dependency on the parent?\n * */\nfunction dependencyOnParent(mode) {\n if (!mode) return false;\n return mode.endsWithParent || dependencyOnParent(mode.starts);\n}\n\n/**\n * Expands a mode or clones it if necessary\n *\n * This is necessary for modes with parental dependenceis (see notes on\n * `dependencyOnParent`) and for nodes that have `variants` - which must then be\n * exploded into their own individual modes at compile time.\n *\n * @param {Mode} mode\n * @returns {Mode | Mode[]}\n * */\nfunction expandOrCloneMode(mode) {\n if (mode.variants && !mode.cachedVariants) {\n mode.cachedVariants = mode.variants.map(function (variant) {\n return inherit$1(mode, {\n variants: null\n }, variant);\n });\n }\n\n // EXPAND\n // if we have variants then essentially \"replace\" the mode with the variants\n // this happens in compileMode, where this function is called from\n if (mode.cachedVariants) {\n return mode.cachedVariants;\n }\n\n // CLONE\n // if we have dependencies on parents then we need a unique\n // instance of ourselves, so we can be reused with many\n // different parents without issue\n if (dependencyOnParent(mode)) {\n return inherit$1(mode, {\n starts: mode.starts ? inherit$1(mode.starts) : null\n });\n }\n if (Object.isFrozen(mode)) {\n return inherit$1(mode);\n }\n\n // no special dependency issues, just return ourselves\n return mode;\n}\nvar version = \"11.9.0\";\nclass HTMLInjectionError extends Error {\n constructor(reason, html) {\n super(reason);\n this.name = \"HTMLInjectionError\";\n this.html = html;\n }\n}\n\n/*\nSyntax highlighting with language autodetection.\nhttps://highlightjs.org/\n*/\n\n/**\n@typedef {import('highlight.js').Mode} Mode\n@typedef {import('highlight.js').CompiledMode} CompiledMode\n@typedef {import('highlight.js').CompiledScope} CompiledScope\n@typedef {import('highlight.js').Language} Language\n@typedef {import('highlight.js').HLJSApi} HLJSApi\n@typedef {import('highlight.js').HLJSPlugin} HLJSPlugin\n@typedef {import('highlight.js').PluginEvent} PluginEvent\n@typedef {import('highlight.js').HLJSOptions} HLJSOptions\n@typedef {import('highlight.js').LanguageFn} LanguageFn\n@typedef {import('highlight.js').HighlightedHTMLElement} HighlightedHTMLElement\n@typedef {import('highlight.js').BeforeHighlightContext} BeforeHighlightContext\n@typedef {import('highlight.js/private').MatchType} MatchType\n@typedef {import('highlight.js/private').KeywordData} KeywordData\n@typedef {import('highlight.js/private').EnhancedMatch} EnhancedMatch\n@typedef {import('highlight.js/private').AnnotatedError} AnnotatedError\n@typedef {import('highlight.js').AutoHighlightResult} AutoHighlightResult\n@typedef {import('highlight.js').HighlightOptions} HighlightOptions\n@typedef {import('highlight.js').HighlightResult} HighlightResult\n*/\n\nconst escape = escapeHTML;\nconst inherit = inherit$1;\nconst NO_MATCH = Symbol(\"nomatch\");\nconst MAX_KEYWORD_HITS = 7;\n\n/**\n * @param {any} hljs - object that is extended (legacy)\n * @returns {HLJSApi}\n */\nconst HLJS = function (hljs) {\n // Global internal variables used within the highlight.js library.\n /** @type {Record} */\n const languages = Object.create(null);\n /** @type {Record} */\n const aliases = Object.create(null);\n /** @type {HLJSPlugin[]} */\n const plugins = [];\n\n // safe/production mode - swallows more errors, tries to keep running\n // even if a single syntax or parse hits a fatal error\n let SAFE_MODE = true;\n const LANGUAGE_NOT_FOUND = \"Could not find the language '{}', did you forget to load/include a language module?\";\n /** @type {Language} */\n const PLAINTEXT_LANGUAGE = {\n disableAutodetect: true,\n name: 'Plain text',\n contains: []\n };\n\n // Global options used when within external APIs. This is modified when\n // calling the `hljs.configure` function.\n /** @type HLJSOptions */\n let options = {\n ignoreUnescapedHTML: false,\n throwUnescapedHTML: false,\n noHighlightRe: /^(no-?highlight)$/i,\n languageDetectRe: /\\blang(?:uage)?-([\\w-]+)\\b/i,\n classPrefix: 'hljs-',\n cssSelector: 'pre code',\n languages: null,\n // beta configuration options, subject to change, welcome to discuss\n // https://github.com/highlightjs/highlight.js/issues/1086\n __emitter: TokenTreeEmitter\n };\n\n /* Utility functions */\n\n /**\n * Tests a language name to see if highlighting should be skipped\n * @param {string} languageName\n */\n function shouldNotHighlight(languageName) {\n return options.noHighlightRe.test(languageName);\n }\n\n /**\n * @param {HighlightedHTMLElement} block - the HTML element to determine language for\n */\n function blockLanguage(block) {\n let classes = block.className + ' ';\n classes += block.parentNode ? block.parentNode.className : '';\n\n // language-* takes precedence over non-prefixed class names.\n const match = options.languageDetectRe.exec(classes);\n if (match) {\n const language = getLanguage(match[1]);\n if (!language) {\n warn(LANGUAGE_NOT_FOUND.replace(\"{}\", match[1]));\n warn(\"Falling back to no-highlight mode for this block.\", block);\n }\n return language ? match[1] : 'no-highlight';\n }\n return classes.split(/\\s+/).find(_class => shouldNotHighlight(_class) || getLanguage(_class));\n }\n\n /**\n * Core highlighting function.\n *\n * OLD API\n * highlight(lang, code, ignoreIllegals, continuation)\n *\n * NEW API\n * highlight(code, {lang, ignoreIllegals})\n *\n * @param {string} codeOrLanguageName - the language to use for highlighting\n * @param {string | HighlightOptions} optionsOrCode - the code to highlight\n * @param {boolean} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n *\n * @returns {HighlightResult} Result - an object that represents the result\n * @property {string} language - the language name\n * @property {number} relevance - the relevance score\n * @property {string} value - the highlighted HTML code\n * @property {string} code - the original raw code\n * @property {CompiledMode} top - top of the current mode stack\n * @property {boolean} illegal - indicates whether any illegal matches were found\n */\n function highlight(codeOrLanguageName, optionsOrCode, ignoreIllegals) {\n let code = \"\";\n let languageName = \"\";\n if (typeof optionsOrCode === \"object\") {\n code = codeOrLanguageName;\n ignoreIllegals = optionsOrCode.ignoreIllegals;\n languageName = optionsOrCode.language;\n } else {\n // old API\n deprecated(\"10.7.0\", \"highlight(lang, code, ...args) has been deprecated.\");\n deprecated(\"10.7.0\", \"Please use highlight(code, options) instead.\\nhttps://github.com/highlightjs/highlight.js/issues/2277\");\n languageName = codeOrLanguageName;\n code = optionsOrCode;\n }\n\n // https://github.com/highlightjs/highlight.js/issues/3149\n // eslint-disable-next-line no-undefined\n if (ignoreIllegals === undefined) {\n ignoreIllegals = true;\n }\n\n /** @type {BeforeHighlightContext} */\n const context = {\n code,\n language: languageName\n };\n // the plugin can change the desired language or the code to be highlighted\n // just be changing the object it was passed\n fire(\"before:highlight\", context);\n\n // a before plugin can usurp the result completely by providing it's own\n // in which case we don't even need to call highlight\n const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);\n result.code = context.code;\n // the plugin can change anything in result to suite it\n fire(\"after:highlight\", result);\n return result;\n }\n\n /**\n * private highlight that's used internally and does not fire callbacks\n *\n * @param {string} languageName - the language to use for highlighting\n * @param {string} codeToHighlight - the code to highlight\n * @param {boolean?} [ignoreIllegals] - whether to ignore illegal matches, default is to bail\n * @param {CompiledMode?} [continuation] - current continuation mode, if any\n * @returns {HighlightResult} - result of the highlight operation\n */\n function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {\n const keywordHits = Object.create(null);\n\n /**\n * Return keyword data if a match is a keyword\n * @param {CompiledMode} mode - current mode\n * @param {string} matchText - the textual match\n * @returns {KeywordData | false}\n */\n function keywordData(mode, matchText) {\n return mode.keywords[matchText];\n }\n function processKeywords() {\n if (!top.keywords) {\n emitter.addText(modeBuffer);\n return;\n }\n let lastIndex = 0;\n top.keywordPatternRe.lastIndex = 0;\n let match = top.keywordPatternRe.exec(modeBuffer);\n let buf = \"\";\n while (match) {\n buf += modeBuffer.substring(lastIndex, match.index);\n const word = language.case_insensitive ? match[0].toLowerCase() : match[0];\n const data = keywordData(top, word);\n if (data) {\n const [kind, keywordRelevance] = data;\n emitter.addText(buf);\n buf = \"\";\n keywordHits[word] = (keywordHits[word] || 0) + 1;\n if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;\n if (kind.startsWith(\"_\")) {\n // _ implied for relevance only, do not highlight\n // by applying a class name\n buf += match[0];\n } else {\n const cssClass = language.classNameAliases[kind] || kind;\n emitKeyword(match[0], cssClass);\n }\n } else {\n buf += match[0];\n }\n lastIndex = top.keywordPatternRe.lastIndex;\n match = top.keywordPatternRe.exec(modeBuffer);\n }\n buf += modeBuffer.substring(lastIndex);\n emitter.addText(buf);\n }\n function processSubLanguage() {\n if (modeBuffer === \"\") return;\n /** @type HighlightResult */\n let result = null;\n if (typeof top.subLanguage === 'string') {\n if (!languages[top.subLanguage]) {\n emitter.addText(modeBuffer);\n return;\n }\n result = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);\n continuations[top.subLanguage] = /** @type {CompiledMode} */result._top;\n } else {\n result = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);\n }\n\n // Counting embedded language score towards the host language may be disabled\n // with zeroing the containing mode relevance. Use case in point is Markdown that\n // allows XML everywhere and makes every XML snippet to have a much larger Markdown\n // score.\n if (top.relevance > 0) {\n relevance += result.relevance;\n }\n emitter.__addSublanguage(result._emitter, result.language);\n }\n function processBuffer() {\n if (top.subLanguage != null) {\n processSubLanguage();\n } else {\n processKeywords();\n }\n modeBuffer = '';\n }\n\n /**\n * @param {string} text\n * @param {string} scope\n */\n function emitKeyword(keyword, scope) {\n if (keyword === \"\") return;\n emitter.startScope(scope);\n emitter.addText(keyword);\n emitter.endScope();\n }\n\n /**\n * @param {CompiledScope} scope\n * @param {RegExpMatchArray} match\n */\n function emitMultiClass(scope, match) {\n let i = 1;\n const max = match.length - 1;\n while (i <= max) {\n if (!scope._emit[i]) {\n i++;\n continue;\n }\n const klass = language.classNameAliases[scope[i]] || scope[i];\n const text = match[i];\n if (klass) {\n emitKeyword(text, klass);\n } else {\n modeBuffer = text;\n processKeywords();\n modeBuffer = \"\";\n }\n i++;\n }\n }\n\n /**\n * @param {CompiledMode} mode - new mode to start\n * @param {RegExpMatchArray} match\n */\n function startNewMode(mode, match) {\n if (mode.scope && typeof mode.scope === \"string\") {\n emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);\n }\n if (mode.beginScope) {\n // beginScope just wraps the begin match itself in a scope\n if (mode.beginScope._wrap) {\n emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);\n modeBuffer = \"\";\n } else if (mode.beginScope._multi) {\n // at this point modeBuffer should just be the match\n emitMultiClass(mode.beginScope, match);\n modeBuffer = \"\";\n }\n }\n top = Object.create(mode, {\n parent: {\n value: top\n }\n });\n return top;\n }\n\n /**\n * @param {CompiledMode } mode - the mode to potentially end\n * @param {RegExpMatchArray} match - the latest match\n * @param {string} matchPlusRemainder - match plus remainder of content\n * @returns {CompiledMode | void} - the next mode, or if void continue on in current mode\n */\n function endOfMode(mode, match, matchPlusRemainder) {\n let matched = startsWith(mode.endRe, matchPlusRemainder);\n if (matched) {\n if (mode[\"on:end\"]) {\n const resp = new Response(mode);\n mode[\"on:end\"](match, resp);\n if (resp.isMatchIgnored) matched = false;\n }\n if (matched) {\n while (mode.endsParent && mode.parent) {\n mode = mode.parent;\n }\n return mode;\n }\n }\n // even if on:end fires an `ignore` it's still possible\n // that we might trigger the end node because of a parent mode\n if (mode.endsWithParent) {\n return endOfMode(mode.parent, match, matchPlusRemainder);\n }\n }\n\n /**\n * Handle matching but then ignoring a sequence of text\n *\n * @param {string} lexeme - string containing full match text\n */\n function doIgnore(lexeme) {\n if (top.matcher.regexIndex === 0) {\n // no more regexes to potentially match here, so we move the cursor forward one\n // space\n modeBuffer += lexeme[0];\n return 1;\n } else {\n // no need to move the cursor, we still have additional regexes to try and\n // match at this very spot\n resumeScanAtSamePosition = true;\n return 0;\n }\n }\n\n /**\n * Handle the start of a new potential mode match\n *\n * @param {EnhancedMatch} match - the current match\n * @returns {number} how far to advance the parse cursor\n */\n function doBeginMatch(match) {\n const lexeme = match[0];\n const newMode = match.rule;\n const resp = new Response(newMode);\n // first internal before callbacks, then the public ones\n const beforeCallbacks = [newMode.__beforeBegin, newMode[\"on:begin\"]];\n for (const cb of beforeCallbacks) {\n if (!cb) continue;\n cb(match, resp);\n if (resp.isMatchIgnored) return doIgnore(lexeme);\n }\n if (newMode.skip) {\n modeBuffer += lexeme;\n } else {\n if (newMode.excludeBegin) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (!newMode.returnBegin && !newMode.excludeBegin) {\n modeBuffer = lexeme;\n }\n }\n startNewMode(newMode, match);\n return newMode.returnBegin ? 0 : lexeme.length;\n }\n\n /**\n * Handle the potential end of mode\n *\n * @param {RegExpMatchArray} match - the current match\n */\n function doEndMatch(match) {\n const lexeme = match[0];\n const matchPlusRemainder = codeToHighlight.substring(match.index);\n const endMode = endOfMode(top, match, matchPlusRemainder);\n if (!endMode) {\n return NO_MATCH;\n }\n const origin = top;\n if (top.endScope && top.endScope._wrap) {\n processBuffer();\n emitKeyword(lexeme, top.endScope._wrap);\n } else if (top.endScope && top.endScope._multi) {\n processBuffer();\n emitMultiClass(top.endScope, match);\n } else if (origin.skip) {\n modeBuffer += lexeme;\n } else {\n if (!(origin.returnEnd || origin.excludeEnd)) {\n modeBuffer += lexeme;\n }\n processBuffer();\n if (origin.excludeEnd) {\n modeBuffer = lexeme;\n }\n }\n do {\n if (top.scope) {\n emitter.closeNode();\n }\n if (!top.skip && !top.subLanguage) {\n relevance += top.relevance;\n }\n top = top.parent;\n } while (top !== endMode.parent);\n if (endMode.starts) {\n startNewMode(endMode.starts, match);\n }\n return origin.returnEnd ? 0 : lexeme.length;\n }\n function processContinuations() {\n const list = [];\n for (let current = top; current !== language; current = current.parent) {\n if (current.scope) {\n list.unshift(current.scope);\n }\n }\n list.forEach(item => emitter.openNode(item));\n }\n\n /** @type {{type?: MatchType, index?: number, rule?: Mode}}} */\n let lastMatch = {};\n\n /**\n * Process an individual match\n *\n * @param {string} textBeforeMatch - text preceding the match (since the last match)\n * @param {EnhancedMatch} [match] - the match itself\n */\n function processLexeme(textBeforeMatch, match) {\n const lexeme = match && match[0];\n\n // add non-matched text to the current mode buffer\n modeBuffer += textBeforeMatch;\n if (lexeme == null) {\n processBuffer();\n return 0;\n }\n\n // we've found a 0 width match and we're stuck, so we need to advance\n // this happens when we have badly behaved rules that have optional matchers to the degree that\n // sometimes they can end up matching nothing at all\n // Ref: https://github.com/highlightjs/highlight.js/issues/2140\n if (lastMatch.type === \"begin\" && match.type === \"end\" && lastMatch.index === match.index && lexeme === \"\") {\n // spit the \"skipped\" character that our regex choked on back into the output sequence\n modeBuffer += codeToHighlight.slice(match.index, match.index + 1);\n if (!SAFE_MODE) {\n /** @type {AnnotatedError} */\n const err = new Error(`0 width match regex (${languageName})`);\n err.languageName = languageName;\n err.badRule = lastMatch.rule;\n throw err;\n }\n return 1;\n }\n lastMatch = match;\n if (match.type === \"begin\") {\n return doBeginMatch(match);\n } else if (match.type === \"illegal\" && !ignoreIllegals) {\n // illegal match, we do not continue processing\n /** @type {AnnotatedError} */\n const err = new Error('Illegal lexeme \"' + lexeme + '\" for mode \"' + (top.scope || '') + '\"');\n err.mode = top;\n throw err;\n } else if (match.type === \"end\") {\n const processed = doEndMatch(match);\n if (processed !== NO_MATCH) {\n return processed;\n }\n }\n\n // edge case for when illegal matches $ (end of line) which is technically\n // a 0 width match but not a begin/end match so it's not caught by the\n // first handler (when ignoreIllegals is true)\n if (match.type === \"illegal\" && lexeme === \"\") {\n // advance so we aren't stuck in an infinite loop\n return 1;\n }\n\n // infinite loops are BAD, this is a last ditch catch all. if we have a\n // decent number of iterations yet our index (cursor position in our\n // parsing) still 3x behind our index then something is very wrong\n // so we bail\n if (iterations > 100000 && iterations > match.index * 3) {\n const err = new Error('potential infinite loop, way more iterations than matches');\n throw err;\n }\n\n /*\n Why might be find ourselves here? An potential end match that was\n triggered but could not be completed. IE, `doEndMatch` returned NO_MATCH.\n (this could be because a callback requests the match be ignored, etc)\n This causes no real harm other than stopping a few times too many.\n */\n\n modeBuffer += lexeme;\n return lexeme.length;\n }\n const language = getLanguage(languageName);\n if (!language) {\n error(LANGUAGE_NOT_FOUND.replace(\"{}\", languageName));\n throw new Error('Unknown language: \"' + languageName + '\"');\n }\n const md = compileLanguage(language);\n let result = '';\n /** @type {CompiledMode} */\n let top = continuation || md;\n /** @type Record */\n const continuations = {}; // keep continuations for sub-languages\n const emitter = new options.__emitter(options);\n processContinuations();\n let modeBuffer = '';\n let relevance = 0;\n let index = 0;\n let iterations = 0;\n let resumeScanAtSamePosition = false;\n try {\n if (!language.__emitTokens) {\n top.matcher.considerAll();\n for (;;) {\n iterations++;\n if (resumeScanAtSamePosition) {\n // only regexes not matched previously will now be\n // considered for a potential match\n resumeScanAtSamePosition = false;\n } else {\n top.matcher.considerAll();\n }\n top.matcher.lastIndex = index;\n const match = top.matcher.exec(codeToHighlight);\n // console.log(\"match\", match[0], match.rule && match.rule.begin)\n\n if (!match) break;\n const beforeMatch = codeToHighlight.substring(index, match.index);\n const processedCount = processLexeme(beforeMatch, match);\n index = match.index + processedCount;\n }\n processLexeme(codeToHighlight.substring(index));\n } else {\n language.__emitTokens(codeToHighlight, emitter);\n }\n emitter.finalize();\n result = emitter.toHTML();\n return {\n language: languageName,\n value: result,\n relevance,\n illegal: false,\n _emitter: emitter,\n _top: top\n };\n } catch (err) {\n if (err.message && err.message.includes('Illegal')) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: true,\n relevance: 0,\n _illegalBy: {\n message: err.message,\n index,\n context: codeToHighlight.slice(index - 100, index + 100),\n mode: err.mode,\n resultSoFar: result\n },\n _emitter: emitter\n };\n } else if (SAFE_MODE) {\n return {\n language: languageName,\n value: escape(codeToHighlight),\n illegal: false,\n relevance: 0,\n errorRaised: err,\n _emitter: emitter,\n _top: top\n };\n } else {\n throw err;\n }\n }\n }\n\n /**\n * returns a valid highlight result, without actually doing any actual work,\n * auto highlight starts with this and it's possible for small snippets that\n * auto-detection may not find a better match\n * @param {string} code\n * @returns {HighlightResult}\n */\n function justTextHighlightResult(code) {\n const result = {\n value: escape(code),\n illegal: false,\n relevance: 0,\n _top: PLAINTEXT_LANGUAGE,\n _emitter: new options.__emitter(options)\n };\n result._emitter.addText(code);\n return result;\n }\n\n /**\n Highlighting with language detection. Accepts a string with the code to\n highlight. Returns an object with the following properties:\n - language (detected language)\n - relevance (int)\n - value (an HTML string with highlighting markup)\n - secondBest (object with the same structure for second-best heuristically\n detected language, may be absent)\n @param {string} code\n @param {Array} [languageSubset]\n @returns {AutoHighlightResult}\n */\n function highlightAuto(code, languageSubset) {\n languageSubset = languageSubset || options.languages || Object.keys(languages);\n const plaintext = justTextHighlightResult(code);\n const results = languageSubset.filter(getLanguage).filter(autoDetection).map(name => _highlight(name, code, false));\n results.unshift(plaintext); // plaintext is always an option\n\n const sorted = results.sort((a, b) => {\n // sort base on relevance\n if (a.relevance !== b.relevance) return b.relevance - a.relevance;\n\n // always award the tie to the base language\n // ie if C++ and Arduino are tied, it's more likely to be C++\n if (a.language && b.language) {\n if (getLanguage(a.language).supersetOf === b.language) {\n return 1;\n } else if (getLanguage(b.language).supersetOf === a.language) {\n return -1;\n }\n }\n\n // otherwise say they are equal, which has the effect of sorting on\n // relevance while preserving the original ordering - which is how ties\n // have historically been settled, ie the language that comes first always\n // wins in the case of a tie\n return 0;\n });\n const [best, secondBest] = sorted;\n\n /** @type {AutoHighlightResult} */\n const result = best;\n result.secondBest = secondBest;\n return result;\n }\n\n /**\n * Builds new class name for block given the language name\n *\n * @param {HTMLElement} element\n * @param {string} [currentLang]\n * @param {string} [resultLang]\n */\n function updateClassName(element, currentLang, resultLang) {\n const language = currentLang && aliases[currentLang] || resultLang;\n element.classList.add(\"hljs\");\n element.classList.add(`language-${language}`);\n }\n\n /**\n * Applies highlighting to a DOM node containing code.\n *\n * @param {HighlightedHTMLElement} element - the HTML element to highlight\n */\n function highlightElement(element) {\n /** @type HTMLElement */\n let node = null;\n const language = blockLanguage(element);\n if (shouldNotHighlight(language)) return;\n fire(\"before:highlightElement\", {\n el: element,\n language\n });\n if (element.dataset.highlighted) {\n console.log(\"Element previously highlighted. To highlight again, first unset `dataset.highlighted`.\", element);\n return;\n }\n\n // we should be all text, no child nodes (unescaped HTML) - this is possibly\n // an HTML injection attack - it's likely too late if this is already in\n // production (the code has likely already done its damage by the time\n // we're seeing it)... but we yell loudly about this so that hopefully it's\n // more likely to be caught in development before making it to production\n if (element.children.length > 0) {\n if (!options.ignoreUnescapedHTML) {\n console.warn(\"One of your code blocks includes unescaped HTML. This is a potentially serious security risk.\");\n console.warn(\"https://github.com/highlightjs/highlight.js/wiki/security\");\n console.warn(\"The element with unescaped HTML:\");\n console.warn(element);\n }\n if (options.throwUnescapedHTML) {\n const err = new HTMLInjectionError(\"One of your code blocks includes unescaped HTML.\", element.innerHTML);\n throw err;\n }\n }\n node = element;\n const text = node.textContent;\n const result = language ? highlight(text, {\n language,\n ignoreIllegals: true\n }) : highlightAuto(text);\n element.innerHTML = result.value;\n element.dataset.highlighted = \"yes\";\n updateClassName(element, language, result.language);\n element.result = {\n language: result.language,\n // TODO: remove with version 11.0\n re: result.relevance,\n relevance: result.relevance\n };\n if (result.secondBest) {\n element.secondBest = {\n language: result.secondBest.language,\n relevance: result.secondBest.relevance\n };\n }\n fire(\"after:highlightElement\", {\n el: element,\n result,\n text\n });\n }\n\n /**\n * Updates highlight.js global options with the passed options\n *\n * @param {Partial} userOptions\n */\n function configure(userOptions) {\n options = inherit(options, userOptions);\n }\n\n // TODO: remove v12, deprecated\n const initHighlighting = () => {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlighting() deprecated. Use highlightAll() now.\");\n };\n\n // TODO: remove v12, deprecated\n function initHighlightingOnLoad() {\n highlightAll();\n deprecated(\"10.6.0\", \"initHighlightingOnLoad() deprecated. Use highlightAll() now.\");\n }\n let wantsHighlight = false;\n\n /**\n * auto-highlights all pre>code elements on the page\n */\n function highlightAll() {\n // if we are called too early in the loading process\n if (document.readyState === \"loading\") {\n wantsHighlight = true;\n return;\n }\n const blocks = document.querySelectorAll(options.cssSelector);\n blocks.forEach(highlightElement);\n }\n function boot() {\n // if a highlight was requested before DOM was loaded, do now\n if (wantsHighlight) highlightAll();\n }\n\n // make sure we are in the browser environment\n if (typeof window !== 'undefined' && window.addEventListener) {\n window.addEventListener('DOMContentLoaded', boot, false);\n }\n\n /**\n * Register a language grammar module\n *\n * @param {string} languageName\n * @param {LanguageFn} languageDefinition\n */\n function registerLanguage(languageName, languageDefinition) {\n let lang = null;\n try {\n lang = languageDefinition(hljs);\n } catch (error$1) {\n error(\"Language definition for '{}' could not be registered.\".replace(\"{}\", languageName));\n // hard or soft error\n if (!SAFE_MODE) {\n throw error$1;\n } else {\n error(error$1);\n }\n // languages that have serious errors are replaced with essentially a\n // \"plaintext\" stand-in so that the code blocks will still get normal\n // css classes applied to them - and one bad language won't break the\n // entire highlighter\n lang = PLAINTEXT_LANGUAGE;\n }\n // give it a temporary name if it doesn't have one in the meta-data\n if (!lang.name) lang.name = languageName;\n languages[languageName] = lang;\n lang.rawDefinition = languageDefinition.bind(null, hljs);\n if (lang.aliases) {\n registerAliases(lang.aliases, {\n languageName\n });\n }\n }\n\n /**\n * Remove a language grammar module\n *\n * @param {string} languageName\n */\n function unregisterLanguage(languageName) {\n delete languages[languageName];\n for (const alias of Object.keys(aliases)) {\n if (aliases[alias] === languageName) {\n delete aliases[alias];\n }\n }\n }\n\n /**\n * @returns {string[]} List of language internal names\n */\n function listLanguages() {\n return Object.keys(languages);\n }\n\n /**\n * @param {string} name - name of the language to retrieve\n * @returns {Language | undefined}\n */\n function getLanguage(name) {\n name = (name || '').toLowerCase();\n return languages[name] || languages[aliases[name]];\n }\n\n /**\n *\n * @param {string|string[]} aliasList - single alias or list of aliases\n * @param {{languageName: string}} opts\n */\n function registerAliases(aliasList, {\n languageName\n }) {\n if (typeof aliasList === 'string') {\n aliasList = [aliasList];\n }\n aliasList.forEach(alias => {\n aliases[alias.toLowerCase()] = languageName;\n });\n }\n\n /**\n * Determines if a given language has auto-detection enabled\n * @param {string} name - name of the language\n */\n function autoDetection(name) {\n const lang = getLanguage(name);\n return lang && !lang.disableAutodetect;\n }\n\n /**\n * Upgrades the old highlightBlock plugins to the new\n * highlightElement API\n * @param {HLJSPlugin} plugin\n */\n function upgradePluginAPI(plugin) {\n // TODO: remove with v12\n if (plugin[\"before:highlightBlock\"] && !plugin[\"before:highlightElement\"]) {\n plugin[\"before:highlightElement\"] = data => {\n plugin[\"before:highlightBlock\"](Object.assign({\n block: data.el\n }, data));\n };\n }\n if (plugin[\"after:highlightBlock\"] && !plugin[\"after:highlightElement\"]) {\n plugin[\"after:highlightElement\"] = data => {\n plugin[\"after:highlightBlock\"](Object.assign({\n block: data.el\n }, data));\n };\n }\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function addPlugin(plugin) {\n upgradePluginAPI(plugin);\n plugins.push(plugin);\n }\n\n /**\n * @param {HLJSPlugin} plugin\n */\n function removePlugin(plugin) {\n const index = plugins.indexOf(plugin);\n if (index !== -1) {\n plugins.splice(index, 1);\n }\n }\n\n /**\n *\n * @param {PluginEvent} event\n * @param {any} args\n */\n function fire(event, args) {\n const cb = event;\n plugins.forEach(function (plugin) {\n if (plugin[cb]) {\n plugin[cb](args);\n }\n });\n }\n\n /**\n * DEPRECATED\n * @param {HighlightedHTMLElement} el\n */\n function deprecateHighlightBlock(el) {\n deprecated(\"10.7.0\", \"highlightBlock will be removed entirely in v12.0\");\n deprecated(\"10.7.0\", \"Please use highlightElement now.\");\n return highlightElement(el);\n }\n\n /* Interface definition */\n Object.assign(hljs, {\n highlight,\n highlightAuto,\n highlightAll,\n highlightElement,\n // TODO: Remove with v12 API\n highlightBlock: deprecateHighlightBlock,\n configure,\n initHighlighting,\n initHighlightingOnLoad,\n registerLanguage,\n unregisterLanguage,\n listLanguages,\n getLanguage,\n registerAliases,\n autoDetection,\n inherit,\n addPlugin,\n removePlugin\n });\n hljs.debugMode = function () {\n SAFE_MODE = false;\n };\n hljs.safeMode = function () {\n SAFE_MODE = true;\n };\n hljs.versionString = version;\n hljs.regex = {\n concat: concat,\n lookahead: lookahead,\n either: either,\n optional: optional,\n anyNumberOfTimes: anyNumberOfTimes\n };\n for (const key in MODES) {\n // @ts-ignore\n if (typeof MODES[key] === \"object\") {\n // @ts-ignore\n deepFreeze(MODES[key]);\n }\n }\n\n // merge all the modes/regexes into our main object\n Object.assign(hljs, MODES);\n return hljs;\n};\n\n// Other names for the variable may break build script\nconst highlight = HLJS({});\n\n// returns a new instance of the highlighter to be used for extensions\n// check https://github.com/wooorm/lowlight/issues/47\nhighlight.newInstance = () => HLJS({});\nmodule.exports = highlight;\nhighlight.HighlightJS = highlight;\nhighlight.default = highlight;","export const GalaxyAiIconSvg = ``;\n\nexport const GalaxyAiIconWithBackgroundSvg = ``;\n","import { inject, Injectable } from '@angular/core';\nimport { MatIconRegistry } from '@angular/material/icon';\nimport { DomSanitizer } from '@angular/platform-browser';\n\nimport { GalaxyAiIconSvg, GalaxyAiIconWithBackgroundSvg } from './ai-icon-svg-string';\nexport { GalaxyAiIconSvg, GalaxyAiIconWithBackgroundSvg };\n\n@Injectable({\n providedIn: 'root',\n})\nexport class GalaxyAiIconService {\n private readonly iconRegistry = inject(MatIconRegistry);\n private readonly sanitizer = inject(DomSanitizer);\n\n constructor() {\n // because this service is injected as root, it will only be instantiated once\n // which means we wont need to worry about adding the same icon multiple times\n this.iconRegistry.addSvgIconLiteral('galaxy-ai-icon', this.sanitizer.bypassSecurityTrustHtml(GalaxyAiIconSvg));\n this.iconRegistry.addSvgIconLiteral(\n 'galaxy-ai-icon-with-background',\n this.sanitizer.bypassSecurityTrustHtml(GalaxyAiIconWithBackgroundSvg),\n );\n }\n\n dummyInit() {\n // If the service when injected as `private` and is marked as unused,\n // you can call this method when you inject the service into your\n // component so it will be \"used\" and not marked as unused.\n }\n}\n","import { Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { Directive, ElementRef, HostListener, Injectable, Input, OnDestroy, TemplateRef, inject } from '@angular/core';\n\nimport { ContactInfoCardComponent } from '../contact-info-card/contact-info-card.component';\nimport { CardDataType } from '../contact-info-types';\nimport { cardPositions } from './positions';\n\n@Directive({\n selector: '[glxyContactCard]',\n standalone: true,\n})\nexport class ContactInfoOnHoverDirective implements OnDestroy {\n @Input('glxyContactCard') cardData?: CardDataType;\n\n @Input('glxyContactCardShowDelay') showDelay = 500;\n\n @Input('glxyContactCardActionsRef') actionsRef?: TemplateRef;\n\n private overlay = inject(Overlay);\n private stateService = inject(ContactCardStateService);\n private elementRef = inject(ElementRef);\n\n contactCardComponent = new ComponentPortal(ContactInfoCardComponent);\n currentOverlayComponent: ContactInfoCardComponent | null = null;\n contactCardOverlayRef?: OverlayRef;\n\n triggerIsHovered = false;\n\n mouseX?: number;\n mouseY?: number;\n\n openTimer = 0; // the id for our window.setTimeout used to open the popover\n closeTimer = 0; // the id for our window.setTimeout used to open the popover\n\n @HostListener('mousemove', ['$event']) onMouseMove(event: MouseEvent): void {\n this.mouseX = event.pageX;\n this.mouseY = event.pageY;\n }\n\n @HostListener('mouseenter') onMouseEnter(): void {\n this.triggerIsHovered = true;\n if (!this.currentOverlayComponent) this.startOpenTimer();\n }\n\n @HostListener('mouseleave') onMouseLeave(): void {\n this.triggerIsHovered = false;\n window.clearTimeout(this.openTimer);\n this.startCloseTimer();\n }\n\n @HostListener('window:keydown.escape') onEscapeKey() {\n this.close();\n }\n\n startOpenTimer() {\n this.openTimer = window.setTimeout(() => {\n this.open();\n }, this.showDelay);\n }\n\n startCloseTimer() {\n window.clearInterval(this.closeTimer); // close any preexisting timers first\n this.closeTimer = window.setInterval(() => {\n this.checkIfCanClose();\n }, 1000);\n }\n\n checkIfCanClose() {\n if (!this.triggerIsHovered && !this.currentOverlayComponent?.popoverIsHovered) {\n this.close();\n }\n }\n\n open() {\n if (!this.cardData) {\n console.warn('appContactCard: No userdata provided!');\n return;\n }\n this.stateService.currentPopover?.close();\n\n // inspired by https://github.com/scttcper/ngx-rightclick/blob/master/src/lib/context-menu.service.ts\n\n let tempElement;\n\n // If the mouse position is not set, use the elementRef\n if (!this.mouseX && !this.mouseY) {\n tempElement = this.elementRef.nativeElement.getBoundingClientRect();\n } else {\n // otherwise, use the mouse position\n tempElement = new ElementRef({\n getBoundingClientRect: () => new DOMRect(this.mouseX, this.mouseY, 0, 0),\n });\n }\n\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(tempElement)\n .withFlexibleDimensions(false)\n .withPositions(cardPositions);\n\n const config = new OverlayConfig({\n positionStrategy: positionStrategy,\n });\n\n this.contactCardOverlayRef = this.overlay.create(config);\n this.currentOverlayComponent = this.contactCardOverlayRef.attach(this.contactCardComponent).instance;\n this.currentOverlayComponent.cardIsPopover = true;\n this.currentOverlayComponent.cardData = this.cardData;\n if (this.actionsRef) {\n this.currentOverlayComponent.actionsRef = this.actionsRef;\n }\n this.stateService.currentPopover = this;\n }\n\n close() {\n window.clearInterval(this.closeTimer);\n if (!this.currentOverlayComponent) return;\n this.contactCardOverlayRef?.dispose();\n this.currentOverlayComponent = null;\n }\n\n ngOnDestroy() {\n this.close();\n }\n}\n\n//\n//\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ContactCardStateService {\n public currentPopover: ContactInfoOnHoverDirective | null = null;\n}\n","import { OverlayModule } from '@angular/cdk/overlay';\nimport { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n HostBinding,\n HostListener,\n inject,\n Input,\n OnInit,\n TemplateRef,\n} from '@angular/core';\nimport { Router, RouterModule } from '@angular/router';\nimport { ClipboardModule } from '@angular/cdk/clipboard';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatCardModule } from '@angular/material/card';\nimport { GalaxyAvatarModule } from '@vendasta/galaxy/avatar';\n\nimport { ContactCardStateService } from '../contact-info-on-hover/contact-info-on-hover.directive';\nimport { CardDataType } from '../contact-info-types';\nimport { GalaxyTooltipModule } from '@vendasta/galaxy/tooltip';\n\n@Component({\n selector: 'glxy-contact-info-card',\n standalone: true,\n imports: [\n CommonModule,\n RouterModule,\n OverlayModule,\n GalaxyAvatarModule,\n MatButtonModule,\n MatIconModule,\n MatTooltipModule,\n MatMenuModule,\n MatCardModule,\n ClipboardModule,\n GalaxyTooltipModule,\n ],\n templateUrl: './contact-info-card.component.html',\n styleUrls: ['./contact-info-card.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ContactInfoCardComponent implements OnInit {\n @HostBinding('class') class = 'glxy-contact-info-card';\n\n @HostBinding('class.is-popover') @Input() cardIsPopover = false;\n\n @Input() cardData?: CardDataType;\n\n @Input() showDefaultActions = true;\n\n @Input() actionsRef: TemplateRef | undefined = undefined;\n\n private router = inject(Router);\n\n cardType: 'user' | 'business' = 'user';\n\n popoverIsHovered = false;\n\n fullBusinessAddress?: string;\n\n stateService = inject(ContactCardStateService);\n\n isCopied = false;\n\n ngOnInit() {\n this.generateAddressString();\n }\n\n @HostListener('mouseenter') onMouseEnter(): void {\n this.popoverIsHovered = true;\n }\n\n @HostListener('mouseleave') onMouseLeave(): void {\n this.popoverIsHovered = false;\n }\n\n handleProfileButtonClick() {\n if (this.cardData?.profileButtonAction) {\n this.cardData.profileButtonAction();\n return;\n }\n\n if (this.cardData?.profileButtonUrlUseRouterLink) {\n if (Array.isArray(this.cardData.profileButtonUrl)) {\n this.router.navigate(this.cardData.profileButtonUrl);\n } else {\n this.router.navigate([this.cardData.profileButtonUrl]);\n }\n }\n // If the link is a normal link, we handle this in the\n // template with the [href] attribute\n }\n\n generateAddressString() {\n // prettier-ignore\n if (this.cardData?.businessAddress) {\n this.fullBusinessAddress = '';\n const addy = this.cardData.businessAddress\n\n // build the address string\n if (addy.address1)\n this.fullBusinessAddress += addy.address1 + ', ';\n if (addy.address2)\n this.fullBusinessAddress += addy.address2 + ', ';\n if (addy.city)\n this.fullBusinessAddress += addy.city + ', ';\n if (addy.state)\n this.fullBusinessAddress += addy.state;\n\n if (addy.country || addy.zip)\n this.fullBusinessAddress += '\\n';\n if (addy.country)\n this.fullBusinessAddress += addy.country + ', ';\n if (addy.zip)\n this.fullBusinessAddress += addy.zip;\n\n this.fullBusinessAddress = this.fullBusinessAddress.trim();\n if (this.fullBusinessAddress.endsWith(','))\n this.fullBusinessAddress = this.fullBusinessAddress.slice(0, -1);\n }\n }\n\n copyClicked() {\n this.isCopied = true;\n window.setTimeout(() => {\n this.isCopied = false;\n }, 3000);\n }\n}\n","\n \n \n\n \n\n \n \n {{ cardData.userName }}\n \n \n {{ cardData.email }}\n \n\n \n \n {{ cardData.businessName }}\n \n \n {{ cardData.businessWebsite }}\n \n\n \n \n \n \n\n
\n business\n {{ cardData.businessName }}\n
\n\n
\n badge\n \n {{ cardData.id }}\n \n \n content_copy\n \n
\n\n
\n location_on\n
{{ fullBusinessAddress }}
\n
\n
\n \n \n\n \n \n \n\n \n \n \n \n {{ cardData.profileButtonLabel ?? 'View details' }}\n \n \n\n \n \n \n \n \n phone_forwarded\n Call {{ cardData.userName ?? cardData.businessName ?? cardData.phone }}\n \n
\n {{ cardData.phone }}\n
\n
\n
\n\n \n \n \n \n \n email\n Send email\n {{\n cardData.userName || cardData.businessName ? 'to ' + (cardData.userName ?? cardData.businessName) : ''\n }}\n \n
\n {{ cardData.email }}\n
\n
\n
\n\n \n
\n\n \n \n
\n
\n
\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ContactInfoCardComponent } from './contact-info-card/contact-info-card.component';\nexport { ContactInfoCardComponent };\n\nimport { ContactInfoOnHoverDirective } from './contact-info-on-hover/contact-info-on-hover.directive';\nexport { ContactInfoOnHoverDirective };\n\nimport { CardDataType } from './contact-info-types';\nexport { CardDataType };\n\nexport const MODULE_IMPORTS = [CommonModule, ContactInfoCardComponent, ContactInfoOnHoverDirective];\nexport const MODULE_EXPORTS = [ContactInfoCardComponent, ContactInfoOnHoverDirective];\n\n@NgModule({\n imports: MODULE_IMPORTS,\n exports: MODULE_EXPORTS,\n})\nexport class GalaxyContactInfoCardModule {}\n","import { Component, Input, inject } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AtlasModule } from '@galaxy/atlas';\nimport { ViewModeService } from '../../../../core/src/lib/view-mode.service';\nimport { Router } from '@angular/router';\nimport { GalaxyAiIconService } from '@vendasta/galaxy/ai-icon';\nimport { map } from 'rxjs';\n\n@Component({\n selector: 'inbox-ai-button',\n standalone: true,\n templateUrl: 'inbox-ai-button.component.html',\n styleUrls: ['./inbox-ai-button.component.scss'],\n imports: [CommonModule, TranslateModule, MatIconModule, MatTooltipModule, AtlasModule],\n})\nexport class InboxAIButtonComponent {\n @Input() isMobile = false;\n private readonly router = inject(Router);\n constructor(private readonly viewModeService: ViewModeService, private _: GalaxyAiIconService) {}\n\n readonly buttonSelected$ = this.viewModeService.isAIOpen$.pipe(\n map((isOpen) => (isOpen ? 'atlas-navbar__item-selected' : '')),\n );\n\n toggle(): void {\n this.viewModeService.toggleInboxAIOpen();\n }\n}\n","\n \n \n \n {{ 'INBOX.HEADER.INBOX_AI_TITLE' | translate }}\n \n \n\n\n\n \n
\n \n
\n \n
\n","import {\n Component,\n ElementRef,\n EventEmitter,\n HostBinding,\n Input,\n OnInit,\n Output,\n ViewChild,\n OnDestroy,\n ChangeDetectorRef,\n} from '@angular/core';\n\nexport type ChatSourceId = 'facebook' | 'google' | 'sms' | 'webchat' | 'openai' | 'platform' | 'email' | 'instagram';\n\nexport interface ChatSource {\n id: ChatSourceId;\n sourceName: string;\n shortSourceName?: string;\n account?: string;\n}\n\nexport interface SentMessage {\n messageText: string;\n sourceId?: ChatSourceId;\n sourceName?: string;\n}\n\n@Component({\n selector: 'glxy-chat-composer',\n templateUrl: './chat-composer.component.html',\n styleUrls: ['./chat-composer.component.scss'],\n})\nexport class ChatComposerComponent implements OnInit, OnDestroy {\n @HostBinding('class') class = 'glxy-chat-composer';\n\n @HostBinding('class.hide-extended-actions')\n get limitedActions(): boolean {\n // controls the hiding or showing of the 'extended-actions' element.\n // It is hidden when the chat composer component's width becomes too small\n return !this.showExtendedActions;\n }\n\n /**\n * Optional. The available chat sources to be shown in the chat sources\n * menu. If there is only one, that will be auto selected. If none, no\n * chat source text or selector is shown.\n */\n @Input() chatSources: ChatSource[] = [];\n\n /**\n * The messages textarea's content. You can use this input\n * to read or modify the text, such as adding links and content\n * to it.\n */\n @Input() public messageText = '';\n\n /**\n * Optional. The placeholder text for the message textarea\n */\n @Input() public placeholder = 'Type here…';\n\n /**\n * Optional. Set the selected chat source from those available in the\n * `chatSources` input above. If none set, the component will default to\n * the first chatSource item\n */\n @Input() set selectedChatSourceId(value: ChatSourceId | undefined) {\n this.currentChatSourceId = value;\n if (this.initialized) {\n this.changeChatSourceId(value);\n }\n }\n\n /**\n * Whether to send the message if you hit the `enter` key on your keyboard\n */\n @Input() public enterKeySendsMessage? = true;\n\n /* Optional. Controls the min height of the text area in the composer */\n @Input() public textAreaMinRows? = 1;\n\n /* Optional. Controls the max height of the text area in the composer */\n @Input() public textAreaMaxRows? = 5;\n\n /* Optional. Will disable the text box and send button if processing */\n @Input() processing? = false;\n\n /* Optional. Will disable the text box and send button if disabled is true */\n @Input() disabled? = false;\n\n /* Optional. Will clear the message text area if set to false */\n @Input() clearMessageTextOnSend? = true;\n\n /* Optional. Will not send out a message when message text is empty if disabled is true */\n @Input() disableSendEmptyText? = true;\n\n /* Optional. Will set the max length of the text area if provided */\n @Input() maxlength?: number;\n\n /* Optional. Specifies whether the send button will use a custom color class or fallback to the galaxy theme*/\n @Input() customColor?: boolean = false;\n\n /**\n * Emitted when the user sends a message.\n */\n @Output() send: EventEmitter = new EventEmitter();\n\n /**\n * Emitted when the user changes chat sources.\n */\n @Output() selectedChatSourceIdChange: EventEmitter = new EventEmitter();\n\n @ViewChild('composerTextArea', { static: true })\n public composerTextArea!: ElementRef;\n\n currentChatSourceId?: ChatSourceId;\n currentChatSource?: ChatSource;\n\n showDynamicContentMinWidthPx = 400;\n showFullSourceNameMinWidthPx = 500;\n\n initialized = false;\n\n // element resizing for mobile and small screens\n showExtendedActions = false;\n showFullSourceName = false;\n\n private resizeObserver!: ResizeObserver;\n private showDynamicContentStore = false;\n private showSourceNameStore = false;\n\n constructor(\n private elementRef: ElementRef,\n private changeDetectorRef: ChangeDetectorRef,\n ) {\n if (window.ResizeObserver) {\n this.resizeObserver = new ResizeObserver((entries) => {\n const entry = Array.isArray(entries) ? entries[0] : entries;\n this.toggleDynamicContent(entry.contentRect.width);\n this.toggleSourceName(entry.contentRect.width);\n });\n this.resizeObserver.observe(this.elementRef.nativeElement);\n }\n }\n\n ngOnInit(): void {\n const firstChatSource = this.chatSources?.[0];\n\n // if no current chat source set, then use first in array\n if (!this.currentChatSourceId && firstChatSource) {\n this.changeChatSourceId(firstChatSource.id);\n } else if (this.currentChatSourceId) {\n this.changeChatSourceId(this.currentChatSourceId);\n }\n this.initialized = true;\n }\n\n ngOnDestroy(): void {\n this.resizeObserver?.disconnect();\n }\n\n sendMessage(event?: Event): void {\n // dont send if processing\n if (this.processing) {\n return;\n }\n\n // when hitting the enter key, we must stop the textinput\n // from adding a new line\n if (event) {\n event.preventDefault();\n }\n\n // focus the editor after sending to keep mobile\n // keyboard visible.\n this.focusTextArea();\n\n const messageText = this.messageText?.trim() ?? '';\n\n // dont sent if meessage is blank\n if (this.disableSendEmptyText && !messageText) return;\n\n const messageToSend: SentMessage = {\n messageText,\n sourceId: this.currentChatSourceId,\n sourceName: this.currentChatSource?.sourceName,\n };\n this.send.emit(messageToSend);\n\n if (this.clearMessageTextOnSend) {\n // clear message after sending\n this.clearMessageText();\n }\n }\n\n chatSourceLabel(): string {\n let label = '';\n if (this.showFullSourceName && this.currentChatSource?.sourceName) {\n label += this.currentChatSource.sourceName;\n } else {\n label += this.currentChatSource?.shortSourceName ?? this.currentChatSource?.sourceName;\n }\n if (this.currentChatSource?.account) {\n label += ' ' + this.currentChatSource.account;\n }\n return label;\n }\n\n public clearMessageText(): void {\n this.messageText = '';\n }\n\n public focusTextArea(): void {\n this.composerTextArea.nativeElement.focus();\n }\n\n changeChatSourceId(sourceId: ChatSourceId | undefined, emitChanges = false): void {\n if (this.chatSources.length === 0 || !sourceId) return;\n\n const newSource = this.chatSources.find((obj) => {\n return obj.id === sourceId;\n });\n\n if (newSource) {\n this.currentChatSourceId = sourceId;\n this.currentChatSource = newSource;\n } else {\n // if no source is found with the id then use the first\n // source in the list\n this.currentChatSourceId = this.chatSources[0].id;\n this.currentChatSource = this.chatSources[0];\n }\n\n if (emitChanges) {\n this.selectedChatSourceIdChange.emit(sourceId);\n }\n }\n\n public insertDynamicContent(\n dynamicContent: string,\n position: 'before' | 'after' | 'curser' = 'curser',\n selectInsertedCurserText = false,\n ): void {\n const textArea = this.composerTextArea.nativeElement;\n\n // If there is no message text, then don't add new lines to output\n const spacing = this.messageText !== '' ? '\\n\\n' : '';\n\n const startPos = textArea.selectionStart;\n const endPos = textArea.selectionEnd ?? startPos;\n\n let newValue: string;\n\n if (position === 'before') {\n dynamicContent = dynamicContent + spacing;\n newValue = dynamicContent + this.messageText;\n } else if (position === 'after') {\n dynamicContent = spacing + dynamicContent;\n newValue = this.messageText + dynamicContent;\n } else {\n // position is `curser`\n const contentBefore = textArea.value.substr(0, startPos);\n const contentAfter = textArea.value.substr(endPos, textArea.value.length);\n\n // add space before and after dynamic content if needed\n if (contentBefore && !contentBefore.endsWith(' ')) {\n dynamicContent = ' ' + dynamicContent;\n }\n if (!contentAfter.startsWith(' ')) {\n dynamicContent = dynamicContent + ' ';\n }\n newValue = contentBefore + dynamicContent + contentAfter;\n }\n\n this.messageText = newValue;\n textArea.value = newValue;\n\n // Using window.setTimeout fix bug where input does not focus\n window.setTimeout(() => {\n if (position === 'curser') {\n if (selectInsertedCurserText) {\n textArea.setSelectionRange(startPos, dynamicContent.length + startPos);\n } else {\n const curserPosition = dynamicContent.length + startPos;\n textArea.setSelectionRange(curserPosition, curserPosition);\n }\n } else if (position === 'after') {\n textArea.setSelectionRange(textArea.value.length, textArea.value.length);\n } else if (position === 'before') {\n textArea.setSelectionRange(0, 0);\n }\n textArea.focus();\n }, 0);\n }\n\n // Hide and show content based on the width of the component\n\n toggleDynamicContent(width: number): void {\n const updatedValue = width > this.showDynamicContentMinWidthPx;\n\n if (updatedValue === this.showDynamicContentStore) return;\n\n this.showDynamicContentStore = updatedValue;\n // window.setTimeout to fix detectChanges not firing\n window.setTimeout(() => this.changeDetectorRef.detectChanges(), 0);\n this.showExtendedActions = updatedValue;\n }\n\n toggleSourceName(width: number): void {\n const updatedValue = width > this.showFullSourceNameMinWidthPx;\n if (updatedValue === this.showSourceNameStore) return;\n\n this.showSourceNameStore = updatedValue;\n // window.setTimeout to fix detectChanges not firing\n window.setTimeout(() => this.changeDetectorRef.detectChanges(), 0);\n this.showFullSourceName = updatedValue;\n }\n}\n","
\n \n\n
\n \n\n
\n 0\">\n \n
Send via {{ chatSourceLabel() }}
\n
\n\n \n
\n Send via\n \n
\n
\n
\n \n \n \n Send\n \n \n
\n
\n
\n\n\n\n \n \n \n\n","import { Directive, HostBinding } from '@angular/core';\n\n@Directive({\n selector: 'glxy-composer-actions, [glxyComposerActions]',\n})\nexport class ChatComposerActionsDirective {\n @HostBinding('class') class = 'glxy-composer-actions';\n}\n","import { Directive, HostBinding } from '@angular/core';\n\n@Directive({\n selector: '[glxyComposerActionButton]',\n})\nexport class ChatComposerActionButtonDirective {\n @HostBinding('class') class = 'glxy-composer-action-button';\n}\n","import { Directive, HostBinding } from '@angular/core';\n\n@Directive({\n selector: 'glxy-composer-beside-send, [glxyComposerBesideSend]',\n})\nexport class ChatComposerBesideSendDirective {\n @HostBinding('class') class = 'glxy-composer-beside-send';\n}\n","import { TextFieldModule } from '@angular/cdk/text-field';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { FormsModule } from '@angular/forms';\n\nimport { ChatComposerComponent } from './chat-composer.component';\nexport { ChatComposerComponent };\n\nimport { ChatComposerActionsDirective } from './directives/chat-composer-actions.directive';\nexport { ChatComposerActionsDirective };\n\nimport { ChatComposerActionsExtendedDirective } from './directives/chat-composer-actions-extended.directive';\nexport { ChatComposerActionsExtendedDirective };\n\nimport { ChatComposerActionButtonDirective } from './directives/chat-composer-action-button.directive';\nexport { ChatComposerActionButtonDirective };\n\nimport { ChatComposerBesideSendDirective } from './directives/chat-composer-beside-send.directive';\nimport { GalaxyButtonLoadingIndicatorModule } from '@vendasta/galaxy/button-loading-indicator';\nexport { ChatComposerBesideSendDirective };\n\nimport { ChatSourceId } from './chat-composer.component';\nexport { ChatSourceId };\n\nexport const MODULE_IMPORTS = [\n CommonModule,\n MatButtonModule,\n MatIconModule,\n TextFieldModule,\n MatMenuModule,\n MatTooltipModule,\n FormsModule,\n GalaxyButtonLoadingIndicatorModule,\n];\n\nexport const MODULE_DECLARATIONS = [\n ChatComposerComponent,\n ChatComposerActionsDirective,\n ChatComposerActionsExtendedDirective,\n ChatComposerActionButtonDirective,\n ChatComposerBesideSendDirective,\n];\n\n@NgModule({\n declarations: MODULE_DECLARATIONS,\n imports: MODULE_IMPORTS,\n exports: MODULE_DECLARATIONS,\n})\nexport class GalaxyChatComposerModule {}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { RouterModule } from '@angular/router';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatRippleModule } from '@angular/material/core';\nimport { TranslateModule } from '@ngx-translate/core';\n\nimport { GalaxyNavLayoutComponent } from './nav-layout.component';\nexport { GalaxyNavLayoutComponent };\n\nimport { GalaxyNavItemComponent } from './components/nav-item/nav-item.component';\nexport { GalaxyNavItemComponent };\n\nimport { GalaxyNavItemListComponent } from './components/nav-item-list/nav-item-list.component';\nexport { GalaxyNavItemListComponent };\n\nimport { GalaxyNavItemListItemsDirective } from './directives/nav-item-list-items.directive';\nexport { GalaxyNavItemListItemsDirective };\n\nimport { GalaxyNavHeaderDirective } from './directives/nav-header.directive';\nexport { GalaxyNavHeaderDirective };\n\nimport { GalaxyNavFooterDirective } from './directives/nav-footer.directive';\nexport { GalaxyNavFooterDirective };\n\nimport { GalaxyNavSubheaderDirective } from './directives/nav-subheader.directive';\nexport { GalaxyNavSubheaderDirective };\n\nimport { GalaxyNavItemAccessoryDirective } from './directives/nav-item-accessory.directive';\nexport { GalaxyNavItemAccessoryDirective };\n\nexport const MODULE_IMPORTS = [CommonModule, RouterModule, MatIconModule, MatRippleModule, TranslateModule];\n\nexport const MODULE_DECLARATIONS = [\n GalaxyNavLayoutComponent,\n GalaxyNavHeaderDirective,\n GalaxyNavFooterDirective,\n GalaxyNavSubheaderDirective,\n GalaxyNavItemAccessoryDirective,\n GalaxyNavItemListItemsDirective,\n GalaxyNavItemComponent,\n GalaxyNavItemListComponent,\n];\n\n@NgModule({\n declarations: MODULE_DECLARATIONS,\n imports: MODULE_IMPORTS,\n exports: [\n GalaxyNavLayoutComponent,\n GalaxyNavHeaderDirective,\n GalaxyNavFooterDirective,\n GalaxyNavSubheaderDirective,\n GalaxyNavItemAccessoryDirective,\n GalaxyNavItemListItemsDirective,\n GalaxyNavItemComponent,\n GalaxyNavItemListComponent,\n ],\n})\nexport class GalaxyNavLayoutModule {}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { PageNavComponent } from './page-nav.component';\nimport { MatSidenavModule } from '@angular/material/sidenav';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nexport { PageNavComponent };\n\nexport const MODULE_IMPORTS = [CommonModule];\n\nexport const MODULE_DECLARATIONS = [PageNavComponent];\n\n@NgModule({\n declarations: MODULE_DECLARATIONS,\n imports: [MODULE_IMPORTS, MatSidenavModule, MatIconModule, MatButtonModule, TranslateModule],\n exports: [PageNavComponent],\n})\nexport class GalaxyPageNavModule {}\n","import { Inject, Injectable } from '@angular/core';\nimport { MatSnackBar } from '@angular/material/snack-bar';\nimport {\n GetTermsOfServiceResponse,\n GetUserAgreementTermsOfServiceResponse,\n PartnerTermsOfApiService,\n PartnerUserAgreementTermsOfApiService,\n TermsOfService,\n UserAgreementTermsOfService,\n} from '@galaxy/partner';\nimport {\n EMPTY,\n Observable,\n ReplaySubject,\n catchError,\n combineLatest,\n defaultIfEmpty,\n map,\n of,\n shareReplay,\n switchMap,\n} from 'rxjs';\nimport { getPlatformLocationToSKey } from './conversation-utils';\nimport { ConversationService } from './conversation.service';\nimport { InboxService } from './inbox.service';\nimport { PARTNER_ID_TOKEN, USER_ID_TOKEN } from './tokens';\n\nexport interface PlatformLocationToSKey {\n partnerId: string;\n feature: string;\n}\n\n@Injectable()\nexport class InboxTermsOfService {\n readonly termsOfServiceAccepted$$: ReplaySubject = new ReplaySubject(1);\n public termsOfServiceAccepted$: Observable = this.termsOfServiceAccepted$$.asObservable();\n\n platformLocationToSKey$ = of(getPlatformLocationToSKey(this.inboxService.platformLocation));\n\n readonly userAgreementTerms$: Observable = this.platformLocationToSKey$.pipe(\n switchMap((platformLocationToSKey) =>\n this.getUserAgreement({\n feature: platformLocationToSKey.feature,\n }),\n ),\n );\n\n readonly termsOfService$: Observable = this.platformLocationToSKey$.pipe(\n switchMap((platformLocationToSKey) =>\n this.getTermsOfService({\n partnerId: platformLocationToSKey.partnerId,\n feature: platformLocationToSKey.feature,\n }).pipe(map((tos) => tos?.termsOfService)),\n ),\n );\n\n readonly getTermsOfServiceText$: Observable = combineLatest([\n this.userAgreementTerms$,\n this.termsOfService$,\n ]).pipe(\n map(([userAgreementResponse, tos]) => {\n const needToAcceptTermsOfService = tos\n ? (this.isNewTermsOfService({\n userAgreement: userAgreementResponse?.userAgreementTermsOfService,\n terms: tos,\n }) ||\n !this.userAgreementIsAccepted({\n userAgreement: userAgreementResponse?.userAgreementTermsOfService,\n })) &&\n this.hasTermsOfService({\n terms: tos,\n })\n : false;\n if (needToAcceptTermsOfService) {\n this.termsOfServiceAccepted$$.next(false);\n return tos?.termsOfService;\n } else {\n this.termsOfServiceAccepted$$.next(true);\n return '';\n }\n }),\n shareReplay(1),\n );\n\n constructor(\n private partnerTermsOfApiService: PartnerTermsOfApiService,\n private partnerUserAgreementTermsOfApiService: PartnerUserAgreementTermsOfApiService,\n private conversationService: ConversationService,\n private snackBar: MatSnackBar,\n @Inject(PARTNER_ID_TOKEN) private partnerId$: Observable,\n @Inject(USER_ID_TOKEN) private userId$: Observable,\n private inboxService: InboxService,\n ) {}\n\n getTermsOfService(termsOfService: {\n partnerId?: string;\n marketId?: string;\n feature?: string;\n }): Observable {\n return this.partnerId$.pipe(\n map((partnerId) => ({\n partnerId,\n ...termsOfService,\n marketId: termsOfService?.marketId || 'NULL',\n })),\n switchMap((termsOfService) => this.partnerTermsOfApiService.getTermsOfService(termsOfService)),\n );\n }\n\n getUserAgreement(userAgreement: {\n partnerId?: string;\n userId?: string;\n feature: string;\n }): Observable {\n return combineLatest([this.partnerId$, this.userId$]).pipe(\n map(([partnerId, userId]) => ({\n partnerId,\n userId,\n ...userAgreement,\n })),\n switchMap((userAgreement) =>\n this.partnerUserAgreementTermsOfApiService.getUserAgreementTermsOfService(userAgreement).pipe(\n catchError((e) => {\n console.warn('Error getting term of service', e);\n return EMPTY;\n }),\n defaultIfEmpty({} as GetUserAgreementTermsOfServiceResponse),\n ),\n ),\n );\n }\n\n hasTermsOfService(check: { terms: TermsOfService }): boolean {\n return !!check.terms?.termsOfService;\n }\n\n userAgreementIsAccepted(check: { userAgreement: UserAgreementTermsOfService }): boolean {\n return check.userAgreement?.accepted;\n }\n\n isNewTermsOfService(check: { userAgreement: UserAgreementTermsOfService; terms: TermsOfService }): boolean {\n return check.userAgreement && check.userAgreement.acceptedAt < check.terms.createdOn;\n }\n\n acceptTermsOfService$(): Observable {\n return combineLatest([this.partnerId$, this.userId$, this.platformLocationToSKey$]).pipe(\n switchMap(([partnerId, userId, platformLocationToSKey]) =>\n this.partnerUserAgreementTermsOfApiService.setUserAgreementTermsOfService({\n userAgreementTermsOfService: {\n partnerId,\n userId,\n accepted: true,\n acceptedAt: new Date(),\n feature: platformLocationToSKey.feature,\n },\n }),\n ),\n catchError((err) => {\n console.warn('setUserAgreementTermsOfService warn', err);\n return of(false);\n }),\n map(() => {\n this.snackBar.open('Terms of Service was accepted', 'OK', {\n duration: 2000,\n });\n return true;\n }),\n );\n }\n}\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nimport { map } from 'rxjs/operators';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar ReviewRequestStatus = /*#__PURE__*/function (ReviewRequestStatus) {\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_NOT_SENT\"] = 0] = \"REVIEW_REQUEST_STATUS_NOT_SENT\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_LEFT_REVIEW\"] = 1] = \"REVIEW_REQUEST_STATUS_LEFT_REVIEW\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_DELIVERED\"] = 2] = \"REVIEW_REQUEST_STATUS_DELIVERED\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_BOUNCED\"] = 3] = \"REVIEW_REQUEST_STATUS_BOUNCED\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_OPENED\"] = 4] = \"REVIEW_REQUEST_STATUS_OPENED\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_CLICKED\"] = 5] = \"REVIEW_REQUEST_STATUS_CLICKED\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_CLICKED_POSITIVE\"] = 6] = \"REVIEW_REQUEST_STATUS_CLICKED_POSITIVE\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_CLICKED_NEGATIVE\"] = 7] = \"REVIEW_REQUEST_STATUS_CLICKED_NEGATIVE\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_UNSUBSCRIBE\"] = 8] = \"REVIEW_REQUEST_STATUS_UNSUBSCRIBE\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_SPAM_REPORT\"] = 9] = \"REVIEW_REQUEST_STATUS_SPAM_REPORT\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_SENDING\"] = 10] = \"REVIEW_REQUEST_STATUS_SENDING\";\n ReviewRequestStatus[ReviewRequestStatus[\"REVIEW_REQUEST_STATUS_DROPPED\"] = 11] = \"REVIEW_REQUEST_STATUS_DROPPED\";\n return ReviewRequestStatus;\n}(ReviewRequestStatus || {});\nvar SmsStatusCode = /*#__PURE__*/function (SmsStatusCode) {\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_SUCCESS\"] = 0] = \"SMS_STATUS_CODE_SUCCESS\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_QUEUE_FULL\"] = 1] = \"SMS_STATUS_CODE_QUEUE_FULL\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_ACCOUNT_SUSPENDED\"] = 2] = \"SMS_STATUS_CODE_ACCOUNT_SUSPENDED\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_UNREACHABLE_DESTINATION\"] = 3] = \"SMS_STATUS_CODE_UNREACHABLE_DESTINATION\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_MESSAGE_BLOCKED\"] = 4] = \"SMS_STATUS_CODE_MESSAGE_BLOCKED\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_UNKNOWN_DESTINATION\"] = 5] = \"SMS_STATUS_CODE_UNKNOWN_DESTINATION\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_LANDLINE_NUMBER\"] = 6] = \"SMS_STATUS_CODE_LANDLINE_NUMBER\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_CARRIER_VIOLATION\"] = 7] = \"SMS_STATUS_CODE_CARRIER_VIOLATION\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_UNKNOWN_ERROR\"] = 8] = \"SMS_STATUS_CODE_UNKNOWN_ERROR\";\n SmsStatusCode[SmsStatusCode[\"SMS_STATUS_CODE_UNSUBSCRIBED\"] = 9] = \"SMS_STATUS_CODE_UNSUBSCRIBED\";\n return SmsStatusCode;\n}(SmsStatusCode || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar AutomationType = /*#__PURE__*/function (AutomationType) {\n AutomationType[AutomationType[\"AUTOMATION_TYPE_NONE\"] = 0] = \"AUTOMATION_TYPE_NONE\";\n AutomationType[AutomationType[\"AUTOMATION_TYPE_REVIEW_REMINDER\"] = 1] = \"AUTOMATION_TYPE_REVIEW_REMINDER\";\n return AutomationType;\n}(AutomationType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar RequestEventType = /*#__PURE__*/function (RequestEventType) {\n RequestEventType[RequestEventType[\"REQUEST_EVENT_TYPE_UNKNOWN\"] = 0] = \"REQUEST_EVENT_TYPE_UNKNOWN\";\n RequestEventType[RequestEventType[\"REQUEST_EVENT_TYPE_EMAIL\"] = 1] = \"REQUEST_EVENT_TYPE_EMAIL\";\n RequestEventType[RequestEventType[\"REQUEST_EVENT_TYPE_SMS\"] = 2] = \"REQUEST_EVENT_TYPE_SMS\";\n return RequestEventType;\n}(RequestEventType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar CreateError = /*#__PURE__*/function (CreateError) {\n CreateError[CreateError[\"CREATE_ERROR_NO_ERRORS\"] = 0] = \"CREATE_ERROR_NO_ERRORS\";\n CreateError[CreateError[\"CREATE_ERROR_EMAIL_OR_PHONE_REQUIRED\"] = 1] = \"CREATE_ERROR_EMAIL_OR_PHONE_REQUIRED\";\n CreateError[CreateError[\"CREATE_ERROR_INVALID_EMAIL\"] = 2] = \"CREATE_ERROR_INVALID_EMAIL\";\n CreateError[CreateError[\"CREATE_ERROR_INVALID_PHONE\"] = 3] = \"CREATE_ERROR_INVALID_PHONE\";\n CreateError[CreateError[\"CREATE_ERROR_INVALID_FIRST_NAME\"] = 4] = \"CREATE_ERROR_INVALID_FIRST_NAME\";\n CreateError[CreateError[\"CREATE_ERROR_INVALID_LAST_NAME\"] = 5] = \"CREATE_ERROR_INVALID_LAST_NAME\";\n CreateError[CreateError[\"CREATE_ERROR_INVALID_COUNTRY\"] = 6] = \"CREATE_ERROR_INVALID_COUNTRY\";\n CreateError[CreateError[\"CREATE_ERROR_INVALID_STATE\"] = 7] = \"CREATE_ERROR_INVALID_STATE\";\n return CreateError;\n}(CreateError || {});\nvar SortDirection = /*#__PURE__*/function (SortDirection) {\n SortDirection[SortDirection[\"SORT_DIRECTION_NONE\"] = 0] = \"SORT_DIRECTION_NONE\";\n SortDirection[SortDirection[\"SORT_DIRECTION_ASCENDING\"] = 1] = \"SORT_DIRECTION_ASCENDING\";\n SortDirection[SortDirection[\"SORT_DIRECTION_DESCENDING\"] = 2] = \"SORT_DIRECTION_DESCENDING\";\n return SortDirection;\n}(SortDirection || {});\n// *********************************\n\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Customer {\n static fromProto(proto) {\n let m = new Customer();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.emailRequestLastDateSent) {\n m.emailRequestLastDateSent = new Date(proto.emailRequestLastDateSent);\n }\n if (proto.smsRequestLastDateSent) {\n m.smsRequestLastDateSent = new Date(proto.smsRequestLastDateSent);\n }\n if (proto.emailReviewRequestStatus) {\n m.emailReviewRequestStatus = enumStringToValue$5(ReviewRequestStatus, proto.emailReviewRequestStatus);\n }\n if (proto.smsReviewRequestStatus) {\n m.smsReviewRequestStatus = enumStringToValue$5(ReviewRequestStatus, proto.smsReviewRequestStatus);\n }\n if (proto.emailLastClickedSource) {\n m.emailLastClickedSource = parseInt(proto.emailLastClickedSource, 10);\n }\n if (proto.review) {\n m.review = CustomerReview.fromProto(proto.review);\n }\n if (proto.smsStatusCode) {\n m.smsStatusCode = enumStringToValue$5(SmsStatusCode, proto.smsStatusCode);\n }\n if (proto.smsLastClickedSource) {\n m.smsLastClickedSource = parseInt(proto.smsLastClickedSource, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.emailRequestLastDateSent !== 'undefined' && this.emailRequestLastDateSent !== null) {\n toReturn['emailRequestLastDateSent'] = 'toApiJson' in this.emailRequestLastDateSent ? this.emailRequestLastDateSent.toApiJson() : this.emailRequestLastDateSent;\n }\n if (typeof this.smsRequestLastDateSent !== 'undefined' && this.smsRequestLastDateSent !== null) {\n toReturn['smsRequestLastDateSent'] = 'toApiJson' in this.smsRequestLastDateSent ? this.smsRequestLastDateSent.toApiJson() : this.smsRequestLastDateSent;\n }\n if (typeof this.emailReviewRequestStatus !== 'undefined') {\n toReturn['emailReviewRequestStatus'] = this.emailReviewRequestStatus;\n }\n if (typeof this.smsReviewRequestStatus !== 'undefined') {\n toReturn['smsReviewRequestStatus'] = this.smsReviewRequestStatus;\n }\n if (typeof this.emailLastClickedSource !== 'undefined') {\n toReturn['emailLastClickedSource'] = this.emailLastClickedSource;\n }\n if (typeof this.employeeFirstName !== 'undefined') {\n toReturn['employeeFirstName'] = this.employeeFirstName;\n }\n if (typeof this.employeeLastName !== 'undefined') {\n toReturn['employeeLastName'] = this.employeeLastName;\n }\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n if (typeof this.review !== 'undefined' && this.review !== null) {\n toReturn['review'] = 'toApiJson' in this.review ? this.review.toApiJson() : this.review;\n }\n if (typeof this.smsStatusCode !== 'undefined') {\n toReturn['smsStatusCode'] = this.smsStatusCode;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.smsLastClickedSource !== 'undefined') {\n toReturn['smsLastClickedSource'] = this.smsLastClickedSource;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n return toReturn;\n }\n}\nclass CustomerReview {\n static fromProto(proto) {\n let m = new CustomerReview();\n m = Object.assign(m, proto);\n if (proto.starRating) {\n m.starRating = parseInt(proto.starRating, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.starRating !== 'undefined') {\n toReturn['starRating'] = this.starRating;\n }\n if (typeof this.reviewUrl !== 'undefined') {\n toReturn['reviewUrl'] = this.reviewUrl;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CustomerRequestEvent {\n static fromProto(proto) {\n let m = new CustomerRequestEvent();\n m = Object.assign(m, proto);\n if (proto.requestEventType) {\n m.requestEventType = enumStringToValue$4(RequestEventType, proto.requestEventType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.requestEventType !== 'undefined') {\n toReturn['requestEventType'] = this.requestEventType;\n }\n return toReturn;\n }\n}\nclass ReviewRequestEvent {\n static fromProto(proto) {\n let m = new ReviewRequestEvent();\n m = Object.assign(m, proto);\n if (proto.customerRequestEvents) {\n m.customerRequestEvents = proto.customerRequestEvents.map(CustomerRequestEvent.fromProto);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.automationType) {\n m.automationType = enumStringToValue$4(AutomationType, proto.automationType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.requestEventId !== 'undefined') {\n toReturn['requestEventId'] = this.requestEventId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.customerRequestEvents !== 'undefined' && this.customerRequestEvents !== null) {\n toReturn['customerRequestEvents'] = 'toApiJson' in this.customerRequestEvents ? this.customerRequestEvents.toApiJson() : this.customerRequestEvents;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.automationType !== 'undefined') {\n toReturn['automationType'] = this.automationType;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Attribute {\n static fromProto(proto) {\n let m = new Attribute();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass CreateCustomerAndSendDefaultReviewRequestRequest {\n static fromProto(proto) {\n let m = new CreateCustomerAndSendDefaultReviewRequestRequest();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n if (typeof this.responseToken !== 'undefined') {\n toReturn['responseToken'] = this.responseToken;\n }\n return toReturn;\n }\n}\nclass CreateCustomerAndSendDefaultReviewRequestResponse {\n static fromProto(proto) {\n let m = new CreateCustomerAndSendDefaultReviewRequestResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n return toReturn;\n }\n}\nclass CreateCustomerRequest {\n static fromProto(proto) {\n let m = new CreateCustomerRequest();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.employeeFirstName !== 'undefined') {\n toReturn['employeeFirstName'] = this.employeeFirstName;\n }\n if (typeof this.employeeLastName !== 'undefined') {\n toReturn['employeeLastName'] = this.employeeLastName;\n }\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n return toReturn;\n }\n}\nclass CreateCustomerResponse {\n static fromProto(proto) {\n let m = new CreateCustomerResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n return toReturn;\n }\n}\nclass CreateMultiCustomerError {\n static fromProto(proto) {\n let m = new CreateMultiCustomerError();\n m = Object.assign(m, proto);\n if (proto.index) {\n m.index = parseInt(proto.index, 10);\n }\n if (proto.errors) {\n m.errors = proto.errors.map(v => enumStringToValue$2(CreateError, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.index !== 'undefined') {\n toReturn['index'] = this.index;\n }\n if (typeof this.errors !== 'undefined') {\n toReturn['errors'] = this.errors;\n }\n return toReturn;\n }\n}\nclass CreateMultiCustomerRequest {\n static fromProto(proto) {\n let m = new CreateMultiCustomerRequest();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n return toReturn;\n }\n}\nclass CreateMultiCustomerResponse {\n static fromProto(proto) {\n let m = new CreateMultiCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n if (proto.errors) {\n m.errors = proto.errors.map(CreateMultiCustomerError.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n if (typeof this.errors !== 'undefined' && this.errors !== null) {\n toReturn['errors'] = 'toApiJson' in this.errors ? this.errors.toApiJson() : this.errors;\n }\n return toReturn;\n }\n}\nclass CreateReviewRequestEventRequest {\n static fromProto(proto) {\n let m = new CreateReviewRequestEventRequest();\n m = Object.assign(m, proto);\n if (proto.customerRequestEvents) {\n m.customerRequestEvents = proto.customerRequestEvents.map(CustomerRequestEvent.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.customerRequestEvents !== 'undefined' && this.customerRequestEvents !== null) {\n toReturn['customerRequestEvents'] = 'toApiJson' in this.customerRequestEvents ? this.customerRequestEvents.toApiJson() : this.customerRequestEvents;\n }\n return toReturn;\n }\n}\nclass CreateReviewRequestEventResponse {\n static fromProto(proto) {\n let m = new CreateReviewRequestEventResponse();\n m = Object.assign(m, proto);\n if (proto.reviewRequestEvent) {\n m.reviewRequestEvent = ReviewRequestEvent.fromProto(proto.reviewRequestEvent);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.reviewRequestEvent !== 'undefined' && this.reviewRequestEvent !== null) {\n toReturn['reviewRequestEvent'] = 'toApiJson' in this.reviewRequestEvent ? this.reviewRequestEvent.toApiJson() : this.reviewRequestEvent;\n }\n return toReturn;\n }\n}\nclass CustomerExistsRequest {\n static fromProto(proto) {\n let m = new CustomerExistsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n return toReturn;\n }\n}\nclass CustomerExistsResponse {\n static fromProto(proto) {\n let m = new CustomerExistsResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerExists !== 'undefined') {\n toReturn['customerExists'] = this.customerExists;\n }\n return toReturn;\n }\n}\nclass CustomerFilters {\n static fromProto(proto) {\n let m = new CustomerFilters();\n m = Object.assign(m, proto);\n if (proto.emailStatus) {\n m.emailStatus = proto.emailStatus.map(v => enumStringToValue$2(ReviewRequestStatus, v));\n }\n if (proto.smsStatus) {\n m.smsStatus = proto.smsStatus.map(v => enumStringToValue$2(ReviewRequestStatus, v));\n }\n if (proto.created) {\n m.created = DateRangeFilter.fromProto(proto.created);\n }\n if (proto.lastRequested) {\n m.lastRequested = DateRangeFilter.fromProto(proto.lastRequested);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.emailStatus !== 'undefined') {\n toReturn['emailStatus'] = this.emailStatus;\n }\n if (typeof this.smsStatus !== 'undefined') {\n toReturn['smsStatus'] = this.smsStatus;\n }\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.lastRequested !== 'undefined' && this.lastRequested !== null) {\n toReturn['lastRequested'] = 'toApiJson' in this.lastRequested ? this.lastRequested.toApiJson() : this.lastRequested;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.negateTags !== 'undefined') {\n toReturn['negateTags'] = this.negateTags;\n }\n if (typeof this.customerIds !== 'undefined') {\n toReturn['customerIds'] = this.customerIds;\n }\n return toReturn;\n }\n}\nclass DateRangeFilter {\n static fromProto(proto) {\n let m = new DateRangeFilter();\n m = Object.assign(m, proto);\n if (proto.beginRange) {\n m.beginRange = new Date(proto.beginRange);\n }\n if (proto.endRange) {\n m.endRange = new Date(proto.endRange);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.beginRange !== 'undefined' && this.beginRange !== null) {\n toReturn['beginRange'] = 'toApiJson' in this.beginRange ? this.beginRange.toApiJson() : this.beginRange;\n }\n if (typeof this.endRange !== 'undefined' && this.endRange !== null) {\n toReturn['endRange'] = 'toApiJson' in this.endRange ? this.endRange.toApiJson() : this.endRange;\n }\n return toReturn;\n }\n}\nclass DeleteCustomerRequest {\n static fromProto(proto) {\n let m = new DeleteCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n return toReturn;\n }\n}\nclass GetCustomerRequest {\n static fromProto(proto) {\n let m = new GetCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n return toReturn;\n }\n}\nclass GetCustomerResponse {\n static fromProto(proto) {\n let m = new GetCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n return toReturn;\n }\n}\nclass GetMultiCustomerForBusinessRequest {\n static fromProto(proto) {\n let m = new GetMultiCustomerForBusinessRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerIds !== 'undefined') {\n toReturn['customerIds'] = this.customerIds;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n return toReturn;\n }\n}\nclass GetMultiCustomerForBusinessResponse {\n static fromProto(proto) {\n let m = new GetMultiCustomerForBusinessResponse();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n return toReturn;\n }\n}\nclass GetQRCodeForURLRequest {\n static fromProto(proto) {\n let m = new GetQRCodeForURLRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n return toReturn;\n }\n}\nclass GetQRCodeForURLResponse {\n static fromProto(proto) {\n let m = new GetQRCodeForURLResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.qrCode !== 'undefined') {\n toReturn['qrCode'] = this.qrCode;\n }\n return toReturn;\n }\n}\nclass HeaderMapping {\n static fromProto(proto) {\n let m = new HeaderMapping();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.employeeFirstName !== 'undefined') {\n toReturn['employeeFirstName'] = this.employeeFirstName;\n }\n if (typeof this.employeeLastName !== 'undefined') {\n toReturn['employeeLastName'] = this.employeeLastName;\n }\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n return toReturn;\n }\n}\nclass ListBusinessTagsRequest {\n static fromProto(proto) {\n let m = new ListBusinessTagsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n return toReturn;\n }\n}\nclass ListBusinessTagsResponse {\n static fromProto(proto) {\n let m = new ListBusinessTagsResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n return toReturn;\n }\n}\nclass ListCustomersRequest {\n static fromProto(proto) {\n let m = new ListCustomersRequest();\n m = Object.assign(m, proto);\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n if (proto.filters) {\n m.filters = CustomerFilters.fromProto(proto.filters);\n }\n if (proto.sortingOptions) {\n m.sortingOptions = proto.sortingOptions.map(SortingOption.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n if (typeof this.searchTerm !== 'undefined') {\n toReturn['searchTerm'] = this.searchTerm;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.sortingOptions !== 'undefined' && this.sortingOptions !== null) {\n toReturn['sortingOptions'] = 'toApiJson' in this.sortingOptions ? this.sortingOptions.toApiJson() : this.sortingOptions;\n }\n return toReturn;\n }\n}\nclass ListCustomersResponse {\n static fromProto(proto) {\n let m = new ListCustomersResponse();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListOriginsRequest {\n static fromProto(proto) {\n let m = new ListOriginsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n return toReturn;\n }\n}\nclass ListOriginsResponse {\n static fromProto(proto) {\n let m = new ListOriginsResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.origins !== 'undefined') {\n toReturn['origins'] = this.origins;\n }\n return toReturn;\n }\n}\nclass ListReviewRequestEventRequest {\n static fromProto(proto) {\n let m = new ListReviewRequestEventRequest();\n m = Object.assign(m, proto);\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n return toReturn;\n }\n}\nclass ListReviewRequestEventResponse {\n static fromProto(proto) {\n let m = new ListReviewRequestEventResponse();\n m = Object.assign(m, proto);\n if (proto.reviewRequestEvents) {\n m.reviewRequestEvents = proto.reviewRequestEvents.map(ReviewRequestEvent.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.reviewRequestEvents !== 'undefined' && this.reviewRequestEvents !== null) {\n toReturn['reviewRequestEvents'] = 'toApiJson' in this.reviewRequestEvents ? this.reviewRequestEvents.toApiJson() : this.reviewRequestEvents;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass MultilocationSendReviewRequestsCSVRequest {\n static fromProto(proto) {\n let m = new MultilocationSendReviewRequestsCSVRequest();\n m = Object.assign(m, proto);\n if (proto.mapping) {\n m.mapping = HeaderMapping.fromProto(proto.mapping);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.filePath !== 'undefined') {\n toReturn['filePath'] = this.filePath;\n }\n if (typeof this.mapping !== 'undefined' && this.mapping !== null) {\n toReturn['mapping'] = 'toApiJson' in this.mapping ? this.mapping.toApiJson() : this.mapping;\n }\n return toReturn;\n }\n}\nclass PagedRequestOptions {\n static fromProto(proto) {\n let m = new PagedRequestOptions();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n return toReturn;\n }\n}\nclass PagedResponseMetadata {\n static fromProto(proto) {\n let m = new PagedResponseMetadata();\n m = Object.assign(m, proto);\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nclass SendReviewRequestEmailRequest {\n static fromProto(proto) {\n let m = new SendReviewRequestEmailRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n return toReturn;\n }\n}\nclass SendReviewRequestSmsRequest {\n static fromProto(proto) {\n let m = new SendReviewRequestSmsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n return toReturn;\n }\n}\nclass SendReviewRequestToDefaultTemplateRequest {\n static fromProto(proto) {\n let m = new SendReviewRequestToDefaultTemplateRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n return toReturn;\n }\n}\nclass SendSMSRequest {\n static fromProto(proto) {\n let m = new SendSMSRequest();\n m = Object.assign(m, proto);\n if (proto.attributes) {\n m.attributes = proto.attributes.map(Attribute.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.customerPhoneNumber !== 'undefined') {\n toReturn['customerPhoneNumber'] = this.customerPhoneNumber;\n }\n if (typeof this.messageToSend !== 'undefined') {\n toReturn['messageToSend'] = this.messageToSend;\n }\n if (typeof this.attributes !== 'undefined' && this.attributes !== null) {\n toReturn['attributes'] = 'toApiJson' in this.attributes ? this.attributes.toApiJson() : this.attributes;\n }\n return toReturn;\n }\n}\nclass SortingOption {\n static fromProto(proto) {\n let m = new SortingOption();\n m = Object.assign(m, proto);\n if (proto.sortDirection) {\n m.sortDirection = enumStringToValue$2(SortDirection, proto.sortDirection);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.columnName !== 'undefined') {\n toReturn['columnName'] = this.columnName;\n }\n if (typeof this.sortDirection !== 'undefined') {\n toReturn['sortDirection'] = this.sortDirection;\n }\n return toReturn;\n }\n}\nclass UpdateCustomerRequest {\n static fromProto(proto) {\n let m = new UpdateCustomerRequest();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass StartTrustHubRegistrationRequest {\n static fromProto(proto) {\n let m = new StartTrustHubRegistrationRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass GetReviewSourceSettingsRequest {\n static fromProto(proto) {\n let m = new GetReviewSourceSettingsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass GetReviewSourceSettingsResponse {\n static fromProto(proto) {\n let m = new GetReviewSourceSettingsResponse();\n m = Object.assign(m, proto);\n if (proto.reviewSources) {\n m.reviewSources = proto.reviewSources.map(ReviewSources.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.reviewSources !== 'undefined' && this.reviewSources !== null) {\n toReturn['reviewSources'] = 'toApiJson' in this.reviewSources ? this.reviewSources.toApiJson() : this.reviewSources;\n }\n if (typeof this.selectedSourceIds !== 'undefined') {\n toReturn['selectedSourceIds'] = this.selectedSourceIds;\n }\n return toReturn;\n }\n}\nclass ReviewSources {\n static fromProto(proto) {\n let m = new ReviewSources();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.sourceId !== 'undefined') {\n toReturn['sourceId'] = this.sourceId;\n }\n if (typeof this.displayName !== 'undefined') {\n toReturn['displayName'] = this.displayName;\n }\n if (typeof this.iconClass !== 'undefined') {\n toReturn['iconClass'] = this.iconClass;\n }\n if (typeof this.hasListings !== 'undefined') {\n toReturn['hasListings'] = this.hasListings;\n }\n if (typeof this.hasWarning !== 'undefined') {\n toReturn['hasWarning'] = this.hasWarning;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.overriddenUrl !== 'undefined') {\n toReturn['overriddenUrl'] = this.overriddenUrl;\n }\n return toReturn;\n }\n}\n\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'customer-voice-service-api.vendasta-local.com',\n 'test': '',\n 'demo': 'customer-voice-service-api-demo.apigateway.co',\n 'prod': 'customer-voice-service-api-prod.apigateway.co',\n 'production': 'customer-voice-service-api-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\nlet CustomerVoiceApiService = /*#__PURE__*/(() => {\n class CustomerVoiceApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n listCustomers(r) {\n const request = r.toApiJson ? r : new ListCustomersRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/ListCustomers\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListCustomersResponse.fromProto(resp)));\n }\n createCustomer(r) {\n const request = r.toApiJson ? r : new CreateCustomerRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/CreateCustomer\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateCustomerResponse.fromProto(resp)));\n }\n createMultiCustomers(r) {\n const request = r.toApiJson ? r : new CreateMultiCustomerRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/CreateMultiCustomers\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateMultiCustomerResponse.fromProto(resp)));\n }\n sendReviewRequestToDefaultTemplate(r) {\n const request = r.toApiJson ? r : new SendReviewRequestToDefaultTemplateRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/SendReviewRequestToDefaultTemplate\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n sendReviewRequestEmail(r) {\n const request = r.toApiJson ? r : new SendReviewRequestEmailRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/SendReviewRequestEmail\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n sendReviewRequestSms(r) {\n const request = r.toApiJson ? r : new SendReviewRequestSmsRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/SendReviewRequestSms\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n updateCustomer(r) {\n const request = r.toApiJson ? r : new UpdateCustomerRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/UpdateCustomer\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteCustomer(r) {\n const request = r.toApiJson ? r : new DeleteCustomerRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/DeleteCustomer\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getCustomer(r) {\n const request = r.toApiJson ? r : new GetCustomerRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/GetCustomer\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetCustomerResponse.fromProto(resp)));\n }\n getMultiCustomerForBusiness(r) {\n const request = r.toApiJson ? r : new GetMultiCustomerForBusinessRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/GetMultiCustomerForBusiness\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiCustomerForBusinessResponse.fromProto(resp)));\n }\n listBusinessTags(r) {\n const request = r.toApiJson ? r : new ListBusinessTagsRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/ListBusinessTags\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListBusinessTagsResponse.fromProto(resp)));\n }\n customerExists(r) {\n const request = r.toApiJson ? r : new CustomerExistsRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/CustomerExists\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CustomerExistsResponse.fromProto(resp)));\n }\n multilocationSendReviewRequestsCsv(r) {\n const request = r.toApiJson ? r : new MultilocationSendReviewRequestsCSVRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/MultilocationSendReviewRequestsCSV\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n createReviewRequestEvent(r) {\n const request = r.toApiJson ? r : new CreateReviewRequestEventRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/CreateReviewRequestEvent\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateReviewRequestEventResponse.fromProto(resp)));\n }\n listReviewRequestEvents(r) {\n const request = r.toApiJson ? r : new ListReviewRequestEventRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/ListReviewRequestEvents\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListReviewRequestEventResponse.fromProto(resp)));\n }\n listOrigins(r) {\n const request = r.toApiJson ? r : new ListOriginsRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/ListOrigins\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListOriginsResponse.fromProto(resp)));\n }\n createCustomerAndSendDefaultReviewRequest(r) {\n const request = r.toApiJson ? r : new CreateCustomerAndSendDefaultReviewRequestRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/CreateCustomerAndSendDefaultReviewRequest\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateCustomerAndSendDefaultReviewRequestResponse.fromProto(resp)));\n }\n sendSms(r) {\n const request = r.toApiJson ? r : new SendSMSRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/SendSMS\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getQrCodeForUrl(r) {\n const request = r.toApiJson ? r : new GetQRCodeForURLRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.CustomerVoice/GetQRCodeForURL\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetQRCodeForURLResponse.fromProto(resp)));\n }\n }\n CustomerVoiceApiService.ɵfac = function CustomerVoiceApiService_Factory(t) {\n return new (t || CustomerVoiceApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n CustomerVoiceApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CustomerVoiceApiService,\n factory: CustomerVoiceApiService.ɵfac,\n providedIn: 'root'\n });\n return CustomerVoiceApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\nlet ListingsApiService = /*#__PURE__*/(() => {\n class ListingsApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n getReviewSourceSettings(r) {\n const request = r.toApiJson ? r : new GetReviewSourceSettingsRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.ListingsService/GetReviewSourceSettings\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetReviewSourceSettingsResponse.fromProto(resp)));\n }\n }\n ListingsApiService.ɵfac = function ListingsApiService_Factory(t) {\n return new (t || ListingsApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n ListingsApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ListingsApiService,\n factory: ListingsApiService.ɵfac,\n providedIn: 'root'\n });\n return ListingsApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\nlet TwilioApiService = /*#__PURE__*/(() => {\n class TwilioApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n startTrustHubRegistration(r) {\n const request = r.toApiJson ? r : new StartTrustHubRegistrationRequest(r);\n return this.http.post(this._host + \"/customervoice.v1.Twilio/StartTrustHubRegistration\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n TwilioApiService.ɵfac = function TwilioApiService_Factory(t) {\n return new (t || TwilioApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n TwilioApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TwilioApiService,\n factory: TwilioApiService.ɵfac,\n providedIn: 'root'\n });\n return TwilioApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Attribute, AutomationType, CreateCustomerAndSendDefaultReviewRequestRequest, CreateCustomerAndSendDefaultReviewRequestResponse, CreateCustomerRequest, CreateCustomerResponse, CreateError, CreateMultiCustomerError, CreateMultiCustomerRequest, CreateMultiCustomerResponse, CreateReviewRequestEventRequest, CreateReviewRequestEventResponse, Customer, CustomerExistsRequest, CustomerExistsResponse, CustomerFilters, CustomerRequestEvent, CustomerReview, CustomerVoiceApiService, DateRangeFilter, DeleteCustomerRequest, FieldMask, GetCustomerRequest, GetCustomerResponse, GetMultiCustomerForBusinessRequest, GetMultiCustomerForBusinessResponse, GetQRCodeForURLRequest, GetQRCodeForURLResponse, GetReviewSourceSettingsRequest, GetReviewSourceSettingsResponse, HeaderMapping, HostService, ListBusinessTagsRequest, ListBusinessTagsResponse, ListCustomersRequest, ListCustomersResponse, ListOriginsRequest, ListOriginsResponse, ListReviewRequestEventRequest, ListReviewRequestEventResponse, ListingsApiService, MultilocationSendReviewRequestsCSVRequest, PagedRequestOptions, PagedResponseMetadata, RequestEventType, ReviewRequestEvent, ReviewRequestStatus, ReviewSources, SendReviewRequestEmailRequest, SendReviewRequestSmsRequest, SendReviewRequestToDefaultTemplateRequest, SendSMSRequest, SmsStatusCode, SortDirection, SortingOption, StartTrustHubRegistrationRequest, TwilioApiService, UpdateCustomerRequest };\n","import { Inject, Injectable } from '@angular/core';\nimport { ListingsApiService } from '@vendasta/customer-voice-service';\n\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { FACEBOOK_SOURCE_ID, GOOGLE_SOURCE_ID } from './inbox.constants';\nimport { ACCOUNT_GROUP_ID_TOKEN } from './tokens';\n\nexport interface ReviewLink {\n sourceName: string;\n reviewUrl: string;\n}\n\n@Injectable()\nexport class ListingService {\n private currentAccountGroupId: string;\n\n constructor(\n private listingsApiService: ListingsApiService,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n ) {\n this.accountGroupId$.pipe(takeUntilDestroyed()).subscribe((accountGroupId) => {\n this.currentAccountGroupId = accountGroupId;\n });\n }\n\n public get reviewLinks$(): Observable {\n return this.listingsApiService.getReviewSourceSettings({ accountGroupId: this.currentAccountGroupId }).pipe(\n map((response) => {\n return response.reviewSources\n .filter((result) => result.url != null || result.overriddenUrl != null)\n .sort((a, b) => {\n if (\n a.sourceId == GOOGLE_SOURCE_ID ||\n a.sourceId == FACEBOOK_SOURCE_ID ||\n (a.sourceId == GOOGLE_SOURCE_ID && b.sourceId == FACEBOOK_SOURCE_ID)\n ) {\n return -1;\n }\n return 1;\n })\n .map((result) => {\n if (result.overriddenUrl) {\n return {\n sourceName: result.displayName,\n reviewUrl: result.overriddenUrl,\n } as ReviewLink;\n }\n return {\n sourceName: result.displayName,\n reviewUrl: result.url,\n } as ReviewLink;\n });\n }),\n );\n }\n}\n","import { HttpClient, HttpParams } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Environment, EnvironmentService } from '@galaxy/core';\nimport { FileInfo, GalaxyUploaderService, UploadResponse } from '@vendasta/galaxy/uploader';\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { map, switchMap, take } from 'rxjs/operators';\nimport { ChatSourceId } from '@vendasta/galaxy/chat-composer/src/chat-composer.component';\n\n@Injectable()\nexport class InboxUploadService extends GalaxyUploaderService {\n conversationId$$: ReplaySubject = new ReplaySubject(1);\n conversationId$: Observable = this.conversationId$$.asObservable();\n\n constructor(http: HttpClient, private readonly env: EnvironmentService) {\n super(http);\n }\n\n buildRequest(fileInfo: FileInfo): Observable {\n this.uploadUrl = 'https://conversation-demo.apigateway.co/upload-file';\n if (this.env.getEnvironment() === Environment.PROD) {\n this.uploadUrl = 'https://conversation-prod.apigateway.co/upload-file';\n }\n return this.conversationId$.pipe(\n map((conversationId) => new HttpParams().set('conversationID', conversationId)),\n switchMap((params) => {\n const body = new FormData();\n\n body.append('file', fileInfo.file);\n const options = { withCredentials: true };\n if (params) {\n options['params'] = params;\n }\n return this.http.post(this.uploadUrl, body, options) as Observable;\n }),\n take(1),\n );\n }\n}\n\n/**\n * Returns the max file size for a given channel in bytes\n * @param chatSourceId\n */\nexport function getMaxFileSize(chatSourceId?: ChatSourceId): number {\n if (!chatSourceId) {\n return 0;\n }\n switch (chatSourceId) {\n case 'sms':\n return 5 * 1024 * 1024; // 5MB\n default:\n return 250 * 1024 * 1024; // 250MB\n }\n}\n\n/**\n * Returns the accepted file types for a given channel\n * @param chatSourceId\n */\nexport function getAcceptFileTypes(chatSourceId?: ChatSourceId): string {\n if (!chatSourceId) {\n return '';\n }\n switch (chatSourceId) {\n case 'sms':\n return 'image/jpeg, image/jpg, image/png, image/gif';\n default:\n return '*/*';\n }\n}\n\n/**\n * Returns the max file size for a given channel in MB\n * @param chatSourceId\n */\nexport function getMaxFileSizeInMB(chatSourceId?: ChatSourceId): number {\n if (!chatSourceId) {\n return 0;\n }\n return getMaxFileSize(chatSourceId) / 1024 / 1024;\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { Conversation, Participant, ParticipantType } from '@vendasta/conversation';\nimport { Observable, map } from 'rxjs';\nimport { formatUnreadConversationsCount, toFirestoreId } from '../../core/src/lib/conversation-utils';\nimport { ConversationService } from '../../core/src/lib/conversation.service';\nimport { ConversationBadge, ConversationDetail } from '../../core/src/lib/interface/conversation.interface';\nimport { CONVERSATION_HOST_APP_INTERFACE_TOKEN, CONVERSATION_ROUTES_TOKEN } from '../../core/src/lib/tokens';\nimport { ViewMode } from '../../core/src/lib/types';\nimport { ViewModeService } from '../../core/src/lib/view-mode.service';\nimport {\n getAcceptFileTypes,\n getMaxFileSize,\n} from '../../ui/src/pages/inbox-chat/components/inbox-upload-file/inbox-upload.service';\nimport { ChatSourceId } from '@vendasta/galaxy/chat-composer/src/chat-composer.component';\n\n// Determine the conversation URL route\n@Pipe({ name: 'conversationRoute' })\nexport class ConversationRoutePipe implements PipeTransform {\n private readonly routes = toSignal(inject(CONVERSATION_ROUTES_TOKEN));\n\n constructor(private viewModeService: ViewModeService) {}\n\n transform(\n conversationDetail: ConversationDetail,\n conversationPath?: string,\n viewMode: ViewMode = 'modal',\n ): string | [string, object] | any[] {\n const firestoreId = toFirestoreId(conversationDetail?.conversation?.conversationId);\n if (this.routes().useModal) {\n return this.viewModeService.routerCommands(viewMode, firestoreId);\n }\n\n if (conversationPath) {\n return `${conversationPath}/${firestoreId}`;\n }\n return `${this.routes().root}/inbox/channel/${firestoreId}`;\n }\n}\n\n@Pipe({ name: 'conversationBadge' })\nexport class ConversationBadgePipe implements PipeTransform {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n private getConversationBadge(conversation: ConversationDetail): ConversationBadge[] {\n const recipient = this.hostAppInterface.getRecipient(conversation);\n return (Array.isArray(recipient) ? recipient : [recipient])\n .map((subjectParticipant) =>\n !subjectParticipant\n ? null\n : this.getConversationBadgeByParticipant(\n subjectParticipant,\n this.hostAppInterface.isRecipientInternalInfoDeleted(conversation),\n ),\n )\n .filter((badge): badge is ConversationBadge => !!badge);\n }\n\n /**\n * TODO - Add more cases to make the badge work in business app && vendor center\n * get badge for Participants\n * @param {SubjectParticipant} participant - the current Participant\n * @param {boolean} deleted - status of deletion\n */\n private getConversationBadgeByParticipant(participant: Participant, deleted: boolean): ConversationBadge | null {\n if (deleted) {\n return { participantType: 'INBOX.LABELS.INACTIVE', badgeColor: 'grey' };\n }\n switch (participant.participantType) {\n case ParticipantType.PARTICIPANT_TYPE_VENDOR:\n return { participantType: 'INBOX.LABELS.VENDOR', badgeColor: 'purple' };\n case ParticipantType.PARTICIPANT_TYPE_ACCOUNT_GROUP:\n return { participantType: 'INBOX.LABELS.ACCOUNT', badgeColor: 'blue' };\n case ParticipantType.PARTICIPANT_TYPE_PARTNER:\n return { participantType: 'INBOX.LABELS.PARTNER', badgeColor: 'green' };\n case ParticipantType.PARTICIPANT_TYPE_OPENAI_BOT:\n return { participantType: 'INBOX.LABELS.APP', badgeColor: 'yellow' };\n }\n\n return null;\n }\n\n transform(conversationDetail: ConversationDetail): ConversationBadge[] {\n return this.getConversationBadge(conversationDetail);\n }\n}\n\n@Pipe({ name: 'conversationUnseen' })\nexport class ConversationUnseenPipe implements PipeTransform {\n constructor(private conversationService: ConversationService) {}\n transform(conversation: Conversation): Observable {\n return this.conversationService.conversationUnseen(conversation);\n }\n}\n\n@Pipe({ name: 'conversationYourExpert' })\nexport class ConversationYourExpertPipe implements PipeTransform {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n transform(conversationDetail: ConversationDetail): boolean {\n return this.hostAppInterface.isYourExpert(conversationDetail);\n }\n}\n\n@Pipe({ name: 'unreadConversationsCount' })\nexport class UnreadConversationsCountPipe implements PipeTransform {\n constructor(private conversationService: ConversationService) {}\n\n transform(viewId: string): Observable {\n return this.conversationService\n .getUnreadConversationsCount(viewId)\n .pipe(map((count) => formatUnreadConversationsCount(count)));\n }\n}\n\n@Pipe({ name: 'maxFileSize' })\nexport class MaxFileSize implements PipeTransform {\n transform(chatSourceId?: ChatSourceId): number {\n return getMaxFileSize(chatSourceId);\n }\n}\n\n@Pipe({ name: 'acceptedFileType' })\nexport class AcceptedFileType implements PipeTransform {\n transform(chatSourceId?: ChatSourceId): string {\n return getAcceptFileTypes(chatSourceId);\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport firebase from 'firebase/compat/app';\n\n@Pipe({ name: 'firebaseTimestampToDate' })\nexport class FirebaseTimestampsToDatePipe implements PipeTransform {\n transform(firebaseTimestamp: firebase.firestore.Timestamp): Date {\n return firebaseTimestamp.toDate();\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({ name: 'inArray' })\nexport class InArrayPipe implements PipeTransform {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n transform(value: any, dataSet: any[]): boolean {\n return dataSet.includes(value);\n }\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { EnvironmentService } from '@galaxy/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport { ConversationChannel, MessageType, ParticipantType } from '@vendasta/conversation';\nimport { ChatSourceId } from '@vendasta/galaxy/chat-composer';\nimport { DEFAULT_OPENAI_BOT_NAME, DEFAULT_WEBCHAT_BOT_NAME } from '../../core/src/lib/inbox.constants';\nimport { ConversationMessage, Media } from '../../core/src/lib/interface/conversation.interface';\nimport { CONVERSATION_HOST_APP_INTERFACE_TOKEN, USER_ID_TOKEN } from '../../core/src/lib/tokens';\nimport { MessageGroup } from '../../core/src/lib/types';\n\n// returns true if message is a System Message type\n@Pipe({ name: 'isSystemMessage' })\nexport class IsSystemMessagePipe implements PipeTransform {\n transform(message: ConversationMessage): boolean {\n return message?.type === MessageType.MESSAGE_TYPE_SYSTEM;\n }\n}\n\n// Determine whether we need to specify message type as 'sent' or 'received'\nenum MessageStatus {\n Sent = 'sent',\n Received = 'received',\n}\n@Pipe({ name: 'messageStatusType' })\nexport class MessageStatusType implements PipeTransform {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n transform(message: ConversationMessage): MessageStatus {\n return this.hostAppInterface.isSenderFromOrganization(message) ? MessageStatus.Sent : MessageStatus.Received;\n }\n}\n\n@Pipe({ name: 'messageFrom' })\nexport class MessageFrom implements PipeTransform {\n constructor(public translateService: TranslateService) {}\n transform(message: ConversationMessage): string {\n return messageFrom(message) || '';\n }\n}\n\n@Pipe({ name: 'messageVia' })\nexport class MessageVia implements PipeTransform {\n constructor(public translateService: TranslateService) {}\n transform(message: ConversationMessage): string {\n switch (message.channel) {\n case ConversationChannel.CONVERSATION_CHANNEL_GOOGLE_BUSINESS_COMMUNICATIONS:\n return 'INBOX.CHAT.VIA_GOOGLE';\n case ConversationChannel.CONVERSATION_CHANNEL_FACEBOOK:\n return 'INBOX.CHAT.VIA_FACEBOOK';\n case ConversationChannel.CONVERSATION_CHANNEL_SMS:\n return 'INBOX.CHAT.VIA_SMS';\n case ConversationChannel.CONVERSATION_CHANNEL_EMAIL:\n return 'INBOX.CHAT.VIA_EMAIL';\n case ConversationChannel.CONVERSATION_CHANNEL_WEB_CHAT:\n return 'INBOX.CHAT.VIA_WEBCHAT';\n case ConversationChannel.CONVERSATION_CHANNEL_INSTAGRAM:\n return 'INBOX.CHAT.VIA_INSTAGRAM';\n default:\n return '';\n }\n }\n}\n\n@Pipe({ name: 'messageCodeBacktick' })\nexport class MessageCodeBacktickPipe implements PipeTransform {\n transform(message: string): string {\n if (!message) {\n return '';\n }\n\n const blockPattern = /```(.+?)?\\n([\\s\\S]*?)```/g;\n const inlinePattern = /`([^`]+)`/g;\n const blockFormatted = message.replace(blockPattern, '
$2
');\n const finalFormat = blockFormatted.replace(inlinePattern, '$1');\n return finalFormat;\n }\n}\n\n@Pipe({ name: 'getMessageMediaUrl' })\nexport class GetMessageMediaUrlPipe implements PipeTransform {\n constructor(public environmentService: EnvironmentService) {}\n transform(media: Media): string {\n const env = this.environmentService.getEnvironmentString();\n return (\n media?.mediaUrl || `https://storage.googleapis.com/conversations-${env}-shared-files/${media.mediaLocationPath}`\n );\n }\n}\n\n@Pipe({ name: 'isFromYou' })\nexport class IsFromYouPipe implements PipeTransform {\n private readonly userId = toSignal(inject(USER_ID_TOKEN));\n transform(messageGroup: MessageGroup): boolean {\n return isFromYou(messageGroup, this.userId());\n }\n}\n\n@Pipe({ name: 'chatSourceIconName' })\nexport class ChatSourceIconName implements PipeTransform {\n transform(channel: ConversationChannel): ChatSourceId | undefined {\n switch (channel) {\n case ConversationChannel.CONVERSATION_CHANNEL_INTERNAL:\n return undefined;\n case ConversationChannel.CONVERSATION_CHANNEL_GOOGLE_BUSINESS_COMMUNICATIONS:\n return 'google';\n case ConversationChannel.CONVERSATION_CHANNEL_FACEBOOK:\n return 'facebook';\n case ConversationChannel.CONVERSATION_CHANNEL_SMS:\n return 'sms';\n case ConversationChannel.CONVERSATION_CHANNEL_EMAIL:\n return 'email';\n case ConversationChannel.CONVERSATION_CHANNEL_WEB_CHAT:\n return 'webchat';\n case ConversationChannel.CONVERSATION_CHANNEL_OPENAI:\n return undefined;\n case ConversationChannel.CONVERSATION_CHANNEL_INSTAGRAM:\n return 'instagram';\n default:\n throw new Error('unsupported channel ' + channel);\n }\n }\n}\n\n@Pipe({ name: 'chatProfileIcon' })\nexport class ChatProfileIconPipe implements PipeTransform {\n private readonly userId = toSignal(inject(USER_ID_TOKEN));\n transform(messageGroup: MessageGroup): string {\n const unknownContact = !messageFrom(messageGroup.lastMessage);\n const notYou = !isFromYou(messageGroup, this.userId());\n return unknownContact && notYou ? 'person' : '';\n }\n}\n\nfunction messageFrom(message: ConversationMessage): string | undefined {\n if (message.sender?.participantType === ParticipantType.PARTICIPANT_TYPE_OPENAI_BOT) {\n return message.channel === ConversationChannel.CONVERSATION_CHANNEL_WEB_CHAT\n ? DEFAULT_WEBCHAT_BOT_NAME\n : DEFAULT_OPENAI_BOT_NAME;\n }\n return message?.sender?.name;\n}\n\nfunction isFromYou(messageGroup: MessageGroup, userId: string | undefined): boolean {\n const senderID: string | undefined = messageGroup?.sender?.internalParticipantId;\n if (!senderID) return false;\n return senderID === userId;\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({ name: 'trimDescription' })\nexport class TrimDescriptionPipe implements PipeTransform {\n transform(text: string, length: number): string {\n if (text.length <= length) {\n return text;\n }\n return text.substring(0, length).concat('…');\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport dayjs from 'dayjs';\nimport calendar from 'dayjs/plugin/calendar';\nimport { ConversationDetail } from '../../core/src/lib/interface/conversation.interface';\ndayjs.extend(calendar);\n\n@Pipe({ name: 'timestamp' })\nexport class TimestampsPipe implements PipeTransform {\n transform(conversationDetail: ConversationDetail): string {\n const timestamp = conversationDetail?.conversation?.latestMsgSentTime;\n const sameDay = timestamp ? dayjs().isSame(timestamp, 'day') : false;\n return sameDay ? dayjs(timestamp).format('h:mm A') : dayjs(timestamp).format('MMM D');\n }\n}\n\n@Pipe({ name: 'messageTime' })\nexport class MessageTime implements PipeTransform {\n constructor(private readonly translateService: TranslateService) {}\n transform(messageTime: Date): string {\n const today = this.translateService.instant('INBOX.DATE.TODAY');\n const yesterday = this.translateService.instant('INBOX.DATE.YESTERDAY');\n const at = this.translateService.instant('INBOX.DATE.AT');\n return dayjs(messageTime).calendar(new Date(), {\n sameDay: `[${today}] h:mm A`, // The same day ( Today 2:30 AM )\n lastDay: `[${yesterday}] h:mm A`, // The day before ( Yesterday 2:30 AM )\n lastWeek: `ddd, MMM D [${at}] h:mm A`, // lastWeek should also follow format ( Mon, Apr 12 at 2:30 AM )\n sameElse: `ddd, MMM D, YYYY [${at}] h:mm A`, // Everything else (Mon, Apr 12, 2023 at 2:30 AM )\n });\n }\n}\n\n@Pipe({ name: 'messageBubbleTime' })\nexport class MessageBubbleTime implements PipeTransform {\n constructor(private readonly translateService: TranslateService) {}\n\n transform(messageBubbleTime: Date): string {\n const now = dayjs();\n const diffInMinutes = now.diff(dayjs(messageBubbleTime), 'minute');\n const isSameDay = dayjs(messageBubbleTime).isSame(now, 'day');\n const isSameYear = dayjs(messageBubbleTime).isSame(now, 'year');\n const isYesterday = dayjs(messageBubbleTime).isSame(now.subtract(1, 'day'), 'day');\n const isWithinLastWeek = dayjs(messageBubbleTime).isAfter(now.subtract(7, 'day'));\n\n const justNowText = this.translateService.instant('INBOX.DATE.JUST_NOW');\n const minsAgoText = this.translateService.instant('INBOX.DATE.MINS_AGO');\n const atText = this.translateService.instant('INBOX.DATE.AT');\n const yesterdayText = this.translateService.instant('INBOX.DATE.YESTERDAY');\n\n if (diffInMinutes < 1) {\n return justNowText;\n } else if (diffInMinutes < 60) {\n return `${diffInMinutes} ${minsAgoText}`;\n } else if (isSameDay) {\n return dayjs(messageBubbleTime).format('h:mm A');\n } else if (isYesterday) {\n return `${yesterdayText} ${atText} ${dayjs(messageBubbleTime).format('h:mm A')}`;\n } else if (isWithinLastWeek) {\n return `${dayjs(messageBubbleTime).format('dddd')} ${atText} ${dayjs(messageBubbleTime).format('h:mm A')}`;\n } else if (isSameYear) {\n return `${dayjs(messageBubbleTime).format('MMM D')} ${atText} ${dayjs(messageBubbleTime).format('h:mm A')}`;\n } else {\n return dayjs(messageBubbleTime).format('MMM D, YYYY');\n }\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { ALL_VIEW_ID, FOLLOWING_VIEW_ID } from '../../core/src/lib/inbox.constants';\n\n@Pipe({ name: 'viewIcon' })\nexport class ViewIconPipe implements PipeTransform {\n transform(viewId: string): string {\n switch (viewId) {\n case ALL_VIEW_ID:\n return 'inbox';\n case FOLLOWING_VIEW_ID:\n return 'star';\n default:\n return 'inbox';\n }\n }\n}\n\n@Pipe({ name: 'viewName' })\nexport class ViewNamePipe implements PipeTransform {\n transform(viewId: string): string {\n switch (viewId) {\n case ALL_VIEW_ID:\n return 'INBOX.VIEWS.ALL_CONVERSATIONS';\n case FOLLOWING_VIEW_ID:\n return 'INBOX.VIEWS.FOLLOWING';\n default:\n return '';\n }\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport {\n AcceptedFileType,\n ConversationBadgePipe,\n ConversationRoutePipe,\n ConversationUnseenPipe,\n ConversationYourExpertPipe,\n MaxFileSize,\n UnreadConversationsCountPipe,\n} from './conversation.pipe';\nimport { FirebaseTimestampsToDatePipe } from './firebase-timestamp-to-date';\nimport { InArrayPipe } from './in-array.pipe';\nimport {\n ChatSourceIconName,\n ChatProfileIconPipe,\n GetMessageMediaUrlPipe,\n IsFromYouPipe,\n IsSystemMessagePipe,\n MessageCodeBacktickPipe,\n MessageFrom,\n MessageStatusType,\n MessageVia,\n} from './message.pipes';\nimport { TrimDescriptionPipe } from './ticket-pane.pipe';\nimport { MessageTime, TimestampsPipe, MessageBubbleTime } from './timestamp.pipe';\nimport { ViewIconPipe, ViewNamePipe } from './views.pipe';\n\nconst PIPES = [\n TimestampsPipe,\n MessageStatusType,\n ConversationRoutePipe,\n ConversationBadgePipe,\n ConversationUnseenPipe,\n ConversationYourExpertPipe,\n IsSystemMessagePipe,\n MessageFrom,\n MessageVia,\n ChatSourceIconName,\n MessageCodeBacktickPipe,\n TrimDescriptionPipe,\n FirebaseTimestampsToDatePipe,\n InArrayPipe,\n MessageTime,\n MessageBubbleTime,\n ViewIconPipe,\n ViewNamePipe,\n UnreadConversationsCountPipe,\n MaxFileSize,\n AcceptedFileType,\n GetMessageMediaUrlPipe,\n IsFromYouPipe,\n ChatProfileIconPipe,\n];\n\n@NgModule({\n imports: [CommonModule],\n declarations: [PIPES],\n exports: [PIPES],\n})\nexport class ConversationPipesModule {}\n","import { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core';\nimport { ConversationService } from '../../../../core/src/lib/conversation.service';\nimport { ConversationDetail } from '../../../../core/src/lib/interface/conversation.interface';\nimport { ReplaySubject } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\n\n@Component({\n selector: 'inbox-conversation-preview',\n templateUrl: './inbox-conversation-preview.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class InboxConversationPreviewComponent {\n private readonly conversationService = inject(ConversationService);\n private readonly conversationDetail$$ = new ReplaySubject(1);\n private readonly conversationDetail$ = this.conversationDetail$$.asObservable();\n protected readonly previewContent$ = this.conversationDetail$.pipe(\n switchMap((details) => this.conversationService.getPreviewContent(details)),\n );\n\n @Input() set conversationDetail(value: ConversationDetail) {\n this.conversationDetail$$.next(value);\n }\n}\n","\n","import { AsyncPipe, NgClass, NgStyle } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { BehaviorSubject } from 'rxjs';\nimport { ConversationDetail } from '../../../../core/src/lib/interface/conversation.interface';\nimport { CONVERSATION_HOST_APP_INTERFACE_TOKEN } from '../../../../core/src/lib/tokens';\n\n@Component({\n selector: 'inbox-conversation-title',\n templateUrl: './inbox-conversation-title.component.html',\n styleUrls: ['./inbox-conversation-title.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [AsyncPipe, NgStyle, NgClass, TranslateModule],\n})\nexport class InboxConversationTitleComponent {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n title$$ = new BehaviorSubject('');\n title$ = this.title$$.asObservable();\n\n isInternalInfoDeleted = false;\n\n @Input() set conversationDetail(value: ConversationDetail | null) {\n if (!value) {\n return;\n }\n const title = this.hostAppInterface.getConversationTitleInfo(value).title;\n this.title$$.next(title);\n this.isInternalInfoDeleted = this.hostAppInterface.isRecipientInternalInfoDeleted(value);\n }\n\n @Input() conversationClosed = false;\n @Input() displayOnTopBar = false;\n}\n","\n {{ title$ | async | translate }}\n\n","import { HttpResponse } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { ConversationApiService } from '@vendasta/conversation';\nimport { View } from '@vendasta/conversation/lib/_internal/objects/conversation-view';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { BehaviorSubject, Observable, combineLatest, switchMap } from 'rxjs';\nimport { distinctUntilChanged, filter, map, tap } from 'rxjs/operators';\nimport { ALL_VIEW_ID, FOLLOWING_VIEW_ID } from './inbox.constants';\nimport { ParticipantService } from './participant.service';\n\nconst localStorageKey = 'inbox-selected-view-id';\n\nexport const getDefaultViewId = (): string => localStorage.getItem(localStorageKey) || ALL_VIEW_ID;\n\n/**\n * Service that interacts with Inbox Views in conversation µservice\n */\n@Injectable()\nexport class ViewService {\n private readonly selectedViewId$$ = new BehaviorSubject(getDefaultViewId());\n readonly selectedViewId$ = this.selectedViewId$$.pipe(\n distinctUntilChanged(),\n tap((selectedViewId) => {\n this.analyticsService.trackEvent('inbox', 'views-tab', 'click', 0, {\n viewId: selectedViewId,\n });\n localStorage.setItem(localStorageKey, selectedViewId);\n }),\n );\n\n constructor(\n private analyticsService: ProductAnalyticsService,\n private conversationApiService: ConversationApiService,\n private participantService: ParticipantService,\n ) {}\n\n setViewId(viewId: string): void {\n this.selectedViewId$$.next(viewId);\n }\n\n // TODO MEGA-248: move view logic from conversationService to viewService\n loadViews(): Observable {\n return this.participantService.currentParticipant$.pipe(\n filter((participant) => !!participant),\n switchMap((participant) =>\n this.conversationApiService.getConversationViews({\n participantId: participant.participantId,\n }),\n ),\n map((res) => res.views),\n );\n }\n\n addConversationToConversationView(conversationId: string): Observable> {\n return combineLatest([this.participantService.currentParticipant$, this.loadViews()]).pipe(\n switchMap(([currentUserParticipant]) => {\n const value = {\n viewId: FOLLOWING_VIEW_ID,\n conversationId: conversationId,\n participantId: currentUserParticipant.participantId,\n };\n return this.conversationApiService.addConversationToConversationView(value);\n }),\n );\n }\n\n removeConversationFromConversationView(conversationId: string): Observable> {\n return this.participantService.currentParticipant$.pipe(\n switchMap((currentUserParticipant) => {\n const value = {\n viewId: FOLLOWING_VIEW_ID,\n conversationId: conversationId,\n participantId: currentUserParticipant.participantId,\n };\n return this.conversationApiService.removeConversationFromConversationView(value);\n }),\n );\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Query, collectionData, limit, query } from '@angular/fire/firestore';\nimport {\n BehaviorSubject,\n Observable,\n Subject,\n asyncScheduler,\n combineLatest,\n distinctUntilChanged,\n map,\n observeOn,\n of,\n shareReplay,\n startWith,\n switchMap,\n} from 'rxjs';\nimport { ConversationFilters } from './conversation-filters';\nimport { ConversationService } from './conversation.service';\nimport { FirestoreService } from './firestore.service';\nimport { FOLLOWING_VIEW_ID } from './inbox.constants';\nimport { InboxService } from './inbox.service';\nimport { ConversationDetail, FirestoreConversation } from './interface/conversation.interface';\nimport { ParticipantService } from './participant.service';\nimport { GROUP_ID_TOKEN } from './tokens';\nimport { ViewService } from './view.service';\n\n@Injectable({ providedIn: 'any' })\nexport class ConversationListService {\n private readonly participantService = inject(ParticipantService);\n private readonly inboxService = inject(InboxService);\n private readonly firestoreService = inject(FirestoreService);\n private readonly conversationService = inject(ConversationService);\n private readonly groupId$ = inject(GROUP_ID_TOKEN);\n\n readonly currentParticipant$ = this.participantService.currentParticipant$;\n\n private readonly filters$$ = new BehaviorSubject(null);\n private readonly loadMoreConversations$$ = new Subject();\n private readonly filterTerm$$ = new BehaviorSubject('');\n\n private readonly conversationsScrollable$ = combineLatest([\n this.currentParticipant$,\n this.participantService.organizationId$,\n inject(ViewService).selectedViewId$,\n this.inboxService.showInboxViews$,\n this.filterTerm$$,\n this.filters$$,\n this.groupId$,\n this.inboxService.isConversationSummaryEnabled$,\n ]).pipe(\n observeOn(asyncScheduler),\n switchMap(\n ([\n currentParticipant,\n organizationId,\n viewId,\n showViews,\n filterTerm,\n filters,\n groupId,\n showConversationSummary,\n ]) => {\n let pageSize = !filterTerm ? 20 : 200; // Get 200 results for a better chance of getting search results\n let conversations: ConversationDetail[] | null = [];\n if (!currentParticipant) {\n return of({\n conversations,\n loading: false,\n empty: true,\n });\n }\n\n return this.loadMoreConversations$$.pipe(\n startWith(null),\n switchMap(() => {\n let q =\n viewId === FOLLOWING_VIEW_ID && showViews\n ? this.firestoreService.getViewsConversationsQuery(currentParticipant.participantId, viewId)\n : this.firestoreService.setupBaseConversationsQuery(organizationId, filters, groupId);\n q = query(q, limit(pageSize));\n pageSize += 40;\n return this.fetchConversations(q, showConversationSummary).pipe(\n map((newConversations) => {\n conversations = newConversations;\n return {\n conversations: this.filterConversations(conversations, filterTerm),\n loading: false,\n empty: conversations.length === 0,\n };\n }),\n startWith({ conversations, loading: true, empty: null }),\n );\n }),\n );\n },\n ),\n takeUntilDestroyed(),\n shareReplay(1),\n );\n readonly conversations$: Observable = this.conversationsScrollable$.pipe(\n map((scrollable) => scrollable.conversations),\n distinctUntilChanged(),\n );\n readonly loadingConversations$: Observable = this.conversationsScrollable$.pipe(\n map((scrollable) => scrollable.loading),\n distinctUntilChanged(),\n );\n readonly emptyConversations$: Observable = this.conversationsScrollable$.pipe(\n map((scrollable) => scrollable.empty),\n distinctUntilChanged(),\n );\n\n // We use a realtime query for this instead of a count so that when the first message for an organization is sent, the\n // conversation list appears.\n readonly organizationHasConversations$ = combineLatest([this.participantService.organizationId$, this.groupId$]).pipe(\n switchMap(([organizationId, groupId]) => {\n let q = this.firestoreService.setupBaseConversationsQuery(organizationId, null, groupId, true, true);\n q = query(q, limit(1));\n return collectionData(q);\n }),\n map((res) => res.length > 0),\n takeUntilDestroyed(),\n shareReplay(1),\n );\n\n readonly organizationHasClosedConversations$ = this.participantService.organizationId$.pipe(\n switchMap((id) => {\n const filters: ConversationFilters = { isOpen: false, isAnonymous: false };\n let q = this.firestoreService.setupBaseConversationsQuery(id, filters, null, true, true);\n q = query(q, limit(1));\n return collectionData(q);\n }),\n map((res) => res.length > 0),\n takeUntilDestroyed(),\n shareReplay(1),\n );\n\n loadMoreConversations(): void {\n this.loadMoreConversations$$.next();\n }\n\n fetchConversations(\n conversationsCollection: Query,\n getSummary = false,\n ): Observable {\n return collectionData(conversationsCollection, { idField: 'id' }).pipe(\n map((cs) => cs.map((c) => c.conversationId).filter((id): id is string => !!id)),\n switchMap((ids) => this.conversationService.getMultiConversationDetails(ids, getSummary)),\n );\n }\n\n setFilterTerm(term: string): void {\n this.filterTerm$$.next(term);\n }\n\n private filterConversations(options: ConversationDetail[], term: string): ConversationDetail[] {\n term = term?.toUpperCase();\n if (!options) {\n return [];\n }\n\n if (!term) {\n return options;\n }\n\n return options.filter((conversationDetail) => {\n const participantsFiltered = conversationDetail?.participants?.filter(\n (participant) =>\n participant?.name?.toLocaleUpperCase().includes(term) ||\n participant?.phoneNumber?.toUpperCase().includes(term),\n );\n if (participantsFiltered && participantsFiltered.length > 0) {\n return conversationDetail;\n }\n });\n }\n\n updateFilters(filters: ConversationFilters | null): void {\n this.filters$$.next(filters);\n }\n}\n","import { InboxAtlasRoute } from '../../core/src/lib/interface/inbox.interface';\n\nexport const INBOX_NAVIGATION_LINK = ['', { outlets: { inbox: ['inbox'] } }];\nexport const INBOX_TEMPLATES_ROUTER_LINK = [\n '',\n { outlets: { inbox: ['inbox', 'settings', 'message-templates'] } },\n];\n\nexport const DEFAULT_MESSAGE_GROUPING_DURATION = 60000 * 10; // 10 minutes in milliseconds\nexport const DEFAULT_HOUR_GROUP_DURATION = 60000 * 60 * 3; // 3 hours in milliseconds\n","import { ChangeDetectionStrategy, Component, DestroyRef, Inject, Input, OnInit, inject } from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { FormControl, FormGroup } from '@angular/forms';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\nimport dayjs from 'dayjs';\nimport utc from 'dayjs/plugin/utc';\nimport { Timestamp } from 'firebase/firestore';\nimport { Observable, combineLatest } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, map, startWith, tap } from 'rxjs/operators';\nimport { ConversationListService } from '../../../../core/src/lib/conversation-list.service';\nimport { ConversationService } from '../../../../core/src/lib/conversation.service';\nimport { isMobile } from '../../../../core/src/lib/inbox-utils';\nimport { InboxService } from '../../../../core/src/lib/inbox.service';\nimport { ConversationDetail } from '../../../../core/src/lib/interface/conversation.interface';\nimport { ACCOUNT_GROUP_ID_TOKEN, CONVERSATION_ROUTES_TOKEN, PARTNER_ID_TOKEN } from '../../../../core/src/lib/tokens';\nimport { ViewService } from '../../../../core/src/lib/view.service';\n\ndayjs.extend(utc);\n\nconst currentViewId = () => {\n const route = inject(ActivatedRoute);\n return route.params.pipe(\n map((params) => params.viewId),\n distinctUntilChanged(),\n );\n};\n\n// This array of strings allows us to type-check at dev-time and at run-time,\n// using a helper method in the component. The `type InboxView` two lines down\n// is a string union infererred from this array of strings. cf.\n// https://dev.to/hansott/how-to-check-if-string-is-member-of-union-type-1j4m\nconst inboxViews = ['none', 'closed', 'anonymous'] as const;\ntype InboxViewTuple = typeof inboxViews;\ntype InboxView = InboxViewTuple[number];\n\n@Component({\n selector: 'inbox-pane',\n templateUrl: './inbox-pane.component.html',\n styleUrls: ['./inbox-pane.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class InboxPaneComponent implements OnInit {\n private readonly destroyRef = inject(DestroyRef);\n private readonly activeRoute = inject(ActivatedRoute);\n private readonly conversationListService = inject(ConversationListService);\n protected readonly showInboxViews$ = this.inboxService.showInboxViews$;\n\n readonly formGroup = new FormGroup({\n search: new FormControl('', { nonNullable: true }),\n view: new FormControl(this.getInitialView(), { nonNullable: true }),\n });\n\n filteredConversations$ = this.conversationListService.conversations$.pipe(\n tap(() => {\n //refresh \"now\"\n this.now = dayjs.utc();\n }),\n );\n\n routerState = '';\n currentConversationId = '';\n displayBadge$: Observable = this.conversationService.displayBadge$;\n\n loadingConversations$ = this.conversationListService.loadingConversations$;\n emptyConversations$ = this.conversationListService.emptyConversations$;\n hasClosedConversations$ = this.conversationListService.organizationHasClosedConversations$;\n\n now = dayjs.utc();\n\n viewId$ = currentViewId();\n\n // TODO: @ardydedase combine inputs into a single interface.\n @Input() learnMoreUrl = '';\n @Input() showSearchBar = true;\n @Input() emptyTitleMessage = 'INBOX.EMPTY.TITLE';\n @Input() emptySubtitleMessage = 'INBOX.EMPTY.SMS_SUBTITLE';\n @Input() conversationPath?: string;\n\n private readonly routes = toSignal(inject(CONVERSATION_ROUTES_TOKEN));\n\n readonly showFilters$ = this.viewService.selectedViewId$.pipe(map((viewId) => viewId === 'all'));\n readonly showToolbar$ = this.showFilters$.pipe(map((showFilters) => showFilters || this.showSearchBar));\n readonly isBusinessApp = this.inboxService.isBusinessApp;\n canAccessSMS$ = this.inboxService.canAccessSMS$;\n\n // TODO(BREW-575): We're going to combine the concepts of 'views' and 'filters'\n // into a single concept, using the dropdwon UI instead of tabs across the\n // top. But for now, we have to handle two different forms of empty view: one\n // for apps like PCC with 'views' tabs, and one for apps like BCC with the\n // 'filters' dropdown. This will get simpler when we consolidate those.\n showEmptyView$ = combineLatest([this.showInboxViews$, this.emptyConversations$]).pipe(\n map(([showInboxViews, emptyConversations]) => !!(showInboxViews && emptyConversations)),\n );\n\n // This is guaranteed to be mutually exclusive with showEmptyView$ because it\n // incorporates that observable in its logic. This will get simpler as\n // mentioned above. (BREW-575)\n showInboxZero$ = combineLatest([\n this.showFilters$,\n this.showEmptyView$,\n this.emptyConversations$,\n this.hasClosedConversations$,\n ]).pipe(\n map(([showFilters, showEmptyView, emptyConversations, hasClosedConversations]) => {\n const unfiltered = this.formGroup.controls.view.value === 'none';\n return !!(showFilters && unfiltered && emptyConversations && hasClosedConversations && !showEmptyView);\n }),\n );\n\n constructor(\n private conversationService: ConversationService,\n private inboxService: InboxService,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n @Inject(PARTNER_ID_TOKEN) readonly partnerId$: Observable,\n private router: Router,\n private readonly viewService: ViewService,\n ) {}\n\n ngOnInit(): void {\n this.activeRoute.queryParamMap.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((params) => {\n this.conversationListService.updateFilters({\n isAnonymous: params.get('view') === 'anonymous',\n isOpen: params.get('view') !== 'closed',\n });\n });\n\n const currentUrlParts = this.router.url.split('/');\n this.routerState = currentUrlParts[currentUrlParts.length - 1];\n if (!isMobile() && this.routerState === 'conversations') {\n this.router.navigate([`${this.routes()?.root}/inbox/home`]);\n }\n\n this.formGroup.controls.search.valueChanges\n .pipe(takeUntilDestroyed(this.destroyRef), debounceTime(500), startWith(''), distinctUntilChanged())\n .subscribe((term) => this.conversationListService.setFilterTerm(term));\n\n this.formGroup.controls.view.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((filter) => {\n const queryParams: Params = { view: filter ? filter : null };\n this.router.navigate([], {\n queryParams: queryParams,\n queryParamsHandling: 'merge',\n });\n });\n }\n\n conversationSelected(selected: boolean): void {\n this.conversationService.conversationSelected(selected);\n }\n\n withinPreviousDayFirestoreTimestamp(timestamp: Timestamp): boolean | undefined {\n if (timestamp) {\n return this.withinPreviousDay(timestamp.toDate());\n }\n }\n\n withinPreviousDay(date: Date): boolean | undefined {\n if (date) {\n return this.now.diff(dayjs(date), 'hour') <= 24;\n }\n }\n\n trackConversationDetailsById(i: number, conversationDetail: ConversationDetail): string | undefined {\n return conversationDetail?.conversation?.conversationId;\n }\n\n loadMoreConversations(): void {\n this.conversationListService.loadMoreConversations();\n }\n\n getInitialView(): InboxView {\n const viewParam = this.activeRoute.snapshot.queryParamMap.get('view') as InboxView;\n if (inboxViews.includes(viewParam)) {\n return viewParam;\n }\n return 'none';\n }\n}\n","\n\n
\n \n \n \n\n \n \n {{ 'INBOX.FILTERS.INBOX' | translate }}\n {{ 'INBOX.FILTERS.CLOSED' | translate }}\n \n {{ 'INBOX.FILTERS.ANONYMOUS' | translate }}\n \n \n
\n\n\n
\n \n \n \n
\n
\n
\n
\n \n {{ badge.participantType | translate }}\n \n
\n
\n
\n \n {{ 'INBOX.YOUR_EXPERT' | translate }}\n \n
\n
\n \n {{ conversationDetail | timestamp }}\n
\n \n
\n
\n
\n
\n
\n \n \n
\n \n \n \n
\n
\n \n
\n \n {{ conversationDetail | timestamp }}\n
\n \n
\n
\n
\n \n \n \n
\n \n \n \n \n\n\n\n\n\n","import { Component, inject } from '@angular/core';\nimport { ALL_VIEW_ID, FOLLOWING_VIEW_ID } from '../../../../core/src/lib/inbox.constants';\nimport { ViewService } from '../../../../core/src/lib/view.service';\nimport { CommonModule } from '@angular/common';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\n\n@Component({\n selector: 'inbox-views-empty',\n templateUrl: './inbox-views-empty.component.html',\n styleUrls: ['./inbox-views-empty.component.scss'],\n standalone: true,\n imports: [CommonModule, GalaxyEmptyStateModule],\n})\nexport class InboxViewsEmptyComponent {\n private readonly viewService = inject(ViewService);\n readonly selectedViewId$ = this.viewService.selectedViewId$;\n allViewId = ALL_VIEW_ID;\n followingViewId = FOLLOWING_VIEW_ID;\n}\n","\n\n\n
\n \n \n
\n
\n

\n Tap the ★ on any conversation you want to follow,\n and it will appear here.\n

\n
\n
\n
\n","import { booleanAttribute, Component, Input, inject } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { RouterLink } from '@angular/router';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { CONVERSATION_ROUTES_TOKEN } from '../../../../core/src/lib/tokens';\n\n@Component({\n selector: 'inbox-zero',\n standalone: true,\n imports: [CommonModule, TranslateModule, MatButtonModule, GalaxyEmptyStateModule, RouterLink],\n templateUrl: './inbox-zero.component.html',\n styleUrls: ['./inbox-zero.component.scss'],\n})\nexport class InboxZeroComponent {\n @Input({ transform: booleanAttribute }) showNewMessageButton = false;\n\n private readonly routes = toSignal(inject(CONVERSATION_ROUTES_TOKEN));\n\n newMessageUrl = this.routes()?.sendNewMessage;\n}\n","\n \n \n \n \n \n \n \n \n \n \n \n \n\n\n\n {{ 'INBOX.INBOX_ZERO.TITLE' | translate }}\n\n

{{ 'INBOX.INBOX_ZERO.DESCRIPTION' | translate }}

\n\n \n \n {{ 'INBOX.INBOX_ZERO.START_A_NEW_CONVERSATION' | translate }}\n \n \n
\n","import * as i0 from '@angular/core';\nimport { PLATFORM_ID, Injectable, Inject } from '@angular/core';\nimport { isPlatformBrowser, DOCUMENT } from '@angular/common';\n\n// This service is based on the `ng2-cookies` package which sadly is not a service and does\nlet CookieService = /*#__PURE__*/(() => {\n class CookieService {\n constructor(document,\n // Get the `PLATFORM_ID` so we can check if we're in a browser.\n platformId) {\n this.document = document;\n this.platformId = platformId;\n this.documentIsAccessible = isPlatformBrowser(this.platformId);\n }\n /**\n * Get cookie Regular Expression\n *\n * @param name Cookie name\n * @returns property RegExp\n *\n * @author: Stepan Suvorov\n * @since: 1.0.0\n */\n static getCookieRegExp(name) {\n const escapedName = name.replace(/([\\[\\]\\{\\}\\(\\)\\|\\=\\;\\+\\?\\,\\.\\*\\^\\$])/gi, '\\\\$1');\n return new RegExp('(?:^' + escapedName + '|;\\\\s*' + escapedName + ')=(.*?)(?:;|$)', 'g');\n }\n /**\n * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n * @param encodedURIComponent A value representing an encoded URI component.\n *\n * @returns The unencoded version of an encoded component of a Uniform Resource Identifier (URI).\n *\n * @author: Stepan Suvorov\n * @since: 1.0.0\n */\n static safeDecodeURIComponent(encodedURIComponent) {\n try {\n return decodeURIComponent(encodedURIComponent);\n } catch {\n // probably it is not uri encoded. return as is\n return encodedURIComponent;\n }\n }\n /**\n * Return `true` if {@link Document} is accessible, otherwise return `false`\n *\n * @param name Cookie name\n * @returns boolean - whether cookie with specified name exists\n *\n * @author: Stepan Suvorov\n * @since: 1.0.0\n */\n check(name) {\n if (!this.documentIsAccessible) {\n return false;\n }\n name = encodeURIComponent(name);\n const regExp = CookieService.getCookieRegExp(name);\n return regExp.test(this.document.cookie);\n }\n /**\n * Get cookies by name\n *\n * @param name Cookie name\n * @returns property value\n *\n * @author: Stepan Suvorov\n * @since: 1.0.0\n */\n get(name) {\n if (this.documentIsAccessible && this.check(name)) {\n name = encodeURIComponent(name);\n const regExp = CookieService.getCookieRegExp(name);\n const result = regExp.exec(this.document.cookie);\n return result[1] ? CookieService.safeDecodeURIComponent(result[1]) : '';\n } else {\n return '';\n }\n }\n /**\n * Get all cookies in JSON format\n *\n * @returns all the cookies in json\n *\n * @author: Stepan Suvorov\n * @since: 1.0.0\n */\n getAll() {\n if (!this.documentIsAccessible) {\n return {};\n }\n const cookies = {};\n const document = this.document;\n if (document.cookie && document.cookie !== '') {\n document.cookie.split(';').forEach(currentCookie => {\n const [cookieName, cookieValue] = currentCookie.split('=');\n cookies[CookieService.safeDecodeURIComponent(cookieName.replace(/^ /, ''))] = CookieService.safeDecodeURIComponent(cookieValue);\n });\n }\n return cookies;\n }\n set(name, value, expiresOrOptions, path, domain, secure, sameSite) {\n if (!this.documentIsAccessible) {\n return;\n }\n if (typeof expiresOrOptions === 'number' || expiresOrOptions instanceof Date || path || domain || secure || sameSite) {\n const optionsBody = {\n expires: expiresOrOptions,\n path,\n domain,\n secure,\n sameSite: sameSite ? sameSite : 'Lax'\n };\n this.set(name, value, optionsBody);\n return;\n }\n let cookieString = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';';\n const options = expiresOrOptions ? expiresOrOptions : {};\n if (options.expires) {\n if (typeof options.expires === 'number') {\n const dateExpires = new Date(new Date().getTime() + options.expires * 1000 * 60 * 60 * 24);\n cookieString += 'expires=' + dateExpires.toUTCString() + ';';\n } else {\n cookieString += 'expires=' + options.expires.toUTCString() + ';';\n }\n }\n if (options.path) {\n cookieString += 'path=' + options.path + ';';\n }\n if (options.domain) {\n cookieString += 'domain=' + options.domain + ';';\n }\n if (options.secure === false && options.sameSite === 'None') {\n options.secure = true;\n console.warn(`[ngx-cookie-service] Cookie ${name} was forced with secure flag because sameSite=None.` + `More details : https://github.com/stevermeister/ngx-cookie-service/issues/86#issuecomment-597720130`);\n }\n if (options.secure) {\n cookieString += 'secure;';\n }\n if (!options.sameSite) {\n options.sameSite = 'Lax';\n }\n cookieString += 'sameSite=' + options.sameSite + ';';\n this.document.cookie = cookieString;\n }\n /**\n * Delete cookie by name\n *\n * @param name Cookie name\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Cookie secure flag\n * @param sameSite Cookie sameSite flag - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite\n *\n * @author: Stepan Suvorov\n * @since: 1.0.0\n */\n delete(name, path, domain, secure, sameSite = 'Lax') {\n if (!this.documentIsAccessible) {\n return;\n }\n const expiresDate = new Date('Thu, 01 Jan 1970 00:00:01 GMT');\n this.set(name, '', {\n expires: expiresDate,\n path,\n domain,\n secure,\n sameSite\n });\n }\n /**\n * Delete all cookies\n *\n * @param path Cookie path\n * @param domain Cookie domain\n * @param secure Is the Cookie secure\n * @param sameSite Is the cookie same site\n *\n * @author: Stepan Suvorov\n * @since: 1.0.0\n */\n deleteAll(path, domain, secure, sameSite = 'Lax') {\n if (!this.documentIsAccessible) {\n return;\n }\n const cookies = this.getAll();\n for (const cookieName in cookies) {\n if (cookies.hasOwnProperty(cookieName)) {\n this.delete(cookieName, path, domain, secure, sameSite);\n }\n }\n }\n }\n CookieService.ɵfac = function CookieService_Factory(t) {\n return new (t || CookieService)(i0.ɵɵinject(DOCUMENT), i0.ɵɵinject(PLATFORM_ID));\n };\n CookieService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CookieService,\n factory: CookieService.ɵfac,\n providedIn: 'root'\n });\n return CookieService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/*\n * Public API Surface of ngx-cookie-service\n */\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { CookieService };\n","import { Inject, Injectable } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { NotificationsService } from '@galaxy/atlas';\nimport { NotificationMedium, NotificationSetting } from '@vendasta/notifications-sdk';\nimport { NotificationContext } from '@vendasta/notifications-sdk/lib/_internal/objects/api';\nimport { CookieService } from 'ngx-cookie-service';\nimport { BehaviorSubject, Observable, combineLatest, switchMap } from 'rxjs';\nimport { PARTNER_ID_TOKEN, USER_ID_TOKEN } from './tokens';\n\nconst INBOX_NOTIFICATION_TYPE_ID = 'inbox-messages';\nconst TURN_ON_NOTIFICATION_COOKIE = 'inbox-turn-on-notification';\n\n@Injectable()\nexport class InboxNotificationService {\n readonly inboxNotificationStatus$ = combineLatest([this.partnerId$, this.userId$]).pipe(\n switchMap(([partnerId, userId]) => {\n return this.notificationsService.getNotificationSettingStatus$(\n partnerId,\n { user: { userId: userId } },\n INBOX_NOTIFICATION_TYPE_ID,\n );\n }),\n );\n\n private userCookiesValue$$ = new BehaviorSubject('');\n\n constructor(\n private readonly notificationsService: NotificationsService,\n private readonly cookieService: CookieService,\n @Inject(USER_ID_TOKEN) readonly userId$: Observable,\n @Inject(PARTNER_ID_TOKEN) readonly partnerId$: Observable,\n ) {\n combineLatest([this.partnerId$, this.userId$])\n .pipe(takeUntilDestroyed())\n .subscribe(([partnerId, userId]) =>\n this.userCookiesValue$$.next(`${partnerId}-${userId}-${TURN_ON_NOTIFICATION_COOKIE}`),\n );\n }\n\n private getCookie(): string {\n return this.cookieService.get(TURN_ON_NOTIFICATION_COOKIE);\n }\n\n public getCookieStatus(): boolean {\n return this.getCookie() === this.userCookiesValue$$.getValue();\n }\n\n public setCookie(): void {\n const expiry = new Date();\n // we would like to make the warning banner disappear for 7 days after close\n expiry.setDate(expiry.getDate() + 6);\n this.cookieService.set(TURN_ON_NOTIFICATION_COOKIE, this.userCookiesValue$$.getValue(), expiry);\n }\n\n public turnOnOnlyMyEventsNotification$() {\n return combineLatest([this.userId$, this.partnerId$]).pipe(\n switchMap(([userId, partnerId]) => {\n const context = {\n user: {\n userId: userId,\n },\n } as NotificationContext;\n\n const emailSetting = {\n context: context,\n notificationTypeId: INBOX_NOTIFICATION_TYPE_ID,\n notificationMedium: NotificationMedium.NOTIFICATION_MEDIUM_EMAIL,\n } as NotificationSetting;\n\n const webSetting = {\n context: context,\n notificationTypeId: INBOX_NOTIFICATION_TYPE_ID,\n notificationMedium: NotificationMedium.NOTIFICATION_MEDIUM_WEB,\n } as NotificationSetting;\n\n return this.notificationsService.saveSettingMulti$(partnerId, [emailSetting, webSetting]);\n }),\n );\n }\n}\n","import { Component, DestroyRef, Input } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Router } from '@angular/router';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { ReplaySubject, combineLatest } from 'rxjs';\nimport { ConversationListService } from '../../../../core/src/lib/conversation-list.service';\nimport { ConversationService } from '../../../../core/src/lib/conversation.service';\nimport { InboxNotificationService } from '../../../../core/src/lib/inbox-notification.service';\nimport { ALL_VIEW_ID } from '../../../../core/src/lib/inbox.constants';\nimport { ViewService } from '../../../../core/src/lib/view.service';\n\nconst FOLLOW_VIEW_ID = 'following';\n\n@Component({\n selector: 'inbox-views',\n templateUrl: './inbox-views.component.html',\n styleUrls: ['./inbox-views.component.scss'],\n})\nexport class InboxViewsComponent {\n @Input() viewMode = false;\n readonly views$ = this.viewService.loadViews();\n selectedViewId$ = this.viewService.selectedViewId$;\n readonly allViewId = ALL_VIEW_ID;\n\n private readonly notificationWarningView$$: ReplaySubject = new ReplaySubject();\n readonly notificationWarningView$ = this.notificationWarningView$$.asObservable();\n\n constructor(\n private readonly router: Router,\n private readonly conversationService: ConversationService,\n private readonly conversationListService: ConversationListService,\n private readonly notificationsService: InboxNotificationService,\n private readonly viewService: ViewService,\n private readonly snackbarService: SnackbarService,\n private readonly destroyRef: DestroyRef,\n ) {}\n\n showView(viewId: string): void {\n this.conversationService.removeLastConversationId();\n this.router.navigate([{ outlets: { inbox: ['inbox', 'views', viewId, 'conversations'] } }]);\n this.viewService.setViewId(viewId);\n this.conversationService.conversationSelected(false);\n this.notificationWarningBannerStatus(viewId);\n }\n\n notificationWarningBannerStatus(viewSection: string): void {\n combineLatest([\n this.notificationsService.inboxNotificationStatus$,\n this.conversationService.conversationSelected$,\n this.conversationListService.conversations$,\n ])\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(([notificationSetting, conversationSelected, conversations]) => {\n const showNotificationWarningBanner =\n conversations && conversations.length > 0\n ? notificationSetting === false &&\n viewSection === FOLLOW_VIEW_ID &&\n this.notificationsService.getCookieStatus() === false &&\n conversationSelected === false\n : false;\n this.notificationWarningView$$.next(showNotificationWarningBanner);\n });\n }\n\n turnOnNotifications(): void {\n this.notificationsService\n .turnOnOnlyMyEventsNotification$()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n this.notificationWarningView$$.next(false);\n this.snackbarService.openSuccessSnack('INBOX.WARNING.NOTIFICATION_UPDATE_SUCCESS');\n },\n error: () => {\n this.snackbarService.openErrorSnack('INBOX.WARNING.NOTIFICATION_UPDATE_ERROR');\n },\n });\n }\n\n onClose(): void {\n this.notificationWarningView$$.next(false);\n this.notificationsService.setCookie();\n }\n}\n","\n {{ 'INBOX.WARNING.TURN_ON_NOTIFICATIONS' | translate }}\n {{ 'INBOX.WARNING.TURN_ON_NOTIFICATIONS_DETAILS' | translate }}\n {{ 'INBOX.WARNING.NOTIFICATION_SETTINGS' | translate }}\n\n\n \n {{ allViewId | viewName | translate }}\n \n \n star\n {{ view.viewId | viewName | translate }} \n \n {{ view.viewId | unreadConversationsCount | async }}\n \n \n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n OnDestroy,\n OnInit,\n Output,\n Self,\n inject,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n AbstractControl,\n FormControl,\n FormsModule,\n NG_VALUE_ACCESSOR,\n NgControl,\n ReactiveFormsModule,\n SelectControlValueAccessor,\n UntypedFormControl,\n ValidationErrors,\n ValidatorFn,\n} from '@angular/forms';\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { Router } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ConversationChannel } from '@vendasta/conversation';\nimport { parsePhoneNumber } from 'libphonenumber-js';\nimport { Observable, Subject, debounceTime, of, shareReplay, skip, switchMap, takeUntil } from 'rxjs';\nimport { InboxContact, InboxContactInfo } from '../../../../core/src/lib/interface/inbox.interface';\nimport { ParticipantService } from '../../../../core/src/lib/participant.service';\nimport { ACCOUNT_GROUP_ID_TOKEN, CONVERSATION_ROUTES_TOKEN } from '../../../../core/src/lib/tokens';\nimport { InboxService } from '../../../../core/src/lib/inbox.service';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { Validator } from '@vendasta/shared';\n\nexport class SelectContactControl extends FormControl {\n constructor(value?: InboxContact | string, validator?: ValidatorFn | ValidatorFn[] | null) {\n const validators = validator ? [controlValidator(), validator].flat() : [controlValidator()];\n super(value, validators);\n }\n}\n\nfunction isPhoneNumberAttempt(value: string): boolean {\n return !isNaN(Number(value.replace(/[-+)(\\s]/g, '')));\n}\n\nfunction isEmailAttempt(value: string): boolean {\n return /@.*\\./.test(value);\n}\n\n@Component({\n selector: 'inbox-select-contact',\n templateUrl: './inbox-select-contact.component.html',\n styleUrls: ['./inbox-select-contact.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useClass: SelectControlValueAccessor,\n multi: true,\n },\n ],\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n FormsModule,\n ReactiveFormsModule,\n MatButtonModule,\n MatIconModule,\n MatFormFieldModule,\n MatInputModule,\n MatProgressBarModule,\n MatAutocompleteModule,\n GalaxyFormFieldModule,\n ],\n})\nexport class InboxSelectContactComponent implements OnDestroy, OnInit {\n control?: SelectContactControl;\n private readonly inboxService = inject(InboxService);\n private readonly unsubscribe$ = new Subject();\n\n contacts$?: Observable;\n //TODO: MEGA-868 Delete this and the HTML if validation when the email channel feature is released\n readonly emailChannelSupported = toSignal(this.inboxService.canAccessEmailChannel$);\n\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n private readonly routes = toSignal(inject(CONVERSATION_ROUTES_TOKEN));\n\n @Output() suggestedChannel = new EventEmitter();\n\n constructor(\n private router: Router,\n private participantService: ParticipantService,\n @Self() readonly ngControl: NgControl,\n ) {}\n\n ngOnInit(): void {\n if (!this.ngControl || !(this.ngControl.control instanceof SelectContactControl)) {\n throw new Error('CustomInputComponent: No ControlValueAccessor provided');\n }\n this.control = this.ngControl.control;\n\n this.contacts$ = this.control.valueChanges.pipe(\n debounceTime(200),\n takeUntil(this.unsubscribe$),\n switchMap((term) => {\n if (typeof term === 'object' && term.contactId) {\n return of([] as InboxContact[]);\n }\n const searchTerm = this.getSearchTerm(term);\n\n this.participantService.searchContacts(searchTerm ?? '', this.accountGroupId() ?? '');\n // skip the first value because it always starts as []\n return this.participantService.contacts$.pipe(skip(1));\n }),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n ngOnDestroy(): void {\n this.unsubscribe$.next();\n this.unsubscribe$.complete();\n }\n\n async searchChanged(): Promise {\n const contact = this.control?.value;\n if (typeof contact !== 'string' || !this.control) return;\n\n try {\n if (Validator.isEmail(this.control) === null && contact.length) {\n this.control.setValue({ email: contact });\n return;\n }\n\n const parsed = parsePhoneNumber(contact, 'US');\n if (parsed.isValid()) this.control.setValue({ phone: parsed.number });\n } catch (error) {\n return;\n }\n }\n\n openAddContactForm(): void {\n const routes = this.routes();\n if (!this.control || !routes) return;\n\n const searchTerm = this.control.value;\n\n let inputValue;\n if (typeof searchTerm === 'string' && isPhoneNumberAttempt(searchTerm)) {\n inputValue = { phone: searchTerm };\n }\n if (typeof searchTerm === 'string' && isEmailAttempt(searchTerm)) {\n inputValue = { email: searchTerm };\n }\n\n this.router.navigate([routes.root, 'inbox', 'create-contact'], {\n state: typeof searchTerm === 'object' ? { ...searchTerm } : inputValue ?? { firstName: searchTerm },\n });\n }\n\n displayContactInfo(contact: InboxContact): InboxContactInfo | null {\n if (!contact) return null;\n\n const phone = contact?.phone ? parsePhoneNumber(contact.phone, 'US') : undefined;\n const email = contact?.email;\n\n return {\n name: [contact.firstName, contact.lastName].filter((s) => !!s).join(' '),\n phoneAndEmail: [phone ? `+${phone?.countryCallingCode} ${phone?.formatNational()}` : undefined, email]\n .filter((s) => !!s)\n .join(' '),\n };\n }\n\n displayContact(contact: InboxContact): string {\n if (!contact) return '';\n\n const phone = contact?.phone ? parsePhoneNumber(contact.phone, 'US') : undefined;\n const email = contact?.email;\n\n return [\n contact.firstName,\n contact.lastName,\n phone ? `+${phone?.countryCallingCode} ${phone?.formatNational()}` : undefined,\n email,\n ]\n .filter((s) => !!s)\n .join(' ');\n }\n\n getPhoneSearchTerm(term: string): string {\n const cleanTerm = term.replace(/[-+)(\\s]/g, '').trim();\n\n if (cleanTerm.startsWith('1')) return '+' + cleanTerm;\n\n return '+1' + cleanTerm;\n }\n\n getSearchTerm(term: string | InboxContact): string {\n const emailControlValue = { value: term } as AbstractControl;\n const phoneControlValue = { value: term } as UntypedFormControl;\n\n switch (typeof term) {\n case 'object':\n if (term?.phone) {\n this.suggestedChannel.emit(ConversationChannel.CONVERSATION_CHANNEL_SMS);\n return term?.phone;\n }\n if (term?.email) {\n this.suggestedChannel.emit(ConversationChannel.CONVERSATION_CHANNEL_EMAIL);\n return term?.email;\n }\n return '';\n case 'string':\n if (Validator.isPhoneNumber(phoneControlValue) === null && term.length) {\n this.suggestedChannel.emit(ConversationChannel.CONVERSATION_CHANNEL_SMS);\n return this.getPhoneSearchTerm(term);\n }\n if (Validator.isEmail(emailControlValue) === null && term.length) {\n this.suggestedChannel.emit(ConversationChannel.CONVERSATION_CHANNEL_EMAIL);\n return term;\n }\n this.suggestedChannel.emit(ConversationChannel.CONVERSATION_CHANNEL_UNDEFINED);\n return term;\n default:\n this.suggestedChannel.emit(ConversationChannel.CONVERSATION_CHANNEL_UNDEFINED);\n return term;\n }\n }\n}\n\nfunction controlValidator(): ValidatorFn {\n //TODO: MEGA-868 Delete the service injection and validation when the email channel feature is released\n const canAccessEmailChannel = toSignal(inject(InboxService).canAccessEmailChannel$);\n\n return (control: AbstractControl): ValidationErrors | null => {\n const invalidInputError = canAccessEmailChannel() ? { invalidInput: true } : { phone: true };\n\n const { value: contact } = control;\n\n if (!contact) return { invalidSelection: true };\n\n if (typeof contact === 'string') {\n let validPhoneNumber: boolean;\n try {\n //TODO: MEGA-1093 - use CRM shared validator instead of external library\n const parsedPhoneNumber = parsePhoneNumber(contact, 'US');\n validPhoneNumber = parsedPhoneNumber.isValid();\n } catch (error) {\n validPhoneNumber = false;\n }\n\n const validEmail = Validator.isEmail(control) === null;\n return validPhoneNumber || validEmail ? null : invalidInputError;\n }\n\n return null;\n };\n}\n","
\n \n {{ 'INBOX.NEW_MESSAGE.SEND_TO' | translate }}\n \n \n \n \n \n {{ displayContactInfo(contact).name }}\n \n
\n \n {{ displayContactInfo(contact).phoneAndEmail }}\n \n
\n
\n \n {{ 'INBOX.ERROR.INVALID_PHONE_NUMBER' | translate }}\n \n \n {{ 'INBOX.ERROR.INVALID_INPUT' | translate }}\n \n \n {{ 'INBOX.ERROR.REQUIRED_FIELD' | translate }}\n \n
\n \n add\n {{ 'INBOX.NEW_MESSAGE.CREATE_A_NEW_CONTACT' | translate }}\n \n
\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nimport { map } from 'rxjs/operators';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar EventType = /*#__PURE__*/function (EventType) {\n EventType[EventType[\"EVENT_TYPE_UNSPECIFIED\"] = 0] = \"EVENT_TYPE_UNSPECIFIED\";\n EventType[EventType[\"EVENT_TYPE_TYPING_STARTED\"] = 1] = \"EVENT_TYPE_TYPING_STARTED\";\n EventType[EventType[\"EVENT_TYPE_TYPING_STOPPED\"] = 2] = \"EVENT_TYPE_TYPING_STOPPED\";\n EventType[EventType[\"EVENT_TYPE_REPRESENTATIVE_JOINED\"] = 3] = \"EVENT_TYPE_REPRESENTATIVE_JOINED\";\n EventType[EventType[\"EVENT_TYPE_REPRESENTATIVE_LEFT\"] = 4] = \"EVENT_TYPE_REPRESENTATIVE_LEFT\";\n return EventType;\n}(EventType || {});\nvar MessageType = /*#__PURE__*/function (MessageType) {\n MessageType[MessageType[\"MESSAGE_TYPE_UNSPECIFIED\"] = 0] = \"MESSAGE_TYPE_UNSPECIFIED\";\n MessageType[MessageType[\"MESSAGE_TYPE_TEXT\"] = 1] = \"MESSAGE_TYPE_TEXT\";\n MessageType[MessageType[\"MESSAGE_TYPE_IMAGE\"] = 2] = \"MESSAGE_TYPE_IMAGE\";\n return MessageType;\n}(MessageType || {});\nvar UserType = /*#__PURE__*/function (UserType) {\n UserType[UserType[\"USER_TYPE_UNSPECIFIED\"] = 0] = \"USER_TYPE_UNSPECIFIED\";\n UserType[UserType[\"USER_TYPE_BOT\"] = 1] = \"USER_TYPE_BOT\";\n UserType[UserType[\"USER_TYPE_HUMAN\"] = 2] = \"USER_TYPE_HUMAN\";\n return UserType;\n}(UserType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar MetricType = /*#__PURE__*/function (MetricType) {\n MetricType[MetricType[\"NONE\"] = 0] = \"NONE\";\n MetricType[MetricType[\"QUERIES_DIRECT\"] = 1] = \"QUERIES_DIRECT\";\n MetricType[MetricType[\"QUERIES_INDIRECT\"] = 2] = \"QUERIES_INDIRECT\";\n MetricType[MetricType[\"VIEWS_MAPS\"] = 3] = \"VIEWS_MAPS\";\n MetricType[MetricType[\"VIEWS_SEARCH\"] = 4] = \"VIEWS_SEARCH\";\n MetricType[MetricType[\"ACTIONS_WEBSITE\"] = 5] = \"ACTIONS_WEBSITE\";\n MetricType[MetricType[\"ACTIONS_PHONE\"] = 6] = \"ACTIONS_PHONE\";\n MetricType[MetricType[\"ACTIONS_DRIVING_DIRECTIONS\"] = 7] = \"ACTIONS_DRIVING_DIRECTIONS\";\n MetricType[MetricType[\"QUERIES_CHAIN\"] = 8] = \"QUERIES_CHAIN\";\n MetricType[MetricType[\"PHOTOS_VIEWS_MERCHANT\"] = 9] = \"PHOTOS_VIEWS_MERCHANT\";\n MetricType[MetricType[\"PHOTOS_VIEWS_CUSTOMERS\"] = 10] = \"PHOTOS_VIEWS_CUSTOMERS\";\n MetricType[MetricType[\"PHOTOS_COUNT_MERCHANT\"] = 11] = \"PHOTOS_COUNT_MERCHANT\";\n MetricType[MetricType[\"PHOTOS_COUNT_CUSTOMERS\"] = 12] = \"PHOTOS_COUNT_CUSTOMERS\";\n MetricType[MetricType[\"LOCAL_POST_VIEWS_SEARCH\"] = 13] = \"LOCAL_POST_VIEWS_SEARCH\";\n MetricType[MetricType[\"LOCAL_POST_ACTIONS_CALL_TO_ACTION\"] = 14] = \"LOCAL_POST_ACTIONS_CALL_TO_ACTION\";\n return MetricType;\n}(MetricType || {});\nvar Period = /*#__PURE__*/function (Period) {\n Period[Period[\"DAY\"] = 0] = \"DAY\";\n Period[Period[\"WEEK\"] = 1] = \"WEEK\";\n Period[Period[\"MONTH\"] = 2] = \"MONTH\";\n return Period;\n}(Period || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$8(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$7(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass GoogleDate {\n static fromProto(proto) {\n let m = new GoogleDate();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.year !== 'undefined') {\n toReturn['year'] = this.year;\n }\n if (typeof this.month !== 'undefined') {\n toReturn['month'] = this.month;\n }\n if (typeof this.day !== 'undefined') {\n toReturn['day'] = this.day;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$6(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass PostInsightsHistory {\n static fromProto(proto) {\n let m = new PostInsightsHistory();\n m = Object.assign(m, proto);\n if (proto.views) {\n m.views = parseInt(proto.views, 10);\n }\n if (proto.callToActionClicks) {\n m.callToActionClicks = parseInt(proto.callToActionClicks, 10);\n }\n if (proto.postedDateTime) {\n m.postedDateTime = new Date(proto.postedDateTime);\n }\n if (proto.statsDateTime) {\n m.statsDateTime = new Date(proto.statsDateTime);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n if (typeof this.internalPostId !== 'undefined') {\n toReturn['internalPostId'] = this.internalPostId;\n }\n if (typeof this.views !== 'undefined') {\n toReturn['views'] = this.views;\n }\n if (typeof this.callToActionClicks !== 'undefined') {\n toReturn['callToActionClicks'] = this.callToActionClicks;\n }\n if (typeof this.postedDateTime !== 'undefined' && this.postedDateTime !== null) {\n toReturn['postedDateTime'] = 'toApiJson' in this.postedDateTime ? this.postedDateTime.toApiJson() : this.postedDateTime;\n }\n if (typeof this.statsDateTime !== 'undefined' && this.statsDateTime !== null) {\n toReturn['statsDateTime'] = 'toApiJson' in this.statsDateTime ? this.statsDateTime.toApiJson() : this.statsDateTime;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Answer {\n static fromProto(proto) {\n let m = new Answer();\n m = Object.assign(m, proto);\n if (proto.upVoteCount) {\n m.upVoteCount = parseInt(proto.upVoteCount, 10);\n }\n if (proto.published) {\n m.published = new Date(proto.published);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.modified) {\n m.modified = new Date(proto.modified);\n }\n if (proto.previousVersions) {\n m.previousVersions = proto.previousVersions.map(Answer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.locationId !== 'undefined') {\n toReturn['locationId'] = this.locationId;\n }\n if (typeof this.questionId !== 'undefined') {\n toReturn['questionId'] = this.questionId;\n }\n if (typeof this.version !== 'undefined') {\n toReturn['version'] = this.version;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.author !== 'undefined') {\n toReturn['author'] = this.author;\n }\n if (typeof this.authorPhotoUrl !== 'undefined') {\n toReturn['authorPhotoUrl'] = this.authorPhotoUrl;\n }\n if (typeof this.authorType !== 'undefined') {\n toReturn['authorType'] = this.authorType;\n }\n if (typeof this.answerId !== 'undefined') {\n toReturn['answerId'] = this.answerId;\n }\n if (typeof this.upVoteCount !== 'undefined') {\n toReturn['upVoteCount'] = this.upVoteCount;\n }\n if (typeof this.published !== 'undefined' && this.published !== null) {\n toReturn['published'] = 'toApiJson' in this.published ? this.published.toApiJson() : this.published;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.modified !== 'undefined' && this.modified !== null) {\n toReturn['modified'] = 'toApiJson' in this.modified ? this.modified.toApiJson() : this.modified;\n }\n if (typeof this.previousVersions !== 'undefined' && this.previousVersions !== null) {\n toReturn['previousVersions'] = 'toApiJson' in this.previousVersions ? this.previousVersions.toApiJson() : this.previousVersions;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Question {\n static fromProto(proto) {\n let m = new Question();\n m = Object.assign(m, proto);\n if (proto.totalAnswerCount) {\n m.totalAnswerCount = parseInt(proto.totalAnswerCount, 10);\n }\n if (proto.upVoteCount) {\n m.upVoteCount = parseInt(proto.upVoteCount, 10);\n }\n if (proto.published) {\n m.published = new Date(proto.published);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.modified) {\n m.modified = new Date(proto.modified);\n }\n if (proto.answers) {\n m.answers = proto.answers.map(Answer.fromProto);\n }\n if (proto.previousVersions) {\n m.previousVersions = proto.previousVersions.map(Question.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.locationId !== 'undefined') {\n toReturn['locationId'] = this.locationId;\n }\n if (typeof this.questionId !== 'undefined') {\n toReturn['questionId'] = this.questionId;\n }\n if (typeof this.version !== 'undefined') {\n toReturn['version'] = this.version;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.author !== 'undefined') {\n toReturn['author'] = this.author;\n }\n if (typeof this.authorPhotoUrl !== 'undefined') {\n toReturn['authorPhotoUrl'] = this.authorPhotoUrl;\n }\n if (typeof this.authorType !== 'undefined') {\n toReturn['authorType'] = this.authorType;\n }\n if (typeof this.totalAnswerCount !== 'undefined') {\n toReturn['totalAnswerCount'] = this.totalAnswerCount;\n }\n if (typeof this.upVoteCount !== 'undefined') {\n toReturn['upVoteCount'] = this.upVoteCount;\n }\n if (typeof this.published !== 'undefined' && this.published !== null) {\n toReturn['published'] = 'toApiJson' in this.published ? this.published.toApiJson() : this.published;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.modified !== 'undefined' && this.modified !== null) {\n toReturn['modified'] = 'toApiJson' in this.modified ? this.modified.toApiJson() : this.modified;\n }\n if (typeof this.answers !== 'undefined' && this.answers !== null) {\n toReturn['answers'] = 'toApiJson' in this.answers ? this.answers.toApiJson() : this.answers;\n }\n if (typeof this.previousVersions !== 'undefined' && this.previousVersions !== null) {\n toReturn['previousVersions'] = 'toApiJson' in this.previousVersions ? this.previousVersions.toApiJson() : this.previousVersions;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CreateEventRequest {\n static fromProto(proto) {\n let m = new CreateEventRequest();\n m = Object.assign(m, proto);\n if (proto.eventType) {\n m.eventType = enumStringToValue$3(EventType, proto.eventType);\n }\n if (proto.user) {\n m.user = User.fromProto(proto.user);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.eventType !== 'undefined') {\n toReturn['eventType'] = this.eventType;\n }\n if (typeof this.user !== 'undefined' && this.user !== null) {\n toReturn['user'] = 'toApiJson' in this.user ? this.user.toApiJson() : this.user;\n }\n if (typeof this.gmbConversationId !== 'undefined') {\n toReturn['gmbConversationId'] = this.gmbConversationId;\n }\n return toReturn;\n }\n}\nclass CreateEventResponse {\n static fromProto(proto) {\n let m = new CreateEventResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.eventId !== 'undefined') {\n toReturn['eventId'] = this.eventId;\n }\n return toReturn;\n }\n}\nclass Image {\n static fromProto(proto) {\n let m = new Image();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.fileUrl !== 'undefined') {\n toReturn['fileUrl'] = this.fileUrl;\n }\n return toReturn;\n }\n}\nclass SendMessageRequest {\n static fromProto(proto) {\n let m = new SendMessageRequest();\n m = Object.assign(m, proto);\n if (proto.sender) {\n m.sender = User.fromProto(proto.sender);\n }\n if (proto.image) {\n m.image = Image.fromProto(proto.image);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.gmbConversationId !== 'undefined') {\n toReturn['gmbConversationId'] = this.gmbConversationId;\n }\n if (typeof this.sender !== 'undefined' && this.sender !== null) {\n toReturn['sender'] = 'toApiJson' in this.sender ? this.sender.toApiJson() : this.sender;\n }\n if (typeof this.image !== 'undefined' && this.image !== null) {\n toReturn['image'] = 'toApiJson' in this.image ? this.image.toApiJson() : this.image;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n return toReturn;\n }\n}\nclass SendMessageResponse {\n static fromProto(proto) {\n let m = new SendMessageResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.messageId !== 'undefined') {\n toReturn['messageId'] = this.messageId;\n }\n return toReturn;\n }\n}\nclass User {\n static fromProto(proto) {\n let m = new User();\n m = Object.assign(m, proto);\n if (proto.userType) {\n m.userType = enumStringToValue$3(UserType, proto.userType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userName !== 'undefined') {\n toReturn['userName'] = this.userName;\n }\n if (typeof this.userAvatarUrl !== 'undefined') {\n toReturn['userAvatarUrl'] = this.userAvatarUrl;\n }\n if (typeof this.userType !== 'undefined') {\n toReturn['userType'] = this.userType;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CanEnableBusinessCommunicationsRequest {\n static fromProto(proto) {\n let m = new CanEnableBusinessCommunicationsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n return toReturn;\n }\n}\nclass CanEnableBusinessCommunicationsResponse {\n static fromProto(proto) {\n let m = new CanEnableBusinessCommunicationsResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.hasRequiredAccessScopes !== 'undefined') {\n toReturn['hasRequiredAccessScopes'] = this.hasRequiredAccessScopes;\n }\n return toReturn;\n }\n}\nclass ConnectBusinessCommunicationsRequest {\n static fromProto(proto) {\n let m = new ConnectBusinessCommunicationsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass GetBusinessLaunchStatusRequest {\n static fromProto(proto) {\n let m = new GetBusinessLaunchStatusRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass GetBusinessLaunchStatusResponse {\n static fromProto(proto) {\n let m = new GetBusinessLaunchStatusResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.isLaunched !== 'undefined') {\n toReturn['isLaunched'] = this.isLaunched;\n }\n return toReturn;\n }\n}\nclass UnlaunchBusinessCommunicationsAgentRequest {\n static fromProto(proto) {\n let m = new UnlaunchBusinessCommunicationsAgentRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CalculateInsightsByTimePeriodRequest {\n static fromProto(proto) {\n let m = new CalculateInsightsByTimePeriodRequest();\n m = Object.assign(m, proto);\n if (proto.startDate) {\n m.startDate = new Date(proto.startDate);\n }\n if (proto.endDate) {\n m.endDate = new Date(proto.endDate);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.startDate !== 'undefined' && this.startDate !== null) {\n toReturn['startDate'] = 'toApiJson' in this.startDate ? this.startDate.toApiJson() : this.startDate;\n }\n if (typeof this.endDate !== 'undefined' && this.endDate !== null) {\n toReturn['endDate'] = 'toApiJson' in this.endDate ? this.endDate.toApiJson() : this.endDate;\n }\n return toReturn;\n }\n}\nclass CalculateInsightsByTimePeriodResponse {\n static fromProto(proto) {\n let m = new CalculateInsightsByTimePeriodResponse();\n m = Object.assign(m, proto);\n if (proto.stats) {\n m.stats = proto.stats.map(InsightsStat.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.stats !== 'undefined' && this.stats !== null) {\n toReturn['stats'] = 'toApiJson' in this.stats ? this.stats.toApiJson() : this.stats;\n }\n return toReturn;\n }\n}\nclass CanRespondToReviewRequest {\n static fromProto(proto) {\n let m = new CanRespondToReviewRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.reviewId !== 'undefined') {\n toReturn['reviewId'] = this.reviewId;\n }\n return toReturn;\n }\n}\nclass CanRespondToReviewResponse {\n static fromProto(proto) {\n let m = new CanRespondToReviewResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.canPublish !== 'undefined') {\n toReturn['canPublish'] = this.canPublish;\n }\n if (typeof this.addLink !== 'undefined') {\n toReturn['addLink'] = this.addLink;\n }\n if (typeof this.message !== 'undefined') {\n toReturn['message'] = this.message;\n }\n return toReturn;\n }\n}\nclass ConnectRequest {\n static fromProto(proto) {\n let m = new ConnectRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.googleUserId !== 'undefined') {\n toReturn['googleUserId'] = this.googleUserId;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass ConnectResponse {\n static fromProto(proto) {\n let m = new ConnectResponse();\n m = Object.assign(m, proto);\n if (proto.location) {\n m.location = Location.fromProto(proto.location);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.location !== 'undefined' && this.location !== null) {\n toReturn['location'] = 'toApiJson' in this.location ? this.location.toApiJson() : this.location;\n }\n return toReturn;\n }\n}\nclass DisconnectRequest {\n static fromProto(proto) {\n let m = new DisconnectRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.googleUserId !== 'undefined') {\n toReturn['googleUserId'] = this.googleUserId;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass EnableDisableSyncRequest {\n static fromProto(proto) {\n let m = new EnableDisableSyncRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.googleUserId !== 'undefined') {\n toReturn['googleUserId'] = this.googleUserId;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.syncSettingFlag !== 'undefined') {\n toReturn['syncSettingFlag'] = this.syncSettingFlag;\n }\n return toReturn;\n }\n}\nclass EnableDisableSyncResponse {\n static fromProto(proto) {\n let m = new EnableDisableSyncResponse();\n m = Object.assign(m, proto);\n if (proto.location) {\n m.location = Location.fromProto(proto.location);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.location !== 'undefined' && this.location !== null) {\n toReturn['location'] = 'toApiJson' in this.location ? this.location.toApiJson() : this.location;\n }\n return toReturn;\n }\n}\nclass GetAsSocialServiceRequest {\n static fromProto(proto) {\n let m = new GetAsSocialServiceRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass GetAsSocialServiceResponse {\n static fromProto(proto) {\n let m = new GetAsSocialServiceResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.serviceType !== 'undefined') {\n toReturn['serviceType'] = this.serviceType;\n }\n if (typeof this.ssid !== 'undefined') {\n toReturn['ssid'] = this.ssid;\n }\n if (typeof this.googleUserId !== 'undefined') {\n toReturn['googleUserId'] = this.googleUserId;\n }\n if (typeof this.agid !== 'undefined') {\n toReturn['agid'] = this.agid;\n }\n if (typeof this.profileUrl !== 'undefined') {\n toReturn['profileUrl'] = this.profileUrl;\n }\n if (typeof this.socialSyncFlag !== 'undefined') {\n toReturn['socialSyncFlag'] = this.socialSyncFlag;\n }\n if (typeof this.spid !== 'undefined') {\n toReturn['spid'] = this.spid;\n }\n if (typeof this.isAuthenticated !== 'undefined') {\n toReturn['isAuthenticated'] = this.isAuthenticated;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n return toReturn;\n }\n}\nclass GetConnectionRequest {\n static fromProto(proto) {\n let m = new GetConnectionRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.googleUserId !== 'undefined') {\n toReturn['googleUserId'] = this.googleUserId;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.refreshFromGoogleFlag !== 'undefined') {\n toReturn['refreshFromGoogleFlag'] = this.refreshFromGoogleFlag;\n }\n return toReturn;\n }\n}\nclass GetConnectionResponse {\n static fromProto(proto) {\n let m = new GetConnectionResponse();\n m = Object.assign(m, proto);\n if (proto.location) {\n m.location = Location.fromProto(proto.location);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.location !== 'undefined' && this.location !== null) {\n toReturn['location'] = 'toApiJson' in this.location ? this.location.toApiJson() : this.location;\n }\n return toReturn;\n }\n}\nclass GetConnectionsRequest {\n static fromProto(proto) {\n let m = new GetConnectionsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.googleUserId !== 'undefined') {\n toReturn['googleUserId'] = this.googleUserId;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.refreshFromGoogleFlag !== 'undefined') {\n toReturn['refreshFromGoogleFlag'] = this.refreshFromGoogleFlag;\n }\n return toReturn;\n }\n}\nclass GetConnectionsResponse {\n static fromProto(proto) {\n let m = new GetConnectionsResponse();\n m = Object.assign(m, proto);\n if (proto.locations) {\n m.locations = proto.locations.map(Location.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.locations !== 'undefined' && this.locations !== null) {\n toReturn['locations'] = 'toApiJson' in this.locations ? this.locations.toApiJson() : this.locations;\n }\n return toReturn;\n }\n}\nclass GetGoogleUserRequest {\n static fromProto(proto) {\n let m = new GetGoogleUserRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.googleUserId !== 'undefined') {\n toReturn['googleUserId'] = this.googleUserId;\n }\n return toReturn;\n }\n}\nclass GetGoogleUserResponse {\n static fromProto(proto) {\n let m = new GetGoogleUserResponse();\n m = Object.assign(m, proto);\n if (proto.user) {\n m.user = GoogleUser.fromProto(proto.user);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.user !== 'undefined' && this.user !== null) {\n toReturn['user'] = 'toApiJson' in this.user ? this.user.toApiJson() : this.user;\n }\n return toReturn;\n }\n}\nclass GoogleUser {\n static fromProto(proto) {\n let m = new GoogleUser();\n m = Object.assign(m, proto);\n if (proto.expiryDateTime) {\n m.expiryDateTime = new Date(proto.expiryDateTime);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.socialServiceId !== 'undefined') {\n toReturn['socialServiceId'] = this.socialServiceId;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n if (typeof this.refreshToken !== 'undefined') {\n toReturn['refreshToken'] = this.refreshToken;\n }\n if (typeof this.isTokenBroken !== 'undefined') {\n toReturn['isTokenBroken'] = this.isTokenBroken;\n }\n if (typeof this.expiryDateTime !== 'undefined' && this.expiryDateTime !== null) {\n toReturn['expiryDateTime'] = 'toApiJson' in this.expiryDateTime ? this.expiryDateTime.toApiJson() : this.expiryDateTime;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass InsightsStat {\n static fromProto(proto) {\n let m = new InsightsStat();\n m = Object.assign(m, proto);\n if (proto.currentValue) {\n m.currentValue = parseInt(proto.currentValue, 10);\n }\n if (proto.change) {\n m.change = parseInt(proto.change, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.currentValue !== 'undefined') {\n toReturn['currentValue'] = this.currentValue;\n }\n if (typeof this.change !== 'undefined') {\n toReturn['change'] = this.change;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n return toReturn;\n }\n}\nclass Location {\n static fromProto(proto) {\n let m = new Location();\n m = Object.assign(m, proto);\n if (proto.locationSyncSucceededOn) {\n m.locationSyncSucceededOn = new Date(proto.locationSyncSucceededOn);\n }\n if (proto.openStatusSyncSucceededOn) {\n m.openStatusSyncSucceededOn = new Date(proto.openStatusSyncSucceededOn);\n }\n if (proto.syncLastAttemptedOn) {\n m.syncLastAttemptedOn = new Date(proto.syncLastAttemptedOn);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.modified) {\n m.modified = new Date(proto.modified);\n }\n if (proto.deleted) {\n m.deleted = new Date(proto.deleted);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.displayName !== 'undefined') {\n toReturn['displayName'] = this.displayName;\n }\n if (typeof this.googleReverify !== 'undefined') {\n toReturn['googleReverify'] = this.googleReverify;\n }\n if (typeof this.googleVerified !== 'undefined') {\n toReturn['googleVerified'] = this.googleVerified;\n }\n if (typeof this.isLocalPostApiDisabled !== 'undefined') {\n toReturn['isLocalPostApiDisabled'] = this.isLocalPostApiDisabled;\n }\n if (typeof this.isMissing !== 'undefined') {\n toReturn['isMissing'] = this.isMissing;\n }\n if (typeof this.isTokenBroken !== 'undefined') {\n toReturn['isTokenBroken'] = this.isTokenBroken;\n }\n if (typeof this.isVerified !== 'undefined') {\n toReturn['isVerified'] = this.isVerified;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.logoImageId !== 'undefined') {\n toReturn['logoImageId'] = this.logoImageId;\n }\n if (typeof this.mapsPlaceId !== 'undefined') {\n toReturn['mapsPlaceId'] = this.mapsPlaceId;\n }\n if (typeof this.primaryImageId !== 'undefined') {\n toReturn['primaryImageId'] = this.primaryImageId;\n }\n if (typeof this.syncSettingFlag !== 'undefined') {\n toReturn['syncSettingFlag'] = this.syncSettingFlag;\n }\n if (typeof this.cannotSyncReasons !== 'undefined') {\n toReturn['cannotSyncReasons'] = this.cannotSyncReasons;\n }\n if (typeof this.serviceAreaPlaceId !== 'undefined') {\n toReturn['serviceAreaPlaceId'] = this.serviceAreaPlaceId;\n }\n if (typeof this.locationSyncSucceededOn !== 'undefined' && this.locationSyncSucceededOn !== null) {\n toReturn['locationSyncSucceededOn'] = 'toApiJson' in this.locationSyncSucceededOn ? this.locationSyncSucceededOn.toApiJson() : this.locationSyncSucceededOn;\n }\n if (typeof this.openStatusSyncSucceededOn !== 'undefined' && this.openStatusSyncSucceededOn !== null) {\n toReturn['openStatusSyncSucceededOn'] = 'toApiJson' in this.openStatusSyncSucceededOn ? this.openStatusSyncSucceededOn.toApiJson() : this.openStatusSyncSucceededOn;\n }\n if (typeof this.syncLastAttemptedOn !== 'undefined' && this.syncLastAttemptedOn !== null) {\n toReturn['syncLastAttemptedOn'] = 'toApiJson' in this.syncLastAttemptedOn ? this.syncLastAttemptedOn.toApiJson() : this.syncLastAttemptedOn;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.modified !== 'undefined' && this.modified !== null) {\n toReturn['modified'] = 'toApiJson' in this.modified ? this.modified.toApiJson() : this.modified;\n }\n if (typeof this.deleted !== 'undefined' && this.deleted !== null) {\n toReturn['deleted'] = 'toApiJson' in this.deleted ? this.deleted.toApiJson() : this.deleted;\n }\n return toReturn;\n }\n}\nclass QAndAAccountData {\n static fromProto(proto) {\n let m = new QAndAAccountData();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass AccountLocation {\n static fromProto(proto) {\n let m = new AccountLocation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.googleAccountId !== 'undefined') {\n toReturn['googleAccountId'] = this.googleAccountId;\n }\n if (typeof this.googleLocationId !== 'undefined') {\n toReturn['googleLocationId'] = this.googleLocationId;\n }\n return toReturn;\n }\n}\nclass CreateAnswerRequest {\n static fromProto(proto) {\n let m = new CreateAnswerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.questionId !== 'undefined') {\n toReturn['questionId'] = this.questionId;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n return toReturn;\n }\n}\nclass CreateAnswerResponse {\n static fromProto(proto) {\n let m = new CreateAnswerResponse();\n m = Object.assign(m, proto);\n if (proto.answer) {\n m.answer = Answer.fromProto(proto.answer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.answer !== 'undefined' && this.answer !== null) {\n toReturn['answer'] = 'toApiJson' in this.answer ? this.answer.toApiJson() : this.answer;\n }\n return toReturn;\n }\n}\nclass CreateQuestionRequest {\n static fromProto(proto) {\n let m = new CreateQuestionRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.socialProfileId !== 'undefined') {\n toReturn['socialProfileId'] = this.socialProfileId;\n }\n if (typeof this.locationPathName !== 'undefined') {\n toReturn['locationPathName'] = this.locationPathName;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass CreateQuestionResponse {\n static fromProto(proto) {\n let m = new CreateQuestionResponse();\n m = Object.assign(m, proto);\n if (proto.question) {\n m.question = Question.fromProto(proto.question);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.question !== 'undefined' && this.question !== null) {\n toReturn['question'] = 'toApiJson' in this.question ? this.question.toApiJson() : this.question;\n }\n return toReturn;\n }\n}\nclass DeleteAccountLocationRequest {\n static fromProto(proto) {\n let m = new DeleteAccountLocationRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass DeletePostRequest {\n static fromProto(proto) {\n let m = new DeletePostRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n if (typeof this.postId !== 'undefined') {\n toReturn['postId'] = this.postId;\n }\n return toReturn;\n }\n}\nclass GetMultiAccountLocationRequest {\n static fromProto(proto) {\n let m = new GetMultiAccountLocationRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupIds !== 'undefined') {\n toReturn['accountGroupIds'] = this.accountGroupIds;\n }\n return toReturn;\n }\n}\nclass GetMultiAccountLocationResponse {\n static fromProto(proto) {\n let m = new GetMultiAccountLocationResponse();\n m = Object.assign(m, proto);\n if (proto.accountLocations) {\n m.accountLocations = proto.accountLocations.map(AccountLocation.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountLocations !== 'undefined' && this.accountLocations !== null) {\n toReturn['accountLocations'] = 'toApiJson' in this.accountLocations ? this.accountLocations.toApiJson() : this.accountLocations;\n }\n return toReturn;\n }\n}\nclass GetMultiQuestionsRequest {\n static fromProto(proto) {\n let m = new GetMultiQuestionsRequest();\n m = Object.assign(m, proto);\n if (proto.questionIds) {\n m.questionIds = proto.questionIds.map(QuestionIdentifier.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.questionIds !== 'undefined' && this.questionIds !== null) {\n toReturn['questionIds'] = 'toApiJson' in this.questionIds ? this.questionIds.toApiJson() : this.questionIds;\n }\n if (typeof this.includeAnswers !== 'undefined') {\n toReturn['includeAnswers'] = this.includeAnswers;\n }\n return toReturn;\n }\n}\nclass GetMultiQuestionsResponse {\n static fromProto(proto) {\n let m = new GetMultiQuestionsResponse();\n m = Object.assign(m, proto);\n if (proto.questions) {\n m.questions = proto.questions.map(Question.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.questions !== 'undefined' && this.questions !== null) {\n toReturn['questions'] = 'toApiJson' in this.questions ? this.questions.toApiJson() : this.questions;\n }\n return toReturn;\n }\n}\nclass GetMultiTimeRangeRequest {\n static fromProto(proto) {\n let m = new GetMultiTimeRangeRequest();\n m = Object.assign(m, proto);\n if (proto.resourceIds) {\n m.resourceIds = proto.resourceIds.map(ResourceId.fromProto);\n }\n if (proto.startTime) {\n m.startTime = new Date(proto.startTime);\n }\n if (proto.endTime) {\n m.endTime = new Date(proto.endTime);\n }\n if (proto.metricTypes) {\n m.metricTypes = proto.metricTypes.map(v => enumStringToValue(MetricType, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.resourceIds !== 'undefined' && this.resourceIds !== null) {\n toReturn['resourceIds'] = 'toApiJson' in this.resourceIds ? this.resourceIds.toApiJson() : this.resourceIds;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.startTime !== 'undefined' && this.startTime !== null) {\n toReturn['startTime'] = 'toApiJson' in this.startTime ? this.startTime.toApiJson() : this.startTime;\n }\n if (typeof this.endTime !== 'undefined' && this.endTime !== null) {\n toReturn['endTime'] = 'toApiJson' in this.endTime ? this.endTime.toApiJson() : this.endTime;\n }\n if (typeof this.metricTypes !== 'undefined') {\n toReturn['metricTypes'] = this.metricTypes;\n }\n if (typeof this.delta !== 'undefined') {\n toReturn['delta'] = this.delta;\n }\n if (typeof this.total !== 'undefined') {\n toReturn['total'] = this.total;\n }\n if (typeof this.overTime !== 'undefined') {\n toReturn['overTime'] = this.overTime;\n }\n return toReturn;\n }\n}\nclass GetMultiTimeRangeResponse {\n static fromProto(proto) {\n let m = new GetMultiTimeRangeResponse();\n m = Object.assign(m, proto);\n if (proto.resourceInsights) {\n m.resourceInsights = proto.resourceInsights.map(GetMultiTimeRangeResponseInsightsContainer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.resourceInsights !== 'undefined' && this.resourceInsights !== null) {\n toReturn['resourceInsights'] = 'toApiJson' in this.resourceInsights ? this.resourceInsights.toApiJson() : this.resourceInsights;\n }\n return toReturn;\n }\n}\nclass GetQuestionAnswerStatsRequest {\n static fromProto(proto) {\n let m = new GetQuestionAnswerStatsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.locationId !== 'undefined') {\n toReturn['locationId'] = this.locationId;\n }\n return toReturn;\n }\n}\nclass GetQuestionAnswerStatsResponse {\n static fromProto(proto) {\n let m = new GetQuestionAnswerStatsResponse();\n m = Object.assign(m, proto);\n if (proto.unanswered) {\n m.unanswered = parseInt(proto.unanswered, 10);\n }\n if (proto.answeredByOwner) {\n m.answeredByOwner = parseInt(proto.answeredByOwner, 10);\n }\n if (proto.totalQuestions) {\n m.totalQuestions = parseInt(proto.totalQuestions, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.unanswered !== 'undefined') {\n toReturn['unanswered'] = this.unanswered;\n }\n if (typeof this.answeredByOwner !== 'undefined') {\n toReturn['answeredByOwner'] = this.answeredByOwner;\n }\n if (typeof this.totalQuestions !== 'undefined') {\n toReturn['totalQuestions'] = this.totalQuestions;\n }\n return toReturn;\n }\n}\nclass GetQuestionRequest {\n static fromProto(proto) {\n let m = new GetQuestionRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.locationId !== 'undefined') {\n toReturn['locationId'] = this.locationId;\n }\n if (typeof this.questionId !== 'undefined') {\n toReturn['questionId'] = this.questionId;\n }\n if (typeof this.includeAnswers !== 'undefined') {\n toReturn['includeAnswers'] = this.includeAnswers;\n }\n if (typeof this.onlyLatestVersion !== 'undefined') {\n toReturn['onlyLatestVersion'] = this.onlyLatestVersion;\n }\n return toReturn;\n }\n}\nclass GetQuestionResponse {\n static fromProto(proto) {\n let m = new GetQuestionResponse();\n m = Object.assign(m, proto);\n if (proto.question) {\n m.question = Question.fromProto(proto.question);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.question !== 'undefined' && this.question !== null) {\n toReturn['question'] = 'toApiJson' in this.question ? this.question.toApiJson() : this.question;\n }\n return toReturn;\n }\n}\nclass GetTimeRangeRequest {\n static fromProto(proto) {\n let m = new GetTimeRangeRequest();\n m = Object.assign(m, proto);\n if (proto.startTime) {\n m.startTime = new Date(proto.startTime);\n }\n if (proto.endTime) {\n m.endTime = new Date(proto.endTime);\n }\n if (proto.metricTypes) {\n m.metricTypes = proto.metricTypes.map(v => enumStringToValue(MetricType, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.groupPathNodes !== 'undefined') {\n toReturn['groupPathNodes'] = this.groupPathNodes;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.startTime !== 'undefined' && this.startTime !== null) {\n toReturn['startTime'] = 'toApiJson' in this.startTime ? this.startTime.toApiJson() : this.startTime;\n }\n if (typeof this.endTime !== 'undefined' && this.endTime !== null) {\n toReturn['endTime'] = 'toApiJson' in this.endTime ? this.endTime.toApiJson() : this.endTime;\n }\n if (typeof this.metricTypes !== 'undefined') {\n toReturn['metricTypes'] = this.metricTypes;\n }\n return toReturn;\n }\n}\nclass Insight {\n static fromProto(proto) {\n let m = new Insight();\n m = Object.assign(m, proto);\n if (proto.metricType) {\n m.metricType = enumStringToValue(MetricType, proto.metricType);\n }\n if (proto.totalValue) {\n m.totalValue = Metric.fromProto(proto.totalValue);\n }\n if (proto.deltaValue) {\n m.deltaValue = Metric.fromProto(proto.deltaValue);\n }\n if (proto.metrics) {\n m.metrics = proto.metrics.map(Metric.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.metricType !== 'undefined') {\n toReturn['metricType'] = this.metricType;\n }\n if (typeof this.totalValue !== 'undefined' && this.totalValue !== null) {\n toReturn['totalValue'] = 'toApiJson' in this.totalValue ? this.totalValue.toApiJson() : this.totalValue;\n }\n if (typeof this.deltaValue !== 'undefined' && this.deltaValue !== null) {\n toReturn['deltaValue'] = 'toApiJson' in this.deltaValue ? this.deltaValue.toApiJson() : this.deltaValue;\n }\n if (typeof this.metrics !== 'undefined' && this.metrics !== null) {\n toReturn['metrics'] = 'toApiJson' in this.metrics ? this.metrics.toApiJson() : this.metrics;\n }\n return toReturn;\n }\n}\nclass GetMultiTimeRangeResponseInsightsContainer {\n static fromProto(proto) {\n let m = new GetMultiTimeRangeResponseInsightsContainer();\n m = Object.assign(m, proto);\n if (proto.insights) {\n m.insights = InsightsResponse.fromProto(proto.insights);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.insights !== 'undefined' && this.insights !== null) {\n toReturn['insights'] = 'toApiJson' in this.insights ? this.insights.toApiJson() : this.insights;\n }\n return toReturn;\n }\n}\nclass InsightsResponse {\n static fromProto(proto) {\n let m = new InsightsResponse();\n m = Object.assign(m, proto);\n if (proto.insights) {\n m.insights = proto.insights.map(Insight.fromProto);\n }\n if (proto.locationCount) {\n m.locationCount = parseInt(proto.locationCount, 10);\n }\n if (proto.connectedLocationCount) {\n m.connectedLocationCount = parseInt(proto.connectedLocationCount, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.insights !== 'undefined' && this.insights !== null) {\n toReturn['insights'] = 'toApiJson' in this.insights ? this.insights.toApiJson() : this.insights;\n }\n if (typeof this.locationCount !== 'undefined') {\n toReturn['locationCount'] = this.locationCount;\n }\n if (typeof this.connectedLocationCount !== 'undefined') {\n toReturn['connectedLocationCount'] = this.connectedLocationCount;\n }\n return toReturn;\n }\n}\nclass ListQuestionsRequest {\n static fromProto(proto) {\n let m = new ListQuestionsRequest();\n m = Object.assign(m, proto);\n if (proto.limit) {\n m.limit = parseInt(proto.limit, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.locationId !== 'undefined') {\n toReturn['locationId'] = this.locationId;\n }\n if (typeof this.includeAnswers !== 'undefined') {\n toReturn['includeAnswers'] = this.includeAnswers;\n }\n if (typeof this.onlyLatestVersion !== 'undefined') {\n toReturn['onlyLatestVersion'] = this.onlyLatestVersion;\n }\n if (typeof this.limit !== 'undefined') {\n toReturn['limit'] = this.limit;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass ListQuestionsResponse {\n static fromProto(proto) {\n let m = new ListQuestionsResponse();\n m = Object.assign(m, proto);\n if (proto.questions) {\n m.questions = proto.questions.map(Question.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.questions !== 'undefined' && this.questions !== null) {\n toReturn['questions'] = 'toApiJson' in this.questions ? this.questions.toApiJson() : this.questions;\n }\n if (typeof this.more !== 'undefined') {\n toReturn['more'] = this.more;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass Metric {\n static fromProto(proto) {\n let m = new Metric();\n m = Object.assign(m, proto);\n if (proto.value) {\n m.value = parseInt(proto.value, 10);\n }\n if (proto.timeDimension) {\n m.timeDimension = TimeDimension.fromProto(proto.timeDimension);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n if (typeof this.timeDimension !== 'undefined' && this.timeDimension !== null) {\n toReturn['timeDimension'] = 'toApiJson' in this.timeDimension ? this.timeDimension.toApiJson() : this.timeDimension;\n }\n return toReturn;\n }\n}\nclass PopulateGoogleBusinessProfilePerformanceMetricsRequest {\n static fromProto(proto) {\n let m = new PopulateGoogleBusinessProfilePerformanceMetricsRequest();\n m = Object.assign(m, proto);\n if (proto.startDate) {\n m.startDate = GoogleDate.fromProto(proto.startDate);\n }\n if (proto.endDate) {\n m.endDate = GoogleDate.fromProto(proto.endDate);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.startDate !== 'undefined' && this.startDate !== null) {\n toReturn['startDate'] = 'toApiJson' in this.startDate ? this.startDate.toApiJson() : this.startDate;\n }\n if (typeof this.endDate !== 'undefined' && this.endDate !== null) {\n toReturn['endDate'] = 'toApiJson' in this.endDate ? this.endDate.toApiJson() : this.endDate;\n }\n return toReturn;\n }\n}\nclass PopulateGoogleBusinessProfileSearchKeywordsRequest {\n static fromProto(proto) {\n let m = new PopulateGoogleBusinessProfileSearchKeywordsRequest();\n m = Object.assign(m, proto);\n if (proto.startDate) {\n m.startDate = GoogleDate.fromProto(proto.startDate);\n }\n if (proto.endDate) {\n m.endDate = GoogleDate.fromProto(proto.endDate);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.googleLocationId !== 'undefined') {\n toReturn['googleLocationId'] = this.googleLocationId;\n }\n if (typeof this.startDate !== 'undefined' && this.startDate !== null) {\n toReturn['startDate'] = 'toApiJson' in this.startDate ? this.startDate.toApiJson() : this.startDate;\n }\n if (typeof this.endDate !== 'undefined' && this.endDate !== null) {\n toReturn['endDate'] = 'toApiJson' in this.endDate ? this.endDate.toApiJson() : this.endDate;\n }\n return toReturn;\n }\n}\nclass QuestionIdentifier {\n static fromProto(proto) {\n let m = new QuestionIdentifier();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.locationId !== 'undefined') {\n toReturn['locationId'] = this.locationId;\n }\n if (typeof this.questionId !== 'undefined') {\n toReturn['questionId'] = this.questionId;\n }\n if (typeof this.version !== 'undefined') {\n toReturn['version'] = this.version;\n }\n return toReturn;\n }\n}\nclass ReplaceAccountLocationRequest {\n static fromProto(proto) {\n let m = new ReplaceAccountLocationRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.googleAccountId !== 'undefined') {\n toReturn['googleAccountId'] = this.googleAccountId;\n }\n if (typeof this.googleLocationId !== 'undefined') {\n toReturn['googleLocationId'] = this.googleLocationId;\n }\n return toReturn;\n }\n}\nclass ReplacePostInsightsHistoryRequest {\n static fromProto(proto) {\n let m = new ReplacePostInsightsHistoryRequest();\n m = Object.assign(m, proto);\n if (proto.postInsightsHistory) {\n m.postInsightsHistory = PostInsightsHistory.fromProto(proto.postInsightsHistory);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.postInsightsHistory !== 'undefined' && this.postInsightsHistory !== null) {\n toReturn['postInsightsHistory'] = 'toApiJson' in this.postInsightsHistory ? this.postInsightsHistory.toApiJson() : this.postInsightsHistory;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass ResourceId {\n static fromProto(proto) {\n let m = new ResourceId();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.groupPathNodes !== 'undefined') {\n toReturn['groupPathNodes'] = this.groupPathNodes;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass SyncDataRequest {\n static fromProto(proto) {\n let m = new SyncDataRequest();\n m = Object.assign(m, proto);\n if (proto.requestedAt) {\n m.requestedAt = new Date(proto.requestedAt);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.gmbInsightsJson !== 'undefined') {\n toReturn['gmbInsightsJson'] = this.gmbInsightsJson;\n }\n if (typeof this.requestedAt !== 'undefined' && this.requestedAt !== null) {\n toReturn['requestedAt'] = 'toApiJson' in this.requestedAt ? this.requestedAt.toApiJson() : this.requestedAt;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass TimeDimension {\n static fromProto(proto) {\n let m = new TimeDimension();\n m = Object.assign(m, proto);\n if (proto.timeRange) {\n m.timeRange = TimePeriod.fromProto(proto.timeRange);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.timeRange !== 'undefined' && this.timeRange !== null) {\n toReturn['timeRange'] = 'toApiJson' in this.timeRange ? this.timeRange.toApiJson() : this.timeRange;\n }\n return toReturn;\n }\n}\nclass TimePeriod {\n static fromProto(proto) {\n let m = new TimePeriod();\n m = Object.assign(m, proto);\n if (proto.startTime) {\n m.startTime = new Date(proto.startTime);\n }\n if (proto.period) {\n m.period = enumStringToValue(Period, proto.period);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.startTime !== 'undefined' && this.startTime !== null) {\n toReturn['startTime'] = 'toApiJson' in this.startTime ? this.startTime.toApiJson() : this.startTime;\n }\n if (typeof this.period !== 'undefined') {\n toReturn['period'] = this.period;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'google-my-business-api.vendasta-local.com',\n 'test': '',\n 'demo': 'google-my-business-api-demo.apigateway.co',\n 'prod': 'google-my-business-api-prod.apigateway.co',\n 'production': 'google-my-business-api-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet AccountApiService = /*#__PURE__*/(() => {\n class AccountApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n getMultiAccountLocation(r) {\n const request = r.toApiJson ? r : new GetMultiAccountLocationRequest(r);\n return this.http.post(this._host + \"/gmb.v1.Account/GetMultiAccountLocation\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiAccountLocationResponse.fromProto(resp)));\n }\n replaceAccountLocation(r) {\n const request = r.toApiJson ? r : new ReplaceAccountLocationRequest(r);\n return this.http.post(this._host + \"/gmb.v1.Account/ReplaceAccountLocation\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteAccountLocation(r) {\n const request = r.toApiJson ? r : new DeleteAccountLocationRequest(r);\n return this.http.post(this._host + \"/gmb.v1.Account/DeleteAccountLocation\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deletePost(r) {\n const request = r.toApiJson ? r : new DeletePostRequest(r);\n return this.http.post(this._host + \"/gmb.v1.Account/DeletePost\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n AccountApiService.ɵfac = function AccountApiService_Factory(t) {\n return new (t || AccountApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n AccountApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AccountApiService,\n factory: AccountApiService.ɵfac,\n providedIn: 'root'\n });\n return AccountApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet BusinessCommunicationsApiService = /*#__PURE__*/(() => {\n class BusinessCommunicationsApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n connectBusinessCommunications(r) {\n const request = r.toApiJson ? r : new ConnectBusinessCommunicationsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.BusinessCommunications/ConnectBusinessCommunications\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n unlaunchBusinessCommunicationsAgent(r) {\n const request = r.toApiJson ? r : new UnlaunchBusinessCommunicationsAgentRequest(r);\n return this.http.post(this._host + \"/gmb.v1.BusinessCommunications/UnlaunchBusinessCommunicationsAgent\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getBusinessLaunchStatus(r) {\n const request = r.toApiJson ? r : new GetBusinessLaunchStatusRequest(r);\n return this.http.post(this._host + \"/gmb.v1.BusinessCommunications/GetBusinessLaunchStatus\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetBusinessLaunchStatusResponse.fromProto(resp)));\n }\n canEnableBusinessCommunications(r) {\n const request = r.toApiJson ? r : new CanEnableBusinessCommunicationsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.BusinessCommunications/CanEnableBusinessCommunications\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CanEnableBusinessCommunicationsResponse.fromProto(resp)));\n }\n }\n BusinessCommunicationsApiService.ɵfac = function BusinessCommunicationsApiService_Factory(t) {\n return new (t || BusinessCommunicationsApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n BusinessCommunicationsApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: BusinessCommunicationsApiService,\n factory: BusinessCommunicationsApiService.ɵfac,\n providedIn: 'root'\n });\n return BusinessCommunicationsApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet BusinessMessagesApiService = /*#__PURE__*/(() => {\n class BusinessMessagesApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n sendMessage(r) {\n const request = r.toApiJson ? r : new SendMessageRequest(r);\n return this.http.post(this._host + \"/gmb.v1.BusinessMessages/SendMessage\", request.toApiJson(), this.apiOptions()).pipe(map(resp => SendMessageResponse.fromProto(resp)));\n }\n createEvent(r) {\n const request = r.toApiJson ? r : new CreateEventRequest(r);\n return this.http.post(this._host + \"/gmb.v1.BusinessMessages/CreateEvent\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateEventResponse.fromProto(resp)));\n }\n }\n BusinessMessagesApiService.ɵfac = function BusinessMessagesApiService_Factory(t) {\n return new (t || BusinessMessagesApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n BusinessMessagesApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: BusinessMessagesApiService,\n factory: BusinessMessagesApiService.ɵfac,\n providedIn: 'root'\n });\n return BusinessMessagesApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet GoogleMyBusinessClientLegacyAPIApiService = /*#__PURE__*/(() => {\n class GoogleMyBusinessClientLegacyAPIApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n calculateInsightsByTimePeriod(r) {\n const request = r.toApiJson ? r : new CalculateInsightsByTimePeriodRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/CalculateInsightsByTimePeriod\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CalculateInsightsByTimePeriodResponse.fromProto(resp)));\n }\n canRespondToReview(r) {\n const request = r.toApiJson ? r : new CanRespondToReviewRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/CanRespondToReview\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CanRespondToReviewResponse.fromProto(resp)));\n }\n connect(r) {\n const request = r.toApiJson ? r : new ConnectRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/Connect\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ConnectResponse.fromProto(resp)));\n }\n disconnect(r) {\n const request = r.toApiJson ? r : new DisconnectRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/Disconnect\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n enableDisableSync(r) {\n const request = r.toApiJson ? r : new EnableDisableSyncRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/EnableDisableSync\", request.toApiJson(), this.apiOptions()).pipe(map(resp => EnableDisableSyncResponse.fromProto(resp)));\n }\n getAsSocialService(r) {\n const request = r.toApiJson ? r : new GetAsSocialServiceRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/GetAsSocialService\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetAsSocialServiceResponse.fromProto(resp)));\n }\n getConnections(r) {\n const request = r.toApiJson ? r : new GetConnectionsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/GetConnections\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetConnectionsResponse.fromProto(resp)));\n }\n getConnection(r) {\n const request = r.toApiJson ? r : new GetConnectionRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/GetConnection\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetConnectionsResponse.fromProto(resp)));\n }\n getGoogleUser(r) {\n const request = r.toApiJson ? r : new GetGoogleUserRequest(r);\n return this.http.post(this._host + \"/gmb.v1.GoogleMyBusinessClientLegacyAPI/GetGoogleUser\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetGoogleUserResponse.fromProto(resp)));\n }\n }\n GoogleMyBusinessClientLegacyAPIApiService.ɵfac = function GoogleMyBusinessClientLegacyAPIApiService_Factory(t) {\n return new (t || GoogleMyBusinessClientLegacyAPIApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n GoogleMyBusinessClientLegacyAPIApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: GoogleMyBusinessClientLegacyAPIApiService,\n factory: GoogleMyBusinessClientLegacyAPIApiService.ɵfac,\n providedIn: 'root'\n });\n return GoogleMyBusinessClientLegacyAPIApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet InsightsApiService = /*#__PURE__*/(() => {\n class InsightsApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n getTimeRange(r) {\n const request = r.toApiJson ? r : new GetTimeRangeRequest(r);\n return this.http.post(this._host + \"/gmb.v1.Insights/GetTimeRange\", request.toApiJson(), this.apiOptions()).pipe(map(resp => InsightsResponse.fromProto(resp)));\n }\n getMultiTimeRange(r) {\n const request = r.toApiJson ? r : new GetMultiTimeRangeRequest(r);\n return this.http.post(this._host + \"/gmb.v1.Insights/GetMultiTimeRange\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiTimeRangeResponse.fromProto(resp)));\n }\n replacePostInsightsHistory(r) {\n const request = r.toApiJson ? r : new ReplacePostInsightsHistoryRequest(r);\n return this.http.post(this._host + \"/gmb.v1.Insights/ReplacePostInsightsHistory\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n InsightsApiService.ɵfac = function InsightsApiService_Factory(t) {\n return new (t || InsightsApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n InsightsApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InsightsApiService,\n factory: InsightsApiService.ɵfac,\n providedIn: 'root'\n });\n return InsightsApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet InsightsSyncApiService = /*#__PURE__*/(() => {\n class InsightsSyncApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n syncData(r) {\n const request = r.toApiJson ? r : new SyncDataRequest(r);\n return this.http.post(this._host + \"/gmb.v1.InsightsSync/SyncData\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n populateGoogleBusinessProfilePerformanceMetrics(r) {\n const request = r.toApiJson ? r : new PopulateGoogleBusinessProfilePerformanceMetricsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.InsightsSync/PopulateGoogleBusinessProfilePerformanceMetrics\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n populateGoogleBusinessProfileSearchKeywords(r) {\n const request = r.toApiJson ? r : new PopulateGoogleBusinessProfileSearchKeywordsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.InsightsSync/PopulateGoogleBusinessProfileSearchKeywords\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n InsightsSyncApiService.ɵfac = function InsightsSyncApiService_Factory(t) {\n return new (t || InsightsSyncApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n InsightsSyncApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InsightsSyncApiService,\n factory: InsightsSyncApiService.ɵfac,\n providedIn: 'root'\n });\n return InsightsSyncApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet QuestionAnswerApiService = /*#__PURE__*/(() => {\n class QuestionAnswerApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n listQuestions(r) {\n const request = r.toApiJson ? r : new ListQuestionsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.QuestionAnswer/ListQuestions\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListQuestionsResponse.fromProto(resp)));\n }\n getQuestion(r) {\n const request = r.toApiJson ? r : new GetQuestionRequest(r);\n return this.http.post(this._host + \"/gmb.v1.QuestionAnswer/GetQuestion\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetQuestionResponse.fromProto(resp)));\n }\n getMultiQuestions(r) {\n const request = r.toApiJson ? r : new GetMultiQuestionsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.QuestionAnswer/GetMultiQuestions\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiQuestionsResponse.fromProto(resp)));\n }\n createAnswer(r) {\n const request = r.toApiJson ? r : new CreateAnswerRequest(r);\n return this.http.post(this._host + \"/gmb.v1.QuestionAnswer/CreateAnswer\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateAnswerResponse.fromProto(resp)));\n }\n createQuestion(r) {\n const request = r.toApiJson ? r : new CreateQuestionRequest(r);\n return this.http.post(this._host + \"/gmb.v1.QuestionAnswer/CreateQuestion\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateQuestionResponse.fromProto(resp)));\n }\n getQuestionAnswerStats(r) {\n const request = r.toApiJson ? r : new GetQuestionAnswerStatsRequest(r);\n return this.http.post(this._host + \"/gmb.v1.QuestionAnswer/GetQuestionAnswerStats\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetQuestionAnswerStatsResponse.fromProto(resp)));\n }\n }\n QuestionAnswerApiService.ɵfac = function QuestionAnswerApiService_Factory(t) {\n return new (t || QuestionAnswerApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n QuestionAnswerApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: QuestionAnswerApiService,\n factory: QuestionAnswerApiService.ɵfac,\n providedIn: 'root'\n });\n return QuestionAnswerApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Index.\n// *********************************\nlet QuestionAndAnswerService = /*#__PURE__*/(() => {\n class QuestionAndAnswerService {\n constructor(_api) {\n this._api = _api;\n }\n listQuestions(accountGroupId, cursor, includeAnswers, limit, locationId, onlyLatestVersion) {\n const request = {\n accountGroupId: accountGroupId,\n cursor: cursor,\n includeAnswers: includeAnswers,\n limit: limit,\n locationId: locationId,\n onlyLatestVersion: onlyLatestVersion\n };\n return this._api.listQuestions(request);\n }\n createAnswer(accountGroupId, socialProfileId, locationPathName, questionId, text) {\n const request = {\n accountGroupId: accountGroupId,\n socialProfileId: socialProfileId,\n locationPathName: locationPathName,\n questionId: questionId,\n text: text\n };\n return this._api.createAnswer(request);\n }\n createQuestion(partnerId, accountGroupId, socialProfileId, locationPathName, text) {\n const request = {\n accountGroupId: accountGroupId,\n socialProfileId: socialProfileId,\n locationPathName: locationPathName,\n partnerId: partnerId,\n text: text\n };\n return this._api.createQuestion(request);\n }\n getMultiQuestions(questionIds, includeAnswers) {\n const request = {\n questionIds: questionIds,\n includeAnswers: includeAnswers\n };\n return this._api.getMultiQuestions(request);\n }\n getQuestion(accountGroupId, locationId, questionId, includeAnswers, onlyLatestVersion) {\n const request = {\n accountGroupId: accountGroupId,\n locationId: locationId,\n questionId: questionId,\n includeAnswers: includeAnswers,\n onlyLatestVersion: onlyLatestVersion\n };\n return this._api.getQuestion(request);\n }\n getQuestionAnswerStats(accountGroupId, locationId) {\n const request = {\n accountGroupId: accountGroupId,\n locationId: locationId\n };\n return this._api.getQuestionAnswerStats(request);\n }\n }\n QuestionAndAnswerService.ɵfac = function QuestionAndAnswerService_Factory(t) {\n return new (t || QuestionAndAnswerService)(i0.ɵɵinject(QuestionAnswerApiService));\n };\n QuestionAndAnswerService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: QuestionAndAnswerService,\n factory: QuestionAndAnswerService.ɵfac,\n providedIn: 'root'\n });\n return QuestionAndAnswerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Answer, BusinessCommunicationsApiService, GetMultiQuestionsResponse, GetQuestionResponse, Question, QuestionAndAnswerService, QuestionAnswerApiService, QuestionIdentifier };\n","import { ConversationChannel } from '@vendasta/conversation';\nimport { Observable } from 'rxjs';\nimport { ConversationDetail } from '../../index';\n\nexport interface AlertOptions {\n title: string;\n description?: string;\n action?: AlertAction;\n}\n\ninterface AlertAction {\n title: string;\n callback: () => void;\n}\n\nexport abstract class ConversationChannelService {\n abstract getChatComposerAlert(\n partnerId: string,\n accountGroupId: string,\n conversationDetail?: ConversationDetail,\n availableChannels?: ConversationChannel[],\n ): Observable;\n}\n","import { HttpErrorResponse, HttpStatusCode } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { BusinessCommunicationsApiService } from '@vendasta/google-my-business';\nimport { addDays, isBefore } from 'date-fns';\nimport { combineLatest, Observable, of, catchError, map, switchMap } from 'rxjs';\nimport { ConversationDetail } from '../interface/conversation.interface';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN,\n PARTNER_ID_TOKEN,\n} from '../tokens';\nimport { AlertOptions, ConversationChannelService } from './conversation-channel.abstract';\n\nexport enum BusinessMessagesEnabledState {\n IS_ENABLED = 'IS_ENABLED',\n INVALID_TOKEN = 'INVALID_TOKEN',\n NOT_ENABLED = 'NOT_ENABLED',\n NOT_LAUNCHED = 'NOT_LAUNCHED',\n CONVERSATION_EXPIRED = 'CONVERSATION_EXPIRED',\n UNKNOWN_ERROR = 'UNKNOWN_ERROR',\n}\n\n@Injectable()\nexport class ConversationGoogleService extends ConversationChannelService {\n private readonly partnerId$: Observable = inject(PARTNER_ID_TOKEN);\n readonly accountGroupId$: Observable = inject(ACCOUNT_GROUP_ID_TOKEN);\n\n private router = inject(Router);\n private readonly googleMyBusinessService = inject(BusinessCommunicationsApiService);\n private readonly googleBusinessMessagesAvailable$ = inject(CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN);\n\n getChatComposerAlert(\n partnerId: string,\n accountGroupId: string,\n conversationDetail: ConversationDetail,\n ): Observable {\n return this.canSendGoogleBusinessMessage(partnerId, accountGroupId, conversationDetail).pipe(\n map((canSend) => {\n if (canSend === BusinessMessagesEnabledState.IS_ENABLED) {\n return null;\n }\n\n return this.getGoogleBusinessMessagesError(canSend, accountGroupId);\n }),\n );\n }\n\n private getGoogleBusinessMessagesError(\n enabledState: BusinessMessagesEnabledState,\n accountGroup: string,\n ): AlertOptions {\n let alert: AlertOptions;\n\n switch (enabledState) {\n case BusinessMessagesEnabledState.NOT_ENABLED:\n alert = {\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.NOT_ENABLED.TITLE',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.NOT_ENABLED.DESCRIPTION',\n };\n break;\n case BusinessMessagesEnabledState.INVALID_TOKEN:\n alert = {\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.GOOGLE_BUSINESS_PROFILE',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.PROFILE_DISCONNECTED',\n action: {\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ACTIONS.GO_TO_SETTINGS',\n callback: () => this.router.navigate([`/account/location/${accountGroup}/settings/inbox`]),\n },\n };\n break;\n case BusinessMessagesEnabledState.CONVERSATION_EXPIRED:\n alert = {\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.EXPIRED_CONVERSATION.TITLE',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.EXPIRED_CONVERSATION.DESCRIPTION',\n };\n break;\n case BusinessMessagesEnabledState.NOT_LAUNCHED:\n alert = {\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.NOT_LAUNCHED.TITLE',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.NOT_LAUNCHED.DESCRIPTION',\n action: {\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ACTIONS.GO_TO_SETTINGS',\n callback: () => this.router.navigate([`/account/location/${accountGroup}/settings/inbox`]),\n },\n };\n break;\n case BusinessMessagesEnabledState.UNKNOWN_ERROR:\n default:\n alert = {\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.UNKNOWN_ERROR.TITLE',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.STATUS.UNKNOWN_ERROR.DESCRIPTION',\n };\n }\n\n return alert;\n }\n\n private canSendGoogleBusinessMessage(\n partnerId: string,\n accountGroupId: string,\n conversationDetail?: ConversationDetail,\n ): Observable {\n const expirationDate = addDays(conversationDetail.latestMessage?.updated, 30);\n const currentDate = new Date();\n\n const launchStatus$: Observable = this.googleMyBusinessService\n .getBusinessLaunchStatus({\n partnerId: partnerId,\n accountGroupId: accountGroupId,\n })\n .pipe(\n map((res) =>\n res.isLaunched ? BusinessMessagesEnabledState.IS_ENABLED : BusinessMessagesEnabledState.NOT_LAUNCHED,\n ),\n catchError((error) => {\n if (error instanceof HttpErrorResponse && error.status === HttpStatusCode.PreconditionFailed) {\n return of(BusinessMessagesEnabledState.INVALID_TOKEN);\n }\n return of(BusinessMessagesEnabledState.UNKNOWN_ERROR);\n }),\n );\n\n return combineLatest([this.googleBusinessMessagesAvailable$, launchStatus$]).pipe(\n map(([googleBusinessMessagesAvailable, launched]) => {\n if (isBefore(expirationDate, currentDate)) {\n return BusinessMessagesEnabledState.CONVERSATION_EXPIRED;\n }\n if (!googleBusinessMessagesAvailable) return BusinessMessagesEnabledState.NOT_ENABLED;\n return launched;\n }),\n );\n }\n\n readonly isGoogleBusinessMessagesEnabled$: Observable = combineLatest([\n this.partnerId$,\n this.accountGroupId$,\n ]).pipe(\n switchMap(([partnerId, accountGroupId]) =>\n this.googleMyBusinessService.getBusinessLaunchStatus({ partnerId, accountGroupId }),\n ),\n map((res) => res.isLaunched),\n catchError(() => of(false)),\n );\n}\n","import { CountryCode, NumberFormat, formatNumber } from 'libphonenumber-js';\nimport { AlertOptions } from './conversation-channel.abstract';\n\nexport interface Translator {\n // eslint-disable-next-line\n instant(key: string | Array, interpolateParams?: Object): string | any;\n}\n\nexport function smsNotAvailableError(\n phoneNumber: string,\n email: string,\n country: string,\n translator: Translator,\n): AlertOptions {\n if (!phoneNumber) {\n return {\n title: translator.instant('INBOX.CHAT.RESPOND_TO_LEAD_AT_EMAIL', {\n email: email,\n }),\n };\n }\n const countryCode = country.toUpperCase() as CountryCode;\n let phone = '';\n try {\n phone = formatNumber(phoneNumber, countryCode, 'NATIONAL' as NumberFormat);\n } catch (error) {\n // fallback to US if country code is not valid\n phone = formatNumber(phoneNumber, 'US' as CountryCode, 'NATIONAL' as NumberFormat);\n }\n if (email) {\n return {\n title: translator.instant('INBOX.CHAT.RESPOND_TO_LEAD_AT_PHONE_NUMBER_OR_EMAIL', {\n phone: phone,\n email: email,\n }),\n };\n }\n return {\n title: translator.instant('INBOX.CHAT.RESPOND_TO_LEAD_AT_PHONE_NUMBER', {\n phone: phone,\n }),\n };\n}\n","import { Injectable, inject } from '@angular/core';\nimport { RegistrationStage, SmsRegistrationService } from '@galaxy/sms';\nimport { TranslateService } from '@ngx-translate/core';\nimport { ConversationApiService, ConversationChannel, ParticipantType, Widget } from '@vendasta/conversation';\nimport { Observable, catchError, combineLatest, map, of, shareReplay, switchMap } from 'rxjs';\nimport { InboxService } from '../inbox.service';\nimport { ConversationDetail } from '../interface/conversation.interface';\nimport { ACCOUNT_GROUP_ID_TOKEN, CONVERSATION_COUNTRY_TOKEN } from '../tokens';\nimport { AlertOptions, ConversationChannelService } from './conversation-channel.abstract';\nimport { smsNotAvailableError } from './alert-helpers';\n\n@Injectable()\nexport class ConversationWebchatService extends ConversationChannelService {\n private readonly translationService = inject(TranslateService);\n private readonly inboxService = inject(InboxService);\n private readonly country$ = inject(CONVERSATION_COUNTRY_TOKEN);\n private readonly smsRegistrationService = this.inboxService.isBusinessApp ? inject(SmsRegistrationService) : null;\n\n getChatComposerAlert(\n partnerId: string,\n accountGroupId: string,\n conversationDetail: ConversationDetail,\n ): Observable {\n if (conversationDetail.conversation.channel !== ConversationChannel.CONVERSATION_CHANNEL_WEB_CHAT) return of(null);\n\n const anonymousParticipant = conversationDetail?.participants?.find(\n (participant) => participant.participantType === ParticipantType.PARTICIPANT_TYPE_ANONYMOUS,\n );\n if (anonymousParticipant) return of(this.contactInfoMissingError());\n\n // should only one customer in one specific webchat conversation\n const customerParticipant = conversationDetail?.participants?.find(\n (participant) => participant.participantType === ParticipantType.PARTICIPANT_TYPE_CUSTOMER,\n );\n if (!customerParticipant || (!customerParticipant.phoneNumber && !customerParticipant.email))\n return of(this.contactInfoMissingError());\n\n return this.country$.pipe(\n switchMap((country) => {\n if (!this.smsRegistrationService || !customerParticipant.phoneNumber) {\n return of(\n smsNotAvailableError(\n customerParticipant.phoneNumber,\n customerParticipant.email,\n country,\n this.translationService,\n ),\n );\n }\n\n return combineLatest([this.inboxService.SMSNumber$, this.smsRegistrationService.registrationStage$]).pipe(\n map(([smsNumber, registrationStage]) => {\n if (!smsNumber && registrationStage != RegistrationStage.RegistrationComplete) {\n return smsNotAvailableError(\n customerParticipant.phoneNumber,\n customerParticipant.email,\n country,\n this.translationService,\n );\n }\n return null;\n }),\n );\n }),\n );\n }\n\n private contactInfoMissingError(): AlertOptions {\n return {\n title: 'INBOX.WEBCHAT.SETTINGS.WEBCHAT_DISABLED_MISSING_CONTACT_INFO',\n };\n }\n\n private readonly conversationApiService = inject(ConversationApiService);\n private accountGroupId$ = inject(ACCOUNT_GROUP_ID_TOKEN);\n\n readonly webchats$: Observable = this.accountGroupId$.pipe(\n switchMap((accountGroupId) => this.conversationApiService.listWidgets({ namespace: accountGroupId })),\n map((listWidgets) => listWidgets?.widgets),\n shareReplay({ bufferSize: 1, refCount: true }),\n catchError(async () => {\n return [];\n }),\n );\n\n readonly isAnyWebchatEnabled$ = this.webchats$.pipe(\n map((webchats) => {\n if (webchats) {\n return webchats.some((webchat) => webchat.isEnabled);\n }\n return false;\n }),\n );\n}\n","import { Component, Inject, OnInit, Optional, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatDialog } from '@angular/material/dialog';\nimport { Router } from '@angular/router';\nimport { RegistrationStage, SmsRegistrationService } from '@galaxy/sms';\nimport { BusinessSelectorDialogComponent } from '@vendasta/businesses';\nimport {\n ConversationChannel,\n GlobalParticipantType,\n PlatformLocation,\n SubjectParticipant,\n} from '@vendasta/conversation';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport {\n Observable,\n combineLatest,\n filter,\n map,\n of,\n shareReplay,\n switchMap,\n take,\n withLatestFrom,\n firstValueFrom,\n} from 'rxjs';\nimport { ConversationGoogleService } from '../../../../core/src/lib/channels/conversation-google.service';\nimport { ConversationWebchatService } from '../../../../core/src/lib/channels/conversation-webchat.service';\nimport { InboxNavigationService } from '../../../../core/src/lib/inbox-navigation.service';\nimport { InboxService } from '../../../../core/src/lib/inbox.service';\nimport { ConversationConfig } from '../../../../core/src/lib/interface/config.interface';\nimport { ParticipantService } from '../../../../core/src/lib/participant.service';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_CONFIG_TOKEN,\n CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN,\n CONVERSATION_HOST_APP_INTERFACE_TOKEN,\n CONVERSATION_IMAGE_SERVICE_TOKEN,\n CONVERSATION_ROUTES_TOKEN,\n CONVERSATION_SMS_ENABLED_TOKEN,\n InboxImageService,\n PARTNER_ID_TOKEN,\n GROUP_ID_TOKEN,\n} from '../../../../core/src/lib/tokens';\nimport { InboxApiService } from '@vendasta/conversation';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\n\n@Component({\n selector: 'inbox-welcome',\n templateUrl: './inbox-welcome.component.html',\n styleUrls: ['./inbox-welcome.component.scss'],\n})\nexport class InboxWelcomeComponent implements OnInit {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n private readonly inboxNav = inject(InboxNavigationService);\n private readonly participantService = inject(ParticipantService);\n\n isBusinessApp = this.inboxService.isBusinessApp;\n private readonly smsRegistrationService = this.isBusinessApp ? inject(SmsRegistrationService) : null;\n\n constructor(\n private readonly analyticsService: ProductAnalyticsService,\n private router: Router,\n private inboxService: InboxService,\n private dialog: MatDialog,\n private inboxApiService: InboxApiService,\n @Inject(CONVERSATION_IMAGE_SERVICE_TOKEN) readonly inboxImageService: InboxImageService,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n @Inject(PARTNER_ID_TOKEN) readonly partnerId$: Observable,\n @Optional() @Inject(CONVERSATION_CONFIG_TOKEN) private readonly inboxConfig: ConversationConfig,\n @Inject(CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN)\n readonly googleBusinessMessagesAvailable$: Observable,\n private readonly conversationWebchatService: ConversationWebchatService,\n private readonly conversationGoogleService: ConversationGoogleService,\n @Inject(CONVERSATION_SMS_ENABLED_TOKEN) private smsEnabled$: Observable,\n @Inject(GROUP_ID_TOKEN) readonly groupId$: Observable,\n private snackbarService: SnackbarService,\n ) {}\n\n optInClicked = false;\n\n isPartnerChatEnabled$ = this.inboxService.allowSmbChatWithPartner$;\n\n displayA2pCard$ = this.inboxService.displayA2pCard$();\n multiLocationEnabled$ = this.inboxService.multiLocationEnabled$;\n displayA2pLink$ =\n this.smsRegistrationService !== null\n ? combineLatest([\n this.smsRegistrationService.getAccountGroupInfo$().pipe(map((info) => info.napData.country)),\n this.displayA2pCard$,\n this.smsRegistrationService.registrationStage$,\n ]).pipe(\n shareReplay({ bufferSize: 1, refCount: true }),\n map(([country, displayA2pCard, registrationStage]) => {\n return country === 'US' && displayA2pCard && registrationStage !== RegistrationStage.RegistrationComplete;\n }),\n )\n : of(false);\n\n displayGoogleLink$ = combineLatest([\n this.googleBusinessMessagesAvailable$,\n this.conversationGoogleService.isGoogleBusinessMessagesEnabled$,\n ]).pipe(\n map(([googleBusinessMessagesAvailable, isGoogleBusinessMessagesEnabled]) => {\n return googleBusinessMessagesAvailable && !isGoogleBusinessMessagesEnabled;\n }),\n );\n\n displayWebchatLink$ = this.inboxService.canAccessWebChatSettings$.pipe(\n switchMap((canAccessWebchat) => {\n if (canAccessWebchat) {\n return this.conversationWebchatService.isAnyWebchatEnabled$.pipe(\n map((isAnyWebchatEnabled) => canAccessWebchat && !isAnyWebchatEnabled),\n );\n }\n return of(false);\n }),\n );\n\n isMultiLocation = this.hostAppInterface.getAppOptions().is_multilocation;\n showNewMessage = !this.inboxConfig?.hideNewMessageButton;\n platformLocation = this.inboxService.platformLocation;\n partnerBrandName$ = this.inboxConfig?.partnerBrandName$;\n\n isOnlyPartnerChatAvailable$ = combineLatest([\n this.isPartnerChatEnabled$,\n this.displayA2pLink$,\n this.displayGoogleLink$,\n this.displayWebchatLink$,\n this.smsEnabled$,\n ]).pipe(\n map(([allowPartnerChat, displayA2pLink, displayGoogleLink, displayWebchatLink, smsEnabled]) => {\n return !!(\n this.isBusinessApp &&\n allowPartnerChat &&\n !displayA2pLink &&\n !displayGoogleLink &&\n !displayWebchatLink &&\n !smsEnabled\n );\n }),\n );\n\n settingsUrl$ = this.accountGroupId$.pipe(\n filter((accountGroupId) => !!accountGroupId),\n map((accountGroupId) => `/account/location/${accountGroupId}/settings/inbox`),\n );\n\n private readonly routes = toSignal(inject(CONVERSATION_ROUTES_TOKEN));\n\n ngOnInit(): void {\n this.analyticsService.trackEvent('inbox', 'home', 'view');\n }\n\n newMessage(): void {\n switch (this.platformLocation) {\n case PlatformLocation.PLATFORM_LOCATION_BUSINESS_APP:\n this.messageFromBusinessCenter();\n break;\n case PlatformLocation.PLATFORM_LOCATION_PARTNER_CENTER:\n case PlatformLocation.PLATFORM_LOCATION_SALES_CENTER:\n this.messageFromPartnerCenter();\n break;\n case PlatformLocation.PLATFORM_LOCATION_VENDOR_CENTER:\n this.messageFromVendorCenter();\n break;\n default:\n console.warn(`New message not supported in ${this.platformLocation}.`);\n break;\n }\n }\n\n messageFromBusinessCenter(): void {\n const routes = this.routes();\n if (!routes) return;\n\n combineLatest([\n this.partnerId$,\n this.accountGroupId$,\n this.inboxService.canAccessSMS$,\n this.participantService.buildIAMUserParticipant(),\n ])\n .pipe(take(1))\n .subscribe(([partnerId, accountGroupId, canAccessSMS, currentIAMParticipant]) => {\n if (canAccessSMS === true) {\n this.router.navigate([routes.sendNewMessage]);\n } else {\n this.hostAppInterface.redirectToInternalConversation(\n currentIAMParticipant,\n [\n new SubjectParticipant({\n internalParticipantId: accountGroupId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_ACCOUNT_GROUP,\n }),\n new SubjectParticipant({\n internalParticipantId: partnerId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n }),\n ],\n ConversationChannel.CONVERSATION_CHANNEL_INTERNAL,\n );\n }\n });\n }\n\n messageFromPartnerCenter(): void {\n const currentIAMParticipant = this.participantService.buildIAMUserParticipant();\n this.partnerId$\n .pipe(\n switchMap((partnerId) => {\n return this.dialog\n .open(BusinessSelectorDialogComponent, {\n width: '500px',\n data: {\n partnerId: partnerId,\n },\n })\n .afterClosed();\n }),\n withLatestFrom(this.partnerId$, currentIAMParticipant),\n take(1),\n )\n .subscribe(([business, partnerId, currentParticipant]) => {\n if (business) {\n this.inboxNav.gotoConversation(\n [\n new SubjectParticipant({\n internalParticipantId: partnerId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n }),\n new SubjectParticipant({\n internalParticipantId: business?.accountGroupId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_ACCOUNT_GROUP,\n }),\n ],\n currentParticipant,\n ConversationChannel.CONVERSATION_CHANNEL_INTERNAL,\n );\n }\n });\n }\n\n messageFromVendorCenter(): void {\n const routes = this.routes();\n if (!routes) return;\n this.router.navigate([routes.root, 'resellers']);\n }\n\n async optIn(): Promise {\n const groupId = await firstValueFrom(this.groupId$);\n try {\n await firstValueFrom(\n this.inboxApiService.upsertProductFeature({\n productFeature: {\n multiLocationEnabled: true,\n },\n fieldMask: {\n paths: ['multi_location_enabled'],\n },\n subjectParticipant: {\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_GROUP,\n internalParticipantId: groupId,\n },\n }),\n );\n this.snackbarService.openSuccessSnack('INBOX.MULTI_LOCATION.SUCCESS_TO_OPT_IN', { duration: Infinity });\n this.optInClicked = true;\n } catch {\n this.snackbarService.openErrorSnack('INBOX.MULTI_LOCATION.FAIL_TO_OPT_IN');\n }\n }\n}\n","
\n\n

{{ 'INBOX.WELCOME.TITLE' | translate }}

\n\n\n \n
\n

\n {{ 'INBOX.WELCOME_CHAT_WITH_PARTNER.SUBTITLE_1' | translate }}\n

\n

\n {{ 'INBOX.WELCOME_CHAT_WITH_PARTNER.SUBTITLE_2' | translate: { partnerBrandName } }}\n

\n
\n\n
\n

\n {{ 'INBOX.WELCOME.SUBTITLE' | translate }}\n

\n\n \n
\n
\n
\n\n

\n {{ 'INBOX.MULTI_LOCATION.MULTI_LOCATION_SUBTITLE' | translate }}\n

\n
\n\n

\n \n {{ 'INBOX.EMPTY.ACTION' | translate }}\n \n \n {{ 'INBOX.MULTI_LOCATION.MULTI_LOCATION_BUTTON' | translate }}\n \n

\n","import { NgModule } from '@angular/core';\nimport { RouterModule } from '@angular/router';\n\n@NgModule({\n imports: [RouterModule.forChild([])],\n exports: [RouterModule],\n})\nexport class ConversationUIRouting {}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, createUrlTreeFromSnapshot, UrlTree } from '@angular/router';\nimport { Observable, switchMap, take } from 'rxjs';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SmsAccessGuard {\n constructor(readonly inboxService: InboxService) {}\n\n canActivate(\n route: ActivatedRouteSnapshot,\n ): Observable | Promise | boolean | UrlTree {\n return this.inboxService.canAccessSMS$.pipe(\n take(1),\n switchMap(async (canAccessSMS) => canAccessSMS || createUrlTreeFromSnapshot(route, ['../'])),\n );\n }\n}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, UrlTree } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class WebChatAccessGuard {\n constructor(readonly inboxService: InboxService) {}\n\n canActivateChild(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _: ActivatedRouteSnapshot,\n ): Observable | Promise | boolean | UrlTree {\n return this.inboxService.canAccessWebChatSettings$;\n }\n}\n","import { Component, Inject, OnInit, inject } from '@angular/core';\nimport { AbstractControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\nimport { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';\nimport { MerchantService } from '@galaxy/billing';\nimport { TranslateService } from '@ngx-translate/core';\nimport { PaymentLinkItem } from '@vendasta/billing';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { getCurrencySymbol } from '@vendasta/galaxy/utility/currency-utils';\nimport { SSOService } from '@vendasta/sso';\nimport { switchMap, take } from 'rxjs/operators';\nimport { ConversationService } from '../../../../../../core/src/lib/conversation.service';\nimport { InboxService } from '../../../../../../core/src/lib/inbox.service';\nimport { CONVERSATION_HOST_APP_INTERFACE_TOKEN, PARTNER_ID_TOKEN } from '../../../../../../core/src/lib/tokens';\n\n@Component({\n selector: 'inbox-insert-payment-link-form',\n templateUrl: 'inbox-insert-payment-link-form.component.html',\n styleUrls: ['inbox-insert-payment-link-form.component.scss'],\n})\nexport class InboxInsertPaymentLinkFormComponent implements OnInit {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n paymentUrl: string;\n paymentLinkForm = this.formBuilder.group({\n lineItems: this.formBuilder.array([]),\n });\n defaultLineItem = {\n quantity: [1],\n description: [''],\n amount: [0],\n };\n currencyCode = 'USD'; // fallback to USD if no currency is set.\n subTotal = 0;\n tax = 0;\n currencySymbol = '$';\n\n showTaxCalculation = false;\n\n readonly CENTS_PER_DOLLAR = 100;\n readonly DIGITS_INFO = '1.2-2';\n\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n\n constructor(\n @Inject(MAT_DIALOG_DATA) public data: any,\n private ssoService: SSOService,\n private formBuilder: UntypedFormBuilder,\n private conversationService: ConversationService,\n private merchantService: MerchantService,\n private snackbarService: SnackbarService,\n private translateService: TranslateService,\n public dialogRef: MatDialogRef,\n private inboxService: InboxService,\n ) {}\n\n ngOnInit(): void {\n this.initCurrency();\n // At least one lineItem cannot be removed.\n this.lineItems.push(this.formBuilder.group(this.defaultLineItem));\n // TODO: Remove this once we have the tax rates management feature in the Business App.\n this.showTaxCalculation = this.inboxService.isPartnerCenter;\n }\n\n private initCurrency(): void {\n // TODO: SMBs don't have merchant retail config currency setting.\n // SMBs will use their partner's currency setting\n // until we have this feature built in the billing µservice,\n this.partnerId$\n .pipe(\n switchMap((partnerId) => {\n return this.merchantService.getMultiRetailConfigurations(partnerId, ['default']);\n }),\n take(1),\n )\n .subscribe((config) => {\n this.currencyCode = config.get('default').currencyCode;\n this.currencySymbol = getCurrencySymbol(this.currencyCode);\n });\n }\n\n get lineItems(): UntypedFormArray {\n return this.paymentLinkForm.controls['lineItems'] as UntypedFormArray;\n }\n\n public addLineItem(): void {\n this.lineItems.push(this.formBuilder.group(this.defaultLineItem));\n }\n\n public deleteLineItemAndCalculate(index: number): void {\n this.lineItems.removeAt(index);\n this.calculateSubTotalAndTax();\n }\n\n public getLineItemsFormArray(): UntypedFormArray {\n return this.paymentLinkForm.get('lineItems') as UntypedFormArray;\n }\n\n public getLineItemsFormControl(): AbstractControl[] {\n return this.getLineItemsFormArray().controls;\n }\n\n private formatAmount(amount: number): string {\n return isNaN(amount) ? '0' : (amount / this.CENTS_PER_DOLLAR).toFixed(2);\n }\n\n public getLineItemsArray(): PaymentLinkItem[] {\n const lineItems: PaymentLinkItem[] = [];\n this.getLineItemsFormControl().forEach((formControl, idx) => {\n const amount = parseInt((formControl.value.amount * this.CENTS_PER_DOLLAR).toFixed(0), 10);\n const formGroup: UntypedFormGroup = this.getLineItemsFormArray()?.at(idx) as UntypedFormGroup;\n formGroup.controls.amount.setValue(this.formatAmount(amount));\n lineItems.push({\n quantity: 1, // always 1 per line item.\n description: formControl.value.description,\n // convert to cents\n amount: amount,\n } as PaymentLinkItem);\n });\n return lineItems;\n }\n\n public calculateSubTotalAndTax(): void {\n this.subTotal = this.getLineItemsArray().reduce((acc, cur) => acc + cur.amount, 0);\n if (this.showTaxCalculation) {\n this.hostAppInterface\n .calculatePaymentLinkTax(this.data.conversationDetail, this.subTotal)\n .pipe(take(1))\n .subscribe((taxAmount) => {\n this.tax = taxAmount;\n });\n }\n }\n\n public requestPayment(): void {\n this.hostAppInterface\n .createPaymentLink(this.data.conversationDetail, this.getLineItemsArray())\n .pipe(take(1))\n .subscribe((paymentUrl) => {\n if (paymentUrl) {\n this.paymentUrl = paymentUrl;\n this.dialogRef.close(paymentUrl);\n const successMessage = this.translateService.instant('INBOX.REQUEST_PAYMENT.INVOICE_CREATE_SUCCESS');\n if (this.showTaxCalculation) {\n this.snackbarService.openWithOptions(successMessage, {\n action: this.translateService.instant('INBOX.REQUEST_PAYMENT.VIEW_INVOICES'),\n actionCallback: () => window.open('/invoices', '_blank'),\n });\n } else {\n this.snackbarService.openSuccessSnack(successMessage);\n }\n } else {\n this.snackbarService.openErrorSnack('INBOX.REQUEST_PAYMENT.INVOICE_CREATE_ERROR');\n }\n });\n }\n}\n","

\n {{ 'INBOX.REQUEST_PAYMENT.TITLE' | translate }}\n

\n\n \n \n \n \n \n \n \n \n   {{ currencySymbol }}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n \n\n","import { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { MatDialog } from '@angular/material/dialog';\nimport { InboxInsertPaymentLinkFormComponent } from './inbox-insert-payment-link-form.component';\nimport { ConversationDetail } from '../../../../../../core/src/lib/interface/conversation.interface';\n@Component({\n selector: 'inbox-insert-payment-link',\n template: '',\n})\nexport class InboxInsertPaymentLinkComponent {\n @Input() conversationDetail: ConversationDetail;\n @Output() insertLink = new EventEmitter();\n\n constructor(public modal: MatDialog) {}\n\n openInsertLinkModal(): void {\n const modalRef$ = this.modal.open(InboxInsertPaymentLinkFormComponent, {\n width: '620px',\n data: {\n conversationDetail: this.conversationDetail,\n },\n });\n // TODO: unsubscribe\n modalRef$.afterClosed().subscribe((res) => {\n if (res) {\n this.insertLink.emit(res);\n }\n });\n }\n}\n","import { ChangeDetectionStrategy, Component, EventEmitter, Output, ViewChild, inject } from '@angular/core';\nimport { EnvironmentService } from '@galaxy/core';\nimport { AppPartnerService, AppSettings } from '@galaxy/marketplace-apps';\nimport { FeatureFlagService } from '@galaxy/partner';\nimport { AccountsService, ActivationStatus } from '@vendasta/accounts';\nimport { GetMultiActivationStatusesResponseAppsAndAddonsActivationStatuses } from '@vendasta/accounts/lib/_internal/objects/api';\nimport { ConversationChannel, GlobalParticipantType, SubjectParticipant } from '@vendasta/conversation';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { SSOService, newAccountServiceContext } from '@vendasta/sso';\nimport { BehaviorSubject, EMPTY, Observable, combineLatest, firstValueFrom, of } from 'rxjs';\nimport { catchError, defaultIfEmpty, filter, map, shareReplay, switchMap, take } from 'rxjs/operators';\nimport { ConversationService } from '../../../../../../core/src/lib/conversation.service';\nimport {\n CustomerVoiceAppIDs,\n DEFAULT_CV_ICON,\n DEFAULT_CV_NAME,\n SMB_MESSAGE_PARTNER_FEATURE,\n} from '../../../../../../core/src/lib/inbox.constants';\nimport { InboxService } from '../../../../../../core/src/lib/inbox.service';\nimport { ListingService, ReviewLink } from '../../../../../../core/src/lib/listing.service';\nimport { ParticipantService } from '../../../../../../core/src/lib/participant.service';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_HOST_APP_INTERFACE_TOKEN,\n PARTNER_ID_TOKEN,\n} from '../../../../../../core/src/lib/tokens';\n\nimport { MatMenu } from '@angular/material/menu';\n\ninterface CVBrandingInfo {\n name: string;\n iconUrl: string;\n}\n\n@Component({\n selector: 'inbox-insert-review-link',\n templateUrl: './inbox-insert-review-link.component.html',\n styleUrls: ['./inbox-insert-review-link.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class InboxInsertReviewLinkComponent {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n private readonly participantService = inject(ParticipantService);\n\n @Output() insertLink = new EventEmitter();\n @ViewChild('menuCustomerVoice') customerVoiceMenu: MatMenu;\n @ViewChild('menuContactUs') contactUsMenu: MatMenu;\n\n private readonly loading$$ = new BehaviorSubject(true);\n protected readonly loading$ = this.loading$$.asObservable();\n\n private readonly accountGroupId$ = inject(ACCOUNT_GROUP_ID_TOKEN);\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n\n customerVoiceAppIsActive$: Observable = this.accountGroupId$.pipe(\n switchMap((accountGroupId) => {\n return this.accountsService.getMultiActivationStatuses([accountGroupId]).pipe(\n catchError((err) => {\n console.warn('error to get activation status', err);\n return EMPTY;\n }),\n defaultIfEmpty([]),\n map((res: GetMultiActivationStatusesResponseAppsAndAddonsActivationStatuses[]) => {\n const activeApps = res.filter(\n (filter) =>\n filter.productId === CustomerVoiceAppIDs[this.environmentService.getEnvironment()] &&\n filter.status === ActivationStatus.ACTIVATION_STATUS_ACTIVATED,\n );\n return activeApps.length > 0;\n }),\n );\n }),\n );\n\n cvPreferredSitesSettingsLink$: Observable = combineLatest([\n this.customerVoiceAppIsActive$,\n this.accountGroupId$,\n ]).pipe(\n switchMap(([customerVoiceAppIsActive, accountGroupId]) => {\n if (!customerVoiceAppIsActive) {\n return of(null);\n }\n return this.ssoService\n .getEntryUrl(\n CustomerVoiceAppIDs[this.environmentService.getEnvironment()],\n newAccountServiceContext(accountGroupId),\n )\n .pipe(\n catchError(() => of(null)),\n map((entryUrl) => {\n if (!entryUrl) {\n return null;\n }\n const url = new URL(\n entryUrl.replace('', accountGroupId).replace('%3CaccountId%3E', accountGroupId),\n );\n url.searchParams.set('nextUrl', `/cv/account/${accountGroupId}/settings/preferred-sites`);\n return url.toString();\n }),\n shareReplay(1),\n );\n }),\n );\n\n customerVoiceAppInfo$ = combineLatest([this.partnerId$, this.conversationService.marketId$]).pipe(\n switchMap(([partnerId, marketId]) => {\n return this.appPartnerService\n .getAppSettings(CustomerVoiceAppIDs[this.environmentService.getEnvironment()], partnerId, marketId)\n .pipe(\n catchError(() => {\n console.error('error getting customer voice app settings');\n return EMPTY;\n }),\n defaultIfEmpty({ branding: { enabled: false } }),\n map((appSettings: AppSettings) => {\n return {\n name:\n appSettings?.branding?.name && appSettings?.branding?.enabled\n ? appSettings?.branding?.name\n : DEFAULT_CV_NAME,\n iconUrl:\n appSettings?.branding?.iconUrl && appSettings?.branding?.enabled\n ? appSettings.branding.iconUrl\n : DEFAULT_CV_ICON,\n };\n }),\n );\n }),\n map((branding) => {\n return {\n name: branding.name,\n iconUrl: branding.iconUrl,\n } as CVBrandingInfo;\n }),\n );\n\n enableMessagePartnerFeature$: Observable = this.partnerId$.pipe(\n switchMap((partnerId) => {\n return this.featureFlagService.batchGetStatus(partnerId, '', [SMB_MESSAGE_PARTNER_FEATURE]);\n }),\n filter((ff) => !!ff),\n map((feature) => feature[SMB_MESSAGE_PARTNER_FEATURE]),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n reviewLinks$: Observable = this.listingService.reviewLinks$.pipe(\n catchError(() => {\n this.loading$$.next(false);\n return EMPTY;\n }),\n defaultIfEmpty([]),\n map((results) => {\n this.loading$$.next(false);\n return results;\n }),\n );\n\n constructor(\n private conversationService: ConversationService,\n private appPartnerService: AppPartnerService,\n private listingService: ListingService,\n private ssoService: SSOService,\n private accountsService: AccountsService,\n private featureFlagService: FeatureFlagService,\n private analyticsService: ProductAnalyticsService,\n private environmentService: EnvironmentService,\n private inboxService: InboxService,\n ) {}\n\n async useLink(reviewLink: ReviewLink): Promise {\n const [partnerId, accountGroupId] = await Promise.all([\n firstValueFrom(this.partnerId$),\n firstValueFrom(this.accountGroupId$),\n ]);\n this.analyticsService.trackEvent('inbox-insert-review-link', reviewLink.sourceName, 'clicked', 0, {\n accountGroupId: accountGroupId,\n partnerId: partnerId,\n location: this.inboxService.platformLocation,\n });\n this.insertLink.emit(reviewLink.reviewUrl);\n }\n\n openNewCVPreferredSitesSettingsTab(cvPreferredSitesSettingsLink: string): void {\n window.open(cvPreferredSitesSettingsLink, '_blank');\n }\n\n async getInserReviewMenu(): Promise {\n return (await firstValueFrom(this.customerVoiceAppIsActive$)) ? this.customerVoiceMenu : this.contactUsMenu;\n }\n\n sendMessage(): void {\n combineLatest([this.partnerId$, this.accountGroupId$, this.participantService.buildIAMUserParticipant()])\n .pipe(take(1))\n .subscribe(([partnerId, accountGroupId, currentIAMParticipant]) => {\n this.hostAppInterface.redirectToInternalConversation(\n currentIAMParticipant,\n [\n new SubjectParticipant({\n internalParticipantId: accountGroupId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_ACCOUNT_GROUP,\n }),\n new SubjectParticipant({\n internalParticipantId: partnerId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n }),\n ],\n ConversationChannel.CONVERSATION_CHANNEL_INTERNAL,\n );\n });\n }\n}\n","\n
\n \n \n \n \n
\n
\n\n\n
\n
\n \n {{ 'INBOX.CHAT.INSERT_REVIEW_LINK' | translate }}\n
\n \n \n {{ 'INBOX.CHAT.GET_ACCESS_TO_REVIEW_LINKS' | translate }}\n \n \n
\n \n
\n\n \n\n\n\n \n
\n \n open_in_new\n
\n \n \n \n 0; else setupCustomerVoice\">\n \n \n \n \n \n \n \n
\n
\n\n\n
\n \n
\n \n
\n","import { Component, inject } from '@angular/core';\nimport { MatDialogRef } from '@angular/material/dialog';\nimport { TemplateService } from '../../../../../../core/src/lib/template.service';\nimport { MessageTemplate } from '@vendasta/conversation';\nimport { Scrollable } from '@vendasta/rx-utils';\nimport { BehaviorSubject, catchError, map, of } from 'rxjs';\nimport { TEMPLATES_PAGE_SIZE } from '../../../../../../core/src/lib/inbox.constants';\nimport { InboxService } from '../../../../../../core/src/lib/inbox.service';\nimport { ACCOUNT_GROUP_ID_TOKEN } from '../../../../../../core/src/lib/tokens';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { InboxAtlasRoute } from '../../../../../../core/src/lib/interface/inbox.interface';\nimport { INBOX_TEMPLATES_ROUTER_LINK } from '../../../../../src/constants';\n\n@Component({\n selector: 'inbox-insert-template',\n templateUrl: './inbox-insert-template.component.html',\n styleUrls: ['./inbox-insert-template.component.scss'],\n})\nexport class InboxInsertTemplateComponent {\n private scrollable: Scrollable = this.getScrollableList();\n protected readonly templates$ = this.scrollable.items$;\n\n private loading$$: BehaviorSubject = new BehaviorSubject(true);\n readonly loading$ = this.loading$$.asObservable();\n\n private readonly templateService = inject(TemplateService);\n private readonly inboxService = inject(InboxService);\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n\n readonly isBusinessApp = this.inboxService.isBusinessApp;\n\n constructor(private readonly dialogRef: MatDialogRef) {}\n\n getEditRoute(): string | InboxAtlasRoute {\n if (this.isBusinessApp) {\n return `/account/location/${this.accountGroupId()}/settings/message-templates`;\n }\n return INBOX_TEMPLATES_ROUTER_LINK;\n }\n\n selectTemplate(template: MessageTemplate): void {\n this.dialogRef.close(template);\n }\n\n loadNext(): void {\n this.scrollable.loadMore();\n }\n\n private getScrollableList() {\n return new Scrollable(of(null), (_, cursor) => {\n return this.loadMore(cursor);\n });\n }\n\n loadMore(cursor: string) {\n return this.templateService.listTemplates(cursor, TEMPLATES_PAGE_SIZE).pipe(\n map((response) => {\n this.loading$$.next(false);\n return {\n items: response.templates,\n cursor: response.pagingMetadata?.nextCursor ?? '',\n hasMore: response.pagingMetadata?.hasMore ?? false,\n };\n }),\n catchError(() => of({ items: [] as Array, cursor: '', hasMore: false })),\n );\n }\n}\n","
\n
\n

{{ 'INBOX.MESSAGE_TEMPLATES.TITLE' | translate }}

\n \n {{ 'INBOX.MESSAGE_TEMPLATES.MODAL.EDIT_TEMPLATES' | translate }}\n \n
\n
\n\n \n \n 0; else emptyState\">\n \n \n
\n \n \n\n\n\n \n\n\n \n \n article\n \n \n {{ 'INBOX.MESSAGE_TEMPLATES.MODAL.EMPTY_STATE_TITLE' | translate }}\n \n

{{ 'INBOX.MESSAGE_TEMPLATES.MODAL.EMPTY_STATE_CONTENT' | translate }}

\n
\n
\n","import { ConversationChannel, MessageType, Participant } from '@vendasta/conversation';\nimport { ConversationEvent, ConversationMessage } from './interface/conversation.interface';\n\nexport type ViewMode = 'modal' | 'sidebar';\n\nexport type MessageGroupable = ConversationEvent | ConversationMessage | MessageGroup;\n\nexport class MessageGroup {\n readonly id: string;\n readonly type: MessageType;\n readonly channel: ConversationChannel;\n messages: ConversationMessage[];\n readonly sender?: Participant;\n createdAt: Date;\n\n constructor(\n messageId: string,\n sender?: Participant,\n messageType?: MessageType,\n channel?: ConversationChannel,\n createdAt?: Date,\n ) {\n this.id = `message-group-${messageId}`;\n this.messages = [];\n this.sender = sender;\n this.type = messageType;\n this.channel = channel;\n this.createdAt = createdAt;\n }\n\n addMessage(message: ConversationMessage): void {\n this.messages.push(message);\n }\n\n get lastMessage(): ConversationMessage {\n return this.messages?.[this.messages?.length - 1];\n }\n}\n","import { Component, EventEmitter, Input, OnDestroy, Output, ViewChild } from '@angular/core';\nimport { ConversationChannel } from '@vendasta/conversation';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport {\n FileInfo,\n FileUploadError,\n FileUploadStatus,\n GALAXY_UPLOADER_SERVICE_TOKEN,\n GalaxyUploaderComponent,\n} from '@vendasta/galaxy/uploader';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { Observable, ReplaySubject, firstValueFrom, map } from 'rxjs';\nimport { ConversationDetail, InboxService, ParticipantService } from '../../../../../../core/src/index';\nimport { MAX_FILES, MAX_RECORDING_TIME } from '../../../../../../core/src/lib/conversation.constants';\nimport { InboxUploadService, getMaxFileSizeInMB } from './inbox-upload.service';\nimport { ChatSourceId } from '@vendasta/galaxy/chat-composer/src/chat-composer.component';\n\n@Component({\n selector: 'inbox-upload-file',\n templateUrl: 'inbox-upload-file.component.html',\n styleUrls: ['./inbox-upload-file.component.scss'],\n providers: [{ provide: GALAXY_UPLOADER_SERVICE_TOKEN, useExisting: InboxUploadService }],\n})\nexport class InboxUploadFileComponent implements OnDestroy {\n maxFiles = MAX_FILES;\n private readonly conversationChannel$$: ReplaySubject = new ReplaySubject(\n 1,\n );\n conversationChannel$: Observable = this.conversationChannel$$.asObservable();\n\n isRecording = false;\n stream: MediaStream | undefined;\n recorder: MediaRecorder;\n chunks: any[] = [];\n recordingTimeout: any;\n disableVoiceRecording$: Observable = this.inboxUploadService.files$$.pipe(map((files) => files.length > 0));\n\n @ViewChild(GalaxyUploaderComponent) public readonly uploader: GalaxyUploaderComponent | undefined;\n\n @Input() set conversationDetail(value: ConversationDetail) {\n this.inboxUploadService.conversationId$$.next(value?.conversation?.conversationId);\n this.conversationChannel$$.next(value?.conversation?.channel);\n }\n\n @Input() selectedChatSourceId: ChatSourceId | undefined;\n\n @Input() enableVoiceRecording = false;\n\n @Output() fileChanged = new EventEmitter();\n\n constructor(\n private readonly snackbarService: SnackbarService,\n private readonly inboxUploadService: InboxUploadService,\n private readonly analyticsService: ProductAnalyticsService,\n private readonly participantService: ParticipantService,\n private readonly inboxService: InboxService,\n ) {}\n\n public async fileUploaded(file: FileInfo): Promise {\n this.emitAnalyticsEvent('file-upload-success', file);\n this.fileChanged.emit(file);\n }\n\n public async uploadErrored(err: FileUploadError): Promise {\n if (err.error.message === 'GALAXY.UPLOADER.ERROR.MAX_FILES_EXCEEDED') {\n this.snackbarService.openErrorSnack('INBOX.UPLOAD_FILE.MAX_FILES_EXCEEDED');\n } else if (err.error.message === 'GALAXY.UPLOADER.ERROR.MAX_FILE_SIZE_EXCEEDED') {\n const channel = await firstValueFrom(this.conversationChannel$);\n this.snackbarService.openErrorSnack('INBOX.UPLOAD_FILE.MAX_FILE_SIZE_EXCEEDED_ARG', {\n interpolateTranslateParams: {\n maxFileSize: getMaxFileSizeInMB(this.selectedChatSourceId).toString(),\n channel: channel.toString(),\n },\n });\n } else {\n this.snackbarService.openErrorSnack(err.error.message);\n }\n this.emitAnalyticsEvent('file-upload-error', err.fileInfo, err.error.message);\n }\n\n public filesChanged(files: FileInfo[]): void {\n //Check the file status to avoid emitting the file twice when file is uploaded successfully\n if (files[0] && files[0].status !== FileUploadStatus.Success) {\n this.fileChanged.emit(files[0]);\n }\n }\n\n get showUploadIcon(): boolean {\n return this.selectedChatSourceId !== 'google';\n }\n\n toggleRecording() {\n this.isRecording = !this.isRecording;\n if (this.isRecording) {\n this.startRecording();\n } else {\n this.stopRecording();\n }\n }\n\n startRecording() {\n this.emitAnalyticsEvent('voice-record-started');\n navigator.mediaDevices\n .getUserMedia({ audio: true })\n .then((stream) => {\n this.stream = stream;\n this.recorder = new MediaRecorder(stream);\n this.recorder.ondataavailable = (ev) => this.chunks.push(ev.data);\n this.recorder.start();\n\n this.recordingTimeout = window.setTimeout(() => {\n this.stopRecording();\n }, MAX_RECORDING_TIME);\n })\n .catch((err) => {\n console.error('Could not start recording: ', err);\n this.isRecording = false;\n });\n }\n\n stopRecording() {\n if (!this.recorder) {\n console.error('No recording to stop');\n return;\n }\n\n const fileName = 'voice-' + new Date().toISOString() + '.webm';\n this.recorder.onstop = () => {\n const blob = new Blob(this.chunks, { type: 'audio/webm' });\n this.chunks = [];\n\n const file = new File([blob], fileName, { type: blob.type });\n\n const fileInfo = {\n file: file,\n name: file.name,\n status: FileUploadStatus.Queued,\n } as FileInfo;\n this.inboxUploadService.setFiles([fileInfo]);\n this.inboxUploadService.uploadQueuedFiles();\n this.isRecording = false;\n };\n\n if (this.recordingTimeout) {\n window.clearTimeout(this.recordingTimeout);\n }\n\n this.recorder.stop();\n this.stream.getTracks().forEach((track) => track.stop());\n }\n\n async emitAnalyticsEvent(eventName: string, file?: FileInfo, err?: string) {\n const [sender, channel] = await Promise.all([\n firstValueFrom(this.participantService.currentParticipant$),\n firstValueFrom(this.conversationChannel$),\n ]);\n\n this.analyticsService.trackEvent('inbox', 'file-share', eventName, 0, {\n accountGroupId: sender.accountGroupId,\n partnerId: sender.partnerId,\n location: this.inboxService.platformLocation,\n channel,\n mediaType: file?.file?.type ?? '',\n error: err ?? '',\n });\n }\n\n ngOnDestroy() {\n if (this.recorder) {\n this.recorder.stop();\n }\n if (this.stream) {\n this.stream.getTracks().forEach((track) => track.stop());\n }\n this.inboxUploadService.clear();\n this.inboxUploadService.fileErrored$$.next(null);\n }\n}\n","\n \n attach_file\n \n\n\n \n \n keyboard_voice\n \n \n fiber_manual_record\n \n \n\n\n\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n computed,\n effect,\n EventEmitter,\n inject,\n Inject,\n Input,\n OnChanges,\n Output,\n signal,\n ViewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatMenu } from '@angular/material/menu';\nimport { PaymentService } from '@galaxy/billing';\nimport { FeatureFlagService } from '@galaxy/partner';\nimport { ConversationChannel, MediaInterface } from '@vendasta/conversation';\nimport {\n ChatComposerComponent,\n ChatSource,\n ChatSourceId,\n SentMessage,\n} from '@vendasta/galaxy/chat-composer/src/chat-composer.component';\nimport { PopoverPositions } from '@vendasta/galaxy/popover';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { FileInfo, FileUploadStatus, GALAXY_UPLOADER_SERVICE_TOKEN } from '@vendasta/galaxy/uploader';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport {\n BehaviorSubject,\n combineLatest,\n filter,\n first,\n firstValueFrom,\n forkJoin,\n map,\n Observable,\n of,\n ReplaySubject,\n shareReplay,\n switchMap,\n take,\n withLatestFrom,\n} from 'rxjs';\nimport { ConversationService } from '../../../../../../core/src/lib/conversation.service';\nimport { isMobile } from '../../../../../../core/src/lib/inbox-utils';\nimport { InboxService } from '../../../../../../core/src/lib/inbox.service';\nimport {\n ConversationAvailableChannels,\n ConversationDetail,\n MessageInfo,\n} from '../../../../../../core/src/lib/interface/conversation.interface';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_HOST_APP_INTERFACE_TOKEN,\n PARTNER_ID_TOKEN,\n} from '../../../../../../core/src/lib/tokens';\nimport { InboxInsertPaymentLinkComponent } from '../inbox-insert-payment-link/inbox-insert-payment-link.component';\nimport { InboxInsertReviewLinkComponent } from '../inbox-insert-review-link/inbox-insert-review-link.component';\nimport { InboxInsertTemplateComponent } from '../inbox-insert-template/inbox-insert-template.component';\nimport { InboxUploadFileComponent } from '../inbox-upload-file/inbox-upload-file.component';\nimport { InboxUploadService } from '../inbox-upload-file/inbox-upload.service';\n\nexport interface ChatSourceInfo {\n channel: ConversationChannel;\n phoneNumber?: string;\n}\n\ninterface PopoverConfig {\n title: string;\n contentFirst: string;\n contentSecond: string;\n}\n\ntype FileTypes = 'image' | 'other';\n\ninterface ComposerAction {\n id: string;\n action: string;\n icon: string;\n onClick: () => void;\n matMenu?: MatMenu | null;\n visible: Observable;\n}\n\n@Component({\n selector: 'inbox-message-text',\n templateUrl: './inbox-message-text.component.html',\n styleUrls: ['./inbox-message-text.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: GALAXY_UPLOADER_SERVICE_TOKEN, useExisting: InboxUploadService }],\n})\nexport class InboxMessageTextComponent implements OnChanges, AfterViewInit {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n private readonly snackbarService = inject(SnackbarService);\n\n @ViewChild('chatComposer') chatComposer?: ChatComposerComponent;\n @ViewChild('inboxUploadFile') inboxUploadFile?: InboxUploadFileComponent;\n @ViewChild('inboxInsertReviewLink') inboxInsertReview?: InboxInsertReviewLinkComponent;\n @ViewChild('inboxInsertPaymentLink') inboxInsertPaymentLink?: InboxInsertPaymentLinkComponent;\n\n @Input() isImpersonating = false;\n @Input() clearMessageText?: boolean;\n @Input() prefilledMessage?: string;\n @Input() missingContactInformation = false;\n\n private readonly availableChannels$$ = new ReplaySubject(1);\n readonly availableChannels$ = this.availableChannels$$.asObservable();\n\n @Input({ required: true }) set availableChannels(value: ConversationAvailableChannels | null) {\n if (value) {\n this.availableChannels$$.next(value);\n if (value.preferredChannel !== ConversationChannel.CONVERSATION_CHANNEL_UNDEFINED) {\n this.selectedChatSourceId.set(mapConversationChannelToChatSource(value.preferredChannel).id);\n }\n }\n }\n\n private readonly conversationDetail$$ = new BehaviorSubject(null);\n readonly conversationDetail$ = this.conversationDetail$$.asObservable();\n\n @Input() set conversationDetail(value: ConversationDetail | null) {\n this.conversationDetail$$.next(value);\n }\n\n @Output() sendMessage = new EventEmitter();\n @Output() fileChange = new EventEmitter();\n\n readonly files = signal([]);\n\n fileTypes = computed(() => {\n for (const file of this.files()) {\n if (file.file?.type.includes('image')) {\n return 'image';\n }\n return 'other';\n }\n return 'other';\n });\n\n disableButtonForSendMsg$$: BehaviorSubject = new BehaviorSubject(false);\n disableButtonForUploadFile$$: BehaviorSubject = new BehaviorSubject(false);\n disableButton$: Observable = combineLatest([\n this.disableButtonForSendMsg$$.asObservable(),\n this.disableButtonForUploadFile$$.asObservable(),\n ]).pipe(map(([sendMsg, uploadFile]) => sendMsg || uploadFile));\n\n isComposerDisabled = signal(false);\n\n showChannelInfoPopover = false;\n\n selectedChatSourceId = signal(undefined);\n\n private readonly currentConversationChannel$ = this.availableChannels$.pipe(\n map((availableChannels) => {\n return availableChannels?.preferredChannel;\n }),\n );\n\n readonly isOpenAIChannel$ = this.currentConversationChannel$.pipe(\n map((channel) => channel === ConversationChannel.CONVERSATION_CHANNEL_OPENAI),\n );\n\n readonly canAccessVoiceRecorder$ = this.currentConversationChannel$.pipe(\n map((channel) => {\n return channel === ConversationChannel.CONVERSATION_CHANNEL_INTERNAL;\n }),\n );\n\n readonly chatSourcesInfo$: Observable = this.availableChannels$.pipe(\n switchMap((value) => {\n const channels = value.availableChannels ?? [];\n if (channels.length === 0) {\n return of([]);\n }\n const chatSourcesInfo = channels.map((channel) => {\n return this.getChatSourceInfo(channel).pipe(first());\n });\n return forkJoin(chatSourcesInfo);\n }),\n );\n\n readonly availableChatSources$: Observable = this.chatSourcesInfo$.pipe(\n map((chatSourceInfo): ChatSource[] => {\n return chatSourceInfo.map((info) => {\n return mapConversationChannelToChatSource(info.channel, info.phoneNumber);\n });\n }),\n map((v) => v ?? new Array()),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n\n readonly popoverConfig$: Observable = this.chatSourcesInfo$.pipe(\n map((results) => {\n if (results.length !== 1) {\n return {\n title: '',\n contentFirst: '',\n contentSecond: '',\n };\n }\n const result = results[0];\n switch (result.channel) {\n case ConversationChannel.CONVERSATION_CHANNEL_SMS:\n return this.setSMSChannelPopoverInfo(result.phoneNumber);\n case ConversationChannel.CONVERSATION_CHANNEL_INTERNAL:\n return this.setInPlatformChannelPopoverInfo();\n case ConversationChannel.CONVERSATION_CHANNEL_GOOGLE_BUSINESS_COMMUNICATIONS:\n return this.setGoogleBusinessCommunicationsPopoverInfo();\n default:\n return {\n title: '',\n contentFirst: '',\n contentSecond: '',\n };\n }\n }),\n );\n\n readonly showPopover$: Observable = combineLatest([this.isOpenAIChannel$, this.popoverConfig$]).pipe(\n map(([isOpenAIChannel, popoverConfig]) => {\n return !isOpenAIChannel && !!popoverConfig.title;\n }),\n );\n\n canAccessPaymentLink$: Observable;\n\n TOOLTIP_BOTTOM_RIGHT = [{ ...PopoverPositions.TopRight }];\n showImpersonatedPopover = false;\n\n composerCollapsedActions: ComposerAction[] = [];\n\n showTemplates$ = this.inboxService.canAccessMessageTemplateSettingsCard$;\n\n constructor(\n private conversationService: ConversationService,\n private featureFlagService: FeatureFlagService,\n private paymentService: PaymentService,\n @Inject(PARTNER_ID_TOKEN) readonly partnerId$: Observable,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n private inboxService: InboxService,\n private inboxUploadService: InboxUploadService,\n public modal: MatDialog,\n private analyticsService: ProductAnalyticsService,\n ) {\n this.conversationDetail$.pipe(takeUntilDestroyed()).subscribe((conversationDetail) => {\n if (conversationDetail?.conversation?.conversationId) {\n this.inboxUploadService.conversationId$$.next(conversationDetail.conversation.conversationId);\n }\n });\n\n this.canAccessPaymentLink$ = this.partnerId$.pipe(\n switchMap((partnerId) => {\n return this.featureFlagService.batchGetStatus(partnerId, '', ['inbox_payment_link']).pipe(\n take(1),\n shareReplay(1),\n map((res) => res['inbox_payment_link']),\n );\n }),\n withLatestFrom(this.accountGroupId$),\n switchMap(([canAccess, accountGroupId]) => {\n if (canAccess && this.inboxService.isBusinessApp) {\n // check if we have setup the retail merchant's stripe account\n return this.paymentService.getRetailProvider(accountGroupId).pipe(\n take(1),\n map((retailProvider) => !!retailProvider?.stripeConnectId),\n );\n }\n return of(canAccess && this.inboxService.isPartnerCenter);\n }),\n take(1),\n );\n\n effect(() => this.setComposerDisabled(this.selectedChatSourceId()), { allowSignalWrites: true });\n }\n\n ngOnChanges(): void {\n this.setComposerDisabled(this.selectedChatSourceId());\n }\n\n async ngAfterViewInit(): Promise {\n if (this.inboxService.isBusinessApp) {\n this.composerCollapsedActions.push({\n id: 'customervoice',\n action: 'INBOX.CHAT.INSERT_REVIEW_LINK',\n icon: 'star_outline',\n matMenu: (await this.inboxInsertReview?.getInserReviewMenu()) || null,\n visible: of(true),\n });\n }\n\n const canAccessPaymentLink = await firstValueFrom(this.canAccessPaymentLink$).catch(() => false);\n\n if (canAccessPaymentLink) {\n this.composerCollapsedActions.push({\n id: 'insertpaymentlink',\n action: 'INBOX.REQUEST_PAYMENT.TITLE',\n icon: 'attach_money',\n onClick: () => this.inboxInsertPaymentLink?.openInsertLinkModal(),\n visible: of(true),\n });\n }\n\n const showTemplates = await firstValueFrom(this.showTemplates$).catch(() => false);\n\n if (showTemplates) {\n this.composerCollapsedActions.push({\n id: 'inserttemplate',\n action: 'INBOX.MESSAGE_TEMPLATES.TITLE',\n icon: 'article',\n onClick: async () => {\n const trackingProps = await this.inboxService.buildTemplateTrackProperties();\n this.analyticsService.trackEvent('inbox', 'template', 'insert-template-button-click', 0, trackingProps);\n this.openInsertTemplateModal();\n },\n visible: of(true),\n });\n }\n }\n\n setComposerDisabled(selectedChatSourceId: ChatSourceId | undefined) {\n this.isComposerDisabled.set(\n this.isImpersonating || this.missingContactInformation || selectedChatSourceId === undefined,\n );\n }\n\n private getChatSourceInfo(ch: ConversationChannel): Observable {\n const result: ChatSourceInfo = {\n channel: ch,\n };\n\n if (ch === ConversationChannel.CONVERSATION_CHANNEL_SMS) {\n // If it's multilocation Inbox, we need to get the current conversation's SMS number because conversations in multilocation have different phone numbers\n if (this.hostAppInterface.getAppOptions().is_multilocation) {\n return this.conversationService.currentConvoSMSNumber$.pipe(\n filter((resp) => !!resp),\n map((resp) => {\n result.phoneNumber = resp.phoneNumber ?? undefined;\n return result;\n }),\n );\n // If it's regular Inbox, we need to get the phone number of account group so that users still can send SMS in new message component\n } else {\n return this.conversationService.sendSMSNumber$.pipe(\n filter((phoneNumber) => phoneNumber !== null),\n map((phoneNumber) => {\n result.phoneNumber = phoneNumber ?? undefined;\n return result;\n }),\n );\n }\n }\n return of(result);\n }\n\n onSubmit(sentMessage: SentMessage): void {\n const text = sentMessage?.messageText;\n const attachments = this.getMessageMediaInfo(this.files());\n const channel = mapChatSourceIdToConversationChannel(sentMessage.sourceId!);\n\n const messageInfo: MessageInfo = {\n text: text,\n attachments: attachments,\n channel,\n };\n\n if ((text && text.trim() !== '') || messageInfo.attachments.length > 0) {\n this.sendMessage.emit(messageInfo);\n if (this.files().length > 0) {\n this.removeFile();\n }\n }\n }\n\n getMessageMediaInfo(files: FileInfo[]): MediaInterface[] {\n if (!files || files.length <= 0) {\n return [];\n }\n\n const messageMedia: MediaInterface[] = files.map((file) => {\n const { media_content_type, media_location_path, media_file_name, media_file_size } = file.resp.data;\n return {\n mediaContentType: media_content_type,\n mediaLocationPath: media_location_path,\n mediaFileName: media_file_name,\n fileSize: media_file_size,\n } as MediaInterface;\n });\n\n return messageMedia;\n }\n\n toggleChannelInfoPopover(): void {\n this.showChannelInfoPopover = !this.showChannelInfoPopover;\n }\n\n closeChannelInfoPopover(): void {\n this.showChannelInfoPopover = false;\n }\n\n showImpersonatedPopovers(): void {\n this.showImpersonatedPopover = true;\n }\n\n hideImpersonatedPopovers(): void {\n this.showImpersonatedPopover = false;\n }\n\n insertLink(reviewLink: string): void {\n this.accountGroupId$\n .pipe(\n switchMap((accountGroupId) => this.hostAppInterface.shortenLink(reviewLink, accountGroupId)),\n take(1),\n )\n .subscribe((shortenReviewLink) => {\n this.chatComposer?.insertDynamicContent(shortenReviewLink, 'curser');\n });\n this.chatComposer?.composerTextArea?.nativeElement?.focus();\n }\n\n setFile(file: FileInfo): void {\n this.files.set([file]);\n switch (file.status) {\n case FileUploadStatus.Queued:\n case FileUploadStatus.InProgress:\n this.disableButtonForUploadFile$$.next(true);\n break;\n case FileUploadStatus.Success:\n case FileUploadStatus.Fail:\n default:\n this.disableButtonForUploadFile$$.next(false);\n break;\n }\n this.fileChange.emit(this.files());\n }\n\n removeFile(): void {\n this.files.set(new Array());\n //Clear file and queue and error\n this.inboxUploadService.clear();\n this.inboxUploadService.fileErrored$$.next(null);\n this.disableButtonForUploadFile$$.next(false);\n this.fileChange.emit(this.files());\n }\n\n setInPlatformChannelPopoverInfo(): PopoverConfig {\n return {\n title: 'INBOX.INFO.PARTNER_PLATFORM_LABEL',\n contentFirst: 'INBOX.POPOVER.IN_PLATFORM_CHANNEL_MESSAGE_INFO',\n contentSecond: '',\n };\n }\n\n setGoogleBusinessCommunicationsPopoverInfo(): PopoverConfig {\n return {\n title: 'INBOX.INFO.GOOGLE_BUSINESS_COMMUNICATIONS_LABEL',\n contentFirst: 'INBOX.POPOVER.GOOGLE_BUSINESS_COMMUNICATIONS_CHANNEL_MESSAGE_INFO',\n contentSecond: '',\n };\n }\n\n setSMSChannelPopoverInfo(phoneNumber?: string): PopoverConfig {\n const popoverConfig = {\n title: '',\n contentFirst: '',\n contentSecond: '',\n };\n if (!phoneNumber) {\n popoverConfig.title = 'INBOX.POPOVER.BUSINESS_INITIATED_CONVERSATIONS';\n popoverConfig.contentFirst = 'INBOX.POPOVER.NO_PHONE_NUMBER_PROVISIONED';\n popoverConfig.contentSecond = '';\n }\n return popoverConfig;\n }\n\n clearText(): void {\n this.chatComposer?.clearMessageText();\n }\n\n async openInsertTemplateModal(): Promise {\n const modalRef$ = this.modal.open(InboxInsertTemplateComponent, {\n width: '620px',\n autoFocus: false,\n });\n\n try {\n const template = await firstValueFrom(modalRef$.afterClosed());\n if (template) {\n this.chatComposer?.insertDynamicContent(template.content, 'curser');\n this.chatComposer?.composerTextArea?.nativeElement?.focus();\n const trackingProps = await this.inboxService.buildTemplateTrackProperties();\n this.analyticsService.trackEvent('inbox', 'template', 'insert-template-success', 0, {\n trackingProps,\n templateId: template.templateId,\n });\n }\n } catch (error) {\n console.error('error inserting template', error);\n this.snackbarService.openErrorSnack('INBOX.MESSAGE_TEMPLATES.MODAL.ERROR');\n return;\n }\n }\n\n get isMobile(): boolean {\n return isMobile();\n }\n}\n\nfunction mapChatSourceIdToConversationChannel(sourceId: ChatSourceId): ConversationChannel {\n switch (sourceId) {\n case 'sms':\n return ConversationChannel.CONVERSATION_CHANNEL_SMS;\n case 'facebook':\n return ConversationChannel.CONVERSATION_CHANNEL_FACEBOOK;\n case 'google':\n return ConversationChannel.CONVERSATION_CHANNEL_GOOGLE_BUSINESS_COMMUNICATIONS;\n case 'webchat':\n return ConversationChannel.CONVERSATION_CHANNEL_WEB_CHAT;\n case 'openai':\n return ConversationChannel.CONVERSATION_CHANNEL_OPENAI;\n case 'platform':\n return ConversationChannel.CONVERSATION_CHANNEL_INTERNAL;\n case 'email':\n return ConversationChannel.CONVERSATION_CHANNEL_EMAIL;\n case 'instagram':\n return ConversationChannel.CONVERSATION_CHANNEL_INSTAGRAM;\n default:\n throw new Error(`Unknown chat source id: ${sourceId}`);\n }\n}\n\nfunction mapConversationChannelToChatSource(channel: ConversationChannel, phoneNumber?: string): ChatSource {\n switch (channel) {\n case ConversationChannel.CONVERSATION_CHANNEL_SMS:\n return { id: 'sms', sourceName: 'SMS', account: phoneNumber };\n case ConversationChannel.CONVERSATION_CHANNEL_FACEBOOK:\n return { id: 'facebook', sourceName: 'Facebook Messenger', shortSourceName: 'Facebook' };\n case ConversationChannel.CONVERSATION_CHANNEL_GOOGLE_BUSINESS_COMMUNICATIONS:\n return { id: 'google', sourceName: 'Google Business Messages', shortSourceName: 'Google' };\n case ConversationChannel.CONVERSATION_CHANNEL_WEB_CHAT:\n return { id: 'webchat', sourceName: 'Web Chat' };\n case ConversationChannel.CONVERSATION_CHANNEL_OPENAI:\n return { id: 'openai', sourceName: '' };\n case ConversationChannel.CONVERSATION_CHANNEL_INTERNAL:\n return { id: 'platform', sourceName: 'Platform Chat', shortSourceName: 'Platform' };\n case ConversationChannel.CONVERSATION_CHANNEL_EMAIL:\n return { id: 'email', sourceName: 'Email' };\n case ConversationChannel.CONVERSATION_CHANNEL_INSTAGRAM:\n return { id: 'instagram', sourceName: 'Instagram Messenger' };\n default:\n throw new Error(`Unknown conversation channel: ${channel}`);\n }\n}\n","\n\n\n\n\n\n\n\n\n \n \n \n \n add\n \n\n \n \n \n \n \n \n \n {{ popoverConfig.title | translate }}\n \n
\n

\n

{{ popoverConfig.contentSecond | translate }}

\n
\n \n \n \n \n
\n\n \n \n {{ 'INBOX.POPOVER.IMPERSONATION_TITLE' | translate }}\n {{ 'INBOX.POPOVER.IMPERSONATION_TEXT' | translate }}\n \n \n\n \n \n \n \n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, Inject } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatInputModule } from '@angular/material/input';\nimport { TranslateModule } from '@ngx-translate/core';\n\nexport interface DialogData {\n mediaUrl: string;\n mediaContentType: string;\n}\n\n@Component({\n selector: 'inbox-media-dialog-component',\n templateUrl: './media-dialog.component.html',\n standalone: true,\n imports: [\n CommonModule,\n MatDialogModule,\n MatFormFieldModule,\n MatInputModule,\n FormsModule,\n MatButtonModule,\n TranslateModule,\n ],\n})\nexport class MediaDialogComponent {\n constructor(\n public dialogRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: DialogData,\n ) {}\n}\n","\"\"\n\n \n\n\n \n\n","import { Component, HostListener, inject } from '@angular/core';\nimport { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { ReactiveFormsModule, FormsModule, FormGroup, FormControl } from '@angular/forms';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\n\nexport interface DialogData {\n helpful: boolean;\n}\n\n@Component({\n selector: 'inbox-response-evaluation-dialog-component',\n templateUrl: 'response-evaluation-dialog.component.html',\n standalone: true,\n imports: [\n CommonModule,\n GalaxyFormFieldModule,\n MatDialogModule,\n MatFormFieldModule,\n MatInputModule,\n MatIconModule,\n ReactiveFormsModule,\n FormsModule,\n MatButtonModule,\n TranslateModule,\n ],\n})\nexport class ResponseEvaluationDialogComponent {\n readonly data = inject(MAT_DIALOG_DATA);\n icon = this.data.helpful ? 'thumb_up' : 'thumb_down';\n label = this.data.helpful\n ? 'INBOX.RESPONSE_EVALUATION.HELPFUL_QUESTION'\n : 'INBOX.RESPONSE_EVALUATION.NOT_HELPFUL_QUESTION';\n\n evaluationForm = new FormGroup({\n comment: new FormControl(),\n });\n\n constructor(public dialogRef: MatDialogRef) {}\n\n submit(): void {\n this.dialogRef.close({ comment: this.evaluationForm.value.comment });\n }\n\n @HostListener('click', ['$event'])\n onClick(event: MouseEvent) {\n event.stopPropagation();\n // while the modal is open, prevent clicks from causing the thumbs to hide below the message bubble\n }\n}\n","\n
\n \n {{ label | translate }}\n \n \n
\n
\n\n \n \n\n","import { Component, inject, Input, signal, ViewChild } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatDialog } from '@angular/material/dialog';\nimport {\n Conversation,\n ConversationChannel,\n MessageType,\n ParticipantType,\n EvaluationSentiment,\n} from '@vendasta/conversation';\nimport { ChatContainerComponent, ChatMessageStatus } from '@vendasta/galaxy/chat';\nimport { defaultBackgroundColor } from '@vendasta/galaxy/avatar';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { BehaviorSubject, combineLatest, firstValueFrom, map } from 'rxjs';\nimport { DEFAULT_OPENAI_BOT_NAME } from '../../../../../../core/src/lib/inbox.constants';\nimport {\n ConversationEvent,\n ConversationMessage,\n} from '../../../../../../core/src/lib/interface/conversation.interface';\nimport { MessageGroup, MessageGroupable } from '../../../../../../core/src/lib/types';\nimport { ConversationService } from '../../../../../../core/src/lib/conversation.service';\nimport { DEFAULT_HOUR_GROUP_DURATION, DEFAULT_MESSAGE_GROUPING_DURATION } from '../../../../constants';\nimport { MediaDialogComponent } from './media-dialog.component';\nimport { DialogData, ResponseEvaluationDialogComponent } from './response-evaluation-dialog.component';\nimport { GalaxyAiIconService } from '@vendasta/galaxy/ai-icon';\n\nexport interface ResponseEvaluation {\n helpful: boolean;\n comment?: string;\n}\n\n@Component({\n selector: 'inbox-messages',\n templateUrl: './inbox-messages.component.html',\n styleUrls: ['./inbox-messages.component.scss'],\n})\nexport class InboxMessagesComponent {\n readonly defaultBackgroundColor = defaultBackgroundColor;\n readonly mediaWithErrorsMessageIDs = signal([]);\n readonly isConversationEvent = isConversationEvent;\n readonly RECEIVED = 'received';\n readonly MessageType = MessageType;\n readonly OPENAI_BOT_NAME = DEFAULT_OPENAI_BOT_NAME;\n readonly OPENAI_BOT_TYPE = ParticipantType.PARTICIPANT_TYPE_OPENAI_BOT;\n readonly OPENAI_BOT_SVG_ICON = 'galaxy-ai-icon-with-background';\n readonly OPENAI_BOT_BACKGROUND_COLOR = '#f6f6f6';\n readonly acceptedMimeType = [\n 'image/jpeg',\n 'image/jpg',\n 'image/png',\n 'image/gif',\n 'video/mp4',\n 'video/3gpp',\n 'video/WebM',\n 'video/ogg',\n 'audio/ogg',\n 'audio/acc',\n 'audio/wav',\n 'audio/mp3',\n 'audio/mp4',\n 'audio/mpeg',\n 'audio/webm',\n ];\n private readonly messages$$ = new BehaviorSubject([]);\n private readonly messages$ = this.messages$$.asObservable();\n private readonly conversationDetail$$ = new BehaviorSubject(null);\n\n protected readonly conversationId$ = this.conversationDetail$$.pipe(\n map((conversation) => conversation?.conversationId || ''),\n );\n\n @Input() set messages(value: ConversationMessage[]) {\n this.mediaWithErrorsMessageIDs.set([]);\n this.messages$$.next(value);\n }\n\n private readonly events$$ = new BehaviorSubject([]);\n @Input() set events(value: ConversationEvent[]) {\n this.events$$.next(value);\n }\n\n @Input() set conversation(value: Conversation) {\n this.conversationDetail$$.next(value);\n }\n\n @ViewChild('chatContainer') chatContainer: ChatContainerComponent | undefined;\n\n readonly groupedMessages$ = combineLatest([this.messages$, this.events$$]).pipe(\n map(([messages, events]) => groupMessages(messages, events)),\n map((messages) => messages?.slice().reverse()), // reverse messages to render in glxy-chat-container\n );\n\n readonly loadingOpenAIReply = toSignal(\n combineLatest([this.conversationDetail$$, this.messages$]).pipe(\n map(([conversation, messages]) => {\n if (conversation?.channel !== ConversationChannel.CONVERSATION_CHANNEL_OPENAI) {\n return false;\n }\n\n const latestMessage = messages?.[0];\n if (!latestMessage) {\n return false;\n }\n\n // NOTE: This is always assuming that Open AI will have a response for every message\n // However, we will always aim for a chat response from the backend if openai fails\n // We're making a tradeoff here until we have something in the backend that we can use to handle this\n if (latestMessage?.sender?.participantType === ParticipantType.PARTICIPANT_TYPE_IAM_USER) {\n return true;\n }\n return false;\n }),\n ),\n );\n private readonly conversationService = inject(ConversationService);\n readonly aiIconService = inject(GalaxyAiIconService); // used to load the ai avatar svg\n constructor(\n private readonly analytics: ProductAnalyticsService,\n private readonly dialog: MatDialog,\n ) {}\n\n openInDialog(url: string, contentType: string) {\n this.analytics.trackEvent('inbox', 'openMediaDialog', 'view');\n this.dialog.open(MediaDialogComponent, {\n data: { mediaUrl: url, mediaContentType: contentType },\n height: 'auto',\n maxWidth: '860px',\n });\n }\n\n trackById(_: number, item: MessageGroupable): string {\n return isConversationEvent(item) ? item.eventId : item?.id;\n }\n\n addMessageIdToMediaErrors(messageID: string) {\n this.mediaWithErrorsMessageIDs.update((errors) => [...errors, messageID]);\n }\n\n async openEvaluateModal(helpful: boolean, message: ConversationMessage): Promise {\n const data: DialogData = {\n helpful: helpful,\n };\n const modalRef$ = this.dialog.open(ResponseEvaluationDialogComponent, {\n data: data,\n width: '660px',\n });\n const submission = await firstValueFrom(modalRef$.afterClosed());\n if (submission) {\n const sentiment = helpful\n ? EvaluationSentiment.EVALUATION_SENTIMENT_POSITIVE\n : EvaluationSentiment.EVALUATION_SENTIMENT_NEGATIVE;\n await this.conversationService.evaluateResponse(message.messageId, submission?.comment, sentiment);\n }\n }\n\n mapMessageStatus(message: ConversationMessage): ChatMessageStatus {\n return this.conversationService.mapStatusForMessage(message);\n }\n}\n\nexport function groupMessages(messages?: ConversationMessage[], events?: ConversationEvent[]): MessageGroupable[] {\n const allItems = [...(messages || []), ...(events || [])].filter(Boolean).sort((a, b) => {\n const aDate = isConversationEvent(a) ? a.happenedAt.toDate().getTime() : a.created.getTime();\n const bDate = isConversationEvent(b) ? b.happenedAt.toDate().getTime() : b.created.getTime();\n return aDate - bDate;\n });\n\n return allItems.reduce((list, item) => {\n // don't group events and system messages\n if (isConversationEvent(item) || isSystemMessage(item)) {\n return [...list, item];\n }\n\n // if possible, add the message to the previous message group\n const previousGroup = list[list.length - 1];\n if (canAddMessageToPreviousGroup(item, previousGroup)) {\n previousGroup.addMessage(item);\n return list;\n }\n\n // othwerwise, create a new message group and add the item to it\n const newGroup = createNewGroupWithMessage(item, previousGroup?.lastMessage);\n return [...list, newGroup];\n }, []);\n}\n\nfunction isConversationEvent(item: MessageGroupable): item is ConversationEvent {\n return 'happenedAt' in item;\n}\n\nfunction isSystemMessage(item: ConversationMessage | ConversationEvent): boolean {\n return 'type' in item && item.type === MessageType.MESSAGE_TYPE_SYSTEM;\n}\n\nfunction canAddMessageToPreviousGroup(message: ConversationMessage, previousGroup: MessageGroupable): boolean {\n if (previousGroup instanceof MessageGroup) {\n const lastMessage = previousGroup.lastMessage;\n const isSameSender = message.sender?.participantId === lastMessage?.sender?.participantId;\n const isSameType = message.type === lastMessage?.type;\n const isSameChannel = message.channel === lastMessage?.channel;\n const timeElapsed = message.created?.getTime() - lastMessage?.created?.getTime();\n const isWithinDuration = timeElapsed < DEFAULT_MESSAGE_GROUPING_DURATION;\n return isSameSender && isSameType && isSameChannel && isWithinDuration;\n }\n return false;\n}\n\nfunction createNewGroupWithMessage(\n message: ConversationMessage,\n previousMessage: ConversationMessage | undefined,\n): MessageGroup {\n // if enough time has passed since the previous message, set the createdAt\n // date of the new message group so a date divider will be shown in the\n // conversation stream\n const previousDate = previousMessage?.created;\n const messageDate = message.created;\n const enoughTimeElapsed = messageDate.getTime() - previousDate?.getTime() > DEFAULT_HOUR_GROUP_DURATION;\n const addTimeDivider = !previousDate || enoughTimeElapsed;\n const createdAt = addTimeDivider ? messageDate : null;\n\n const { id, sender, channel, type } = message;\n const newGroup = new MessageGroup(id, sender, type, channel, createdAt);\n newGroup.addMessage(message);\n return newGroup;\n}\n","\n \n \n\n \n \n \n \n\n \n \n \n\n \n {{ item.labelKey | translate }}\n \n \n\n\n\n \n \n \n \n \n thumb_up\n \n \n thumb_down\n \n \n \n \n \n \n\n \n {{ messageGroup.createdAt | messageTime }}\n \n\n\n\n \n
\n
\n
\n\n\n \n \n \n \n
\n \n \n \n \n \n
\n
\n
\n \n \n broken_image\n \n

{{ 'INBOX.ERROR.BROKEN_MEDIA_URL' | translate }}

\n \n \n\n \n \n insert_drive_file\n {{ media.mediaFileName }}\n \n \n
\n
\n","import { ChangeDetectionStrategy, Component, OnInit, ViewChild, computed, inject, signal } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n ConversationChannel,\n MessageType,\n Participant,\n ParticipantType,\n PlatformLocation,\n} from '@vendasta/conversation';\nimport { filterNullAndUndefined } from '@vendasta/rx-utils';\nimport { Observable, combineLatest, firstValueFrom, map } from 'rxjs';\nimport { toFirestoreId } from '../../../../core/src/lib/conversation-utils';\nimport { ConversationService } from '../../../../core/src/lib/conversation.service';\nimport { InboxService } from '../../../../core/src/lib/inbox.service';\nimport { ConversationAvailableChannels, MessageInfo } from '../../../../core/src/lib/interface/conversation.interface';\nimport { PARTNER_ID_TOKEN, USER_ID_TOKEN } from '../../../../core/src/lib/tokens';\nimport { InboxMessageTextComponent } from '../inbox-chat/components/inbox-message-text/inbox-message-text.component';\n\n@Component({\n selector: 'inbox-ai-chat',\n templateUrl: './inbox-ai-chat.component.html',\n styleUrls: ['./inbox-ai-chat.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class InboxAiChatComponent implements OnInit {\n messages$ = this.conversationService.messages$;\n readonly loadingMessages = toSignal(this.conversationService.loadingMessages$);\n readonly currentConversationDetail$ = this.conversationService.currentConversationDetail$;\n readonly loadingConversation = signal(true);\n readonly loading = computed(() => this.loadingConversation() || this.loadingMessages());\n\n @ViewChild('inboxTextComponent') inboxTextComponent?: InboxMessageTextComponent;\n\n readonly isImpersonating$: Observable = this.conversationService.isUserImpersonated$;\n\n AIParticipantRecipient = {\n participantType: ParticipantType.PARTICIPANT_TYPE_OPENAI_BOT,\n partnerId: '',\n } as Participant;\n\n private readonly userId$ = inject(USER_ID_TOKEN);\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n\n senderParticipant$: Observable = combineLatest([this.userId$, this.partnerId$]).pipe(\n map(([user, partnerID]) => {\n return {\n internalParticipantId: user,\n partnerId: partnerID,\n participantType: ParticipantType.PARTICIPANT_TYPE_IAM_USER,\n isSubjectParticipant: true,\n } as Participant;\n }),\n );\n\n availableChannels: ConversationAvailableChannels = {\n availableChannels: [ConversationChannel.CONVERSATION_CHANNEL_OPENAI],\n preferredChannel: ConversationChannel.CONVERSATION_CHANNEL_OPENAI,\n };\n\n constructor(\n private readonly conversationService: ConversationService,\n private readonly inboxService: InboxService,\n ) {}\n\n ngOnInit(): void {\n this.startConversation();\n }\n\n async startConversation(): Promise {\n const participants = [await firstValueFrom(this.senderParticipant$), this.AIParticipantRecipient];\n\n try {\n const resp = await firstValueFrom(\n this.conversationService.createConversation(\n participants ?? [],\n ConversationChannel.CONVERSATION_CHANNEL_OPENAI,\n PlatformLocation.PLATFORM_LOCATION_PARTNER_CENTER,\n ),\n );\n\n this.conversationService.setCurrentFirestoreConversationId(\n toFirestoreId(resp?.conversation?.conversationId ?? ''),\n );\n } catch (error) {\n console.warn('Error to get or create the AI conversation: ', error);\n } finally {\n this.loadingConversation.set(false);\n }\n }\n\n async sendMessage(messageInfo: MessageInfo): Promise {\n const currentConversationDetail = await firstValueFrom(\n this.currentConversationDetail$.pipe(filterNullAndUndefined()),\n );\n if (currentConversationDetail.conversation.channel !== ConversationChannel.CONVERSATION_CHANNEL_OPENAI) {\n // Just in case the first non-null conversation we load isn't an AI conversation\n // we don't want messages intended for AI appearing in other conversations\n return;\n }\n await this.conversationService.sendMessage(\n currentConversationDetail.conversation.conversationId,\n MessageType.MESSAGE_TYPE_MESSAGE,\n messageInfo.text,\n messageInfo.channel,\n this.inboxService.platformLocation,\n messageInfo.attachments,\n );\n this.inboxTextComponent?.clearText?.();\n }\n}\n","
\n \n \n \n
\n","import { CommonModule } from '@angular/common';\nimport { Component, Input } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyPipesModule } from '@vendasta/galaxy/pipes';\nimport { ConversationPipesModule } from '../../../../../../../pipes';\nimport { TicketInfo } from '../inbox-ticket/inbox-ticket.component';\n\n@Component({\n selector: 'inbox-ticket-card',\n standalone: true,\n imports: [\n CommonModule,\n GalaxyPipesModule,\n MatCardModule,\n MatIconModule,\n TranslateModule,\n ConversationPipesModule,\n GalaxyBadgeModule,\n MatButtonModule,\n ],\n templateUrl: './inbox-ticket-card.component.html',\n styleUrls: ['./inbox-ticket-card.component.scss'],\n})\nexport class InboxTicketCardComponent {\n protected ticketInfo: TicketInfo;\n protected isMinView = true;\n @Input() set ticketCardInfo(ticket: TicketInfo) {\n this.ticketInfo = ticket;\n }\n showMoreLess() {\n this.isMinView = !this.isMinView;\n }\n}\n","\n \n
\n
\n
{{ ticketInfo.subject }}
\n
\n {{ ticketInfo.status }}\n
\n
\n {{ ticketInfo.createdAt }}\n {{ ticketInfo.groupName }}\n {{ ticketInfo.channel }}\n
\n {{ ticketInfo.description | trimDescription : 80 }}\n {{ ticketInfo.description }} \n 80 && isMinView\" (click)=\"showMoreLess()\">\n {{ 'INBOX.TICKETS.VIEW_MORE' | translate }}\n \n 80 && !isMinView\" (click)=\"showMoreLess()\">\n {{ 'INBOX.TICKETS.VIEW_LESS' | translate }}\n \n
\n \n
\n {{ ticketInfo.requester }}\n
\n \n
\n
\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nimport { map } from 'rxjs/operators';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar SortBy = /*#__PURE__*/function (SortBy) {\n SortBy[SortBy[\"SORT_BY_NOT_SPECIFIED\"] = 0] = \"SORT_BY_NOT_SPECIFIED\";\n SortBy[SortBy[\"SORT_BY_UPDATED_AT\"] = 1] = \"SORT_BY_UPDATED_AT\";\n SortBy[SortBy[\"SORT_BY_CREATED_AT\"] = 2] = \"SORT_BY_CREATED_AT\";\n SortBy[SortBy[\"SORT_BY_PRIORITY\"] = 3] = \"SORT_BY_PRIORITY\";\n SortBy[SortBy[\"SORT_BY_STATUS\"] = 4] = \"SORT_BY_STATUS\";\n SortBy[SortBy[\"SORT_BY_TICKET_TYPE\"] = 5] = \"SORT_BY_TICKET_TYPE\";\n return SortBy;\n}(SortBy || {});\nvar SortOrder = /*#__PURE__*/function (SortOrder) {\n SortOrder[SortOrder[\"SORT_ORDER_NOT_SPECIFIED\"] = 0] = \"SORT_ORDER_NOT_SPECIFIED\";\n SortOrder[SortOrder[\"SORT_ORDER_ASC\"] = 1] = \"SORT_ORDER_ASC\";\n SortOrder[SortOrder[\"SORT_ORDER_DESC\"] = 2] = \"SORT_ORDER_DESC\";\n return SortOrder;\n}(SortOrder || {});\nvar Status = /*#__PURE__*/function (Status) {\n Status[Status[\"STATUS_NOT_SPECIFIED\"] = 0] = \"STATUS_NOT_SPECIFIED\";\n Status[Status[\"STATUS_NEW\"] = 1] = \"STATUS_NEW\";\n Status[Status[\"STATUS_OPEN\"] = 2] = \"STATUS_OPEN\";\n Status[Status[\"STATUS_PENDING\"] = 3] = \"STATUS_PENDING\";\n Status[Status[\"STATUS_HOLD\"] = 4] = \"STATUS_HOLD\";\n Status[Status[\"STATUS_SOLVED\"] = 5] = \"STATUS_SOLVED\";\n Status[Status[\"STATUS_CLOSED\"] = 6] = \"STATUS_CLOSED\";\n return Status;\n}(Status || {});\n// *********************************\n\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Article {\n static fromProto(proto) {\n let m = new Article();\n m = Object.assign(m, proto);\n if (proto.id) {\n m.id = parseInt(proto.id, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.body !== 'undefined') {\n toReturn['body'] = this.body;\n }\n if (typeof this.title !== 'undefined') {\n toReturn['title'] = this.title;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n return toReturn;\n }\n}\nclass Attachment {\n static fromProto(proto) {\n let m = new Attachment();\n m = Object.assign(m, proto);\n if (proto.id) {\n m.id = parseInt(proto.id, 10);\n }\n if (proto.size) {\n m.size = parseInt(proto.size, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.fileName !== 'undefined') {\n toReturn['fileName'] = this.fileName;\n }\n if (typeof this.contentUrl !== 'undefined') {\n toReturn['contentUrl'] = this.contentUrl;\n }\n if (typeof this.contentType !== 'undefined') {\n toReturn['contentType'] = this.contentType;\n }\n if (typeof this.size !== 'undefined') {\n toReturn['size'] = this.size;\n }\n if (typeof this.inline !== 'undefined') {\n toReturn['inline'] = this.inline;\n }\n return toReturn;\n }\n}\nclass Group {\n static fromProto(proto) {\n let m = new Group();\n m = Object.assign(m, proto);\n if (proto.id) {\n m.id = parseInt(proto.id, 10);\n }\n if (proto.createdAt) {\n m.createdAt = new Date(proto.createdAt);\n }\n if (proto.updatedAt) {\n m.updatedAt = new Date(proto.updatedAt);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.deleted !== 'undefined') {\n toReturn['deleted'] = this.deleted;\n }\n if (typeof this.createdAt !== 'undefined' && this.createdAt !== null) {\n toReturn['createdAt'] = 'toApiJson' in this.createdAt ? this.createdAt.toApiJson() : this.createdAt;\n }\n if (typeof this.updatedAt !== 'undefined' && this.updatedAt !== null) {\n toReturn['updatedAt'] = 'toApiJson' in this.updatedAt ? this.updatedAt.toApiJson() : this.updatedAt;\n }\n return toReturn;\n }\n}\nclass Ticket {\n static fromProto(proto) {\n let m = new Ticket();\n m = Object.assign(m, proto);\n if (proto.id) {\n m.id = parseInt(proto.id, 10);\n }\n if (proto.organizationId) {\n m.organizationId = parseInt(proto.organizationId, 10);\n }\n if (proto.requester) {\n m.requester = User.fromProto(proto.requester);\n }\n if (proto.collaborators) {\n m.collaborators = proto.collaborators.map(User.fromProto);\n }\n if (proto.dueAt) {\n m.dueAt = new Date(proto.dueAt);\n }\n if (proto.createdAt) {\n m.createdAt = new Date(proto.createdAt);\n }\n if (proto.updatedAt) {\n m.updatedAt = new Date(proto.updatedAt);\n }\n if (proto.followupSourceId) {\n m.followupSourceId = parseInt(proto.followupSourceId, 10);\n }\n if (proto.assignee) {\n m.assignee = User.fromProto(proto.assignee);\n }\n if (proto.group) {\n m.group = Group.fromProto(proto.group);\n }\n if (proto.via) {\n m.via = Via.fromProto(proto.via);\n }\n if (proto.comment) {\n m.comment = TicketComment.fromProto(proto.comment);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.status !== 'undefined') {\n toReturn['status'] = this.status;\n }\n if (typeof this.priority !== 'undefined') {\n toReturn['priority'] = this.priority;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.subject !== 'undefined') {\n toReturn['subject'] = this.subject;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n if (typeof this.organizationId !== 'undefined') {\n toReturn['organizationId'] = this.organizationId;\n }\n if (typeof this.requester !== 'undefined' && this.requester !== null) {\n toReturn['requester'] = 'toApiJson' in this.requester ? this.requester.toApiJson() : this.requester;\n }\n if (typeof this.collaborators !== 'undefined' && this.collaborators !== null) {\n toReturn['collaborators'] = 'toApiJson' in this.collaborators ? this.collaborators.toApiJson() : this.collaborators;\n }\n if (typeof this.dueAt !== 'undefined' && this.dueAt !== null) {\n toReturn['dueAt'] = 'toApiJson' in this.dueAt ? this.dueAt.toApiJson() : this.dueAt;\n }\n if (typeof this.createdAt !== 'undefined' && this.createdAt !== null) {\n toReturn['createdAt'] = 'toApiJson' in this.createdAt ? this.createdAt.toApiJson() : this.createdAt;\n }\n if (typeof this.updatedAt !== 'undefined' && this.updatedAt !== null) {\n toReturn['updatedAt'] = 'toApiJson' in this.updatedAt ? this.updatedAt.toApiJson() : this.updatedAt;\n }\n if (typeof this.recipient !== 'undefined') {\n toReturn['recipient'] = this.recipient;\n }\n if (typeof this.followupSourceId !== 'undefined') {\n toReturn['followupSourceId'] = this.followupSourceId;\n }\n if (typeof this.assignee !== 'undefined' && this.assignee !== null) {\n toReturn['assignee'] = 'toApiJson' in this.assignee ? this.assignee.toApiJson() : this.assignee;\n }\n if (typeof this.group !== 'undefined' && this.group !== null) {\n toReturn['group'] = 'toApiJson' in this.group ? this.group.toApiJson() : this.group;\n }\n if (typeof this.via !== 'undefined' && this.via !== null) {\n toReturn['via'] = 'toApiJson' in this.via ? this.via.toApiJson() : this.via;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.comment !== 'undefined' && this.comment !== null) {\n toReturn['comment'] = 'toApiJson' in this.comment ? this.comment.toApiJson() : this.comment;\n }\n return toReturn;\n }\n}\nclass TicketComment {\n static fromProto(proto) {\n let m = new TicketComment();\n m = Object.assign(m, proto);\n if (proto.id) {\n m.id = parseInt(proto.id, 10);\n }\n if (proto.authorId) {\n m.authorId = parseInt(proto.authorId, 10);\n }\n if (proto.attachments) {\n m.attachments = proto.attachments.map(Attachment.fromProto);\n }\n if (proto.createdAt) {\n m.createdAt = new Date(proto.createdAt);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.body !== 'undefined') {\n toReturn['body'] = this.body;\n }\n if (typeof this.htmlBody !== 'undefined') {\n toReturn['htmlBody'] = this.htmlBody;\n }\n if (typeof this.public !== 'undefined') {\n toReturn['public'] = this.public;\n }\n if (typeof this.authorId !== 'undefined') {\n toReturn['authorId'] = this.authorId;\n }\n if (typeof this.attachments !== 'undefined' && this.attachments !== null) {\n toReturn['attachments'] = 'toApiJson' in this.attachments ? this.attachments.toApiJson() : this.attachments;\n }\n if (typeof this.createdAt !== 'undefined' && this.createdAt !== null) {\n toReturn['createdAt'] = 'toApiJson' in this.createdAt ? this.createdAt.toApiJson() : this.createdAt;\n }\n return toReturn;\n }\n}\nclass User {\n static fromProto(proto) {\n let m = new User();\n m = Object.assign(m, proto);\n if (proto.id) {\n m.id = parseInt(proto.id, 10);\n }\n if (proto.createdAt) {\n m.createdAt = new Date(proto.createdAt);\n }\n if (proto.updatedAt) {\n m.updatedAt = new Date(proto.updatedAt);\n }\n if (proto.localeId) {\n m.localeId = parseInt(proto.localeId, 10);\n }\n if (proto.lastLoginAt) {\n m.lastLoginAt = new Date(proto.lastLoginAt);\n }\n if (proto.organizationId) {\n m.organizationId = parseInt(proto.organizationId, 10);\n }\n if (proto.customRoleId) {\n m.customRoleId = parseInt(proto.customRoleId, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.externalId !== 'undefined') {\n toReturn['externalId'] = this.externalId;\n }\n if (typeof this.alias !== 'undefined') {\n toReturn['alias'] = this.alias;\n }\n if (typeof this.createdAt !== 'undefined' && this.createdAt !== null) {\n toReturn['createdAt'] = 'toApiJson' in this.createdAt ? this.createdAt.toApiJson() : this.createdAt;\n }\n if (typeof this.updatedAt !== 'undefined' && this.updatedAt !== null) {\n toReturn['updatedAt'] = 'toApiJson' in this.updatedAt ? this.updatedAt.toApiJson() : this.updatedAt;\n }\n if (typeof this.active !== 'undefined') {\n toReturn['active'] = this.active;\n }\n if (typeof this.verified !== 'undefined') {\n toReturn['verified'] = this.verified;\n }\n if (typeof this.shared !== 'undefined') {\n toReturn['shared'] = this.shared;\n }\n if (typeof this.sharedAgent !== 'undefined') {\n toReturn['sharedAgent'] = this.sharedAgent;\n }\n if (typeof this.locale !== 'undefined') {\n toReturn['locale'] = this.locale;\n }\n if (typeof this.localeId !== 'undefined') {\n toReturn['localeId'] = this.localeId;\n }\n if (typeof this.timeZone !== 'undefined') {\n toReturn['timeZone'] = this.timeZone;\n }\n if (typeof this.lastLoginAt !== 'undefined' && this.lastLoginAt !== null) {\n toReturn['lastLoginAt'] = 'toApiJson' in this.lastLoginAt ? this.lastLoginAt.toApiJson() : this.lastLoginAt;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n if (typeof this.signature !== 'undefined') {\n toReturn['signature'] = this.signature;\n }\n if (typeof this.details !== 'undefined') {\n toReturn['details'] = this.details;\n }\n if (typeof this.notes !== 'undefined') {\n toReturn['notes'] = this.notes;\n }\n if (typeof this.organizationId !== 'undefined') {\n toReturn['organizationId'] = this.organizationId;\n }\n if (typeof this.role !== 'undefined') {\n toReturn['role'] = this.role;\n }\n if (typeof this.customRoleId !== 'undefined') {\n toReturn['customRoleId'] = this.customRoleId;\n }\n if (typeof this.moderator !== 'undefined') {\n toReturn['moderator'] = this.moderator;\n }\n if (typeof this.ticketRestriction !== 'undefined') {\n toReturn['ticketRestriction'] = this.ticketRestriction;\n }\n if (typeof this.onlyPrivateComments !== 'undefined') {\n toReturn['onlyPrivateComments'] = this.onlyPrivateComments;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.restrictedAgent !== 'undefined') {\n toReturn['restrictedAgent'] = this.restrictedAgent;\n }\n if (typeof this.suspended !== 'undefined') {\n toReturn['suspended'] = this.suspended;\n }\n return toReturn;\n }\n}\nclass Via {\n static fromProto(proto) {\n let m = new Via();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.channel !== 'undefined') {\n toReturn['channel'] = this.channel;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CreateTicketRequest {\n static fromProto(proto) {\n let m = new CreateTicketRequest();\n m = Object.assign(m, proto);\n if (proto.ticket) {\n m.ticket = Ticket.fromProto(proto.ticket);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.ticket !== 'undefined' && this.ticket !== null) {\n toReturn['ticket'] = 'toApiJson' in this.ticket ? this.ticket.toApiJson() : this.ticket;\n }\n return toReturn;\n }\n}\nclass CreateTicketResponse {\n static fromProto(proto) {\n let m = new CreateTicketResponse();\n m = Object.assign(m, proto);\n if (proto.ticket) {\n m.ticket = Ticket.fromProto(proto.ticket);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.ticket !== 'undefined' && this.ticket !== null) {\n toReturn['ticket'] = 'toApiJson' in this.ticket ? this.ticket.toApiJson() : this.ticket;\n }\n return toReturn;\n }\n}\nclass GetArticleRequest {\n static fromProto(proto) {\n let m = new GetArticleRequest();\n m = Object.assign(m, proto);\n if (proto.id) {\n m.id = parseInt(proto.id, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n return toReturn;\n }\n}\nclass GetArticleResponse {\n static fromProto(proto) {\n let m = new GetArticleResponse();\n m = Object.assign(m, proto);\n if (proto.article) {\n m.article = Article.fromProto(proto.article);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.article !== 'undefined' && this.article !== null) {\n toReturn['article'] = 'toApiJson' in this.article ? this.article.toApiJson() : this.article;\n }\n return toReturn;\n }\n}\nclass GetUserByPhoneRequest {\n static fromProto(proto) {\n let m = new GetUserByPhoneRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.number !== 'undefined') {\n toReturn['number'] = this.number;\n }\n return toReturn;\n }\n}\nclass GetUserByPhoneResponse {\n static fromProto(proto) {\n let m = new GetUserByPhoneResponse();\n m = Object.assign(m, proto);\n if (proto.user) {\n m.user = User.fromProto(proto.user);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.user !== 'undefined' && this.user !== null) {\n toReturn['user'] = 'toApiJson' in this.user ? this.user.toApiJson() : this.user;\n }\n if (typeof this.pid !== 'undefined') {\n toReturn['pid'] = this.pid;\n }\n return toReturn;\n }\n}\nclass ListCommentsRequest {\n static fromProto(proto) {\n let m = new ListCommentsRequest();\n m = Object.assign(m, proto);\n if (proto.ticketId) {\n m.ticketId = parseInt(proto.ticketId, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.ticketId !== 'undefined') {\n toReturn['ticketId'] = this.ticketId;\n }\n return toReturn;\n }\n}\nclass ListCommentsResponse {\n static fromProto(proto) {\n let m = new ListCommentsResponse();\n m = Object.assign(m, proto);\n if (proto.comments) {\n m.comments = proto.comments.map(TicketComment.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.comments !== 'undefined' && this.comments !== null) {\n toReturn['comments'] = 'toApiJson' in this.comments ? this.comments.toApiJson() : this.comments;\n }\n return toReturn;\n }\n}\nclass ListTicketsRequest {\n static fromProto(proto) {\n let m = new ListTicketsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n return toReturn;\n }\n}\nclass ListTicketsResponse {\n static fromProto(proto) {\n let m = new ListTicketsResponse();\n m = Object.assign(m, proto);\n if (proto.tickets) {\n m.tickets = proto.tickets.map(Ticket.fromProto);\n }\n if (proto.users) {\n m.users = proto.users.map(User.fromProto);\n }\n if (proto.count) {\n m.count = parseInt(proto.count, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.tickets !== 'undefined' && this.tickets !== null) {\n toReturn['tickets'] = 'toApiJson' in this.tickets ? this.tickets.toApiJson() : this.tickets;\n }\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.count !== 'undefined') {\n toReturn['count'] = this.count;\n }\n return toReturn;\n }\n}\nclass SearchTicketsRequest {\n static fromProto(proto) {\n let m = new SearchTicketsRequest();\n m = Object.assign(m, proto);\n if (proto.status) {\n m.status = enumStringToValue(Status, proto.status);\n }\n if (proto.sortBy) {\n m.sortBy = enumStringToValue(SortBy, proto.sortBy);\n }\n if (proto.sortOrder) {\n m.sortOrder = enumStringToValue(SortOrder, proto.sortOrder);\n }\n if (proto.statuses) {\n m.statuses = proto.statuses.map(v => enumStringToValue(Status, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.searchTerm !== 'undefined') {\n toReturn['searchTerm'] = this.searchTerm;\n }\n if (typeof this.status !== 'undefined') {\n toReturn['status'] = this.status;\n }\n if (typeof this.sortBy !== 'undefined') {\n toReturn['sortBy'] = this.sortBy;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.sortOrder !== 'undefined') {\n toReturn['sortOrder'] = this.sortOrder;\n }\n if (typeof this.statuses !== 'undefined') {\n toReturn['statuses'] = this.statuses;\n }\n return toReturn;\n }\n}\nclass SearchTicketsResponse {\n static fromProto(proto) {\n let m = new SearchTicketsResponse();\n m = Object.assign(m, proto);\n if (proto.tickets) {\n m.tickets = proto.tickets.map(Ticket.fromProto);\n }\n if (proto.users) {\n m.users = proto.users.map(User.fromProto);\n }\n if (proto.count) {\n m.count = parseInt(proto.count, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.tickets !== 'undefined' && this.tickets !== null) {\n toReturn['tickets'] = 'toApiJson' in this.tickets ? this.tickets.toApiJson() : this.tickets;\n }\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.count !== 'undefined') {\n toReturn['count'] = this.count;\n }\n return toReturn;\n }\n}\n\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'support-api.vendasta-local.com',\n 'test': '',\n 'demo': 'support-api-demo.apigateway.co',\n 'prod': 'support-api-prod.apigateway.co',\n 'production': 'support-api-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\nlet SupportApiService = /*#__PURE__*/(() => {\n class SupportApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createTicket(r) {\n const request = r.toApiJson ? r : new CreateTicketRequest(r);\n return this.http.post(this._host + \"/support.v1.Support/CreateTicket\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateTicketResponse.fromProto(resp)));\n }\n getUserByPhone(r) {\n const request = r.toApiJson ? r : new GetUserByPhoneRequest(r);\n return this.http.post(this._host + \"/support.v1.Support/GetUserByPhone\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetUserByPhoneResponse.fromProto(resp)));\n }\n listTickets(r) {\n const request = r.toApiJson ? r : new ListTicketsRequest(r);\n return this.http.post(this._host + \"/support.v1.Support/ListTickets\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListTicketsResponse.fromProto(resp)));\n }\n listComments(r) {\n const request = r.toApiJson ? r : new ListCommentsRequest(r);\n return this.http.post(this._host + \"/support.v1.Support/ListComments\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListCommentsResponse.fromProto(resp)));\n }\n searchTickets(r) {\n const request = r.toApiJson ? r : new SearchTicketsRequest(r);\n return this.http.post(this._host + \"/support.v1.Support/SearchTickets\", request.toApiJson(), this.apiOptions()).pipe(map(resp => SearchTicketsResponse.fromProto(resp)));\n }\n getArticle(r) {\n const request = r.toApiJson ? r : new GetArticleRequest(r);\n return this.http.post(this._host + \"/support.v1.Support/GetArticle\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetArticleResponse.fromProto(resp)));\n }\n }\n SupportApiService.ɵfac = function SupportApiService_Factory(t) {\n return new (t || SupportApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n SupportApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: SupportApiService,\n factory: SupportApiService.ɵfac,\n providedIn: 'root'\n });\n return SupportApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Article, Attachment, CreateTicketRequest, CreateTicketResponse, GetArticleRequest, GetArticleResponse, GetUserByPhoneRequest, GetUserByPhoneResponse, Group, ListCommentsRequest, ListCommentsResponse, ListTicketsRequest, ListTicketsResponse, SearchTicketsRequest, SearchTicketsResponse, SortBy, SortOrder, Status, SupportApiService, Ticket, TicketComment, User, Via };\n","import { Ticket } from '@vendasta/support';\n\nconst VMF_INSTANCE = 'https://vendasta-support.zendesk.com/agent/tickets/';\nconst URL_REGEX = /(?:https?|ftp):\\/\\/[\\n\\S]+/g;\nconst badgeColor: Record = {\n new: 'blue',\n open: 'grey',\n hold: 'yellow',\n pending: 'yellow',\n solved: 'green',\n closed: 'green',\n};\n\nexport class TicketInfo {\n id: string;\n subject: string;\n description: string;\n status: string;\n requester: string;\n createdAt: string;\n channel: string;\n groupName: string;\n badgeColor: string;\n url: string;\n total: number;\n\n constructor(ticket: Ticket) {\n this.id = ticket.id.toString();\n this.subject = ticket.subject;\n this.description = this.formatDescription(ticket.description);\n this.status = ticket.status;\n this.requester = ticket.requester.name;\n this.createdAt = ticket.createdAt.toString().substring(0, 15);\n this.channel = ticket.via.channel;\n this.groupName = ticket.group.name;\n this.badgeColor = badgeColor[ticket.status] ? badgeColor[ticket.status] : 'grey';\n this.url = VMF_INSTANCE.concat(ticket.id.toString());\n }\n\n private formatDescription(text: string) {\n text = text.replace(URL_REGEX, '');\n return text.substring(0, 1200);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, Input, OnInit } from '@angular/core';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { GalaxyPipesModule } from '@vendasta/galaxy/pipes';\nimport { SortBy, SortOrder, SupportApiService, Status as SupportStatus } from '@vendasta/support';\nimport {\n BehaviorSubject,\n Observable,\n ReplaySubject,\n combineLatest,\n map,\n skipWhile,\n startWith,\n switchMap,\n tap,\n} from 'rxjs';\nimport { ConversationPipesModule } from '../../../../../../../pipes';\nimport { InboxTicketCardComponent } from '../inbox-ticket-card/inbox-ticket-card.component';\nimport { TicketInfo } from './ticket-info';\n\ntype Status = 'open' | 'closed';\n\nenum statusEnum {\n OPEN = 'open',\n CLOSED = 'closed',\n}\n\nconst CLOSED_STATUS = [SupportStatus.STATUS_CLOSED, SupportStatus.STATUS_SOLVED];\nconst OPEN_STATUS = [\n SupportStatus.STATUS_HOLD,\n SupportStatus.STATUS_NEW,\n SupportStatus.STATUS_OPEN,\n SupportStatus.STATUS_PENDING,\n];\nconst PAGE = 5;\n\ninterface TicketList {\n tickets: TicketInfo[];\n total: number;\n continue: boolean;\n}\n@Component({\n selector: 'inbox-ticket-list',\n templateUrl: './inbox-ticket-list.component.html',\n styleUrls: ['./inbox-ticket-list.component.scss'],\n standalone: true,\n imports: [\n CommonModule,\n GalaxyPipesModule,\n MatIconModule,\n TranslateModule,\n ConversationPipesModule,\n InboxTicketCardComponent,\n GalaxyFormFieldModule,\n MatCardModule,\n GalaxyLoadingSpinnerModule,\n GalaxyAlertModule,\n ],\n})\nexport class InboxTicketListComponent implements OnInit {\n @Input() set partner(partnerId: string) {\n this.partnerId$$.next(partnerId);\n }\n @Input() title: string;\n @Input() status: Status;\n\n private partnerId$$ = new ReplaySubject(1);\n statusName: string;\n\n private readonly isLoading$$ = new BehaviorSubject(true);\n protected readonly isLoading$ = this.isLoading$$.asObservable();\n\n private showMore$$ = new BehaviorSubject(PAGE);\n private nextPage$ = this.showMore$$.asObservable();\n\n readonly tickets$ = this.partnerId$$.pipe(\n skipWhile((partner) => !partner),\n tap(() => this.isLoading$$.next(true)),\n tap(() => this.showMore$$.next(PAGE)),\n switchMap((partnerId) =>\n this.supportService.searchTickets({\n partnerId: partnerId,\n searchTerm: '',\n sortBy: this.status === statusEnum.OPEN ? SortBy.SORT_BY_CREATED_AT : SortBy.SORT_BY_UPDATED_AT,\n sortOrder: SortOrder.SORT_ORDER_DESC,\n statuses: this.status === statusEnum.OPEN ? OPEN_STATUS : CLOSED_STATUS,\n }),\n ),\n map((res) => {\n return {\n tickets: res?.tickets?.map((ticket) => new TicketInfo(ticket)) || [],\n total: res?.count || 0,\n } as TicketList;\n }),\n startWith({ tickets: [], total: 0, continue: false } as TicketList),\n tap(() => this.isLoading$$.next(false)),\n );\n\n pagedTickets$: Observable = combineLatest([this.tickets$, this.nextPage$]).pipe(\n map(([tickets, page]) => {\n return {\n tickets: tickets.tickets.slice(0, page),\n total: tickets.total,\n continue: page < tickets.total,\n } as TicketList;\n }),\n );\n\n constructor(private readonly supportService: SupportApiService) {}\n\n ngOnInit() {\n this.statusName = statusEnum.OPEN === this.status ? statusEnum.OPEN : statusEnum.CLOSED;\n }\n\n loadClosed(): void {\n this.showMore$$.next(this.showMore$$.value + 5);\n }\n}\n","\n \n \n \n \n \n \n \n \n \n {{ title }} ({{ ticketList.value.total }})\n \n \n \n 0\">\n
\n \n
\n
\n \n
\n
\n\n \n \n \n \n {{ 'INBOX.TICKETS.NO_TICKETS' | translate : { status: statusName } }}\n \n \n \n \n \n \n {{ 'INBOX.TICKETS.ERROR_TICKETS' | translate : { status: statusName } }}\n \n \n\n","import { Component, Input, inject } from '@angular/core';\nimport { BehaviorSubject, map, skipWhile } from 'rxjs';\nimport { ConversationDetail } from '../../../../../../../core/src/lib//interface/conversation.interface';\nimport { CONVERSATION_HOST_APP_INTERFACE_TOKEN } from '../../../../../../../core/src/lib/tokens';\n\nconst VMF_INSTANCE = 'https://vendasta-support.zendesk.com/agent/tickets/';\n\nexport type TicketInfo = {\n id: string;\n subject: string;\n description: string;\n status: string;\n requester: string;\n createdAt: string;\n channel: string;\n groupName: string;\n badgeColor: string;\n url: string;\n total: number;\n};\n\n@Component({\n selector: 'inbox-ticket',\n templateUrl: './inbox-ticket.component.html',\n styleUrls: ['./inbox-ticket.component.scss'],\n})\nexport class InboxTicketComponent {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n @Input() set conversationDetails(conversationDetail: ConversationDetail) {\n this.conversationSubject$$.next(conversationDetail);\n }\n\n private readonly conversationSubject$$ = new BehaviorSubject(null);\n readonly partnerAccountGroupId$ = this.conversationSubject$$.asObservable().pipe(\n skipWhile((detail) => !detail),\n map((detail) => {\n return this.hostAppInterface.getConversationTitleInfo(detail).secondarySubtitle;\n }),\n );\n\n openCreateTicket() {\n window.open(VMF_INSTANCE.concat('new/1'), '_blank');\n }\n}\n","
\n \n
\n
\n
\n \n
\n
\n
\n \n
\n","import { AsyncPipe, NgIf } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { AccountGroupService, ProjectionFilter } from '@galaxy/account-group';\nimport { PartnerApiService } from '@galaxy/partner';\nimport { TranslateModule, TranslateService } from '@ngx-translate/core';\nimport { ParticipantType } from '@vendasta/conversation';\nimport { GalaxyAvatarModule } from '@vendasta/galaxy/avatar';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { filterNullAndUndefined } from '@vendasta/rx-utils';\nimport { SalespersonService } from '@vendasta/sales';\nimport {\n Observable,\n ReplaySubject,\n catchError,\n defaultIfEmpty,\n distinctUntilChanged,\n filter,\n map,\n of,\n shareReplay,\n switchMap,\n} from 'rxjs';\nimport { MARKETING_SERVICES_PIDS, SUPPORT_PID } from '../../../../core/src/lib/conversation.constants';\nimport { ConversationService } from '../../../../core/src/lib/conversation.service';\nimport { ConversationDetail } from '../../../../core/src/lib/interface/conversation.interface';\nimport { CONVERSATION_HOST_APP_INTERFACE_TOKEN, PARTNER_ID_TOKEN } from '../../../../core/src/lib/tokens';\n\ninterface SalesContact {\n name?: string | null;\n image?: string | null;\n}\n\n@Component({\n selector: 'inbox-conversation-assignee',\n templateUrl: './inbox-conversation-assignee.component.html',\n styleUrls: ['./inbox-conversation-assignee.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [AsyncPipe, NgIf, TranslateModule, GalaxyAvatarModule],\n})\nexport class InboxConversationAssigneeComponent {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n private conversationDetails$$ = new ReplaySubject(1);\n private conversationDetails$ = this.conversationDetails$$.asObservable().pipe(distinctUntilChanged());\n\n conversationInfo$ = this.conversationDetails$.pipe(\n map((details) => {\n if (!details) return null;\n const res = this.hostAppInterface.getRecipient(details);\n if (Array.isArray(res) && res.length > 0) {\n return res[0];\n } else if (!Array.isArray(res) && res) {\n return res;\n } else {\n throw new Error(this.translateService.instant('ERROR_LOADING_RECIPIENT'));\n }\n }),\n catchError((error) => {\n this.snackbarService.openErrorSnack(error);\n return of(null);\n }),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n\n accountGroupPartnerId$ = this.conversationInfo$.pipe(\n switchMap((accountGroupOrPartner) => {\n const partnerId = this.partnerId();\n if (\n accountGroupOrPartner?.participantType === ParticipantType.PARTICIPANT_TYPE_PARTNER &&\n partnerId &&\n (partnerId === SUPPORT_PID || MARKETING_SERVICES_PIDS.includes(partnerId))\n ) {\n return this.getMappedAccountPartner(accountGroupOrPartner.partnerId);\n } else if (accountGroupOrPartner?.participantType === ParticipantType.PARTICIPANT_TYPE_ACCOUNT_GROUP) {\n return of(accountGroupOrPartner.accountGroupId);\n } else {\n return of(null);\n }\n }),\n catchError(() => of(null)),\n );\n\n assignedContact$ = this.accountGroupPartnerId$.pipe(\n filterNullAndUndefined(),\n switchMap((accountGroupId) => this.getSalesPersonDetails(accountGroupId)),\n switchMap((salesPerson) => this.getSalesPersonContactInfo(salesPerson.partnerId, salesPerson.salesPersonId)),\n );\n\n readonly isAccountGroupPartnerType$ = this.accountGroupPartnerId$.pipe(\n map((account) => !!account),\n defaultIfEmpty(false),\n );\n\n @Input() set conversationDetail(details: ConversationDetail | null) {\n this.conversationDetails$$.next(details);\n }\n\n constructor(\n private readonly accountGroupService: AccountGroupService,\n private readonly partnerApiService: PartnerApiService,\n private readonly conversationService: ConversationService,\n private readonly translateService: TranslateService,\n private readonly salespersonService: SalespersonService,\n private readonly snackbarService: SnackbarService,\n ) {}\n\n getSalesPersonDetails(accountGroupId: string): Observable<{ salesPersonId: string; partnerId: string }> {\n return this.accountGroupService\n .get(accountGroupId, new ProjectionFilter({ accountGroupExternalIdentifiers: true }))\n .pipe(\n filter((res) => !!res),\n map((res) => ({\n salesPersonId: res.externalIdentifiers?.salesPersonId || '',\n partnerId: res.externalIdentifiers?.partnerId || '',\n })),\n defaultIfEmpty({ salesPersonId: '', partnerId: '' }),\n );\n }\n\n getSalesPersonContactInfo(partnerId: string, salesPersonId: string): Observable {\n if (partnerId !== '' && salesPersonId !== '') {\n return this.salespersonService.getMultiSalesperson(partnerId, [salesPersonId]).pipe(\n map((res) => res?.[0]),\n filter((res) => !!res),\n map((contact): SalesContact => {\n return {\n name:\n [contact.firstName, contact.lastName].join(' ').trim().length > 0\n ? [contact.firstName, contact.lastName].join(' ').trim()\n : this.translateService.instant('INBOX.TOPBAR.NONE'),\n image: contact.photoUrlHttps ? contact.photoUrlHttps : '',\n };\n }),\n defaultIfEmpty({\n name: this.translateService.instant('INBOX.TOPBAR.NONE'),\n image: null,\n }),\n );\n } else {\n return of({\n name: this.translateService.instant('INBOX.TOPBAR.NONE'),\n image: null,\n });\n }\n }\n\n getMappedAccountPartner(partnerId: string): Observable {\n return this.partnerApiService\n .getPartnerAccountGroupMapping({ partnerId: partnerId, accountGroupPartnerId: '' })\n .pipe(\n map((accountGroupMapping) => {\n return accountGroupMapping.accountGroupId || '';\n }),\n );\n }\n}\n","\n \n
\n
{{ 'INBOX.TOPBAR.ASSIGNEE' | translate }}:
\n \n
{{ salesContact.name }}
\n
\n
\n
\n","import { Component, Input, inject } from '@angular/core';\nimport { ConversationDetail } from '../../../../core/src/lib/interface/conversation.interface';\nimport { CONVERSATION_HOST_APP_INTERFACE_TOKEN } from '../../../../core/src/lib/tokens';\nimport { ConversationPipesModule } from '../../../../pipes/src/pipes.module';\n\n@Component({\n selector: 'inbox-conversation-account',\n template: `\n
\n
\n {{ subtitle | messageCodeBacktick }}\n
\n
\n `,\n styleUrls: ['./inbox-conversation-subtitle.component.scss'],\n standalone: true,\n imports: [ConversationPipesModule],\n})\nexport class InboxConversationSubtitleAccountComponent {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n\n subtitle = '';\n\n @Input() set conversationDetail(value: ConversationDetail | null) {\n if (!value) return;\n const titleInfo = this.hostAppInterface.getConversationTitleInfo(value);\n this.subtitle = titleInfo.subtitle ?? '';\n }\n}\n","import { Injectable } from '@angular/core';\nimport { BehaviorSubject } from 'rxjs';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class InboxInfoDrawerService {\n private isOpen$$ = new BehaviorSubject(false);\n isOpenDrawer$ = this.isOpen$$.asObservable();\n\n public toggle(): void {\n this.isOpen$$.next(!this.isOpen$$.value);\n }\n\n public setIsOpen(isOpen: boolean): void {\n this.isOpen$$.next(isOpen);\n }\n}\n","import { Component, inject } from '@angular/core';\nimport { MAT_DIALOG_DATA, MatDialogRef, MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\n\nexport interface DialogData {\n summary: string;\n}\n\n@Component({\n selector: 'inbox-summarize-conversation-dialog.component',\n templateUrl: 'summarize-conversation-dialog.component.html',\n standalone: true,\n imports: [CommonModule, MatDialogModule, MatButtonModule, TranslateModule],\n})\nexport class SummarizeConversationDialogComponent {\n readonly data = inject(MAT_DIALOG_DATA);\n\n constructor(public dialogRef: MatDialogRef) {}\n\n ok(): void {\n this.dialogRef.close();\n }\n}\n","

\n {{ 'INBOX.CONVERSATION_SUMMARY' | translate }}\n

\n\n {{ data.summary }}\n\n\n \n\n","import { AsyncPipe, NgClass, NgFor, NgIf } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n EventEmitter,\n Inject,\n Input,\n Optional,\n Output,\n inject,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { Router } from '@angular/router';\nimport { TranslateModule, TranslateService } from '@ngx-translate/core';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { BehaviorSubject, firstValueFrom, map, of, switchMap } from 'rxjs';\nimport { ConversationService } from '../../../../../../core/src/lib/conversation.service';\nimport { InboxService } from '../../../../../../core/src/lib/inbox.service';\nimport {\n ConversationUnseen,\n KabobDynamicButton,\n} from '../../../../../../core/src/lib/interface/conversation.interface';\nimport { HostAppInterface } from '../../../../../../core/src/lib/interface/host-app.interface';\nimport {\n CONVERSATION_HOST_APP_INTERFACE_TOKEN,\n CONVERSATION_ROUTES_TOKEN,\n} from '../../../../../../core/src/lib/tokens';\nimport { ViewModeService } from '../../../../../../core/src/lib/view-mode.service';\nimport { InboxConversationAssigneeComponent } from '../../../../components/inbox-conversation-assignee/inbox-conversation-assignee.component';\nimport { InboxConversationSubtitleAccountComponent } from '../../../../components/inbox-conversation-subtitle/inbox-conversation-subtitle.component';\nimport { InboxConversationTitleComponent } from '../../../../components/inbox-conversation-title/inbox-conversation-title.component';\nimport { INBOX_NAVIGATION_LINK } from '../../../../constants';\nimport { InboxInfoDrawerService } from '../inbox-info-pane/inbox-info-drawer.service';\nimport { MatDialog } from '@angular/material/dialog';\nimport { DialogData, SummarizeConversationDialogComponent } from './summarize-conversation-dialog.component';\nimport { ConversationApiService } from '@vendasta/conversation';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\n\n@Component({\n selector: 'inbox-messages-top-bar',\n templateUrl: './inbox-messages-top-bar.component.html',\n styleUrls: ['./inbox-messages-top-bar.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n standalone: true,\n imports: [\n // Common\n AsyncPipe,\n NgFor,\n NgIf,\n NgClass,\n\n // Material\n MatButtonModule,\n MatIconModule,\n MatMenuModule,\n MatTooltipModule,\n\n // Everything else\n GalaxyBadgeModule,\n InboxConversationAssigneeComponent,\n InboxConversationTitleComponent,\n TranslateModule,\n InboxConversationSubtitleAccountComponent,\n ],\n})\nexport class InboxMessagesTopBarComponent {\n conversationDetail$ = this.conversationService.currentConversationDetail$;\n kabobAvailableActions$ = this.conversationDetail$.pipe(\n switchMap((conversationDetail) => {\n if (!conversationDetail) return of(new Array());\n return this.hostAppInterface.getKabobAvailableActions(conversationDetail);\n }),\n );\n\n isInternalInfoDeleted = false;\n unseen$$ = new BehaviorSubject({ read: true, conversationId: '' });\n unseen$ = this.unseen$$.asObservable();\n\n readonly showInboxViews$ = this.inboxService.showInboxViews$;\n\n // readonly isBusinessApp = true;\n readonly isBusinessApp = this.inboxService.isBusinessApp;\n\n // only display assignee saleperson for sales center and partner center for now\n readonly displayAssignee = this.inboxService.isSalesCenter || this.inboxService.isPartnerCenter;\n\n readonly showConversationSummary$ = this.inboxService.isConversationSummaryEnabled$;\n\n @Input() set unseen(value: ConversationUnseen) {\n this.unseen$$.next(value);\n }\n @Input() isFollowing = false;\n @Input() isOpen = false;\n\n useSidebarStyles$ = this.viewModeService.viewMode$.pipe(map((viewMode) => viewMode === 'sidebar'));\n\n @Input() accountGroupId = '';\n @Input() groupId = '';\n\n @Output() markedUnread = new EventEmitter();\n @Output() changeFollowStatus = new EventEmitter();\n @Output() changeOpenStatus = new EventEmitter();\n\n private readonly routes = toSignal(inject(CONVERSATION_ROUTES_TOKEN));\n\n constructor(\n private router: Router,\n private conversationService: ConversationService,\n private inboxService: InboxService,\n @Optional()\n private viewModeService: ViewModeService,\n private inboxInfoDrawerService: InboxInfoDrawerService,\n @Inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN) private readonly hostAppInterface: HostAppInterface,\n private readonly dialog: MatDialog,\n private conversationAPIService: ConversationApiService,\n private snackbarService: SnackbarService,\n private translateService: TranslateService,\n ) {}\n\n back(): void {\n if (this.routes()?.useModal) {\n this.conversationService.removeLastConversationId();\n\n this.router.navigate(INBOX_NAVIGATION_LINK, {\n queryParamsHandling: 'merge',\n queryParams: { inboxPrefilledMessage: null },\n });\n return;\n }\n\n if (this.accountGroupId) {\n this.router.navigateByUrl(`/account/location/${this.accountGroupId}/inbox`);\n } else if (this.groupId) {\n this.router.navigateByUrl(`/account/brands/${this.groupId}/inbox`);\n } else {\n this.router.navigateByUrl(`/inbox`);\n }\n }\n\n markUnread(): void {\n this.markedUnread.emit({\n read: false,\n });\n }\n\n markRead(): void {\n this.markedUnread.emit({\n read: true,\n });\n }\n\n updateFollowStatus(): void {\n this.changeFollowStatus.emit(!this.isFollowing);\n }\n\n toggleDetailsDrawer() {\n this.inboxInfoDrawerService.toggle();\n }\n\n toggleConversationOpen(): void {\n this.changeOpenStatus.emit(!this.isOpen);\n }\n\n async openConversationSummaryModal(): Promise {\n const conversation = await firstValueFrom(this.conversationDetail$);\n\n if (!conversation) return;\n\n try {\n const resp = await firstValueFrom(\n this.conversationAPIService.getConversationSummary({\n conversationId: conversation.conversation.conversationId,\n }),\n );\n const data: DialogData = {\n summary: resp.summary,\n };\n this.dialog.open(SummarizeConversationDialogComponent, {\n data: data,\n width: '660px',\n });\n } catch (e) {\n this.snackbarService.openErrorSnack(this.translateService.instant('INBOX.ERROR_GETTING_CONVERSATION_SUMMARY'));\n }\n }\n}\n","\n \n arrow_back\n \n\n
\n
\n
\n \n
\n
\n \n {{ 'INBOX.INFO.DELETED' | translate }}\n \n \n
\n
\n \n \n
\n\n
\n \n \n \n {{ isFollowing ? 'star' : 'star_border' }}\n \n\n \n \n {{ isFollowing ? 'star' : 'star_border' }}\n {{ (isFollowing ? 'INBOX.VIEWS.FOLLOWING' : 'INBOX.VIEWS.FOLLOW') | translate }}\n \n \n\n \n more_vert\n \n \n \n
\n {{ 'INBOX.SENDER.SUMMARIZE_CONVERSATION' | translate }}\n \n
\n \n \n {{ 'INBOX.SENDER.MARK_READ' | translate }}\n \n \n \n \n \n \n\n \n \n \n \n
\n
\n\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, Inject, OnInit, Pipe, PipeTransform } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { TranslateModule } from '@ngx-translate/core';\nimport DOMPurify from 'dompurify';\n\n@Pipe({\n name: 'sanitize',\n standalone: true,\n})\nexport class SanitizePipe implements PipeTransform {\n constructor(private sanitizer: DomSanitizer) {}\n\n public transform(value: string | Node): SafeHtml {\n // While allowing iframes is not best practice, a lot of embedded content relies on them. This does allow a\n // potentially malicious actor to inject what appears to be an element of business centre for a social\n // engineering attack, but the browser should prevent any XSS attacks.\n return this.sanitizer.bypassSecurityTrustHtml(DOMPurify.sanitize(value, { ADD_TAGS: ['iframe'] }));\n }\n}\n\nexport interface TermsOfServiceData {\n termsOfService: string;\n accepted: boolean;\n partner?: TermsOfServiceDataPartner;\n}\n\nexport interface TermsOfServiceDataPartner {\n name: string;\n}\n\n@Component({\n selector: 'inbox-terms-of-service',\n templateUrl: './inbox-terms-of-service.component.html',\n styleUrls: ['./inbox-terms-of-service.component.scss'],\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n MatButtonModule,\n MatCheckboxModule,\n MatDialogModule,\n FormsModule,\n SanitizePipe,\n ],\n})\nexport class InboxTermsOfServiceDialogComponent implements OnInit {\n checkedTerms = false;\n showFullTOS = false;\n constructor(\n public dialogRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: TermsOfServiceData,\n ) {}\n\n ngOnInit(): void {\n this.data.accepted = false;\n if (this.data?.partner) {\n this.data.termsOfService = this.replaceVariables(this.data?.termsOfService);\n }\n\n this.data.termsOfService = this.convertToHtml(this.data?.termsOfService);\n }\n\n toggleTOS() {\n this.showFullTOS = !this.showFullTOS;\n }\n\n convertToHtml(escapeString: string): string {\n const parser = new DOMParser();\n return parser.parseFromString(parser.parseFromString(escapeString, 'text/html').body.textContent, 'text/html').body\n .textContent;\n }\n\n accepts(value: boolean): void {\n this.data.accepted = value;\n this.close();\n }\n\n replaceVariables(termsOfService: string): string {\n return termsOfService.replace(/\\[\\[partnerName\\]\\]/gm, this.data?.partner?.name);\n }\n\n close(): void {\n this.dialogRef.close(this.data);\n }\n}\n","

{{ 'INBOX.TERMS_OF_SERVICE.FULL_TITLE' | translate }}

\n\n \n
\n {{ 'INBOX.TERMS_OF_SERVICE.INTRO_FIRST_LINE' | translate }}\n {{ 'INBOX.TERMS_OF_SERVICE.TITLE' | translate }}.\n
\n\n \n {{ 'INBOX.TERMS_OF_SERVICE.ACCEPTANCE_MESSAGE' | translate }}\n \n
\n \n \n \n \n
\n\n\n \n
\n
\n \n \n \n
\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n Inject,\n Input,\n NgZone,\n Signal,\n ViewChild,\n inject,\n signal,\n} from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { MatDialog, MatDialogRef } from '@angular/material/dialog';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport {\n ConversationChannel,\n GlobalParticipantType,\n InboxApiService,\n MessageType,\n ParticipantType,\n SendMessageResponse,\n SetLastSeenRequestStatus,\n SubjectParticipant,\n} from '@vendasta/conversation';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { FileInfo } from '@vendasta/galaxy/uploader';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { filterNullAndUndefined } from '@vendasta/rx-utils';\nimport {\n BehaviorSubject,\n Observable,\n ReplaySubject,\n combineLatest,\n distinctUntilChanged,\n firstValueFrom,\n map,\n of,\n switchMap,\n take,\n tap,\n filter,\n} from 'rxjs';\nimport { AlertOptions } from '../../../../core/src/lib/channels/conversation-channel.abstract';\nimport { getFollowViewID, toFirestoreId } from '../../../../core/src/lib/conversation-utils';\nimport { ConversationService } from '../../../../core/src/lib/conversation.service';\nimport { InboxNotificationService } from '../../../../core/src/lib/inbox-notification.service';\nimport { InboxTermsOfService } from '../../../../core/src/lib/inbox-terms-of-service.service';\nimport { InboxService } from '../../../../core/src/lib/inbox.service';\nimport {\n ConversationDetail,\n ConversationUnseen,\n MessageInfo,\n TermsOfServiceResult,\n} from '../../../../core/src/lib/interface/conversation.interface';\nimport { HostAppInterface } from '../../../../core/src/lib/interface/host-app.interface';\nimport { isContactInformationMissing } from '../../../../core/src/lib/participant-utils';\nimport { ParticipantService } from '../../../../core/src/lib/participant.service';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_HOST_APP_INTERFACE_TOKEN,\n CONVERSATION_ROUTES_TOKEN,\n GROUP_ID_TOKEN,\n PARTNER_ID_TOKEN,\n USER_ID_TOKEN,\n} from '../../../../core/src/lib/tokens';\nimport { ViewService } from '../../../../core/src/lib/view.service';\nimport { InboxMessageTextComponent } from './components/inbox-message-text/inbox-message-text.component';\nimport {\n InboxTermsOfServiceDialogComponent,\n TermsOfServiceData,\n} from './components/inbox-terms-of-service/inbox-terms-of-service.component';\n\n@Component({\n selector: 'inbox-chat',\n templateUrl: './inbox-chat.component.html',\n styleUrls: ['./inbox-chat.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class InboxChatComponent {\n conversationService = inject(ConversationService);\n\n @Input() set id(value: string) {\n this.conversationService.setCurrentFirestoreConversationId(value);\n }\n @Input() viewModel?: boolean;\n\n @ViewChild('inboxTextComponent') inboxTextComponent?: InboxMessageTextComponent;\n\n readonly isBusinessApp = this.inboxService.isBusinessApp;\n\n destroyRef = inject(DestroyRef);\n\n private readonly notificationWarningChat$$: ReplaySubject = new ReplaySubject();\n readonly notificationWarningChat$ = this.notificationWarningChat$$.asObservable();\n readonly isOpen = signal(false);\n\n readonly currentConversationDetail$ = this.conversationService.currentConversationDetail$.pipe(\n tap((conversationDetails) => this.isOpen.set(conversationDetails?.conversation?.isOpen ?? false)),\n );\n readonly currentConversationDetail = toSignal(this.currentConversationDetail$, {\n initialValue: null,\n });\n\n messages$ = this.conversationService.messages$;\n events$ = this.conversationService.events$;\n loadingMessages$ = this.conversationService.loadingMessages$;\n\n private readonly fileChange$$ = new ReplaySubject(1);\n readonly fileChange$ = this.fileChange$$.asObservable();\n\n private partnerBrandName?: string;\n\n readonly unseenDefault: ConversationUnseen = {\n read: true,\n conversationId: '',\n };\n private readonly unseen$$: BehaviorSubject = new BehaviorSubject(\n this.unseenDefault,\n );\n readonly unseen$ = this.unseen$$.asObservable();\n\n private readonly isFollowing$$: BehaviorSubject = new BehaviorSubject(false);\n readonly isFollowing$ = this.isFollowing$$.asObservable();\n\n readonly isImpersonating$: Observable = this.conversationService.isUserImpersonated$;\n\n readonly isOpenAIChannel$: Observable = this.currentConversationDetail$.pipe(\n map((conversation) => conversation?.conversation?.channel === ConversationChannel.CONVERSATION_CHANNEL_OPENAI),\n );\n\n readonly isNotGoogleNorFacebookChannel$: Observable = this.currentConversationDetail$.pipe(\n map(\n (conversation) =>\n conversation?.conversation?.channel !==\n ConversationChannel.CONVERSATION_CHANNEL_GOOGLE_BUSINESS_COMMUNICATIONS &&\n conversation?.conversation?.channel !== ConversationChannel.CONVERSATION_CHANNEL_FACEBOOK,\n ),\n );\n\n readonly termsOfServiceResult$: Observable = combineLatest([\n this.inboxTermsOfService.getTermsOfServiceText$,\n this.inboxTermsOfService.termsOfServiceAccepted$,\n this.conversationService.isUserImpersonated$,\n ]).pipe(\n map(([termsOfServiceTextMessage, termsOfServiceAccepted, isImpersonating]) => {\n const showTOS = !isImpersonating && termsOfServiceTextMessage && !termsOfServiceAccepted;\n return {\n termsOfServiceAccepted: termsOfServiceAccepted,\n termsOfServiceTextMessage: showTOS ? termsOfServiceTextMessage : null,\n } as TermsOfServiceResult;\n }),\n );\n\n banners$ = this.currentConversationDetail$.pipe(\n map((conversation) => {\n return this.isBusinessApp\n ? []\n : conversation?.participants\n ?.filter(\n (participant) =>\n participant.isSubjectParticipant &&\n participant.internalParticipantId &&\n (participant.participantType === ParticipantType.PARTICIPANT_TYPE_PARTNER ||\n participant.participantType === ParticipantType.PARTICIPANT_TYPE_VENDOR),\n )\n ?.map(\n (participant) =>\n new SubjectParticipant({\n // We only want to get and display banners for Partners and Vendors. Since currently we only allow\n // Partners to set configurations we must look for the Partner's configuration for that vendor.\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n internalParticipantId: participant.internalParticipantId,\n }),\n ) || [];\n }),\n switchMap((participants) => {\n if (participants.length === 0) {\n return of(null);\n }\n return this.inboxApiService.getMultiConfiguration({\n subjectParticipants: participants,\n });\n }),\n map((configs) =>\n configs?.configurations\n ?.filter((config) => !!config?.availabilityMessage && config?.showAvailabilityMessage)\n ?.map((config) => config.availabilityMessage),\n ),\n );\n\n readonly inboxPrefilledMessage$ = this.route.queryParamMap.pipe(map((params) => params.get('inboxPrefilledMessage')));\n\n readonly isRecipientDeleted$ = this.currentConversationDetail$.pipe(\n filterNullAndUndefined(),\n map((conversation) => this.hostAppInterface.isRecipientInternalInfoDeleted(conversation)),\n );\n\n readonly availableChannels$ = this.conversationService.availableChannels$;\n\n readonly missingContactInformation$ = combineLatest([this.currentConversationDetail$, this.availableChannels$]).pipe(\n map(([conversation, availableChannels]) => {\n if (!conversation) {\n return false;\n }\n return isContactInformationMissing(conversation, availableChannels);\n }),\n );\n\n readonly showContactAlert$: Observable = combineLatest([\n this.isRecipientDeleted$,\n this.missingContactInformation$,\n this.isNotGoogleNorFacebookChannel$,\n ]).pipe(\n map(\n ([isRecipientDeleted, missingContactInformation, isNotGoogleNorFacebookChannel]) =>\n isNotGoogleNorFacebookChannel && !isRecipientDeleted && missingContactInformation,\n ),\n );\n\n disabledAlert: Signal;\n isWebChatConversation$ = this.currentConversationDetail$.pipe(\n map(\n (currentConversationDetail) =>\n currentConversationDetail?.conversation?.channel === ConversationChannel.CONVERSATION_CHANNEL_WEB_CHAT,\n ),\n );\n\n private readonly accountGroupId$ = inject(ACCOUNT_GROUP_ID_TOKEN);\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n private readonly groupId$ = inject(GROUP_ID_TOKEN);\n readonly accountGroupId = toSignal(this.accountGroupId$);\n readonly partnerId = toSignal(this.partnerId$);\n readonly groupId = toSignal(this.groupId$);\n readonly userId = toSignal(inject(USER_ID_TOKEN));\n readonly routes = toSignal(inject(CONVERSATION_ROUTES_TOKEN));\n\n constructor(\n private readonly router: Router,\n private readonly route: ActivatedRoute,\n private readonly snackbarService: SnackbarService,\n private readonly analyticsService: ProductAnalyticsService,\n private readonly inboxService: InboxService,\n private readonly inboxTermsOfService: InboxTermsOfService,\n private readonly viewService: ViewService,\n private readonly dialog: MatDialog,\n private readonly inboxNotificationService: InboxNotificationService,\n private inboxApiService: InboxApiService,\n private readonly participantService: ParticipantService,\n private readonly ngZone: NgZone,\n @Inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN) private readonly hostAppInterface: HostAppInterface,\n ) {\n const alertOptions$ = this.currentConversationDetail$.pipe(\n filterNullAndUndefined(),\n switchMap((convoDetails) => {\n //TODO: MEGA-1090 - Update this to only use the preferred channel and the selected channel by the user as input and to not block the channel selection\n return this.conversationService.displayAlertIfExists(convoDetails, convoDetails.conversation.channel);\n }),\n );\n\n this.disabledAlert = toSignal(alertOptions$, {\n initialValue: null,\n });\n\n // This is normally handled by the component input binding, which ties the named router param to directly set the\n // 'id' input. However, in Partner Center we are using an auxiliary outlet/named router outlet, and it doesn't\n // appear that component input bindings work for params defined in those routes. This subscription is a fallback to\n // ensure the value still gets set. Oct 11, 2023\n this.route.params.pipe(takeUntilDestroyed()).subscribe((params) => {\n if (params.id) {\n this.conversationService.setCurrentFirestoreConversationId(params.id);\n }\n });\n\n const orgId$ = this.isBusinessApp\n ? this.hostAppInterface.getAppOptions().is_multilocation\n ? this.groupId$\n : this.accountGroupId$\n : this.partnerId$;\n\n combineLatest([\n orgId$.pipe(filter((orgId) => !!orgId)),\n this.currentConversationDetail$.pipe(\n distinctUntilChanged((a, b) => a?.conversation?.conversationId === b?.conversation?.conversationId),\n filterNullAndUndefined(),\n ),\n ])\n .pipe(takeUntilDestroyed())\n .subscribe(([currentOrg, conversationDetail]) => {\n if (conversationDetail?.conversation.subjectParticipants?.some((p) => p.internalParticipantId === currentOrg)) {\n this.loadConversation(conversationDetail);\n } else {\n this.conversationService.removeLastConversationId();\n const routes = this.routes();\n this.router.navigate(routes.useModal ? ['', { outlets: { inbox: 'inbox' } }] : [routes.root + '/inbox']);\n }\n });\n }\n\n //TODO: MEGA-868 Delete this and the HTML switch validation when the email channel feature is released\n readonly emailChannelSupported$ = this.inboxService.canAccessEmailChannel$;\n\n /**\n * load conversation using the new µs\n */\n private async loadConversation(conversationDetail: ConversationDetail): Promise {\n if (conversationDetail && conversationDetail?.conversation?.conversationId) {\n this.analyticsService.trackEvent('inbox', 'conversation', 'view', 0, {\n id: toFirestoreId(conversationDetail.conversation.conversationId),\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: conversationDetail?.conversation?.channel,\n });\n this.sendDraftMessage();\n }\n\n await this.conversationService.setConversationLastSeen(\n conversationDetail.conversation.conversationId as string,\n SetLastSeenRequestStatus.SET_LAST_SEEN_REQUEST_STATUS_READ,\n );\n this.unseen$$.next({\n conversationId: conversationDetail.conversation.conversationId,\n read: true,\n });\n\n this.conversationService.currentParticipant$\n .pipe(\n take(1),\n map(\n (participant) =>\n conversationDetail?.conversation?.conversationViewIds?.indexOf(\n getFollowViewID(participant.participantId),\n ) >= 0,\n ),\n )\n .subscribe((notInFollowIDs) => {\n this.isFollowing$$.next(notInFollowIDs);\n });\n\n const prefilledMessage = await firstValueFrom(this.inboxPrefilledMessage$);\n if (!prefilledMessage) {\n this.inboxTextComponent?.clearText();\n }\n this.inboxTextComponent?.removeFile();\n }\n\n private sendDraftMessage(): void {\n if (\n this.conversationService.draftMessages &&\n ((this.conversationService.draftMessages?.text && this.conversationService.draftMessages?.text !== '') ||\n this.conversationService.draftMessages?.attachments?.length > 0)\n ) {\n this.sendMessageConversation(this.conversationService.draftMessages);\n }\n }\n\n async sendMessage(messageInfo: MessageInfo): Promise {\n const tosResult = await firstValueFrom(this.termsOfServiceResult$);\n let accepted = tosResult.termsOfServiceAccepted;\n if (!accepted) {\n accepted = await this.showTermsOfService({\n terms: tosResult?.termsOfServiceTextMessage,\n });\n this.inboxTermsOfService.termsOfServiceAccepted$$.next(accepted);\n }\n if (accepted) {\n const result = await this.sendMessageConversation(messageInfo);\n const following = await firstValueFrom(this.isFollowing$);\n if (result && !following) {\n this.simulateFollowingForBackgroundProccess();\n }\n }\n }\n\n fileChange(files: FileInfo[]): void {\n this.fileChange$$.next(files);\n }\n\n private simulateFollowingForBackgroundProccess(): void {\n if (this.isBusinessApp) {\n return;\n }\n this.isFollowing$$.next(true);\n this.snackbarService.openSuccessSnack('INBOX.VIEWS.SUCCESS_FOLLOW');\n }\n\n private async sendMessageConversation(messageInfo: MessageInfo): Promise {\n if ((messageInfo.text && messageInfo.text !== '') || messageInfo.attachments?.length > 0) {\n const result = await this.sendMessageViaConversation(messageInfo);\n this.conversationService.draftMessages = {} as MessageInfo;\n this.analyticsService.trackEvent('inbox', 'conversation', 'send-message', 0, {\n id: toFirestoreId(this.currentConversationDetail().conversation.conversationId),\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: messageInfo.channel,\n });\n return result;\n }\n }\n\n /**\n * send message using the new Conversation µs\n * @param {MessageInfo} messageInfo - the message text and media\n */\n private async sendMessageViaConversation(messageInfo: MessageInfo): Promise {\n const channel = messageInfo.channel;\n const result = await this.conversationService.sendMessage(\n this.currentConversationDetail().conversation.conversationId,\n MessageType.MESSAGE_TYPE_MESSAGE,\n messageInfo.text,\n channel,\n this.inboxService.platformLocation,\n messageInfo.attachments,\n );\n this.ngZone.run(() => {\n this.inboxTextComponent?.clearText();\n });\n return result;\n }\n\n private async showTermsOfService(termsOfService: { terms: string }): Promise {\n const data = {\n termsOfService: termsOfService.terms,\n accepted: false,\n partner: {\n name: this.partnerBrandName,\n },\n };\n\n const dialogRef: MatDialogRef = this.dialog.open(\n InboxTermsOfServiceDialogComponent,\n {\n width: '600px',\n maxHeight: '90vh',\n autoFocus: false,\n data,\n },\n );\n\n const result = await firstValueFrom(dialogRef.afterClosed());\n if (!result?.accepted) return false;\n\n const success = await firstValueFrom(this.inboxTermsOfService.acceptTermsOfService$());\n return success;\n }\n\n /**\n * TODO - Remove it when creating the new message status system\n * marking read is setting a date in the `lastSeenAt` attribute and unread is setting null\n * @param {{ read: boolean }} event - the event\n * @return {boolean}\n */\n async updateReadStatus(event: { read: boolean }): Promise {\n const status = event?.read\n ? SetLastSeenRequestStatus.SET_LAST_SEEN_REQUEST_STATUS_READ\n : SetLastSeenRequestStatus.SET_LAST_SEEN_REQUEST_STATUS_UNREAD;\n\n await this.conversationService.setConversationLastSeen(\n this.currentConversationDetail()?.conversation.conversationId as string,\n status,\n );\n this.unseen$$.next({\n conversationId: this.currentConversationDetail()?.conversation.conversationId,\n read: event?.read,\n });\n }\n\n async updateFollowStatus(newFollowStatus: boolean): Promise {\n if (this.isBusinessApp) {\n return;\n }\n const conversationDetails = await firstValueFrom(this.currentConversationDetail$);\n const conversationId = conversationDetails.conversation.conversationId;\n try {\n if (newFollowStatus) {\n await firstValueFrom(this.viewService.addConversationToConversationView(conversationId));\n this.snackbarService.openSuccessSnack('INBOX.VIEWS.SUCCESS_FOLLOW');\n } else {\n await firstValueFrom(this.viewService.removeConversationFromConversationView(conversationId));\n }\n this.isFollowing$$.next(newFollowStatus);\n } catch (error) {\n this.snackbarService.openErrorSnack('INBOX.VIEWS.FAILED_FOLLOW');\n }\n }\n\n async updateOpenStatus(newOpenStatus: boolean): Promise {\n const conversationId = this.currentConversationDetail()?.conversation.conversationId;\n if (!conversationId) {\n return;\n }\n\n const conversation = await this.conversationService.setConversationOpenStatus(conversationId, newOpenStatus);\n this.isOpen.set(conversation.isOpen);\n }\n\n openSettings(): void {\n this.inboxNotificationService\n .turnOnOnlyMyEventsNotification$()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n this.notificationWarningChat$$.next(false);\n this.snackbarService.openSuccessSnack('INBOX.WARNING.NOTIFICATION_UPDATE_SUCCESS');\n },\n error: () => {\n this.snackbarService.openErrorSnack('INBOX.WARNING.NOTIFICATION_UPDATE_ERROR');\n },\n });\n }\n\n async viewContact(): Promise {\n const conversationDetail = await firstValueFrom(this.currentConversationDetail$);\n const recipient = this.hostAppInterface.getRecipient(conversationDetail);\n const contactId = Array.isArray(recipient) ? recipient[0]?.internalParticipantId : recipient?.internalParticipantId;\n this.participantService.viewContact(\n contactId,\n ParticipantType.PARTICIPANT_TYPE_CUSTOMER,\n conversationDetail.conversation.conversationId,\n toFirestoreId(conversationDetail.conversation.conversationId),\n );\n }\n\n onClose(): void {\n this.notificationWarningChat$$.next(false);\n this.inboxNotificationService.setCookie();\n }\n}\n","
\n \n \n \n {{ bannerText }}\n \n \n \n \n \n {{ 'INBOX.ERROR.NO_PHONE_NUMBER_OR_EMAIL' | translate }}\n \n \n {{ 'INBOX.ERROR.NO_PHONE_NUMBER' | translate }}\n \n \n \n \n {{ 'INBOX.WARNING.TURN_ON_NOTIFICATIONS' | translate }}\n {{ 'INBOX.WARNING.TURN_ON_NOTIFICATIONS_DETAILS' | translate }}\n {{ 'INBOX.WARNING.NOTIFICATION_SETTINGS' | translate }}\n \n \n \n \n
\n \n \n \n {{ disabledAlert()?.description || '' | translate }}\n \n \n
\n \n \n \n
\n
\n","import { FocusMonitor } from '@angular/cdk/a11y';\nimport { Location } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Inject,\n ViewChild,\n inject,\n} from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { FormBuilder, Validators } from '@angular/forms';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { PhoneInputComponent } from '@vendasta/galaxy/input';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { Observable, firstValueFrom } from 'rxjs';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n COMPANY_NAME_TOKEN,\n ConversationService,\n InboxContact,\n InboxService,\n PARTNER_ID_TOKEN,\n ParticipantService,\n} from '../../../../core/src/index';\n\n@Component({\n selector: 'inbox-create-contact-form',\n templateUrl: './create-contact-form.component.html',\n styleUrls: ['./create-contact-form.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CreateContactFormComponent implements AfterViewInit {\n @ViewChild('phoneInput') phoneInput: PhoneInputComponent;\n @ViewChild('firstNameInput') firstNameInput: ElementRef;\n\n readonly MIN_CHARACTERS = 2;\n\n readonly contactForm = this.formBuilder.group({\n firstName: ['', [Validators.required, Validators.minLength(this.MIN_CHARACTERS)]],\n lastName: [''],\n phone: [Number(null), [Validators.minLength(6)]],\n email: ['', [Validators.email, Validators.minLength(6)]],\n });\n\n get errors() {\n return {\n firstName: this.contactForm.controls.firstName.errors,\n lastName: this.contactForm.controls.lastName.errors,\n email: this.contactForm.controls.email.errors,\n phone: this.contactForm.controls.phone.errors,\n };\n }\n\n isLoading = false;\n isSubmitted = false;\n\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n\n constructor(\n private readonly focus: FocusMonitor,\n private readonly router: Router,\n private readonly activatedRoute: ActivatedRoute,\n private readonly location: Location,\n private cdRef: ChangeDetectorRef,\n @Inject(COMPANY_NAME_TOKEN) readonly companyName$: Observable,\n private readonly formBuilder: FormBuilder,\n private readonly conversationService: ConversationService,\n private readonly inboxService: InboxService,\n private readonly participantService: ParticipantService,\n private readonly snackbarService: SnackbarService,\n private readonly analyticsService: ProductAnalyticsService,\n ) {\n const currentNavigation = this.router.getCurrentNavigation();\n if (currentNavigation) {\n this.contactForm.patchValue(currentNavigation.extras.state);\n }\n }\n\n ngAfterViewInit(): void {\n this.focus.focusVia(this.firstNameInput, 'program');\n this.cdRef.detectChanges();\n }\n\n async submit(): Promise {\n this.phoneInput.rawInputControl.updateValueAndValidity();\n this.isSubmitted = true;\n\n if (!(this.contactForm.get('phone').value || this.contactForm.get('email').value)) {\n this.snackbarService.openErrorSnack('INBOX.ERROR.PHONE_OR_EMAIL_REQUIRED');\n return;\n }\n\n if (!this.contactForm.valid) {\n this.snackbarService.openErrorSnack('INBOX.ERROR.CORRECT_INVALID_REQUIRED_FIELDS');\n return;\n }\n\n this.startLoading();\n\n try {\n const formValue = this.contactForm.value;\n const newContact = await firstValueFrom(\n this.participantService.addContact({\n firstName: formValue.firstName,\n lastName: formValue.lastName,\n phone: `${formValue.phone}`,\n email: formValue.email,\n permissionToContact: true,\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n }),\n );\n\n if (!newContact?.contactId) throw new Error('Contact not created');\n\n this.analyticsService.trackEvent('inbox', 'new-message', 'add-contact-success', 0, {\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: this.conversationService.getConversationChannel(),\n });\n\n await this.returnToNewMessage(newContact);\n } catch (error) {\n console.warn('submit', error.message);\n if (error.status === 409) {\n this.snackbarService.openErrorSnack('INBOX.ERROR.CONTACT_EXISTS');\n } else {\n this.snackbarService.openErrorSnack('INBOX.ERROR.CREATE_CONTACT');\n }\n\n this.analyticsService.trackEvent('inbox', 'new-message', 'add-contact-error', 0, {\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: this.conversationService.getConversationChannel(),\n message: error?.message,\n });\n }\n\n this.stopLoading();\n }\n\n private async returnToNewMessage(contact: InboxContact): Promise {\n contact.lastName = contact.lastName || '';\n\n this.router.navigate(['../new-message', contact], {\n relativeTo: this.activatedRoute,\n state: {\n contact: contact,\n },\n });\n }\n\n private startLoading(): void {\n this.isLoading = true;\n }\n\n private stopLoading(): void {\n this.isLoading = false;\n }\n\n close() {\n this.location.back();\n }\n}\n","\n
\n
\n

\n {{ 'INBOX.ADD_CONTACT.ADD_CONTACT_FORM_HEADER' | translate : { businessName: companyName$ | async } }}\n

\n\n close\n
\n \n \n {{ 'INBOX.NEW_MESSAGE.FIRST_NAME' | translate }}\n \n \n {{ 'INBOX.ERROR.REQUIRED_FIELD' | translate }}\n \n \n {{ 'INBOX.ERROR.INVALID_LENGTH_TOO_FEW_CHARACTERS' | translate : { min: MIN_CHARACTERS } }}\n \n \n \n {{ 'INBOX.NEW_MESSAGE.LAST_NAME' | translate }}\n \n \n \n \n \n {{ 'INBOX.NEW_MESSAGE.EMAIL' | translate }}\n \n \n {{ 'INBOX.ERROR.INVALID_EMAIL_ADDRESS' | translate }}\n \n \n
\n \n {{ 'INBOX.NEW_MESSAGE.ADD_CONTACT' | translate }}\n \n
\n\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nimport { map } from 'rxjs/operators';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar ReviewRequestStatus = /*#__PURE__*/function (ReviewRequestStatus) {\n ReviewRequestStatus[ReviewRequestStatus[\"LEFT_REVIEW\"] = 0] = \"LEFT_REVIEW\";\n ReviewRequestStatus[ReviewRequestStatus[\"DELIVERED\"] = 1] = \"DELIVERED\";\n ReviewRequestStatus[ReviewRequestStatus[\"BOUNCED\"] = 2] = \"BOUNCED\";\n ReviewRequestStatus[ReviewRequestStatus[\"OPENED\"] = 3] = \"OPENED\";\n ReviewRequestStatus[ReviewRequestStatus[\"CLICKED\"] = 4] = \"CLICKED\";\n ReviewRequestStatus[ReviewRequestStatus[\"CLICKED_POSITIVE\"] = 5] = \"CLICKED_POSITIVE\";\n ReviewRequestStatus[ReviewRequestStatus[\"CLICKED_NEGATIVE\"] = 6] = \"CLICKED_NEGATIVE\";\n ReviewRequestStatus[ReviewRequestStatus[\"UNSUBSCRIBE\"] = 7] = \"UNSUBSCRIBE\";\n ReviewRequestStatus[ReviewRequestStatus[\"SPAM_REPORT\"] = 8] = \"SPAM_REPORT\";\n ReviewRequestStatus[ReviewRequestStatus[\"SENDING\"] = 9] = \"SENDING\";\n ReviewRequestStatus[ReviewRequestStatus[\"DROPPED\"] = 10] = \"DROPPED\";\n return ReviewRequestStatus;\n}(ReviewRequestStatus || {});\nvar SortDirection = /*#__PURE__*/function (SortDirection) {\n SortDirection[SortDirection[\"Ascending\"] = 0] = \"Ascending\";\n SortDirection[SortDirection[\"Descending\"] = 1] = \"Descending\";\n return SortDirection;\n}(SortDirection || {});\nvar SortField = /*#__PURE__*/function (SortField) {\n SortField[SortField[\"Name\"] = 0] = \"Name\";\n SortField[SortField[\"Created\"] = 1] = \"Created\";\n return SortField;\n}(SortField || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar CustomerFieldType = /*#__PURE__*/function (CustomerFieldType) {\n CustomerFieldType[CustomerFieldType[\"CUSTOMER_FIELD_TYPE_NONE\"] = 0] = \"CUSTOMER_FIELD_TYPE_NONE\";\n CustomerFieldType[CustomerFieldType[\"CUSTOMER_FIELD_TYPE_EMAIL\"] = 1] = \"CUSTOMER_FIELD_TYPE_EMAIL\";\n CustomerFieldType[CustomerFieldType[\"CUSTOMER_FIELD_TYPE_PHONE\"] = 2] = \"CUSTOMER_FIELD_TYPE_PHONE\";\n return CustomerFieldType;\n}(CustomerFieldType || {});\nvar CustomerSortDirection = /*#__PURE__*/function (CustomerSortDirection) {\n CustomerSortDirection[CustomerSortDirection[\"CUSTOMER_SORT_DIRECTION_ASCENDING\"] = 0] = \"CUSTOMER_SORT_DIRECTION_ASCENDING\";\n CustomerSortDirection[CustomerSortDirection[\"CUSTOMER_SORT_DIRECTION_DESCENDING\"] = 1] = \"CUSTOMER_SORT_DIRECTION_DESCENDING\";\n return CustomerSortDirection;\n}(CustomerSortDirection || {});\nvar CustomerSortField = /*#__PURE__*/function (CustomerSortField) {\n CustomerSortField[CustomerSortField[\"CUSTOMER_SORT_FIELD_FIRST_NAME\"] = 0] = \"CUSTOMER_SORT_FIELD_FIRST_NAME\";\n CustomerSortField[CustomerSortField[\"CUSTOMER_SORT_FIELD_LAST_NAME\"] = 1] = \"CUSTOMER_SORT_FIELD_LAST_NAME\";\n CustomerSortField[CustomerSortField[\"CUSTOMER_SORT_FIELD_CREATED\"] = 2] = \"CUSTOMER_SORT_FIELD_CREATED\";\n return CustomerSortField;\n}(CustomerSortField || {});\nvar CustomerValidationError = /*#__PURE__*/function (CustomerValidationError) {\n CustomerValidationError[CustomerValidationError[\"CUSTOMER_VALIDATION_ERROR_NO_ERRORS\"] = 0] = \"CUSTOMER_VALIDATION_ERROR_NO_ERRORS\";\n CustomerValidationError[CustomerValidationError[\"CUSTOMER_VALIDATION_ERROR_EMAIL_OR_PHONE_REQUIRED\"] = 1] = \"CUSTOMER_VALIDATION_ERROR_EMAIL_OR_PHONE_REQUIRED\";\n CustomerValidationError[CustomerValidationError[\"CUSTOMER_VALIDATION_ERROR_INVALID_EMAIL\"] = 2] = \"CUSTOMER_VALIDATION_ERROR_INVALID_EMAIL\";\n CustomerValidationError[CustomerValidationError[\"CUSTOMER_VALIDATION_ERROR_INVALID_PHONE\"] = 3] = \"CUSTOMER_VALIDATION_ERROR_INVALID_PHONE\";\n CustomerValidationError[CustomerValidationError[\"CUSTOMER_VALIDATION_ERROR_INVALID_FIRST_NAME\"] = 4] = \"CUSTOMER_VALIDATION_ERROR_INVALID_FIRST_NAME\";\n CustomerValidationError[CustomerValidationError[\"CUSTOMER_VALIDATION_ERROR_INVALID_LAST_NAME\"] = 5] = \"CUSTOMER_VALIDATION_ERROR_INVALID_LAST_NAME\";\n return CustomerValidationError;\n}(CustomerValidationError || {});\nvar EntityType = /*#__PURE__*/function (EntityType) {\n EntityType[EntityType[\"ENTITY_TYPE_UNKNOWN\"] = 0] = \"ENTITY_TYPE_UNKNOWN\";\n EntityType[EntityType[\"ENTITY_TYPE_CUSTOMER\"] = 1] = \"ENTITY_TYPE_CUSTOMER\";\n EntityType[EntityType[\"ENTITY_TYPE_CONFLICT\"] = 2] = \"ENTITY_TYPE_CONFLICT\";\n return EntityType;\n}(EntityType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar CustomerType = /*#__PURE__*/function (CustomerType) {\n CustomerType[CustomerType[\"CUSTOMER_TYPE_UNKNOWN\"] = 0] = \"CUSTOMER_TYPE_UNKNOWN\";\n CustomerType[CustomerType[\"CUSTOMER_TYPE_CUSTOMER\"] = 1] = \"CUSTOMER_TYPE_CUSTOMER\";\n CustomerType[CustomerType[\"CUSTOMER_TYPE_CONFLICT\"] = 2] = \"CUSTOMER_TYPE_CONFLICT\";\n return CustomerType;\n}(CustomerType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass AddUsersToListRequest {\n static fromProto(proto) {\n let m = new AddUsersToListRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.listId !== 'undefined') {\n toReturn['listId'] = this.listId;\n }\n if (typeof this.userIds !== 'undefined') {\n toReturn['userIds'] = this.userIds;\n }\n return toReturn;\n }\n}\nclass AssociateIDRequest {\n static fromProto(proto) {\n let m = new AssociateIDRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contactId !== 'undefined') {\n toReturn['contactId'] = this.contactId;\n }\n if (typeof this.vendorContactId !== 'undefined') {\n toReturn['vendorContactId'] = this.vendorContactId;\n }\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n return toReturn;\n }\n}\nclass BulkCreateContactRequest {\n static fromProto(proto) {\n let m = new BulkCreateContactRequest();\n m = Object.assign(m, proto);\n if (proto.mapping) {\n m.mapping = HeaderMapping.fromProto(proto.mapping);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filePath !== 'undefined') {\n toReturn['filePath'] = this.filePath;\n }\n if (typeof this.mapping !== 'undefined' && this.mapping !== null) {\n toReturn['mapping'] = 'toApiJson' in this.mapping ? this.mapping.toApiJson() : this.mapping;\n }\n if (typeof this.syncedAppIds !== 'undefined') {\n toReturn['syncedAppIds'] = this.syncedAppIds;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n return toReturn;\n }\n}\nclass BulkUpdateContactRequest {\n static fromProto(proto) {\n let m = new BulkUpdateContactRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contactIds !== 'undefined') {\n toReturn['contactIds'] = this.contactIds;\n }\n if (typeof this.syncedAppIdsToAdd !== 'undefined') {\n toReturn['syncedAppIdsToAdd'] = this.syncedAppIdsToAdd;\n }\n if (typeof this.syncedAppIdsToRemove !== 'undefined') {\n toReturn['syncedAppIdsToRemove'] = this.syncedAppIdsToRemove;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass Contact {\n static fromProto(proto) {\n let m = new Contact();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.deleted) {\n m.deleted = new Date(proto.deleted);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contactId !== 'undefined') {\n toReturn['contactId'] = this.contactId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.deleted !== 'undefined' && this.deleted !== null) {\n toReturn['deleted'] = 'toApiJson' in this.deleted ? this.deleted.toApiJson() : this.deleted;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.originalId !== 'undefined') {\n toReturn['originalId'] = this.originalId;\n }\n if (typeof this.syncedAppIds !== 'undefined') {\n toReturn['syncedAppIds'] = this.syncedAppIds;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n return toReturn;\n }\n}\nclass CreateContactRequest {\n static fromProto(proto) {\n let m = new CreateContactRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.originalId !== 'undefined') {\n toReturn['originalId'] = this.originalId;\n }\n if (typeof this.syncedAppIds !== 'undefined') {\n toReturn['syncedAppIds'] = this.syncedAppIds;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n return toReturn;\n }\n}\nclass CreateContactResponse {\n static fromProto(proto) {\n let m = new CreateContactResponse();\n m = Object.assign(m, proto);\n if (proto.contact) {\n m.contact = Contact.fromProto(proto.contact);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contact !== 'undefined' && this.contact !== null) {\n toReturn['contact'] = 'toApiJson' in this.contact ? this.contact.toApiJson() : this.contact;\n }\n return toReturn;\n }\n}\nclass CreateUserListRequest {\n static fromProto(proto) {\n let m = new CreateUserListRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.listId !== 'undefined') {\n toReturn['listId'] = this.listId;\n }\n if (typeof this.listName !== 'undefined') {\n toReturn['listName'] = this.listName;\n }\n return toReturn;\n }\n}\nclass DeleteContactRequest {\n static fromProto(proto) {\n let m = new DeleteContactRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contactId !== 'undefined') {\n toReturn['contactId'] = this.contactId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.author !== 'undefined') {\n toReturn['author'] = this.author;\n }\n return toReturn;\n }\n}\nclass DeleteUserFromListRequest {\n static fromProto(proto) {\n let m = new DeleteUserFromListRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.listId !== 'undefined') {\n toReturn['listId'] = this.listId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass Filters {\n static fromProto(proto) {\n let m = new Filters();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.source !== 'undefined') {\n toReturn['source'] = this.source;\n }\n if (typeof this.syncedAppIds !== 'undefined') {\n toReturn['syncedAppIds'] = this.syncedAppIds;\n }\n return toReturn;\n }\n}\nclass GetUserListRequest {\n static fromProto(proto) {\n let m = new GetUserListRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.listId !== 'undefined') {\n toReturn['listId'] = this.listId;\n }\n return toReturn;\n }\n}\nclass GetUserListResponse {\n static fromProto(proto) {\n let m = new GetUserListResponse();\n m = Object.assign(m, proto);\n if (proto.userList) {\n m.userList = UserListItem.fromProto(proto.userList);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userList !== 'undefined' && this.userList !== null) {\n toReturn['userList'] = 'toApiJson' in this.userList ? this.userList.toApiJson() : this.userList;\n }\n return toReturn;\n }\n}\nclass HeaderMapping {\n static fromProto(proto) {\n let m = new HeaderMapping();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.emails !== 'undefined') {\n toReturn['emails'] = this.emails;\n }\n if (typeof this.phones !== 'undefined') {\n toReturn['phones'] = this.phones;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n return toReturn;\n }\n}\nclass ListContactsRequest {\n static fromProto(proto) {\n let m = new ListContactsRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n if (proto.sortOptions) {\n m.sortOptions = SortOptions.fromProto(proto.sortOptions);\n }\n if (proto.filters) {\n m.filters = Filters.fromProto(proto.filters);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.searchTerm !== 'undefined') {\n toReturn['searchTerm'] = this.searchTerm;\n }\n if (typeof this.sortOptions !== 'undefined' && this.sortOptions !== null) {\n toReturn['sortOptions'] = 'toApiJson' in this.sortOptions ? this.sortOptions.toApiJson() : this.sortOptions;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n return toReturn;\n }\n}\nclass ListContactsResponse {\n static fromProto(proto) {\n let m = new ListContactsResponse();\n m = Object.assign(m, proto);\n if (proto.contacts) {\n m.contacts = proto.contacts.map(Contact.fromProto);\n }\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contacts !== 'undefined' && this.contacts !== null) {\n toReturn['contacts'] = 'toApiJson' in this.contacts ? this.contacts.toApiJson() : this.contacts;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nclass ListOriginsRequest {\n static fromProto(proto) {\n let m = new ListOriginsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass ListOriginsResponse {\n static fromProto(proto) {\n let m = new ListOriginsResponse();\n m = Object.assign(m, proto);\n if (proto.whiteLabeledOrigins) {\n m.whiteLabeledOrigins = proto.whiteLabeledOrigins.map(WhiteLabeledOrigin.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.whiteLabeledOrigins !== 'undefined' && this.whiteLabeledOrigins !== null) {\n toReturn['whiteLabeledOrigins'] = 'toApiJson' in this.whiteLabeledOrigins ? this.whiteLabeledOrigins.toApiJson() : this.whiteLabeledOrigins;\n }\n return toReturn;\n }\n}\nclass ListUserListsRequest {\n static fromProto(proto) {\n let m = new ListUserListsRequest();\n m = Object.assign(m, proto);\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n return toReturn;\n }\n}\nclass ListUserListsResponse {\n static fromProto(proto) {\n let m = new ListUserListsResponse();\n m = Object.assign(m, proto);\n if (proto.userLists) {\n m.userLists = proto.userLists.map(UserListItem.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userLists !== 'undefined' && this.userLists !== null) {\n toReturn['userLists'] = 'toApiJson' in this.userLists ? this.userLists.toApiJson() : this.userLists;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListUsersFromListRequest {\n static fromProto(proto) {\n let m = new ListUsersFromListRequest();\n m = Object.assign(m, proto);\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.listId !== 'undefined') {\n toReturn['listId'] = this.listId;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n return toReturn;\n }\n}\nclass ListUsersFromListResponse {\n static fromProto(proto) {\n let m = new ListUsersFromListResponse();\n m = Object.assign(m, proto);\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userIds !== 'undefined') {\n toReturn['userIds'] = this.userIds;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass PagedRequestOptions {\n static fromProto(proto) {\n let m = new PagedRequestOptions();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n return toReturn;\n }\n}\nclass PagedResponseMetadata {\n static fromProto(proto) {\n let m = new PagedResponseMetadata();\n m = Object.assign(m, proto);\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nclass SortOptions {\n static fromProto(proto) {\n let m = new SortOptions();\n m = Object.assign(m, proto);\n if (proto.direction) {\n m.direction = enumStringToValue$3(SortDirection, proto.direction);\n }\n if (proto.field) {\n m.field = enumStringToValue$3(SortField, proto.field);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.direction !== 'undefined') {\n toReturn['direction'] = this.direction;\n }\n if (typeof this.field !== 'undefined') {\n toReturn['field'] = this.field;\n }\n return toReturn;\n }\n}\nclass TriggerSyncRequest {\n static fromProto(proto) {\n let m = new TriggerSyncRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n return toReturn;\n }\n}\nclass UpdateContactRequest {\n static fromProto(proto) {\n let m = new UpdateContactRequest();\n m = Object.assign(m, proto);\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phone !== 'undefined') {\n toReturn['phone'] = this.phone;\n }\n if (typeof this.email !== 'undefined') {\n toReturn['email'] = this.email;\n }\n if (typeof this.contactId !== 'undefined') {\n toReturn['contactId'] = this.contactId;\n }\n if (typeof this.author !== 'undefined') {\n toReturn['author'] = this.author;\n }\n if (typeof this.syncedAppIds !== 'undefined') {\n toReturn['syncedAppIds'] = this.syncedAppIds;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass UpdateContactResponse {\n static fromProto(proto) {\n let m = new UpdateContactResponse();\n m = Object.assign(m, proto);\n if (proto.contact) {\n m.contact = Contact.fromProto(proto.contact);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contact !== 'undefined' && this.contact !== null) {\n toReturn['contact'] = 'toApiJson' in this.contact ? this.contact.toApiJson() : this.contact;\n }\n return toReturn;\n }\n}\nclass UserListItem {\n static fromProto(proto) {\n let m = new UserListItem();\n m = Object.assign(m, proto);\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.itemCount) {\n m.itemCount = parseInt(proto.itemCount, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.listId !== 'undefined') {\n toReturn['listId'] = this.listId;\n }\n if (typeof this.listName !== 'undefined') {\n toReturn['listName'] = this.listName;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.itemCount !== 'undefined') {\n toReturn['itemCount'] = this.itemCount;\n }\n return toReturn;\n }\n}\nclass WhiteLabeledOrigin {\n static fromProto(proto) {\n let m = new WhiteLabeledOrigin();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.whiteLabeledName !== 'undefined') {\n toReturn['whiteLabeledName'] = this.whiteLabeledName;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass ContactMessageRequest {\n static fromProto(proto) {\n let m = new ContactMessageRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.contactIds !== 'undefined') {\n toReturn['contactIds'] = this.contactIds;\n }\n if (typeof this.subject !== 'undefined') {\n toReturn['subject'] = this.subject;\n }\n if (typeof this.template !== 'undefined') {\n toReturn['template'] = this.template;\n }\n if (typeof this.ccAddress !== 'undefined') {\n toReturn['ccAddress'] = this.ccAddress;\n }\n if (typeof this.bccAddress !== 'undefined') {\n toReturn['bccAddress'] = this.bccAddress;\n }\n if (typeof this.replyAddress !== 'undefined') {\n toReturn['replyAddress'] = this.replyAddress;\n }\n return toReturn;\n }\n}\nclass ContactMessageResponse {\n static fromProto(proto) {\n let m = new ContactMessageResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.responseMessage !== 'undefined') {\n toReturn['responseMessage'] = this.responseMessage;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass BulkCreateCustomerRequest {\n static fromProto(proto) {\n let m = new BulkCreateCustomerRequest();\n m = Object.assign(m, proto);\n if (proto.mapping) {\n m.mapping = CustomerHeaderMapping.fromProto(proto.mapping);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.filePath !== 'undefined') {\n toReturn['filePath'] = this.filePath;\n }\n if (typeof this.mapping !== 'undefined' && this.mapping !== null) {\n toReturn['mapping'] = 'toApiJson' in this.mapping ? this.mapping.toApiJson() : this.mapping;\n }\n return toReturn;\n }\n}\nclass BulkCreateCustomerResponse {\n static fromProto(proto) {\n let m = new BulkCreateCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.errors) {\n m.errors = proto.errors.map(BulkCreateCustomerValidationError.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.errors !== 'undefined' && this.errors !== null) {\n toReturn['errors'] = 'toApiJson' in this.errors ? this.errors.toApiJson() : this.errors;\n }\n return toReturn;\n }\n}\nclass BulkCreateCustomerValidationError {\n static fromProto(proto) {\n let m = new BulkCreateCustomerValidationError();\n m = Object.assign(m, proto);\n if (proto.index) {\n m.index = parseInt(proto.index, 10);\n }\n if (proto.errors) {\n m.errors = proto.errors.map(v => enumStringToValue$1(CustomerValidationError, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.index !== 'undefined') {\n toReturn['index'] = this.index;\n }\n if (typeof this.errors !== 'undefined') {\n toReturn['errors'] = this.errors;\n }\n return toReturn;\n }\n}\nclass BulkUpdateCustomersRequest {\n static fromProto(proto) {\n let m = new BulkUpdateCustomersRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerIds !== 'undefined') {\n toReturn['customerIds'] = this.customerIds;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n return toReturn;\n }\n}\nclass BulkUpdateCustomersResponse {\n static fromProto(proto) {\n let m = new BulkUpdateCustomersResponse();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n return toReturn;\n }\n}\nclass Conflict {\n static fromProto(proto) {\n let m = new Conflict();\n m = Object.assign(m, proto);\n if (proto.permissionToContact) {\n m.permissionToContact = new Date(proto.permissionToContact);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.deleted) {\n m.deleted = new Date(proto.deleted);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.conflictId !== 'undefined') {\n toReturn['conflictId'] = this.conflictId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phoneNumbers !== 'undefined') {\n toReturn['phoneNumbers'] = this.phoneNumbers;\n }\n if (typeof this.emailAddresses !== 'undefined') {\n toReturn['emailAddresses'] = this.emailAddresses;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.origins !== 'undefined') {\n toReturn['origins'] = this.origins;\n }\n if (typeof this.permissionToContact !== 'undefined' && this.permissionToContact !== null) {\n toReturn['permissionToContact'] = 'toApiJson' in this.permissionToContact ? this.permissionToContact.toApiJson() : this.permissionToContact;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.deleted !== 'undefined' && this.deleted !== null) {\n toReturn['deleted'] = 'toApiJson' in this.deleted ? this.deleted.toApiJson() : this.deleted;\n }\n if (typeof this.assignedRepFirstName !== 'undefined') {\n toReturn['assignedRepFirstName'] = this.assignedRepFirstName;\n }\n if (typeof this.assignedRepLastName !== 'undefined') {\n toReturn['assignedRepLastName'] = this.assignedRepLastName;\n }\n return toReturn;\n }\n}\nclass ConflictingField {\n static fromProto(proto) {\n let m = new ConflictingField();\n m = Object.assign(m, proto);\n if (proto.fieldType) {\n m.fieldType = enumStringToValue$1(CustomerFieldType, proto.fieldType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.fieldType !== 'undefined') {\n toReturn['fieldType'] = this.fieldType;\n }\n if (typeof this.fieldValue !== 'undefined') {\n toReturn['fieldValue'] = this.fieldValue;\n }\n return toReturn;\n }\n}\nclass CreateCustomerRequest {\n static fromProto(proto) {\n let m = new CreateCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phoneNumbers !== 'undefined') {\n toReturn['phoneNumbers'] = this.phoneNumbers;\n }\n if (typeof this.emailAddresses !== 'undefined') {\n toReturn['emailAddresses'] = this.emailAddresses;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.origins !== 'undefined') {\n toReturn['origins'] = this.origins;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n if (typeof this.assignedRepFirstName !== 'undefined') {\n toReturn['assignedRepFirstName'] = this.assignedRepFirstName;\n }\n if (typeof this.assignedRepLastName !== 'undefined') {\n toReturn['assignedRepLastName'] = this.assignedRepLastName;\n }\n return toReturn;\n }\n}\nclass CreateCustomerResponse {\n static fromProto(proto) {\n let m = new CreateCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n if (proto.conflict) {\n m.conflict = Conflict.fromProto(proto.conflict);\n }\n if (proto.entityType) {\n m.entityType = enumStringToValue$1(EntityType, proto.entityType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n if (typeof this.conflict !== 'undefined' && this.conflict !== null) {\n toReturn['conflict'] = 'toApiJson' in this.conflict ? this.conflict.toApiJson() : this.conflict;\n }\n if (typeof this.entityType !== 'undefined') {\n toReturn['entityType'] = this.entityType;\n }\n return toReturn;\n }\n}\nclass CreateWithoutConflictRequest {\n static fromProto(proto) {\n let m = new CreateWithoutConflictRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phoneNumbers !== 'undefined') {\n toReturn['phoneNumbers'] = this.phoneNumbers;\n }\n if (typeof this.emailAddresses !== 'undefined') {\n toReturn['emailAddresses'] = this.emailAddresses;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.origins !== 'undefined') {\n toReturn['origins'] = this.origins;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n if (typeof this.assignedRepFirstName !== 'undefined') {\n toReturn['assignedRepFirstName'] = this.assignedRepFirstName;\n }\n if (typeof this.assignedRepLastName !== 'undefined') {\n toReturn['assignedRepLastName'] = this.assignedRepLastName;\n }\n return toReturn;\n }\n}\nclass CreateWithoutConflictResponse {\n static fromProto(proto) {\n let m = new CreateWithoutConflictResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n if (proto.conflictingFields) {\n m.conflictingFields = proto.conflictingFields.map(ConflictingField.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n if (typeof this.conflictingFields !== 'undefined' && this.conflictingFields !== null) {\n toReturn['conflictingFields'] = 'toApiJson' in this.conflictingFields ? this.conflictingFields.toApiJson() : this.conflictingFields;\n }\n return toReturn;\n }\n}\nclass Customer {\n static fromProto(proto) {\n let m = new Customer();\n m = Object.assign(m, proto);\n if (proto.permissionToContact) {\n m.permissionToContact = new Date(proto.permissionToContact);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.deleted) {\n m.deleted = new Date(proto.deleted);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phoneNumbers !== 'undefined') {\n toReturn['phoneNumbers'] = this.phoneNumbers;\n }\n if (typeof this.emailAddresses !== 'undefined') {\n toReturn['emailAddresses'] = this.emailAddresses;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.origins !== 'undefined') {\n toReturn['origins'] = this.origins;\n }\n if (typeof this.permissionToContact !== 'undefined' && this.permissionToContact !== null) {\n toReturn['permissionToContact'] = 'toApiJson' in this.permissionToContact ? this.permissionToContact.toApiJson() : this.permissionToContact;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.deleted !== 'undefined' && this.deleted !== null) {\n toReturn['deleted'] = 'toApiJson' in this.deleted ? this.deleted.toApiJson() : this.deleted;\n }\n if (typeof this.vendorCustomerId !== 'undefined') {\n toReturn['vendorCustomerId'] = this.vendorCustomerId;\n }\n if (typeof this.assignedRepFirstName !== 'undefined') {\n toReturn['assignedRepFirstName'] = this.assignedRepFirstName;\n }\n if (typeof this.assignedRepLastName !== 'undefined') {\n toReturn['assignedRepLastName'] = this.assignedRepLastName;\n }\n return toReturn;\n }\n}\nclass CustomerFilters {\n static fromProto(proto) {\n let m = new CustomerFilters();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = DateRangeFilter.fromProto(proto.created);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.negateTags !== 'undefined') {\n toReturn['negateTags'] = this.negateTags;\n }\n return toReturn;\n }\n}\nclass CustomerHeaderMapping {\n static fromProto(proto) {\n let m = new CustomerHeaderMapping();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.emails !== 'undefined') {\n toReturn['emails'] = this.emails;\n }\n if (typeof this.phones !== 'undefined') {\n toReturn['phones'] = this.phones;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n return toReturn;\n }\n}\nclass GetMultiCustomersRequestCustomerIdentifiers {\n static fromProto(proto) {\n let m = new GetMultiCustomersRequestCustomerIdentifiers();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n return toReturn;\n }\n}\nclass CustomerOrigin {\n static fromProto(proto) {\n let m = new CustomerOrigin();\n m = Object.assign(m, proto);\n if (proto.count) {\n m.count = parseInt(proto.count, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.count !== 'undefined') {\n toReturn['count'] = this.count;\n }\n return toReturn;\n }\n}\nclass CustomerSortOptions {\n static fromProto(proto) {\n let m = new CustomerSortOptions();\n m = Object.assign(m, proto);\n if (proto.direction) {\n m.direction = enumStringToValue$1(CustomerSortDirection, proto.direction);\n }\n if (proto.field) {\n m.field = enumStringToValue$1(CustomerSortField, proto.field);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.direction !== 'undefined') {\n toReturn['direction'] = this.direction;\n }\n if (typeof this.field !== 'undefined') {\n toReturn['field'] = this.field;\n }\n return toReturn;\n }\n}\nclass DateRangeFilter {\n static fromProto(proto) {\n let m = new DateRangeFilter();\n m = Object.assign(m, proto);\n if (proto.beginRange) {\n m.beginRange = new Date(proto.beginRange);\n }\n if (proto.endRange) {\n m.endRange = new Date(proto.endRange);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.beginRange !== 'undefined' && this.beginRange !== null) {\n toReturn['beginRange'] = 'toApiJson' in this.beginRange ? this.beginRange.toApiJson() : this.beginRange;\n }\n if (typeof this.endRange !== 'undefined' && this.endRange !== null) {\n toReturn['endRange'] = 'toApiJson' in this.endRange ? this.endRange.toApiJson() : this.endRange;\n }\n return toReturn;\n }\n}\nclass DeleteCustomerRequest {\n static fromProto(proto) {\n let m = new DeleteCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass DesyncCustomersRequest {\n static fromProto(proto) {\n let m = new DesyncCustomersRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerIds !== 'undefined') {\n toReturn['customerIds'] = this.customerIds;\n }\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n return toReturn;\n }\n}\nclass GetCustomerRequest {\n static fromProto(proto) {\n let m = new GetCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n return toReturn;\n }\n}\nclass GetCustomerResponse {\n static fromProto(proto) {\n let m = new GetCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n return toReturn;\n }\n}\nclass GetMultiCustomersRequest {\n static fromProto(proto) {\n let m = new GetMultiCustomersRequest();\n m = Object.assign(m, proto);\n if (proto.customerIdentifiers) {\n m.customerIdentifiers = proto.customerIdentifiers.map(GetMultiCustomersRequestCustomerIdentifiers.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerIdentifiers !== 'undefined' && this.customerIdentifiers !== null) {\n toReturn['customerIdentifiers'] = 'toApiJson' in this.customerIdentifiers ? this.customerIdentifiers.toApiJson() : this.customerIdentifiers;\n }\n return toReturn;\n }\n}\nclass GetMultiCustomersResponse {\n static fromProto(proto) {\n let m = new GetMultiCustomersResponse();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n return toReturn;\n }\n}\nclass ListCustomerOriginsRequest {\n static fromProto(proto) {\n let m = new ListCustomerOriginsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass ListCustomerOriginsResponse {\n static fromProto(proto) {\n let m = new ListCustomerOriginsResponse();\n m = Object.assign(m, proto);\n if (proto.origins) {\n m.origins = proto.origins.map(CustomerOrigin.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.origins !== 'undefined' && this.origins !== null) {\n toReturn['origins'] = 'toApiJson' in this.origins ? this.origins.toApiJson() : this.origins;\n }\n return toReturn;\n }\n}\nclass ListCustomersRequest {\n static fromProto(proto) {\n let m = new ListCustomersRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n if (proto.sortOptions) {\n m.sortOptions = CustomerSortOptions.fromProto(proto.sortOptions);\n }\n if (proto.filters) {\n m.filters = CustomerFilters.fromProto(proto.filters);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.searchTerm !== 'undefined') {\n toReturn['searchTerm'] = this.searchTerm;\n }\n if (typeof this.sortOptions !== 'undefined' && this.sortOptions !== null) {\n toReturn['sortOptions'] = 'toApiJson' in this.sortOptions ? this.sortOptions.toApiJson() : this.sortOptions;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n return toReturn;\n }\n}\nclass ListCustomersResponse {\n static fromProto(proto) {\n let m = new ListCustomersResponse();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nclass SyncCustomersRequest {\n static fromProto(proto) {\n let m = new SyncCustomersRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerIds !== 'undefined') {\n toReturn['customerIds'] = this.customerIds;\n }\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n return toReturn;\n }\n}\nclass UpdateCustomerRequest {\n static fromProto(proto) {\n let m = new UpdateCustomerRequest();\n m = Object.assign(m, proto);\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phoneNumbers !== 'undefined') {\n toReturn['phoneNumbers'] = this.phoneNumbers;\n }\n if (typeof this.emailAddresses !== 'undefined') {\n toReturn['emailAddresses'] = this.emailAddresses;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n if (typeof this.assignedRepFirstName !== 'undefined') {\n toReturn['assignedRepFirstName'] = this.assignedRepFirstName;\n }\n if (typeof this.assignedRepLastName !== 'undefined') {\n toReturn['assignedRepLastName'] = this.assignedRepLastName;\n }\n return toReturn;\n }\n}\nclass UpdateCustomerResponse {\n static fromProto(proto) {\n let m = new UpdateCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n return toReturn;\n }\n}\nclass VendorAssociateCustomerIDRequest {\n static fromProto(proto) {\n let m = new VendorAssociateCustomerIDRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.vendorCustomerId !== 'undefined') {\n toReturn['vendorCustomerId'] = this.vendorCustomerId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n return toReturn;\n }\n}\nclass VendorCreateCustomerRequest {\n static fromProto(proto) {\n let m = new VendorCreateCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.vendorCustomerId !== 'undefined') {\n toReturn['vendorCustomerId'] = this.vendorCustomerId;\n }\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phoneNumbers !== 'undefined') {\n toReturn['phoneNumbers'] = this.phoneNumbers;\n }\n if (typeof this.emailAddresses !== 'undefined') {\n toReturn['emailAddresses'] = this.emailAddresses;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n if (typeof this.assignedRepFirstName !== 'undefined') {\n toReturn['assignedRepFirstName'] = this.assignedRepFirstName;\n }\n if (typeof this.assignedRepLastName !== 'undefined') {\n toReturn['assignedRepLastName'] = this.assignedRepLastName;\n }\n return toReturn;\n }\n}\nclass VendorCreateCustomerResponse {\n static fromProto(proto) {\n let m = new VendorCreateCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n if (typeof this.conflictingCustomerId !== 'undefined') {\n toReturn['conflictingCustomerId'] = this.conflictingCustomerId;\n }\n return toReturn;\n }\n}\nclass VendorDeleteCustomerRequest {\n static fromProto(proto) {\n let m = new VendorDeleteCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.vendorCustomerId !== 'undefined') {\n toReturn['vendorCustomerId'] = this.vendorCustomerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n return toReturn;\n }\n}\nclass VendorGetCustomerRequest {\n static fromProto(proto) {\n let m = new VendorGetCustomerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.vendorCustomerId !== 'undefined') {\n toReturn['vendorCustomerId'] = this.vendorCustomerId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n return toReturn;\n }\n}\nclass VendorGetCustomerResponse {\n static fromProto(proto) {\n let m = new VendorGetCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n if (typeof this.conflictingCustomerId !== 'undefined') {\n toReturn['conflictingCustomerId'] = this.conflictingCustomerId;\n }\n return toReturn;\n }\n}\nclass VendorListCustomerOriginsRequest {\n static fromProto(proto) {\n let m = new VendorListCustomerOriginsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass VendorListCustomerOriginsResponse {\n static fromProto(proto) {\n let m = new VendorListCustomerOriginsResponse();\n m = Object.assign(m, proto);\n if (proto.origins) {\n m.origins = proto.origins.map(CustomerOrigin.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.origins !== 'undefined' && this.origins !== null) {\n toReturn['origins'] = 'toApiJson' in this.origins ? this.origins.toApiJson() : this.origins;\n }\n return toReturn;\n }\n}\nclass VendorListCustomersRequest {\n static fromProto(proto) {\n let m = new VendorListCustomersRequest();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n if (proto.sortOptions) {\n m.sortOptions = CustomerSortOptions.fromProto(proto.sortOptions);\n }\n if (proto.filters) {\n m.filters = CustomerFilters.fromProto(proto.filters);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.searchTerm !== 'undefined') {\n toReturn['searchTerm'] = this.searchTerm;\n }\n if (typeof this.sortOptions !== 'undefined' && this.sortOptions !== null) {\n toReturn['sortOptions'] = 'toApiJson' in this.sortOptions ? this.sortOptions.toApiJson() : this.sortOptions;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n return toReturn;\n }\n}\nclass VendorListCustomersResponse {\n static fromProto(proto) {\n let m = new VendorListCustomersResponse();\n m = Object.assign(m, proto);\n if (proto.customers) {\n m.customers = proto.customers.map(Customer.fromProto);\n }\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customers !== 'undefined' && this.customers !== null) {\n toReturn['customers'] = 'toApiJson' in this.customers ? this.customers.toApiJson() : this.customers;\n }\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nclass VendorSyncAllCustomersRequest {\n static fromProto(proto) {\n let m = new VendorSyncAllCustomersRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n return toReturn;\n }\n}\nclass VendorUpdateCustomerRequest {\n static fromProto(proto) {\n let m = new VendorUpdateCustomerRequest();\n m = Object.assign(m, proto);\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.vendorCustomerId !== 'undefined') {\n toReturn['vendorCustomerId'] = this.vendorCustomerId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n if (typeof this.address !== 'undefined') {\n toReturn['address'] = this.address;\n }\n if (typeof this.city !== 'undefined') {\n toReturn['city'] = this.city;\n }\n if (typeof this.state !== 'undefined') {\n toReturn['state'] = this.state;\n }\n if (typeof this.country !== 'undefined') {\n toReturn['country'] = this.country;\n }\n if (typeof this.phoneNumbers !== 'undefined') {\n toReturn['phoneNumbers'] = this.phoneNumbers;\n }\n if (typeof this.emailAddresses !== 'undefined') {\n toReturn['emailAddresses'] = this.emailAddresses;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.origin !== 'undefined') {\n toReturn['origin'] = this.origin;\n }\n if (typeof this.permissionToContact !== 'undefined') {\n toReturn['permissionToContact'] = this.permissionToContact;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n if (typeof this.assignedRepFirstName !== 'undefined') {\n toReturn['assignedRepFirstName'] = this.assignedRepFirstName;\n }\n if (typeof this.assignedRepLastName !== 'undefined') {\n toReturn['assignedRepLastName'] = this.assignedRepLastName;\n }\n return toReturn;\n }\n}\nclass VendorUpdateCustomerResponse {\n static fromProto(proto) {\n let m = new VendorUpdateCustomerResponse();\n m = Object.assign(m, proto);\n if (proto.customer) {\n m.customer = Customer.fromProto(proto.customer);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customer !== 'undefined' && this.customer !== null) {\n toReturn['customer'] = 'toApiJson' in this.customer ? this.customer.toApiJson() : this.customer;\n }\n if (typeof this.conflictingCustomerId !== 'undefined') {\n toReturn['conflictingCustomerId'] = this.conflictingCustomerId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CustomerIdMapping {\n static fromProto(proto) {\n let m = new CustomerIdMapping();\n m = Object.assign(m, proto);\n if (proto.customerType) {\n m.customerType = enumStringToValue(CustomerType, proto.customerType);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n if (typeof this.vendorCustomerId !== 'undefined') {\n toReturn['vendorCustomerId'] = this.vendorCustomerId;\n }\n if (typeof this.customerType !== 'undefined') {\n toReturn['customerType'] = this.customerType;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n return toReturn;\n }\n}\nclass GetCustomerIdMappingRequest {\n static fromProto(proto) {\n let m = new GetCustomerIdMappingRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.customerId !== 'undefined') {\n toReturn['customerId'] = this.customerId;\n }\n if (typeof this.vendorAppId !== 'undefined') {\n toReturn['vendorAppId'] = this.vendorAppId;\n }\n return toReturn;\n }\n}\nclass GetCustomerIdMappingResponse {\n static fromProto(proto) {\n let m = new GetCustomerIdMappingResponse();\n m = Object.assign(m, proto);\n if (proto.customerIdMapping) {\n m.customerIdMapping = CustomerIdMapping.fromProto(proto.customerIdMapping);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.customerIdMapping !== 'undefined' && this.customerIdMapping !== null) {\n toReturn['customerIdMapping'] = 'toApiJson' in this.customerIdMapping ? this.customerIdMapping.toApiJson() : this.customerIdMapping;\n }\n return toReturn;\n }\n}\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'contacts-api.vendasta-local.com',\n 'test': '',\n 'demo': 'contacts-api-demo.vendasta-internal.com',\n 'prod': 'contacts-api-prod.vendasta-internal.com',\n 'production': 'contacts-api-prod.vendasta-internal.com'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet ContactEmailApiService = /*#__PURE__*/(() => {\n class ContactEmailApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createContactMessage(r) {\n const request = r.toApiJson ? r : new ContactMessageRequest(r);\n return this.http.post(this._host + \"/contacts.v1.ContactEmailService/CreateContactMessage\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ContactMessageResponse.fromProto(resp)));\n }\n }\n ContactEmailApiService.ɵfac = function ContactEmailApiService_Factory(t) {\n return new (t || ContactEmailApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n ContactEmailApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ContactEmailApiService,\n factory: ContactEmailApiService.ɵfac,\n providedIn: 'root'\n });\n return ContactEmailApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet ContactsApiService = /*#__PURE__*/(() => {\n class ContactsApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n create(r) {\n const request = r.toApiJson ? r : new CreateContactRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/Create\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateContactResponse.fromProto(resp)));\n }\n delete(r) {\n const request = r.toApiJson ? r : new DeleteContactRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/Delete\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n update(r) {\n const request = r.toApiJson ? r : new UpdateContactRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/Update\", request.toApiJson(), this.apiOptions()).pipe(map(resp => UpdateContactResponse.fromProto(resp)));\n }\n list(r) {\n const request = r.toApiJson ? r : new ListContactsRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/List\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListContactsResponse.fromProto(resp)));\n }\n listOrigins(r) {\n const request = r.toApiJson ? r : new ListOriginsRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/ListOrigins\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListOriginsResponse.fromProto(resp)));\n }\n associateId(r) {\n const request = r.toApiJson ? r : new AssociateIDRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/AssociateID\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n bulkCreate(r) {\n const request = r.toApiJson ? r : new BulkCreateContactRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/BulkCreate\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n bulkUpdate(r) {\n const request = r.toApiJson ? r : new BulkUpdateContactRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/BulkUpdate\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n triggerSync(r) {\n const request = r.toApiJson ? r : new TriggerSyncRequest(r);\n return this.http.post(this._host + \"/contacts.v1.Contacts/TriggerSync\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n ContactsApiService.ɵfac = function ContactsApiService_Factory(t) {\n return new (t || ContactsApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n ContactsApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ContactsApiService,\n factory: ContactsApiService.ɵfac,\n providedIn: 'root'\n });\n return ContactsApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet CustomerIdMappingApiService = /*#__PURE__*/(() => {\n class CustomerIdMappingApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n get(r) {\n const request = r.toApiJson ? r : new GetCustomerIdMappingRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerIdMappingService/Get\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetCustomerIdMappingResponse.fromProto(resp)));\n }\n }\n CustomerIdMappingApiService.ɵfac = function CustomerIdMappingApiService_Factory(t) {\n return new (t || CustomerIdMappingApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n CustomerIdMappingApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CustomerIdMappingApiService,\n factory: CustomerIdMappingApiService.ɵfac,\n providedIn: 'root'\n });\n return CustomerIdMappingApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet CustomerApiService = /*#__PURE__*/(() => {\n class CustomerApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n create(r) {\n const request = r.toApiJson ? r : new CreateCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/Create\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateCustomerResponse.fromProto(resp)));\n }\n delete(r) {\n const request = r.toApiJson ? r : new DeleteCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/Delete\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n update(r) {\n const request = r.toApiJson ? r : new UpdateCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/Update\", request.toApiJson(), this.apiOptions()).pipe(map(resp => UpdateCustomerResponse.fromProto(resp)));\n }\n get(r) {\n const request = r.toApiJson ? r : new GetCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/Get\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetCustomerResponse.fromProto(resp)));\n }\n getMultiCustomers(r) {\n const request = r.toApiJson ? r : new GetMultiCustomersRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/GetMultiCustomers\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiCustomersResponse.fromProto(resp)));\n }\n list(r) {\n const request = r.toApiJson ? r : new ListCustomersRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/List\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListCustomersResponse.fromProto(resp)));\n }\n bulkCreate(r) {\n const request = r.toApiJson ? r : new BulkCreateCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/BulkCreate\", request.toApiJson(), this.apiOptions()).pipe(map(resp => BulkCreateCustomerResponse.fromProto(resp)));\n }\n listCustomerOrigins(r) {\n const request = r.toApiJson ? r : new ListCustomerOriginsRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/ListCustomerOrigins\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListCustomerOriginsResponse.fromProto(resp)));\n }\n syncCustomers(r) {\n const request = r.toApiJson ? r : new SyncCustomersRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/SyncCustomers\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n desyncCustomers(r) {\n const request = r.toApiJson ? r : new DesyncCustomersRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/DesyncCustomers\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n bulkUpdate(r) {\n const request = r.toApiJson ? r : new BulkUpdateCustomersRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/BulkUpdate\", request.toApiJson(), this.apiOptions()).pipe(map(resp => BulkUpdateCustomersResponse.fromProto(resp)));\n }\n createWithoutConflict(r) {\n const request = r.toApiJson ? r : new CreateWithoutConflictRequest(r);\n return this.http.post(this._host + \"/contacts.v1.CustomerService/CreateWithoutConflict\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateWithoutConflictResponse.fromProto(resp)));\n }\n }\n CustomerApiService.ɵfac = function CustomerApiService_Factory(t) {\n return new (t || CustomerApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n CustomerApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CustomerApiService,\n factory: CustomerApiService.ɵfac,\n providedIn: 'root'\n });\n return CustomerApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet UserListApiService = /*#__PURE__*/(() => {\n class UserListApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createUserList(r) {\n const request = r.toApiJson ? r : new CreateUserListRequest(r);\n return this.http.post(this._host + \"/contacts.v1.UserList/CreateUserList\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n addUsersToList(r) {\n const request = r.toApiJson ? r : new AddUsersToListRequest(r);\n return this.http.post(this._host + \"/contacts.v1.UserList/AddUsersToList\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listUsersFromList(r) {\n const request = r.toApiJson ? r : new ListUsersFromListRequest(r);\n return this.http.post(this._host + \"/contacts.v1.UserList/ListUsersFromList\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListUsersFromListResponse.fromProto(resp)));\n }\n listUserLists(r) {\n const request = r.toApiJson ? r : new ListUserListsRequest(r);\n return this.http.post(this._host + \"/contacts.v1.UserList/ListUserLists\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListUserListsResponse.fromProto(resp)));\n }\n getUserList(r) {\n const request = r.toApiJson ? r : new GetUserListRequest(r);\n return this.http.post(this._host + \"/contacts.v1.UserList/GetUserList\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetUserListResponse.fromProto(resp)));\n }\n deleteUserFromList(r) {\n const request = r.toApiJson ? r : new DeleteUserFromListRequest(r);\n return this.http.post(this._host + \"/contacts.v1.UserList/DeleteUserFromList\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n UserListApiService.ɵfac = function UserListApiService_Factory(t) {\n return new (t || UserListApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n UserListApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UserListApiService,\n factory: UserListApiService.ɵfac,\n providedIn: 'root'\n });\n return UserListApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet VendorCustomerApiService = /*#__PURE__*/(() => {\n class VendorCustomerApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n vendorCreate(r) {\n const request = r.toApiJson ? r : new VendorCreateCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorCreate\", request.toApiJson(), this.apiOptions()).pipe(map(resp => VendorCreateCustomerResponse.fromProto(resp)));\n }\n vendorAssociateCustomerId(r) {\n const request = r.toApiJson ? r : new VendorAssociateCustomerIDRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorAssociateCustomerID\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n vendorUpdate(r) {\n const request = r.toApiJson ? r : new VendorUpdateCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorUpdate\", request.toApiJson(), this.apiOptions()).pipe(map(resp => VendorUpdateCustomerResponse.fromProto(resp)));\n }\n vendorDelete(r) {\n const request = r.toApiJson ? r : new VendorDeleteCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorDelete\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n vendorGet(r) {\n const request = r.toApiJson ? r : new VendorGetCustomerRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorGet\", request.toApiJson(), this.apiOptions()).pipe(map(resp => VendorGetCustomerResponse.fromProto(resp)));\n }\n vendorList(r) {\n const request = r.toApiJson ? r : new VendorListCustomersRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorList\", request.toApiJson(), this.apiOptions()).pipe(map(resp => VendorListCustomersResponse.fromProto(resp)));\n }\n vendorListCustomerOrigins(r) {\n const request = r.toApiJson ? r : new VendorListCustomerOriginsRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorListCustomerOrigins\", request.toApiJson(), this.apiOptions()).pipe(map(resp => VendorListCustomerOriginsResponse.fromProto(resp)));\n }\n vendorSyncAllCustomers(r) {\n const request = r.toApiJson ? r : new VendorSyncAllCustomersRequest(r);\n return this.http.post(this._host + \"/contacts.v1.VendorCustomerService/VendorSyncAllCustomers\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n VendorCustomerApiService.ɵfac = function VendorCustomerApiService_Factory(t) {\n return new (t || VendorCustomerApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n VendorCustomerApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: VendorCustomerApiService,\n factory: VendorCustomerApiService.ɵfac,\n providedIn: 'root'\n });\n return VendorCustomerApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Index.\n// *********************************\nlet CustomerService = /*#__PURE__*/(() => {\n class CustomerService {\n constructor(customerAPI) {\n this.customerAPI = customerAPI;\n }\n createCustomer(accountGroupId, partnerId, firstName, lastName, address, city, state, country, phoneNumbers, emailAddresses, tags, origins, permissionToContact) {\n return this.customerAPI.create({\n accountGroupId: accountGroupId,\n partnerId: partnerId,\n firstName: firstName,\n lastName: lastName,\n address: address,\n city: city,\n state: state,\n country: country,\n phoneNumbers: phoneNumbers,\n emailAddresses: emailAddresses,\n tags: tags,\n origins: origins,\n permissionToContact: permissionToContact\n });\n }\n updateCustomer(accountGroupId, customerId, firstName, lastName, address, city, state, country, phoneNumbers, emailAddresses, tags, origin, permissionToContact, fieldMask, assignedRepFirstName, assignedRepLastName) {\n return this.customerAPI.update({\n accountGroupId: accountGroupId,\n customerId: customerId,\n firstName: firstName,\n lastName: lastName,\n address: address,\n city: city,\n state: state,\n country: country,\n phoneNumbers: phoneNumbers,\n emailAddresses: emailAddresses,\n tags: tags,\n origin: origin,\n permissionToContact: permissionToContact,\n fieldMask: fieldMask,\n assignedRepFirstName: assignedRepFirstName,\n assignedRepLastName: assignedRepLastName\n });\n }\n bulkUpdateCustomers(accountGroupId, customerIds, permissionToContact) {\n return this.customerAPI.bulkUpdate({\n accountGroupId,\n customerIds,\n permissionToContact\n });\n }\n deleteCustomer(accountGroupId, customerId) {\n return this.customerAPI.delete({\n accountGroupId: accountGroupId,\n customerId: customerId\n });\n }\n getCustomer(accountGroupId, customerId) {\n return this.customerAPI.get({\n accountGroupId: accountGroupId,\n customerId: customerId\n });\n }\n getMultiCustomers(customerIdentifiers) {\n return this.customerAPI.getMultiCustomers({\n customerIdentifiers: customerIdentifiers\n });\n }\n listCustomers(accountGroupId, cursor, pageSize, searchTerm, filters, sortOptions) {\n return this.customerAPI.list({\n accountGroupId: accountGroupId,\n cursor: cursor,\n pageSize: pageSize,\n searchTerm: searchTerm,\n filters: filters,\n sortOptions: sortOptions\n });\n }\n bulkCreateCustomers(accountGroupId, partnerId, filePath, mapping) {\n return this.customerAPI.bulkCreate({\n partnerId: partnerId,\n accountGroupId: accountGroupId,\n filePath: filePath,\n mapping: mapping\n });\n }\n listCustomerOrigins(accountGroupId) {\n return this.customerAPI.listCustomerOrigins({\n accountGroupId: accountGroupId\n });\n }\n syncCustomers(accountGroupId, appId, customerIds) {\n return this.customerAPI.syncCustomers({\n accountGroupId,\n appId,\n customerIds\n });\n }\n desyncCustomers(accountGroupId, appId, customerIds) {\n return this.customerAPI.desyncCustomers({\n accountGroupId,\n appId,\n customerIds\n });\n }\n }\n CustomerService.ɵfac = function CustomerService_Factory(t) {\n return new (t || CustomerService)(i0.ɵɵinject(CustomerApiService));\n };\n CustomerService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: CustomerService,\n factory: CustomerService.ɵfac,\n providedIn: 'root'\n });\n return CustomerService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet UserListSdkService = /*#__PURE__*/(() => {\n class UserListSdkService {\n constructor(delegate) {\n this.delegate = delegate;\n }\n createUserList(partnerId, listName, listId) {\n const req = {\n partnerId: partnerId,\n listName: listName,\n listId: listId\n };\n return this.delegate.createUserList(req).pipe(map(resp => resp.status === 200));\n }\n addUsersToList(listId, userIds) {\n const req = {\n listId: listId,\n userIds: userIds\n };\n return this.delegate.addUsersToList(req).pipe(map(resp => resp.status === 200));\n }\n listUsersFromList(listId, cursor, pageSize) {\n const req = {\n listId: listId,\n pagingOptions: {\n cursor: cursor,\n pageSize: pageSize\n }\n };\n return this.delegate.listUsersFromList(req);\n }\n listUserLists(partnerId, cursor, pageSize) {\n const req = {\n partnerId: partnerId,\n pagingOptions: {\n cursor: cursor,\n pageSize: pageSize\n }\n };\n return this.delegate.listUserLists(req);\n }\n getUserList(listId) {\n const req = {\n listId: listId\n };\n return this.delegate.getUserList(req).pipe(map(r => r.userList));\n }\n deleteUserFromList(listId, userId) {\n const req = {\n listId: listId,\n userId: userId\n };\n return this.delegate.deleteUserFromList(req).pipe(map(resp => resp.status === 200));\n }\n }\n UserListSdkService.ɵfac = function UserListSdkService_Factory(t) {\n return new (t || UserListSdkService)(i0.ɵɵinject(UserListApiService));\n };\n UserListSdkService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UserListSdkService,\n factory: UserListSdkService.ɵfac,\n providedIn: 'root'\n });\n return UserListSdkService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ContactEmailService = /*#__PURE__*/(() => {\n class ContactEmailService {\n constructor(delegate) {\n this.delegate = delegate;\n }\n createContactMessage(accountGroupId, contactIds, subject, template, ccAddress, bccAddress, replyAddress) {\n const req = {\n accountGroupId: accountGroupId,\n contactIds: contactIds,\n subject: subject,\n template: template,\n ccAddress: ccAddress,\n bccAddress: bccAddress,\n replyAddress: replyAddress\n };\n return this.delegate.createContactMessage(req).pipe(map(resp => {\n return resp.responseMessage;\n }));\n }\n }\n ContactEmailService.ɵfac = function ContactEmailService_Factory(t) {\n return new (t || ContactEmailService)(i0.ɵɵinject(ContactEmailApiService));\n };\n ContactEmailService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ContactEmailService,\n factory: ContactEmailService.ɵfac,\n providedIn: 'root'\n });\n return ContactEmailService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { AddUsersToListRequest, AssociateIDRequest, BulkCreateContactRequest, BulkCreateCustomerRequest, BulkCreateCustomerResponse, BulkCreateCustomerValidationError, BulkUpdateContactRequest, BulkUpdateCustomersRequest, BulkUpdateCustomersResponse, Conflict, ConflictingField, Contact, ContactEmailApiService, ContactEmailService, ContactMessageRequest, ContactMessageResponse, ContactsApiService, CreateContactRequest, CreateContactResponse, CreateCustomerRequest, CreateCustomerResponse, CreateUserListRequest, CreateWithoutConflictRequest, CreateWithoutConflictResponse, Customer, CustomerApiService, CustomerFieldType, CustomerFilters, CustomerHeaderMapping, CustomerIdMapping, CustomerIdMappingApiService, CustomerOrigin, CustomerService, CustomerSortDirection, CustomerSortField, CustomerSortOptions, CustomerType, CustomerValidationError, DateRangeFilter, DeleteContactRequest, DeleteCustomerRequest, DeleteUserFromListRequest, DesyncCustomersRequest, EntityType, FieldMask, Filters, GetCustomerIdMappingRequest, GetCustomerIdMappingResponse, GetCustomerRequest, GetCustomerResponse, GetMultiCustomersRequest, GetMultiCustomersRequestCustomerIdentifiers, GetMultiCustomersResponse, GetUserListRequest, GetUserListResponse, HeaderMapping, HostService, ListContactsRequest, ListContactsResponse, ListCustomerOriginsRequest, ListCustomerOriginsResponse, ListCustomersRequest, ListCustomersResponse, ListOriginsRequest, ListOriginsResponse, ListUserListsRequest, ListUserListsResponse, ListUsersFromListRequest, ListUsersFromListResponse, PagedRequestOptions, PagedResponseMetadata, ReviewRequestStatus, SortDirection, SortField, SortOptions, SyncCustomersRequest, TriggerSyncRequest, UpdateContactRequest, UpdateContactResponse, UpdateCustomerRequest, UpdateCustomerResponse, UserListApiService, UserListItem, UserListSdkService, VendorAssociateCustomerIDRequest, VendorCreateCustomerRequest, VendorCreateCustomerResponse, VendorCustomerApiService, VendorDeleteCustomerRequest, VendorGetCustomerRequest, VendorGetCustomerResponse, VendorListCustomerOriginsRequest, VendorListCustomerOriginsResponse, VendorListCustomersRequest, VendorListCustomersResponse, VendorSyncAllCustomersRequest, VendorUpdateCustomerRequest, VendorUpdateCustomerResponse, WhiteLabeledOrigin };\n","import { Location } from '@angular/common';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport { ChangeDetectionStrategy, ChangeDetectorRef, Component, Inject, OnInit, inject, signal } from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { Router } from '@angular/router';\nimport { CustomerService, FieldMask } from '@vendasta/contacts';\nimport { ConversationChannel } from '@vendasta/conversation';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { BehaviorSubject, Observable, firstValueFrom, map, take } from 'rxjs';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n COMPANY_NAME_TOKEN,\n ConversationAvailableChannels,\n ConversationService,\n InboxContact,\n InboxService,\n MessageInfo,\n PARTNER_ID_TOKEN,\n ParticipantService,\n STANDARD_CRM_FIELD_EXTERNAL_IDS,\n USER_ID_TOKEN,\n redirectToConversationFactory,\n} from '../../../../core/src';\nimport { AlertOptions } from '../../../../core/src/lib/channels/conversation-channel.abstract';\nimport { SelectContactControl } from '../../components/inbox-select-contact/inbox-select-contact.component';\n\nconst DEFAULT_NEW_MESSAGE_AVAILABLE_CHANNELS = {\n availableChannels: [],\n preferredChannel: ConversationChannel.CONVERSATION_CHANNEL_UNDEFINED,\n};\n\n@Component({\n selector: 'inbox-new-message',\n templateUrl: './inbox-new-message.component.html',\n styleUrls: ['./inbox-new-message.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class InboxNewMessageComponent implements OnInit {\n isLoading = false;\n\n readonly selectControl = new SelectContactControl(null);\n\n readonly disabledAlert = signal(null);\n\n private readonly redirectToConversation = redirectToConversationFactory();\n\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN), { requireSync: true });\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN).pipe(), { requireSync: true });\n private readonly userId = toSignal(inject(USER_ID_TOKEN), { requireSync: true });\n\n //TODO: MEGA-896 remove feature flag validation when the email channel feature is released\n private readonly hasEmailAccess = toSignal(this.inboxService.canAccessEmailChannel$);\n private readonly isSMSChannelAvailable$ = this.conversationService.isSMSChannelAvailableForOrg$;\n\n readonly availableChannels$ = this.isSMSChannelAvailable$.pipe(\n map((smsAvailable) => {\n const availableChannels = [\n ...(smsAvailable ? [ConversationChannel.CONVERSATION_CHANNEL_SMS] : []),\n ...(this.hasEmailAccess() ? [ConversationChannel.CONVERSATION_CHANNEL_EMAIL] : []),\n ];\n return {\n availableChannels: availableChannels,\n preferredChannel: availableChannels[0] || ConversationChannel.CONVERSATION_CHANNEL_UNDEFINED,\n };\n }),\n );\n\n private readonly channelsToShow$$ = new BehaviorSubject(\n DEFAULT_NEW_MESSAGE_AVAILABLE_CHANNELS,\n );\n readonly channelsToShow$ = this.channelsToShow$$.asObservable();\n\n private readonly trackingProps = this.inboxService.buildTemplateTrackProperties();\n\n constructor(\n @Inject(COMPANY_NAME_TOKEN) readonly companyName$: Observable,\n private router: Router,\n private snackbarService: SnackbarService,\n private location: Location,\n private conversationService: ConversationService,\n private readonly analyticsService: ProductAnalyticsService,\n private customerService: CustomerService,\n private participantService: ParticipantService,\n private inboxService: InboxService,\n private cdRef: ChangeDetectorRef,\n ) {\n const routeData = this.router.getCurrentNavigation();\n if (routeData?.extras?.state?.contact) {\n this.selectControl.setValue(routeData.extras.state.contact);\n this.selectContact(routeData.extras.state.contact);\n }\n\n this.selectControl.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => {\n if (typeof value === 'object' && value.contactId) {\n this.startConversation();\n }\n });\n }\n\n ngOnInit(): void {\n this.conversationService.setCurrentFirestoreConversationId('');\n this.analyticsService.trackEvent('inbox', 'new-message', 'view');\n }\n\n async onSubmitDraft(messageInfo: MessageInfo): Promise {\n this.isLoading = true;\n\n try {\n const contact = this.selectControl.value;\n if (!contact || typeof contact === 'string') {\n this.snackbarService.openWithOptions(\n this.hasEmailAccess() ? 'INBOX.ERROR.INVALID_CONTACT_SELECTED' : 'INBOX.ERROR.NO_CONTACT_SELECTED',\n );\n return;\n }\n\n if (!contact.contactId && (contact.phone || contact.email)) {\n await this.addContactAndStartConversation(contact.phone ?? '', contact.email ?? '', messageInfo);\n this.isLoading = false;\n return;\n }\n\n if (contact.contactId) {\n if (!contact.permissionToContact) {\n this.updateCustomerPermissionToContact(contact);\n }\n\n this.conversationService.draftMessages = messageInfo;\n await this.startConversation();\n this.isLoading = false;\n }\n } finally {\n this.isLoading = false;\n }\n }\n\n async selectContact(contact: InboxContact): Promise {\n if (contact && (contact?.phone !== '' || contact?.email !== '')) {\n await this.startConversation();\n this.isLoading = false;\n }\n }\n\n private async startConversation(): Promise {\n const contact = this.selectControl.value as InboxContact;\n if (!contact || typeof contact === 'string') {\n this.snackbarService.openWithOptions(\n this.hasEmailAccess() ? 'INBOX.ERROR.INVALID_CONTACT_SELECTED' : 'INBOX.ERROR.NO_CONTACT_SELECTED',\n );\n return;\n }\n\n if (contact.phone === '' && contact.email === '') {\n this.snackbarService.openErrorSnack(\n this.hasEmailAccess() ? 'NO_PHONE_NUMBER_OR_EMAIL' : 'INBOX.ERROR.NO_PHONE_NUMBER',\n );\n return;\n }\n\n if (contact) {\n const platformLocation = this.inboxService.platformLocation;\n const conversationChannel = contact.phone\n ? ConversationChannel.CONVERSATION_CHANNEL_SMS\n : ConversationChannel.CONVERSATION_CHANNEL_EMAIL;\n\n // TODO: Add an PartnerType participant when this component is exposed to partners (SMS/Email for partners)\n const participantOrganization = this.participantService.buildAccountGroup(\n this.partnerId(),\n this.accountGroupId(),\n );\n const participantRecipient = this.participantService.buildContactParticipant(\n contact.contactId ?? '',\n this.partnerId(),\n this.accountGroupId(),\n );\n const participantSender = this.participantService.buildIamUser(\n this.partnerId(),\n this.accountGroupId(),\n this.userId(),\n false,\n );\n\n const trackingProps = await this.inboxService.buildTemplateTrackProperties();\n\n return firstValueFrom(\n this.conversationService.createConversation(\n [participantOrganization, participantSender, participantRecipient],\n conversationChannel,\n platformLocation,\n ),\n )\n .then((response) => {\n if (response && response.conversation) {\n this.analyticsService.trackEvent('inbox', 'new-message', 'create-conversation-success', 0, {\n trackingProps,\n channel: conversationChannel,\n });\n this.redirectToConversation(response.conversation.conversationId);\n }\n })\n .catch((httpErrorResponse: HttpErrorResponse) => {\n console.warn('Error to create a conversation: ', httpErrorResponse);\n this.snackbarService.openErrorSnack(httpErrorResponse?.error?.message);\n\n this.analyticsService.trackEvent('inbox', 'new-message', 'create-conversation-error', 0, {\n trackingProps,\n channel: conversationChannel,\n message: httpErrorResponse?.error?.message,\n });\n });\n }\n }\n\n private handleAddContactError(): (error: HttpErrorResponse) => Promise {\n return async (error: HttpErrorResponse) => {\n console.warn('onSubmitAddContact', error.message);\n if (error.status === 409) {\n this.snackbarService.openErrorSnack('INBOX.ERROR.CONTACT_EXISTS');\n } else {\n this.snackbarService.openErrorSnack('INBOX.ERROR.CREATE_CONTACT');\n }\n\n const trackingProps = await this.inboxService.buildTemplateTrackProperties();\n this.analyticsService.trackEvent('inbox', 'new-message', 'add-contact-error', 0, {\n trackingProps,\n channel: this.conversationService.getConversationChannel(),\n message: error?.message,\n });\n };\n }\n\n close(): void {\n this.location.back();\n }\n\n private async addContactAndStartConversation(\n phoneNumber: string,\n email: string,\n messageInfo: MessageInfo,\n ): Promise {\n const trackingProps = await this.inboxService.buildTemplateTrackProperties();\n\n if (email !== '') {\n const existingContact = await this.getCrmContactByField(STANDARD_CRM_FIELD_EXTERNAL_IDS.email, email);\n if (existingContact?.contactId) {\n this.analyticsService.trackEvent('inbox', 'new-message', 'get-contact-success', 0, {\n trackingProps,\n channel: ConversationChannel.CONVERSATION_CHANNEL_EMAIL,\n });\n this.conversationService.draftMessages = messageInfo;\n this.selectControl.setValue(existingContact);\n return;\n }\n }\n\n return firstValueFrom(\n this.participantService.addContact({\n firstName: '',\n lastName: '',\n phone: phoneNumber,\n email: email,\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n }),\n )\n .then((newContact) => {\n this.analyticsService.trackEvent('inbox', 'new-message', 'add-contact-success', 0, {\n trackingProps,\n channel: phoneNumber\n ? ConversationChannel.CONVERSATION_CHANNEL_SMS\n : ConversationChannel.CONVERSATION_CHANNEL_EMAIL,\n });\n if (!newContact?.lastName) {\n newContact.lastName = '';\n }\n\n if (newContact?.contactId === undefined) {\n this.snackbarService.openErrorSnack('INBOX.ERROR.CREATE_CONTACT');\n }\n\n if (newContact?.contactId) {\n this.conversationService.draftMessages = messageInfo;\n //Set newContact value to selectControl will trigger the subscription of it in constructor to call startConversation()\n this.selectControl.setValue(newContact);\n }\n })\n .catch(this.handleAddContactError());\n }\n\n private async getCrmContactByField(fieldId: string, value: string): Promise {\n const contacts = await firstValueFrom(\n this.participantService.getContactByField(this.accountGroupId(), fieldId, value),\n );\n return contacts?.[0] ?? ({} as InboxContact);\n }\n\n private updateCustomerPermissionToContact(contact: InboxContact): void {\n this.customerService\n .updateCustomer(\n contact.accountGroupId ?? '',\n contact.contactId ?? '',\n '',\n '',\n '',\n '',\n '',\n '',\n [],\n [],\n [],\n '',\n true,\n new FieldMask({ paths: ['PermissionToContact'] }),\n '',\n '',\n )\n .pipe(take(1))\n .subscribe();\n }\n\n async changeAvailableChannels(channel: ConversationChannel): Promise {\n const currentAvailableChannels = await firstValueFrom(this.availableChannels$);\n const channelsToShow = await firstValueFrom(this.channelsToShow$);\n this.disabledAlert.set(null);\n if (channel === ConversationChannel.CONVERSATION_CHANNEL_UNDEFINED) {\n if (channelsToShow.availableChannels.length > 0) {\n this.channelsToShow$$.next(DEFAULT_NEW_MESSAGE_AVAILABLE_CHANNELS);\n this.cdRef.markForCheck();\n return;\n }\n return;\n }\n\n if (currentAvailableChannels?.availableChannels.includes(channel)) {\n this.disabledAlert.set(null);\n this.channelsToShow$$.next({\n availableChannels: [channel],\n preferredChannel: channel,\n });\n } else {\n const alertMessage = await firstValueFrom(this.conversationService.displayAlertIfExists(null, channel));\n this.disabledAlert.set(alertMessage);\n }\n this.cdRef.markForCheck();\n return;\n }\n}\n","\n
\n
\n
\n

\n {{ 'INBOX.NEW_MESSAGE.NEW_MESSAGE_FROM' | translate }}:\n {{ companyName$ | async }}\n

\n
\n close\n
\n
\n \n
\n
\n \n {{ disabledAlert()?.title ?? '' | translate }}\n {{ disabledAlert()?.description ?? '' | translate }}\n \n
\n \n \n \n \n \n
\n","import { Injectable } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { SendMessage } from '../../../../core/src/lib/interface/conversation.interface';\n\n@Injectable()\nexport class InboxSendMessageResolver {\n constructor(private router: Router) {}\n\n resolve(): SendMessage {\n return this.router.getCurrentNavigation().extras?.state as SendMessage;\n }\n}\n","{\n \"INBOX\": {\n \"ALL\": \"All\",\n \"SAVE\": \"Save\",\n \"SUBMIT\": \"Submit\",\n \"LOADING_CONVERSATION\": \"We are loading your conversations...\",\n \"YOUR_EXPERT\": \"Your Expert\",\n \"CANCEL\": \"Cancel\",\n \"CLOSE\": \"Close\",\n \"CUSTOMERS\": \"Customers\",\n \"SETTINGS_LINK\": \"Inbox Settings\",\n \"MORE\": \"More\",\n \"DONE\": \"Done\",\n \"EDIT\": \"Edit\",\n \"NEXT\": \"Next\",\n \"DELETE\": \"Delete\",\n \"CREATE_NEW\": \"Create new\",\n \"DATE_CREATED\": \"Date created\",\n \"MORE_ACTIONS\": \"More actions\",\n \"CONVERSATION_SUMMARY\": \"Conversation summary\",\n \"ERROR_GETTING_CONVERSATION_SUMMARY\": \"Error getting conversation summary, try again later.\",\n \"EMPTY\": {\n \"TITLE\": \"Message your customers\",\n \"SMS_SUBTITLE\": \"Start an SMS conversation with your customers\",\n \"MESSAGE_SUBTITLE\": \"Start a conversation with your customers\",\n \"ACTION\": \"Send a message\",\n \"LEARN\": \"Learn about Inbox\"\n },\n \"UNSAVED_CHANGES\": {\n \"TITLE\": \"Unsaved changes\",\n \"MESSAGE\": \"Are you sure you want to leave? You will lose any unsaved changes.\",\n \"CONFIRM\": \"Discard changes\"\n },\n \"WELCOME\": {\n \"TITLE\": \"Welcome to Inbox\",\n \"SUBTITLE\": \"Where your team collaborates on great customer service.\",\n \"SMS_REGISTRATION_LINK_TEXT\": \"Register to send SMS messages\",\n \"GOOGLE_MESSAGES_LINK_TEXT\": \"Get messages from Google Maps and Search\",\n \"WEBCHAT_LINK_TEXT\": \"Capture leads from your website\"\n },\n \"WELCOME_CHAT_WITH_PARTNER\": {\n \"SUBTITLE_1\": \"Questions? We're available to help.\",\n \"SUBTITLE_2\": \"Chat directly with the team at {{ partnerBrandName }}.\"\n },\n \"SENDER\": {\n \"MARK_UNREAD\": \"Mark conversation as unread\",\n \"MARK_READ\": \"Mark conversation as read\",\n \"EDIT\": \"Edit\",\n \"VIEW_CONTACT\": \"View contact\",\n \"GO_TO_ACCOUNT\": \"Go to account\",\n \"OPEN_BUSINESS_APP\": \"Open Business App\",\n \"BLOCK\": \"Block\",\n \"UNSUBSCRIBE\": \"Unsubscribe\",\n \"OPEN_CONVERSATION\": \"Open conversation\",\n \"CLOSE_CONVERSATION\": \"Close conversation\",\n \"SUMMARIZE_CONVERSATION\": \"Summarize conversation\"\n },\n \"CHAT\": {\n \"ENTER_MESSAGE\": \"Enter message\",\n \"SEND\": \"Send\",\n \"SENDING\": \"Sending ...\",\n \"TYPING\": \"Typing ...\",\n \"FAILED_SENDING\": \"Failed to send message.\",\n \"HAS_PHONE_NUMBER\": \"Messages sent via {{ phone_number }}\",\n \"NO_PHONE_NUMBER\": \"You will be assigned an SMS number when you send your first message\",\n \"MEDIA_NOT_SUPPORTED\": \"This message contains a media file which cannot be displayed in Inbox currently. You may request they try sending it to you by another method.\",\n \"INSERT_REVIEW_LINK\": \"Ask for review\",\n \"NO_REVIEW_LINKS_FOUND\": \"Sorry there aren’t any review links yet. Add them in {{ cvWhiteLabelName }}\",\n \"SEND_MESSAGE\": \"Send message\",\n \"GET_ACCESS_TO_REVIEW_LINKS\": \"Get quick access to your review links from many sites and more...\",\n \"GET_ACCESS_TO_REVIEW_LINKS_CONTACT_US\": \"Get quick access to your review links from many sites and more. Contact us for more info.\",\n \"GET_ACCESS_TO_REVIEW_LINKS_ERROR\": \"Error getting data, please try again later.\",\n \"CONTACT_US\": \"Contact us\",\n \"SETUP_REVIEW_LINKS\": \"Setup review links\",\n \"AI_INFO\": \"Chat with Automated Assistant to get help with Vendasta platform, products and services. In training; may produce inaccurate information.\",\n \"AI_INFO_TITLE\": \"This conversation is private to you\",\n \"VIA_GOOGLE\": \"via Google\",\n \"VIA_FACEBOOK\": \"via Facebook\",\n \"VIA_INSTAGRAM\": \"via Instagram\",\n \"VIA_SMS\": \"via SMS\",\n \"VIA_EMAIL\": \"via Email\",\n \"VIA_WEBCHAT\": \"via Web Chat\",\n \"UNKNOWN_CONTACT\": \"Unknown Contact\",\n \"RESPOND_TO_LEAD_AT_PHONE_NUMBER\": \"Respond to this lead at {{phone}}.\",\n \"RESPOND_TO_LEAD_AT_EMAIL\": \"Respond to this lead at {{email}}.\",\n \"RESPOND_TO_LEAD_AT_PHONE_NUMBER_OR_EMAIL\": \"Respond to this lead at {{phone}} or {{email}}.\"\n },\n \"NEW_MESSAGE\": {\n \"NEW_MESSAGE\": \"New message\",\n \"NEW_MESSAGE_FROM\": \"New message from\",\n \"SEND_TO\": \"Send to:\",\n \"NAME\": \"Name\",\n \"PHONE_NUMBER_OR_CONTACT_NAME\": \"Phone number or contact name\",\n \"PHONE_NUMBER_EMAIL_OR_CONTACT_NAME\": \"Phone number, email or contact name\",\n \"EMAIL\": \"E-mail\",\n \"PHONE\": \"Phone\",\n \"FIRST_NAME\": \"First name\",\n \"LAST_NAME\": \"Last name\",\n \"NAME_OR_PHONE\": \"Name or phone\",\n \"CREATE_A_NEW_CONTACT\": \"Create a new contact\",\n \"ADD_CONTACT\": \"Add contact\",\n \"ADDING_CONTACT\": \"Adding contact ...\",\n \"SUGGESTED_CONTACTS\": \"Suggested contacts\",\n \"START_CONVERSATION\": \"Start conversation\"\n },\n \"ADD_CONTACT\": {\n \"ADD_CONTACT_FORM_HEADER\": \"Add contact: {{ businessName }}\"\n },\n \"ERROR\": {\n \"PERMISSION\": \"Sorry, you don't have permission to send a message in this chat\",\n \"PERMISSION_DENY\": \"You are currently unable to access partial conversations. Please reach out to your system administrator for the necessary permissions.\",\n \"CHAT_DELETED\": \"Sorry, this channel is inactivated to receive new messages\",\n \"CREATE_CONTACT\": \"Sorry, could not create contact\",\n \"CORRECT_INVALID_REQUIRED_FIELDS\": \"Please correct the required or invalid fields\",\n \"THE_MESSAGE_IS_EMPTY\": \"The message is empty\",\n \"NO_CONTACT_SELECTED\": \"Select a contact or enter a valid phone number to send a message\",\n \"INVALID_CONTACT_SELECTED\": \"Select an existing contact or provide a valid email address or phone number to send a message\",\n \"CONTACT_EXISTS\": \"A contact already exists with that phone number and/or email\",\n \"UNSUPPORTED_PHONE_NUMBER\": \"Unsupported number. Please try a different number, or select a contact from search results.\",\n \"INVALID_PHONE_NUMBER\": \"The phone number is invalid\",\n \"INVALID_INPUT\": \"The provided phone number or email is invalid\",\n \"DELETED_CUSTOMER\": \"Deleted Customer\",\n \"REQUIRED_FIELD\": \"This field is required\",\n \"INVALID_LENGTH_TOO_FEW_CHARACTERS\": \"Must be {{ min }} characters or more\",\n \"INVALID_EMAIL_ADDRESS\": \"Invalid email address\",\n \"PHONE_OR_EMAIL_REQUIRED\": \"A phone number or email address is required\",\n \"NO_PHONE_NUMBER\": \"Sorry, you are unable to send messages to this contact, as no phone number has been provided.\",\n \"NO_PHONE_NUMBER_OR_EMAIL\": \"Sorry, you are unable to send messages to this contact, as no phone number or e-mail has been provided.\",\n \"BROKEN_MEDIA_URL\": \"Image is expired or unavailable\"\n },\n \"POPOVER\": {\n \"BUSINESS_INITIATED_CONVERSATIONS\": \"Inbox SMS Number\",\n \"BUSINESS_INITIATED_CONVERSATIONS_DETAIL\": \"Your business is assigned an SMS number. You can share this number with customers. Please note, this number is for SMS text messages only. Calls cannot be received at this number.\",\n \"IN_PLATFORM_CHANNEL_MESSAGE_INFO\": \"Messages will be sent directly through the platform, and recipients will be notified.\",\n \"GOOGLE_BUSINESS_COMMUNICATIONS_CHANNEL_MESSAGE_INFO\": \"

This customer is reaching out via your business listing on Google Maps or Google Search. Your response will be delivered to them via Google Business Messages, and the customer can reply directly from your listing.

This conversation will automatically expire 30 days after the customer's last response. We recommend asking for their phone number or email address if you want to retain this customer.

\",\n \"NO_PHONE_NUMBER_PROVISIONED\": \"You will automatically be assigned a local sms number when you send your first message.\",\n \"IMPERSONATION_TITLE\": \"You're impersonating another user\",\n \"IMPERSONATION_TEXT\": \"Before sending messages from Inbox, make sure you're not impersonating another user.\"\n },\n \"INFO\": {\n \"DELETED\": \"Deleted\",\n \"PARTNER_PLATFORM_LABEL\": \"Messages sent via platform\",\n \"GOOGLE_BUSINESS_COMMUNICATIONS_LABEL\": \"Google Business Messages\",\n \"CONVERSATION_DETAILS\": \"Conversation details\",\n \"CONVERSATION_STATUS_OPENED\": \"Conversation opened\",\n \"CONVERSATION_STATUS_CLOSED\": \"Conversation closed\"\n },\n \"LABELS\": {\n \"VENDOR\": \"Vendor\",\n \"PARTNER\": \"Partner\",\n \"ACCOUNT\": \"Account\",\n \"CUSTOMER\": \"Customer\",\n \"APP\": \"App\",\n \"INACTIVE\": \"Inactive\",\n \"ACCOUNT_DELETED\": \"Account Deleted\"\n },\n \"TERMS_OF_SERVICE\": {\n \"TITLE\": \"Terms of Service\",\n \"FULL_TITLE\": \"Inbox Terms of Service\",\n \"INTRO_FIRST_LINE\": \"To continue, you need to agree to the \",\n \"ACCEPTANCE_MESSAGE\": \"I have read and agree to the Terms of Service\"\n },\n \"COMMON\": {\n \"ACTION_LABELS\": {\n \"DECLINE\": \"Decline\",\n \"ACCEPT\": \"Accept\",\n \"AGREE\": \"Agree\",\n \"GO_BACK\": \"Go back\",\n \"COPY\": \"Copy\"\n },\n \"SNACK_BAR_MESSAGE\": {\n \"COPY_SUCCESS\": \"Copied to clipboard\",\n \"CLICK_TO_COPY\": \"Click to copy\"\n }\n },\n \"REQUEST_PAYMENT\": {\n \"TITLE\": \"Send invoice\",\n \"FORM_LABEL\": \"Add items and create an invoice.\",\n \"ITEM_DESCRIPTION\": \"Item description\",\n \"ADD_ITEM\": \"Add item\",\n \"SUBTOTAL\": \"Subtotal:\",\n \"TAX\": \"Tax:\",\n \"TAX_TOOLTIP\": \"Tax is automatically calculated using the best matching tax rate.\",\n \"CONFIGURE_TAX_RATES\": \"Configure tax rates\",\n \"TOTAL\": \"Total:\",\n \"CANCEL\": \"Cancel\",\n \"CREATE\": \"Create invoice\",\n \"VIEW_INVOICES\": \"View invoices\",\n \"INVOICE_CREATE_SUCCESS\": \"Invoice created!\",\n \"INVOICE_CREATE_ERROR\": \"Failed to create invoice. Please try again.\"\n },\n \"UPLOAD_FILE\": {\n \"TITLE\": \"Add file\",\n \"SUCCESSFUL_UPLOAD\": \"Successfully uploaded {{fileName}} file\",\n \"MAX_FILES_EXCEEDED\": \"Only one attachment per message. Send message or remove attachment to add another.\",\n \"MAX_FILE_SIZE_EXCEEDED_ARG\": \"Max file size of {{maxFileSize}}MB exceeded ({{channel}} messaging limit). Please use a different file\",\n \"VOICE_RECORDING\": {\n \"TITLE\": \"Record audio clip\",\n \"STOP_RECORDING\": \"Stop recording\"\n }\n },\n \"MESSAGE_TEMPLATES\": {\n \"TITLE\": \"Insert templated message\",\n \"MODAL\": {\n \"EDIT_TEMPLATES\": \"Edit\",\n \"CREATE_TEMPLATE\": \"Create template\",\n \"EMPTY_STATE_TITLE\": \"Messaging Templates\",\n \"EMPTY_STATE_CONTENT\": \"There are no message templates yet. Customize your templates or create a new one and save time when responding to messages in your Inbox.\",\n \"ERROR\": \"Error inserting template, please try again\"\n }\n },\n \"PREVIEW_PANE\": {\n \"TITLE\": \"Inbox messages\",\n \"GO_TO_INBOX\": \"Go to Inbox\",\n \"EMPTY_STATE\": {\n \"INFO\": \"Start a conversation with this account.\",\n \"SEND_MESSAGE\": \"Send a message\"\n },\n \"LOAD_MORE\": \"Load more\",\n \"CURRENT_USER\": \"You\",\n \"DELETED_USER\": \"Deleted User\",\n \"SHARED_A_FILE\": \"Shared a file\"\n },\n \"HEADER\": {\n \"TITLE\": \"Inbox\",\n \"BETA\": \"BETA\",\n \"INBOX_AI_TITLE\": \"Automated Assistant\"\n },\n \"TOPBAR\": {\n \"ASSIGNEE\": \"Assignee\",\n \"NONE\": \"None\",\n \"ERROR_LOADING_RECIPIENT\": \"Error loading recipients information\"\n },\n \"SETTINGS\": {\n \"PAGE_TITLE\": \"Inbox settings\",\n \"CHAT_AVAILABILITY\": \"Chat availability\",\n \"DISPLAY_AVAILABILITY_MESSAGE\": \"Display availability message\",\n \"AVAILABILITY_DESCRIPTION\": \"All recipients in conversations with you will see your organization’s availability message at the top of their message window\",\n \"AVAILABILITY_MESSAGE\": \"Availability message\",\n \"PREVIEW_TITLE\": \"Preview\",\n \"SAVE_SUCCESSFUL\": \"Settings saved successfully\",\n \"ERROR_SAVING_SETTINGS\": \"Error saving settings\",\n \"ERROR_LOADING_SETTINGS\": \"Error loading settings\",\n \"PREVIEW\": {\n \"TITLE\": \"Organization Name\"\n },\n \"AUTOMATIONS\": \"Automations\",\n \"AUTOMATIONS_DESCRIPTION\": \"You can further enhance Inbox features by creating automated workflows.\",\n \"GO_TO_AUTOMATIONS\": \"Go to Automations\",\n \"LEARN_MORE\": \"Learn more\",\n \"EMPTY_STATE\": {\n \"TITLE\": \"Inbox settings coming soon\",\n \"DESCRIPTION\": \"We’re working on ways to let you customize your inbox. Stay tuned.\"\n },\n \"ACTIVE\": \"Active\",\n \"INACTIVE\": \"Setup required\",\n \"DISCONNECT\": \"Disconnect\",\n \"FACEBOOK_MESSENGER\": {\n \"TITLE\": \"Facebook Messenger\",\n \"DESCRIPTION\": \"Receive and respond to Facebook Messenger inquiries in your Inbox.\",\n \"DISCONNECTED_DESCRIPTION\": \"Connect a verified account to gain access to Facebook Messenger inquiries directly in your Inbox.\",\n \"FACEBOOK_PAGE_NAME\": \"Facebook Page\",\n \"CONNECT\": \"Connect Facebook\",\n \"SIGN_IN_TO_FACEBOOK\": \"Sign in with Facebook\",\n \"RECONNECT\": \"Reconnect\",\n \"TURN_ON_MESSAGING\": \"Turn on messaging\",\n \"DISCONNECT\": \"Disconnect\",\n \"DISCONNECT_TITLE\": \"Are you sure you want to disconnect Facebook Messenger?\",\n \"DISCONNECT_DESCRIPTION\": \"You will no longer be able to receive or respond to messages from Facebook Messenger in your Inbox.\",\n \"SUCCESS\": {\n \"SUCCESSFULLY_ENABLED\": \"Successfully enabled Facebook Messenger\",\n \"SUCCESSFULLY_DISABLED\": \"Successfully disabled Facebook Messenger\"\n },\n \"WARNINGS\": {\n \"MULTIPLE_PAGES_LINKED\": \"Multiple Facebook Pages linked\",\n \"MULTIPLE_PAGE_FIRST_SELECTED\": \"The page you will setup for Facebook Messenger is {{ pageName }}.\",\n \"MULTIPLE_PAGES_LINKED_DESCRIPTION\": \"You have linked multiple Facebook pages to your account but may only use one with Inbox Pro.\"\n },\n \"ERRORS\": {\n \"FAILED_TO_ENABLE\": \"Failed to enable Facebook Messenger. Please contact support if the issue persists.\",\n \"FAILED_TO_DISABLE\": \"Failed to disable Facebook Messenger. Please contact support if the issue persists.\",\n \"UNKNOWN_ERROR\": \"An unknown error occurred.\",\n \"PERMISSIONS_ERROR\": \"A permissions error occurred.\",\n \"PERMISSIONS_ERROR_DESCRIPTION\": \"You do not have the necessary permissions to make changes to this connection. Please contact support for assistance.\",\n \"PLEASE_TRY_RECONNECTING\": \"Please try reconnecting.\",\n \"RECONNECT_TO_GRANT_PERMISSIONS\": \"Please reconnect to Facebook to grant additional messaging permissions for your Facebook page.\",\n \"CANNOT_SEND_MESSAGE\": \"Unable to reply with Facebook Messenger\",\n \"CANNOT_SEND_MESSAGE_DESCRIPTION\": \"This conversation has timed out, and can no longer be replied to.\"\n }\n },\n \"GOOGLE_BUSINESS_MESSAGES\": {\n \"GRANT_ACCESS\": \"Grant access\",\n \"GOOGLE_BUSINESS_PROFILE_REQUIRED\": \"Google Business Profile required\",\n \"FETCH_STATE_FAILED\": \"Failed to fetch Google Business Messages launch state.\",\n \"INSUFFICIENT_PERMISSIONS\": \"You do not have the necessary permissions to make changes.\",\n \"RECONNECT_GBP\": \"Authorization needed\",\n \"INSUFFICIENT_PERMISSIONS_DETAIL\": \"In order to set up Google Business Messages you must reauthorize your Google Business Profile. This may affect your Google Analytics history\",\n \"RECONNECT_GBP_DETAIL\": \"In order to connect Google Business Messages you must reauthorize your Google Business Profile. If a different account is connected, this will affect all apps that use this connection.\",\n \"ERROR_CONNECTING\": \"Error connecting\",\n \"ERROR_DISCONNECTING\": \"Error disconnecting\",\n \"FAILED_TO_TURN_ON\": \"Failed to turn on Google Business Messages. Please contact support if the issue persists. Account ID: {{ accountId }}\",\n \"FAILED_TO_TURN_ON_ALREADY_CONNECTED_TO_OTHER_APP\": \"

Your Google Business Profile is connected to another messaging partner. To connect Google Business Messages to Inbox Pro, disconnect the other messaging partner or contact support.

If you contact support, we'll ask Google to disconnect your account from the other partner. Google may take up to a week to complete the disconnection process manually.\",\n \"FAILED_TO_TURN_OFF\": \"Failed to turn off Google Business Messages. Please contact support if the issue persists. Account ID: {{ accountId }}\",\n \"DESCRIPTION\": \"Receive and respond to Google Business Profile inquiries in your inbox.\",\n \"TITLE\": \"Google Business Messages\",\n \"LABEL\": \"Enable messaging\",\n \"AUTHORIZE\": \"Sign in with Google\",\n \"PROBLEM_WITH_CONNECTION\": \"There was a problem with your connection.\",\n \"RECONNECT_DESCRIPTION\": \"Try reconnecting. This may affect your Google Analytics history\",\n \"GOOGLE_PROFILE_ERROR\": \"In order to set up Google Business Messages, you must connect a verified Google Business Profile.\",\n \"CONNECTIONS\": \"Connections\",\n \"CONNECT\": \"Connect\",\n \"RECONNECT\": \"Reconnect\",\n \"DISCONNECT\": \"Disconnect\",\n \"CONFIRM_DISCONNECT_TITLE\": \"Disconnect Google Business Profile\",\n \"CONFIRM_DISCONNECT_DESCRIPTION\": \"

Are you sure you want to disconnect your Google Business Profile?

You will no longer be able to receive or respond to messages from your Google Business Profile in Inbox.\",\n \"DISCLAIMER\": \"It may take up to 24 hours for the 'chat' option to become available on Google Maps and Google Search.\",\n \"BUSINESS_NAME\": \"Business name\",\n \"CONNECT_DESCRIPTION\": \"Setup Google Business Messages to begin receiving messages from Google Maps and Google Search leads.\",\n \"DISCONNECTED_DESCRIPTION\": \"Google Business Messages from Google Maps & Google Search leads will appear in Inbox. Disconnect to stop receiving these messages in Inbox.\",\n \"ACTIONS\": {\n \"GO_TO_SETTINGS\": \"Go to settings\"\n },\n \"STATUS\": {\n \"NOT_LAUNCHED\": {\n \"TITLE\": \"Business Messages is not enabled\",\n \"DESCRIPTION\": \"Google Business Messages has been disabled for this account. You can re-enable it by visiting the Inbox Settings page.\"\n },\n \"NOT_ENABLED\": {\n \"TITLE\": \"Business Messages is disabled\",\n \"DESCRIPTION\": \"Google Business Messages is disabled for this account. To enable it, please contact your account administrator.\"\n },\n \"EXPIRED_CONVERSATION\": {\n \"TITLE\": \"Conversation has expired\",\n \"DESCRIPTION\": \"Google Business Messages conversations expire after 30 days from the customer's last message, and responses can no longer be provided beyond that point.\"\n },\n \"UNKNOWN_ERROR\": {\n \"TITLE\": \"Unknown error\",\n \"DESCRIPTION\": \"An unknown error occurred. Please contact support, or try again later.\"\n },\n \"INVALID_TOKEN\": {\n \"TITLE\": \"Google Business Profile disconnected\",\n \"DESCRIPTION\": \"This conversation was initiated from your Google Business Profile, but your profile is no longer connected. To continue the conversation, please reconnect your profile.\"\n }\n }\n },\n \"INSTAGRAM_MESSAGES\": {\n \"TITLE\": \"Instagram Messages\",\n \"DESCRIPTION\": \"Receive and respond to Instagram Messages in your Inbox.\",\n \"DISCONNECTED_DESCRIPTION\": \"Connect through Facebook with a verified account to gain access.\",\n \"SIGN_IN_TO_INSTAGRAM\": \"Sign in with Instagram\",\n \"INSTAGRAM_PAGE_NAME\": \"Connected account\",\n \"CONNECT\": \"Connect Instagram\",\n \"RECONNECT\": \"Reconnect\",\n \"TURN_ON_MESSAGING\": \"Turn on messaging\",\n \"DISCONNECT\": \"Disconnect\",\n \"DISCONNECT_TITLE\": \"Are you sure you want to disconnect Instagram Messages?\",\n \"DISCONNECT_DESCRIPTION\": \"You will no longer be able to receive or respond to Instagram Messages in your Inbox.\",\n \"SUCCESS\": {\n \"SUCCESSFULLY_ENABLED\": \"Successfully enabled Instagram Messages\",\n \"SUCCESSFULLY_DISABLED\": \"Successfully disabled Instagram Messages\"\n },\n \"WARNINGS\": {\n \"MULTIPLE_PAGES_LINKED\": \"Multiple Instagram Pages linked\",\n \"MULTIPLE_PAGE_FIRST_SELECTED\": \"The page you will setup for Instagram Messages is {{ pageName }}.\",\n \"MULTIPLE_PAGES_LINKED_DESCRIPTION\": \"You have linked multiple Instagram pages to your account but may only use one with Inbox Pro.\"\n },\n \"ERRORS\": {\n \"FAILED_TO_ENABLE\": \"Failed to enable Instagram Messages. Please contact support if the issue persists.\",\n \"FAILED_TO_DISABLE\": \"Failed to disable Instagram Messages. Please contact support if the issue persists.\",\n \"UNKNOWN_ERROR\": \"An unknown error occurred.\",\n \"PERMISSIONS_ERROR\": \"A permissions error occurred.\",\n \"PERMISSIONS_ERROR_DESCRIPTION\": \"You do not have the necessary permissions to make changes to this connection. Please contact support for assistance.\",\n \"PLEASE_TRY_RECONNECTING\": \"Please try reconnecting.\",\n \"RECONNECT_TO_GRANT_PERMISSIONS\": \"Please reconnect to Instagram to grant additional messaging permissions for your Instagram page.\",\n \"CANNOT_SEND_MESSAGE\": \"Unable to reply with Instagram Messages\",\n \"CANNOT_SEND_MESSAGE_DESCRIPTION\": \"This conversation has expired, or there is an issue with the Instagram connection.\"\n }\n },\n \"SMS_MESSAGES\": {\n \"COMPOSER_A2P_REGISTRATION_REQUIRED\": {\n \"TITLE\": \"SMS Registration Required\",\n \"DESCRIPTION\": \"SMS Registration Required – US telecom companies require businesses to register to send SMS messages. Register your business to continue this conversation via SMS.\",\n \"ACTION_TITLE\": \"View registration\"\n },\n \"NOT_ENABLED\": {\n \"TITLE\": \"SMS Messages is disabled\",\n \"DESCRIPTION\": \"SMS messaging is not enabled for your account.\"\n },\n \"NO_PHONE_NUMBER\": {\n \"TITLE\": \"SMS Messages not available\",\n \"DESCRIPTION\": \"SMS phone number not available. Please contact support if the issue persists\"\n }\n },\n \"MANAGE_ON_WEB\": \"Manage on web\",\n \"MANAGE_ON_WEB_ERROR\": \"Failed to open the web page.\",\n \"SMS_REGISTRATION\": \"SMS Registration\",\n \"INBOX_SETTINGS\": \"Inbox Settings\",\n \"EMAIL_SETTINGS\": {\n \"TITLE\": \"Email\",\n \"DESCRIPTION\": \"Sender info preview\",\n \"FORWARDING_ADDRESS\": \"Forwarding address\",\n \"FORWARDING_ADDRESS_DESCRIPTION\": \"Set up email forwarding on an external email account to forward emails to Inbox\",\n \"SENDER_PREVIEW_INFO_DESCRIPTION\": \"The sender name is automatically set as your logged in name and business profile name.\",\n \"FORWARDING_LEARN_MORE_TITLE\": \"Assigned email\",\n \"FORWARDING_LEARN_MORE_DESCRIPTION\": \"Your email send address for email messages sent out of Inbox, can be configured in email settings.\",\n \"CLOSE_BUTTON\": \"Close\",\n \"LEARN_MORE\": \"Learn more\",\n \"USER_AT_COMPANY\": \"{{firstName}} at {{companyName}}\",\n \"COMPANY_ONLY\": \"{{companyName}}\",\n \"FORWARDING_ADDRESS_INFO\": \"What is a forwarding address?

Forwarding email addresses are email addresses that automatically forward incoming emails to another email address. They act as a bridge, receiving emails and then sending them on to a final destination.

How does a forwarding email address work?

To set up a forwarding address, you can either create it on your email server or use a dedicated forwarding service. Once set up, all emails sent to the forwarding address will be automatically forwarded to your Inbox.

Why use a forwarding email address?

There are various reasons to use forwarding email addresses, such as during temporary projects or events, to monitor or track incoming emails, or to create an alias for multiple recipients. However, there are also important considerations to keep in mind.

Important considerations:

It's crucial to test the forwarding address by sending a test email to ensure that it's working correctly and that emails are being received at the intended destination. You should also exercise caution when using forwarding services, as some free options might expose your emails to third-party access or advertising.

Furthermore, forwarded emails might inherit spam filtering settings from the forwarding address, potentially affecting delivery. Therefore, avoiding creating complex forwarding chains is important, as multiple forwards can disrupt communication flow and cause delays.

\",\n \"FORWARDING_ADDRESS_INFO_TITLE\": \"Understanding Forwarding Email Addresses\"\n },\n \"MESSAGE_TEMPLATES\": {\n \"TITLE\": \"Messaging templates\",\n \"DESCRIPTION\": \"Create text messaging templates to save time when responding to messages in Inbox.\",\n \"GO_TO_MESSAGE_TEMPLATES\": \"Customize templates\",\n \"EDIT_TEMPLATE\": \"Edit template\",\n \"DELETE_TEMPLATE\": \"Delete template\",\n \"TEMPLATE_NAME\": \"Name\",\n \"TEMPLATE_CONTENT\": \"Content\",\n \"CREATE_TEMPLATE\": \"Create template\",\n \"CREATE_TEMPLATE_SUCCESSFUL\": \"Template is created successfully\",\n \"CREATE_TEMPLATE_FAILED\": \"An error occurred while creating the template\",\n \"TEMPLATE_MISSING_FIELDS\": \"Some fields are required\",\n \"UPDATE_TEMPLATE_SUCCESSFUL\": \"Template is successfully updated\",\n \"UPDATE_TEMPLATE_FAILED\": \"An error occurred while updating the template\",\n \"LOAD_TEMPLATE_FAILED\": \"An error occurred while loading the template\",\n \"DELETE_TEMPLATE_MODAL\": {\n \"TITLE\": \"Delete template\",\n \"DESCRIPTION\": \"Are you sure you want to delete this template?\"\n }\n },\n \"WEBCHAT_CONFIGURATION\": \"Web Chat configuration\"\n },\n \"VIEWS\": {\n \"ALL_CONVERSATIONS\": \"All conversations\",\n \"NOTIFICATIONS\": \"Notifications\",\n \"SETTINGS\": \"Settings\",\n \"TOGGLE_LABEL\": \"Menu\",\n \"FOLLOW\": \"Follow\",\n \"FOLLOWING\": \"Following\",\n \"FAILED_FOLLOW\": \"Failed change follow status.\",\n \"SUCCESS_FOLLOW\": \"You are now following this conversation.\",\n \"BANNER_INFO_HEADING\": \"Messaging views are here!\",\n \"BANNER_INFO_BODY\": \"Focus on the conversations that matter most to you by adding them to your ★ Following view.\"\n },\n \"DETAILS\": {\n \"TITLE\": \"Conversation details\",\n \"LOADING_ERROR\": \"Error loading conversation details\"\n },\n \"TICKETS\": {\n \"TITLE\": \"Tickets\",\n \"VIEW_MORE\": \"View more\",\n \"VIEW_LESS\": \"View less\",\n \"CREATE\": \"Create ticket\",\n \"VIEW\": \"View ticket\",\n \"OPEN_TITLE\": \"Open tickets\",\n \"CLOSED_TITLE\": \"Closed tickets\",\n \"NO_TICKETS\": \"No {{status}} tickets\",\n \"NO_TICKETS_DESCRIPTION\": \"Congratulations you are all caught up\",\n \"LOAD_MORE\": \"Load more\",\n \"ERROR_TICKETS\": \"Error loading {{status}} tickets. Please refresh.\"\n },\n \"DATE\": {\n \"TODAY\": \"Today\",\n \"YESTERDAY\": \"Yesterday\",\n \"AT\": \"at\",\n \"MINS_AGO\": \"mins ago\",\n \"JUST_NOW\": \"Just now\"\n },\n \"EVENTS\": {\n \"UNSUBSCRIBED\": \"A recipient unsubscribed from your messages\"\n },\n \"WARNING\": {\n \"TURN_ON_NOTIFICATIONS\": \"Turn on notifications \",\n \"TURN_ON_NOTIFICATIONS_DETAILS\": \"— To be notified of new messages in this conversation, turn on “Only my events” in your \",\n \"NOTIFICATION_SETTINGS\": \"Notification settings.\",\n \"NOTIFICATION_UPDATE_SUCCESS\": \"Notification settings updated successfully\",\n \"NOTIFICATION_UPDATE_ERROR\": \"Error updating notification settings\",\n \"A2P_BANNER_TITLE\": \"Action required immediately\",\n \"A2P_BANNER_DESCRIPTION\": \"SMS messages are being blocked by telecoms for unregistered businesses. Fill out your business details now to minimize downtime of message deliverability.\",\n \"A2P_BANNER_ACTION\": \"Update business info\",\n \"A2P_REJECTED_BANNER_DESCRIPTION\": \"- Your SMS registration was rejected. Please correct your application and resubmit.\",\n \"A2P_REJECTED_BANNER_ACTION\": \"View submission\"\n },\n \"WEBCHAT\": {\n \"SETTINGS\": {\n \"INSTALLATION\": \"Installation\",\n \"WEBSITE_INSTALLATION\": \"Website\",\n \"WORD_PRESS_INSTALLATION\": \"WordPress\",\n \"INSTALL_INSTRUCTIONS\": \"Copy and paste this code into the head element of your website, typically just before the closing tag.\",\n \"INSTALL_INSTRUCTIONS_READ_MORE\": \"Read detailed instructions\",\n \"GTM_TITLE\": \"Google Tag Manager\",\n \"GTM_DESCRIPTION\": \"You can use this code with Google Tag Manager to embed Web Chat on your site.\",\n \"WORD_PRESS_INSTALL_INSTRUCTIONS\": \"Integrate chat into your WordPress site with our easy to use plugin.\",\n \"WORD_PRESS_INSTALL_INSTRUCTIONS_DETAILS\": \"Upload and activate this plugin on your website at yoursite.com/wp-admin/ > Plugins > Add New Plugin\",\n \"WORD_PRESS_DOWNLOAD\": \"Download WordPress plugin\",\n \"SUCCESS_WORD_PRESS_DOWNLOAD\": \"Downloaded file saved to {{directory}}\",\n \"TITLE\": \"Web Chat\",\n \"DESCRIPTION\": \"Capture new leads from your website with an AI-assisted chat widget.\",\n \"LEARN_MORE\": \"Learn more\",\n \"ENABLED_WEBCHAT\": \"Enable Web Chat\",\n \"ENABLED_DESCRIPTION\": \"Once installed on your website, new leads will appear in your Inbox.\",\n \"CONFIGURE_WEBCHAT\": \"Configure Web Chat\",\n \"SETUP_WEBCHAT\": \"Setup Web Chat\",\n \"SETUP_REQUIRED\": \"Setup required\",\n \"NOT_ACTIVE\": \"Not active\",\n \"SOMETHING_WENT_WRONG\": \"Something went wrong.\",\n \"WIDGET_NAME\": \"Widget name\",\n \"WIDGET_NAME_DESCRIPTION\": \"A unique name to identify this widget internally.\",\n \"WEBCHAT_GREETING\": \"Web Chat greeting\",\n \"WEBCHAT_GREETING_DESCRIPTION\": \"This is the message that will appear when a customer first opens the chat window.\",\n \"WEBCHAT_GREETING_PLACEHOLDER\": \"Hi, how can we help you today?\",\n \"APPEARANCE\": \"Appearance\",\n \"PRIMARY_COLOR\": \"Primary color\",\n \"TEXT_COLOR\": \"Primary text color\",\n \"ACCENT_COLOR\": \"Accent color (send button and chat bubbles)\",\n \"ACCENT_TEXT_COLOR\": \"Accent text color\",\n \"LIGHT\": \"Light\",\n \"DARK\": \"Dark\",\n \"INVALID_COLOR\": \"Invalid format of \\\"#rrggbb\\\", where rr, gg, bb are two-digit hexadecimal characters.\",\n \"WEBCHAT_UPDATED\": \"Web Chat updated successfully.\",\n \"WEBCHAT_UPDATE_ERROR\": \"Error updating Web Chat.\",\n \"WEBCHAT_CREATED\": \"Web Chat created successfully.\",\n \"WEBCHAT_CREATE_ERROR\": \"Error creating Web Chat.\",\n \"WEBCHAT_VALIDATION_ERROR\": \"Please correct the invalid fields before saving.\",\n \"WEBCHAT_DISABLED\": \"Web Chat replies not available.\",\n \"WEBCHAT_DISABLED_MISSING_CONTACT_INFO\": \"You will be able to respond once the web visitor provides their contact information.\",\n \"WEBCHAT_DISABLED_NO_SMS_PHONE\": \"Respond to this lead at {{phone}}.\",\n \"WEBCHAT_DISABLED_NO_SMS_EMAIL\": \"Respond to this lead at {{email}}.\",\n \"WEBCHAT_DISABLED_NO_SMS_EMAIL_PHONE\": \"Respond to this lead at {{phone}} or {{email}}.\",\n \"WEBCHAT_ASSISTANT_TITLE\": \"AI assistant\",\n \"BUSINESS_PROFILE\": {\n \"BUSINESS_PROFILE\": \"Business Profile\",\n \"ALLOW_ACCESS\": \"Allow access to your business profile\",\n \"DESCRIPTION\": \"Answer questions about your business contact information, hours, products and services you offer.\",\n \"MANAGE_BUSINESS_PROFILE\": \"Manage business profile\",\n \"LEARN_MORE\": {\n \"TITLE\": \"Learn more\",\n \"WHAT_INFORMATION_QUESTION\": \"What information is made available to your AI assistant?\",\n \"WHAT_INFORMATION\": \"These fields are shared from your business profile:\",\n \"BUSINESS_NAME\": \"Business name\",\n \"ADDRESS_SERVICE_AREAS\": \"Address and/or service areas\",\n \"WEBSITE\": \"Website\",\n \"PHONE_NUMBER\": \"Phone number\",\n \"CATEGORIES\": \"Categories\",\n \"HOURS\": \"Hours\",\n \"SERVICES_OFFERED\": \"Services offered\",\n \"SHORT_DESCRIPTION\": \"Short description\",\n \"LONG_DESCRIPTION\": \"Long description\",\n \"SOCIAL_MEDIA_URLS\": \"Social media URLs\",\n \"BOOKING_URL\": \"Booking URL\"\n }\n },\n \"CUSTOM_KNOWLEDGE\": {\n \"AI_KNOWLEDGE_BASE\": \"AI knowledge base\",\n \"MANAGE_KNOWLEDGE\": \"Manage knowledge\",\n \"MANAGE_KNOWLEDGE_DESCRIPTION\": \"Create and manage facts and information that can be added to AI assistants\",\n \"REFRESH_OPTIONS\": \"Refresh options\",\n \"CHOOSE_KNOWLEDGE_SOURCES\": \"Choose the knowledge sources that the Automated Assistant will reference when responding to inquiries\",\n \"KNOWLEDGE_SOURCES\": \"Knowledge sources\",\n \"ADD_KNOWLEDGE\": \"Add knowledge\",\n \"SELECT_KNOWLEDGE\": \"Select knowledge\",\n \"CUSTOM_KNOWLEDGE\": \"Q&A\",\n \"DESCRIPTION\": \"Provide additional facts and answers to frequently asked questions your Automated Assistant can use when responding to inquiries.\",\n \"MAX_CHARACTER_EXCEEDED\": \"Maximum character limit exceeded\",\n \"APPLICATION_SETTINGS\": \"Settings\",\n \"APPS_WARNING\": \"This knowledge is currently being used by the following:\",\n \"NO_APPS\": \"This knowledge is not currently being used.\",\n \"EDIT\": {\n \"TITLE\": \"Custom knowledge\",\n \"NAME\": \"Name\",\n \"CONTENT\": \"Content\"\n },\n \"DELETE\": {\n \"TITLE\": \"Delete custom knowledge?\"\n }\n }\n },\n \"LEARN_MORE\": {\n \"TITLE\": \"Learn more\",\n \"WHAT_CAN_DO_QUESTION\": \"What can an AI-assisted web chat widget do for my business?\",\n \"WHAT_CAN_DO\": \"Installing an AI-assisted web chat widget on your business website can help you capture more leads at any time of day, even when you are not available to respond immediately. \\n An AI Agent will chat with customers on your behalf, with the goal of obtaining their name and contact information for you to follow up at a time that suits you.\",\n \"HOW_IT_WORKS_QUESTION\": \"How does my AI Agent work?\",\n \"HOW_IT_WORKS\": \"Your AI Agent will act as a first responder to any website leads and will maintain a professional and courteous tone while requesting the website visitor's name, mobile number, or email. The Agent has been given strict instructions on how to behave and will not step outside of these bounds. \\n You can monitor all conversations in real-time via your Inbox, providing complete transparency of the historical context prior to outreach. \\n When you respond, you can do so via SMS directly from your Inbox, allowing you to continue the conversation off the website and onto their phone.\",\n \"HOW_TO_GET_MOST_QUESTION\": \"How do I get the most from my AI-assisted Chat Widget?\",\n \"HOW_TO_GET_MOST\": \"Ensure the widget appears on every page of your website. That way, even if visitors navigate around to multiple pages, they can chat with your Agent. \\n The more website visitors you have, the more opportunity you have to capture a new lead. By improving your website's search engine optimization (SEO) and driving traffic to your website through paid advertising, you'll increase the effectiveness of your chat widget, which should result in more leads! \\n Make sure someone from your team is reaching out to new leads as quickly as possible – Every moment that passes without a response is a moment that the lead could choose to go to another business. Don't lose the lead – respond quickly!\",\n \"HOW_TEST_IT_QUESTION\": \"How can I test it?\",\n \"HOW_TEST_IT\": \"Install the chat widget on a private or low-traffic web page and try chatting with it yourself. You'll see it's an exciting way to drive new business for your company automatically.\"\n }\n },\n \"BANNER\": {\n \"SMS_UNAVAILABLE_TITLE\": \"SMS unavailable - \",\n \"SMS_UNAVAILABLE_DESCRIPTION\": \" As of December 1, 2023, SMS messaging is only available in Inbox Pro. Contact your expert today to upgrade.\"\n },\n \"FILTERS\": {\n \"INBOX\": \"Inbox\",\n \"ANONYMOUS\": \"Anonymous web visitors\",\n \"CLOSED\": \"Closed\"\n },\n \"RESPONSE_EVALUATION\": {\n \"HELPFUL\": \"Helpful\",\n \"HELPFUL_QUESTION\": \"What about this response was helpful?\",\n \"NOT_HELPFUL\": \"Not helpful\",\n \"NOT_HELPFUL_QUESTION\": \"What about this response was not helpful?\"\n },\n \"INBOX_ZERO\": {\n \"TITLE\": \"Great work!\",\n \"DESCRIPTION\": \"You have closed all your conversations.\",\n \"START_A_NEW_CONVERSATION\": \"Start a new conversation\"\n },\n \"MULTI_LOCATION\": {\n \"MULTI_LOCATION_SUBTITLE\": \"Chat with customers across all locations in this group.\",\n \"MULTI_LOCATION_BUTTON\": \"Start using multi-location inbox\",\n \"SUCCESS_TO_OPT_IN\": \"You are now able to use Inbox for this group. Please wait while conversations are loaded.\",\n \"FAIL_TO_OPT_IN\": \"Opting in failed\",\n \"INBOX_INFO\": \"Interact with all conversations from all accounts in this group. Note, contacts and notifications are managed at single-location.\"\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { LexiconModule } from '@galaxy/lexicon';\nimport { TranslateModule } from '@ngx-translate/core';\nimport baseTranslation from './i18n/assets/en_devel.json';\n\n@NgModule({\n imports: [\n TranslateModule,\n LexiconModule.forChild({\n componentName: 'business-center/inbox',\n baseTranslation: baseTranslation,\n }),\n ],\n})\nexport class TranslationModule {}\n","import { OverlayModule } from '@angular/cdk/overlay';\nimport { CommonModule, DatePipe } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatListModule } from '@angular/material/list';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AddressAPIService } from '@vendasta/address';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyAvatarModule } from '@vendasta/galaxy/avatar';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyChatModule } from '@vendasta/galaxy/chat';\nimport { GalaxyChatComposerModule } from '@vendasta/galaxy/chat-composer';\nimport { GalaxyCheckboxModule } from '@vendasta/galaxy/checkbox';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyInfiniteScrollTriggerModule } from '@vendasta/galaxy/infinite-scroll-trigger';\nimport { GalaxyInputModule } from '@vendasta/galaxy/input';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { GalaxyNavLayoutModule } from '@vendasta/galaxy/nav-layout';\nimport { GalaxyPageNavModule } from '@vendasta/galaxy/page-nav';\nimport { GalaxyPipesModule } from '@vendasta/galaxy/pipes';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { GalaxyUploaderModule } from '@vendasta/galaxy/uploader';\nimport { InboxTermsOfService } from '../../core/src/lib/inbox-terms-of-service.service';\nimport { ListingService } from '../../core/src/lib/listing.service';\nimport { ConversationPipesModule } from '../../pipes';\nimport { InboxConversationPreviewComponent } from './components/inbox-conversation-preview/inbox-conversation-preview.component';\nimport { InboxConversationTitleComponent } from './components/inbox-conversation-title/inbox-conversation-title.component';\nimport { InboxPanePreviewComponent } from './components/inbox-pane-preview/inbox-pane-preview.component';\nimport { InboxPaneComponent } from './components/inbox-pane/inbox-pane.component';\nimport { InboxSelectContactComponent } from './components/inbox-select-contact/inbox-select-contact.component';\nimport { InboxViewsComponent } from './components/inbox-views/inbox-views.component';\nimport { InboxViewsEmptyComponent } from './components/inbox-views-empty/inbox-views-empty.component';\nimport { InboxWelcomeComponent } from './components/inbox-welcome/inbox-welcome.component';\nimport { ConversationUIRouting } from './conversation-ui.routing';\nimport { SmsAccessGuard } from './guards/sms-access.guard';\nimport { WebChatAccessGuard } from './guards/web-chat-access.guard';\nimport { InboxAiChatComponent } from './pages/inbox-ai-chat/inbox-ai-chat.component';\nimport { InboxTicketCardComponent } from './pages/inbox-chat/components/inbox-info-pane/inbox-ticket-card/inbox-ticket-card.component';\nimport { InboxTicketListComponent } from './pages/inbox-chat/components/inbox-info-pane/inbox-ticket/inbox-ticket-list.component';\nimport { InboxTicketComponent } from './pages/inbox-chat/components/inbox-info-pane/inbox-ticket/inbox-ticket.component';\nimport { InboxInsertPaymentLinkFormComponent } from './pages/inbox-chat/components/inbox-insert-payment-link/inbox-insert-payment-link-form.component';\nimport { InboxInsertPaymentLinkComponent } from './pages/inbox-chat/components/inbox-insert-payment-link/inbox-insert-payment-link.component';\nimport { InboxInsertReviewLinkComponent } from './pages/inbox-chat/components/inbox-insert-review-link/inbox-insert-review-link.component';\nimport { InboxMessageTextComponent } from './pages/inbox-chat/components/inbox-message-text/inbox-message-text.component';\nimport { InboxMessagesTopBarComponent } from './pages/inbox-chat/components/inbox-messages-top-bar/inbox-messages-top-bar.component';\nimport { InboxMessagesComponent } from './pages/inbox-chat/components/inbox-messages/inbox-messages.component';\nimport { InboxUploadFileComponent } from './pages/inbox-chat/components/inbox-upload-file/inbox-upload-file.component';\nimport { InboxUploadService } from './pages/inbox-chat/components/inbox-upload-file/inbox-upload.service';\nimport { InboxChatComponent } from './pages/inbox-chat/inbox-chat.component';\nimport { CreateContactFormComponent } from './pages/inbox-create-contact/create-contact-form.component';\nimport { InboxNewMessageComponent } from './pages/inbox-new-message/inbox-new-message.component';\nimport { InboxSendMessageComponent } from './pages/inbox-send-message/inbox-send-message.component';\nimport { InboxSendMessageResolver } from './pages/inbox-send-message/inbox-send-message.resolver';\nimport { TranslationModule } from './translation-module';\nimport { InboxInsertTemplateComponent } from './pages/inbox-chat/components/inbox-insert-template/inbox-insert-template.component';\nimport { MatSelectModule } from '@angular/material/select';\nimport { InboxZeroComponent } from './components/inbox-zero/inbox-zero.component';\n\nexport const MODULE_DECLARATIONS_EXPORTS = [\n InboxPaneComponent,\n InboxNewMessageComponent,\n InboxMessagesComponent,\n InboxWelcomeComponent,\n InboxMessageTextComponent,\n InboxConversationPreviewComponent,\n InboxSendMessageComponent,\n InboxChatComponent,\n InboxInsertReviewLinkComponent,\n InboxInsertPaymentLinkComponent,\n InboxInsertPaymentLinkFormComponent,\n InboxInsertTemplateComponent,\n InboxUploadFileComponent,\n InboxPanePreviewComponent,\n CreateContactFormComponent,\n InboxViewsComponent,\n InboxTicketComponent,\n InboxAiChatComponent,\n];\n\n// This list is used for compatibility reasons, as dependent components are\n// converted to standalone components, these should be removed from this list.\nconst STANDALONE_COMPONENTS = [\n InboxSelectContactComponent,\n InboxConversationTitleComponent,\n InboxMessagesTopBarComponent,\n InboxTicketCardComponent,\n InboxTicketListComponent,\n InboxZeroComponent,\n];\n@NgModule({\n imports: [\n CommonModule,\n TranslateModule,\n TranslationModule,\n FormsModule,\n MatInputModule,\n ReactiveFormsModule,\n MatButtonModule,\n MatIconModule,\n MatProgressSpinnerModule,\n MatFormFieldModule,\n MatMenuModule,\n MatButtonModule,\n MatCardModule,\n MatSelectModule,\n GalaxyInputModule,\n GalaxyCheckboxModule,\n GalaxyBadgeModule,\n GalaxyUploaderModule,\n OverlayModule, // Requires by GalaxyPopoverModule\n GalaxyPopoverModule,\n ConversationUIRouting,\n GalaxyPipesModule,\n GalaxyChatModule,\n GalaxyInfiniteScrollTriggerModule,\n ConversationPipesModule,\n GalaxyChatComposerModule,\n MatTooltipModule,\n GalaxyLoadingSpinnerModule,\n MatDialogModule,\n GalaxyFormFieldModule,\n MatDividerModule,\n GalaxyEmptyStateModule,\n InboxViewsEmptyComponent,\n GalaxyAvatarModule,\n GalaxyAlertModule,\n MatProgressBarModule,\n MatAutocompleteModule,\n GalaxyPageNavModule,\n GalaxyNavLayoutModule,\n MatTabsModule,\n MatListModule,\n ...STANDALONE_COMPONENTS,\n ],\n declarations: MODULE_DECLARATIONS_EXPORTS,\n providers: [\n ListingService,\n SmsAccessGuard,\n WebChatAccessGuard,\n DatePipe,\n InboxTermsOfService,\n InboxSendMessageResolver,\n AddressAPIService,\n InboxUploadService,\n ],\n exports: MODULE_DECLARATIONS_EXPORTS,\n})\nexport class ConversationUIModule {}\n","import { Component, inject } from '@angular/core';\nimport { Router, RouterModule } from '@angular/router';\nimport { ConversationUIModule } from '../../../../ui/src/conversation-ui.module';\nimport { MatIconModule } from '@angular/material/icon';\nimport { GalaxyNavLayoutModule } from '@vendasta/galaxy/nav-layout';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { GalaxyPageNavModule } from '@vendasta/galaxy/page-nav';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyTooltipModule } from '@vendasta/galaxy/tooltip';\nimport { CommonModule } from '@angular/common';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\n\n@Component({\n selector: 'inbox-ai-overlay',\n standalone: true,\n templateUrl: './inbox-ai-overlay.component.html',\n styleUrls: ['./inbox-ai-overlay.component.scss'],\n imports: [\n CommonModule,\n RouterModule,\n ConversationUIModule,\n MatIconModule,\n GalaxyNavLayoutModule,\n GalaxyPageModule,\n GalaxyPageNavModule,\n MatButtonModule,\n TranslateModule,\n GalaxyBadgeModule,\n GalaxyTooltipModule,\n GalaxyLoadingSpinnerModule,\n ],\n})\nexport class AIChatInboxOverlayComponent {\n private readonly router = inject(Router);\n\n closeModal(): void {\n this.close();\n }\n private close(): void {\n this.router.navigate([{ outlets: { inbox: null } }], {\n queryParamsHandling: 'merge',\n });\n }\n}\n","\n \n \n {{ 'INBOX.HEADER.INBOX_AI_TITLE' | translate }}\n \n info_outline\n \n \n {{ 'INBOX.HEADER.BETA' | translate }}\n \n \n \n \n \n \n \n\n","import { Component, Inject } from '@angular/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AsyncPipe, NgIf } from '@angular/common';\nimport { RegistrationStage, SmsRegistrationService } from '@galaxy/sms';\nimport { BehaviorSubject, combineLatest, map, Observable } from 'rxjs';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN,\n CONVERSATION_SMS_ENABLED_TOKEN,\n} from '../../../core/src/lib/tokens';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\n@Component({\n selector: 'inbox-alert-banner',\n standalone: true,\n imports: [GalaxyAlertModule, TranslateModule, AsyncPipe, NgIf],\n templateUrl: './inbox-alert-banner.component.html',\n})\nexport class InboxAlertBannerComponent {\n readonly registrationStatus$ = this.smsRegistrationService.registrationStage$;\n readonly registrationFormRoute$ = this.accountGroupId$.pipe(\n map((id) => `/account/location/${id}/settings/inbox/sms-registration`),\n );\n\n private readonly hideInboxAlertBanner$$ = new BehaviorSubject(false);\n readonly hideInboxAlertBanner$ = this.hideInboxAlertBanner$$.asObservable();\n\n readonly showGrandfatheringBanner$ = combineLatest([\n this.smsEnabled$,\n this.googleBusinessMessagesAvailable$,\n this.hideInboxAlertBanner$,\n this.inboxService.SMSNumber$,\n ]).pipe(\n map(([smsEnabled, googleBusinessMessagesAvailable, hideInboxAlertBanner, smsNumber]) => {\n return !smsEnabled && !googleBusinessMessagesAvailable && !hideInboxAlertBanner && !!smsNumber;\n }),\n );\n\n protected readonly RegistrationStage = RegistrationStage;\n\n constructor(\n private readonly smsRegistrationService: SmsRegistrationService,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) private readonly accountGroupId$: Observable,\n @Inject(CONVERSATION_SMS_ENABLED_TOKEN) private smsEnabled$: Observable,\n @Inject(CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN)\n private googleBusinessMessagesAvailable$: Observable,\n private readonly inboxService: InboxService,\n ) {}\n\n onBannerClosed(): void {\n this.hideInboxAlertBanner$$.next(true);\n }\n}\n","\n \n {{ 'INBOX.BANNER.SMS_UNAVAILABLE_TITLE' | translate }}\n {{ 'INBOX.BANNER.SMS_UNAVAILABLE_DESCRIPTION' | translate }}\n \n\n\n \n {{ 'INBOX.WARNING.A2P_BANNER_TITLE' | translate }}\n {{ 'INBOX.WARNING.A2P_REJECTED_BANNER_DESCRIPTION' | translate }}\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, OnInit } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { TranslateModule } from '@ngx-translate/core';\n\nimport { AtlasModule } from '@galaxy/atlas';\nimport { CookieService } from 'ngx-cookie-service';\nimport { combineLatest, map, take } from 'rxjs';\nimport { FOLLOWING_VIEW_ID, ConversationService } from '../../../core/src/index';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { ConversationPipesModule } from '../../../pipes/src/pipes.module';\n\nconst cookieKeyInboxDefaultOpen = 'inbox-default-open';\nconst inboxFollowingViewId = 'following';\n\n@Component({\n selector: 'inbox-button',\n standalone: true,\n styleUrls: ['./inbox-button.component.scss'],\n templateUrl: 'inbox-button.component.html',\n imports: [CommonModule, TranslateModule, MatIconModule, MatTooltipModule, AtlasModule, ConversationPipesModule],\n})\nexport class InboxButtonComponent implements OnInit {\n readonly defaultViewId = FOLLOWING_VIEW_ID;\n constructor(\n private readonly viewModeService: ViewModeService,\n private readonly cookieService: CookieService,\n private readonly conversationService: ConversationService,\n ) {}\n\n ngOnInit() {\n combineLatest([\n this.viewModeService.viewMode$,\n this.conversationService.getUnreadConversationsCount(inboxFollowingViewId),\n ])\n .pipe(\n map(([viewMode, unreadMessagesCount]) => {\n const defaultOpen = this.getInboxDefaultOpen();\n if (viewMode === 'sidebar' && !defaultOpen && unreadMessagesCount > 0) {\n this.toggle();\n this.setInboxDefaultOpen();\n }\n }),\n take(1),\n )\n .subscribe();\n }\n readonly buttonSelected$ = this.viewModeService.isInboxOpen$.pipe(\n map((isOpen) => (isOpen ? 'atlas-navbar__item-selected' : '')),\n );\n\n toggle(): void {\n this.viewModeService.toggleInboxOpen();\n }\n\n private setInboxDefaultOpen(): void {\n this.cookieService.set(cookieKeyInboxDefaultOpen, 'opened');\n }\n\n private getInboxDefaultOpen(): string {\n return this.cookieService.get(cookieKeyInboxDefaultOpen);\n }\n}\n","\n","import { CommonModule } from '@angular/common';\nimport { Component, Inject, OnInit, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDialog } from '@angular/material/dialog';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AccountGroup } from '@vendasta/account-group';\nimport { BusinessSelectorDialogComponent, BusinessSelectorDialogModule } from '@vendasta/businesses';\nimport { ConversationChannel, GlobalParticipantType, SubjectParticipant } from '@vendasta/conversation';\nimport { GalaxyNavLayoutModule } from '@vendasta/galaxy/nav-layout';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { GalaxyPageNavModule } from '@vendasta/galaxy/page-nav';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { filter, map, switchMap, take, tap, withLatestFrom } from 'rxjs';\nimport { ConversationListService } from '../../../core/src/lib/conversation-list.service';\nimport { toFirestoreId } from '../../../core/src/lib/conversation-utils';\nimport { ConversationService } from '../../../core/src/lib/conversation.service';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\nimport { ConversationConfig } from '../../../core/src/lib/interface/config.interface';\nimport { SendMessage } from '../../../core/src/lib/interface/conversation.interface';\nimport { ParticipantService } from '../../../core/src/lib/participant.service';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_CONFIG_TOKEN,\n CONVERSATION_HOST_APP_INTERFACE_TOKEN,\n PARTNER_ID_TOKEN,\n} from '../../../core/src/lib/tokens';\nimport { ViewMode } from '../../../core/src/lib/types';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { ViewService } from '../../../core/src/lib/view.service';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\n@Component({\n standalone: true,\n selector: 'inbox-container',\n imports: [\n CommonModule,\n TranslateModule,\n RouterModule,\n MatButtonModule,\n MatIconModule,\n MatProgressBarModule,\n GalaxyPageModule,\n GalaxySnackbarModule,\n GalaxyPageNavModule,\n GalaxyNavLayoutModule,\n ConversationUIModule,\n BusinessSelectorDialogModule,\n ],\n templateUrl: './inbox-container.component.html',\n styleUrls: ['./inbox-container.component.scss'],\n})\nexport class InboxContainerComponent implements OnInit {\n private readonly hostAppInterface = inject(CONVERSATION_HOST_APP_INTERFACE_TOKEN);\n private readonly participantService = inject(ParticipantService);\n\n protected readonly showNewMessageButton = !this.inboxConfig.hideNewMessageButton;\n protected readonly learnMoreUrl = this.inboxConfig.learnMoreUrl || '';\n\n protected readonly showSettings$ = this.inboxService.canAccessEmbeddedSettings$;\n protected readonly showInboxViews$ = this.inboxService.showInboxViews$;\n protected readonly viewMode$ = this.viewModeService.viewMode$;\n protected readonly isModal$ = this.viewMode$.pipe(map((mode) => mode === 'modal'));\n readonly organizationHasConversations$ = this.conversationListService.organizationHasConversations$;\n\n viewingConversation$ = this.conversationService.currentFirestoreConversationId$.pipe(\n map((conversationId) => !!conversationId),\n );\n\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n\n constructor(\n private readonly conversationService: ConversationService,\n private readonly conversationListService: ConversationListService,\n private readonly dialog: MatDialog,\n private readonly router: Router,\n private readonly route: ActivatedRoute,\n private readonly snackbar: SnackbarService,\n private readonly analyticsService: ProductAnalyticsService,\n @Inject(CONVERSATION_CONFIG_TOKEN) private readonly inboxConfig: ConversationConfig,\n private readonly inboxService: InboxService,\n private readonly viewModeService: ViewModeService,\n private readonly viewService: ViewService,\n ) {}\n\n ngOnInit(): void {\n this.showInboxViews$.pipe(\n take(1),\n withLatestFrom(this.viewService.selectedViewId$),\n map(([showInboxViews, selectedViewId]) => {\n if (showInboxViews) {\n this.router.navigate([{ outlets: { inbox: ['inbox', 'views', selectedViewId, 'conversations'] } }], {\n queryParamsHandling: 'preserve',\n });\n }\n }),\n );\n }\n\n closeModal(): void {\n this.viewModeService.toggleInboxOpen();\n }\n\n protected toggleView(state: ViewMode): void {\n const isFullView = state === 'sidebar';\n this.analyticsService.trackToggle('inbox-view-mode-toggle-state', isFullView);\n this.viewModeService.toggleViewMode();\n }\n\n // This modal will need to change if button is shown in any Task Manager or Vendor Center.\n // This modal will need to change if this component is put in Business App.\n // SMBs and Vendors don't have accounts to pick from.\n // Not sure the limitation for Task Manager; I anticipate it is because digital agents can start conversations with partners and accounts.\n newMessage(): void {\n const currentIAMParticipant$ = this.participantService.buildIAMUserParticipant();\n this.dialog\n .open(BusinessSelectorDialogComponent, {\n width: '500px',\n data: {\n partnerId: this.partnerId(),\n },\n })\n .afterClosed()\n .pipe(\n filter((business: AccountGroup) => !!business),\n withLatestFrom(currentIAMParticipant$),\n switchMap(([business, currentParticipant]) => {\n return this.hostAppInterface.buildSendMessageParams(\n currentParticipant,\n [\n new SubjectParticipant({\n internalParticipantId: this.partnerId(),\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n }),\n new SubjectParticipant({\n internalParticipantId: business.accountGroupId,\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_ACCOUNT_GROUP,\n }),\n ],\n ConversationChannel.CONVERSATION_CHANNEL_INTERNAL,\n );\n }),\n switchMap((sendMessage: SendMessage) =>\n this.conversationService.createConversation(\n sendMessage.participants ?? [],\n sendMessage.channel,\n sendMessage.location,\n ),\n ),\n tap((conversationDetails) => {\n if (!conversationDetails?.conversation) return;\n this.analyticsService.trackEvent('inbox', 'send-message', 'create-conversation-success', 0, {\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: this.conversationService.getConversationChannel(),\n });\n }),\n switchMap((conversationResp) =>\n this.conversationService.getConversationDetail(conversationResp.conversation.conversationId),\n ),\n map((conversationDetails) => toFirestoreId(conversationDetails?.conversation?.conversationId)),\n )\n .subscribe({\n next: (conversationId) =>\n this.router.navigate(['conversations', conversationId], {\n relativeTo: this.route,\n }),\n error: (err) => {\n console.warn('Error to create a conversation: ', err);\n this.snackbar.openErrorSnack(err);\n this.analyticsService.trackEvent('inbox', 'send-message', 'create-conversation-error', 0, {\n accountGroupId: this.accountGroupId(),\n partnerId: this.partnerId(),\n location: this.inboxService.platformLocation,\n channel: this.conversationService.getConversationChannel(),\n message: err?.error?.message,\n });\n },\n });\n }\n}\n","\n \n \n {{ 'INBOX.HEADER.TITLE' | translate }}\n \n \n \n \n \n \n settings\n \n \n {{ (isModal$ | async) ? 'fullscreen_exit' : 'fullscreen' }}\n \n \n \n \n\n
\n \n
\n \n
\n\n \n
\n \n
\n","import { CommonModule } from '@angular/common';\nimport { Component, Input, OnDestroy, Optional } from '@angular/core';\nimport { MatDrawerMode, MatSidenavModule } from '@angular/material/sidenav';\nimport { RouterModule } from '@angular/router';\nimport { PageService } from '@vendasta/galaxy/page/src/page.service';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { InboxContainerComponent } from '../inbox-container/inbox-container.component';\n\n@Component({\n selector: 'inbox-inbox',\n standalone: true,\n imports: [CommonModule, RouterModule, MatSidenavModule, InboxContainerComponent],\n styleUrls: ['./inbox.component.scss'],\n templateUrl: './inbox.component.html',\n})\nexport class InboxComponent implements OnDestroy {\n @Input() modeType: MatDrawerMode = 'over';\n\n constructor(protected readonly viewModeService: ViewModeService, @Optional() private pageService: PageService) {}\n\n ngOnDestroy(): void {\n if (this.pageService) {\n this.pageService.pop();\n }\n }\n}\n","\n \n
\n \n
\n \n
\n\n \n \n \n
\n \n
\n \n\n \n \n \n
\n
\n
\n\n\n \n\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, OnInit, Optional } from '@angular/core';\nimport { RouterModule } from '@angular/router';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { ProductAnalyticsService } from '@vendasta/product-analytics';\nimport { ConversationListService } from '../../../../core/src/lib/conversation-list.service';\nimport { isMobile } from '../../../../core/src/lib/inbox-utils';\nimport { ConversationUIModule } from '../../conversation-ui.module';\n\n@Component({\n selector: 'inbox-home',\n templateUrl: './inbox-home.component.html',\n styleUrls: ['./inbox-home.component.scss'],\n standalone: true,\n imports: [CommonModule, RouterModule, ConversationUIModule, GalaxyLoadingSpinnerModule],\n})\nexport class InboxHomeComponent implements OnInit {\n readonly organizationHasConversations$ = this.conversationListService.organizationHasConversations$;\n\n constructor(\n @Optional() private readonly analyticsService: ProductAnalyticsService,\n private conversationListService: ConversationListService,\n ) {}\n\n ngOnInit(): void {\n if (this.analyticsService) {\n this.analyticsService.trackEvent('inbox', 'home', 'view');\n }\n }\n\n get isMobile(): boolean {\n return isMobile();\n }\n}\n","\n\n\n \n\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Input, Output, inject } from '@angular/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatToolbarModule } from '@angular/material/toolbar';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ParticipantType } from '@vendasta/conversation';\nimport { CardDataType, GalaxyContactInfoCardModule } from '@vendasta/galaxy/contact-info-card';\nimport { combineLatest, map } from 'rxjs';\nimport { ConversationService } from '../../../../../../../core/src/lib/conversation.service';\nimport { PARTNER_ID_TOKEN } from '../../../../../../../core/src/lib/tokens';\n\nconst detailsParticipantTypes = [\n ParticipantType.PARTICIPANT_TYPE_ACCOUNT_GROUP,\n ParticipantType.PARTICIPANT_TYPE_PARTNER,\n ParticipantType.PARTICIPANT_TYPE_VENDOR,\n];\n\n@Component({\n selector: 'inbox-conversation-details',\n standalone: true,\n imports: [CommonModule, MatToolbarModule, MatIconModule, TranslateModule, GalaxyContactInfoCardModule],\n templateUrl: './conversation-details.component.html',\n styleUrls: ['./conversation-details.component.scss'],\n})\nexport default class ConversationDetailsComponent {\n private conversationService = inject(ConversationService);\n private conversationDetail$ = this.conversationService.currentConversationDetail$;\n\n @Input() showTickets = false;\n\n @Output() ticketsClicked = new EventEmitter();\n\n private participants$ = this.conversationDetail$.pipe(map((conversations) => conversations?.participants || []));\n\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n\n readonly cardData$ = combineLatest([this.participants$, this.partnerId$]).pipe(\n map(([participants, currentPartnerId]) =>\n participants\n .filter((participant) => !!participant)\n .filter(\n (participant) =>\n participant?.isSubjectParticipant || detailsParticipantTypes.includes(participant.participantType),\n )\n .filter(\n (participant) =>\n !(\n participant.participantType === ParticipantType.PARTICIPANT_TYPE_PARTNER &&\n participant.partnerId === currentPartnerId\n ),\n )\n .map((participant) => {\n const {\n name,\n participantType,\n email,\n phoneNumber,\n profileImageUrl,\n partnerId,\n accountGroupId,\n internalParticipantId,\n } = participant;\n const { firstLineAddress, secondLineAddress, city, state, country, zipCode } = participant.address || {};\n const cardType = participantType === ParticipantType.PARTICIPANT_TYPE_IAM_USER ? 'user' : 'business';\n\n return {\n type: cardType,\n id: internalParticipantId || accountGroupId || partnerId,\n email: email,\n phone: phoneNumber,\n avatar: profileImageUrl,\n businessName: name,\n businessAddress: {\n address1: firstLineAddress,\n address2: secondLineAddress,\n city: city,\n state: state,\n country: country,\n zip: zipCode,\n },\n } as CardDataType;\n }),\n ),\n );\n}\n","
\n \n
\n
\n \n
\n","export enum ActiveSideView {\n Details = 'details',\n Tickets = 'tickets',\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, HostListener, OnInit, computed, inject } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatDrawerMode, MatSidenavModule } from '@angular/material/sidenav';\nimport { MatSnackBarModule } from '@angular/material/snack-bar';\nimport { MatToolbarModule } from '@angular/material/toolbar';\nimport { ActivatedRoute } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ReplaySubject, combineLatest, distinctUntilChanged, map, shareReplay, skipWhile, switchMap, tap } from 'rxjs';\nimport { SUPPORT_PID } from '../../../core/src/lib/conversation.constants';\nimport { ConversationService } from '../../../core/src/lib/conversation.service';\nimport { PARTNER_ID_TOKEN } from '../../../core/src/lib/tokens';\nimport { ViewModeService } from '../../../core/src/lib/view-mode.service';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\nimport ConversationDetailsComponent from '../../../ui/src/pages/inbox-chat/components/inbox-info-pane/conversation-details/conversation-details.component';\nimport { InboxInfoDrawerService } from '../../../ui/src/pages/inbox-chat/components/inbox-info-pane/inbox-info-drawer.service';\nimport { ActiveSideView } from './types';\n\n@Component({\n standalone: true,\n imports: [\n MatSnackBarModule,\n CommonModule,\n ConversationUIModule,\n MatSidenavModule,\n MatIconModule,\n MatToolbarModule,\n TranslateModule,\n ConversationDetailsComponent,\n ],\n templateUrl: './chat.component.html',\n styleUrls: ['./chat.component.scss'],\n})\nexport class ChatComponent implements OnInit {\n readonly isDrawerOpen$ = this.inboxInfoDrawerService.isOpenDrawer$;\n readonly viewMode$ = this.viewModeService.viewMode$;\n activeSideView: ActiveSideView = ActiveSideView.Details;\n\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n readonly isTicketsEnabled = computed(() => this.partnerId() === SUPPORT_PID);\n\n private drawerMode$$ = new ReplaySubject(1);\n readonly drawerMode$ = combineLatest([this.drawerMode$$.pipe(distinctUntilChanged()), this.viewMode$]).pipe(\n tap(([drawerMode, viewMode]) => {\n this.inboxInfoDrawerService.setIsOpen(viewMode === 'modal' && drawerMode === 'side');\n }),\n map(([drawerMode, viewMode]) => (viewMode === 'sidebar' ? 'over' : drawerMode)),\n distinctUntilChanged(),\n );\n\n protected readonly details$ = this.route.paramMap.pipe(\n map((params) => params.get('id')),\n switchMap((id) => this.conversationService.getConversationDetail(id)),\n skipWhile((details) => !details),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n constructor(\n private readonly conversationService: ConversationService,\n private readonly route: ActivatedRoute,\n private readonly inboxInfoDrawerService: InboxInfoDrawerService,\n private readonly viewModeService: ViewModeService,\n ) {}\n\n ngOnInit(): void {\n this.drawerMode$$.next(this.drawerMode);\n }\n\n back() {\n if (this.activeSideView === ActiveSideView.Details) {\n this.inboxInfoDrawerService.toggle();\n } else {\n this.activeSideView = ActiveSideView.Details;\n }\n }\n\n openTickets() {\n this.activeSideView = ActiveSideView.Tickets;\n }\n\n @HostListener('window:resize', ['$event'])\n onResize(): void {\n this.drawerMode$$.next(this.drawerMode);\n }\n\n private get drawerMode(): MatDrawerMode {\n return window.matchMedia('(max-width: 1100px)').matches ? 'over' : 'side';\n }\n}\n","\n \n \n \n \n \n \n \n\n

\n {{ 'INBOX.TICKETS.TITLE' | translate }}\n {{ 'INBOX.DETAILS.TITLE' | translate }}\n

\n
\n
\n \n \n \n \n \n \n \n
\n","import { Component } from '@angular/core';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\n\n@Component({\n standalone: true,\n imports: [ConversationUIModule],\n template: `\n \n `,\n styles: [\n `\n :host {\n width: 100%;\n }\n `,\n ],\n})\nexport class CreateContactComponent {}\n","import { Component } from '@angular/core';\nimport { ConversationUIModule } from '../../../ui/src/conversation-ui.module';\n\n@Component({\n standalone: true,\n imports: [ConversationUIModule],\n template: `\n \n `,\n styles: [\n `\n :host {\n width: 100%;\n }\n `,\n ],\n})\nexport class NewMessageComponent {}\n","import { CommonModule } from '@angular/common';\nimport { Component, Input, booleanAttribute } from '@angular/core';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyChatModule } from '@vendasta/galaxy/chat';\n\n@Component({\n selector: 'inbox-preview',\n standalone: true,\n imports: [CommonModule, GalaxyChatModule, MatIconModule, MatCardModule, GalaxyAlertModule, TranslateModule],\n templateUrl: './inbox-preview.component.html',\n styleUrls: ['./inbox-preview.component.scss'],\n})\nexport class InboxPreviewComponent {\n fakeText = ' '.repeat(60);\n\n @Input({ transform: booleanAttribute }) showAvailabilityMessage = false;\n @Input() availabilityMessage = '';\n}\n","\n \n
\n
\n {{ 'INBOX.SETTINGS.PREVIEW.TITLE' | translate }}\n
\n
\n more_vert\n
\n
\n
\n \n {{ availabilityMessage }}\n \n
\n
\n \n \n \n\n \n\n \n\n \n \n \n
\n","import { Component } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\n\n@Component({\n standalone: true,\n imports: [CommonModule, MatDialogModule, MatButtonModule, TranslateModule],\n templateUrl: './email-forwarding-info.component.html',\n})\nexport class EmailForwardingInfoComponent {}\n","
{{ 'INBOX.SETTINGS.EMAIL_SETTINGS.FORWARDING_ADDRESS_INFO_TITLE' | translate }}
\n\n
\n
\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, computed } from '@angular/core';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { CdkOverlayOrigin } from '@angular/cdk/overlay';\nimport { MatButton, MatIconButton } from '@angular/material/button';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { EmailForwardingInfoComponent } from './email-forwarding-info/email-forwarding-info.component';\nimport { MatDialog } from '@angular/material/dialog';\nimport { Clipboard } from '@angular/cdk/clipboard';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport { GalaxyTooltipModule } from '@vendasta/galaxy/tooltip';\nimport { InboxService, COMPANY_NAME_TOKEN, ACCOUNT_GROUP_ID_TOKEN } from '../../../../core/src';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { FormsModule } from '@angular/forms';\nimport { GlobalParticipantType, EmailApiService } from '@vendasta/conversation';\nimport { map, switchMap, catchError, shareReplay, of, Observable } from 'rxjs';\n@Component({\n standalone: true,\n selector: 'inbox-email-settings-card',\n imports: [\n CommonModule,\n MatIconModule,\n MatCardModule,\n TranslateModule,\n GalaxyPopoverModule,\n CdkOverlayOrigin,\n MatButton,\n MatIconButton,\n GalaxyFormFieldModule,\n MatTooltip,\n GalaxyTooltipModule,\n FormsModule,\n ],\n templateUrl: './email-settings-card.component.html',\n styleUrl: './email-settings-card.component.scss',\n})\nexport class EmailSettingsCardComponent {\n private readonly emailApiService = inject(EmailApiService);\n private readonly accountGroupId$ = inject(ACCOUNT_GROUP_ID_TOKEN);\n private readonly user = toSignal(inject(InboxService).iamUser$);\n private readonly companyName = toSignal(inject(COMPANY_NAME_TOKEN));\n readonly forwardingAddress = toSignal(this.getForwardingAddress());\n constructor(\n private dialog: MatDialog,\n private clipboard: Clipboard,\n ) {}\n\n protected showPopover = false;\n protected isCopied = false;\n forwardingEmailTitle = computed(() => {\n const user = this.user();\n const companyName = this.companyName();\n return {\n firstName: user?.firstName,\n companyName: companyName,\n translationKey: user?.firstName\n ? 'INBOX.SETTINGS.EMAIL_SETTINGS.USER_AT_COMPANY'\n : 'INBOX.SETTINGS.EMAIL_SETTINGS.COMPANY_ONLY',\n };\n });\n\n openLearnMoreModal(): void {\n this.dialog.open(EmailForwardingInfoComponent, { width: '600px' });\n }\n\n copyClicked() {\n this.isCopied = true;\n this.clipboard.copy(this.forwardingAddress());\n setTimeout(() => {\n this.isCopied = false;\n }, 5000);\n }\n\n getForwardingAddress(): Observable {\n return this.accountGroupId$.pipe(\n switchMap((accountGroupId) => {\n return this.emailApiService\n .getOwnerEmail({\n subjectParticipant: {\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_ACCOUNT_GROUP,\n internalParticipantId: accountGroupId,\n },\n })\n .pipe(catchError(() => of({ forwardingEmail: '' })));\n }),\n map((emailRes) => {\n return emailRes.forwardingEmail ?? '';\n }),\n catchError(() => of('')),\n shareReplay(1),\n );\n }\n}\n","\n \n \n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.TITLE' | translate }}\n \n \n
\n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.DESCRIPTION' | translate }}\n \n info_outline\n \n
\n
\n \n \n person\n {{\n forwardingEmailTitle().translationKey | translate: forwardingEmailTitle()\n }}\n <{{ this.forwardingAddress() }}>\n \n \n
\n \n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.FORWARDING_ADDRESS' | translate }}\n \n \n content_copy\n \n \n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.SENDER_PREVIEW_INFO_DESCRIPTION' | translate }}\n {{ 'INBOX.SETTINGS.EMAIL_SETTINGS.LEARN_MORE' | translate }}\n \n \n
\n
\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nimport { map } from 'rxjs/operators';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar PermissionsGroup = /*#__PURE__*/function (PermissionsGroup) {\n PermissionsGroup[PermissionsGroup[\"PERMISSIONS_GROUP_UNKNOWN\"] = 0] = \"PERMISSIONS_GROUP_UNKNOWN\";\n PermissionsGroup[PermissionsGroup[\"PERMISSIONS_GROUP_MESSENGER\"] = 1] = \"PERMISSIONS_GROUP_MESSENGER\";\n return PermissionsGroup;\n}(PermissionsGroup || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar MessageAttachmentType = /*#__PURE__*/function (MessageAttachmentType) {\n MessageAttachmentType[MessageAttachmentType[\"UNSPECIFIED\"] = 0] = \"UNSPECIFIED\";\n MessageAttachmentType[MessageAttachmentType[\"IMAGE\"] = 1] = \"IMAGE\";\n MessageAttachmentType[MessageAttachmentType[\"AUDIO\"] = 2] = \"AUDIO\";\n MessageAttachmentType[MessageAttachmentType[\"FILE\"] = 3] = \"FILE\";\n return MessageAttachmentType;\n}(MessageAttachmentType || {});\nvar TokenStatus = /*#__PURE__*/function (TokenStatus) {\n TokenStatus[TokenStatus[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n TokenStatus[TokenStatus[\"VALID\"] = 1] = \"VALID\";\n TokenStatus[TokenStatus[\"INVALID\"] = 2] = \"INVALID\";\n TokenStatus[TokenStatus[\"MISSING_PERMISSIONS\"] = 3] = \"MISSING_PERMISSIONS\";\n return TokenStatus;\n}(TokenStatus || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$7(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FacebookPage {\n static fromProto(proto) {\n let m = new FacebookPage();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.canSubscribeLeadWebhooks !== 'undefined') {\n toReturn['canSubscribeLeadWebhooks'] = this.canSubscribeLeadWebhooks;\n }\n if (typeof this.tasks !== 'undefined') {\n toReturn['tasks'] = this.tasks;\n }\n return toReturn;\n }\n}\nclass FacebookPagingRequest {\n static fromProto(proto) {\n let m = new FacebookPagingRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.before !== 'undefined') {\n toReturn['before'] = this.before;\n }\n if (typeof this.after !== 'undefined') {\n toReturn['after'] = this.after;\n }\n return toReturn;\n }\n}\nclass FacebookPagingResponse {\n static fromProto(proto) {\n let m = new FacebookPagingResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.before !== 'undefined') {\n toReturn['before'] = this.before;\n }\n if (typeof this.after !== 'undefined') {\n toReturn['after'] = this.after;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass LeadGenAdForm {\n static fromProto(proto) {\n let m = new LeadGenAdForm();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.leadgenId !== 'undefined') {\n toReturn['leadgenId'] = this.leadgenId;\n }\n if (typeof this.rawJsonPayload !== 'undefined') {\n toReturn['rawJsonPayload'] = this.rawJsonPayload;\n }\n if (typeof this.adName !== 'undefined') {\n toReturn['adName'] = this.adName;\n }\n if (typeof this.campaignName !== 'undefined') {\n toReturn['campaignName'] = this.campaignName;\n }\n if (typeof this.formId !== 'undefined') {\n toReturn['formId'] = this.formId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$6(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FacebookForm {\n static fromProto(proto) {\n let m = new FacebookForm();\n m = Object.assign(m, proto);\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n if (typeof this.leadgenFormId !== 'undefined') {\n toReturn['leadgenFormId'] = this.leadgenFormId;\n }\n if (typeof this.leadgenFormName !== 'undefined') {\n toReturn['leadgenFormName'] = this.leadgenFormName;\n }\n if (typeof this.isEnabledForLeads !== 'undefined') {\n toReturn['isEnabledForLeads'] = this.isEnabledForLeads;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.locale !== 'undefined') {\n toReturn['locale'] = this.locale;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass PageData {\n static fromProto(proto) {\n let m = new PageData();\n m = Object.assign(m, proto);\n if (proto.checkins) {\n m.checkins = parseInt(proto.checkins, 10);\n }\n if (proto.talkingAboutCount) {\n m.talkingAboutCount = parseInt(proto.talkingAboutCount, 10);\n }\n if (proto.ratingCount) {\n m.ratingCount = parseInt(proto.ratingCount, 10);\n }\n if (proto.wereHereCount) {\n m.wereHereCount = parseInt(proto.wereHereCount, 10);\n }\n if (proto.picture) {\n m.picture = Picture.fromProto(proto.picture);\n }\n if (proto.fanCount) {\n m.fanCount = parseInt(proto.fanCount, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.about !== 'undefined') {\n toReturn['about'] = this.about;\n }\n if (typeof this.canPost !== 'undefined') {\n toReturn['canPost'] = this.canPost;\n }\n if (typeof this.checkins !== 'undefined') {\n toReturn['checkins'] = this.checkins;\n }\n if (typeof this.isPublished !== 'undefined') {\n toReturn['isPublished'] = this.isPublished;\n }\n if (typeof this.talkingAboutCount !== 'undefined') {\n toReturn['talkingAboutCount'] = this.talkingAboutCount;\n }\n if (typeof this.ratingCount !== 'undefined') {\n toReturn['ratingCount'] = this.ratingCount;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.wereHereCount !== 'undefined') {\n toReturn['wereHereCount'] = this.wereHereCount;\n }\n if (typeof this.category !== 'undefined') {\n toReturn['category'] = this.category;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.link !== 'undefined') {\n toReturn['link'] = this.link;\n }\n if (typeof this.picture !== 'undefined' && this.picture !== null) {\n toReturn['picture'] = 'toApiJson' in this.picture ? this.picture.toApiJson() : this.picture;\n }\n if (typeof this.fanCount !== 'undefined') {\n toReturn['fanCount'] = this.fanCount;\n }\n return toReturn;\n }\n}\nclass Picture {\n static fromProto(proto) {\n let m = new Picture();\n m = Object.assign(m, proto);\n if (proto.height) {\n m.height = parseInt(proto.height, 10);\n }\n if (proto.width) {\n m.width = parseInt(proto.width, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.height !== 'undefined') {\n toReturn['height'] = this.height;\n }\n if (typeof this.width !== 'undefined') {\n toReturn['width'] = this.width;\n }\n if (typeof this.isSilhouette !== 'undefined') {\n toReturn['isSilhouette'] = this.isSilhouette;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass GetUserNameRequest {\n static fromProto(proto) {\n let m = new GetUserNameRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n if (typeof this.organizationId !== 'undefined') {\n toReturn['organizationId'] = this.organizationId;\n }\n return toReturn;\n }\n}\nclass GetUserNameResponse {\n static fromProto(proto) {\n let m = new GetUserNameResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.firstName !== 'undefined') {\n toReturn['firstName'] = this.firstName;\n }\n if (typeof this.lastName !== 'undefined') {\n toReturn['lastName'] = this.lastName;\n }\n return toReturn;\n }\n}\nclass PagedRequestOptions {\n static fromProto(proto) {\n let m = new PagedRequestOptions();\n m = Object.assign(m, proto);\n if (proto.pageIndex) {\n m.pageIndex = parseInt(proto.pageIndex, 10);\n }\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageIndex !== 'undefined') {\n toReturn['pageIndex'] = this.pageIndex;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n if (typeof this.allRows !== 'undefined') {\n toReturn['allRows'] = this.allRows;\n }\n return toReturn;\n }\n}\nclass PagedResponseMetadata {\n static fromProto(proto) {\n let m = new PagedResponseMetadata();\n m = Object.assign(m, proto);\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass VerifyTokenHasScopesForFeatureRequest {\n static fromProto(proto) {\n let m = new VerifyTokenHasScopesForFeatureRequest();\n m = Object.assign(m, proto);\n if (proto.permissionsGroup) {\n m.permissionsGroup = enumStringToValue$3(PermissionsGroup, proto.permissionsGroup);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.token !== 'undefined') {\n toReturn['token'] = this.token;\n }\n if (typeof this.permissionsGroup !== 'undefined') {\n toReturn['permissionsGroup'] = this.permissionsGroup;\n }\n return toReturn;\n }\n}\nclass VerifyTokenHasScopesForFeatureResponse {\n static fromProto(proto) {\n let m = new VerifyTokenHasScopesForFeatureResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.tokenValid !== 'undefined') {\n toReturn['tokenValid'] = this.tokenValid;\n }\n if (typeof this.hasAllPermissions !== 'undefined') {\n toReturn['hasAllPermissions'] = this.hasAllPermissions;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass AssignFacebookPageOwnerRequest {\n static fromProto(proto) {\n let m = new AssignFacebookPageOwnerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.organizationId !== 'undefined') {\n toReturn['organizationId'] = this.organizationId;\n }\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n return toReturn;\n }\n}\nclass SendFacebookMessageRequestAttachment {\n static fromProto(proto) {\n let m = new SendFacebookMessageRequestAttachment();\n m = Object.assign(m, proto);\n if (proto.type) {\n m.type = enumStringToValue$2(MessageAttachmentType, proto.type);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.isReusable !== 'undefined') {\n toReturn['isReusable'] = this.isReusable;\n }\n return toReturn;\n }\n}\nclass DisableMessengerForPageRequest {\n static fromProto(proto) {\n let m = new DisableMessengerForPageRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n if (typeof this.organizationId !== 'undefined') {\n toReturn['organizationId'] = this.organizationId;\n }\n return toReturn;\n }\n}\nclass FacebookPageMessengerStateRequest {\n static fromProto(proto) {\n let m = new FacebookPageMessengerStateRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n if (typeof this.facebookUserId !== 'undefined') {\n toReturn['facebookUserId'] = this.facebookUserId;\n }\n if (typeof this.organizationId !== 'undefined') {\n toReturn['organizationId'] = this.organizationId;\n }\n return toReturn;\n }\n}\nclass FacebookPageMessengerStateResponse {\n static fromProto(proto) {\n let m = new FacebookPageMessengerStateResponse();\n m = Object.assign(m, proto);\n if (proto.tokenValid) {\n m.tokenValid = enumStringToValue$2(TokenStatus, proto.tokenValid);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.messengerEnabled !== 'undefined') {\n toReturn['messengerEnabled'] = this.messengerEnabled;\n }\n if (typeof this.tokenValid !== 'undefined') {\n toReturn['tokenValid'] = this.tokenValid;\n }\n if (typeof this.isPageOwner !== 'undefined') {\n toReturn['isPageOwner'] = this.isPageOwner;\n }\n return toReturn;\n }\n}\nclass SendFacebookMessageRequest {\n static fromProto(proto) {\n let m = new SendFacebookMessageRequest();\n m = Object.assign(m, proto);\n if (proto.attachment) {\n m.attachment = SendFacebookMessageRequestAttachment.fromProto(proto.attachment);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.organizationId !== 'undefined') {\n toReturn['organizationId'] = this.organizationId;\n }\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n if (typeof this.recipientId !== 'undefined') {\n toReturn['recipientId'] = this.recipientId;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.attachment !== 'undefined' && this.attachment !== null) {\n toReturn['attachment'] = 'toApiJson' in this.attachment ? this.attachment.toApiJson() : this.attachment;\n }\n return toReturn;\n }\n}\nclass SendFacebookMessageResponse {\n static fromProto(proto) {\n let m = new SendFacebookMessageResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.messageId !== 'undefined') {\n toReturn['messageId'] = this.messageId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CreateLeadGenAdFormRequest {\n static fromProto(proto) {\n let m = new CreateLeadGenAdFormRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.leadgenId !== 'undefined') {\n toReturn['leadgenId'] = this.leadgenId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n if (typeof this.rawJsonPayload !== 'undefined') {\n toReturn['rawJsonPayload'] = this.rawJsonPayload;\n }\n if (typeof this.campaignName !== 'undefined') {\n toReturn['campaignName'] = this.campaignName;\n }\n if (typeof this.adName !== 'undefined') {\n toReturn['adName'] = this.adName;\n }\n if (typeof this.formId !== 'undefined') {\n toReturn['formId'] = this.formId;\n }\n return toReturn;\n }\n}\nclass CreateLeadGenAdFormResponse {\n static fromProto(proto) {\n let m = new CreateLeadGenAdFormResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.leadId !== 'undefined') {\n toReturn['leadId'] = this.leadId;\n }\n return toReturn;\n }\n}\nclass FetchLeadsRequest {\n static fromProto(proto) {\n let m = new FetchLeadsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.leadIds !== 'undefined') {\n toReturn['leadIds'] = this.leadIds;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n return toReturn;\n }\n}\nclass GetFormDataRequest {\n static fromProto(proto) {\n let m = new GetFormDataRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.formId !== 'undefined') {\n toReturn['formId'] = this.formId;\n }\n return toReturn;\n }\n}\nclass GetFormDataResponse {\n static fromProto(proto) {\n let m = new GetFormDataResponse();\n m = Object.assign(m, proto);\n if (proto.facebookForm) {\n m.facebookForm = FacebookForm.fromProto(proto.facebookForm);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.facebookForm !== 'undefined' && this.facebookForm !== null) {\n toReturn['facebookForm'] = 'toApiJson' in this.facebookForm ? this.facebookForm.toApiJson() : this.facebookForm;\n }\n return toReturn;\n }\n}\nclass GetLeadGenAdFormRequest {\n static fromProto(proto) {\n let m = new GetLeadGenAdFormRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.leadgenId !== 'undefined') {\n toReturn['leadgenId'] = this.leadgenId;\n }\n return toReturn;\n }\n}\nclass GetLeadGenAdFormResponse {\n static fromProto(proto) {\n let m = new GetLeadGenAdFormResponse();\n m = Object.assign(m, proto);\n if (proto.leadgenAdform) {\n m.leadgenAdform = LeadGenAdForm.fromProto(proto.leadgenAdform);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.leadgenAdform !== 'undefined' && this.leadgenAdform !== null) {\n toReturn['leadgenAdform'] = 'toApiJson' in this.leadgenAdform ? this.leadgenAdform.toApiJson() : this.leadgenAdform;\n }\n return toReturn;\n }\n}\nclass GetPagesDataRequest {\n static fromProto(proto) {\n let m = new GetPagesDataRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n if (typeof this.pageIds !== 'undefined') {\n toReturn['pageIds'] = this.pageIds;\n }\n return toReturn;\n }\n}\nclass GetPagesDataResponse {\n static fromProto(proto) {\n let m = new GetPagesDataResponse();\n m = Object.assign(m, proto);\n if (proto.pageData) {\n m.pageData = proto.pageData.map(PageData.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pageData !== 'undefined' && this.pageData !== null) {\n toReturn['pageData'] = 'toApiJson' in this.pageData ? this.pageData.toApiJson() : this.pageData;\n }\n return toReturn;\n }\n}\nclass ListFormsForPageRequest {\n static fromProto(proto) {\n let m = new ListFormsForPageRequest();\n m = Object.assign(m, proto);\n if (proto.facebookPaging) {\n m.facebookPaging = FacebookPagingRequest.fromProto(proto.facebookPaging);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n if (typeof this.facebookPaging !== 'undefined' && this.facebookPaging !== null) {\n toReturn['facebookPaging'] = 'toApiJson' in this.facebookPaging ? this.facebookPaging.toApiJson() : this.facebookPaging;\n }\n return toReturn;\n }\n}\nclass ListFormsForPageResponse {\n static fromProto(proto) {\n let m = new ListFormsForPageResponse();\n m = Object.assign(m, proto);\n if (proto.facebookForms) {\n m.facebookForms = proto.facebookForms.map(FacebookForm.fromProto);\n }\n if (proto.facebookPaging) {\n m.facebookPaging = FacebookPagingResponse.fromProto(proto.facebookPaging);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.facebookForms !== 'undefined' && this.facebookForms !== null) {\n toReturn['facebookForms'] = 'toApiJson' in this.facebookForms ? this.facebookForms.toApiJson() : this.facebookForms;\n }\n if (typeof this.facebookPaging !== 'undefined' && this.facebookPaging !== null) {\n toReturn['facebookPaging'] = 'toApiJson' in this.facebookPaging ? this.facebookPaging.toApiJson() : this.facebookPaging;\n }\n return toReturn;\n }\n}\nclass ListLeadGenAdFormsByPartnerIDRequest {\n static fromProto(proto) {\n let m = new ListLeadGenAdFormsByPartnerIDRequest();\n m = Object.assign(m, proto);\n if (proto.paging) {\n m.paging = PagedRequestOptions.fromProto(proto.paging);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.paging !== 'undefined' && this.paging !== null) {\n toReturn['paging'] = 'toApiJson' in this.paging ? this.paging.toApiJson() : this.paging;\n }\n return toReturn;\n }\n}\nclass ListLeadGenAdFormsByPartnerIDResponse {\n static fromProto(proto) {\n let m = new ListLeadGenAdFormsByPartnerIDResponse();\n m = Object.assign(m, proto);\n if (proto.leadgenAdforms) {\n m.leadgenAdforms = proto.leadgenAdforms.map(LeadGenAdForm.fromProto);\n }\n if (proto.paging) {\n m.paging = PagedResponseMetadata.fromProto(proto.paging);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.leadgenAdforms !== 'undefined' && this.leadgenAdforms !== null) {\n toReturn['leadgenAdforms'] = 'toApiJson' in this.leadgenAdforms ? this.leadgenAdforms.toApiJson() : this.leadgenAdforms;\n }\n if (typeof this.paging !== 'undefined' && this.paging !== null) {\n toReturn['paging'] = 'toApiJson' in this.paging ? this.paging.toApiJson() : this.paging;\n }\n return toReturn;\n }\n}\nclass ListPagesForPartnerRequest {\n static fromProto(proto) {\n let m = new ListPagesForPartnerRequest();\n m = Object.assign(m, proto);\n if (proto.facebookPaging) {\n m.facebookPaging = FacebookPagingRequest.fromProto(proto.facebookPaging);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.facebookPaging !== 'undefined' && this.facebookPaging !== null) {\n toReturn['facebookPaging'] = 'toApiJson' in this.facebookPaging ? this.facebookPaging.toApiJson() : this.facebookPaging;\n }\n return toReturn;\n }\n}\nclass ListPagesForPartnerResponse {\n static fromProto(proto) {\n let m = new ListPagesForPartnerResponse();\n m = Object.assign(m, proto);\n if (proto.facebookPage) {\n m.facebookPage = proto.facebookPage.map(FacebookPage.fromProto);\n }\n if (proto.facebookPaging) {\n m.facebookPaging = FacebookPagingResponse.fromProto(proto.facebookPaging);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.facebookPage !== 'undefined' && this.facebookPage !== null) {\n toReturn['facebookPage'] = 'toApiJson' in this.facebookPage ? this.facebookPage.toApiJson() : this.facebookPage;\n }\n if (typeof this.facebookPaging !== 'undefined' && this.facebookPaging !== null) {\n toReturn['facebookPaging'] = 'toApiJson' in this.facebookPaging ? this.facebookPaging.toApiJson() : this.facebookPaging;\n }\n return toReturn;\n }\n}\nclass PartnerLeadAdsTokenStatusRequest {\n static fromProto(proto) {\n let m = new PartnerLeadAdsTokenStatusRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass PartnerLeadAdsTokenStatusResponse {\n static fromProto(proto) {\n let m = new PartnerLeadAdsTokenStatusResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.exists !== 'undefined') {\n toReturn['exists'] = this.exists;\n }\n if (typeof this.valid !== 'undefined') {\n toReturn['valid'] = this.valid;\n }\n return toReturn;\n }\n}\nclass RegisterSessionToConnectLeadAdsForPartnerRequest {\n static fromProto(proto) {\n let m = new RegisterSessionToConnectLeadAdsForPartnerRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass RegisterSessionToConnectLeadAdsForPartnerResponse {\n static fromProto(proto) {\n let m = new RegisterSessionToConnectLeadAdsForPartnerResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.sessionId !== 'undefined') {\n toReturn['sessionId'] = this.sessionId;\n }\n return toReturn;\n }\n}\nclass SubscribePageToAppRequest {\n static fromProto(proto) {\n let m = new SubscribePageToAppRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n return toReturn;\n }\n}\nclass UnsubscribePageFromAppRequest {\n static fromProto(proto) {\n let m = new UnsubscribePageFromAppRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n return toReturn;\n }\n}\nclass VerifyLeadGenTokensRequest {\n static fromProto(proto) {\n let m = new VerifyLeadGenTokensRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n return toReturn;\n }\n}\nclass VerifyLeadGenTokensResponse {\n static fromProto(proto) {\n let m = new VerifyLeadGenTokensResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.exists !== 'undefined') {\n toReturn['exists'] = this.exists;\n }\n if (typeof this.valid !== 'undefined') {\n toReturn['valid'] = this.valid;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'facebook-api.vendasta-local.com',\n 'test': '',\n 'demo': 'facebook-api-demo.apigateway.co',\n 'prod': 'facebook-api-prod.apigateway.co',\n 'production': 'facebook-api-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet FacebookApiService = /*#__PURE__*/(() => {\n class FacebookApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n registerSessionToConnectLeadAdsForPartner(r) {\n const request = r.toApiJson ? r : new RegisterSessionToConnectLeadAdsForPartnerRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/RegisterSessionToConnectLeadAdsForPartner\", request.toApiJson(), this.apiOptions()).pipe(map(resp => RegisterSessionToConnectLeadAdsForPartnerResponse.fromProto(resp)));\n }\n partnerLeadAdsTokenStatus(r) {\n const request = r.toApiJson ? r : new PartnerLeadAdsTokenStatusRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/PartnerLeadAdsTokenStatus\", request.toApiJson(), this.apiOptions()).pipe(map(resp => PartnerLeadAdsTokenStatusResponse.fromProto(resp)));\n }\n subscribePageToApp(r) {\n const request = r.toApiJson ? r : new SubscribePageToAppRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/SubscribePageToApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n unsubscribePageFromApp(r) {\n const request = r.toApiJson ? r : new UnsubscribePageFromAppRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/UnsubscribePageFromApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n verifyLeadGenTokens(r) {\n const request = r.toApiJson ? r : new VerifyLeadGenTokensRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/VerifyLeadGenTokens\", request.toApiJson(), this.apiOptions()).pipe(map(resp => VerifyLeadGenTokensResponse.fromProto(resp)));\n }\n listPagesForPartner(r) {\n const request = r.toApiJson ? r : new ListPagesForPartnerRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/ListPagesForPartner\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListPagesForPartnerResponse.fromProto(resp)));\n }\n listFormsForPage(r) {\n const request = r.toApiJson ? r : new ListFormsForPageRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/ListFormsForPage\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListFormsForPageResponse.fromProto(resp)));\n }\n getFormData(r) {\n const request = r.toApiJson ? r : new GetFormDataRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/GetFormData\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetFormDataResponse.fromProto(resp)));\n }\n getPagesData(r) {\n const request = r.toApiJson ? r : new GetPagesDataRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/GetPagesData\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetPagesDataResponse.fromProto(resp)));\n }\n listLeadGenAdFormsByPartnerId(r) {\n const request = r.toApiJson ? r : new ListLeadGenAdFormsByPartnerIDRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/ListLeadGenAdFormsByPartnerID\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListLeadGenAdFormsByPartnerIDResponse.fromProto(resp)));\n }\n getLeadGenAdForm(r) {\n const request = r.toApiJson ? r : new GetLeadGenAdFormRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/GetLeadGenAdForm\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetLeadGenAdFormResponse.fromProto(resp)));\n }\n createLeadGenAdForm(r) {\n const request = r.toApiJson ? r : new CreateLeadGenAdFormRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/CreateLeadGenAdForm\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateLeadGenAdFormResponse.fromProto(resp)));\n }\n fetchLeads(r) {\n const request = r.toApiJson ? r : new FetchLeadsRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/FetchLeads\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n verifyTokenHasScopesForFeature(r) {\n const request = r.toApiJson ? r : new VerifyTokenHasScopesForFeatureRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/VerifyTokenHasScopesForFeature\", request.toApiJson(), this.apiOptions()).pipe(map(resp => VerifyTokenHasScopesForFeatureResponse.fromProto(resp)));\n }\n getUserName(r) {\n const request = r.toApiJson ? r : new GetUserNameRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/GetUserName\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetUserNameResponse.fromProto(resp)));\n }\n assignFacebookPageOwner(r) {\n const request = r.toApiJson ? r : new AssignFacebookPageOwnerRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/AssignFacebookPageOwner\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n sendFacebookMessage(r) {\n const request = r.toApiJson ? r : new SendFacebookMessageRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/SendFacebookMessage\", request.toApiJson(), this.apiOptions()).pipe(map(resp => SendFacebookMessageResponse.fromProto(resp)));\n }\n facebookPageMessengerState(r) {\n const request = r.toApiJson ? r : new FacebookPageMessengerStateRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/FacebookPageMessengerState\", request.toApiJson(), this.apiOptions()).pipe(map(resp => FacebookPageMessengerStateResponse.fromProto(resp)));\n }\n disableMessengerForPage(r) {\n const request = r.toApiJson ? r : new DisableMessengerForPageRequest(r);\n return this.http.post(this._host + \"/facebook.v1.Facebook/DisableMessengerForPage\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n FacebookApiService.ɵfac = function FacebookApiService_Factory(t) {\n return new (t || FacebookApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n FacebookApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: FacebookApiService,\n factory: FacebookApiService.ɵfac,\n providedIn: 'root'\n });\n return FacebookApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Index.\n// *********************************\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { FacebookApiService, TokenStatus };\n","import { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { FacebookApiService, TokenStatus } from '@vendasta/facebook';\nimport { Observable, catchError, firstValueFrom, map, of, shareReplay } from 'rxjs';\nimport {\n AuthLinksResponse,\n SocialConnectionLinks,\n SocialConnections,\n SocialPageFacebook,\n VAPIResponse,\n} from '../interfaces';\n\nexport interface FacebookPageConnectionInfo {\n name: string;\n tokenStatus: TokenStatus;\n messengerEnabled: boolean;\n isAssignedPageOwner: boolean;\n statusCheckPermissionError?: boolean;\n}\n\n@Injectable({\n providedIn: 'any',\n})\nexport class FacebookMessengerService {\n private readonly fbAPIService = inject(FacebookApiService);\n private readonly http = inject(HttpClient);\n\n connectPage(accountID: string, facebookPageData: SocialPageFacebook): Observable {\n const facebookPageID = facebookPageData.profileUrl?.split('id=')[1] ?? '';\n if (!facebookPageID) {\n return of(false);\n }\n\n return this.fbAPIService\n .assignFacebookPageOwner({\n organizationId: accountID,\n facebookPageId: facebookPageID,\n })\n .pipe(\n map(() => {\n return true;\n }),\n catchError(() => {\n return of(false);\n }),\n );\n }\n\n async redirectToFacebookAuth(accountID: string): Promise {\n const protocol = window.location.protocol;\n const host = window.location.host;\n const baseUrl = `${protocol}//${host}`;\n const newUrl: URL = new URL(baseUrl);\n newUrl.pathname = `/account/location/${accountID}/settings/connections/target/inbox`;\n\n const authUrls = await firstValueFrom(this.getAuthUrls(accountID, newUrl));\n const serviceAuthURL = authUrls.facebook;\n const serviceName = 'Facebook';\n const oauthUrl = [\n serviceAuthURL.slice(0, serviceAuthURL.indexOf('&spid')),\n `?type=${serviceName}&includeMessengerScopes=true`,\n serviceAuthURL.slice(serviceAuthURL.indexOf('&spid')),\n ].join('');\n window.location.href = oauthUrl;\n }\n\n disconnectPage(accountID: string, facebookPageData: SocialPageFacebook): Observable {\n const facebookPageID = facebookPageData.profileUrl?.split('id=')[1] ?? '';\n if (!facebookPageID) {\n return of(false);\n }\n\n return this.fbAPIService\n .disableMessengerForPage({\n organizationId: accountID,\n facebookPageId: facebookPageID,\n })\n .pipe(\n map(() => true),\n catchError(() => of(false)),\n );\n }\n\n getPagesForAccount(accountGroupId: string): Observable {\n return this.getSocialProfileConnections(accountGroupId).pipe(\n map((connections) => {\n let fbPages: SocialPageFacebook[] = [];\n const fbUsers = connections.facebook ?? [];\n for (const fbUser of fbUsers) {\n fbPages = fbPages.concat(\n fbUser.pages.map((page: SocialPageFacebook) => {\n page.facebookUserID = fbUser.ssid.split('-')[1];\n return page;\n }),\n );\n }\n return fbPages;\n }),\n );\n }\n\n getPageInfo(\n facebookPageData: SocialPageFacebook,\n partnerID: string,\n accountGroupID: string,\n ): Observable {\n const enabledForPage$ = this.fbAPIService.facebookPageMessengerState({\n organizationId: partnerID + ':' + accountGroupID,\n pageId: facebookPageData.profileUrl?.split('id=')[1],\n facebookUserId: facebookPageData.facebookUserID,\n });\n\n return enabledForPage$.pipe(\n map((enabledForPage) => {\n return {\n name: facebookPageData.name,\n tokenStatus: TokenStatus.VALID,\n messengerEnabled: !!enabledForPage.messengerEnabled,\n isAssignedPageOwner: !!enabledForPage.isPageOwner,\n };\n }),\n catchError((e: HttpErrorResponse) => {\n const statusCheckPermissionError = e.status === 403;\n return of({\n name: facebookPageData.name,\n tokenStatus: TokenStatus.UNKNOWN,\n messengerEnabled: false,\n isAssignedPageOwner: false,\n statusCheckPermissionError,\n });\n }),\n );\n }\n\n private getSocialProfileConnections(accountGroupId: string): Observable {\n return this.http\n .get('/ajax/v1/get-social-profile-connections/', {\n params: {\n accountGroupId: accountGroupId,\n },\n })\n .pipe(\n map((response) => response.data),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n private getAuthUrls(accountGroupId: string, nextUrl: URL): Observable {\n let newUrl = nextUrl.href;\n const urlParts = nextUrl.pathname.split('/');\n urlParts.forEach((part) => {\n if (part.startsWith('AG-')) {\n newUrl = newUrl.replace(part, accountGroupId);\n }\n });\n return this.http\n .get('/ajax/v1/get-auth-urls/', {\n params: {\n accountGroupId: accountGroupId,\n nextUrl: newUrl,\n },\n })\n .pipe(\n map((response) => {\n return response.data;\n }),\n );\n }\n}\n","import { Capacitor } from '@capacitor/core';\n\nexport function isNativeApp(): boolean {\n return Capacitor.isNativePlatform();\n}\n","import { registerPlugin } from '@capacitor/core';\nconst Browser = registerPlugin('Browser', {\n web: () => import('./web').then(m => new m.BrowserWeb())\n});\nexport * from './definitions';\nexport { Browser };\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport { map } from 'rxjs/operators';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass MethodMetadata {\n static fromProto(proto) {\n let m = new MethodMetadata();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.isPublic !== 'undefined') {\n toReturn['isPublic'] = this.isPublic;\n }\n if (typeof this.scopes !== 'undefined') {\n toReturn['scopes'] = this.scopes;\n }\n return toReturn;\n }\n}\nclass SDKMetadata {\n static fromProto(proto) {\n let m = new SDKMetadata();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.sdkName !== 'undefined') {\n toReturn['sdkName'] = this.sdkName;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar Alignment = /*#__PURE__*/function (Alignment) {\n Alignment[Alignment[\"ALIGNMENT_RELAXED\"] = 0] = \"ALIGNMENT_RELAXED\";\n Alignment[Alignment[\"ALIGNMENT_STRICT\"] = 1] = \"ALIGNMENT_STRICT\";\n return Alignment;\n}(Alignment || {});\nvar DMARCPolicy = /*#__PURE__*/function (DMARCPolicy) {\n DMARCPolicy[DMARCPolicy[\"DMARC_POLICY_NONE\"] = 0] = \"DMARC_POLICY_NONE\";\n DMARCPolicy[DMARCPolicy[\"DMARC_POLICY_QUARANTINE\"] = 1] = \"DMARC_POLICY_QUARANTINE\";\n DMARCPolicy[DMARCPolicy[\"DMARC_POLICY_REJECT\"] = 2] = \"DMARC_POLICY_REJECT\";\n return DMARCPolicy;\n}(DMARCPolicy || {});\nvar ReportOption = /*#__PURE__*/function (ReportOption) {\n ReportOption[ReportOption[\"REPORT_OPTION_ALL_FAILED\"] = 0] = \"REPORT_OPTION_ALL_FAILED\";\n ReportOption[ReportOption[\"REPORT_OPTION_ANY_FAILED\"] = 1] = \"REPORT_OPTION_ANY_FAILED\";\n ReportOption[ReportOption[\"REPORT_OPTION_DKIM_FAILED\"] = 2] = \"REPORT_OPTION_DKIM_FAILED\";\n ReportOption[ReportOption[\"REPORT_OPTION_SPF_FAILED\"] = 3] = \"REPORT_OPTION_SPF_FAILED\";\n return ReportOption;\n}(ReportOption || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar DNSRecordType = /*#__PURE__*/function (DNSRecordType) {\n DNSRecordType[DNSRecordType[\"A_RECORD\"] = 0] = \"A_RECORD\";\n DNSRecordType[DNSRecordType[\"CNAME_RECORD\"] = 1] = \"CNAME_RECORD\";\n DNSRecordType[DNSRecordType[\"CAA_RECORD\"] = 2] = \"CAA_RECORD\";\n DNSRecordType[DNSRecordType[\"TXT_RECORD\"] = 3] = \"TXT_RECORD\";\n DNSRecordType[DNSRecordType[\"AAAA_RECORD\"] = 4] = \"AAAA_RECORD\";\n return DNSRecordType;\n}(DNSRecordType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar MechanismType = /*#__PURE__*/function (MechanismType) {\n MechanismType[MechanismType[\"MECHANISM_TYPE_ALL\"] = 0] = \"MECHANISM_TYPE_ALL\";\n MechanismType[MechanismType[\"MECHANISM_TYPE_INCLUDE\"] = 1] = \"MECHANISM_TYPE_INCLUDE\";\n MechanismType[MechanismType[\"MECHANISM_TYPE_A\"] = 2] = \"MECHANISM_TYPE_A\";\n MechanismType[MechanismType[\"MECHANISM_TYPE_MX\"] = 3] = \"MECHANISM_TYPE_MX\";\n MechanismType[MechanismType[\"MECHANISM_TYPE_PTR\"] = 4] = \"MECHANISM_TYPE_PTR\";\n MechanismType[MechanismType[\"MECHANISM_TYPE_IP4\"] = 5] = \"MECHANISM_TYPE_IP4\";\n MechanismType[MechanismType[\"MECHANISM_TYPE_IP6\"] = 6] = \"MECHANISM_TYPE_IP6\";\n MechanismType[MechanismType[\"MECHANISM_TYPE_EXISTS\"] = 7] = \"MECHANISM_TYPE_EXISTS\";\n return MechanismType;\n}(MechanismType || {});\nvar Qualifier = /*#__PURE__*/function (Qualifier) {\n Qualifier[Qualifier[\"QUALIFIER_PASS\"] = 0] = \"QUALIFIER_PASS\";\n Qualifier[Qualifier[\"QUALIFIER_FAIL\"] = 1] = \"QUALIFIER_FAIL\";\n Qualifier[Qualifier[\"QUALIFIER_SOFT_FAIL\"] = 2] = \"QUALIFIER_SOFT_FAIL\";\n Qualifier[Qualifier[\"QUALIFIER_NEUTRAL\"] = 3] = \"QUALIFIER_NEUTRAL\";\n return Qualifier;\n}(Qualifier || {});\n// *********************************\n\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass DMARCRecord {\n static fromProto(proto) {\n let m = new DMARCRecord();\n m = Object.assign(m, proto);\n if (proto.domainPolicy) {\n m.domainPolicy = enumStringToValue$4(DMARCPolicy, proto.domainPolicy);\n }\n if (proto.subdomainPolicy) {\n m.subdomainPolicy = enumStringToValue$4(DMARCPolicy, proto.subdomainPolicy);\n }\n if (proto.dkimAlignment) {\n m.dkimAlignment = enumStringToValue$4(Alignment, proto.dkimAlignment);\n }\n if (proto.spfAlignment) {\n m.spfAlignment = enumStringToValue$4(Alignment, proto.spfAlignment);\n }\n if (proto.reportOption) {\n m.reportOption = enumStringToValue$4(ReportOption, proto.reportOption);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.version !== 'undefined') {\n toReturn['version'] = this.version;\n }\n if (typeof this.reportAggregate !== 'undefined') {\n toReturn['reportAggregate'] = this.reportAggregate;\n }\n if (typeof this.reportForensics !== 'undefined') {\n toReturn['reportForensics'] = this.reportForensics;\n }\n if (typeof this.filterPercent !== 'undefined') {\n toReturn['filterPercent'] = this.filterPercent;\n }\n if (typeof this.domainPolicy !== 'undefined') {\n toReturn['domainPolicy'] = this.domainPolicy;\n }\n if (typeof this.subdomainPolicy !== 'undefined') {\n toReturn['subdomainPolicy'] = this.subdomainPolicy;\n }\n if (typeof this.dkimAlignment !== 'undefined') {\n toReturn['dkimAlignment'] = this.dkimAlignment;\n }\n if (typeof this.spfAlignment !== 'undefined') {\n toReturn['spfAlignment'] = this.spfAlignment;\n }\n if (typeof this.reportOption !== 'undefined') {\n toReturn['reportOption'] = this.reportOption;\n }\n if (typeof this.raw !== 'undefined') {\n toReturn['raw'] = this.raw;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass AAAARecord {\n static fromProto(proto) {\n let m = new AAAARecord();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass ARecord {\n static fromProto(proto) {\n let m = new ARecord();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass CAARecord {\n static fromProto(proto) {\n let m = new CAARecord();\n m = Object.assign(m, proto);\n if (proto.value) {\n m.value = proto.value.map(CAAValue.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.value !== 'undefined' && this.value !== null) {\n toReturn['value'] = 'toApiJson' in this.value ? this.value.toApiJson() : this.value;\n }\n return toReturn;\n }\n}\nclass CAAValue {\n static fromProto(proto) {\n let m = new CAAValue();\n m = Object.assign(m, proto);\n if (proto.ttl) {\n m.ttl = parseInt(proto.ttl, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n if (typeof this.issuerCriticalFlag !== 'undefined') {\n toReturn['issuerCriticalFlag'] = this.issuerCriticalFlag;\n }\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n if (typeof this.ttl !== 'undefined') {\n toReturn['ttl'] = this.ttl;\n }\n if (typeof this.recordClass !== 'undefined') {\n toReturn['recordClass'] = this.recordClass;\n }\n return toReturn;\n }\n}\nclass CNameRecord {\n static fromProto(proto) {\n let m = new CNameRecord();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass TXTRecord {\n static fromProto(proto) {\n let m = new TXTRecord();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Directive {\n static fromProto(proto) {\n let m = new Directive();\n m = Object.assign(m, proto);\n if (proto.qualifier) {\n m.qualifier = enumStringToValue$2(Qualifier, proto.qualifier);\n }\n if (proto.type) {\n m.type = enumStringToValue$2(MechanismType, proto.type);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.qualifier !== 'undefined') {\n toReturn['qualifier'] = this.qualifier;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass Modifier {\n static fromProto(proto) {\n let m = new Modifier();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.tag !== 'undefined') {\n toReturn['tag'] = this.tag;\n }\n if (typeof this.value !== 'undefined') {\n toReturn['value'] = this.value;\n }\n return toReturn;\n }\n}\nclass SPFRecord {\n static fromProto(proto) {\n let m = new SPFRecord();\n m = Object.assign(m, proto);\n if (proto.directives) {\n m.directives = proto.directives.map(Directive.fromProto);\n }\n if (proto.modifiers) {\n m.modifiers = proto.modifiers.map(Modifier.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.version !== 'undefined') {\n toReturn['version'] = this.version;\n }\n if (typeof this.directives !== 'undefined' && this.directives !== null) {\n toReturn['directives'] = 'toApiJson' in this.directives ? this.directives.toApiJson() : this.directives;\n }\n if (typeof this.modifiers !== 'undefined' && this.modifiers !== null) {\n toReturn['modifiers'] = 'toApiJson' in this.modifiers ? this.modifiers.toApiJson() : this.modifiers;\n }\n if (typeof this.raw !== 'undefined') {\n toReturn['raw'] = this.raw;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Access {\n static fromProto(proto) {\n let m = new Access();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scope !== 'undefined') {\n toReturn['scope'] = this.scope;\n }\n if (typeof this.public !== 'undefined') {\n toReturn['public'] = this.public;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Domain {\n static fromProto(proto) {\n let m = new Domain();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.domain !== 'undefined') {\n toReturn['domain'] = this.domain;\n }\n if (typeof this.secure !== 'undefined') {\n toReturn['secure'] = this.secure;\n }\n return toReturn;\n }\n}\nclass GetDMARCRecordRequest {\n static fromProto(proto) {\n let m = new GetDMARCRecordRequest();\n m = Object.assign(m, proto);\n if (proto.primary) {\n m.primary = Domain.fromProto(proto.primary);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.primary !== 'undefined' && this.primary !== null) {\n toReturn['primary'] = 'toApiJson' in this.primary ? this.primary.toApiJson() : this.primary;\n }\n return toReturn;\n }\n}\nclass GetDMARCRecordResponse {\n static fromProto(proto) {\n let m = new GetDMARCRecordResponse();\n m = Object.assign(m, proto);\n if (proto.record) {\n m.record = DMARCRecord.fromProto(proto.record);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.record !== 'undefined' && this.record !== null) {\n toReturn['record'] = 'toApiJson' in this.record ? this.record.toApiJson() : this.record;\n }\n return toReturn;\n }\n}\nclass GetDNSRecordsRequest {\n static fromProto(proto) {\n let m = new GetDNSRecordsRequest();\n m = Object.assign(m, proto);\n if (proto.recordTypes) {\n m.recordTypes = proto.recordTypes.map(v => enumStringToValue(DNSRecordType, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.domain !== 'undefined') {\n toReturn['domain'] = this.domain;\n }\n if (typeof this.recordTypes !== 'undefined') {\n toReturn['recordTypes'] = this.recordTypes;\n }\n return toReturn;\n }\n}\nclass GetDNSRecordsResponse {\n static fromProto(proto) {\n let m = new GetDNSRecordsResponse();\n m = Object.assign(m, proto);\n if (proto.aRecord) {\n m.aRecord = ARecord.fromProto(proto.aRecord);\n }\n if (proto.cnameRecord) {\n m.cnameRecord = CNameRecord.fromProto(proto.cnameRecord);\n }\n if (proto.caaRecord) {\n m.caaRecord = CAARecord.fromProto(proto.caaRecord);\n }\n if (proto.aaaaRecord) {\n m.aaaaRecord = AAAARecord.fromProto(proto.aaaaRecord);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.domain !== 'undefined') {\n toReturn['domain'] = this.domain;\n }\n if (typeof this.aRecord !== 'undefined' && this.aRecord !== null) {\n toReturn['aRecord'] = 'toApiJson' in this.aRecord ? this.aRecord.toApiJson() : this.aRecord;\n }\n if (typeof this.cnameRecord !== 'undefined' && this.cnameRecord !== null) {\n toReturn['cnameRecord'] = 'toApiJson' in this.cnameRecord ? this.cnameRecord.toApiJson() : this.cnameRecord;\n }\n if (typeof this.caaRecord !== 'undefined' && this.caaRecord !== null) {\n toReturn['caaRecord'] = 'toApiJson' in this.caaRecord ? this.caaRecord.toApiJson() : this.caaRecord;\n }\n if (typeof this.aaaaRecord !== 'undefined' && this.aaaaRecord !== null) {\n toReturn['aaaaRecord'] = 'toApiJson' in this.aaaaRecord ? this.aaaaRecord.toApiJson() : this.aaaaRecord;\n }\n return toReturn;\n }\n}\nclass GetDomainByIdentifierRequest {\n static fromProto(proto) {\n let m = new GetDomainByIdentifierRequest();\n m = Object.assign(m, proto);\n if (proto.identifier) {\n m.identifier = Identifier.fromProto(proto.identifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.identifier !== 'undefined' && this.identifier !== null) {\n toReturn['identifier'] = 'toApiJson' in this.identifier ? this.identifier.toApiJson() : this.identifier;\n }\n return toReturn;\n }\n}\nclass GetDomainByIdentifierResponse {\n static fromProto(proto) {\n let m = new GetDomainByIdentifierResponse();\n m = Object.assign(m, proto);\n if (proto.primary) {\n m.primary = Domain.fromProto(proto.primary);\n }\n if (proto.secondaries) {\n m.secondaries = proto.secondaries.map(Domain.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.primary !== 'undefined' && this.primary !== null) {\n toReturn['primary'] = 'toApiJson' in this.primary ? this.primary.toApiJson() : this.primary;\n }\n if (typeof this.secondaries !== 'undefined' && this.secondaries !== null) {\n toReturn['secondaries'] = 'toApiJson' in this.secondaries ? this.secondaries.toApiJson() : this.secondaries;\n }\n return toReturn;\n }\n}\nclass GetIdentifierByDomainRequest {\n static fromProto(proto) {\n let m = new GetIdentifierByDomainRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.domain !== 'undefined') {\n toReturn['domain'] = this.domain;\n }\n return toReturn;\n }\n}\nclass GetIdentifierByDomainResponse {\n static fromProto(proto) {\n let m = new GetIdentifierByDomainResponse();\n m = Object.assign(m, proto);\n if (proto.identifier) {\n m.identifier = Identifier.fromProto(proto.identifier);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.identifier !== 'undefined' && this.identifier !== null) {\n toReturn['identifier'] = 'toApiJson' in this.identifier ? this.identifier.toApiJson() : this.identifier;\n }\n return toReturn;\n }\n}\nclass GetSPFRecordRequest {\n static fromProto(proto) {\n let m = new GetSPFRecordRequest();\n m = Object.assign(m, proto);\n if (proto.primary) {\n m.primary = Domain.fromProto(proto.primary);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.primary !== 'undefined' && this.primary !== null) {\n toReturn['primary'] = 'toApiJson' in this.primary ? this.primary.toApiJson() : this.primary;\n }\n return toReturn;\n }\n}\nclass GetSPFRecordResponse {\n static fromProto(proto) {\n let m = new GetSPFRecordResponse();\n m = Object.assign(m, proto);\n if (proto.record) {\n m.record = SPFRecord.fromProto(proto.record);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.record !== 'undefined' && this.record !== null) {\n toReturn['record'] = 'toApiJson' in this.record ? this.record.toApiJson() : this.record;\n }\n return toReturn;\n }\n}\nclass Identifier {\n static fromProto(proto) {\n let m = new Identifier();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.contextualIdentifier !== 'undefined') {\n toReturn['contextualIdentifier'] = this.contextualIdentifier;\n }\n return toReturn;\n }\n}\n\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'domain-api.vendasta-local.com',\n 'test': '',\n 'demo': 'domain-demo.apigateway.co',\n 'prod': 'domain-prod.apigateway.co',\n 'production': 'domain-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\nlet DomainApiService = /*#__PURE__*/(() => {\n class DomainApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n getDnsRecords(r) {\n const request = r.toApiJson ? r : new GetDNSRecordsRequest(r);\n return this.http.post(this._host + \"/domain.v1.DomainService/GetDNSRecords\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetDNSRecordsResponse.fromProto(resp)));\n }\n getIdentifierByDomain(r) {\n const request = r.toApiJson ? r : new GetIdentifierByDomainRequest(r);\n return this.http.post(this._host + \"/domain.v1.DomainService/GetIdentifierByDomain\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetIdentifierByDomainResponse.fromProto(resp)));\n }\n getDomainByIdentifier(r) {\n const request = r.toApiJson ? r : new GetDomainByIdentifierRequest(r);\n return this.http.post(this._host + \"/domain.v1.DomainService/GetDomainByIdentifier\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetDomainByIdentifierResponse.fromProto(resp)));\n }\n getSpfRecord(r) {\n const request = r.toApiJson ? r : new GetSPFRecordRequest(r);\n return this.http.post(this._host + \"/domain.v1.DomainService/GetSPFRecord\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetSPFRecordResponse.fromProto(resp)));\n }\n getDmarcRecord(r) {\n const request = r.toApiJson ? r : new GetDMARCRecordRequest(r);\n return this.http.post(this._host + \"/domain.v1.DomainService/GetDMARCRecord\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetDMARCRecordResponse.fromProto(resp)));\n }\n }\n DomainApiService.ɵfac = function DomainApiService_Factory(t) {\n return new (t || DomainApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n DomainApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DomainApiService,\n factory: DomainApiService.ɵfac,\n providedIn: 'root'\n });\n return DomainApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet DomainService = /*#__PURE__*/(() => {\n class DomainService {\n constructor(api) {\n this.api = api;\n }\n getDomainByIdentifier(contextualIdentifier) {\n return this.api.getDomainByIdentifier({\n identifier: {\n contextualIdentifier: contextualIdentifier\n }\n });\n }\n getSpfRecord(domain) {\n return this.api.getSpfRecord({\n primary: {\n domain: domain.domain,\n secure: domain.secure\n }\n }).pipe(map(resp => resp.record));\n }\n getDmarcRecord(domain) {\n return this.api.getDmarcRecord({\n primary: {\n domain: domain.domain,\n secure: domain.secure\n }\n }).pipe(map(resp => resp.record));\n }\n }\n DomainService.ɵfac = function DomainService_Factory(t) {\n return new (t || DomainService)(i0.ɵɵinject(DomainApiService));\n };\n DomainService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DomainService,\n factory: DomainService.ɵfac,\n providedIn: 'root'\n });\n return DomainService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { DMARCRecord, DomainService, GetDomainByIdentifierResponse, SPFRecord };\n","import { CommonModule } from '@angular/common';\nimport { Component, Input, inject, signal } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { Browser } from '@capacitor/browser';\nimport { PARTNER_ID_TOKEN } from '../../../../core/src/index';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { DomainService } from '@vendasta/domain';\nimport { firstValueFrom, map, shareReplay, switchMap } from 'rxjs';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\n\n@Component({\n standalone: true,\n selector: 'inbox-manage-on-web',\n templateUrl: './manage-on-web.component.html',\n styleUrls: ['./manage-on-web.component.scss'],\n imports: [CommonModule, TranslateModule, MatButtonModule, MatProgressSpinnerModule],\n providers: [DomainService],\n})\nexport class ManageOnWebComponent {\n @Input() description?: string;\n @Input() url?: string;\n\n private readonly domainService = inject(DomainService);\n private readonly snackbarService = inject(SnackbarService);\n private readonly partnerId$ = inject(PARTNER_ID_TOKEN);\n\n private readonly currentHost$ = this.partnerId$.pipe(\n switchMap((partnerId) => this.domainService.getDomainByIdentifier(`/application/VBC/partner/${partnerId}`)),\n map((resp) => {\n const scheme = resp.primary.secure ? 'https://' : 'http://';\n return scheme + resp.primary.domain;\n }),\n shareReplay({ bufferSize: 1, refCount: true }),\n );\n\n readonly isLoading = signal(false);\n\n async openInWeb(): Promise {\n this.isLoading.set(true);\n try {\n const host = await firstValueFrom(this.currentHost$);\n await Browser.open({\n url: this.url ? this.url : host + window.location.pathname,\n presentationStyle: 'popover',\n });\n } catch (error) {\n console.error('Failed to open in web', error);\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.MANAGE_ON_WEB_ERROR');\n }\n this.isLoading.set(false);\n }\n}\n","
\n {{ description }}\n
\n\n","import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, OnChanges, Signal, signal, SimpleChanges } from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { filter, firstValueFrom, switchMap } from 'rxjs';\nimport { SocialPageFacebook } from '../interfaces';\nimport { FacebookMessengerService, FacebookPageConnectionInfo } from './facebook-messenger.service';\nimport { TokenStatus } from '@vendasta/facebook';\nimport { isNativeApp } from '../../../../core/src/lib/mobile';\nimport { ManageOnWebComponent } from '../manage-on-web/manage-on-web.component';\n\ntype badgeValue = {\n color: 'red' | 'green';\n i18nKey: string;\n};\n\ntype displayedButton = 'sign-in' | 'enable' | 'disable' | null;\n\n@Component({\n selector: 'inbox-facebook-messenger',\n standalone: true,\n imports: [\n CommonModule,\n MatCardModule,\n MatIconModule,\n MatButtonModule,\n TranslateModule,\n GalaxyBadgeModule,\n MatProgressSpinnerModule,\n GalaxyAlertModule,\n GalaxyPopoverModule,\n GalaxySnackbarModule,\n ManageOnWebComponent,\n ],\n templateUrl: './facebook-messenger.component.html',\n styleUrl: './facebook-messenger.component.scss',\n})\nexport class FacebookMessengerComponent implements OnChanges {\n readonly isNativeApp = isNativeApp();\n\n readonly loading = computed(() => this.loadingAccounts() || this.loadingPage());\n private readonly loadingAccounts = signal(true);\n private readonly loadingPage = signal(false);\n\n readonly pageName: Signal;\n readonly badgeValue: Signal;\n readonly manyPages: Signal;\n readonly noPages: Signal;\n readonly buttonToDisplay: Signal;\n readonly authTokenMissingPermissions: Signal;\n readonly unknownError: Signal;\n // user does not have required auth to view connection status, connect, or disconnect\n readonly authError: Signal;\n readonly messengerEnabled: Signal;\n\n private readonly connectedPages = signal([]);\n private readonly pageInfo = signal(null);\n\n @Input({ required: true }) accountID = '';\n @Input({ required: true }) partnerID = '';\n\n constructor(\n private readonly facebookMessengerService: FacebookMessengerService,\n private readonly snackbarService: SnackbarService,\n ) {\n this.manyPages = computed(() => {\n return this.connectedPages().length > 1;\n });\n\n this.noPages = computed(() => {\n return this.connectedPages().length === 0;\n });\n\n toObservable(this.connectedPages)\n .pipe(\n takeUntilDestroyed(),\n filter((connectedPages) => connectedPages.length > 0),\n switchMap((connectedPages) =>\n this.facebookMessengerService.getPageInfo(connectedPages[0], this.partnerID, this.accountID),\n ),\n )\n .subscribe((pageInfo) => {\n this.loadingPage.set(false);\n this.pageInfo.set(pageInfo);\n });\n\n this.messengerEnabled = computed(\n () =>\n (this.pageInfo()?.messengerEnabled &&\n this.pageInfo()?.tokenStatus === TokenStatus.VALID &&\n this.pageInfo()?.isAssignedPageOwner) ??\n false,\n );\n\n this.badgeValue = computed(() => {\n return {\n color: this.messengerEnabled() ? 'green' : 'red',\n i18nKey: this.messengerEnabled() ? 'INBOX.SETTINGS.ACTIVE' : 'INBOX.SETTINGS.INACTIVE',\n };\n });\n this.pageName = computed(() => this.pageInfo()?.name ?? '');\n this.authTokenMissingPermissions = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.MISSING_PERMISSIONS);\n this.unknownError = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.INVALID);\n this.authError = computed(() => this.pageInfo()?.statusCheckPermissionError ?? false);\n\n this.buttonToDisplay = computed(() => {\n if (this.noPages()) {\n return 'sign-in';\n } else if (this.messengerEnabled()) {\n return 'disable';\n } else if (this.unknownError()) {\n return null;\n } else if (!this.messengerEnabled() && this.pageInfo()?.tokenStatus === TokenStatus.VALID) {\n return 'enable';\n } else {\n return null;\n }\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['accountID']) {\n this.loadingAccounts.set(true);\n firstValueFrom(this.facebookMessengerService.getPagesForAccount(changes['accountID'].currentValue))\n .then((pages) => {\n if (pages.length > 0) {\n this.connectedPages.set(pages);\n this.loadingPage.set(true);\n } else {\n this.connectedPages.set([]);\n }\n })\n .catch(() => {\n this.connectedPages.set([]);\n })\n .finally(() => {\n this.loadingAccounts.set(false);\n });\n }\n }\n\n authClick() {\n this.facebookMessengerService.redirectToFacebookAuth(this.accountID);\n }\n\n async connect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.facebookMessengerService.connectPage(this.accountID, this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_ENABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_ENABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n\n async disconnect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.facebookMessengerService.disconnectPage(this.accountID, this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_DISABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_DISABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n}\n","\n \n \n \n {{ badgeValue()!.i18nKey | translate }}\n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.TITLE' | translate }}\n \n \n
\n \n
\n \n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECTED_DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.FACEBOOK_PAGE_NAME' | translate }}: \n \n {{ pageName() }}\n \n

\n

\n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.TURN_ON_MESSAGING' | translate }}\n \n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.SIGN_IN_TO_FACEBOOK' | translate }}\n \n \n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECT' | translate }}\n \n

\n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.UNKNOWN_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PLEASE_TRY_RECONNECTING' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PERMISSIONS_ERROR_DESCRIPTION' | translate }}\n

\n
\n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.RECONNECT_TO_GRANT_PERMISSIONS' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.WARNINGS.MULTIPLE_PAGES_LINKED' | translate }}\n
\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.WARNINGS.MULTIPLE_PAGES_LINKED_DESCRIPTION' | translate }}\n \n

\n
\n
\n
\n
\n
\n\n\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECT_TITLE' | translate }}\n {{ 'INBOX.SETTINGS.FACEBOOK_MESSENGER.DISCONNECT_DESCRIPTION' | translate }}\n \n \n \n \n\n\n\n \n\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable, map, shareReplay } from 'rxjs';\nimport { AuthLinksResponse, SocialConnectionLinks, SocialConnections, VAPIResponse } from '../interfaces';\n\n@Injectable()\nexport class GoogleBusinessConnectionsService {\n constructor(private readonly http: HttpClient) {}\n\n getAuthUrls(accountGroupId: string, nextUrl: URL): Observable {\n let newUrl = nextUrl.href;\n const urlParts = nextUrl.pathname.split('/');\n urlParts.forEach((part) => {\n if (part.startsWith('AG-')) {\n newUrl = newUrl.replace(part, accountGroupId);\n }\n });\n return this.http\n .get('/ajax/v1/get-auth-urls/', {\n params: {\n accountGroupId: accountGroupId,\n nextUrl: newUrl,\n },\n })\n .pipe(\n map((response) => {\n return response.data;\n }),\n );\n }\n\n getSocialProfileConnections(accountGroupId: string): Observable {\n return this.http\n .get('/ajax/v1/get-social-profile-connections/', {\n params: {\n accountGroupId: accountGroupId,\n },\n })\n .pipe(\n map((response) => response.data),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { HttpClient, HttpErrorResponse } from '@angular/common/http';\nimport { Component, Inject, InjectionToken, Signal, computed, inject, signal } from '@angular/core';\nimport { FormsModule } from '@angular/forms';\nimport { MatBadgeModule } from '@angular/material/badge';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { AccountGroupService as AccountGroupSDK, ProjectionFilter } from '@galaxy/account-group';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyButtonLoadingIndicatorModule } from '@vendasta/galaxy/button-loading-indicator';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { GalaxyTooltipModule } from '@vendasta/galaxy/tooltip';\nimport { BusinessCommunicationsApiService } from '@vendasta/google-my-business';\nimport { Observable, firstValueFrom, lastValueFrom, map, shareReplay, switchMap } from 'rxjs';\nimport { ACCOUNT_GROUP_ID_TOKEN, PARTNER_ID_TOKEN } from '../../../../core/src/lib/tokens';\nimport { SocialConnectionLinks, SocialPageMeta } from '../interfaces';\nimport { GoogleBusinessConnectionsService } from './google-business-connections.service';\nimport { isNativeApp } from '../../../../core/src/lib/mobile';\nimport { ManageOnWebComponent } from '../manage-on-web/manage-on-web.component';\n\n// gbp = Google Business Profile\ntype alertTypes = 'no-alert' | 'auth-insufficient' | 'gbp-not-connected' | 'gbp-not-verified' | 'setup-blocked';\n\nconst googleBusinessConnectionsServiceToken = new InjectionToken(\n 'GoogleBusinessConnectionsService',\n);\n\nfunction googleBusinessConnectionsServiceFactory(): GoogleBusinessConnectionsService {\n try {\n return inject(GoogleBusinessConnectionsService);\n } catch (e) {\n return new GoogleBusinessConnectionsService(inject(HttpClient));\n }\n}\n\n@Component({\n standalone: true,\n selector: 'inbox-google-business-communication-card',\n templateUrl: './google-business-communication-card.component.html',\n styleUrls: ['./google-business-communication-card.component.scss'],\n imports: [\n CommonModule,\n GalaxyBadgeModule,\n MatButtonModule,\n MatCardModule,\n MatBadgeModule,\n FormsModule,\n GalaxyButtonLoadingIndicatorModule,\n MatProgressSpinnerModule,\n GalaxyAlertModule,\n MatIconModule,\n GalaxyTooltipModule,\n GalaxyBadgeModule,\n GalaxyPopoverModule,\n TranslateModule,\n ManageOnWebComponent,\n ],\n providers: [\n {\n provide: googleBusinessConnectionsServiceToken,\n useFactory: googleBusinessConnectionsServiceFactory,\n },\n ],\n})\nexport class GoogleBusinessCommunicationCardComponent {\n private loadingEnabledStatus = signal(true);\n private loadingCanEnable = signal(true);\n\n private readonly socialProfileId$: Observable;\n\n // this means the feature is active\n readonly googleBusinessMessagesEnabled = signal(false);\n readonly canEnable = signal(false);\n readonly setupBlocked = signal(false);\n readonly isNativeApp = isNativeApp();\n\n readonly loading: Signal;\n showAlert: Signal;\n badgeColor: Signal<'red' | 'green'>;\n\n readonly businessInfo = signal(null);\n private readonly loadingGoogleBusinessConnectionStatus = signal(true);\n private readonly googleBusinessProfileConnected = computed(() => this.businessInfo() !== null);\n private readonly googleBusinessProfileVerified = computed(() => this.businessInfo()?.isVerified ?? false);\n\n cardDescription: Signal;\n\n actionErrors = signal<{ title: string; description: string } | null>(null);\n\n private serviceName = 'googleplus';\n\n constructor(\n @Inject(PARTNER_ID_TOKEN) private readonly partnerId$: Observable,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n private readonly googleMyBusinessService: BusinessCommunicationsApiService,\n private readonly accountGroupSDK: AccountGroupSDK,\n private readonly router: Router,\n private readonly route: ActivatedRoute,\n @Inject(googleBusinessConnectionsServiceToken)\n private readonly gBizConnectionsService: GoogleBusinessConnectionsService,\n ) {\n this.socialProfileId$ = this.accountGroupId$.pipe(\n switchMap((agid) => {\n const pf = new ProjectionFilter({\n accountGroupExternalIdentifiers: true,\n });\n return this.accountGroupSDK.get(agid, pf).pipe(map((ag) => ag.externalIdentifiers.socialProfileId));\n }),\n shareReplay(1),\n );\n\n this.initGoogleBusinessMessagesEnabledStatus();\n this.initCanEnableBusinessCommunications();\n this.initGoogleBusinessProfileConnectionStatus();\n\n this.loading = computed(\n () => this.loadingEnabledStatus() || this.loadingCanEnable() || this.loadingGoogleBusinessConnectionStatus(),\n );\n\n this.showAlert = computed(() => {\n if (this.loading()) return 'no-alert';\n // User attempted to connect and an un-retryable error occurred\n if (this.setupBlocked()) return 'setup-blocked';\n if (!this.googleBusinessProfileConnected()) return 'gbp-not-connected';\n if (this.googleBusinessProfileConnected() && !this.googleBusinessProfileVerified()) return 'gbp-not-verified';\n // Checks if the Google Business Profile access token is valid and has the required scopes\n if (this.googleBusinessProfileConnected() && !this.canEnable()) return 'auth-insufficient';\n return 'no-alert';\n });\n\n this.badgeColor = computed(() => {\n return this.googleBusinessMessagesEnabled() ? 'green' : 'red';\n });\n\n this.cardDescription = computed(() => {\n if (!this.googleBusinessMessagesEnabled() && !this.loading()) {\n return 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.CONNECT_DESCRIPTION';\n }\n return '';\n });\n }\n\n private async initGoogleBusinessMessagesEnabledStatus() {\n this.loadingEnabledStatus.set(true);\n const partnerId = await firstValueFrom(this.partnerId$);\n const accountGroupId = await firstValueFrom(this.accountGroupId$);\n\n try {\n const response = await lastValueFrom(\n this.googleMyBusinessService.getBusinessLaunchStatus({ partnerId: partnerId, accountGroupId: accountGroupId }),\n );\n this.googleBusinessMessagesEnabled.set(response.isLaunched ?? false);\n } catch {\n this.googleBusinessMessagesEnabled.set(false);\n } finally {\n this.loadingEnabledStatus.set(false);\n }\n }\n\n private async initCanEnableBusinessCommunications() {\n this.loadingCanEnable.set(true);\n const socialProfileId = await firstValueFrom(this.socialProfileId$);\n\n try {\n const response = await firstValueFrom(\n this.googleMyBusinessService.canEnableBusinessCommunications({ socialProfileId }),\n );\n this.canEnable.set(response.hasRequiredAccessScopes ?? false);\n } catch (e) {\n this.canEnable.set(false);\n } finally {\n this.loadingCanEnable.set(false);\n }\n }\n\n private async initGoogleBusinessProfileConnectionStatus() {\n this.loadingGoogleBusinessConnectionStatus.set(true);\n const accountGroupId = await firstValueFrom(this.accountGroupId$);\n\n try {\n const response = await lastValueFrom(this.gBizConnectionsService.getSocialProfileConnections(accountGroupId));\n this.businessInfo.set(response.google_my_business[0] ?? null);\n } catch {\n this.businessInfo.set(null);\n } finally {\n this.loadingGoogleBusinessConnectionStatus.set(false);\n }\n }\n\n async reauthorize(): Promise {\n const accountGroupId = await firstValueFrom(this.accountGroupId$);\n\n const protocol = window.location.protocol;\n const host = window.location.host;\n const baseUrl = `${protocol}//${host}`;\n const newURL: URL = new URL(baseUrl);\n newURL.pathname = `/account/location/${accountGroupId}/settings/connections`;\n\n const authUrls = await firstValueFrom(this.gBizConnectionsService.getAuthUrls(accountGroupId, newURL));\n const serviceAuthURL = authUrls[this.serviceName as keyof SocialConnectionLinks];\n const oauthUrl = [\n serviceAuthURL.slice(0, serviceAuthURL.indexOf('&spid')),\n `?type=Google%20My%20Business`,\n serviceAuthURL.slice(serviceAuthURL.indexOf('&spid')),\n ].join('');\n window.location.href = oauthUrl;\n }\n\n redirectToConnections() {\n // This will only work if the parent app is Business Center.\n this.router.navigate(['../connections'], { relativeTo: this.route });\n }\n\n async connectGoogleBusinessCommunications() {\n this.loadingEnabledStatus.set(true);\n const accountID = await firstValueFrom(this.accountGroupId$);\n const partnerID = await firstValueFrom(this.partnerId$);\n const socialProfileID = await firstValueFrom(this.socialProfileId$);\n\n try {\n await firstValueFrom(\n this.googleMyBusinessService.connectBusinessCommunications({\n partnerId: partnerID,\n accountGroupId: accountID,\n socialProfileId: socialProfileID,\n }),\n );\n this.googleBusinessMessagesEnabled.set(true);\n } catch (e) {\n if (\n e instanceof HttpErrorResponse &&\n typeof e.error.message == 'string' &&\n e.error.message.includes('failed to launch agent due to enabled locations with same place-ids')\n ) {\n this.actionErrors.set({\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ERROR_CONNECTING',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.FAILED_TO_TURN_ON_ALREADY_CONNECTED_TO_OTHER_APP',\n });\n this.setupBlocked.set(true);\n } else {\n this.actionErrors.set({\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ERROR_CONNECTING',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.FAILED_TO_TURN_ON',\n });\n }\n } finally {\n this.loadingEnabledStatus.set(false);\n }\n }\n\n async unlaunchGoogleBusinessCommunications() {\n this.loadingEnabledStatus.set(true);\n\n const accountID = await firstValueFrom(this.accountGroupId$);\n const partnerID = await firstValueFrom(this.partnerId$);\n\n try {\n await firstValueFrom(\n this.googleMyBusinessService.unlaunchBusinessCommunicationsAgent({\n partnerId: partnerID,\n accountGroupId: accountID,\n }),\n );\n this.googleBusinessMessagesEnabled.set(false);\n } catch (e) {\n this.actionErrors.set({\n title: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.ERROR_DISCONNECTING',\n description: 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.FAILED_TO_TURN_OFF',\n });\n } finally {\n this.loadingEnabledStatus.set(false);\n }\n }\n}\n","\n \n \n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.TITLE' | translate }}\n\n \n {{ (googleBusinessMessagesEnabled() ? 'INBOX.SETTINGS.ACTIVE' : 'INBOX.SETTINGS.INACTIVE') | translate }}\n \n \n \n
\n \n
\n \n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DESCRIPTION' | translate }}\n \n

\n \n

\n {{ cardDescription() | translate }}\n

\n\n

\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.BUSINESS_NAME' | translate }}:\n \n {{ businessInfo()?.name }}\n \n \n {{ businessInfo()?.name }}\n \n

\n\n \n \n \n \n \n \n \n \n \n \n \n
\n\n \n\n

\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DISCLAIMER' | translate }}\n

\n \n
\n
\n\n\n\n \n

\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.RECONNECT_GBP' | translate }}\n
\n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.RECONNECT_GBP_DETAIL' | translate }}\n

\n \n
\n\n\n\n \n\n\n\n\n \n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.PROBLEM_WITH_CONNECTION' | translate }}\n \n
\n \n

\n \n
\n\n\n \n \n {{ actionErrors()?.title || '' | translate }}\n \n \n
\n
\n
\n
\n\n\n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.CONNECT' | translate }}\n \n

\n
\n\n\n

{{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.GOOGLE_PROFILE_ERROR' | translate }}

\n\n

\n \n

\n
\n\n\n

\n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DISCONNECT' | translate }}\n \n

\n \n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.CONFIRM_DISCONNECT_TITLE' | translate }}\n \n
\n \n \n \n {{ 'INBOX.SETTINGS.GOOGLE_BUSINESS_MESSAGES.DISCONNECT' | translate }}\n \n \n
\n
\n\n\n \n\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport { map } from 'rxjs/operators';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar PostType = /*#__PURE__*/function (PostType) {\n PostType[PostType[\"POST_TYPE_INVALID\"] = 0] = \"POST_TYPE_INVALID\";\n PostType[PostType[\"POST_TYPE_IMAGE\"] = 1] = \"POST_TYPE_IMAGE\";\n PostType[PostType[\"POST_TYPE_VIDEO\"] = 2] = \"POST_TYPE_VIDEO\";\n PostType[PostType[\"POST_TYPE_GIF\"] = 3] = \"POST_TYPE_GIF\";\n PostType[PostType[\"POST_TYPE_REEL\"] = 4] = \"POST_TYPE_REEL\";\n PostType[PostType[\"POST_TYPE_CAROUSEL\"] = 5] = \"POST_TYPE_CAROUSEL\";\n return PostType;\n}(PostType || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar GetBusinessStatsResponseStatus = /*#__PURE__*/function (GetBusinessStatsResponseStatus) {\n GetBusinessStatsResponseStatus[GetBusinessStatsResponseStatus[\"GET_BUSINESS_STATS_RESPONSE_STATUS_IN_PROGRESS\"] = 0] = \"GET_BUSINESS_STATS_RESPONSE_STATUS_IN_PROGRESS\";\n GetBusinessStatsResponseStatus[GetBusinessStatsResponseStatus[\"GET_BUSINESS_STATS_RESPONSE_STATUS_FINISHED\"] = 1] = \"GET_BUSINESS_STATS_RESPONSE_STATUS_FINISHED\";\n return GetBusinessStatsResponseStatus;\n}(GetBusinessStatsResponseStatus || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$8(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass BusinessStats {\n static fromProto(proto) {\n let m = new BusinessStats();\n m = Object.assign(m, proto);\n if (proto.timestamp) {\n m.timestamp = new Date(proto.timestamp);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.followersCount) {\n m.followersCount = parseInt(proto.followersCount, 10);\n }\n if (proto.mediaCount) {\n m.mediaCount = parseInt(proto.mediaCount, 10);\n }\n if (proto.stats) {\n m.stats = BusinessStatsStats.fromProto(proto.stats);\n }\n if (proto.error) {\n m.error = BusinessStatsError.fromProto(proto.error);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.timestamp !== 'undefined' && this.timestamp !== null) {\n toReturn['timestamp'] = 'toApiJson' in this.timestamp ? this.timestamp.toApiJson() : this.timestamp;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.followersCount !== 'undefined') {\n toReturn['followersCount'] = this.followersCount;\n }\n if (typeof this.mediaCount !== 'undefined') {\n toReturn['mediaCount'] = this.mediaCount;\n }\n if (typeof this.stats !== 'undefined' && this.stats !== null) {\n toReturn['stats'] = 'toApiJson' in this.stats ? this.stats.toApiJson() : this.stats;\n }\n if (typeof this.error !== 'undefined' && this.error !== null) {\n toReturn['error'] = 'toApiJson' in this.error ? this.error.toApiJson() : this.error;\n }\n return toReturn;\n }\n}\nclass BusinessStatsError {\n static fromProto(proto) {\n let m = new BusinessStatsError();\n m = Object.assign(m, proto);\n if (proto.code) {\n m.code = parseInt(proto.code, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.message !== 'undefined') {\n toReturn['message'] = this.message;\n }\n if (typeof this.type !== 'undefined') {\n toReturn['type'] = this.type;\n }\n if (typeof this.code !== 'undefined') {\n toReturn['code'] = this.code;\n }\n return toReturn;\n }\n}\nclass BusinessStatsStats {\n static fromProto(proto) {\n let m = new BusinessStatsStats();\n m = Object.assign(m, proto);\n if (proto.followersCount) {\n m.followersCount = parseInt(proto.followersCount, 10);\n }\n if (proto.mediaCount) {\n m.mediaCount = parseInt(proto.mediaCount, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.followersCount !== 'undefined') {\n toReturn['followersCount'] = this.followersCount;\n }\n if (typeof this.mediaCount !== 'undefined') {\n toReturn['mediaCount'] = this.mediaCount;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$7(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Comment {\n static fromProto(proto) {\n let m = new Comment();\n m = Object.assign(m, proto);\n if (proto.postedOn) {\n m.postedOn = new Date(proto.postedOn);\n }\n if (proto.likeCount) {\n m.likeCount = parseInt(proto.likeCount, 10);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.modified) {\n m.modified = new Date(proto.modified);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.commentId !== 'undefined') {\n toReturn['commentId'] = this.commentId;\n }\n if (typeof this.parentId !== 'undefined') {\n toReturn['parentId'] = this.parentId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.instagramCommentId !== 'undefined') {\n toReturn['instagramCommentId'] = this.instagramCommentId;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.postedOn !== 'undefined' && this.postedOn !== null) {\n toReturn['postedOn'] = 'toApiJson' in this.postedOn ? this.postedOn.toApiJson() : this.postedOn;\n }\n if (typeof this.likeCount !== 'undefined') {\n toReturn['likeCount'] = this.likeCount;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.modified !== 'undefined' && this.modified !== null) {\n toReturn['modified'] = 'toApiJson' in this.modified ? this.modified.toApiJson() : this.modified;\n }\n if (typeof this.hasReplies !== 'undefined') {\n toReturn['hasReplies'] = this.hasReplies;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$6(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass InstagramBusiness {\n static fromProto(proto) {\n let m = new InstagramBusiness();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n if (typeof this.instagramBusinessId !== 'undefined') {\n toReturn['instagramBusinessId'] = this.instagramBusinessId;\n }\n if (typeof this.biography !== 'undefined') {\n toReturn['biography'] = this.biography;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.profilePictureUrl !== 'undefined') {\n toReturn['profilePictureUrl'] = this.profilePictureUrl;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.website !== 'undefined') {\n toReturn['website'] = this.website;\n }\n if (typeof this.canPost !== 'undefined') {\n toReturn['canPost'] = this.canPost;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Media {\n static fromProto(proto) {\n let m = new Media();\n m = Object.assign(m, proto);\n if (proto.postDateTime) {\n m.postDateTime = new Date(proto.postDateTime);\n }\n if (proto.postedDateTime) {\n m.postedDateTime = new Date(proto.postedDateTime);\n }\n if (proto.commentsCount) {\n m.commentsCount = parseInt(proto.commentsCount, 10);\n }\n if (proto.likeCount) {\n m.likeCount = parseInt(proto.likeCount, 10);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.reach) {\n m.reach = parseInt(proto.reach, 10);\n }\n if (proto.saves) {\n m.saves = parseInt(proto.saves, 10);\n }\n if (proto.videoViews) {\n m.videoViews = parseInt(proto.videoViews, 10);\n }\n if (proto.insightsUpdated) {\n m.insightsUpdated = new Date(proto.insightsUpdated);\n }\n if (proto.postType) {\n m.postType = enumStringToValue$5(PostType, proto.postType);\n }\n if (proto.deletedAt) {\n m.deletedAt = new Date(proto.deletedAt);\n }\n if (proto.mediaEntries) {\n m.mediaEntries = proto.mediaEntries.map(MediaEntry.fromProto);\n }\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.instagramMediaId !== 'undefined') {\n toReturn['instagramMediaId'] = this.instagramMediaId;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.postText !== 'undefined') {\n toReturn['postText'] = this.postText;\n }\n if (typeof this.postDateTime !== 'undefined' && this.postDateTime !== null) {\n toReturn['postDateTime'] = 'toApiJson' in this.postDateTime ? this.postDateTime.toApiJson() : this.postDateTime;\n }\n if (typeof this.imageUrl !== 'undefined') {\n toReturn['imageUrl'] = this.imageUrl;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.clientTags !== 'undefined') {\n toReturn['clientTags'] = this.clientTags;\n }\n if (typeof this.permalink !== 'undefined') {\n toReturn['permalink'] = this.permalink;\n }\n if (typeof this.error !== 'undefined') {\n toReturn['error'] = this.error;\n }\n if (typeof this.postedDateTime !== 'undefined' && this.postedDateTime !== null) {\n toReturn['postedDateTime'] = 'toApiJson' in this.postedDateTime ? this.postedDateTime.toApiJson() : this.postedDateTime;\n }\n if (typeof this.profilePictureUrl !== 'undefined') {\n toReturn['profilePictureUrl'] = this.profilePictureUrl;\n }\n if (typeof this.hasScheduledTask !== 'undefined') {\n toReturn['hasScheduledTask'] = this.hasScheduledTask;\n }\n if (typeof this.instagramCreationId !== 'undefined') {\n toReturn['instagramCreationId'] = this.instagramCreationId;\n }\n if (typeof this.commentsCount !== 'undefined') {\n toReturn['commentsCount'] = this.commentsCount;\n }\n if (typeof this.likeCount !== 'undefined') {\n toReturn['likeCount'] = this.likeCount;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.videoUrl !== 'undefined') {\n toReturn['videoUrl'] = this.videoUrl;\n }\n if (typeof this.postedByOwner !== 'undefined') {\n toReturn['postedByOwner'] = this.postedByOwner;\n }\n if (typeof this.linkShortcodes !== 'undefined') {\n toReturn['linkShortcodes'] = this.linkShortcodes;\n }\n if (typeof this.reach !== 'undefined') {\n toReturn['reach'] = this.reach;\n }\n if (typeof this.saves !== 'undefined') {\n toReturn['saves'] = this.saves;\n }\n if (typeof this.videoViews !== 'undefined') {\n toReturn['videoViews'] = this.videoViews;\n }\n if (typeof this.insightsUpdated !== 'undefined' && this.insightsUpdated !== null) {\n toReturn['insightsUpdated'] = 'toApiJson' in this.insightsUpdated ? this.insightsUpdated.toApiJson() : this.insightsUpdated;\n }\n if (typeof this.postType !== 'undefined') {\n toReturn['postType'] = this.postType;\n }\n if (typeof this.deletedAt !== 'undefined' && this.deletedAt !== null) {\n toReturn['deletedAt'] = 'toApiJson' in this.deletedAt ? this.deletedAt.toApiJson() : this.deletedAt;\n }\n if (typeof this.mediaEntries !== 'undefined' && this.mediaEntries !== null) {\n toReturn['mediaEntries'] = 'toApiJson' in this.mediaEntries ? this.mediaEntries.toApiJson() : this.mediaEntries;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n if (typeof this.multilocationPostId !== 'undefined') {\n toReturn['multilocationPostId'] = this.multilocationPostId;\n }\n if (typeof this.brandId !== 'undefined') {\n toReturn['brandId'] = this.brandId;\n }\n return toReturn;\n }\n}\nclass MediaEntry {\n static fromProto(proto) {\n let m = new MediaEntry();\n m = Object.assign(m, proto);\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaEntryId !== 'undefined') {\n toReturn['mediaEntryId'] = this.mediaEntryId;\n }\n if (typeof this.mediaUrl !== 'undefined') {\n toReturn['mediaUrl'] = this.mediaUrl;\n }\n if (typeof this.mediaType !== 'undefined') {\n toReturn['mediaType'] = this.mediaType;\n }\n if (typeof this.containerId !== 'undefined') {\n toReturn['containerId'] = this.containerId;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n return toReturn;\n }\n}\nclass MediaKeyset {\n static fromProto(proto) {\n let m = new MediaKeyset();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass MetaData {\n static fromProto(proto) {\n let m = new MetaData();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.propertyName !== 'undefined') {\n toReturn['propertyName'] = this.propertyName;\n }\n if (typeof this.propertyValue !== 'undefined') {\n toReturn['propertyValue'] = this.propertyValue;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Page {\n static fromProto(proto) {\n let m = new Page();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pageId !== 'undefined') {\n toReturn['pageId'] = this.pageId;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.location !== 'undefined') {\n toReturn['location'] = this.location;\n }\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.perms !== 'undefined') {\n toReturn['perms'] = this.perms;\n }\n if (typeof this.tasks !== 'undefined') {\n toReturn['tasks'] = this.tasks;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass User {\n static fromProto(proto) {\n let m = new User();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.profilePicture !== 'undefined') {\n toReturn['profilePicture'] = this.profilePicture;\n }\n if (typeof this.fullName !== 'undefined') {\n toReturn['fullName'] = this.fullName;\n }\n if (typeof this.bio !== 'undefined') {\n toReturn['bio'] = this.bio;\n }\n if (typeof this.website !== 'undefined') {\n toReturn['website'] = this.website;\n }\n if (typeof this.isBusiness !== 'undefined') {\n toReturn['isBusiness'] = this.isBusiness;\n }\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n if (typeof this.facebookUserId !== 'undefined') {\n toReturn['facebookUserId'] = this.facebookUserId;\n }\n if (typeof this.tokenBroken !== 'undefined') {\n toReturn['tokenBroken'] = this.tokenBroken;\n }\n if (typeof this.metaAppId !== 'undefined') {\n toReturn['metaAppId'] = this.metaAppId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass BreakInstagramUserTokenRequest {\n static fromProto(proto) {\n let m = new BreakInstagramUserTokenRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass ConnectInstagramBusinessRequest {\n static fromProto(proto) {\n let m = new ConnectInstagramBusinessRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n if (typeof this.instagramBusinessId !== 'undefined') {\n toReturn['instagramBusinessId'] = this.instagramBusinessId;\n }\n return toReturn;\n }\n}\nclass CreateCommentRequest {\n static fromProto(proto) {\n let m = new CreateCommentRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.parentId !== 'undefined') {\n toReturn['parentId'] = this.parentId;\n }\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n return toReturn;\n }\n}\nclass CreateCommentResponse {\n static fromProto(proto) {\n let m = new CreateCommentResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.commentId !== 'undefined') {\n toReturn['commentId'] = this.commentId;\n }\n return toReturn;\n }\n}\nclass CreateMediaRequest {\n static fromProto(proto) {\n let m = new CreateMediaRequest();\n m = Object.assign(m, proto);\n if (proto.postDateTime) {\n m.postDateTime = new Date(proto.postDateTime);\n }\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n if (proto.mediaEntries) {\n m.mediaEntries = proto.mediaEntries.map(MediaEntry.fromProto);\n }\n if (proto.postType) {\n m.postType = enumStringToValue$2(PostType, proto.postType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.postText !== 'undefined') {\n toReturn['postText'] = this.postText;\n }\n if (typeof this.imageUrl !== 'undefined') {\n toReturn['imageUrl'] = this.imageUrl;\n }\n if (typeof this.postDateTime !== 'undefined' && this.postDateTime !== null) {\n toReturn['postDateTime'] = 'toApiJson' in this.postDateTime ? this.postDateTime.toApiJson() : this.postDateTime;\n }\n if (typeof this.hasScheduledTask !== 'undefined') {\n toReturn['hasScheduledTask'] = this.hasScheduledTask;\n }\n if (typeof this.videoUrl !== 'undefined') {\n toReturn['videoUrl'] = this.videoUrl;\n }\n if (typeof this.postedByOwner !== 'undefined') {\n toReturn['postedByOwner'] = this.postedByOwner;\n }\n if (typeof this.linkShortcodes !== 'undefined') {\n toReturn['linkShortcodes'] = this.linkShortcodes;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n if (typeof this.mediaEntries !== 'undefined' && this.mediaEntries !== null) {\n toReturn['mediaEntries'] = 'toApiJson' in this.mediaEntries ? this.mediaEntries.toApiJson() : this.mediaEntries;\n }\n if (typeof this.postType !== 'undefined') {\n toReturn['postType'] = this.postType;\n }\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n if (typeof this.multilocationPostId !== 'undefined') {\n toReturn['multilocationPostId'] = this.multilocationPostId;\n }\n if (typeof this.brandId !== 'undefined') {\n toReturn['brandId'] = this.brandId;\n }\n return toReturn;\n }\n}\nclass CreateMediaResponse {\n static fromProto(proto) {\n let m = new CreateMediaResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass CreateUserRequest {\n static fromProto(proto) {\n let m = new CreateUserRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.instagramUserId !== 'undefined') {\n toReturn['instagramUserId'] = this.instagramUserId;\n }\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n if (typeof this.profilePicture !== 'undefined') {\n toReturn['profilePicture'] = this.profilePicture;\n }\n if (typeof this.fullName !== 'undefined') {\n toReturn['fullName'] = this.fullName;\n }\n if (typeof this.bio !== 'undefined') {\n toReturn['bio'] = this.bio;\n }\n if (typeof this.website !== 'undefined') {\n toReturn['website'] = this.website;\n }\n if (typeof this.accessToken !== 'undefined') {\n toReturn['accessToken'] = this.accessToken;\n }\n return toReturn;\n }\n}\nclass DeleteMediaRequest {\n static fromProto(proto) {\n let m = new DeleteMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramMediaId !== 'undefined') {\n toReturn['instagramMediaId'] = this.instagramMediaId;\n }\n return toReturn;\n }\n}\nclass DeleteUserRequest {\n static fromProto(proto) {\n let m = new DeleteUserRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass GetBusinessStatsRequest {\n static fromProto(proto) {\n let m = new GetBusinessStatsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.username !== 'undefined') {\n toReturn['username'] = this.username;\n }\n return toReturn;\n }\n}\nclass GetBusinessStatsResponse {\n static fromProto(proto) {\n let m = new GetBusinessStatsResponse();\n m = Object.assign(m, proto);\n if (proto.businessStats) {\n m.businessStats = BusinessStats.fromProto(proto.businessStats);\n }\n if (proto.status) {\n m.status = enumStringToValue$2(GetBusinessStatsResponseStatus, proto.status);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessStats !== 'undefined' && this.businessStats !== null) {\n toReturn['businessStats'] = 'toApiJson' in this.businessStats ? this.businessStats.toApiJson() : this.businessStats;\n }\n if (typeof this.status !== 'undefined') {\n toReturn['status'] = this.status;\n }\n return toReturn;\n }\n}\nclass GetInstagramBusinessRequest {\n static fromProto(proto) {\n let m = new GetInstagramBusinessRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.facebookPageId !== 'undefined') {\n toReturn['facebookPageId'] = this.facebookPageId;\n }\n return toReturn;\n }\n}\nclass GetInstagramBusinessResponse {\n static fromProto(proto) {\n let m = new GetInstagramBusinessResponse();\n m = Object.assign(m, proto);\n if (proto.instagramBusiness) {\n m.instagramBusiness = InstagramBusiness.fromProto(proto.instagramBusiness);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.instagramBusiness !== 'undefined' && this.instagramBusiness !== null) {\n toReturn['instagramBusiness'] = 'toApiJson' in this.instagramBusiness ? this.instagramBusiness.toApiJson() : this.instagramBusiness;\n }\n return toReturn;\n }\n}\nclass GetMediaRequest {\n static fromProto(proto) {\n let m = new GetMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.instagramMediaId !== 'undefined') {\n toReturn['instagramMediaId'] = this.instagramMediaId;\n }\n return toReturn;\n }\n}\nclass GetMediaResponse {\n static fromProto(proto) {\n let m = new GetMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = Media.fromProto(proto.media);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaRequest {\n static fromProto(proto) {\n let m = new GetMultiMediaRequest();\n m = Object.assign(m, proto);\n if (proto.keysets) {\n m.keysets = proto.keysets.map(MediaKeyset.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.keysets !== 'undefined' && this.keysets !== null) {\n toReturn['keysets'] = 'toApiJson' in this.keysets ? this.keysets.toApiJson() : this.keysets;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaResponse {\n static fromProto(proto) {\n let m = new GetMultiMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = proto.media.map(Media.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaStatsRequest {\n static fromProto(proto) {\n let m = new GetMultiMediaStatsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaIds !== 'undefined') {\n toReturn['mediaIds'] = this.mediaIds;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaStatsResponse {\n static fromProto(proto) {\n let m = new GetMultiMediaStatsResponse();\n m = Object.assign(m, proto);\n if (proto.mediaStats) {\n m.mediaStats = Object.keys(proto.mediaStats).reduce((obj, k) => {\n obj[k] = MediaStats.fromProto(proto.mediaStats[k]);\n return obj;\n }, {});\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.mediaStats !== 'undefined' && this.mediaStats !== null) {\n toReturn['mediaStats'] = 'toApiJson' in this.mediaStats ? this.mediaStats.toApiJson() : this.mediaStats;\n }\n return toReturn;\n }\n}\nclass GetUserRequest {\n static fromProto(proto) {\n let m = new GetUserRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass GetUserResponse {\n static fromProto(proto) {\n let m = new GetUserResponse();\n m = Object.assign(m, proto);\n if (proto.user) {\n m.user = User.fromProto(proto.user);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.user !== 'undefined' && this.user !== null) {\n toReturn['user'] = 'toApiJson' in this.user ? this.user.toApiJson() : this.user;\n }\n return toReturn;\n }\n}\nclass ListCommentsRequest {\n static fromProto(proto) {\n let m = new ListCommentsRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.parentId !== 'undefined') {\n toReturn['parentId'] = this.parentId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListCommentsResponse {\n static fromProto(proto) {\n let m = new ListCommentsResponse();\n m = Object.assign(m, proto);\n if (proto.comments) {\n m.comments = proto.comments.map(Comment.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.comments !== 'undefined' && this.comments !== null) {\n toReturn['comments'] = 'toApiJson' in this.comments ? this.comments.toApiJson() : this.comments;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListFacebookPagesRequest {\n static fromProto(proto) {\n let m = new ListFacebookPagesRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListFacebookPagesResponse {\n static fromProto(proto) {\n let m = new ListFacebookPagesResponse();\n m = Object.assign(m, proto);\n if (proto.pages) {\n m.pages = proto.pages.map(Page.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.pages !== 'undefined' && this.pages !== null) {\n toReturn['pages'] = 'toApiJson' in this.pages ? this.pages.toApiJson() : this.pages;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListInstagramBusinessRequest {\n static fromProto(proto) {\n let m = new ListInstagramBusinessRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListInstagramBusinessResponse {\n static fromProto(proto) {\n let m = new ListInstagramBusinessResponse();\n m = Object.assign(m, proto);\n if (proto.instagramBusiness) {\n m.instagramBusiness = proto.instagramBusiness.map(InstagramBusiness.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.instagramBusiness !== 'undefined' && this.instagramBusiness !== null) {\n toReturn['instagramBusiness'] = 'toApiJson' in this.instagramBusiness ? this.instagramBusiness.toApiJson() : this.instagramBusiness;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListMediaRequest {\n static fromProto(proto) {\n let m = new ListMediaRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListMediaResponse {\n static fromProto(proto) {\n let m = new ListMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = proto.media.map(Media.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListUsersByMultiBusinessesRequest {\n static fromProto(proto) {\n let m = new ListUsersByMultiBusinessesRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListUsersByMultiBusinessesResponse {\n static fromProto(proto) {\n let m = new ListUsersByMultiBusinessesResponse();\n m = Object.assign(m, proto);\n if (proto.users) {\n m.users = proto.users.map(User.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ListUsersRequest {\n static fromProto(proto) {\n let m = new ListUsersRequest();\n m = Object.assign(m, proto);\n if (proto.options) {\n m.options = PagedRequestOptions.fromProto(proto.options);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.options !== 'undefined' && this.options !== null) {\n toReturn['options'] = 'toApiJson' in this.options ? this.options.toApiJson() : this.options;\n }\n return toReturn;\n }\n}\nclass ListUsersResponse {\n static fromProto(proto) {\n let m = new ListUsersResponse();\n m = Object.assign(m, proto);\n if (proto.users) {\n m.users = proto.users.map(User.fromProto);\n }\n if (proto.pagingMetadata) {\n m.pagingMetadata = PagedResponseMetadata.fromProto(proto.pagingMetadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.users !== 'undefined' && this.users !== null) {\n toReturn['users'] = 'toApiJson' in this.users ? this.users.toApiJson() : this.users;\n }\n if (typeof this.pagingMetadata !== 'undefined' && this.pagingMetadata !== null) {\n toReturn['pagingMetadata'] = 'toApiJson' in this.pagingMetadata ? this.pagingMetadata.toApiJson() : this.pagingMetadata;\n }\n return toReturn;\n }\n}\nclass ManageMediaTagsRequest {\n static fromProto(proto) {\n let m = new ManageMediaTagsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.addTags !== 'undefined') {\n toReturn['addTags'] = this.addTags;\n }\n if (typeof this.removeTags !== 'undefined') {\n toReturn['removeTags'] = this.removeTags;\n }\n return toReturn;\n }\n}\nclass ManageMediaTagsResponse {\n static fromProto(proto) {\n let m = new ManageMediaTagsResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.tags !== 'undefined') {\n toReturn['tags'] = this.tags;\n }\n return toReturn;\n }\n}\nclass MediaStats {\n static fromProto(proto) {\n let m = new MediaStats();\n m = Object.assign(m, proto);\n if (proto.commentsCount) {\n m.commentsCount = parseInt(proto.commentsCount, 10);\n }\n if (proto.likeCount) {\n m.likeCount = parseInt(proto.likeCount, 10);\n }\n if (proto.reach) {\n m.reach = parseInt(proto.reach, 10);\n }\n if (proto.saves) {\n m.saves = parseInt(proto.saves, 10);\n }\n if (proto.videoViews) {\n m.videoViews = parseInt(proto.videoViews, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.commentsCount !== 'undefined') {\n toReturn['commentsCount'] = this.commentsCount;\n }\n if (typeof this.likeCount !== 'undefined') {\n toReturn['likeCount'] = this.likeCount;\n }\n if (typeof this.reach !== 'undefined') {\n toReturn['reach'] = this.reach;\n }\n if (typeof this.saves !== 'undefined') {\n toReturn['saves'] = this.saves;\n }\n if (typeof this.videoViews !== 'undefined') {\n toReturn['videoViews'] = this.videoViews;\n }\n return toReturn;\n }\n}\nclass GetMultiMediaStatsResponseMediaStatsEntry {\n static fromProto(proto) {\n let m = new GetMultiMediaStatsResponseMediaStatsEntry();\n m = Object.assign(m, proto);\n if (proto.value) {\n m.value = MediaStats.fromProto(proto.value);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.key !== 'undefined') {\n toReturn['key'] = this.key;\n }\n if (typeof this.value !== 'undefined' && this.value !== null) {\n toReturn['value'] = 'toApiJson' in this.value ? this.value.toApiJson() : this.value;\n }\n return toReturn;\n }\n}\nclass PagedRequestOptions {\n static fromProto(proto) {\n let m = new PagedRequestOptions();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n return toReturn;\n }\n}\nclass PagedResponseMetadata {\n static fromProto(proto) {\n let m = new PagedResponseMetadata();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n return toReturn;\n }\n}\nclass PopulateRecentMediaRequest {\n static fromProto(proto) {\n let m = new PopulateRecentMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n return toReturn;\n }\n}\nclass PostMediaRequest {\n static fromProto(proto) {\n let m = new PostMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass PostMediaResponse {\n static fromProto(proto) {\n let m = new PostMediaResponse();\n m = Object.assign(m, proto);\n if (proto.media) {\n m.media = Media.fromProto(proto.media);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.media !== 'undefined' && this.media !== null) {\n toReturn['media'] = 'toApiJson' in this.media ? this.media.toApiJson() : this.media;\n }\n return toReturn;\n }\n}\nclass UpdateMediaInsightsRequest {\n static fromProto(proto) {\n let m = new UpdateMediaInsightsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\nclass UpdateMediaRequest {\n static fromProto(proto) {\n let m = new UpdateMediaRequest();\n m = Object.assign(m, proto);\n if (proto.postDateTime) {\n m.postDateTime = new Date(proto.postDateTime);\n }\n if (proto.metaData) {\n m.metaData = proto.metaData.map(MetaData.fromProto);\n }\n if (proto.mediaEntries) {\n m.mediaEntries = proto.mediaEntries.map(MediaEntry.fromProto);\n }\n if (proto.postType) {\n m.postType = enumStringToValue$2(PostType, proto.postType);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n if (typeof this.postText !== 'undefined') {\n toReturn['postText'] = this.postText;\n }\n if (typeof this.imageUrl !== 'undefined') {\n toReturn['imageUrl'] = this.imageUrl;\n }\n if (typeof this.postDateTime !== 'undefined' && this.postDateTime !== null) {\n toReturn['postDateTime'] = 'toApiJson' in this.postDateTime ? this.postDateTime.toApiJson() : this.postDateTime;\n }\n if (typeof this.hasScheduledTask !== 'undefined') {\n toReturn['hasScheduledTask'] = this.hasScheduledTask;\n }\n if (typeof this.videoUrl !== 'undefined') {\n toReturn['videoUrl'] = this.videoUrl;\n }\n if (typeof this.linkShortcodes !== 'undefined') {\n toReturn['linkShortcodes'] = this.linkShortcodes;\n }\n if (typeof this.metaData !== 'undefined' && this.metaData !== null) {\n toReturn['metaData'] = 'toApiJson' in this.metaData ? this.metaData.toApiJson() : this.metaData;\n }\n if (typeof this.mediaEntries !== 'undefined' && this.mediaEntries !== null) {\n toReturn['mediaEntries'] = 'toApiJson' in this.mediaEntries ? this.mediaEntries.toApiJson() : this.mediaEntries;\n }\n if (typeof this.postType !== 'undefined') {\n toReturn['postType'] = this.postType;\n }\n if (typeof this.multilocationPostId !== 'undefined') {\n toReturn['multilocationPostId'] = this.multilocationPostId;\n }\n if (typeof this.brandId !== 'undefined') {\n toReturn['brandId'] = this.brandId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass MediaStatsHistory {\n static fromProto(proto) {\n let m = new MediaStatsHistory();\n m = Object.assign(m, proto);\n if (proto.saves) {\n m.saves = parseInt(proto.saves, 10);\n }\n if (proto.videoViews) {\n m.videoViews = parseInt(proto.videoViews, 10);\n }\n if (proto.likesCount) {\n m.likesCount = parseInt(proto.likesCount, 10);\n }\n if (proto.reach) {\n m.reach = parseInt(proto.reach, 10);\n }\n if (proto.commentsCount) {\n m.commentsCount = parseInt(proto.commentsCount, 10);\n }\n if (proto.postedDateTime) {\n m.postedDateTime = new Date(proto.postedDateTime);\n }\n if (proto.created) {\n m.created = new Date(proto.created);\n }\n if (proto.updated) {\n m.updated = new Date(proto.updated);\n }\n if (proto.statsDateTime) {\n m.statsDateTime = new Date(proto.statsDateTime);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.internalPostId !== 'undefined') {\n toReturn['internalPostId'] = this.internalPostId;\n }\n if (typeof this.saves !== 'undefined') {\n toReturn['saves'] = this.saves;\n }\n if (typeof this.videoViews !== 'undefined') {\n toReturn['videoViews'] = this.videoViews;\n }\n if (typeof this.likesCount !== 'undefined') {\n toReturn['likesCount'] = this.likesCount;\n }\n if (typeof this.reach !== 'undefined') {\n toReturn['reach'] = this.reach;\n }\n if (typeof this.commentsCount !== 'undefined') {\n toReturn['commentsCount'] = this.commentsCount;\n }\n if (typeof this.postedDateTime !== 'undefined' && this.postedDateTime !== null) {\n toReturn['postedDateTime'] = 'toApiJson' in this.postedDateTime ? this.postedDateTime.toApiJson() : this.postedDateTime;\n }\n if (typeof this.created !== 'undefined' && this.created !== null) {\n toReturn['created'] = 'toApiJson' in this.created ? this.created.toApiJson() : this.created;\n }\n if (typeof this.updated !== 'undefined' && this.updated !== null) {\n toReturn['updated'] = 'toApiJson' in this.updated ? this.updated.toApiJson() : this.updated;\n }\n if (typeof this.statsDateTime !== 'undefined' && this.statsDateTime !== null) {\n toReturn['statsDateTime'] = 'toApiJson' in this.statsDateTime ? this.statsDateTime.toApiJson() : this.statsDateTime;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass PublishMediaRequest {\n static fromProto(proto) {\n let m = new PublishMediaRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.businessId !== 'undefined') {\n toReturn['businessId'] = this.businessId;\n }\n if (typeof this.userId !== 'undefined') {\n toReturn['userId'] = this.userId;\n }\n if (typeof this.mediaId !== 'undefined') {\n toReturn['mediaId'] = this.mediaId;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'instagram-api.vendasta-local.com',\n 'test': '',\n 'demo': 'instagram-demo.apigateway.co',\n 'prod': 'instagram-prod.apigateway.co',\n 'production': 'instagram-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet InstagramApiService = /*#__PURE__*/(() => {\n class InstagramApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createUser(r) {\n const request = r.toApiJson ? r : new CreateUserRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/CreateUser\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listUsers(r) {\n const request = r.toApiJson ? r : new ListUsersRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListUsers\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListUsersResponse.fromProto(resp)));\n }\n listUsersByMultiBusinesses(r) {\n const request = r.toApiJson ? r : new ListUsersByMultiBusinessesRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListUsersByMultiBusinesses\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListUsersByMultiBusinessesResponse.fromProto(resp)));\n }\n getUser(r) {\n const request = r.toApiJson ? r : new GetUserRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetUser\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetUserResponse.fromProto(resp)));\n }\n deleteUser(r) {\n const request = r.toApiJson ? r : new DeleteUserRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/DeleteUser\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n populateRecentMedia(r) {\n const request = r.toApiJson ? r : new PopulateRecentMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/PopulateRecentMedia\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n createMedia(r) {\n const request = r.toApiJson ? r : new CreateMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/CreateMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateMediaResponse.fromProto(resp)));\n }\n listMedia(r) {\n const request = r.toApiJson ? r : new ListMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListMediaResponse.fromProto(resp)));\n }\n getMedia(r) {\n const request = r.toApiJson ? r : new GetMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMediaResponse.fromProto(resp)));\n }\n deleteMedia(r) {\n const request = r.toApiJson ? r : new DeleteMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/DeleteMedia\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n postMedia(r) {\n const request = r.toApiJson ? r : new PostMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/PostMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => PostMediaResponse.fromProto(resp)));\n }\n updateMedia(r) {\n const request = r.toApiJson ? r : new UpdateMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/UpdateMedia\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getMultiMediaStats(r) {\n const request = r.toApiJson ? r : new GetMultiMediaStatsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetMultiMediaStats\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiMediaStatsResponse.fromProto(resp)));\n }\n createComment(r) {\n const request = r.toApiJson ? r : new CreateCommentRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/CreateComment\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateCommentResponse.fromProto(resp)));\n }\n listComments(r) {\n const request = r.toApiJson ? r : new ListCommentsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListComments\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListCommentsResponse.fromProto(resp)));\n }\n listFacebookPages(r) {\n const request = r.toApiJson ? r : new ListFacebookPagesRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListFacebookPages\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListFacebookPagesResponse.fromProto(resp)));\n }\n getInstagramBusiness(r) {\n const request = r.toApiJson ? r : new GetInstagramBusinessRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetInstagramBusiness\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetInstagramBusinessResponse.fromProto(resp)));\n }\n listInstagramBusiness(r) {\n const request = r.toApiJson ? r : new ListInstagramBusinessRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ListInstagramBusiness\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListInstagramBusinessResponse.fromProto(resp)));\n }\n connectInstagramBusiness(r) {\n const request = r.toApiJson ? r : new ConnectInstagramBusinessRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ConnectInstagramBusiness\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n manageMediaTags(r) {\n const request = r.toApiJson ? r : new ManageMediaTagsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/ManageMediaTags\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ManageMediaTagsResponse.fromProto(resp)));\n }\n getBusinessStats(r) {\n const request = r.toApiJson ? r : new GetBusinessStatsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetBusinessStats\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetBusinessStatsResponse.fromProto(resp)));\n }\n getMultiMedia(r) {\n const request = r.toApiJson ? r : new GetMultiMediaRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/GetMultiMedia\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetMultiMediaResponse.fromProto(resp)));\n }\n updateMediaInsights(r) {\n const request = r.toApiJson ? r : new UpdateMediaInsightsRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/UpdateMediaInsights\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n processBusinessStats() {\n return this.http.post(this._host + \"/instagram.v1.Instagram/ProcessBusinessStats\", {}, {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n breakInstagramUserToken(r) {\n const request = r.toApiJson ? r : new BreakInstagramUserTokenRequest(r);\n return this.http.post(this._host + \"/instagram.v1.Instagram/BreakInstagramUserToken\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n InstagramApiService.ɵfac = function InstagramApiService_Factory(t) {\n return new (t || InstagramApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n InstagramApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InstagramApiService,\n factory: InstagramApiService.ɵfac,\n providedIn: 'root'\n });\n return InstagramApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass InstagramPagedResponse {\n constructor(results, nextCursor, hasMore) {\n this.results = results;\n this.nextCursor = nextCursor;\n this.hasMore = hasMore;\n }\n}\nlet InstagramService = /*#__PURE__*/(() => {\n class InstagramService {\n constructor(apiService) {\n this.apiService = apiService;\n }\n listUsers(partnerId, businessId, cursor, pageSize) {\n const req = new ListUsersRequest({\n partnerId: partnerId,\n businessId: businessId,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listUsers(req).pipe(map(resp => ({\n results: resp.users,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n getUser(partnerId, businessId, userId) {\n const req = new GetUserRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId\n });\n return this.apiService.getUser(req).pipe(map(resp => resp.user));\n }\n deleteUser(partnerId, businessId, userId) {\n const req = new DeleteUserRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId\n });\n return this.apiService.deleteUser(req);\n }\n listFacebookPages(partnerId, businessId, userId, cursor, pageSize) {\n const req = new ListFacebookPagesRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listFacebookPages(req).pipe(map(resp => ({\n results: resp.pages,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n listInstagramBusiness(partnerId, businessId, userId, cursor, pageSize) {\n const req = new ListInstagramBusinessRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listInstagramBusiness(req).pipe(map(resp => ({\n results: resp.instagramBusiness,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n getInstagramBusiness(partnerId, businessId, userId, facebookPageId) {\n const req = new GetInstagramBusinessRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n facebookPageId: facebookPageId\n });\n return this.apiService.getInstagramBusiness(req).pipe(map(resp => resp.instagramBusiness));\n }\n connectInstagramBusiness(partnerId, businessId, userId, facebookPageId, instagramBusinessId) {\n const req = new ConnectInstagramBusinessRequest({\n partnerId: partnerId,\n businessId: businessId,\n userId: userId,\n facebookPageId: facebookPageId,\n instagramBusinessId: instagramBusinessId\n });\n return this.apiService.connectInstagramBusiness(req);\n }\n listUsersByMultiBusinesses(businessIds, cursor, pageSize) {\n const req = new ListUsersByMultiBusinessesRequest({\n businessId: businessIds,\n options: {\n cursor: cursor,\n pageSize: pageSize ? pageSize : 0\n }\n });\n return this.apiService.listUsersByMultiBusinesses(req).pipe(map(resp => ({\n results: resp.users,\n nextCursor: resp.pagingMetadata ? resp.pagingMetadata.nextCursor : '',\n hasMore: resp.pagingMetadata ? resp.pagingMetadata.hasMore : false\n })));\n }\n }\n InstagramService.ɵfac = function InstagramService_Factory(t) {\n return new (t || InstagramService)(i0.ɵɵinject(InstagramApiService));\n };\n InstagramService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InstagramService,\n factory: InstagramService.ɵfac,\n providedIn: 'root'\n });\n return InstagramService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BreakInstagramUserTokenRequest, BusinessStats, BusinessStatsError, BusinessStatsStats, Comment, ConnectInstagramBusinessRequest, CreateCommentRequest, CreateCommentResponse, CreateMediaRequest, CreateMediaResponse, CreateUserRequest, DeleteMediaRequest, DeleteUserRequest, GetBusinessStatsRequest, GetBusinessStatsResponse, GetBusinessStatsResponseStatus, GetInstagramBusinessRequest, GetInstagramBusinessResponse, GetMediaRequest, GetMediaResponse, GetMultiMediaRequest, GetMultiMediaResponse, GetMultiMediaStatsRequest, GetMultiMediaStatsResponse, GetMultiMediaStatsResponseMediaStatsEntry, GetUserRequest, GetUserResponse, InstagramApiService, InstagramBusiness, InstagramPagedResponse, InstagramService, ListCommentsRequest, ListCommentsResponse, ListFacebookPagesRequest, ListFacebookPagesResponse, ListInstagramBusinessRequest, ListInstagramBusinessResponse, ListMediaRequest, ListMediaResponse, ListUsersByMultiBusinessesRequest, ListUsersByMultiBusinessesResponse, ListUsersRequest, ListUsersResponse, ManageMediaTagsRequest, ManageMediaTagsResponse, Media, MediaEntry, MediaKeyset, MediaStats, MediaStatsHistory, MetaData, Page, PagedRequestOptions, PagedResponseMetadata, PopulateRecentMediaRequest, PostMediaRequest, PostMediaResponse, PostType, PublishMediaRequest, UpdateMediaInsightsRequest, UpdateMediaRequest, User };\n","import { inject, Injectable } from '@angular/core';\nimport { Environment, EnvironmentService } from '@galaxy/core';\nimport { TokenStatus } from '@vendasta/facebook';\nimport { InstagramApiService } from '@vendasta/instagram';\nimport { firstValueFrom, map, Observable, of, shareReplay, switchMap } from 'rxjs';\nimport { PARTNER_ID_TOKEN } from '../../../../core/src/lib/tokens';\nimport { SocialPageFacebook, SocialPageInstagram } from '../interfaces';\n\n// TODO(BREW-687): update this interface according to instagram spec\nexport interface InstagramPageConnectionInfo {\n name: string;\n profileUrl: string;\n tokenStatus: TokenStatus;\n messengerEnabled: boolean;\n isAssignedPageOwner: boolean;\n statusCheckPermissionError?: boolean;\n}\n\n@Injectable({\n providedIn: 'any',\n})\nexport class InstagramMessagesService {\n private readonly instagramAPIService = inject(InstagramApiService);\n private readonly environmentService = inject(EnvironmentService);\n private readonly partnerID$ = inject(PARTNER_ID_TOKEN);\n\n enableMessaging(_instagramPageData: SocialPageInstagram): Observable {\n // TODO: (BREW-703) Connect to Instagram enable messaging API\n return of(false);\n }\n\n async redirectToFacebookAuth(accountID: string): Promise {\n const protocol = window.location.protocol;\n const host = window.location.host;\n const baseUrl = `${protocol}//${host}`;\n const nextUrl: URL = new URL(baseUrl);\n nextUrl.pathname = `/account/location/${accountID}/settings/connections/target/inbox`;\n\n const partnerID = await firstValueFrom(this.partnerID$);\n const env = this.environmentService.getEnvironment() === Environment.PROD ? 'prod' : 'demo';\n window.location.href = `https://instagram-${env}.apigateway.co/v2/auth-user?partnerID=${partnerID}&businessID=${accountID}&nextURL=${nextUrl.href}`;\n }\n\n disableMessaging(_accountID: string, _facebookPageData: SocialPageFacebook): Observable {\n // TODO(BREW-703): Connect to Instagram disable messaging API\n return of(false);\n }\n\n getPagesForAccount(accountGroupId: string): Observable {\n return this.partnerID$.pipe(\n switchMap((partnerID) => {\n return this.instagramAPIService.listUsers({\n partnerId: partnerID,\n businessId: accountGroupId,\n options: {\n pageSize: 100,\n },\n });\n }),\n map((response) => {\n return response.users.map((user): SocialPageInstagram => {\n return {\n type: 'instagram',\n name: user.fullName,\n username: user.username,\n facebookPageId: user.facebookUserId,\n instagramBusinessId: user.instagramUserId,\n internalInstagramUserId: user.userId,\n partnerId: user.partnerId,\n businessId: user.businessId,\n profileUrl: `https://www.instagram.com/${user.username}/`,\n // TODO(BREW-687): Can we populate any of these? Are any relevant?\n isVerified: true,\n locationId: '',\n mapsUri: '',\n ssid: '',\n pages: [],\n clientTags: [],\n deleteUrl: '',\n tokenIsBroken: false,\n };\n });\n }),\n shareReplay({ refCount: true, bufferSize: 1 }),\n );\n }\n\n getConnectionState(\n instagramPageData: SocialPageInstagram,\n _partnerID: string,\n _accountGroupID: string,\n ): Observable {\n // const enabledForPage$ = this.fbAPIService.facebookPageMessengerState({\n // organizationId: partnerID + ':' + accountGroupID,\n // pageId: facebookPageData.profileUrl?.split('id=')[1],\n // facebookUserId: facebookPageData.facebookUserID,\n // });\n\n // return enabledForPage$.pipe(\n // map((enabledForPage) => {\n // return {\n // name: facebookPageData.name,\n // tokenStatus: TokenStatus.VALID,\n // messengerEnabled: !!enabledForPage.messengerEnabled,\n // isAssignedPageOwner: !!enabledForPage.isPageOwner,\n // };\n // }),\n // catchError((e: HttpErrorResponse) => {\n // const statusCheckPermissionError = e.status === 403;\n // return of({\n // name: facebookPageData.name,\n // tokenStatus: TokenStatus.UNKNOWN,\n // messengerEnabled: false,\n // isAssignedPageOwner: false,\n // statusCheckPermissionError,\n // });\n // }),\n // );\n return of({\n name: instagramPageData.name,\n profileUrl: instagramPageData.profileUrl,\n tokenStatus: TokenStatus.VALID,\n messengerEnabled: false,\n isAssignedPageOwner: true,\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, computed, Input, OnChanges, Signal, signal, SimpleChanges } from '@angular/core';\nimport { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { TokenStatus } from '@vendasta/facebook';\nimport { GalaxyAlertModule } from '@vendasta/galaxy/alert';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { GalaxyPopoverModule } from '@vendasta/galaxy/popover';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { filter, firstValueFrom, switchMap } from 'rxjs';\nimport { SocialPageInstagram } from '../interfaces';\nimport { InstagramMessagesService, InstagramPageConnectionInfo } from './instagram-messages.service';\n\ntype badgeValue = {\n color: 'red' | 'green';\n i18nKey: string;\n};\n\ntype displayedButton = 'sign-in' | 'enable' | 'disable' | null;\n\n// TODO(BREW-577): This was copied from the FacebookMessengerComponent. So the\n// methods and properties of this class may need to be updated to handle\n// Instagram specifics.\n@Component({\n selector: 'inbox-instagram-messages',\n standalone: true,\n imports: [\n CommonModule,\n MatCardModule,\n MatIconModule,\n MatButtonModule,\n TranslateModule,\n GalaxyBadgeModule,\n MatProgressSpinnerModule,\n GalaxyAlertModule,\n GalaxyPopoverModule,\n GalaxySnackbarModule,\n ],\n templateUrl: './instagram-messages.component.html',\n styleUrl: './instagram-messages.component.scss',\n})\nexport class InstagramMessagesComponent implements OnChanges {\n readonly loadingAccounts = signal(true);\n readonly loadingPage = signal(false);\n\n readonly pageName: Signal;\n readonly pageUrl: Signal;\n readonly badgeValue: Signal;\n readonly manyPages: Signal;\n readonly noPages: Signal;\n readonly buttonToDisplay: Signal;\n readonly authTokenMissingPermissions: Signal;\n readonly unknownError: Signal;\n // user does not have required auth to view connection status, connect, or disconnect\n readonly authError: Signal;\n readonly messengerEnabled: Signal;\n\n private readonly connectedPages = signal([]);\n private readonly pageInfo = signal(null);\n\n @Input({ required: true }) accountID = '';\n @Input({ required: true }) partnerID = '';\n\n constructor(\n private readonly instagramMessagesService: InstagramMessagesService,\n private readonly snackbarService: SnackbarService,\n ) {\n this.manyPages = computed(() => {\n return this.connectedPages().length > 1;\n });\n\n this.noPages = computed(() => {\n return this.connectedPages().length === 0;\n });\n\n toObservable(this.connectedPages)\n .pipe(\n takeUntilDestroyed(),\n filter((connectedPages) => connectedPages.length > 0),\n switchMap((connectedPages) =>\n this.instagramMessagesService.getConnectionState(connectedPages[0], this.partnerID, this.accountID),\n ),\n )\n .subscribe((pageInfo) => {\n this.loadingPage.set(false);\n this.pageInfo.set(pageInfo);\n });\n\n this.messengerEnabled = computed(\n () =>\n (this.pageInfo()?.messengerEnabled &&\n this.pageInfo()?.tokenStatus === TokenStatus.VALID &&\n this.pageInfo()?.isAssignedPageOwner) ??\n false,\n );\n\n this.badgeValue = computed(() => {\n return {\n color: this.messengerEnabled() ? 'green' : 'red',\n i18nKey: this.messengerEnabled() ? 'INBOX.SETTINGS.ACTIVE' : 'INBOX.SETTINGS.INACTIVE',\n };\n });\n this.pageName = computed(() => this.pageInfo()?.name ?? '');\n this.pageUrl = computed(() => this.pageInfo()?.profileUrl ?? '');\n this.authTokenMissingPermissions = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.MISSING_PERMISSIONS);\n this.unknownError = computed(() => this.pageInfo()?.tokenStatus === TokenStatus.INVALID);\n this.authError = computed(() => this.pageInfo()?.statusCheckPermissionError ?? false);\n\n this.buttonToDisplay = computed(() => {\n if (this.noPages()) {\n return 'sign-in';\n } else if (this.messengerEnabled()) {\n return 'disable';\n } else if (this.unknownError()) {\n return null;\n } else if (!this.messengerEnabled() && this.pageInfo()?.tokenStatus === TokenStatus.VALID) {\n return 'enable';\n } else {\n return null;\n }\n });\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['accountID']) {\n this.loadingAccounts.set(true);\n firstValueFrom(this.instagramMessagesService.getPagesForAccount(changes['accountID'].currentValue))\n .then((pages) => {\n if (pages.length > 0) {\n this.connectedPages.set(pages);\n this.loadingPage.set(true);\n } else {\n this.connectedPages.set([]);\n }\n })\n .catch(() => {\n this.connectedPages.set([]);\n })\n .finally(() => {\n this.loadingAccounts.set(false);\n });\n }\n }\n\n authClick() {\n this.instagramMessagesService.redirectToFacebookAuth(this.accountID);\n }\n\n async connect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.instagramMessagesService.enableMessaging(this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_ENABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_ENABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n\n async disconnect(): Promise {\n this.loadingAccounts.set(true);\n return firstValueFrom(this.instagramMessagesService.disableMessaging(this.accountID, this.connectedPages()[0]))\n .then((success) => {\n if (success) {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.SUCCESS.SUCCESSFULLY_DISABLED');\n const pages = this.connectedPages();\n this.connectedPages.update(() => []); // update only emmits if the value changes\n this.connectedPages.update(() => pages);\n } else {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.FACEBOOK_MESSENGER.ERRORS.FAILED_TO_DISABLE');\n }\n })\n .finally(() => this.loadingAccounts.set(false));\n }\n}\n","\n\n \n \n \n {{ badgeValue()!.i18nKey | translate }}\n \n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.TITLE' | translate }}\n \n \n
\n \n
\n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECTED_DESCRIPTION' | translate }}\n

\n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.INSTAGRAM_PAGE_NAME' | translate }}: \n @if (pageUrl()) {\n {{ pageName() }}\n } @else {\n {{ pageName() }}\n }\n

\n

\n \n \n \n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECT' | translate }}\n \n

\n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.UNKNOWN_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PLEASE_TRY_RECONNECTING' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PERMISSIONS_ERROR_DESCRIPTION' | translate }}\n

\n
\n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.PERMISSIONS_ERROR' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.ERRORS.RECONNECT_TO_GRANT_PERMISSIONS' | translate }}\n

\n \n \n

\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.WARNINGS.MULTIPLE_PAGES_LINKED' | translate }}\n
\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.WARNINGS.MULTIPLE_PAGES_LINKED_DESCRIPTION' | translate }}\n \n

\n
\n
\n
\n
\n\n\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECT_TITLE' | translate }}\n {{ 'INBOX.SETTINGS.INSTAGRAM_MESSAGES.DISCONNECT_DESCRIPTION' | translate }}\n \n \n \n \n\n","import { CommonModule } from '@angular/common';\nimport { Component } from '@angular/core';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\n@Component({\n selector: 'inbox-webchat-learn-more',\n standalone: true,\n imports: [CommonModule, MatDialogModule, MatButtonModule, TranslateModule],\n templateUrl: './webchat-learn-more.component.html',\n styleUrls: ['./webchat-learn-more.component.scss'],\n})\nexport class WebchatLearnMoreComponent {}\n","

{{ 'INBOX.WEBCHAT.LEARN_MORE.TITLE' | translate }}

\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.WHAT_CAN_DO_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.WHAT_CAN_DO' | translate }}\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_IT_WORKS_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_IT_WORKS' | translate }}\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TO_GET_MOST_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TO_GET_MOST' | translate }}\n\n

{{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TEST_IT_QUESTION' | translate }}

\n {{ 'INBOX.WEBCHAT.LEARN_MORE.HOW_TEST_IT' | translate }}\n
\n\n \n\n","import { Component, inject, Input, signal } from '@angular/core';\nimport { MatCardModule } from '@angular/material/card';\nimport { GalaxyBadgeModule } from '@vendasta/galaxy/badge';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { WebchatLearnMoreComponent } from '../webchat-learn-more/webchat-learn-more.component';\nimport { MatDialog } from '@angular/material/dialog';\nimport { catchError, firstValueFrom, throwError } from 'rxjs';\nimport { AsyncPipe, NgIf } from '@angular/common';\nimport { ActivatedRoute, Router } from '@angular/router';\nimport { ConversationApiService } from '@vendasta/conversation';\nimport { Widget } from '../webchat-form/widget';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\n\nconst CREATE_WEBCHAT_URL = `../widgets/new`;\nconst WEBCHAT_ICON = 'https://vstatic-prod.apigateway.co/business-center-client/assets/webchat-icon.svg';\n\n@Component({\n selector: 'inbox-webchat-config-card',\n standalone: true,\n templateUrl: './webchat-config-card.component.html',\n styleUrls: ['./webchat-config-card.component.scss'],\n imports: [MatCardModule, GalaxyBadgeModule, MatButtonModule, MatSlideToggleModule, TranslateModule, AsyncPipe, NgIf],\n})\nexport class WebchatConfigCardComponent {\n @Input() set widget(value: Widget) {\n this.webchat.set(value);\n }\n @Input() created?: boolean = true;\n\n webchat = signal(null);\n protected readonly webchatIcon = WEBCHAT_ICON;\n\n private readonly dialog = inject(MatDialog);\n private readonly router = inject(Router);\n private route = inject(ActivatedRoute);\n private readonly conversationApiService = inject(ConversationApiService);\n private snackbarService = inject(SnackbarService);\n\n protected async handleToggleChange(): Promise {\n try {\n const resp = await firstValueFrom(\n this.conversationApiService\n .updateWidget({\n widgetId: this.webchat().widgetId,\n isEnabled: !this.webchat().isEnabled,\n fieldMask: {\n paths: ['is_enabled'],\n },\n })\n .pipe(catchError((err) => throwError(() => err))),\n );\n this.webchat.set(resp.widget);\n this.snackbarService.openSuccessSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_UPDATED');\n } catch (e) {\n this.snackbarService.openErrorSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_UPDATE_ERROR');\n }\n }\n\n protected learnMore(): void {\n this.dialog.open(WebchatLearnMoreComponent, {\n width: '660px',\n });\n }\n\n protected webChatCardRedirect(): void {\n this.router.navigate([this.created ? `../widgets/${this.webchat().widgetId}/edit` : CREATE_WEBCHAT_URL], {\n relativeTo: this.route,\n });\n }\n}\n","\n \n \"avatar\"\n \n {{ webchat()?.name ? webchat()?.name : ('INBOX.WEBCHAT.SETTINGS.TITLE' | translate) }}\n \n
\n {{ 'INBOX.SETTINGS.ACTIVE' | translate }}\n \n {{ 'INBOX.WEBCHAT.SETTINGS.NOT_ACTIVE' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.SETUP_REQUIRED' | translate }}\n \n
\n
\n \n
\n {{ 'INBOX.WEBCHAT.SETTINGS.DESCRIPTION' | translate }}\n {{ 'INBOX.WEBCHAT.SETTINGS.LEARN_MORE' | translate }}\n
\n
\n \n
\n {{ 'INBOX.WEBCHAT.SETTINGS.ENABLED_WEBCHAT' | translate }}\n
{{ 'INBOX.WEBCHAT.SETTINGS.ENABLED_DESCRIPTION' | translate }}
\n
\n
\n \n
\n
\n","import { CommonModule } from '@angular/common';\nimport { Component, DestroyRef, inject, Inject, OnInit } from '@angular/core';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { SmsModule } from '@galaxy/sms';\nimport { TranslateModule } from '@ngx-translate/core';\nimport {\n Configuration,\n ConversationApiService,\n GlobalParticipantType,\n InboxApiService,\n Widget,\n} from '@vendasta/conversation';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { BehaviorSubject, combineLatest, firstValueFrom, map, Observable, shareReplay } from 'rxjs';\nimport { catchError, distinctUntilChanged, switchMap, tap } from 'rxjs/operators';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n CONVERSATION_FACEBOOK_MESSENGER_AVAILABLE_TOKEN,\n CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN,\n CONVERSATION_INSTAGRAM_MESSAGES_AVAILABLE_TOKEN,\n InboxService,\n PARTNER_ID_TOKEN,\n} from '../../../core/src/index';\nimport { InboxPreviewComponent } from '../inbox-preview/inbox-preview.component';\nimport { EmailSettingsCardComponent } from './email-configuration/email-settings-card.component';\nimport { FacebookMessengerComponent } from './facebook-messenger/facebook-messenger.component';\nimport { GoogleBusinessCommunicationCardComponent } from './google-business-communication-card/google-business-communication-card.component';\nimport { InstagramMessagesComponent } from './instagram-messages/instagram-messages.component';\nimport { WebchatConfigCardComponent } from './webchat-configuration/webchat-config-card/webchat-config-card.component';\n\n@Component({\n standalone: true,\n imports: [\n CommonModule,\n ReactiveFormsModule,\n RouterModule,\n TranslateModule,\n GalaxyPageModule,\n GalaxyFormFieldModule,\n MatButtonModule,\n MatCardModule,\n MatInputModule,\n MatSlideToggleModule,\n MatIconModule,\n InboxPreviewComponent,\n GalaxyEmptyStateModule,\n SmsModule,\n GoogleBusinessCommunicationCardComponent,\n FacebookMessengerComponent,\n InstagramMessagesComponent,\n WebchatConfigCardComponent,\n EmailSettingsCardComponent,\n ],\n templateUrl: './settings.component.html',\n styleUrls: ['./settings.component.scss'],\n})\nexport class SettingsComponent implements OnInit {\n private readonly loading$$ = new BehaviorSubject(true);\n protected readonly loading$ = this.loading$$.asObservable();\n protected readonly showAvailabilityMessageSettings$ = this.inboxService.showAvailabilityMessageSettings$;\n protected readonly canAccessWebChatSettingsCard$ = this.inboxService.canAccessWebChatSettings$;\n protected readonly canAccessMessageTemplateSettingsCard$ = this.inboxService.canAccessMessageTemplateSettingsCard$;\n protected readonly canAccessEmailChannel$ = this.inboxService.canAccessEmailChannel$;\n // Only show save button if there is at least one setting that requires saving.\n protected readonly showSaveButton$ = this.showAvailabilityMessageSettings$;\n\n protected readonly form = new FormGroup({\n showAvailabilityMessage: new FormControl(false),\n availabilityMessage: new FormControl(''),\n });\n\n protected readonly isPartnerCenter = this.inboxService.isPartnerCenter;\n protected readonly isBusinessApp = this.inboxService.isBusinessApp;\n protected readonly displayA2pCard$ = this.inboxService.displayA2pCard$();\n protected readonly displayGoogleBusinessCommunicationCard$: Observable;\n protected readonly displayEmptyState$: Observable;\n\n private accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n protected readonly webchats$: Observable = this.partnerId$.pipe(\n switchMap((partnerId) => {\n const namespaceID = this.isPartnerCenter ? partnerId : this.accountGroupId();\n return this.conversationApiService.listWidgets({\n namespace: namespaceID,\n });\n }),\n map((listWidgets) => listWidgets?.widgets),\n shareReplay({ bufferSize: 1, refCount: true }),\n catchError(async (err) => {\n return err;\n }),\n );\n protected readonly webchatStatus$: Observable = this.webchats$.pipe(map((webchats) => webchats?.length > 0));\n private route = inject(ActivatedRoute);\n\n readonly businessAppSettingsPageUrl$ = this.accountGroupId$.pipe(\n map((accountGroupId) => `/account/location/${accountGroupId}/settings`),\n );\n\n constructor(\n private readonly inboxApiService: InboxApiService,\n private readonly snackbarService: SnackbarService,\n private readonly inboxService: InboxService,\n private readonly router: Router,\n @Inject(ACCOUNT_GROUP_ID_TOKEN) readonly accountGroupId$: Observable,\n @Inject(PARTNER_ID_TOKEN) protected readonly partnerId$: Observable,\n @Inject(CONVERSATION_GOOGLE_BUSINESS_MESSAGES_AVAILABLE_TOKEN)\n readonly googleBusinessMessagesAvailable$: Observable,\n @Inject(CONVERSATION_FACEBOOK_MESSENGER_AVAILABLE_TOKEN) readonly facebookMessengerAvailable$: Observable,\n @Inject(CONVERSATION_INSTAGRAM_MESSAGES_AVAILABLE_TOKEN) readonly instagramMessengerAvailable$: Observable,\n private readonly destroyRef: DestroyRef,\n private readonly conversationApiService: ConversationApiService,\n ) {\n this.displayGoogleBusinessCommunicationCard$ = this.googleBusinessMessagesAvailable$;\n this.facebookMessengerAvailable$;\n this.displayEmptyState$ = combineLatest([\n this.displayA2pCard$,\n this.displayGoogleBusinessCommunicationCard$,\n this.canAccessWebChatSettingsCard$,\n this.canAccessMessageTemplateSettingsCard$,\n this.facebookMessengerAvailable$,\n ]).pipe(\n map(\n ([\n displayA2pCard,\n displayGoogleCard,\n canAccessWebChatSettings,\n canAccessTemplates,\n facebookAvailable,\n ]): boolean => {\n const flags = [\n displayA2pCard,\n displayGoogleCard,\n canAccessWebChatSettings,\n canAccessTemplates,\n this.isPartnerCenter,\n facebookAvailable,\n ];\n return !flags.some(Boolean);\n },\n ),\n );\n }\n\n ngOnInit(): void {\n const showAvailabilityMessage = this.form.get('showAvailabilityMessage');\n if (showAvailabilityMessage) {\n showAvailabilityMessage.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((enabled) => {\n const field = this.form.get('availabilityMessage');\n enabled ? field?.enable() : field?.disable();\n });\n }\n\n this.partnerId$\n .pipe(\n tap(() => this.loading$$.next(true)),\n takeUntilDestroyed(this.destroyRef),\n distinctUntilChanged(),\n switchMap((partnerId) =>\n this.inboxApiService.getConfiguration({\n subjectParticipant: {\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n internalParticipantId: partnerId,\n },\n }),\n ),\n )\n .subscribe({\n next: (config) => {\n this.loading$$.next(false);\n this.updateForm(config.configuration);\n },\n error: (err) => {\n if (err.status !== 404) {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.ERROR_LOADING_SETTINGS');\n }\n this.loading$$.next(false);\n },\n });\n }\n\n protected async onSubmit(): Promise {\n this.loading$$.next(true);\n\n const partnerId = await firstValueFrom(this.partnerId$);\n const req = this.inboxApiService.upsertConfiguration({\n configuration: {\n subjectParticipant: {\n participantType: GlobalParticipantType.GLOBAL_PARTICIPANT_TYPE_PARTNER,\n internalParticipantId: partnerId,\n },\n showAvailabilityMessage: this.form.getRawValue().showAvailabilityMessage ?? undefined,\n availabilityMessage: this.form.getRawValue().availabilityMessage ?? undefined,\n },\n });\n\n await firstValueFrom(req)\n .then((resp) => {\n this.snackbarService.openSuccessSnack('INBOX.SETTINGS.SAVE_SUCCESSFUL');\n this.updateForm(resp.configuration);\n })\n .catch(() => {\n this.snackbarService.openErrorSnack('INBOX.SETTINGS.ERROR_SAVING_SETTINGS');\n });\n\n this.loading$$.next(false);\n }\n\n protected goToAutomations(): void {\n this.router\n .navigate(['/automations'])\n .then(() => this.router.navigate([{ outlets: { inbox: null } }], { queryParamsHandling: 'merge' }));\n }\n\n protected goToTemplatePage(): void {\n if (this.isBusinessApp) {\n this.router.navigate([`../message-templates`], {\n relativeTo: this.route,\n });\n } else {\n this.router.navigate(['', { outlets: { inbox: 'inbox/settings/message-templates' } }], {\n queryParamsHandling: 'merge',\n });\n }\n }\n\n private updateForm(config: Configuration): void {\n this.form.patchValue({\n showAvailabilityMessage: config.showAvailabilityMessage,\n availabilityMessage: config.availabilityMessage,\n });\n }\n}\n","\n \n \n \n \n \n\n \n \n arrow_back\n \n \n {{ 'INBOX.SETTINGS.PAGE_TITLE' | translate }}\n \n \n \n \n\n \n
\n \n \n {{ 'INBOX.SETTINGS.CHAT_AVAILABILITY' | translate }}\n \n \n
\n \n
\n \n {{ 'INBOX.SETTINGS.DISPLAY_AVAILABILITY_MESSAGE' | translate }}\n \n
\n
\n {{ 'INBOX.SETTINGS.AVAILABILITY_DESCRIPTION' | translate }}\n
\n
\n\n \n {{ 'INBOX.SETTINGS.AVAILABILITY_MESSAGE' | translate }}\n \n \n
\n
\n
{{ 'INBOX.SETTINGS.PREVIEW_TITLE' | translate }}
\n
\n \n
\n
\n
\n
\n\n \n \n {{ 'INBOX.SETTINGS.AUTOMATIONS' | translate }}\n \n \n
\n {{ 'INBOX.SETTINGS.AUTOMATIONS_DESCRIPTION' | translate }}\n \n {{ 'INBOX.SETTINGS.LEARN_MORE' | translate }}\n \n
\n \n
\n
\n\n \n\n \n\n \n\n \n\n \n\n \n \n \n \n \n \n \n \n\n \n \n \n {{ 'INBOX.SETTINGS.MESSAGE_TEMPLATES.TITLE' | translate }}\n \n \n
{{ 'INBOX.SETTINGS.MESSAGE_TEMPLATES.DESCRIPTION' | translate }}
\n \n
\n
\n
\n
\n\n \n \n \n
\n\n\n \n \n
\n
\n {{ 'INBOX.SETTINGS.EMPTY_STATE.TITLE' | translate }}\n

{{ 'INBOX.SETTINGS.EMPTY_STATE.DESCRIPTION' | translate }}

\n
\n
\n","import { Injectable } from '@angular/core';\nimport { ActivatedRouteSnapshot, Router, UrlTree } from '@angular/router';\nimport { Observable } from 'rxjs';\nimport { tap } from 'rxjs/operators';\nimport { InboxService } from '../../../core/src/lib/inbox.service';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class SettingsAccessGuard {\n constructor(readonly inboxService: InboxService, private router: Router) {}\n\n canActivate(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _: ActivatedRouteSnapshot,\n ): Observable | Promise | boolean | UrlTree {\n return this.inboxService.canAccessEmbeddedSettings$.pipe(\n tap((canAccess) => {\n if (!canAccess) {\n this.router.navigate([{ outlets: { inbox: 'inbox' } }]);\n }\n }),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Input, Output } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatCardModule } from '@angular/material/card';\nimport { RouterModule } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\n\n@Component({\n selector: 'inbox-sticky-footer',\n standalone: true,\n imports: [CommonModule, RouterModule, MatCardModule, MatButtonModule, TranslateModule],\n templateUrl: './sticky-footer.component.html',\n styleUrls: ['./sticky-footer.component.scss'],\n})\nexport class StickyFooterComponent {\n @Output() public submitClick = new EventEmitter();\n @Input() public cancelLink: string;\n @Input() public disabled = false;\n @Input() public submitOverride?: string;\n @Input() public cancelOverride?: string;\n\n onSubmit(): void {\n this.submitClick.emit();\n }\n}\n","\n \n \n \n {{ cancelOverride || 'INBOX.CANCEL' | translate }}\n \n \n\n","const PARTNER_CENTER_SETTINGS_URL = 'settings';\nconst BUSINESS_APP_SETTINGS_URL = 'inbox';\n\nexport function getBackUrl(isBusinessApp: boolean, levelsDeep: number): string {\n const centerUrl = isBusinessApp ? BUSINESS_APP_SETTINGS_URL : PARTNER_CENTER_SETTINGS_URL;\n let url = '';\n for (let i = 0; i < levelsDeep; i++) {\n url += '../';\n }\n return `${url}${centerUrl}`;\n}\n","import * as i0 from '@angular/core';\nimport { Injectable } from '@angular/core';\nimport { map } from 'rxjs/operators';\nimport * as i1 from '@angular/common/http';\nimport { HttpHeaders } from '@angular/common/http';\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar EmbeddingSourceType = /*#__PURE__*/function (EmbeddingSourceType) {\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_INVALID\"] = 0] = \"EMBEDDING_SOURCE_TYPE_INVALID\";\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_USER_INPUT\"] = 1] = \"EMBEDDING_SOURCE_TYPE_USER_INPUT\";\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_WEBSITE\"] = 2] = \"EMBEDDING_SOURCE_TYPE_WEBSITE\";\n EmbeddingSourceType[EmbeddingSourceType[\"EMBEDDING_SOURCE_TYPE_BUSINESS_PROFILE\"] = 3] = \"EMBEDDING_SOURCE_TYPE_BUSINESS_PROFILE\";\n return EmbeddingSourceType;\n}(EmbeddingSourceType || {});\nvar EmbeddingVendorModel = /*#__PURE__*/function (EmbeddingVendorModel) {\n EmbeddingVendorModel[EmbeddingVendorModel[\"EMBEDDING_MODEL_INVALID\"] = 0] = \"EMBEDDING_MODEL_INVALID\";\n EmbeddingVendorModel[EmbeddingVendorModel[\"EMBEDDING_MODEL_OPENAI_ADA_V2\"] = 1] = \"EMBEDDING_MODEL_OPENAI_ADA_V2\";\n EmbeddingVendorModel[EmbeddingVendorModel[\"EMBEDDING_MODEL_GOOGLE_GECKO_V2\"] = 2] = \"EMBEDDING_MODEL_GOOGLE_GECKO_V2\";\n return EmbeddingVendorModel;\n}(EmbeddingVendorModel || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar KnowledgeSourceConfigType = /*#__PURE__*/function (KnowledgeSourceConfigType) {\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_INVALID\"] = 0] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_INVALID\";\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_BUSINESS_PROFILE\"] = 1] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_BUSINESS_PROFILE\";\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_CUSTOM_DATA\"] = 2] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_CUSTOM_DATA\";\n KnowledgeSourceConfigType[KnowledgeSourceConfigType[\"KNOWLEDGE_SOURCE_CONFIG_TYPE_WEBSITE_SCRAPE\"] = 3] = \"KNOWLEDGE_SOURCE_CONFIG_TYPE_WEBSITE_SCRAPE\";\n return KnowledgeSourceConfigType;\n}(KnowledgeSourceConfigType || {});\nvar WebsiteScrapeConfigCrawlMode = /*#__PURE__*/function (WebsiteScrapeConfigCrawlMode) {\n WebsiteScrapeConfigCrawlMode[WebsiteScrapeConfigCrawlMode[\"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_INVALID\"] = 0] = \"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_INVALID\";\n WebsiteScrapeConfigCrawlMode[WebsiteScrapeConfigCrawlMode[\"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE\"] = 1] = \"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE\";\n WebsiteScrapeConfigCrawlMode[WebsiteScrapeConfigCrawlMode[\"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE\"] = 2] = \"WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE\";\n return WebsiteScrapeConfigCrawlMode;\n}(WebsiteScrapeConfigCrawlMode || {});\nvar WebsiteScrapeConfigProgress = /*#__PURE__*/function (WebsiteScrapeConfigProgress) {\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_INVALID\"] = 0] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_INVALID\";\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\"] = 1] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\";\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_IN_PROGRESS\"] = 2] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_IN_PROGRESS\";\n WebsiteScrapeConfigProgress[WebsiteScrapeConfigProgress[\"WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\"] = 3] = \"WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\";\n return WebsiteScrapeConfigProgress;\n}(WebsiteScrapeConfigProgress || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums.\n// *********************************\nvar RefreshAccountGroupWebsiteEmbeddingsProgress = /*#__PURE__*/function (RefreshAccountGroupWebsiteEmbeddingsProgress) {\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_INVALID\"] = 0] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_INVALID\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_SCRAPE_STARTED\"] = 1] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_SCRAPE_STARTED\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_ANALYSIS_STARTED\"] = 2] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_ANALYSIS_STARTED\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_COMPLETE\"] = 3] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_COMPLETE\";\n RefreshAccountGroupWebsiteEmbeddingsProgress[RefreshAccountGroupWebsiteEmbeddingsProgress[\"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_FAILED\"] = 4] = \"REFRESH_WEBSITE_EMBEDDINGS_PROGRESS_FAILED\";\n return RefreshAccountGroupWebsiteEmbeddingsProgress;\n}(RefreshAccountGroupWebsiteEmbeddingsProgress || {});\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Enums Index.\n// *********************************\n\nfunction enumStringToValue$5(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Embedding {\n static fromProto(proto) {\n let m = new Embedding();\n m = Object.assign(m, proto);\n if (proto.metadata) {\n m.metadata = EmbeddingMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.content !== 'undefined') {\n toReturn['content'] = this.content;\n }\n if (typeof this.originalContent !== 'undefined') {\n toReturn['originalContent'] = this.originalContent;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass EmbeddingCitation {\n static fromProto(proto) {\n let m = new EmbeddingCitation();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.link !== 'undefined') {\n toReturn['link'] = this.link;\n }\n if (typeof this.title !== 'undefined') {\n toReturn['title'] = this.title;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n return toReturn;\n }\n}\nclass EmbeddingMetadata {\n static fromProto(proto) {\n let m = new EmbeddingMetadata();\n m = Object.assign(m, proto);\n if (proto.createdAt) {\n m.createdAt = new Date(proto.createdAt);\n }\n if (proto.updatedAt) {\n m.updatedAt = new Date(proto.updatedAt);\n }\n if (proto.relationship) {\n m.relationship = EmbeddingRelationship.fromProto(proto.relationship);\n }\n if (proto.sourceType) {\n m.sourceType = enumStringToValue$5(EmbeddingSourceType, proto.sourceType);\n }\n if (proto.vendorModel) {\n m.vendorModel = enumStringToValue$5(EmbeddingVendorModel, proto.vendorModel);\n }\n if (proto.citation) {\n m.citation = EmbeddingCitation.fromProto(proto.citation);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.createdBy !== 'undefined') {\n toReturn['createdBy'] = this.createdBy;\n }\n if (typeof this.createdAt !== 'undefined' && this.createdAt !== null) {\n toReturn['createdAt'] = 'toApiJson' in this.createdAt ? this.createdAt.toApiJson() : this.createdAt;\n }\n if (typeof this.updatedAt !== 'undefined' && this.updatedAt !== null) {\n toReturn['updatedAt'] = 'toApiJson' in this.updatedAt ? this.updatedAt.toApiJson() : this.updatedAt;\n }\n if (typeof this.relationship !== 'undefined' && this.relationship !== null) {\n toReturn['relationship'] = 'toApiJson' in this.relationship ? this.relationship.toApiJson() : this.relationship;\n }\n if (typeof this.sourceType !== 'undefined') {\n toReturn['sourceType'] = this.sourceType;\n }\n if (typeof this.sourceFeature !== 'undefined') {\n toReturn['sourceFeature'] = this.sourceFeature;\n }\n if (typeof this.vendorModel !== 'undefined') {\n toReturn['vendorModel'] = this.vendorModel;\n }\n if (typeof this.citation !== 'undefined' && this.citation !== null) {\n toReturn['citation'] = 'toApiJson' in this.citation ? this.citation.toApiJson() : this.citation;\n }\n if (typeof this.disabled !== 'undefined') {\n toReturn['disabled'] = this.disabled;\n }\n return toReturn;\n }\n}\nclass EmbeddingRelationship {\n static fromProto(proto) {\n let m = new EmbeddingRelationship();\n m = Object.assign(m, proto);\n if (proto.accountGroup) {\n m.accountGroup = EmbeddingRelationshipAccountGroup.fromProto(proto.accountGroup);\n }\n if (proto.partner) {\n m.partner = EmbeddingRelationshipPartner.fromProto(proto.partner);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroup !== 'undefined' && this.accountGroup !== null) {\n toReturn['accountGroup'] = 'toApiJson' in this.accountGroup ? this.accountGroup.toApiJson() : this.accountGroup;\n }\n if (typeof this.partner !== 'undefined' && this.partner !== null) {\n toReturn['partner'] = 'toApiJson' in this.partner ? this.partner.toApiJson() : this.partner;\n }\n return toReturn;\n }\n}\nclass EmbeddingRelationshipAccountGroup {\n static fromProto(proto) {\n let m = new EmbeddingRelationshipAccountGroup();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n if (typeof this.marketId !== 'undefined') {\n toReturn['marketId'] = this.marketId;\n }\n return toReturn;\n }\n}\nclass EmbeddingRelationshipPartner {\n static fromProto(proto) {\n let m = new EmbeddingRelationshipPartner();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$4(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass NamespaceAccountGroupNamespace {\n static fromProto(proto) {\n let m = new NamespaceAccountGroupNamespace();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n if (typeof this.marketId !== 'undefined') {\n toReturn['marketId'] = this.marketId;\n }\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass App {\n static fromProto(proto) {\n let m = new App();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.knowledgeBaseKeys) {\n m.knowledgeBaseKeys = proto.knowledgeBaseKeys.map(KnowledgeBaseKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.configurationUrl !== 'undefined') {\n toReturn['configurationUrl'] = this.configurationUrl;\n }\n if (typeof this.knowledgeBaseKeys !== 'undefined' && this.knowledgeBaseKeys !== null) {\n toReturn['knowledgeBaseKeys'] = 'toApiJson' in this.knowledgeBaseKeys ? this.knowledgeBaseKeys.toApiJson() : this.knowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigBusinessProfileConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigBusinessProfileConfig();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigCustomDataConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigCustomDataConfig();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.text !== 'undefined') {\n toReturn['text'] = this.text;\n }\n if (typeof this.fileUrl !== 'undefined') {\n toReturn['fileUrl'] = this.fileUrl;\n }\n return toReturn;\n }\n}\nclass KnowledgeBase {\n static fromProto(proto) {\n let m = new KnowledgeBase();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.knowledgeSourceKeys) {\n m.knowledgeSourceKeys = proto.knowledgeSourceKeys.map(KnowledgeSourceKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n if (typeof this.knowledgeSourceKeys !== 'undefined' && this.knowledgeSourceKeys !== null) {\n toReturn['knowledgeSourceKeys'] = 'toApiJson' in this.knowledgeSourceKeys ? this.knowledgeSourceKeys.toApiJson() : this.knowledgeSourceKeys;\n }\n return toReturn;\n }\n}\nclass KnowledgeBaseKey {\n static fromProto(proto) {\n let m = new KnowledgeBaseKey();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBaseId !== 'undefined') {\n toReturn['knowledgeBaseId'] = this.knowledgeBaseId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass KnowledgeSource {\n static fromProto(proto) {\n let m = new KnowledgeSource();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.config) {\n m.config = KnowledgeSourceConfig.fromProto(proto.config);\n }\n if (proto.knowledgeBaseKeys) {\n m.knowledgeBaseKeys = proto.knowledgeBaseKeys.map(KnowledgeBaseKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.name !== 'undefined') {\n toReturn['name'] = this.name;\n }\n if (typeof this.description !== 'undefined') {\n toReturn['description'] = this.description;\n }\n if (typeof this.config !== 'undefined' && this.config !== null) {\n toReturn['config'] = 'toApiJson' in this.config ? this.config.toApiJson() : this.config;\n }\n if (typeof this.knowledgeBaseKeys !== 'undefined' && this.knowledgeBaseKeys !== null) {\n toReturn['knowledgeBaseKeys'] = 'toApiJson' in this.knowledgeBaseKeys ? this.knowledgeBaseKeys.toApiJson() : this.knowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfig();\n m = Object.assign(m, proto);\n if (proto.businessProfileConfig) {\n m.businessProfileConfig = KnowledgeSourceConfigBusinessProfileConfig.fromProto(proto.businessProfileConfig);\n }\n if (proto.customDataConfig) {\n m.customDataConfig = KnowledgeSourceConfigCustomDataConfig.fromProto(proto.customDataConfig);\n }\n if (proto.websiteScrapeConfig) {\n m.websiteScrapeConfig = KnowledgeSourceConfigWebsiteScrapeConfig.fromProto(proto.websiteScrapeConfig);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.businessProfileConfig !== 'undefined' && this.businessProfileConfig !== null) {\n toReturn['businessProfileConfig'] = 'toApiJson' in this.businessProfileConfig ? this.businessProfileConfig.toApiJson() : this.businessProfileConfig;\n }\n if (typeof this.customDataConfig !== 'undefined' && this.customDataConfig !== null) {\n toReturn['customDataConfig'] = 'toApiJson' in this.customDataConfig ? this.customDataConfig.toApiJson() : this.customDataConfig;\n }\n if (typeof this.websiteScrapeConfig !== 'undefined' && this.websiteScrapeConfig !== null) {\n toReturn['websiteScrapeConfig'] = 'toApiJson' in this.websiteScrapeConfig ? this.websiteScrapeConfig.toApiJson() : this.websiteScrapeConfig;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceKey {\n static fromProto(proto) {\n let m = new KnowledgeSourceKey();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSourceId !== 'undefined') {\n toReturn['knowledgeSourceId'] = this.knowledgeSourceId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass Namespace {\n static fromProto(proto) {\n let m = new Namespace();\n m = Object.assign(m, proto);\n if (proto.accountGroupNamespace) {\n m.accountGroupNamespace = NamespaceAccountGroupNamespace.fromProto(proto.accountGroupNamespace);\n }\n if (proto.partnerNamespace) {\n m.partnerNamespace = NamespacePartnerNamespace.fromProto(proto.partnerNamespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupNamespace !== 'undefined' && this.accountGroupNamespace !== null) {\n toReturn['accountGroupNamespace'] = 'toApiJson' in this.accountGroupNamespace ? this.accountGroupNamespace.toApiJson() : this.accountGroupNamespace;\n }\n if (typeof this.partnerNamespace !== 'undefined' && this.partnerNamespace !== null) {\n toReturn['partnerNamespace'] = 'toApiJson' in this.partnerNamespace ? this.partnerNamespace.toApiJson() : this.partnerNamespace;\n }\n return toReturn;\n }\n}\nclass NamespacePartnerNamespace {\n static fromProto(proto) {\n let m = new NamespacePartnerNamespace();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.partnerId !== 'undefined') {\n toReturn['partnerId'] = this.partnerId;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.title !== 'undefined') {\n toReturn['title'] = this.title;\n }\n if (typeof this.errorMessage !== 'undefined') {\n toReturn['errorMessage'] = this.errorMessage;\n }\n if (typeof this.trainingEnabled !== 'undefined') {\n toReturn['trainingEnabled'] = this.trainingEnabled;\n }\n return toReturn;\n }\n}\nclass KnowledgeSourceConfigWebsiteScrapeConfig {\n static fromProto(proto) {\n let m = new KnowledgeSourceConfigWebsiteScrapeConfig();\n m = Object.assign(m, proto);\n if (proto.crawlMode) {\n m.crawlMode = enumStringToValue$4(WebsiteScrapeConfigCrawlMode, proto.crawlMode);\n }\n if (proto.scrapedPages) {\n m.scrapedPages = proto.scrapedPages.map(KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage.fromProto);\n }\n if (proto.scrapeProgress) {\n m.scrapeProgress = enumStringToValue$4(WebsiteScrapeConfigProgress, proto.scrapeProgress);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.url !== 'undefined') {\n toReturn['url'] = this.url;\n }\n if (typeof this.crawlMode !== 'undefined') {\n toReturn['crawlMode'] = this.crawlMode;\n }\n if (typeof this.scrapeInProgress !== 'undefined') {\n toReturn['scrapeInProgress'] = this.scrapeInProgress;\n }\n if (typeof this.scrapedPages !== 'undefined' && this.scrapedPages !== null) {\n toReturn['scrapedPages'] = 'toApiJson' in this.scrapedPages ? this.scrapedPages.toApiJson() : this.scrapedPages;\n }\n if (typeof this.scrapeProgress !== 'undefined') {\n toReturn['scrapeProgress'] = this.scrapeProgress;\n }\n if (typeof this.scrapeError !== 'undefined') {\n toReturn['scrapeError'] = this.scrapeError;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$3(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass FieldMask {\n static fromProto(proto) {\n let m = new FieldMask();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.paths !== 'undefined') {\n toReturn['paths'] = this.paths;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$2(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass PagedRequestOptions {\n static fromProto(proto) {\n let m = new PagedRequestOptions();\n m = Object.assign(m, proto);\n if (proto.pageSize) {\n m.pageSize = parseInt(proto.pageSize, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.cursor !== 'undefined') {\n toReturn['cursor'] = this.cursor;\n }\n if (typeof this.pageSize !== 'undefined') {\n toReturn['pageSize'] = this.pageSize;\n }\n return toReturn;\n }\n}\nclass PagedResponseMetadata {\n static fromProto(proto) {\n let m = new PagedResponseMetadata();\n m = Object.assign(m, proto);\n if (proto.totalResults) {\n m.totalResults = parseInt(proto.totalResults, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.nextCursor !== 'undefined') {\n toReturn['nextCursor'] = this.nextCursor;\n }\n if (typeof this.hasMore !== 'undefined') {\n toReturn['hasMore'] = this.hasMore;\n }\n if (typeof this.totalResults !== 'undefined') {\n toReturn['totalResults'] = this.totalResults;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue$1(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass Access {\n static fromProto(proto) {\n let m = new Access();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.scope !== 'undefined') {\n toReturn['scope'] = this.scope;\n }\n if (typeof this.public !== 'undefined') {\n toReturn['public'] = this.public;\n }\n return toReturn;\n }\n}\nfunction enumStringToValue(enumRef, value) {\n if (typeof value === 'number') {\n return value;\n }\n return enumRef[value];\n}\nclass CreateEmbeddingRequest {\n static fromProto(proto) {\n let m = new CreateEmbeddingRequest();\n m = Object.assign(m, proto);\n if (proto.metadata) {\n m.metadata = EmbeddingMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.content !== 'undefined') {\n toReturn['content'] = this.content;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass CreateEmbeddingResponse {\n static fromProto(proto) {\n let m = new CreateEmbeddingResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new CreateKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeBase) {\n m.knowledgeBase = KnowledgeBase.fromProto(proto.knowledgeBase);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBase !== 'undefined' && this.knowledgeBase !== null) {\n toReturn['knowledgeBase'] = 'toApiJson' in this.knowledgeBase ? this.knowledgeBase.toApiJson() : this.knowledgeBase;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeBaseResponse {\n static fromProto(proto) {\n let m = new CreateKnowledgeBaseResponse();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new CreateKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeSource) {\n m.knowledgeSource = KnowledgeSource.fromProto(proto.knowledgeSource);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSource !== 'undefined' && this.knowledgeSource !== null) {\n toReturn['knowledgeSource'] = 'toApiJson' in this.knowledgeSource ? this.knowledgeSource.toApiJson() : this.knowledgeSource;\n }\n return toReturn;\n }\n}\nclass CreateKnowledgeSourceResponse {\n static fromProto(proto) {\n let m = new CreateKnowledgeSourceResponse();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass DeleteAppRequest {\n static fromProto(proto) {\n let m = new DeleteAppRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass DeleteEmbeddingRequest {\n static fromProto(proto) {\n let m = new DeleteEmbeddingRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embeddingId !== 'undefined') {\n toReturn['embeddingId'] = this.embeddingId;\n }\n return toReturn;\n }\n}\nclass DeleteKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new DeleteKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass DeleteKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new DeleteKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeSourcesRequestFilters {\n static fromProto(proto) {\n let m = new ListKnowledgeSourcesRequestFilters();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.configTypes) {\n m.configTypes = proto.configTypes.map(v => enumStringToValue(KnowledgeSourceConfigType, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.configTypes !== 'undefined') {\n toReturn['configTypes'] = this.configTypes;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeBasesRequestFilters {\n static fromProto(proto) {\n let m = new ListKnowledgeBasesRequestFilters();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListEmbeddingsRequestFilters {\n static fromProto(proto) {\n let m = new ListEmbeddingsRequestFilters();\n m = Object.assign(m, proto);\n if (proto.relationship) {\n m.relationship = EmbeddingRelationship.fromProto(proto.relationship);\n }\n if (proto.sourceType) {\n m.sourceType = proto.sourceType.map(v => enumStringToValue(EmbeddingSourceType, v));\n }\n if (proto.vendorModel) {\n m.vendorModel = enumStringToValue(EmbeddingVendorModel, proto.vendorModel);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.relationship !== 'undefined' && this.relationship !== null) {\n toReturn['relationship'] = 'toApiJson' in this.relationship ? this.relationship.toApiJson() : this.relationship;\n }\n if (typeof this.sourceType !== 'undefined') {\n toReturn['sourceType'] = this.sourceType;\n }\n if (typeof this.vendorModel !== 'undefined') {\n toReturn['vendorModel'] = this.vendorModel;\n }\n if (typeof this.associatedAppId !== 'undefined') {\n toReturn['associatedAppId'] = this.associatedAppId;\n }\n return toReturn;\n }\n}\nclass ListAppsRequestFilters {\n static fromProto(proto) {\n let m = new ListAppsRequestFilters();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListAllKnowledgeSourcesForAppRequestFilters {\n static fromProto(proto) {\n let m = new ListAllKnowledgeSourcesForAppRequestFilters();\n m = Object.assign(m, proto);\n if (proto.configTypes) {\n m.configTypes = proto.configTypes.map(v => enumStringToValue(KnowledgeSourceConfigType, v));\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.configTypes !== 'undefined') {\n toReturn['configTypes'] = this.configTypes;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsRequestFilters {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsRequestFilters();\n m = Object.assign(m, proto);\n if (proto.relationship) {\n m.relationship = EmbeddingRelationship.fromProto(proto.relationship);\n }\n if (proto.sourceType) {\n m.sourceType = proto.sourceType.map(v => enumStringToValue(EmbeddingSourceType, v));\n }\n if (proto.vendorModel) {\n m.vendorModel = enumStringToValue(EmbeddingVendorModel, proto.vendorModel);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.relationship !== 'undefined' && this.relationship !== null) {\n toReturn['relationship'] = 'toApiJson' in this.relationship ? this.relationship.toApiJson() : this.relationship;\n }\n if (typeof this.sourceType !== 'undefined') {\n toReturn['sourceType'] = this.sourceType;\n }\n if (typeof this.vendorModel !== 'undefined') {\n toReturn['vendorModel'] = this.vendorModel;\n }\n if (typeof this.associatedAppId !== 'undefined') {\n toReturn['associatedAppId'] = this.associatedAppId;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsRequest {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = FindSimilarEmbeddingsRequestFilters.fromProto(proto.filters);\n }\n if (proto.limit) {\n m.limit = parseInt(proto.limit, 10);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.query !== 'undefined') {\n toReturn['query'] = this.query;\n }\n if (typeof this.limit !== 'undefined') {\n toReturn['limit'] = this.limit;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsResponse {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsResponse();\n m = Object.assign(m, proto);\n if (proto.embeddings) {\n m.embeddings = proto.embeddings.map(FindSimilarEmbeddingsResponseMatch.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embeddings !== 'undefined' && this.embeddings !== null) {\n toReturn['embeddings'] = 'toApiJson' in this.embeddings ? this.embeddings.toApiJson() : this.embeddings;\n }\n return toReturn;\n }\n}\nclass GetAppRequest {\n static fromProto(proto) {\n let m = new GetAppRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass GetAppResponse {\n static fromProto(proto) {\n let m = new GetAppResponse();\n m = Object.assign(m, proto);\n if (proto.app) {\n m.app = App.fromProto(proto.app);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.app !== 'undefined' && this.app !== null) {\n toReturn['app'] = 'toApiJson' in this.app ? this.app.toApiJson() : this.app;\n }\n return toReturn;\n }\n}\nclass GetEmbeddingRequest {\n static fromProto(proto) {\n let m = new GetEmbeddingRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n return toReturn;\n }\n}\nclass GetEmbeddingResponse {\n static fromProto(proto) {\n let m = new GetEmbeddingResponse();\n m = Object.assign(m, proto);\n if (proto.embedding) {\n m.embedding = Embedding.fromProto(proto.embedding);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embedding !== 'undefined' && this.embedding !== null) {\n toReturn['embedding'] = 'toApiJson' in this.embedding ? this.embedding.toApiJson() : this.embedding;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new GetKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.includeKnowledgeSourceKeys !== 'undefined') {\n toReturn['includeKnowledgeSourceKeys'] = this.includeKnowledgeSourceKeys;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeBaseResponse {\n static fromProto(proto) {\n let m = new GetKnowledgeBaseResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeBase) {\n m.knowledgeBase = KnowledgeBase.fromProto(proto.knowledgeBase);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBase !== 'undefined' && this.knowledgeBase !== null) {\n toReturn['knowledgeBase'] = 'toApiJson' in this.knowledgeBase ? this.knowledgeBase.toApiJson() : this.knowledgeBase;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new GetKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.id !== 'undefined') {\n toReturn['id'] = this.id;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass GetKnowledgeSourceResponse {\n static fromProto(proto) {\n let m = new GetKnowledgeSourceResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeSource) {\n m.knowledgeSource = KnowledgeSource.fromProto(proto.knowledgeSource);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSource !== 'undefined' && this.knowledgeSource !== null) {\n toReturn['knowledgeSource'] = 'toApiJson' in this.knowledgeSource ? this.knowledgeSource.toApiJson() : this.knowledgeSource;\n }\n return toReturn;\n }\n}\nclass ListAllAppsForKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new ListAllAppsForKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSourceId !== 'undefined') {\n toReturn['knowledgeSourceId'] = this.knowledgeSourceId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ListAllAppsForKnowledgeSourceResponse {\n static fromProto(proto) {\n let m = new ListAllAppsForKnowledgeSourceResponse();\n m = Object.assign(m, proto);\n if (proto.apps) {\n m.apps = proto.apps.map(App.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.apps !== 'undefined' && this.apps !== null) {\n toReturn['apps'] = 'toApiJson' in this.apps ? this.apps.toApiJson() : this.apps;\n }\n return toReturn;\n }\n}\nclass ListAllKnowledgeSourcesForAppRequest {\n static fromProto(proto) {\n let m = new ListAllKnowledgeSourcesForAppRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n if (proto.filters) {\n m.filters = ListAllKnowledgeSourcesForAppRequestFilters.fromProto(proto.filters);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.appId !== 'undefined') {\n toReturn['appId'] = this.appId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n return toReturn;\n }\n}\nclass ListAllKnowledgeSourcesForAppResponse {\n static fromProto(proto) {\n let m = new ListAllKnowledgeSourcesForAppResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeSources) {\n m.knowledgeSources = proto.knowledgeSources.map(KnowledgeSource.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSources !== 'undefined' && this.knowledgeSources !== null) {\n toReturn['knowledgeSources'] = 'toApiJson' in this.knowledgeSources ? this.knowledgeSources.toApiJson() : this.knowledgeSources;\n }\n return toReturn;\n }\n}\nclass ListAppsRequest {\n static fromProto(proto) {\n let m = new ListAppsRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListAppsRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass ListAppsResponse {\n static fromProto(proto) {\n let m = new ListAppsResponse();\n m = Object.assign(m, proto);\n if (proto.apps) {\n m.apps = proto.apps.map(App.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.apps !== 'undefined' && this.apps !== null) {\n toReturn['apps'] = 'toApiJson' in this.apps ? this.apps.toApiJson() : this.apps;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass ListEmbeddingsRequest {\n static fromProto(proto) {\n let m = new ListEmbeddingsRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListEmbeddingsRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n return toReturn;\n }\n}\nclass ListEmbeddingsResponse {\n static fromProto(proto) {\n let m = new ListEmbeddingsResponse();\n m = Object.assign(m, proto);\n if (proto.embeddings) {\n m.embeddings = proto.embeddings.map(Embedding.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embeddings !== 'undefined' && this.embeddings !== null) {\n toReturn['embeddings'] = 'toApiJson' in this.embeddings ? this.embeddings.toApiJson() : this.embeddings;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeBasesRequest {\n static fromProto(proto) {\n let m = new ListKnowledgeBasesRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListKnowledgeBasesRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n if (typeof this.includeKnowledgeSourceKeys !== 'undefined') {\n toReturn['includeKnowledgeSourceKeys'] = this.includeKnowledgeSourceKeys;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeBasesResponse {\n static fromProto(proto) {\n let m = new ListKnowledgeBasesResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeBases) {\n m.knowledgeBases = proto.knowledgeBases.map(KnowledgeBase.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBases !== 'undefined' && this.knowledgeBases !== null) {\n toReturn['knowledgeBases'] = 'toApiJson' in this.knowledgeBases ? this.knowledgeBases.toApiJson() : this.knowledgeBases;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeSourcesRequest {\n static fromProto(proto) {\n let m = new ListKnowledgeSourcesRequest();\n m = Object.assign(m, proto);\n if (proto.filters) {\n m.filters = ListKnowledgeSourcesRequestFilters.fromProto(proto.filters);\n }\n if (proto.pagingOptions) {\n m.pagingOptions = PagedRequestOptions.fromProto(proto.pagingOptions);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.filters !== 'undefined' && this.filters !== null) {\n toReturn['filters'] = 'toApiJson' in this.filters ? this.filters.toApiJson() : this.filters;\n }\n if (typeof this.pagingOptions !== 'undefined' && this.pagingOptions !== null) {\n toReturn['pagingOptions'] = 'toApiJson' in this.pagingOptions ? this.pagingOptions.toApiJson() : this.pagingOptions;\n }\n if (typeof this.includeKnowledgeBaseKeys !== 'undefined') {\n toReturn['includeKnowledgeBaseKeys'] = this.includeKnowledgeBaseKeys;\n }\n return toReturn;\n }\n}\nclass ListKnowledgeSourcesResponse {\n static fromProto(proto) {\n let m = new ListKnowledgeSourcesResponse();\n m = Object.assign(m, proto);\n if (proto.knowledgeSources) {\n m.knowledgeSources = proto.knowledgeSources.map(KnowledgeSource.fromProto);\n }\n if (proto.metadata) {\n m.metadata = PagedResponseMetadata.fromProto(proto.metadata);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSources !== 'undefined' && this.knowledgeSources !== null) {\n toReturn['knowledgeSources'] = 'toApiJson' in this.knowledgeSources ? this.knowledgeSources.toApiJson() : this.knowledgeSources;\n }\n if (typeof this.metadata !== 'undefined' && this.metadata !== null) {\n toReturn['metadata'] = 'toApiJson' in this.metadata ? this.metadata.toApiJson() : this.metadata;\n }\n return toReturn;\n }\n}\nclass FindSimilarEmbeddingsResponseMatch {\n static fromProto(proto) {\n let m = new FindSimilarEmbeddingsResponseMatch();\n m = Object.assign(m, proto);\n if (proto.embedding) {\n m.embedding = Embedding.fromProto(proto.embedding);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embedding !== 'undefined' && this.embedding !== null) {\n toReturn['embedding'] = 'toApiJson' in this.embedding ? this.embedding.toApiJson() : this.embedding;\n }\n if (typeof this.similarity !== 'undefined') {\n toReturn['similarity'] = this.similarity;\n }\n return toReturn;\n }\n}\nclass RefreshBusinessProfileEmbeddingsRequest {\n static fromProto(proto) {\n let m = new RefreshBusinessProfileEmbeddingsRequest();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.accountGroupId !== 'undefined') {\n toReturn['accountGroupId'] = this.accountGroupId;\n }\n return toReturn;\n }\n}\nclass ScrapeWebsiteRequest {\n static fromProto(proto) {\n let m = new ScrapeWebsiteRequest();\n m = Object.assign(m, proto);\n if (proto.namespace) {\n m.namespace = Namespace.fromProto(proto.namespace);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSourceId !== 'undefined') {\n toReturn['knowledgeSourceId'] = this.knowledgeSourceId;\n }\n if (typeof this.namespace !== 'undefined' && this.namespace !== null) {\n toReturn['namespace'] = 'toApiJson' in this.namespace ? this.namespace.toApiJson() : this.namespace;\n }\n return toReturn;\n }\n}\nclass ScrapeWebsiteResponse {\n static fromProto(proto) {\n let m = new ScrapeWebsiteResponse();\n m = Object.assign(m, proto);\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n return toReturn;\n }\n}\nclass UpdateEmbeddingRequest {\n static fromProto(proto) {\n let m = new UpdateEmbeddingRequest();\n m = Object.assign(m, proto);\n if (proto.embedding) {\n m.embedding = Embedding.fromProto(proto.embedding);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.embedding !== 'undefined' && this.embedding !== null) {\n toReturn['embedding'] = 'toApiJson' in this.embedding ? this.embedding.toApiJson() : this.embedding;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass UpdateKnowledgeBaseRequest {\n static fromProto(proto) {\n let m = new UpdateKnowledgeBaseRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeBase) {\n m.knowledgeBase = KnowledgeBase.fromProto(proto.knowledgeBase);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeBase !== 'undefined' && this.knowledgeBase !== null) {\n toReturn['knowledgeBase'] = 'toApiJson' in this.knowledgeBase ? this.knowledgeBase.toApiJson() : this.knowledgeBase;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass UpdateKnowledgeSourceRequest {\n static fromProto(proto) {\n let m = new UpdateKnowledgeSourceRequest();\n m = Object.assign(m, proto);\n if (proto.knowledgeSource) {\n m.knowledgeSource = KnowledgeSource.fromProto(proto.knowledgeSource);\n }\n if (proto.fieldMask) {\n m.fieldMask = FieldMask.fromProto(proto.fieldMask);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.knowledgeSource !== 'undefined' && this.knowledgeSource !== null) {\n toReturn['knowledgeSource'] = 'toApiJson' in this.knowledgeSource ? this.knowledgeSource.toApiJson() : this.knowledgeSource;\n }\n if (typeof this.fieldMask !== 'undefined' && this.fieldMask !== null) {\n toReturn['fieldMask'] = 'toApiJson' in this.fieldMask ? this.fieldMask.toApiJson() : this.fieldMask;\n }\n return toReturn;\n }\n}\nclass UpsertAppRequest {\n static fromProto(proto) {\n let m = new UpsertAppRequest();\n m = Object.assign(m, proto);\n if (proto.app) {\n m.app = App.fromProto(proto.app);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.app !== 'undefined' && this.app !== null) {\n toReturn['app'] = 'toApiJson' in this.app ? this.app.toApiJson() : this.app;\n }\n return toReturn;\n }\n}\nclass UpsertKnowledgeForAppRequest {\n static fromProto(proto) {\n let m = new UpsertKnowledgeForAppRequest();\n m = Object.assign(m, proto);\n if (proto.app) {\n m.app = App.fromProto(proto.app);\n }\n if (proto.configs) {\n m.configs = proto.configs.map(KnowledgeSourceConfig.fromProto);\n }\n if (proto.knowledgeSourceKeys) {\n m.knowledgeSourceKeys = proto.knowledgeSourceKeys.map(KnowledgeSourceKey.fromProto);\n }\n return m;\n }\n constructor(kwargs) {\n if (!kwargs) {\n return;\n }\n Object.assign(this, kwargs);\n }\n toApiJson() {\n const toReturn = {};\n if (typeof this.app !== 'undefined' && this.app !== null) {\n toReturn['app'] = 'toApiJson' in this.app ? this.app.toApiJson() : this.app;\n }\n if (typeof this.configs !== 'undefined' && this.configs !== null) {\n toReturn['configs'] = 'toApiJson' in this.configs ? this.configs.toApiJson() : this.configs;\n }\n if (typeof this.knowledgeSourceKeys !== 'undefined' && this.knowledgeSourceKeys !== null) {\n toReturn['knowledgeSourceKeys'] = 'toApiJson' in this.knowledgeSourceKeys ? this.knowledgeSourceKeys.toApiJson() : this.knowledgeSourceKeys;\n }\n return toReturn;\n }\n}\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Objects Index.\n// *********************************\n\nconst environment = (window ? window['environment'] : 'prod') ?? 'prod';\nconst hostMap = {\n 'local': 'embeddings-api.vendasta-local.com',\n 'test': '',\n 'demo': 'embeddings-demo.apigateway.co',\n 'prod': 'embeddings-prod.apigateway.co',\n 'production': 'embeddings-prod.apigateway.co'\n};\nlet HostService = /*#__PURE__*/(() => {\n class HostService {\n get host() {\n return hostMap[environment.toLowerCase()];\n }\n get hostWithScheme() {\n return 'https://' + this.host;\n }\n }\n HostService.ɵfac = function HostService_Factory(t) {\n return new (t || HostService)();\n };\n HostService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HostService,\n factory: HostService.ɵfac,\n providedIn: 'root'\n });\n return HostService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet EmbeddingApiService = /*#__PURE__*/(() => {\n class EmbeddingApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createEmbedding(r) {\n const request = r.toApiJson ? r : new CreateEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/CreateEmbedding\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateEmbeddingResponse.fromProto(resp)));\n }\n getEmbedding(r) {\n const request = r.toApiJson ? r : new GetEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/GetEmbedding\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetEmbeddingResponse.fromProto(resp)));\n }\n updateEmbedding(r) {\n const request = r.toApiJson ? r : new UpdateEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/UpdateEmbedding\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteEmbedding(r) {\n const request = r.toApiJson ? r : new DeleteEmbeddingRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/DeleteEmbedding\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listEmbeddings(r) {\n const request = r.toApiJson ? r : new ListEmbeddingsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/ListEmbeddings\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListEmbeddingsResponse.fromProto(resp)));\n }\n findSimilarEmbeddings(r) {\n const request = r.toApiJson ? r : new FindSimilarEmbeddingsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.EmbeddingService/FindSimilarEmbeddings\", request.toApiJson(), this.apiOptions()).pipe(map(resp => FindSimilarEmbeddingsResponse.fromProto(resp)));\n }\n }\n EmbeddingApiService.ɵfac = function EmbeddingApiService_Factory(t) {\n return new (t || EmbeddingApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n EmbeddingApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: EmbeddingApiService,\n factory: EmbeddingApiService.ɵfac,\n providedIn: 'root'\n });\n return EmbeddingApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet EmbeddingService = /*#__PURE__*/(() => {\n class EmbeddingService {\n constructor(api) {\n this.api = api;\n }\n createEmbedding(req) {\n return this.api.createEmbedding(req).pipe(map(resp => resp.id));\n }\n getEmbedding(req) {\n return this.api.getEmbedding(req).pipe(map(resp => resp.embedding));\n }\n updateEmbedding(req) {\n return this.api.updateEmbedding(req).pipe(map(() => true));\n }\n listEmbeddings(req) {\n return this.api.listEmbeddings(req);\n }\n deleteEmbedding(req) {\n return this.api.deleteEmbedding(req).pipe(map(() => true));\n }\n }\n EmbeddingService.ɵfac = function EmbeddingService_Factory(t) {\n return new (t || EmbeddingService)(i0.ɵɵinject(EmbeddingApiService));\n };\n EmbeddingService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: EmbeddingService,\n factory: EmbeddingService.ɵfac,\n providedIn: 'root'\n });\n return EmbeddingService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet AutomatedEmbeddingsApiService = /*#__PURE__*/(() => {\n class AutomatedEmbeddingsApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n scrapeWebsite(r) {\n const request = r.toApiJson ? r : new ScrapeWebsiteRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.AutomatedEmbeddingsService/ScrapeWebsite\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ScrapeWebsiteResponse.fromProto(resp)));\n }\n refreshBusinessProfileEmbeddings(r) {\n const request = r.toApiJson ? r : new RefreshBusinessProfileEmbeddingsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.AutomatedEmbeddingsService/RefreshBusinessProfileEmbeddings\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n refreshAllBusinessProfileEmbeddings() {\n return this.http.post(this._host + \"/embeddings.v1alpha1.AutomatedEmbeddingsService/RefreshAllBusinessProfileEmbeddings\", {}, {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n AutomatedEmbeddingsApiService.ɵfac = function AutomatedEmbeddingsApiService_Factory(t) {\n return new (t || AutomatedEmbeddingsApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n AutomatedEmbeddingsApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: AutomatedEmbeddingsApiService,\n factory: AutomatedEmbeddingsApiService.ɵfac,\n providedIn: 'root'\n });\n return AutomatedEmbeddingsApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// API Service.\n// *********************************\nlet KnowledgeBaseApiService = /*#__PURE__*/(() => {\n class KnowledgeBaseApiService {\n constructor(http, hostService) {\n this.http = http;\n this.hostService = hostService;\n this._host = this.hostService.hostWithScheme;\n }\n apiOptions() {\n return {\n headers: new HttpHeaders({\n 'Content-Type': 'application/json'\n }),\n withCredentials: true\n };\n }\n createKnowledgeBase(r) {\n const request = r.toApiJson ? r : new CreateKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/CreateKnowledgeBase\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateKnowledgeBaseResponse.fromProto(resp)));\n }\n getKnowledgeBase(r) {\n const request = r.toApiJson ? r : new GetKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/GetKnowledgeBase\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetKnowledgeBaseResponse.fromProto(resp)));\n }\n updateKnowledgeBase(r) {\n const request = r.toApiJson ? r : new UpdateKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpdateKnowledgeBase\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteKnowledgeBase(r) {\n const request = r.toApiJson ? r : new DeleteKnowledgeBaseRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/DeleteKnowledgeBase\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listKnowledgeBases(r) {\n const request = r.toApiJson ? r : new ListKnowledgeBasesRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListKnowledgeBases\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListKnowledgeBasesResponse.fromProto(resp)));\n }\n createKnowledgeSource(r) {\n const request = r.toApiJson ? r : new CreateKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/CreateKnowledgeSource\", request.toApiJson(), this.apiOptions()).pipe(map(resp => CreateKnowledgeSourceResponse.fromProto(resp)));\n }\n getKnowledgeSource(r) {\n const request = r.toApiJson ? r : new GetKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/GetKnowledgeSource\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetKnowledgeSourceResponse.fromProto(resp)));\n }\n updateKnowledgeSource(r) {\n const request = r.toApiJson ? r : new UpdateKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpdateKnowledgeSource\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n deleteKnowledgeSource(r) {\n const request = r.toApiJson ? r : new DeleteKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/DeleteKnowledgeSource\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listKnowledgeSources(r) {\n const request = r.toApiJson ? r : new ListKnowledgeSourcesRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListKnowledgeSources\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListKnowledgeSourcesResponse.fromProto(resp)));\n }\n upsertApp(r) {\n const request = r.toApiJson ? r : new UpsertAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpsertApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n getApp(r) {\n const request = r.toApiJson ? r : new GetAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/GetApp\", request.toApiJson(), this.apiOptions()).pipe(map(resp => GetAppResponse.fromProto(resp)));\n }\n deleteApp(r) {\n const request = r.toApiJson ? r : new DeleteAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/DeleteApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n listApps(r) {\n const request = r.toApiJson ? r : new ListAppsRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListApps\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListAppsResponse.fromProto(resp)));\n }\n listAllKnowledgeSourcesForApp(r) {\n const request = r.toApiJson ? r : new ListAllKnowledgeSourcesForAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListAllKnowledgeSourcesForApp\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListAllKnowledgeSourcesForAppResponse.fromProto(resp)));\n }\n listAllAppsForKnowledgeSource(r) {\n const request = r.toApiJson ? r : new ListAllAppsForKnowledgeSourceRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/ListAllAppsForKnowledgeSource\", request.toApiJson(), this.apiOptions()).pipe(map(resp => ListAllAppsForKnowledgeSourceResponse.fromProto(resp)));\n }\n upsertKnowledgeForApp(r) {\n const request = r.toApiJson ? r : new UpsertKnowledgeForAppRequest(r);\n return this.http.post(this._host + \"/embeddings.v1alpha1.KnowledgeBaseService/UpsertKnowledgeForApp\", request.toApiJson(), {\n ...this.apiOptions(),\n observe: 'response'\n });\n }\n }\n KnowledgeBaseApiService.ɵfac = function KnowledgeBaseApiService_Factory(t) {\n return new (t || KnowledgeBaseApiService)(i0.ɵɵinject(i1.HttpClient), i0.ɵɵinject(HostService));\n };\n KnowledgeBaseApiService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: KnowledgeBaseApiService,\n factory: KnowledgeBaseApiService.ɵfac,\n providedIn: 'root'\n });\n return KnowledgeBaseApiService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n// *********************************\n// Code generated by sdkgen\n// DO NOT EDIT!.\n//\n// Index.\n// *********************************\nlet KnowledgeBaseService = /*#__PURE__*/(() => {\n class KnowledgeBaseService {\n constructor(api, automatedServiceApi) {\n this.api = api;\n this.automatedServiceApi = automatedServiceApi;\n }\n getApp(req) {\n return this.api.getApp(req).pipe(map(resp => resp.app));\n }\n updateKnowledgeBase(req) {\n return this.api.updateKnowledgeBase(req).pipe(map(() => true));\n }\n getKnowledgeSource(req) {\n return this.api.getKnowledgeSource(req).pipe(map(resp => resp.knowledgeSource));\n }\n createKnowledgeSource(req) {\n return this.api.createKnowledgeSource(req).pipe(map(resp => resp));\n }\n updateKnowledgeSource(req) {\n return this.api.updateKnowledgeSource(req).pipe(map(() => true));\n }\n deleteKnowledgeSource(req) {\n return this.api.deleteKnowledgeSource(req).pipe(map(() => true));\n }\n listKnowledgeSources(req) {\n return this.api.listKnowledgeSources(req).pipe(map(resp => resp));\n }\n listAllKnowledgeSourcesForApp(req) {\n return this.api.listAllKnowledgeSourcesForApp(req);\n }\n listAllAppsForKnowledgeSource(req) {\n return this.api.listAllAppsForKnowledgeSource(req);\n }\n upsertKnowledgeForApp(req) {\n return this.api.upsertKnowledgeForApp(req).pipe(map(() => true));\n }\n scrapeWebsite(req) {\n return this.automatedServiceApi.scrapeWebsite(req);\n }\n }\n KnowledgeBaseService.ɵfac = function KnowledgeBaseService_Factory(t) {\n return new (t || KnowledgeBaseService)(i0.ɵɵinject(KnowledgeBaseApiService), i0.ɵɵinject(AutomatedEmbeddingsApiService));\n };\n KnowledgeBaseService.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: KnowledgeBaseService,\n factory: KnowledgeBaseService.ɵfac,\n providedIn: 'root'\n });\n return KnowledgeBaseService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { Access, App, CreateEmbeddingRequest, CreateEmbeddingResponse, CreateKnowledgeBaseRequest, CreateKnowledgeBaseResponse, CreateKnowledgeSourceRequest, CreateKnowledgeSourceResponse, DeleteAppRequest, DeleteEmbeddingRequest, DeleteKnowledgeBaseRequest, DeleteKnowledgeSourceRequest, Embedding, EmbeddingCitation, EmbeddingMetadata, EmbeddingRelationship, EmbeddingRelationshipAccountGroup, EmbeddingRelationshipPartner, EmbeddingService, EmbeddingSourceType, EmbeddingVendorModel, FieldMask, FindSimilarEmbeddingsRequest, FindSimilarEmbeddingsRequestFilters, FindSimilarEmbeddingsResponse, FindSimilarEmbeddingsResponseMatch, GetAppRequest, GetAppResponse, GetEmbeddingRequest, GetEmbeddingResponse, GetKnowledgeBaseRequest, GetKnowledgeBaseResponse, GetKnowledgeSourceRequest, GetKnowledgeSourceResponse, KnowledgeBase, KnowledgeBaseKey, KnowledgeBaseService, KnowledgeSource, KnowledgeSourceConfig, KnowledgeSourceConfigBusinessProfileConfig, KnowledgeSourceConfigCustomDataConfig, KnowledgeSourceConfigType, KnowledgeSourceConfigWebsiteScrapeConfig, KnowledgeSourceConfigWebsiteScrapeConfigScrapedPage, KnowledgeSourceKey, ListAllAppsForKnowledgeSourceRequest, ListAllAppsForKnowledgeSourceResponse, ListAllKnowledgeSourcesForAppRequest, ListAllKnowledgeSourcesForAppRequestFilters, ListAllKnowledgeSourcesForAppResponse, ListAppsRequest, ListAppsRequestFilters, ListAppsResponse, ListEmbeddingsRequest, ListEmbeddingsRequestFilters, ListEmbeddingsResponse, ListKnowledgeBasesRequest, ListKnowledgeBasesRequestFilters, ListKnowledgeBasesResponse, ListKnowledgeSourcesRequest, ListKnowledgeSourcesRequestFilters, ListKnowledgeSourcesResponse, Namespace, NamespaceAccountGroupNamespace, NamespacePartnerNamespace, PagedRequestOptions, PagedResponseMetadata, RefreshAccountGroupWebsiteEmbeddingsProgress, RefreshBusinessProfileEmbeddingsRequest, ScrapeWebsiteRequest, ScrapeWebsiteResponse, UpdateEmbeddingRequest, UpdateKnowledgeBaseRequest, UpdateKnowledgeSourceRequest, UpsertAppRequest, UpsertKnowledgeForAppRequest, WebsiteScrapeConfigCrawlMode, WebsiteScrapeConfigProgress };\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { AiKnowledgeConfig, RouteCommand } from './interface/config.interface';\n\nexport const AI_KNOWLEDGE_CONFIG_TOKEN = new InjectionToken(\n '[AiKnowledge]: token for configuration',\n);\n\nexport const ACCOUNT_GROUP_ID_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for accountGroupId',\n);\n\nexport const MARKET_ID_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for marketId',\n);\n\nexport const PARTNER_ID_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for partnerId',\n);\n\nexport const MANAGE_KNOWLEDGE_URL_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for manageKnowledgeUrl',\n);\n\nexport const BUSINESS_PROFILE_URL_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for businessProfileUrl',\n);\n\nexport const SHOW_BUSINESS_PROFILE_SOURCE_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for showBusinessProfileSource',\n);\n\nexport const INBOX_SETTINGS_ROUTE_TOKEN: InjectionToken> = new InjectionToken(\n '[AiKnowledge]: token for inboxSettingsRoute',\n);\n","import { inject, Injectable } from '@angular/core';\nimport {\n App,\n CreateKnowledgeSourceRequestInterface,\n DeleteKnowledgeSourceRequestInterface,\n KnowledgeBaseService,\n KnowledgeSource,\n KnowledgeSourceConfigInterface,\n KnowledgeSourceConfigType,\n ListAllAppsForKnowledgeSourceRequestInterface,\n ListAllKnowledgeSourcesForAppRequestInterface,\n ListKnowledgeSourcesRequestInterface,\n ListKnowledgeSourcesResponse,\n NamespaceInterface,\n PagedRequestOptionsInterface,\n UpdateKnowledgeSourceRequestInterface,\n UpsertKnowledgeForAppRequestInterface,\n} from '@vendasta/embeddings';\nimport { catchError, firstValueFrom, throwError } from 'rxjs';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport {\n ACCOUNT_GROUP_ID_TOKEN,\n BUSINESS_PROFILE_URL_TOKEN,\n INBOX_SETTINGS_ROUTE_TOKEN,\n MANAGE_KNOWLEDGE_URL_TOKEN,\n MARKET_ID_TOKEN,\n PARTNER_ID_TOKEN,\n} from './tokens';\nimport { TranslateService } from '@ngx-translate/core';\nimport { RouteCommand } from './interface/config.interface';\n\n@Injectable()\nexport class AiKnowledgeService {\n private readonly knowledgeBaseService = inject(KnowledgeBaseService);\n private readonly translateService = inject(TranslateService);\n\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n private readonly marketId = toSignal(inject(MARKET_ID_TOKEN));\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n private readonly manageKnowledgeUrl = toSignal(inject(MANAGE_KNOWLEDGE_URL_TOKEN));\n private readonly businessProfileUrl = toSignal(inject(BUSINESS_PROFILE_URL_TOKEN));\n private readonly inboxSettingsRoute = toSignal(inject(INBOX_SETTINGS_ROUTE_TOKEN));\n\n async getKnowledgeSource(\n id: string,\n namespace: NamespaceInterface,\n includeKnowledgeBaseKeys?: boolean,\n ): Promise {\n return await firstValueFrom(\n this.knowledgeBaseService.getKnowledgeSource({\n id: id,\n namespace: namespace,\n includeKnowledgeBaseKeys: includeKnowledgeBaseKeys,\n }),\n );\n }\n\n // TODO paging\n async listKnowledgeSources(\n configTypes?: KnowledgeSourceConfigType[],\n pagingOptions?: PagedRequestOptionsInterface,\n ): Promise {\n const request: ListKnowledgeSourcesRequestInterface = {\n filters: {\n namespace: this.buildNamespaceInterface(),\n configTypes: configTypes,\n },\n pagingOptions: pagingOptions,\n };\n return await firstValueFrom(this.knowledgeBaseService.listKnowledgeSources(request));\n }\n\n async updateKnowledgeSourceNameAndConfig(source: KnowledgeSource): Promise {\n const request: UpdateKnowledgeSourceRequestInterface = {\n knowledgeSource: source,\n fieldMask: {\n paths: ['name', 'config'],\n },\n };\n await firstValueFrom(this.knowledgeBaseService.updateKnowledgeSource(request));\n }\n\n async createKnowledgeSource(name: string, config: KnowledgeSourceConfigInterface): Promise {\n const request: CreateKnowledgeSourceRequestInterface = {\n knowledgeSource: {\n namespace: this.buildNamespaceInterface(),\n name: name,\n config: config,\n },\n };\n const result = await firstValueFrom(this.knowledgeBaseService.createKnowledgeSource(request));\n return result.id;\n }\n\n async deleteKnowledgeSource(id: string): Promise {\n const request: DeleteKnowledgeSourceRequestInterface = {\n id: id,\n namespace: this.buildNamespaceInterface(),\n };\n await firstValueFrom(this.knowledgeBaseService.deleteKnowledgeSource(request));\n }\n\n async listAllAppsForKnowledgeSource(knowledgeSourceId: string): Promise {\n const request: ListAllAppsForKnowledgeSourceRequestInterface = {\n knowledgeSourceId: knowledgeSourceId,\n namespace: this.buildNamespaceInterface(),\n };\n const results = await firstValueFrom(this.knowledgeBaseService.listAllAppsForKnowledgeSource(request));\n return results.apps || [];\n }\n\n async listAllKnowledgeSourcesForApp(\n appId: string,\n configTypes?: KnowledgeSourceConfigType[],\n ): Promise {\n const request: ListAllKnowledgeSourcesForAppRequestInterface = {\n appId: appId,\n namespace: this.buildNamespaceInterface(),\n filters: {\n configTypes: configTypes,\n },\n };\n const results = await firstValueFrom(this.knowledgeBaseService.listAllKnowledgeSourcesForApp(request));\n return results.knowledgeSources || [];\n }\n\n async upsertKnowledgeForApp(\n appId: string,\n name: string,\n configurationUrl: string,\n knowledgeSources?: KnowledgeSource[],\n ): Promise {\n const configs = [];\n const knowledgeSourceKeys = [];\n\n for (const source of knowledgeSources) {\n knowledgeSourceKeys.push({\n knowledgeSourceId: source.id,\n namespace: source.namespace,\n });\n }\n\n const request: UpsertKnowledgeForAppRequestInterface = {\n app: {\n id: appId,\n namespace: this.buildNamespaceInterface(),\n name: name,\n configurationUrl: configurationUrl,\n },\n configs: configs,\n knowledgeSourceKeys: knowledgeSourceKeys,\n };\n await firstValueFrom(\n this.knowledgeBaseService.upsertKnowledgeForApp(request).pipe(catchError((err) => throwError(() => err))),\n );\n }\n\n buildNamespaceInterface(): NamespaceInterface {\n if (this.accountGroupId()) {\n return {\n accountGroupNamespace: {\n accountGroupId: this.accountGroupId(),\n marketId: this.marketId(),\n partnerId: this.partnerId(),\n },\n };\n }\n return {\n partnerNamespace: {\n partnerId: this.partnerId(),\n },\n };\n }\n\n buildManageKnowledgeUrl(): string {\n return this.manageKnowledgeUrl();\n }\n\n buildEditKnowledgeUrl(sourceId: string): string {\n return this.buildManageKnowledgeUrl() + `?editSource=${sourceId}`;\n }\n\n buildAddKnowledgeUrl(): string {\n return this.buildManageKnowledgeUrl() + `?addSource=true`;\n }\n\n buildBusinessProfileUrl(): string {\n return this.businessProfileUrl();\n }\n\n buildInboxSettingsRoute(): RouteCommand[] {\n return this.inboxSettingsRoute();\n }\n\n buildBusinessProfileKnowledgeSourceId(): string {\n if (this.accountGroupId()) {\n return `KS-business-profile-${this.accountGroupId()}`;\n }\n return '';\n }\n\n buildBusinessProfileKnowledgeSource(): KnowledgeSource | null {\n if (this.accountGroupId()) {\n return {\n id: this.buildBusinessProfileKnowledgeSourceId(),\n namespace: this.buildNamespaceInterface(),\n name: 'Business Profile', // untranslated because that is how the name is in the backend\n config: {\n businessProfileConfig: {\n accountGroupId: this.accountGroupId(),\n },\n },\n } as KnowledgeSource;\n }\n return null;\n }\n\n getKnowledgePreview(source: KnowledgeSource): string {\n if (source?.config?.businessProfileConfig?.accountGroupId) {\n return this.translateService.instant('INBOX.WEBCHAT.SETTINGS.BUSINESS_PROFILE.DESCRIPTION');\n }\n if (source?.config?.customDataConfig) {\n return source?.config?.customDataConfig?.text;\n }\n if (source?.config?.websiteScrapeConfig) {\n return source?.config?.websiteScrapeConfig?.url;\n }\n\n return '';\n }\n}\n","{\n \"COMMON\": {\n \"SAVE\": \"Save\",\n \"SAVE_AND_CONTINUE\": \"Save and continue\",\n \"NEXT\": \"Next\",\n \"BACK\": \"Back\",\n \"EDIT\": \"Edit\",\n \"CANCEL\": \"Cancel\",\n \"CLOSE\": \"Close\",\n \"DELETE\": \"Delete\",\n \"INVALID_FORM\": \"Form is invalid\",\n \"ERROR_OCCURRED\": \"An error occurred\",\n \"YES\": \"Yes\",\n \"NO\": \"No\"\n },\n \"AI_KNOWLEDGE_BASE\": \"AI knowledge base\",\n \"MANAGE_KNOWLEDGE\": \"Manage knowledge\",\n \"MANAGE_KNOWLEDGE_DESCRIPTION\": \"Provide information AI can use when creating content or answering inqueries\",\n \"REFRESH_OPTIONS\": \"Refresh options\",\n \"CHOOSE_KNOWLEDGE_SOURCES\": \"Choose the knowledge sources that the AI assistant will reference when responding to inquiries\",\n \"KNOWLEDGE_SOURCES\": \"Knowledge sources\",\n \"ADD_KNOWLEDGE\": \"Add knowledge\",\n \"SELECT_KNOWLEDGE\": \"Select knowledge\",\n \"APPLICATION_SETTINGS\": \"Settings\",\n \"APPS_WARNING\": \"This knowledge is currently being used by the following:\",\n \"NO_APPS\": \"This knowledge is not currently being used.\",\n \"NO_MATCHING_KNOWLEDGE_SOURCES\": \"No knowledge available\",\n \"EDIT_KNOWLEDGE\": {\n \"TITLE\": \"Edit knowledge\",\n \"NAME\": \"Name\",\n \"CUSTOM_DATA_CONFIG\": {\n \"TITLE\": \"Custom data\",\n \"DESCRIPTION\": \"Text content related to your business such as FAQs or information snippets\",\n \"CONTENT\": \"Content\",\n \"CONTENT_HINT\": \"Enter any text content related to your business such as FAQs, so AI can accurately answer questions and create content about your business.\"\n },\n \"WEBSITE_SCRAPE_CONFIG\": {\n \"TITLE\": \"Website scrape\",\n \"DESCRIPTION\": \"Scrape content from a website\",\n \"URL\": \"URL\",\n \"INVALID_URL\": \"Please enter a valid URL\",\n \"CRAWL_MODE\": \"Mode\",\n \"SINGLE_PAGE\": \"Single page\",\n \"FOLLOW_LINKS\": \"Follow links\",\n \"FOLLOW_LINKS_HINT\": \"Will find up to {{pageLimit}} pages by following links from this domain starting on the provided URL\",\n \"PAGES\": \"Pages\",\n \"NUMBER_OF_PAGES_TRAINED\": \"Trained on {{trainedPagesCount}} of {{scrapedPagesCount}} scraped pages\",\n \"SELECT_PAGES_TO_TRAIN\": \"Choose which pages to train on\",\n \"SELECT_ALL\": \"Select all ({{scrapedPagesCount}} pages)\",\n \"SCRAPE_QUEUED\": \"Scrape is queued\",\n \"SCRAPE_IN_PROGRESS\": \"Scrape in progress\",\n \"SCRAPE_IN_PROGRESS_CLARIFICATION\": \"Pages to train on will appear here once scraping has completed\",\n \"PAGE_TITLE\": \"Page title\"\n },\n \"REQUIRED_FIELD\": \"Required\"\n },\n \"DELETE_KNOWLEDGE\": {\n \"TITLE\": \"Delete custom knowledge?\"\n },\n \"BUSINESS_PROFILE\": {\n \"BUSINESS_PROFILE\": \"Business Profile\",\n \"ALLOW_ACCESS\": \"Allow access to your business profile\",\n \"DESCRIPTION\": \"Answer questions about your business contact information, hours, products and services you offer.\",\n \"MANAGE_BUSINESS_PROFILE\": \"Manage business profile\",\n \"LEARN_MORE\": {\n \"TITLE\": \"Learn more\",\n \"WHAT_INFORMATION_QUESTION\": \"What information is made available to your AI assistant?\",\n \"WHAT_INFORMATION\": \"These fields are shared from your business profile:\",\n \"BUSINESS_NAME\": \"Business name\",\n \"ADDRESS_SERVICE_AREAS\": \"Address and/or service areas\",\n \"WEBSITE\": \"Website\",\n \"PHONE_NUMBER\": \"Phone number\",\n \"CATEGORIES\": \"Categories\",\n \"HOURS\": \"Hours\",\n \"SERVICES_OFFERED\": \"Services offered\",\n \"SHORT_DESCRIPTION\": \"Short description\",\n \"LONG_DESCRIPTION\": \"Long description\",\n \"SOCIAL_MEDIA_URLS\": \"Social media URLs\",\n \"BOOKING_URL\": \"Booking URL\"\n }\n },\n \"INBOX_SETTINGS\": {\n \"PROMPT\": \"Add knowledge to your Web Chat widget\",\n \"DESCRIPTION\": \"This knowledge and others can be added to your Web Chat widget via the Inbox settings page\",\n \"GO_TO\": \"Go to Inbox settings\"\n },\n \"UNSAVED_CHANGES\": {\n \"TITLE\": \"Any unsaved changes will be lost\",\n \"MESSAGE\": \"Do you wish to proceed?\"\n }\n}\n","import { NgModule } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { LexiconModule } from '@galaxy/lexicon';\nimport En from './en_devel.json';\n\n@NgModule({\n imports: [\n TranslateModule,\n LexiconModule.forChild({\n componentName: 'common/ai-knowledge',\n baseTranslation: En,\n }),\n ],\n})\nexport class AiKnowledgeI18nModule {}\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, Input, OnInit, signal } from '@angular/core';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { App } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { RouteCommand } from '../interface/config.interface';\nimport { MatIconModule } from '@angular/material/icon';\nimport { RouterModule } from '@angular/router';\nimport { MatListModule } from '@angular/material/list';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\n\n@Component({\n selector: 'ai-knowledge-apps-for-knowledge-source',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatButtonModule,\n MatIconModule,\n RouterModule,\n MatListModule,\n GalaxyLoadingSpinnerModule,\n GalaxyEmptyStateModule,\n ],\n templateUrl: './apps-for-knowledge-source.component.html',\n styleUrls: ['./apps-for-knowledge-source.component.scss'],\n})\nexport class AppsForKnowledgeSourceComponent implements OnInit {\n @Input() knowledgeSourceId: string;\n @Input() showInboxSettingsLink: boolean;\n\n readonly apps = signal([]);\n private readonly knowledgeService = inject(AiKnowledgeService);\n readonly isLoading = signal(true);\n\n async ngOnInit(): Promise {\n this.apps.set(await this.knowledgeService.listAllAppsForKnowledgeSource(this.knowledgeSourceId));\n this.isLoading.set(false);\n }\n\n inboxSettingsRoute(): RouteCommand[] {\n return this.knowledgeService.buildInboxSettingsRoute();\n }\n}\n","\n \n \n \n {{ 'NO_APPS' | translate }}\n \n \n {{ 'INBOX_SETTINGS.PROMPT' | translate }}\n open_in_new\n \n \n \n\n \n {{ 'APPS_WARNING' | translate }}\n \n \n {{ app.name }}\n {{ 'APPLICATION_SETTINGS' | translate }}\n \n \n \n\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, Inject } from '@angular/core';\nimport { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MatIconModule } from '@angular/material/icon';\nimport { RouterModule } from '@angular/router';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { AppsForKnowledgeSourceComponent } from '../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\n\nexport interface Data {\n businessProfileUrl?: string;\n readOnly?: boolean;\n}\n\n@Component({\n selector: 'ai-knowledge-learn-more-business-profile',\n standalone: true,\n imports: [\n CommonModule,\n MatDialogModule,\n MatButtonModule,\n MatIconModule,\n RouterModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n AppsForKnowledgeSourceComponent,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './learn-more-business-profile.component.html',\n styleUrls: ['./learn-more-business-profile.component.scss'],\n})\nexport class LearnMoreBusinessProfileComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n\n constructor(@Inject(MAT_DIALOG_DATA) public data: Data) {}\n\n businessProfileUrl(): string {\n return this.knowledgeService.buildBusinessProfileUrl();\n }\n\n knowledgeSourceId(): string {\n return this.knowledgeService.buildBusinessProfileKnowledgeSourceId();\n }\n}\n","

{{ 'BUSINESS_PROFILE.LEARN_MORE.TITLE' | translate }}

\n\n

\n {{ 'BUSINESS_PROFILE.LEARN_MORE.WHAT_INFORMATION_QUESTION' | translate }}\n

\n
\n {{ 'BUSINESS_PROFILE.LEARN_MORE.WHAT_INFORMATION' | translate }}\n
    \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.BUSINESS_NAME' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.ADDRESS_SERVICE_AREAS' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.WEBSITE' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.PHONE_NUMBER' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.CATEGORIES' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.HOURS' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.SERVICES_OFFERED' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.SHORT_DESCRIPTION' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.LONG_DESCRIPTION' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.SOCIAL_MEDIA_URLS' | translate }}
  • \n
  • {{ 'BUSINESS_PROFILE.LEARN_MORE.BOOKING_URL' | translate }}
  • \n
\n
\n\n
\n \n
\n
\n\n \n \n {{ 'BUSINESS_PROFILE.MANAGE_BUSINESS_PROFILE' | translate }}\n open_in_new\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, inject, Input, Output } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { KnowledgeSource } from '@vendasta/embeddings';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatListModule } from '@angular/material/list';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\n\n@Component({\n selector: 'ai-knowledge-knowledge-list',\n standalone: true,\n imports: [CommonModule, TranslateModule, AiKnowledgeI18nModule, MatIconModule, MatListModule],\n templateUrl: './knowledge-list.component.html',\n styleUrls: ['./knowledge-list.component.scss'],\n})\nexport class KnowledgeListComponent {\n @Input()\n get knowledgeSources(): KnowledgeSource[] {\n return this._knowledgeSources;\n }\n set knowledgeSources(sources: KnowledgeSource[]) {\n this._knowledgeSources = (sources || []).sort((a, b) => {\n if (a?.config?.businessProfileConfig?.accountGroupId) {\n return -1;\n }\n if (b?.config?.businessProfileConfig?.accountGroupId) {\n return 1;\n }\n return a?.name?.localeCompare(b?.name) || 0;\n });\n }\n _knowledgeSources: KnowledgeSource[];\n\n @Input() allowRemoveBusinessProfile: boolean;\n @Output() titleClicked = new EventEmitter();\n @Output() removeClicked = new EventEmitter();\n\n private readonly knowledgeService = inject(AiKnowledgeService);\n\n getKnowledgePreview(source: KnowledgeSource): string {\n return this.knowledgeService.getKnowledgePreview(source);\n }\n\n clickTitle(source: KnowledgeSource): void {\n this.titleClicked.emit(source);\n }\n\n clickRemove(source: KnowledgeSource): void {\n this.removeClicked.emit(source);\n }\n\n canRemoveSource(source: KnowledgeSource): boolean {\n if (source?.config?.businessProfileConfig?.accountGroupId) {\n return this.allowRemoveBusinessProfile;\n }\n return true;\n }\n}\n","\n \n \n {{ source.name }}\n {{ getKnowledgePreview(source) }}\n
\n
\n close\n
\n
\n
\n \n
\n
\n","import { ChangeDetectorRef, Directive, inject, Type } from '@angular/core';\nimport { KnowledgeSource } from '@vendasta/embeddings';\n\n@Directive()\nexport abstract class CommonKnowledgeSourceEditorComponent {\n knowledgeSource: KnowledgeSource;\n readOnly: boolean;\n disableSubmit = false;\n cdr = inject(ChangeDetectorRef);\n\n // init is run after the component is created and data is set\n init(): void {\n return;\n }\n\n // submit will be called when the submit action in the editor is clicked\n // should return the knowledge source id if it is created or update\n // a falsy return value will not close the dialog or move to the next step\n async submit(): Promise {\n return;\n }\n\n // if nextStep is provided, the submit action will be changed from Save to Next, and the given component will be rendered\n // Note: the submit function will still be called before rendering the next step\n nextStep(): Type {\n return;\n }\n\n // if previousStep is provided, a Back button will be included in the actions that will render the given component\n previousStep(): Type {\n return;\n }\n\n // getEditOption is used to build a query param that will link to this component's step, if it is not the first step\n getEditOption(): string {\n return;\n }\n\n // if true, a warning will be shown when cancelling or going to a previous step\n hasUnsavedChanges(): boolean {\n return false;\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, inject } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { KnowledgeSourceConfig, KnowledgeSourceConfigCustomDataConfig } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../../ai-knowledge.service';\nimport { AppsForKnowledgeSourceComponent } from '../../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { RouterModule } from '@angular/router';\nimport { MatIconModule } from '@angular/material/icon';\nimport { AiKnowledgeI18nModule } from '../../assets/i18n/ai-knowledge-i18n.module';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatSelectModule } from '@angular/material/select';\nimport { MatOptionModule } from '@angular/material/core';\nimport { MatExpansionModule } from '@angular/material/expansion';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { CommonKnowledgeSourceEditorComponent } from '../common/common-knowledge-source-editor.component';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { MatInputModule } from '@angular/material/input';\n\n@Component({\n selector: 'ai-knowledge-custom-data',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatButtonModule,\n MatDialogModule,\n MatIconModule,\n MatTabsModule,\n MatSelectModule,\n MatOptionModule,\n MatExpansionModule,\n MatCheckboxModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxyLoadingSpinnerModule,\n RouterModule,\n AppsForKnowledgeSourceComponent,\n GalaxySnackbarModule,\n MatInputModule,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './custom-data.component.html',\n styleUrls: ['./custom-data.component.scss'],\n})\nexport class CustomDataComponent extends CommonKnowledgeSourceEditorComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n customDataConfig: KnowledgeSourceConfigCustomDataConfig;\n form: FormGroup | undefined;\n private readonly snackbarService = inject(SnackbarService);\n\n init(): void {\n this.customDataConfig = this.knowledgeSource?.config?.customDataConfig;\n this.form = new FormGroup({\n name: new FormControl(this.knowledgeSource?.name || '', [Validators.required]),\n content: new FormControl(this.customDataConfig?.text || '', [Validators.required]),\n });\n }\n\n async submit(): Promise {\n if (!this.isFormValid()) {\n this.snackbarService.openErrorSnack('COMMON.INVALID_FORM');\n return;\n }\n const name = this.form.get('name').value;\n const config = {\n customDataConfig: {\n text: this.form.get('content')?.value,\n },\n } as KnowledgeSourceConfig;\n if (this.knowledgeSource) {\n const source = this.knowledgeSource;\n source.name = name;\n source.config = config;\n await this.knowledgeService.updateKnowledgeSourceNameAndConfig(source);\n return source.id;\n } else {\n return await this.knowledgeService.createKnowledgeSource(name, config);\n }\n }\n\n private isFormValid(): boolean {\n const controls = [this.form.get('name'), this.form.get('content')];\n let valid = true;\n controls.forEach((c) => {\n c?.markAsDirty();\n if (!c?.valid) {\n valid = false;\n }\n });\n return valid;\n }\n\n hasUnsavedChanges(): boolean {\n return this.form.dirty;\n }\n}\n","\n {{ customDataConfig?.text }}\n\n\n\n \n \n {{ 'EDIT_KNOWLEDGE.NAME' | translate }}\n \n \n {{ 'EDIT_KNOWLEDGE.REQUIRED_FIELD' | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.CONTENT' | translate }}\n {{\n 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.CONTENT_HINT' | translate\n }}\n \n \n {{ 'EDIT_KNOWLEDGE.REQUIRED_FIELD' | translate }}\n \n \n \n\n","import { Component, DestroyRef, inject, signal, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { FormArray, FormControl, FormGroup, FormsModule, ReactiveFormsModule, UntypedFormArray } from '@angular/forms';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { AppsForKnowledgeSourceComponent } from '../../../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { AiKnowledgeService } from '../../../ai-knowledge.service';\nimport {\n KnowledgeSource,\n KnowledgeSourceConfig,\n KnowledgeSourceConfigWebsiteScrapeConfig,\n WebsiteScrapeConfigProgress,\n} from '@vendasta/embeddings';\nimport { CommonKnowledgeSourceEditorComponent } from '../../common/common-knowledge-source-editor.component';\nimport { GalaxyEmptyStateModule } from '@vendasta/galaxy/empty-state';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { defer, from, map, retry, take } from 'rxjs';\nimport { AiKnowledgeI18nModule } from '../../../assets/i18n/ai-knowledge-i18n.module';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { WebsiteScrapeComponent } from '../website-scrape.component';\n\nexport const EDIT_OPTION = 'scrapedPages';\n\n@Component({\n selector: 'ai-knowledge-scraped-pages',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatCheckboxModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxyEmptyStateModule,\n GalaxyLoadingSpinnerModule,\n AppsForKnowledgeSourceComponent,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './scraped-pages.component.html',\n styleUrls: ['./scraped-pages.component.scss'],\n})\nexport class ScrapedPagesComponent extends CommonKnowledgeSourceEditorComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n private readonly snackbarService = inject(SnackbarService);\n private destroyRef = inject(DestroyRef);\n websiteScrapeConfig: KnowledgeSourceConfigWebsiteScrapeConfig;\n scrapeProgressStates = WebsiteScrapeConfigProgress;\n form: FormGroup | undefined;\n readonly isLoading = signal(false);\n disabled = true;\n\n init(): void {\n this.disableSubmit = true;\n this.websiteScrapeConfig = this.knowledgeSource?.config?.websiteScrapeConfig;\n this.form = new FormGroup({\n scrapedPages: new FormArray([]),\n });\n\n if (this.knowledgeSource) {\n this.isLoading.set(true);\n defer(() =>\n from(this.knowledgeService.getKnowledgeSource(this.knowledgeSource?.id, this.knowledgeSource?.namespace)),\n )\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((ks) => {\n this.updateKnowledgeSource(ks);\n this.isLoading.set(false);\n if (\n this.websiteScrapeConfig?.scrapeProgress !==\n WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\n ) {\n // throw error to poll again\n throw false;\n }\n this.disableSubmit = false;\n }),\n retry({ delay: 5000 }),\n take(1),\n )\n .subscribe();\n }\n }\n\n updateKnowledgeSource(ks: KnowledgeSource): void {\n this.knowledgeSource = ks;\n this.websiteScrapeConfig = this.knowledgeSource?.config?.websiteScrapeConfig;\n if (this.websiteScrapeConfig.scrapeProgress === WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE) {\n this.websiteScrapeConfig.scrapedPages.sort((a, b) =>\n a?.trainingEnabled === b?.trainingEnabled ? a?.url?.localeCompare(b?.url) : a?.trainingEnabled ? -1 : 1,\n );\n this.form.controls.scrapedPages = new FormArray(\n this.websiteScrapeConfig.scrapedPages.map((page) => new FormControl(page.trainingEnabled)),\n );\n this.form.controls.scrapedPages.valueChanges\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map(() => this.form.markAsDirty()),\n )\n .subscribe();\n }\n }\n\n get scrapedPagesArray(): UntypedFormArray {\n return this.form.controls['scrapedPages'] as UntypedFormArray;\n }\n\n selectAll(): void {\n this.form.controls.scrapedPages = new FormArray(\n this.websiteScrapeConfig.scrapedPages.map(() => new FormControl(true)),\n );\n }\n\n getScrapedPagesCount(): number {\n return this.websiteScrapeConfig?.scrapedPages?.length || 0;\n }\n\n async submit(): Promise {\n this.scrapedPagesArray.controls.forEach((pageControl, index) => {\n this.websiteScrapeConfig.scrapedPages[index].trainingEnabled = pageControl.value;\n });\n const config = {\n websiteScrapeConfig: this.websiteScrapeConfig,\n } as KnowledgeSourceConfig;\n if (this.knowledgeSource) {\n const source = this.knowledgeSource;\n source.config = config;\n await this.knowledgeService.updateKnowledgeSourceNameAndConfig(source);\n return source.id;\n }\n this.snackbarService.openErrorSnack('COMMON.ERROR_OCCURRED');\n return;\n }\n\n getScrapeProgressTitle(): string {\n if (\n this.websiteScrapeConfig?.scrapeProgress === WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\n ) {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_QUEUED';\n }\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_IN_PROGRESS';\n }\n\n previousStep(): Type {\n return WebsiteScrapeComponent;\n }\n\n hasUnsavedChanges(): boolean {\n return this.form.dirty;\n }\n\n getEditOption(): string {\n return EDIT_OPTION;\n }\n}\n","\n \n \n \n \n \n {{ getScrapeProgressTitle() | translate }}\n \n

{{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_IN_PROGRESS_CLARIFICATION' | translate }}

\n \n\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SELECT_PAGES_TO_TRAIN' | translate }}\n

1\">\n {{\n 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SELECT_ALL' | translate: { scrapedPagesCount: getScrapedPagesCount() }\n }}\n

\n \n \n {{ websiteScrapeConfig?.scrapedPages[i]?.title }}\n {{ websiteScrapeConfig?.scrapedPages[i]?.url }}\n {{\n websiteScrapeConfig?.scrapedPages[i]?.errorMessage\n }}\n \n \n
\n
\n
\n
\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, DestroyRef, inject, Type } from '@angular/core';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { urlValidator } from '@vendasta/forms';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport {\n KnowledgeSourceConfig,\n KnowledgeSourceConfigWebsiteScrapeConfig,\n WebsiteScrapeConfigCrawlMode,\n WebsiteScrapeConfigProgress,\n} from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../../ai-knowledge.service';\nimport { MatIconModule } from '@angular/material/icon';\nimport { AiKnowledgeI18nModule } from '../../assets/i18n/ai-knowledge-i18n.module';\nimport { MatSelectModule } from '@angular/material/select';\nimport { MatOptionModule } from '@angular/material/core';\nimport { ScrapedPagesComponent } from './scraped-pages/scraped-pages.component';\nimport { CommonKnowledgeSourceEditorComponent } from '../common/common-knowledge-source-editor.component';\nimport { GalaxySnackbarModule, SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { MatInputModule } from '@angular/material/input';\nimport { defer, from, map, retry, take } from 'rxjs';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Environment, EnvironmentService } from '@galaxy/core';\n\n@Component({\n selector: 'ai-knowledge-website-scrape',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatIconModule,\n MatSelectModule,\n MatOptionModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxySnackbarModule,\n MatInputModule,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './website-scrape.component.html',\n styleUrls: ['./website-scrape.component.scss'],\n})\nexport class WebsiteScrapeComponent extends CommonKnowledgeSourceEditorComponent {\n private readonly knowledgeService = inject(AiKnowledgeService);\n private readonly snackbarService = inject(SnackbarService);\n private destroyRef = inject(DestroyRef);\n private environmentService = inject(EnvironmentService);\n websiteScrapeConfig: KnowledgeSourceConfigWebsiteScrapeConfig;\n form: FormGroup | undefined;\n crawlModes = WebsiteScrapeConfigCrawlMode;\n scrapeProgressStates = WebsiteScrapeConfigProgress;\n\n init(): void {\n this.websiteScrapeConfig = this.knowledgeSource?.config?.websiteScrapeConfig;\n this.form = new FormGroup({\n name: new FormControl(this.knowledgeSource?.name || '', [Validators.required]),\n url: new FormControl(this.websiteScrapeConfig?.url || '', [urlValidator, Validators.required]),\n crawlMode: new FormControl(\n this.websiteScrapeConfig?.crawlMode || WebsiteScrapeConfigCrawlMode.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE,\n ),\n });\n if (this.knowledgeSource) {\n defer(() =>\n from(this.knowledgeService.getKnowledgeSource(this.knowledgeSource?.id, this.knowledgeSource?.namespace)),\n )\n .pipe(\n takeUntilDestroyed(this.destroyRef),\n map((ks) => {\n this.websiteScrapeConfig = ks?.config?.websiteScrapeConfig;\n if (\n this.websiteScrapeConfig?.scrapeProgress !==\n WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_DONE\n ) {\n // throw error to poll again\n throw false;\n }\n }),\n retry({ delay: 5000 }),\n take(1),\n )\n .subscribe();\n }\n }\n\n getCrawlModeTranslationKey(crawlMode: WebsiteScrapeConfigCrawlMode): string {\n switch (crawlMode) {\n case WebsiteScrapeConfigCrawlMode.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE: {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SINGLE_PAGE';\n }\n case WebsiteScrapeConfigCrawlMode.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE: {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.FOLLOW_LINKS';\n }\n default: {\n return '';\n }\n }\n }\n\n getScrapeProgressTitle(): string {\n if (\n this.websiteScrapeConfig?.scrapeProgress === WebsiteScrapeConfigProgress.WEBSITE_SCRAPE_CONFIG_PROGRESS_QUEUED\n ) {\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_QUEUED';\n }\n return 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.SCRAPE_IN_PROGRESS';\n }\n\n getScrapedPagesCount(): number {\n return this.websiteScrapeConfig?.scrapedPages?.length || 0;\n }\n\n getTrainedPagesCount(): number {\n return this.websiteScrapeConfig?.scrapedPages?.filter((p) => p.trainingEnabled)?.length || 0;\n }\n\n getPageLimit(): number {\n switch (this.environmentService.getEnvironment()) {\n case Environment.LOCAL:\n case Environment.DEMO:\n return 10;\n case Environment.PROD:\n return 100;\n default:\n return 0;\n }\n }\n\n isFormValid(): boolean {\n const controls = [this.form.get('name'), this.form.get('url')];\n let valid = true;\n controls.forEach((c) => {\n c?.markAsDirty();\n if (!c?.valid) {\n valid = false;\n }\n });\n return valid;\n }\n\n async submit(): Promise {\n if (!this.isFormValid()) {\n this.snackbarService.openErrorSnack('COMMON.INVALID_FORM');\n return;\n }\n const name = this.form.get('name').value;\n const url = this.form.get('url')?.value;\n const config = {\n websiteScrapeConfig: {\n url: url,\n crawlMode: this.form.get('crawlMode')?.value,\n scrapedPages: this.websiteScrapeConfig?.scrapedPages,\n },\n } as KnowledgeSourceConfig;\n if (this.knowledgeSource) {\n const source = this.knowledgeSource;\n source.name = name;\n source.config = config;\n await this.knowledgeService.updateKnowledgeSourceNameAndConfig(source);\n return source.id;\n } else {\n return await this.knowledgeService.createKnowledgeSource(name, config);\n }\n }\n\n nextStep(): Type {\n return ScrapedPagesComponent;\n }\n\n hasUnsavedChanges(): boolean {\n return this.form.dirty;\n }\n}\n","\n
\n \n
\n {{ getCrawlModeTranslationKey(websiteScrapeConfig?.crawlMode) | translate }}\n
\n
\n \n
\n\n \n \n {{ 'EDIT_KNOWLEDGE.NAME' | translate }}\n \n \n {{ 'EDIT_KNOWLEDGE.REQUIRED_FIELD' | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.URL' | translate }}\n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.INVALID_URL' | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.CRAWL_MODE' | translate }}\n \n \n {{ getCrawlModeTranslationKey(crawlModes.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_SINGLE) | translate }}\n \n \n {{ getCrawlModeTranslationKey(crawlModes.WEBSITE_SCRAPE_CONFIG_CRAWL_MODE_RECURSIVE) | translate }}\n \n \n \n {{ 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.FOLLOW_LINKS_HINT' | translate: { pageLimit: getPageLimit() } }}\n \n \n \n \n\n\n\n
\n \n {{\n 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.NUMBER_OF_PAGES_TRAINED'\n | translate: { trainedPagesCount: getTrainedPagesCount(), scrapedPagesCount: getScrapedPagesCount() }\n }}\n \n \n
{{ getScrapeProgressTitle() | translate }}
\n
\n
\n
\n","import { CommonModule } from '@angular/common';\nimport { Component, EventEmitter, Output } from '@angular/core';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { AiKnowledgeService } from '../../ai-knowledge.service';\nimport { AiKnowledgeI18nModule } from '../../assets/i18n/ai-knowledge-i18n.module';\nimport { MatCardModule } from '@angular/material/card';\nimport { CustomDataComponent } from '../custom-data/custom-data.component';\nimport { WebsiteScrapeComponent } from '../website-scrape/website-scrape.component';\nimport { CommonKnowledgeSourceEditorComponent } from '../common/common-knowledge-source-editor.component';\n\ninterface Choice {\n title: string;\n description: string;\n component: any;\n}\n\n@Component({\n selector: 'ai-knowledge-add-knowledge',\n standalone: true,\n imports: [CommonModule, TranslateModule, AiKnowledgeI18nModule, MatCardModule],\n providers: [AiKnowledgeService],\n templateUrl: './add-knowledge.component.html',\n styleUrls: ['./add-knowledge.component.scss'],\n})\nexport class AddKnowledgeComponent extends CommonKnowledgeSourceEditorComponent {\n @Output() componentSelected = new EventEmitter();\n\n choices: Choice[] = [\n {\n title: 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.TITLE',\n description: 'EDIT_KNOWLEDGE.CUSTOM_DATA_CONFIG.DESCRIPTION',\n component: CustomDataComponent,\n },\n {\n title: 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.TITLE',\n description: 'EDIT_KNOWLEDGE.WEBSITE_SCRAPE_CONFIG.DESCRIPTION',\n component: WebsiteScrapeComponent,\n },\n ];\n\n selectComponent(choice: Choice): void {\n this.componentSelected.emit(choice.component);\n }\n}\n","
\n \n \n \n

{{ choice.title | translate }}

\n

\n {{ choice.description | translate }}\n

\n
\n
\n
\n
\n","import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectorRef,\n Component,\n DestroyRef,\n inject,\n Inject,\n OnInit,\n signal,\n Type,\n ViewChild,\n ViewContainerRef,\n} from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { KnowledgeSource, KnowledgeSourceKey } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { AppsForKnowledgeSourceComponent } from '../apps-for-knowledge-source/apps-for-knowledge-source.component';\nimport { ActivatedRoute, Router, RouterModule } from '@angular/router';\nimport { MatIconModule } from '@angular/material/icon';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\nimport { MatTabsModule } from '@angular/material/tabs';\nimport { MatSelectModule } from '@angular/material/select';\nimport { MatOptionModule } from '@angular/material/core';\nimport { MatExpansionModule } from '@angular/material/expansion';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { AddKnowledgeComponent } from './add-knowledge/add-knowledge.component';\nimport { WebsiteScrapeComponent } from './website-scrape/website-scrape.component';\nimport { CustomDataComponent } from './custom-data/custom-data.component';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { firstValueFrom } from 'rxjs';\nimport { FeatureFlagService } from '@galaxy/partner';\nimport { PARTNER_ID_TOKEN } from '../tokens';\nimport { CommonKnowledgeSourceEditorComponent } from './common/common-knowledge-source-editor.component';\nimport { OpenConfirmationModalService } from '@vendasta/galaxy/confirmation-modal';\nimport {\n EDIT_OPTION as SCRAPED_PAGES_EDIT_OPTION,\n ScrapedPagesComponent,\n} from './website-scrape/scraped-pages/scraped-pages.component';\n\n// feature flag id\nexport const WEBSITE_KNOWLEDGE = 'website_knowledge';\n\ninterface Data {\n knowledgeSourceKey?: KnowledgeSourceKey;\n readOnly?: boolean;\n editOption?: string;\n}\n\n@Component({\n selector: 'ai-knowledge-knowledge-editor-dialog',\n standalone: true,\n imports: [\n CommonModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatButtonModule,\n MatDialogModule,\n MatIconModule,\n MatTabsModule,\n MatSelectModule,\n MatOptionModule,\n MatExpansionModule,\n MatCheckboxModule,\n ReactiveFormsModule,\n FormsModule,\n GalaxyFormFieldModule,\n GalaxyLoadingSpinnerModule,\n RouterModule,\n AppsForKnowledgeSourceComponent,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './knowledge-editor.component.html',\n styleUrls: ['./knowledge-editor.component.scss'],\n})\nexport class KnowledgeEditorComponent implements OnInit {\n @ViewChild('component', { read: ViewContainerRef }) componentViewRef?: ViewContainerRef;\n componentInstance: CommonKnowledgeSourceEditorComponent;\n private readonly knowledgeService = inject(AiKnowledgeService);\n private featureFlagService = inject(FeatureFlagService);\n private cdr = inject(ChangeDetectorRef);\n private confirmationModal = inject(OpenConfirmationModalService);\n private readonly activeRoute = inject(ActivatedRoute);\n router = inject(Router);\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n readonly isLoading = signal(true);\n component: Type;\n knowledgeSource: KnowledgeSource;\n\n constructor(\n private readonly destroyRef: DestroyRef,\n public dialogRef: MatDialogRef,\n @Inject(MAT_DIALOG_DATA) public data: Data,\n ) {}\n\n async ngOnInit(): Promise {\n this.dialogRef.disableClose = true;\n if (this.data?.knowledgeSourceKey) {\n this.knowledgeSource = await this.knowledgeService.getKnowledgeSource(\n this.data.knowledgeSourceKey.knowledgeSourceId,\n this.data.knowledgeSourceKey.namespace,\n );\n }\n await this.setInitialComponent();\n this.isLoading.set(false);\n }\n\n setEditSourceQueryParam(editSource: string | null, option?: string): void {\n if (option) {\n editSource = editSource + ':' + option;\n }\n const queryParams = { editSource: editSource };\n this.router.navigate([], {\n relativeTo: this.activeRoute,\n queryParams,\n queryParamsHandling: 'merge',\n });\n }\n\n async websiteKnowledgeFeatureEnabled(): Promise {\n const results = await firstValueFrom(\n this.featureFlagService.batchGetStatus(this.partnerId(), '', [WEBSITE_KNOWLEDGE]),\n );\n return results[WEBSITE_KNOWLEDGE];\n }\n\n close(): void {\n this.warnUnsavedChanged(() => {\n this.setEditSourceQueryParam(null);\n this.dialogRef.close();\n });\n }\n\n async setInitialComponent(): Promise {\n if (this.knowledgeSource) {\n if (this.knowledgeSource.config?.customDataConfig) {\n this.setComponent(CustomDataComponent);\n } else if (this.knowledgeSource.config?.websiteScrapeConfig) {\n if (this.data?.editOption === SCRAPED_PAGES_EDIT_OPTION) {\n this.setComponent(ScrapedPagesComponent);\n } else {\n this.setComponent(WebsiteScrapeComponent);\n }\n }\n } else if (await this.websiteKnowledgeFeatureEnabled()) {\n this.setComponent(AddKnowledgeComponent);\n } else {\n this.setComponent(CustomDataComponent);\n }\n }\n\n setComponent(c: Type): void {\n this.component = c;\n this.componentViewRef.detach();\n this.componentInstance = this.componentViewRef.createComponent(c).instance;\n this.componentInstance.knowledgeSource = this.knowledgeSource;\n this.componentInstance.readOnly = this.data?.readOnly;\n this.componentInstance.init();\n this.componentInstance.cdr.detectChanges();\n this.setEditSourceQueryParam(\n this.data?.knowledgeSourceKey?.knowledgeSourceId,\n this.componentInstance.getEditOption(),\n );\n if (c === AddKnowledgeComponent) {\n (this.componentInstance as AddKnowledgeComponent).componentSelected\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe((c) => this.setComponent(c));\n }\n }\n\n async submit(): Promise {\n if (this.componentInstance) {\n let result = this.knowledgeSource?.id;\n if (this.componentInstance.hasUnsavedChanges()) {\n result = await this.componentInstance.submit();\n }\n if (result) {\n const nextStep = this.componentInstance.nextStep();\n if (nextStep) {\n this.knowledgeSource = await this.knowledgeService.getKnowledgeSource(\n result,\n this.knowledgeService.buildNamespaceInterface(),\n );\n this.setComponent(nextStep);\n this.cdr.detectChanges();\n return;\n }\n this.setEditSourceQueryParam(null);\n this.dialogRef.close(true);\n }\n }\n }\n\n showBack(): boolean {\n return !!this.componentInstance?.previousStep();\n }\n\n back(): void {\n this.warnUnsavedChanged(() => {\n if (this.componentInstance?.previousStep()) {\n this.setComponent(this.componentInstance.previousStep());\n this.cdr.detectChanges();\n }\n });\n }\n\n warnUnsavedChanged(func: () => void): void {\n if (!this.componentInstance?.hasUnsavedChanges()) {\n func();\n return;\n }\n\n this.confirmationModal\n .openModal({\n title: 'UNSAVED_CHANGES.TITLE',\n message: 'UNSAVED_CHANGES.MESSAGE',\n confirmButtonText: 'COMMON.YES',\n cancelButtonText: 'COMMON.NO',\n })\n .subscribe((confirmed) => {\n if (confirmed) {\n func();\n }\n });\n }\n\n getTitle(): string {\n if (this.data?.readOnly && this.knowledgeSource) {\n return this.knowledgeSource.name;\n }\n if (!this.data?.knowledgeSourceKey) {\n return 'ADD_KNOWLEDGE';\n }\n return 'EDIT_KNOWLEDGE.TITLE';\n }\n\n buildEditUrl(): string {\n return this.knowledgeService.buildEditKnowledgeUrl(this.knowledgeSource?.id || '');\n }\n\n showSubmit(): boolean {\n return this.component !== AddKnowledgeComponent;\n }\n\n submitDisabled(): boolean {\n return this.componentInstance?.disableSubmit;\n }\n\n getSubmitAction(): string {\n if (this.componentInstance && this.componentInstance.nextStep()) {\n return 'COMMON.SAVE_AND_CONTINUE';\n }\n return 'COMMON.SAVE';\n }\n}\n","

{{ getTitle() | translate }}

\n
\n \n \n
\n \n
\n
\n \n
\n \n
\n
\n \n \n \n {{ getSubmitAction() | translate }}\n \n \n
\n
\n
\n\n\n\n\n \n {{ 'COMMON.EDIT' | translate }}\n open_in_new\n \n\n","import {\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n EventEmitter,\n inject,\n Input,\n OnInit,\n Output,\n signal,\n ViewChild,\n} from '@angular/core';\nimport { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatAutocomplete, MatAutocompleteModule, MatAutocompleteTrigger } from '@angular/material/autocomplete';\nimport { KnowledgeSource, KnowledgeSourceConfigType } from '@vendasta/embeddings';\nimport { AiKnowledgeService } from '../ai-knowledge.service';\nimport { CommonModule } from '@angular/common';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatFormFieldModule } from '@angular/material/form-field';\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\nimport { MatChipsModule } from '@angular/material/chips';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { RouterModule } from '@angular/router';\nimport { KnowledgeListComponent } from '../knowledge-list/knowledge-list.component';\nimport { KnowledgeEditorComponent } from '../knowledge-editor/knowledge-editor.component';\nimport { LearnMoreBusinessProfileComponent } from '../learn-more-business-profile/learn-more-business-profile.component';\nimport { MatDialog, MatDialogConfig, MatDialogModule } from '@angular/material/dialog';\nimport { SHOW_BUSINESS_PROFILE_SOURCE_TOKEN } from '../tokens';\nimport { AiKnowledgeI18nModule } from '../assets/i18n/ai-knowledge-i18n.module';\nimport { MatDividerModule } from '@angular/material/divider';\nimport { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';\n\n@Component({\n selector: 'ai-knowledge-application-knowledge',\n standalone: true,\n imports: [\n CommonModule,\n RouterModule,\n TranslateModule,\n AiKnowledgeI18nModule,\n MatIconModule,\n MatButtonModule,\n MatInputModule,\n MatFormFieldModule,\n MatAutocompleteModule,\n FormsModule,\n ReactiveFormsModule,\n MatProgressSpinnerModule,\n MatChipsModule,\n GalaxyLoadingSpinnerModule,\n GalaxyFormFieldModule,\n KnowledgeListComponent,\n MatDialogModule,\n MatDividerModule,\n ],\n providers: [AiKnowledgeService],\n templateUrl: './application-knowledge.component.html',\n styleUrls: ['./application-knowledge.component.scss'],\n})\nexport class ApplicationKnowledgeComponent implements OnInit {\n @Input() appId: string;\n @Input() disabled: boolean;\n\n @Output() selectedSourcesChange = new EventEmitter();\n\n DIALOG_WIDTH = '660px';\n private readonly dialog = inject(MatDialog);\n private readonly bpObserver = inject(BreakpointObserver);\n\n private readonly knowledgeService = inject(AiKnowledgeService);\n private readonly showBusinessProfileSource = toSignal(inject(SHOW_BUSINESS_PROFILE_SOURCE_TOKEN));\n sources = signal([]);\n searchValue = signal('');\n selectedSources = signal(null);\n filteredSources = computed(() =>\n this.sources().filter(\n (source) =>\n source.name.toLowerCase().indexOf(this.searchValue()) >= 0 &&\n !this.selectedSources().some((selected) => selected.id === source.id),\n ),\n );\n readonly isLoading = signal(true);\n\n selectedSourceControl = new FormControl();\n\n @ViewChild('knowledgeSourceInput') knowledgeSourceInput: ElementRef;\n @ViewChild('auto') matAutocomplete: MatAutocomplete;\n @ViewChild('trigger') matAutocompleteTrigger: MatAutocompleteTrigger;\n\n constructor(private readonly destroyRef: DestroyRef) {\n effect(() => this.selectedSourcesChange.emit(this.selectedSources()));\n }\n\n async ngOnInit(): Promise {\n await this.refreshSources();\n\n let initialSources: KnowledgeSource[] = [];\n if (this.appId) {\n initialSources = await this.knowledgeService.listAllKnowledgeSourcesForApp(this.appId);\n } else if (this.showBusinessProfileSource()) {\n const businessProfileSource = this.knowledgeService.buildBusinessProfileKnowledgeSource();\n if (businessProfileSource) {\n initialSources = [businessProfileSource];\n }\n }\n this.selectedSources.set(initialSources);\n this.isLoading.set(false);\n\n this.selectedSourceControl.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((searchValue) => {\n if (typeof searchValue === 'string') {\n this.searchValue.set(searchValue?.toLowerCase());\n }\n });\n }\n\n async refreshSources(): Promise {\n // TODO: actually page and search on value changes\n const sourcesResult = await this.knowledgeService.listKnowledgeSources(\n [\n KnowledgeSourceConfigType.KNOWLEDGE_SOURCE_CONFIG_TYPE_CUSTOM_DATA,\n KnowledgeSourceConfigType.KNOWLEDGE_SOURCE_CONFIG_TYPE_WEBSITE_SCRAPE,\n ],\n { pageSize: 100 },\n );\n const knowledgeSources = sourcesResult.knowledgeSources || [];\n if (this.showBusinessProfileSource()) {\n // manually insert business profile source because it may not exist yet\n const businessProfileSource = this.knowledgeService.buildBusinessProfileKnowledgeSource();\n if (businessProfileSource) {\n knowledgeSources.unshift(businessProfileSource);\n }\n }\n this.sources.set(knowledgeSources);\n this.clearInputFields();\n }\n\n async forceRefreshSources(): Promise {\n this.isLoading.set(true);\n await this.refreshSources();\n this.isLoading.set(false);\n }\n\n async viewSource(source: KnowledgeSource): Promise {\n if (source?.config?.businessProfileConfig?.accountGroupId) {\n this.dialog.open(LearnMoreBusinessProfileComponent, {\n width: this.DIALOG_WIDTH,\n data: { readOnly: true },\n });\n return;\n }\n const conf: MatDialogConfig = {\n width: this.DIALOG_WIDTH,\n data: { knowledgeSourceKey: { knowledgeSourceId: source?.id, namespace: source?.namespace }, readOnly: true },\n };\n\n const isSmallScreen = this.bpObserver.isMatched(Breakpoints.XSmall);\n if (isSmallScreen) {\n conf.maxWidth = '100vw';\n conf.maxHeight = '100vh';\n }\n this.dialog.open(KnowledgeEditorComponent, conf);\n }\n\n removeSource(source: KnowledgeSource): void {\n this.selectedSources.update((selectedSources) => {\n const index = selectedSources.indexOf(source);\n if (index >= 0) {\n selectedSources.splice(index, 1);\n }\n return [...selectedSources];\n });\n }\n\n addSource(source: KnowledgeSource): void {\n this.selectedSources.update((selectedSources) => {\n const sourceIds = selectedSources.map((g) => g.id);\n if (!sourceIds.includes(source.id)) {\n selectedSources.push(source);\n }\n this.clearInputFields();\n this.matAutocompleteTrigger.closePanel();\n return [...selectedSources];\n });\n }\n\n chooseMatch(event: any): void {\n event.preventDefault();\n if (this.filteredSources().length > 1) {\n // Do not select if there are multiple matches\n return;\n }\n if (this.filteredSources().length === 1) {\n const sourceToAdd = this.filteredSources()[0];\n this.addSource(sourceToAdd);\n }\n }\n\n clearInputFields(): void {\n if (this.knowledgeSourceInput?.nativeElement?.value) {\n this.knowledgeSourceInput.nativeElement.value = '';\n }\n this.selectedSourceControl.setValue('');\n }\n\n manageKnowledgeUrl(): string {\n return this.knowledgeService.buildManageKnowledgeUrl();\n }\n\n goToAddKnowledge(): void {\n window.open(this.knowledgeService.buildAddKnowledgeUrl(), '_blank');\n }\n\n getKnowledgePreview(source: KnowledgeSource): string {\n return this.knowledgeService.getKnowledgePreview(source);\n }\n}\n","
\n {{ 'CHOOSE_KNOWLEDGE_SOURCES' | translate }}\n
\n\n \n \n \n \n refresh\n \n \n \n {{ 'ADD_KNOWLEDGE' | translate }}\n open_in_new\n \n \n 0\">\n \n
{{ source.name }}
\n
{{ getKnowledgePreview(source) }}
\n
\n
\n
\n \n
\n\n\n \n\n","import { CommonModule } from '@angular/common';\nimport { Component, DestroyRef, EventEmitter, HostListener, inject, Input, OnInit, Output } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatInputModule } from '@angular/material/input';\nimport { MaybeAsync, RouterModule } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { Widget } from './widget';\nimport { GalaxyFormFieldModule } from '@vendasta/galaxy/form-field';\nimport { map } from 'rxjs';\nimport { InboxService } from '../../../../../core/src/lib/inbox.service';\nimport { GalaxyLoadingSpinnerModule } from '@vendasta/galaxy/loading-spinner';\nimport { KnowledgeSource } from '@vendasta/embeddings';\nimport { ApplicationKnowledgeComponent } from '@galaxy/ai-knowledge';\nimport { OpenConfirmationModalService } from '@vendasta/galaxy/confirmation-modal';\nimport { MatDialogModule } from '@angular/material/dialog';\n\n@Component({\n selector: 'inbox-webchat-form',\n standalone: true,\n imports: [\n CommonModule,\n MatInputModule,\n MatCardModule,\n ReactiveFormsModule,\n FormsModule,\n MatButtonModule,\n GalaxyFormFieldModule,\n GalaxyLoadingSpinnerModule,\n TranslateModule,\n MatCheckboxModule,\n RouterModule,\n MatIconModule,\n MatButtonToggleModule,\n MatDialogModule,\n ApplicationKnowledgeComponent,\n ],\n templateUrl: './webchat-form.component.html',\n styleUrls: ['./webchat-form.component.scss'],\n})\nexport class WebchatFormComponent implements OnInit {\n @Input() webchat: Widget;\n\n @Input() set disabled(value: boolean) {\n if (this.widgetForm) {\n value ? this.widgetForm.disable() : this.widgetForm.enable();\n }\n }\n\n @Output() formChange = new EventEmitter();\n @Output() knowledgeSourcesChange = new EventEmitter();\n\n private destroyRef = inject(DestroyRef);\n widgetForm: FormGroup | undefined;\n customKnowledgeForm: FormGroup | undefined;\n textColorSelected = 'light';\n accentTextColorSelected = 'light';\n COLOR_REGEX = /^#[a-fA-F0-9]{6}$/;\n private inboxService = inject(InboxService);\n private readonly confirmationModal = inject(OpenConfirmationModalService);\n private hasUnsavedChanges = false;\n private initialSources: KnowledgeSource[] | null = null;\n isBusinessApp = this.inboxService.isBusinessApp;\n knowledgeAppId = '';\n\n ngOnInit(): void {\n this.widgetForm = new FormGroup({\n name: new FormControl(this.webchat?.name || ''),\n color: new FormControl(this.webchat?.color || '#555555', [\n Validators.required,\n Validators.pattern(this.COLOR_REGEX),\n ]),\n welcomeMessage: new FormControl(this.webchat?.welcomeMessage || ''),\n textColor: new FormControl(this.webchat?.textColor || 'light'),\n accentColor: new FormControl(this.webchat?.accentColor || '#1976d2', [\n Validators.required,\n Validators.pattern(this.COLOR_REGEX),\n ]),\n accentTextColor: new FormControl(this.webchat?.accentTextColor || 'light'),\n });\n this.customKnowledgeForm = new FormGroup({\n knowledgeSources: new FormControl([]),\n });\n this.textColorSelected = this.widgetForm?.get('textColor')?.value || 'light';\n this.accentTextColorSelected = this.widgetForm?.get('accentTextColor')?.value || 'light';\n\n this.widgetForm.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {\n this.formChange.emit(value);\n this.markChanges();\n });\n\n this.customKnowledgeForm.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((value) => {\n this.knowledgeSourcesChange.emit(value?.knowledgeSources);\n this.markChanges();\n });\n\n if (this.webchat?.widgetId) {\n this.knowledgeAppId = this.inboxService.buildAppId(this.webchat.widgetId);\n }\n }\n\n private knowledgeSourcesHaveChanged(): boolean {\n const currentSources: KnowledgeSource[] = this.customKnowledgeForm?.get('knowledgeSources')?.value;\n if (this.initialSources?.length !== currentSources?.length) {\n return true;\n }\n for (const source of this.initialSources || []) {\n if (!currentSources.some((s) => s.id === source.id)) {\n return true;\n }\n }\n return false;\n }\n\n public getContrastYIQ(color: string): string {\n const len = 2;\n const baseHex = 16;\n\n // remove hash from hexa string\n const hexColor = color.substring(1);\n\n const r = parseInt(hexColor.substr(0, len), baseHex);\n const g = parseInt(hexColor.substr(2, len), baseHex);\n const b = parseInt(hexColor.substr(4, len), baseHex);\n const yiq = (r * 299 + g * 587 + b * 114) / 1000;\n return yiq >= 128 ? 'dark' : 'light';\n }\n\n updateSelectedSources(sources: KnowledgeSource[] | null): void {\n if (this.initialSources === null && sources !== null) {\n this.initialSources = JSON.parse(JSON.stringify(sources));\n }\n this.customKnowledgeForm?.get('knowledgeSources')?.setValue(sources);\n }\n\n public setTextColor() {\n this.widgetForm\n ?.get('textColor')\n ?.setValue(this.getContrastYIQ(this.widgetForm?.get('color')?.value), { emitEvent: false });\n }\n\n public setAccentTextColor() {\n this.widgetForm\n ?.get('accentTextColor')\n ?.setValue(this.getContrastYIQ(this.widgetForm?.get('accentColor')?.value), { emitEvent: false });\n }\n\n @HostListener('window: beforeunload', ['$event'])\n onBeforeUnload(event: BeforeUnloadEvent): void {\n if (this.hasUnsavedChanges) {\n event.preventDefault();\n event.stopPropagation();\n event.returnValue = false;\n }\n }\n\n canDeactivate(): MaybeAsync {\n if (this.hasUnsavedChanges) {\n return this.confirmationModal\n .openModal({\n type: 'warn',\n title: 'INBOX.UNSAVED_CHANGES.TITLE',\n message: 'INBOX.UNSAVED_CHANGES.MESSAGE',\n confirmButtonText: 'INBOX.UNSAVED_CHANGES.CONFIRM',\n })\n .pipe(map((confirmation) => !!confirmation));\n }\n return true;\n }\n\n private markChanges(): void {\n if (this.widgetForm?.dirty || this.customKnowledgeForm?.dirty || this.knowledgeSourcesHaveChanged()) {\n this.hasUnsavedChanges = true;\n return;\n }\n this.hasUnsavedChanges = false;\n }\n\n markAsSaved() {\n this.widgetForm?.markAsPristine();\n this.customKnowledgeForm?.markAsPristine();\n this.initialSources = JSON.parse(JSON.stringify(this.customKnowledgeForm?.get('knowledgeSources')?.value));\n this.hasUnsavedChanges = false;\n }\n}\n","
\n
\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WIDGET_NAME' | translate }}\n \n \n \n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WIDGET_NAME_DESCRIPTION' | translate }}\n \n \n \n \n\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WEBCHAT_ASSISTANT_TITLE' | translate }}\n \n \n \n \n \n\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.WEBCHAT_GREETING' | translate }}\n \n \n

{{ 'INBOX.WEBCHAT.SETTINGS.WEBCHAT_GREETING_DESCRIPTION' | translate }}

\n \n \n {{ welcomeMessageLimit.value?.length || 0 }}/70\n \n
\n
\n\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.APPEARANCE' | translate }}\n \n \n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.PRIMARY_COLOR' | translate }}\n \n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.INVALID_COLOR' | translate }}\n \n \n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.TEXT_COLOR' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.DARK' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.LIGHT' | translate }}\n \n \n \n\n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.ACCENT_COLOR' | translate }}\n \n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.INVALID_COLOR' | translate }}\n \n \n
\n \n {{ 'INBOX.WEBCHAT.SETTINGS.ACCENT_TEXT_COLOR' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.DARK' | translate }}\n \n \n {{ 'INBOX.WEBCHAT.SETTINGS.LIGHT' | translate }}\n \n \n \n
\n
\n
\n
\n","import { CommonModule } from '@angular/common';\nimport { Component, inject, signal, ViewChild } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { MatCardModule } from '@angular/material/card';\nimport { MatIconModule } from '@angular/material/icon';\nimport { ActivatedRoute, MaybeAsync, Router } from '@angular/router';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ConversationApiService } from '@vendasta/conversation';\nimport { Widget } from '../webchat-form/widget';\nimport { GalaxyPageModule } from '@vendasta/galaxy/page';\nimport { SnackbarService } from '@vendasta/galaxy/snackbar-service';\nimport { catchError, firstValueFrom, throwError } from 'rxjs';\nimport { InboxService } from '../../../../../core/src';\nimport { ACCOUNT_GROUP_ID_TOKEN, PARTNER_ID_TOKEN } from '../../../../../core/src/lib/tokens';\nimport { StickyFooterComponent } from '../../../components/sticky-footer/sticky-footer.component';\nimport { getBackUrl } from '../constants';\nimport { WebchatFormComponent } from '../webchat-form/webchat-form.component';\nimport { AiKnowledgeService } from '@galaxy/ai-knowledge';\nimport { KnowledgeSource } from '@vendasta/embeddings';\n\n@Component({\n selector: 'inbox-new-webchat',\n standalone: true,\n imports: [\n CommonModule,\n MatCardModule,\n GalaxyPageModule,\n TranslateModule,\n MatIconModule,\n WebchatFormComponent,\n StickyFooterComponent,\n ],\n templateUrl: './new-webchat.component.html',\n styleUrls: ['./new-webchat.component.scss'],\n})\nexport class NewWebchatComponent {\n @ViewChild('webchatFormComponent') webchatFormComponent: WebchatFormComponent;\n private readonly conversationApi = inject(ConversationApiService);\n private readonly snackbarService = inject(SnackbarService);\n private readonly router = inject(Router);\n private readonly route = inject(ActivatedRoute);\n private readonly partnerId = toSignal(inject(PARTNER_ID_TOKEN));\n private readonly accountGroupId = toSignal(inject(ACCOUNT_GROUP_ID_TOKEN));\n private readonly inboxService = inject(InboxService);\n private readonly knowledgeService = inject(AiKnowledgeService);\n\n private widgetFormData: Widget;\n private knowledgeSources?: KnowledgeSource[];\n\n readonly isLoading = signal(false);\n readonly backUrl = getBackUrl(this.inboxService.isBusinessApp, 2);\n\n updateFormData(widget: Widget): void {\n this.widgetFormData = widget;\n }\n\n updateKnowledgeSources(sources: KnowledgeSource[]): void {\n this.knowledgeSources = sources;\n }\n\n async createWebchat(): Promise {\n this.isLoading.set(true);\n\n // We may need to revisit how we get namespaces for the settings page.\n // This works for now\n const namespace = this.accountGroupId() || this.partnerId();\n\n try {\n const resp = await firstValueFrom(\n this.conversationApi\n .createWidget({\n ...this.widgetFormData,\n namespace: namespace,\n })\n .pipe(catchError((err) => throwError(() => err))),\n );\n\n const widgetId = resp.widget.widgetId;\n const configurationUrl = await this.inboxService.buildAiKnowledgeAppConfigurationUrl(widgetId);\n await this.knowledgeService\n .upsertKnowledgeForApp(\n this.inboxService.buildAppId(widgetId),\n 'Web Chat: ' + resp.widget.name,\n configurationUrl,\n this.knowledgeSources,\n )\n .catch(\n // ignore error here for now because it could orphan the widget otherwise\n // TODO: handle this better in the next iteration of the UI for AI Knowledge (a different step?)\n () => console.warn('Failed to save Automated Assistant settings'),\n );\n\n this.webchatFormComponent.markAsSaved();\n this.snackbarService.openSuccessSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_CREATED');\n this.router.navigate(['..', resp.widget.widgetId], { relativeTo: this.route });\n } catch (e) {\n this.snackbarService.openErrorSnack('INBOX.WEBCHAT.SETTINGS.WEBCHAT_CREATE_ERROR');\n } finally {\n this.isLoading.set(false);\n }\n }\n\n canDeactivate(): MaybeAsync {\n return this.webchatFormComponent.canDeactivate();\n }\n}\n","\n \n {{ 'INBOX.SETTINGS.WEBCHAT_CONFIGURATION' | translate }}\n \n \n \n\n \n \n\n","import { Component } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { MatDialogModule } from '@angular/material/dialog';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatDividerModule } from '@angular/material/divider';\n\n@Component({\n selector: 'inbox-webchat-install-instructions-dialog',\n standalone: true,\n imports: [CommonModule, MatButtonModule, MatDialogModule, MatDividerModule],\n templateUrl: './webchat-install-instructions-dialog.component.html',\n})\nexport class WebchatInstallInstructionsDialogComponent {}\n","

How to install Inbox Pro Web Chat widget on a website

\n\n\n

Install the WordPress web chat plugin

\n
    \n
  1. Download your custom plugin from Inbox Pro Settings > Web Chat > Installation > WordPress
  2. \n
  3. \n Go to\n your-website.com\n /wp-admin > Plugins > Add New Plugin\n
  4. \n
  5. Upload the zip file containing your plugin, and install it.
  6. \n
  7. Activate it, and you’ll see the chat appear on your site after reloading the page.
  8. \n
\n\n

Alternatively, install the website embed code

\n

\n To install your web chat widget on your website, copy and paste your install code into the\n <head>\n element of your website, typically just before the closing\n </head>\n tag.\n

\n\n

For a WordPress site with Divi theme

\n
    \n
  1. Copy your web chat installation code into your clipboard.
  2. \n
  3. \n Navigate to your WordPress backend admin, usually at\n your-website.com\n /wp-admin\n
  4. \n
  5. Go to Divi > Theme Options > Integrations
  6. \n
  7. \n Paste the code into the section titled \"Add code to the\n <head>\n of your blog.\"\n
  8. \n
  9. Save changes. Your web chat widget should now be live on your website, on all pages.
  10. \n
\n\n

For a WordPress site without Divi theme

\n

\n To save custom code to the header of your website, you’ll need to download a plugin like\n \n Header Footer Code Manager.\n \n (We are not affiliated with these plugins, use at your own risk.)\n

\n
    \n
  1. Copy your web chat installation code to your clipboard.
  2. \n
  3. \n Go to your WordPress backend admin, typically at\n your-website.com\n /wp-admin\n
  4. \n
  5. Navigate to Plugins > Add New
  6. \n
  7. Search for your plugin, Install and Activate it.
  8. \n
  9. \n Once the plugin is downloaded and activated, navigate to the area in the plugin where you can add custom content\n to the\n <head>\n element of your website, and paste your web chat code.\n
  10. \n
\n\n \n\n

Common issues

\n\n

Issue: I cannot scroll, or type the 'space' key, or a certain character into the chat widget

\n

\n Some plugin features can interfere with the ability to type in the widget because they “hijack” that key for their\n own functions. Try disabling plugins, one by one, to find the plugin that’s affecting the web chat.\n

\n\n

Issue: I don't see the web chat on my site, even though it’s installed in the right place

\n

\n If the Web chat code is installed on your website, and enabled in Inbox Settings, and you cannot see it on your\n website, the most likely next cause is usually cache or plugin issues. You can try additional steps on your website\n to clear cache or any blocking plugins to get the web chat to appear.\n

\n\n

Caching issues

\n

\n Most websites use multiple types of caches that help the site to load faster. You’ll want to reset the caches, to\n get your latest website changes to appear.\n

\n
    \n
  1. Browser cache – to tell your browser to load the website without using local device cache
  2. \n
      \n
    1. Shift+command+R (Mac)
    2. \n
    3. Ctrl + F5 (PC)
    4. \n
    \n
  3. \n Website hosting cache – clear the cache that Website product manages, by clicking the ‘Flush Cache’ button on the\n Website overview page.\n
  4. \n
  5. \n Divi CSS cache – Disable the Static CSS File Generation cache in your Divi Theme options > Builder >\n Advanced\n
  6. \n
  7. \n Other Cache plugins – Ensure there are no other cache plugins activated on your website; if so, disable them.\n
  8. \n
\n\n

Google reCAPTCHA badge is in the way

\n

\n When reCAPTCHA is being used on a website form, this badge will appear in the bottom right of a webpage – which can\n be in the way of the web chat widget.\n

\n

\n You can hide the badge completely on your website with some custom CSS; just make sure to follow Google’s required\n alternative ways to inform the user that reCAPTCHA is being used. Read more:\n \n https://developers.google.com/recaptcha/docs/faq#id-like-to-hide-the-recaptcha-badge.-what-is-allowed\n \n

\n\n

To hide the reCAPTCHA badge, go to your website CSS editor,

\n
    \n
  1. Log in to your WordPress dashboard
  2. \n
  3. \n Go to\n Appearance > Customizer\n
  4. \n
  5. \n Click\n Additional CSS\n
  6. \n
  7. \n Add the snippet below:\n
    .grecaptcha-badge {{'{'}}\n  visibility: hidden!important;\n{{'}'}}
    \n
  8. \n
  9. Save and preview your website.
  10. \n
\n
\n\n\n \n\n","// https://nodejs.org/api/packages.html#packages_writing_dual_packages_while_avoiding_or_minimizing_hazards\nimport HighlightJS from '../lib/core.js';\nexport { HighlightJS };\nexport default HighlightJS;","const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\"as\",\n// for exports\n\"in\", \"of\", \"if\", \"for\", \"while\", \"finally\", \"var\", \"new\", \"function\", \"do\", \"return\", \"void\", \"else\", \"break\", \"catch\", \"instanceof\", \"with\", \"throw\", \"case\", \"default\", \"try\", \"switch\", \"continue\", \"typeof\", \"delete\", \"let\", \"yield\", \"const\", \"class\",\n// JS handles these with a special rule\n// \"get\",\n// \"set\",\n\"debugger\", \"async\", \"await\", \"static\", \"import\", \"from\", \"export\", \"extends\"];\nconst LITERALS = [\"true\", \"false\", \"null\", \"undefined\", \"NaN\", \"Infinity\"];\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects\nconst TYPES = [\n// Fundamental objects\n\"Object\", \"Function\", \"Boolean\", \"Symbol\",\n// numbers and dates\n\"Math\", \"Date\", \"Number\", \"BigInt\",\n// text\n\"String\", \"RegExp\",\n// Indexed collections\n\"Array\", \"Float32Array\", \"Float64Array\", \"Int8Array\", \"Uint8Array\", \"Uint8ClampedArray\", \"Int16Array\", \"Int32Array\", \"Uint16Array\", \"Uint32Array\", \"BigInt64Array\", \"BigUint64Array\",\n// Keyed collections\n\"Set\", \"Map\", \"WeakSet\", \"WeakMap\",\n// Structured data\n\"ArrayBuffer\", \"SharedArrayBuffer\", \"Atomics\", \"DataView\", \"JSON\",\n// Control abstraction objects\n\"Promise\", \"Generator\", \"GeneratorFunction\", \"AsyncFunction\",\n// Reflection\n\"Reflect\", \"Proxy\",\n// Internationalization\n\"Intl\",\n// WebAssembly\n\"WebAssembly\"];\nconst ERROR_TYPES = [\"Error\", \"EvalError\", \"InternalError\", \"RangeError\", \"ReferenceError\", \"SyntaxError\", \"TypeError\", \"URIError\"];\nconst BUILT_IN_GLOBALS = [\"setInterval\", \"setTimeout\", \"clearInterval\", \"clearTimeout\", \"require\", \"exports\", \"eval\", \"isFinite\", \"isNaN\", \"parseFloat\", \"parseInt\", \"decodeURI\", \"decodeURIComponent\", \"encodeURI\", \"encodeURIComponent\", \"escape\", \"unescape\"];\nconst BUILT_IN_VARIABLES = [\"arguments\", \"this\", \"super\", \"console\", \"window\", \"document\", \"localStorage\", \"sessionStorage\", \"module\", \"global\" // Node.js\n];\nconst BUILT_INS = [].concat(BUILT_IN_GLOBALS, TYPES, ERROR_TYPES);\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting, web\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n const regex = hljs.regex;\n /**\n * Takes a string like \" {\n const tag = \"',\n end: ''\n };\n // to avoid some special cases inside isTrulyOpeningTag\n const XML_SELF_CLOSING = /<[A-Za-z0-9\\\\._:-]+\\s*\\/>/;\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n if (\n // HTML should not include another raw `<` inside a tag\n // nested type?\n // `>`, etc.\n nextChar === \"<\" ||\n // the , gives away that this is not HTML\n // ``\n nextChar === \",\") {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // Quite possibly a tag, lets look for a matching closing tag...\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, {\n after: afterMatchIndex\n })) {\n response.ignoreMatch();\n }\n }\n\n // `` (self-closing)\n // handled by simpleSelfClosing rule\n\n let m;\n const afterMatch = match.input.substring(afterMatchIndex);\n\n // some more template typing stuff\n // (key?: string) => Modify<\n if (m = afterMatch.match(/^\\s*=/)) {\n response.ignoreMatch();\n return;\n }\n\n // ``\n // technically this could be HTML, but it smells like a type\n // NOTE: This is ugh, but added specifically for https://github.com/highlightjs/highlight.js/issues/3276\n if (m = afterMatch.match(/^\\s+extends\\s+/)) {\n if (m.index === 0) {\n response.ignoreMatch();\n // eslint-disable-next-line no-useless-return\n return;\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS,\n literal: LITERALS,\n built_in: BUILT_INS,\n \"variable.language\": BUILT_IN_VARIABLES\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n {\n begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` + `[eE][+-]?(${decimalDigits})\\\\b`\n }, {\n begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b`\n },\n // DecimalBigIntegerLiteral\n {\n begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b`\n },\n // NonDecimalIntegerLiteral\n {\n begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\"\n }, {\n begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\"\n }, {\n begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\"\n },\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n {\n begin: \"\\\\b0[0-7]+n?\\\\b\"\n }],\n relevance: 0\n };\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: 'html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [hljs.BACKSLASH_ESCAPE, SUBST],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: 'css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [hljs.BACKSLASH_ESCAPE, SUBST],\n subLanguage: 'css'\n }\n };\n const GRAPHQL_TEMPLATE = {\n begin: 'gql`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [hljs.BACKSLASH_ESCAPE, SUBST],\n subLanguage: 'graphql'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [hljs.BACKSLASH_ESCAPE, SUBST]\n };\n const JSDOC_COMMENT = hljs.COMMENT(/\\/\\*\\*(?!\\/)/, '\\\\*/', {\n relevance: 0,\n contains: [{\n begin: '(?=@[A-Za-z]+)',\n relevance: 0,\n contains: [{\n className: 'doctag',\n begin: '@[A-Za-z]+'\n }, {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n excludeEnd: true,\n excludeBegin: true,\n relevance: 0\n }, {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }]\n }]\n });\n const COMMENT = {\n className: \"comment\",\n variants: [JSDOC_COMMENT, hljs.C_BLOCK_COMMENT_MODE, hljs.C_LINE_COMMENT_MODE]\n };\n const SUBST_INTERNALS = [hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, HTML_TEMPLATE, CSS_TEMPLATE, GRAPHQL_TEMPLATE, TEMPLATE_STRING,\n // Skip numbers when they are part of a variable name\n {\n match: /\\$\\d+/\n }, NUMBER\n // This is intentional:\n // See https://github.com/highlightjs/highlight.js/issues/3288\n // hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS.concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }]);\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n // ES6 classes\n const CLASS_OR_EXTENDS = {\n variants: [\n // class Car extends vehicle\n {\n match: [/class/, /\\s+/, IDENT_RE$1, /\\s+/, /extends/, /\\s+/, regex.concat(IDENT_RE$1, \"(\", regex.concat(/\\./, IDENT_RE$1), \")*\")],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\",\n 5: \"keyword\",\n 7: \"title.class.inherited\"\n }\n },\n // class Car\n {\n match: [/class/, /\\s+/, IDENT_RE$1],\n scope: {\n 1: \"keyword\",\n 3: \"title.class\"\n }\n }]\n };\n const CLASS_REFERENCE = {\n relevance: 0,\n match: regex.either(\n // Hard coded exceptions\n /\\bJSON/,\n // Float32Array, OutT\n /\\b[A-Z][a-z]+([A-Z][a-z]*|\\d)*/,\n // CSSFactory, CSSFactoryT\n /\\b[A-Z]{2,}([A-Z][a-z]+|\\d)+([A-Z][a-z]*)*/,\n // FPs, FPsT\n /\\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\\d)*([A-Z][a-z]*)*/\n // P\n // single letters are not highlighted\n // BLAH\n // this will be flagged as a UPPER_CASE_CONSTANT instead\n ),\n className: \"title.class\",\n keywords: {\n _: [\n // se we still get relevance credit for JS library classes\n ...TYPES, ...ERROR_TYPES]\n }\n };\n const USE_STRICT = {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n };\n const FUNCTION_DEFINITION = {\n variants: [{\n match: [/function/, /\\s+/, IDENT_RE$1, /(?=\\s*\\()/]\n },\n // anonymous function\n {\n match: [/function/, /\\s*(?=\\()/]\n }],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n label: \"func.def\",\n contains: [PARAMS],\n illegal: /%/\n };\n const UPPER_CASE_CONSTANT = {\n relevance: 0,\n match: /\\b[A-Z][A-Z_0-9]+\\b/,\n className: \"variable.constant\"\n };\n function noneOf(list) {\n return regex.concat(\"(?!\", list.join(\"|\"), \")\");\n }\n const FUNCTION_CALL = {\n match: regex.concat(/\\b/, noneOf([...BUILT_IN_GLOBALS, \"super\", \"import\"]), IDENT_RE$1, regex.lookahead(/\\(/)),\n className: \"title.function\",\n relevance: 0\n };\n const PROPERTY_ACCESS = {\n begin: regex.concat(/\\./, regex.lookahead(regex.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),\n end: IDENT_RE$1,\n excludeBegin: true,\n keywords: \"prototype\",\n className: \"property\",\n relevance: 0\n };\n const GETTER_OR_SETTER = {\n match: [/get|set/, /\\s+/, IDENT_RE$1, /(?=\\()/],\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [{\n // eat to avoid empty params\n begin: /\\(\\)/\n }, PARAMS]\n };\n const FUNC_LEAD_IN_RE = '(\\\\(' + '[^()]*(\\\\(' + '[^()]*(\\\\(' + '[^()]*' + '\\\\)[^()]*)*' + '\\\\)[^()]*)*' + '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>';\n const FUNCTION_VARIABLE = {\n match: [/const|var|let/, /\\s+/, IDENT_RE$1, /\\s*/, /=\\s*/, /(async\\s*)?/,\n // async is optional\n regex.lookahead(FUNC_LEAD_IN_RE)],\n keywords: \"async\",\n className: {\n 1: \"keyword\",\n 3: \"title.function\"\n },\n contains: [PARAMS]\n };\n return {\n name: 'JavaScript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: {\n PARAMS_CONTAINS,\n CLASS_REFERENCE\n },\n illegal: /#(?![$_A-z])/,\n contains: [hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }), USE_STRICT, hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, HTML_TEMPLATE, CSS_TEMPLATE, GRAPHQL_TEMPLATE, TEMPLATE_STRING, COMMENT,\n // Skip numbers when they are part of a variable name\n {\n match: /\\$\\d+/\n }, NUMBER, CLASS_REFERENCE, {\n className: 'attr',\n begin: IDENT_RE$1 + regex.lookahead(':'),\n relevance: 0\n }, FUNCTION_VARIABLE, {\n // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n relevance: 0,\n contains: [COMMENT, hljs.REGEXP_MODE, {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: FUNC_LEAD_IN_RE,\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [{\n className: 'params',\n variants: [{\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n }, {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n }, {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }]\n }]\n }, {\n // could be a comma delimited list of params to a function call\n begin: /,/,\n relevance: 0\n }, {\n match: /\\s+/,\n relevance: 0\n }, {\n // JSX\n variants: [{\n begin: FRAGMENT.begin,\n end: FRAGMENT.end\n }, {\n match: XML_SELF_CLOSING\n }, {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }],\n subLanguage: 'xml',\n contains: [{\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }]\n }]\n }, FUNCTION_DEFINITION, {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n }, {\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: '\\\\b(?!function)' + hljs.UNDERSCORE_IDENT_RE + '\\\\(' +\n // first parens\n '[^()]*(\\\\(' + '[^()]*(\\\\(' + '[^()]*' + '\\\\)[^()]*)*' + '\\\\)[^()]*)*' + '\\\\)\\\\s*\\\\{',\n // end parens\n returnBegin: true,\n label: \"func.def\",\n contains: [PARAMS, hljs.inherit(hljs.TITLE_MODE, {\n begin: IDENT_RE$1,\n className: \"title.function\"\n })]\n },\n // catch ... so it won't trigger the property rule below\n {\n match: /\\.\\.\\./,\n relevance: 0\n }, PROPERTY_ACCESS,\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n match: '\\\\$' + IDENT_RE$1,\n relevance: 0\n }, {\n match: [/\\bconstructor(?=\\s*\\()/],\n className: {\n 1: \"title.function\"\n },\n contains: [PARAMS]\n }, FUNCTION_CALL, UPPER_CASE_CONSTANT, CLASS_OR_EXTENDS, GETTER_OR_SETTER, {\n match: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }]\n };\n}\nexport { javascript as default };","/*\nLanguage: HTML, XML\nWebsite: https://www.w3.org/XML/\nCategory: common, web\nAudit: 2020\n*/\n\n/** @type LanguageFn */\nfunction xml(hljs) {\n const regex = hljs.regex;\n // XML names can have the following additional letters: https://www.w3.org/TR/xml/#NT-NameChar\n // OTHER_NAME_CHARS = /[:\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]/;\n // Element names start with NAME_START_CHAR followed by optional other Unicode letters, ASCII digits, hyphens, underscores, and periods\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);;\n // const XML_IDENT_RE = /[A-Z_a-z:\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]+/;\n // const TAG_NAME_RE = regex.concat(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/, regex.optional(/[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*:/), /[A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*/);\n // however, to cater for performance and more Unicode support rely simply on the Unicode letter class\n const TAG_NAME_RE = regex.concat(/[\\p{L}_]/u, regex.optional(/[\\p{L}0-9_.-]*:/u), /[\\p{L}0-9_.-]*/u);\n const XML_IDENT_RE = /[\\p{L}0-9._:-]+/u;\n const XML_ENTITIES = {\n className: 'symbol',\n begin: /&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/\n };\n const XML_META_KEYWORDS = {\n begin: /\\s/,\n contains: [{\n className: 'keyword',\n begin: /#?[a-z_][a-z1-9_-]+/,\n illegal: /\\n/\n }]\n };\n const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {\n begin: /\\(/,\n end: /\\)/\n });\n const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, {\n className: 'string'\n });\n const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, {\n className: 'string'\n });\n const TAG_INTERNALS = {\n endsWithParent: true,\n illegal: /`]+/\n }]\n }]\n }]\n };\n return {\n name: 'HTML, XML',\n aliases: ['html', 'xhtml', 'rss', 'atom', 'xjb', 'xsd', 'xsl', 'plist', 'wsf', 'svg'],\n case_insensitive: true,\n unicodeRegex: true,\n contains: [{\n className: 'meta',\n begin: //,\n relevance: 10,\n contains: [XML_META_KEYWORDS, QUOTE_META_STRING_MODE, APOS_META_STRING_MODE, XML_META_PAR_KEYWORDS, {\n begin: /\\[/,\n end: /\\]/,\n contains: [{\n className: 'meta',\n begin: //,\n contains: [XML_META_KEYWORDS, XML_META_PAR_KEYWORDS, QUOTE_META_STRING_MODE, APOS_META_STRING_MODE]\n }]\n }]\n }, hljs.COMMENT(//, {\n relevance: 10\n }), {\n begin: //,\n relevance: 10\n }, XML_ENTITIES,\n // xml processing instructions\n {\n className: 'meta',\n end: /\\?>/,\n variants: [{\n begin: /<\\?xml/,\n relevance: 10,\n contains: [QUOTE_META_STRING_MODE]\n }, {\n begin: /<\\?[a-z][a-z0-9]+/\n }]\n }, {\n className: 'tag',\n /*\n The lookahead pattern (?=...) ensures that 'begin' only matches\n ')/,\n end: />/,\n keywords: {\n name: 'style'\n },\n contains: [TAG_INTERNALS],\n starts: {\n end: /<\\/style>/,\n returnEnd: true,\n subLanguage: ['css', 'xml']\n }\n }, {\n className: 'tag',\n // See the comment in the