@saasquatch/component-environment 1.0.1-2 → 1.0.2-0
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/index.d.ts +3 -0
- package/dist/index.js +10 -3
- package/dist/index.mjs +10 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -79,7 +79,7 @@ function getEnvironment() {
|
|
|
79
79
|
return getEnvironmentSDK().type;
|
|
80
80
|
}
|
|
81
81
|
function getEnvironmentSDK() {
|
|
82
|
-
var _a, _b;
|
|
82
|
+
var _a, _b, _c;
|
|
83
83
|
if (window["SquatchAndroid"]) {
|
|
84
84
|
return {
|
|
85
85
|
type: "SquatchAndroid",
|
|
@@ -99,10 +99,10 @@ function getEnvironmentSDK() {
|
|
|
99
99
|
adminSDK: window["SquatchAdmin"]
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
if (window["
|
|
102
|
+
if (((_a = window.frameElement) == null ? void 0 : _a["squatchJsApi"]) && ((_b = window["widgetIdent"]) == null ? void 0 : _b.env) !== "demo") {
|
|
103
103
|
return {
|
|
104
104
|
type: "SquatchJS2",
|
|
105
|
-
api: (
|
|
105
|
+
api: (_c = window.frameElement) == null ? void 0 : _c["squatchJsApi"],
|
|
106
106
|
widgetIdent: window["widgetIdent"]
|
|
107
107
|
};
|
|
108
108
|
}
|
|
@@ -119,6 +119,7 @@ function getTenantAlias() {
|
|
|
119
119
|
const sdk = getEnvironmentSDK();
|
|
120
120
|
switch (sdk.type) {
|
|
121
121
|
case "SquatchAndroid":
|
|
122
|
+
case "SquatchIOS":
|
|
122
123
|
case "SquatchJS2":
|
|
123
124
|
return sdk.widgetIdent.tenantAlias;
|
|
124
125
|
case "SquatchAdmin":
|
|
@@ -134,6 +135,7 @@ function getAppDomain() {
|
|
|
134
135
|
const sdk = getEnvironmentSDK();
|
|
135
136
|
switch (sdk.type) {
|
|
136
137
|
case "SquatchAndroid":
|
|
138
|
+
case "SquatchIOS":
|
|
137
139
|
case "SquatchJS2":
|
|
138
140
|
return sdk.widgetIdent.appDomain;
|
|
139
141
|
case "SquatchPortal":
|
|
@@ -149,6 +151,7 @@ function getEngagementMedium() {
|
|
|
149
151
|
case "SquatchJS2":
|
|
150
152
|
return sdk.widgetIdent.engagementMedium || DEFAULT_MEDIUM;
|
|
151
153
|
case "SquatchAndroid":
|
|
154
|
+
case "SquatchIOS":
|
|
152
155
|
case "SquatchPortal":
|
|
153
156
|
case "SquatchAdmin":
|
|
154
157
|
case "None":
|
|
@@ -528,8 +531,12 @@ function userIdentityFromJwt(jwt) {
|
|
|
528
531
|
function _getInitialValue() {
|
|
529
532
|
const sdk = getEnvironmentSDK();
|
|
530
533
|
switch (sdk.type) {
|
|
534
|
+
case "SquatchIOS":
|
|
531
535
|
case "SquatchAndroid":
|
|
532
536
|
case "SquatchJS2":
|
|
537
|
+
const { userId, accountId, token } = sdk.widgetIdent;
|
|
538
|
+
if (!userId || !accountId || !token)
|
|
539
|
+
return void 0;
|
|
533
540
|
return {
|
|
534
541
|
id: sdk.widgetIdent.userId,
|
|
535
542
|
accountId: sdk.widgetIdent.accountId,
|
package/dist/index.mjs
CHANGED
|
@@ -30,7 +30,7 @@ function getEnvironment() {
|
|
|
30
30
|
return getEnvironmentSDK().type;
|
|
31
31
|
}
|
|
32
32
|
function getEnvironmentSDK() {
|
|
33
|
-
var _a, _b;
|
|
33
|
+
var _a, _b, _c;
|
|
34
34
|
if (window["SquatchAndroid"]) {
|
|
35
35
|
return {
|
|
36
36
|
type: "SquatchAndroid",
|
|
@@ -50,10 +50,10 @@ function getEnvironmentSDK() {
|
|
|
50
50
|
adminSDK: window["SquatchAdmin"]
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
if (window["
|
|
53
|
+
if (((_a = window.frameElement) == null ? void 0 : _a["squatchJsApi"]) && ((_b = window["widgetIdent"]) == null ? void 0 : _b.env) !== "demo") {
|
|
54
54
|
return {
|
|
55
55
|
type: "SquatchJS2",
|
|
56
|
-
api: (
|
|
56
|
+
api: (_c = window.frameElement) == null ? void 0 : _c["squatchJsApi"],
|
|
57
57
|
widgetIdent: window["widgetIdent"]
|
|
58
58
|
};
|
|
59
59
|
}
|
|
@@ -70,6 +70,7 @@ function getTenantAlias() {
|
|
|
70
70
|
const sdk = getEnvironmentSDK();
|
|
71
71
|
switch (sdk.type) {
|
|
72
72
|
case "SquatchAndroid":
|
|
73
|
+
case "SquatchIOS":
|
|
73
74
|
case "SquatchJS2":
|
|
74
75
|
return sdk.widgetIdent.tenantAlias;
|
|
75
76
|
case "SquatchAdmin":
|
|
@@ -85,6 +86,7 @@ function getAppDomain() {
|
|
|
85
86
|
const sdk = getEnvironmentSDK();
|
|
86
87
|
switch (sdk.type) {
|
|
87
88
|
case "SquatchAndroid":
|
|
89
|
+
case "SquatchIOS":
|
|
88
90
|
case "SquatchJS2":
|
|
89
91
|
return sdk.widgetIdent.appDomain;
|
|
90
92
|
case "SquatchPortal":
|
|
@@ -100,6 +102,7 @@ function getEngagementMedium() {
|
|
|
100
102
|
case "SquatchJS2":
|
|
101
103
|
return sdk.widgetIdent.engagementMedium || DEFAULT_MEDIUM;
|
|
102
104
|
case "SquatchAndroid":
|
|
105
|
+
case "SquatchIOS":
|
|
103
106
|
case "SquatchPortal":
|
|
104
107
|
case "SquatchAdmin":
|
|
105
108
|
case "None":
|
|
@@ -479,8 +482,12 @@ function userIdentityFromJwt(jwt) {
|
|
|
479
482
|
function _getInitialValue() {
|
|
480
483
|
const sdk = getEnvironmentSDK();
|
|
481
484
|
switch (sdk.type) {
|
|
485
|
+
case "SquatchIOS":
|
|
482
486
|
case "SquatchAndroid":
|
|
483
487
|
case "SquatchJS2":
|
|
488
|
+
const { userId, accountId, token } = sdk.widgetIdent;
|
|
489
|
+
if (!userId || !accountId || !token)
|
|
490
|
+
return void 0;
|
|
484
491
|
return {
|
|
485
492
|
id: sdk.widgetIdent.userId,
|
|
486
493
|
accountId: sdk.widgetIdent.accountId,
|