@go1/go1-embedding-react-sdk 0.0.10 → 0.0.11
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.
package/dist/common/params.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function addPortalURL(url: URL, portalURL: string, env?: '
|
|
1
|
+
export declare function addPortalURL(url: URL, portalURL: string, env?: 'staging' | 'production'): void;
|
|
2
2
|
export declare function addOneTimeToken(url: URL, oneTimeToken: string): void;
|
|
3
3
|
export declare function isValidFeature(feature: string): boolean;
|
package/dist/common/params.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isValidFeature = exports.addOneTimeToken = exports.addPortalURL = void 0;
|
|
4
|
-
function addPortalURL(url, portalURL, env = '
|
|
4
|
+
function addPortalURL(url, portalURL, env = 'production') {
|
|
5
5
|
let validPortalURL = /^(?=.{1,255}$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,245}[a-zA-Z0-9])?\.mygo1\.com$/;
|
|
6
|
-
if (env === '
|
|
6
|
+
if (env === 'staging') {
|
|
7
7
|
validPortalURL = /^(?=.{1,255}$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,245}[a-zA-Z0-9])?\.qa\.go1\.cloud$/;
|
|
8
8
|
}
|
|
9
9
|
if (validPortalURL.test(portalURL)) {
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { InitOptions, SendMessageToGo1 } from '../../common/types';
|
|
3
3
|
export type ContentViewProps = Omit<InitOptions, 'iframeParentId' | 'iframeParentElement'>;
|
|
4
4
|
type EnvProps = {
|
|
5
|
-
env?: '
|
|
5
|
+
env?: 'staging' | 'production';
|
|
6
6
|
};
|
|
7
7
|
export declare function useGo1ContentView(props: ContentViewProps & EnvProps): {
|
|
8
8
|
sendMessageToGo1: SendMessageToGo1;
|
|
@@ -6,10 +6,10 @@ const react_1 = require("react");
|
|
|
6
6
|
const constants_1 = require("../../common/constants");
|
|
7
7
|
const params_1 = require("../../common/params");
|
|
8
8
|
function useGo1ContentView(props) {
|
|
9
|
-
const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, env = '
|
|
9
|
+
const { feature, featureAttributes, portalURL, oneTimeToken, onGo1MessageReceived, additionalUserInfo, themeInformation, env = 'production', } = props;
|
|
10
10
|
const iframeRef = (0, react_1.useRef)(null);
|
|
11
11
|
let url = 'https://embedding.go1.com';
|
|
12
|
-
if (env === '
|
|
12
|
+
if (env === 'staging') {
|
|
13
13
|
url = 'https://embedding.qa.go1.cloud';
|
|
14
14
|
}
|
|
15
15
|
if (!(0, params_1.isValidFeature)(feature)) {
|