@memberstack/dom 1.3.2 → 1.4.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/lib/index.d.ts +1 -1
- package/lib/methods/dom/methods.d.ts +1 -1
- package/lib/methods/dom/methods.js +22 -11
- package/lib/methods/index.d.ts +1 -1
- package/package.json +5 -3
package/lib/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ declare const _default: {
|
|
|
41
41
|
_showLoader: (element?: any) => void;
|
|
42
42
|
_hideLoader: (element?: any) => void;
|
|
43
43
|
_showMessage: (msg: any, isError: any) => void;
|
|
44
|
-
openModal: (type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD", params?: {
|
|
44
|
+
openModal: (type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD" | "PROFILE", params?: {
|
|
45
45
|
planId?: string;
|
|
46
46
|
priceId?: string;
|
|
47
47
|
}, options?: {
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -58,6 +69,7 @@ var endpoint_1 = require("../../constants/endpoint");
|
|
|
58
69
|
var cookies_1 = require("../../utils/cookies");
|
|
59
70
|
var persistence_1 = require("../../auth/persistence");
|
|
60
71
|
var logger_1 = require("../../utils/logger");
|
|
72
|
+
var cookies_2 = require("../../utils/cookies");
|
|
61
73
|
var isBrowser = typeof window !== "undefined";
|
|
62
74
|
var isInitialized = function () {
|
|
63
75
|
if (!isBrowser)
|
|
@@ -116,13 +128,15 @@ var TYPE_PARAMS = {
|
|
|
116
128
|
LOGIN: "login",
|
|
117
129
|
SIGNUP: "signup",
|
|
118
130
|
FORGOT_PASSWORD: "sendResetEmail",
|
|
131
|
+
PROFILE: "profile",
|
|
119
132
|
};
|
|
120
133
|
var createLink = function (query) {
|
|
121
|
-
var _a = query.planId, planId = _a === void 0 ? "" : _a, _b = query.appId, appId = _b === void 0 ? "" : _b, _c = query.page, page = _c === void 0 ? "" : _c, _d = query.priceId, priceId = _d === void 0 ? "" : _d, _e = query.pk, pk = _e === void 0 ? "" : _e, _f = query.hideNav, hideNav = _f === void 0 ? "" : _f;
|
|
122
|
-
var queryParams = Object.keys({ priceId: priceId, pk: pk, hideNav: hideNav })
|
|
134
|
+
var _a = query.planId, planId = _a === void 0 ? "" : _a, _b = query.appId, appId = _b === void 0 ? "" : _b, _c = query.page, page = _c === void 0 ? "" : _c, _d = query.priceId, priceId = _d === void 0 ? "" : _d, _e = query.pk, pk = _e === void 0 ? "" : _e, _f = query.hideNav, hideNav = _f === void 0 ? "" : _f, _g = query.token, token = _g === void 0 ? "" : _g;
|
|
135
|
+
var queryParams = Object.keys({ priceId: priceId, pk: pk, hideNav: hideNav, token: token })
|
|
123
136
|
.map(function (key) { return query[key] && encodeURIComponent(key) + "=" + encodeURIComponent(query[key]); })
|
|
124
137
|
.filter(function (x) { return x; })
|
|
125
138
|
.join("&");
|
|
139
|
+
console.log("CREATE LINK", token);
|
|
126
140
|
var baseUrl = endpoint_1.endpoints.hostedUI + "/" + (appId || "") + (page ? "/" + page : "") + (planId ? (page === "signup" ? "/" + planId : "?planId=" + planId) : "");
|
|
127
141
|
return "" + baseUrl + (baseUrl.includes("?planId") ? "&" : "?") + queryParams;
|
|
128
142
|
};
|
|
@@ -171,7 +185,7 @@ var hideLoader = function (element) {
|
|
|
171
185
|
};
|
|
172
186
|
exports.hideLoader = hideLoader;
|
|
173
187
|
var openModal = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
174
|
-
var appId, page, link, div, iframe, iframestyles;
|
|
188
|
+
var appId, page, token, link, div, iframe, iframestyles;
|
|
175
189
|
var _a, _b;
|
|
176
190
|
return __generator(this, function (_c) {
|
|
177
191
|
switch (_c.label) {
|
|
@@ -182,13 +196,10 @@ var openModal = function (props) { return __awaiter(void 0, void 0, void 0, func
|
|
|
182
196
|
case 1:
|
|
183
197
|
appId = _c.sent();
|
|
184
198
|
page = TYPE_PARAMS[props.type];
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
appId: appId,
|
|
190
|
-
page: page,
|
|
191
|
-
});
|
|
199
|
+
if (props.type === "PROFILE") {
|
|
200
|
+
token = (0, cookies_2.getMemberCookie)();
|
|
201
|
+
}
|
|
202
|
+
link = createLink(__assign({ pk: props.publicKey, planId: (_a = props.params) === null || _a === void 0 ? void 0 : _a.planId, priceId: (_b = props.params) === null || _b === void 0 ? void 0 : _b.priceId, appId: appId, page: page }, (token ? { token: token } : {})));
|
|
192
203
|
div = document.createElement("div");
|
|
193
204
|
div.setAttribute("data-ms-iframe", "true");
|
|
194
205
|
div.style["position"] = "fixed";
|
|
@@ -203,7 +214,7 @@ var openModal = function (props) { return __awaiter(void 0, void 0, void 0, func
|
|
|
203
214
|
top: 0,
|
|
204
215
|
bottom: 0,
|
|
205
216
|
border: "none",
|
|
206
|
-
zIndex: "2000000"
|
|
217
|
+
zIndex: "2000000",
|
|
207
218
|
};
|
|
208
219
|
Object.entries(iframestyles).map(function (_a) {
|
|
209
220
|
var _b = __read(_a, 2), attr = _b[0], value = _b[1];
|
package/lib/methods/index.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ declare const _default: {
|
|
|
56
56
|
_showLoader: (element?: any) => void;
|
|
57
57
|
_hideLoader: (element?: any) => void;
|
|
58
58
|
_showMessage: (msg: any, isError: any) => void;
|
|
59
|
-
openModal: (type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD", params?: {
|
|
59
|
+
openModal: (type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD" | "PROFILE", params?: {
|
|
60
60
|
planId?: string;
|
|
61
61
|
priceId?: string;
|
|
62
62
|
}, options?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberstack/dom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*"
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"prepublishOnly": "npx tsc",
|
|
16
16
|
"watch": "tsc-watch --onSuccess 'yarn replace:vars:local'",
|
|
17
17
|
"clean": "rm -rf node_modules",
|
|
18
|
-
"replace:vars:local": "ts-node utils/replaceDynamicVars -development"
|
|
18
|
+
"replace:vars:local": "ts-node utils/replaceDynamicVars -development",
|
|
19
|
+
"deploy:latest": "npx np --tag latest --no-tests --any-branch",
|
|
20
|
+
"deploy:next": "npx np --tag next --no-tests --any-branch"
|
|
19
21
|
}
|
|
20
|
-
}
|
|
22
|
+
}
|