Auth Module

Privo.auth.getToken() - returns a previously issued token, if it have not expired. Can return nil if token wasn't issued or expired

Privo.auth.checkTokenValid() { 
  response in
  response.token
  response.isValid
}

Check token if exist and renew it. Return token and its status (valid or not)

Privo.auth.logout() - Logout and clean previously issued token.

Privo.auth.renewToken() - Renew token. Return token and it's status.

Privo.auth.showAuth() - Shows a modal window. User is prompted to Sign In inside this modal window. It returns a new user token as a result

Privo.auth.showRegister() - Shows a modal window. User is prompted to Create an Account inside this modal window
NOTE: this dialog should be closed from completion callback. (This can be done after a short delay. In this case, the user will be able to read content of the congratulations page)

Swift UI Components:

PrivoAuthButton - swift ui button element that opens a modal window by clicking on it. User is prompted to Sign In inside this modal window. Depending on the integration settings, this button can be customized with branded PRIVO styles by default.

PrivoAuthButton params:
label - customazable Swift UI Label element for the button. It can contains text and any styling inside it.
onFinish - optional completion callback that will provide token if Auth was successful. Otherwise it will provide nil.
closeIcon - optional image for close icon in modal dialog. If nothing is specified, the default image will be used.

PrivoRegisterButton - swift ui button element that opens a modal window by clicking on it. User is prompted to Create an account inside this modal window. Depending on the integration settings, this button can be customized with branded PRIVO styles by default.

PrivoRegisterButton params:
isPresented - binding state value that shows status of modal window presentation. Changed to true automatically when user press button.
Should be changed to false when you want to close the modal dialog.
label - customazable Swift UI Label element for the button. It can contains text and any styling inside it.
onFinish - optional completion handler that will provide token if Auth was successful. Otherwise it will provide nil.
You can change isPresented state value to false inside this callback.
You also can change isPresented after some delay. In this case user will be able to see "Congratulation" page content inside modal dialog.
closeIcon - optional image for close icon in modal dialog. If nothing is specified, the default image will be used.

Auth Module Swift UI Components:

   Privo.auth.getToken()
      Privo.auth.checkTokenValid() { response in
        response.token
        response.isValid
      }
      Privo.auth.logout()
    title: Auth Module methods
   
  PrivoAuthButton(label: {
    Text("Sign In")
  }, onFinish: { token in
    self.token = token
  }).padding()

  PrivoRegisterButton(isPresented: $showRegistration, label: {
    Text("Register")
  }){
    DispatchQueue.main.asyncAfter(deadline: .now() + 10.0) {
      showRegistration = false
    }
  }.padding()