@openg2p/registry-widgets 1.1.0-dev.5 → 1.1.0-dev.6

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.js CHANGED
@@ -10619,7 +10619,7 @@ const IdAuthenticationWidget = ({ config, schemaData: propSchemaData }) => {
10619
10619
  return dataPath;
10620
10620
  }, [dataPath]);
10621
10621
  const authConfig = config['widget-auth-config'];
10622
- const registerId = resolveValueFromSources(paths.registerId, values, schemaData);
10622
+ const registerId = authConfig?.registerId ?? undefined;
10623
10623
  const internalRecordId = resolveValueFromSources(paths.internalRecordId, values, schemaData);
10624
10624
  const initiatedByStaffId = resolveValueFromSources(paths.initiatedByStaffId, values, schemaData);
10625
10625
  const providerId = authConfig?.providerId;
@@ -10715,12 +10715,18 @@ const IdAuthenticationWidget = ({ config, schemaData: propSchemaData }) => {
10715
10715
  if (!url && canCallAuthApi) {
10716
10716
  setAuthActionLoading(true);
10717
10717
  try {
10718
- const resp = await dataSourceRequestHandler(authConfig.service, authConfig.authenticateEndpoint, authConfig.authenticateMethod || 'POST', {
10718
+ const basePayload = {
10719
10719
  register_id: registerId,
10720
10720
  internal_record_id: internalRecordId,
10721
- provider_id: authConfig.providerId,
10721
+ provider_id: providerId,
10722
10722
  initiated_by_staff_id: initiatedByStaffId,
10723
- });
10723
+ };
10724
+ const wrap = authConfig.wrapRequestPayload !== false;
10725
+ const payloadKey = authConfig.requestPayloadKey || 'request_payload';
10726
+ const requestParams = wrap ? { [payloadKey]: basePayload } : basePayload;
10727
+ // eslint-disable-next-line no-console
10728
+ console.log('[IdAuthenticationWidget] authenticate_registrant params', requestParams);
10729
+ const resp = await dataSourceRequestHandler(authConfig.service, authConfig.authenticateEndpoint, authConfig.authenticateMethod || 'POST', requestParams);
10724
10730
  const payload = unwrapPayload(resp);
10725
10731
  const authUrl = pickAuthorizationUrl(payload, authConfig.authorizationUrlKey);
10726
10732
  url = authUrl || null;