@etainabl/nodejs-sdk 1.3.190 → 1.3.192
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.
- package/dist/esm/index.js +15 -53
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +15 -53
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -53,6 +53,9 @@ declare const wasteCategories: readonly [{
|
|
|
53
53
|
}, {
|
|
54
54
|
readonly name: "Meals Donated";
|
|
55
55
|
readonly type: "N/A";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "Cardboard";
|
|
58
|
+
readonly type: "Recyclable";
|
|
56
59
|
}];
|
|
57
60
|
declare const utilityTypes: readonly [{
|
|
58
61
|
readonly name: "Electricity";
|
|
@@ -1985,9 +1988,7 @@ declare const _default$3: (options: EmailTemplateOptions) => string;
|
|
|
1985
1988
|
interface NotificationEmailOptions {
|
|
1986
1989
|
title: string;
|
|
1987
1990
|
message: string;
|
|
1988
|
-
severity?: NotificationTemplateSeverity;
|
|
1989
1991
|
category?: string;
|
|
1990
|
-
userName?: string;
|
|
1991
1992
|
actions?: Array<{
|
|
1992
1993
|
label: string;
|
|
1993
1994
|
url?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,9 @@ declare const wasteCategories: readonly [{
|
|
|
53
53
|
}, {
|
|
54
54
|
readonly name: "Meals Donated";
|
|
55
55
|
readonly type: "N/A";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "Cardboard";
|
|
58
|
+
readonly type: "Recyclable";
|
|
56
59
|
}];
|
|
57
60
|
declare const utilityTypes: readonly [{
|
|
58
61
|
readonly name: "Electricity";
|
|
@@ -1985,9 +1988,7 @@ declare const _default$3: (options: EmailTemplateOptions) => string;
|
|
|
1985
1988
|
interface NotificationEmailOptions {
|
|
1986
1989
|
title: string;
|
|
1987
1990
|
message: string;
|
|
1988
|
-
severity?: NotificationTemplateSeverity;
|
|
1989
1991
|
category?: string;
|
|
1990
|
-
userName?: string;
|
|
1991
1992
|
actions?: Array<{
|
|
1992
1993
|
label: string;
|
|
1993
1994
|
url?: string;
|
package/dist/index.js
CHANGED
|
@@ -22858,39 +22858,11 @@ var emailTemplate_default = (options) => {
|
|
|
22858
22858
|
|
|
22859
22859
|
// src/notificationEmailTemplate.ts
|
|
22860
22860
|
var import_mjml = __toESM(require("mjml"), 1);
|
|
22861
|
-
var severityConfig = {
|
|
22862
|
-
error: {
|
|
22863
|
-
color: "#FFFFFF",
|
|
22864
|
-
bgColor: "#e04f1a",
|
|
22865
|
-
label: "ERROR"
|
|
22866
|
-
},
|
|
22867
|
-
success: {
|
|
22868
|
-
color: "#FFFFFF",
|
|
22869
|
-
bgColor: "#82b54b",
|
|
22870
|
-
label: "SUCCESS"
|
|
22871
|
-
},
|
|
22872
|
-
warning: {
|
|
22873
|
-
color: "#FFFFFF",
|
|
22874
|
-
bgColor: "#ff9f43",
|
|
22875
|
-
label: "WARNING"
|
|
22876
|
-
},
|
|
22877
|
-
tip: {
|
|
22878
|
-
color: "#FFFFFF",
|
|
22879
|
-
bgColor: "#00bad1",
|
|
22880
|
-
label: "TIP"
|
|
22881
|
-
},
|
|
22882
|
-
info: {
|
|
22883
|
-
color: "#FFFFFF",
|
|
22884
|
-
bgColor: "#5ECFB1",
|
|
22885
|
-
label: "INFO"
|
|
22886
|
-
}
|
|
22887
|
-
};
|
|
22888
22861
|
function generateNotificationEmail(options) {
|
|
22889
22862
|
if (!process.env.ETAINABL_UI_URL) {
|
|
22890
22863
|
throw new Error("ETAINABL_UI_URL environment variable is not set");
|
|
22891
22864
|
}
|
|
22892
|
-
const { title, message,
|
|
22893
|
-
const config = severityConfig[severity];
|
|
22865
|
+
const { title, message, category = "Notification", actions = [], metadata = {}, items = [] } = options;
|
|
22894
22866
|
const isSingleItem = items.length === 1;
|
|
22895
22867
|
const hasMultipleItems = items.length > 1;
|
|
22896
22868
|
const mainTitle = isSingleItem && items[0]?.message ? items[0].message : message;
|
|
@@ -22908,17 +22880,6 @@ function generateNotificationEmail(options) {
|
|
|
22908
22880
|
</mj-attributes>
|
|
22909
22881
|
|
|
22910
22882
|
<mj-style inline="inline">
|
|
22911
|
-
.severity-badge {
|
|
22912
|
-
display: inline-block;
|
|
22913
|
-
padding: 2px 6px;
|
|
22914
|
-
border-radius: 6px;
|
|
22915
|
-
font-size: 9px;
|
|
22916
|
-
font-weight: 600;
|
|
22917
|
-
letter-spacing: 0.5px;
|
|
22918
|
-
background-color: ${config.bgColor};
|
|
22919
|
-
color: ${config.color};
|
|
22920
|
-
}
|
|
22921
|
-
|
|
22922
22883
|
.metadata-table {
|
|
22923
22884
|
width: 100%;
|
|
22924
22885
|
border-collapse: collapse;
|
|
@@ -22963,15 +22924,10 @@ function generateNotificationEmail(options) {
|
|
|
22963
22924
|
<!-- Main Content Card -->
|
|
22964
22925
|
<mj-wrapper background-color="#FFFFFF" border-radius="8px" padding="0">
|
|
22965
22926
|
|
|
22966
|
-
<!--
|
|
22927
|
+
<!-- Category -->
|
|
22967
22928
|
<mj-section padding="32px 32px 20px 32px">
|
|
22968
|
-
<mj-column
|
|
22969
|
-
<mj-text padding="0"
|
|
22970
|
-
<span class="severity-badge">${config.label}</span>
|
|
22971
|
-
</mj-text>
|
|
22972
|
-
</mj-column>
|
|
22973
|
-
<mj-column width="50%">
|
|
22974
|
-
<mj-text padding="0" align="right" color="#6B7280" font-size="12px">
|
|
22929
|
+
<mj-column>
|
|
22930
|
+
<mj-text padding="0" color="#6B7280" font-size="12px">
|
|
22975
22931
|
${category}
|
|
22976
22932
|
</mj-text>
|
|
22977
22933
|
</mj-column>
|
|
@@ -23062,7 +23018,7 @@ function generateNotificationEmail(options) {
|
|
|
23062
23018
|
${actions.map(
|
|
23063
23019
|
(action) => `
|
|
23064
23020
|
<mj-button
|
|
23065
|
-
background-color="
|
|
23021
|
+
background-color="#65c198"
|
|
23066
23022
|
color="#FFFFFF"
|
|
23067
23023
|
border-radius="6px"
|
|
23068
23024
|
font-weight="600"
|
|
@@ -23089,7 +23045,7 @@ function generateNotificationEmail(options) {
|
|
|
23089
23045
|
font-weight="600"
|
|
23090
23046
|
font-size="14px"
|
|
23091
23047
|
padding="12px 24px"
|
|
23092
|
-
href="${process.env.ETAINABL_UI_URL}/
|
|
23048
|
+
href="${process.env.ETAINABL_UI_URL}/notifications/inbox"
|
|
23093
23049
|
align="center"
|
|
23094
23050
|
width="100%"
|
|
23095
23051
|
>
|
|
@@ -23125,7 +23081,7 @@ function generateNotificationEmail(options) {
|
|
|
23125
23081
|
<mj-column>
|
|
23126
23082
|
<mj-text align="center" font-size="12px" color="#6B7280" line-height="1.5">
|
|
23127
23083
|
This is an automated notification from Etainabl<br/>
|
|
23128
|
-
<a href="${process.env.ETAINABL_UI_URL}/
|
|
23084
|
+
<a href="${process.env.ETAINABL_UI_URL}/notifications/inbox" style="color: #5ECFB1; text-decoration: none;">Manage notification preferences</a>
|
|
23129
23085
|
</mj-text>
|
|
23130
23086
|
<mj-text align="center" font-size="11px" color="#9CA3AF" padding-top="16px">
|
|
23131
23087
|
\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} Etainabl Ltd. All rights reserved.
|
|
@@ -25361,7 +25317,8 @@ var wasteCategories = [
|
|
|
25361
25317
|
{ name: "Wood", type: "Recyclable" },
|
|
25362
25318
|
{ name: "Metal", type: "Recyclable" },
|
|
25363
25319
|
{ name: "Furniture", type: "Recyclable" },
|
|
25364
|
-
{ name: "Meals Donated", type: "N/A" }
|
|
25320
|
+
{ name: "Meals Donated", type: "N/A" },
|
|
25321
|
+
{ name: "Cardboard", type: "Recyclable" }
|
|
25365
25322
|
];
|
|
25366
25323
|
var utilityTypes = [
|
|
25367
25324
|
{ name: "Electricity", value: "electricity", icon: "fa-plug", color: "text-warning" },
|
|
@@ -25384,7 +25341,12 @@ var utilityTypes = [
|
|
|
25384
25341
|
{ name: "Other", value: "other", icon: "fa-meter", color: "text-muted" }
|
|
25385
25342
|
];
|
|
25386
25343
|
var units = [
|
|
25387
|
-
{
|
|
25344
|
+
{
|
|
25345
|
+
name: "kWh",
|
|
25346
|
+
value: "kwh",
|
|
25347
|
+
types: ["electricity", "gas", "solar", "heating", "cooling"],
|
|
25348
|
+
defaultTypes: ["electricity", "gas", "solar", "heating", "cooling"]
|
|
25349
|
+
},
|
|
25388
25350
|
{ name: "m3 (Cubic Meters)", value: "m3", types: ["gas", "water"], defaultTypes: ["water"] },
|
|
25389
25351
|
{ name: "hcf (Hundred Cubic Feet)", value: "hcf", types: ["gas"] },
|
|
25390
25352
|
{ name: "ft3 (Cubic Feet)", value: "ft3", types: ["gas"] },
|