mirror of
https://github.com/bringout/oca-ocb-mail.git
synced 2026-04-20 07:42:00 +02:00
Initial commit: Mail packages
This commit is contained in:
commit
4e53507711
1948 changed files with 751201 additions and 0 deletions
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="70" height="70"><defs><path id="a" d="M4 0h61c4 0 5 1 5 5v60c0 4-1 5-5 5H4c-3 0-4-1-4-5V5c0-4 1-5 4-5z"/><linearGradient id="c" x1="100%" x2="0%" y1="0%" y2="100%"><stop offset="0%" stop-color="#94B6C8"/><stop offset="100%" stop-color="#6A9EBA"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><mask id="b" fill="#fff"><use xlink:href="#a"/></mask><g mask="url(#b)"><g><path fill="url(#c)" d="M0 0H70V70H0z"/><path fill="#FFF" fill-opacity=".383" d="M4 1h61c2.667 0 4.333.667 5 2V0H0v3c.667-1.333 2-2 4-2z"/></g><path fill="#000" fill-opacity=".383" d="M4 69h61c2.667 0 4.333-1 5-3v4H0v-4c.667 2 2 3 4 3z"/><path fill="#000" fill-opacity=".151" d="M3 69.6c-2 0-4-1-4-4.1V29.7l18.6-18.9L44.3 12v16.727l4.585-3.484 7.039.82-3.47 4.437 3.062 5L44.3 46.516v6.83L31.2 69.6H3z"/><path fill="#000" fill-opacity=".3" fill-rule="nonzero" d="M44.3 14c0-1.1-.9-2-2-2H19c-1.1 0-2 .9-2 2v40.6c0 1.1.9 2 2 2h23.3c1.1 0 2-.9 2-2v-10c-.7.5-1.5 1-2.3 1.4v5.3c0 .2-.1.3-.3.3H19.6c-.2 0-.3-.1-.3-.3v-33c0-.2.1-.3.3-.3h22.1c.2 0 .3.1.3.3v2.8c.5 0 1.1-.1 1.6-.1h.7v-7zM30.7 52.4c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5-1.5-.7-1.5-1.5.7-1.5 1.5-1.5zm3.1-35.9h-6.1c-.3 0-.5-.2-.5-.5s.2-.5.5-.5h6.1c.3 0 .5.2.5.5s-.3.5-.5.5z"/><path fill="#FFF" fill-rule="nonzero" d="M43.6 42.4c-.5 0-1.1 0-1.6-.1v7.1c0 .2-.1.3-.3.3H19.6c-.2 0-.3-.1-.3-.3v-33c0-.2.1-.3.3-.3h22.1c.2 0 .3.1.3.3v2.9c.5 0 1.1-.1 1.6-.1h.7V12c0-1.1-.9-2-2-2H19c-1.1 0-2 .9-2 2v40.7c0 1.1.9 2 2 2h23.3c1.1 0 2-.9 2-2V42.4h-.7zm-16-28.7h6.1c.3 0 .5.2.5.5s-.2.5-.4.5h-6.1c-.3 0-.5-.2-.5-.5s.1-.5.4-.5zm3.1 39.9c-.8 0-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5 1.5.7 1.5 1.5c0 .9-.7 1.5-1.5 1.5z"/><text fill="#000" fill-opacity=".3" font-family="IBMPlexMono-Bold, IBM Plex Mono" font-size="18" font-weight="bold" letter-spacing="-.215" transform="translate(17 10)"><tspan x="8.144" y="29">SMS</tspan></text><text fill="#FFF" font-family="IBMPlexMono-Bold, IBM Plex Mono" font-size="18" font-weight="bold" letter-spacing="-.215" transform="translate(17 10)"><tspan x="8.144" y="27">SMS</tspan></text></g></g></svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
|
@ -0,0 +1,73 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
import { SmsWidget } from "@sms/components/sms_widget/fields_sms_widget";
|
||||
|
||||
import { onWillStart } from "@odoo/owl";
|
||||
|
||||
const TEXT_URL_REGEX = /https?:\/\/[\w@:%.+&~#=/-]+(?:\?\S+)?/g; // from tools.mail.TEXT_URL_REGEX
|
||||
|
||||
/**
|
||||
* Patch to provide extra characters count information to
|
||||
* consider links converted with link_tracker and opt-out
|
||||
* link if the option is selected.
|
||||
*/
|
||||
patch(SmsWidget.prototype, 'sms_widget_mass_mailing', {
|
||||
setup() {
|
||||
this._super(...arguments);
|
||||
this.orm = useService("orm");
|
||||
this.optOutEnabled = false;
|
||||
this.noticeLinksReplaced = false;
|
||||
this.linkReplacementsPlaceholders = null;
|
||||
|
||||
onWillStart(async () => {
|
||||
if (this.props.record.resModel === "mailing.mailing") {
|
||||
const { unsubscribe, link } = await this.orm.call(
|
||||
'mailing.mailing',
|
||||
'get_sms_link_replacements_placeholders',
|
||||
[this.res_id],
|
||||
);
|
||||
this.linkReplacementsPlaceholders = { unsubscribe, link };
|
||||
this.noticeLinksReplaced = false;
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
get nbrCharExplanation() {
|
||||
if (this.optOutEnabled) {
|
||||
return this.noticeLinksReplaced
|
||||
? this.env._t(" (including link trackers and opt-out link) ")
|
||||
: this.env._t(" (including opt-out link) ");
|
||||
}
|
||||
return this.noticeLinksReplaced
|
||||
? this.env._t(" (including link trackers) ")
|
||||
: this._super.apply(this, arguments); // Also default when no linkReplacementsPlaceholders
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
get nbrChar() {
|
||||
let res = this._super(...arguments);
|
||||
if (this.props.record.data.sms_allow_unsubscribe) {
|
||||
this.optOutEnabled = true;
|
||||
res += this.linkReplacementsPlaceholders.unsubscribe.length;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_getValueForSmsCounts(value) {
|
||||
let res = this._super(...arguments);
|
||||
if (this.linkReplacementsPlaceholders) {
|
||||
const replaced = res.replaceAll(TEXT_URL_REGEX, this.linkReplacementsPlaceholders.link);
|
||||
this.noticeLinksReplaced = replaced !== res;
|
||||
return replaced;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue