@developer_tribe/react-builder 1.0.4 → 1.0.5
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/README.md +6 -0
- package/dist/assets/samples/getSamples.d.ts +1 -0
- package/dist/background.jpg +0 -0
- package/dist/build-components/BIcon/BIcon.d.ts +5 -0
- package/dist/build-components/BIcon/BIconProps.generated.d.ts +55 -0
- package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +4 -0
- package/dist/build-components/Button/ButtonProps.generated.d.ts +4 -0
- package/dist/build-components/Carousel/CarouselProps.generated.d.ts +4 -0
- package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +4 -0
- package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +4 -0
- package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +4 -0
- package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +4 -0
- package/dist/build-components/Image/ImageProps.generated.d.ts +4 -0
- package/dist/build-components/Main/Main.d.ts +5 -0
- package/dist/build-components/Main/MainProps.generated.d.ts +48 -0
- package/dist/build-components/Onboard/OnboardProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +4 -1
- package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +4 -0
- package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +4 -0
- package/dist/build-components/PaywallBackground/PaywallBackground.d.ts +5 -0
- package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +47 -0
- package/dist/build-components/PaywallCloseButton/PaywallCloseButton.d.ts +5 -0
- package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +56 -0
- package/dist/build-components/PaywallOptions/PaywallOptionButton.d.ts +9 -0
- package/dist/build-components/PaywallOptions/PaywallOptions.d.ts +5 -0
- package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +47 -0
- package/dist/build-components/PaywallOptions/usePaywallOptionParamsFactory.d.ts +10 -0
- package/dist/build-components/PaywallProvider/PaywallProvider.d.ts +5 -0
- package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +47 -0
- package/dist/build-components/PaywallSubscriButton/PaywallSubscriButton.d.ts +5 -0
- package/dist/build-components/PaywallSubscriButton/PaywallSubscriButtonProps.generated.d.ts +50 -0
- package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButton.d.ts +5 -0
- package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +50 -0
- package/dist/build-components/RadioButton/RadioButton.d.ts +11 -0
- package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +50 -0
- package/dist/build-components/RenderNode.generated.d.ts +1 -1
- package/dist/build-components/Text/TextProps.generated.d.ts +4 -0
- package/dist/build-components/View/ViewProps.generated.d.ts +4 -0
- package/dist/build-components/index.d.ts +10 -1
- package/dist/build-components/patterns.generated.d.ts +4831 -661
- package/dist/components/AttributesEditorPanel.d.ts +2 -1
- package/dist/components/Builder.d.ts +1 -1
- package/dist/components/BuilderButton.d.ts +1 -1
- package/dist/components/BuilderProvider.d.ts +15 -0
- package/dist/components/EditorHeader.d.ts +1 -1
- package/dist/components/Icon.generated.d.ts +11 -0
- package/dist/components/LocalizationParamsProvider.d.ts +11 -0
- package/dist/components/ParamsProvider.d.ts +14 -0
- package/dist/hooks/useLocalizationParams.d.ts +1 -0
- package/dist/hooks/useLocalize.d.ts +2 -0
- package/dist/hooks/useParams.d.ts +1 -0
- package/dist/hooks/useSafeAreaViewStyle.d.ts +1 -0
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.cjs.js +29 -0
- package/dist/index.native.cjs.js.map +1 -0
- package/dist/index.native.d.ts +31 -0
- package/dist/index.native.esm.js +29 -0
- package/dist/index.native.esm.js.map +1 -0
- package/dist/mockOS/components/MockOSRouter.d.ts +1 -1
- package/dist/mockOS/context/MockOSContext.d.ts +4 -18
- package/dist/mockOS/context/MockOSContextBase.d.ts +21 -0
- package/dist/mockOS/index.d.ts +3 -2
- package/dist/modals/BenefitEditModal.d.ts +13 -0
- package/dist/modals/BenefitPresetsModal.d.ts +9 -0
- package/dist/modals/IconPickerModal.d.ts +9 -0
- package/dist/modals/MockableFeatureModal.d.ts +6 -0
- package/dist/modals/ProductEditModal.d.ts +9 -0
- package/dist/modals/ProductPresetsModal.d.ts +9 -0
- package/dist/modals/index.d.ts +6 -0
- package/dist/pages/ProjectPage.d.ts +3 -2
- package/dist/pages/tabs/BuilderPanel.d.ts +1 -1
- package/dist/pages/tabs/SideTool.d.ts +1 -1
- package/dist/paywall/hooks/index.d.ts +5 -0
- package/dist/paywall/hooks/useCalculateLocalizedPrice.d.ts +4 -0
- package/dist/paywall/hooks/useCarouselOptionsSeperator.d.ts +6 -0
- package/dist/paywall/hooks/useCloseStatusPaywall.d.ts +4 -0
- package/dist/paywall/hooks/useDiscountRate.d.ts +4 -0
- package/dist/paywall/hooks/usePaywallCounter.d.ts +4 -0
- package/dist/paywall/types/benefits.d.ts +14 -0
- package/dist/paywall/types/paywall-types.d.ts +43 -0
- package/dist/store.d.ts +29 -1
- package/dist/styles.css +1 -1
- package/dist/types/Icons.d.ts +2 -0
- package/dist/types/Project.d.ts +5 -0
- package/dist/utils/analyseNode.d.ts +1 -4
- package/dist/utils/analyseNodeByPatterns.d.ts +16 -0
- package/dist/utils/analyseNodeStructural.d.ts +11 -0
- package/dist/utils/findNodeByKeyNested.d.ts +2 -0
- package/dist/utils/nodeGuards.d.ts +5 -0
- package/dist/utils/novaToJson.d.ts +5 -0
- package/dist/utils/patterns.d.ts +14 -0
- package/dist/utils/replaceLocalizationParams.d.ts +1 -0
- package/package.json +33 -3
- package/scripts/prebuild/assets/icon.template +71 -0
- package/scripts/prebuild/build-components.js +5 -0
- package/scripts/prebuild/icon-generator.js +206 -0
- package/scripts/prebuild/prebuild.js +10 -1
- package/scripts/prebuild/utils/createComponentTsx.js +6 -3
- package/scripts/prebuild/utils/createGeneratedProps.js +4 -2
- package/scripts/prebuild/utils/createRenderNodeGenerated.js +43 -8
- package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +20 -9
- package/scripts/prebuild/utils/validatePatternJson.js +3 -2
- package/src/AttributesEditor.tsx +178 -34
- package/src/DeviceMockFrame.tsx +41 -43
- package/src/RenderPage.tsx +8 -49
- package/src/assets/benefits.json +24 -0
- package/src/assets/iconset/activity-heart.svg +3 -0
- package/src/assets/iconset/activity.svg +3 -0
- package/src/assets/iconset/alert-circle.svg +3 -0
- package/src/assets/iconset/alert-triangle.svg +3 -0
- package/src/assets/iconset/anchor.svg +3 -0
- package/src/assets/iconset/archive.svg +3 -0
- package/src/assets/iconset/arrow-down.svg +3 -0
- package/src/assets/iconset/arrow-left.svg +3 -0
- package/src/assets/iconset/arrow-narrow-down-left.svg +3 -0
- package/src/assets/iconset/arrow-narrow-up-right.svg +3 -0
- package/src/assets/iconset/arrow-right-smooth.svg +4 -0
- package/src/assets/iconset/arrow-right.svg +7 -0
- package/src/assets/iconset/asterisk-01.svg +3 -0
- package/src/assets/iconset/asterisk-02.svg +3 -0
- package/src/assets/iconset/at-sign.svg +3 -0
- package/src/assets/iconset/award.svg +4 -0
- package/src/assets/iconset/battery-charging.svg +6 -0
- package/src/assets/iconset/bell-01.svg +5 -0
- package/src/assets/iconset/bell-02.svg +3 -0
- package/src/assets/iconset/bell-ringing-02.svg +3 -0
- package/src/assets/iconset/bookmark-add.svg +3 -0
- package/src/assets/iconset/bookmark-check.svg +3 -0
- package/src/assets/iconset/bookmark-minus.svg +3 -0
- package/src/assets/iconset/bookmark-x.svg +3 -0
- package/src/assets/iconset/bookmark.svg +3 -0
- package/src/assets/iconset/bubble.svg +5 -0
- package/src/assets/iconset/building-01.svg +3 -0
- package/src/assets/iconset/building-02.svg +3 -0
- package/src/assets/iconset/building-03.svg +3 -0
- package/src/assets/iconset/building-04.svg +3 -0
- package/src/assets/iconset/building-05.svg +3 -0
- package/src/assets/iconset/building-06.svg +3 -0
- package/src/assets/iconset/building-07.svg +3 -0
- package/src/assets/iconset/building-08.svg +3 -0
- package/src/assets/iconset/building-09.svg +3 -0
- package/src/assets/iconset/camera-01.svg +8 -0
- package/src/assets/iconset/camera-steel.svg +4 -0
- package/src/assets/iconset/camera.svg +4 -0
- package/src/assets/iconset/check-circle-bold.svg +3 -0
- package/src/assets/iconset/check-circle-broken.svg +3 -0
- package/src/assets/iconset/check-circle.svg +3 -0
- package/src/assets/iconset/check-done-01.svg +3 -0
- package/src/assets/iconset/check-done-02.svg +3 -0
- package/src/assets/iconset/check-heart.svg +3 -0
- package/src/assets/iconset/check-square-broken.svg +3 -0
- package/src/assets/iconset/check-square.svg +3 -0
- package/src/assets/iconset/check-verified-01.svg +3 -0
- package/src/assets/iconset/check-verified-02.svg +3 -0
- package/src/assets/iconset/check-verified-03.svg +3 -0
- package/src/assets/iconset/check.svg +3 -0
- package/src/assets/iconset/checkbox.svg +4 -0
- package/src/assets/iconset/checkv.svg +3 -0
- package/src/assets/iconset/chevron-down.svg +3 -0
- package/src/assets/iconset/chevron-down2.svg +3 -0
- package/src/assets/iconset/chevron-left-2.svg +3 -0
- package/src/assets/iconset/chevron-left.svg +3 -0
- package/src/assets/iconset/chevron-right-empty.svg +3 -0
- package/src/assets/iconset/chevron-right-smooth.svg +3 -0
- package/src/assets/iconset/chevron-right.svg +3 -0
- package/src/assets/iconset/chevron-up.svg +3 -0
- package/src/assets/iconset/circle.svg +32 -0
- package/src/assets/iconset/clock-fast-forward.svg +10 -0
- package/src/assets/iconset/clock.svg +3 -0
- package/src/assets/iconset/close-circle.svg +3 -0
- package/src/assets/iconset/close.svg +3 -0
- package/src/assets/iconset/cloud-01.svg +5 -0
- package/src/assets/iconset/cloud-blank-01.svg +3 -0
- package/src/assets/iconset/cloud-blank-02.svg +3 -0
- package/src/assets/iconset/coin.svg +5 -0
- package/src/assets/iconset/coins-02.svg +3 -0
- package/src/assets/iconset/colors.svg +3 -0
- package/src/assets/iconset/copy-01.svg +3 -0
- package/src/assets/iconset/copy-02.svg +3 -0
- package/src/assets/iconset/copy-03.svg +3 -0
- package/src/assets/iconset/copy-04.svg +3 -0
- package/src/assets/iconset/copy-05.svg +3 -0
- package/src/assets/iconset/copy-06.svg +3 -0
- package/src/assets/iconset/copy-07.svg +3 -0
- package/src/assets/iconset/corner-down-right.svg +3 -0
- package/src/assets/iconset/crypto-bold.svg +4 -0
- package/src/assets/iconset/delete-icon.svg +5 -0
- package/src/assets/iconset/diamond.svg +3 -0
- package/src/assets/iconset/dice-3.svg +3 -0
- package/src/assets/iconset/divide-01.svg +3 -0
- package/src/assets/iconset/divide-02.svg +3 -0
- package/src/assets/iconset/divide-03.svg +3 -0
- package/src/assets/iconset/document-check-bold.svg +4 -0
- package/src/assets/iconset/dots-circle.svg +10 -0
- package/src/assets/iconset/dots-grid.svg +11 -0
- package/src/assets/iconset/dots-horizontal.svg +5 -0
- package/src/assets/iconset/dots-vertical.svg +5 -0
- package/src/assets/iconset/download-01.svg +3 -0
- package/src/assets/iconset/download-02.svg +3 -0
- package/src/assets/iconset/download-03.svg +3 -0
- package/src/assets/iconset/edit-03.svg +3 -0
- package/src/assets/iconset/edit-04.svg +3 -0
- package/src/assets/iconset/edit-05.svg +3 -0
- package/src/assets/iconset/element-3.svg +6 -0
- package/src/assets/iconset/ellipse-127.svg +3 -0
- package/src/assets/iconset/exclaimation-circle.svg +8 -0
- package/src/assets/iconset/eye-off-line.svg +5 -0
- package/src/assets/iconset/face-smile.svg +5 -0
- package/src/assets/iconset/file-04.svg +3 -0
- package/src/assets/iconset/file-05.svg +3 -0
- package/src/assets/iconset/file-check-02.svg +3 -0
- package/src/assets/iconset/file-plus-01.svg +5 -0
- package/src/assets/iconset/file-shield-02.svg +5 -0
- package/src/assets/iconset/filter-funnel-01.svg +3 -0
- package/src/assets/iconset/flag-03.svg +3 -0
- package/src/assets/iconset/flash.svg +3 -0
- package/src/assets/iconset/folder-plus.svg +3 -0
- package/src/assets/iconset/folder.svg +3 -0
- package/src/assets/iconset/gallery.svg +3 -0
- package/src/assets/iconset/globe-01.svg +3 -0
- package/src/assets/iconset/globe-04.svg +5 -0
- package/src/assets/iconset/globe-bold.svg +4 -0
- package/src/assets/iconset/guard.svg +3 -0
- package/src/assets/iconset/headphones-01.svg +3 -0
- package/src/assets/iconset/headphones-02.svg +5 -0
- package/src/assets/iconset/headset-bold.svg +4 -0
- package/src/assets/iconset/heart-bold.svg +3 -0
- package/src/assets/iconset/heart.svg +3 -0
- package/src/assets/iconset/help-circle.svg +5 -0
- package/src/assets/iconset/home-2.svg +4 -0
- package/src/assets/iconset/home-line.svg +3 -0
- package/src/assets/iconset/hourglass-02.svg +5 -0
- package/src/assets/iconset/image-01.svg +5 -0
- package/src/assets/iconset/image-03.svg +3 -0
- package/src/assets/iconset/image.svg +4 -0
- package/src/assets/iconset/inbox-01.svg +3 -0
- package/src/assets/iconset/inbox-arrow-down.svg +3 -0
- package/src/assets/iconset/info-circle.svg +3 -0
- package/src/assets/iconset/keyboard-line.svg +9 -0
- package/src/assets/iconset/lamp-charge.svg +5 -0
- package/src/assets/iconset/layer.svg +3 -0
- package/src/assets/iconset/light.svg +6 -0
- package/src/assets/iconset/like-dislike.svg +6 -0
- package/src/assets/iconset/lock-03.svg +3 -0
- package/src/assets/iconset/logout.svg +3 -0
- package/src/assets/iconset/magicpen.svg +7 -0
- package/src/assets/iconset/mail-01.svg +5 -0
- package/src/assets/iconset/mail.svg +3 -0
- package/src/assets/iconset/marker.svg +3 -0
- package/src/assets/iconset/medal-star.svg +5 -0
- package/src/assets/iconset/menu-04.svg +3 -0
- package/src/assets/iconset/menu.svg +5 -0
- package/src/assets/iconset/message-circle-01.svg +5 -0
- package/src/assets/iconset/message-plus-circle.svg +3 -0
- package/src/assets/iconset/message-question-circle.svg +5 -0
- package/src/assets/iconset/message-text-circle-01.svg +5 -0
- package/src/assets/iconset/message-text-square-02.svg +3 -0
- package/src/assets/iconset/message-x-square.svg +3 -0
- package/src/assets/iconset/microphone-02.svg +3 -0
- package/src/assets/iconset/microphone-slash.svg +8 -0
- package/src/assets/iconset/mirror.svg +4 -0
- package/src/assets/iconset/moon-01.svg +3 -0
- package/src/assets/iconset/moon-bold.svg +3 -0
- package/src/assets/iconset/mouse-circle.svg +4 -0
- package/src/assets/iconset/move.svg +5 -0
- package/src/assets/iconset/notification-fill.svg +3 -0
- package/src/assets/iconset/notification-text.svg +3 -0
- package/src/assets/iconset/notification.svg +5 -0
- package/src/assets/iconset/pdf-01.svg +6 -0
- package/src/assets/iconset/pencil-01.svg +5 -0
- package/src/assets/iconset/phone-01.svg +3 -0
- package/src/assets/iconset/phone-arrow-down-left.svg +4 -0
- package/src/assets/iconset/phone-arrow-up-right.svg +8 -0
- package/src/assets/iconset/phone-hang-up.svg +5 -0
- package/src/assets/iconset/phone-hangup2.svg +8 -0
- package/src/assets/iconset/phone-incoming-01.svg +3 -0
- package/src/assets/iconset/phone-outgoing-01.svg +3 -0
- package/src/assets/iconset/phone-plus.svg +3 -0
- package/src/assets/iconset/phone-x.svg +3 -0
- package/src/assets/iconset/phone.svg +3 -0
- package/src/assets/iconset/plus-circle.svg +3 -0
- package/src/assets/iconset/plus.svg +4 -0
- package/src/assets/iconset/printer.svg +3 -0
- package/src/assets/iconset/question-mark-circle.svg +5 -0
- package/src/assets/iconset/refresh-ccw-01.svg +3 -0
- package/src/assets/iconset/refresh-cw-01.svg +3 -0
- package/src/assets/iconset/refresh-cw-04.svg +3 -0
- package/src/assets/iconset/refresh-right-square-bold.svg +3 -0
- package/src/assets/iconset/remove-circle.svg +12 -0
- package/src/assets/iconset/repeat-04.svg +3 -0
- package/src/assets/iconset/repeat-bold.svg +3 -0
- package/src/assets/iconset/ruler-pen.svg +4 -0
- package/src/assets/iconset/search-lg.svg +3 -0
- package/src/assets/iconset/search-md.svg +5 -0
- package/src/assets/iconset/search-refraction.svg +5 -0
- package/src/assets/iconset/search.svg +3 -0
- package/src/assets/iconset/send-01.svg +3 -0
- package/src/assets/iconset/send-02.svg +5 -0
- package/src/assets/iconset/send-diagonal.svg +3 -0
- package/src/assets/iconset/setting-2.svg +4 -0
- package/src/assets/iconset/settings-02.svg +4 -0
- package/src/assets/iconset/settings-04.svg +5 -0
- package/src/assets/iconset/settings-2.svg +4 -0
- package/src/assets/iconset/settings-cog.svg +3 -0
- package/src/assets/iconset/settings.svg +4 -0
- package/src/assets/iconset/share-01.svg +4 -0
- package/src/assets/iconset/share-03.svg +3 -0
- package/src/assets/iconset/share-04.svg +3 -0
- package/src/assets/iconset/share-05.svg +5 -0
- package/src/assets/iconset/share-06.svg +3 -0
- package/src/assets/iconset/share-bold.svg +3 -0
- package/src/assets/iconset/shield-01.svg +3 -0
- package/src/assets/iconset/shield-bold.svg +3 -0
- package/src/assets/iconset/solar-check.svg +3 -0
- package/src/assets/iconset/speaker-wave.svg +9 -0
- package/src/assets/iconset/speaker.svg +5 -0
- package/src/assets/iconset/speedometer-03.svg +3 -0
- package/src/assets/iconset/star-rounded.svg +3 -0
- package/src/assets/iconset/star.svg +3 -0
- package/src/assets/iconset/sun.svg +5 -0
- package/src/assets/iconset/target-03.svg +3 -0
- package/src/assets/iconset/text-input.svg +3 -0
- package/src/assets/iconset/translate.svg +7 -0
- package/src/assets/iconset/trash-02.svg +3 -0
- package/src/assets/iconset/trash-03.svg +5 -0
- package/src/assets/iconset/trash-04.svg +3 -0
- package/src/assets/iconset/trash.svg +7 -0
- package/src/assets/iconset/trush-square-bold.svg +3 -0
- package/src/assets/iconset/unlimited.svg +3 -0
- package/src/assets/iconset/user-circle.svg +3 -0
- package/src/assets/iconset/user-jogging.svg +3 -0
- package/src/assets/iconset/user-plus-01.svg +5 -0
- package/src/assets/iconset/user-square.svg +5 -0
- package/src/assets/iconset/user-x-01.svg +5 -0
- package/src/assets/iconset/user-x-02.svg +3 -0
- package/src/assets/iconset/user2.svg +3 -0
- package/src/assets/iconset/users-02.svg +5 -0
- package/src/assets/iconset/users-speaker.svg +7 -0
- package/src/assets/iconset/verify.svg +3 -0
- package/src/assets/iconset/voice-cricle.svg +8 -0
- package/src/assets/iconset/x-circle.svg +3 -0
- package/src/assets/iconset/x-close.svg +3 -0
- package/src/assets/iconset/x-sm.svg +3 -0
- package/src/assets/iconset/zap.svg +3 -0
- package/src/assets/images/background.jpg +0 -0
- package/src/assets/loading_animation.json +1 -0
- package/src/assets/products.json +98 -0
- package/src/assets/samples/carousel-sample.json +1 -0
- package/src/assets/samples/getSamples.ts +39 -66
- package/src/assets/samples/paywall-1.json +220 -0
- package/src/assets/samples/simple-1.json +1 -0
- package/src/assets/samples/simple-2.json +1 -0
- package/src/assets/samples/vpn-onboard-1.json +324 -720
- package/src/assets/samples/vpn-onboard-2.json +299 -683
- package/src/assets/samples/vpn-onboard-3.json +270 -680
- package/src/assets/samples/vpn-onboard-4.json +270 -681
- package/src/assets/samples/vpn-onboard-5.json +408 -893
- package/src/assets/samples/vpn-onboard-6.json +279 -594
- package/src/attributes-editor/SpecialCategorySection.tsx +1 -1
- package/src/build-components/BIcon/BIcon.tsx +56 -0
- package/src/build-components/BIcon/BIconProps.generated.ts +82 -0
- package/src/build-components/BIcon/pattern.json +47 -0
- package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +4 -0
- package/src/build-components/BackgroundImage/pattern.json +2 -2
- package/src/build-components/Button/Button.tsx +14 -1
- package/src/build-components/Button/ButtonProps.generated.ts +4 -0
- package/src/build-components/Button/pattern.json +4 -1
- package/src/build-components/Carousel/CarouselProps.generated.ts +4 -0
- package/src/build-components/Carousel/pattern.json +2 -2
- package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +4 -0
- package/src/build-components/CarouselButtons/pattern.json +1 -1
- package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +4 -0
- package/src/build-components/CarouselDots/pattern.json +1 -1
- package/src/build-components/CarouselItem/CarouselItem.tsx +1 -1
- package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +4 -0
- package/src/build-components/CarouselItem/pattern.json +1 -1
- package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
- package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +4 -0
- package/src/build-components/CarouselProvider/pattern.json +1 -1
- package/src/build-components/Image/ImageProps.generated.ts +4 -0
- package/src/build-components/Image/pattern.json +1 -1
- package/src/build-components/Main/Main.tsx +61 -0
- package/src/build-components/Main/MainProps.generated.ts +64 -0
- package/src/build-components/Main/pattern.json +35 -0
- package/src/build-components/Onboard/OnboardProps.generated.ts +4 -0
- package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +4 -0
- package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +4 -0
- package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +4 -0
- package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +4 -0
- package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +4 -0
- package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
- package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +4 -0
- package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +4 -1
- package/src/build-components/OnboardProvider/pattern.json +6 -16
- package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +4 -0
- package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +4 -0
- package/src/build-components/PaywallBackground/PaywallBackground.tsx +47 -0
- package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +63 -0
- package/src/build-components/PaywallBackground/pattern.json +16 -0
- package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +62 -0
- package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +83 -0
- package/src/build-components/PaywallCloseButton/pattern.json +23 -0
- package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +64 -0
- package/src/build-components/PaywallOptions/PaywallOptions.tsx +92 -0
- package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +63 -0
- package/src/build-components/PaywallOptions/pattern.json +22 -0
- package/src/build-components/PaywallOptions/usePaywallOptionParamsFactory.ts +42 -0
- package/src/build-components/PaywallProvider/PaywallProvider.tsx +78 -0
- package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +63 -0
- package/src/build-components/PaywallProvider/pattern.json +24 -0
- package/src/build-components/PaywallSubscriButton/PaywallSubscriButton.tsx +10 -0
- package/src/build-components/PaywallSubscriButton/PaywallSubscriButtonProps.generated.ts +77 -0
- package/src/build-components/PaywallSubscriButton/pattern.json +27 -0
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +60 -0
- package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +77 -0
- package/src/build-components/PaywallSubscribeButton/pattern.json +27 -0
- package/src/build-components/RadioButton/RadioButton.tsx +123 -0
- package/src/build-components/RadioButton/RadioButtonProps.generated.ts +66 -0
- package/src/build-components/RadioButton/pattern.json +42 -0
- package/src/build-components/RenderNode.generated.tsx +140 -37
- package/src/build-components/Text/Text.tsx +3 -3
- package/src/build-components/Text/TextProps.generated.ts +4 -0
- package/src/build-components/Text/pattern.json +1 -1
- package/src/build-components/View/ViewProps.generated.ts +4 -0
- package/src/build-components/View/pattern.json +42 -4
- package/src/build-components/index.ts +55 -10
- package/src/build-components/patterns.generated.ts +4909 -706
- package/src/components/AttributesEditorPanel.tsx +3 -1
- package/src/components/Builder.tsx +3 -5
- package/src/components/BuilderButton.tsx +2 -7
- package/src/components/BuilderProvider.tsx +45 -0
- package/src/components/DeviceNavigationBar.tsx +1 -1
- package/src/components/EditorHeader.tsx +4 -1
- package/src/components/Icon.generated.tsx +540 -0
- package/src/components/LocalizationParamsProvider.tsx +22 -0
- package/src/components/ParamsProvider.tsx +38 -0
- package/src/hooks/useLocalizationParams.ts +5 -0
- package/src/hooks/useLocalize.ts +23 -0
- package/src/hooks/useParams.ts +8 -0
- package/src/hooks/useSafeAreaViewStyle.ts +67 -0
- package/src/index.native.ts +75 -0
- package/src/index.ts +26 -0
- package/src/mockOS/components/MockOSRouter.tsx +9 -14
- package/src/mockOS/context/MockOSContext.tsx +12 -36
- package/src/mockOS/context/MockOSContextBase.ts +35 -0
- package/src/mockOS/index.ts +3 -2
- package/src/modals/AddComponentModal.tsx +1 -0
- package/src/modals/BenefitEditModal.tsx +160 -0
- package/src/modals/BenefitPresetsModal.tsx +166 -0
- package/src/modals/IconPickerModal.tsx +109 -0
- package/src/modals/MockableFeatureModal.tsx +292 -0
- package/src/modals/ProductEditModal.tsx +215 -0
- package/src/modals/ProductPresetsModal.tsx +151 -0
- package/src/modals/index.ts +6 -0
- package/src/pages/ProjectPage.tsx +72 -15
- package/src/pages/tabs/BuilderPanel.tsx +1 -1
- package/src/pages/tabs/SideTool.tsx +3 -10
- package/src/paywall/hooks/index.ts +5 -0
- package/src/paywall/hooks/useCalculateLocalizedPrice.ts +6 -0
- package/src/paywall/hooks/useCarouselOptionsSeperator.ts +8 -0
- package/src/paywall/hooks/useCloseStatusPaywall.ts +6 -0
- package/src/paywall/hooks/useDiscountRate.ts +6 -0
- package/src/paywall/hooks/usePaywallCounter.ts +6 -0
- package/src/paywall/types/benefits.ts +44 -0
- package/src/paywall/types/paywall-types.ts +51 -0
- package/src/store.ts +155 -41
- package/src/styles/base/_global.scss +49 -41
- package/src/styles/components/_attributes-editor.scss +40 -5
- package/src/styles/components/_editor-shell.scss +5 -11
- package/src/styles/components/_ui-components.scss +2 -1
- package/src/styles/index.scss +5 -0
- package/src/styles/modals/_benefit-edit-modal.scss +17 -0
- package/src/styles/modals/_benefit-presets-modal.scss +79 -0
- package/src/styles/modals/_mockable-feature-modal.scss +15 -0
- package/src/styles/modals/_product-edit-modal.scss +23 -0
- package/src/styles/modals/_product-presets-modal.scss +81 -0
- package/src/types/Icons.ts +244 -0
- package/src/types/Project.ts +5 -0
- package/src/types/jest-globals.d.ts +13 -0
- package/src/utils/analyseNode.ts +22 -109
- package/src/utils/analyseNodeByPatterns.ts +438 -0
- package/src/utils/analyseNodeStructural.ts +52 -0
- package/src/utils/extractViewStyle.ts +19 -0
- package/src/utils/findNodeByKeyNested.ts +32 -0
- package/src/utils/isCarousel.ts +21 -5
- package/src/utils/nodeGuards.ts +26 -0
- package/src/utils/novaToJson.ts +21 -9
- package/src/utils/patterns.ts +62 -3
- package/src/utils/replaceLocalizationParams.ts +15 -0
|
@@ -46,6 +46,10 @@ export interface OnboardImagePropsGenerated {
|
|
|
46
46
|
marginRight?: string;
|
|
47
47
|
backgroundColor?: string;
|
|
48
48
|
borderRadius?: string;
|
|
49
|
+
minWidth?: string;
|
|
50
|
+
maxWidth?: string;
|
|
51
|
+
minHeight?: string;
|
|
52
|
+
maxHeight?: string;
|
|
49
53
|
flex?: number;
|
|
50
54
|
position?: PositionOptionType;
|
|
51
55
|
top?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useId, useMemo } from 'react';
|
|
2
2
|
import type { OnboardItemComponentProps } from './OnboardItemProps.generated';
|
|
3
3
|
import useNode from '../useNode';
|
|
4
|
-
import
|
|
4
|
+
import RenderNode from '../RenderNode.generated';
|
|
5
5
|
import { useRenderStore } from '../../store';
|
|
6
6
|
import { parseSize } from '../../size-matters';
|
|
7
7
|
import { useLogRender } from '../../utils/useLogRender';
|
|
@@ -43,7 +43,11 @@ export interface OnboardItemPropsGenerated {
|
|
|
43
43
|
backgroundColor?: string;
|
|
44
44
|
borderRadius?: string;
|
|
45
45
|
width?: string;
|
|
46
|
+
minWidth?: string;
|
|
47
|
+
maxWidth?: string;
|
|
46
48
|
height?: string;
|
|
49
|
+
minHeight?: string;
|
|
50
|
+
maxHeight?: string;
|
|
47
51
|
flex?: number;
|
|
48
52
|
position?: PositionOptionType;
|
|
49
53
|
top?: string;
|
|
@@ -42,7 +42,11 @@ export interface OnboardProviderPropsGenerated {
|
|
|
42
42
|
backgroundColor?: string;
|
|
43
43
|
borderRadius?: never;
|
|
44
44
|
width?: string;
|
|
45
|
+
minWidth?: string;
|
|
46
|
+
maxWidth?: string;
|
|
45
47
|
height?: string;
|
|
48
|
+
minHeight?: string;
|
|
49
|
+
maxHeight?: string;
|
|
46
50
|
flex?: number;
|
|
47
51
|
position?: PositionOptionType;
|
|
48
52
|
top?: string;
|
|
@@ -50,7 +54,6 @@ export interface OnboardProviderPropsGenerated {
|
|
|
50
54
|
left?: string;
|
|
51
55
|
right?: string;
|
|
52
56
|
zIndex?: number;
|
|
53
|
-
use_safe_area_inset?: boolean;
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
|
|
@@ -6,55 +6,45 @@
|
|
|
6
6
|
"children": "node",
|
|
7
7
|
"extends": "View",
|
|
8
8
|
"attributes": {
|
|
9
|
-
"use_safe_area_inset": "boolean",
|
|
10
9
|
"borderRadius": "never"
|
|
11
10
|
}
|
|
12
11
|
},
|
|
13
12
|
"defaults": {
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"paddingBottom": 8,
|
|
17
|
-
"paddingLeft": 0
|
|
13
|
+
"width": "100%",
|
|
14
|
+
"height": "100%"
|
|
18
15
|
},
|
|
19
16
|
"meta": {
|
|
20
17
|
"desiredParent": ["root"],
|
|
21
18
|
"label": "Onboard Provider",
|
|
22
19
|
"description": "Provides shared settings for onboarding.",
|
|
23
20
|
"attributes": {
|
|
24
|
-
"use_safe_area_inset": {
|
|
25
|
-
"label": "Use Safe Area Inset",
|
|
26
|
-
"description": "Adds safe area padding.",
|
|
27
|
-
"category": "container",
|
|
28
|
-
"specialCategory": null,
|
|
29
|
-
"sort": 2
|
|
30
|
-
},
|
|
31
21
|
"paddingTop": {
|
|
32
22
|
"label": "Padding Top",
|
|
33
23
|
"description": "Top padding for the provider.",
|
|
34
24
|
"category": "container",
|
|
35
25
|
"specialCategory": "padding",
|
|
36
|
-
"sort":
|
|
26
|
+
"sort": 1
|
|
37
27
|
},
|
|
38
28
|
"paddingRight": {
|
|
39
29
|
"label": "Padding Right",
|
|
40
30
|
"description": "Right padding for the provider.",
|
|
41
31
|
"category": "container",
|
|
42
32
|
"specialCategory": "padding",
|
|
43
|
-
"sort":
|
|
33
|
+
"sort": 2
|
|
44
34
|
},
|
|
45
35
|
"paddingBottom": {
|
|
46
36
|
"label": "Padding Bottom",
|
|
47
37
|
"description": "Bottom padding for the provider.",
|
|
48
38
|
"category": "container",
|
|
49
39
|
"specialCategory": "padding",
|
|
50
|
-
"sort":
|
|
40
|
+
"sort": 3
|
|
51
41
|
},
|
|
52
42
|
"paddingLeft": {
|
|
53
43
|
"label": "Padding Left",
|
|
54
44
|
"description": "Left padding for the provider.",
|
|
55
45
|
"category": "container",
|
|
56
46
|
"specialCategory": "padding",
|
|
57
|
-
"sort":
|
|
47
|
+
"sort": 4
|
|
58
48
|
}
|
|
59
49
|
}
|
|
60
50
|
}
|
|
@@ -59,7 +59,11 @@ export interface OnboardSubtitlePropsGenerated {
|
|
|
59
59
|
backgroundColor?: string;
|
|
60
60
|
borderRadius?: string;
|
|
61
61
|
width?: string;
|
|
62
|
+
minWidth?: string;
|
|
63
|
+
maxWidth?: string;
|
|
62
64
|
height?: string;
|
|
65
|
+
minHeight?: string;
|
|
66
|
+
maxHeight?: string;
|
|
63
67
|
flex?: number;
|
|
64
68
|
position?: PositionOptionType;
|
|
65
69
|
top?: string;
|
|
@@ -59,7 +59,11 @@ export interface OnboardTitlePropsGenerated {
|
|
|
59
59
|
backgroundColor?: string;
|
|
60
60
|
borderRadius?: string;
|
|
61
61
|
width?: string;
|
|
62
|
+
minWidth?: string;
|
|
63
|
+
maxWidth?: string;
|
|
62
64
|
height?: string;
|
|
65
|
+
minHeight?: string;
|
|
66
|
+
maxHeight?: string;
|
|
63
67
|
flex?: number;
|
|
64
68
|
position?: PositionOptionType;
|
|
65
69
|
top?: string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useId, useMemo } from 'react';
|
|
2
|
+
import type { PaywallBackgroundComponentProps } from './PaywallBackgroundProps.generated';
|
|
3
|
+
import useNode from '../useNode';
|
|
4
|
+
import { useRenderStore } from '../../store';
|
|
5
|
+
import { extractViewStyle } from '../../utils/extractViewStyle';
|
|
6
|
+
import { useLogRender } from '../../utils/useLogRender';
|
|
7
|
+
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
8
|
+
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
9
|
+
|
|
10
|
+
function PaywallBackground({ node }: PaywallBackgroundComponentProps) {
|
|
11
|
+
useLogRender('PaywallBackground');
|
|
12
|
+
node = useNode(node);
|
|
13
|
+
|
|
14
|
+
const generatedId = useId();
|
|
15
|
+
const attributeName = node.type ?? 'PaywallBackground';
|
|
16
|
+
const attributeKey = node.key ?? generatedId;
|
|
17
|
+
|
|
18
|
+
const { previewMode, current, appConfig, projectColors } = useRenderStore(
|
|
19
|
+
(s) => ({
|
|
20
|
+
previewMode: s.previewMode,
|
|
21
|
+
current: s.current,
|
|
22
|
+
appConfig: s.appConfig,
|
|
23
|
+
projectColors: s.projectColors,
|
|
24
|
+
}),
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const baseStyle = useMemo(
|
|
28
|
+
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
29
|
+
[node, appConfig, projectColors],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
33
|
+
const style = useMergedStyle(
|
|
34
|
+
baseStyle,
|
|
35
|
+
isSelected ? SELECTED_OUTLINE_STYLE : undefined,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
attribute-name={attributeName}
|
|
41
|
+
attribute-key={attributeKey}
|
|
42
|
+
style={style}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default React.memo(PaywallBackground);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* AUTO-GENERATED FILE - DO NOT EDIT */
|
|
2
|
+
|
|
3
|
+
import type { NodeData } from '../../types/Node';
|
|
4
|
+
|
|
5
|
+
export type FlexDirectionOptionType = 'row' | 'column';
|
|
6
|
+
export type AlignItemsOptionType =
|
|
7
|
+
| 'flex-start'
|
|
8
|
+
| 'center'
|
|
9
|
+
| 'flex-end'
|
|
10
|
+
| 'stretch'
|
|
11
|
+
| 'baseline';
|
|
12
|
+
export type JustifyContentOptionType =
|
|
13
|
+
| 'flex-start'
|
|
14
|
+
| 'center'
|
|
15
|
+
| 'flex-end'
|
|
16
|
+
| 'space-between'
|
|
17
|
+
| 'space-around'
|
|
18
|
+
| 'space-evenly';
|
|
19
|
+
export type PositionOptionType = 'relative' | 'absolute';
|
|
20
|
+
|
|
21
|
+
export interface PaywallBackgroundPropsGenerated {
|
|
22
|
+
child: string;
|
|
23
|
+
attributes: {
|
|
24
|
+
scrollable?: boolean;
|
|
25
|
+
flexDirection?: FlexDirectionOptionType;
|
|
26
|
+
alignItems?: AlignItemsOptionType;
|
|
27
|
+
justifyContent?: JustifyContentOptionType;
|
|
28
|
+
gap?: string;
|
|
29
|
+
padding?: string;
|
|
30
|
+
paddingHorizontal?: string;
|
|
31
|
+
paddingVertical?: string;
|
|
32
|
+
paddingTop?: string;
|
|
33
|
+
paddingBottom?: string;
|
|
34
|
+
paddingLeft?: string;
|
|
35
|
+
paddingRight?: string;
|
|
36
|
+
margin?: string;
|
|
37
|
+
marginVertical?: string;
|
|
38
|
+
marginTop?: string;
|
|
39
|
+
marginBottom?: string;
|
|
40
|
+
marginLeft?: string;
|
|
41
|
+
marginRight?: string;
|
|
42
|
+
backgroundColor?: string;
|
|
43
|
+
borderRadius?: string;
|
|
44
|
+
width?: string;
|
|
45
|
+
minWidth?: string;
|
|
46
|
+
maxWidth?: string;
|
|
47
|
+
height?: string;
|
|
48
|
+
minHeight?: string;
|
|
49
|
+
maxHeight?: string;
|
|
50
|
+
flex?: number;
|
|
51
|
+
position?: PositionOptionType;
|
|
52
|
+
top?: string;
|
|
53
|
+
bottom?: string;
|
|
54
|
+
left?: string;
|
|
55
|
+
right?: string;
|
|
56
|
+
zIndex?: number;
|
|
57
|
+
[key: string]: string | number | boolean | undefined;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PaywallBackgroundComponentProps {
|
|
62
|
+
node: NodeData<PaywallBackgroundPropsGenerated['attributes']>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"allowUnknownAttributes": true,
|
|
4
|
+
"pattern": {
|
|
5
|
+
"type": "PaywallBackground",
|
|
6
|
+
"children": "never",
|
|
7
|
+
"extends": "View",
|
|
8
|
+
"attributes": {}
|
|
9
|
+
},
|
|
10
|
+
"meta": {
|
|
11
|
+
"desiredParent": [">PaywallProvider"],
|
|
12
|
+
"label": "Paywall Background",
|
|
13
|
+
"description": "Paywall Background component.",
|
|
14
|
+
"attributes": {}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useId, useMemo } from 'react';
|
|
2
|
+
import type { PaywallCloseButtonComponentProps } from './PaywallCloseButtonProps.generated';
|
|
3
|
+
import useNode from '../useNode';
|
|
4
|
+
import { useRenderStore } from '../../store';
|
|
5
|
+
import { extractTextStyle } from '../../utils/extractTextStyle';
|
|
6
|
+
import { useLogRender } from '../../utils/useLogRender';
|
|
7
|
+
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
8
|
+
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
9
|
+
import { Icon } from '../../components/Icon.generated';
|
|
10
|
+
import { IconsType } from '../../types/Icons';
|
|
11
|
+
|
|
12
|
+
function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
|
|
13
|
+
useLogRender('PaywallCloseButton');
|
|
14
|
+
node = useNode(node);
|
|
15
|
+
|
|
16
|
+
const generatedId = useId();
|
|
17
|
+
const attributeName =
|
|
18
|
+
(node as any)?.sourceType ?? node.type ?? 'PaywallCloseButton';
|
|
19
|
+
const attributeKey = node.key ?? generatedId;
|
|
20
|
+
|
|
21
|
+
const { previewMode, current, appConfig, projectColors } = useRenderStore(
|
|
22
|
+
(s) => ({
|
|
23
|
+
previewMode: s.previewMode,
|
|
24
|
+
current: s.current,
|
|
25
|
+
appConfig: s.appConfig,
|
|
26
|
+
projectColors: s.projectColors,
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const baseStyle = useMemo(
|
|
31
|
+
() => extractTextStyle(node, { appConfig, projectColors }),
|
|
32
|
+
[node, appConfig, projectColors],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
36
|
+
const style = useMergedStyle(
|
|
37
|
+
baseStyle,
|
|
38
|
+
isSelected ? SELECTED_OUTLINE_STYLE : undefined,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const iconType = node.attributes?.iconType ?? 'close';
|
|
42
|
+
const size =
|
|
43
|
+
node.attributes?.size ?? (style.fontSize as number | undefined) ?? 24;
|
|
44
|
+
const color =
|
|
45
|
+
(style.color as string | undefined) ??
|
|
46
|
+
(node.attributes?.color as string | undefined);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<a
|
|
50
|
+
attribute-name={attributeName}
|
|
51
|
+
attribute-key={attributeKey}
|
|
52
|
+
href="#"
|
|
53
|
+
onClick={(e) => e.preventDefault()}
|
|
54
|
+
aria-label="Close"
|
|
55
|
+
style={{ ...style, cursor: 'pointer', textDecoration: 'none' }}
|
|
56
|
+
>
|
|
57
|
+
<Icon iconType={iconType as IconsType} size={size} color={color} alt="" />
|
|
58
|
+
</a>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default React.memo(PaywallCloseButton);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* AUTO-GENERATED FILE - DO NOT EDIT */
|
|
2
|
+
|
|
3
|
+
import type { NodeData } from '../../types/Node';
|
|
4
|
+
|
|
5
|
+
export type FontWeightOptionType =
|
|
6
|
+
| 'normal'
|
|
7
|
+
| 'bold'
|
|
8
|
+
| '100'
|
|
9
|
+
| '200'
|
|
10
|
+
| '300'
|
|
11
|
+
| '400'
|
|
12
|
+
| '500'
|
|
13
|
+
| '600'
|
|
14
|
+
| '700'
|
|
15
|
+
| '800'
|
|
16
|
+
| '900';
|
|
17
|
+
export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
|
|
18
|
+
export type FlexDirectionOptionType = 'row' | 'column';
|
|
19
|
+
export type AlignItemsOptionType =
|
|
20
|
+
| 'flex-start'
|
|
21
|
+
| 'center'
|
|
22
|
+
| 'flex-end'
|
|
23
|
+
| 'stretch'
|
|
24
|
+
| 'baseline';
|
|
25
|
+
export type JustifyContentOptionType =
|
|
26
|
+
| 'flex-start'
|
|
27
|
+
| 'center'
|
|
28
|
+
| 'flex-end'
|
|
29
|
+
| 'space-between'
|
|
30
|
+
| 'space-around'
|
|
31
|
+
| 'space-evenly';
|
|
32
|
+
export type PositionOptionType = 'relative' | 'absolute';
|
|
33
|
+
|
|
34
|
+
export interface PaywallCloseButtonPropsGenerated {
|
|
35
|
+
child: string;
|
|
36
|
+
attributes: {
|
|
37
|
+
iconType?: string;
|
|
38
|
+
size?: number;
|
|
39
|
+
strokeWidth?: number;
|
|
40
|
+
color?: string;
|
|
41
|
+
fontSize?: string;
|
|
42
|
+
fontWeight?: FontWeightOptionType;
|
|
43
|
+
textAlign?: TextAlignOptionType;
|
|
44
|
+
scrollable?: boolean;
|
|
45
|
+
flexDirection?: FlexDirectionOptionType;
|
|
46
|
+
alignItems?: AlignItemsOptionType;
|
|
47
|
+
justifyContent?: JustifyContentOptionType;
|
|
48
|
+
gap?: string;
|
|
49
|
+
padding?: string;
|
|
50
|
+
paddingHorizontal?: string;
|
|
51
|
+
paddingVertical?: string;
|
|
52
|
+
paddingTop?: string;
|
|
53
|
+
paddingBottom?: string;
|
|
54
|
+
paddingLeft?: string;
|
|
55
|
+
paddingRight?: string;
|
|
56
|
+
margin?: string;
|
|
57
|
+
marginVertical?: string;
|
|
58
|
+
marginTop?: string;
|
|
59
|
+
marginBottom?: string;
|
|
60
|
+
marginLeft?: string;
|
|
61
|
+
marginRight?: string;
|
|
62
|
+
backgroundColor?: string;
|
|
63
|
+
borderRadius?: string;
|
|
64
|
+
width?: string;
|
|
65
|
+
minWidth?: string;
|
|
66
|
+
maxWidth?: string;
|
|
67
|
+
height?: string;
|
|
68
|
+
minHeight?: string;
|
|
69
|
+
maxHeight?: string;
|
|
70
|
+
flex?: number;
|
|
71
|
+
position?: PositionOptionType;
|
|
72
|
+
top?: string;
|
|
73
|
+
bottom?: string;
|
|
74
|
+
left?: string;
|
|
75
|
+
right?: string;
|
|
76
|
+
zIndex?: number;
|
|
77
|
+
[key: string]: string | number | boolean | undefined;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface PaywallCloseButtonComponentProps {
|
|
82
|
+
node: NodeData<PaywallCloseButtonPropsGenerated['attributes']>;
|
|
83
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"allowUnknownAttributes": true,
|
|
4
|
+
"pattern": {
|
|
5
|
+
"type": "PaywallCloseButton",
|
|
6
|
+
"children": "never",
|
|
7
|
+
"extends": "BIcon",
|
|
8
|
+
"attributes": {},
|
|
9
|
+
"defaults": {
|
|
10
|
+
"iconType": "close",
|
|
11
|
+
"size": 24,
|
|
12
|
+
"flexDirection": "row",
|
|
13
|
+
"justifyContent": "center",
|
|
14
|
+
"alignItems": "center"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"meta": {
|
|
18
|
+
"desiredParent": [">PaywallProvider"],
|
|
19
|
+
"label": "Paywall Close Button",
|
|
20
|
+
"description": "Paywall Close Button component.",
|
|
21
|
+
"attributes": {}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useId, useMemo } from 'react';
|
|
2
|
+
import type { Product } from '../../paywall/types/paywall-types';
|
|
3
|
+
import { extractViewStyle } from '../../utils/extractViewStyle';
|
|
4
|
+
import type { NodeData } from '../../types/Node';
|
|
5
|
+
import { useRenderStore } from '../../store';
|
|
6
|
+
import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
|
|
7
|
+
import { useMergedStyle } from '../../utils/useMergedStyle';
|
|
8
|
+
import { RenderNode } from '../..';
|
|
9
|
+
|
|
10
|
+
export type OptionsButtonProps = {
|
|
11
|
+
product: Product;
|
|
12
|
+
selected: boolean;
|
|
13
|
+
onPress: (productId: string) => void;
|
|
14
|
+
node: NodeData<any>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function PaywallOptionButton({
|
|
18
|
+
product,
|
|
19
|
+
selected,
|
|
20
|
+
onPress,
|
|
21
|
+
node,
|
|
22
|
+
}: OptionsButtonProps) {
|
|
23
|
+
const generatedId = useId();
|
|
24
|
+
const productId = (product.productId ?? '').trim();
|
|
25
|
+
|
|
26
|
+
const { previewMode, current, appConfig, projectColors } = useRenderStore(
|
|
27
|
+
(s) => ({
|
|
28
|
+
previewMode: s.previewMode,
|
|
29
|
+
current: s.current,
|
|
30
|
+
appConfig: s.appConfig,
|
|
31
|
+
projectColors: s.projectColors,
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const baseStyle = useMemo(
|
|
36
|
+
() => extractViewStyle(node, { appConfig, projectColors }),
|
|
37
|
+
[node, appConfig, projectColors],
|
|
38
|
+
);
|
|
39
|
+
console.log('-->', { node, baseStyle });
|
|
40
|
+
|
|
41
|
+
const isSelected = isNodeSelected({ previewMode, current, node });
|
|
42
|
+
|
|
43
|
+
const mergedStyle = useMergedStyle(
|
|
44
|
+
baseStyle,
|
|
45
|
+
isSelected ? SELECTED_OUTLINE_STYLE : undefined,
|
|
46
|
+
);
|
|
47
|
+
const attributeName = (node as any)?.sourceType ?? node.type ?? 'text';
|
|
48
|
+
const baseAttributeKey = (node.key ?? generatedId) as string;
|
|
49
|
+
const attributeKey = productId
|
|
50
|
+
? `${baseAttributeKey}:${productId}`
|
|
51
|
+
: baseAttributeKey;
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
attribute-name={attributeName}
|
|
55
|
+
attribute-key={attributeKey}
|
|
56
|
+
role="button"
|
|
57
|
+
tabIndex={0}
|
|
58
|
+
onClick={() => onPress(productId)}
|
|
59
|
+
style={{ ...mergedStyle, cursor: 'pointer' }}
|
|
60
|
+
>
|
|
61
|
+
<RenderNode node={node.children as Node} />
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { useId, useMemo, useState } from 'react';
|
|
2
|
+
import type { PaywallOptionsComponentProps } from './PaywallOptionsProps.generated';
|
|
3
|
+
import useNode from '../useNode';
|
|
4
|
+
import { useLogRender } from '../../utils/useLogRender';
|
|
5
|
+
import { useBuilderParams } from '../../components/BuilderProvider';
|
|
6
|
+
import { ParamsProvider } from '../../components/ParamsProvider';
|
|
7
|
+
import type { Product } from '../../paywall/types/paywall-types';
|
|
8
|
+
import { PaywallOptionButton } from './PaywallOptionButton';
|
|
9
|
+
import { usePaywallOptionParamsFactory } from './usePaywallOptionParamsFactory';
|
|
10
|
+
|
|
11
|
+
function parseNumberLike(value: unknown): number | undefined {
|
|
12
|
+
if (value === null || value === undefined) return undefined;
|
|
13
|
+
if (typeof value === 'number' && Number.isFinite(value)) return value;
|
|
14
|
+
if (typeof value !== 'string') return undefined;
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
if (!trimmed) return undefined;
|
|
17
|
+
const normalized = trimmed.replace(',', '.');
|
|
18
|
+
const parsed = Number.parseFloat(normalized);
|
|
19
|
+
if (!Number.isFinite(parsed)) return undefined;
|
|
20
|
+
return parsed;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function compareProducts(
|
|
24
|
+
a: Product,
|
|
25
|
+
b: Product,
|
|
26
|
+
aIndex: number,
|
|
27
|
+
bIndex: number,
|
|
28
|
+
): number {
|
|
29
|
+
const aPrice = parseNumberLike(a.price);
|
|
30
|
+
const bPrice = parseNumberLike(b.price);
|
|
31
|
+
if (aPrice !== undefined && bPrice !== undefined && aPrice !== bPrice) {
|
|
32
|
+
return aPrice - bPrice;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const aTitle = (a.title ?? '').trim();
|
|
36
|
+
const bTitle = (b.title ?? '').trim();
|
|
37
|
+
if (aTitle && bTitle && aTitle !== bTitle)
|
|
38
|
+
return aTitle.localeCompare(bTitle);
|
|
39
|
+
if (aTitle && !bTitle) return -1;
|
|
40
|
+
if (!aTitle && bTitle) return 1;
|
|
41
|
+
|
|
42
|
+
const aId = (a.productId ?? '').trim();
|
|
43
|
+
const bId = (b.productId ?? '').trim();
|
|
44
|
+
if (aId !== bId) return aId.localeCompare(bId);
|
|
45
|
+
|
|
46
|
+
// Stable fallback
|
|
47
|
+
return aIndex - bIndex;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function PaywallOptions({ node }: PaywallOptionsComponentProps) {
|
|
51
|
+
useLogRender('PaywallOptions');
|
|
52
|
+
node = useNode(node);
|
|
53
|
+
const { products } = useBuilderParams();
|
|
54
|
+
const [selectedProductId, setSelectedProductId] = useState<string>('');
|
|
55
|
+
const getParamsForProduct = usePaywallOptionParamsFactory();
|
|
56
|
+
|
|
57
|
+
const sortedProducts = useMemo(() => {
|
|
58
|
+
const list = Array.isArray(products) ? products : [];
|
|
59
|
+
return list
|
|
60
|
+
.map((p, idx) => ({ p, idx }))
|
|
61
|
+
.sort((a, b) => compareProducts(a.p, b.p, a.idx, b.idx))
|
|
62
|
+
.map(({ p }) => p);
|
|
63
|
+
}, [products]);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<>
|
|
67
|
+
{sortedProducts.map((p, index) => {
|
|
68
|
+
const productId = p.productId || `${index}`;
|
|
69
|
+
const isSelected = selectedProductId === productId;
|
|
70
|
+
const { localizationParams, otherParams } = getParamsForProduct(p, {
|
|
71
|
+
isSelected,
|
|
72
|
+
});
|
|
73
|
+
return (
|
|
74
|
+
<ParamsProvider
|
|
75
|
+
key={productId}
|
|
76
|
+
localizationParams={localizationParams}
|
|
77
|
+
otherParams={otherParams}
|
|
78
|
+
>
|
|
79
|
+
<PaywallOptionButton
|
|
80
|
+
node={node}
|
|
81
|
+
product={p}
|
|
82
|
+
selected={isSelected}
|
|
83
|
+
onPress={setSelectedProductId}
|
|
84
|
+
/>
|
|
85
|
+
</ParamsProvider>
|
|
86
|
+
);
|
|
87
|
+
})}
|
|
88
|
+
</>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default React.memo(PaywallOptions);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* AUTO-GENERATED FILE - DO NOT EDIT */
|
|
2
|
+
|
|
3
|
+
import type { NodeData } from '../../types/Node';
|
|
4
|
+
|
|
5
|
+
export type FlexDirectionOptionType = 'row' | 'column';
|
|
6
|
+
export type AlignItemsOptionType =
|
|
7
|
+
| 'flex-start'
|
|
8
|
+
| 'center'
|
|
9
|
+
| 'flex-end'
|
|
10
|
+
| 'stretch'
|
|
11
|
+
| 'baseline';
|
|
12
|
+
export type JustifyContentOptionType =
|
|
13
|
+
| 'flex-start'
|
|
14
|
+
| 'center'
|
|
15
|
+
| 'flex-end'
|
|
16
|
+
| 'space-between'
|
|
17
|
+
| 'space-around'
|
|
18
|
+
| 'space-evenly';
|
|
19
|
+
export type PositionOptionType = 'relative' | 'absolute';
|
|
20
|
+
|
|
21
|
+
export interface PaywallOptionsPropsGenerated {
|
|
22
|
+
child: string;
|
|
23
|
+
attributes: {
|
|
24
|
+
scrollable?: boolean;
|
|
25
|
+
flexDirection?: FlexDirectionOptionType;
|
|
26
|
+
alignItems?: AlignItemsOptionType;
|
|
27
|
+
justifyContent?: JustifyContentOptionType;
|
|
28
|
+
gap?: string;
|
|
29
|
+
padding?: string;
|
|
30
|
+
paddingHorizontal?: string;
|
|
31
|
+
paddingVertical?: string;
|
|
32
|
+
paddingTop?: string;
|
|
33
|
+
paddingBottom?: string;
|
|
34
|
+
paddingLeft?: string;
|
|
35
|
+
paddingRight?: string;
|
|
36
|
+
margin?: string;
|
|
37
|
+
marginVertical?: string;
|
|
38
|
+
marginTop?: string;
|
|
39
|
+
marginBottom?: string;
|
|
40
|
+
marginLeft?: string;
|
|
41
|
+
marginRight?: string;
|
|
42
|
+
backgroundColor?: string;
|
|
43
|
+
borderRadius?: string;
|
|
44
|
+
width?: string;
|
|
45
|
+
minWidth?: string;
|
|
46
|
+
maxWidth?: string;
|
|
47
|
+
height?: string;
|
|
48
|
+
minHeight?: string;
|
|
49
|
+
maxHeight?: string;
|
|
50
|
+
flex?: number;
|
|
51
|
+
position?: PositionOptionType;
|
|
52
|
+
top?: string;
|
|
53
|
+
bottom?: string;
|
|
54
|
+
left?: string;
|
|
55
|
+
right?: string;
|
|
56
|
+
zIndex?: number;
|
|
57
|
+
[key: string]: string | number | boolean | undefined;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface PaywallOptionsComponentProps {
|
|
62
|
+
node: NodeData<PaywallOptionsPropsGenerated['attributes']>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"allowUnknownAttributes": true,
|
|
4
|
+
"pattern": {
|
|
5
|
+
"type": "PaywallOptions",
|
|
6
|
+
"extends": "View",
|
|
7
|
+
"children": ["node", "array"],
|
|
8
|
+
"attributes": {},
|
|
9
|
+
"defaults": {
|
|
10
|
+
"flexDirection": "row",
|
|
11
|
+
"justifyContent": "space-between",
|
|
12
|
+
"alignItems": "center",
|
|
13
|
+
"minHeight": "60px"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"meta": {
|
|
17
|
+
"desiredParent": [">PaywallProvider"],
|
|
18
|
+
"label": "Paywall Options",
|
|
19
|
+
"description": "Paywall options selector component.",
|
|
20
|
+
"attributes": {}
|
|
21
|
+
}
|
|
22
|
+
}
|