@nuskin/react-loyalty-elements 1.0.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/LICENSE.md ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2023, Nuskin
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # Loyalty Components
2
+
3
+ This is a repository for loyalty components to be used to integrate with other domains as well as providing reuseability
4
+
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@nuskin/react-loyalty-elements",
3
+ "version": "1.0.0",
4
+ "description": "A React based component library for reusable Nextgen Loyalty component",
5
+ "main": "src/common/index.ts",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git@code.tls.nuskin.io:nextgen-development/loyalty/npm/react-loyalty-elements.git"
9
+ },
10
+ "homepage": "https://code.tls.nuskin.io/nextgen-development/loyalty/npm/react-loyalty-elements/-/blob/master/README.md",
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "keywords": [
15
+ "react",
16
+ "loyalty",
17
+ "nextgen-loyalty",
18
+ "react-loyalty-elements"
19
+ ],
20
+ "license": "MIT",
21
+ "scripts": {
22
+ "lint": "eslint",
23
+ "test": "jest --coverage",
24
+ "test:watch": "jest --watch",
25
+ "test:update-snapshot": "jest -u",
26
+ "test:failed": "npx jest --onlyFailures",
27
+ "test:coverage": "jest --coverage",
28
+ "types:check": "tsc --pretty --noEmit"
29
+ },
30
+ "dependencies": {
31
+ "@types/react": "^18.2.0",
32
+ "@types/react-dom": "^18.2.0",
33
+ "react-dom": "^18.2.0"
34
+ },
35
+ "devDependencies": {
36
+ "@babel/core": "^7.23.2",
37
+ "@babel/preset-env": "^7.23.2",
38
+ "@babel/preset-react": "^7.22.15",
39
+ "@babel/preset-typescript": "^7.23.2",
40
+ "@nuskin/eslint-config": "^1.0.0-setup.1",
41
+ "@testing-library/dom": "^9.3.3",
42
+ "@testing-library/jest-dom": "^6.1.4",
43
+ "@testing-library/react": "^14.0.0",
44
+ "@types/jest": "^29.5.7",
45
+ "@types/lodash": "^4.14.200",
46
+ "@types/node": "^20.8.7",
47
+ "@types/react-test-renderer": "^18.0.5",
48
+ "babel-jest": "^29.7.0",
49
+ "babel-loader": "^9.1.3",
50
+ "babel-plugin-emotion": "^11.0.0",
51
+ "eslint": "^8.51.0",
52
+ "eslint-config-prettier": "^9.0.0",
53
+ "eslint-plugin-json": "^3.1.0",
54
+ "eslint-plugin-prettier": "^5.0.1",
55
+ "jest": "^29.7.0",
56
+ "jest-environment-jsdom": "^29.7.0",
57
+ "react": "^18.2.0",
58
+ "typescript": "^5.4.2"
59
+ },
60
+ "peerDependencies": {
61
+ "react": "^18.2.0",
62
+ "typescript": "^5.4.2"
63
+ },
64
+ "files": [
65
+ "src"
66
+ ],
67
+ "readme": "./README.md"
68
+ }
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { render, screen, fireEvent } from '@testing-library/react';
3
+ import SampleComponent from './SampleComponent';
4
+
5
+ describe('NsInputField', () => {
6
+ it('should render component', () => {
7
+ render(<SampleComponent />);
8
+ const sampleComponent = screen.getByText('Sample Component');
9
+ expect(sampleComponent).toBeTruthy();
10
+ });
11
+
12
+ it('should increment count', () => {
13
+ render(<SampleComponent />);
14
+ const incrementButton = screen.getByText('Increment');
15
+ fireEvent.click(incrementButton);
16
+ const count = screen.getByText('Count: 1');
17
+ expect(count).toBeTruthy();
18
+ });
19
+
20
+ it('should decrement count', () => {
21
+ render(<SampleComponent />);
22
+ const decrementButton = screen.getByText('Decrement');
23
+ fireEvent.click(decrementButton);
24
+ const count = screen.getByText('Count: -1');
25
+ expect(count).toBeTruthy();
26
+ });
27
+ });
@@ -0,0 +1,15 @@
1
+ import React, { ReactElement, useState } from 'react';
2
+
3
+ const SampleComponent = (): ReactElement => {
4
+ const [count, setCount] = useState<number>(0);
5
+
6
+ return (
7
+ <div>
8
+ <h1>Sample Component</h1>
9
+ <p>Count: {count}</p>
10
+ <button onClick={() => setCount(count + 1)}>Increment</button>
11
+ <button onClick={() => setCount(count - 1)}>Decrement</button>
12
+ </div>
13
+ );
14
+ };
15
+ export default SampleComponent;
@@ -0,0 +1 @@
1
+ export { default as SampleComponent } from './SampleComponent';
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './SampleComponent';