@sendoracloud/sdk-react-native 0.18.6 → 0.18.7
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/dist/index.cjs +58 -0
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +58 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2141,6 +2141,64 @@ var SendoraSDK = class {
|
|
|
2141
2141
|
}
|
|
2142
2142
|
};
|
|
2143
2143
|
}
|
|
2144
|
+
/**
|
|
2145
|
+
* Feature-flags namespace — per-user evaluation against percentage
|
|
2146
|
+
* rollouts + audience targeting. Mirrors backend
|
|
2147
|
+
* `/feature-flags/{evaluate,evaluate-all}` SDK routes and the web
|
|
2148
|
+
* SDK's `FeatureFlags` class.
|
|
2149
|
+
*
|
|
2150
|
+
* `evaluate(key)` returns the resolved value (boolean / string /
|
|
2151
|
+
* number / variant payload) for a single flag — use when you only
|
|
2152
|
+
* need one specific flag in a code path.
|
|
2153
|
+
*
|
|
2154
|
+
* `evaluateAll()` returns the full flag map in one round-trip —
|
|
2155
|
+
* call once on app startup or screen mount, then read from the
|
|
2156
|
+
* map locally. Avoids N+1.
|
|
2157
|
+
*
|
|
2158
|
+
* Both methods auto-thread `userId` (from `identify()`) when not
|
|
2159
|
+
* passed. `entityId` is for entity-scoped flags (org / team /
|
|
2160
|
+
* device-cohort); typically omitted in mobile apps.
|
|
2161
|
+
*/
|
|
2162
|
+
get flags() {
|
|
2163
|
+
const self = this;
|
|
2164
|
+
return {
|
|
2165
|
+
evaluate: async (input) => {
|
|
2166
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before flags.evaluate().");
|
|
2167
|
+
const body = {
|
|
2168
|
+
key: input.key,
|
|
2169
|
+
userId: input.userId ?? self.userId ?? void 0,
|
|
2170
|
+
entityId: input.entityId,
|
|
2171
|
+
environment: input.environment
|
|
2172
|
+
};
|
|
2173
|
+
const res = await post(
|
|
2174
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2175
|
+
"/feature-flags/evaluate",
|
|
2176
|
+
body
|
|
2177
|
+
);
|
|
2178
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluate failed (${res?.status ?? "network"})`);
|
|
2179
|
+
const parsed = await res.json();
|
|
2180
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] flags.evaluate: bad response");
|
|
2181
|
+
return parsed.data;
|
|
2182
|
+
},
|
|
2183
|
+
evaluateAll: async (input) => {
|
|
2184
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before flags.evaluateAll().");
|
|
2185
|
+
const body = {
|
|
2186
|
+
userId: input?.userId ?? self.userId ?? void 0,
|
|
2187
|
+
entityId: input?.entityId,
|
|
2188
|
+
environment: input?.environment
|
|
2189
|
+
};
|
|
2190
|
+
const res = await post(
|
|
2191
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2192
|
+
"/feature-flags/evaluate-all",
|
|
2193
|
+
body
|
|
2194
|
+
);
|
|
2195
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluateAll failed (${res?.status ?? "network"})`);
|
|
2196
|
+
const parsed = await res.json();
|
|
2197
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] flags.evaluateAll: bad response");
|
|
2198
|
+
return parsed.data;
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
}
|
|
2144
2202
|
/**
|
|
2145
2203
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
2146
2204
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.d.cts
CHANGED
|
@@ -1035,6 +1035,46 @@ declare class SendoraSDK {
|
|
|
1035
1035
|
entityId?: string;
|
|
1036
1036
|
}) => Promise<void>;
|
|
1037
1037
|
};
|
|
1038
|
+
/**
|
|
1039
|
+
* Feature-flags namespace — per-user evaluation against percentage
|
|
1040
|
+
* rollouts + audience targeting. Mirrors backend
|
|
1041
|
+
* `/feature-flags/{evaluate,evaluate-all}` SDK routes and the web
|
|
1042
|
+
* SDK's `FeatureFlags` class.
|
|
1043
|
+
*
|
|
1044
|
+
* `evaluate(key)` returns the resolved value (boolean / string /
|
|
1045
|
+
* number / variant payload) for a single flag — use when you only
|
|
1046
|
+
* need one specific flag in a code path.
|
|
1047
|
+
*
|
|
1048
|
+
* `evaluateAll()` returns the full flag map in one round-trip —
|
|
1049
|
+
* call once on app startup or screen mount, then read from the
|
|
1050
|
+
* map locally. Avoids N+1.
|
|
1051
|
+
*
|
|
1052
|
+
* Both methods auto-thread `userId` (from `identify()`) when not
|
|
1053
|
+
* passed. `entityId` is for entity-scoped flags (org / team /
|
|
1054
|
+
* device-cohort); typically omitted in mobile apps.
|
|
1055
|
+
*/
|
|
1056
|
+
get flags(): {
|
|
1057
|
+
evaluate: (input: {
|
|
1058
|
+
key: string;
|
|
1059
|
+
entityId?: string;
|
|
1060
|
+
userId?: string;
|
|
1061
|
+
environment?: string;
|
|
1062
|
+
}) => Promise<{
|
|
1063
|
+
key: string;
|
|
1064
|
+
value: unknown;
|
|
1065
|
+
variant: string | null;
|
|
1066
|
+
reason: string;
|
|
1067
|
+
}>;
|
|
1068
|
+
evaluateAll: (input?: {
|
|
1069
|
+
entityId?: string;
|
|
1070
|
+
userId?: string;
|
|
1071
|
+
environment?: string;
|
|
1072
|
+
}) => Promise<Record<string, {
|
|
1073
|
+
value: unknown;
|
|
1074
|
+
variant: string | null;
|
|
1075
|
+
reason: string;
|
|
1076
|
+
}>>;
|
|
1077
|
+
};
|
|
1038
1078
|
/**
|
|
1039
1079
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
1040
1080
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.d.ts
CHANGED
|
@@ -1035,6 +1035,46 @@ declare class SendoraSDK {
|
|
|
1035
1035
|
entityId?: string;
|
|
1036
1036
|
}) => Promise<void>;
|
|
1037
1037
|
};
|
|
1038
|
+
/**
|
|
1039
|
+
* Feature-flags namespace — per-user evaluation against percentage
|
|
1040
|
+
* rollouts + audience targeting. Mirrors backend
|
|
1041
|
+
* `/feature-flags/{evaluate,evaluate-all}` SDK routes and the web
|
|
1042
|
+
* SDK's `FeatureFlags` class.
|
|
1043
|
+
*
|
|
1044
|
+
* `evaluate(key)` returns the resolved value (boolean / string /
|
|
1045
|
+
* number / variant payload) for a single flag — use when you only
|
|
1046
|
+
* need one specific flag in a code path.
|
|
1047
|
+
*
|
|
1048
|
+
* `evaluateAll()` returns the full flag map in one round-trip —
|
|
1049
|
+
* call once on app startup or screen mount, then read from the
|
|
1050
|
+
* map locally. Avoids N+1.
|
|
1051
|
+
*
|
|
1052
|
+
* Both methods auto-thread `userId` (from `identify()`) when not
|
|
1053
|
+
* passed. `entityId` is for entity-scoped flags (org / team /
|
|
1054
|
+
* device-cohort); typically omitted in mobile apps.
|
|
1055
|
+
*/
|
|
1056
|
+
get flags(): {
|
|
1057
|
+
evaluate: (input: {
|
|
1058
|
+
key: string;
|
|
1059
|
+
entityId?: string;
|
|
1060
|
+
userId?: string;
|
|
1061
|
+
environment?: string;
|
|
1062
|
+
}) => Promise<{
|
|
1063
|
+
key: string;
|
|
1064
|
+
value: unknown;
|
|
1065
|
+
variant: string | null;
|
|
1066
|
+
reason: string;
|
|
1067
|
+
}>;
|
|
1068
|
+
evaluateAll: (input?: {
|
|
1069
|
+
entityId?: string;
|
|
1070
|
+
userId?: string;
|
|
1071
|
+
environment?: string;
|
|
1072
|
+
}) => Promise<Record<string, {
|
|
1073
|
+
value: unknown;
|
|
1074
|
+
variant: string | null;
|
|
1075
|
+
reason: string;
|
|
1076
|
+
}>>;
|
|
1077
|
+
};
|
|
1038
1078
|
/**
|
|
1039
1079
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
1040
1080
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/dist/index.js
CHANGED
|
@@ -2103,6 +2103,64 @@ var SendoraSDK = class {
|
|
|
2103
2103
|
}
|
|
2104
2104
|
};
|
|
2105
2105
|
}
|
|
2106
|
+
/**
|
|
2107
|
+
* Feature-flags namespace — per-user evaluation against percentage
|
|
2108
|
+
* rollouts + audience targeting. Mirrors backend
|
|
2109
|
+
* `/feature-flags/{evaluate,evaluate-all}` SDK routes and the web
|
|
2110
|
+
* SDK's `FeatureFlags` class.
|
|
2111
|
+
*
|
|
2112
|
+
* `evaluate(key)` returns the resolved value (boolean / string /
|
|
2113
|
+
* number / variant payload) for a single flag — use when you only
|
|
2114
|
+
* need one specific flag in a code path.
|
|
2115
|
+
*
|
|
2116
|
+
* `evaluateAll()` returns the full flag map in one round-trip —
|
|
2117
|
+
* call once on app startup or screen mount, then read from the
|
|
2118
|
+
* map locally. Avoids N+1.
|
|
2119
|
+
*
|
|
2120
|
+
* Both methods auto-thread `userId` (from `identify()`) when not
|
|
2121
|
+
* passed. `entityId` is for entity-scoped flags (org / team /
|
|
2122
|
+
* device-cohort); typically omitted in mobile apps.
|
|
2123
|
+
*/
|
|
2124
|
+
get flags() {
|
|
2125
|
+
const self = this;
|
|
2126
|
+
return {
|
|
2127
|
+
evaluate: async (input) => {
|
|
2128
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before flags.evaluate().");
|
|
2129
|
+
const body = {
|
|
2130
|
+
key: input.key,
|
|
2131
|
+
userId: input.userId ?? self.userId ?? void 0,
|
|
2132
|
+
entityId: input.entityId,
|
|
2133
|
+
environment: input.environment
|
|
2134
|
+
};
|
|
2135
|
+
const res = await post(
|
|
2136
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2137
|
+
"/feature-flags/evaluate",
|
|
2138
|
+
body
|
|
2139
|
+
);
|
|
2140
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluate failed (${res?.status ?? "network"})`);
|
|
2141
|
+
const parsed = await res.json();
|
|
2142
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] flags.evaluate: bad response");
|
|
2143
|
+
return parsed.data;
|
|
2144
|
+
},
|
|
2145
|
+
evaluateAll: async (input) => {
|
|
2146
|
+
if (!self.config) throw new Error("[sendoracloud] init() must complete before flags.evaluateAll().");
|
|
2147
|
+
const body = {
|
|
2148
|
+
userId: input?.userId ?? self.userId ?? void 0,
|
|
2149
|
+
entityId: input?.entityId,
|
|
2150
|
+
environment: input?.environment
|
|
2151
|
+
};
|
|
2152
|
+
const res = await post(
|
|
2153
|
+
{ apiUrl: self.config.apiUrl, publicKey: self.config.publicKey, debug: self.debug },
|
|
2154
|
+
"/feature-flags/evaluate-all",
|
|
2155
|
+
body
|
|
2156
|
+
);
|
|
2157
|
+
if (!res || !res.ok) throw new Error(`[sendoracloud] flags.evaluateAll failed (${res?.status ?? "network"})`);
|
|
2158
|
+
const parsed = await res.json();
|
|
2159
|
+
if (!parsed.success || !parsed.data) throw new Error("[sendoracloud] flags.evaluateAll: bad response");
|
|
2160
|
+
return parsed.data;
|
|
2161
|
+
}
|
|
2162
|
+
};
|
|
2163
|
+
}
|
|
2106
2164
|
/**
|
|
2107
2165
|
* Clear identity + rotate the anonymous id. Call on logout. Awaits
|
|
2108
2166
|
* the AsyncStorage writes so a caller who kills the app immediately
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendoracloud/sdk-react-native",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
4
4
|
"description": "Sendora Cloud React Native + Expo SDK — analytics, identity, push-token registration, auth, deep links (Branch / Firebase Dynamic Links parity). Auth + analytics + deep links work in Expo Go; push token registration requires a Dev Client (EAS Build or `npx expo prebuild`).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|