UNPKG

@aws-amplify/analytics

Version:

Analytics category of aws-amplify

1 lines 2.07 kB
{"version":3,"file":"deprecatePinpoint.mjs","sources":["../../../src/utils/deprecatePinpoint.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { ConsoleLogger } from '@aws-amplify/core';\nconst logger = new ConsoleLogger('Analytics');\nconst DEPRECATION_MESSAGE = 'The default (Amazon Pinpoint) export of `aws-amplify/analytics` is deprecated. ' +\n 'AWS will end support for Amazon Pinpoint on October 30, 2026. ' +\n 'Migrate to a supported provider by importing from its sub-path export instead: ' +\n 'Kinesis (`aws-amplify/analytics/kinesis`), ' +\n 'Kinesis Data Firehose (`aws-amplify/analytics/kinesis-firehose`), or ' +\n 'Personalize Event (`aws-amplify/analytics/personalize`).';\n/**\n * Wraps a Pinpoint (default-export) Analytics API so that invoking it emits a\n * one-time runtime deprecation warning before delegating to the underlying\n * implementation. The returned function is a transparent proxy — it preserves\n * the exact parameters, return value, and `this` binding of the wrapped API.\n *\n * The warning is emitted at most once per wrapped API for the lifetime of the\n * module, so repeated calls do not spam the console.\n *\n * @internal\n */\nexport const deprecatePinpoint = (fn) => {\n let warned = false;\n return (...args) => {\n if (!warned) {\n warned = true;\n logger.warn(DEPRECATION_MESSAGE);\n }\n return fn(...args);\n };\n};\n"],"names":[],"mappings":";;AAAA;AACA;AAEA,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC;AAC7C,MAAM,mBAAmB,GAAG,iFAAiF;AAC7G,IAAI,gEAAgE;AACpE,IAAI,iFAAiF;AACrF,IAAI,6CAA6C;AACjD,IAAI,uEAAuE;AAC3E,IAAI,0DAA0D;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,iBAAiB,GAAG,CAAC,EAAE,KAAK;AACzC,IAAI,IAAI,MAAM,GAAG,KAAK;AACtB,IAAI,OAAO,CAAC,GAAG,IAAI,KAAK;AACxB,QAAQ,IAAI,CAAC,MAAM,EAAE;AACrB,YAAY,MAAM,GAAG,IAAI;AACzB,YAAY,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC;AAC5C,QAAQ;AACR,QAAQ,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;AAC1B,IAAI,CAAC;AACL;;;;"}