Skip to content

Commit 39107ba

Browse files
cp-sumi-knamidan
andauthored
NC-5315: add missing fields in NamiCampaign and NamiPurchase (#338)
* NC-5315: add missing fields in NamiCampaign and NamiPurchase * Update NamiCampaign and NamiPurchase * Fix eslint * Replace external_segment_id to external_segment --------- Co-authored-by: Dan Burcaw <[email protected]>
1 parent ad96c01 commit 39107ba

File tree

5 files changed

+43
-8
lines changed

5 files changed

+43
-8
lines changed

examples/Basic/index.js

+18
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,24 @@ const Root = () => {
5656
return () => {};
5757
}, []);
5858

59+
useEffect(() => {
60+
async function configureNami() {
61+
checkSdkConfigured();
62+
63+
const result = await Nami.configure(configDict);
64+
if(result.success){
65+
setIsConfigurationComplete(true);
66+
checkSdkConfigured();
67+
}
68+
69+
initStoreConnection();
70+
71+
// eslint-disable-next-line @typescript-eslint/no-empty-function
72+
return () => {};
73+
}
74+
configureNami();
75+
}, []);
76+
5977
return isConfigurationComplete ? <App /> : <View />;
6078
};
6179

examples/TestNamiTV/index.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ const Root = () => {
2323
useEffect(() => {
2424
async function configureNami() {
2525
const result = await Nami.configure(configDict);
26-
if (result.success) {
26+
if(result.success){
2727
setIsConfigurationComplete(true);
28-
28+
2929
if (Platform.constants.Manufacturer === 'Amazon') {
3030
NamiPaywallManager.setProductDetails(getAmazonProducts(), false);
3131
}
3232
}
33+
34+
// eslint-disable-next-line @typescript-eslint/no-empty-function
35+
return () => {};
36+
3337
}
3438
configureNami();
35-
36-
// eslint-disable-next-line @typescript-eslint/no-empty-function
37-
return () => {};
3839
}, []);
3940

4041
return isConfigurationComplete ? <App /> : <View />;

index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ export { NamiEntitlementManager } from './src/NamiEntitlementManager';
66
export { NamiManager } from './src/NamiManager';
77
export { NamiPurchaseManager } from './src/NamiPurchaseManager';
88
export { NamiPaywallManager } from './src/NamiPaywallManager';
9-
export { NamiSKU } from './src/types';
109
export * from './src/types';

src/types.d.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,20 @@ export type AppleProduct = {
4747
export type GoogleProduct = {};
4848
export type AmazonProduct = {};
4949
export type NamiCampaign = {
50-
id: string;
50+
name: string;
5151
rule: string;
5252
segment: string;
5353
paywall: string;
5454
type: NamiCampaignRuleType;
5555
value?: string | null;
56+
form_factors: NamiFormFactor[];
57+
external_segment: string | null;
5658
};
59+
type NamiFormFactor = {
60+
form_factor: string;
61+
supports_portrait?: boolean;
62+
supports_landscape?: boolean;
63+
}
5764
export declare enum NamiCampaignRuleType {
5865
DEFAULT = "default",
5966
LABEL = "label",
@@ -158,6 +165,7 @@ export type NamiPurchase = {
158165
sku?: NamiSKU;
159166
skuId: string;
160167
transactionIdentifier?: string;
168+
purchaseToken?: string;
161169
expires?: Date;
162170
purchaseInitiatedTimestamp: Date;
163171
purchaseSource?: 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';

src/types.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,14 @@ export type AmazonProduct = {};
153153

154154
// NamiCampaignManager
155155
export type NamiCampaign = {
156-
id: string;
156+
name: string;
157157
rule: string;
158158
segment: string;
159159
paywall: string;
160160
type: NamiCampaignRuleType;
161161
value?: string | null;
162+
form_factors: NamiFormFactor[];
163+
external_segment: string | null;
162164
};
163165

164166
export enum NamiCampaignRuleType {
@@ -168,6 +170,12 @@ export enum NamiCampaignRuleType {
168170
URL = 'url',
169171
}
170172

173+
type NamiFormFactor = {
174+
form_factor?: string;
175+
supports_portrait?: boolean;
176+
supports_landscape?: boolean;
177+
};
178+
171179
export enum LaunchCampaignError {
172180
DEFAULT_CAMPAIGN_NOT_FOUND = 0,
173181
LABELED_CAMPAIGN_NOT_FOUND = 1,
@@ -295,6 +303,7 @@ export type NamiPurchase = {
295303
sku?: NamiSKU;
296304
skuId: string;
297305
transactionIdentifier?: string;
306+
purchaseToken?: string;
298307
expires?: Date;
299308
purchaseInitiatedTimestamp: Date;
300309
purchaseSource?: 'CAMPAIGN' | 'MARKETPLACE' | 'UNKNOWN';

0 commit comments

Comments
 (0)