@zwayam/apply-experience-library 0.0.7 → 0.0.8
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/README.md +191 -9
- package/package.json +30 -12
- package/packages/{apply-experience-sdk → web}/README.md +20 -18
- package/packages/{apply-experience-sdk/packages/web → web}/dist/index.js +9 -9
- package/packages/web/dist/styles.css +1 -0
- package/packages/apply-experience-sdk/packages/web/dist/styles.css +0 -1
- /package/packages/{apply-experience-sdk/packages/web → web}/dist/index.d.ts +0 -0
- /package/packages/{apply-experience-sdk/packages/web → web}/dist/publicTypes.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,22 +1,204 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Apply Experience Web SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Apply Experience is a reusable Add Profile widget for recruiter/admin web apps. It provides the popup UI for resume upload, candidate field capture, validations, phone fields, source/sub-source selection, and final profile submission flow.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This repository root is installable directly from GitHub. The host app provides job/user context and API functions; the SDK handles the Add Profile experience.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Install From GitHub
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install github:YOUR_GITHUB_USERNAME/YOUR_REPO_NAME#main
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or install a tagged version:
|
|
10
14
|
|
|
11
15
|
```bash
|
|
12
|
-
npm install
|
|
16
|
+
npm install github:YOUR_GITHUB_USERNAME/YOUR_REPO_NAME#v0.2.1
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Import styles once:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import "@zwayam/apply-experience-library/styles.css";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Required Inputs
|
|
26
|
+
|
|
27
|
+
The host app must provide:
|
|
28
|
+
|
|
29
|
+
- `container`: DOM element where the popup will mount.
|
|
30
|
+
- `context`: current job, logged-in user, session, and optional environment data.
|
|
31
|
+
- `api`: host-owned functions for loading config, parsing resume, submitting profile, and optional location suggestions.
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
const context = {
|
|
35
|
+
job: {
|
|
36
|
+
id: "263294",
|
|
37
|
+
companyId: 16136,
|
|
38
|
+
jobTitle: "Java Developer",
|
|
39
|
+
jobCode: "13949",
|
|
40
|
+
location: "Kolkata",
|
|
41
|
+
departmentName: "All Departments",
|
|
42
|
+
},
|
|
43
|
+
user: {
|
|
44
|
+
id: 286813,
|
|
45
|
+
email: "user@example.com",
|
|
46
|
+
name: "Recruiter Name",
|
|
47
|
+
},
|
|
48
|
+
session: {
|
|
49
|
+
sessionId: "SESSION_ID",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const api = {
|
|
54
|
+
loadInitialData: async () => ({
|
|
55
|
+
applyFields: [],
|
|
56
|
+
supportedFiles: {
|
|
57
|
+
addProfile: {
|
|
58
|
+
fileFormat: ["pdf", "doc", "docx"],
|
|
59
|
+
fileSize: 3,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
profileSources: [],
|
|
63
|
+
phoneConfiguration: {
|
|
64
|
+
countryIsoCode: "IN",
|
|
65
|
+
whatsAppEnabled: true,
|
|
66
|
+
maxCount: 3,
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
|
|
70
|
+
parseResume: async (file) => {
|
|
71
|
+
const formData = new FormData();
|
|
72
|
+
formData.append("file", file);
|
|
73
|
+
return fetch("/parse-resume", { method: "POST", body: formData }).then((res) => res.json());
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
submitProfile: async (payload) => {
|
|
77
|
+
return fetch("/add-profile", { method: "POST", body: payload }).then((res) => res.json());
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## React
|
|
83
|
+
|
|
84
|
+
```jsx
|
|
85
|
+
import { useEffect, useRef } from "react";
|
|
86
|
+
import { mountAddProfile } from "@zwayam/apply-experience-library";
|
|
87
|
+
import "@zwayam/apply-experience-library/styles.css";
|
|
88
|
+
|
|
89
|
+
export function AddProfile({ open, context, api, onClose }) {
|
|
90
|
+
const rootRef = useRef(null);
|
|
91
|
+
const mountedRef = useRef(null);
|
|
92
|
+
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!open || !rootRef.current) return;
|
|
95
|
+
|
|
96
|
+
mountedRef.current = mountAddProfile({
|
|
97
|
+
container: rootRef.current,
|
|
98
|
+
context,
|
|
99
|
+
api,
|
|
100
|
+
onClose,
|
|
101
|
+
onSuccess: onClose,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return () => mountedRef.current?.unmount();
|
|
105
|
+
}, [open, context, api, onClose]);
|
|
106
|
+
|
|
107
|
+
return <div ref={rootRef} />;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Angular
|
|
112
|
+
|
|
113
|
+
Import styles in a global stylesheet:
|
|
114
|
+
|
|
115
|
+
```scss
|
|
116
|
+
@import "@zwayam/apply-experience-library/styles.css";
|
|
13
117
|
```
|
|
14
118
|
|
|
15
|
-
|
|
119
|
+
Mount from a component:
|
|
16
120
|
|
|
17
121
|
```ts
|
|
18
|
-
import { mountAddProfile,
|
|
122
|
+
import { mountAddProfile, MountedAddProfile } from "@zwayam/apply-experience-library";
|
|
123
|
+
|
|
124
|
+
private mountedAddProfile?: MountedAddProfile;
|
|
125
|
+
|
|
126
|
+
openAddProfile(container: Element, context: any, api: any) {
|
|
127
|
+
this.mountedAddProfile = mountAddProfile({
|
|
128
|
+
container,
|
|
129
|
+
context,
|
|
130
|
+
api,
|
|
131
|
+
onClose: () => this.mountedAddProfile?.unmount(),
|
|
132
|
+
onSuccess: () => {
|
|
133
|
+
this.mountedAddProfile?.unmount();
|
|
134
|
+
// refresh host data if needed
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Vue
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<script setup>
|
|
144
|
+
import { onBeforeUnmount, onMounted, ref } from "vue";
|
|
145
|
+
import { mountAddProfile } from "@zwayam/apply-experience-library";
|
|
19
146
|
import "@zwayam/apply-experience-library/styles.css";
|
|
147
|
+
|
|
148
|
+
const root = ref(null);
|
|
149
|
+
let mounted;
|
|
150
|
+
|
|
151
|
+
onMounted(() => {
|
|
152
|
+
mounted = mountAddProfile({
|
|
153
|
+
container: root.value,
|
|
154
|
+
context,
|
|
155
|
+
api,
|
|
156
|
+
onClose: () => mounted?.unmount(),
|
|
157
|
+
onSuccess: () => mounted?.unmount(),
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
onBeforeUnmount(() => mounted?.unmount());
|
|
162
|
+
</script>
|
|
163
|
+
|
|
164
|
+
<template>
|
|
165
|
+
<div ref="root"></div>
|
|
166
|
+
</template>
|
|
20
167
|
```
|
|
21
168
|
|
|
22
|
-
|
|
169
|
+
## Vanilla JavaScript
|
|
170
|
+
|
|
171
|
+
```html
|
|
172
|
+
<button id="open-add-profile">Add Profile</button>
|
|
173
|
+
<div id="add-profile-root"></div>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```js
|
|
177
|
+
import { mountAddProfile } from "@zwayam/apply-experience-library";
|
|
178
|
+
import "@zwayam/apply-experience-library/styles.css";
|
|
179
|
+
|
|
180
|
+
document.querySelector("#open-add-profile").addEventListener("click", () => {
|
|
181
|
+
const mounted = mountAddProfile({
|
|
182
|
+
container: document.querySelector("#add-profile-root"),
|
|
183
|
+
context,
|
|
184
|
+
api,
|
|
185
|
+
onClose: () => mounted.unmount(),
|
|
186
|
+
onSuccess: () => mounted.unmount(),
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Development
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm install
|
|
195
|
+
npm run build
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
The GitHub-installed package uses the built files from `packages/web/dist`, so keep `dist` committed when using GitHub installs.
|
|
199
|
+
|
|
200
|
+
## Notes
|
|
201
|
+
|
|
202
|
+
- The host app owns authentication, session handling, and API endpoints.
|
|
203
|
+
- The SDK should be unmounted when the popup closes or the host component is destroyed.
|
|
204
|
+
- The root package is configured for GitHub installation and exports the bundled web SDK.
|
package/package.json
CHANGED
|
@@ -1,24 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zwayam/apply-experience-library",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Host-facing Apply Experience SDK for Angular, React, Vue, and
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"description": "Host-facing Apply Experience SDK for Angular, React, Vue, and other frameworks.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./packages/
|
|
7
|
-
"module": "./packages/
|
|
8
|
-
"types": "./packages/
|
|
6
|
+
"main": "./packages/web/dist/index.js",
|
|
7
|
+
"module": "./packages/web/dist/index.js",
|
|
8
|
+
"types": "./packages/web/dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"types": "./packages/
|
|
12
|
-
"default": "./packages/
|
|
11
|
+
"types": "./packages/web/dist/index.d.ts",
|
|
12
|
+
"default": "./packages/web/dist/index.js"
|
|
13
13
|
},
|
|
14
|
-
"./styles.css": "./packages/
|
|
14
|
+
"./styles.css": "./packages/web/dist/styles.css",
|
|
15
15
|
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"packages/
|
|
19
|
-
"
|
|
18
|
+
"packages/web/dist",
|
|
19
|
+
"README.md"
|
|
20
20
|
],
|
|
21
21
|
"sideEffects": [
|
|
22
|
-
"./packages/
|
|
23
|
-
]
|
|
22
|
+
"./packages/web/dist/styles.css"
|
|
23
|
+
],
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"autoprefixer": "^10.4.21",
|
|
26
|
+
"esbuild": "^0.28.0",
|
|
27
|
+
"postcss": "^8.5.6",
|
|
28
|
+
"postcss-cli": "^11.0.1",
|
|
29
|
+
"react-icons": "^5.5.0",
|
|
30
|
+
"tailwindcss": "^3.4.17"
|
|
31
|
+
},
|
|
32
|
+
"workspaces": [
|
|
33
|
+
"packages/react",
|
|
34
|
+
"packages/web",
|
|
35
|
+
"packages/playground"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "npm run build -w @react-apply-experience/react && npm run build -w @zwayam/apply-experience-library",
|
|
39
|
+
"playground": "npm run dev -w @react-apply-experience/playground",
|
|
40
|
+
"playground:build": "npm run build -w @react-apply-experience/playground"
|
|
41
|
+
}
|
|
24
42
|
}
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
Apply Experience is a reusable Add Profile widget for recruiter/admin web apps. It provides the popup UI for resume upload, candidate field capture, validations, phone fields, source/sub-source selection, and final profile submission flow.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The SDK is framework-friendly. It can be mounted from React, Angular, Vue, or plain JavaScript. The host app provides job/user context and API functions; the SDK handles the Add Profile experience.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Package Options
|
|
8
|
+
|
|
9
|
+
Use this package for Angular, Vue, plain JavaScript, or any host that wants a fully bundled widget:
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
|
-
npm install
|
|
12
|
+
npm install @zwayam/apply-experience-library
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
For React host apps, a lighter React package can be used when available. It treats `react` and `react-dom` as peer dependencies, so the host app's React runtime is reused instead of bundled again.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
14
18
|
|
|
15
19
|
```bash
|
|
16
|
-
npm install
|
|
20
|
+
npm install @zwayam/apply-experience-library
|
|
17
21
|
```
|
|
18
22
|
|
|
19
23
|
Import styles once:
|
|
@@ -51,7 +55,7 @@ const context = {
|
|
|
51
55
|
};
|
|
52
56
|
|
|
53
57
|
const api = {
|
|
54
|
-
loadInitialData: async () => ({
|
|
58
|
+
loadInitialData: async (context) => ({
|
|
55
59
|
applyFields: [],
|
|
56
60
|
supportedFiles: {
|
|
57
61
|
addProfile: {
|
|
@@ -67,15 +71,21 @@ const api = {
|
|
|
67
71
|
},
|
|
68
72
|
}),
|
|
69
73
|
|
|
70
|
-
parseResume: async (file) => {
|
|
74
|
+
parseResume: async (file, context) => {
|
|
71
75
|
const formData = new FormData();
|
|
72
76
|
formData.append("file", file);
|
|
73
77
|
return fetch("/parse-resume", { method: "POST", body: formData }).then((res) => res.json());
|
|
74
78
|
},
|
|
75
79
|
|
|
76
|
-
submitProfile: async (payload) => {
|
|
80
|
+
submitProfile: async (payload, context) => {
|
|
77
81
|
return fetch("/add-profile", { method: "POST", body: payload }).then((res) => res.json());
|
|
78
82
|
},
|
|
83
|
+
|
|
84
|
+
getLocationSuggestions: async (query, context) => {
|
|
85
|
+
return fetch(`/locations?q=${encodeURIComponent(query)}`)
|
|
86
|
+
.then((res) => res.json())
|
|
87
|
+
.then((data) => data.suggestions || []);
|
|
88
|
+
},
|
|
79
89
|
};
|
|
80
90
|
```
|
|
81
91
|
|
|
@@ -188,17 +198,9 @@ document.querySelector("#open-add-profile").addEventListener("click", () => {
|
|
|
188
198
|
});
|
|
189
199
|
```
|
|
190
200
|
|
|
191
|
-
## Development
|
|
192
|
-
|
|
193
|
-
```bash
|
|
194
|
-
npm install
|
|
195
|
-
npm run build
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
The GitHub-installed package uses the built files from `packages/web/dist`, so keep `dist` committed when using GitHub installs.
|
|
199
|
-
|
|
200
201
|
## Notes
|
|
201
202
|
|
|
202
203
|
- The host app owns authentication, session handling, and API endpoints.
|
|
203
204
|
- The SDK should be unmounted when the popup closes or the host component is destroyed.
|
|
204
|
-
- The
|
|
205
|
+
- The web package is fully bundled for non-React hosts.
|
|
206
|
+
- React-specific builds should use peer dependencies for `react` and `react-dom` to keep host bundles smaller.
|