@vocollege/app 0.0.107 → 0.0.108

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.
@@ -66,4 +66,5 @@ export declare const getObjValue: (obj: any, ...props: string[]) => any;
66
66
  * https://bugzilla.mozilla.org/show_bug.cgi?id=700533
67
67
  */
68
68
  export declare const convertSvgToImage: (url: string, width?: null | number, height?: null | number, format?: string, quality?: number) => Promise<unknown>;
69
+ export declare const getCollegeUrl: (item: any, origin?: string) => string;
69
70
  export {};
@@ -59,7 +59,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
59
59
  return (mod && mod.__esModule) ? mod : { "default": mod };
60
60
  };
61
61
  Object.defineProperty(exports, "__esModule", { value: true });
62
- exports.convertSvgToImage = exports.getObjValue = exports.getGroupLogotype = exports.reducer = exports.changeObj = exports.parseState = exports.getUserString = exports.getContactName = exports.getImageDescription = exports.getImage = exports.getImageContact = exports.shortenText = exports.orderByField = exports.orderByPosition = exports.downloadFile = exports.wrapPromise = exports.createSlug2 = exports.getTemporaryId = exports.getError = exports.regexPatterns = exports.encodeQueryData = exports.localStorage = exports.createRandomString = exports.base64Url = void 0;
62
+ exports.getCollegeUrl = exports.convertSvgToImage = exports.getObjValue = exports.getGroupLogotype = exports.reducer = exports.changeObj = exports.parseState = exports.getUserString = exports.getContactName = exports.getImageDescription = exports.getImage = exports.getImageContact = exports.shortenText = exports.orderByField = exports.orderByPosition = exports.downloadFile = exports.wrapPromise = exports.createSlug2 = exports.getTemporaryId = exports.getError = exports.regexPatterns = exports.encodeQueryData = exports.localStorage = exports.createRandomString = exports.base64Url = void 0;
63
63
  var crypto_js_1 = __importDefault(require("crypto-js"));
64
64
  var he_1 = __importDefault(require("he"));
65
65
  var base64Url = function (string) {
@@ -484,3 +484,21 @@ var convertSvgToImage = function (url, width, height, format, quality) {
484
484
  }); });
485
485
  };
486
486
  exports.convertSvgToImage = convertSvgToImage;
487
+ var getCollegeUrl = function (item, origin) {
488
+ if (!origin && typeof window === "undefined") {
489
+ return "/";
490
+ }
491
+ var currentUrl = new URL(origin || window.location.href);
492
+ var urlParts = currentUrl.host.split(".");
493
+ var url = [
494
+ item === null || item === void 0 ? void 0 : item.name,
495
+ urlParts[urlParts.length - 2],
496
+ urlParts[urlParts.length - 1],
497
+ ];
498
+ var currentGroupParts = urlParts[0].split("-");
499
+ if (currentGroupParts[0] === "local") {
500
+ url[0] = "local-".concat(url[0]);
501
+ }
502
+ return currentUrl.protocol + "//" + url.join(".");
503
+ };
504
+ exports.getCollegeUrl = getCollegeUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vocollege/app",
3
- "version": "0.0.107",
3
+ "version": "0.0.108",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -431,3 +431,21 @@ export const convertSvgToImage = (
431
431
  }
432
432
  });
433
433
  };
434
+
435
+ export const getCollegeUrl = (item: any, origin?: string) => {
436
+ if (!origin && typeof window === "undefined") {
437
+ return "/";
438
+ }
439
+ const currentUrl = new URL(origin || window.location.href);
440
+ let urlParts = currentUrl.host.split(".");
441
+ let url = [
442
+ item?.name,
443
+ urlParts[urlParts.length - 2],
444
+ urlParts[urlParts.length - 1],
445
+ ];
446
+ let currentGroupParts = urlParts[0].split("-");
447
+ if (currentGroupParts[0] === "local") {
448
+ url[0] = `local-${url[0]}`;
449
+ }
450
+ return currentUrl.protocol + "//" + url.join(".");
451
+ };