@evlop/commons 1.0.165 → 1.0.166
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/helpers/base64.test.d.ts +2 -0
- package/dist/src/helpers/base64.test.d.ts.map +1 -0
- package/dist/src/helpers/base64.test.js +25 -0
- package/dist/src/helpers/base64.test.js.map +1 -0
- package/dist/src/helpers/index.d.ts +1 -0
- package/dist/src/helpers/index.d.ts.map +1 -1
- package/dist/src/helpers/index.js +1 -0
- package/dist/src/helpers/index.js.map +1 -1
- package/dist/src/helpers/pathHelper.d.ts +2 -0
- package/dist/src/helpers/pathHelper.d.ts.map +1 -0
- package/dist/src/helpers/pathHelper.js +36 -0
- package/dist/src/helpers/pathHelper.js.map +1 -0
- package/dist/src/helpers/pathhelper.test.d.ts +2 -0
- package/dist/src/helpers/pathhelper.test.d.ts.map +1 -0
- package/dist/src/helpers/pathhelper.test.js +35 -0
- package/dist/src/helpers/pathhelper.test.js.map +1 -0
- package/dist/src/reducers/config/initialState.native.js +2 -5
- package/dist/src/reducers/config/initialState.native.js.map +1 -1
- package/dist/src/reducers/pages/initialState.native.js +2 -5
- package/dist/src/reducers/pages/initialState.native.js.map +1 -1
- package/dist/src/reducers/routes.d.ts +1 -1
- package/dist/src/reducers/routes.d.ts.map +1 -1
- package/dist/src/reducers/routes.js +6 -9
- package/dist/src/reducers/routes.js.map +1 -1
- package/package.json +5 -4
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.test.d.ts","sourceRoot":"","sources":["../../../src/helpers/base64.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const chai_1 = require("chai");
|
4
|
+
const base64_1 = require("./base64"); // Assuming the functions are exported from this file
|
5
|
+
describe('Base64', () => {
|
6
|
+
it('should correctly encode to Base64', () => {
|
7
|
+
const result = base64_1.encodeBase64("Hello, World!");
|
8
|
+
chai_1.expect(result).to.equal("SGVsbG8sIFdvcmxkIQ==");
|
9
|
+
});
|
10
|
+
it('should correctly decode from Base64', () => {
|
11
|
+
const result = base64_1.decodeBase64("SGVsbG8sIFdvcmxkIQ==");
|
12
|
+
chai_1.expect(result).to.equal("Hello, World!");
|
13
|
+
});
|
14
|
+
it('should be able to decode encoded string', () => {
|
15
|
+
const original = "Hello, World!";
|
16
|
+
const encoded = base64_1.encodeBase64(original);
|
17
|
+
const decoded = base64_1.decodeBase64(encoded);
|
18
|
+
chai_1.expect(decoded).to.equal(original);
|
19
|
+
});
|
20
|
+
it('should throw error on invalid Base64 characters', () => {
|
21
|
+
const invalidBase64 = "SGVsbG8sIFdvcmxkIQ==$";
|
22
|
+
chai_1.expect(() => base64_1.decodeBase64(invalidBase64)).to.throw();
|
23
|
+
});
|
24
|
+
});
|
25
|
+
//# sourceMappingURL=base64.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"base64.test.js","sourceRoot":"","sources":["../../../src/helpers/base64.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,qCAAsD,CAAC,qDAAqD;AAE5G,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACzC,MAAM,MAAM,GAAG,qBAAY,CAAC,eAAe,CAAC,CAAC;QAC7C,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC3C,MAAM,MAAM,GAAG,qBAAY,CAAC,sBAAsB,CAAC,CAAC;QACpD,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC;QACjC,MAAM,OAAO,GAAG,qBAAY,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,qBAAY,CAAC,OAAO,CAAC,CAAC;QACtC,aAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACvD,MAAM,aAAa,GAAG,uBAAuB,CAAC;QAC9C,aAAM,CAAC,GAAG,EAAE,CAAC,qBAAY,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
@@ -18,4 +18,5 @@ __exportStar(require("./base64"), exports);
|
|
18
18
|
__exportStar(require("./i18nHelpers"), exports);
|
19
19
|
__exportStar(require("./analytics"), exports);
|
20
20
|
__exportStar(require("./remoteAction"), exports);
|
21
|
+
__exportStar(require("./pathHelper"), exports);
|
21
22
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,8CAA4B;AAC5B,iDAA+B;AAC/B,iDAA+B;AAC/B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAmC;AACnC,8CAA4B;AAC5B,iDAA+B;AAC/B,iDAA+B;AAC/B,2CAAyB;AACzB,gDAA8B;AAC9B,8CAA4B;AAC5B,iDAA+B;AAC/B,+CAA6B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pathHelper.d.ts","sourceRoot":"","sources":["../../../src/helpers/pathHelper.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UA4B7D"}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.generatePath = void 0;
|
7
|
+
const lodash_1 = require("lodash");
|
8
|
+
const query_string_1 = __importDefault(require("query-string"));
|
9
|
+
function generatePath(pathTemplate, params) {
|
10
|
+
const parts = lodash_1.compact(lodash_1.split(pathTemplate, '/'));
|
11
|
+
const { pathSegments, usedParams } = lodash_1.reduce(parts, ({ pathSegments, usedParams }, part) => {
|
12
|
+
const isOptional = part[part.length - 1] === '?';
|
13
|
+
if (isOptional)
|
14
|
+
part = part.slice(0, -1);
|
15
|
+
if (part[0] === ':') {
|
16
|
+
const key = part.slice(1);
|
17
|
+
if (lodash_1.has(params, [key])) {
|
18
|
+
pathSegments.push(encodeURIComponent(params[key]));
|
19
|
+
usedParams[key] = true;
|
20
|
+
}
|
21
|
+
else if (!isOptional) {
|
22
|
+
pathSegments.push(part);
|
23
|
+
}
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
pathSegments.push(part);
|
27
|
+
}
|
28
|
+
return { pathSegments, usedParams };
|
29
|
+
}, { pathSegments: [], usedParams: {} });
|
30
|
+
const remainingParams = lodash_1.omit(params, Object.keys(usedParams));
|
31
|
+
const query = query_string_1.default.stringify(remainingParams);
|
32
|
+
const path = '/' + pathSegments.join('/');
|
33
|
+
return path + (query ? '?' + query : '');
|
34
|
+
}
|
35
|
+
exports.generatePath = generatePath;
|
36
|
+
//# sourceMappingURL=pathHelper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pathHelper.js","sourceRoot":"","sources":["../../../src/helpers/pathHelper.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA2D;AAC3D,gEAAuC;AAEvC,SAAgB,YAAY,CAAC,YAAoB,EAAE,MAAW;IAC1D,MAAM,KAAK,GAAG,gBAAO,CAAC,cAAK,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;IAEhD,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,eAAM,CAAC,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE;QACtF,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;QACjD,IAAI,UAAU;YAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAEzC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YACjB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,YAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;gBACpB,YAAY,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBACnD,UAAU,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;aAC1B;iBAAM,IAAI,CAAC,UAAU,EAAE;gBACpB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC3B;SACJ;aAAM;YACH,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC3B;QAED,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;IACxC,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzC,MAAM,eAAe,GAAG,aAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,sBAAW,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE1C,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AAC7C,CAAC;AA5BD,oCA4BC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pathhelper.test.d.ts","sourceRoot":"","sources":["../../../src/helpers/pathhelper.test.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const chai_1 = require("chai");
|
4
|
+
const pathHelper_1 = require("./pathHelper");
|
5
|
+
describe('Test handlebar temaplates', function () {
|
6
|
+
it('should replace params and append query string', () => {
|
7
|
+
const result = pathHelper_1.generatePath("/users/:id?/edit?", { id: "42", a: 1 });
|
8
|
+
chai_1.expect(result).to.equal("/users/42/edit?a=1");
|
9
|
+
});
|
10
|
+
it('should handle optional path segments', () => {
|
11
|
+
const result = pathHelper_1.generatePath("/users/:id?/edit?", { a: 1 });
|
12
|
+
chai_1.expect(result).to.equal("/users/edit?a=1");
|
13
|
+
});
|
14
|
+
it('should handle missing optional params', () => {
|
15
|
+
const result = pathHelper_1.generatePath("/users/:id?/edit?", {});
|
16
|
+
chai_1.expect(result).to.equal("/users/edit");
|
17
|
+
});
|
18
|
+
it('should URL encode params', () => {
|
19
|
+
const result = pathHelper_1.generatePath("/users/:id?", { id: "hello world" });
|
20
|
+
chai_1.expect(result).to.equal("/users/hello%20world");
|
21
|
+
});
|
22
|
+
it('should URL encode query string', () => {
|
23
|
+
const result = pathHelper_1.generatePath("/users/:id?", { id: "42", a: "hello world" });
|
24
|
+
chai_1.expect(result).to.equal("/users/42?a=hello%20world");
|
25
|
+
});
|
26
|
+
it('should return root path when all path segments are optional and missing', () => {
|
27
|
+
const result = pathHelper_1.generatePath("/:a?/:b?/:c?", {});
|
28
|
+
chai_1.expect(result).to.equal("/");
|
29
|
+
});
|
30
|
+
it('should keep required params in path even if missing in params', () => {
|
31
|
+
const result = pathHelper_1.generatePath("/users/:id/edit", {});
|
32
|
+
chai_1.expect(result).to.eq("/users/:id/edit");
|
33
|
+
});
|
34
|
+
});
|
35
|
+
//# sourceMappingURL=pathhelper.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pathhelper.test.js","sourceRoot":"","sources":["../../../src/helpers/pathhelper.test.ts"],"names":[],"mappings":";;AAAA,+BAA8B;AAC9B,6CAA4C;AAE5C,QAAQ,CAAC,2BAA2B,EAAE;IAClC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,MAAM,MAAM,GAAG,yBAAY,CAAC,mBAAmB,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrE,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,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CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACrE,MAAM,MAAM,GAAG,yBAAY,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACnD,aAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"}
|
@@ -1,15 +1,12 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
const react_native_1 = require("react-native");
|
4
|
+
const helpers_1 = require("../../helpers");
|
7
5
|
const { AppConstants } = react_native_1.NativeModules;
|
8
|
-
const react_native_base64_1 = __importDefault(require("react-native-base64"));
|
9
6
|
let configData = null;
|
10
7
|
try {
|
11
8
|
const configDataJSONBase64 = AppConstants.getConfigDataJSONBase64();
|
12
|
-
configData = JSON.parse(
|
9
|
+
configData = JSON.parse(helpers_1.decodeBase64(configDataJSONBase64));
|
13
10
|
}
|
14
11
|
catch (e) {
|
15
12
|
console.log('Error redux initial state for config', e);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"initialState.native.js","sourceRoot":"","sources":["../../../../src/reducers/config/initialState.native.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"initialState.native.js","sourceRoot":"","sources":["../../../../src/reducers/config/initialState.native.tsx"],"names":[],"mappings":";;AAAA,+CAA6C;AAC7C,2CAA6C;AAC7C,MAAM,EAAC,YAAY,EAAC,GAAG,4BAAa,CAAC;AAGrC,IAAI,UAAU,GAAG,IAAI,CAAC;AAEtB,IAAG;IACC,MAAM,oBAAoB,GAAG,YAAY,CAAC,uBAAuB,EAAE,CAAC;IACpE,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC;CAC/D;AAAA,OAAM,CAAC,EAAC;IACL,OAAO,CAAC,GAAG,CAAC,sCAAsC,EAAE,CAAC,CAAC,CAAC;IACvD,UAAU,GAAG,EAAE,CAAA;CAClB;AAED,MAAM,kBAAkB,GAAG;IACvB,MAAM,EAAE,EAAE;IACV,IAAI,EAAC,UAAU;CAClB,CAAA;AAED,kBAAe,kBAAkB,CAAC"}
|
@@ -1,17 +1,14 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
const lodash_1 = require("lodash");
|
7
4
|
const react_native_1 = require("react-native");
|
5
|
+
const helpers_1 = require("../../helpers");
|
8
6
|
const { AppConstants } = react_native_1.NativeModules;
|
9
|
-
const react_native_base64_1 = __importDefault(require("react-native-base64"));
|
10
7
|
let pagesArray = [];
|
11
8
|
let pagesById = {};
|
12
9
|
try {
|
13
10
|
const configDataJSONBase64 = AppConstants.getPagesJSONBase64();
|
14
|
-
pagesArray = JSON.parse(
|
11
|
+
pagesArray = JSON.parse(helpers_1.decodeBase64(configDataJSONBase64));
|
15
12
|
if (!Array.isArray(pagesArray))
|
16
13
|
throw new Error('Pages must be an array');
|
17
14
|
pagesById = lodash_1.keyBy(pagesArray, 'id');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"initialState.native.js","sourceRoot":"","sources":["../../../../src/reducers/pages/initialState.native.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"initialState.native.js","sourceRoot":"","sources":["../../../../src/reducers/pages/initialState.native.tsx"],"names":[],"mappings":";;AAAA,mCAA+B;AAC/B,+CAA6C;AAC7C,2CAA6C;AAC7C,MAAM,EAAC,YAAY,EAAC,GAAG,4BAAa,CAAC;AAErC,IAAI,UAAU,GAAQ,EAAE,CAAC;AACzB,IAAI,SAAS,GAAQ,EAAE,CAAC;AAExB,IAAG;IACC,MAAM,oBAAoB,GAAG,YAAY,CAAC,kBAAkB,EAAE,CAAC;IAC/D,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,sBAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC5D,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IACzE,SAAS,GAAG,cAAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;CACvC;AAAA,OAAM,CAAC,EAAC;IACL,OAAO,CAAC,GAAG,CAAC,qCAAqC,EAAE,CAAC,CAAC,CAAC;IACtD,UAAU,GAAG,EAAE,CAAC;IAChB,SAAS,GAAG,EAAE,CAAC;CAClB;AAED,MAAM,iBAAiB,GAAG,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAAE,CAAA;AAElH,kBAAe,iBAAiB,CAAC"}
|
@@ -37,7 +37,7 @@ export declare function unregisterAdminPage(id: any): {
|
|
37
37
|
id: any;
|
38
38
|
key: string;
|
39
39
|
};
|
40
|
-
export declare function getPagePath(typeOrId: any, options: any, platform?: any): (dispatch: any, getState: any) =>
|
40
|
+
export declare function getPagePath(typeOrId: any, options: any, platform?: any): (dispatch: any, getState: any) => string;
|
41
41
|
export declare function getPageRouteName(pathOrId: any, platform?: string): (dispatch: any, getState: any) => any;
|
42
42
|
export declare function getPath(type: string, options?: any): (dispatch: any, getState: any) => any;
|
43
43
|
declare const _default: (state: any, action: any) => any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/reducers/routes.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;A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gB,gBAAgB,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA;;;;;EAOxC;AAED,wBAAgB,kBAAkB,CAAC,EAAE,KAAA;;;;EAMpC;AAED,wBAAgB,iBAAiB,CAAC,EAAE,KAAA,EAAE,IAAI,KAAA;;;;;EAOzC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,KAAA;;;;EAMrC;AAED,wBAAgB,WAAW,CAAE,QAAQ,KAAA,EAAE,OAAO,KAAA,EAAE,QAAQ,MAAO,4CAQ9D;AAED,wBAAgB,gBAAgB,CAAE,QAAQ,KAAA,EAAE,QAAQ,SAAQ,yCAQ3D;AAED,wBAAgB,OAAO,CAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAG,GAAG,yCAmBpD;gCAgBqB,GAAG;AAAzB,wBA2CC"}
|
@@ -10,13 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
10
10
|
}
|
11
11
|
return t;
|
12
12
|
};
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
-
};
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
14
|
exports.getPath = exports.getPageRouteName = exports.getPagePath = exports.unregisterAdminPage = exports.registerAdminPage = exports.unregisterSitePage = exports.registerSitePage = exports.unregisterPageType = exports.registerPageType = exports.ROUTE_404 = exports.PAGE_EDITOR = exports.VIEW_PAGE = exports.SITE_PAGE = exports.ROUTE_TYPE_PATH = exports.UNREGISTER_PAGE_TYPE = exports.UNREGISTER_PAGE_ROUTE = exports.REGISTER_PAGE_TYPE = exports.REGISTER_PAGE_ROUTE = void 0;
|
18
|
-
const
|
19
|
-
const
|
15
|
+
const lodash_1 = require("lodash");
|
16
|
+
const pathHelper_1 = require("../helpers/pathHelper");
|
20
17
|
exports.REGISTER_PAGE_ROUTE = 'REGISTER_PAGE_ROUTE';
|
21
18
|
exports.REGISTER_PAGE_TYPE = 'REGISTER_PAGE_TYPE';
|
22
19
|
exports.UNREGISTER_PAGE_ROUTE = 'UNREGISTER_PAGE_ROUTE';
|
@@ -77,18 +74,18 @@ exports.unregisterAdminPage = unregisterAdminPage;
|
|
77
74
|
function getPagePath(typeOrId, options, platform = null) {
|
78
75
|
return (dispatch, getState) => {
|
79
76
|
const { pages: { records: { data: pages = [] } } } = getState();
|
80
|
-
const page = lodash_1.
|
77
|
+
const page = lodash_1.find(pages, page => (!platform || page.platform === platform) && (page.routeName === typeOrId || page.id === typeOrId));
|
81
78
|
if (!page)
|
82
79
|
return '/';
|
83
80
|
const path = page.slug;
|
84
|
-
return
|
81
|
+
return pathHelper_1.generatePath(path, options);
|
85
82
|
};
|
86
83
|
}
|
87
84
|
exports.getPagePath = getPagePath;
|
88
85
|
function getPageRouteName(pathOrId, platform = "APP") {
|
89
86
|
return (dispatch, getState) => {
|
90
87
|
const { pages: { records: { data: pages = [] } } } = getState();
|
91
|
-
const page = lodash_1.
|
88
|
+
const page = lodash_1.find(pages, page => (!platform || page.platform === platform) && (page.slug === pathOrId || page.id === pathOrId));
|
92
89
|
if (!page)
|
93
90
|
return 'LANDING_PAGE';
|
94
91
|
return page.routeName;
|
@@ -112,7 +109,7 @@ function getPath(type, options) {
|
|
112
109
|
const routes = [...site, ...adminRoutesMapped];
|
113
110
|
const route = routes.find(({ id }) => id === routeId);
|
114
111
|
if (route) {
|
115
|
-
return
|
112
|
+
return pathHelper_1.generatePath(route.path, options);
|
116
113
|
}
|
117
114
|
else {
|
118
115
|
return false;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/reducers/routes.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/reducers/routes.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mCAAiC;AACjC,sDAAqD;AAExC,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,kBAAkB,GAAG,oBAA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N,KAAK,4BAAoB;YACrB,uCACO,KAAK,KACR,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,IAC7E;QACN;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evlop/commons",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.166",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/main.js",
|
6
6
|
"peerDependencies": {
|
@@ -10,14 +10,14 @@
|
|
10
10
|
"lodash": "^4.17.21",
|
11
11
|
"react-native": "^0.68.2",
|
12
12
|
"react-native-vector-icons": "^9.1.0",
|
13
|
-
"uuid": "^8.3.2"
|
13
|
+
"uuid": "^8.3.2",
|
14
|
+
"query-string": "^7.1.0"
|
14
15
|
},
|
15
16
|
"optionalDependencies": {},
|
16
17
|
"dependencies": {
|
17
18
|
"axios-retry": "^3.3.1",
|
18
19
|
"events": "^3.3.0",
|
19
|
-
"moment": "^2.29.1"
|
20
|
-
"react-native-base64": "^0.2.1"
|
20
|
+
"moment": "^2.29.1"
|
21
21
|
},
|
22
22
|
"scripts": {
|
23
23
|
"prepack": " rm -rf dist && npm run build",
|
@@ -48,6 +48,7 @@
|
|
48
48
|
"jest": "^26.6.3",
|
49
49
|
"lodash": "^4.17.21",
|
50
50
|
"mocha": "^8.4.0",
|
51
|
+
"query-string": "^7.1.0",
|
51
52
|
"react-native": "^0.68.2",
|
52
53
|
"react-native-vector-icons": "^9.1.0",
|
53
54
|
"ts-node": "^10.4.0",
|