react-native-nami-sdk 3.4.12-dev.202610061758 → 3.4.12-dev.202610081956

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.
@@ -85,8 +85,8 @@ dependencies {
85
85
  implementation fileTree(dir: 'libs', include: ['*.jar'])
86
86
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
87
87
 
88
- playImplementation "com.namiml:sdk-android:3.4.12-dev.202610061758"
89
- amazonImplementation "com.namiml:sdk-amazon:3.4.12-dev.202610061758"
88
+ playImplementation "com.namiml:sdk-android:3.4.12-dev.202610081956"
89
+ amazonImplementation "com.namiml:sdk-amazon:3.4.12-dev.202610081956"
90
90
 
91
91
  implementation "com.facebook.react:react-native:+" // From node_modules
92
92
  coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4"
@@ -13,6 +13,7 @@ import com.namiml.Nami
13
13
  import com.namiml.NamiConfiguration
14
14
  import com.namiml.NamiLanguageCode
15
15
  import com.namiml.NamiLogLevel
16
+ import com.namiml.api.model.DeviceFormFactor
16
17
 
17
18
  @ReactModule(name = NamiBridgeModule.NAME)
18
19
  class NamiBridgeModule internal constructor(
@@ -28,6 +29,7 @@ class NamiBridgeModule internal constructor(
28
29
  private const val CONFIG_MAP_NAMI_COMMANDS_KEY = "namiCommands"
29
30
  private const val CONFIG_MAP_LANGUAGE_CODE_KEY = "namiLanguageCode"
30
31
  private const val CONFIG_MAP_INITIAL_CONFIG_KEY = "initialConfig"
32
+ private const val CONFIG_MAP_FORM_FACTOR_KEY = "formFactor"
31
33
 
32
34
  private const val PLATFORM_ID_ERROR_VALUE = "APPPLATFORMID_NOT_FOUND"
33
35
  }
@@ -86,6 +88,21 @@ class NamiBridgeModule internal constructor(
86
88
  builder.initialConfig = it
87
89
  }
88
90
 
91
+ configDict.getString(CONFIG_MAP_FORM_FACTOR_KEY)?.let { rawFormFactor ->
92
+ val formFactor =
93
+ when (rawFormFactor.lowercase()) {
94
+ "phone" -> DeviceFormFactor.PHONE
95
+ "tablet" -> DeviceFormFactor.TABLET
96
+ "television" -> DeviceFormFactor.TELEVISION
97
+ else -> null
98
+ }
99
+ if (formFactor != null) {
100
+ builder.formFactor = formFactor
101
+ } else {
102
+ Log.w("RNNami", "Ignoring unsupported formFactor override: $rawFormFactor")
103
+ }
104
+ }
105
+
89
106
  context.runOnUiQueueThread {
90
107
  Nami.configure(builder.build()) { result ->
91
108
  val resultMap =
@@ -6,6 +6,7 @@ export interface Spec extends TurboModule {
6
6
  namiCommands?: string[];
7
7
  namiLanguageCode?: string;
8
8
  initialConfig?: string;
9
+ formFactor?: string;
9
10
  }): Promise<{
10
11
  success: boolean;
11
12
  }>;
@@ -1,9 +1,15 @@
1
+ export type NamiFormFactorOverride = 'phone' | 'tablet' | 'television';
1
2
  export type NamiConfiguration = {
2
3
  appPlatformID: string;
3
4
  logLevel: string;
4
5
  namiCommands?: string[];
5
6
  namiLanguageCode?: NamiLanguageCodes;
6
7
  initialConfig?: string;
8
+ /**
9
+ * Overrides the detected device form factor. Android only; ignored on iOS.
10
+ * Any other value is ignored with a native warning and the form factor is detected.
11
+ */
12
+ formFactor?: NamiFormFactorOverride;
7
13
  };
8
14
  export type NamiLanguageCodes = 'af' | 'ar' | 'ar-dz' | 'ast' | 'az' | 'bg' | 'be' | 'bn' | 'br' | 'bs' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'dsb' | 'el' | 'en' | 'en-au' | 'en-gb' | 'eo' | 'es' | 'es-ar' | 'es-co' | 'es-mx' | 'es-ni' | 'es-ve' | 'et' | 'eu' | 'fa' | 'fi' | 'fr' | 'fy' | 'ga' | 'gd' | 'gl' | 'he' | 'hi' | 'hr' | 'hsb' | 'hu' | 'hy' | 'ia' | 'id' | 'ig' | 'io' | 'is' | 'it' | 'ja' | 'ka' | 'kab' | 'kk' | 'km' | 'kn' | 'ko' | 'ky' | 'lb' | 'lt' | 'lv' | 'mk' | 'ml' | 'mn' | 'mr' | 'my' | 'nb' | 'ne' | 'nl' | 'nn' | 'os' | 'pa' | 'pl' | 'pt' | 'pt-br' | 'ro' | 'ru' | 'sk' | 'sl' | 'sq' | 'sr' | 'sr-latn' | 'sv' | 'sw' | 'ta' | 'te' | 'tg' | 'th' | 'tk' | 'tr' | 'tt' | 'udm' | 'uk' | 'ur' | 'uz' | 'vi' | 'zh-hans' | 'zh-hant';
9
15
  export type NamiSKU = {
@@ -2,4 +2,4 @@
2
2
  * Auto-generated file. Do not edit manually.
3
3
  * React Native Nami SDK version.
4
4
  */
5
- export declare const NAMI_REACT_NATIVE_VERSION = "3.4.12-dev.202610061758";
5
+ export declare const NAMI_REACT_NATIVE_VERSION = "3.4.12-dev.202610081956";
package/ios/Nami.swift CHANGED
@@ -59,6 +59,9 @@ class RNNami: NSObject {
59
59
  config.initialConfig = initialConfig
60
60
  }
61
61
 
62
+ // `formFactor` is an Android-only override; the Apple SDK has no equivalent, so it is
63
+ // deliberately not read here.
64
+
62
65
  var didCallBack = false
63
66
  Nami.configure(with: config) { sdkConfigured in
64
67
  didCallBack = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nami-sdk",
3
- "version": "3.4.12-dev.202610061758",
3
+ "version": "3.4.12-dev.202610081956",
4
4
  "description": "React Native SDK for Nami - No-code paywall and onboarding flows with A/B testing.",
5
5
  "main": "index.ts",
6
6
  "types": "dist/index.d.ts",
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
21
21
  s.requires_arc = true
22
22
  s.swift_version = '5.0' # or your supported version
23
23
 
24
- s.dependency 'Nami', '3.4.12-dev.202610061758'
24
+ s.dependency 'Nami', '3.4.12-dev.202610081956'
25
25
 
26
26
  pod_target_xcconfig = {
27
27
  'DEFINES_MODULE' => 'YES',
@@ -8,6 +8,7 @@ export interface Spec extends TurboModule {
8
8
  namiCommands?: string[];
9
9
  namiLanguageCode?: string;
10
10
  initialConfig?: string;
11
+ formFactor?: string;
11
12
  }): Promise<{ success: boolean }>;
12
13
 
13
14
  sdkConfigured(): Promise<boolean>;
@@ -0,0 +1,44 @@
1
+ // Mock react-native BEFORE importing the SDK — `../Nami` resolves
2
+ // the native module via TurboModuleRegistry at import time.
3
+ const configure = jest.fn().mockResolvedValue({ success: true });
4
+ const sdkConfigured = jest.fn().mockResolvedValue(false);
5
+
6
+ jest.mock('react-native', () => ({
7
+ TurboModuleRegistry: {
8
+ getEnforcing: jest.fn(() => ({ configure, sdkConfigured })),
9
+ },
10
+ NativeModules: {
11
+ RNNami: { configure, sdkConfigured },
12
+ },
13
+ }));
14
+
15
+ import { Nami } from '../Nami';
16
+
17
+ describe('Nami.configure formFactor override (NAM-3588)', () => {
18
+ beforeEach(() => {
19
+ configure.mockClear();
20
+ });
21
+
22
+ it('passes formFactor through to the native configure call', async () => {
23
+ await Nami.configure({
24
+ appPlatformID: 'app-platform-id',
25
+ logLevel: 'DEBUG',
26
+ formFactor: 'television',
27
+ });
28
+
29
+ expect(configure).toHaveBeenCalledTimes(1);
30
+ expect(configure.mock.calls[0][0]).toMatchObject({
31
+ appPlatformID: 'app-platform-id',
32
+ formFactor: 'television',
33
+ });
34
+ });
35
+
36
+ it('omits formFactor when the app does not set one', async () => {
37
+ await Nami.configure({
38
+ appPlatformID: 'app-platform-id',
39
+ logLevel: 'DEBUG',
40
+ });
41
+
42
+ expect(configure.mock.calls[0][0]).not.toHaveProperty('formFactor');
43
+ });
44
+ });
package/src/types.ts CHANGED
@@ -1,9 +1,16 @@
1
+ export type NamiFormFactorOverride = 'phone' | 'tablet' | 'television';
2
+
1
3
  export type NamiConfiguration = {
2
4
  appPlatformID: string;
3
5
  logLevel: string;
4
6
  namiCommands?: string[];
5
7
  namiLanguageCode?: NamiLanguageCodes;
6
8
  initialConfig?: string;
9
+ /**
10
+ * Overrides the detected device form factor. Android only; ignored on iOS.
11
+ * Any other value is ignored with a native warning and the form factor is detected.
12
+ */
13
+ formFactor?: NamiFormFactorOverride;
7
14
  };
8
15
 
9
16
  export type NamiLanguageCodes =
package/src/version.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Auto-generated file. Do not edit manually.
3
3
  * React Native Nami SDK version.
4
4
  */
5
- export const NAMI_REACT_NATIVE_VERSION = '3.4.12-dev.202610061758';
5
+ export const NAMI_REACT_NATIVE_VERSION = '3.4.12-dev.202610081956';