@saasquatch/squatch-js 2.8.3-3 → 2.8.3-30

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/babelregister.js +0 -1
  3. package/coverage/base.css +224 -0
  4. package/coverage/block-navigation.js +87 -0
  5. package/coverage/clover.xml +996 -0
  6. package/coverage/coverage-final.json +26 -0
  7. package/coverage/favicon.png +0 -0
  8. package/coverage/prettify.css +1 -0
  9. package/coverage/prettify.js +2 -0
  10. package/coverage/sort-arrow-sprite.png +0 -0
  11. package/coverage/sorter.js +210 -0
  12. package/demo/perf-benchmark.ts +363 -0
  13. package/demo/perf-compare.html +870 -0
  14. package/demo/perf-deploy/vercel.json +17 -0
  15. package/demo/perf-frame.html +417 -0
  16. package/demo/perf-server.ts +131 -0
  17. package/dist/ErrorTemplate-DUNm11h9.js +124 -0
  18. package/dist/ErrorTemplate-DUNm11h9.js.map +1 -0
  19. package/dist/ErrorTemplate-DumOlC5f.cjs +109 -0
  20. package/dist/ErrorTemplate-DumOlC5f.cjs.map +1 -0
  21. package/dist/SkeletonTemplate-B3Bk4NFu.cjs +243 -0
  22. package/dist/SkeletonTemplate-B3Bk4NFu.cjs.map +1 -0
  23. package/dist/SkeletonTemplate-Day_0iMM.js +246 -0
  24. package/dist/SkeletonTemplate-Day_0iMM.js.map +1 -0
  25. package/dist/squatch.cjs.js +33 -2523
  26. package/dist/squatch.cjs.js.map +1 -1
  27. package/dist/squatch.esm.js +928 -1956
  28. package/dist/squatch.esm.js.map +1 -1
  29. package/dist/squatch.js +227 -2373
  30. package/dist/squatch.js.map +1 -1
  31. package/dist/squatch.min.js +4 -5
  32. package/dist/types.d.ts +134 -1
  33. package/dist/utils/cookieUtils.d.ts +1 -0
  34. package/dist/utils/logger.d.ts +23 -0
  35. package/dist/widgets/EmbedWidget.d.ts +1 -1
  36. package/dist/widgets/ErrorTemplate.d.ts +9 -0
  37. package/dist/widgets/PopupWidget.d.ts +3 -5
  38. package/dist/widgets/SkeletonTemplate.d.ts +1 -4
  39. package/dist/widgets/Widget.d.ts +29 -2
  40. package/dist/widgets/declarative/DeclarativeWidget.d.ts +9 -1
  41. package/dist/widgets/declarative/DeclarativeWidgets.d.ts +0 -6
  42. package/package.json +11 -15
  43. package/vite-env.d.ts +2 -1
  44. package/vite.config.ts +17 -0
  45. package/babel.config.js +0 -8
  46. package/jest.config.ts +0 -200
@@ -84,7 +84,12 @@ export default abstract class DeclarativeWidget extends HTMLElement {
84
84
  * Builds a Widget instance for the default error widget
85
85
  * @returns Instance of either {@link EmbedWidget} or {@link PopupWidget} depending on `this.type`
86
86
  */
87
- setErrorWidget: (e: Error) => EmbedWidget | PopupWidget;
87
+ setErrorWidget: (e: Error | {
88
+ apiErrorCode?: string;
89
+ rsCode?: string;
90
+ statusCode?: number;
91
+ message?: string;
92
+ }) => EmbedWidget | PopupWidget;
88
93
  /**
89
94
  * Calls `open` method of `widgetInstance`
90
95
  * @throws Throws an Error if called before the widget has loaded
@@ -98,4 +103,7 @@ export default abstract class DeclarativeWidget extends HTMLElement {
98
103
  reload: () => Promise<void>;
99
104
  show: () => void;
100
105
  hide: () => void;
106
+ static get observedAttributes(): string[];
107
+ attributeChangedCallback(attr: string, oldVal: string, newVal: string): void;
108
+ connectedCallback(): Promise<void>;
101
109
  }
@@ -12,9 +12,6 @@ import { default as DeclarativeWidget } from './DeclarativeWidget';
12
12
  */
13
13
  export declare class DeclarativeEmbedWidget extends DeclarativeWidget {
14
14
  constructor();
15
- static get observedAttributes(): string[];
16
- attributeChangedCallback(attr: string, oldVal: string, newVal: string): void;
17
- connectedCallback(): Promise<void>;
18
15
  }
19
16
  /**
20
17
  * Base class for `squatch-popup` web-component
@@ -29,7 +26,4 @@ export declare class DeclarativeEmbedWidget extends DeclarativeWidget {
29
26
  */
30
27
  export declare class DeclarativePopupWidget extends DeclarativeWidget {
31
28
  constructor();
32
- static get observedAttributes(): string[];
33
- attributeChangedCallback(attr: string, oldVal: string, newVal: string): void;
34
- connectedCallback(): Promise<void>;
35
29
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasquatch/squatch-js",
3
3
  "type": "module",
4
- "version": "2.8.3-3",
4
+ "version": "2.8.3-30",
5
5
  "description": "The official Referral SaaSquatch Javascript Web/Browser SDK https://docs.referralsaasquatch.com/developer/squatchjs/",
6
6
  "license": "MIT",
7
7
  "author": "ReferralSaaSquatch.com, Inc.",
@@ -36,8 +36,8 @@
36
36
  "test:webkit": "cross-env BROWSER=webkit cucumber-js",
37
37
  "test:firefox": "cross-env BROWSER=firefox cucumber-js",
38
38
  "test:types": "tsd",
39
- "test:features": "jest --verbose --coverage",
40
- "test:utf8": "jest --verbose -t 'UTF-8 characters in different languages'",
39
+ "test:features": "vitest run --coverage",
40
+ "test:utf8": "vitest run -t 'UTF-8 characters in different languages'",
41
41
  "test": "run-s test:features test:browser test:webkit test:firefox",
42
42
  "build:docs": "typedoc",
43
43
  "deploy": "np --no-cleanup",
@@ -45,6 +45,9 @@
45
45
  "preversion": "run-s build",
46
46
  "demo": "msw init demo/dist/ --save && run-p static parcel",
47
47
  "demo:deploy": "run-s parcel:build parcel:deploy",
48
+ "perf": "npx tsx demo/perf-benchmark.ts",
49
+ "perf:ui": "npx tsx demo/perf-server.ts",
50
+ "perf:deploy": "cp demo/perf-compare.html demo/perf-deploy/index.html && cp demo/perf-frame.html demo/perf-deploy/perf-frame.html && cd demo/perf-deploy && vercel --prod",
48
51
  "static": "serve -l 3333 -s dist",
49
52
  "parcel": "cd demo && parcel index.html",
50
53
  "parcel:build": "cd demo && parcel build index.html",
@@ -52,13 +55,11 @@
52
55
  },
53
56
  "devDependencies": {
54
57
  "@babel/core": "^7.14.3",
55
- "@babel/plugin-proposal-class-properties": "^7.13.0",
56
58
  "@babel/plugin-transform-runtime": "^7.14.3",
57
59
  "@babel/preset-env": "^7.14.2",
58
60
  "@babel/preset-typescript": "^7.13.0",
59
61
  "@babel/register": "^7.13.16",
60
62
  "@babel/runtime-corejs2": "^7.14.0",
61
- "@happy-dom/jest-environment": "^9.20.3",
62
63
  "@open-wc/testing-helpers": "^2.3.0",
63
64
  "@size-limit/preset-small-lib": "^8.2.4",
64
65
  "@testing-library/dom": "^9.3.1",
@@ -67,22 +68,19 @@
67
68
  "@types/estree": "^1.0.1",
68
69
  "@types/express": "^4.17.6",
69
70
  "@types/inquirer": "^9.0.3",
70
- "@types/jest": "^29.5.2",
71
- "@types/js-cookie": "^2.2.6",
72
71
  "@types/jsdom-global": "^3.0.2",
73
72
  "@types/react": "^16.9.35",
74
73
  "@ungap/url-search-params": "^0.2.0",
74
+ "@vitest/coverage-v8": "^4.1.2",
75
75
  "ajv": "^8.17.1",
76
- "babel-jest": "^29.5.0",
77
76
  "babel-loader": "^8.2.2",
78
77
  "base64-url": "^2.3.3",
79
78
  "chai": "^4.3.7",
80
79
  "cross-env": "^7.0.2",
81
80
  "cucumber": "^6.0.5",
82
81
  "express": "^4.17.1",
83
- "jest": "^29.5.0",
82
+ "happy-dom": "^20.8.9",
84
83
  "jest-cucumber": "^3.0.1",
85
- "jest-environment-jsdom": "^29.5.0",
86
84
  "microbundle": "^0.13.0",
87
85
  "msw": "^0.36.8",
88
86
  "np": "^6.2.3",
@@ -97,21 +95,19 @@
97
95
  "serve": "^11.3.0",
98
96
  "size-limit": "^8.2.4",
99
97
  "terser": "^5.39.1",
100
- "ts-jest": "^29.3.3",
101
98
  "ts-loader": "^7.0.4",
102
99
  "ts-node": "^8.10.2",
103
100
  "tsd": "^0.13.1",
101
+ "tsx": "^4.21.0",
104
102
  "typedoc": "^0.24.8",
105
103
  "typescript": "^5.1.6",
106
104
  "vite": "^6.2.4",
107
105
  "vite-bundle-analyzer": "^0.18.1",
108
106
  "vite-plugin-dts": "^4.5.3",
109
- "vite-tsconfig-paths": "^5.1.4"
107
+ "vite-tsconfig-paths": "^5.1.4",
108
+ "vitest": "^4.1.2"
110
109
  },
111
110
  "prettier": {},
112
- "dependencies": {
113
- "js-cookie": "^3.0.5"
114
- },
115
111
  "browserslist": "> 0.25%, not dead",
116
112
  "msw": {
117
113
  "workerDirectory": "demo/dist"
package/vite-env.d.ts CHANGED
@@ -1 +1,2 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vitest/globals" />
package/vite.config.ts CHANGED
@@ -4,6 +4,23 @@ import tsconfigPaths from "vite-tsconfig-paths";
4
4
  import dts from "vite-plugin-dts";
5
5
 
6
6
  export default defineConfig({
7
+ test: {
8
+ environment: "happy-dom",
9
+ globals: true,
10
+ include: [
11
+ "**/*.steps.[tj]s",
12
+ "**/__tests__/**/*.[jt]s?(x)",
13
+ "**/?(*.)+(spec|test).[tj]s?(x)",
14
+ ],
15
+ mockReset: true,
16
+ restoreMocks: false,
17
+ coverage: {
18
+ exclude: ["node_modules", "test"],
19
+ },
20
+ alias: {
21
+ "^uuid$": "uuid",
22
+ },
23
+ },
7
24
  plugins: [
8
25
  tsconfigPaths(),
9
26
  dts({
package/babel.config.js DELETED
@@ -1,8 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- [
4
- "@babel/preset-env",
5
- { targets: { esmodules: true }}
6
- ]
7
- ]
8
- }
package/jest.config.ts DELETED
@@ -1,200 +0,0 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property and type check, visit:
3
- * https://jestjs.io/docs/configuration
4
- */
5
-
6
- export default {
7
- // All imported modules in your tests should be mocked automatically
8
- // automock: false,
9
-
10
- // Stop running tests after `n` failures
11
- // bail: 0,
12
-
13
- // The directory where Jest should store its cached dependency information
14
- // cacheDirectory: "/private/var/folders/zv/t83jrkg12jx3bqgq3vx_v29h0000gp/T/jest_dy",
15
-
16
- // Automatically clear mock calls, instances, contexts and results before every test
17
- // clearMocks: false,
18
-
19
- // Indicates whether the coverage information should be collected while executing the test
20
- // collectCoverage: false,
21
-
22
- // An array of glob patterns indicating a set of files for which coverage information should be collected
23
- // collectCoverageFrom: undefined,
24
-
25
- // The directory where Jest should output its coverage files
26
- // coverageDirectory: "coverage",
27
-
28
- // An array of regexp pattern strings used to skip coverage collection
29
- coveragePathIgnorePatterns: ["/node_modules/", "/test/"],
30
-
31
- // Indicates which provider should be used to instrument code for coverage
32
- // coverageProvider: "babel",
33
-
34
- // A list of reporter names that Jest uses when writing coverage reports
35
- // coverageReporters: [
36
- // "json",
37
- // "text",
38
- // "lcov",
39
- // "clover"
40
- // ],
41
-
42
- // An object that configures minimum threshold enforcement for coverage results
43
- // coverageThreshold: undefined,
44
-
45
- // A path to a custom dependency extractor
46
- // dependencyExtractor: undefined,
47
-
48
- // Make calling deprecated APIs throw helpful error messages
49
- // errorOnDeprecated: false,
50
-
51
- // The default configuration for fake timers
52
- // fakeTimers: {
53
- // "enableGlobally": false
54
- // },
55
-
56
- // Force coverage collection from ignored files using an array of glob patterns
57
- // forceCoverageMatch: [],
58
-
59
- // A path to a module which exports an async function that is triggered once before all test suites
60
- // globalSetup: undefined,
61
-
62
- // A path to a module which exports an async function that is triggered once after all test suites
63
- // globalTeardown: undefined,
64
-
65
- // A set of global variables that need to be available in all test environments
66
- // globals: {},
67
-
68
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
69
- // maxWorkers: "50%",
70
-
71
- // An array of directory names to be searched recursively up from the requiring module's location
72
- moduleDirectories: ["node_modules"],
73
-
74
- // An array of file extensions your modules use
75
- // moduleFileExtensions: [
76
- // "js",
77
- // "mjs",
78
- // "cjs",
79
- // "jsx",
80
- // "ts",
81
- // "tsx",
82
- // "json",
83
- // "node"
84
- // ],
85
-
86
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
87
- moduleNameMapper: {
88
- "source-map-support/register": "identity-obj-proxy",
89
- "^uuid$": "uuid",
90
- },
91
-
92
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
93
- // modulePathIgnorePatterns: [],
94
-
95
- // Activates notifications for test results
96
- // notify: false,
97
-
98
- // An enum that specifies notification mode. Requires { notify: true }
99
- // notifyMode: "failure-change",
100
-
101
- // A preset that is used as a base for Jest's configuration
102
- preset: "ts-jest",
103
-
104
- // Run tests from one or more projects
105
- // projects: undefined,
106
-
107
- // Use this configuration option to add custom reporters to Jest
108
- // reporters: undefined,
109
-
110
- // Automatically reset mock state before every test
111
- resetMocks: true,
112
-
113
- // Reset the module registry before running each individual test
114
- resetModules: true,
115
-
116
- // A path to a custom resolver
117
- // resolver: undefined,
118
-
119
- // Automatically restore mock state and implementation before every test
120
- // restoreMocks: false,
121
-
122
- // The root directory that Jest should scan for tests and modules within
123
- // rootDir: undefined,
124
-
125
- // A list of paths to directories that Jest should use to search for files in
126
- // roots: [
127
- // "<rootDir>"
128
- // ],
129
-
130
- // Allows you to use a custom runner instead of Jest's default test runner
131
- // runner: "jest-runner",
132
-
133
- // The paths to modules that run some code to configure or set up the testing environment before each test
134
- // setupFiles: [],
135
-
136
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
137
- // setupFilesAfterEnv: [],
138
-
139
- // The number of seconds after which a test is considered as slow and reported as such in the results.
140
- // slowTestThreshold: 5,
141
-
142
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
143
- // snapshotSerializers: [],
144
-
145
- // The test environment that will be used for testing
146
- testEnvironment: "@happy-dom/jest-environment",
147
-
148
- // Options that will be passed to the testEnvironment
149
- testEnvironmentOptions: {
150
- resources: "usable",
151
- },
152
-
153
- // Adds a location field to test results
154
- // testLocationInResults: false,
155
-
156
- // The glob patterns Jest uses to detect test files
157
- testMatch: [
158
- "**/*.steps.[tj]s",
159
- "**/__tests__/**/*.[jt]s?(x)",
160
- "**/?(*.)+(spec|test).[tj]s?(x)",
161
- ],
162
-
163
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
164
- // testPathIgnorePatterns: [
165
- // "/node_modules/"
166
- // ],
167
-
168
- // The regexp pattern or array of patterns that Jest uses to detect test files
169
- // testRegex: [],
170
-
171
- // This option allows the use of a custom results processor
172
- // testResultsProcessor: undefined,
173
-
174
- // This option allows use of a custom test runner
175
- // testRunner: "jest-circus/runner",
176
-
177
- // A map from regular expressions to paths to transformers
178
- transform: {
179
- "^.+\\.(ts|tsx)?$": "ts-jest",
180
- "^.+\\.(js|jsx)$": "babel-jest",
181
- },
182
-
183
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
184
- transformIgnorePatterns: [
185
- "node_modules/(?!(@open-wc|lit|jest-cucumber|lit-html|@lit|lit-element)/)",
186
- "\\.pnp\\.[^\\/]+$",
187
- ],
188
-
189
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
190
- // unmockedModulePathPatterns: undefined,
191
-
192
- // Indicates whether each individual test should be reported during the run
193
- // verbose: undefined,
194
-
195
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
196
- // watchPathIgnorePatterns: [],
197
-
198
- // Whether to use watchman for file crawling
199
- // watchman: true,
200
- };