@zwayam/apply-experience-library 0.0.1

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 ADDED
@@ -0,0 +1,22 @@
1
+ # Zwayam UI Libraries
2
+
3
+ Shared UI libraries for Zwayam applications.
4
+
5
+ ## Apply Experience Library
6
+
7
+ `@zwayam/apply-experience-library` provides reusable Add Profile and Edit Profile widgets that can be mounted from Angular, React, Vue, or plain JavaScript host apps.
8
+
9
+ Install directly from this GitLab repository:
10
+
11
+ ```bash
12
+ npm install git+https://zwayam-gitlab.infoedge.com/zwayam/zwayam-ui-libraries.git#main
13
+ ```
14
+
15
+ Import the SDK and stylesheet:
16
+
17
+ ```ts
18
+ import { mountAddProfile, mountEditProfile } from "@zwayam/apply-experience-library";
19
+ import "@zwayam/apply-experience-library/styles.css";
20
+ ```
21
+
22
+ The host application owns API calls and passes the required context/API handlers to the SDK. The implementation lives in `packages/apply-experience-sdk`.
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@zwayam/apply-experience-library",
3
+ "version": "0.0.1",
4
+ "description": "Host-facing Apply Experience SDK for Angular, React, Vue, and plain JavaScript apps.",
5
+ "type": "module",
6
+ "main": "./packages/apply-experience-sdk/packages/web/dist/index.js",
7
+ "module": "./packages/apply-experience-sdk/packages/web/dist/index.js",
8
+ "types": "./packages/apply-experience-sdk/packages/web/dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./packages/apply-experience-sdk/packages/web/dist/index.d.ts",
12
+ "default": "./packages/apply-experience-sdk/packages/web/dist/index.js"
13
+ },
14
+ "./styles.css": "./packages/apply-experience-sdk/packages/web/dist/styles.css",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "packages/apply-experience-sdk/packages/web/dist",
19
+ "packages/apply-experience-sdk/README.md"
20
+ ],
21
+ "sideEffects": [
22
+ "./packages/apply-experience-sdk/packages/web/dist/styles.css"
23
+ ]
24
+ }
@@ -0,0 +1,204 @@
1
+ # Apply Experience Web SDK
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.
4
+
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
+
7
+ ## Install From GitHub
8
+
9
+ ```bash
10
+ npm install github:YOUR_GITHUB_USERNAME/YOUR_REPO_NAME#main
11
+ ```
12
+
13
+ Or install a tagged version:
14
+
15
+ ```bash
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";
117
+ ```
118
+
119
+ Mount from a component:
120
+
121
+ ```ts
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";
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>
167
+ ```
168
+
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.
@@ -0,0 +1,48 @@
1
+ import type { AddProfileApi, AddProfileHostContext, EditProfileApi, EditProfileHostContext } from "./publicTypes";
2
+ export type { AddProfileApi, AddProfileFieldDefinition, AddProfileHostContext, AddProfileInitializationData, AddProfileSubmitResult, EditProfileApi, EditProfileHostContext, EditProfileInitializationData, PhoneConfiguration, ProfileSourceRecord, ResumeParseResponse, SupportedFileRule, SupportedFilesMap, } from "./publicTypes";
3
+ export interface MountAddProfileOptions {
4
+ container: Element;
5
+ api: AddProfileApi;
6
+ context: AddProfileHostContext;
7
+ title?: string;
8
+ onClose?(): void;
9
+ onSuccess?(result: unknown): void;
10
+ showSubmitToast?: boolean;
11
+ }
12
+ export interface MountedAddProfile {
13
+ update(nextOptions: Omit<MountAddProfileOptions, "container">): void;
14
+ unmount(): void;
15
+ }
16
+ export declare function mountAddProfile(options: MountAddProfileOptions): MountedAddProfile;
17
+ export interface RegisterAddProfileElementOptions {
18
+ tagName?: string;
19
+ getApi(): AddProfileApi;
20
+ getContext(): AddProfileHostContext;
21
+ onClose?(): void;
22
+ onSuccess?(result: unknown): void;
23
+ showSubmitToast?: boolean;
24
+ }
25
+ export declare function registerAddProfileElement(options: RegisterAddProfileElementOptions): string;
26
+ export interface MountEditProfileOptions {
27
+ container: Element;
28
+ api: EditProfileApi;
29
+ context: EditProfileHostContext;
30
+ title?: string;
31
+ onClose?(): void;
32
+ onSuccess?(result: unknown): void;
33
+ showSubmitToast?: boolean;
34
+ }
35
+ export interface MountedEditProfile {
36
+ update(nextOptions: Omit<MountEditProfileOptions, "container">): void;
37
+ unmount(): void;
38
+ }
39
+ export declare function mountEditProfile(options: MountEditProfileOptions): MountedEditProfile;
40
+ export interface RegisterEditProfileElementOptions {
41
+ tagName?: string;
42
+ getApi(): EditProfileApi;
43
+ getContext(): EditProfileHostContext;
44
+ onClose?(): void;
45
+ onSuccess?(result: unknown): void;
46
+ showSubmitToast?: boolean;
47
+ }
48
+ export declare function registerEditProfileElement(options: RegisterEditProfileElementOptions): string;