{"version":3,"file":"identifyUser.mjs","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { InAppMessagingAction } from '@aws-amplify/core/internals/utils';\nimport { updateEndpoint, } from '@aws-amplify/core/internals/providers/pinpoint';\nimport { CATEGORY, CHANNEL_TYPE, getInAppMessagingUserAgentString, resolveConfig, resolveCredentials, } from '../utils';\nimport { assertIsInitialized } from '../../../utils';\n/**\n * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user\n * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using\n * the same `userId`.\n *\n * @deprecated AWS will end support for Amazon Pinpoint on October 30, 2026.\n *\n * @param input The input object that conforms to {@link IdentifyUserInput} used to construct requests sent to Pinpoint's UpdateEndpoint\n *  API.\n * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @returns A promise that will resolve when the operation is complete.\n * @example\n * ```ts\n * // Identify a user with Pinpoint\n * await identifyUser({\n *     userId,\n *     userProfile: {\n *         email: 'userEmail@example.com'\n *         customProperties: {\n *             phoneNumber: ['555-555-5555'],\n *         },\n *     }\n * });\n * ```\n *\n * @example\n * ```ts\n * // Identify a user with Pinpoint specific options\n * await identifyUser({\n *     userId,\n *     userProfile: {\n *         email: 'userEmail@example.com'\n *         customProperties: {\n *             phoneNumber: ['555-555-5555'],\n *         },\n *         demographic: {\n *             platform: 'ios',\n *             timezone: 'America/Los_Angeles'\n *         }\n *     },\n *     options: {\n *         address: 'device-address',\n *         optOut: 'NONE',\n *         userAttributes: {\n *             interests: ['food']\n *         },\n *     },\n * });\n */\nexport const identifyUser = async (input) => {\n    const { userId, userProfile, options } = input;\n    assertIsInitialized();\n    const { credentials, identityId } = await resolveCredentials();\n    const { appId, region } = resolveConfig();\n    const { address, optOut, userAttributes } = options ?? {};\n    await updateEndpoint({\n        address,\n        channelType: CHANNEL_TYPE,\n        optOut,\n        appId,\n        category: CATEGORY,\n        credentials,\n        identityId,\n        region,\n        userAttributes,\n        userId,\n        userProfile,\n        userAgentValue: getInAppMessagingUserAgentString(InAppMessagingAction.IdentifyUser),\n    });\n};\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,YAAY,GAAG,OAAO,KAAK,KAAK;AAC7C,IAAI,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK;AAClD,IAAI,mBAAmB,EAAE;AACzB,IAAI,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,kBAAkB,EAAE;AAClE,IAAI,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE;AAC7C,IAAI,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,IAAI,EAAE;AAC7D,IAAI,MAAM,cAAc,CAAC;AACzB,QAAQ,OAAO;AACf,QAAQ,WAAW,EAAE,YAAY;AACjC,QAAQ,MAAM;AACd,QAAQ,KAAK;AACb,QAAQ,QAAQ,EAAE,QAAQ;AAC1B,QAAQ,WAAW;AACnB,QAAQ,UAAU;AAClB,QAAQ,MAAM;AACd,QAAQ,cAAc;AACtB,QAAQ,MAAM;AACd,QAAQ,WAAW;AACnB,QAAQ,cAAc,EAAE,gCAAgC,CAAC,oBAAoB,CAAC,YAAY,CAAC;AAC3F,KAAK,CAAC;AACN;;;;"}