@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,40 @@
|
|
|
1
|
+
export interface PushNotificationEvent {
|
|
2
|
+
type: 'received' | 'clicked' | 'dismissed';
|
|
3
|
+
id?: string;
|
|
4
|
+
data?: any;
|
|
5
|
+
}
|
|
6
|
+
export type PushEventCallback = (event: PushNotificationEvent) => void;
|
|
7
|
+
declare class ApnsManager {
|
|
8
|
+
private static instance;
|
|
9
|
+
private tokenFetched;
|
|
10
|
+
private pushEventSubscriptions;
|
|
11
|
+
private initialized;
|
|
12
|
+
private isLoggedIn;
|
|
13
|
+
private pendingEvent;
|
|
14
|
+
private constructor();
|
|
15
|
+
static getInstance(): ApnsManager;
|
|
16
|
+
setLoggedIn(status: boolean): void;
|
|
17
|
+
init(): Promise<void>;
|
|
18
|
+
private _fetchTokenSafely;
|
|
19
|
+
private _fetchTokenWithRetry;
|
|
20
|
+
private _requestPushPermission;
|
|
21
|
+
private _setupPushEventListeners;
|
|
22
|
+
private _handlePushEvent;
|
|
23
|
+
private _onNotificationReceived;
|
|
24
|
+
private _onNotificationClicked;
|
|
25
|
+
private _onNotificationDismissed;
|
|
26
|
+
private listeners;
|
|
27
|
+
on(event: string, callback: Function): void;
|
|
28
|
+
off(event: string, callback: Function): void;
|
|
29
|
+
private emit;
|
|
30
|
+
fetchToken(): Promise<string | null>;
|
|
31
|
+
requestPermission(): Promise<boolean>;
|
|
32
|
+
addPushEventHandler(callback: PushEventCallback): any;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
isTokenFetched(): boolean;
|
|
35
|
+
getCurrentToken(): Promise<string | null>;
|
|
36
|
+
}
|
|
37
|
+
declare const _default: ApnsManager;
|
|
38
|
+
export default _default;
|
|
39
|
+
export { ApnsManager };
|
|
40
|
+
//# sourceMappingURL=apns-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apns-manager.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/push-notifications/apns-manager.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAEvE,cAAM,WAAW;IACf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,sBAAsB,CAAa;IAE3C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAsD;IAE1E,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,WAAW;IAOjC,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAS5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;YAoBb,iBAAiB;YAmBjB,oBAAoB;YAyBpB,sBAAsB;IASpC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,uBAAuB;YAKjB,sBAAsB;IAwBpC,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,SAAS,CAAsC;IAEvD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAO3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAU5C,OAAO,CAAC,IAAI;IAaN,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAcpC,iBAAiB,IAAI,OAAO,CAAC,OAAO,CAAC;IAS3C,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,GAAG;IAIrD,OAAO,IAAI,IAAI;IASf,cAAc,IAAI,OAAO;IAInB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAMhD;;AAED,wBAAyC;AAEzC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PushNotificationEvent {
|
|
2
|
+
type: 'received' | 'clicked' | 'dismissed';
|
|
3
|
+
id?: string;
|
|
4
|
+
data?: any;
|
|
5
|
+
}
|
|
6
|
+
export type PushEventCallback = (event: PushNotificationEvent) => void;
|
|
7
|
+
declare class FcmManager {
|
|
8
|
+
private static instance;
|
|
9
|
+
private pushEventSubscriptions;
|
|
10
|
+
private initialized;
|
|
11
|
+
private isLoggedIn;
|
|
12
|
+
private pendingEvent;
|
|
13
|
+
private constructor();
|
|
14
|
+
static getInstance(): FcmManager;
|
|
15
|
+
setLoggedIn(status: boolean): void;
|
|
16
|
+
init(): Promise<void>;
|
|
17
|
+
private _setupPushEventListeners;
|
|
18
|
+
private _handlePushEvent;
|
|
19
|
+
private _onNotificationReceived;
|
|
20
|
+
private _onNotificationClicked;
|
|
21
|
+
private _onNotificationDismissed;
|
|
22
|
+
private listeners;
|
|
23
|
+
on(event: string, callback: Function): void;
|
|
24
|
+
off(event: string, callback: Function): void;
|
|
25
|
+
private emit;
|
|
26
|
+
addPushEventHandler(callback: PushEventCallback): any;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
}
|
|
29
|
+
declare const _default: FcmManager;
|
|
30
|
+
export default _default;
|
|
31
|
+
export { FcmManager };
|
|
32
|
+
//# sourceMappingURL=fcm-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fcm-manager.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/push-notifications/fcm-manager.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAEvE,cAAM,UAAU;IACd,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAa;IACpC,OAAO,CAAC,sBAAsB,CAAa;IAE3C,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAsD;IAE1E,OAAO;IAEP,MAAM,CAAC,WAAW,IAAI,UAAU;IAOhC,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAS5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB3B,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,uBAAuB;YAKjB,sBAAsB;IAsBpC,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,SAAS,CAAsC;IAEvD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAO3C,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAU5C,OAAO,CAAC,IAAI;IAaZ,mBAAmB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,GAAG;IAIrD,OAAO,IAAI,IAAI;CAQhB;;AAED,wBAAwC;AAExC,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acmo_config.d.ts","sourceRoot":"","sources":["../../../../src/acmo_config.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAc,WAAW,SAAS;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,YAAY,SAAkB;IAC5C,OAAc,WAAW,SAA6F;CACvH"}
|
|
1
|
+
{"version":3,"file":"acmo_config.d.ts","sourceRoot":"","sources":["../../../../src/acmo_config.ts"],"names":[],"mappings":"AAAA,qBAAa,UAAU;IACrB,OAAc,WAAW,SAAS;IAClC,OAAc,QAAQ,SAAkD;IACxE,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,aAAa,SAAO;IAClC,OAAc,YAAY,SAAkB;IAC5C,OAAc,WAAW,SAA6F;CACvH"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import type { TyradsConfig, TyradsMediaSourceInfo, TyradsUserInfo } from './acmo/core/types/external_types';
|
|
2
|
+
export type { TyradsConfig, TyradsMediaSourceInfo, TyradsUserInfo } from './acmo/core/types/external_types';
|
|
3
|
+
export { PremiumWidgetStyles } from './acmo/modules/premium-widgets/premium_offers_widget';
|
|
4
|
+
export { PremiumOffersWidget, PremiumOffersWidgetLoading } from './acmo/modules/premium-widgets/premium_offers_widget_wrapper';
|
|
4
5
|
declare const Tyrads: {
|
|
5
|
-
init: (apiKey: string, apiSecret: string, encKey?: string, engagementId?: string, mediaSourceInfo?: TyradsMediaSourceInfo, userInfo?: TyradsUserInfo) => Promise<any>;
|
|
6
|
+
init: (apiKey: string, apiSecret: string, encKey?: string, engagementId?: string, placementId?: string, mediaSourceInfo?: TyradsMediaSourceInfo, userInfo?: TyradsUserInfo, config?: TyradsConfig) => Promise<any>;
|
|
6
7
|
loginUser: (userId: string) => Promise<any>;
|
|
7
8
|
showOffers: ({ launchMode, route, campaignID, }?: {
|
|
8
9
|
launchMode?: number;
|
|
9
10
|
route?: string;
|
|
10
11
|
campaignID?: number | null;
|
|
11
12
|
}) => Promise<any>;
|
|
12
|
-
topPremiumOffers: ({ widgetStyle, launchMode, }?: {
|
|
13
|
-
widgetStyle?: PremiumWidgetStyles;
|
|
14
|
-
launchMode?: number;
|
|
15
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
topPremiumOffersLoading: ({ widgetStyle }: {
|
|
17
|
-
widgetStyle?: PremiumWidgetStyles;
|
|
18
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
13
|
changeLanguage: (lang: string) => Promise<any>;
|
|
20
14
|
};
|
|
21
15
|
export default Tyrads;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAM3G,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAC3G,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAE/H,QAAA,MAAM,MAAM;mBACW,MAAM,aAAa,MAAM,WAAW,MAAM,iBAAiB,MAAM,gBAAgB,MAAM,oBAAoB,qBAAqB,aAAa,cAAc,WAAW,YAAY;wBAI7K,MAAM;sDAQ7B;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;2BAKzC,MAAM;CAGpC,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tyrads.com/tyrads-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.0",
|
|
4
4
|
"description": "Tyrads SDK for React Native ",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@types/jest": "^29.5.5",
|
|
73
73
|
"@types/numeral": "^2.0.5",
|
|
74
74
|
"@types/react": "^19.0.0",
|
|
75
|
-
"@types/react-native-snap-carousel": "^3.8.
|
|
75
|
+
"@types/react-native-snap-carousel": "^3.8.12",
|
|
76
76
|
"commitlint": "^17.0.2",
|
|
77
77
|
"del-cli": "^5.1.0",
|
|
78
78
|
"eslint": "^8.51.0",
|
|
@@ -190,6 +190,8 @@
|
|
|
190
190
|
},
|
|
191
191
|
"dependencies": {
|
|
192
192
|
"@react-native-async-storage/async-storage": "^2.1.2",
|
|
193
|
-
"axios": "^1.8.1"
|
|
193
|
+
"axios": "^1.8.1",
|
|
194
|
+
"react-native-linear-gradient": "^2.8.3",
|
|
195
|
+
"react-native-snap-carousel": "^3.9.1"
|
|
194
196
|
}
|
|
195
197
|
}
|
package/readme.md
CHANGED
|
@@ -14,14 +14,27 @@ yarn add @tyrads.com/tyrads-sdk
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
```js
|
|
17
|
-
import Tyrads from '@tyrads.com/tyrads-sdk';
|
|
17
|
+
import Tyrads, { PremiumOffersWidget, PremiumWidgetStyles } from '@tyrads.com/tyrads-sdk';
|
|
18
18
|
|
|
19
|
-
//
|
|
19
|
+
// 1. Initialize the SDK
|
|
20
|
+
// Tyrads.init(apiKey, apiSecret, encKey?, engagementId?, placementId?, mediaSourceInfo?, userInfo?, config?)
|
|
21
|
+
await Tyrads.init('YOUR_API_KEY', 'YOUR_API_SECRET');
|
|
20
22
|
|
|
23
|
+
// 2. Login User
|
|
24
|
+
await Tyrads.loginUser('user123');
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
// 3. Show Offerwall
|
|
27
|
+
await Tyrads.showOffers();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Premium Offers Widget (v4+)
|
|
31
|
+
You can render premium offers natively inside your app views using the provided React components:
|
|
32
|
+
|
|
33
|
+
```jsx
|
|
34
|
+
import { PremiumOffersWidget, PremiumOffersWidgetLoading, PremiumWidgetStyles } from '@tyrads.com/tyrads-sdk';
|
|
35
|
+
|
|
36
|
+
// Inside your screen/component:
|
|
37
|
+
<PremiumOffersWidget widgetStyle={PremiumWidgetStyles.list} />
|
|
25
38
|
```
|
|
26
39
|
|
|
27
40
|
|
|
@@ -47,7 +60,7 @@ Available launch modes:
|
|
|
47
60
|
|
|
48
61
|
// Note: The launchMode parameter is optional, if not specified the default would be opening the Offerwall in an external browser (Safari)
|
|
49
62
|
|
|
50
|
-
Tyrads.showOffers({ launchMode: 3 });// provide launchMode: 2 to open the Offerwall in a webkit view that is embedded in the app
|
|
63
|
+
await Tyrads.showOffers({ launchMode: 3 });// provide launchMode: 2 to open the Offerwall in a webkit view that is embedded in the app
|
|
51
64
|
|
|
52
65
|
```
|
|
53
66
|
</details>
|
|
@@ -61,7 +74,7 @@ Tyrads.showOffers({ launchMode: 3 });// provide launchMode: 2 to open the Offerw
|
|
|
61
74
|
|
|
62
75
|
</br>
|
|
63
76
|
|
|
64
|
-
##### Min SDK version required:
|
|
77
|
+
##### Min SDK version required: v4.0.0-beta.0
|
|
65
78
|
|
|
66
79
|
</br>
|
|
67
80
|
|
|
@@ -70,25 +83,25 @@ The Tyrads SDK supports deeplinking to specific sections of the offerwall. When
|
|
|
70
83
|
Available routes and their usage:
|
|
71
84
|
- `offers` - opens the Campaigns Page
|
|
72
85
|
- `active-offers` - opens the Activated Campaigns Page
|
|
73
|
-
- `
|
|
74
|
-
- `support` - opens the Campaign Tickets Page (requires campaignID)
|
|
86
|
+
- `offers` with campaignID - opens the Campaign Details Page (requires campaignID)
|
|
87
|
+
- `support` with campaignID - opens the Campaign Tickets Page (requires campaignID)
|
|
75
88
|
|
|
76
89
|
```js
|
|
77
90
|
|
|
78
91
|
// Default route (Campaigns Page)
|
|
79
|
-
Tyrads.showOffers();
|
|
92
|
+
await Tyrads.showOffers();
|
|
80
93
|
|
|
81
94
|
// Explicitly specifying the Campaigns Page
|
|
82
|
-
Tyrads.showOffers({ route: "offers" });
|
|
95
|
+
await Tyrads.showOffers({ route: "offers" });
|
|
83
96
|
|
|
84
97
|
// Activated Campaigns Page
|
|
85
|
-
Tyrads.showOffers({ route: "active-offers" });
|
|
98
|
+
await Tyrads.showOffers({ route: "active-offers" });
|
|
86
99
|
|
|
87
100
|
// Campaign Details Page (requires campaignID)
|
|
88
|
-
Tyrads.showOffers({ route: "
|
|
101
|
+
await Tyrads.showOffers({ route: "offers", campaignID: "your_campaign_id_here" });
|
|
89
102
|
|
|
90
103
|
// Campaign Tickets Page (requires campaignID)
|
|
91
|
-
Tyrads.showOffers({ route: "support", campaignID: "your_campaign_id_here" });
|
|
104
|
+
await Tyrads.showOffers({ route: "support", campaignID: "your_campaign_id_here" });
|
|
92
105
|
|
|
93
106
|
```
|
|
94
107
|
</details>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface CountdownTimerProps {
|
|
5
|
+
duration: number;
|
|
6
|
+
style?: any;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const CountdownTimer: React.FC<CountdownTimerProps> = ({
|
|
10
|
+
duration,
|
|
11
|
+
style,
|
|
12
|
+
}) => {
|
|
13
|
+
const [timeLeft, setTimeLeft] = useState(duration);
|
|
14
|
+
const intervalRef = useRef<NodeJS.Timeout>();
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
intervalRef.current = setInterval(() => {
|
|
18
|
+
setTimeLeft((prev) => {
|
|
19
|
+
if (prev <= 1) {
|
|
20
|
+
clearInterval(intervalRef.current!);
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
return prev - 1;
|
|
24
|
+
});
|
|
25
|
+
}, 1000);
|
|
26
|
+
|
|
27
|
+
return () => clearInterval(intervalRef.current!);
|
|
28
|
+
}, []);
|
|
29
|
+
|
|
30
|
+
const formatTime = (seconds: number): string => {
|
|
31
|
+
if (seconds <= 0) return '00:00:00';
|
|
32
|
+
|
|
33
|
+
const days = Math.floor(seconds / 86400);
|
|
34
|
+
const hours = Math.floor((seconds % 86400) / 3600);
|
|
35
|
+
const minutes = Math.floor((seconds % 3600) / 60);
|
|
36
|
+
const secs = seconds % 60;
|
|
37
|
+
|
|
38
|
+
const pad = (num: number) => num.toString().padStart(2, '0');
|
|
39
|
+
|
|
40
|
+
if (days > 0) {
|
|
41
|
+
return `${pad(days)} d ${pad(hours)} h`;
|
|
42
|
+
} else {
|
|
43
|
+
return `${pad(hours)}:${pad(minutes)}:${pad(secs)}`;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Text style={style}>
|
|
49
|
+
{formatTime(timeLeft)}
|
|
50
|
+
</Text>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import '../helpers/patches'
|
|
2
|
+
|
|
3
|
+
import React, { useRef, useState } from "react";
|
|
4
|
+
import { View, Dimensions, StyleSheet, type ViewStyle } from "react-native";
|
|
5
|
+
import Carousel, { Pagination } from "react-native-snap-carousel";
|
|
6
|
+
|
|
7
|
+
interface SnapCarouselProps {
|
|
8
|
+
data: any[];
|
|
9
|
+
renderItem: ({ item, index }: any) => JSX.Element;
|
|
10
|
+
sliderWidth?: number;
|
|
11
|
+
itemWidth?: number;
|
|
12
|
+
showPagination?: boolean;
|
|
13
|
+
onSnapToItem?: (index: number) => void;
|
|
14
|
+
inactiveSlideScale?: number;
|
|
15
|
+
inactiveSlideOpacity?: number;
|
|
16
|
+
activeSlideAlignment?: "start" | "center" | "end";
|
|
17
|
+
containerStyle?: ViewStyle;
|
|
18
|
+
paginationContainerStyle?: ViewStyle;
|
|
19
|
+
dotStyle?: ViewStyle;
|
|
20
|
+
inActiveDotStyle?: ViewStyle;
|
|
21
|
+
inActiveDotScale?: number;
|
|
22
|
+
loop?: boolean;
|
|
23
|
+
autoplay?: boolean;
|
|
24
|
+
autoPlayDelay?: number;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { width: screenWidth } = Dimensions.get("window");
|
|
29
|
+
|
|
30
|
+
const SnapCarousel: React.FC<SnapCarouselProps> = ({
|
|
31
|
+
data,
|
|
32
|
+
renderItem,
|
|
33
|
+
sliderWidth = screenWidth,
|
|
34
|
+
itemWidth = screenWidth * 0.75,
|
|
35
|
+
showPagination = true,
|
|
36
|
+
onSnapToItem = () => {},
|
|
37
|
+
inactiveSlideScale = 1,
|
|
38
|
+
inactiveSlideOpacity = 0.99,
|
|
39
|
+
activeSlideAlignment = "center",
|
|
40
|
+
containerStyle,
|
|
41
|
+
paginationContainerStyle,
|
|
42
|
+
dotStyle,
|
|
43
|
+
inActiveDotStyle,
|
|
44
|
+
inActiveDotScale = 0.95,
|
|
45
|
+
loop = false,
|
|
46
|
+
autoplay = false,
|
|
47
|
+
autoPlayDelay = 5000,
|
|
48
|
+
...rest
|
|
49
|
+
}) => {
|
|
50
|
+
const carouselRef = useRef<Carousel<any>>(null);
|
|
51
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
52
|
+
|
|
53
|
+
const sidePadding = (sliderWidth - itemWidth) / 2;
|
|
54
|
+
|
|
55
|
+
const safeData = data || [];
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<View style={[containerStyle]}>
|
|
59
|
+
<Carousel
|
|
60
|
+
ref={carouselRef}
|
|
61
|
+
data={safeData}
|
|
62
|
+
renderItem={renderItem}
|
|
63
|
+
sliderWidth={sliderWidth}
|
|
64
|
+
itemWidth={itemWidth}
|
|
65
|
+
inactiveSlideScale={inactiveSlideScale}
|
|
66
|
+
inactiveSlideOpacity={inactiveSlideOpacity}
|
|
67
|
+
activeSlideAlignment={activeSlideAlignment}
|
|
68
|
+
onSnapToItem={(index) => {
|
|
69
|
+
setActiveIndex(index);
|
|
70
|
+
onSnapToItem(index);
|
|
71
|
+
}}
|
|
72
|
+
contentContainerCustomStyle={{
|
|
73
|
+
paddingHorizontal: sidePadding,
|
|
74
|
+
}}
|
|
75
|
+
loop={loop}
|
|
76
|
+
autoplay={autoplay}
|
|
77
|
+
autoplayDelay={autoPlayDelay}
|
|
78
|
+
{...rest}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
{showPagination && (
|
|
82
|
+
<Pagination
|
|
83
|
+
dotsLength={safeData.length}
|
|
84
|
+
activeDotIndex={activeIndex}
|
|
85
|
+
dotStyle={[styles.dot, dotStyle]}
|
|
86
|
+
inactiveDotOpacity={0.3}
|
|
87
|
+
inactiveDotStyle={[inActiveDotStyle]}
|
|
88
|
+
inactiveDotScale={inActiveDotScale}
|
|
89
|
+
dotContainerStyle={[{ marginHorizontal: 4 , marginBottom: 0}]}
|
|
90
|
+
containerStyle={paginationContainerStyle}
|
|
91
|
+
/>
|
|
92
|
+
)}
|
|
93
|
+
</View>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const styles = StyleSheet.create({
|
|
98
|
+
dot: {
|
|
99
|
+
width: 8,
|
|
100
|
+
height: 8,
|
|
101
|
+
borderRadius: 4,
|
|
102
|
+
backgroundColor: "#fff",
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export default SnapCarousel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class AcmoAPIEndpoints {
|
|
2
|
+
public static readonly TARGETED_CAMPAIGNS = "campaigns";
|
|
3
|
+
public static readonly ACTIVE_CAMPAIGNS = "campaigns/activated";
|
|
4
|
+
public static readonly SUMMARY = "campaigns/activated/summary";
|
|
5
|
+
public static readonly ENGAGEMENT = "account/engagement";
|
|
6
|
+
public static readonly USER_ACTIVITIES = "account/activity";
|
|
7
|
+
public static readonly ACTIVATE_CAMPAIGN = (id: number) => `campaigns/${id}/activate`;
|
|
8
|
+
public static readonly TRANSLATIONS = (locale: string) => `translations/${locale}`;
|
|
9
|
+
public static readonly TRANSLATIONS_VERSION = "translations/version";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default AcmoAPIEndpoints;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const getContrastColor = (hexColor: string | null | undefined): string => {
|
|
2
|
+
if (!hexColor) return 'white';
|
|
3
|
+
|
|
4
|
+
let hex = hexColor.replace('#', '');
|
|
5
|
+
|
|
6
|
+
if (hex.length === 3) {
|
|
7
|
+
hex = hex.split('').map(char => char + char).join('');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
11
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
12
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
13
|
+
const yiq = ((r * 299) + (g * 587) + (b * 114)) / 1000;
|
|
14
|
+
|
|
15
|
+
return (yiq >= 128) ? 'black' : 'white';
|
|
16
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import NetworkCommon from "./network-common";
|
|
3
|
+
|
|
4
|
+
export type HttpError = {
|
|
5
|
+
type: "network" | "server" | "timeout" | "unknown";
|
|
6
|
+
status?: number;
|
|
7
|
+
data?: any;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
class HttpClient {
|
|
12
|
+
private handleError(error: any): HttpError {
|
|
13
|
+
if (axios.isAxiosError(error)) {
|
|
14
|
+
const status = error.response?.status;
|
|
15
|
+
const data = error.response?.data;
|
|
16
|
+
|
|
17
|
+
if (!error.response) {
|
|
18
|
+
return {
|
|
19
|
+
type: 'network',
|
|
20
|
+
message: 'Network error or no response from server',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (error.code === 'ECONNABORTED') {
|
|
25
|
+
return {
|
|
26
|
+
type: 'timeout',
|
|
27
|
+
message: 'Request timed out',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
type: 'server',
|
|
33
|
+
status,
|
|
34
|
+
data,
|
|
35
|
+
message: error.message,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
type: 'unknown',
|
|
41
|
+
message: String(error),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async get(url: string, params?: any) {
|
|
46
|
+
const api = NetworkCommon.getInstance().getAxios();
|
|
47
|
+
try {
|
|
48
|
+
const response = await api.get(url, {
|
|
49
|
+
params: params ?? {},
|
|
50
|
+
});
|
|
51
|
+
return { status: response.status, data: response.data };
|
|
52
|
+
} catch (error) {
|
|
53
|
+
throw this.handleError(error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async post(url: string, data?: any, config?: any) {
|
|
58
|
+
const api = NetworkCommon.getInstance().getAxios();
|
|
59
|
+
try {
|
|
60
|
+
const response = await api.post(url, data, config);
|
|
61
|
+
return { status: response.status, data: response.data };
|
|
62
|
+
} catch (error) {
|
|
63
|
+
throw this.handleError(error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async put(url: string, data?: any, config?: any) {
|
|
68
|
+
const api = NetworkCommon.getInstance().getAxios();
|
|
69
|
+
try {
|
|
70
|
+
const response = await api.put(url, data, config);
|
|
71
|
+
return { status: response.status, data: response.data };
|
|
72
|
+
} catch (error) {
|
|
73
|
+
throw this.handleError(error);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async delete(url: string, config?: any) {
|
|
78
|
+
const api = NetworkCommon.getInstance().getAxios();
|
|
79
|
+
try {
|
|
80
|
+
const response = await api.delete(url, config);
|
|
81
|
+
return { status: response.status, data: response.data };
|
|
82
|
+
} catch (error) {
|
|
83
|
+
throw this.handleError(error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const http = new HttpClient();
|
|
89
|
+
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import axios, { type AxiosInstance, AxiosError } from 'axios';
|
|
2
|
+
import { AcmoConfig } from '../../../acmo_config';
|
|
3
|
+
import { Logger } from '../helpers/logger';
|
|
4
|
+
import TyradsSdkCore from '../tyrads-sdk-core';
|
|
5
|
+
import { getData } from '../storage/storage';
|
|
6
|
+
|
|
7
|
+
const BASE_URL = AcmoConfig.BASE_URL;
|
|
8
|
+
|
|
9
|
+
class NetworkCommon {
|
|
10
|
+
private static instance: NetworkCommon;
|
|
11
|
+
private axiosInstance: AxiosInstance | null = null;
|
|
12
|
+
|
|
13
|
+
private constructor() { }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
public static getInstance(): NetworkCommon {
|
|
17
|
+
if (!NetworkCommon.instance) {
|
|
18
|
+
NetworkCommon.instance = new NetworkCommon();
|
|
19
|
+
}
|
|
20
|
+
return NetworkCommon.instance;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async init(): Promise<void> {
|
|
24
|
+
if (this.axiosInstance) return;
|
|
25
|
+
|
|
26
|
+
this.axiosInstance = axios.create({
|
|
27
|
+
baseURL: BASE_URL,
|
|
28
|
+
timeout: 10000,
|
|
29
|
+
headers: {
|
|
30
|
+
'Content-Type': 'application/json',
|
|
31
|
+
Accept: 'application/json',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
this.addInterceptors();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private logSafe(title: string, data: any) {
|
|
39
|
+
if (!__DEV__) return;
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
console.group(title);
|
|
43
|
+
console.log(JSON.stringify(data, null, 2));
|
|
44
|
+
console.groupEnd();
|
|
45
|
+
} catch {
|
|
46
|
+
console.log(title, data);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private addInterceptors() {
|
|
51
|
+
if (!this.axiosInstance) return;
|
|
52
|
+
|
|
53
|
+
this.axiosInstance.interceptors.request.use(
|
|
54
|
+
async (config) => {
|
|
55
|
+
const apiKey = TyradsSdkCore.apiKey;
|
|
56
|
+
const apiSecret = TyradsSdkCore.apiSecret;
|
|
57
|
+
const sdkPlatform = AcmoConfig.SDK_PLATFORM;
|
|
58
|
+
const sdkVersion = AcmoConfig.SDK_VERSION;
|
|
59
|
+
|
|
60
|
+
let userId = TyradsSdkCore.userId;
|
|
61
|
+
if (!userId) {
|
|
62
|
+
userId = (await getData<string>('xUserId')) || '';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
config.headers['X-API-Key'] = apiKey;
|
|
66
|
+
config.headers['X-API-Secret'] = apiSecret;
|
|
67
|
+
config.headers['X-User-ID'] = userId;
|
|
68
|
+
config.headers['X-SDK-Platform'] = sdkPlatform;
|
|
69
|
+
config.headers['X-SDK-Version'] = sdkVersion;
|
|
70
|
+
|
|
71
|
+
if (__DEV__) {
|
|
72
|
+
this.logSafe('HTTP REQUEST', {
|
|
73
|
+
timestamp: new Date().toISOString(),
|
|
74
|
+
method: config.method?.toUpperCase(),
|
|
75
|
+
url: `${config.baseURL}${config.url}`,
|
|
76
|
+
headers: {
|
|
77
|
+
...config.headers,
|
|
78
|
+
'X-API-Key': '***',
|
|
79
|
+
'X-API-Secret': '***',
|
|
80
|
+
},
|
|
81
|
+
body: config.data,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return config;
|
|
85
|
+
},
|
|
86
|
+
(error) => {
|
|
87
|
+
Logger.error('Request Interceptor Error:', error);
|
|
88
|
+
return Promise.reject(error);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
this.axiosInstance.interceptors.response.use(
|
|
93
|
+
(response) => {
|
|
94
|
+
if (__DEV__) {
|
|
95
|
+
this.logSafe('HTTP RESPONSE', {
|
|
96
|
+
timestamp: new Date().toISOString(),
|
|
97
|
+
status: response.status,
|
|
98
|
+
url: response.config.url,
|
|
99
|
+
data: response.data,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return response;
|
|
103
|
+
},
|
|
104
|
+
(error: AxiosError) => {
|
|
105
|
+
if (__DEV__) {
|
|
106
|
+
this.logSafe('HTTP ERROR', {
|
|
107
|
+
timestamp: new Date().toISOString(),
|
|
108
|
+
isAxiosError: axios.isAxiosError(error),
|
|
109
|
+
status: error.response?.status,
|
|
110
|
+
url: error.config?.url,
|
|
111
|
+
message: error.message,
|
|
112
|
+
responseData: error.response?.data,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return Promise.reject(error);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public getAxios(): AxiosInstance {
|
|
121
|
+
if (!this.axiosInstance) {
|
|
122
|
+
throw new Error('NetworkCommon not initialized. Call init() first.');
|
|
123
|
+
}
|
|
124
|
+
return this.axiosInstance;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export default NetworkCommon;
|