CustomerProvider

public protocol CustomerProvider

The provider for customer related properties and methods.

  • The customer currently using the app.

    Declaration

    Swift

    func get() -> CustomerIdentity?

    Return Value

    Returns customer if it is set. Otherwise; returns nil.

  • Sets the customer currently using the app.

    If you set your customer ID, you must ensure that it is unique and that it is not used by any other customer.

    Note

    Setting your own Customer ID may result in security vulnerabilities. It is recommended to use the customer ID provided by the SDK. If you want to update the customer name, use the setName(firstName:lastName:) method.

    Warning

    This method must be called before SDK initialization via prepare(environment:brandId:channelId:).

    Throws

    illegalChatState if the chat is already initialized.

    Declaration

    Swift

    @available(*, deprecated, message: "The method uses a shorthand unnamed parameter, which can obscure the meaning of the method for developers unfamiliar with the code.\n Please update your usage to the new method `set(customer:﹚`.")
    func set(_ customer: CustomerIdentity?) throws

    Parameters

    customer

    The customer. Might be nil.

  • Sets the customer currently using the app.

    If you set your customer ID, you must ensure that it is unique and that it is not used by any other customer.

    Note

    Setting your own Customer ID may result in security vulnerabilities. It is recommended to use the customer ID provided by the SDK. If you want to update the customer name, use the setName(firstName:lastName:) method.

    Warning

    This method must be called before SDK initialization via prepare(environment:brandId:channelId:).

    Throws

    illegalChatState if the chat is already initialized.

    Declaration

    Swift

    func set(customer: CustomerIdentity?) throws

    Parameters

    customer

    The customer. Might be nil.

  • Registers a device to be used for push notifications.

    Declaration

    Swift

    func setDeviceToken(_ token: String)

    Parameters

    token

    The unique token for the device to be registered.

  • Registers a device to be used for push notifications.

    Declaration

    Swift

    func setDeviceToken(_ tokenData: Data)

    Parameters

    tokenData

    The unique token for the device to be registered.

  • Sets the authorization code from an OAuth provider in order to authorize the customer with authentication code.

    This code must be provided before connect(environment:brandId:channelId:) or connect(chatURL:socketURL:brandId:channelId:). if the channel is configured to use OAuth.

    Note

    This is not an access token. This is the authorization code that one would use to obtain an access token.

    Declaration

    Swift

    func setAuthorizationCode(_ code: String)

    Parameters

    code

    The authorization code from an OAuth provider.

  • Sets the code verifier to be used for OAuth if the OAuth provider uses PKCE.

    This must be passed so that CXone can retrieve an auth token.

    Declaration

    Swift

    func setCodeVerifier(_ verifier: String)

    Parameters

    verifier

    The generated code verifier.

  • Sets the name to be used for the customer in the chat.

    Declaration

    Swift

    func setName(firstName: String, lastName: String)

    Parameters

    firstName

    The first name for the customer.

    lastName

    The last name for the customer.