@aprilium/tripsm_message-support 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/packages/message-support/src/effects.d.ts +2 -0
- package/lib/packages/message-support/src/effects.js +113 -0
- package/lib/packages/message-support/src/index.d.ts +39 -0
- package/lib/packages/message-support/src/index.js +138 -0
- package/lib/packages/message-support/src/models/MessageSupport.d.ts +32 -0
- package/lib/packages/message-support/src/models/MessageSupport.js +22 -0
- package/lib/packages/message-support/src/parameters/AddMessageSupport.d.ts +16 -0
- package/lib/packages/message-support/src/parameters/AddMessageSupport.js +13 -0
- package/lib/packages/message-support/src/parameters/MessageSupportParameters.d.ts +7 -0
- package/lib/packages/message-support/src/parameters/MessageSupportParameters.js +2 -0
- package/lib/packages/message-support/src/selectors.d.ts +5 -0
- package/lib/packages/message-support/src/selectors.js +12 -0
- package/lib/packages/message-support/src/service.d.ts +25 -0
- package/lib/packages/message-support/src/service.js +125 -0
- package/lib/packages/message-support/src/state.d.ts +32 -0
- package/lib/packages/message-support/src/state.js +82 -0
- package/lib/utils/axios-interceptor.d.ts +2 -0
- package/lib/utils/axios-interceptor.js +98 -0
- package/package.json +30 -0
@@ -0,0 +1,113 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
3
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
4
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
5
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
6
|
+
function step(op) {
|
7
|
+
if (f) throw new TypeError("Generator is already executing.");
|
8
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
9
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
10
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
11
|
+
switch (op[0]) {
|
12
|
+
case 0: case 1: t = op; break;
|
13
|
+
case 4: _.label++; return { value: op[1], done: false };
|
14
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
15
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
16
|
+
default:
|
17
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
18
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
19
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
20
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
21
|
+
if (t[2]) _.ops.pop();
|
22
|
+
_.trys.pop(); continue;
|
23
|
+
}
|
24
|
+
op = body.call(thisArg, _);
|
25
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
26
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
27
|
+
}
|
28
|
+
};
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
30
|
+
var effects_1 = require("redux-saga/effects");
|
31
|
+
var utils_1 = require("@aprilium/tripsm_common/lib/helper/utils");
|
32
|
+
var service_1 = require("./service");
|
33
|
+
var state_1 = require("./state");
|
34
|
+
function getMessageSupportEffect(action) {
|
35
|
+
var MessageSupport_1, err_1;
|
36
|
+
return __generator(this, function (_a) {
|
37
|
+
switch (_a.label) {
|
38
|
+
case 0:
|
39
|
+
_a.trys.push([0, 3, , 5]);
|
40
|
+
if (!action.payload) {
|
41
|
+
throw Error("Missing parameters");
|
42
|
+
}
|
43
|
+
return [4 /*yield*/, (0, effects_1.call)(service_1.fetchMessageSupportData, action.payload)];
|
44
|
+
case 1:
|
45
|
+
MessageSupport_1 = _a.sent();
|
46
|
+
if (!MessageSupport_1)
|
47
|
+
throw Error;
|
48
|
+
return [4 /*yield*/, (0, effects_1.put)(state_1.MessageSupportActions.getMessageSupportDataSuccess(MessageSupport_1))];
|
49
|
+
case 2:
|
50
|
+
_a.sent();
|
51
|
+
return [3 /*break*/, 5];
|
52
|
+
case 3:
|
53
|
+
err_1 = _a.sent();
|
54
|
+
return [4 /*yield*/, (0, effects_1.put)(state_1.MessageSupportActions.getMessageSupportDataFailure("app_name", (0, utils_1.buildTechnicalErrorMessage)(err_1)))];
|
55
|
+
case 4:
|
56
|
+
_a.sent();
|
57
|
+
return [3 /*break*/, 5];
|
58
|
+
case 5: return [2 /*return*/];
|
59
|
+
}
|
60
|
+
});
|
61
|
+
}
|
62
|
+
function addMessageSupportEffect(action) {
|
63
|
+
var _a, success, error, statusCode, result, err_2;
|
64
|
+
return __generator(this, function (_b) {
|
65
|
+
switch (_b.label) {
|
66
|
+
case 0:
|
67
|
+
_b.trys.push([0, 8, , 10]);
|
68
|
+
if (!action.payload) {
|
69
|
+
throw Error("Missing add MessageSupport parameters");
|
70
|
+
}
|
71
|
+
return [4 /*yield*/, (0, effects_1.call)(service_1.addNewMessageSupport, action.payload)];
|
72
|
+
case 1:
|
73
|
+
_a = _b.sent(), success = _a.success, error = _a.error, statusCode = _a.statusCode, result = _a.result;
|
74
|
+
if (!(!success && statusCode)) return [3 /*break*/, 3];
|
75
|
+
return [4 /*yield*/, (0, effects_1.put)(state_1.MessageSupportActions.addMessageSupportFailure("Failed to add MessageSupport", (0, utils_1.buildTechnicalErrorMessage)(error, statusCode)))];
|
76
|
+
case 2:
|
77
|
+
_b.sent();
|
78
|
+
return [3 /*break*/, 7];
|
79
|
+
case 3:
|
80
|
+
if (!(!success && !statusCode)) return [3 /*break*/, 5];
|
81
|
+
return [4 /*yield*/, (0, effects_1.put)(state_1.MessageSupportActions.addMessageSupportFailure("Failed to add MessageSupport", (0, utils_1.buildTechnicalErrorMessage)(error)))];
|
82
|
+
case 4:
|
83
|
+
_b.sent();
|
84
|
+
return [3 /*break*/, 7];
|
85
|
+
case 5: return [4 /*yield*/, (0, effects_1.put)(state_1.MessageSupportActions.addMessageSupportSuccess(result))];
|
86
|
+
case 6:
|
87
|
+
_b.sent();
|
88
|
+
_b.label = 7;
|
89
|
+
case 7: return [3 /*break*/, 10];
|
90
|
+
case 8:
|
91
|
+
err_2 = _b.sent();
|
92
|
+
return [4 /*yield*/, (0, effects_1.put)(state_1.MessageSupportActions.addMessageSupportFailure("Failed to add MessageSupport", (0, utils_1.buildTechnicalErrorMessage)(err_2)))];
|
93
|
+
case 9:
|
94
|
+
_b.sent();
|
95
|
+
return [3 /*break*/, 10];
|
96
|
+
case 10: return [2 /*return*/];
|
97
|
+
}
|
98
|
+
});
|
99
|
+
}
|
100
|
+
function MessageSupportEffects() {
|
101
|
+
return __generator(this, function (_a) {
|
102
|
+
switch (_a.label) {
|
103
|
+
case 0: return [4 /*yield*/, (0, effects_1.takeLatest)(state_1.MessageSupportActions.getMessageSupport.type, getMessageSupportEffect)];
|
104
|
+
case 1:
|
105
|
+
_a.sent();
|
106
|
+
return [4 /*yield*/, (0, effects_1.takeLatest)(state_1.MessageSupportActions.addMessageSupport.type, addMessageSupportEffect)];
|
107
|
+
case 2:
|
108
|
+
_a.sent();
|
109
|
+
return [2 /*return*/];
|
110
|
+
}
|
111
|
+
});
|
112
|
+
}
|
113
|
+
exports.default = MessageSupportEffects;
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/// <reference types="redux-persist/types/types" />
|
2
|
+
import { Store } from "redux";
|
3
|
+
import { Saga } from "redux-saga";
|
4
|
+
import { PersistGate } from "redux-persist/integration/react";
|
5
|
+
import { PersistConfig } from "redux-persist";
|
6
|
+
import { State as messageSupportState } from "./state";
|
7
|
+
import messageSupportEffects from "./effects";
|
8
|
+
import UrlsConfigs from "@aprilium/tripsm_common/lib/urlsConfig";
|
9
|
+
export declare const initialSagas: {
|
10
|
+
messageSupport: typeof messageSupportEffects;
|
11
|
+
};
|
12
|
+
export declare const initialStates: {
|
13
|
+
messageSupport: messageSupportState;
|
14
|
+
};
|
15
|
+
export declare const sagas: (typeof messageSupportEffects)[];
|
16
|
+
export type States = {
|
17
|
+
messageSupport: messageSupportState;
|
18
|
+
};
|
19
|
+
export type StateName = "message-support";
|
20
|
+
export declare const StateNames: {
|
21
|
+
[prop: string]: StateName;
|
22
|
+
};
|
23
|
+
export declare const reducers: {
|
24
|
+
messageSupport: import("immer-reducer").ImmerReducerFunction<typeof import("./state").MessageSupportState>;
|
25
|
+
};
|
26
|
+
export declare const newReducer: (stateImmerClass: any, initialState: any) => import("immer-reducer").ImmerReducerFunction<any>;
|
27
|
+
export declare const sagaMiddleware: import("redux-saga").SagaMiddleware<object>;
|
28
|
+
export declare const urlsConfig: UrlsConfigs;
|
29
|
+
declare function configStore(extraMiddleWares: any[] | undefined, // Adding other middlewares
|
30
|
+
persistConfig: PersistConfig<unknown, any, any, any>, // Configuration for persistState
|
31
|
+
extraStates?: any, // Adding other states in the store
|
32
|
+
replaceAllStates?: boolean): {
|
33
|
+
store: Store<any, any>;
|
34
|
+
persistor: import("redux-persist").Persistor;
|
35
|
+
PersistGate: typeof PersistGate;
|
36
|
+
};
|
37
|
+
export declare function initSagaMiddleware(extraSagas?: Array<Saga>, // local sagas from frontEnd Client
|
38
|
+
waitForRehydrate?: boolean): void;
|
39
|
+
export default configStore;
|
@@ -0,0 +1,138 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
13
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
14
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
15
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
16
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
17
|
+
function step(op) {
|
18
|
+
if (f) throw new TypeError("Generator is already executing.");
|
19
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
20
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
21
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
22
|
+
switch (op[0]) {
|
23
|
+
case 0: case 1: t = op; break;
|
24
|
+
case 4: _.label++; return { value: op[1], done: false };
|
25
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
26
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
27
|
+
default:
|
28
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
29
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
30
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
31
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
32
|
+
if (t[2]) _.ops.pop();
|
33
|
+
_.trys.pop(); continue;
|
34
|
+
}
|
35
|
+
op = body.call(thisArg, _);
|
36
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
37
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
38
|
+
}
|
39
|
+
};
|
40
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
41
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
42
|
+
if (ar || !(i in from)) {
|
43
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
44
|
+
ar[i] = from[i];
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
48
|
+
};
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
51
|
+
};
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
53
|
+
exports.initSagaMiddleware = exports.urlsConfig = exports.sagaMiddleware = exports.newReducer = exports.reducers = exports.StateNames = exports.sagas = exports.initialStates = exports.initialSagas = void 0;
|
54
|
+
var redux_1 = require("redux");
|
55
|
+
var redux_saga_1 = __importDefault(require("redux-saga"));
|
56
|
+
var effects_1 = require("redux-saga/effects");
|
57
|
+
var react_1 = require("redux-persist/integration/react");
|
58
|
+
var redux_persist_1 = require("redux-persist");
|
59
|
+
var immer_reducer_1 = require("immer-reducer");
|
60
|
+
var state_1 = require("./state");
|
61
|
+
var effects_2 = __importDefault(require("./effects"));
|
62
|
+
var urlsConfig_1 = __importDefault(require("@aprilium/tripsm_common/lib/urlsConfig"));
|
63
|
+
exports.initialSagas = {
|
64
|
+
messageSupport: effects_2.default,
|
65
|
+
};
|
66
|
+
exports.initialStates = {
|
67
|
+
messageSupport: state_1.initialState,
|
68
|
+
};
|
69
|
+
exports.sagas = Object.keys(exports.initialSagas).map(function (key) { return exports.initialSagas[key]; });
|
70
|
+
exports.StateNames = {
|
71
|
+
messageSupportStateName: "message-support",
|
72
|
+
};
|
73
|
+
exports.reducers = {
|
74
|
+
messageSupport: state_1.MessageSupportReducerFunction,
|
75
|
+
};
|
76
|
+
var newReducer = function (stateImmerClass, initialState) { return (0, immer_reducer_1.createReducerFunction)(stateImmerClass, initialState); };
|
77
|
+
exports.newReducer = newReducer;
|
78
|
+
exports.sagaMiddleware = (0, redux_saga_1.default)();
|
79
|
+
exports.urlsConfig = new urlsConfig_1.default();
|
80
|
+
function configStore(extraMiddleWares, // Adding other middlewares
|
81
|
+
persistConfig, // Configuration for persistState
|
82
|
+
extraStates, // Adding other states in the store
|
83
|
+
replaceAllStates // It will keep only extraStates
|
84
|
+
) {
|
85
|
+
if (extraMiddleWares === void 0) { extraMiddleWares = []; }
|
86
|
+
if (extraStates === void 0) { extraStates = {}; }
|
87
|
+
if (replaceAllStates === void 0) { replaceAllStates = false; }
|
88
|
+
var _reducers = (0, redux_1.combineReducers)(__assign(__assign({}, exports.reducers), extraStates));
|
89
|
+
if (replaceAllStates) {
|
90
|
+
_reducers = (0, redux_1.combineReducers)(__assign({}, extraStates));
|
91
|
+
}
|
92
|
+
var _middleWares = __spreadArray(__spreadArray([], extraMiddleWares, true), [exports.sagaMiddleware], false);
|
93
|
+
// @ts-ignore
|
94
|
+
var persistedReducer = (0, redux_persist_1.persistReducer)(persistConfig, _reducers);
|
95
|
+
var store = (0, redux_1.createStore)(persistedReducer, redux_1.applyMiddleware.apply(void 0, _middleWares));
|
96
|
+
var persistor = (0, redux_persist_1.persistStore)(store);
|
97
|
+
return { store: store, persistor: persistor, PersistGate: react_1.PersistGate };
|
98
|
+
}
|
99
|
+
function initSagaMiddleware(extraSagas, // local sagas from frontEnd Client
|
100
|
+
waitForRehydrate) {
|
101
|
+
if (extraSagas === void 0) { extraSagas = []; }
|
102
|
+
if (waitForRehydrate === void 0) { waitForRehydrate = false; }
|
103
|
+
var _sagas = __spreadArray(__spreadArray([], exports.sagas, true), extraSagas, true);
|
104
|
+
// It will initialize all sagas
|
105
|
+
function rootSaga() {
|
106
|
+
var instSagas;
|
107
|
+
return __generator(this, function (_a) {
|
108
|
+
switch (_a.label) {
|
109
|
+
case 0:
|
110
|
+
if (!waitForRehydrate) return [3 /*break*/, 2];
|
111
|
+
return [4 /*yield*/, (0, effects_1.take)(redux_persist_1.REHYDRATE)];
|
112
|
+
case 1:
|
113
|
+
_a.sent();
|
114
|
+
_a.label = 2;
|
115
|
+
case 2: return [4 /*yield*/, _sagas.map(function (saga) {
|
116
|
+
return __generator(this, function (_a) {
|
117
|
+
switch (_a.label) {
|
118
|
+
case 0: return [4 /*yield*/, (0, effects_1.fork)(saga)];
|
119
|
+
case 1:
|
120
|
+
_a.sent();
|
121
|
+
return [2 /*return*/];
|
122
|
+
}
|
123
|
+
});
|
124
|
+
})];
|
125
|
+
case 3:
|
126
|
+
instSagas = _a.sent();
|
127
|
+
return [4 /*yield*/, (0, effects_1.all)(instSagas)];
|
128
|
+
case 4:
|
129
|
+
_a.sent();
|
130
|
+
return [2 /*return*/];
|
131
|
+
}
|
132
|
+
});
|
133
|
+
}
|
134
|
+
// Start the listener
|
135
|
+
exports.sagaMiddleware.run(rootSaga);
|
136
|
+
}
|
137
|
+
exports.initSagaMiddleware = initSagaMiddleware;
|
138
|
+
exports.default = configStore;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
export type SupportConversationDataType = {
|
2
|
+
Id: number;
|
3
|
+
MessageSupportContent: number;
|
4
|
+
SupportConversationId: number;
|
5
|
+
StaffId: number;
|
6
|
+
GuestId: number;
|
7
|
+
Media: number;
|
8
|
+
IsActive: number;
|
9
|
+
CreationDate: number;
|
10
|
+
CreatedBy: number;
|
11
|
+
IsDeleted: number;
|
12
|
+
UpdateDate: Date;
|
13
|
+
UpdateBy: string;
|
14
|
+
AgencyId: number;
|
15
|
+
};
|
16
|
+
declare class SupportConversation {
|
17
|
+
Id: number;
|
18
|
+
MessageSupportContent: number;
|
19
|
+
SupportConversationId: number;
|
20
|
+
StaffId: number;
|
21
|
+
GuestId: number;
|
22
|
+
Media: number;
|
23
|
+
IsActive: number;
|
24
|
+
CreationDate: number;
|
25
|
+
CreatedBy: number;
|
26
|
+
IsDeleted: number;
|
27
|
+
UpdateDate: Date;
|
28
|
+
UpdateBy: string;
|
29
|
+
AgencyId: number;
|
30
|
+
constructor(props: SupportConversationDataType);
|
31
|
+
}
|
32
|
+
export default SupportConversation;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
var SupportConversation = /** @class */ (function () {
|
4
|
+
function SupportConversation(props) {
|
5
|
+
this.Id = props.Id;
|
6
|
+
this.MessageSupportContent = props.MessageSupportContent;
|
7
|
+
this.SupportConversationId = props.SupportConversationId;
|
8
|
+
this.StaffId = props.StaffId;
|
9
|
+
this.GuestId = props.GuestId;
|
10
|
+
this.AgencyId = props.AgencyId;
|
11
|
+
this.Media = props.Media;
|
12
|
+
this.IsActive = props.IsActive;
|
13
|
+
this.UpdateDate = props.UpdateDate;
|
14
|
+
this.CreatedBy = props.CreatedBy;
|
15
|
+
this.CreationDate = props.CreationDate;
|
16
|
+
this.IsActive = props.IsActive;
|
17
|
+
this.IsDeleted = props.IsDeleted;
|
18
|
+
this.UpdateBy = props.UpdateBy;
|
19
|
+
}
|
20
|
+
return SupportConversation;
|
21
|
+
}());
|
22
|
+
exports.default = SupportConversation;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export type AddMessageSupportDataType = {
|
2
|
+
GuestId: string;
|
3
|
+
AgencyId: number;
|
4
|
+
MessageContent: string;
|
5
|
+
Media: string;
|
6
|
+
SenderId: number;
|
7
|
+
};
|
8
|
+
declare class AddMessageSupport {
|
9
|
+
GuestId: string;
|
10
|
+
AgencyId: number;
|
11
|
+
MessageContent: string;
|
12
|
+
Media: string;
|
13
|
+
SenderId: number;
|
14
|
+
constructor(props: AddMessageSupportDataType);
|
15
|
+
}
|
16
|
+
export default AddMessageSupport;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
var AddMessageSupport = /** @class */ (function () {
|
4
|
+
function AddMessageSupport(props) {
|
5
|
+
this.GuestId = props.GuestId;
|
6
|
+
this.AgencyId = props.AgencyId;
|
7
|
+
this.MessageContent = props.MessageContent;
|
8
|
+
this.Media = props.Media;
|
9
|
+
this.SenderId = props.SenderId;
|
10
|
+
}
|
11
|
+
return AddMessageSupport;
|
12
|
+
}());
|
13
|
+
exports.default = AddMessageSupport;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { States } from "./index";
|
2
|
+
import MessageSupport from "./models/MessageSupport";
|
3
|
+
import { State } from "./state";
|
4
|
+
export declare function getMessageSupportState(states: Partial<States>): State | undefined;
|
5
|
+
export declare function getMessageSupportsList(states: Partial<States>): MessageSupport[] | null | undefined;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getMessageSupportsList = exports.getMessageSupportState = void 0;
|
4
|
+
function getMessageSupportState(states) {
|
5
|
+
return states === null || states === void 0 ? void 0 : states.messageSupport;
|
6
|
+
}
|
7
|
+
exports.getMessageSupportState = getMessageSupportState;
|
8
|
+
function getMessageSupportsList(states) {
|
9
|
+
var _a;
|
10
|
+
return (_a = states === null || states === void 0 ? void 0 : states.messageSupport) === null || _a === void 0 ? void 0 : _a.MessageSupportByConversation;
|
11
|
+
}
|
12
|
+
exports.getMessageSupportsList = getMessageSupportsList;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import MessageSupportParameters from "./parameters/MessageSupportParameters";
|
2
|
+
import MessageSupport from "./models/MessageSupport";
|
3
|
+
import AddMessageSupport from "./parameters/AddMessageSupport";
|
4
|
+
import { PagedResult } from "@aprilium/tripsm_common/lib/models/PagedResult";
|
5
|
+
declare function fetchMessageSupportData(MessageSupportParameters: MessageSupportParameters): Promise<PagedResult<MessageSupport> | undefined>;
|
6
|
+
declare function addNewMessageSupport(newMessageSupport: AddMessageSupport): Promise<{
|
7
|
+
result: boolean;
|
8
|
+
success: boolean;
|
9
|
+
error?: undefined;
|
10
|
+
statusCode?: undefined;
|
11
|
+
messageSupport?: undefined;
|
12
|
+
} | {
|
13
|
+
success: boolean;
|
14
|
+
error: any;
|
15
|
+
statusCode: number | undefined;
|
16
|
+
result?: undefined;
|
17
|
+
messageSupport?: undefined;
|
18
|
+
} | {
|
19
|
+
success: boolean;
|
20
|
+
messageSupport: string;
|
21
|
+
error: unknown;
|
22
|
+
result?: undefined;
|
23
|
+
statusCode?: undefined;
|
24
|
+
}>;
|
25
|
+
export { fetchMessageSupportData, addNewMessageSupport };
|
@@ -0,0 +1,125 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
+
function step(op) {
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
+
switch (op[0]) {
|
21
|
+
case 0: case 1: t = op; break;
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
+
default:
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
+
if (t[2]) _.ops.pop();
|
31
|
+
_.trys.pop(); continue;
|
32
|
+
}
|
33
|
+
op = body.call(thisArg, _);
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
+
}
|
37
|
+
};
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
40
|
+
};
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
42
|
+
exports.addNewMessageSupport = exports.fetchMessageSupportData = void 0;
|
43
|
+
var axios_interceptor_1 = __importDefault(require("../../../utils/axios-interceptor"));
|
44
|
+
var index_1 = require("./index");
|
45
|
+
var serviceUtils_1 = require("@aprilium/tripsm_common/lib/helper/serviceUtils");
|
46
|
+
var axios_1 = __importDefault(require("axios"));
|
47
|
+
function fetchMessageSupportData(MessageSupportParameters) {
|
48
|
+
return __awaiter(this, void 0, void 0, function () {
|
49
|
+
var route, query, response, exception_1;
|
50
|
+
return __generator(this, function (_a) {
|
51
|
+
switch (_a.label) {
|
52
|
+
case 0:
|
53
|
+
route = "/api/MessageSupport/get";
|
54
|
+
query = (0, serviceUtils_1.buildQueryParams)(MessageSupportParameters);
|
55
|
+
if (!index_1.urlsConfig.values)
|
56
|
+
throw Error("No urls config found");
|
57
|
+
_a.label = 1;
|
58
|
+
case 1:
|
59
|
+
_a.trys.push([1, 3, , 4]);
|
60
|
+
return [4 /*yield*/, axios_interceptor_1.default.get("".concat(index_1.urlsConfig.values.CORE_BASE_URL).concat(route).concat(query), {
|
61
|
+
headers: {
|
62
|
+
"Content-Type": "application/json;charset=utf-8",
|
63
|
+
"Access-Control-Allow-Origin": "http://localhost:3000",
|
64
|
+
"Access-Control-Allow-Credentials": "true",
|
65
|
+
"Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
|
66
|
+
},
|
67
|
+
})];
|
68
|
+
case 2:
|
69
|
+
response = _a.sent();
|
70
|
+
return [2 /*return*/, response.data];
|
71
|
+
case 3:
|
72
|
+
exception_1 = _a.sent();
|
73
|
+
console.log("Exception: ", exception_1);
|
74
|
+
return [3 /*break*/, 4];
|
75
|
+
case 4: return [2 /*return*/];
|
76
|
+
}
|
77
|
+
});
|
78
|
+
});
|
79
|
+
}
|
80
|
+
exports.fetchMessageSupportData = fetchMessageSupportData;
|
81
|
+
function addNewMessageSupport(newMessageSupport) {
|
82
|
+
var _a, _b;
|
83
|
+
return __awaiter(this, void 0, void 0, function () {
|
84
|
+
var route, url, formData, response, exception_2;
|
85
|
+
return __generator(this, function (_c) {
|
86
|
+
switch (_c.label) {
|
87
|
+
case 0:
|
88
|
+
route = "/api/MessageSupport/insert";
|
89
|
+
if (!index_1.urlsConfig.values)
|
90
|
+
throw Error("No urls config found");
|
91
|
+
url = "".concat(index_1.urlsConfig.values.CORE_BASE_URL).concat(route);
|
92
|
+
formData = new FormData();
|
93
|
+
formData.append("AgencyId", newMessageSupport.AgencyId.toString());
|
94
|
+
formData.append("GuestId", newMessageSupport.GuestId.toString());
|
95
|
+
formData.append("SenderId", newMessageSupport.GuestId.toString());
|
96
|
+
newMessageSupport.MessageContent && formData.append("MessageSupportContent", newMessageSupport.MessageContent);
|
97
|
+
newMessageSupport.Media && formData.append("Media", newMessageSupport.Media);
|
98
|
+
_c.label = 1;
|
99
|
+
case 1:
|
100
|
+
_c.trys.push([1, 3, , 4]);
|
101
|
+
return [4 /*yield*/, axios_interceptor_1.default.post(url, formData, {
|
102
|
+
headers: {
|
103
|
+
"Content-Type": "multipart/form-data",
|
104
|
+
},
|
105
|
+
}
|
106
|
+
//config
|
107
|
+
)];
|
108
|
+
case 2:
|
109
|
+
response = _c.sent();
|
110
|
+
return [2 /*return*/, { result: response.data, success: true }];
|
111
|
+
case 3:
|
112
|
+
exception_2 = _c.sent();
|
113
|
+
if (axios_1.default.isAxiosError(exception_2)) {
|
114
|
+
return [2 /*return*/, { success: false, error: (_a = exception_2.response) === null || _a === void 0 ? void 0 : _a.data, statusCode: (_b = exception_2.response) === null || _b === void 0 ? void 0 : _b.status }];
|
115
|
+
}
|
116
|
+
else {
|
117
|
+
return [2 /*return*/, { success: false, messageSupport: "An unknown error occurred", error: exception_2 }];
|
118
|
+
}
|
119
|
+
return [3 /*break*/, 4];
|
120
|
+
case 4: return [2 /*return*/];
|
121
|
+
}
|
122
|
+
});
|
123
|
+
});
|
124
|
+
}
|
125
|
+
exports.addNewMessageSupport = addNewMessageSupport;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { ImmerReducer } from "immer-reducer";
|
2
|
+
import MessageSupport from "./models/MessageSupport";
|
3
|
+
import MessageSupportParameters from "./parameters/MessageSupportParameters";
|
4
|
+
import AddMessageSupport from "./parameters/AddMessageSupport";
|
5
|
+
import { technicalErrorMessageType } from "@aprilium/tripsm_common/lib/helper/utils";
|
6
|
+
export type State = {
|
7
|
+
getMessageSupport: {
|
8
|
+
loading: boolean;
|
9
|
+
success: boolean;
|
10
|
+
errorMessageSupport: string | null;
|
11
|
+
technicalErrorMessageSupport: technicalErrorMessageType | null;
|
12
|
+
};
|
13
|
+
addMessageSupport: {
|
14
|
+
loading: boolean;
|
15
|
+
success: boolean;
|
16
|
+
errorMessageSupport: string | null;
|
17
|
+
technicalErrorMessageSupport: technicalErrorMessageType | null;
|
18
|
+
payload: any;
|
19
|
+
};
|
20
|
+
MessageSupportByConversation: MessageSupport[] | null;
|
21
|
+
};
|
22
|
+
export declare const initialState: State;
|
23
|
+
export declare class MessageSupportState extends ImmerReducer<State> {
|
24
|
+
getMessageSupport(params: MessageSupportParameters): void;
|
25
|
+
getMessageSupportDataSuccess(MessageSupport: MessageSupport[]): void;
|
26
|
+
getMessageSupportDataFailure(errorMessageSupport: string, technicalErrorMessageSupport: technicalErrorMessageType): void;
|
27
|
+
addMessageSupport(params: AddMessageSupport): void;
|
28
|
+
addMessageSupportSuccess(payload: any): void;
|
29
|
+
addMessageSupportFailure(errorMessageSupport: string, technicalErrorMessageSupport: technicalErrorMessageType): void;
|
30
|
+
}
|
31
|
+
export declare const MessageSupportActions: import("immer-reducer").ActionCreators<typeof MessageSupportState>;
|
32
|
+
export declare const MessageSupportReducerFunction: import("immer-reducer").ImmerReducerFunction<typeof MessageSupportState>;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
3
|
+
var extendStatics = function (d, b) {
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
7
|
+
return extendStatics(d, b);
|
8
|
+
};
|
9
|
+
return function (d, b) {
|
10
|
+
if (typeof b !== "function" && b !== null)
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
12
|
+
extendStatics(d, b);
|
13
|
+
function __() { this.constructor = d; }
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
15
|
+
};
|
16
|
+
})();
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
+
exports.MessageSupportReducerFunction = exports.MessageSupportActions = exports.MessageSupportState = exports.initialState = void 0;
|
19
|
+
var immer_reducer_1 = require("immer-reducer");
|
20
|
+
exports.initialState = {
|
21
|
+
getMessageSupport: {
|
22
|
+
loading: false,
|
23
|
+
success: false,
|
24
|
+
errorMessageSupport: null,
|
25
|
+
technicalErrorMessageSupport: null,
|
26
|
+
},
|
27
|
+
addMessageSupport: {
|
28
|
+
loading: false,
|
29
|
+
success: false,
|
30
|
+
errorMessageSupport: null,
|
31
|
+
technicalErrorMessageSupport: null,
|
32
|
+
payload: null
|
33
|
+
},
|
34
|
+
MessageSupportByConversation: null,
|
35
|
+
};
|
36
|
+
var MessageSupportState = /** @class */ (function (_super) {
|
37
|
+
__extends(MessageSupportState, _super);
|
38
|
+
function MessageSupportState() {
|
39
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
40
|
+
}
|
41
|
+
MessageSupportState.prototype.getMessageSupport = function (params) {
|
42
|
+
this.draftState.getMessageSupport.loading = true;
|
43
|
+
this.draftState.getMessageSupport.success = false;
|
44
|
+
this.draftState.getMessageSupport.errorMessageSupport = null;
|
45
|
+
this.draftState.getMessageSupport.technicalErrorMessageSupport = null;
|
46
|
+
};
|
47
|
+
MessageSupportState.prototype.getMessageSupportDataSuccess = function (MessageSupport) {
|
48
|
+
this.draftState.getMessageSupport.loading = false;
|
49
|
+
this.draftState.MessageSupportByConversation = MessageSupport;
|
50
|
+
this.draftState.getMessageSupport.errorMessageSupport = null;
|
51
|
+
this.draftState.getMessageSupport.technicalErrorMessageSupport = null;
|
52
|
+
};
|
53
|
+
MessageSupportState.prototype.getMessageSupportDataFailure = function (errorMessageSupport, technicalErrorMessageSupport) {
|
54
|
+
this.draftState.getMessageSupport.loading = false;
|
55
|
+
this.draftState.getMessageSupport.errorMessageSupport = errorMessageSupport;
|
56
|
+
this.draftState.getMessageSupport.technicalErrorMessageSupport = technicalErrorMessageSupport;
|
57
|
+
};
|
58
|
+
MessageSupportState.prototype.addMessageSupport = function (params) {
|
59
|
+
this.draftState.addMessageSupport.loading = true;
|
60
|
+
this.draftState.addMessageSupport.success = false;
|
61
|
+
this.draftState.addMessageSupport.errorMessageSupport = null;
|
62
|
+
this.draftState.addMessageSupport.technicalErrorMessageSupport = null;
|
63
|
+
this.draftState.addMessageSupport.technicalErrorMessageSupport = null;
|
64
|
+
};
|
65
|
+
MessageSupportState.prototype.addMessageSupportSuccess = function (payload) {
|
66
|
+
this.draftState.addMessageSupport.loading = false;
|
67
|
+
this.draftState.addMessageSupport.success = true;
|
68
|
+
this.draftState.addMessageSupport.errorMessageSupport = null;
|
69
|
+
this.draftState.addMessageSupport.technicalErrorMessageSupport = null;
|
70
|
+
this.draftState.addMessageSupport.payload = payload;
|
71
|
+
};
|
72
|
+
MessageSupportState.prototype.addMessageSupportFailure = function (errorMessageSupport, technicalErrorMessageSupport) {
|
73
|
+
this.draftState.addMessageSupport.loading = false;
|
74
|
+
this.draftState.addMessageSupport.success = false;
|
75
|
+
this.draftState.addMessageSupport.errorMessageSupport = errorMessageSupport;
|
76
|
+
this.draftState.addMessageSupport.technicalErrorMessageSupport = technicalErrorMessageSupport;
|
77
|
+
};
|
78
|
+
return MessageSupportState;
|
79
|
+
}(immer_reducer_1.ImmerReducer));
|
80
|
+
exports.MessageSupportState = MessageSupportState;
|
81
|
+
exports.MessageSupportActions = (0, immer_reducer_1.createActionCreators)(MessageSupportState);
|
82
|
+
exports.MessageSupportReducerFunction = (0, immer_reducer_1.createReducerFunction)(MessageSupportState, exports.initialState);
|
@@ -0,0 +1,98 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
+
function step(op) {
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
+
switch (op[0]) {
|
21
|
+
case 0: case 1: t = op; break;
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
+
default:
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
+
if (t[2]) _.ops.pop();
|
31
|
+
_.trys.pop(); continue;
|
32
|
+
}
|
33
|
+
op = body.call(thisArg, _);
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
+
}
|
37
|
+
};
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
40
|
+
};
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
42
|
+
var axios_1 = __importDefault(require("axios"));
|
43
|
+
var getToken = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
44
|
+
return [2 /*return*/, null];
|
45
|
+
}); }); };
|
46
|
+
if (typeof window !== "undefined" && typeof window.document !== "undefined") {
|
47
|
+
// For React (web)
|
48
|
+
getToken = function () { return __awaiter(void 0, void 0, void 0, function () {
|
49
|
+
return __generator(this, function (_a) {
|
50
|
+
return [2 /*return*/, localStorage.getItem("token")];
|
51
|
+
});
|
52
|
+
}); };
|
53
|
+
}
|
54
|
+
else {
|
55
|
+
var AsyncStorage_1 = require("@react-native-async-storage/async-storage").default;
|
56
|
+
getToken = function () { return __awaiter(void 0, void 0, void 0, function () {
|
57
|
+
var token, error_1;
|
58
|
+
return __generator(this, function (_a) {
|
59
|
+
switch (_a.label) {
|
60
|
+
case 0:
|
61
|
+
_a.trys.push([0, 2, , 3]);
|
62
|
+
return [4 /*yield*/, AsyncStorage_1.getItem("token")];
|
63
|
+
case 1:
|
64
|
+
token = _a.sent();
|
65
|
+
return [2 /*return*/, token];
|
66
|
+
case 2:
|
67
|
+
error_1 = _a.sent();
|
68
|
+
console.error("Error retrieving token from AsyncStorage:", error_1);
|
69
|
+
return [2 /*return*/, null];
|
70
|
+
case 3: return [2 /*return*/];
|
71
|
+
}
|
72
|
+
});
|
73
|
+
}); };
|
74
|
+
}
|
75
|
+
var customAxios = axios_1.default.create({
|
76
|
+
baseURL: "https://localhost:47616",
|
77
|
+
});
|
78
|
+
customAxios.interceptors.request.use(function (config) { return __awaiter(void 0, void 0, void 0, function () {
|
79
|
+
var signInOrSignUpRoutes, token;
|
80
|
+
return __generator(this, function (_a) {
|
81
|
+
switch (_a.label) {
|
82
|
+
case 0:
|
83
|
+
signInOrSignUpRoutes = ["/api/authGuest/signin", "/api/authGuest/signup", "/api/auth/signin"];
|
84
|
+
if (!!signInOrSignUpRoutes.includes(config.url || "")) return [3 /*break*/, 2];
|
85
|
+
return [4 /*yield*/, getToken()];
|
86
|
+
case 1:
|
87
|
+
token = _a.sent();
|
88
|
+
if (token) {
|
89
|
+
config.headers["Authorization"] = "Bearer ".concat(token);
|
90
|
+
}
|
91
|
+
_a.label = 2;
|
92
|
+
case 2: return [2 /*return*/, config];
|
93
|
+
}
|
94
|
+
});
|
95
|
+
}); }, function (error) {
|
96
|
+
return Promise.reject(error);
|
97
|
+
});
|
98
|
+
exports.default = customAxios;
|
package/package.json
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"name": "@aprilium/tripsm_message-support",
|
3
|
+
"version": "0.0.1",
|
4
|
+
"description": "message states",
|
5
|
+
"main": "lib/index.js",
|
6
|
+
"types": "lib/index.d.ts",
|
7
|
+
"files": [
|
8
|
+
"lib/**"
|
9
|
+
],
|
10
|
+
"scripts": {
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
12
|
+
"build": "tsc"
|
13
|
+
},
|
14
|
+
"dependencies": {
|
15
|
+
"@aprilium/tripsm_common": "^0.0.15",
|
16
|
+
"@types/react": "^17.0.0",
|
17
|
+
"axios": "^0.21.1",
|
18
|
+
"immer": "^9.0.15",
|
19
|
+
"immer-reducer": "^0.7.13",
|
20
|
+
"querystring": "^0.2.1",
|
21
|
+
"react-i18next": "^11.11.4",
|
22
|
+
"redux": "^4.1.0",
|
23
|
+
"redux-persist": "^6.0.0",
|
24
|
+
"redux-saga": "^1.1.3",
|
25
|
+
"typescript": "^4.8.4"
|
26
|
+
},
|
27
|
+
"author": "ADH",
|
28
|
+
"license": "ISC"
|
29
|
+
}
|
30
|
+
|