@harkenapp/sdk-react-native 0.0.1-alpha.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 +67 -0
- package/app.plugin.cjs +135 -0
- package/app.plugin.js +1 -0
- package/dist/api/client.d.ts +67 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +163 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/errors.d.ts +46 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/api/errors.js +72 -0
- package/dist/api/errors.js.map +1 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +20 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/retry.d.ts +29 -0
- package/dist/api/retry.d.ts.map +1 -0
- package/dist/api/retry.js +74 -0
- package/dist/api/retry.js.map +1 -0
- package/dist/attachments/FeedbackSheet.d.ts +88 -0
- package/dist/attachments/FeedbackSheet.d.ts.map +1 -0
- package/dist/attachments/FeedbackSheet.js +250 -0
- package/dist/attachments/FeedbackSheet.js.map +1 -0
- package/dist/attachments/index.d.ts +20 -0
- package/dist/attachments/index.d.ts.map +1 -0
- package/dist/attachments/index.js +40 -0
- package/dist/attachments/index.js.map +1 -0
- package/dist/components/AttachmentGrid.d.ts +94 -0
- package/dist/components/AttachmentGrid.d.ts.map +1 -0
- package/dist/components/AttachmentGrid.js +132 -0
- package/dist/components/AttachmentGrid.js.map +1 -0
- package/dist/components/AttachmentPicker.d.ts +98 -0
- package/dist/components/AttachmentPicker.d.ts.map +1 -0
- package/dist/components/AttachmentPicker.js +297 -0
- package/dist/components/AttachmentPicker.js.map +1 -0
- package/dist/components/AttachmentPreview.d.ts +78 -0
- package/dist/components/AttachmentPreview.d.ts.map +1 -0
- package/dist/components/AttachmentPreview.js +133 -0
- package/dist/components/AttachmentPreview.js.map +1 -0
- package/dist/components/CategorySelector.d.ts +77 -0
- package/dist/components/CategorySelector.d.ts.map +1 -0
- package/dist/components/CategorySelector.js +117 -0
- package/dist/components/CategorySelector.js.map +1 -0
- package/dist/components/FeedbackForm.d.ts +50 -0
- package/dist/components/FeedbackForm.d.ts.map +1 -0
- package/dist/components/FeedbackForm.js +141 -0
- package/dist/components/FeedbackForm.js.map +1 -0
- package/dist/components/FeedbackSheet.d.ts +75 -0
- package/dist/components/FeedbackSheet.d.ts.map +1 -0
- package/dist/components/FeedbackSheet.js +215 -0
- package/dist/components/FeedbackSheet.js.map +1 -0
- package/dist/components/ThemedButton.d.ts +23 -0
- package/dist/components/ThemedButton.d.ts.map +1 -0
- package/dist/components/ThemedButton.js +77 -0
- package/dist/components/ThemedButton.js.map +1 -0
- package/dist/components/ThemedText.d.ts +16 -0
- package/dist/components/ThemedText.d.ts.map +1 -0
- package/dist/components/ThemedText.js +44 -0
- package/dist/components/ThemedText.js.map +1 -0
- package/dist/components/ThemedTextInput.d.ts +13 -0
- package/dist/components/ThemedTextInput.d.ts.map +1 -0
- package/dist/components/ThemedTextInput.js +76 -0
- package/dist/components/ThemedTextInput.js.map +1 -0
- package/dist/components/UploadStatusOverlay.d.ts +82 -0
- package/dist/components/UploadStatusOverlay.d.ts.map +1 -0
- package/dist/components/UploadStatusOverlay.js +319 -0
- package/dist/components/UploadStatusOverlay.js.map +1 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +28 -0
- package/dist/components/index.js.map +1 -0
- package/dist/context/HarkenContext.d.ts +62 -0
- package/dist/context/HarkenContext.d.ts.map +1 -0
- package/dist/context/HarkenContext.js +128 -0
- package/dist/context/HarkenContext.js.map +1 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +7 -0
- package/dist/context/index.js.map +1 -0
- package/dist/domain/index.d.ts +3 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/index.js +7 -0
- package/dist/domain/index.js.map +1 -0
- package/dist/domain/upload-queue.d.ts +116 -0
- package/dist/domain/upload-queue.d.ts.map +1 -0
- package/dist/domain/upload-queue.js +34 -0
- package/dist/domain/upload-queue.js.map +1 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +16 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAnonymousId.d.ts +28 -0
- package/dist/hooks/useAnonymousId.d.ts.map +1 -0
- package/dist/hooks/useAnonymousId.js +59 -0
- package/dist/hooks/useAnonymousId.js.map +1 -0
- package/dist/hooks/useAttachmentPicker.d.ts +84 -0
- package/dist/hooks/useAttachmentPicker.d.ts.map +1 -0
- package/dist/hooks/useAttachmentPicker.js +181 -0
- package/dist/hooks/useAttachmentPicker.js.map +1 -0
- package/dist/hooks/useAttachmentStatus.d.ts +51 -0
- package/dist/hooks/useAttachmentStatus.d.ts.map +1 -0
- package/dist/hooks/useAttachmentStatus.js +69 -0
- package/dist/hooks/useAttachmentStatus.js.map +1 -0
- package/dist/hooks/useAttachmentUpload.d.ts +101 -0
- package/dist/hooks/useAttachmentUpload.d.ts.map +1 -0
- package/dist/hooks/useAttachmentUpload.js +293 -0
- package/dist/hooks/useAttachmentUpload.js.map +1 -0
- package/dist/hooks/useFeedback.d.ts +55 -0
- package/dist/hooks/useFeedback.d.ts.map +1 -0
- package/dist/hooks/useFeedback.js +96 -0
- package/dist/hooks/useFeedback.js.map +1 -0
- package/dist/hooks/useHarkenContext.d.ts +25 -0
- package/dist/hooks/useHarkenContext.d.ts.map +1 -0
- package/dist/hooks/useHarkenContext.js +35 -0
- package/dist/hooks/useHarkenContext.js.map +1 -0
- package/dist/hooks/useHarkenTheme.d.ts +26 -0
- package/dist/hooks/useHarkenTheme.d.ts.map +1 -0
- package/dist/hooks/useHarkenTheme.js +36 -0
- package/dist/hooks/useHarkenTheme.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +9 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/uploadQueueService.d.ts +193 -0
- package/dist/services/uploadQueueService.d.ts.map +1 -0
- package/dist/services/uploadQueueService.js +623 -0
- package/dist/services/uploadQueueService.js.map +1 -0
- package/dist/services/uploadQueueStorage.d.ts +30 -0
- package/dist/services/uploadQueueStorage.d.ts.map +1 -0
- package/dist/services/uploadQueueStorage.js +77 -0
- package/dist/services/uploadQueueStorage.js.map +1 -0
- package/dist/storage/IdentityStore.d.ts +38 -0
- package/dist/storage/IdentityStore.d.ts.map +1 -0
- package/dist/storage/IdentityStore.js +83 -0
- package/dist/storage/IdentityStore.js.map +1 -0
- package/dist/storage/SecureStoreAdapter.d.ts +28 -0
- package/dist/storage/SecureStoreAdapter.d.ts.map +1 -0
- package/dist/storage/SecureStoreAdapter.js +52 -0
- package/dist/storage/SecureStoreAdapter.js.map +1 -0
- package/dist/storage/defaultStorage.d.ts +20 -0
- package/dist/storage/defaultStorage.d.ts.map +1 -0
- package/dist/storage/defaultStorage.js +131 -0
- package/dist/storage/defaultStorage.js.map +1 -0
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +13 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/types.d.ts +32 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +11 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/theme/defaults.d.ts +43 -0
- package/dist/theme/defaults.d.ts.map +1 -0
- package/dist/theme/defaults.js +128 -0
- package/dist/theme/defaults.js.map +1 -0
- package/dist/theme/index.d.ts +3 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +14 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/types.d.ts +136 -0
- package/dist/theme/types.d.ts.map +1 -0
- package/dist/theme/types.js +3 -0
- package/dist/theme/types.js.map +1 -0
- package/dist/types/config.d.ts +100 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/openapi.d.ts +601 -0
- package/dist/types/openapi.d.ts.map +1 -0
- package/dist/types/openapi.js +7 -0
- package/dist/types/openapi.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/uuid.d.ts +10 -0
- package/dist/utils/uuid.d.ts.map +1 -0
- package/dist/utils/uuid.js +60 -0
- package/dist/utils/uuid.js.map +1 -0
- package/package.json +124 -0
- package/src/@types/expo-file-system-legacy.d.ts +13 -0
- package/src/api/client.ts +250 -0
- package/src/api/errors.ts +84 -0
- package/src/api/index.ts +15 -0
- package/src/api/retry.ts +99 -0
- package/src/attachments/FeedbackSheet.tsx +400 -0
- package/src/attachments/index.ts +70 -0
- package/src/components/AttachmentGrid.tsx +247 -0
- package/src/components/AttachmentPicker.tsx +391 -0
- package/src/components/AttachmentPreview.tsx +210 -0
- package/src/components/CategorySelector.tsx +174 -0
- package/src/components/FeedbackForm.tsx +216 -0
- package/src/components/FeedbackSheet.tsx +321 -0
- package/src/components/ThemedButton.tsx +127 -0
- package/src/components/ThemedText.tsx +65 -0
- package/src/components/ThemedTextInput.tsx +65 -0
- package/src/components/UploadStatusOverlay.tsx +440 -0
- package/src/components/index.ts +39 -0
- package/src/context/HarkenContext.tsx +129 -0
- package/src/context/index.ts +2 -0
- package/src/domain/index.ts +12 -0
- package/src/domain/upload-queue.ts +131 -0
- package/src/hooks/index.ts +10 -0
- package/src/hooks/useAnonymousId.ts +68 -0
- package/src/hooks/useAttachmentPicker.ts +243 -0
- package/src/hooks/useAttachmentStatus.ts +86 -0
- package/src/hooks/useAttachmentUpload.ts +370 -0
- package/src/hooks/useFeedback.ts +139 -0
- package/src/hooks/useHarkenContext.ts +35 -0
- package/src/hooks/useHarkenTheme.ts +36 -0
- package/src/index.ts +168 -0
- package/src/services/index.ts +11 -0
- package/src/services/uploadQueueService.ts +727 -0
- package/src/services/uploadQueueStorage.ts +78 -0
- package/src/storage/IdentityStore.ts +89 -0
- package/src/storage/SecureStoreAdapter.ts +59 -0
- package/src/storage/defaultStorage.ts +109 -0
- package/src/storage/index.ts +5 -0
- package/src/storage/types.ts +34 -0
- package/src/theme/defaults.ts +151 -0
- package/src/theme/index.ts +23 -0
- package/src/theme/types.ts +157 -0
- package/src/types/config.ts +112 -0
- package/src/types/index.ts +10 -0
- package/src/types/openapi.ts +601 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/uuid.ts +77 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_RETRY_CONFIG = void 0;
|
|
4
|
+
exports.calculateRetryDelay = calculateRetryDelay;
|
|
5
|
+
exports.isRetryableError = isRetryableError;
|
|
6
|
+
exports.sleep = sleep;
|
|
7
|
+
exports.withRetry = withRetry;
|
|
8
|
+
const errors_1 = require("./errors");
|
|
9
|
+
exports.DEFAULT_RETRY_CONFIG = {
|
|
10
|
+
maxRetries: 3,
|
|
11
|
+
baseDelay: 1000,
|
|
12
|
+
maxDelay: 30000,
|
|
13
|
+
jitter: 0.1,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Calculate delay for a retry attempt with exponential backoff and jitter.
|
|
17
|
+
*/
|
|
18
|
+
function calculateRetryDelay(attempt, config, retryAfter) {
|
|
19
|
+
// If server specified Retry-After, respect it
|
|
20
|
+
if (retryAfter !== undefined && retryAfter > 0) {
|
|
21
|
+
return Math.min(retryAfter * 1000, config.maxDelay);
|
|
22
|
+
}
|
|
23
|
+
// Exponential backoff: baseDelay * 2^attempt
|
|
24
|
+
const exponentialDelay = config.baseDelay * Math.pow(2, attempt);
|
|
25
|
+
const cappedDelay = Math.min(exponentialDelay, config.maxDelay);
|
|
26
|
+
// Add jitter
|
|
27
|
+
const jitterRange = cappedDelay * config.jitter;
|
|
28
|
+
const jitter = (Math.random() - 0.5) * 2 * jitterRange;
|
|
29
|
+
return Math.max(0, cappedDelay + jitter);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if an error is retryable.
|
|
33
|
+
*/
|
|
34
|
+
function isRetryableError(error) {
|
|
35
|
+
if (error instanceof errors_1.HarkenApiError) {
|
|
36
|
+
return error.isRetryable;
|
|
37
|
+
}
|
|
38
|
+
if (error instanceof errors_1.HarkenNetworkError) {
|
|
39
|
+
return error.isRetryable;
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sleep for a given number of milliseconds.
|
|
45
|
+
*/
|
|
46
|
+
function sleep(ms) {
|
|
47
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Execute a function with retry logic.
|
|
51
|
+
*/
|
|
52
|
+
async function withRetry(fn, config = {}) {
|
|
53
|
+
const fullConfig = { ...exports.DEFAULT_RETRY_CONFIG, ...config };
|
|
54
|
+
let lastError;
|
|
55
|
+
for (let attempt = 0; attempt <= fullConfig.maxRetries; attempt++) {
|
|
56
|
+
try {
|
|
57
|
+
return await fn();
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
lastError = error;
|
|
61
|
+
// Don't retry if this is the last attempt or error isn't retryable
|
|
62
|
+
if (attempt >= fullConfig.maxRetries || !isRetryableError(error)) {
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
// Calculate delay, respecting Retry-After header if present
|
|
66
|
+
const retryAfter = error instanceof errors_1.HarkenApiError ? error.retryAfter : undefined;
|
|
67
|
+
const delay = calculateRetryDelay(attempt, fullConfig, retryAfter);
|
|
68
|
+
await sleep(delay);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Should never reach here, but TypeScript needs this
|
|
72
|
+
throw lastError;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/api/retry.ts"],"names":[],"mappings":";;;AAuBA,kDAmBC;AAKD,4CAUC;AAKD,sBAEC;AAKD,8BA6BC;AAlGD,qCAA8D;AAajD,QAAA,oBAAoB,GAAgB;IAC/C,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,GAAG;CACZ,CAAC;AAEF;;GAEG;AACH,SAAgB,mBAAmB,CACjC,OAAe,EACf,MAAmB,EACnB,UAAmB;IAEnB,8CAA8C;IAC9C,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACjE,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEhE,aAAa;IACb,MAAM,WAAW,GAAG,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;IAEvD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,CAAC;AAC3C,CAAC;AAED;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AC;IAED,qDAAqD;IACrD,MAAM,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewStyle } from 'react-native';
|
|
3
|
+
import type { components } from '../types/index.js';
|
|
4
|
+
import type { CategoryOption } from '../components/CategorySelector';
|
|
5
|
+
import type { AttachmentSourceConfig } from '../hooks/useAttachmentPicker';
|
|
6
|
+
type FeedbackSubmissionResponse = components['schemas']['FeedbackSubmissionResponse'];
|
|
7
|
+
export interface FeedbackSheetProps {
|
|
8
|
+
/** Called when feedback is successfully submitted */
|
|
9
|
+
onSuccess?: (result: FeedbackSubmissionResponse) => void;
|
|
10
|
+
/** Called when submission fails */
|
|
11
|
+
onError?: (error: Error) => void;
|
|
12
|
+
/** Called when user cancels/dismisses the form */
|
|
13
|
+
onCancel?: () => void;
|
|
14
|
+
/** Title text */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Placeholder text for message input */
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** Submit button text */
|
|
19
|
+
submitLabel?: string;
|
|
20
|
+
/** Cancel button text */
|
|
21
|
+
cancelLabel?: string;
|
|
22
|
+
/** Custom categories */
|
|
23
|
+
categories?: CategoryOption[];
|
|
24
|
+
/** Whether category selection is required */
|
|
25
|
+
requireCategory?: boolean;
|
|
26
|
+
/** Minimum message length */
|
|
27
|
+
minMessageLength?: number;
|
|
28
|
+
/** Maximum message length */
|
|
29
|
+
maxMessageLength?: number;
|
|
30
|
+
/** Whether to enable attachment support. @default true */
|
|
31
|
+
enableAttachments?: boolean;
|
|
32
|
+
/** Maximum number of attachments. @default 5 */
|
|
33
|
+
maxAttachments?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Configure which attachment sources are available.
|
|
36
|
+
* If only one source is enabled, the picker modal is skipped.
|
|
37
|
+
* @default { camera: true, library: true, files: true }
|
|
38
|
+
*/
|
|
39
|
+
attachmentSources?: AttachmentSourceConfig;
|
|
40
|
+
/** Message shown in success alert. Set to null to disable alert. */
|
|
41
|
+
successMessage?: string | null;
|
|
42
|
+
/** Whether to show success alert. @default true */
|
|
43
|
+
showSuccessAlert?: boolean;
|
|
44
|
+
/** Whether to clear form on success. @default true */
|
|
45
|
+
clearOnSuccess?: boolean;
|
|
46
|
+
/** Container style override */
|
|
47
|
+
containerStyle?: ViewStyle;
|
|
48
|
+
/** Form content style override */
|
|
49
|
+
formStyle?: ViewStyle;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A batteries-included feedback form component with full attachment support.
|
|
53
|
+
*
|
|
54
|
+
* This version is exported from '@harkenapp/sdk-react-native/attachments' and
|
|
55
|
+
* includes support for picking images, documents, and uploading them.
|
|
56
|
+
*
|
|
57
|
+
* For the version without attachment dependencies, import from the main entry point.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* import { FeedbackSheet } from '@harkenapp/sdk-react-native/attachments';
|
|
62
|
+
*
|
|
63
|
+
* // Minimal usage with attachments
|
|
64
|
+
* <FeedbackSheet onSuccess={() => navigation.goBack()} />
|
|
65
|
+
*
|
|
66
|
+
* // With customization
|
|
67
|
+
* <FeedbackSheet
|
|
68
|
+
* title="Report a Bug"
|
|
69
|
+
* requireCategory
|
|
70
|
+
* enableAttachments
|
|
71
|
+
* maxAttachments={3}
|
|
72
|
+
* onSuccess={(result) => {
|
|
73
|
+
* analytics.track('feedback_submitted');
|
|
74
|
+
* navigation.goBack();
|
|
75
|
+
* }}
|
|
76
|
+
* onCancel={() => navigation.goBack()}
|
|
77
|
+
* />
|
|
78
|
+
*
|
|
79
|
+
* // With restricted attachment sources (photo library only)
|
|
80
|
+
* <FeedbackSheet
|
|
81
|
+
* attachmentSources={{ camera: false, library: true, files: false }}
|
|
82
|
+
* onSuccess={() => navigation.goBack()}
|
|
83
|
+
* />
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function FeedbackSheet({ onSuccess, onError, onCancel, title, placeholder, submitLabel, cancelLabel, categories, requireCategory, minMessageLength, maxMessageLength, enableAttachments, maxAttachments, attachmentSources, successMessage, showSuccessAlert, clearOnSuccess, containerStyle, formStyle, }: FeedbackSheetProps): React.JSX.Element;
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=FeedbackSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedbackSheet.d.ts","sourceRoot":"","sources":["../../src/attachments/FeedbackSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAQrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAMpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAI3E,KAAK,0BAA0B,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAC;AAEtF,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,0BAA0B,KAAK,IAAI,CAAC;IACzD,mCAAmC;IACnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IAEtB,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,wBAAwB;IACxB,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9B,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,6BAA6B;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6BAA6B;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;IAE3C,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,sDAAsD;IACtD,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,kCAAkC;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,OAAO,EACP,QAAQ,EACR,KAAuB,EACvB,WAA6C,EAC7C,WAAsB,EACtB,WAAsB,EACtB,UAA+B,EAC/B,eAAuB,EACvB,gBAAoB,EACpB,gBAAuB,EACvB,iBAAwB,EACxB,cAAkB,EAClB,iBAAiB,EACjB,cAA+C,EAC/C,gBAAuB,EACvB,cAAqB,EACrB,cAAc,EACd,SAAS,GACV,EAAE,kBAAkB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA6QxC"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.FeedbackSheet = FeedbackSheet;
|
|
37
|
+
const react_1 = __importStar(require("react"));
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const hooks_1 = require("../hooks");
|
|
40
|
+
const ThemedText_1 = require("../components/ThemedText");
|
|
41
|
+
const ThemedTextInput_1 = require("../components/ThemedTextInput");
|
|
42
|
+
const ThemedButton_1 = require("../components/ThemedButton");
|
|
43
|
+
const CategorySelector_1 = require("../components/CategorySelector");
|
|
44
|
+
const useAttachmentPicker_1 = require("../hooks/useAttachmentPicker");
|
|
45
|
+
const AttachmentGrid_1 = require("../components/AttachmentGrid");
|
|
46
|
+
const AttachmentPicker_1 = require("../components/AttachmentPicker");
|
|
47
|
+
/**
|
|
48
|
+
* A batteries-included feedback form component with full attachment support.
|
|
49
|
+
*
|
|
50
|
+
* This version is exported from '@harkenapp/sdk-react-native/attachments' and
|
|
51
|
+
* includes support for picking images, documents, and uploading them.
|
|
52
|
+
*
|
|
53
|
+
* For the version without attachment dependencies, import from the main entry point.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* import { FeedbackSheet } from '@harkenapp/sdk-react-native/attachments';
|
|
58
|
+
*
|
|
59
|
+
* // Minimal usage with attachments
|
|
60
|
+
* <FeedbackSheet onSuccess={() => navigation.goBack()} />
|
|
61
|
+
*
|
|
62
|
+
* // With customization
|
|
63
|
+
* <FeedbackSheet
|
|
64
|
+
* title="Report a Bug"
|
|
65
|
+
* requireCategory
|
|
66
|
+
* enableAttachments
|
|
67
|
+
* maxAttachments={3}
|
|
68
|
+
* onSuccess={(result) => {
|
|
69
|
+
* analytics.track('feedback_submitted');
|
|
70
|
+
* navigation.goBack();
|
|
71
|
+
* }}
|
|
72
|
+
* onCancel={() => navigation.goBack()}
|
|
73
|
+
* />
|
|
74
|
+
*
|
|
75
|
+
* // With restricted attachment sources (photo library only)
|
|
76
|
+
* <FeedbackSheet
|
|
77
|
+
* attachmentSources={{ camera: false, library: true, files: false }}
|
|
78
|
+
* onSuccess={() => navigation.goBack()}
|
|
79
|
+
* />
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
function FeedbackSheet({ onSuccess, onError, onCancel, title = 'Send Feedback', placeholder = 'What would you like to share?', submitLabel = 'Submit', cancelLabel = 'Cancel', categories = CategorySelector_1.DEFAULT_CATEGORIES, requireCategory = false, minMessageLength = 1, maxMessageLength = 5000, enableAttachments = true, maxAttachments = 5, attachmentSources, successMessage = 'Thank you for your feedback!', showSuccessAlert = true, clearOnSuccess = true, containerStyle, formStyle, }) {
|
|
83
|
+
const theme = (0, hooks_1.useHarkenTheme)();
|
|
84
|
+
const { submitFeedback, isSubmitting, error, clearError, isInitializing } = (0, hooks_1.useFeedback)();
|
|
85
|
+
const { attachments, removeAttachment, retryAttachment, getAttachmentIds, hasActiveUploads, openPicker, pickerProps, enabledSourceCount, } = (0, useAttachmentPicker_1.useAttachmentPicker)(attachmentSources);
|
|
86
|
+
const [message, setMessage] = (0, react_1.useState)('');
|
|
87
|
+
const [category, setCategory] = (0, react_1.useState)(null);
|
|
88
|
+
const trimmedMessage = message.trim();
|
|
89
|
+
const isMessageValid = trimmedMessage.length >= minMessageLength &&
|
|
90
|
+
trimmedMessage.length <= maxMessageLength;
|
|
91
|
+
const isCategoryValid = !requireCategory || category !== null;
|
|
92
|
+
const canSubmit = isMessageValid && isCategoryValid && !isSubmitting && !isInitializing;
|
|
93
|
+
const resetForm = (0, react_1.useCallback)(() => {
|
|
94
|
+
setMessage('');
|
|
95
|
+
setCategory(null);
|
|
96
|
+
clearError();
|
|
97
|
+
// Note: We don't clear attachments since they may still be uploading
|
|
98
|
+
// and can be reused. Users can manually remove them if needed.
|
|
99
|
+
}, [clearError]);
|
|
100
|
+
const handleSubmit = (0, react_1.useCallback)(async () => {
|
|
101
|
+
if (!canSubmit)
|
|
102
|
+
return;
|
|
103
|
+
clearError();
|
|
104
|
+
try {
|
|
105
|
+
const result = await submitFeedback({
|
|
106
|
+
message: trimmedMessage,
|
|
107
|
+
category: category ?? 'other',
|
|
108
|
+
attachments: enableAttachments ? getAttachmentIds() : undefined,
|
|
109
|
+
});
|
|
110
|
+
const uploadNote = enableAttachments && hasActiveUploads
|
|
111
|
+
? '\n\nAttachments are still uploading in the background.'
|
|
112
|
+
: '';
|
|
113
|
+
if (showSuccessAlert && successMessage) {
|
|
114
|
+
react_native_1.Alert.alert('Success', `${successMessage}${uploadNote}`, [
|
|
115
|
+
{
|
|
116
|
+
text: 'OK',
|
|
117
|
+
onPress: () => {
|
|
118
|
+
if (clearOnSuccess) {
|
|
119
|
+
resetForm();
|
|
120
|
+
}
|
|
121
|
+
onSuccess?.(result);
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
if (clearOnSuccess) {
|
|
128
|
+
resetForm();
|
|
129
|
+
}
|
|
130
|
+
onSuccess?.(result);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
const errorMessage = e instanceof Error ? e.message : 'Failed to submit feedback. Please try again.';
|
|
135
|
+
react_native_1.Alert.alert('Submission Failed', errorMessage);
|
|
136
|
+
onError?.(e instanceof Error ? e : new Error(errorMessage));
|
|
137
|
+
}
|
|
138
|
+
}, [
|
|
139
|
+
canSubmit,
|
|
140
|
+
clearError,
|
|
141
|
+
submitFeedback,
|
|
142
|
+
trimmedMessage,
|
|
143
|
+
category,
|
|
144
|
+
enableAttachments,
|
|
145
|
+
getAttachmentIds,
|
|
146
|
+
hasActiveUploads,
|
|
147
|
+
showSuccessAlert,
|
|
148
|
+
successMessage,
|
|
149
|
+
clearOnSuccess,
|
|
150
|
+
resetForm,
|
|
151
|
+
onSuccess,
|
|
152
|
+
onError,
|
|
153
|
+
]);
|
|
154
|
+
const handleCancel = (0, react_1.useCallback)(() => {
|
|
155
|
+
resetForm();
|
|
156
|
+
onCancel?.();
|
|
157
|
+
}, [resetForm, onCancel]);
|
|
158
|
+
const baseContainerStyle = {
|
|
159
|
+
flex: 1,
|
|
160
|
+
backgroundColor: theme.colors.background,
|
|
161
|
+
};
|
|
162
|
+
const contentStyle = {
|
|
163
|
+
flexGrow: 1,
|
|
164
|
+
padding: theme.spacing.lg,
|
|
165
|
+
};
|
|
166
|
+
const sectionStyle = {
|
|
167
|
+
marginBottom: theme.spacing.lg,
|
|
168
|
+
};
|
|
169
|
+
const buttonRowStyle = {
|
|
170
|
+
flexDirection: 'row',
|
|
171
|
+
gap: theme.spacing.sm,
|
|
172
|
+
marginTop: theme.spacing.md,
|
|
173
|
+
};
|
|
174
|
+
const characterCount = trimmedMessage.length;
|
|
175
|
+
const showCharacterWarning = characterCount > maxMessageLength * 0.9;
|
|
176
|
+
if (isInitializing) {
|
|
177
|
+
return (<react_native_1.View style={[baseContainerStyle, containerStyle, { justifyContent: 'center', alignItems: 'center' }]}>
|
|
178
|
+
<ThemedText_1.ThemedText variant="body" secondary>
|
|
179
|
+
Initializing...
|
|
180
|
+
</ThemedText_1.ThemedText>
|
|
181
|
+
</react_native_1.View>);
|
|
182
|
+
}
|
|
183
|
+
return (<>
|
|
184
|
+
<react_native_1.KeyboardAvoidingView behavior={react_native_1.Platform.OS === 'ios' ? 'padding' : 'height'} style={[baseContainerStyle, containerStyle]}>
|
|
185
|
+
<react_native_1.ScrollView contentContainerStyle={[contentStyle, formStyle]} keyboardShouldPersistTaps="handled">
|
|
186
|
+
{/* Title */}
|
|
187
|
+
<react_native_1.View style={sectionStyle}>
|
|
188
|
+
<ThemedText_1.ThemedText variant="title">{title}</ThemedText_1.ThemedText>
|
|
189
|
+
</react_native_1.View>
|
|
190
|
+
|
|
191
|
+
{/* Category selector */}
|
|
192
|
+
<react_native_1.View style={sectionStyle}>
|
|
193
|
+
<ThemedText_1.ThemedText variant="label" secondary style={{ marginBottom: theme.spacing.sm }}>
|
|
194
|
+
Category{requireCategory ? '' : ' (optional)'}
|
|
195
|
+
</ThemedText_1.ThemedText>
|
|
196
|
+
<CategorySelector_1.CategorySelector value={category} onChange={setCategory} categories={categories} disabled={isSubmitting}/>
|
|
197
|
+
</react_native_1.View>
|
|
198
|
+
|
|
199
|
+
{/* Message input */}
|
|
200
|
+
<react_native_1.View style={sectionStyle}>
|
|
201
|
+
<ThemedText_1.ThemedText variant="label" secondary style={{ marginBottom: theme.spacing.sm }}>
|
|
202
|
+
Message
|
|
203
|
+
</ThemedText_1.ThemedText>
|
|
204
|
+
<ThemedTextInput_1.ThemedTextInput value={message} onChangeText={setMessage} placeholder={placeholder} multiline numberOfLines={4} textAlignVertical="top" editable={!isSubmitting} style={{ minHeight: 120 }} maxLength={maxMessageLength + 100}/>
|
|
205
|
+
{showCharacterWarning && (<ThemedText_1.ThemedText variant="caption" color={characterCount > maxMessageLength
|
|
206
|
+
? theme.colors.error
|
|
207
|
+
: theme.colors.textSecondary} style={{ marginTop: theme.spacing.xs, textAlign: 'right' }}>
|
|
208
|
+
{characterCount}/{maxMessageLength}
|
|
209
|
+
</ThemedText_1.ThemedText>)}
|
|
210
|
+
</react_native_1.View>
|
|
211
|
+
|
|
212
|
+
{/* Attachments */}
|
|
213
|
+
{enableAttachments && (<react_native_1.View style={sectionStyle}>
|
|
214
|
+
<ThemedText_1.ThemedText variant="label" secondary style={{ marginBottom: theme.spacing.sm }}>
|
|
215
|
+
Attachments
|
|
216
|
+
</ThemedText_1.ThemedText>
|
|
217
|
+
<AttachmentGrid_1.AttachmentGrid attachments={attachments} onRemove={removeAttachment} onRetry={retryAttachment} onAdd={openPicker} maxAttachments={maxAttachments} showAddButton={enabledSourceCount > 0}/>
|
|
218
|
+
</react_native_1.View>)}
|
|
219
|
+
|
|
220
|
+
{/* Error display */}
|
|
221
|
+
{error && (<react_native_1.View style={{ marginBottom: theme.spacing.md }}>
|
|
222
|
+
<ThemedText_1.ThemedText variant="caption" color={theme.colors.error}>
|
|
223
|
+
{error.message}
|
|
224
|
+
</ThemedText_1.ThemedText>
|
|
225
|
+
</react_native_1.View>)}
|
|
226
|
+
|
|
227
|
+
{/* Buttons */}
|
|
228
|
+
<react_native_1.View style={buttonRowStyle}>
|
|
229
|
+
{onCancel && (<react_native_1.View style={{ flex: 1 }}>
|
|
230
|
+
<ThemedButton_1.ThemedButton title={cancelLabel} variant="secondary" onPress={handleCancel} disabled={isSubmitting} fullWidth/>
|
|
231
|
+
</react_native_1.View>)}
|
|
232
|
+
<react_native_1.View style={{ flex: onCancel ? 1 : undefined }}>
|
|
233
|
+
<ThemedButton_1.ThemedButton title={submitLabel} variant="primary" onPress={handleSubmit} disabled={!canSubmit} loading={isSubmitting} fullWidth={!!onCancel}/>
|
|
234
|
+
</react_native_1.View>
|
|
235
|
+
</react_native_1.View>
|
|
236
|
+
|
|
237
|
+
{/* Upload status indicator */}
|
|
238
|
+
{enableAttachments && hasActiveUploads && (<react_native_1.View style={{ marginTop: theme.spacing.sm }}>
|
|
239
|
+
<ThemedText_1.ThemedText variant="caption" color={theme.colors.primary} style={{ textAlign: 'center' }}>
|
|
240
|
+
Uploads in progress - you can still submit now
|
|
241
|
+
</ThemedText_1.ThemedText>
|
|
242
|
+
</react_native_1.View>)}
|
|
243
|
+
</react_native_1.ScrollView>
|
|
244
|
+
</react_native_1.KeyboardAvoidingView>
|
|
245
|
+
|
|
246
|
+
{/* Attachment picker modal */}
|
|
247
|
+
{enableAttachments && <AttachmentPicker_1.AttachmentPicker {...pickerProps}/>}
|
|
248
|
+
</>);
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=FeedbackSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedbackSheet.js","sourceRoot":"","sources":["../../src/attachments/FeedbackSheet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8GA,sCAiSC;AA/YD,+CAAqD;AACrD,+CAMsB;AAGtB,oCAAuD;AACvD,yDAAsD;AACtD,mEAAgE;AAChE,6DAA0D;AAC1D,qEAAsF;AAGtF,sEAAmE;AAEnE,iEAA8D;AAC9D,qEAAkE;AAuDlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,SAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,OAAO,EACP,QAAQ,EACR,KAAK,GAAG,eAAe,EACvB,WAAW,GAAG,+BAA+B,EAC7C,WAAW,GAAG,QAAQ,EACtB,WAAW,GAAG,QAAQ,EACtB,UAAU,GAAG,qCAAkB,EAC/B,eAAe,GAAG,KAAK,EACvB,gBAAgB,GAAG,CAAC,EACpB,gBAAgB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,EAAE,CAAC,CAC9C;cAAA,CAAC,2BAAY,CACX,KAAK,CAAC,CAAC,WAAW,CAAC,CACnB,OAAO,CAAC,SAAS,CACjB,OAAO,CAAC,CAAC,YAAY,CAAC,CACtB,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CACrB,OAAO,CAAC,CAAC,YAAY,CAAC,CACtB,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAE1B;YAAA,EAAE,mBAAI,CACR;UAAA,EAAE,mBAAI,CAEN;;UAAA,CAAC,6BAA6B,CAC9B;UAAA,CAAC,iBAAiB,IAAI,gBAAgB,IAAI,CACxC,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,CAC3C;cAAA,CAAC,uBAAU,CACT,OAAO,CAAC,SAAS,CACjB,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAC5B,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAE/B;;cACF,EAAE,uBAAU,CACd;YAAA,EAAE,mBAAI,CAAC,CACR,CACH;QAAA,EAAE,yBAAU,CACd;MAAA,EAAE,mCAAoB,CAEtB;;MAAA,CAAC,6BAA6B,CAC9B;MAAA,CAAC,iBAAiB,IAAI,CAAC,mCAAgB,CAAC,IAAI,WAAW,CAAC,EAAG,CAC7D;IAAA,GAAG,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harken SDK - Attachment Features
|
|
3
|
+
*
|
|
4
|
+
* @deprecated Import from '@harkenapp/sdk-react-native' instead.
|
|
5
|
+
* This entry point is maintained for backwards compatibility.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // Preferred (single entry point)
|
|
10
|
+
* import { HarkenProvider, FeedbackSheet, useAttachmentUpload } from '@harkenapp/sdk-react-native';
|
|
11
|
+
*
|
|
12
|
+
* // Legacy (still works)
|
|
13
|
+
* import { FeedbackSheet } from '@harkenapp/sdk-react-native/attachments';
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @packageDocumentation
|
|
17
|
+
*/
|
|
18
|
+
export { useAttachmentUpload, useAttachmentPicker, useAttachmentStatus, AttachmentPicker, UploadStatusOverlay, AttachmentPreview, AttachmentGrid, FeedbackSheet, UploadQueueService, uploadQueueService, UploadQueueStorage, UploadPhase, DEFAULT_UPLOAD_RETRY_CONFIG, } from '../index';
|
|
19
|
+
export type { AttachmentState, UseAttachmentUploadResult, AttachmentSourceConfig, UseAttachmentPickerResult, AttachmentStatus, AttachmentPickerProps, AttachmentSource, PickerOptionConfig, UploadStatusOverlayProps, UploadStatusLabels, AttachmentPreviewProps, AttachmentGridProps, FeedbackSheetProps, UploadQueueServiceConfig, EnqueueParams, QueueItem, QueueStatus, UploadProgress, UploadRetryConfig, } from '../index';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/attachments/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAEL,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EAGnB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,aAAa,EAGb,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAGlB,WAAW,EACX,2BAA2B,GAC5B,MAAM,UAAU,CAAC;AAElB,YAAY,EAEV,eAAe,EACf,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAGhB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAGlB,wBAAwB,EACxB,aAAa,EAGb,SAAS,EACT,WAAW,EACX,cAAc,EACd,iBAAiB,GAClB,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Harken SDK - Attachment Features
|
|
4
|
+
*
|
|
5
|
+
* @deprecated Import from '@harkenapp/sdk-react-native' instead.
|
|
6
|
+
* This entry point is maintained for backwards compatibility.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // Preferred (single entry point)
|
|
11
|
+
* import { HarkenProvider, FeedbackSheet, useAttachmentUpload } from '@harkenapp/sdk-react-native';
|
|
12
|
+
*
|
|
13
|
+
* // Legacy (still works)
|
|
14
|
+
* import { FeedbackSheet } from '@harkenapp/sdk-react-native/attachments';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.DEFAULT_UPLOAD_RETRY_CONFIG = exports.UploadPhase = exports.UploadQueueStorage = exports.uploadQueueService = exports.UploadQueueService = exports.FeedbackSheet = exports.AttachmentGrid = exports.AttachmentPreview = exports.UploadStatusOverlay = exports.AttachmentPicker = exports.useAttachmentStatus = exports.useAttachmentPicker = exports.useAttachmentUpload = void 0;
|
|
21
|
+
// Re-export everything from the main entry point for backwards compatibility
|
|
22
|
+
var index_1 = require("../index");
|
|
23
|
+
// Attachment hooks
|
|
24
|
+
Object.defineProperty(exports, "useAttachmentUpload", { enumerable: true, get: function () { return index_1.useAttachmentUpload; } });
|
|
25
|
+
Object.defineProperty(exports, "useAttachmentPicker", { enumerable: true, get: function () { return index_1.useAttachmentPicker; } });
|
|
26
|
+
Object.defineProperty(exports, "useAttachmentStatus", { enumerable: true, get: function () { return index_1.useAttachmentStatus; } });
|
|
27
|
+
// Attachment components
|
|
28
|
+
Object.defineProperty(exports, "AttachmentPicker", { enumerable: true, get: function () { return index_1.AttachmentPicker; } });
|
|
29
|
+
Object.defineProperty(exports, "UploadStatusOverlay", { enumerable: true, get: function () { return index_1.UploadStatusOverlay; } });
|
|
30
|
+
Object.defineProperty(exports, "AttachmentPreview", { enumerable: true, get: function () { return index_1.AttachmentPreview; } });
|
|
31
|
+
Object.defineProperty(exports, "AttachmentGrid", { enumerable: true, get: function () { return index_1.AttachmentGrid; } });
|
|
32
|
+
Object.defineProperty(exports, "FeedbackSheet", { enumerable: true, get: function () { return index_1.FeedbackSheet; } });
|
|
33
|
+
// Services
|
|
34
|
+
Object.defineProperty(exports, "UploadQueueService", { enumerable: true, get: function () { return index_1.UploadQueueService; } });
|
|
35
|
+
Object.defineProperty(exports, "uploadQueueService", { enumerable: true, get: function () { return index_1.uploadQueueService; } });
|
|
36
|
+
Object.defineProperty(exports, "UploadQueueStorage", { enumerable: true, get: function () { return index_1.UploadQueueStorage; } });
|
|
37
|
+
// Domain types
|
|
38
|
+
Object.defineProperty(exports, "UploadPhase", { enumerable: true, get: function () { return index_1.UploadPhase; } });
|
|
39
|
+
Object.defineProperty(exports, "DEFAULT_UPLOAD_RETRY_CONFIG", { enumerable: true, get: function () { return index_1.DEFAULT_UPLOAD_RETRY_CONFIG; } });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/attachments/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,6EAA6E;AAC7E,kCAqBkB;AApBhB,mBAAmB;AACnB,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AAEnB,wBAAwB;AACxB,yGAAA,gBAAgB,OAAA;AAChB,4GAAA,mBAAmB,OAAA;AACnB,0GAAA,iBAAiB,OAAA;AACjB,uGAAA,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AAEb,WAAW;AACX,2GAAA,kBAAkB,OAAA;AAClB,2GAAA,kBAAkB,OAAA;AAClB,2GAAA,kBAAkB,OAAA;AAElB,eAAe;AACf,oGAAA,WAAW,OAAA;AACX,oHAAA,2BAA2B,OAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ViewStyle, StyleProp, ImageStyle } from 'react-native';
|
|
3
|
+
import type { AttachmentState } from '../hooks/useAttachmentUpload';
|
|
4
|
+
import type { UploadStatusLabels } from './UploadStatusOverlay';
|
|
5
|
+
export interface AttachmentGridProps {
|
|
6
|
+
/** List of attachments to display */
|
|
7
|
+
attachments: AttachmentState[];
|
|
8
|
+
/** Callback to retry a failed attachment */
|
|
9
|
+
onRetry?: (attachmentId: string) => void;
|
|
10
|
+
/** Callback to remove an attachment */
|
|
11
|
+
onRemove?: (attachmentId: string) => void;
|
|
12
|
+
/** Callback when add button is pressed */
|
|
13
|
+
onAdd?: () => void;
|
|
14
|
+
/** Maximum number of attachments allowed (hides add button when reached) */
|
|
15
|
+
maxAttachments?: number;
|
|
16
|
+
/** Size of each preview tile */
|
|
17
|
+
tileSize?: number;
|
|
18
|
+
/** Gap between tiles */
|
|
19
|
+
gap?: number;
|
|
20
|
+
/** Whether to show the add button */
|
|
21
|
+
showAddButton?: boolean;
|
|
22
|
+
/** Disable interactions */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Additional container style */
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
/** Label for the add button (default: "Add") */
|
|
27
|
+
addButtonLabel?: string;
|
|
28
|
+
/** Icon for the add button (default: "+") */
|
|
29
|
+
addButtonIcon?: React.ReactNode | string;
|
|
30
|
+
/** Style for the add button */
|
|
31
|
+
addButtonStyle?: StyleProp<ViewStyle>;
|
|
32
|
+
/** Text to show when empty and no add button (default: "No attachments") */
|
|
33
|
+
emptyText?: string;
|
|
34
|
+
/** Custom renderer for the add button */
|
|
35
|
+
renderAddButton?: (onPress: () => void, disabled: boolean) => React.ReactNode;
|
|
36
|
+
/** Custom renderer for each attachment tile */
|
|
37
|
+
renderTile?: (attachment: AttachmentState, onRetry?: () => void, onRemove?: () => void) => React.ReactNode;
|
|
38
|
+
/** Style for each tile container */
|
|
39
|
+
tileStyle?: StyleProp<ViewStyle>;
|
|
40
|
+
/** Style for tile images */
|
|
41
|
+
tileImageStyle?: StyleProp<ImageStyle>;
|
|
42
|
+
/** Custom labels for upload status overlay */
|
|
43
|
+
statusLabels?: UploadStatusLabels;
|
|
44
|
+
/** Custom file icon function (passed to AttachmentPreview) */
|
|
45
|
+
getFileIcon?: (mimeType: string) => React.ReactNode | string;
|
|
46
|
+
/** Custom placeholder renderer (passed to AttachmentPreview) */
|
|
47
|
+
renderPlaceholder?: (mimeType: string, fileName?: string) => React.ReactNode;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Grid component for displaying multiple attachments.
|
|
51
|
+
*
|
|
52
|
+
* Shows attachment previews with upload status and an optional add button.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* // Basic usage
|
|
57
|
+
* const { attachments, pickImage, retryAttachment, removeAttachment } = useAttachmentUpload();
|
|
58
|
+
*
|
|
59
|
+
* <AttachmentGrid
|
|
60
|
+
* attachments={attachments}
|
|
61
|
+
* onRetry={retryAttachment}
|
|
62
|
+
* onRemove={removeAttachment}
|
|
63
|
+
* onAdd={() => pickImage('library')}
|
|
64
|
+
* maxAttachments={5}
|
|
65
|
+
* />
|
|
66
|
+
*
|
|
67
|
+
* // With custom add button
|
|
68
|
+
* <AttachmentGrid
|
|
69
|
+
* attachments={attachments}
|
|
70
|
+
* onAdd={showPicker}
|
|
71
|
+
* addButtonIcon={<PlusIcon />}
|
|
72
|
+
* addButtonLabel="Upload"
|
|
73
|
+
* addButtonStyle={{ borderColor: 'blue' }}
|
|
74
|
+
* />
|
|
75
|
+
*
|
|
76
|
+
* // With fully custom renderers
|
|
77
|
+
* <AttachmentGrid
|
|
78
|
+
* attachments={attachments}
|
|
79
|
+
* renderAddButton={(onPress, disabled) => (
|
|
80
|
+
* <MyButton onPress={onPress} disabled={disabled}>Add File</MyButton>
|
|
81
|
+
* )}
|
|
82
|
+
* renderTile={(attachment, onRetry, onRemove) => (
|
|
83
|
+
* <MyTile
|
|
84
|
+
* key={attachment.attachmentId}
|
|
85
|
+
* {...attachment}
|
|
86
|
+
* onRetry={onRetry}
|
|
87
|
+
* onRemove={onRemove}
|
|
88
|
+
* />
|
|
89
|
+
* )}
|
|
90
|
+
* />
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare function AttachmentGrid({ attachments, onRetry, onRemove, onAdd, maxAttachments, tileSize, gap, showAddButton, disabled, style, addButtonLabel, addButtonIcon, addButtonStyle, emptyText, renderAddButton, renderTile, tileStyle, tileImageStyle, statusLabels, getFileIcon, renderPlaceholder, }: AttachmentGridProps): React.JSX.Element;
|
|
94
|
+
//# sourceMappingURL=AttachmentGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentGrid.d.ts","sourceRoot":"","sources":["../../src/components/AttachmentGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,WAAW,mBAAmB;IAClC,qCAAqC;IACrC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,0CAA0C;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