@memberstack/dom 1.9.26 → 1.9.28

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/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@memberstack/dom",
3
- "version": "1.9.26",
3
+ "version": "1.9.28",
4
4
  "main": "./lib/index.js",
5
+ "module": "./lib/index.mjs",
6
+ "types": "./lib/index.d.ts",
5
7
  "files": [
6
8
  "lib/**/*"
7
9
  ],
@@ -13,20 +15,24 @@
13
15
  "js-cookie": "^3.0.1"
14
16
  },
15
17
  "scripts": {
16
- "prepublishOnly": "yarn workspace prebuilt-uis build && npx tsc",
17
- "prepublishOnly:porter-dev": "yarn workspace prebuilt-uis build && npx tsc && yarn replace:vars:local endpoint=https://dev-client.memberstack.com",
18
+ "dev": "tsup --format esm,cjs --dts --watch --env.API_ENDPOINT=https://client.memberstack.com",
19
+ "build": "tsup --format esm,cjs --dts --env.API_ENDPOINT=https://client.memberstack.com",
20
+ "prepublishOnly": "yarn workspace prebuilt-uis build && yarn build:local",
21
+ "prepublishOnly:porter-prod": "yarn workspace prebuilt-uis build && tsup --format esm,cjs --dts --env.API_ENDPOINT=https://client.memberstack.com",
22
+ "prepublishOnly:porter-dev": "yarn workspace prebuilt-uis build && tsup --format esm,cjs --dts --env.API_ENDPOINT=https://dev-client.memberstack.com",
18
23
  "watch": "tsc-watch",
19
- "watch:dev": "tsc-watch --onSuccess 'yarn replace:vars:local'",
20
- "watch:dev-ngrok": "tsc-watch --onSuccess 'yarn replace:vars:local endpoint=https://client-testing.ngrok.io'",
21
- "watch:dev-api": "tsc-watch --onSuccess 'yarn replace:vars:local endpoint=https://dev-client.memberstack.com'",
22
- "clean": "rm -rf node_modules",
23
- "replace:vars:local": "ts-node utils/replaceDynamicVars -development",
24
+ "watch:dev": "tsup --format esm,cjs --dts --watch --env.API_ENDPOINT=http://localhost:3005",
25
+ "watch:dev-ngrok": "tsup --format esm,cjs --dts --watch --env.API_ENDPOINT=https://client-testing.ngrok.io",
26
+ "watch:dev-api": "tsup --format esm,cjs --dts --watch --env.API_ENDPOINT=https://dev-client.memberstack.com",
27
+ "clean": "rm -rf node_modules lib",
24
28
  "deploy:latest": "npx np --tag latest --no-tests --any-branch",
25
29
  "deploy:next": "npx np --tag next --no-tests --any-branch",
26
- "build:local": "npx tsc"
30
+ "build:local": "tsup --format esm,cjs --dts"
27
31
  },
28
32
  "devDependencies": {
29
33
  "replace-in-file": "^6.3.5",
30
- "ts-jest": "^26.5.6"
34
+ "ts-jest": "^26.5.6",
35
+ "tsc-watch": "^6.0.4",
36
+ "tsup": "^7.2.0"
31
37
  }
32
38
  }
@@ -1,7 +0,0 @@
1
- export declare const getPersistedMember: () => any;
2
- export declare const setPersistedMember: (member: any) => void;
3
- export declare const updatePersistedMember: (member: any) => void;
4
- export declare const unsetPersistedMember: () => void;
5
- export declare const onAuthChange: (cb: any) => {
6
- unsubscribe: () => boolean;
7
- };
package/lib/auth/index.js DELETED
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __spread = (this && this.__spread) || function () {
19
- for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
20
- return ar;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.onAuthChange = exports.unsetPersistedMember = exports.updatePersistedMember = exports.setPersistedMember = exports.getPersistedMember = void 0;
24
- var cookies_1 = require("../utils/cookies");
25
- var createObservable = function () {
26
- var observer = new Map();
27
- return {
28
- subscribe: function (key, fn) {
29
- if (typeof fn !== "function")
30
- return;
31
- return observer.set(key, fn);
32
- },
33
- unsubscribe: function (key) {
34
- return observer.delete(key);
35
- },
36
- notify: function (data) {
37
- return __spread(observer.values()).forEach(function (fn) { return fn(data); });
38
- },
39
- };
40
- };
41
- var observable = createObservable();
42
- exports.getPersistedMember = function () {
43
- return JSON.parse(localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem("_ms-mem"));
44
- };
45
- exports.setPersistedMember = function (member) {
46
- if (member) {
47
- var data = JSON.stringify(member);
48
- if (data)
49
- localStorage === null || localStorage === void 0 ? void 0 : localStorage.setItem("_ms-mem", data);
50
- observable.notify(member);
51
- }
52
- };
53
- exports.updatePersistedMember = function (member) {
54
- if (member) {
55
- var data = JSON.stringify(member);
56
- if (data)
57
- localStorage === null || localStorage === void 0 ? void 0 : localStorage.setItem("_ms-mem", data);
58
- }
59
- else {
60
- localStorage === null || localStorage === void 0 ? void 0 : localStorage.removeItem("_ms-mem");
61
- cookies_1.removeMemberToken();
62
- }
63
- };
64
- exports.unsetPersistedMember = function () {
65
- localStorage === null || localStorage === void 0 ? void 0 : localStorage.removeItem("_ms-mem");
66
- cookies_1.removeMemberToken();
67
- observable.notify(null);
68
- };
69
- exports.onAuthChange = function (cb) {
70
- var id = Math.floor(Math.random() * 1000);
71
- observable.subscribe(id, cb);
72
- return {
73
- unsubscribe: function () { return observable.unsubscribe(id); },
74
- };
75
- };
@@ -1,3 +0,0 @@
1
- export declare const endpoints: {
2
- API: string;
3
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.endpoints = void 0;
4
- exports.endpoints = {
5
- API: "https://client.memberstack.com"
6
- };
File without changes
File without changes
@@ -1,12 +0,0 @@
1
- export { Main as default };
2
- declare class Main extends SvelteComponent {
3
- constructor(options: any);
4
- }
5
- /**
6
- * Base class for Svelte components. Used when dev=false.
7
- */
8
- declare class SvelteComponent {
9
- $destroy(): void;
10
- $on(type: any, callback: any): () => void;
11
- $set($$props: any): void;
12
- }