nextemos 4.3.3 → 4.3.5

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.
@@ -10,4 +10,5 @@ export declare const Service: {
10
10
  Localization: import("..").ILocalizationService;
11
11
  Environment: import("./environment/environment.types").IEnvironmentService;
12
12
  Keycloak: import("./keycloak/keycloak.types").IKeycloakService;
13
+ Notification: import("./notification/notification.types").INotificationService;
13
14
  };
@@ -9,6 +9,7 @@ const environment_1 = require("./environment");
9
9
  const keycloak_1 = require("./keycloak");
10
10
  const localization_1 = require("./localization");
11
11
  const member_1 = require("./member");
12
+ const notification_1 = require("./notification");
12
13
  const prediction_1 = require("./prediction");
13
14
  const product_1 = require("./product");
14
15
  const route_1 = require("./route");
@@ -24,5 +25,6 @@ exports.Service = {
24
25
  Prediction: prediction_1.PredictionService,
25
26
  Localization: localization_1.LocalizationService,
26
27
  Environment: environment_1.EnvironmentService,
27
- Keycloak: keycloak_1.KeycloakService
28
+ Keycloak: keycloak_1.KeycloakService,
29
+ Notification: notification_1.NotificationService
28
30
  };
@@ -0,0 +1,2 @@
1
+ import { INotificationService } from './notification.types';
2
+ export declare const NotificationService: INotificationService;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.NotificationService = void 0;
36
+ const urls_1 = __importStar(require("../urls"));
37
+ const __1 = require("../..");
38
+ exports.NotificationService = {
39
+ Namespace: process.env.MS_NAMESPACE || 'emosv2service',
40
+ ServiceUrl: function () {
41
+ return `http://notification.${this.Namespace}.svc.cluster.local`;
42
+ },
43
+ Prefix: '/api/notification',
44
+ RenderTemplate: function (data, options) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const renderTemplateUri = (0, urls_1.getUrl)({
47
+ serviceUrl: this.ServiceUrl(),
48
+ prefix: this.Prefix,
49
+ isClient: options === null || options === void 0 ? void 0 : options.useClient,
50
+ language: data === null || data === void 0 ? void 0 : data.language,
51
+ methodName: urls_1.default.Notification.RenderTemplate
52
+ });
53
+ return yield (0, __1.fetchRequest)().post(`${renderTemplateUri}?providerName=${data.providerName}`, Object.assign(Object.assign({}, options), { body: data.templateModel ? JSON.stringify(data.templateModel) : '{}' }));
54
+ });
55
+ },
56
+ };
@@ -0,0 +1,9 @@
1
+ import { IApiResponse, IRequestInit, IService } from '../..';
2
+ export interface IRenderTemplateRequest {
3
+ providerName: string;
4
+ templateModel?: any;
5
+ language?: string;
6
+ }
7
+ export interface INotificationService extends IService {
8
+ RenderTemplate: (data: IRenderTemplateRequest, options?: IRequestInit) => Promise<IApiResponse<string>>;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -66,6 +66,9 @@ declare const _default: {
66
66
  Read: string;
67
67
  Update: string;
68
68
  };
69
+ Notification: {
70
+ RenderTemplate: string;
71
+ };
69
72
  };
70
73
  export default _default;
71
74
  export declare const getUrl: ({ isClient, language, methodName, serviceUrl, prefix, id }: {
@@ -72,6 +72,9 @@ exports.default = {
72
72
  Read: '/{language}/Environment/v1/Read',
73
73
  Update: '/{language}/Environment/v1/Update',
74
74
  },
75
+ Notification: {
76
+ RenderTemplate: '/{language}/Template/v1/RenderTemplate',
77
+ }
75
78
  };
76
79
  const getUrl = ({ isClient = false, language = process.env.DEFAULT_LANGUAGE || "tr", methodName, serviceUrl, prefix, id = '' }) => {
77
80
  let url = serviceUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nextemos",
3
- "version": "4.3.3",
3
+ "version": "4.3.5",
4
4
  "description": "For helpers and hooks used in NextJS projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",