TwilioDevEd / message-segment-calculator

JS-based tool to calculate and display message segmentation data for a given message body
https://twiliodeved.github.io/message-segment-calculator/
MIT License
89 stars 35 forks source link

Create a library for the segment calculator #8

Closed vernig closed 3 years ago

vernig commented 3 years ago

The aim of this PR is to convert the implementation into a nodeJS package that can be integrated in server side script. This can be used to check the number of segments before sending the message, in order to contain costs.

This PR includes:

Fix #7

vernig commented 3 years ago

@HugoCrd this is a first draft of the implementation. I added a minimal README to document the main class.

I like the idea of the getIncompatibleEncodingCharacters method, but I'll probably add it to a different PR. I want to use this one to get to a features parity with the previous implementation, which will make merging it easier.

It'd be good if you could have a look at this and let me know what you think.

HugoCrd commented 3 years ago

That's great! I love that you could divide the lib into simpler TS classes. Way easier to read.

@vernig yes getIncompatibleEncodingCharacters is very handy on our side, it helps our customers understand why they're suddenly using 3 segments instead of 1. I totally get why you'd like to add that later on though.

vernig commented 3 years ago

Thanks @HugoCrd @micaswyers. I merged the PR. I'll work to publish the package on npm as well as adding the getIncompatibleEncodingCharacters and the Twilio Smart Encoding option.