@tyrads.com/tyrads-sdk 3.3.4 → 4.0.0-beta.0
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/android/build.gradle +1 -1
- package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +161 -19
- package/ios/Tyrads/AcmoConfig.swift +1 -1
- package/ios/Tyrads/InitModel.swift +29 -15
- package/ios/Tyrads/Tyrads.swift +332 -274
- package/ios/Tyrads/WebViewController.swift +10 -17
- package/ios/Tyrads/core/models/TyradsUserInfo.swift +2 -0
- package/ios/Tyrads/core/utils/AcmoKeyNames.swift +1 -0
- package/ios/Tyrads/helpers/device_details.swift +122 -2
- package/ios/Tyrads/pushNotifications/APNsAppDelegateProxy.swift +37 -0
- package/ios/Tyrads/pushNotifications/APNsNotificationListener.swift +14 -0
- package/ios/Tyrads/pushNotifications/APNsNotificationManager.swift +68 -0
- package/ios/Tyrads/pushNotifications/APNsNotificationReceiver.swift +77 -0
- package/ios/Tyrads/pushNotifications/TyradsAPNsSwizzler.mm +179 -0
- package/ios/TyradsSdk-Bridging-Header.h +3 -0
- package/ios/TyradsSdk.mm +12 -1
- package/ios/TyradsSdk.swift +121 -4
- package/lib/commonjs/acmo/core/components/countdown-timer.js +48 -0
- package/lib/commonjs/acmo/core/components/countdown-timer.js.map +1 -0
- package/lib/commonjs/acmo/core/components/snap-carousel.js +86 -0
- package/lib/commonjs/acmo/core/components/snap-carousel.js.map +1 -0
- package/lib/commonjs/acmo/core/constants/api-endpoints.js +18 -0
- package/lib/commonjs/acmo/core/constants/api-endpoints.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/colors.js +20 -0
- package/lib/commonjs/acmo/core/helpers/colors.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/logger.js +18 -0
- package/lib/commonjs/acmo/core/helpers/logger.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/patches.js +7 -0
- package/lib/commonjs/acmo/core/helpers/patches.js.map +1 -0
- package/lib/commonjs/acmo/core/network/http-client.js +91 -0
- package/lib/commonjs/acmo/core/network/http-client.js.map +1 -0
- package/lib/commonjs/acmo/core/network/network-common.js +111 -0
- package/lib/commonjs/acmo/core/network/network-common.js.map +1 -0
- package/lib/commonjs/acmo/core/services/localization_service.js +7 -13
- package/lib/commonjs/acmo/core/services/localization_service.js.map +1 -1
- package/lib/commonjs/acmo/core/types/activated-campaings.d.js +2 -0
- package/lib/commonjs/acmo/core/types/activated-campaings.d.js.map +1 -0
- package/lib/commonjs/acmo/core/tyrads-sdk-core.js +203 -0
- package/lib/commonjs/acmo/core/tyrads-sdk-core.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/gradient_card.js +98 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/gradient_card.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/modal-wrapper.js +55 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/modal-wrapper.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/controller.js +141 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/controller.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js +183 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-host.js +37 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-host.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-manager.js +39 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-manager.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js +206 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js +155 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/repository.js +52 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/repository.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/tyrads-global-host.js +37 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/tyrads-global-host.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/active_offers_button.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_card.js +1 -2
- package/lib/commonjs/acmo/modules/premium-widgets/components/custom_card.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.js +20 -11
- package/lib/commonjs/acmo/modules/premium-widgets/components/custom_scroller.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/custom_shimmer.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/offer_card.js +12 -12
- package/lib/commonjs/acmo/modules/premium-widgets/components/offer_card.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.js +3 -3
- package/lib/commonjs/acmo/modules/premium-widgets/components/offer_list_item.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/premium_empty_widget.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/premium_header.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.js +3 -3
- package/lib/commonjs/acmo/modules/premium-widgets/components/premium_loading.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/controller.js +30 -0
- package/lib/commonjs/acmo/modules/premium-widgets/controller.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard/top_offers.js → premium-widgets/premium_offers_widget.js} +67 -30
- package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js +49 -0
- package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/repository.js +103 -0
- package/lib/commonjs/acmo/modules/premium-widgets/repository.js.map +1 -0
- package/lib/commonjs/acmo/modules/push-notifications/apns-manager.js +227 -0
- package/lib/commonjs/acmo/modules/push-notifications/apns-manager.js.map +1 -0
- package/lib/commonjs/acmo/modules/push-notifications/fcm-manager.js +148 -0
- package/lib/commonjs/acmo/modules/push-notifications/fcm-manager.js.map +1 -0
- package/lib/commonjs/acmo_config.js +6 -5
- package/lib/commonjs/acmo_config.js.map +1 -1
- package/lib/commonjs/assets/images/alarm-clock.png +0 -0
- package/lib/commonjs/assets/images/circle-x.png +0 -0
- package/lib/commonjs/assets/images/coin.png +0 -0
- package/lib/commonjs/index.js +33 -106
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/acmo/core/components/countdown-timer.js +42 -0
- package/lib/module/acmo/core/components/countdown-timer.js.map +1 -0
- package/lib/module/acmo/core/components/snap-carousel.js +81 -0
- package/lib/module/acmo/core/components/snap-carousel.js.map +1 -0
- package/lib/module/acmo/core/constants/api-endpoints.js +14 -0
- package/lib/module/acmo/core/constants/api-endpoints.js.map +1 -0
- package/lib/module/acmo/core/helpers/colors.js +15 -0
- package/lib/module/acmo/core/helpers/colors.js.map +1 -0
- package/lib/module/acmo/core/helpers/logger.js +14 -0
- package/lib/module/acmo/core/helpers/logger.js.map +1 -0
- package/lib/module/acmo/core/helpers/patches.js +7 -0
- package/lib/module/acmo/core/helpers/patches.js.map +1 -0
- package/lib/module/acmo/core/network/http-client.js +86 -0
- package/lib/module/acmo/core/network/http-client.js.map +1 -0
- package/lib/module/acmo/core/network/network-common.js +106 -0
- package/lib/module/acmo/core/network/network-common.js.map +1 -0
- package/lib/module/acmo/core/services/localization_service.js +7 -13
- package/lib/module/acmo/core/services/localization_service.js.map +1 -1
- package/lib/module/acmo/core/types/activated-campaings.d.js +2 -0
- package/lib/module/acmo/core/types/activated-campaings.d.js.map +1 -0
- package/lib/module/acmo/core/tyrads-sdk-core.js +197 -0
- package/lib/module/acmo/core/tyrads-sdk-core.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/components/gradient_card.js +92 -0
- package/lib/module/acmo/modules/inapp-notifications/components/gradient_card.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/components/modal-wrapper.js +49 -0
- package/lib/module/acmo/modules/inapp-notifications/components/modal-wrapper.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/controller.js +136 -0
- package/lib/module/acmo/modules/inapp-notifications/controller.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js +176 -0
- package/lib/module/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-host.js +32 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-host.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-manager.js +35 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-manager.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js +200 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js +149 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/repository.js +47 -0
- package/lib/module/acmo/modules/inapp-notifications/repository.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/tyrads-global-host.js +32 -0
- package/lib/module/acmo/modules/inapp-notifications/tyrads-global-host.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/active_offers_button.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_card.js +1 -2
- package/lib/module/acmo/modules/premium-widgets/components/custom_card.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.js +20 -11
- package/lib/module/acmo/modules/premium-widgets/components/custom_scroller.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/custom_shimmer.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/offer_card.js +12 -12
- package/lib/module/acmo/modules/premium-widgets/components/offer_card.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.js +3 -3
- package/lib/module/acmo/modules/premium-widgets/components/offer_list_item.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/premium_empty_widget.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/premium_header.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.js +1 -1
- package/lib/module/acmo/modules/premium-widgets/components/premium_loading.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/controller.js +25 -0
- package/lib/module/acmo/modules/premium-widgets/controller.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard/top_offers.js → premium-widgets/premium_offers_widget.js} +69 -32
- package/lib/module/acmo/modules/premium-widgets/premium_offers_widget.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js +41 -0
- package/lib/module/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/repository.js +98 -0
- package/lib/module/acmo/modules/premium-widgets/repository.js.map +1 -0
- package/lib/module/acmo/modules/push-notifications/apns-manager.js +222 -0
- package/lib/module/acmo/modules/push-notifications/apns-manager.js.map +1 -0
- package/lib/module/acmo/modules/push-notifications/fcm-manager.js +143 -0
- package/lib/module/acmo/modules/push-notifications/fcm-manager.js.map +1 -0
- package/lib/module/acmo_config.js +6 -5
- package/lib/module/acmo_config.js.map +1 -1
- package/lib/module/assets/images/alarm-clock.png +0 -0
- package/lib/module/assets/images/circle-x.png +0 -0
- package/lib/module/assets/images/coin.png +0 -0
- package/lib/module/index.js +16 -106
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/components/countdown-timer.d.ts +8 -0
- package/lib/typescript/commonjs/src/acmo/core/components/countdown-timer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/components/snap-carousel.d.ts +26 -0
- package/lib/typescript/commonjs/src/acmo/core/components/snap-carousel.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/constants/api-endpoints.d.ts +12 -0
- package/lib/typescript/commonjs/src/acmo/core/constants/api-endpoints.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/colors.d.ts +2 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/logger.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/network/http-client.d.ts +28 -0
- package/lib/typescript/commonjs/src/acmo/core/network/http-client.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/network/network-common.d.ts +13 -0
- package/lib/typescript/commonjs/src/acmo/core/network/network-common.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts +0 -1
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/types/external_types.d.ts +5 -0
- package/lib/typescript/commonjs/src/acmo/core/types/external_types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/tyrads-sdk-core.d.ts +46 -0
- package/lib/typescript/commonjs/src/acmo/core/tyrads-sdk-core.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts +17 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts +10 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/controller.d.ts +22 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts +7 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts +14 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts +4 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts +7 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/repository.d.ts +8 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/repository.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/active_offers_button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_card.d.ts.map +1 -0
- package/lib/typescript/{module/src/acmo/modules/dashboard → commonjs/src/acmo/modules/premium-widgets}/components/custom_scroller.d.ts +3 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_scroller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_shimmer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/offer_card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/offer_list_item.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_empty_widget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_header.d.ts.map +1 -0
- package/lib/typescript/{module/src/acmo/modules/dashboard → commonjs/src/acmo/modules/premium-widgets}/components/premium_loading.d.ts +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_loading.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/controller.d.ts +14 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/{dashboard/top_offers.d.ts → premium-widgets/premium_offers_widget.d.ts} +3 -3
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts +9 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/repository.d.ts +13 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/repository.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/apns-manager.d.ts +40 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/apns-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/fcm-manager.d.ts +32 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/fcm-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo_config.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo_config.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +5 -11
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/components/countdown-timer.d.ts +8 -0
- package/lib/typescript/module/src/acmo/core/components/countdown-timer.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/components/snap-carousel.d.ts +26 -0
- package/lib/typescript/module/src/acmo/core/components/snap-carousel.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/constants/api-endpoints.d.ts +12 -0
- package/lib/typescript/module/src/acmo/core/constants/api-endpoints.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/helpers/colors.d.ts +2 -0
- package/lib/typescript/module/src/acmo/core/helpers/colors.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/helpers/logger.d.ts +6 -0
- package/lib/typescript/module/src/acmo/core/helpers/logger.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/network/http-client.d.ts +28 -0
- package/lib/typescript/module/src/acmo/core/network/http-client.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/network/network-common.d.ts +13 -0
- package/lib/typescript/module/src/acmo/core/network/network-common.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts +0 -1
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/types/external_types.d.ts +5 -0
- package/lib/typescript/module/src/acmo/core/types/external_types.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/tyrads-sdk-core.d.ts +46 -0
- package/lib/typescript/module/src/acmo/core/tyrads-sdk-core.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts +17 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts +10 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/controller.d.ts +22 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/controller.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts +6 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts +7 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts +14 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts +4 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts +7 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/repository.d.ts +8 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/repository.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts +6 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/active_offers_button.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_card.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src/acmo/modules/dashboard → module/src/acmo/modules/premium-widgets}/components/custom_scroller.d.ts +3 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_scroller.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_shimmer.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/offer_card.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/offer_list_item.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_empty_widget.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_header.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src/acmo/modules/dashboard → module/src/acmo/modules/premium-widgets}/components/premium_loading.d.ts +1 -1
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_loading.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/controller.d.ts +14 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/controller.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/{dashboard/top_offers.d.ts → premium-widgets/premium_offers_widget.d.ts} +3 -3
- package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts +9 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/repository.d.ts +13 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/repository.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/apns-manager.d.ts +40 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/apns-manager.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/fcm-manager.d.ts +32 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/fcm-manager.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo_config.d.ts +1 -0
- package/lib/typescript/module/src/acmo_config.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +5 -11
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +5 -3
- package/readme.md +27 -14
- package/src/acmo/core/components/countdown-timer.tsx +52 -0
- package/src/acmo/core/components/snap-carousel.tsx +106 -0
- package/src/acmo/core/constants/api-endpoints.ts +12 -0
- package/src/acmo/core/helpers/colors.ts +16 -0
- package/src/acmo/core/helpers/logger.ts +11 -0
- package/src/acmo/core/helpers/patches.js +6 -0
- package/src/acmo/core/network/http-client.ts +89 -0
- package/src/acmo/core/network/network-common.ts +128 -0
- package/src/acmo/core/services/localization_service.ts +7 -14
- package/src/acmo/core/types/activated-campaings.d.ts +101 -0
- package/src/acmo/core/types/external_types.ts +7 -1
- package/src/acmo/core/types/types.d.ts +112 -76
- package/src/acmo/core/tyrads-sdk-core.tsx +256 -0
- package/src/acmo/modules/inapp-notifications/components/gradient_card.tsx +87 -0
- package/src/acmo/modules/inapp-notifications/components/modal-wrapper.tsx +59 -0
- package/src/acmo/modules/inapp-notifications/controller.ts +183 -0
- package/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.tsx +164 -0
- package/src/acmo/modules/inapp-notifications/inapp-notification-host.tsx +32 -0
- package/src/acmo/modules/inapp-notifications/inapp-notification-manager.ts +40 -0
- package/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.tsx +188 -0
- package/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.tsx +149 -0
- package/src/acmo/modules/inapp-notifications/repository.ts +49 -0
- package/src/acmo/modules/inapp-notifications/tyrads-global-host.tsx +25 -0
- package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.tsx +1 -2
- package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.tsx +24 -10
- package/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.tsx +11 -11
- package/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.tsx +3 -3
- package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.tsx +1 -1
- package/src/acmo/modules/premium-widgets/controller.ts +39 -0
- package/src/acmo/modules/{dashboard/top_offers.tsx → premium-widgets/premium_offers_widget.tsx} +67 -45
- package/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.tsx +39 -0
- package/src/acmo/modules/premium-widgets/repository.ts +107 -0
- package/src/acmo/modules/push-notifications/apns-manager.ts +254 -0
- package/src/acmo/modules/push-notifications/fcm-manager.ts +162 -0
- package/src/acmo_config.ts +6 -5
- package/src/assets/images/alarm-clock.png +0 -0
- package/src/assets/images/circle-x.png +0 -0
- package/src/assets/images/coin.png +0 -0
- package/src/index.tsx +19 -127
- package/ios/Tyrads/user/AcmoUserUpdatePage.swift +0 -302
- package/ios/Tyrads/user/AcmoUsersUpdateController.swift +0 -26
- package/ios/Tyrads/user/Repository.swift +0 -89
- package/lib/commonjs/acmo/core/helpers/native_methods.js +0 -48
- package/lib/commonjs/acmo/core/helpers/native_methods.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_shimmer.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/repository.js +0 -147
- package/lib/commonjs/acmo/modules/dashboard/repository.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +0 -1
- package/lib/module/acmo/core/helpers/native_methods.js +0 -44
- package/lib/module/acmo/core/helpers/native_methods.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/active_offers_button.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/custom_scroller.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/offer_card.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/offer_list_item.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_loading.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/repository.js +0 -140
- package/lib/module/acmo/modules/dashboard/repository.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/top_offers.js.map +0 -1
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts +0 -10
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_card.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts +0 -3
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts +0 -10
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_card.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts +0 -3
- package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +0 -1
- package/src/acmo/core/helpers/native_methods.ts +0 -59
- package/src/acmo/modules/dashboard/repository.ts +0 -170
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.js +0 -0
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.js +0 -0
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.js +0 -0
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_header.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_header.js +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.d.ts +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.tsx +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.tsx +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.tsx +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.tsx +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { http } from "../../core/network/http-client.js";
|
|
4
|
+
import { acmoLaunchURLForce } from "../../core/helpers/launcher.js";
|
|
5
|
+
import AcmoAPIEndpoints from "../../core/constants/api-endpoints.js";
|
|
6
|
+
import TyradsSdkCore from "../../core/tyrads-sdk-core.js";
|
|
7
|
+
import { Logger } from "../../core/helpers/logger.js";
|
|
8
|
+
class PremiumWidgetsRepository {
|
|
9
|
+
constructor() {}
|
|
10
|
+
static getInstance() {
|
|
11
|
+
if (!PremiumWidgetsRepository.instance) {
|
|
12
|
+
PremiumWidgetsRepository.instance = new PremiumWidgetsRepository();
|
|
13
|
+
}
|
|
14
|
+
return PremiumWidgetsRepository.instance;
|
|
15
|
+
}
|
|
16
|
+
async fetchTargetedCampaigns() {
|
|
17
|
+
const language = TyradsSdkCore.currentLanguage;
|
|
18
|
+
const {
|
|
19
|
+
status,
|
|
20
|
+
data
|
|
21
|
+
} = await http.get(`${AcmoAPIEndpoints.TARGETED_CAMPAIGNS}?lang=${language}`);
|
|
22
|
+
if (status !== 200) {
|
|
23
|
+
throw new Error('Failed to fetch targeted campaigns');
|
|
24
|
+
}
|
|
25
|
+
const campaigns = data.data;
|
|
26
|
+
const hotOffers = campaigns.sort((a, b) => {
|
|
27
|
+
if (a.campaignPremium && !b.campaignPremium) return -1;
|
|
28
|
+
if (!a.campaignPremium && b.campaignPremium) return 1;
|
|
29
|
+
return 0;
|
|
30
|
+
}).slice(0, 5);
|
|
31
|
+
return hotOffers;
|
|
32
|
+
}
|
|
33
|
+
async fetchCurrencySales() {
|
|
34
|
+
const language = TyradsSdkCore.currentLanguage;
|
|
35
|
+
const {
|
|
36
|
+
status,
|
|
37
|
+
data
|
|
38
|
+
} = await http.get(`${AcmoAPIEndpoints.ENGAGEMENT}?lang=${language}`);
|
|
39
|
+
if (status !== 200) {
|
|
40
|
+
throw new Error('Failed to fetch currency sales');
|
|
41
|
+
}
|
|
42
|
+
return data.data.CurrencySales;
|
|
43
|
+
}
|
|
44
|
+
async fetchSummary() {
|
|
45
|
+
const language = TyradsSdkCore.currentLanguage;
|
|
46
|
+
const {
|
|
47
|
+
status,
|
|
48
|
+
data
|
|
49
|
+
} = await http.get(`${AcmoAPIEndpoints.SUMMARY}?lang=${language}`);
|
|
50
|
+
if (status !== 200) {
|
|
51
|
+
throw new Error('Failed to fetch summary');
|
|
52
|
+
}
|
|
53
|
+
return data.data.activeCampaignCount;
|
|
54
|
+
}
|
|
55
|
+
async track(activity) {
|
|
56
|
+
const {
|
|
57
|
+
status
|
|
58
|
+
} = await http.post(AcmoAPIEndpoints.USER_ACTIVITIES, {
|
|
59
|
+
activity
|
|
60
|
+
});
|
|
61
|
+
if (status !== 200) {
|
|
62
|
+
throw new Error('Failed to track activity');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async openOffer(campaign) {
|
|
66
|
+
const campaignId = campaign.campaignId;
|
|
67
|
+
const clickUrl = campaign.tracking.clickUrl;
|
|
68
|
+
const isRetryDownload = campaign.validity.isRetryDownload;
|
|
69
|
+
const isInstalled = campaign.validity.isInstalled;
|
|
70
|
+
const previewUrl = campaign.app.previewUrl;
|
|
71
|
+
const s2sClickUrl = campaign.tracking.s2sClickUrl;
|
|
72
|
+
try {
|
|
73
|
+
let url = clickUrl || "";
|
|
74
|
+
if (isInstalled) {
|
|
75
|
+
url = previewUrl;
|
|
76
|
+
} else {
|
|
77
|
+
if (isRetryDownload) {
|
|
78
|
+
await this.track("CampaignActivatedRetry");
|
|
79
|
+
} else {
|
|
80
|
+
await this.track("CampaignActivated");
|
|
81
|
+
}
|
|
82
|
+
await http.post(AcmoAPIEndpoints.ACTIVATE_CAMPAIGN(campaignId), {}, {});
|
|
83
|
+
}
|
|
84
|
+
if (s2sClickUrl != null) {
|
|
85
|
+
const res = await http.get(s2sClickUrl);
|
|
86
|
+
if (res.status == 200) {
|
|
87
|
+
// url = res.data.url;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
await acmoLaunchURLForce(url);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
Logger.error(error);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export default PremiumWidgetsRepository.getInstance();
|
|
98
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["http","acmoLaunchURLForce","AcmoAPIEndpoints","TyradsSdkCore","Logger","PremiumWidgetsRepository","constructor","getInstance","instance","fetchTargetedCampaigns","language","currentLanguage","status","data","get","TARGETED_CAMPAIGNS","Error","campaigns","hotOffers","sort","a","b","campaignPremium","slice","fetchCurrencySales","ENGAGEMENT","CurrencySales","fetchSummary","SUMMARY","activeCampaignCount","track","activity","post","USER_ACTIVITIES","openOffer","campaign","campaignId","clickUrl","tracking","isRetryDownload","validity","isInstalled","previewUrl","app","s2sClickUrl","url","ACTIVATE_CAMPAIGN","res","error"],"sourceRoot":"../../../../../src","sources":["acmo/modules/premium-widgets/repository.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,mCAAgC;AACrD,SAASC,kBAAkB,QAAQ,gCAA6B;AAChE,OAAOC,gBAAgB,MAAM,uCAAoC;AACjE,OAAOC,aAAa,MAAM,+BAA4B;AACtD,SAASC,MAAM,QAAQ,8BAA2B;AAElD,MAAMC,wBAAwB,CAAC;EAErBC,WAAWA,CAAA,EAAG,CAAE;EACxB,OAAOC,WAAWA,CAAA,EAAG;IACnB,IAAI,CAACF,wBAAwB,CAACG,QAAQ,EAAE;MACtCH,wBAAwB,CA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AACgC,IAAI,CAAC9B,gBAAgB,CAAC4C,iBAAiB,CAACV,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;MACzE;MACA,IAAIQ,WAAW,IAAI,IAAI,EAAE;QACvB,MAAMG,GAAG,GAAG,MAAM/C,IAAI,CAACc,GAAG,CAAC8B,WAAW,CAAC;QACvC,IAAIG,GAAG,CAACnC,MAAM,IAAI,GAAG,EAAE;UACrB;UACA;QACF;MACF;MACA,MAAMX,kBAAkB,CAAC4C,GAAG,CAAC;IAC/B,CAAC,CAAC,OAAOG,KAAK,EAAE;MACd5C,MAAM,CAAC4C,KAAK,CAACA,KAAK,CAAC;IACrB;EACF;AACF;AAEA,eAAe3C,wBAAwB,CAACE,WAAW,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import TyradsSdkCoreMethods from "../../core/tyrads-sdk-core.js";
|
|
5
|
+
class ApnsManager {
|
|
6
|
+
tokenFetched = false;
|
|
7
|
+
pushEventSubscriptions = [];
|
|
8
|
+
initialized = false;
|
|
9
|
+
isLoggedIn = false;
|
|
10
|
+
pendingEvent = null;
|
|
11
|
+
constructor() {}
|
|
12
|
+
static getInstance() {
|
|
13
|
+
if (!ApnsManager.instance) {
|
|
14
|
+
ApnsManager.instance = new ApnsManager();
|
|
15
|
+
}
|
|
16
|
+
return ApnsManager.instance;
|
|
17
|
+
}
|
|
18
|
+
setLoggedIn(status) {
|
|
19
|
+
this.isLoggedIn = status;
|
|
20
|
+
if (this.isLoggedIn && this.pendingEvent) {
|
|
21
|
+
const {
|
|
22
|
+
identifier,
|
|
23
|
+
userInfo
|
|
24
|
+
} = this.pendingEvent;
|
|
25
|
+
this.pendingEvent = null;
|
|
26
|
+
this._onNotificationClicked(identifier, userInfo);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async init() {
|
|
30
|
+
if (Platform.OS !== 'ios') {
|
|
31
|
+
console.log('APNs is only available on iOS');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (this.initialized) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
this._requestPushPermission();
|
|
39
|
+
this._fetchTokenSafely();
|
|
40
|
+
this._setupPushEventListeners();
|
|
41
|
+
this.initialized = true;
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Failed to initialize APNs manager:', error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async _fetchTokenSafely() {
|
|
47
|
+
if (this.tokenFetched) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const token = await this._fetchTokenWithRetry(3);
|
|
52
|
+
if (token) {
|
|
53
|
+
console.log('APNs token:', token);
|
|
54
|
+
this.tokenFetched = true;
|
|
55
|
+
this.emit('tokenFetched', token);
|
|
56
|
+
} else {
|
|
57
|
+
console.log('APNs token not available after retries');
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
console.log('APNs token fetch failed:', error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async _fetchTokenWithRetry(maxRetries) {
|
|
64
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
65
|
+
try {
|
|
66
|
+
console.log(`Fetching APNs token (attempt ${attempt}/${maxRetries})...`);
|
|
67
|
+
const token = await TyradsSdkCoreMethods.getApnsToken();
|
|
68
|
+
if (token && typeof token === 'string' && token.length > 0) {
|
|
69
|
+
return token;
|
|
70
|
+
}
|
|
71
|
+
if (attempt < maxRetries) {
|
|
72
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
73
|
+
}
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.log(`Attempt ${attempt} failed:`, error);
|
|
76
|
+
if (attempt < maxRetries) {
|
|
77
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
async _requestPushPermission() {
|
|
84
|
+
try {
|
|
85
|
+
const granted = await TyradsSdkCoreMethods.requestPushPermission();
|
|
86
|
+
console.log('Push permission granted:', granted);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
console.error('Error requesting push permission:', error);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
_setupPushEventListeners() {
|
|
92
|
+
const subscription = TyradsSdkCoreMethods.addPushNotificationListener(event => {
|
|
93
|
+
console.log('Push event:', event);
|
|
94
|
+
const eventParsed = typeof event === 'string' ? JSON.parse(event) : event;
|
|
95
|
+
this._handlePushEvent(eventParsed);
|
|
96
|
+
});
|
|
97
|
+
this.pushEventSubscriptions.push(subscription);
|
|
98
|
+
}
|
|
99
|
+
_handlePushEvent(event) {
|
|
100
|
+
switch (event.type) {
|
|
101
|
+
case 'received':
|
|
102
|
+
this._onNotificationReceived(event.data);
|
|
103
|
+
break;
|
|
104
|
+
case 'clicked':
|
|
105
|
+
this._onNotificationClicked(event.id, event.data);
|
|
106
|
+
break;
|
|
107
|
+
case 'dismissed':
|
|
108
|
+
this._onNotificationDismissed(event.id);
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
_onNotificationReceived(userInfo) {
|
|
113
|
+
console.log('Notification received:', userInfo);
|
|
114
|
+
this.emit('notificationReceived', userInfo);
|
|
115
|
+
}
|
|
116
|
+
async _onNotificationClicked(identifier, userInfo) {
|
|
117
|
+
console.log('Notification clicked:', identifier, userInfo);
|
|
118
|
+
const deepLink = userInfo['deepLink'];
|
|
119
|
+
if (!this.isLoggedIn && deepLink) {
|
|
120
|
+
console.log('Notification clicked (iOS) but user not logged in. Queueing navigation.');
|
|
121
|
+
this.pendingEvent = {
|
|
122
|
+
identifier,
|
|
123
|
+
userInfo
|
|
124
|
+
};
|
|
125
|
+
this.emit('notificationClicked', {
|
|
126
|
+
identifier,
|
|
127
|
+
userInfo
|
|
128
|
+
});
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.emit('notificationClicked', {
|
|
132
|
+
identifier,
|
|
133
|
+
userInfo
|
|
134
|
+
});
|
|
135
|
+
if (deepLink != null && deepLink != '') {
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
TyradsSdkCoreMethods.showOffers({
|
|
138
|
+
route: deepLink,
|
|
139
|
+
launchMode: 2
|
|
140
|
+
}).catch(err => {
|
|
141
|
+
console.error('Failed to show offers from notification click (iOS):', err);
|
|
142
|
+
});
|
|
143
|
+
}, 500);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
_onNotificationDismissed(identifier) {
|
|
147
|
+
console.log('Notification dismissed:', identifier);
|
|
148
|
+
this.emit('notificationDismissed', identifier);
|
|
149
|
+
}
|
|
150
|
+
listeners = new Map();
|
|
151
|
+
on(event, callback) {
|
|
152
|
+
if (!this.listeners.has(event)) {
|
|
153
|
+
this.listeners.set(event, []);
|
|
154
|
+
}
|
|
155
|
+
this.listeners.get(event).push(callback);
|
|
156
|
+
}
|
|
157
|
+
off(event, callback) {
|
|
158
|
+
const callbacks = this.listeners.get(event);
|
|
159
|
+
if (callbacks) {
|
|
160
|
+
const index = callbacks.indexOf(callback);
|
|
161
|
+
if (index > -1) {
|
|
162
|
+
callbacks.splice(index, 1);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
emit(event, data) {
|
|
167
|
+
const callbacks = this.listeners.get(event);
|
|
168
|
+
if (callbacks) {
|
|
169
|
+
callbacks.forEach(callback => {
|
|
170
|
+
try {
|
|
171
|
+
callback(data);
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.error(`Error in ${event} listener:`, error);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async fetchToken() {
|
|
179
|
+
try {
|
|
180
|
+
const token = await TyradsSdkCoreMethods.getApnsToken();
|
|
181
|
+
if (token) {
|
|
182
|
+
this.tokenFetched = true;
|
|
183
|
+
console.log('Manually fetched APNs token:', token);
|
|
184
|
+
}
|
|
185
|
+
return token;
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.error('Error fetching token:', error);
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async requestPermission() {
|
|
192
|
+
try {
|
|
193
|
+
return await TyradsSdkCoreMethods.requestPushPermission();
|
|
194
|
+
} catch (error) {
|
|
195
|
+
console.error('Error requesting permission:', error);
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
addPushEventHandler(callback) {
|
|
200
|
+
return TyradsSdkCoreMethods.addPushNotificationListener(callback);
|
|
201
|
+
}
|
|
202
|
+
dispose() {
|
|
203
|
+
this.pushEventSubscriptions.forEach(subscription => {
|
|
204
|
+
subscription.remove();
|
|
205
|
+
});
|
|
206
|
+
this.pushEventSubscriptions = [];
|
|
207
|
+
this.listeners.clear();
|
|
208
|
+
this.initialized = false;
|
|
209
|
+
}
|
|
210
|
+
isTokenFetched() {
|
|
211
|
+
return this.tokenFetched;
|
|
212
|
+
}
|
|
213
|
+
async getCurrentToken() {
|
|
214
|
+
if (!this.tokenFetched) {
|
|
215
|
+
return await this.fetchToken();
|
|
216
|
+
}
|
|
217
|
+
return await TyradsSdkCoreMethods.getApnsToken();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
export default ApnsManager.getInstance();
|
|
221
|
+
export { ApnsManager };
|
|
222
|
+
//# sourceMappingURL=apns-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","TyradsSdkCoreMethods","ApnsManager","tokenFetched","pushEventSubscriptions","initialized","isLoggedIn","pendingEvent","constructor","getInstance","instance","setLoggedIn","status","identifier","userInfo","_onNotificationClicked","init","OS","console","log","_requestPushPermission","_fetchTokenSafely","_setupPushEventListeners","error","token","_fetchTokenWithRetry","emit","maxRetries","attempt","getApnsToken","length","Promise","resolve","setTimeout","granted","requestPushPermission","subscription","addPushNotificationListener","event","eventParsed","JSON","parse","_handlePushEvent","push","type","_onNotificationReceived","data","id","_onNotificationDismissed","deepLink","showOffers","route","launchMode","catch","err","listeners","Map","on","callback","has","set","get","off","callbacks","index","indexOf","splice","forEach","fetchToken","requestPermission","addPushEventHandler","dispose","remove","clear","isTokenFetched","getCurrentToken"],"sourceRoot":"../../../../../src","sources":["acmo/modules/push-notifications/apns-manager.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,oBAAoB,MAAM,+BAA4B;AAU7D,MAAMC,WAAW,CAAC;EAERC,YAAY,GAAY,KAAK;EAC7BC,sBAAsB,GAAU,EAAE;EAElCC,WAAW,GAAG,KAAK;EACnBC,UAAU,GAAG,KAAK;EAClBC,YAAY,GAAiD,IAAI;EAEjEC,WAAWA,CAAA,EAAG,CAAE;EAExB,OAAOC,WAAWA,CAAA,EAAgB;IAChC,IAAI,CAACP,WAAW,CAACQ,QAAQ,EAAE;MACzBR,WAAW,CAACQ,QAAQ,GAAG,IAAIR,WAAW,CAAC,CAAC;IAC1C;IACA,OAAOA,WAAW,CAACQ,QAAQ;EAC7B;EAEAC,WAAWA,CAACC,MAAe,EAAQ;IACjC,IAAI,CAACN,UAAU,GAAGM,MAAM;IACxB,IAAI,IAAI,CAACN,UAAU,IAAI,IAAI,CAACC,YAAY,EAAE;MACxC,MAAM;QAAEM,UAAU;QAAEC;MAAS,CAAC,GAAG,IAAI,CAACP,YAAY;MAClD,IAAI,CAACA,YAAY,GAAG,IAAI;MACxB,IAAI,CAACQ,sBAAsB,CAACF,UAAU,EAAEC,QAAQ,CAAC;IACnD;EACF;EAEA,MAAME,IAAIA,CAAA,EAAkB;IAC1B,IAAIhB,QAAQ,CAACiB,EAAE,KAAK,KAAK,EAAE;MACzBC,OAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC;MAC5C;IACF;IAEA,IAAI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AC;EAClD;AACF;AAEA,eAAe3B,WAAW,CAACO,WAAW,CAAC,CAAC;AAExC,SAASP,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import TyradsSdkCoreMethods from "../../core/tyrads-sdk-core.js";
|
|
5
|
+
class FcmManager {
|
|
6
|
+
pushEventSubscriptions = [];
|
|
7
|
+
initialized = false;
|
|
8
|
+
isLoggedIn = false;
|
|
9
|
+
pendingEvent = null;
|
|
10
|
+
constructor() {}
|
|
11
|
+
static getInstance() {
|
|
12
|
+
if (!FcmManager.instance) {
|
|
13
|
+
FcmManager.instance = new FcmManager();
|
|
14
|
+
}
|
|
15
|
+
return FcmManager.instance;
|
|
16
|
+
}
|
|
17
|
+
setLoggedIn(status) {
|
|
18
|
+
this.isLoggedIn = status;
|
|
19
|
+
if (this.isLoggedIn && this.pendingEvent) {
|
|
20
|
+
const {
|
|
21
|
+
identifier,
|
|
22
|
+
userInfo
|
|
23
|
+
} = this.pendingEvent;
|
|
24
|
+
this.pendingEvent = null;
|
|
25
|
+
this._onNotificationClicked(identifier, userInfo);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async init() {
|
|
29
|
+
if (Platform.OS !== 'android') {
|
|
30
|
+
console.log('FCM is only available on Android');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (this.initialized) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
this._setupPushEventListeners();
|
|
38
|
+
this.initialized = true;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error('Failed to initialize FCM manager:', error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
_setupPushEventListeners() {
|
|
44
|
+
const subscription = TyradsSdkCoreMethods.addPushNotificationListener(event => {
|
|
45
|
+
console.log('Push event:', event);
|
|
46
|
+
const eventParsed = typeof event === 'string' ? JSON.parse(event) : event;
|
|
47
|
+
this._handlePushEvent(eventParsed);
|
|
48
|
+
});
|
|
49
|
+
this.pushEventSubscriptions.push(subscription);
|
|
50
|
+
}
|
|
51
|
+
_handlePushEvent(event) {
|
|
52
|
+
switch (event.type) {
|
|
53
|
+
case 'received':
|
|
54
|
+
this._onNotificationReceived(event.data);
|
|
55
|
+
break;
|
|
56
|
+
case 'clicked':
|
|
57
|
+
this._onNotificationClicked(event.id, event.data);
|
|
58
|
+
break;
|
|
59
|
+
case 'dismissed':
|
|
60
|
+
this._onNotificationDismissed(event.id);
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_onNotificationReceived(userInfo) {
|
|
65
|
+
console.log('Notification received:', userInfo);
|
|
66
|
+
this.emit('notificationReceived', userInfo);
|
|
67
|
+
}
|
|
68
|
+
async _onNotificationClicked(identifier, userInfo) {
|
|
69
|
+
console.log('Notification clicked:', identifier, userInfo);
|
|
70
|
+
const deepLink = userInfo['deepLink'];
|
|
71
|
+
if (!this.isLoggedIn && deepLink) {
|
|
72
|
+
this.pendingEvent = {
|
|
73
|
+
identifier,
|
|
74
|
+
userInfo
|
|
75
|
+
};
|
|
76
|
+
this.emit('notificationClicked', {
|
|
77
|
+
identifier,
|
|
78
|
+
userInfo
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.emit('notificationClicked', {
|
|
83
|
+
identifier,
|
|
84
|
+
userInfo
|
|
85
|
+
});
|
|
86
|
+
if (deepLink != null && deepLink != '') {
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
TyradsSdkCoreMethods.showOffers({
|
|
89
|
+
route: deepLink,
|
|
90
|
+
launchMode: 2
|
|
91
|
+
}).catch(err => {
|
|
92
|
+
console.error('Failed to show offers from notification click:', err);
|
|
93
|
+
});
|
|
94
|
+
}, 500);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
_onNotificationDismissed(identifier) {
|
|
98
|
+
console.log('Notification dismissed:', identifier);
|
|
99
|
+
this.emit('notificationDismissed', identifier);
|
|
100
|
+
}
|
|
101
|
+
listeners = new Map();
|
|
102
|
+
on(event, callback) {
|
|
103
|
+
if (!this.listeners.has(event)) {
|
|
104
|
+
this.listeners.set(event, []);
|
|
105
|
+
}
|
|
106
|
+
this.listeners.get(event).push(callback);
|
|
107
|
+
}
|
|
108
|
+
off(event, callback) {
|
|
109
|
+
const callbacks = this.listeners.get(event);
|
|
110
|
+
if (callbacks) {
|
|
111
|
+
const index = callbacks.indexOf(callback);
|
|
112
|
+
if (index > -1) {
|
|
113
|
+
callbacks.splice(index, 1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
emit(event, data) {
|
|
118
|
+
const callbacks = this.listeners.get(event);
|
|
119
|
+
if (callbacks) {
|
|
120
|
+
callbacks.forEach(callback => {
|
|
121
|
+
try {
|
|
122
|
+
callback(data);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error(`Error in ${event} listener:`, error);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
addPushEventHandler(callback) {
|
|
130
|
+
return TyradsSdkCoreMethods.addPushNotificationListener(callback);
|
|
131
|
+
}
|
|
132
|
+
dispose() {
|
|
133
|
+
this.pushEventSubscriptions.forEach(subscription => {
|
|
134
|
+
subscription.remove();
|
|
135
|
+
});
|
|
136
|
+
this.pushEventSubscriptions = [];
|
|
137
|
+
this.listeners.clear();
|
|
138
|
+
this.initialized = false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export default FcmManager.getInstance();
|
|
142
|
+
export { FcmManager };
|
|
143
|
+
//# sourceMappingURL=fcm-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","TyradsSdkCoreMethods","FcmManager","pushEventSubscriptions","initialized","isLoggedIn","pendingEvent","constructor","getInstance","instance","setLoggedIn","status","identifier","userInfo","_onNotificationClicked","init","OS","console","log","_setupPushEventListeners","error","subscription","addPushNotificationListener","event","eventParsed","JSON","parse","_handlePushEvent","push","type","_onNotificationReceived","data","id","_onNotificationDismissed","emit","deepLink","setTimeout","showOffers","route","launchMode","catch","err","listeners","Map","on","callback","has","set","get","off","callbacks","index","indexOf","splice","forEach","addPushEventHandler","dispose","remove","clear"],"sourceRoot":"../../../../../src","sources":["acmo/modules/push-notifications/fcm-manager.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,oBAAoB,MAAM,+BAA4B;AAU7D,MAAMC,UAAU,CAAC;EAEPC,sBAAsB,GAAU,EAAE;EAElCC,WAAW,GAAG,KAAK;EACnBC,UAAU,GAAG,KAAK;EAClBC,YAAY,GAAiD,IAAI;EAEjEC,WAAWA,CAAA,EAAG,CAAE;EAExB,OAAOC,WAAWA,CAAA,EAAe;IAC/B,IAAI,CAACN,UAAU,CAACO,QAAQ,EAAE;MACxBP,UAAU,CAACO,QAAQ,GAAG,IAAIP,UAAU,CAAC,CAAC;IACxC;IACA,OAAOA,UAAU,CAACO,QAAQ;EAC5B;EAEAC,WAAWA,CAACC,MAAe,EAAQ;IACjC,IAAI,CAACN,UAAU,GAAGM,MAAM;IACxB,IAAI,IAAI,CAACN,UAAU,IAAI,IAAI,CAACC,YAAY,EAAE;MACxC,MAAM;QAAEM,UAAU;QAAEC;MAAS,CAAC,GAAG,IAAI,CAACP,YAAY;MAClD,IAAI,CAACA,YAAY,GAAG,IAAI;MACxB,IAAI,CAACQ,sBAAsB,CAACF,UAAU,EAAEC,QAAQ,CAAC;IACnD;EACF;EAEA,MAAME,IAAIA,CAAA,EAAkB;IAC1B,IAAIf,QAAQ,CAACgB,EAAE,KAAK,SAAS,EAAE;MAC7BC,OAAO,CAACC,GAAG,CAAC,kCAAkC,CAAC;MAC/C;IACF;IAEA,IAAI,IAAI,CAACd,WAAW,EAAE;MACpB;IACF;IAEA,IAAI;MACF,IAAI,CAACe,wBAAwB,CA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|
6
|
-
static
|
|
7
|
-
static
|
|
8
|
-
static
|
|
4
|
+
static API_VERSION = "4.0";
|
|
5
|
+
static BASE_URL = `https://api.tyrads.com/v${this.API_VERSION}/`;
|
|
6
|
+
static MAJOR_VERSION = "4";
|
|
7
|
+
static MINOR_VERSION = "0";
|
|
8
|
+
static PATCH_VERSION = "0";
|
|
9
|
+
static BUILD_VERSION = "1";
|
|
9
10
|
static SDK_PLATFORM = "React Native";
|
|
10
11
|
static SDK_VERSION = `${this.MAJOR_VERSION}.${this.MINOR_VERSION}.${this.PATCH_VERSION}-${this.BUILD_VERSION}`;
|
|
11
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AcmoConfig","API_VERSION","MAJOR_VERSION","MINOR_VERSION","PATCH_VERSION","BUILD_VERSION","SDK_PLATFORM","SDK_VERSION"],"sourceRoot":"../../src","sources":["acmo_config.ts"],"mappings":";;AAAA,OAAO,MAAMA,UAAU,CAAC;EACtB,OAAcC,WAAW,GAAG,KAAK;EACjC,OAAcC,aAAa,GAAG,GAAG;EACjC,OAAcC,aAAa,GAAG,GAAG;EACjC,OAAcC,aAAa,GAAG,GAAG;EACjC,OAAcC,aAAa,GAAG,GAAG;EACjC,OAAcC,YAAY,GAAG,cAAc;EAC3C,OAAcC,WAAW,GAAG,GAAG,IAAI,CAACL,aAAa,IAAI,IAAI,CAACC,aAAa,IAAI,IAAI,CAACC,aAAa,IAAI,IAAI,CAACC,aAAa,EAAE;AACvH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["AcmoConfig","API_VERSION","BASE_URL","MAJOR_VERSION","MINOR_VERSION","PATCH_VERSION","BUILD_VERSION","SDK_PLATFORM","SDK_VERSION"],"sourceRoot":"../../src","sources":["acmo_config.ts"],"mappings":";;AAAA,OAAO,MAAMA,UAAU,CAAC;EACtB,OAAcC,WAAW,GAAG,KAAK;EACjC,OAAcC,QAAQ,GAAG,2BAA2B,IAAI,CAACD,WAAW,GAAG;EACvE,OAAcE,aAAa,GAAG,GAAG;EACjC,OAAcC,aAAa,GAAG,GAAG;EACjC,OAAcC,aAAa,GAAG,GAAG;EACjC,OAAcC,aAAa,GAAG,GAAG;EACjC,OAAcC,YAAY,GAAG,cAAc;EAC3C,OAAcC,WAAW,GAAG,GAAG,IAAI,CAACL,aAAa,IAAI,IAAI,CAACC,aAAa,IAAI,IAAI,CAACC,aAAa,IAAI,IAAI,CAACC,aAAa,EAAE;AACvH","ignoreList":[]}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/module/index.js
CHANGED
|
@@ -1,124 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import Localization from "./acmo/core/services/localization_service.js";
|
|
7
|
-
import { changeProviderLanguage, LocalizationProvider, updateProviderLanguage } from "./acmo/modules/localization/localization_context.js";
|
|
8
|
-
import PremiumWidgetsLoading from "./acmo/modules/dashboard/components/premium_loading.js";
|
|
9
|
-
import TyradsNativeMethods from "./acmo/core/helpers/native_methods.js";
|
|
3
|
+
import { AppRegistry } from 'react-native';
|
|
4
|
+
import TyradsSdkCore from "./acmo/core/tyrads-sdk-core.js";
|
|
5
|
+
import TyradsGlobalHost from "./acmo/modules/inapp-notifications/tyrads-global-host.js";
|
|
10
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
17
|
-
const TyradsSdk = NativeModules.TyradsSdk ? NativeModules.TyradsSdk : new Proxy({}, {
|
|
18
|
-
get() {
|
|
19
|
-
throw new Error(LINKING_ERROR);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const tyradsEmitter = new NativeEventEmitter(TyradsSdk);
|
|
23
|
-
let languageChangedSubscription = null;
|
|
7
|
+
AppRegistry.setWrapperComponentProvider(() => props => /*#__PURE__*/_jsx(TyradsGlobalHost, {
|
|
8
|
+
...props
|
|
9
|
+
}));
|
|
10
|
+
export { PremiumWidgetStyles } from "./acmo/modules/premium-widgets/premium_offers_widget.js";
|
|
11
|
+
export { PremiumOffersWidget, PremiumOffersWidgetLoading } from "./acmo/modules/premium-widgets/premium_offers_widget_wrapper.js";
|
|
24
12
|
const Tyrads = {
|
|
25
|
-
init: async (apiKey, apiSecret, encKey, engagementId, mediaSourceInfo, userInfo) => {
|
|
26
|
-
|
|
27
|
-
if (mediaSourceInfo) {
|
|
28
|
-
TyradsNativeMethods.setMediaSourceInfo(mediaSourceInfo);
|
|
29
|
-
}
|
|
30
|
-
if (userInfo) {
|
|
31
|
-
TyradsNativeMethods.setUserInfo(userInfo);
|
|
32
|
-
}
|
|
33
|
-
const data = await TyradsSdk.init(apiKey, apiSecret, encKey, engagementId);
|
|
34
|
-
await saveData("credentials", {
|
|
35
|
-
'X-API-Key': apiKey,
|
|
36
|
-
'X-API-Secret': apiSecret
|
|
37
|
-
});
|
|
38
|
-
let languageCode = "en";
|
|
39
|
-
try {
|
|
40
|
-
const parsed = typeof data === "string" ? JSON.parse(data) : data;
|
|
41
|
-
if (parsed?.languageCode) {
|
|
42
|
-
languageCode = parsed.languageCode;
|
|
43
|
-
}
|
|
44
|
-
} catch {}
|
|
45
|
-
TyradsSdk.startObserving();
|
|
46
|
-
languageChangedSubscription?.remove();
|
|
47
|
-
languageChangedSubscription = tyradsEmitter.addListener('LanguageChanged', async lang => {
|
|
48
|
-
console.log('LanguageChanged event from Android SDK:', lang);
|
|
49
|
-
await changeProviderLanguage(lang);
|
|
50
|
-
});
|
|
51
|
-
await saveData("language", languageCode);
|
|
52
|
-
await Localization.getInstance().init(languageCode);
|
|
53
|
-
await updateProviderLanguage(languageCode);
|
|
54
|
-
return data;
|
|
13
|
+
init: async (apiKey, apiSecret, encKey, engagementId, placementId, mediaSourceInfo, userInfo, config) => {
|
|
14
|
+
return await TyradsSdkCore.init(apiKey, apiSecret, encKey, engagementId, placementId, mediaSourceInfo, userInfo, config);
|
|
55
15
|
},
|
|
56
16
|
loginUser: async userId => {
|
|
57
|
-
|
|
58
|
-
const data = await TyradsSdk.loginUser(userId);
|
|
59
|
-
if (typeof data === "object") {
|
|
60
|
-
await saveData('apiHeaders', JSON.stringify(data));
|
|
61
|
-
await saveData('language', data.languageCode);
|
|
62
|
-
} else if (typeof data === "string") {
|
|
63
|
-
await saveData('apiHeaders', data);
|
|
64
|
-
await saveData('language', JSON.parse(data).languageCode);
|
|
65
|
-
}
|
|
66
|
-
return data;
|
|
67
|
-
} catch (err) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
17
|
+
return await TyradsSdkCore.loginUser(userId);
|
|
70
18
|
},
|
|
71
19
|
showOffers: async ({
|
|
72
20
|
launchMode = 3,
|
|
73
21
|
route,
|
|
74
22
|
campaignID
|
|
75
23
|
} = {}) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return await TyradsSdk.showOfferDetails(launchMode, route, campaignID);
|
|
81
|
-
} else {
|
|
82
|
-
if (campaignID == null) {
|
|
83
|
-
return await TyradsSdk.showOffers(route);
|
|
84
|
-
}
|
|
85
|
-
return await TyradsSdk.showOfferDetails(route, campaignID);
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
topPremiumOffers: ({
|
|
89
|
-
widgetStyle,
|
|
90
|
-
launchMode = 2
|
|
91
|
-
} = {}) => {
|
|
92
|
-
const handleNavigation = (route, campaignID) => {
|
|
93
|
-
Tyrads.showOffers({
|
|
94
|
-
route: route,
|
|
95
|
-
campaignID: campaignID,
|
|
96
|
-
launchMode: launchMode
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
return /*#__PURE__*/_jsx(LocalizationProvider, {
|
|
100
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
101
|
-
style: {
|
|
102
|
-
flex: 1,
|
|
103
|
-
justifyContent: 'center',
|
|
104
|
-
alignItems: 'center'
|
|
105
|
-
},
|
|
106
|
-
children: /*#__PURE__*/_jsx(TopOffers, {
|
|
107
|
-
widgetStyle: widgetStyle,
|
|
108
|
-
onNavigate: handleNavigation
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
});
|
|
112
|
-
},
|
|
113
|
-
topPremiumOffersLoading: ({
|
|
114
|
-
widgetStyle = PremiumWidgetStyles.list
|
|
115
|
-
}) => {
|
|
116
|
-
return /*#__PURE__*/_jsx(PremiumWidgetsLoading, {
|
|
117
|
-
widgetStyle: widgetStyle
|
|
24
|
+
return await TyradsSdkCore.showOffers({
|
|
25
|
+
launchMode,
|
|
26
|
+
route,
|
|
27
|
+
campaignID
|
|
118
28
|
});
|
|
119
29
|
},
|
|
120
30
|
changeLanguage: async lang => {
|
|
121
|
-
return await
|
|
31
|
+
return await TyradsSdkCore.changeLanguage(lang);
|
|
122
32
|
}
|
|
123
33
|
};
|
|
124
34
|
export default Tyrads;
|