Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mass SMS crud #1005

Open
wants to merge 26 commits into
base: feature/mass-sms
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1b3c3fe
Add Sms Distributions section
stefanfisk Apr 13, 2019
c7712e2
Implement AddSmsDistributionPane
stefanfisk Apr 13, 2019
e49691b
Make SmsDistributionList prettier and sortable
stefanfisk Apr 13, 2019
13ea760
Add draft content for SmsDistributionPane
stefanfisk Apr 13, 2019
42a0323
Implement SmsDistributionTargetsPane
stefanfisk Apr 13, 2019
90878fa
Add confirm content for SmsDistributionPane
stefanfisk Apr 13, 2019
d6fa73b
Implement SmsDistributionMessagesPane
stefanfisk Apr 13, 2019
117dda9
Add sending content for SmsDistributionPane
stefanfisk Apr 14, 2019
c6ddaa8
Add sent content for SmsDistributionPane
stefanfisk Apr 14, 2019
c931bd4
Fix autorefresh and message sorting
stefanfisk Apr 14, 2019
a485785
Implement EditSmsDistributionPane
stefanfisk Apr 14, 2019
511423c
Add message split info to SmsDistributionForm
stefanfisk Apr 14, 2019
1adac8d
Add sender value cleaning to SmsDistributionForm
stefanfisk Apr 14, 2019
3ef09f1
Add credit amount to SmsDistributionPane
stefanfisk Apr 14, 2019
9089c71
Make SmsDistributionPane title show state
stefanfisk Apr 14, 2019
472a04d
Disable SMS Distribution confirm button when there is nothing to send
stefanfisk Apr 14, 2019
5063ce3
Add credits info to SmsDistributionPane
stefanfisk Apr 16, 2019
5842ba4
Add purchase credits button to SmsDistributionPane
stefanfisk Apr 16, 2019
c920182
Add PurchaseSmsDistributionCreditsPane
stefanfisk Apr 16, 2019
7d8070f
Add SMS Credits pane placeholder
stefanfisk Apr 17, 2019
026c7e5
Add available credits to SmsDistributionCreditsPane
stefanfisk Apr 17, 2019
98e7b22
Add about to SmsDistributionCreditsPane
stefanfisk Apr 17, 2019
4a29e4a
Add purchase history to SmsDistributionCreditsPane
stefanfisk Apr 17, 2019
7867a28
Add balance history to SmsDistributionCreditsPane
stefanfisk Apr 23, 2019
ca22ae2
Add SmsDistributionCreditTransactionsPane
stefanfisk Apr 24, 2019
cdb71ff
Add SmsDistributionCreditTransactionPane
stefanfisk Apr 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions locale/forms/smsDistribution/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
message: Message
messageInput:
length: '{ length } Characters'
partCount: '{ partCount } Parts'
remainingInPart: '{ remainingInPart } Characters Remaining in Part'
unicodeWarning: If you use emojis, you will have a lot fever characters per message part.
sender: Sender
title: Title
7 changes: 7 additions & 0 deletions locale/lists/smsDistributionCreditTransactionList/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
header:
created: Date
amount: Amount
balance: Balance
item:
amount: '{ amount }'
balance: '{ balance }'
10 changes: 10 additions & 0 deletions locale/lists/smsDistributionList/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
header:
title: Title
sent: Sent
state: State
item:
state:
draft: Draft
confirm: Confirm
sending: Sending
sent: Sent
12 changes: 12 additions & 0 deletions locale/lists/smsDistributionMessageList/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error:
country_not_whitelisted: Messages cannot be sent to this country.
gateway_error: The message failed to send.
invalid_format: The phone number format is not valid.
not_mobile: The person has no mobile number.
no_phone_number: The person has no phone number.
timeout: The message took to long to send.
header:
email: E-mail
firstName: First name
lastName: Last name
phone: Phone number
2 changes: 2 additions & 0 deletions locale/panes/addSmsDistribution/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
saveButton: Save Distribution
title: Create Distribution
1 change: 1 addition & 0 deletions locale/panes/allSmsDistributions/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addButton: Add distribution
1 change: 1 addition & 0 deletions locale/panes/editQuery/da.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ saveButton: Gem søgningen
title:
callassignment_goal: Rediger søgning på målsætning
callassignment_target: Rediger søgning på målgruppe
smsdistribution_target: Rediger søgning på modtagere
standalone: Rediger smartsøgning
1 change: 1 addition & 0 deletions locale/panes/editQuery/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ saveButton: Save query
title:
callassignment_goal: Edit goal query
callassignment_target: Edit target query
smsdistribution_target: Edit target query
standalone: Edit smart search query
1 change: 1 addition & 0 deletions locale/panes/editQuery/sv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ saveButton: Spara sökfråga
title:
callassignment_goal: Redigera syftessökning
callassignment_target: Redigera målgruppssökning
smsdistribution_target: Redigera mottagarsökning
standalone: Redigera smart sökning
4 changes: 4 additions & 0 deletions locale/panes/editSmsDistribution/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
notDraft: Cannot edit non-draft distributions.
pendingTitle: Edit SMS Distribution
saveButton: Save
title: 'Edit: { title }'
21 changes: 21 additions & 0 deletions locale/panes/purchaseSmsDistributionCredits/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
amountLabel: Amount
cardNumberLabel: Card Number
checkoutButton: Checkout
checkoutCost: '{ cost } SEK'
cost: '{ amount } SEK'
costLabel: Cost
cvcLabel: CVC
expiryLabel: Expiry Date
done:
cost: '{ cost } SEK'
credits: '{ credits } Credits'
receipt: View Receipt
nameLabel: Cardholder Name
payButton: Pay
tierUnitPrice: '{ unitPrice } SEK / credit'
tiersTitle: Price Tiers
title:
cart: Purchase Credits
checkout: Payment Details
done: Payment Confirmation
toFewCredits: 'You must purchase at least { minCredits } credits.'
34 changes: 34 additions & 0 deletions locale/panes/smsDistribution/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
confirmButton: Confirm
credits:
amount: 'Cost: { amount } credits'
estimated_amount: 'Estimated Cost: { amount } credits'
h: Credits
reserved_amount: 'Reserved Cost: { amount } credits'
creditsInfo:
content: '{ amount } / { availableCredits } available'
title: Estimated credits to be used
warning: There are not enough available credits to send the message.
editLink: Edit
editTargetQueryLink: Edit Target Query
messages: Messages
showTargetsLink: Show Targets
purchaseCreditsButton: Purchase Credits
revertToDraftButton: Revert to Draft
sendButton: Send
showMessagesLink: Show Messages
stats:
num_target_matches: '{ num_target_matches } Targets'
num_messages: '{ num_messages } Messages'
num_failed_messages: '{ num_failed_messages } Failed'
num_confirm_messages: '{ num_confirm_messages } To Confirm'
num_confirmed_messages: '{ num_confirm_messages } To Send'
num_created_messages: '{ num_created_messages } Created'
num_sent_messages: '{ num_sent_messages } Sent'
num_delivered_messages: '{ num_delivered_messages } Delivered'
targets: Targets
target_matches_have_changed: The target query's matches have changed since confirming
title:
draft: '{ title }'
confirm: 'Confirm "{ title }"'
sending: 'Sending "{ title }"'
sent: 'Sent "{ title }"'
8 changes: 8 additions & 0 deletions locale/panes/smsDistributionCreditTransaction/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
amount: '{ amount } Credits'
purchase:
chargeAmount: '{ chargeAmount } SEK'
receipt: View Receipt
title:
distribution: Distribution
manual: Manual
purchase: Purchase
3 changes: 3 additions & 0 deletions locale/panes/smsDistributionCreditTransactions/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
title:
all: Transaction History
purchase: Purchase History
18 changes: 18 additions & 0 deletions locale/panes/smsDistributionCredits/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
about:
content: 'This is a brief description of what the credits are all about. You can read more about them on our { readMoreLink }.'
contentReadMoreLink: our site
readMoreLink: Read More
readMoreUrl: http://example.com/
title: About
availableCredits:
credits: '{ credits }'
purchaseButton: Purchase Credits
title: Available Credits
balanceHistory:
title: Credit Balance History
viewAllLink: View full history
purchaseHistory:
title: Purchase History
costThisYear: '{ cost } SEK this year'
countThisYear: '{ count } purchases'
viewAllLink: View full history
5 changes: 5 additions & 0 deletions locale/panes/smsDistributionMessages/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
delivered: Delivered
failed: Failed
queued: Queued
sent: Sent
title: Distribution Messages
1 change: 1 addition & 0 deletions locale/panes/smsDistributionTargets/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: Distribution Targets
2 changes: 2 additions & 0 deletions locale/sections/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ subSections:
dialog:
assignments: Assignments
calls: Call log
sms-distributions: SMS Distributions
sms-distribution-credits: SMS Distribution Credits
maps:
locations: Locations
overview: Overview
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@
"react-intl-redux": "^0.1.0",
"react-redux": "^4.4.5",
"react-rte": "^0.11.0",
"react-stripe-elements": "^2.0.3",
"recursive-readdir": "^2.1.0",
"redux": "^3.5.2",
"redux-batched-subscribe": "^0.1.6",
"redux-promise-middleware": "^3.0.0",
"reselect": "^3.0.1",
"run-sequence": "^1.0.2",
"scroll": "^2.0.0",
"split-sms": "^0.1.7",
"sugar-date": "^2.0.4",
"webpack": "^2.2.1",
"worker-loader": "^0.8.1",
Expand Down
18 changes: 18 additions & 0 deletions src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,21 @@ export const TOGGLE_ACTION_IMPORT_ROW = 'TOGGLE_ACTION_IMPORT_ROW';
export const SET_ACTION_IMPORT_MAPPING = 'SET_ACTION_IMPORT_MAPPING';
export const EXECUTE_ACTION_IMPORT = 'EXECUTE_ACTION_IMPORT';
export const RESET_ACTION_IMPORT = 'RESET_ACTION_IMPORT';

// Flux actions related to SMS distributions
export const CREATE_SMS_DISTRIBUTION = 'CREATE_SMS_DISTRIBUTION';
export const RETRIEVE_SMS_DISTRIBUTIONS = 'RETRIEVE_SMS_DISTRIBUTIONS';
export const RETRIEVE_SMS_DISTRIBUTION = 'RETRIEVE_SMS_DISTRIBUTION';
export const RETRIEVE_SMS_DISTRIBUTION_STATS = 'RETRIEVE_SMS_DISTRIBUTION_STATS';
export const RETRIEVE_SMS_DISTRIBUTION_TARGETS = 'RETRIEVE_SMS_DISTRIBUTION_TARGETS';
export const RETRIEVE_SMS_DISTRIBUTION_MESSAGES = 'RETRIEVE_SMS_DISTRIBUTION_MESSAGES';
export const UPDATE_SMS_DISTRIBUTION = 'UPDATE_SMS_DISTRIBUTION';
export const RETRIEVE_SMS_DISTRIBUTION_CREDITS = 'RETRIEVE_SMS_DISTRIBUTION_CREDITS';
export const BEGIN_SMS_DISTRIBUTION_CREDIT_PURCHASE = 'BEGIN_SMS_DISTRIBUTION_CREDIT_PURCHASE';
export const COMPLETE_SMS_DISTRIBUTION_CREDIT_PURCHASE = 'COMPLETE_SMS_DISTRIBUTION_CREDIT_PURCHASE';
export const END_SMS_DISTRIBUTION_CREDIT_PURCHASE = 'END_SMS_DISTRIBUTION_CREDIT_PURCHASE';
export const RETRIEVE_SMS_DISTRIBUTION_CREDIT_TRANSACTIONS = 'RETRIEVE_SMS_DISTRIBUTION_CREDIT_TRANSACTIONS';
export const RETRIEVE_SMS_DISTRIBUTION_CREDIT_TRANSACTION = 'RETRIEVE_SMS_DISTRIBUTION_CREDIT_TRANSACTION';

// Flux actions related to payments
export const INIT_PAYMENTS = 'INIT_PAYMENTS';
39 changes: 39 additions & 0 deletions src/actions/payments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import * as types from '.';

export function initPayments() {
return ({ dispatch, getState, z }) => {
const state = getState().payments;

if (state.loading || state.loaded) {
return;
}

dispatch({
type: types.INIT_PAYMENTS,
payload: {
promise: Promise
.all([
new Promise((resolve, reject) => {
if (window.Stripe) {
resolve();
return;
}

const script = document.createElement('script');
script.src = 'https://js.stripe.com/v3/';
script.async = true;
script.onload = resolve;
script.onerror =reject;

document.body.appendChild(script);
}),
z.resource('payments', 'client_config').get()
])
.then(([event, config]) => ({
config: config.data.data,
stripe: window.Stripe(config.data.data.stripe.publishableKey),
})),
}
});
};
}
Loading