From 06756881fd1a4331fb19fa0144764bd46cdecbe0 Mon Sep 17 00:00:00 2001
From: Andrey Sobolev <haiodo@users.noreply.github.com>
Date: Wed, 2 Feb 2022 20:25:16 +0700
Subject: [PATCH] Support facebook channel (#915)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
---
 models/contact/src/index.ts                           | 11 +++++++++++
 packages/rekoni/src/types.ts                          |  2 +-
 plugins/contact/src/index.ts                          |  3 ++-
 .../src/components/CreateCandidate.svelte             |  5 +++++
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/models/contact/src/index.ts b/models/contact/src/index.ts
index ee79cfb592..b1d1ed38ed 100644
--- a/models/contact/src/index.ts
+++ b/models/contact/src/index.ts
@@ -208,6 +208,17 @@ export function createModel (builder: Builder): void {
     contact.channelProvider.GitHub
   )
 
+  builder.createDoc(
+    contact.class.ChannelProvider,
+    core.space.Model,
+    {
+      label: 'Facebook' as IntlString,
+      icon: contact.icon.Facebook,
+      placeholder: '' as IntlString
+    },
+    contact.channelProvider.Facebook
+  )
+
   builder.createDoc(
     core.class.Space,
     core.space.Model,
diff --git a/packages/rekoni/src/types.ts b/packages/rekoni/src/types.ts
index e2ac84eb3f..aca0766859 100644
--- a/packages/rekoni/src/types.ts
+++ b/packages/rekoni/src/types.ts
@@ -19,13 +19,13 @@
 export interface ReconiDocument {
   firstName: string
   lastName: string
+  title?: string
   avatar?: string
   email?: string
   phone?: string
   city?: string
   skype?: string
   linkedin?: string
-  gmail?: string
   github?: string
   facebook?: string
   telegram?: string
diff --git a/plugins/contact/src/index.ts b/plugins/contact/src/index.ts
index 5dd8005c16..e9fe6068fc 100644
--- a/plugins/contact/src/index.ts
+++ b/plugins/contact/src/index.ts
@@ -139,7 +139,8 @@ export default plugin(contactId, {
     LinkedIn: '' as Ref<ChannelProvider>,
     Twitter: '' as Ref<ChannelProvider>,
     Telegram: '' as Ref<ChannelProvider>,
-    GitHub: '' as Ref<ChannelProvider>
+    GitHub: '' as Ref<ChannelProvider>,
+    Facebook: '' as Ref<ChannelProvider>
   },
   icon: {
     Phone: '' as Asset,
diff --git a/plugins/recruit-resources/src/components/CreateCandidate.svelte b/plugins/recruit-resources/src/components/CreateCandidate.svelte
index c04d06388a..3282978488 100644
--- a/plugins/recruit-resources/src/components/CreateCandidate.svelte
+++ b/plugins/recruit-resources/src/components/CreateCandidate.svelte
@@ -139,6 +139,10 @@
     try {
       const doc = await recognizeDocument(token, fileUrl)
 
+      if (isUndef(object.title) && doc.title !== undefined) {
+        object.title = doc.title
+      }
+
       if (isUndef(firstName) && doc.firstName !== undefined) {
         firstName = doc.firstName
       }
@@ -169,6 +173,7 @@
       addChannel(newChannels, contact.channelProvider.Phone, doc.phone)
       addChannel(newChannels, contact.channelProvider.Telegram, doc.telegram)
       addChannel(newChannels, contact.channelProvider.Twitter, doc.twitter)
+      addChannel(newChannels, contact.channelProvider.Facebook, doc.facebook)
       channels = newChannels
 
       console.log(doc, channels)