@zwayam/apply-experience-library 0.1.2 → 0.1.4

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.
@@ -1,18 +1,14 @@
1
- # Apply Experience Web SDK
1
+ # Apply Experience Library
2
2
 
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.
3
+ This package is the bundled web entrypoint for `@zwayam/apply-experience-library`.
4
4
 
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.
5
+ It exposes framework-friendly mount helpers for launching **Add Profile** and **Edit Profile** popups from:
6
6
 
7
- ## Package Options
8
-
9
- Use this package for Angular, Vue, plain JavaScript, or any host that wants a fully bundled widget:
10
-
11
- ```bash
12
- npm install @zwayam/apply-experience-library
13
- ```
14
-
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.
7
+ - Angular
8
+ - React
9
+ - Vue
10
+ - Vanilla JavaScript
11
+ - Custom elements
16
12
 
17
13
  ## Install
18
14
 
@@ -22,185 +18,40 @@ npm install @zwayam/apply-experience-library
22
18
 
23
19
  Import styles once:
24
20
 
25
- ```js
21
+ ```ts
26
22
  import "@zwayam/apply-experience-library/styles.css";
27
23
  ```
28
24
 
29
- ## Required Inputs
30
-
31
- The host app must provide:
32
-
33
- - `container`: DOM element where the popup will mount.
34
- - `context`: current job, logged-in user, session, and optional environment data.
35
- - `api`: host-owned functions for loading config, parsing resume, submitting profile, and optional location suggestions.
36
-
37
- ```js
38
- const context = {
39
- job: {
40
- id: "263294",
41
- companyId: 16136,
42
- jobTitle: "Java Developer",
43
- jobCode: "13949",
44
- location: "Kolkata",
45
- departmentName: "All Departments",
46
- },
47
- user: {
48
- id: 286813,
49
- email: "user@example.com",
50
- name: "Recruiter Name",
51
- },
52
- session: {
53
- sessionId: "SESSION_ID",
54
- },
55
- };
56
-
57
- const api = {
58
- loadInitialData: async (context) => ({
59
- applyFields: [],
60
- supportedFiles: {
61
- addProfile: {
62
- fileFormat: ["pdf", "doc", "docx"],
63
- fileSize: 3,
64
- },
65
- },
66
- profileSources: [],
67
- phoneConfiguration: {
68
- countryIsoCode: "IN",
69
- whatsAppEnabled: true,
70
- maxCount: 3,
71
- },
72
- }),
73
-
74
- parseResume: async (file, context) => {
75
- const formData = new FormData();
76
- formData.append("file", file);
77
- return fetch("/parse-resume", { method: "POST", body: formData }).then((res) => res.json());
78
- },
79
-
80
- submitProfile: async (payload, context) => {
81
- return fetch("/add-profile", { method: "POST", body: payload }).then((res) => res.json());
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
- },
89
- };
90
- ```
91
-
92
- ## React
25
+ ## Main Exports
93
26
 
94
- ```jsx
95
- import { useEffect, useRef } from "react";
96
- import { mountAddProfile } from "@zwayam/apply-experience-library";
97
- import "@zwayam/apply-experience-library/styles.css";
98
-
99
- export function AddProfile({ open, context, api, onClose }) {
100
- const rootRef = useRef(null);
101
- const mountedRef = useRef(null);
102
-
103
- useEffect(() => {
104
- if (!open || !rootRef.current) return;
105
-
106
- mountedRef.current = mountAddProfile({
107
- container: rootRef.current,
108
- context,
109
- api,
110
- onClose,
111
- onSuccess: onClose,
112
- });
113
-
114
- return () => mountedRef.current?.unmount();
115
- }, [open, context, api, onClose]);
116
-
117
- return <div ref={rootRef} />;
118
- }
119
- ```
27
+ - `mountAddProfile`
28
+ - `mountEditProfile`
29
+ - `registerAddProfileElement`
30
+ - `registerEditProfileElement`
120
31
 
121
- ## Angular
122
-
123
- Import styles in a global stylesheet:
124
-
125
- ```scss
126
- @import "@zwayam/apply-experience-library/styles.css";
127
- ```
128
-
129
- Mount from a component:
32
+ ## Quick Example
130
33
 
131
34
  ```ts
132
- import { mountAddProfile, MountedAddProfile } from "@zwayam/apply-experience-library";
133
-
134
- private mountedAddProfile?: MountedAddProfile;
135
-
136
- openAddProfile(container: Element, context: any, api: any) {
137
- this.mountedAddProfile = mountAddProfile({
138
- container,
139
- context,
140
- api,
141
- onClose: () => this.mountedAddProfile?.unmount(),
142
- onSuccess: () => {
143
- this.mountedAddProfile?.unmount();
144
- // refresh host data if needed
145
- },
146
- });
147
- }
148
- ```
149
-
150
- ## Vue
151
-
152
- ```vue
153
- <script setup>
154
- import { onBeforeUnmount, onMounted, ref } from "vue";
155
35
  import { mountAddProfile } from "@zwayam/apply-experience-library";
156
- import "@zwayam/apply-experience-library/styles.css";
157
36
 
158
- const root = ref(null);
159
- let mounted;
160
-
161
- onMounted(() => {
162
- mounted = mountAddProfile({
163
- container: root.value,
164
- context,
165
- api,
166
- onClose: () => mounted?.unmount(),
167
- onSuccess: () => mounted?.unmount(),
168
- });
37
+ const mounted = mountAddProfile({
38
+ container: document.getElementById("add-profile-root"),
39
+ context,
40
+ api,
41
+ onClose: () => mounted.unmount(),
42
+ onSuccess: () => mounted.unmount(),
169
43
  });
170
-
171
- onBeforeUnmount(() => mounted?.unmount());
172
- </script>
173
-
174
- <template>
175
- <div ref="root"></div>
176
- </template>
177
44
  ```
178
45
 
179
- ## Vanilla JavaScript
180
-
181
- ```html
182
- <button id="open-add-profile">Add Profile</button>
183
- <div id="add-profile-root"></div>
184
- ```
46
+ ## Context and API
185
47
 
186
- ```js
187
- import { mountAddProfile } from "@zwayam/apply-experience-library";
188
- import "@zwayam/apply-experience-library/styles.css";
48
+ The host must provide:
189
49
 
190
- document.querySelector("#open-add-profile").addEventListener("click", () => {
191
- const mounted = mountAddProfile({
192
- container: document.querySelector("#add-profile-root"),
193
- context,
194
- api,
195
- onClose: () => mounted.unmount(),
196
- onSuccess: () => mounted.unmount(),
197
- });
198
- });
199
- ```
50
+ - job context
51
+ - logged-in user context
52
+ - session context
53
+ - host-owned API functions for loading fields, parsing resume, submitting profile, and optionally fetching location suggestions
200
54
 
201
- ## Notes
55
+ For the full API contract and framework-specific examples, see:
202
56
 
203
- - The host app owns authentication, session handling, and API endpoints.
204
- - The SDK should be unmounted when the popup closes or the host component is destroyed.
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.
57
+ - [../../README.md](../../README.md)