wco_email 0.1.1.134 → 0.1.1.136

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e6b7dac9980a5018f3dccc039ec411f19d7b75284a8f36078c9e563e7e055fb
4
- data.tar.gz: f763407aed6f02c0b81eee67c3faffe961de1564c2f9d547df2c7f540d5b27dd
3
+ metadata.gz: c920c0ce8ae8d6be19d6082a242f6d9d61ede4b85bfcdca7a680cca133abcf49
4
+ data.tar.gz: 3cf6dbdf328d8b996ed111df5ad3e7880b4704439ac5be41783d36e4dcd17185
5
5
  SHA512:
6
- metadata.gz: 11eec479d06ce632681aab082ef793ef13664ef69319e6235ed88b9b83a7e2f21372fdb84b0da7e791b5a51a494f69cb5071addebf6096ad05d962bdf0bfee17
7
- data.tar.gz: 01e48d9030c260fa5e882cbc5eaa13e94d1956cd0ed2b5f8355102a0177242ba3827ab9cc92942a82993622737c132eb9f4651dcda7d1c74621a663d3fe5313e
6
+ metadata.gz: 41f0243a85a81ca840c9c20d8926e84fe02cdc3b6fad8218c6ea0145e50538fe157e55a9491d9fda3fa9a425c65d52e3330299c9fe4435fdbc453f6abd3ccee6
7
+ data.tar.gz: d323ddf5c01c912a42a2c272a949fdaadc2548e51a3f65a570ce2757bcb07d16c1313c68a096fa376a0fd6e633737a7499d025bfdfa8e081ea7ca739e8cda67b
@@ -16,5 +16,12 @@ $(document).ready(() => {
16
16
  })
17
17
  }
18
18
 
19
- logg('loaded wco_email/contexts.js')
19
+ $('.select2-leads-ajax').select2({
20
+ ajax: {
21
+ url: '/wco/api/leads',
22
+ dataType: 'json',
23
+ }
24
+ })
25
+
26
+ console.log('loaded wco_email/contexts.js')
20
27
  }) // END
@@ -1,6 +1,13 @@
1
1
 
2
2
  class WcoEmail::Api::ConversationsController < WcoEmail::ApiController
3
3
 
4
+ def destroy_many
5
+ authorize! :edit, WcoEmail::Conversation
6
+ @convs = WcoEmail::Conversation.find( params[:ids] )
7
+ @convs.each { |c| c.destroy! }
8
+ render json: { status: 'ok', message: 'probably ok' }
9
+ end
10
+
4
11
  def index
5
12
  authorize! :index, WcoEmail::Conversation
6
13
  @conversations, @messages, @tag = WcoEmail::Conversation.load_conversations_messages_tag_by_params_and_profile( params, current_profile )
@@ -3,6 +3,35 @@ class WcoEmail::MessagesController < WcoEmail::ApplicationController
3
3
 
4
4
  before_action :set_lists, except: %i| show_iframe |
5
5
 
6
+ def autorespond
7
+ @message = WcoEmail::Message.find params[:id]
8
+ authorize! :show, @message
9
+
10
+ task = 'You are an administrative assistant. Write a brief email response to the following email. exclude subject. exclude footer. exclude signature. format as <p></p> html paragraphs.'
11
+ content = @message.part_txt
12
+ outs = Wco::AiWriter.do_call(task, content)
13
+ puts! outs, 'outs'
14
+
15
+
16
+ @ctx = WcoEmail::Context.new({
17
+ bcc_self: true,
18
+ body: outs,
19
+ email_template: WcoEmail::EmailTemplate.blank,
20
+ from_email: @message.to,
21
+ lead: @message.lead,
22
+ reply_to_message_id: @message.id,
23
+ # send_at: Time.now,
24
+ subject: @message.subject,
25
+ })
26
+
27
+ if @ctx.save
28
+ flash_notice 'Saved.'
29
+ else
30
+ flash_alert @ctx
31
+ end
32
+ redirect_to request.referrer
33
+ end
34
+
6
35
  def show
7
36
  @client ||= Aws::S3::Client.new(::SES_S3_CREDENTIALS)
8
37
  @message = WcoEmail::Message.find params[:id]
@@ -22,7 +22,7 @@
22
22
  = f.check_box :bcc_self, checked: true
23
23
  .field
24
24
  %label To lead
25
- = f.select :lead_id, options_for_select( @leads_list, selected: ctx.lead_id ), {}, { class: 'select2' }
25
+ = f.select :lead_id, options_for_select( @leads_list, selected: ctx.lead_id ), {}, { class: 'select2-leads-ajax' }
26
26
  .field
27
27
  %label cc
28
28
  = f.text_field :cc, class: 'w-100'
@@ -16,6 +16,11 @@
16
16
  = render '/wco_email/conversations/tags_actions'
17
17
  = render '/wco/office_actions/actions'
18
18
 
19
+ .actions.d-flex
20
+ .a.mr-2= button_tag 'Delete', method: :delete, class: 'delete-btn', data: { url: '/email/api/conversations' }
21
+
22
+ = render 'wco/tags/actions', resource: 'WcoEmail::Conversation'
23
+
19
24
  = render '/wco/paginate', resource: @conversations, param_name: ::WcoEmail::Conversation::PAGE_PARAM_NAME
20
25
  = render '/wco_email/conversations/table', convs: @conversations
21
26
  = render '/wco/paginate', resource: @conversations, param_name: ::WcoEmail::Conversation::PAGE_PARAM_NAME
@@ -46,4 +46,5 @@
46
46
  = paginate @messages, param_name: :messages_page
47
47
 
48
48
  - msg = @messages.last
49
- = render '/wco_email/contexts/form_reply', lead_id: msg.lead_id, message: msg, ctx: WcoEmail::Context.new({ from_email: msg.to&.downcase, subject: msg.subject, email_template_id: ET.find_by( slug: 'blank').id })
49
+ = render '/wco_email/contexts/form_reply', lead_id: msg.lead_id, message: msg, ctx: WcoEmail::Context.new({ from_email: msg.to&.downcase, subject: msg.subject, email_template_id: ET.find_by( slug: 'blank').id })
50
+ = button_to 'autorespond', message_autorespond_path(msg), data: { confirm: 'Are you sure?' }
@@ -1,3 +1,5 @@
1
1
 
2
2
  STRIPE_PK = 'pk_test_qr1QPmSpLdBFt1F7itdWJOj3'
3
3
  STRIPE_SK = 'sk_test_ARuaXffdANoXLKAwUXDcp0v0'
4
+
5
+ OPENAI_API_KEY = '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'
data/config/routes.rb CHANGED
@@ -8,6 +8,7 @@ WcoEmail::Engine.routes.draw do
8
8
 
9
9
  get 'api/contexts/summary', to: '/wco_email/api/contexts#summary'
10
10
  get 'api/conversations', to: '/wco_email/api/conversations#index'
11
+ delete 'api/conversations', to: '/wco_email/api/conversations#destroy_many'
11
12
  get 'api/email_action_templates', to: '/wco_email/api/email_action_templates#index'
12
13
  get 'api/email_filters', to: '/wco_email/api/email_filters#index', defaults: { format: :json }
13
14
  get 'api/email_filters/:id', to: '/wco_email/api/email_filters#show'
@@ -59,7 +60,8 @@ WcoEmail::Engine.routes.draw do
59
60
  resources :lead_action_templates
60
61
  resources :lead_actions
61
62
 
62
- get 'messages/:id/iframe', to: 'messages#show_iframe', as: :message_iframe
63
+ get 'messages/:id/iframe', to: 'messages#show_iframe', as: :message_iframe
64
+ post 'messages/:id/autorespond', to: 'messages#autorespond', as: :message_autorespond
63
65
  resources :messages
64
66
 
65
67
  post 'message_stub/:id/churn', to: 'message_stubs#churn', as: :churn_message_stub
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_email
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.134
4
+ version: 0.1.1.136
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-18 00:00:00.000000000 Z
11
+ date: 2026-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3