leadguru-jobs 0.668.0__py3-none-any.whl → 0.669.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: leadguru_jobs
3
- Version: 0.668.0
3
+ Version: 0.669.0
4
4
  Summary: LGT jobs builds
5
5
  Author-email: developer@leadguru.co
6
6
  Classifier: Development Status :: 5 - Production/Stable
@@ -43,7 +43,7 @@ lgt_jobs/lgt_data/engine.py,sha256=GY8FOl3dl7euKjQRML_H3ophaSTgfQ8ICMRv1NpE2oE,7
43
43
  lgt_jobs/lgt_data/enums.py,sha256=SN2eLoB2m-bVswgLVuY46v0DhPj8IurgHY6R-KRsd6s,2621
44
44
  lgt_jobs/lgt_data/helpers.py,sha256=S_1P7pnx14dllmen-TzjA9pkKWQr39x8-v6iv7FUYnQ,423
45
45
  lgt_jobs/lgt_data/model.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
- lgt_jobs/lgt_data/mongo_repository.py,sha256=AG-WDftNi3PG29zzjMlu_bk9KvrdeoHXsTanqWMtNos,56175
46
+ lgt_jobs/lgt_data/mongo_repository.py,sha256=4BLKHpTrlBpnSlUil3ZAY3gF1WFN_kbSOh3PtZwYxGw,56443
47
47
  lgt_jobs/lgt_data/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
48
  lgt_jobs/lgt_data/models/base.py,sha256=YaiceCaaF45snOLx-bQoYJ1aTWrfgMQeHWjAaRnzGKE,592
49
49
  lgt_jobs/lgt_data/models/boards/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -76,7 +76,7 @@ lgt_jobs/lgt_data/models/leads/extended_lead.py,sha256=ezFrKv-f5GBXr3QAM-V_qJQ-i
76
76
  lgt_jobs/lgt_data/models/leads/lead.py,sha256=mTZh8YV06nX9OWYvv_X7rDdIperB-RPChrEuheeYMU0,1300
77
77
  lgt_jobs/lgt_data/models/leads/message.py,sha256=7mXwYfSpmhY_zC8TfUdAZzxsPP-02bOqVjdkN4Vid5s,1533
78
78
  lgt_jobs/lgt_data/models/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
- lgt_jobs/lgt_data/models/notifications/notification.py,sha256=WyN6vm1_UazFYla9VH2bnpyYgzQG7uJPvM9V5gEIBwE,12853
79
+ lgt_jobs/lgt_data/models/notifications/notification.py,sha256=mtdrVzn7Hs2zWz6v29OKynznoe0yfZ2J9ijA34Omy_o,19358
80
80
  lgt_jobs/lgt_data/models/notifications/notification_settings.py,sha256=VFddLvk2ROz4n50wYuZmqBDn7MssFwj-e9DbWweIVA4,2780
81
81
  lgt_jobs/lgt_data/models/people/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
82
  lgt_jobs/lgt_data/models/people/people.py,sha256=pm60uMVmNIxOGCBAtZWhmXSJOe0SJ4C1y_HurUq00oY,3420
@@ -105,7 +105,7 @@ lgt_jobs/lgt_data/repositories/post/posts.py,sha256=ZA19L-CYdxLhlapyMQtSJzP3QMUl
105
105
  lgt_jobs/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
106
106
  lgt_jobs/services/web_client.py,sha256=oMyWJxwGeIe3f40fPT7xcisjDg3BhA3Ipf8dr1jVT-Y,1549
107
107
  lgt_jobs/templates/new_message.html,sha256=dZl8UmdAOOMq4nidvAgMFroSrTV7Pw0RWt2yLp_2idg,6989
108
- leadguru_jobs-0.668.0.dist-info/METADATA,sha256=GJSbhsV5pmEtVuZfiqOo8iqIsVBcvRBVDu3PE9JtxdI,1319
109
- leadguru_jobs-0.668.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
110
- leadguru_jobs-0.668.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
111
- leadguru_jobs-0.668.0.dist-info/RECORD,,
108
+ leadguru_jobs-0.669.0.dist-info/METADATA,sha256=x8ipyKBYK2ruiP1rkCBstiUA3ec8Lm64J4WRbp0vVAY,1319
109
+ leadguru_jobs-0.669.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
110
+ leadguru_jobs-0.669.0.dist-info/top_level.txt,sha256=rIuw1DqwbnZyeoarBSC-bYeGOhv9mZBs7_afl9q4_JI,9
111
+ leadguru_jobs-0.669.0.dist-info/RECORD,,
@@ -52,9 +52,77 @@ class Notification(DictionaryModel):
52
52
 
53
53
 
54
54
  class IncomingMessageNotification(Notification):
55
+
56
+ other_leads_text = ' and other leads.'
57
+ name_html_item = '''
58
+ <div style="display: inline-block; padding-left: 2px" class="lead_names">
59
+ <img alt="Lead Photo" src="$$USER_IMAGE$$" width="24" height="24"
60
+ style="background-color: #FFFFFE !important; display: inline-block; vertical-align: top; width: 24px;
61
+ max-width: 24px; min-width: 24px; font-family: 'Outfit', Helvetica, Arial, sans-serif; color: #FFFFFE;
62
+ border-radius: 50%; font-size: 16px;" border="0">
63
+ <span style="font-weight: 600;">$$USER_NAME$$</span>
64
+ </div>
65
+ '''
66
+ view_message_html_item = '''
67
+ <td align="right" class="pr-text-dark" style="width: 100%">
68
+ <a href="$$VIEW_MESSAGE_URL$$" target="_blank"style="color: #3579F6; font-family: 'Outfit', Helvetica, Arial,
69
+ sans-serif; font-size: 14px; font-weight: 500; line-height: 20px; text-decoration: none;
70
+ display: inline-block;">View message <img alt="View message" src="{{ IMAGE_ARROW_BLUE.src }}" width="16"
71
+ height="16" style="display: inline-block; vertical-align: middle; width: 16px; max-width: 16px;
72
+ min-width: 16px; margin: 0 -1px 4px 7px" border="0"></a>
73
+ </td>'''
74
+
75
+ unread_message_html_item = '''
76
+ <tr>
77
+ <td bgcolor="#FFFFFE" align="left" style="padding-top: 16px;"
78
+ class="pr-bg-dark pr-text-dark">
79
+ <table role="presentation" width="100%" border="0" cellspacing="0" cellpadding="0">
80
+ <tr>
81
+ <td bgcolor="#FFFFFE" align="left"
82
+ class="pr-bg-dark pr-text-dark"
83
+ style="color: #262730; font-family: 'Outfit', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 20px;">
84
+ <table role="presentation" border="0" cellspacing="0" cellpadding="0"
85
+ style="border-collapse: separate !important;">
86
+ <tr>
87
+ <td align="center" bgcolor="#FFFFFE" style="border-radius: 50% !important;">
88
+ <img alt="Lead Photo" src="$$USER_IMAGE$$" width="24"
89
+ height="24"
90
+ style="display: inline-block; vertical-align: middle; width: 24px; max-width: 24px; min-width: 24px; font-family: 'Outfit', Helvetica, Arial, sans-serif; color: #FFFFFE; border-radius: 50%; font-size: 16px;"
91
+ border="0">
92
+ </td>
93
+ <td align="center"
94
+ class="pr-text-dark"
95
+ style="white-space: nowrap; color: #262730; font-family: 'Outfit', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 600; line-height: 20px; padding-left: 4px">
96
+ $$USER_NAME$$
97
+ </td>
98
+ $$VIEW_MESSAGE_BUTTON$$
99
+ </tr>
100
+ </table>
101
+ </td>
102
+ </tr>
103
+
104
+ <tr>
105
+ <td align="left" style="padding-top: 8px">
106
+ <table role="presentation" border="0" cellspacing="0" cellpadding="0"
107
+ style="border-collapse: separate !important;">
108
+ <tr>
109
+ <td align="left" bgcolor="#F6F6F8"
110
+ class="sec-bg-dark pr-text-dark"
111
+ style="color: #262730; font-family: 'Outfit', Helvetica, Arial, sans-serif; font-size: 14px; font-weight: 400; line-height: 20px; padding: 12px; border-radius: 0 12px 12px 12px; background-color: #F6F6F8">
112
+ $$MESSAGE_TEXT$$
113
+ </td>
114
+ </tr>
115
+ </table>
116
+ </td>
117
+ </tr>
118
+ </table>
119
+ </td>
120
+ </tr>
121
+ '''
122
+
55
123
  @staticmethod
56
124
  def get_button_name() -> str:
57
- return 'View message'
125
+ return 'Go to Chat'
58
126
 
59
127
  @staticmethod
60
128
  def get_button_url(sender_id: str, source_id: str) -> str:
@@ -67,19 +135,38 @@ class IncomingMessageNotification(Notification):
67
135
  return 'Unread messages from your lead'
68
136
  return 'Unread message from your lead'
69
137
 
70
- def get_notification_text(self, users: list):
71
- if self.type == NotificationType.INSTANTLY:
72
- return f'{users[-1]} has just sent you a message.'
73
- elif self.type == NotificationType.UNREAD_FOR_FEW_MINUTES:
74
- return f'{users[-1]} sent you a message {self.minute} minutes ago.'
75
- elif (self.type == NotificationType.ONCE_A_DAY or self.type == NotificationType.ONCE_A_WEEK) and users:
76
- match len(users):
77
- case 1:
78
- return f'You have unread message(s) from {users[0]}.'
79
- case 2 | 3:
80
- return f'You have unread messages from {", ".join(users)}.'
81
- case _:
82
- return f'You have unread messages from {", ".join(users[:3])} and other leads.'
138
+ def create_title(self, user_ids: list[str], users: list):
139
+ title = ""
140
+ for user_id in user_ids[:3]:
141
+ user = [user for user in users if user_id == user['sender_id']][0]
142
+ photo = user.get('images', {}).get('image_72', '{{ IMAGE_PERSON.src }}')
143
+ item = self.name_html_item.replace('$$USER_NAME$$', user['real_name'])
144
+ item = item.replace('$$USER_IMAGE$$', photo)
145
+ title += item
146
+
147
+ if len(user_ids) > 3:
148
+ title += self.other_leads_text
149
+
150
+ return f"You have unread messages from {title}" if len(users) > 1 else f"You have unread message from {title}"
151
+
152
+ def create_unread_messages_list(self, messages: list):
153
+ unread_messages = ""
154
+ for message in messages[:3]:
155
+ name = message['user']['real_name']
156
+ photo = message['user'].get('images', {}).get('image_72', '{{ IMAGE_PERSON.src }}')
157
+ item = self.unread_message_html_item.replace('$$USER_NAME$$', name)
158
+ item = item.replace('$$USER_IMAGE$$', photo)
159
+ item = item.replace('$$MESSAGE_TEXT$$', message['text'])
160
+ view_message_button = ""
161
+ if len(messages) > 1:
162
+ view_message_button = (
163
+ self.view_message_html_item.replace('$$VIEW_MESSAGE_URL$$',
164
+ self.get_button_url(message['sender_id'],
165
+ message['bot']['source']['source_id'])))
166
+ item = item.replace('$$VIEW_MESSAGE_BUTTON$$', view_message_button)
167
+
168
+ unread_messages += item
169
+ return unread_messages
83
170
 
84
171
 
85
172
  class InboxNotification(Notification):
@@ -1340,7 +1340,15 @@ class ChatRepository(BaseMongoRepository):
1340
1340
  }
1341
1341
  },
1342
1342
  {
1343
- '$addFields': {'user': {'$first': '$user'}}
1343
+ '$lookup': {
1344
+ 'from': 'dedicated_bots',
1345
+ 'localField': 'bot_id',
1346
+ 'foreignField': '_id',
1347
+ 'as': 'bot'
1348
+ }
1349
+ },
1350
+ {
1351
+ '$addFields': {'user': {'$first': '$user'}, 'bot': {'$first': '$bot'}}
1344
1352
  },
1345
1353
  {
1346
1354
  '$sort': {sort_by: 1}