Merge branch 'hub-redesign' of https://github.com/frappe/erpnext into hub-redesign
diff --git a/erpnext/hub_node/api.py b/erpnext/hub_node/api.py
index c4a7925..9f4499f 100644
--- a/erpnext/hub_node/api.py
+++ b/erpnext/hub_node/api.py
@@ -81,13 +81,14 @@
 			'item_code': item_code,
 			'hub_category': item.get('hub_category'),
 			'image_list': item.get('image_list')
-		}).insert()
+		}).insert(ignore_if_duplicate=True)
 
 
 	items = map_fields(items_to_publish)
 
 	try:
 		item_sync_preprocess()
+		load_base64_image_from_items(items)
 
 		# TODO: Publish Progress
 		connection = get_hub_connection()
@@ -97,10 +98,8 @@
 			'status': 'Success',
 			'stats': len(items)
 		})
-
 	except Exception as e:
-		frappe.db.set_value("Hub Settings", "Hub Settings", "sync_in_progress", 0)
-		frappe.throw(e)
+		frappe.log_error(title='Hub Sync Error')
 
 def item_sync_preprocess():
 	hub_seller = frappe.db.get_value("Hub Settings", "Hub Settings", "company_email")
@@ -137,6 +136,31 @@
 
 	frappe.db.set_value('Hub Settings', 'Hub Settings', 'sync_in_progress', 0)
 
+
+def load_base64_image_from_items(items):
+	import io, base64, urllib, os
+	from frappe.utils.file_manager import get_file_path
+
+	for item in items:
+		file_path = item['image']
+		file_name = os.path.basename(file_path)
+
+		if file_path.startswith('http'):
+			url = file_path
+			file_path = os.path.join('/tmp', file_name)
+			urllib.urlretrieve(url, file_path)
+		else:
+			file_path = os.path.abspath(get_file_path(file_path))
+
+		with io.open(file_path, 'rb') as f:
+			image_data = json.dumps({
+				'file_name': file_name,
+				'base64': base64.b64encode(f.read())
+			})
+
+		item['image'] = image_data
+
+
 def get_hub_connection():
 	if frappe.db.exists('Data Migration Connector', 'Hub Connector'):
 		hub_connector = frappe.get_doc('Data Migration Connector', 'Hub Connector')
diff --git a/erpnext/public/js/hub/pages/messages.js b/erpnext/public/js/hub/pages/messages.js
deleted file mode 100644
index 5f67502..0000000
--- a/erpnext/public/js/hub/pages/messages.js
+++ /dev/null
@@ -1,104 +0,0 @@
-import SubPage from './subpage';
-// import { get_item_card_container_html } from '../components/items_container';
-import { get_buying_item_message_card_html } from '../components/item_card';
-import { get_selling_item_message_card_html } from '../components/item_card';
-// import { get_empty_state } from '../components/empty_state';
-
-erpnext.hub.Buying = class Buying extends SubPage {
-	refresh() {
-		this.get_items_for_messages().then((items) => {
-			this.empty();
-			if (items.length) {
-				items.map(item => {
-					item.route = `marketplace/buying/${item.hub_item_code}`
-				})
-				this.render(items, __('Buying'));
-			}
-
-			if (!items.length && !items.length) {
-				this.render_empty_state();
-			}
-		});
-	}
-
-	render(items = [], title) {
-		// const html = get_item_card_container_html(items, title, get_buying_item_message_card_html);
-		this.$wrapper.append(html);
-	}
-
-	render_empty_state() {
-		// const empty_state = get_empty_state(__('You haven\'t interacted with any seller yet.'));
-		// this.$wrapper.html(empty_state);
-	}
-
-	get_items_for_messages() {
-		return hub.call('get_buying_items_for_messages', {}, 'action:send_message');
-	}
-}
-
-erpnext.hub.Selling = class Selling extends SubPage {
-	refresh() {
-		this.get_items_for_messages().then((items) => {
-			this.empty();
-			if (items.length) {
-				items.map(item => {
-					item.route = `marketplace/selling/${item.hub_item_code}`
-				})
-				this.render(items, __('Selling'));
-			}
-
-			if (!items.length && !items.length) {
-				this.render_empty_state();
-			}
-		});
-	}
-
-	render(items = [], title) {
-		// const html = get_item_card_container_html(items, title, get_selling_item_message_card_html);
-		this.$wrapper.append(html);
-	}
-
-	render_empty_state() {
-		const empty_state = get_empty_state(__('You haven\'t interacted with any seller yet.'));
-		this.$wrapper.html(empty_state);
-	}
-
-	get_items_for_messages() {
-		return hub.call('get_selling_items_for_messages', {});
-	}
-}
-
-function get_message_area_html() {
-	return `
-		<div class="message-area border padding flex flex-column">
-			<div class="message-list">
-			</div>
-			<div class="message-input">
-			</div>
-		</div>
-	`;
-}
-
-function get_list_item_html(seller) {
-	const active_class = frappe.get_route()[2] === seller.email ? 'active' : '';
-
-	return `
-		<div class="message-list-item ${active_class}" data-route="marketplace/messages/${seller.email}">
-			<div class="list-item-left">
-				<img src="${seller.image || 'https://picsum.photos/200?random'}">
-			</div>
-			<div class="list-item-body">
-				${seller.company}
-			</div>
-		</div>
-	`;
-}
-
-function get_message_html(message) {
-	return `
-		<div>
-			<h5>${message.sender}</h5>
-			<p>${message.content}</p>
-		</div>
-	`;
-}