@memberstack/dom 1.0.0-beta.19 → 1.0.0-beta.22

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.
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.endpoints = void 0;
4
4
  exports.endpoints = {
5
- parentOrigin: "https://ui.memberstack.com",
6
- loaderScript: "https://ui.memberstack.com/loader.cjs.production.min.js",
5
+ parentOrigin: "https://dev-ui-parent.vercel.app",
6
+ loaderScript: "https://dev-ui-parent.vercel.app/loader.cjs.production.min.js",
7
7
  };
package/lib/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export { Persistence } from "./auth/persistence";
2
- import { Methods } from "./methods";
3
- export default Methods;
2
+ declare const _default: {
3
+ init: any;
4
+ };
5
+ export default _default;
package/lib/index.js CHANGED
@@ -4,4 +4,4 @@ exports.Persistence = void 0;
4
4
  var persistence_1 = require("./auth/persistence");
5
5
  Object.defineProperty(exports, "Persistence", { enumerable: true, get: function () { return persistence_1.Persistence; } });
6
6
  var methods_1 = require("./methods");
7
- exports.default = methods_1.Methods;
7
+ exports.default = { init: methods_1.init };
@@ -1,21 +1,31 @@
1
1
  import type { DOMConfig } from "..";
2
- export declare type OpenModalParams = {
3
- type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD";
2
+ declare type ActionParams = {
3
+ onCompleted?: (x: any) => any;
4
+ onError?: (x: any) => any;
5
+ };
6
+ export declare type OpenModalParams = ActionParams & ({
7
+ type: "LOGIN";
4
8
  params?: {
5
9
  planId?: string;
6
- planPaymentOptionId?: string;
10
+ priceId?: string;
7
11
  };
8
- options?: {
9
- onCompleted?: (x: any) => any;
10
- onError?: (x: any) => any;
12
+ } | {
13
+ type: "SIGNUP";
14
+ params: {
15
+ planId: string;
16
+ priceId?: string;
11
17
  };
12
- };
18
+ } | {
19
+ type: "FORGOT_PASSWORD";
20
+ params: {};
21
+ });
13
22
  export declare const initDOM: (props: {
14
23
  publicKey: string;
15
- }) => {
16
- openModal: (props: OpenModalParams & DOMConfig) => void;
24
+ } & DOMConfig) => {
25
+ openModal: (openModalProps: OpenModalParams) => void;
17
26
  hideModal: any;
18
27
  onAuthChange: (cb: any) => {
19
28
  unsubscribe: () => boolean;
20
29
  };
21
30
  };
31
+ export {};
@@ -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
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.initDOM = void 0;
4
15
  var window_1 = require("../../constants/window");
@@ -8,7 +19,7 @@ var persistence_1 = require("../../auth/persistence");
8
19
  var initDOM = function (props) {
9
20
  var methods = window[window_1.Window.MEMBERSTACK].init({ publicKey: props.publicKey });
10
21
  return {
11
- openModal: function (props) { return openModal(methods, props); },
22
+ openModal: function (openModalProps) { return openModal(methods, __assign(__assign({}, props), openModalProps)); },
12
23
  hideModal: methods.hide,
13
24
  onAuthChange: persistence_1.onAuthChange
14
25
  };
@@ -17,7 +28,7 @@ exports.initDOM = initDOM;
17
28
  var openModal = function (methods, props) {
18
29
  methods.show(props.type, props.params);
19
30
  window.addEventListener("message", function (e) {
20
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
31
+ var _a, _b, _c, _d, _e, _f, _g, _h;
21
32
  if (e.origin === endpoint_1.endpoints.parentOrigin) {
22
33
  if (e.data.type === "CLOSE") {
23
34
  return methods.hide();
@@ -28,7 +39,7 @@ var openModal = function (methods, props) {
28
39
  if (props.useCookie && ((_f = (_e = (_d = e.data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.tokens) === null || _f === void 0 ? void 0 : _f.accessToken)) {
29
40
  (0, cookies_1.setMemberCookie)(e.data.data.tokens.accessToken);
30
41
  }
31
- (_h = (_g = props.options) === null || _g === void 0 ? void 0 : _g.onCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, (_j = e.data) === null || _j === void 0 ? void 0 : _j.data);
42
+ (_g = props.onCompleted) === null || _g === void 0 ? void 0 : _g.call(props, (_h = e.data) === null || _h === void 0 ? void 0 : _h.data);
32
43
  }
33
44
  });
34
45
  };
@@ -10,6 +10,3 @@ export declare type DOMConfig = ClientConfig & {
10
10
  useCookie?: boolean;
11
11
  };
12
12
  export declare const init: any;
13
- export declare const Methods: {
14
- init: any;
15
- };
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Methods = exports.init = void 0;
17
+ exports.init = void 0;
18
18
  var persistence_1 = require("../auth/persistence");
19
19
  var proxy_1 = __importDefault(require("../utils/proxy"));
20
20
  var methods_1 = require("./dom/methods");
@@ -33,4 +33,3 @@ exports.init = withScript(function (props) {
33
33
  var methods = (0, methods_1.initDOM)({ publicKey: props.publicKey });
34
34
  return Object.assign(client, methods);
35
35
  });
36
- exports.Methods = { init: exports.init };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberstack/dom",
3
- "version": "1.0.0-beta.19",
3
+ "version": "1.0.0-beta.22",
4
4
  "main": "./lib/index.js",
5
5
  "files": [
6
6
  "lib/**/*"