let preChatValue = "myValue"
let preChatKey = "Somename"
let config = UIConfiguration(serviceAPI: serviceAPIURL,
organizationId: organizationId,
developerName: developerName,
conversationId: conversationId)
let coreClient = CoreFactory.create(withConfig: config)
let myPreChatDelegate = HiddenPrechatDelegateImplementation(preChatValue: preChatValue, preChatKey: preChatKey)
coreClient.preChatDelegate = myPreChatDelegate
// Need to add some code to add preChatField with name(preChatKey) and value (preChatValue)
< /code>
hiddenprechatdelegateimplementation < /h1>
import Foundation
import SMIClientCore // Import the Salesforce SDK; you need to confirm the correct module name.
class HiddenPrechatDelegateImplementation: HiddenPreChatDelegate {
var preChatValue: String
var preChatKey: String
init(preChatValue: String, preChatKey: String) {
self.preChatValue = preChatValue
self.preChatKey = preChatKey
}
func core(_ core: CoreClient,
conversation: Conversation,
didRequestPrechatValues hiddenPreChatFields: [HiddenPreChatField],
completionHandler: HiddenPreChatValueCompletion) {
// Use the conversation object to inspect info about the conversation
// Pass pre-chat fields back to SDK
completionHandler(hiddenPreChatFields)
}
}
openchat < /h1> [code] let preChatValue = "myValue" let preChatKey = "Somename" let config = UIConfiguration(serviceAPI: serviceAPIURL, organizationId: organizationId, developerName: developerName, conversationId: conversationId)
let coreClient = CoreFactory.create(withConfig: config)
let myPreChatDelegate = HiddenPrechatDelegateImplementation(preChatValue: preChatValue, preChatKey: preChatKey) coreClient.preChatDelegate = myPreChatDelegate // Need to add some code to add preChatField with name(preChatKey) and value (preChatValue)
< /code> hiddenprechatdelegateimplementation < /h1> import Foundation import SMIClientCore // Import the Salesforce SDK; you need to confirm the correct module name.
class HiddenPrechatDelegateImplementation: HiddenPreChatDelegate {
// Use the conversation object to inspect info about the conversation
// Pass pre-chat fields back to SDK completionHandler(hiddenPreChatFields) }
} [/code] Docs: https://developer.salesforce.com/docs/service/messaging-in-app/guide/ios-core-sdk.html#handle-a-pre-chat -form Repo: https://github.com/salesforce-async-messaging Я попытался установить поле PreChat из Swift Code (iOS Swift)