@developer_tribe/react-builder 1.2.46 → 1.2.47
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/dist/attributes-editor/Field.d.ts +3 -1
- package/dist/attributes-editor/attributesEditorModelTypes.d.ts +3 -0
- package/dist/attributes-editor/useAttributesEditorModel.d.ts +1 -1
- package/dist/build-components/FormSubmitButton/FormSubmitButtonProps.generated.d.ts +8 -3
- package/dist/build-components/GlobalProvider/GlobalContext.d.ts +28 -0
- package/dist/build-components/GlobalProvider/GlobalProvider.d.ts +5 -0
- package/dist/build-components/GlobalProvider/GlobalProviderProps.generated.d.ts +60 -0
- package/dist/build-components/GlobalProvider/globalProviderUtils.d.ts +28 -0
- package/dist/build-components/GlobalProvider/useGlobalNavigation.d.ts +19 -0
- package/dist/build-components/GlobalProvider/useGlobalProviderLogic.d.ts +15 -0
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +8 -3
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +2 -0
- package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +2 -0
- package/dist/build-components/SystemButton/SystemButtonProps.generated.d.ts +8 -3
- package/dist/build-components/SystemButton/usePlacementButtonEvents.d.ts +15 -2
- package/dist/build-components/TermsProvider/TermsProvider.d.ts +5 -0
- package/dist/build-components/TermsProvider/TermsProviderProps.generated.d.ts +55 -0
- package/dist/build-components/index.d.ts +3 -1
- package/dist/build-components/patterns.generated.d.ts +2128 -1333
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.web.cjs.js +3 -3
- package/dist/index.web.cjs.js.map +1 -1
- package/dist/index.web.esm.js +3 -3
- package/dist/index.web.esm.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/nodeTree.d.ts +18 -0
- package/package.json +1 -1
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +68 -4
- package/src/assets/meta.json +1 -1
- package/src/assets/prompt-scheme-onboard.generated.ts +1 -1
- package/src/assets/prompt-scheme-paywall.generated.ts +1 -1
- package/src/assets/samples/getSamples.ts +2 -0
- package/src/assets/samples/global-onboard-flow.json +735 -0
- package/src/assets/samples/terms-and-privacy-no-form.json +1 -1
- package/src/assets/samples/terms-and-privacy.json +1 -1
- package/src/attributes-editor/AttributesEditorView.tsx +3 -0
- package/src/attributes-editor/Field.tsx +91 -2
- package/src/attributes-editor/attributesEditorModelTypes.ts +3 -0
- package/src/attributes-editor/useAttributesEditorModel.ts +8 -0
- package/src/build-components/FormCheckbox/FormCheckbox.tsx +3 -3
- package/src/build-components/FormSubmitButton/FormSubmitButton.tsx +6 -0
- package/src/build-components/FormSubmitButton/FormSubmitButtonProps.generated.ts +26 -3
- package/src/build-components/GlobalProvider/GlobalContext.ts +48 -0
- package/src/build-components/GlobalProvider/GlobalProvider.tsx +51 -0
- package/src/build-components/GlobalProvider/GlobalProviderProps.generated.ts +78 -0
- package/src/build-components/GlobalProvider/globalProviderUtils.ts +204 -0
- package/src/build-components/GlobalProvider/pattern.json +55 -0
- package/src/build-components/GlobalProvider/useGlobalNavigation.ts +65 -0
- package/src/build-components/GlobalProvider/useGlobalProviderLogic.ts +172 -0
- package/src/build-components/OnboardButton/OnboardButton.tsx +8 -1
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +26 -3
- package/src/build-components/OnboardButton/pattern.json +5 -3
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +12 -0
- package/src/build-components/OnboardProvider/pattern.json +9 -1
- package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +12 -0
- package/src/build-components/PaywallProvider/pattern.json +9 -1
- package/src/build-components/RenderNode.generated.tsx +10 -0
- package/src/build-components/SystemButton/SystemButton.tsx +6 -0
- package/src/build-components/SystemButton/SystemButtonProps.generated.ts +26 -3
- package/src/build-components/SystemButton/pattern.json +5 -3
- package/src/build-components/SystemButton/usePlacementButtonEvents.ts +51 -27
- package/src/build-components/TermsProvider/TermsProvider.tsx +45 -0
- package/src/build-components/TermsProvider/TermsProviderProps.generated.ts +82 -0
- package/src/build-components/TermsProvider/pattern.json +35 -0
- package/src/build-components/index.ts +10 -0
- package/src/build-components/patterns.generated.ts +2290 -1399
- package/src/components/AttributesEditorPanel.tsx +1 -0
- package/src/modals/CreateDeviceModal.tsx +12 -2
- package/src/modals/DeviceSelectorModal.tsx +1 -1
- package/src/patterns/event-constants.json +19 -0
- package/src/styles/components/_global-provider.scss +131 -0
- package/src/styles/index.scss +1 -0
- package/src/utils/analyseNodeByPatterns.ts +5 -2
- package/src/utils/nodeTree.ts +115 -0
- package/src/.DS_Store +0 -0
- package/src/assets/.DS_Store +0 -0
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"children": "node",
|
|
8
8
|
"extends": "View",
|
|
9
9
|
"attributes": {
|
|
10
|
-
"delay": "number"
|
|
10
|
+
"delay": "number",
|
|
11
|
+
"animation": ["default", "fade", "fade_from_bottom", "fade_from_right", "reveal_from_bottom", "scale_from_center", "slide_from_right", "slide_from_left", "slide_from_bottom", "none"]
|
|
11
12
|
}
|
|
12
13
|
},
|
|
13
14
|
"defaults": {
|
|
@@ -27,6 +28,13 @@
|
|
|
27
28
|
"category": "other",
|
|
28
29
|
"specialCategory": null,
|
|
29
30
|
"sort": 1
|
|
31
|
+
},
|
|
32
|
+
"animation": {
|
|
33
|
+
"label": "Page transition animation",
|
|
34
|
+
"description": "When this component is a GlobalProvider page: animation used when navigating to this screen.",
|
|
35
|
+
"category": "other",
|
|
36
|
+
"specialCategory": null,
|
|
37
|
+
"sort": 2
|
|
30
38
|
}
|
|
31
39
|
},
|
|
32
40
|
"mockableFeatures": {
|
|
@@ -27,6 +27,7 @@ import type { FormCheckboxComponentProps } from './FormCheckbox/FormCheckboxProp
|
|
|
27
27
|
import type { FormErrorTextComponentProps } from './FormErrorText/FormErrorTextProps.generated';
|
|
28
28
|
import type { FormProviderComponentProps } from './FormProvider/FormProviderProps.generated';
|
|
29
29
|
import type { FormSubmitButtonComponentProps } from './FormSubmitButton/FormSubmitButtonProps.generated';
|
|
30
|
+
import type { GlobalProviderComponentProps } from './GlobalProvider/GlobalProviderProps.generated';
|
|
30
31
|
import type { ImageComponentProps } from './Image/ImageProps.generated';
|
|
31
32
|
import type { MainComponentProps } from './Main/MainProps.generated';
|
|
32
33
|
import type { NavigationBarColorComponentProps } from './NavigationBarColor/NavigationBarColorProps.generated';
|
|
@@ -53,6 +54,7 @@ import type { RadioButtonComponentProps } from './RadioButton/RadioButtonProps.g
|
|
|
53
54
|
import type { SeparatorComponentProps } from './Separator/SeparatorProps.generated';
|
|
54
55
|
import type { StatusBarColorComponentProps } from './StatusBarColor/StatusBarColorProps.generated';
|
|
55
56
|
import type { SystemButtonComponentProps } from './SystemButton/SystemButtonProps.generated';
|
|
57
|
+
import type { TermsProviderComponentProps } from './TermsProvider/TermsProviderProps.generated';
|
|
56
58
|
import type { TextComponentProps } from './Text/TextProps.generated';
|
|
57
59
|
import type { ViewComponentProps } from './View/ViewProps.generated';
|
|
58
60
|
import type { WebViewComponentProps } from './WebView/WebViewProps.generated';
|
|
@@ -70,6 +72,7 @@ import { FormCheckbox } from './FormCheckbox/FormCheckbox';
|
|
|
70
72
|
import { FormErrorText } from './FormErrorText/FormErrorText';
|
|
71
73
|
import { FormProvider } from './FormProvider/FormProvider';
|
|
72
74
|
import { FormSubmitButton } from './FormSubmitButton/FormSubmitButton';
|
|
75
|
+
import GlobalProvider from './GlobalProvider/GlobalProvider';
|
|
73
76
|
import Image from './Image/Image';
|
|
74
77
|
import Main from './Main/Main';
|
|
75
78
|
import NavigationBarColor from './NavigationBarColor/NavigationBarColor';
|
|
@@ -96,6 +99,7 @@ import RadioButton from './RadioButton/RadioButton';
|
|
|
96
99
|
import Separator from './Separator/Separator';
|
|
97
100
|
import StatusBarColor from './StatusBarColor/StatusBarColor';
|
|
98
101
|
import { SystemButton } from './SystemButton/SystemButton';
|
|
102
|
+
import TermsProvider from './TermsProvider/TermsProvider';
|
|
99
103
|
import { Text } from './Text/Text';
|
|
100
104
|
import View from './View/View';
|
|
101
105
|
import { WebView } from './WebView/WebView';
|
|
@@ -115,6 +119,7 @@ type BuilderNode =
|
|
|
115
119
|
| (FormErrorTextComponentProps['node'] & { type: 'FormErrorText' })
|
|
116
120
|
| (FormProviderComponentProps['node'] & { type: 'FormProvider' })
|
|
117
121
|
| (FormSubmitButtonComponentProps['node'] & { type: 'FormSubmitButton' })
|
|
122
|
+
| (GlobalProviderComponentProps['node'] & { type: 'GlobalProvider' })
|
|
118
123
|
| (ImageComponentProps['node'] & { type: 'Image' })
|
|
119
124
|
| (MainComponentProps['node'] & { type: 'Main' })
|
|
120
125
|
| (NavigationBarColorComponentProps['node'] & { type: 'NavigationBarColor' })
|
|
@@ -143,6 +148,7 @@ type BuilderNode =
|
|
|
143
148
|
| (SeparatorComponentProps['node'] & { type: 'Separator' })
|
|
144
149
|
| (StatusBarColorComponentProps['node'] & { type: 'StatusBarColor' })
|
|
145
150
|
| (SystemButtonComponentProps['node'] & { type: 'SystemButton' })
|
|
151
|
+
| (TermsProviderComponentProps['node'] & { type: 'TermsProvider' })
|
|
146
152
|
| (TextComponentProps['node'] & { type: 'Text' })
|
|
147
153
|
| (ViewComponentProps['node'] & { type: 'View' })
|
|
148
154
|
| (WebViewComponentProps['node'] & { type: 'WebView' });
|
|
@@ -205,6 +211,8 @@ function RenderNode({ node }: { node: Node }) {
|
|
|
205
211
|
return <FormProvider node={normalizedNode} />;
|
|
206
212
|
case 'FormSubmitButton':
|
|
207
213
|
return <FormSubmitButton node={normalizedNode} />;
|
|
214
|
+
case 'GlobalProvider':
|
|
215
|
+
return <GlobalProvider node={normalizedNode} />;
|
|
208
216
|
case 'Image':
|
|
209
217
|
return <Image node={normalizedNode} />;
|
|
210
218
|
case 'Main':
|
|
@@ -257,6 +265,8 @@ function RenderNode({ node }: { node: Node }) {
|
|
|
257
265
|
return <StatusBarColor node={normalizedNode} />;
|
|
258
266
|
case 'SystemButton':
|
|
259
267
|
return <SystemButton node={normalizedNode} />;
|
|
268
|
+
case 'TermsProvider':
|
|
269
|
+
return <TermsProvider node={normalizedNode} />;
|
|
260
270
|
case 'Text':
|
|
261
271
|
return <Text node={normalizedNode} />;
|
|
262
272
|
case 'View':
|
|
@@ -8,6 +8,8 @@ import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
|
8
8
|
import { useMockOSContext, useMockPermission } from '../../mockOS';
|
|
9
9
|
import { useLocalize } from '../../hooks/useLocalize';
|
|
10
10
|
import { usePlacementButtonEvents } from './usePlacementButtonEvents';
|
|
11
|
+
import { useGlobalNavigation } from '../GlobalProvider/useGlobalNavigation';
|
|
12
|
+
import { useGlobalContext } from '../GlobalProvider/GlobalContext';
|
|
11
13
|
|
|
12
14
|
export type SystemButtonOptionalProps = {
|
|
13
15
|
onClick?: () => void;
|
|
@@ -24,6 +26,8 @@ export function SystemButton({
|
|
|
24
26
|
const attributeName = node.sourceType ?? node.type ?? 'SystemButton';
|
|
25
27
|
const context = useMockOSContext();
|
|
26
28
|
const mockPermissionManager = useMockPermission(context);
|
|
29
|
+
const globalNavigate = useGlobalNavigation();
|
|
30
|
+
const globalCtx = useGlobalContext();
|
|
27
31
|
const generatedId = useId();
|
|
28
32
|
const attributeKey = node.key ?? generatedId;
|
|
29
33
|
const attrs = node.attributes;
|
|
@@ -37,6 +41,8 @@ export function SystemButton({
|
|
|
37
41
|
context,
|
|
38
42
|
requestPermission: (permission) =>
|
|
39
43
|
mockPermissionManager.requestPermission(permission),
|
|
44
|
+
globalNavigate,
|
|
45
|
+
setCondition: globalCtx?.setCondition,
|
|
40
46
|
});
|
|
41
47
|
|
|
42
48
|
const handleClick = onClickProp ?? placementClick;
|
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
-
export type TypeOptionType =
|
|
5
|
+
export type TypeOptionType =
|
|
6
|
+
| 'Permission'
|
|
7
|
+
| 'Navigate'
|
|
8
|
+
| 'Placement'
|
|
9
|
+
| 'SetCondition';
|
|
10
|
+
export type PermissionOptionType =
|
|
11
|
+
| 'notification'
|
|
12
|
+
| 'camera'
|
|
13
|
+
| 'microphone'
|
|
14
|
+
| 'location'
|
|
15
|
+
| 'photos'
|
|
16
|
+
| 'contacts'
|
|
17
|
+
| 'att'
|
|
18
|
+
| 'rating'
|
|
19
|
+
| 'GDPR';
|
|
20
|
+
export type PlacementKeyOptionType =
|
|
21
|
+
| 'terms'
|
|
22
|
+
| 'onboard'
|
|
23
|
+
| 'paywall'
|
|
24
|
+
| 'subscription'
|
|
25
|
+
| 'home';
|
|
26
|
+
export type ConditionKeyOptionType = 'termsAccepted';
|
|
6
27
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
7
28
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
8
29
|
export type AlignItemsOptionType =
|
|
@@ -22,10 +43,12 @@ export type PositionOptionType = 'relative' | 'absolute';
|
|
|
22
43
|
|
|
23
44
|
export interface EventObjectGenerated {
|
|
24
45
|
type?: TypeOptionType;
|
|
25
|
-
permission?:
|
|
46
|
+
permission?: PermissionOptionType;
|
|
26
47
|
navigate_to?: string;
|
|
27
48
|
targetIndex?: number;
|
|
28
|
-
placementKey?:
|
|
49
|
+
placementKey?: PlacementKeyOptionType;
|
|
50
|
+
conditionKey?: ConditionKeyOptionType;
|
|
51
|
+
value?: boolean;
|
|
29
52
|
}
|
|
30
53
|
|
|
31
54
|
export interface SystemButtonStyleGenerated {
|
|
@@ -33,11 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"types": {
|
|
35
35
|
"EventObject": {
|
|
36
|
-
"type":
|
|
37
|
-
"permission": "
|
|
36
|
+
"type": "$ref:event-constants.eventTypes",
|
|
37
|
+
"permission": "$ref:event-constants.permissionTypes",
|
|
38
38
|
"navigate_to": "string",
|
|
39
39
|
"targetIndex": "number",
|
|
40
|
-
"placementKey": "
|
|
40
|
+
"placementKey": "$ref:event-constants.placementKeys",
|
|
41
|
+
"conditionKey": "$ref:event-constants.conditionKeys",
|
|
42
|
+
"value": "boolean"
|
|
41
43
|
}
|
|
42
44
|
},
|
|
43
45
|
"meta": {
|
|
@@ -2,13 +2,15 @@ import { useRef, useCallback } from 'react';
|
|
|
2
2
|
import type { MockOSContextValue } from '../../mockOS/context/MockOSContextBase';
|
|
3
3
|
import type { PermissionStatus } from '../../mockOS/managers/mockPermissionManager';
|
|
4
4
|
|
|
5
|
-
/** Event shape shared by SystemButton and OnboardButton. Placement = go to placementKey (onboard/terms/paywall); Navigate = navigate_to or carousel. */
|
|
5
|
+
/** Event shape shared by SystemButton and OnboardButton. Placement = go to placementKey (onboard/terms/paywall); Navigate = navigate_to or carousel; SetCondition = update a global boolean condition. */
|
|
6
6
|
export interface PlacementEventObject {
|
|
7
|
-
type?: 'Permission' | 'Navigate' | 'Placement';
|
|
7
|
+
type?: 'Permission' | 'Navigate' | 'Placement' | 'SetCondition';
|
|
8
8
|
permission?: string | null;
|
|
9
9
|
placementKey?: string;
|
|
10
10
|
navigate_to?: string;
|
|
11
11
|
targetIndex?: number;
|
|
12
|
+
conditionKey?: string;
|
|
13
|
+
value?: boolean;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface UsePlacementButtonEventsOptions {
|
|
@@ -18,6 +20,17 @@ export interface UsePlacementButtonEventsOptions {
|
|
|
18
20
|
onNavigateWithoutPlacement?: (
|
|
19
21
|
e: PlacementEventObject,
|
|
20
22
|
) => Promise<boolean> | boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Optional global navigate function (from useGlobalNavigation).
|
|
25
|
+
* When provided, Navigate/Placement events try this first before falling back
|
|
26
|
+
* to MockOSContext. Return true if the navigation was handled.
|
|
27
|
+
*/
|
|
28
|
+
globalNavigate?: (target: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Optional callback to set a global boolean condition (from GlobalContext).
|
|
31
|
+
* Used by SetCondition events.
|
|
32
|
+
*/
|
|
33
|
+
setCondition?: (key: string, value: boolean) => void;
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
/**
|
|
@@ -29,9 +42,27 @@ export function usePlacementButtonEvents(
|
|
|
29
42
|
events: PlacementEventObject[] | undefined,
|
|
30
43
|
options: UsePlacementButtonEventsOptions,
|
|
31
44
|
): () => Promise<void> {
|
|
32
|
-
const {
|
|
45
|
+
const {
|
|
46
|
+
context,
|
|
47
|
+
requestPermission,
|
|
48
|
+
onNavigateWithoutPlacement,
|
|
49
|
+
globalNavigate,
|
|
50
|
+
setCondition,
|
|
51
|
+
} = options;
|
|
33
52
|
const handledEventsRef = useRef<PlacementEventObject[]>([]);
|
|
34
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Attempts to navigate to a target. Tries globalNavigate first (GlobalProvider),
|
|
56
|
+
* then falls back to MockOSContext.
|
|
57
|
+
*/
|
|
58
|
+
const navigateTo = useCallback(
|
|
59
|
+
(target: string): void => {
|
|
60
|
+
if (globalNavigate?.(target)) return;
|
|
61
|
+
context?.navigation(target as Parameters<typeof context.navigation>[0]);
|
|
62
|
+
},
|
|
63
|
+
[context, globalNavigate],
|
|
64
|
+
);
|
|
65
|
+
|
|
35
66
|
const handleClick = useCallback(async () => {
|
|
36
67
|
const list = events ?? [];
|
|
37
68
|
|
|
@@ -44,24 +75,19 @@ export function usePlacementButtonEvents(
|
|
|
44
75
|
const permission = e.permission ?? 'camera';
|
|
45
76
|
await requestPermission(permission);
|
|
46
77
|
handledEventsRef.current.push(e);
|
|
78
|
+
} else if (e.type === 'SetCondition' && e.conditionKey) {
|
|
79
|
+
setCondition?.(e.conditionKey, e.value ?? false);
|
|
80
|
+
handledEventsRef.current.push(e);
|
|
47
81
|
} else if (e.type === 'Placement' && e.placementKey) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
context?.navigation('subscription');
|
|
52
|
-
} else if (e.placementKey === 'terms') {
|
|
53
|
-
context?.navigation('terms');
|
|
54
|
-
}
|
|
82
|
+
const target =
|
|
83
|
+
e.placementKey === 'paywall' ? 'paywall' : e.placementKey;
|
|
84
|
+
navigateTo(target);
|
|
55
85
|
handledEventsRef.current.push(e);
|
|
56
86
|
} else if (e.type === 'Navigate') {
|
|
57
87
|
if (e.placementKey) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
context?.navigation('subscription');
|
|
62
|
-
} else if (e.placementKey === 'terms') {
|
|
63
|
-
context?.navigation('terms');
|
|
64
|
-
}
|
|
88
|
+
const target =
|
|
89
|
+
e.placementKey === 'paywall' ? 'paywall' : e.placementKey;
|
|
90
|
+
navigateTo(target);
|
|
65
91
|
handledEventsRef.current.push(e);
|
|
66
92
|
} else {
|
|
67
93
|
const handled =
|
|
@@ -70,21 +96,19 @@ export function usePlacementButtonEvents(
|
|
|
70
96
|
if (handled) {
|
|
71
97
|
handledEventsRef.current.push(e);
|
|
72
98
|
} else if (e.navigate_to && typeof e.navigate_to === 'string') {
|
|
73
|
-
|
|
74
|
-
e.navigate_to as
|
|
75
|
-
| 'onboard'
|
|
76
|
-
| 'terms'
|
|
77
|
-
| 'subscription'
|
|
78
|
-
| 'app'
|
|
79
|
-
| 'home'
|
|
80
|
-
| 'launchscreen',
|
|
81
|
-
);
|
|
99
|
+
navigateTo(e.navigate_to);
|
|
82
100
|
handledEventsRef.current.push(e);
|
|
83
101
|
}
|
|
84
102
|
}
|
|
85
103
|
}
|
|
86
104
|
}
|
|
87
|
-
}, [
|
|
105
|
+
}, [
|
|
106
|
+
events,
|
|
107
|
+
requestPermission,
|
|
108
|
+
setCondition,
|
|
109
|
+
navigateTo,
|
|
110
|
+
onNavigateWithoutPlacement,
|
|
111
|
+
]);
|
|
88
112
|
|
|
89
113
|
return handleClick;
|
|
90
114
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useId } from 'react';
|
|
2
|
+
import type { TermsProviderComponentProps } from './TermsProviderProps.generated';
|
|
3
|
+
import RenderNode from '../RenderNode.generated';
|
|
4
|
+
import type { Node } from '../../types/Node';
|
|
5
|
+
import useNode from '../useNode';
|
|
6
|
+
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
7
|
+
import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
|
|
8
|
+
import { useLogRender } from '../../utils/useLogRender';
|
|
9
|
+
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
10
|
+
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
11
|
+
|
|
12
|
+
function TermsProvider({ node }: TermsProviderComponentProps) {
|
|
13
|
+
useLogRender('TermsProvider');
|
|
14
|
+
node = useNode(node);
|
|
15
|
+
|
|
16
|
+
const generatedId = useId();
|
|
17
|
+
const attributeName = node.sourceType ?? node.type ?? 'TermsProvider';
|
|
18
|
+
const attributeKey = node.key ?? generatedId;
|
|
19
|
+
|
|
20
|
+
const { previewMode, selectedKey } = useBuilderParams();
|
|
21
|
+
|
|
22
|
+
const baseStyle = useExtractViewStyle(node);
|
|
23
|
+
|
|
24
|
+
const isSelected = isNodeSelected({
|
|
25
|
+
previewMode: !!previewMode,
|
|
26
|
+
current: selectedKey ? { key: selectedKey } : undefined,
|
|
27
|
+
node,
|
|
28
|
+
});
|
|
29
|
+
const style = useMergedStyle(
|
|
30
|
+
baseStyle,
|
|
31
|
+
isSelected ? SELECTED_OUTLINE_STYLE : undefined,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<div
|
|
36
|
+
attribute-name={attributeName}
|
|
37
|
+
attribute-key={attributeKey}
|
|
38
|
+
style={style}
|
|
39
|
+
>
|
|
40
|
+
{node.children && <RenderNode node={node.children as Node} />}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default React.memo(TermsProvider);
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* AUTO-GENERATED FILE - DO NOT EDIT */
|
|
2
|
+
|
|
3
|
+
import type { NodeData } from '../../types/Node';
|
|
4
|
+
|
|
5
|
+
export type AnimationOptionType =
|
|
6
|
+
| 'default'
|
|
7
|
+
| 'fade'
|
|
8
|
+
| 'fade_from_bottom'
|
|
9
|
+
| 'fade_from_right'
|
|
10
|
+
| 'reveal_from_bottom'
|
|
11
|
+
| 'scale_from_center'
|
|
12
|
+
| 'slide_from_right'
|
|
13
|
+
| 'slide_from_left'
|
|
14
|
+
| 'slide_from_bottom'
|
|
15
|
+
| 'none';
|
|
16
|
+
export type FlexDirectionOptionType = 'row' | 'column';
|
|
17
|
+
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
18
|
+
export type AlignItemsOptionType =
|
|
19
|
+
| 'flex-start'
|
|
20
|
+
| 'center'
|
|
21
|
+
| 'flex-end'
|
|
22
|
+
| 'stretch'
|
|
23
|
+
| 'baseline';
|
|
24
|
+
export type JustifyContentOptionType =
|
|
25
|
+
| 'flex-start'
|
|
26
|
+
| 'center'
|
|
27
|
+
| 'flex-end'
|
|
28
|
+
| 'space-between'
|
|
29
|
+
| 'space-around'
|
|
30
|
+
| 'space-evenly';
|
|
31
|
+
export type PositionOptionType = 'relative' | 'absolute';
|
|
32
|
+
|
|
33
|
+
export interface TermsProviderStyleGenerated {
|
|
34
|
+
flexDirection?: FlexDirectionOptionType;
|
|
35
|
+
flexWrap?: FlexWrapOptionType;
|
|
36
|
+
alignItems?: AlignItemsOptionType;
|
|
37
|
+
justifyContent?: JustifyContentOptionType;
|
|
38
|
+
gap?: string;
|
|
39
|
+
padding?: string;
|
|
40
|
+
paddingHorizontal?: string;
|
|
41
|
+
paddingVertical?: string;
|
|
42
|
+
paddingTop?: string;
|
|
43
|
+
paddingBottom?: string;
|
|
44
|
+
paddingLeft?: string;
|
|
45
|
+
paddingRight?: string;
|
|
46
|
+
margin?: string;
|
|
47
|
+
marginHorizontal?: string;
|
|
48
|
+
marginVertical?: string;
|
|
49
|
+
marginTop?: string;
|
|
50
|
+
marginBottom?: string;
|
|
51
|
+
marginLeft?: string;
|
|
52
|
+
marginRight?: string;
|
|
53
|
+
backgroundColor?: string;
|
|
54
|
+
borderRadius?: string;
|
|
55
|
+
width?: string;
|
|
56
|
+
minWidth?: string;
|
|
57
|
+
maxWidth?: string;
|
|
58
|
+
height?: string;
|
|
59
|
+
minHeight?: string;
|
|
60
|
+
maxHeight?: string;
|
|
61
|
+
flex?: number;
|
|
62
|
+
position?: PositionOptionType;
|
|
63
|
+
top?: string;
|
|
64
|
+
bottom?: string;
|
|
65
|
+
left?: string;
|
|
66
|
+
right?: string;
|
|
67
|
+
zIndex?: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface TermsProviderPropsGenerated {
|
|
71
|
+
child: string;
|
|
72
|
+
attributes: {
|
|
73
|
+
styles?: TermsProviderStyleGenerated;
|
|
74
|
+
scrollable?: boolean;
|
|
75
|
+
testID?: string;
|
|
76
|
+
animation?: AnimationOptionType;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface TermsProviderComponentProps {
|
|
81
|
+
node: NodeData<TermsProviderPropsGenerated['attributes']>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"pattern": {
|
|
4
|
+
"type": "TermsProvider",
|
|
5
|
+
"title": "title",
|
|
6
|
+
"description": "description",
|
|
7
|
+
"children": "node",
|
|
8
|
+
"extends": "View",
|
|
9
|
+
"attributes": {
|
|
10
|
+
"animation": ["default", "fade", "fade_from_bottom", "fade_from_right", "reveal_from_bottom", "scale_from_center", "slide_from_right", "slide_from_left", "slide_from_bottom", "none"]
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"defaults": {
|
|
14
|
+
"styles": {
|
|
15
|
+
"width": "100%",
|
|
16
|
+
"height": "100%",
|
|
17
|
+
"flex": 1
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"meta": {
|
|
21
|
+
"desiredParent": ["root", "GlobalProvider"],
|
|
22
|
+
"label": "Terms Provider",
|
|
23
|
+
"description": "Provider for terms & privacy page (e.g. WebView + form). Use as a GlobalProvider page.",
|
|
24
|
+
"attributes": {
|
|
25
|
+
"animation": {
|
|
26
|
+
"label": "Page transition animation",
|
|
27
|
+
"description": "When this component is a GlobalProvider page: animation used when navigating to this screen.",
|
|
28
|
+
"category": "other",
|
|
29
|
+
"specialCategory": null,
|
|
30
|
+
"sort": 1
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"styles": {}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -19,6 +19,7 @@ export const allcomponentNames = [
|
|
|
19
19
|
'FormErrorText',
|
|
20
20
|
'FormProvider',
|
|
21
21
|
'FormSubmitButton',
|
|
22
|
+
'GlobalProvider',
|
|
22
23
|
'Image',
|
|
23
24
|
'Main',
|
|
24
25
|
'NavigationBarColor',
|
|
@@ -45,6 +46,7 @@ export const allcomponentNames = [
|
|
|
45
46
|
'Separator',
|
|
46
47
|
'StatusBarColor',
|
|
47
48
|
'SystemButton',
|
|
49
|
+
'TermsProvider',
|
|
48
50
|
'Text',
|
|
49
51
|
'View',
|
|
50
52
|
'WebView',
|
|
@@ -106,6 +108,10 @@ export type {
|
|
|
106
108
|
FormSubmitButtonPropsGenerated,
|
|
107
109
|
FormSubmitButtonComponentProps,
|
|
108
110
|
} from './FormSubmitButton/FormSubmitButtonProps.generated';
|
|
111
|
+
export type {
|
|
112
|
+
GlobalProviderPropsGenerated,
|
|
113
|
+
GlobalProviderComponentProps,
|
|
114
|
+
} from './GlobalProvider/GlobalProviderProps.generated';
|
|
109
115
|
export type {
|
|
110
116
|
ImagePropsGenerated,
|
|
111
117
|
ImageComponentProps,
|
|
@@ -210,6 +216,10 @@ export type {
|
|
|
210
216
|
SystemButtonPropsGenerated,
|
|
211
217
|
SystemButtonComponentProps,
|
|
212
218
|
} from './SystemButton/SystemButtonProps.generated';
|
|
219
|
+
export type {
|
|
220
|
+
TermsProviderPropsGenerated,
|
|
221
|
+
TermsProviderComponentProps,
|
|
222
|
+
} from './TermsProvider/TermsProviderProps.generated';
|
|
213
223
|
export type {
|
|
214
224
|
TextPropsGenerated,
|
|
215
225
|
TextComponentProps,
|