@developer_tribe/react-builder 1.2.44-test.2 → 1.2.44

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 (75) hide show
  1. package/dist/attributes-editor/Field.d.ts +1 -3
  2. package/dist/attributes-editor/attributesEditorModelTypes.d.ts +0 -3
  3. package/dist/attributes-editor/useAttributesEditorModel.d.ts +1 -1
  4. package/dist/build-components/FormSubmitButton/FormSubmitButtonProps.generated.d.ts +3 -8
  5. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +3 -8
  6. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +0 -2
  7. package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +0 -2
  8. package/dist/build-components/SystemButton/SystemButtonProps.generated.d.ts +3 -8
  9. package/dist/build-components/SystemButton/usePlacementButtonEvents.d.ts +2 -15
  10. package/dist/build-components/index.d.ts +1 -3
  11. package/dist/build-components/patterns.generated.d.ts +1334 -2129
  12. package/dist/index.cjs.js +1 -1
  13. package/dist/index.cjs.js.map +1 -1
  14. package/dist/index.esm.js +1 -1
  15. package/dist/index.esm.js.map +1 -1
  16. package/dist/index.web.cjs.js +4 -4
  17. package/dist/index.web.cjs.js.map +1 -1
  18. package/dist/index.web.esm.js +3 -3
  19. package/dist/index.web.esm.js.map +1 -1
  20. package/dist/styles.css +1 -1
  21. package/dist/utils/nodeTree.d.ts +0 -18
  22. package/package.json +1 -1
  23. package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +4 -68
  24. package/src/assets/meta.json +1 -1
  25. package/src/assets/prompt-scheme-onboard.generated.ts +1 -1
  26. package/src/assets/prompt-scheme-paywall.generated.ts +1 -1
  27. package/src/assets/samples/getSamples.ts +0 -2
  28. package/src/assets/samples/terms-and-privacy-no-form.json +1 -1
  29. package/src/assets/samples/terms-and-privacy.json +1 -1
  30. package/src/attributes-editor/AttributesEditorView.tsx +0 -3
  31. package/src/attributes-editor/Field.tsx +2 -91
  32. package/src/attributes-editor/attributesEditorModelTypes.ts +0 -3
  33. package/src/attributes-editor/useAttributesEditorModel.ts +0 -8
  34. package/src/build-components/FormCheckbox/FormCheckbox.tsx +1 -3
  35. package/src/build-components/FormSubmitButton/FormSubmitButton.tsx +0 -6
  36. package/src/build-components/FormSubmitButton/FormSubmitButtonProps.generated.ts +3 -26
  37. package/src/build-components/OnboardButton/OnboardButton.tsx +1 -8
  38. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +3 -26
  39. package/src/build-components/OnboardButton/pattern.json +3 -5
  40. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +0 -12
  41. package/src/build-components/OnboardProvider/pattern.json +1 -9
  42. package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +0 -12
  43. package/src/build-components/PaywallProvider/pattern.json +1 -9
  44. package/src/build-components/RenderNode.generated.tsx +0 -10
  45. package/src/build-components/SystemButton/SystemButton.tsx +0 -6
  46. package/src/build-components/SystemButton/SystemButtonProps.generated.ts +3 -26
  47. package/src/build-components/SystemButton/pattern.json +3 -5
  48. package/src/build-components/SystemButton/usePlacementButtonEvents.ts +27 -51
  49. package/src/build-components/index.ts +0 -10
  50. package/src/build-components/patterns.generated.ts +1379 -2270
  51. package/src/components/AttributesEditorPanel.tsx +0 -1
  52. package/src/styles/index.scss +0 -1
  53. package/src/utils/analyseNodeByPatterns.ts +2 -5
  54. package/src/utils/nodeTree.ts +0 -115
  55. package/dist/build-components/GlobalProvider/GlobalContext.d.ts +0 -28
  56. package/dist/build-components/GlobalProvider/GlobalProvider.d.ts +0 -5
  57. package/dist/build-components/GlobalProvider/GlobalProviderProps.generated.d.ts +0 -60
  58. package/dist/build-components/GlobalProvider/globalProviderUtils.d.ts +0 -28
  59. package/dist/build-components/GlobalProvider/useGlobalNavigation.d.ts +0 -19
  60. package/dist/build-components/GlobalProvider/useGlobalProviderLogic.d.ts +0 -15
  61. package/dist/build-components/TermsProvider/TermsProvider.d.ts +0 -5
  62. package/dist/build-components/TermsProvider/TermsProviderProps.generated.d.ts +0 -55
  63. package/src/assets/samples/global-onboard-flow.json +0 -735
  64. package/src/build-components/GlobalProvider/GlobalContext.ts +0 -48
  65. package/src/build-components/GlobalProvider/GlobalProvider.tsx +0 -51
  66. package/src/build-components/GlobalProvider/GlobalProviderProps.generated.ts +0 -78
  67. package/src/build-components/GlobalProvider/globalProviderUtils.ts +0 -204
  68. package/src/build-components/GlobalProvider/pattern.json +0 -55
  69. package/src/build-components/GlobalProvider/useGlobalNavigation.ts +0 -65
  70. package/src/build-components/GlobalProvider/useGlobalProviderLogic.ts +0 -172
  71. package/src/build-components/TermsProvider/TermsProvider.tsx +0 -45
  72. package/src/build-components/TermsProvider/TermsProviderProps.generated.ts +0 -82
  73. package/src/build-components/TermsProvider/pattern.json +0 -35
  74. package/src/patterns/event-constants.json +0 -19
  75. package/src/styles/components/_global-provider.scss +0 -131
@@ -88,7 +88,6 @@ export function AttributesEditorPanel({
88
88
  node={nodeForEditor}
89
89
  onChange={handleAttributesChange}
90
90
  projectColors={projectColors}
91
- projectRoot={attributes}
92
91
  />
93
92
  </div>
94
93
  );
@@ -16,7 +16,6 @@
16
16
  @use './components/mockos-router';
17
17
  @use './components/bottom-bar';
18
18
  @use './components/onboard';
19
- @use './components/global-provider';
20
19
 
21
20
  @use './components/webview';
22
21
  @use './components/checkbox';
@@ -432,15 +432,12 @@ function validateAttributesByPattern(
432
432
  if (
433
433
  attrName === 'title' ||
434
434
  attrName === 'description' ||
435
- attrName === 'testID' ||
436
- attrName === 'animation'
435
+ attrName === 'testID'
437
436
  ) {
438
437
  const res = validateAttributeValue(
439
438
  pattern.pattern.type,
440
439
  attrValue,
441
- attrName === 'testID' || attrName === 'animation'
442
- ? 'string'
443
- : attrName,
440
+ attrName === 'testID' ? 'string' : attrName,
444
441
  joinPath(path, attrName),
445
442
  );
446
443
  if (!res.valid) return res;
@@ -1,5 +1,4 @@
1
1
  import type { Node, NodeData } from '../types/Node';
2
- import eventConstants from '../patterns/event-constants.json';
3
2
 
4
3
  export function deleteNodeFromTree(root: Node, target: Node): Node {
5
4
  if (root === null || root === undefined) return root;
@@ -98,117 +97,3 @@ export function findNodeByKey(root: Node, key?: string): Node | null {
98
97
 
99
98
  return null;
100
99
  }
101
-
102
- export type ProjectOptions = {
103
- pageKeys: string[];
104
- conditionKeys: string[];
105
- placementKeys: string[];
106
- formFieldNames: string[];
107
- eventTypes: string[];
108
- validationTypes: string[];
109
- };
110
-
111
- /**
112
- * Traverses the entire node tree to dynamically discover project-level metadata
113
- * (page keys, condition keys, form field names, etc.) and merges them with
114
- * central constants from event-constants.json.
115
- *
116
- * This enables the Attributes Editor to provide a complete list of valid options
117
- * for dropdown fields, combining predefined standards with actually used keys
118
- * in the current design.
119
- */
120
- export function collectProjectMetadata(root: Node): ProjectOptions {
121
- const pageKeys = new Set<string>();
122
- const conditionKeys = new Set<string>();
123
- const placementKeys = new Set<string>();
124
- const formFieldNames = new Set<string>();
125
- const eventTypes = new Set<string>();
126
-
127
- function traverse(node: Node) {
128
- if (!node || typeof node === 'string') return;
129
-
130
- if (Array.isArray(node)) {
131
- node.forEach(traverse);
132
- return;
133
- }
134
-
135
- const data = node as NodeData;
136
- const type = data.type;
137
- const attrs = (data.attributes ?? {}) as Record<string, any>;
138
-
139
- // Collect Page Keys
140
- if (type === 'GlobalProvider' && Array.isArray(data.children)) {
141
- data.children.forEach((child) => {
142
- if (typeof child === 'object' && child !== null && 'key' in child) {
143
- if (typeof child.key === 'string') pageKeys.add(child.key);
144
- }
145
- });
146
- }
147
- if (attrs.pageKey && typeof attrs.pageKey === 'string') {
148
- pageKeys.add(attrs.pageKey);
149
- }
150
-
151
- // Collect Condition Keys
152
- if (attrs.conditionKey && typeof attrs.conditionKey === 'string') {
153
- conditionKeys.add(attrs.conditionKey);
154
- }
155
- if (Array.isArray(attrs.skipConditions)) {
156
- attrs.skipConditions.forEach((entry: any) => {
157
- if (entry?.conditionKey) conditionKeys.add(entry.conditionKey);
158
- });
159
- }
160
-
161
- // Collect Placement Keys
162
- if (attrs.placementKey && typeof attrs.placementKey === 'string') {
163
- placementKeys.add(attrs.placementKey);
164
- }
165
-
166
- // Collect Form Field Names
167
- if (type.startsWith('Form') && type !== 'FormProvider' && attrs.name) {
168
- if (typeof attrs.name === 'string') formFieldNames.add(attrs.name);
169
- }
170
-
171
- // Collect from events
172
- if (Array.isArray(attrs.events)) {
173
- attrs.events.forEach((evt: any) => {
174
- if (evt.type && typeof evt.type === 'string') eventTypes.add(evt.type);
175
- if (evt.navigate_to) pageKeys.add(evt.navigate_to);
176
- if (evt.placementKey) placementKeys.add(evt.placementKey);
177
- if (evt.conditionKey) conditionKeys.add(evt.conditionKey);
178
- });
179
- }
180
-
181
- if (data.children) {
182
- traverse(data.children as Node);
183
- }
184
- }
185
-
186
- traverse(root);
187
-
188
- // Merge with central constants for a complete set of options
189
- const result: ProjectOptions = {
190
- pageKeys: Array.from(
191
- new Set([...pageKeys, ...eventConstants.placementKeys]),
192
- ).sort(),
193
- conditionKeys: Array.from(
194
- new Set([...conditionKeys, ...eventConstants.conditionKeys]),
195
- ).sort(),
196
- placementKeys: Array.from(
197
- new Set([...placementKeys, ...eventConstants.placementKeys]),
198
- ).sort(),
199
- formFieldNames: Array.from(
200
- new Set([
201
- ...formFieldNames,
202
- ...((eventConstants as any).formFieldNames as string[]),
203
- ]),
204
- ).sort(),
205
- eventTypes: Array.from(
206
- new Set([...eventTypes, ...eventConstants.eventTypes]),
207
- ).sort(),
208
- validationTypes: Array.from(
209
- new Set((eventConstants as any).validationTypes as string[]),
210
- ).sort(),
211
- };
212
-
213
- return result;
214
- }
@@ -1,28 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- /** Supported transition animations when navigating to this page (platform-style names).
3
- * rn stack transition animations
4
- */
5
- export declare const GLOBAL_PAGE_ANIMATIONS: readonly ["default", "fade", "fade_from_bottom", "fade_from_right", "reveal_from_bottom", "scale_from_center", "slide_from_right", "slide_from_left", "slide_from_bottom", "none"];
6
- export type GlobalPageAnimationType = (typeof GLOBAL_PAGE_ANIMATIONS)[number];
7
- export interface GlobalPage {
8
- key: string;
9
- node: NodeData;
10
- /** Condition key: this page is skipped when conditions[skipIf] === true */
11
- skipIf?: string;
12
- /** Optional transition animation when this page is shown (push/enter). */
13
- animation?: string;
14
- index: number;
15
- }
16
- export interface GlobalContextValue {
17
- currentPageKey: string;
18
- pages: GlobalPage[];
19
- pageStack: string[];
20
- navigate: (key: string) => void;
21
- goNext: () => void;
22
- goBack: () => boolean;
23
- /** Runtime boolean conditions (e.g. termsAccepted) */
24
- conditions: Record<string, boolean>;
25
- setCondition: (key: string, value: boolean) => void;
26
- }
27
- export declare const GlobalContext: import("react").Context<GlobalContextValue | null>;
28
- export declare function useGlobalContext(): GlobalContextValue | null;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import type { GlobalProviderComponentProps } from './GlobalProviderProps.generated';
3
- declare function GlobalProvider({ node }: GlobalProviderComponentProps): import("react/jsx-runtime").JSX.Element;
4
- declare const _default: React.MemoExoticComponent<typeof GlobalProvider>;
5
- export default _default;
@@ -1,60 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- export type FlexDirectionOptionType = 'row' | 'column';
3
- export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
4
- export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
5
- export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
6
- export type PositionOptionType = 'relative' | 'absolute';
7
- export interface SkipConditionEntryGenerated {
8
- pageKey?: string;
9
- conditionKey?: string;
10
- }
11
- export interface GlobalProviderStyleGenerated {
12
- flexDirection?: FlexDirectionOptionType;
13
- flexWrap?: FlexWrapOptionType;
14
- alignItems?: AlignItemsOptionType;
15
- justifyContent?: JustifyContentOptionType;
16
- gap?: string;
17
- padding?: string;
18
- paddingHorizontal?: string;
19
- paddingVertical?: string;
20
- paddingTop?: string;
21
- paddingBottom?: string;
22
- paddingLeft?: string;
23
- paddingRight?: string;
24
- margin?: string;
25
- marginHorizontal?: string;
26
- marginVertical?: string;
27
- marginTop?: string;
28
- marginBottom?: string;
29
- marginLeft?: string;
30
- marginRight?: string;
31
- backgroundColor?: string;
32
- borderRadius?: string;
33
- width?: string;
34
- minWidth?: string;
35
- maxWidth?: string;
36
- height?: string;
37
- minHeight?: string;
38
- maxHeight?: string;
39
- flex?: number;
40
- position?: PositionOptionType;
41
- top?: string;
42
- bottom?: string;
43
- left?: string;
44
- right?: string;
45
- zIndex?: number;
46
- }
47
- export interface GlobalProviderPropsGenerated {
48
- child: string;
49
- attributes: {
50
- styles?: GlobalProviderStyleGenerated;
51
- scrollable?: boolean;
52
- testID?: string;
53
- initialPage?: string;
54
- persistProgress?: boolean;
55
- skipConditions?: SkipConditionEntryGenerated[];
56
- };
57
- }
58
- export interface GlobalProviderComponentProps {
59
- node: NodeData<GlobalProviderPropsGenerated['attributes']>;
60
- }
@@ -1,28 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- import type { GlobalPage } from './GlobalContext';
3
- /**
4
- * Derives a stable and unique page key for a child node.
5
- * Priority: node.key → TYPE_KEY_MAP → "${type}-${index}"
6
- */
7
- export declare function derivePageKey(node: NodeData, index: number, existingKeys: Set<string>): string;
8
- /** Runtime shape of a SkipConditionEntry (mirrors the types block in pattern.json). */
9
- export interface SkipConditionEntry {
10
- pageKey: string;
11
- conditionKey: string;
12
- }
13
- /**
14
- * Converts SkipConditionEntry[] (from pattern schema) to a lookup map for fast access.
15
- */
16
- export declare function normalizeSkipConditions(raw: unknown): Record<string, string>;
17
- /**
18
- * Builds the page list for GlobalProvider.
19
- */
20
- export declare function buildPages(children: NodeData[], skipConditions?: Record<string, string>): GlobalPage[];
21
- /** Returns the first non-skipped page key, starting from the requested key. */
22
- export declare function resolveEffectivePage(targetKey: string, pages: GlobalPage[], conditions: Record<string, boolean>): string | null;
23
- export declare function persistProgress(storageKey: string, currentPageKey: string, conditions: Record<string, boolean>): void;
24
- export declare function loadProgress(storageKey: string): {
25
- currentPageKey: string;
26
- conditions: Record<string, boolean>;
27
- } | null;
28
- export declare function clearProgress(storageKey: string): void;
@@ -1,19 +0,0 @@
1
- /**
2
- * Maps route/placement aliases to their canonical GlobalProvider page keys.
3
- *
4
- * Add entries here when a new alias should resolve to an existing page key.
5
- * Keys are the incoming target strings (from JSON events / usePlacementButtonEvents).
6
- * Values are the canonical page key that GlobalContext.navigate() will receive.
7
- *
8
- * Exported so other modules (e.g. a navigation-flow visualiser) can inspect
9
- * which aliases exist without duplicating this logic.
10
- */
11
- export declare const GLOBAL_ROUTE_ALIASES: Record<string, string>;
12
- /**
13
- * Returns a navigate function that first attempts to route within GlobalContext
14
- * (when a GlobalProvider is active), then falls back to MockOSContext navigation.
15
- *
16
- * Used by SystemButton and OnboardButton so that events defined in JSON work
17
- * transparently whether rendered inside a GlobalProvider or standalone.
18
- */
19
- export declare function useGlobalNavigation(): (target: string) => boolean;
@@ -1,15 +0,0 @@
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 +0,0 @@
1
- import React from 'react';
2
- import type { TermsProviderComponentProps } from './TermsProviderProps.generated';
3
- declare function TermsProvider({ node }: TermsProviderComponentProps): import("react/jsx-runtime").JSX.Element;
4
- declare const _default: React.MemoExoticComponent<typeof TermsProvider>;
5
- export default _default;
@@ -1,55 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- export type AnimationOptionType = 'default' | 'fade' | 'fade_from_bottom' | 'fade_from_right' | 'reveal_from_bottom' | 'scale_from_center' | 'slide_from_right' | 'slide_from_left' | 'slide_from_bottom' | 'none';
3
- export type FlexDirectionOptionType = 'row' | 'column';
4
- export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
5
- export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
6
- export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
7
- export type PositionOptionType = 'relative' | 'absolute';
8
- export interface TermsProviderStyleGenerated {
9
- flexDirection?: FlexDirectionOptionType;
10
- flexWrap?: FlexWrapOptionType;
11
- alignItems?: AlignItemsOptionType;
12
- justifyContent?: JustifyContentOptionType;
13
- gap?: string;
14
- padding?: string;
15
- paddingHorizontal?: string;
16
- paddingVertical?: string;
17
- paddingTop?: string;
18
- paddingBottom?: string;
19
- paddingLeft?: string;
20
- paddingRight?: string;
21
- margin?: string;
22
- marginHorizontal?: string;
23
- marginVertical?: string;
24
- marginTop?: string;
25
- marginBottom?: string;
26
- marginLeft?: string;
27
- marginRight?: string;
28
- backgroundColor?: string;
29
- borderRadius?: string;
30
- width?: string;
31
- minWidth?: string;
32
- maxWidth?: string;
33
- height?: string;
34
- minHeight?: string;
35
- maxHeight?: string;
36
- flex?: number;
37
- position?: PositionOptionType;
38
- top?: string;
39
- bottom?: string;
40
- left?: string;
41
- right?: string;
42
- zIndex?: number;
43
- }
44
- export interface TermsProviderPropsGenerated {
45
- child: string;
46
- attributes: {
47
- styles?: TermsProviderStyleGenerated;
48
- scrollable?: boolean;
49
- testID?: string;
50
- animation?: AnimationOptionType;
51
- };
52
- }
53
- export interface TermsProviderComponentProps {
54
- node: NodeData<TermsProviderPropsGenerated['attributes']>;
55
- }