@patientprism/snippet-sdk 1.0.1 → 1.1.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@patientprism/snippet-sdk",
3
3
  "type": "module",
4
4
  "types": "types/index.d.ts",
5
- "version": "1.0.1",
5
+ "version": "1.1.0",
6
6
  "scripts": {
7
7
  "test": "vitest run",
8
8
  "test:watch": "vitest watch",
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@patientprism/snippet-sdk",
3
+ "type": "module",
4
+ "types": "types/index.d.ts",
5
+ "version": "1.1.0",
6
+ "scripts": {
7
+ "test": "vitest run",
8
+ "test:watch": "vitest watch",
9
+ "dev": "vite dev",
10
+ "build": "vite build",
11
+ "build:types": "sh ./build-type-declarations.sh"
12
+ },
13
+ "dependencies": {
14
+ "collect.js": "^4.36.1",
15
+ "js-cookie": "^3.0.5",
16
+ "jsdom": "^23.0.1",
17
+ "libphonenumber-js": "^1.10.51",
18
+ "vite": "^7.1.5",
19
+ "vitest": "^3.2.4",
20
+ "ziggy-js": "^2.5.0"
21
+ },
22
+ "devDependencies": {
23
+ "json": "^11.0.0",
24
+ "typescript": "^5.5.4"
25
+ }
26
+ }
package/types/index.d.ts CHANGED
@@ -1,3 +1,59 @@
1
+ /**
2
+ * @typedef {Object} SubmissionField
3
+ *
4
+ * @property {string} type
5
+ * @property {string|number} value
6
+ * @property {string} label
7
+ */
8
+ /**
9
+ * @typedef {Record<string, string|number|null>} SubmissionOptions
10
+ */
11
+ /**
12
+ * @typedef {Record<string, SubmissionField>} Submission
13
+ */
14
+ /**
15
+ * @typedef {Object} SwapSDK
16
+ *
17
+ * Object containing methods related to Swap functionality.
18
+ *
19
+ * @property {() => Promise<void>} init Initializes the Swap functionality.
20
+ */
21
+ /**
22
+ * @typedef {Object} SubmissionSDK
23
+ *
24
+ * Object containing methods related to Submission functionality.
25
+ *
26
+ * @property {boolean} captureHiddenFields Indicates whether hidden fields should be captured in submissions.
27
+ * @property {() => Promise<void>} init Initialize the Submission functionality.
28
+ * @property {(data: Submission, elementID: string|HTMLElement, options?: SubmissionOptions) => Promise<void>} send Send the form submission.
29
+ */
30
+ /**
31
+ * @typedef {Object} CustomFieldSDK
32
+ *
33
+ * Object containing methods related to the Custom Field functionality.
34
+ *
35
+ * @property {(keys?: string|string[]|Set<string>) => Promise<void>} recapture Recapture some or all of the custom fields.
36
+ */
37
+ /**
38
+ * @typedef {Object} CustomFieldSDK
39
+ *
40
+ * Object containing methods related to the Custom Field functionality.
41
+ *
42
+ * @property {(keys?: string|string[]|Set<string>) => Promise<void>} recapture Recapture some or all of the custom fields.
43
+ */
44
+ /**
45
+ * @typedef {Object} PrismSDK
46
+ *
47
+ * The global `$prism` object for managing Prism-related functionality.
48
+ *
49
+ * @property {boolean} loaded Indicates whether Prism has been loaded or not.
50
+ * @property {boolean} debug Indicates whether Prism is in debug mode or not.
51
+ * @property {(message: string) => void} log Logs a message to the console if debug mode is enabled.
52
+ * @property {SwapSDK} swap Object containing methods related to Swap functionality.
53
+ * @property {SubmissionSDK} submission Object containing methods related to Submission functionality.
54
+ * @property {CustomFieldSDK} custom_fields Object containing methods related to the Custom Field functionality.
55
+ */
56
+ export default function handle(): void;
1
57
  export type SubmissionField = {
2
58
  type: string;
3
59
  value: string | number;