@tiledesk/tiledesk-server 2.3.1 → 2.3.4

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.
@@ -0,0 +1,236 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang="en" xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
3
+
4
+ <head>
5
+ <meta name="viewport" content="width=device-width" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
7
+ <title>New Ticket from TileDesk</title>
8
+
9
+ <style type="text/css">
10
+ img {
11
+ max-width: 100%;
12
+ margin-left:16px;
13
+ margin-bottom:16px;
14
+ text-align:center !important;
15
+ }
16
+ body {
17
+ -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em;
18
+ }
19
+ body {
20
+ background-color: #f6f6f6;
21
+ }
22
+
23
+ @media only screen and (max-width: 640px) {
24
+ body {
25
+ padding: 0 !important;
26
+ }
27
+ h1 {
28
+ font-weight: 800 !important; margin: 20px 0 5px !important;
29
+ text-align:center !important;
30
+ }
31
+ h2 {
32
+ font-weight: 800 !important; margin: 20px 0 5px !important;
33
+ }
34
+ h3 {
35
+ font-weight: 800 !important; margin: 20px 0 5px !important;
36
+ }
37
+ h4 {
38
+ font-weight: 800 !important; margin: 20px 0 5px !important;
39
+ }
40
+ h1 {
41
+ font-size: 22px !important;
42
+ }
43
+ h2 {
44
+ font-size: 18px !important;
45
+ }
46
+ h3 {
47
+ font-size: 16px !important;
48
+ }
49
+ .container {
50
+ padding: 0 !important; width: 100% !important;
51
+ }
52
+ .content {
53
+ padding: 0 !important;
54
+ }
55
+ .content-wrap {
56
+ padding: 10px !important;
57
+ }
58
+ .invoice {
59
+ width: 100% !important;
60
+ }
61
+ }
62
+ </style>
63
+ </head>
64
+
65
+ <body itemscope itemtype="http://schema.org/EmailMessage" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; line-height: 1.6em; background-color: #f6f6f6; margin: 0;" bgcolor="#f6f6f6">
66
+
67
+ {{#if baseScope.replyEnabled}}
68
+ <div>\# Please type your reply above this line \#</div>
69
+ {{/if}}
70
+
71
+ <table class="main" width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; border-radius: 3px; background-color: #fff; margin: 0; border: 1px solid #e9e9e9;" bgcolor="#fff">
72
+
73
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
74
+ <td class="alert alert-warning" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; margin: 0;" align="center" valign="top">
75
+
76
+ <div style="text-align:center">
77
+ <a href="http://www.tiledesk.com" style="color:#2daae1;font-weight:bold;text-decoration:none;word-break:break-word" target="_blank">
78
+ <img src="https://tiledesk.com/wp-content/uploads/2022/07/tiledesk_v2.png" style="width:20%;outline:none;text-decoration:none;border:none;min-height:36px" class="CToWUd">
79
+ </a>
80
+ </div>
81
+ </td>
82
+ </tr>
83
+
84
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
85
+
86
+ <td class="alert alert-warning" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 16px; vertical-align: top; font-weight: 500; text-align: center; border-radius: 3px 3px 0 0; margin: 0;" align="center" valign="top">
87
+ <div>
88
+ <h2>You are a follower of the ticket number: #{{message.request.ticket_id}}</h2>
89
+ </div>
90
+
91
+ </td>
92
+ </tr>
93
+
94
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
95
+ <td class="content-wrap" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 20px;" valign="top">
96
+ <table width="100%" cellpadding="0" cellspacing="0" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
97
+
98
+
99
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
100
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
101
+ Sender: <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{message.senderFullname}}</strong>
102
+ </td>
103
+ </tr>
104
+
105
+
106
+
107
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
108
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
109
+ {{#ifEquals message.type "text"}}
110
+ <div style="white-space: pre-wrap;">{{{msgText}}}</div>
111
+ {{/ifEquals}}
112
+ {{#ifEquals message.type "image"}}
113
+ <img src="{{message.metadata.src}}"/>
114
+ {{#if msgText}}
115
+ <div style="white-space: pre-wrap;">{{{msgText}}}</div>
116
+ {{/if}}
117
+ {{/ifEquals}}
118
+ {{#ifEquals message.type "file"}}
119
+ <a href="{{message.metadata.src}}">{{message.metadata.name}}</a>
120
+ {{/ifEquals}}
121
+ {{#ifEquals message.type "frame"}}
122
+ <a href="{{message.metadata.src}}">{{message.metadata.name}}</a>
123
+ {{#if msgText}}
124
+ <div style="white-space: pre-wrap;">{{{msgText}}}</div>
125
+ {{/if}}
126
+ {{/ifEquals}}
127
+
128
+ {{#if message.attributes}}
129
+ {{#if message.attributes.attachment}}
130
+ {{#if message.attributes.attachment.buttons}}
131
+ {{#each message.attributes.attachment.buttons}}
132
+ {{#ifEquals this.type "url"}}
133
+ <li><a href="{{this.link}}" class="dynamic_button">{{this.value}}</a></li>
134
+ {{else}}
135
+ <li><a href="mailto:{{../message.request.request_id}}@{{../baseScope.inboundDomain}}?subject=Re:%20{{../message.request.subject}}&body={{this.value}}" class="dynamic_button">{{this.value}}</a></li>
136
+ {{/ifEquals}}
137
+ {{/each}}
138
+
139
+
140
+ {{/if}}
141
+ {{/if}}
142
+ {{/if}}
143
+
144
+ <!-- {{#if message.attributes.intent_info}}
145
+ {{#if message.attributes.intent_info.others}}
146
+ Others:
147
+ {{#each message.attributes.intent_info.others}}
148
+ <li><span>{{this.answer}}</span></li>
149
+ {{/each}}
150
+ {{/if}}
151
+ {{/if}} -->
152
+
153
+
154
+
155
+
156
+
157
+ </td>
158
+ </tr>
159
+
160
+
161
+
162
+
163
+
164
+
165
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
166
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
167
+ Project name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{project.name}}</strong>
168
+ </td>
169
+ </tr>
170
+
171
+
172
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
173
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
174
+ Department name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{message.request.department.name}}</strong>
175
+ </td>
176
+ </tr>
177
+
178
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
179
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
180
+ Source page : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{message.request.sourcePage}}</strong>
181
+ </td>
182
+ </tr>
183
+
184
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
185
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
186
+ Contact name : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{message.request.lead.fullname}}</strong>
187
+ </td>
188
+ </tr>
189
+
190
+
191
+
192
+
193
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
194
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
195
+ Channel : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
196
+
197
+ {{#ifEquals message.request.channel.name "chat21"}}
198
+ Chat
199
+ {{else}}
200
+ {{message.request.channel.name}}
201
+ {{/ifEquals}}
202
+
203
+
204
+ </strong>
205
+ </td>
206
+ </tr>
207
+
208
+
209
+
210
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
211
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
212
+ Priority : <strong style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">{{message.request.priority}}</strong>
213
+ </td>
214
+ </tr>
215
+
216
+
217
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
218
+ <td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
219
+ </td>
220
+ </tr>
221
+ </table>
222
+ </td>
223
+ </tr>
224
+ </table>
225
+ <div class="footer" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; width: 100%; clear: both; color: #999; margin: 0; padding: 20px;">
226
+ <table width="100%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
227
+ <tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
228
+ <td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0; padding: 0 0 20px;" align="center" valign="top">
229
+ <span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
230
+ <!-- <br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span> -->
231
+ </td>
232
+ </tr>
233
+ </table>
234
+
235
+ </body>
236
+ </html>
@@ -720,6 +720,75 @@ it('createWithPriority', function (done) {
720
720
 
721
721
 
722
722
 
723
+
724
+ // mocha test/messageRoute.js --grep 'createSimpleWithFollowers'
725
+
726
+ it('createSimpleWithFollowers', function (done) {
727
+ // this.timeout(10000);
728
+
729
+ var email = "test-message-create-" + Date.now() + "@email.com";
730
+ var pwd = "pwd";
731
+
732
+ userService.signup( email ,pwd, "Test Firstname", "Test lastname").then(function(savedUser) {
733
+ projectService.createAndReturnProjectAndProjectUser("message-create", savedUser._id).then(function(savedProjectAndPU) {
734
+
735
+ var savedProject = savedProjectAndPU.project;
736
+
737
+ chai.request(server)
738
+ .post('/'+ savedProject._id + '/requests/req123-createSimpleWithFollowers/messages')
739
+ .auth(email, pwd)
740
+ .set('content-type', 'application/json')
741
+ .send({"text":"text", "followers": [savedProjectAndPU.project_user._id.toString()]})
742
+ .end(function(err, res) {
743
+ //console.log("res", res);
744
+ console.log("res.body", JSON.stringify(res.body));
745
+ res.should.have.status(200);
746
+ res.body.should.be.a('object');
747
+
748
+ expect(res.body.sender).to.equal(savedUser._id.toString());
749
+ // expect(res.body.sender).to.equal(savedProjectAndPU.project_user._id.toString());
750
+ // expect(res.body.senderFullname).to.equal("senderFullname");
751
+ expect(res.body.recipient).to.equal("req123-createSimpleWithFollowers");
752
+ expect(res.body.text).to.equal("text");
753
+ expect(res.body.id_project).to.equal(savedProject._id.toString());
754
+ expect(res.body.createdBy).to.equal(savedUser._id.toString());
755
+ expect(res.body.status).to.equal(0);
756
+
757
+ expect(res.body.request.request_id).to.equal("req123-createSimpleWithFollowers");
758
+ expect(res.body.request.requester._id).to.equal(savedProjectAndPU.project_user._id.toString());
759
+ // expect(res.body.request.requester_id).to.equal("sender");
760
+ expect(res.body.request.first_text).to.equal("text");
761
+ expect(res.body.request.id_project).to.equal(savedProject._id.toString());
762
+ expect(res.body.request.createdBy).to.equal(savedUser._id.toString());
763
+
764
+ // expect(res.body.request.messages_count).to.equal(1);
765
+
766
+ expect(res.body.request.status).to.equal(200);
767
+ expect(res.body.request.snapshot.agents.length).to.equal(1);
768
+ expect(res.body.request.participants.length).to.equal(1);
769
+ expect(res.body.request.department).to.not.equal(null);
770
+ expect(res.body.request.lead).to.not.equal(null);
771
+
772
+ expect(res.body.channel_type).to.equal("group");
773
+ expect(res.body.channel.name).to.equal("chat21");
774
+ expect(res.body.request.channel.name).to.equal("chat21");
775
+
776
+
777
+ expect(res.body.request.location).to.equal(undefined);
778
+
779
+ expect(res.body.request.followers[0]).to.equal(savedProjectAndPU.project_user._id.toString());
780
+
781
+
782
+ done();
783
+ });
784
+ });
785
+ });
786
+ });
787
+
788
+
789
+
790
+
791
+
723
792
  it('getall', function (done) {
724
793
  // this.timeout(10000);
725
794
 
@@ -686,13 +686,15 @@ describe('RequestService', function () {
686
686
  savedProject._id, "5badfe5d553d1844ad654072"),
687
687
  messageService.create("5badfe5d553d1844ad654072", "test sender", savedRequest.request_id, "hello2",
688
688
  savedProject._id, "5badfe5d553d1844ad654072")]).then(function(all) {
689
- requestService.closeRequestByRequestId(savedRequest.request_id, savedProject._id).then(function(closedRequest) {
689
+ // closeRequestByRequestId(request_id, id_project, skipStatsUpdate, notify, closed_by)
690
+ requestService.closeRequestByRequestId(savedRequest.request_id, savedProject._id, false, true, "user1").then(function(closedRequest) {
690
691
  winston.debug("resolve closedRequest", closedRequest.toObject());
691
692
  expect(closedRequest.status).to.equal(1000);
692
693
  expect(closedRequest.closed_at).to.not.equal(null);
693
694
  expect(closedRequest.transcript).to.contains("hello1");
694
695
  expect(closedRequest.transcript).to.contains("hello2");
695
696
  expect(closedRequest.snapshot.agents).to.equal(undefined);
697
+ expect(closedRequest.closed_by).to.equal("user1");
696
698
 
697
699
  done();
698
700
  }).catch(function(err){
@@ -10,7 +10,7 @@ block content
10
10
 
11
11
  each message in messages
12
12
  p(class="transcript-p")
13
- span(class="transcript-chat-date") [#{message.createdAt.toLocaleString('it', { timeZone: 'UTC' })}]
13
+ span(class="transcript-chat-date") [#{message.createdAt.toLocaleString('en', { timeZone: 'UTC' })}]
14
14
  span(class="transcript-chat-sender") #{message.senderFullname}:
15
15
  span(class="transcript-chat-msg") #{message.text}
16
16
 
@@ -1,11 +0,0 @@
1
- const EventEmitter = require('events');
2
-
3
- class SubscriptionEvent extends EventEmitter {}
4
- var winston = require('../config/winston');
5
-
6
-
7
- const subscriptionEvent = new SubscriptionEvent();
8
-
9
-
10
-
11
- module.exports = subscriptionEvent;