@teamvortexsoftware/vortex-react-native 0.0.13 → 1.0.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.
Files changed (36) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +1227 -11
  3. package/package.json +93 -20
  4. package/dist/components/Clipboard.js +0 -64
  5. package/dist/components/ShareButtons.js +0 -180
  6. package/dist/hooks/useThemeStyles.js +0 -39
  7. package/dist/hooks/useVortexInvite.js +0 -321
  8. package/dist/index.js +0 -5
  9. package/dist/shared/InvitationResult.js +0 -2
  10. package/dist/shared/api.js +0 -90
  11. package/dist/tests/TestVortexInvite.js +0 -134
  12. package/dist/types/components/Clipboard.d.ts +0 -16
  13. package/dist/types/components/Clipboard.d.ts.map +0 -1
  14. package/dist/types/components/ShareButtons.d.ts +0 -29
  15. package/dist/types/components/ShareButtons.d.ts.map +0 -1
  16. package/dist/types/hooks/useThemeStyles.d.ts +0 -34
  17. package/dist/types/hooks/useThemeStyles.d.ts.map +0 -1
  18. package/dist/types/hooks/useVortexInvite.d.ts +0 -44
  19. package/dist/types/hooks/useVortexInvite.d.ts.map +0 -1
  20. package/dist/types/index.d.ts +0 -2
  21. package/dist/types/index.d.ts.map +0 -1
  22. package/dist/types/shared/InvitationResult.d.ts +0 -24
  23. package/dist/types/shared/InvitationResult.d.ts.map +0 -1
  24. package/dist/types/shared/api.d.ts +0 -14
  25. package/dist/types/shared/api.d.ts.map +0 -1
  26. package/dist/types/tests/TestVortexInvite.d.ts +0 -4
  27. package/dist/types/tests/TestVortexInvite.d.ts.map +0 -1
  28. package/dist/types/utils/formUtils.d.ts +0 -85
  29. package/dist/types/utils/formUtils.d.ts.map +0 -1
  30. package/dist/types/utils/themeUtils.d.ts +0 -36
  31. package/dist/types/utils/themeUtils.d.ts.map +0 -1
  32. package/dist/types/vortexInvite.d.ts +0 -25
  33. package/dist/types/vortexInvite.d.ts.map +0 -1
  34. package/dist/utils/formUtils.js +0 -174
  35. package/dist/utils/themeUtils.js +0 -56
  36. package/dist/vortexInvite.js +0 -172
@@ -1,44 +0,0 @@
1
- import { WidgetConfiguration } from '@teamvortexsoftware/vortex-core';
2
- import { Animated } from 'react-native';
3
- import { Attributes, VortexActionResult, VortexActionType } from '../vortexInvite';
4
- export interface UseVortexInviteOptions {
5
- widgetId: string;
6
- environmentId: string;
7
- vortexApiUrl: string;
8
- contentTokens?: Attributes;
9
- isLoading?: boolean;
10
- jwt?: string;
11
- onSuccess?: (result: VortexActionResult) => void;
12
- onError?: (error: Error, type: VortexActionType) => void;
13
- }
14
- export declare function useVortexInvite({ widgetId, environmentId, vortexApiUrl, contentTokens, isLoading, jwt, onSuccess, onError, }: UseVortexInviteOptions): {
15
- widgetConfiguration: WidgetConfiguration | undefined;
16
- error: {
17
- message: string;
18
- } | null;
19
- fetching: boolean;
20
- loading: boolean;
21
- email: string;
22
- setEmail: import("react").Dispatch<import("react").SetStateAction<string>>;
23
- opacity: Animated.Value;
24
- themeColors: import("../utils/themeUtils").ThemeColors;
25
- themeStyles: Record<string, Record<string, string | number>>;
26
- has: import("../utils/themeUtils").FeatureFlags;
27
- options: {};
28
- inviteLoading: boolean;
29
- showSuccessMessage: boolean;
30
- handleInviteClick: (contentTokens?: Attributes) => Promise<void>;
31
- handleShareLink: () => Promise<void>;
32
- handleCopyLink: () => Promise<void>;
33
- handleSmsShare: () => Promise<void>;
34
- handleEmailShare: () => Promise<void>;
35
- getShareableLink: () => string;
36
- formLayout: {
37
- emailPlaceholder: string;
38
- submitButtonLabel: string;
39
- isGridLayout: boolean;
40
- hasSeparateColumns: boolean;
41
- formConfig: import("../utils/formUtils").FormComponent[] | null;
42
- };
43
- };
44
- //# sourceMappingURL=useVortexInvite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useVortexInvite.d.ts","sourceRoot":"","sources":["../../../src/hooks/useVortexInvite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAkB,MAAM,cAAc,CAAC;AAIxD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYnF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,UAAU,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC1D;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAiB,EACjB,GAAG,EACH,SAAS,EACT,OAAO,GACR,EAAE,sBAAsB;;;iBAIuB,MAAM;;;;;;;;;;;;;wCAwIH,UAAU,KAAG,OAAO,CAAC,IAAI,CAAC;;;;;;;;;;;;;EA+L5E"}
@@ -1,2 +0,0 @@
1
- export { VortexInvite, type VortexInviteProps, type Attributes, type VortexActionResult, type VortexActionType } from './vortexInvite';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,KAAK,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,24 +0,0 @@
1
- import { UUID } from '@teamvortexsoftware/vortex-core';
2
- export interface InvitationResultDto {
3
- invitation: {
4
- id: UUID;
5
- accountId: UUID;
6
- attributes: any;
7
- clickThroughs: number | null;
8
- configurationAttributes: any;
9
- createdAt: Date;
10
- deactivated: boolean;
11
- deliveryCount: number;
12
- deliveryTypes: string[];
13
- foreignCreatorId: UUID | null;
14
- invitationType: string;
15
- modifiedAt: Date | null;
16
- passThrough: string | null;
17
- status: string;
18
- target: any;
19
- views: number | null;
20
- widgetConfigurationId: UUID | null;
21
- projectId: UUID | null;
22
- };
23
- }
24
- //# sourceMappingURL=InvitationResult.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InvitationResult.d.ts","sourceRoot":"","sources":["../../../src/shared/InvitationResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iCAAiC,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE;QACV,EAAE,EAAE,IAAI,CAAC;QACT,SAAS,EAAE,IAAI,CAAC;QAChB,UAAU,EAAE,GAAG,CAAC;QAChB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,uBAAuB,EAAE,GAAG,CAAC;QAC7B,SAAS,EAAE,IAAI,CAAC;QAChB,WAAW,EAAE,OAAO,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;QAC9B,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,IAAI,GAAG,IAAI,CAAC;QACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,GAAG,CAAC;QACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,qBAAqB,EAAE,IAAI,GAAG,IAAI,CAAC;QACnC,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;KACxB,CAAC;CACH"}
@@ -1,14 +0,0 @@
1
- import { InvitationResultDto } from './InvitationResult';
2
- declare class VortexClient {
3
- private sessionId;
4
- private baseUrl;
5
- constructor(baseUrl: string, sessionId: string);
6
- getWidgetConfiguration(widgetId: string, jwt: string, environmentId: string): Promise<any>;
7
- createInvite(jwt: string, widgetConfigurationId: string, environmentId: string, payload: any): Promise<any>;
8
- getShareableLinkFormatted(): string;
9
- createShareableInvite(jwt: string, widgetConfigurationId: string, environmentId: string): Promise<{
10
- data: InvitationResultDto;
11
- }>;
12
- }
13
- export default VortexClient;
14
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/shared/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,cAAM,YAAY;IAKd,OAAO,CAAC,SAAS;IAJnB,OAAO,CAAC,OAAO,CAAS;gBAGtB,OAAO,EAAE,MAAM,EACP,SAAS,EAAE,MAAM;IAMrB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;IAsB3E,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;IA4BlG,yBAAyB;IAInB,qBAAqB,CACzB,GAAG,EAAE,MAAM,EACX,qBAAqB,EAAE,MAAM,EAC7B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC;QAAE,IAAI,EAAE,mBAAmB,CAAA;KAAE,CAAC;CA0B1C;AAED,eAAe,YAAY,CAAC"}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- declare const TestVortexInvite: () => React.JSX.Element;
3
- export default TestVortexInvite;
4
- //# sourceMappingURL=TestVortexInvite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TestVortexInvite.d.ts","sourceRoot":"","sources":["../../../src/tests/TestVortexInvite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,QAAA,MAAM,gBAAgB,yBAqErB,CAAC;AAmDF,eAAe,gBAAgB,CAAC"}
@@ -1,85 +0,0 @@
1
- import { WidgetConfiguration } from "@teamvortexsoftware/vortex-core";
2
- import { ThemeColors } from "./themeUtils";
3
- export interface FormComponentStyle {
4
- [key: string]: {
5
- label?: string;
6
- value?: string | number;
7
- computedValue?: string;
8
- unit?: string;
9
- };
10
- }
11
- export interface FormComponentSettings {
12
- action?: {
13
- type: string;
14
- value: string;
15
- target?: string;
16
- };
17
- size?: number;
18
- }
19
- export interface FormComponent {
20
- id: string;
21
- type: string;
22
- subtype?: string;
23
- label?: string;
24
- hint?: string;
25
- name?: string;
26
- required?: boolean;
27
- placeholder?: string;
28
- style?: FormComponentStyle;
29
- settings?: FormComponentSettings;
30
- vortex?: {
31
- role?: string;
32
- canRemove?: boolean;
33
- };
34
- children?: FormComponent[];
35
- multiValue?: boolean;
36
- validation?: Array<{
37
- type: string;
38
- value: string;
39
- operator: string;
40
- canRemove: boolean;
41
- errorMessage: string;
42
- }>;
43
- tagName?: string;
44
- textContent?: string;
45
- attributes?: {
46
- [key: string]: string;
47
- };
48
- }
49
- export interface FormConfiguration {
50
- value: FormComponent[];
51
- valueType: string;
52
- }
53
- /**
54
- * Extracts the form configuration from the widget configuration
55
- */
56
- export declare function extractFormConfiguration(widgetConfiguration?: WidgetConfiguration): FormComponent[] | null;
57
- /**
58
- * Converts form component style object to React Native styles
59
- */
60
- export declare function convertFormStyleToRNStyle(style?: FormComponentStyle): Record<string, string | number>;
61
- /**
62
- * Find a specific component by role in the form configuration
63
- */
64
- export declare function findComponentByRole(formConfig: FormComponent[] | null, role: string): FormComponent | null;
65
- /**
66
- * Merges theme styles with component-specific styles from form configuration
67
- */
68
- export declare function mergeThemeAndComponentStyles(themeStyles: Record<string, Record<string, string | number>>, themeColors: ThemeColors, formConfig: FormComponent[] | null): Record<string, Record<string, string | number>>;
69
- /**
70
- * Get email input placeholder from form configuration
71
- */
72
- export declare function getEmailPlaceholder(formConfig: FormComponent[] | null): string;
73
- /**
74
- * Get submit button label from form configuration
75
- */
76
- export declare function getSubmitButtonLabel(formConfig: FormComponent[] | null): string;
77
- /**
78
- * Determines if the form layout uses a grid structure
79
- */
80
- export declare function hasGridLayout(formConfig: FormComponent[] | null): boolean;
81
- /**
82
- * Determines if email and share components are in separate grid items
83
- */
84
- export declare function hasEmailAndShareInSeparateColumns(formConfig: FormComponent[] | null): boolean;
85
- //# sourceMappingURL=formUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/formUtils.ts"],"names":[],"mappings":"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"}
@@ -1,36 +0,0 @@
1
- import { WidgetConfiguration } from '@teamvortexsoftware/vortex-core';
2
- export interface ThemeColors {
3
- containerBackground: string;
4
- containerForeground: string;
5
- containerBorder: string;
6
- primaryButtonBackground: string;
7
- primaryButtonForeground: string;
8
- primaryButtonBorder: string;
9
- secondaryButtonBackground: string;
10
- secondaryButtonForeground: string;
11
- secondaryButtonBorder: string;
12
- }
13
- export interface FeatureFlags {
14
- shareableLinks: boolean;
15
- emailInvitations: boolean;
16
- shareOptionsCopyLink: boolean;
17
- shareOptionsSms: boolean;
18
- shareOptionsEmail: boolean;
19
- shareOptionsFacebookMessenger: boolean;
20
- shareOptionsInstagramDms: boolean;
21
- shareOptionsLinkedInMessaging: boolean;
22
- shareOptionsTwitterDms: boolean;
23
- shareOptionsWhatsApp: boolean;
24
- shareOptionsNativeShareSheet: boolean;
25
- shareOptionsQrCode: boolean;
26
- shareEnabled: boolean;
27
- }
28
- /**
29
- * Extracts theme colors from widget configuration
30
- */
31
- export declare function extractThemeColors(widgetConfiguration?: WidgetConfiguration): ThemeColors;
32
- /**
33
- * Extracts feature flags from widget configuration
34
- */
35
- export declare function extractFeatureFlags(widgetConfiguration?: WidgetConfiguration): FeatureFlags;
36
- //# sourceMappingURL=themeUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"themeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/themeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,WAAW;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,MAAM,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,6BAA6B,EAAE,OAAO,CAAC;IACvC,wBAAwB,EAAE,OAAO,CAAC;IAClC,6BAA6B,EAAE,OAAO,CAAC;IACvC,sBAAsB,EAAE,OAAO,CAAC;IAChC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,4BAA4B,EAAE,OAAO,CAAC;IACtC,kBAAkB,EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,WAAW,CAsBzF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,mBAAmB,GAAG,YAAY,CA0B3F"}
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- export type VortexActionType = 'invite' | 'share';
3
- export interface VortexActionResult {
4
- type: VortexActionType;
5
- data: string;
6
- }
7
- export interface Attributes {
8
- [key: string]: {
9
- value: string | string[];
10
- type: string;
11
- role?: string;
12
- };
13
- }
14
- export interface VortexInviteProps {
15
- environmentId: string;
16
- widgetId: string;
17
- vortexApiHost: string;
18
- isLoading: boolean;
19
- jwt?: string;
20
- onSuccess?: (result: VortexActionResult) => void;
21
- onError?: (error: Error, type: VortexActionType) => void;
22
- contentTokens?: Attributes;
23
- }
24
- export declare function VortexInvite({ widgetId, environmentId, vortexApiHost, isLoading, jwt, onSuccess, onError, contentTokens, }: VortexInviteProps): React.JSX.Element;
25
- //# sourceMappingURL=vortexInvite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vortexInvite.d.ts","sourceRoot":"","sources":["../../src/vortexInvite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1E;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,aAAa,EACb,aAAa,EACb,SAAiB,EACjB,GAAG,EACH,SAAS,EACT,OAAO,EACP,aAAa,GACd,EAAE,iBAAiB,qBA+JnB"}
@@ -1,174 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractFormConfiguration = extractFormConfiguration;
4
- exports.convertFormStyleToRNStyle = convertFormStyleToRNStyle;
5
- exports.findComponentByRole = findComponentByRole;
6
- exports.mergeThemeAndComponentStyles = mergeThemeAndComponentStyles;
7
- exports.getEmailPlaceholder = getEmailPlaceholder;
8
- exports.getSubmitButtonLabel = getSubmitButtonLabel;
9
- exports.hasGridLayout = hasGridLayout;
10
- exports.hasEmailAndShareInSeparateColumns = hasEmailAndShareInSeparateColumns;
11
- /**
12
- * Extracts the form configuration from the widget configuration
13
- */
14
- function extractFormConfiguration(widgetConfiguration) {
15
- var _a, _b, _c;
16
- if (!((_c = (_b = (_a = widgetConfiguration === null || widgetConfiguration === void 0 ? void 0 : widgetConfiguration.configuration) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b["vortex.components.form"]) === null || _c === void 0 ? void 0 : _c.value)) {
17
- return null;
18
- }
19
- return widgetConfiguration.configuration.props["vortex.components.form"].value;
20
- }
21
- /**
22
- * Converts form component style object to React Native styles
23
- */
24
- function convertFormStyleToRNStyle(style) {
25
- if (!style)
26
- return {};
27
- const rnStyle = {};
28
- Object.keys(style).forEach((key) => {
29
- const styleObj = style[key];
30
- // Handle special cases like background-color to backgroundColor
31
- const normalizedKey = key.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
32
- // Use computedValue if available, otherwise use value
33
- if (styleObj.computedValue) {
34
- rnStyle[normalizedKey] = styleObj.computedValue;
35
- }
36
- else if (styleObj.value !== undefined) {
37
- // Handle numeric values
38
- if (typeof styleObj.value === 'string' && !isNaN(Number(styleObj.value))) {
39
- rnStyle[normalizedKey] = Number(styleObj.value);
40
- }
41
- else {
42
- rnStyle[normalizedKey] = styleObj.value;
43
- }
44
- }
45
- });
46
- return rnStyle;
47
- }
48
- /**
49
- * Find a specific component by role in the form configuration
50
- */
51
- function findComponentByRole(formConfig, role) {
52
- if (!formConfig)
53
- return null;
54
- const findComponent = (components) => {
55
- var _a;
56
- for (const component of components) {
57
- if (((_a = component.vortex) === null || _a === void 0 ? void 0 : _a.role) === role) {
58
- return component;
59
- }
60
- if (component.children) {
61
- const found = findComponent(component.children);
62
- if (found)
63
- return found;
64
- }
65
- }
66
- return null;
67
- };
68
- return findComponent(formConfig);
69
- }
70
- /**
71
- * Merges theme styles with component-specific styles from form configuration
72
- */
73
- function mergeThemeAndComponentStyles(themeStyles, themeColors, formConfig) {
74
- // Start with the base theme styles
75
- const mergedStyles = Object.assign({}, themeStyles);
76
- // Find submit button and email input components
77
- const submitButton = findComponentByRole(formConfig, 'submit');
78
- const emailInput = findComponentByRole(formConfig, 'email');
79
- // Merge submit button styles
80
- if (submitButton === null || submitButton === void 0 ? void 0 : submitButton.style) {
81
- const submitButtonStyle = convertFormStyleToRNStyle(submitButton.style);
82
- mergedStyles.primaryButton = Object.assign(Object.assign(Object.assign({}, mergedStyles.primaryButton), (submitButtonStyle['backgroundColor'] && { backgroundColor: submitButtonStyle['backgroundColor'] })), (submitButtonStyle['borderColor'] && { borderColor: submitButtonStyle['borderColor'] }));
83
- // Update button text if there's a color specified
84
- if (submitButtonStyle['color']) {
85
- mergedStyles.primaryButtonText = Object.assign(Object.assign({}, mergedStyles.primaryButtonText), { color: submitButtonStyle['color'] });
86
- }
87
- }
88
- // Merge email input styles
89
- if (emailInput === null || emailInput === void 0 ? void 0 : emailInput.style) {
90
- const emailInputStyle = convertFormStyleToRNStyle(emailInput.style);
91
- mergedStyles.inputStyles = Object.assign(Object.assign({}, mergedStyles.inputStyles), emailInputStyle);
92
- }
93
- return mergedStyles;
94
- }
95
- /**
96
- * Get email input placeholder from form configuration
97
- */
98
- function getEmailPlaceholder(formConfig) {
99
- const emailInput = findComponentByRole(formConfig, 'email');
100
- return (emailInput === null || emailInput === void 0 ? void 0 : emailInput.placeholder) || 'Enter email';
101
- }
102
- /**
103
- * Get submit button label from form configuration
104
- */
105
- function getSubmitButtonLabel(formConfig) {
106
- const submitButton = findComponentByRole(formConfig, 'submit');
107
- return (submitButton === null || submitButton === void 0 ? void 0 : submitButton.label) || 'Invite';
108
- }
109
- /**
110
- * Determines if the form layout uses a grid structure
111
- */
112
- function hasGridLayout(formConfig) {
113
- if (!formConfig)
114
- return false;
115
- const findGrid = (components) => {
116
- for (const component of components) {
117
- if (component.type === 'grid') {
118
- return true;
119
- }
120
- if (component.children) {
121
- const found = findGrid(component.children);
122
- if (found)
123
- return true;
124
- }
125
- }
126
- return false;
127
- };
128
- return findGrid(formConfig);
129
- }
130
- /**
131
- * Determines if email and share components are in separate grid items
132
- */
133
- function hasEmailAndShareInSeparateColumns(formConfig) {
134
- if (!formConfig)
135
- return false;
136
- // Look for a grid with multiple grid-items
137
- const findSeparateColumns = (components) => {
138
- for (const component of components) {
139
- if (component.type === 'grid' && component.children) {
140
- // Check if there are at least 2 grid-items
141
- const gridItems = component.children.filter(child => child.type === 'grid-item');
142
- if (gridItems.length >= 2) {
143
- // Check if one has email and one has share
144
- let hasEmailItem = false;
145
- let hasShareItem = false;
146
- for (const item of gridItems) {
147
- if (!item.children)
148
- continue;
149
- // Check for email component
150
- if (!hasEmailItem) {
151
- hasEmailItem = item.children.some(child => {
152
- var _a;
153
- return child.type === 'form' &&
154
- ((_a = child.children) === null || _a === void 0 ? void 0 : _a.some(formChild => { var _a; return ((_a = formChild.vortex) === null || _a === void 0 ? void 0 : _a.role) === 'email'; }));
155
- });
156
- }
157
- // Check for share component
158
- if (!hasShareItem) {
159
- hasShareItem = item.children.some(child => child.type === 'vortex.components.share');
160
- }
161
- }
162
- return hasEmailItem && hasShareItem;
163
- }
164
- }
165
- if (component.children) {
166
- const found = findSeparateColumns(component.children);
167
- if (found)
168
- return true;
169
- }
170
- }
171
- return false;
172
- };
173
- return findSeparateColumns(formConfig);
174
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.extractThemeColors = extractThemeColors;
4
- exports.extractFeatureFlags = extractFeatureFlags;
5
- /**
6
- * Extracts theme colors from widget configuration
7
- */
8
- function extractThemeColors(widgetConfiguration) {
9
- var _a, _b;
10
- const options = (_a = widgetConfiguration === null || widgetConfiguration === void 0 ? void 0 : widgetConfiguration.configuration) === null || _a === void 0 ? void 0 : _a.props;
11
- const colors = ((_b = options === null || options === void 0 ? void 0 : options['vortex.theme.colors']) === null || _b === void 0 ? void 0 : _b.value) || [];
12
- const colorMap = {};
13
- colors.forEach((color) => {
14
- if (color.key && color.value) {
15
- colorMap[color.key] = color.value;
16
- }
17
- });
18
- return {
19
- containerBackground: colorMap['--container-background'] || '#ffffff',
20
- containerForeground: colorMap['--container-foreground-color'] || '#666666',
21
- containerBorder: colorMap['--container-border-color'] || '#c4c4c4',
22
- primaryButtonBackground: colorMap['--primary-button-background'] || '#197af3',
23
- primaryButtonForeground: colorMap['--primary-button-foreground-color'] || '#ffffff',
24
- primaryButtonBorder: colorMap['--primary-button-border-color'] || '#000000',
25
- secondaryButtonBackground: colorMap['--secondary-button-background'] || '#dfdfdf',
26
- secondaryButtonForeground: colorMap['--secondary-button-foreground-color'] || '#000000',
27
- secondaryButtonBorder: colorMap['--secondary-button-border-color'] || '#c4c4c4',
28
- };
29
- }
30
- /**
31
- * Extracts feature flags from widget configuration
32
- */
33
- function extractFeatureFlags(widgetConfiguration) {
34
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
35
- const features = Array.isArray((_c = (_b = (_a = widgetConfiguration === null || widgetConfiguration === void 0 ? void 0 : widgetConfiguration.configuration) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b['vortex.components']) === null || _c === void 0 ? void 0 : _c.value)
36
- ? (_f = (_e = (_d = widgetConfiguration === null || widgetConfiguration === void 0 ? void 0 : widgetConfiguration.configuration) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e['vortex.components']) === null || _f === void 0 ? void 0 : _f.value
37
- : [];
38
- const shareOptions = Array.isArray((_j = (_h = (_g = widgetConfiguration === null || widgetConfiguration === void 0 ? void 0 : widgetConfiguration.configuration) === null || _g === void 0 ? void 0 : _g.props) === null || _h === void 0 ? void 0 : _h['vortex.components.share.options']) === null || _j === void 0 ? void 0 : _j.value)
39
- ? (_m = (_l = (_k = widgetConfiguration === null || widgetConfiguration === void 0 ? void 0 : widgetConfiguration.configuration) === null || _k === void 0 ? void 0 : _k.props) === null || _l === void 0 ? void 0 : _l['vortex.components.share.options']) === null || _m === void 0 ? void 0 : _m.value
40
- : [];
41
- return {
42
- shareableLinks: features.includes("vortex.components.emailinvitations"),
43
- emailInvitations: features.includes("vortex.components.share"),
44
- shareEnabled: features.includes("vortex.components.share"),
45
- shareOptionsCopyLink: shareOptions.includes("copyLink"),
46
- shareOptionsFacebookMessenger: shareOptions.includes("facebookMessenger"),
47
- shareOptionsInstagramDms: shareOptions.includes("instagramDms"),
48
- shareOptionsLinkedInMessaging: shareOptions.includes("linkedInMessaging"),
49
- shareOptionsNativeShareSheet: shareOptions.includes("nativeShareSheet"),
50
- shareOptionsQrCode: shareOptions.includes("qrCode"), // Only true if specifically included
51
- shareOptionsEmail: shareOptions.includes("email"),
52
- shareOptionsSms: shareOptions.includes("sms"),
53
- shareOptionsTwitterDms: shareOptions.includes("twitterDms"),
54
- shareOptionsWhatsApp: shareOptions.includes("whatsApp"),
55
- };
56
- }