@@ -48,6 +48,30 @@ class _RoktLayoutsScreenState extends State<RoktLayoutsScreen> {
4848 return {};
4949 }
5050
51+ Map <String , String > _getShoppableAdsAttributes () {
52+ return {
53+ 'country' : 'US' ,
54+ 'shippingstate' : 'NY' ,
55+ 'shippingzipcode' : '10001' ,
56+ 'firstname' : 'Jenny' ,
57+ 'stripeApplePayAvailable' : 'true' ,
58+ 'last4digits' : '4444' ,
59+ 'shippingaddress1' : '123 Main St' ,
60+ 'colormode' : 'LIGHT' ,
61+ 'billingzipcode' : '07762' ,
62+ 'paymenttype' : 'ApplePay' ,
63+ 'shippingcountry' : 'US' ,
64+ 'sandbox' : 'true' ,
65+ 'shippingaddress2' : 'Apt 4B' ,
66+ 'confirmationref' : 'ORD-12345' ,
67+ 'shippingcity' : 'New York' ,
68+ 'newToApplePay' : 'false' ,
69+ 'applePayCapabilities' : 'true' ,
70+ 'lastname' : 'Smith' ,
71+ 'email' : 'jenny.smith@example.com' ,
72+ };
73+ }
74+
5175 String _getPlatform () {
5276 if (kIsWeb) {
5377 return 'Web' ;
@@ -151,6 +175,30 @@ class _RoktLayoutsScreenState extends State<RoktLayoutsScreen> {
151175 print ('Error calling Rokt selectPlacements: $e ' );
152176 }
153177 }),
178+ const SizedBox (height: 20 ),
179+ buildButton ('Select Shoppable Ads (iOS)' , () async {
180+ if (! Platform .isIOS) {
181+ print ('${_getPlatform ()} SelectShoppableAds is a no-op' );
182+ return ;
183+ }
184+
185+ var identityRequest = MparticleFlutterSdk .identityRequest;
186+ identityRequest.setIdentity (
187+ identityType: IdentityType .CustomerId ,
188+ value: _getIdentityValue ());
189+
190+ try {
191+ await widget.mpInstance? .identity
192+ .identify (identityRequest: identityRequest);
193+
194+ widget.mpInstance? .rokt.selectShoppableAds (
195+ identifier: 'MSDKShoppableAdsLayout' ,
196+ attributes: _getShoppableAdsAttributes ());
197+ print ('${_getPlatform ()} Rokt selectShoppableAds called' );
198+ } catch (e) {
199+ print ('Error calling Rokt selectShoppableAds: $e ' );
200+ }
201+ }),
154202 Center (
155203 child: Text ("Location1" , style: TextStyle (fontSize: 20 , fontWeight: FontWeight .bold)),
156204 ),
0 commit comments