@@ -55,6 +55,31 @@ export async function davinci({ config }: { config: DaVinciConfig }) {
55
55
// Pass store methods to the client
56
56
subscribe : store . subscribe ,
57
57
58
+ /**
59
+ * Social Login Handler
60
+ * Use this as part of an event when clicking on
61
+ * a social login button. Pass in the collector responsible
62
+ * for the social login being started.
63
+ *
64
+ * This method will save the `continueUrl`
65
+ * and then replace the window with the authenticate
66
+ * url from the collector
67
+ *
68
+ * Can return an error when no continue url is found
69
+ * or no authenticate url is found in the collectors
70
+ *
71
+ * @method : externalIdp
72
+ * @param collector IdpCollector
73
+ * @returns {function }
74
+ */
75
+ externalIdp : ( collector : IdpCollector ) => {
76
+ const rootState : RootState = store . getState ( ) ;
77
+
78
+ const serverSlice = nodeSlice . selectors . selectServer ( rootState ) ;
79
+
80
+ return ( ) => authorize ( serverSlice , collector ) ;
81
+ } ,
82
+
58
83
/**
59
84
* @method flow - Method for initiating a new flow, different than current flow
60
85
* @param {DaVinciAction } action - the action to initiate the flow
@@ -97,6 +122,15 @@ export async function davinci({ config }: { config: DaVinciConfig }) {
97
122
return node ;
98
123
} ,
99
124
125
+ /**
126
+ * @method : resume - Resume a social login flow when returned to application
127
+ * @returns unknown
128
+ */
129
+ resume : async ( { continueToken } : { continueToken : string } ) => {
130
+ const node = store . dispatch ( davinciApi . endpoints . resume . initiate ( { continueToken } ) ) ;
131
+ return node ;
132
+ } ,
133
+
100
134
/**
101
135
* @method start - Method for initiating a DaVinci flow
102
136
* @returns {Promise } - a promise that initiates a DaVinci flow and returns a node
@@ -140,13 +174,20 @@ export async function davinci({ config }: { config: DaVinciConfig }) {
140
174
} ;
141
175
}
142
176
143
- if ( collectorToUpdate . category !== 'SingleValueCollector' ) {
144
- console . error ( 'Collector is not a SingleValueCollector and cannot be updated' ) ;
177
+ if (
178
+ collectorToUpdate . category !== 'MultiValueCollector' &&
179
+ collectorToUpdate . category !== 'SingleValueCollector' &&
180
+ collectorToUpdate . category !== 'ValidatedSingleValueCollector'
181
+ ) {
182
+ console . error (
183
+ 'Collector is not a MultiValueCollector, SingleValueCollector or ValidatedSingleValueCollector and cannot be updated' ,
184
+ ) ;
145
185
return function ( ) {
146
186
return {
147
187
type : 'internal_error' ,
148
188
error : {
149
- message : 'Collector is not a SingleValueCollector and cannot be updated' ,
189
+ message :
190
+ 'Collector is not a SingleValueCollector or ValidatedSingleValueCollector and cannot be updated' ,
150
191
type : 'state_error' ,
151
192
} ,
152
193
} as const ;
@@ -271,39 +312,6 @@ export async function davinci({ config }: { config: DaVinciConfig }) {
271
312
return nodeSlice . selectors . selectServer ( state ) ;
272
313
} ,
273
314
274
- /**
275
- * @method : resume - Resume a social login flow when returned to application
276
- * @returns unknown
277
- */
278
- resume : async ( { continueToken } : { continueToken : string } ) => {
279
- const node = store . dispatch ( davinciApi . endpoints . resume . initiate ( { continueToken } ) ) ;
280
- return node ;
281
- } ,
282
- /**
283
- * Social Login Handler
284
- * Use this as part of an event when clicking on
285
- * a social login button. Pass in the collector responsible
286
- * for the social login being started.
287
- *
288
- * This method will save the `continueUrl`
289
- * and then replace the window with the authenticate
290
- * url from the collector
291
- *
292
- * Can return an error when no continue url is found
293
- * or no authenticate url is found in the collectors
294
- *
295
- * @method : externalIdp
296
- * @param collector IdpCollector
297
- * @returns {function }
298
- */
299
- externalIdp : ( collector : IdpCollector ) => {
300
- const rootState : RootState = store . getState ( ) ;
301
-
302
- const serverSlice = nodeSlice . selectors . selectServer ( rootState ) ;
303
-
304
- return ( ) => authorize ( serverSlice , collector ) ;
305
- } ,
306
-
307
315
/**
308
316
* Utilities to help query cached responses from server
309
317
*/
0 commit comments