@developer_tribe/react-builder 1.2.27 → 1.2.29
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/assets/samples/getSamples.d.ts +0 -3
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +1 -2
- package/dist/build-components/CountDown/CountDownProps.generated.d.ts +2 -1
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +1 -2
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +1 -2
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +1 -2
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +1 -2
- package/dist/build-components/PaywallOptions/usePaywallOptionParamsFactory.d.ts +1 -1
- package/dist/build-components/PriceTag/PriceTag.d.ts +5 -0
- package/dist/build-components/PriceTag/PriceTagProps.generated.d.ts +63 -0
- package/dist/build-components/Pricing/Pricing.d.ts +5 -0
- package/dist/build-components/Pricing/PricingProps.generated.d.ts +59 -0
- package/dist/build-components/Promo/Promo.d.ts +5 -0
- package/dist/build-components/Promo/PromoProps.generated.d.ts +59 -0
- package/dist/build-components/Text/TextProps.generated.d.ts +1 -2
- package/dist/build-components/index.d.ts +4 -1
- package/dist/build-components/patterns.generated.d.ts +1405 -202
- package/dist/components/BuilderProvider.d.ts +5 -3
- package/dist/components/ParamsProvider.d.ts +16 -8
- package/dist/hooks/useSyncHtmlThemeClass.d.ts +1 -1
- package/dist/index.cjs.js +4 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.esm.js +4 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.web.cjs.js +4 -4
- package/dist/index.web.cjs.js.map +1 -1
- package/dist/index.web.esm.js +4 -4
- package/dist/index.web.esm.js.map +1 -1
- package/dist/logger.d.ts +18 -0
- package/dist/modals/InspectModal.d.ts +5 -0
- package/dist/modals/index.d.ts +1 -1
- package/dist/pages/ProjectPage.d.ts +3 -3
- package/dist/paywall/hooks/useCalculateLocalizedPrice.d.ts +4 -2
- package/dist/paywall/hooks/useDiscountRate.d.ts +3 -2
- package/dist/paywall/types/paywall-types.d.ts +7 -32
- package/dist/product-base/buildPaywallLocalizationParams.d.ts +16 -0
- package/dist/product-base/calculations.d.ts +29 -0
- package/dist/product-base/extractAndroidParams.d.ts +24 -0
- package/dist/product-base/extractIOSParams.d.ts +24 -0
- package/dist/product-base/index.d.ts +51 -0
- package/dist/product-base/periodLocalizationKeys.d.ts +44 -0
- package/dist/product-base/types.d.ts +155 -0
- package/dist/product-base/usePaywallLocalizationParams.d.ts +29 -0
- package/dist/store.d.ts +7 -1
- package/dist/styles.css +1 -1
- package/dist/types/PreviewConfig.d.ts +10 -16
- package/dist/utils/extractTextStyle/extractTextStyle.d.ts +2 -2
- package/dist/utils/extractTextStyle/extractTextStyleNative.d.ts +2 -2
- package/dist/utils/replaceLocalizationParams.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/migrate-samples-to-current.ts +3 -3
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +28 -12
- package/src/DeviceMockFrame.tsx +15 -10
- package/src/assets/meta.json +1 -1
- package/src/assets/samples/carousel-sample.json +6 -5
- package/src/assets/samples/getSamples.ts +16 -49
- package/src/assets/samples/paywall-1.json +64 -22
- package/src/assets/samples/paywall-2.json +0 -15
- package/src/assets/samples/paywall-app-delete-offer.json +0 -15
- package/src/assets/samples/paywall-app-open-offer.json +0 -15
- package/src/assets/samples/paywall-back-offer.json +0 -15
- package/src/assets/samples/paywall-notification-offer.json +0 -15
- package/src/assets/samples/simple-1.json +1 -16
- package/src/assets/samples/simple-2.json +0 -15
- package/src/assets/samples/unmigrated-builder-1.1.1.json +0 -3
- package/src/assets/samples/unmigrated-builder1.json +0 -3
- package/src/assets/samples/unvalidated-builder1.json +0 -3
- package/src/assets/samples/unvalidated-crash1.json +0 -3
- package/src/assets/samples/unvalidated-crashcomponent1.json +0 -3
- package/src/assets/samples/vpn-onboard-1.json +1 -34
- package/src/assets/samples/vpn-onboard-2.json +1 -34
- package/src/assets/samples/vpn-onboard-3.json +1 -42
- package/src/assets/samples/vpn-onboard-4.json +0 -73
- package/src/assets/samples/vpn-onboard-5.json +0 -73
- package/src/assets/samples/vpn-onboard-6.json +0 -73
- package/src/assets/samples/vpn-onboard-7.json +529 -0
- package/src/attribute-analyser/style/native/useExtractImageStyle.ts +1 -4
- package/src/attribute-analyser/style/native/useExtractTextStyle.ts +3 -12
- package/src/attribute-analyser/style/native/useExtractViewStyle.ts +1 -4
- package/src/attribute-analyser/style/web/useExtractImageStyle.ts +1 -4
- package/src/attribute-analyser/style/web/useExtractTextStyle.ts +3 -12
- package/src/attribute-analyser/style/web/useExtractViewStyle.ts +1 -4
- package/src/attributes-editor/useAttributesEditorModel.ts +5 -52
- package/src/build-components/BIcon/BIconProps.generated.ts +1 -2
- package/src/build-components/CarouselDots/CarouselDots.tsx +6 -13
- package/src/build-components/CountDown/CountDownProps.generated.ts +2 -1
- package/src/build-components/NavigationBarColor/NavigationBarColor.tsx +2 -2
- package/src/build-components/OnboardButton/OnboardButton.tsx +1 -2
- package/src/build-components/OnboardDot/OnboardDot.tsx +6 -18
- package/src/build-components/OnboardFooter/OnboardFooter.tsx +5 -3
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +1 -2
- package/src/build-components/OnboardFooter/pattern.json +1 -1
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +1 -2
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +1 -2
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +1 -2
- package/src/build-components/PaywallOptions/PaywallOptions.tsx +3 -3
- package/src/build-components/PaywallOptions/usePaywallOptionParamsFactory.ts +26 -13
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +51 -12
- package/src/build-components/PriceTag/PriceTag.tsx +25 -0
- package/src/build-components/PriceTag/PriceTagProps.generated.ts +83 -0
- package/src/build-components/PriceTag/pattern.json +53 -0
- package/src/build-components/Pricing/Pricing.tsx +13 -0
- package/src/build-components/Pricing/PricingProps.generated.ts +76 -0
- package/src/build-components/Pricing/pattern.json +25 -0
- package/src/build-components/Promo/Promo.tsx +13 -0
- package/src/build-components/Promo/PromoProps.generated.ts +76 -0
- package/src/build-components/Promo/pattern.json +25 -0
- package/src/build-components/RadioButton/RadioButton.tsx +3 -5
- package/src/build-components/RenderNode.generated.tsx +15 -0
- package/src/build-components/StatusBarColor/StatusBarColor.tsx +2 -2
- package/src/build-components/Text/Text.tsx +12 -5
- package/src/build-components/Text/TextProps.generated.ts +1 -2
- package/src/build-components/Text/pattern.json +3 -2
- package/src/build-components/index.ts +15 -0
- package/src/build-components/patterns.generated.ts +1454 -181
- package/src/components/BottomBar.tsx +42 -39
- package/src/components/BuilderProvider.tsx +41 -14
- package/src/components/LocalizationParamsProvider.tsx +1 -1
- package/src/components/ParamsProvider.tsx +36 -11
- package/src/hooks/useLocalize.ts +7 -4
- package/src/hooks/useParams.ts +1 -1
- package/src/hooks/useSyncHtmlThemeClass.ts +2 -2
- package/src/index.ts +54 -8
- package/src/logger.ts +39 -0
- package/src/modals/InspectModal.tsx +331 -0
- package/src/modals/ProductPresetsModal.tsx +7 -14
- package/src/modals/index.ts +1 -1
- package/src/pages/DebugJsonPage.tsx +9 -22
- package/src/pages/ProjectDebug.tsx +1 -1
- package/src/pages/ProjectPage.tsx +29 -11
- package/src/pages/tabs/SideTool.tsx +28 -104
- package/src/paywall/hooks/useCalculateLocalizedPrice.ts +8 -3
- package/src/paywall/hooks/useDiscountRate.ts +11 -3
- package/src/paywall/types/paywall-types.ts +7 -38
- package/src/product-base/buildPaywallLocalizationParams.ts +100 -0
- package/src/product-base/calculations.ts +93 -0
- package/src/product-base/extractAndroidParams.ts +207 -0
- package/src/product-base/extractIOSParams.ts +199 -0
- package/src/product-base/index.ts +64 -0
- package/src/product-base/mockProducts.json +489 -0
- package/src/product-base/periodLocalizationKeys.ts +114 -0
- package/src/product-base/types.ts +183 -0
- package/src/product-base/usePaywallLocalizationParams.ts +61 -0
- package/src/store.ts +18 -1
- package/src/styles/index.scss +1 -0
- package/src/styles/modals/_inspect-modal.scss +155 -0
- package/src/types/PreviewConfig.ts +157 -16
- package/src/utils/extractTextStyle/extractTextStyle.ts +14 -6
- package/src/utils/extractTextStyle/extractTextStyleNative.ts +8 -6
- package/src/utils/logRenderStore.ts +6 -10
- package/src/utils/parseColor.ts +0 -1
- package/src/utils/replaceLocalizationParams.ts +8 -4
- package/dist/modals/ScreenColorsModal.d.ts +0 -8
- package/src/assets/products.json +0 -98
- package/src/modals/ScreenColorsModal.tsx +0 -121
|
@@ -7,7 +7,6 @@ import type {
|
|
|
7
7
|
} from '../../../build-components/Image/ImageProps.generated';
|
|
8
8
|
import { useBuilderParams } from '../../../components/BuilderProvider';
|
|
9
9
|
import { extractImageStyleNative } from '../../../utils/extractImageStyle';
|
|
10
|
-
import { defaultAppConfig } from '../../../types/PreviewConfig';
|
|
11
10
|
import {
|
|
12
11
|
getStyleBag,
|
|
13
12
|
toAttributeRecord,
|
|
@@ -23,9 +22,7 @@ export function useExtractImageStyle<
|
|
|
23
22
|
style: ImageStyle;
|
|
24
23
|
other: Omit<T, StyleAttrKey> & { resizeMode?: ResizeModeOptionType };
|
|
25
24
|
} {
|
|
26
|
-
const {
|
|
27
|
-
const theme = appConfig?.theme ?? defaultAppConfig.theme;
|
|
28
|
-
const projectColors = builderProjectColors;
|
|
25
|
+
const { theme, projectColors } = useBuilderParams();
|
|
29
26
|
|
|
30
27
|
return useMemo(() => {
|
|
31
28
|
// extractImageStyleNative returns Record<string, unknown> that may include resizeMode.
|
|
@@ -2,7 +2,6 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import type { TextStyle } from 'react-native';
|
|
3
3
|
import type { NodeData } from '../../../types/Node';
|
|
4
4
|
import type { TextPropsGenerated } from '../../../build-components/Text/TextProps.generated';
|
|
5
|
-
import { defaultAppConfig } from '../../../types/PreviewConfig';
|
|
6
5
|
import { useBuilderParams } from '../../../components/BuilderProvider';
|
|
7
6
|
import { extractTextStyleNative } from '../../../utils/extractTextStyle';
|
|
8
7
|
import {
|
|
@@ -21,20 +20,12 @@ export function useExtractTextStyle<T extends TextPropsGenerated['attributes']>(
|
|
|
21
20
|
showEllipsis?: boolean;
|
|
22
21
|
};
|
|
23
22
|
} {
|
|
24
|
-
const {
|
|
25
|
-
appConfig: builderAppConfig,
|
|
26
|
-
projectColors: builderProjectColors,
|
|
27
|
-
fonts: builderFonts,
|
|
28
|
-
} = useBuilderParams();
|
|
29
|
-
|
|
30
|
-
const appConfig = builderAppConfig ?? defaultAppConfig;
|
|
31
|
-
const projectColors = builderProjectColors;
|
|
32
|
-
const fonts = builderFonts;
|
|
23
|
+
const { theme, projectColors, fonts } = useBuilderParams();
|
|
33
24
|
|
|
34
25
|
return useMemo(
|
|
35
26
|
() => {
|
|
36
27
|
const style = extractTextStyleNative(node, {
|
|
37
|
-
|
|
28
|
+
theme,
|
|
38
29
|
projectColors,
|
|
39
30
|
fonts,
|
|
40
31
|
});
|
|
@@ -60,6 +51,6 @@ export function useExtractTextStyle<T extends TextPropsGenerated['attributes']>(
|
|
|
60
51
|
};
|
|
61
52
|
},
|
|
62
53
|
// fonts is intentionally included: extractTextStyleNative resolves weights via font definitions.
|
|
63
|
-
[node,
|
|
54
|
+
[node, theme, projectColors, fonts],
|
|
64
55
|
);
|
|
65
56
|
}
|
|
@@ -4,7 +4,6 @@ import type { NodeData } from '../../../types/Node';
|
|
|
4
4
|
import type { ViewPropsGenerated } from '../../../build-components/View/ViewProps.generated';
|
|
5
5
|
import { useBuilderParams } from '../../../components/BuilderProvider';
|
|
6
6
|
import { extractViewStyleNative } from '../../../utils/extractViewStyle';
|
|
7
|
-
import { defaultAppConfig } from '../../../types/PreviewConfig';
|
|
8
7
|
import {
|
|
9
8
|
getStyleBag,
|
|
10
9
|
toAttributeRecord,
|
|
@@ -18,9 +17,7 @@ export function useExtractViewStyle<T extends ViewPropsGenerated['attributes']>(
|
|
|
18
17
|
style: ViewStyle;
|
|
19
18
|
other: Omit<T, StyleAttrKey> & { scrollable?: boolean };
|
|
20
19
|
} {
|
|
21
|
-
const {
|
|
22
|
-
const theme = appConfig?.theme ?? defaultAppConfig.theme;
|
|
23
|
-
const projectColors = builderProjectColors;
|
|
20
|
+
const { theme, projectColors } = useBuilderParams();
|
|
24
21
|
|
|
25
22
|
return useMemo(() => {
|
|
26
23
|
const style = extractViewStyleNative(node, { theme, projectColors });
|
|
@@ -4,14 +4,11 @@ import type { NodeData } from '../../../types/Node';
|
|
|
4
4
|
import type { ImagePropsGenerated } from '../../../build-components/Image/ImageProps.generated';
|
|
5
5
|
import { useBuilderParams } from '../../../components/BuilderProvider';
|
|
6
6
|
import { extractImageStyle } from '../../../utils/extractImageStyle';
|
|
7
|
-
import { defaultAppConfig } from '../../../types/PreviewConfig';
|
|
8
7
|
|
|
9
8
|
export function useExtractImageStyle<
|
|
10
9
|
T extends ImagePropsGenerated['attributes'],
|
|
11
10
|
>(node: NodeData<T>): CSSProperties {
|
|
12
|
-
const {
|
|
13
|
-
const theme = appConfig?.theme ?? defaultAppConfig.theme;
|
|
14
|
-
const projectColors = builderProjectColors;
|
|
11
|
+
const { theme, projectColors } = useBuilderParams();
|
|
15
12
|
|
|
16
13
|
return useMemo(
|
|
17
14
|
() => extractImageStyle(node, { theme, projectColors }),
|
|
@@ -2,7 +2,6 @@ import { useMemo } from 'react';
|
|
|
2
2
|
import type { CSSProperties } from 'react';
|
|
3
3
|
import type { NodeData } from '../../../types/Node';
|
|
4
4
|
import type { TextPropsGenerated } from '../../../build-components/Text/TextProps.generated';
|
|
5
|
-
import { defaultAppConfig } from '../../../types/PreviewConfig';
|
|
6
5
|
import { useBuilderParams } from '../../../components/BuilderProvider';
|
|
7
6
|
import { extractTextStyle } from '../../../utils/extractTextStyle';
|
|
8
7
|
|
|
@@ -10,25 +9,17 @@ export function useExtractTextStyle<T extends TextPropsGenerated['attributes']>(
|
|
|
10
9
|
node: NodeData<T>,
|
|
11
10
|
directlyTextStyle = false,
|
|
12
11
|
): CSSProperties {
|
|
13
|
-
const {
|
|
14
|
-
appConfig: builderAppConfig,
|
|
15
|
-
projectColors: builderProjectColors,
|
|
16
|
-
fonts: builderFonts,
|
|
17
|
-
} = useBuilderParams();
|
|
18
|
-
|
|
19
|
-
const appConfig = builderAppConfig ?? defaultAppConfig;
|
|
20
|
-
const projectColors = builderProjectColors;
|
|
21
|
-
const fonts = builderFonts;
|
|
12
|
+
const { theme, projectColors, fonts } = useBuilderParams();
|
|
22
13
|
|
|
23
14
|
return useMemo(
|
|
24
15
|
() =>
|
|
25
16
|
extractTextStyle(node, {
|
|
26
|
-
|
|
17
|
+
theme,
|
|
27
18
|
projectColors,
|
|
28
19
|
fonts,
|
|
29
20
|
directlyTextStyle,
|
|
30
21
|
}),
|
|
31
22
|
// fonts is intentionally included: extractTextStyle resolves weights via font definitions.
|
|
32
|
-
[node,
|
|
23
|
+
[node, theme, projectColors, fonts, directlyTextStyle],
|
|
33
24
|
);
|
|
34
25
|
}
|
|
@@ -4,14 +4,11 @@ import type { NodeData } from '../../../types/Node';
|
|
|
4
4
|
import type { ViewPropsGenerated } from '../../../build-components/View/ViewProps.generated';
|
|
5
5
|
import { useBuilderParams } from '../../../components/BuilderProvider';
|
|
6
6
|
import { extractViewStyle } from '../../../utils/extractViewStyle';
|
|
7
|
-
import { defaultAppConfig } from '../../../types/PreviewConfig';
|
|
8
7
|
|
|
9
8
|
export function useExtractViewStyle<T extends ViewPropsGenerated['attributes']>(
|
|
10
9
|
node: NodeData<T>,
|
|
11
10
|
): CSSProperties {
|
|
12
|
-
const {
|
|
13
|
-
const theme = appConfig?.theme ?? defaultAppConfig.theme;
|
|
14
|
-
const projectColors = builderProjectColors;
|
|
11
|
+
const { theme, projectColors } = useBuilderParams();
|
|
15
12
|
|
|
16
13
|
return useMemo(
|
|
17
14
|
() => extractViewStyle(node, { theme, projectColors }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
2
|
import type { NodeData, NodeDefaultAttribute } from '../types/Node';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ProjectColors } from '../types/Project';
|
|
4
4
|
import type { ViewPropsGenerated } from '../build-components/View/ViewProps.generated';
|
|
5
5
|
import useNode from '../build-components/useNode';
|
|
6
6
|
import { isNodeString } from '../utils/analyseNode';
|
|
@@ -32,51 +32,6 @@ function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
|
32
32
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function buildProjectColorsFallback(
|
|
36
|
-
appConfig: Record<string, unknown> | undefined | null,
|
|
37
|
-
): ProjectColors | undefined {
|
|
38
|
-
const addColor = (collection: Set<string>, value?: string) => {
|
|
39
|
-
if (typeof value !== 'string') return;
|
|
40
|
-
const trimmed = value.trim();
|
|
41
|
-
if (!trimmed) return;
|
|
42
|
-
collection.add(trimmed);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const fallback = new Set<string>();
|
|
46
|
-
const screenStyle = (
|
|
47
|
-
appConfig as {
|
|
48
|
-
screenStyle?: {
|
|
49
|
-
light?: Record<string, string>;
|
|
50
|
-
dark?: Record<string, string>;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
)?.screenStyle;
|
|
54
|
-
const styles = [screenStyle?.light, screenStyle?.dark].filter(
|
|
55
|
-
Boolean,
|
|
56
|
-
) as Array<{
|
|
57
|
-
backgroundColor?: string;
|
|
58
|
-
color?: string;
|
|
59
|
-
seperatorColor?: string;
|
|
60
|
-
}>;
|
|
61
|
-
styles.forEach((style) => {
|
|
62
|
-
['backgroundColor', 'color', 'seperatorColor'].forEach((key) => {
|
|
63
|
-
const value = style?.[key as keyof typeof style];
|
|
64
|
-
addColor(fallback, value);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
if (fallback.size === 0) {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const fallbackRecord: ProjectColorTokenMap = {};
|
|
73
|
-
Array.from(fallback).forEach((color, index) => {
|
|
74
|
-
fallbackRecord[`FALLBACK_${index + 1}`] = color;
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
return { STATIC_COLORS: fallbackRecord };
|
|
78
|
-
}
|
|
79
|
-
|
|
80
35
|
export function useAttributesEditorModel({
|
|
81
36
|
node,
|
|
82
37
|
onChange,
|
|
@@ -191,12 +146,10 @@ export function useAttributesEditorModel({
|
|
|
191
146
|
[attributes, isStyleKeyForRead, styleBag],
|
|
192
147
|
);
|
|
193
148
|
|
|
194
|
-
const projectColorsForPicker = useMemo<ProjectColors | undefined>(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
);
|
|
199
|
-
}, [appConfig, projectColors]);
|
|
149
|
+
const projectColorsForPicker = useMemo<ProjectColors | undefined>(
|
|
150
|
+
() => projectColors,
|
|
151
|
+
[projectColors],
|
|
152
|
+
);
|
|
200
153
|
|
|
201
154
|
const viewAttributes = useMemo<
|
|
202
155
|
Partial<ViewPropsGenerated['attributes']> | undefined
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
-
export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
|
|
6
5
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
7
6
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
8
7
|
export type AlignItemsOptionType =
|
|
@@ -25,7 +24,6 @@ export interface BIconStyleGenerated {
|
|
|
25
24
|
fontSize?: string;
|
|
26
25
|
fontFamily?: string;
|
|
27
26
|
fontWeight?: string;
|
|
28
|
-
textAlign?: TextAlignOptionType;
|
|
29
27
|
flexDirection?: FlexDirectionOptionType;
|
|
30
28
|
flexWrap?: FlexWrapOptionType;
|
|
31
29
|
alignItems?: AlignItemsOptionType;
|
|
@@ -68,6 +66,7 @@ export interface BIconPropsGenerated {
|
|
|
68
66
|
style?: BIconStyleGenerated;
|
|
69
67
|
adjustsFontSizeToFit?: boolean;
|
|
70
68
|
showEllipsis?: boolean;
|
|
69
|
+
translateCounter?: number;
|
|
71
70
|
scrollable?: boolean;
|
|
72
71
|
iconType?: string;
|
|
73
72
|
size?: number;
|
|
@@ -9,7 +9,6 @@ import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
|
9
9
|
import { parseColor } from '../../utils/parseColor';
|
|
10
10
|
import { parseSize } from '../../size-matters';
|
|
11
11
|
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
12
|
-
import { defaultAppConfig } from '../../types/PreviewConfig';
|
|
13
12
|
import { getStyleBag, toAttributeRecord } from '../../utils/attributeStyle';
|
|
14
13
|
|
|
15
14
|
function CarouselDots({ node }: CarouselDotsComponentProps) {
|
|
@@ -52,29 +51,23 @@ function CarouselDots({ node }: CarouselDotsComponentProps) {
|
|
|
52
51
|
(stylesBag?.dot_thickness as string | number | undefined) ??
|
|
53
52
|
(attrRecord.dot_thickness as string | number | undefined);
|
|
54
53
|
|
|
55
|
-
const {
|
|
56
|
-
const
|
|
57
|
-
const isDark = appConfig.theme === 'dark';
|
|
54
|
+
const { theme, projectColors } = useBuilderParams();
|
|
55
|
+
const isDark = theme === 'dark';
|
|
58
56
|
const inactiveDotColorBase = isDark
|
|
59
57
|
? GHOST_DOT_DARK_COLOR
|
|
60
58
|
: GHOST_DOT_LIGHT_COLOR;
|
|
61
59
|
|
|
62
60
|
const resolvedActiveDotColor = useMemo(
|
|
63
|
-
() => parseColor(activeDotColor, { theme
|
|
64
|
-
[activeDotColor,
|
|
61
|
+
() => parseColor(activeDotColor, { theme, projectColors }),
|
|
62
|
+
[activeDotColor, theme, projectColors],
|
|
65
63
|
);
|
|
66
64
|
const resolvedInactiveDotColor = useMemo(() => {
|
|
67
65
|
const parsed = parseColor(inactiveDotColorOverride, {
|
|
68
|
-
theme
|
|
66
|
+
theme,
|
|
69
67
|
projectColors,
|
|
70
68
|
});
|
|
71
69
|
return parsed ?? inactiveDotColorBase;
|
|
72
|
-
}, [
|
|
73
|
-
inactiveDotColorBase,
|
|
74
|
-
inactiveDotColorOverride,
|
|
75
|
-
appConfig.theme,
|
|
76
|
-
projectColors,
|
|
77
|
-
]);
|
|
70
|
+
}, [inactiveDotColorBase, inactiveDotColorOverride, theme, projectColors]);
|
|
78
71
|
|
|
79
72
|
const dotSizeCss = useMemo(() => {
|
|
80
73
|
const parsed = parseSize(dotThicknessRaw);
|
|
@@ -24,7 +24,6 @@ export interface CountDownStyleGenerated {
|
|
|
24
24
|
fontSize?: string;
|
|
25
25
|
fontFamily?: string;
|
|
26
26
|
fontWeight?: string;
|
|
27
|
-
textAlign?: never;
|
|
28
27
|
flexDirection?: FlexDirectionOptionType;
|
|
29
28
|
flexWrap?: FlexWrapOptionType;
|
|
30
29
|
alignItems?: AlignItemsOptionType;
|
|
@@ -59,6 +58,7 @@ export interface CountDownStyleGenerated {
|
|
|
59
58
|
left?: string;
|
|
60
59
|
right?: string;
|
|
61
60
|
zIndex?: number;
|
|
61
|
+
textAlign?: never;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export interface CountDownPropsGenerated {
|
|
@@ -67,6 +67,7 @@ export interface CountDownPropsGenerated {
|
|
|
67
67
|
style?: CountDownStyleGenerated;
|
|
68
68
|
adjustsFontSizeToFit?: boolean;
|
|
69
69
|
showEllipsis?: boolean;
|
|
70
|
+
translateCounter?: number;
|
|
70
71
|
scrollable?: boolean;
|
|
71
72
|
count?: number;
|
|
72
73
|
};
|
|
@@ -11,7 +11,7 @@ function NavigationBarColor({ node }: NavigationBarColorComponentProps) {
|
|
|
11
11
|
useLogRender('NavigationBarColor');
|
|
12
12
|
node = useNode(node);
|
|
13
13
|
|
|
14
|
-
const {
|
|
14
|
+
const { theme, projectColors } = useBuilderParams();
|
|
15
15
|
const setNavBarOverrideColor = useRenderStore(
|
|
16
16
|
(s) => s.setNavBarOverrideColor,
|
|
17
17
|
);
|
|
@@ -21,7 +21,7 @@ function NavigationBarColor({ node }: NavigationBarColorComponentProps) {
|
|
|
21
21
|
| undefined;
|
|
22
22
|
const resolvedColor = parseColor(rawBg, {
|
|
23
23
|
projectColors,
|
|
24
|
-
theme
|
|
24
|
+
theme,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
useEffect(() => {
|
|
@@ -18,8 +18,7 @@ function OnboardButton({ node }: OnboardButtonComponentProps) {
|
|
|
18
18
|
node = useNode(node);
|
|
19
19
|
const attributeName = node.sourceType ?? node.type ?? 'OnboardButton';
|
|
20
20
|
const { emblaApi } = useContext(onboardContext) ?? {};
|
|
21
|
-
const {
|
|
22
|
-
const theme = appConfig?.theme;
|
|
21
|
+
const { theme, projectColors, appConfig } = useBuilderParams();
|
|
23
22
|
|
|
24
23
|
const context = useMockOSContext();
|
|
25
24
|
const mockPermissionManager = useMockPermission(context);
|
|
@@ -9,7 +9,6 @@ import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
|
9
9
|
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
10
10
|
import { parseColor } from '../../utils/parseColor';
|
|
11
11
|
import { parseSize } from '../../size-matters';
|
|
12
|
-
import { defaultAppConfig } from '../../types/PreviewConfig';
|
|
13
12
|
import { getStyleBag, toAttributeRecord } from '../../utils/attributeStyle';
|
|
14
13
|
|
|
15
14
|
function OnboardDot({ node }: OnboardDotComponentProps) {
|
|
@@ -29,14 +28,8 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
|
|
|
29
28
|
'normal_dot';
|
|
30
29
|
const GHOST_DOT_DARK_COLOR = '#E4E5E7';
|
|
31
30
|
const GHOST_DOT_LIGHT_COLOR = '#F7F7F9';
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
selectedKey,
|
|
35
|
-
appConfig: builderAppConfig,
|
|
36
|
-
projectColors,
|
|
37
|
-
} = useBuilderParams();
|
|
38
|
-
const appConfig = builderAppConfig ?? defaultAppConfig;
|
|
39
|
-
const isDark = appConfig.theme === 'dark';
|
|
31
|
+
const { previewMode, selectedKey, theme, projectColors } = useBuilderParams();
|
|
32
|
+
const isDark = theme === 'dark';
|
|
40
33
|
|
|
41
34
|
// OnboardDot specific attributes
|
|
42
35
|
const inactiveDotColor = isDark
|
|
@@ -53,21 +46,16 @@ function OnboardDot({ node }: OnboardDotComponentProps) {
|
|
|
53
46
|
(stylesBag?.active_dot_color as string | undefined) ??
|
|
54
47
|
(attrRecord.active_dot_color as string | undefined);
|
|
55
48
|
const resolvedActiveDotColor = useMemo(
|
|
56
|
-
() => parseColor(activeDotColor, { theme
|
|
57
|
-
[activeDotColor,
|
|
49
|
+
() => parseColor(activeDotColor, { theme, projectColors }),
|
|
50
|
+
[activeDotColor, theme, projectColors],
|
|
58
51
|
);
|
|
59
52
|
const resolvedInactiveDotColor = useMemo(() => {
|
|
60
53
|
const parsed = parseColor(inactiveDotColorOverride, {
|
|
61
|
-
theme
|
|
54
|
+
theme,
|
|
62
55
|
projectColors,
|
|
63
56
|
});
|
|
64
57
|
return parsed ?? inactiveDotColor;
|
|
65
|
-
}, [
|
|
66
|
-
inactiveDotColor,
|
|
67
|
-
inactiveDotColorOverride,
|
|
68
|
-
appConfig.theme,
|
|
69
|
-
projectColors,
|
|
70
|
-
]);
|
|
58
|
+
}, [inactiveDotColor, inactiveDotColorOverride, theme, projectColors]);
|
|
71
59
|
|
|
72
60
|
const extractedStyle = useExtractViewStyle(node);
|
|
73
61
|
const baseStyle = useMemo(() => {
|
|
@@ -97,15 +97,17 @@ function OnboardFooter({ node }: OnboardFooterComponentProps) {
|
|
|
97
97
|
const attributeName = node.sourceType ?? node.type ?? 'OnboardFooter';
|
|
98
98
|
const {
|
|
99
99
|
appConfig: builderAppConfig,
|
|
100
|
+
theme,
|
|
101
|
+
defaultLanguage,
|
|
100
102
|
previewMode,
|
|
101
103
|
selectedKey,
|
|
102
104
|
projectColors: builderProjectColors,
|
|
103
105
|
} = useBuilderParams();
|
|
104
106
|
const appConfig = builderAppConfig ?? defaultAppConfig;
|
|
105
107
|
const projectColors = builderProjectColors;
|
|
106
|
-
const { localication
|
|
107
|
-
const
|
|
108
|
-
|
|
108
|
+
const { localication } = appConfig;
|
|
109
|
+
const lang = defaultLanguage ?? 'en';
|
|
110
|
+
const t = (key?: string) => (key ? (localication?.[lang]?.[key] ?? key) : '');
|
|
109
111
|
|
|
110
112
|
const attrs = node?.attributes;
|
|
111
113
|
const attrRecord = toAttributeRecord(attrs);
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
-
export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
|
|
6
5
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
7
6
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
8
7
|
export type AlignItemsOptionType =
|
|
@@ -25,7 +24,6 @@ export interface OnboardFooterStyleGenerated {
|
|
|
25
24
|
fontSize?: string;
|
|
26
25
|
fontFamily?: string;
|
|
27
26
|
fontWeight?: string;
|
|
28
|
-
textAlign?: TextAlignOptionType;
|
|
29
27
|
flexDirection?: FlexDirectionOptionType;
|
|
30
28
|
flexWrap?: FlexWrapOptionType;
|
|
31
29
|
alignItems?: AlignItemsOptionType;
|
|
@@ -68,6 +66,7 @@ export interface OnboardFooterPropsGenerated {
|
|
|
68
66
|
style?: OnboardFooterStyleGenerated;
|
|
69
67
|
adjustsFontSizeToFit?: boolean;
|
|
70
68
|
showEllipsis?: boolean;
|
|
69
|
+
translateCounter?: number;
|
|
71
70
|
scrollable?: boolean;
|
|
72
71
|
textLocalizationKey?: string;
|
|
73
72
|
linkedWordFirstLocalizationKey?: string;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
-
export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
|
|
6
5
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
7
6
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
8
7
|
export type AlignItemsOptionType =
|
|
@@ -25,7 +24,6 @@ export interface OnboardSubtitleStyleGenerated {
|
|
|
25
24
|
fontSize?: string;
|
|
26
25
|
fontFamily?: string;
|
|
27
26
|
fontWeight?: string;
|
|
28
|
-
textAlign?: TextAlignOptionType;
|
|
29
27
|
flexDirection?: FlexDirectionOptionType;
|
|
30
28
|
flexWrap?: FlexWrapOptionType;
|
|
31
29
|
alignItems?: AlignItemsOptionType;
|
|
@@ -68,6 +66,7 @@ export interface OnboardSubtitlePropsGenerated {
|
|
|
68
66
|
style?: OnboardSubtitleStyleGenerated;
|
|
69
67
|
adjustsFontSizeToFit?: boolean;
|
|
70
68
|
showEllipsis?: boolean;
|
|
69
|
+
translateCounter?: number;
|
|
71
70
|
scrollable?: boolean;
|
|
72
71
|
};
|
|
73
72
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
-
export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
|
|
6
5
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
7
6
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
8
7
|
export type AlignItemsOptionType =
|
|
@@ -25,7 +24,6 @@ export interface OnboardTitleStyleGenerated {
|
|
|
25
24
|
fontSize?: string;
|
|
26
25
|
fontFamily?: string;
|
|
27
26
|
fontWeight?: string;
|
|
28
|
-
textAlign?: TextAlignOptionType;
|
|
29
27
|
flexDirection?: FlexDirectionOptionType;
|
|
30
28
|
flexWrap?: FlexWrapOptionType;
|
|
31
29
|
alignItems?: AlignItemsOptionType;
|
|
@@ -68,6 +66,7 @@ export interface OnboardTitlePropsGenerated {
|
|
|
68
66
|
style?: OnboardTitleStyleGenerated;
|
|
69
67
|
adjustsFontSizeToFit?: boolean;
|
|
70
68
|
showEllipsis?: boolean;
|
|
69
|
+
translateCounter?: number;
|
|
71
70
|
scrollable?: boolean;
|
|
72
71
|
};
|
|
73
72
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import type { NodeData } from '../../types/Node';
|
|
4
4
|
|
|
5
|
-
export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
|
|
6
5
|
export type FlexDirectionOptionType = 'row' | 'column';
|
|
7
6
|
export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
|
|
8
7
|
export type AlignItemsOptionType =
|
|
@@ -25,7 +24,6 @@ export interface PaywallCloseButtonStyleGenerated {
|
|
|
25
24
|
fontSize?: string;
|
|
26
25
|
fontFamily?: string;
|
|
27
26
|
fontWeight?: string;
|
|
28
|
-
textAlign?: TextAlignOptionType;
|
|
29
27
|
flexDirection?: FlexDirectionOptionType;
|
|
30
28
|
flexWrap?: FlexWrapOptionType;
|
|
31
29
|
alignItems?: AlignItemsOptionType;
|
|
@@ -71,6 +69,7 @@ export interface PaywallCloseButtonPropsGenerated {
|
|
|
71
69
|
strokeWidth?: number;
|
|
72
70
|
adjustsFontSizeToFit?: boolean;
|
|
73
71
|
showEllipsis?: boolean;
|
|
72
|
+
translateCounter?: number;
|
|
74
73
|
scrollable?: boolean;
|
|
75
74
|
};
|
|
76
75
|
}
|
|
@@ -51,17 +51,17 @@ function compareProducts(
|
|
|
51
51
|
function PaywallOptions({ node }: PaywallOptionsComponentProps) {
|
|
52
52
|
useLogRender('PaywallOptions');
|
|
53
53
|
node = useNode(node);
|
|
54
|
-
const {
|
|
54
|
+
const { mockProducts } = useBuilderParams();
|
|
55
55
|
const { selectedProduct, setSelectedProductId } = usePaywallContext();
|
|
56
56
|
const getParamsForProduct = usePaywallOptionParamsFactory();
|
|
57
57
|
|
|
58
58
|
const sortedProducts = useMemo(() => {
|
|
59
|
-
const list = Array.isArray(
|
|
59
|
+
const list = Array.isArray(mockProducts) ? mockProducts : [];
|
|
60
60
|
return list
|
|
61
61
|
.map((p, idx) => ({ p, idx }))
|
|
62
62
|
.sort((a, b) => compareProducts(a.p, b.p, a.idx, b.idx))
|
|
63
63
|
.map(({ p }) => p);
|
|
64
|
-
}, [
|
|
64
|
+
}, [mockProducts]);
|
|
65
65
|
|
|
66
66
|
return (
|
|
67
67
|
<>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { useCallback } from 'react';
|
|
2
2
|
import { useParams } from '../../hooks/useParams';
|
|
3
3
|
import type { Product } from '../../paywall/types/paywall-types';
|
|
4
|
-
import {
|
|
4
|
+
import type {
|
|
5
5
|
LocalizationParams,
|
|
6
6
|
OtherParams,
|
|
7
7
|
} from '../../components/ParamsProvider';
|
|
8
|
+
import { buildPaywallLocalizationParams } from '../../product-base';
|
|
9
|
+
import { useRenderStore } from '../../store';
|
|
10
|
+
import { useLocalize } from '../../hooks/useLocalize';
|
|
8
11
|
|
|
9
12
|
type PaywallOptionParams = {
|
|
10
13
|
localizationParams: LocalizationParams;
|
|
@@ -17,26 +20,36 @@ export function usePaywallOptionParamsFactory() {
|
|
|
17
20
|
otherParams: baseOtherParams,
|
|
18
21
|
} = useParams();
|
|
19
22
|
|
|
23
|
+
const device = useRenderStore((s) => s.device);
|
|
24
|
+
const localize = useLocalize();
|
|
25
|
+
const platform = (device.platform === 'ios' ? 'ios' : 'android') as
|
|
26
|
+
| 'ios'
|
|
27
|
+
| 'android';
|
|
28
|
+
|
|
20
29
|
return useCallback(
|
|
21
30
|
(
|
|
22
31
|
p: Product,
|
|
23
32
|
{ isSelected }: { isSelected: boolean },
|
|
24
33
|
): PaywallOptionParams => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
productId: String(p.productId ?? ''),
|
|
32
|
-
productSelected: isSelected ? 'true' : 'false',
|
|
33
|
-
};
|
|
34
|
+
const productParams = buildPaywallLocalizationParams(
|
|
35
|
+
p,
|
|
36
|
+
platform,
|
|
37
|
+
undefined,
|
|
38
|
+
localize,
|
|
39
|
+
);
|
|
34
40
|
|
|
35
41
|
return {
|
|
36
|
-
localizationParams: {
|
|
37
|
-
|
|
42
|
+
localizationParams: {
|
|
43
|
+
...baseLocalizationParams,
|
|
44
|
+
...productParams,
|
|
45
|
+
productSelected: isSelected ? 'true' : 'false',
|
|
46
|
+
},
|
|
47
|
+
otherParams: {
|
|
48
|
+
...baseOtherParams,
|
|
49
|
+
singleProductIsSelected: isSelected,
|
|
50
|
+
},
|
|
38
51
|
};
|
|
39
52
|
},
|
|
40
|
-
[baseLocalizationParams, baseOtherParams],
|
|
53
|
+
[baseLocalizationParams, baseOtherParams, platform, localize],
|
|
41
54
|
);
|
|
42
55
|
}
|