Socket
Socket
Sign inDemoInstall

purecloud-client-app-sdk

Package Overview
Dependencies
11
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.6.0 to 2.6.1

dist/purecloud-client-app-sdk-70cdb3a5.min.js

4

dist/index.d.ts

@@ -11,3 +11,3 @@ /**

*/
import { PcEnv, EnvironmentParser } from './utils/env';
import { PcEnv } from './utils/env';
import AlertingApi from './modules/alerting';

@@ -189,3 +189,3 @@ import LifecycleApi from './modules/lifecycle';

protected lookupEnv(env: string, envTlds?: string[], hostAppDevOrigin?: string): PcEnv;
protected lookupGcEnv(hostOrigin: string, targetEnv: string, parseEnvironment?: EnvironmentParser): PcEnv;
protected lookupGcEnv(hostOrigin: string, targetEnv: string, envs?: Environment[]): PcEnv;
/**

@@ -192,0 +192,0 @@ * Returns the pcEnvironment (e.g. mypurecloud.com, mypurecloud.jp) if known; null otherwise.

@@ -1,3 +0,1 @@

import { parse } from 'genesys-cloud-service-discovery-web';
export declare type EnvironmentParser = typeof parse;
export interface PcEnv {

@@ -23,5 +21,5 @@ pcEnvTld: string;

* @param targetEnv A string representing the Genesys Cloud environment target
* @param parseEnvironment A method used to parse the Genesys Cloud environment url
* @param envs A Environment array of all available Genesys Cloud environments
* @returns A Genesys Cloud environment object if found; null otherwise.
*/
export declare const lookupGcEnv: (url: string, targetEnv: string, parseEnvironment?: EnvironmentParser) => PcEnv | null;
export declare const lookupGcEnv: (url: string, targetEnv: string, envs?: Environment[]) => PcEnv | null;
{
"name": "purecloud-client-app-sdk",
"version": "2.6.0",
"version": "2.6.1",
"description": "Javascript API for integrating 3rd-party apps with Genesys Cloud",

@@ -5,0 +5,0 @@ "main": "dist/main.js",

@@ -13,3 +13,3 @@ /**

import * as queryString from 'query-string';
import { lookupPcEnv, lookupGcEnv, PcEnv, DEFAULT_PC_ENV, EnvironmentParser } from './utils/env';
import { lookupPcEnv, lookupGcEnv, PcEnv, DEFAULT_PC_ENV } from './utils/env';
import AlertingApi from './modules/alerting';

@@ -255,4 +255,4 @@ import LifecycleApi from './modules/lifecycle';

}
protected lookupGcEnv(hostOrigin: string, targetEnv: string, parseEnvironment?: EnvironmentParser) {
const pcEnv = lookupGcEnv(hostOrigin, targetEnv, parseEnvironment);
protected lookupGcEnv(hostOrigin: string, targetEnv: string, envs?: Environment[]) {
const pcEnv = lookupGcEnv(hostOrigin, targetEnv, envs);
if (!pcEnv) throw new Error(`Could not parse ${hostOrigin} (${targetEnv}) into a known GenesysCloud environment`);

@@ -259,0 +259,0 @@ return pcEnv;

@@ -1,4 +0,4 @@

import { getEnvironments, parse } from 'genesys-cloud-service-discovery-web';
/* eslint-disable no-console */
import { getEnvironments } from 'genesys-cloud-service-discovery-web';
export type EnvironmentParser = typeof parse;
export interface PcEnv {

@@ -24,3 +24,2 @@ pcEnvTld: string;

.concat(__PC_DEV_ENVS__);
const GC_ENV_NAMES = new Set<string>([...environments, ...__GC_DEV_EXTRA_ENVS__].map((e) => e.name));

@@ -31,8 +30,16 @@ const [defaultEnv] = environments.filter(env => env.region === DEFAULT_ENV_REGION);

function isKnownEnvName(toCheck: string) {
return GC_ENV_NAMES.has(toCheck);
function isKnownEnvName(toCheck: string, envs: Environment[]) {
const envList = new Set<string>([...envs, ...__GC_DEV_EXTRA_ENVS__].map((e) => e.name));
return envList.has(toCheck);
}
function findPcEnvironment(location: URL, targetEnv: string, parseEnvironment: EnvironmentParser): PcEnv|null {
const parsedEnv = parseEnvironment(location.origin, {});
const matchesHostname = (hostname: string) => (domain: string) => {
return hostname === domain || hostname.endsWith(`.${domain}`);
};
function findPcEnvironment(location: URL, targetEnv: string, envs: Environment[]): PcEnv|null {
const parsedEnv = [...envs, ...__GC_DEV_EXTRA_ENVS__].find(({ publicDomainName, publicDomainAliases }) => {
const domains = [publicDomainName, ...publicDomainAliases].filter(d => !!d);
return domains.some(matchesHostname(location.hostname));
});
if (parsedEnv && parsedEnv.name === targetEnv) {

@@ -43,13 +50,2 @@ return {

};
} else {
for (const environment of __GC_DEV_EXTRA_ENVS__) {
const publicDomains = [environment.publicDomainName, ...(environment.publicDomainAliases || [])];
const matchingDomain = publicDomains.find((p) => location.hostname === p || location.hostname.endsWith(`.${p}`));
if (matchingDomain && environment.name === targetEnv) {
return {
pcEnvTld: environment.publicDomainName,
pcAppOrigin: location.origin
};
}
}
}

@@ -103,7 +99,7 @@ return null;

* @param targetEnv A string representing the Genesys Cloud environment target
* @param parseEnvironment A method used to parse the Genesys Cloud environment url
* @param envs A Environment array of all available Genesys Cloud environments
* @returns A Genesys Cloud environment object if found; null otherwise.
*/
export const lookupGcEnv = (url: string, targetEnv: string, parseEnvironment: EnvironmentParser = parse): PcEnv|null => {
if (!isKnownEnvName(targetEnv)) {
export const lookupGcEnv = (url: string, targetEnv: string, envs: Environment[] = environments): PcEnv|null => {
if (!isKnownEnvName(targetEnv, envs)) {
return null;

@@ -119,3 +115,3 @@ }

} else {
return findPcEnvironment(hostLocation, targetEnv, parseEnvironment);
return findPcEnvironment(hostLocation, targetEnv, envs);
}

@@ -122,0 +118,0 @@ } catch {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc