@tyrads.com/tyrads-sdk 3.1.0-beta.0 → 3.2.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 +130 -46
- package/ios/Tyrads/AcmoAssets.swift +14 -0
- package/ios/Tyrads/ApiHeaders.swift +1 -0
- package/ios/Tyrads/Tyrads.swift +184 -57
- package/ios/Tyrads/WebViewController.swift +27 -3
- package/ios/Tyrads/core/utils/AcmoKeyNames.swift +29 -0
- package/ios/Tyrads/core/utils/ColorExtension.swift +55 -0
- package/ios/Tyrads/core/utils/Services/LocalizationService.swift +175 -0
- package/ios/Tyrads/helpers/device_details.swift +148 -46
- package/ios/Tyrads/legal/AcmoPrivacyPage.swift +353 -0
- package/ios/Tyrads/legal/PrivacyPageController.swift +31 -0
- package/ios/Tyrads/user/AcmoUserUpdatePage.swift +302 -0
- package/ios/Tyrads/user/AcmoUsersUpdateController.swift +26 -0
- package/ios/Tyrads/user/Repository.swift +89 -0
- package/ios/TyradsSdk.mm +15 -3
- package/ios/TyradsSdk.swift +101 -46
- package/lib/commonjs/acmo/core/helpers/native_methods.js +37 -0
- package/lib/commonjs/acmo/core/helpers/native_methods.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/numeral.js +19 -0
- package/lib/commonjs/acmo/core/helpers/numeral.js.map +1 -0
- package/lib/commonjs/acmo/core/services/localization_service.js +164 -0
- package/lib/commonjs/acmo/core/services/localization_service.js.map +1 -0
- package/lib/commonjs/acmo/core/storage/storage.js +15 -1
- package/lib/commonjs/acmo/core/storage/storage.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js +5 -2
- package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js +3 -4
- package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js +12 -6
- package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js +6 -2
- package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js +4 -4
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js +4 -11
- package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/repository.js +1 -1
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js +15 -0
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +1 -1
- package/lib/commonjs/acmo/modules/localization/localization_context.js +56 -0
- package/lib/commonjs/acmo/modules/localization/localization_context.js.map +1 -0
- package/lib/commonjs/index.js +39 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/acmo/core/helpers/native_methods.js +33 -0
- package/lib/module/acmo/core/helpers/native_methods.js.map +1 -0
- package/lib/module/acmo/core/helpers/numeral.js +14 -0
- package/lib/module/acmo/core/helpers/numeral.js.map +1 -0
- package/lib/module/acmo/core/services/localization_service.js +159 -0
- package/lib/module/acmo/core/services/localization_service.js.map +1 -0
- package/lib/module/acmo/core/storage/storage.js +13 -0
- package/lib/module/acmo/core/storage/storage.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/active_offers_button.js +5 -2
- package/lib/module/acmo/modules/dashboard/components/active_offers_button.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/offer_card.js +3 -3
- package/lib/module/acmo/modules/dashboard/components/offer_card.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/offer_list_item.js +12 -6
- package/lib/module/acmo/modules/dashboard/components/offer_list_item.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js +6 -2
- package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_header.js +4 -4
- package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_loading.js +5 -12
- package/lib/module/acmo/modules/dashboard/components/premium_loading.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/repository.js +1 -1
- package/lib/module/acmo/modules/dashboard/top_offers.js +15 -0
- package/lib/module/acmo/modules/dashboard/top_offers.js.map +1 -1
- package/lib/module/acmo/modules/localization/localization_context.js +45 -0
- package/lib/module/acmo/modules/localization/localization_context.js.map +1 -0
- package/lib/module/index.js +38 -6
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/numeral.d.ts +2 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/numeral.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts +18 -0
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/localization/localization_context.d.ts +14 -0
- package/lib/typescript/commonjs/src/acmo/modules/localization/localization_context.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts +6 -0
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/helpers/numeral.d.ts +2 -0
- package/lib/typescript/module/src/acmo/core/helpers/numeral.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts +18 -0
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/storage/storage.d.ts +1 -0
- package/lib/typescript/module/src/acmo/core/storage/storage.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/localization/localization_context.d.ts +14 -0
- package/lib/typescript/module/src/acmo/modules/localization/localization_context.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/acmo/core/helpers/native_methods.ts +43 -0
- package/src/acmo/core/helpers/numeral.ts +14 -0
- package/src/acmo/core/services/localization_service.ts +200 -0
- package/src/acmo/core/storage/storage.ts +14 -0
- package/src/acmo/modules/dashboard/components/active_offers_button.tsx +3 -2
- package/src/acmo/modules/dashboard/components/offer_card.tsx +3 -3
- package/src/acmo/modules/dashboard/components/offer_list_item.tsx +8 -5
- package/src/acmo/modules/dashboard/components/premium_empty_widget.tsx +5 -2
- package/src/acmo/modules/dashboard/components/premium_header.tsx +6 -5
- package/src/acmo/modules/dashboard/components/premium_loading.tsx +2 -8
- package/src/acmo/modules/dashboard/repository.ts +1 -1
- package/src/acmo/modules/dashboard/top_offers.tsx +18 -3
- package/src/acmo/modules/localization/localization_context.tsx +52 -0
- package/src/index.tsx +63 -18
- package/lib/commonjs/i18n.js +0 -112
- package/lib/commonjs/i18n.js.map +0 -1
- package/lib/module/i18n.js +0 -107
- package/lib/module/i18n.js.map +0 -1
- package/lib/typescript/commonjs/src/i18n.d.ts +0 -3
- package/lib/typescript/commonjs/src/i18n.d.ts.map +0 -1
- package/lib/typescript/module/src/i18n.d.ts +0 -3
- package/lib/typescript/module/src/i18n.d.ts.map +0 -1
- package/src/i18n.ts +0 -115
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"offer_card.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_card.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"offer_card.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,aAAa,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA8FlC,CAAC;AAoIF,eAAe,aAAa,CAAC"}
|
package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"offer_list_item.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_list_item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"offer_list_item.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_list_item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,QAAQ,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACjD,CAAC;AAUF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA6F7C,CAAC"}
|
package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"premium_empty_widget.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_empty_widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"premium_empty_widget.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_empty_widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAC,CAqCjF,CAAC;AAqCF,eAAe,gBAAgB,CAAC"}
|
package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"premium_header.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,yBAAyB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
1
|
+
{"version":3,"file":"premium_header.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,yBAAyB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA6B7D,CAAC;AA0CF,eAAe,oBAAoB,CAAC"}
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
2
2
|
import { PremiumWidgetStyles } from '../top_offers';
|
3
3
|
interface PremiumWidgetsLoadingProps {
|
4
4
|
widgetStyle: PremiumWidgetStyles;
|
5
|
-
itemHeight?: number;
|
6
5
|
}
|
7
6
|
declare const PremiumWidgetsLoading: React.FC<PremiumWidgetsLoadingProps>;
|
8
7
|
export default PremiumWidgetsLoading;
|
package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"premium_loading.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,UAAU,0BAA0B;IAClC,WAAW,EAAE,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"premium_loading.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,UAAU,0BAA0B;IAClC,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAqC/D,CAAC;AAwBF,eAAe,qBAAqB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"top_offers.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/dashboard/top_offers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"top_offers.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/dashboard/top_offers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,0BAAkB,mBAAmB;IACnC,IAAI,IAAA;IACJ,WAAW,IAAA;CACZ;AAED,UAAU,kBAAkB;IAC1B,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsIhD,CAAC;AAkCF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface LocalizationContextProps {
|
3
|
+
t: (key: string, args?: Record<string, string | number>) => string;
|
4
|
+
changeLanguage: (lang: string) => Promise<void>;
|
5
|
+
currentLanguage: string;
|
6
|
+
}
|
7
|
+
export declare const LocalizationProvider: React.FC<{
|
8
|
+
children: React.ReactNode;
|
9
|
+
}>;
|
10
|
+
export declare const useLocalization: () => LocalizationContextProps;
|
11
|
+
export declare const updateProviderLanguage: (lang: string) => Promise<void>;
|
12
|
+
export declare const changeProviderLanguage: (lang: string) => Promise<void>;
|
13
|
+
export {};
|
14
|
+
//# sourceMappingURL=localization_context.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"localization_context.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/localization/localization_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,UAAU,wBAAwB;IAChC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;IACnE,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;CACzB;AAUD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAoBxE,CAAC;AAEF,eAAO,MAAM,eAAe,gCAAwC,CAAC;AAErE,eAAO,MAAM,sBAAsB,SAAgB,MAAM,kBAIxD,CAAC;AAEF,eAAO,MAAM,sBAAsB,SAAgB,MAAM,kBAIxD,CAAC"}
|
@@ -11,6 +11,10 @@ declare const Tyrads: {
|
|
11
11
|
widgetStyle?: PremiumWidgetStyles;
|
12
12
|
launchMode?: number;
|
13
13
|
}) => import("react/jsx-runtime").JSX.Element;
|
14
|
+
topPremiumOffersLoading: ({ widgetStyle }: {
|
15
|
+
widgetStyle?: PremiumWidgetStyles;
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
17
|
+
changeLanguage: (lang: string) => Promise<any>;
|
14
18
|
};
|
15
19
|
export default Tyrads;
|
16
20
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAkB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAkB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AA8BrF,QAAA,MAAM,MAAM;mBACW,MAAM,aAAa,MAAM,WAAW,MAAM;wBAgCrC,MAAM;sDAoB7B;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;sDAgBnE;QACD,WAAW,CAAC,EAAE,mBAAmB,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;+CAgB6C;QAC1C,WAAW,CAAC,EAAE,mBAAmB,CAAC;KACnC;2BAQ0B,MAAM;CAGpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"native_methods.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/core/helpers/native_methods.ts"],"names":[],"mappings":"AAoBA,QAAA,MAAM,mBAAmB;;;CAoBxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"numeral.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/core/helpers/numeral.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAW,MAAM,aAAY,MAAM,KAAO,MAa7D,CAAC"}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
declare class LocalizationService {
|
2
|
+
private static instance;
|
3
|
+
private axios;
|
4
|
+
private translations;
|
5
|
+
private supportedLocales;
|
6
|
+
private readonly fallbackLocale;
|
7
|
+
private constructor();
|
8
|
+
static getInstance(): LocalizationService;
|
9
|
+
private static getHeadersFromStorage;
|
10
|
+
init(locale: string): Promise<void>;
|
11
|
+
private loadTranslations;
|
12
|
+
private fetchTranslations;
|
13
|
+
private checkForUpdate;
|
14
|
+
translate(key: string, args?: Record<string, string | number>): string;
|
15
|
+
changeLanguage(locale: string, force?: boolean): Promise<void>;
|
16
|
+
}
|
17
|
+
export default LocalizationService;
|
18
|
+
//# sourceMappingURL=localization_service.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"localization_service.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/core/services/localization_service.ts"],"names":[],"mappings":"AAgBA,cAAM,mBAAmB;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAsB;IAC7C,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAE/C,OAAO;WAGO,WAAW,IAAI,mBAAmB;mBAO3B,qBAAqB;IAW7B,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YA4ClC,gBAAgB;YAkBhB,iBAAiB;YAiCjB,cAAc;IA+BrB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,GAAG,MAAM;IAwBpE,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAG1E;AAED,eAAe,mBAAmB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/core/storage/storage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QAAe,MAAM,UAAU,GAAG,KAAG,OAAO,CAAC,IAAI,CAWrE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,CAAC,OAAO,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAY9D,CAAC"}
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/core/storage/storage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,QAAe,MAAM,UAAU,GAAG,KAAG,OAAO,CAAC,IAAI,CAWrE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,CAAC,OAAO,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAY9D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAU,CAAC,OAAO,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAYhE,CAAC"}
|
package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"active_offers_button.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/active_offers_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"active_offers_button.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/active_offers_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,oBAAoB;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgBtD,CAAC;AAkCF,eAAe,kBAAkB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"offer_card.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_card.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"offer_card.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAYxC,UAAU,KAAK;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,aAAa,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA8FlC,CAAC;AAoIF,eAAe,aAAa,CAAC"}
|
package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"offer_list_item.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_list_item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"offer_list_item.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/offer_list_item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,QAAQ,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACjD,CAAC;AAUF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA6F7C,CAAC"}
|
package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"premium_empty_widget.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_empty_widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"premium_empty_widget.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_empty_widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAC,CAqCjF,CAAC;AAqCF,eAAe,gBAAgB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"premium_header.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,yBAAyB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
1
|
+
{"version":3,"file":"premium_header.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,UAAU,yBAAyB;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CA6B7D,CAAC;AA0CF,eAAe,oBAAoB,CAAC"}
|
@@ -2,7 +2,6 @@ import React from 'react';
|
|
2
2
|
import { PremiumWidgetStyles } from '../top_offers';
|
3
3
|
interface PremiumWidgetsLoadingProps {
|
4
4
|
widgetStyle: PremiumWidgetStyles;
|
5
|
-
itemHeight?: number;
|
6
5
|
}
|
7
6
|
declare const PremiumWidgetsLoading: React.FC<PremiumWidgetsLoadingProps>;
|
8
7
|
export default PremiumWidgetsLoading;
|
package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"premium_loading.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,UAAU,0BAA0B;IAClC,WAAW,EAAE,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"premium_loading.d.ts","sourceRoot":"","sources":["../../../../../../../../src/acmo/modules/dashboard/components/premium_loading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGpD,UAAU,0BAA0B;IAClC,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAqC/D,CAAC;AAwBF,eAAe,qBAAqB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"top_offers.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/dashboard/top_offers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"top_offers.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/dashboard/top_offers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAiBnD,0BAAkB,mBAAmB;IACnC,IAAI,IAAA;IACJ,WAAW,IAAA;CACZ;AAED,UAAU,kBAAkB;IAC1B,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsIhD,CAAC;AAkCF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
interface LocalizationContextProps {
|
3
|
+
t: (key: string, args?: Record<string, string | number>) => string;
|
4
|
+
changeLanguage: (lang: string) => Promise<void>;
|
5
|
+
currentLanguage: string;
|
6
|
+
}
|
7
|
+
export declare const LocalizationProvider: React.FC<{
|
8
|
+
children: React.ReactNode;
|
9
|
+
}>;
|
10
|
+
export declare const useLocalization: () => LocalizationContextProps;
|
11
|
+
export declare const updateProviderLanguage: (lang: string) => Promise<void>;
|
12
|
+
export declare const changeProviderLanguage: (lang: string) => Promise<void>;
|
13
|
+
export {};
|
14
|
+
//# sourceMappingURL=localization_context.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"localization_context.d.ts","sourceRoot":"","sources":["../../../../../../../src/acmo/modules/localization/localization_context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAG9E,UAAU,wBAAwB;IAChC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;IACnE,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;CACzB;AAUD,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAoBxE,CAAC;AAEF,eAAO,MAAM,eAAe,gCAAwC,CAAC;AAErE,eAAO,MAAM,sBAAsB,SAAgB,MAAM,kBAIxD,CAAC;AAEF,eAAO,MAAM,sBAAsB,SAAgB,MAAM,kBAIxD,CAAC"}
|
@@ -11,6 +11,10 @@ declare const Tyrads: {
|
|
11
11
|
widgetStyle?: PremiumWidgetStyles;
|
12
12
|
launchMode?: number;
|
13
13
|
}) => import("react/jsx-runtime").JSX.Element;
|
14
|
+
topPremiumOffersLoading: ({ widgetStyle }: {
|
15
|
+
widgetStyle?: PremiumWidgetStyles;
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
17
|
+
changeLanguage: (lang: string) => Promise<any>;
|
14
18
|
};
|
15
19
|
export default Tyrads;
|
16
20
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAkB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAkB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AA8BrF,QAAA,MAAM,MAAM;mBACW,MAAM,aAAa,MAAM,WAAW,MAAM;wBAgCrC,MAAM;sDAoB7B;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;sDAgBnE;QACD,WAAW,CAAC,EAAE,mBAAmB,CAAC;QAClC,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB;+CAgB6C;QAC1C,WAAW,CAAC,EAAE,mBAAmB,CAAC;KACnC;2BAQ0B,MAAM;CAGpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@tyrads.com/tyrads-sdk",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.2.0-beta.0",
|
4
4
|
"description": "Tyrads SDK for React Native ",
|
5
5
|
"source": "./src/index.tsx",
|
6
6
|
"main": "./lib/commonjs/index.js",
|
@@ -189,10 +189,6 @@
|
|
189
189
|
},
|
190
190
|
"dependencies": {
|
191
191
|
"@react-native-async-storage/async-storage": "^2.1.2",
|
192
|
-
"axios": "^1.8.1"
|
193
|
-
"i18next": "^24.2.2",
|
194
|
-
"numeral": "^2.0.6",
|
195
|
-
"react-i18next": "^15.4.1",
|
196
|
-
"react-native-snap-carousel": "^3.9.1"
|
192
|
+
"axios": "^1.8.1"
|
197
193
|
}
|
198
194
|
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { NativeModules, Platform } from "react-native";
|
2
|
+
|
3
|
+
const LINKING_ERROR =
|
4
|
+
`The package 'tyrads-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
7
|
+
'- You are not using Expo Go\n';
|
8
|
+
|
9
|
+
const TyradsSdk = NativeModules.TyradsSdk
|
10
|
+
? NativeModules.TyradsSdk
|
11
|
+
: new Proxy(
|
12
|
+
{},
|
13
|
+
{
|
14
|
+
get() {
|
15
|
+
throw new Error(LINKING_ERROR);
|
16
|
+
},
|
17
|
+
}
|
18
|
+
);
|
19
|
+
|
20
|
+
|
21
|
+
const TyradsNativeMethods = {
|
22
|
+
|
23
|
+
isPrivacyAccepted: async () => {
|
24
|
+
try {
|
25
|
+
return await TyradsSdk.isPrivacyAccepted();
|
26
|
+
} catch (err) {
|
27
|
+
console.error("Error checking privacy acceptance:", err);
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
},
|
31
|
+
|
32
|
+
checkOnboardingProcess: async () => {
|
33
|
+
try {
|
34
|
+
const result = await TyradsSdk.checkOnboardingProcess();
|
35
|
+
return result === true;
|
36
|
+
} catch (err) {
|
37
|
+
console.error("Error showing privacy flow:", err);
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
};
|
42
|
+
|
43
|
+
export default TyradsNativeMethods;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export const numeral = (value: number, decimals: number = 2): string => {
|
2
|
+
const suffixes = ['', 'K', 'M', 'B', 'T'];
|
3
|
+
let suffixIndex = 0;
|
4
|
+
let dividedValue = value;
|
5
|
+
|
6
|
+
while (dividedValue >= 1000 && suffixIndex < suffixes.length - 1) {
|
7
|
+
dividedValue /= 1000;
|
8
|
+
suffixIndex++;
|
9
|
+
}
|
10
|
+
|
11
|
+
const roundedValue = Math.floor(dividedValue * Math.pow(10, decimals)) / Math.pow(10, decimals);
|
12
|
+
|
13
|
+
return `${roundedValue}${suffixes[suffixIndex]}`;
|
14
|
+
};
|
@@ -0,0 +1,200 @@
|
|
1
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
2
|
+
import axios, { type AxiosInstance } from 'axios';
|
3
|
+
|
4
|
+
const BASE_URL = 'https://api.tyrads.com/v3.0/';
|
5
|
+
|
6
|
+
interface TranslationResponse {
|
7
|
+
data: Array<{
|
8
|
+
code: string;
|
9
|
+
sha256: string;
|
10
|
+
}>;
|
11
|
+
}
|
12
|
+
|
13
|
+
type Translations = {
|
14
|
+
[key: string]: string | Translations;
|
15
|
+
};
|
16
|
+
|
17
|
+
class LocalizationService {
|
18
|
+
private static instance: LocalizationService;
|
19
|
+
private axios: AxiosInstance | null = null;
|
20
|
+
private translations: Translations = {};
|
21
|
+
private supportedLocales: string[] = [];
|
22
|
+
private readonly fallbackLocale: string = 'en';
|
23
|
+
|
24
|
+
private constructor() {
|
25
|
+
}
|
26
|
+
|
27
|
+
public static getInstance(): LocalizationService {
|
28
|
+
if (!LocalizationService.instance) {
|
29
|
+
LocalizationService.instance = new LocalizationService();
|
30
|
+
}
|
31
|
+
return LocalizationService.instance;
|
32
|
+
}
|
33
|
+
|
34
|
+
private static async getHeadersFromStorage(): Promise<Record<string, string>> {
|
35
|
+
try {
|
36
|
+
const data = await AsyncStorage.getItem('credentials');
|
37
|
+
return data ? JSON.parse(data) : {};
|
38
|
+
} catch (error) {
|
39
|
+
console.error('Failed to retrieve headers from AsyncStorage', error);
|
40
|
+
return {};
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
public async init(locale: string): Promise<void> {
|
46
|
+
if (this.axios) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
|
50
|
+
const headers = await LocalizationService.getHeadersFromStorage();
|
51
|
+
|
52
|
+
this.axios = axios.create({
|
53
|
+
baseURL: BASE_URL,
|
54
|
+
timeout: 10000,
|
55
|
+
headers: {
|
56
|
+
'Content-Type': 'application/json',
|
57
|
+
Accept: 'application/json',
|
58
|
+
"X-API-Key": headers["X-API-Key"],
|
59
|
+
"X-API-Secret": headers["X-API-Secret"],
|
60
|
+
}
|
61
|
+
});
|
62
|
+
|
63
|
+
this.axios.interceptors.request.use(
|
64
|
+
(config) => {
|
65
|
+
console.log('====================================');
|
66
|
+
console.log(`Request: ${config.method} ${config.baseURL}${config.url}`);
|
67
|
+
console.log('Headers:', config.headers);
|
68
|
+
console.log('====================================');
|
69
|
+
return config;
|
70
|
+
},
|
71
|
+
(error) => {
|
72
|
+
return Promise.reject(error);
|
73
|
+
}
|
74
|
+
);
|
75
|
+
this.axios.interceptors.response.use(
|
76
|
+
(res) => {
|
77
|
+
console.log('====================================');
|
78
|
+
console.log('Response Data:', res.data);
|
79
|
+
console.log('====================================');
|
80
|
+
return res;
|
81
|
+
},
|
82
|
+
(error) => {
|
83
|
+
return Promise.reject(error);
|
84
|
+
}
|
85
|
+
);
|
86
|
+
await this.loadTranslations(locale);
|
87
|
+
}
|
88
|
+
|
89
|
+
private async loadTranslations(locale: string, force = false): Promise<void> {
|
90
|
+
const hasUpdate = await this.checkForUpdate(locale, force);
|
91
|
+
|
92
|
+
if (!hasUpdate) {
|
93
|
+
const cachedData = await AsyncStorage.getItem(`translations_${locale}`);
|
94
|
+
if (cachedData) {
|
95
|
+
try {
|
96
|
+
this.translations = JSON.parse(cachedData);
|
97
|
+
return;
|
98
|
+
} catch (e) {
|
99
|
+
console.error('Failed to parse cached translations', e);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
await this.fetchTranslations(locale, force);
|
105
|
+
}
|
106
|
+
|
107
|
+
private async fetchTranslations(locale: string, force = false): Promise<void> {
|
108
|
+
if (!this.axios) return;
|
109
|
+
try {
|
110
|
+
let effectiveLocale = locale;
|
111
|
+
if (!this.supportedLocales.includes(locale)) {
|
112
|
+
effectiveLocale = this.fallbackLocale;
|
113
|
+
}
|
114
|
+
|
115
|
+
const response = await this.axios.get(
|
116
|
+
`translations/${effectiveLocale}`,
|
117
|
+
{
|
118
|
+
params: {
|
119
|
+
force,
|
120
|
+
format: 'nested',
|
121
|
+
},
|
122
|
+
}
|
123
|
+
);
|
124
|
+
|
125
|
+
if (response.status === 200) {
|
126
|
+
this.translations = response.data as Translations;
|
127
|
+
await AsyncStorage.setItem(`translations_${effectiveLocale}`, JSON.stringify(response.data));
|
128
|
+
} else {
|
129
|
+
console.warn(`Failed to load translations: ${response.status}`);
|
130
|
+
}
|
131
|
+
} catch (e) {
|
132
|
+
if (axios.isAxiosError(e)) {
|
133
|
+
console.error('Network error fetching translations:', e.message);
|
134
|
+
} else {
|
135
|
+
console.error('An unexpected error occurred:', e);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
private async checkForUpdate(locale: string, force = false): Promise<boolean> {
|
141
|
+
if (!this.axios) return false;
|
142
|
+
try {
|
143
|
+
const response = await this.axios.get<TranslationResponse>('translations/version', { params: { force } });
|
144
|
+
if (response.status === 200) {
|
145
|
+
const data = response.data.data;
|
146
|
+
this.supportedLocales = data.map(item => item.code);
|
147
|
+
|
148
|
+
const currentLocaleData = data.find(item => item.code === locale);
|
149
|
+
if (!currentLocaleData) {
|
150
|
+
return false;
|
151
|
+
}
|
152
|
+
|
153
|
+
const currentLocaleSha256 = currentLocaleData.sha256;
|
154
|
+
const cachedVersion = await AsyncStorage.getItem(`cached_version_${locale}`);
|
155
|
+
|
156
|
+
if (currentLocaleSha256 !== cachedVersion) {
|
157
|
+
await AsyncStorage.setItem(`cached_version_${locale}`, currentLocaleSha256);
|
158
|
+
return true;
|
159
|
+
}
|
160
|
+
}
|
161
|
+
} catch (e) {
|
162
|
+
if (axios.isAxiosError(e)) {
|
163
|
+
console.error('Error checking for update:', e.message);
|
164
|
+
} else {
|
165
|
+
console.error('An unexpected error occurred:', e);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
return false;
|
169
|
+
}
|
170
|
+
|
171
|
+
public translate(key: string, args: Record<string, string | number> = {}): string {
|
172
|
+
const keys = key.split('.');
|
173
|
+
let currentMap: any = this.translations;
|
174
|
+
|
175
|
+
for (const k of keys) {
|
176
|
+
if (typeof currentMap === 'object' && currentMap !== null && currentMap.hasOwnProperty(k)) {
|
177
|
+
currentMap = currentMap[k];
|
178
|
+
} else {
|
179
|
+
return key;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
if (typeof currentMap === 'string') {
|
184
|
+
let result = currentMap;
|
185
|
+
for (const [argKey, argValue] of Object.entries(args)) {
|
186
|
+
const regex = new RegExp(`{${argKey}}`, 'gi');
|
187
|
+
result = result.replace(regex, String(argValue));
|
188
|
+
}
|
189
|
+
return result;
|
190
|
+
}
|
191
|
+
|
192
|
+
return key;
|
193
|
+
}
|
194
|
+
|
195
|
+
public async changeLanguage(locale: string, force = false): Promise<void> {
|
196
|
+
await this.loadTranslations(locale, force);
|
197
|
+
}
|
198
|
+
}
|
199
|
+
|
200
|
+
export default LocalizationService;
|
@@ -25,4 +25,18 @@ export const getData = async <T>(key: string): Promise<T | null> => {
|
|
25
25
|
}
|
26
26
|
return null;
|
27
27
|
}
|
28
|
+
};
|
29
|
+
|
30
|
+
export const clearData = async <T>(key: string): Promise<T | null> => {
|
31
|
+
try {
|
32
|
+
await AsyncStorage.removeItem(key);
|
33
|
+
return true as T;
|
34
|
+
} catch (e: any) {
|
35
|
+
if (e instanceof Error) {
|
36
|
+
console.error('Error getting object:', e.message);
|
37
|
+
} else {
|
38
|
+
console.error('An unknown error occurred while getting.');
|
39
|
+
}
|
40
|
+
return false as T;
|
41
|
+
}
|
28
42
|
};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { TouchableOpacity, Text, StyleSheet, View, } from 'react-native';
|
3
|
+
import { useLocalization } from '../../localization/localization_context';
|
3
4
|
// import { useTranslation } from 'react-i18next';
|
4
5
|
|
5
6
|
interface ActiveOffersBtnProps {
|
@@ -9,14 +10,14 @@ interface ActiveOffersBtnProps {
|
|
9
10
|
}
|
10
11
|
|
11
12
|
const ActiveOffersButton: React.FC<ActiveOffersBtnProps> = ({ premiumColor, activeCount, onPress }) => {
|
12
|
-
|
13
|
+
const { t } = useLocalization();
|
13
14
|
return (
|
14
15
|
<TouchableOpacity
|
15
16
|
style={[styles.button, { borderColor: premiumColor }]}
|
16
17
|
onPress={() => onPress && onPress('active-offers')}
|
17
18
|
>
|
18
19
|
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
19
|
-
<Text style={[styles.buttonText, { color: premiumColor }]}>
|
20
|
+
<Text style={[styles.buttonText, { color: premiumColor }]}>{t("data.offers.button.activeOffers")}</Text>
|
20
21
|
{activeCount > 0 &&
|
21
22
|
<View style={styles.activeCountContainer}>
|
22
23
|
<Text style={styles.activeCountText}>{activeCount > 99 ? '99+' : activeCount}</Text>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import numeral from 'numeral';
|
2
1
|
import React, { useState } from 'react';
|
2
|
+
import {numeral} from '../../../core/helpers/numeral';
|
3
3
|
import {
|
4
4
|
View,
|
5
5
|
Text,
|
@@ -71,13 +71,13 @@ const AcmoOfferCard: React.FC<Props> = ({
|
|
71
71
|
<View style={styles.payoutSection}>
|
72
72
|
{currencySaleModel?.multiplier && (
|
73
73
|
<Text style={styles.strikePayout}>
|
74
|
-
{numeral(item.campaignPayout.totalPlayablePayoutConverted)
|
74
|
+
{numeral(item.campaignPayout.totalPlayablePayoutConverted)}
|
75
75
|
</Text>
|
76
76
|
)}
|
77
77
|
<View style={styles.payoutRow}>
|
78
78
|
<Image source={{ uri: item.currency.adUnitCurrencyIcon }} style={styles.currencyIcon} />
|
79
79
|
<Text style={styles.payoutText}>
|
80
|
-
{numeral(item.campaignPayout.totalPlayablePayoutConverted * bonusMultiplier)
|
80
|
+
{numeral(item.campaignPayout.totalPlayablePayoutConverted * bonusMultiplier)}
|
81
81
|
</Text>
|
82
82
|
</View>
|
83
83
|
</View>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import {numeral} from '../../../core/helpers/numeral';
|
2
3
|
import {
|
3
4
|
View,
|
4
5
|
Text,
|
@@ -7,7 +8,7 @@ import {
|
|
7
8
|
StyleSheet,
|
8
9
|
ActivityIndicator,
|
9
10
|
} from 'react-native';
|
10
|
-
import
|
11
|
+
import { useLocalization } from '../../localization/localization_context';
|
11
12
|
|
12
13
|
|
13
14
|
|
@@ -45,6 +46,7 @@ export const AcmoOfferListItem: React.FC<Props> = ({
|
|
45
46
|
const bonusMultiplier = currencySales?.multiplier ?? 1;
|
46
47
|
const isLoading = loadingIndex === index;
|
47
48
|
const anyLoading = loadingIndex != null;
|
49
|
+
const { t } = useLocalization();
|
48
50
|
|
49
51
|
return (
|
50
52
|
<TouchableOpacity
|
@@ -62,7 +64,8 @@ export const AcmoOfferListItem: React.FC<Props> = ({
|
|
62
64
|
{currencySales && (
|
63
65
|
<View style={[styles.bonusBadge, { backgroundColor: `${colorPremium}20` }]}>
|
64
66
|
<Text style={[styles.bonusText, { color: colorPremium }]}>
|
65
|
-
{
|
67
|
+
{t('data.shared.label.bonusTagCaps',
|
68
|
+
{ 'multiplier': currencySales?.multiplier! },)}
|
66
69
|
</Text>
|
67
70
|
</View>
|
68
71
|
)}
|
@@ -74,7 +77,7 @@ export const AcmoOfferListItem: React.FC<Props> = ({
|
|
74
77
|
<View style={styles.payoutRow}>
|
75
78
|
{currencySales && (
|
76
79
|
<Text style={styles.strikeText}>
|
77
|
-
{numeral(offer.campaignPayout.totalPlayablePayoutConverted)
|
80
|
+
{numeral(offer.campaignPayout.totalPlayablePayoutConverted)}
|
78
81
|
</Text>
|
79
82
|
)}
|
80
83
|
|
@@ -86,7 +89,7 @@ export const AcmoOfferListItem: React.FC<Props> = ({
|
|
86
89
|
<Text style={styles.payoutText}>
|
87
90
|
{numeral(
|
88
91
|
offer.campaignPayout.totalPlayablePayoutConverted * bonusMultiplier
|
89
|
-
)
|
92
|
+
)}
|
90
93
|
</Text>
|
91
94
|
</View>
|
92
95
|
</View>
|
@@ -115,7 +118,7 @@ export const AcmoOfferListItem: React.FC<Props> = ({
|
|
115
118
|
},
|
116
119
|
]}
|
117
120
|
>
|
118
|
-
|
121
|
+
{t("data.widget.button.play")}
|
119
122
|
</Text>
|
120
123
|
</TouchableOpacity>
|
121
124
|
|