@developer_tribe/react-builder 1.2.44-test.1 → 1.2.44-test.2
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/globalProviderUtils.d.ts +4 -13
- 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/SystemButton/SystemButtonProps.generated.d.ts +8 -3
- package/dist/build-components/SystemButton/usePlacementButtonEvents.d.ts +9 -2
- package/dist/build-components/patterns.generated.d.ts +15 -9
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- 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/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/samples/global-onboard-flow.json +7 -1
- 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 -1
- package/src/build-components/FormSubmitButton/FormSubmitButton.tsx +3 -0
- package/src/build-components/FormSubmitButton/FormSubmitButtonProps.generated.ts +26 -3
- package/src/build-components/GlobalProvider/GlobalProvider.tsx +4 -144
- package/src/build-components/GlobalProvider/globalProviderUtils.ts +79 -38
- package/src/build-components/GlobalProvider/useGlobalNavigation.ts +0 -5
- package/src/build-components/GlobalProvider/useGlobalProviderLogic.ts +172 -0
- package/src/build-components/OnboardButton/OnboardButton.tsx +3 -0
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +26 -3
- package/src/build-components/OnboardButton/pattern.json +5 -3
- package/src/build-components/SystemButton/SystemButton.tsx +3 -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 +22 -9
- package/src/build-components/patterns.generated.ts +45 -9
- package/src/components/AttributesEditorPanel.tsx +1 -0
- package/src/patterns/event-constants.json +19 -0
- package/src/utils/nodeTree.ts +115 -0
|
@@ -3,6 +3,7 @@ import type { ViewPropsGenerated } from '../build-components/View/ViewProps.gene
|
|
|
3
3
|
import type { ProjectColors } from '../types/Project';
|
|
4
4
|
import { type PreferredScale } from './SizeField';
|
|
5
5
|
import { LayoutContext } from './types';
|
|
6
|
+
import type { ProjectOptions } from '../utils/nodeTree';
|
|
6
7
|
type FieldProps = {
|
|
7
8
|
name: string;
|
|
8
9
|
type: string | string[];
|
|
@@ -14,6 +15,7 @@ type FieldProps = {
|
|
|
14
15
|
viewAttributes?: Partial<ViewPropsGenerated['attributes']>;
|
|
15
16
|
label?: React.ReactNode;
|
|
16
17
|
preferredScale?: PreferredScale;
|
|
18
|
+
projectOptions?: ProjectOptions;
|
|
17
19
|
};
|
|
18
|
-
export declare function Field({ name, type, value, onChange, componentType, projectColors, layoutContext, viewAttributes, label, preferredScale, }: FieldProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function Field({ name, type, value, onChange, componentType, projectColors, layoutContext, viewAttributes, label, preferredScale, projectOptions, }: FieldProps): import("react/jsx-runtime").JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -3,11 +3,13 @@ import type { ProjectColors } from '../types/Project';
|
|
|
3
3
|
import type { ViewPropsGenerated } from '../build-components/View/ViewProps.generated';
|
|
4
4
|
import type { Fonts } from '../types/Fonts';
|
|
5
5
|
import type { LayoutContext, SchemaEntry } from './types';
|
|
6
|
+
import type { ProjectOptions } from '../utils/nodeTree';
|
|
6
7
|
export type TabId = 'style' | 'container' | 'other';
|
|
7
8
|
export type AttributesEditorProps = {
|
|
8
9
|
node: Node;
|
|
9
10
|
onChange: (next: Node) => void;
|
|
10
11
|
projectColors?: ProjectColors;
|
|
12
|
+
projectRoot?: Node;
|
|
11
13
|
};
|
|
12
14
|
export type AttributesEditorTabConfig = {
|
|
13
15
|
id: TabId;
|
|
@@ -47,6 +49,7 @@ export type AttributesEditorModel = {
|
|
|
47
49
|
projectColorsForPicker?: ProjectColors;
|
|
48
50
|
viewAttributes?: Partial<ViewPropsGenerated['attributes']>;
|
|
49
51
|
layoutContext: LayoutContext;
|
|
52
|
+
projectOptions: ProjectOptions;
|
|
50
53
|
getAttributeValue: (name: string) => unknown;
|
|
51
54
|
handleAttributeChange: (name: string, val: unknown) => void;
|
|
52
55
|
handleChildrenChange: (val: string) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { AttributesEditorModel, AttributesEditorProps } from './attributesEditorModelTypes';
|
|
2
|
-
export declare function useAttributesEditorModel({ node, onChange, projectColors, }: AttributesEditorProps): AttributesEditorModel;
|
|
2
|
+
export declare function useAttributesEditorModel({ node, onChange, projectColors, projectRoot, }: AttributesEditorProps): AttributesEditorModel;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { NodeData } from '../../types/Node';
|
|
2
|
-
export type TypeOptionType = 'Permission' | 'Navigate' | 'Placement';
|
|
2
|
+
export type TypeOptionType = 'Permission' | 'Navigate' | 'Placement' | 'SetCondition';
|
|
3
|
+
export type PermissionOptionType = 'notification' | 'camera' | 'microphone' | 'location' | 'photos' | 'contacts' | 'att' | 'rating' | 'GDPR';
|
|
4
|
+
export type PlacementKeyOptionType = 'terms' | 'onboard' | 'paywall' | 'subscription' | 'home';
|
|
5
|
+
export type ConditionKeyOptionType = 'termsAccepted';
|
|
3
6
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
4
7
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
5
8
|
export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
|
|
@@ -7,10 +10,12 @@ export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 's
|
|
|
7
10
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
8
11
|
export interface EventObjectGenerated {
|
|
9
12
|
type?: TypeOptionType;
|
|
10
|
-
permission?:
|
|
13
|
+
permission?: PermissionOptionType;
|
|
11
14
|
navigate_to?: string;
|
|
12
15
|
targetIndex?: number;
|
|
13
|
-
placementKey?:
|
|
16
|
+
placementKey?: PlacementKeyOptionType;
|
|
17
|
+
conditionKey?: ConditionKeyOptionType;
|
|
18
|
+
value?: boolean;
|
|
14
19
|
}
|
|
15
20
|
export interface FormSubmitButtonStyleGenerated {
|
|
16
21
|
color?: string;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { NodeData } from '../../types/Node';
|
|
2
2
|
import type { GlobalPage } from './GlobalContext';
|
|
3
3
|
/**
|
|
4
|
-
* Derives a stable page key for a child node.
|
|
5
|
-
* Priority: node.key
|
|
6
|
-
*
|
|
7
|
-
* Using node.key avoids adding unknown attributes to child components that
|
|
8
|
-
* would fail builder validation.
|
|
4
|
+
* Derives a stable and unique page key for a child node.
|
|
5
|
+
* Priority: node.key → TYPE_KEY_MAP → "${type}-${index}"
|
|
9
6
|
*/
|
|
10
|
-
export declare function derivePageKey(node: NodeData, index: number): string;
|
|
7
|
+
export declare function derivePageKey(node: NodeData, index: number, existingKeys: Set<string>): string;
|
|
11
8
|
/** Runtime shape of a SkipConditionEntry (mirrors the types block in pattern.json). */
|
|
12
9
|
export interface SkipConditionEntry {
|
|
13
10
|
pageKey: string;
|
|
@@ -15,20 +12,14 @@ export interface SkipConditionEntry {
|
|
|
15
12
|
}
|
|
16
13
|
/**
|
|
17
14
|
* Converts SkipConditionEntry[] (from pattern schema) to a lookup map for fast access.
|
|
18
|
-
* Array format is used in pattern.json because the schema system doesn't support
|
|
19
|
-
* plain Record/object attribute types.
|
|
20
15
|
*/
|
|
21
16
|
export declare function normalizeSkipConditions(raw: unknown): Record<string, string>;
|
|
22
17
|
/**
|
|
23
18
|
* Builds the page list for GlobalProvider.
|
|
24
|
-
*
|
|
25
|
-
* @param children - direct child nodes of GlobalProvider
|
|
26
|
-
* @param skipConditions - lookup map of pageKey → conditionKey, already normalized
|
|
27
|
-
* from SkipConditionEntry[] via normalizeSkipConditions().
|
|
28
19
|
*/
|
|
29
20
|
export declare function buildPages(children: NodeData[], skipConditions?: Record<string, string>): GlobalPage[];
|
|
30
21
|
/** Returns the first non-skipped page key, starting from the requested key. */
|
|
31
|
-
export declare function resolveEffectivePage(targetKey: string, pages: GlobalPage[], conditions: Record<string, boolean>): string;
|
|
22
|
+
export declare function resolveEffectivePage(targetKey: string, pages: GlobalPage[], conditions: Record<string, boolean>): string | null;
|
|
32
23
|
export declare function persistProgress(storageKey: string, currentPageKey: string, conditions: Record<string, boolean>): void;
|
|
33
24
|
export declare function loadProgress(storageKey: string): {
|
|
34
25
|
currentPageKey: string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GlobalContextValue } from './GlobalContext';
|
|
2
|
+
import type { NodeData } from '../../types/Node';
|
|
3
|
+
export interface UseGlobalProviderLogicOptions {
|
|
4
|
+
node: NodeData;
|
|
5
|
+
}
|
|
6
|
+
export declare function useGlobalProviderLogic({ node: rawNode, }: UseGlobalProviderLogicOptions): {
|
|
7
|
+
node: NodeData<Record<string, unknown>>;
|
|
8
|
+
attributeName: string;
|
|
9
|
+
attributeKey: string;
|
|
10
|
+
attrs: Record<string, unknown> | undefined;
|
|
11
|
+
pages: import("./GlobalContext").GlobalPage[];
|
|
12
|
+
currentPageKey: string;
|
|
13
|
+
activePage: import("./GlobalContext").GlobalPage | undefined;
|
|
14
|
+
contextValue: GlobalContextValue;
|
|
15
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { NodeData } from '../../types/Node';
|
|
2
|
-
export type TypeOptionType = 'Permission' | 'Navigate' | 'Placement';
|
|
2
|
+
export type TypeOptionType = 'Permission' | 'Navigate' | 'Placement' | 'SetCondition';
|
|
3
|
+
export type PermissionOptionType = 'notification' | 'camera' | 'microphone' | 'location' | 'photos' | 'contacts' | 'att' | 'rating' | 'GDPR';
|
|
4
|
+
export type PlacementKeyOptionType = 'terms' | 'onboard' | 'paywall' | 'subscription' | 'home';
|
|
5
|
+
export type ConditionKeyOptionType = 'termsAccepted';
|
|
3
6
|
export type TestIDOptionType = 'onboardSkip' | 'onboardNext';
|
|
4
7
|
export type AnimationOptionType = 'simple-animation' | 'line-animation' | 'blur' | 'blur-animation' | 'blur-line-animation';
|
|
5
8
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
@@ -9,10 +12,12 @@ export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 's
|
|
|
9
12
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
10
13
|
export interface EventObjectGenerated {
|
|
11
14
|
type?: TypeOptionType;
|
|
12
|
-
permission?:
|
|
15
|
+
permission?: PermissionOptionType;
|
|
13
16
|
navigate_to?: string;
|
|
14
17
|
targetIndex?: number;
|
|
15
|
-
placementKey?:
|
|
18
|
+
placementKey?: PlacementKeyOptionType;
|
|
19
|
+
conditionKey?: ConditionKeyOptionType;
|
|
20
|
+
value?: boolean;
|
|
16
21
|
}
|
|
17
22
|
export interface OnboardButtonStyleGenerated {
|
|
18
23
|
color?: string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { NodeData } from '../../types/Node';
|
|
2
|
-
export type TypeOptionType = 'Permission' | 'Navigate' | 'Placement';
|
|
2
|
+
export type TypeOptionType = 'Permission' | 'Navigate' | 'Placement' | 'SetCondition';
|
|
3
|
+
export type PermissionOptionType = 'notification' | 'camera' | 'microphone' | 'location' | 'photos' | 'contacts' | 'att' | 'rating' | 'GDPR';
|
|
4
|
+
export type PlacementKeyOptionType = 'terms' | 'onboard' | 'paywall' | 'subscription' | 'home';
|
|
5
|
+
export type ConditionKeyOptionType = 'termsAccepted';
|
|
3
6
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
4
7
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
5
8
|
export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
|
|
@@ -7,10 +10,12 @@ export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 's
|
|
|
7
10
|
export type PositionOptionType = 'relative' | 'absolute';
|
|
8
11
|
export interface EventObjectGenerated {
|
|
9
12
|
type?: TypeOptionType;
|
|
10
|
-
permission?:
|
|
13
|
+
permission?: PermissionOptionType;
|
|
11
14
|
navigate_to?: string;
|
|
12
15
|
targetIndex?: number;
|
|
13
|
-
placementKey?:
|
|
16
|
+
placementKey?: PlacementKeyOptionType;
|
|
17
|
+
conditionKey?: ConditionKeyOptionType;
|
|
18
|
+
value?: boolean;
|
|
14
19
|
}
|
|
15
20
|
export interface SystemButtonStyleGenerated {
|
|
16
21
|
color?: string;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { MockOSContextValue } from '../../mockOS/context/MockOSContextBase';
|
|
2
2
|
import type { PermissionStatus } from '../../mockOS/managers/mockPermissionManager';
|
|
3
|
-
/** Event shape shared by SystemButton and OnboardButton. Placement = go to placementKey (onboard/terms/paywall); Navigate = navigate_to or carousel. */
|
|
3
|
+
/** 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. */
|
|
4
4
|
export interface PlacementEventObject {
|
|
5
|
-
type?: 'Permission' | 'Navigate' | 'Placement';
|
|
5
|
+
type?: 'Permission' | 'Navigate' | 'Placement' | 'SetCondition';
|
|
6
6
|
permission?: string | null;
|
|
7
7
|
placementKey?: string;
|
|
8
8
|
navigate_to?: string;
|
|
9
9
|
targetIndex?: number;
|
|
10
|
+
conditionKey?: string;
|
|
11
|
+
value?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export interface UsePlacementButtonEventsOptions {
|
|
12
14
|
context: MockOSContextValue | null;
|
|
@@ -19,6 +21,11 @@ export interface UsePlacementButtonEventsOptions {
|
|
|
19
21
|
* to MockOSContext. Return true if the navigation was handled.
|
|
20
22
|
*/
|
|
21
23
|
globalNavigate?: (target: string) => boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Optional callback to set a global boolean condition (from GlobalContext).
|
|
26
|
+
* Used by SetCondition events.
|
|
27
|
+
*/
|
|
28
|
+
setCondition?: (key: string, value: boolean) => void;
|
|
22
29
|
}
|
|
23
30
|
/**
|
|
24
31
|
* Shared hook for Permission + Navigate(placementKey / navigate_to) used by SystemButton and OnboardButton.
|
|
@@ -5384,11 +5384,13 @@ export declare const patterns: readonly [{
|
|
|
5384
5384
|
};
|
|
5385
5385
|
readonly types: {
|
|
5386
5386
|
readonly EventObject: {
|
|
5387
|
-
readonly type: readonly ["Permission", "Navigate", "Placement"];
|
|
5388
|
-
readonly permission: "
|
|
5387
|
+
readonly type: readonly ["Permission", "Navigate", "Placement", "SetCondition"];
|
|
5388
|
+
readonly permission: readonly ["notification", "camera", "microphone", "location", "photos", "contacts", "att", "rating", "GDPR"];
|
|
5389
5389
|
readonly navigate_to: "string";
|
|
5390
5390
|
readonly targetIndex: "number";
|
|
5391
|
-
readonly placementKey: "
|
|
5391
|
+
readonly placementKey: readonly ["terms", "onboard", "paywall", "subscription", "home"];
|
|
5392
|
+
readonly conditionKey: readonly ["termsAccepted"];
|
|
5393
|
+
readonly value: "boolean";
|
|
5392
5394
|
};
|
|
5393
5395
|
};
|
|
5394
5396
|
readonly meta: {
|
|
@@ -7434,11 +7436,13 @@ export declare const patterns: readonly [{
|
|
|
7434
7436
|
};
|
|
7435
7437
|
readonly types: {
|
|
7436
7438
|
readonly EventObject: {
|
|
7437
|
-
readonly type: readonly ["Permission", "Navigate", "Placement"];
|
|
7438
|
-
readonly permission: "
|
|
7439
|
+
readonly type: readonly ["Permission", "Navigate", "Placement", "SetCondition"];
|
|
7440
|
+
readonly permission: readonly ["notification", "camera", "microphone", "location", "photos", "contacts", "att", "rating", "GDPR"];
|
|
7439
7441
|
readonly navigate_to: "string";
|
|
7440
7442
|
readonly targetIndex: "number";
|
|
7441
|
-
readonly placementKey: "
|
|
7443
|
+
readonly placementKey: readonly ["terms", "onboard", "paywall", "subscription", "home"];
|
|
7444
|
+
readonly conditionKey: readonly ["termsAccepted"];
|
|
7445
|
+
readonly value: "boolean";
|
|
7442
7446
|
};
|
|
7443
7447
|
};
|
|
7444
7448
|
readonly meta: {
|
|
@@ -15956,11 +15960,13 @@ export declare const patterns: readonly [{
|
|
|
15956
15960
|
};
|
|
15957
15961
|
readonly types: {
|
|
15958
15962
|
readonly EventObject: {
|
|
15959
|
-
readonly type: readonly ["Permission", "Navigate", "Placement"];
|
|
15960
|
-
readonly permission: "
|
|
15963
|
+
readonly type: readonly ["Permission", "Navigate", "Placement", "SetCondition"];
|
|
15964
|
+
readonly permission: readonly ["notification", "camera", "microphone", "location", "photos", "contacts", "att", "rating", "GDPR"];
|
|
15961
15965
|
readonly navigate_to: "string";
|
|
15962
15966
|
readonly targetIndex: "number";
|
|
15963
|
-
readonly placementKey: "
|
|
15967
|
+
readonly placementKey: readonly ["terms", "onboard", "paywall", "subscription", "home"];
|
|
15968
|
+
readonly conditionKey: readonly ["termsAccepted"];
|
|
15969
|
+
readonly value: "boolean";
|
|
15964
15970
|
};
|
|
15965
15971
|
};
|
|
15966
15972
|
}, {
|