@15gifts/sdk 0.23.1 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -579,6 +579,8 @@ interface components {
579
579
  pickMin?: number | null;
580
580
  /** Pickmax */
581
581
  pickMax?: number | null;
582
+ /** Classification */
583
+ classification?: string | null;
582
584
  };
583
585
  /**
584
586
  * OptionalAddOnChoices
@@ -1013,6 +1015,571 @@ interface operations {
1013
1015
  * Do not make direct changes to the file.
1014
1016
  */
1015
1017
  interface paths {
1018
+ '/api/tracking/checkout/v1': {
1019
+ parameters: {
1020
+ query?: never;
1021
+ header?: never;
1022
+ path?: never;
1023
+ cookie?: never;
1024
+ };
1025
+ get?: never;
1026
+ put?: never;
1027
+ /**
1028
+ * Submit checkout sales event from browser
1029
+ * @description Submit checkout sales event from browser (identity token auth)
1030
+ */
1031
+ post: {
1032
+ parameters: {
1033
+ query?: never;
1034
+ header?: never;
1035
+ path?: never;
1036
+ cookie?: never;
1037
+ };
1038
+ requestBody: {
1039
+ content: {
1040
+ 'application/json': {
1041
+ /** @description A 36 character alphanumeric hash that uniquely identifies a user.
1042
+ *
1043
+ *
1044
+ * This should match the UUID V4 as specified in RFC 9652:
1045
+ * https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4
1046
+ *
1047
+ * e.g f81d4fae-7dec-41d0-a765-00a0c91e6bf6 */
1048
+ userId?: string;
1049
+ /** @description A timestamp describing the time the event occurred. This should conform to ISO 8601 standards and be in UTC. Example: "2024-07-17T10:11:16.591Z" */
1050
+ eventAt?: string;
1051
+ /** @description The page url at the time the event is fired */
1052
+ url?: string;
1053
+ /** @description What web browser the user is using e.g. chrome/firefox/safari etc. */
1054
+ browser?: string;
1055
+ /** @description The customer that the event occurred on */
1056
+ customerId: string;
1057
+ /** @description The user agent string e.g. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" */
1058
+ userAgent?: string;
1059
+ /** @description A 36 character alphanumeric hash that uniquely identifies a tracking event
1060
+ *
1061
+ * This should match the UUID V4 as specified in RFC 9652:
1062
+ * https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4
1063
+ *
1064
+ * e.g f81d4fae-7dec-41d0-a765-00a0c91e6bf6 */
1065
+ eventId?: string;
1066
+ /**
1067
+ * @description The name of an event
1068
+ * @enum {string}
1069
+ */
1070
+ eventName?: 'sale-completed';
1071
+ /** @description A 36 character alphanumeric hash that uniquely identifies a page view (page-shown event)
1072
+ *
1073
+ * This should match the UUID V4 as specified in RFC 9652:
1074
+ * https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4
1075
+ *
1076
+ * e.g f81d4fae-7dec-41d0-a765-00a0c91e6bf6 */
1077
+ pageviewId?: string | null;
1078
+ /** @description A unique user id native to our customers web analytics platforms (adobe, google analytics etc). Helps us & our customers align our data with what customers see in their platforms. */
1079
+ webAnalyticsPlatformUserId?: string | null;
1080
+ /** @description A 36 character alphanumeric hash that uniquely identifies a session.
1081
+ *
1082
+ *
1083
+ * This should match the UUID V4 as specified in RFC 9652:
1084
+ * https://datatracker.ietf.org/doc/html/rfc9562#name-uuid-version-4
1085
+ *
1086
+ * e.g f81d4fae-7dec-41d0-a765-00a0c91e6bf6
1087
+ * */
1088
+ browserSessionId?: string | null;
1089
+ /** @description The device screen width in pixels - window.screen.width in JS. This is a user level property that should never change. */
1090
+ screenWidth?: number;
1091
+ /** @description The device screen height in pixels - window.screen.height in JS. This is a user level property that should never change. */
1092
+ screenHeight?: number;
1093
+ /**
1094
+ * @description The size of the device's screen, based off the actual user experience it will generate, assuming the browser window takes up the whole screen.
1095
+ *
1096
+ * Based off https://15gifts.atlassian.net/wiki/spaces/AI/pages/3981443139/Breakpoints+for+mobile+desktop
1097
+ *
1098
+ * screen_width <= 480px = 'mobile'
1099
+ * screen_width > 480px = 'large'
1100
+ * @enum {string}
1101
+ */
1102
+ screenSize?: 'large' | 'mobile';
1103
+ /** @description The ID for the sale, a unique, non-empty value we can correlate with customer records. */
1104
+ saleId: string;
1105
+ /**
1106
+ * @description The type of user, for example, existing or prospect.
1107
+ * @enum {string}
1108
+ */
1109
+ userType: 'existing' | 'prospect';
1110
+ /**
1111
+ * @description A code that represents what currency the product price is listed in e.g. USD, GBP. This should match the ISO 4217 standard - see https://www.iban.com/currency-codes.
1112
+ * @enum {string}
1113
+ */
1114
+ currencyCode?: 'AUD' | 'CAD' | 'EUR' | 'GBP' | 'MXN' | 'USD';
1115
+ /** @description The full basket value of the sale, inclusive of any offers. */
1116
+ saleTotalValue?: number;
1117
+ /** @description A list containing separate line items for each product sold. */
1118
+ productsSold: {
1119
+ /** @description The ID or SKU of a product that is provided by the customer */
1120
+ siteProductId: string;
1121
+ /** @description The name of the product */
1122
+ siteProductName: string;
1123
+ /** @description The category of products the product belongs to. */
1124
+ siteProductType: string;
1125
+ /** @description The upfront price the user has to pay for the product. */
1126
+ productPriceUpfront: number;
1127
+ }[];
1128
+ /**
1129
+ * @description The language of the part of the site the sales data is coming from in ISO 639-1 format e.g. 'en', 'es' etc.
1130
+ * @enum {string}
1131
+ */
1132
+ language?: 'de' | 'en' | 'es' | 'fr' | 'it';
1133
+ /**
1134
+ * @description Describes the origin of the sales tracking data, i.e which client sent the data to the sales tracking API.
1135
+ *
1136
+ * In the case of an authenticated backend-backend connection, the value will be 'backend'.
1137
+ * In the case of an unauthenticated browser client sending us the event, the value will be 'frontend'.
1138
+ *
1139
+ * @enum {string}
1140
+ */
1141
+ salesTrackingOrigin?: 'backend' | 'frontend';
1142
+ /**
1143
+ * @description The name of the system/service that the event originates from
1144
+ * @enum {string}
1145
+ */
1146
+ service?: 'frontend' | 'salesTrackingApi';
1147
+ /** @description A JSON object containing the different versions of services directly used by the service that tracks an event. The version of the service that is firing any tracking event should ALWAYS be included, for example if the conversation_api is firing an event, service_versions should include conversation_api_version. It should also ideally include the version numbers of any other services used in the generation of the event that is being tracked. */
1148
+ serviceVersions?: {
1149
+ /** @description The version number for the frontend service */
1150
+ frontendVersion?: string | null;
1151
+ /** @description The version number for the frontend api service */
1152
+ frontendApiVersion?: string | null;
1153
+ /** @description The version number for the conversation api service */
1154
+ conversationApiVersion?: string | null;
1155
+ /** @description The version number for the customer configuration service */
1156
+ customerConfigurationVersion?: string | null;
1157
+ /** @description The version number for the client library our customers are using */
1158
+ sdkVersion?: string | null;
1159
+ /** @description The version number for the product configuration data */
1160
+ productConfigurationVersion?: string | null;
1161
+ /** @description The version number for the sales tracking api service. *in the short term this is technically just the frontend so will match that */
1162
+ salesTrackingApiVersion?: string | null;
1163
+ /** @description The version number for the recommender service */
1164
+ recommenderVersion?: string | null;
1165
+ };
1166
+ /**
1167
+ * @description The environment the event originated from (production/development/testing/staging/local/uat/ephemeral)
1168
+ * @enum {string}
1169
+ */
1170
+ environment?: 'development' | 'ephemeral' | 'local' | 'production' | 'staging' | 'test' | 'uat';
1171
+ /** @description A JWT used to identify the user in the system, can be obtained from the identity endpoint */
1172
+ identityToken: string;
1173
+ } | {
1174
+ /**
1175
+ * @description The customer that the event occurred on
1176
+ * @enum {string}
1177
+ */
1178
+ customerId: 'aidem';
1179
+ /** @description The timestamp describing the time the event occurred. This should conform to ISO 8601 standards and be in UTC */
1180
+ eventAt?: string;
1181
+ /** @description A JWT used to identify the user in the system, can be obtained from the identity endpoint */
1182
+ identityToken: string;
1183
+ /** @description The ID for the sale, a unique value we can correlate with customer records. */
1184
+ saleId: string;
1185
+ /**
1186
+ * @description The type of user, for example, existing or prospect.
1187
+ * @enum {string}
1188
+ */
1189
+ userType: 'existing' | 'prospect';
1190
+ /** @description The browser the user is using, e.g. Chrome, Firefox, Safari, etc. */
1191
+ browser?: string;
1192
+ /** @description The user agent string e.g. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" */
1193
+ userAgent?: string;
1194
+ /** @description The device screen width in pixels - window.screen.width in JS. This is a user level property that should never change. */
1195
+ screenWidth?: number;
1196
+ /** @description The device screen height in pixels - window.screen.height in JS. This is a user level property that should never change. */
1197
+ screenHeight?: number;
1198
+ /**
1199
+ * @description The size of the device's screen, based off the actual user experience it will generate, assuming the browser window takes up the whole screen.
1200
+ *
1201
+ * Based off https://15gifts.atlassian.net/wiki/spaces/AI/pages/3981443139/Breakpoints+for+mobile+desktop
1202
+ *
1203
+ * screen_width <= 480px = 'mobile'
1204
+ * screen_width > 480px = 'large'
1205
+ * @enum {string}
1206
+ */
1207
+ screenSize?: 'mobile' | 'large';
1208
+ /** @description "A code that represents what currency the product price is listed in e.g. USD, GBP. This should match the ISO 4217 standard - see https://www.iban.com/currency-codes. */
1209
+ currencyCode?: string;
1210
+ /** @description The host/domain of the URL at the time the event is fired */
1211
+ siteHost: string;
1212
+ /** @description The path of the URL (including an initial `/`) at the time the event is fired */
1213
+ sitePath?: string;
1214
+ /** @description The query string of the URL (including an initial `?`) at the time the event is fired */
1215
+ siteQueryString?: string;
1216
+ /** @description The language of the part of the site the sales data is coming from in ISO 639-1 format e.g. 'en-us', 'es-us' etc. */
1217
+ language?: string;
1218
+ /** @description The recurring payment due per payment period */
1219
+ priceRecurring: number;
1220
+ /** @description An ISO-8601 duration that represents the period of time that the priceRecurring payment recurs over */
1221
+ priceRecurringPeriod: string;
1222
+ /** @description The upfront price the user has to pay for the product. */
1223
+ priceUpfront?: number;
1224
+ /** @description The full basket value of the sale, inclusive of any offers. */
1225
+ totalValueOfSale?: number;
1226
+ /** @description The taxes the user has to pay relating to the priceUpfront of the product(s) */
1227
+ totalUpfrontTax?: number;
1228
+ /** @description The taxes the user has to pay relating to the priceRecurring of the product(s), due per payment period */
1229
+ totalRecurringTax?: number;
1230
+ totalTaxOnSale?: number;
1231
+ /** @description A list containing separate line items for each product sold. */
1232
+ productsSold: {
1233
+ /** @description The ID or SKU of a product that is provided by the customer */
1234
+ siteProductId?: string;
1235
+ /** @description The name of the product */
1236
+ siteProductName: string;
1237
+ /** @description The category of products the product belongs to. */
1238
+ siteProductType: string;
1239
+ /** @description An ISO-8601 duration that represents the contract length */
1240
+ productContractLength: string;
1241
+ /** @description An integer representing how many of this particular product the user is purchasing */
1242
+ quantity: number;
1243
+ /** @description The upfront price the user has to pay for the product. */
1244
+ productPriceUpfront: number;
1245
+ /** @description The recurring payment per payment period for the product */
1246
+ productPricePerPeriod: number;
1247
+ /** @description An ISO-8601 duration that represents the period of time that the productPricePerPeriod payment recurs over */
1248
+ productRecurringPaymentPeriod: string;
1249
+ /** @description The ID or SKU of a bundle that the product (and other products being purchased at the same time) are part of */
1250
+ bundleId?: string;
1251
+ }[];
1252
+ /** @description A unique user id native to our customers web analytics platforms (adobe, google analytics etc). Helps us & our customers align our data with what customers see in their platforms. */
1253
+ webAnalyticsPlatformUserId?: string;
1254
+ } | {
1255
+ /**
1256
+ * @description The customer that the event occurred on
1257
+ * @enum {string}
1258
+ */
1259
+ customerId: 'spectrum-us-media-consumer-en';
1260
+ /** @description The timestamp describing the time the event occurred. This should conform to ISO 8601 standards and be in UTC */
1261
+ eventAt?: string;
1262
+ /** @description A JWT used to identify the user in the system, can be obtained from the identity endpoint */
1263
+ identityToken: string;
1264
+ /** @description The ID for the sale, a unique value we can correlate with customer records. */
1265
+ saleId: string;
1266
+ /**
1267
+ * @description The type of user, for example, existing or prospect.
1268
+ * @enum {string}
1269
+ */
1270
+ userType: 'existing' | 'prospect';
1271
+ /** @description The browser the user is using, e.g. Chrome, Firefox, Safari, etc. */
1272
+ browser?: string;
1273
+ /** @description The user agent string e.g. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" */
1274
+ userAgent?: string;
1275
+ /** @description The device screen width in pixels - window.screen.width in JS. This is a user level property that should never change. */
1276
+ screenWidth?: number;
1277
+ /** @description The device screen height in pixels - window.screen.height in JS. This is a user level property that should never change. */
1278
+ screenHeight?: number;
1279
+ /**
1280
+ * @description The size of the device's screen, based off the actual user experience it will generate, assuming the browser window takes up the whole screen.
1281
+ *
1282
+ * Based off https://15gifts.atlassian.net/wiki/spaces/AI/pages/3981443139/Breakpoints+for+mobile+desktop
1283
+ *
1284
+ * screen_width <= 480px = 'mobile'
1285
+ * screen_width > 480px = 'large'
1286
+ * @enum {string}
1287
+ */
1288
+ screenSize?: 'mobile' | 'large';
1289
+ /** @description "A code that represents what currency the product price is listed in e.g. USD, GBP. This should match the ISO 4217 standard - see https://www.iban.com/currency-codes. */
1290
+ currencyCode?: string;
1291
+ /** @description The host/domain of the URL at the time the event is fired */
1292
+ siteHost: string;
1293
+ /** @description The path of the URL (including an initial `/`) at the time the event is fired */
1294
+ sitePath?: string;
1295
+ /** @description The query string of the URL (including an initial `?`) at the time the event is fired */
1296
+ siteQueryString?: string;
1297
+ /** @description The language of the part of the site the sales data is coming from in ISO 639-1 format e.g. 'en-us', 'es-us' etc. */
1298
+ language?: string;
1299
+ /** @description The recurring payment due per payment period */
1300
+ priceRecurring: number;
1301
+ /** @description An ISO-8601 duration that represents the period of time that the priceRecurring payment recurs over */
1302
+ priceRecurringPeriod: string;
1303
+ /** @description The upfront price the user has to pay for the product. */
1304
+ priceUpfront?: number;
1305
+ /** @description The full basket value of the sale, inclusive of any offers. */
1306
+ totalValueOfSale?: number;
1307
+ /** @description The taxes the user has to pay relating to the priceUpfront of the product(s) */
1308
+ totalUpfrontTax?: number;
1309
+ /** @description The taxes the user has to pay relating to the priceRecurring of the product(s), due per payment period */
1310
+ totalRecurringTax?: number;
1311
+ totalTaxOnSale?: number;
1312
+ /** @description A list containing separate line items for each product sold. */
1313
+ productsSold: {
1314
+ /** @description The ID or SKU of a product that is provided by the customer */
1315
+ siteProductId?: string;
1316
+ /** @description The name of the product */
1317
+ siteProductName: string;
1318
+ /** @description The category of products the product belongs to. */
1319
+ siteProductType: string;
1320
+ /** @description An ISO-8601 duration that represents the contract length */
1321
+ productContractLength: string;
1322
+ /** @description An integer representing how many of this particular product the user is purchasing */
1323
+ quantity: number;
1324
+ /** @description The upfront price the user has to pay for the product. */
1325
+ productPriceUpfront: number;
1326
+ /** @description The recurring payment per payment period for the product */
1327
+ productPricePerPeriod: number;
1328
+ /** @description An ISO-8601 duration that represents the period of time that the productPricePerPeriod payment recurs over */
1329
+ productRecurringPaymentPeriod: string;
1330
+ /** @description The ID or SKU of a bundle that the product (and other products being purchased at the same time) are part of */
1331
+ bundleId?: string;
1332
+ }[];
1333
+ /** @description A unique user id native to our customers web analytics platforms (adobe, google analytics etc). Helps us & our customers align our data with what customers see in their platforms. */
1334
+ webAnalyticsPlatformUserId?: string;
1335
+ } | {
1336
+ /**
1337
+ * @description The customer that the event occurred on
1338
+ * @enum {string}
1339
+ */
1340
+ customerId: 'o2-gb-telco-consumer-en';
1341
+ /** @description The timestamp describing the time the event occurred. This should conform to ISO 8601 standards and be in UTC */
1342
+ eventAt?: string;
1343
+ /** @description A JWT used to identify the user in the system, can be obtained from the identity endpoint */
1344
+ identityToken: string;
1345
+ /** @description The ID for the sale, a unique value we can correlate with customer records. */
1346
+ saleId: string;
1347
+ /**
1348
+ * @description The type of user, for example, existing or prospect.
1349
+ * @enum {string}
1350
+ */
1351
+ userType: 'existing' | 'prospect';
1352
+ /** @description The browser the user is using, e.g. Chrome, Firefox, Safari, etc. */
1353
+ browser?: string;
1354
+ /** @description The user agent string e.g. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" */
1355
+ userAgent?: string;
1356
+ /** @description The device screen width in pixels - window.screen.width in JS. This is a user level property that should never change. */
1357
+ screenWidth?: number;
1358
+ /** @description The device screen height in pixels - window.screen.height in JS. This is a user level property that should never change. */
1359
+ screenHeight?: number;
1360
+ /**
1361
+ * @description The size of the device's screen, based off the actual user experience it will generate, assuming the browser window takes up the whole screen.
1362
+ *
1363
+ * Based off https://15gifts.atlassian.net/wiki/spaces/AI/pages/3981443139/Breakpoints+for+mobile+desktop
1364
+ *
1365
+ * screen_width <= 480px = 'mobile'
1366
+ * screen_width > 480px = 'large'
1367
+ * @enum {string}
1368
+ */
1369
+ screenSize?: 'mobile' | 'large';
1370
+ /** @description "A code that represents what currency the product price is listed in e.g. USD, GBP. This should match the ISO 4217 standard - see https://www.iban.com/currency-codes. */
1371
+ currencyCode?: string;
1372
+ /** @description The host/domain of the URL at the time the event is fired */
1373
+ siteHost?: string;
1374
+ /** @description The path of the URL (including an initial `/`) at the time the event is fired */
1375
+ sitePath?: string;
1376
+ /** @description The query string of the URL (including an initial `?`) at the time the event is fired */
1377
+ siteQueryString?: string;
1378
+ /** @description The language of the part of the site the sales data is coming from in ISO 639-1 format e.g. 'en-us', 'es-us' etc. */
1379
+ language?: string;
1380
+ /** @description The recurring payment due per payment period */
1381
+ priceRecurring?: number;
1382
+ /** @description An ISO-8601 duration that represents the period of time that the priceRecurring payment recurs over */
1383
+ priceRecurringPeriod?: string;
1384
+ /** @description The upfront price the user has to pay for the product. */
1385
+ priceUpfront?: number;
1386
+ /** @description The full basket value of the sale, inclusive of any offers. */
1387
+ totalValueOfSale?: number;
1388
+ /** @description The taxes the user has to pay relating to the priceUpfront of the product(s) */
1389
+ totalUpfrontTax?: number;
1390
+ /** @description The taxes the user has to pay relating to the priceRecurring of the product(s), due per payment period */
1391
+ totalRecurringTax?: number;
1392
+ totalTaxOnSale?: number;
1393
+ /** @description A list containing separate line items for each product sold. */
1394
+ productsSold: {
1395
+ /** @description The ID or SKU of a product that is provided by the customer */
1396
+ siteProductId?: string;
1397
+ /** @description The name of the product */
1398
+ siteProductName: string;
1399
+ /** @description The category of products the product belongs to. */
1400
+ siteProductType: string;
1401
+ /** @description An ISO-8601 duration that represents the contract length */
1402
+ productContractLength: string;
1403
+ /** @description An integer representing how many of this particular product the user is purchasing */
1404
+ quantity: number;
1405
+ /** @description The upfront price the user has to pay for the product. */
1406
+ productPriceUpfront: number;
1407
+ /** @description The recurring payment per payment period for the product */
1408
+ productPricePerPeriod: number;
1409
+ /** @description An ISO-8601 duration that represents the period of time that the productPricePerPeriod payment recurs over */
1410
+ productRecurringPaymentPeriod: string;
1411
+ /** @description The ID or SKU of a bundle that the product (and other products being purchased at the same time) are part of */
1412
+ bundleId?: string;
1413
+ }[];
1414
+ /** @description A unique user id native to our customers web analytics platforms (adobe, google analytics etc). Helps us & our customers align our data with what customers see in their platforms. */
1415
+ webAnalyticsPlatformUserId?: string;
1416
+ } | {
1417
+ /**
1418
+ * @description The customer that the event occurred on
1419
+ * @enum {string}
1420
+ */
1421
+ customerId: 'vodafone-gb-media-consumer-en';
1422
+ /** @description The timestamp describing the time the event occurred. This should conform to ISO 8601 standards and be in UTC */
1423
+ eventAt?: string;
1424
+ /** @description A JWT used to identify the user in the system, can be obtained from the identity endpoint */
1425
+ identityToken: string;
1426
+ /** @description The ID for the sale, a unique value we can correlate with customer records. */
1427
+ saleId: string;
1428
+ /**
1429
+ * @description The type of user, for example, existing or prospect.
1430
+ * @enum {string}
1431
+ */
1432
+ userType: 'existing' | 'prospect';
1433
+ /** @description The browser the user is using, e.g. Chrome, Firefox, Safari, etc. */
1434
+ browser?: string;
1435
+ /** @description The user agent string e.g. "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" */
1436
+ userAgent?: string;
1437
+ /** @description The device screen width in pixels - window.screen.width in JS. This is a user level property that should never change. */
1438
+ screenWidth?: number;
1439
+ /** @description The device screen height in pixels - window.screen.height in JS. This is a user level property that should never change. */
1440
+ screenHeight?: number;
1441
+ /**
1442
+ * @description The size of the device's screen, based off the actual user experience it will generate, assuming the browser window takes up the whole screen.
1443
+ *
1444
+ * Based off https://15gifts.atlassian.net/wiki/spaces/AI/pages/3981443139/Breakpoints+for+mobile+desktop
1445
+ *
1446
+ * screen_width <= 480px = 'mobile'
1447
+ * screen_width > 480px = 'large'
1448
+ * @enum {string}
1449
+ */
1450
+ screenSize?: 'mobile' | 'large';
1451
+ /** @description "A code that represents what currency the product price is listed in e.g. USD, GBP. This should match the ISO 4217 standard - see https://www.iban.com/currency-codes. */
1452
+ currencyCode?: string;
1453
+ /** @description The host/domain of the URL at the time the event is fired */
1454
+ siteHost: string;
1455
+ /** @description The path of the URL (including an initial `/`) at the time the event is fired */
1456
+ sitePath?: string;
1457
+ /** @description The query string of the URL (including an initial `?`) at the time the event is fired */
1458
+ siteQueryString?: string;
1459
+ /** @description The language of the part of the site the sales data is coming from in ISO 639-1 format e.g. 'en-us', 'es-us' etc. */
1460
+ language?: string;
1461
+ /** @description The recurring payment due per payment period */
1462
+ priceRecurring: number;
1463
+ /** @description An ISO-8601 duration that represents the period of time that the priceRecurring payment recurs over */
1464
+ priceRecurringPeriod: string;
1465
+ /** @description The upfront price the user has to pay for the product. */
1466
+ priceUpfront?: number;
1467
+ /** @description The full basket value of the sale, inclusive of any offers. */
1468
+ totalValueOfSale?: number;
1469
+ /** @description The taxes the user has to pay relating to the priceUpfront of the product(s) */
1470
+ totalUpfrontTax?: number;
1471
+ /** @description The taxes the user has to pay relating to the priceRecurring of the product(s), due per payment period */
1472
+ totalRecurringTax?: number;
1473
+ totalTaxOnSale?: number;
1474
+ /** @description A list containing separate line items for each product sold. */
1475
+ productsSold: {
1476
+ /** @description The ID or SKU of a product that is provided by the customer */
1477
+ siteProductId?: string;
1478
+ /** @description The name of the product */
1479
+ siteProductName: string;
1480
+ /** @description The category of products the product belongs to. */
1481
+ siteProductType: string;
1482
+ /** @description An ISO-8601 duration that represents the contract length */
1483
+ productContractLength: string;
1484
+ /** @description An integer representing how many of this particular product the user is purchasing */
1485
+ quantity: number;
1486
+ /** @description The upfront price the user has to pay for the product. */
1487
+ productPriceUpfront: number;
1488
+ /** @description The recurring payment per payment period for the product */
1489
+ productPricePerPeriod: number;
1490
+ /** @description An ISO-8601 duration that represents the period of time that the productPricePerPeriod payment recurs over */
1491
+ productRecurringPaymentPeriod: string;
1492
+ /** @description The ID or SKU of a bundle that the product (and other products being purchased at the same time) are part of */
1493
+ bundleId?: string;
1494
+ }[];
1495
+ /** @description A unique user id native to our customers web analytics platforms (adobe, google analytics etc). Helps us & our customers align our data with what customers see in their platforms. */
1496
+ webAnalyticsPlatformUserId?: string;
1497
+ };
1498
+ };
1499
+ };
1500
+ responses: {
1501
+ /** @description Successful response */
1502
+ 204: {
1503
+ headers: {
1504
+ [name: string]: unknown;
1505
+ };
1506
+ content?: never;
1507
+ };
1508
+ /** @description Error response */
1509
+ 400: {
1510
+ headers: {
1511
+ [name: string]: unknown;
1512
+ };
1513
+ content: {
1514
+ 'application/json': {
1515
+ /** @description The error message */
1516
+ message?: string;
1517
+ };
1518
+ };
1519
+ };
1520
+ /** @description Error response */
1521
+ 403: {
1522
+ headers: {
1523
+ [name: string]: unknown;
1524
+ };
1525
+ content: {
1526
+ 'application/json': {
1527
+ /** @description The error message */
1528
+ message?: string;
1529
+ };
1530
+ };
1531
+ };
1532
+ /** @description Error response */
1533
+ 404: {
1534
+ headers: {
1535
+ [name: string]: unknown;
1536
+ };
1537
+ content: {
1538
+ 'application/json': {
1539
+ /** @description The error message */
1540
+ message?: string;
1541
+ };
1542
+ };
1543
+ };
1544
+ /** @description Default Response */
1545
+ 422: {
1546
+ headers: {
1547
+ [name: string]: unknown;
1548
+ };
1549
+ content: {
1550
+ 'application/json': {
1551
+ /** @description The path to the field that caused the error */
1552
+ instancePath?: string;
1553
+ /** @description The error message */
1554
+ message?: string;
1555
+ /** @description The path to the schema that caused the error */
1556
+ schemaPath?: string;
1557
+ /** @description The keyword that caused the error */
1558
+ keyword?: string;
1559
+ params?: {
1560
+ /** @description The name of the missing property */
1561
+ missingProperty?: string;
1562
+ /** @description The pattern that caused the error */
1563
+ pattern?: string;
1564
+ /** @description The name of the additional property that caused the error */
1565
+ additionalProperty?: string;
1566
+ /** @description The comparison that caused the error */
1567
+ comparison?: string;
1568
+ };
1569
+ }[] | {
1570
+ /** @description The error message */
1571
+ message?: string;
1572
+ };
1573
+ };
1574
+ };
1575
+ };
1576
+ };
1577
+ delete?: never;
1578
+ options?: never;
1579
+ head?: never;
1580
+ patch?: never;
1581
+ trace?: never;
1582
+ };
1016
1583
  '/api/tracking/identity/v2': {
1017
1584
  parameters: {
1018
1585
  query?: never;
@@ -1657,18 +2224,7 @@ declare class Client {
1657
2224
  event_name?: string;
1658
2225
  pageview_id?: string;
1659
2226
  web_analytics_platform_user_id?: string | null;
1660
- browser_session_id? /**
1661
- * Sends an event to the tracking API, with the required properties already set.
1662
- *
1663
- * @param eventName - The name of the event to track.
1664
- * @param properties - Additional properties to include in the event.
1665
- * @returns A promise that resolves once the event is tracked.
1666
- *
1667
- * @example
1668
- * ```ts
1669
- * await client.trackEvent('entry_point-shown')
1670
- * ```
1671
- */: string | null;
2227
+ browser_session_id?: string | null;
1672
2228
  screen_width?: number;
1673
2229
  screen_height?: number;
1674
2230
  screen_size?: string;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var R=Object.create;var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var s in t)d(e,s,{get:t[s],enumerable:!0})},x=(e,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of O(t))!k.call(e,n)&&n!==s&&d(e,n,{get:()=>t[n],enumerable:!(o=P(t,n))||o.enumerable});return e};var N=(e,t,s)=>(s=e!=null?R(_(e)):{},x(t||!e||!e.__esModule?d(s,"default",{value:e,enumerable:!0}):s,e)),b=e=>x(d({},"__esModule",{value:!0}),e);var se={};U(se,{Client:()=>E,SDKError:()=>r,authMiddleware:()=>p,errorMiddleware:()=>g,headerMiddleware:()=>u});module.exports=b(se);var M=N(require("openapi-fetch"));var V=e=>{let t=localStorage.getItem(e);if(!t)return null;let s=JSON.parse(t);return Date.now()>s.expires?(localStorage.removeItem(e),null):s.value},y=V;var L=(e,t,s)=>{let o={expires:Date.now()+s,value:t};localStorage.setItem(e,JSON.stringify(o))},m=L;var D=1e3*60*60*24,G=D*30,f="__15gifts_conversation_id",S="__15gifts_session_id",h="__15gifts_identity_token",T="__15gifts_user_id",j=()=>sessionStorage.removeItem(f),q=()=>sessionStorage.getItem(f),K=e=>sessionStorage.setItem(f,e),W=()=>sessionStorage.getItem(S),H=e=>sessionStorage.setItem(S,e),X=e=>{try{let[,t]=e.split(".");if(!t)throw new Error("Invalid token payload");let s=JSON.parse(atob(t));return s.exp&&Date.now()/1e3>s.exp}catch(t){return console.error("Invalid token format",t),!0}},B=()=>{let e=localStorage.getItem(h);return!e||X(e)?(localStorage.removeItem(h),null):e},$=e=>localStorage.setItem(h,e),F=()=>{let e=y(T);return e&&C(e),e},C=e=>m(T,e,G),c=(e,t,s)=>({enumerable:!0,configurable:!0,get:()=>e()??void 0,set:o=>{if(o){t(o);return}s?.()}}),w=e=>{let t={customerId:e},s={conversationId:c(q,K,j),sessionId:c(W,H),token:c(B,$),userId:c(F,C)};return Object.defineProperties(t,s),t};var J=e=>({onRequest:async({request:t})=>{if(t.url.includes("/identity/"))return t;if(!e)throw new Error("Access token is required for authentication.");return t.headers.set("Authorization",`Bearer ${e}`),t}}),p=J;var z={onResponse:async({response:e})=>{if(!e.ok){let t=await e.json();throw new Error(t.message)}return e}},g=z;var Q=(e,t)=>({onRequest:async({request:s})=>(e.pageviewId&&s.headers.set("X-PAGEVIEW-ID",e.pageviewId),t&&s.headers.set("X-PAGE-URL",t),s)}),u=Q;var I=e=>{let{conversationId:t,...s}=e;return s},Y=(e,t)=>t?.assistantMessages.find(n=>n.type==="SINGLE_SELECT")?.options.find(n=>n.value===e.option)?.label||"",Z=(e,t)=>{let{userMessage:s}=e;switch(s.type){case"SINGLE_SELECT":return{...I(s),userMessage:Y(s,t)};case"START_CONVERSATION":return{type:"MESSAGE",userMessage:s.openingUserMessage?.option||""};case"MESSAGE":return I(s);case"MULTI_SELECT":return I(s)}},ee=(e,t)=>{let s=!!t;return e.assistantMessages.filter(o=>o.type!=="CONVERSATION_ID"&&!(s&&o.type==="SINGLE_SELECT"))},A=e=>e.map((t,s)=>{let o=s>0?e[s-1]:void 0,n=s<e.length-1?e[s+1]:void 0;return{id:`restored-turn-${s}`,userMessage:Z(t,o),assistantReply:ee(t,n)}});var l="0.23.1";var r=class e extends Error{sdkVersion;cause;constructor(t,{cause:s}={}){super(t),this.name="SDKError",this.cause=s,this.sdkVersion=l,Object.setPrototypeOf(this,e.prototype)}};var E=class{endpoint;identity;constructor(t){let{conversationUrl:s,customerId:o,fetch:n,frontendUrl:i,headers:v}=t,a={...v,"X-SDK-VERSION":l};this.endpoint={conversation:(0,M.default)({baseUrl:s,fetch:n,headers:a,credentials:"include"}),frontend:(0,M.default)({baseUrl:i,fetch:n,headers:a})},this.identity=w(o),this.endpoint.conversation.use(g),this.endpoint.conversation.use(u(this.identity,window.location.href))}async createIdentity(){let{customerId:t,sessionId:s,userId:o}=this.identity;try{let{data:n}=await this.endpoint.frontend.POST("/api/tracking/identity/v2",{body:{customerId:t,sessionId:s,userId:o,url:window.location.href,userAgent:window.navigator.userAgent}});if(!n)throw new r("No data received from identity API");this.identity.pageviewId=n.pageviewId,s||(this.identity.sessionId=n.sessionId),o||(this.identity.userId=n.userId),this.identity.token=n.token,Object.values(this.endpoint).forEach(i=>{i.use(p(n.token))})}catch(n){throw Object.values(this.endpoint).forEach(i=>{i.use(p())}),new r("Failed to create identity",{cause:n})}}endConversation(){this.identity.conversationId=void 0}async startConversation(t,s){this.endConversation();let o={...t},{data:n}=await this.endpoint.conversation.POST("/api/conversation/v3",{body:{type:"START_CONVERSATION",conversationContext:o,openingUserMessage:s}});if(!n)throw new r("No data received from Conversation API");let[i,...v]=n,a=i.conversationId;if(!a)throw new r("Conversation ID not received in API response");return this.identity.conversationId=a,v}async sendMessage(t){let s=this.identity.conversationId;if(!s)throw new r("Conversation ID not set");let{data:o}=await this.endpoint.conversation.POST("/api/conversation/v3",{body:{conversationId:s,...t}});if(!o)throw new r("No data received from conversation API");return o.filter(n=>n.type!=="CONVERSATION_ID")}async trackEvent(t,s){let o={additionalProperties:s,conversationId:this.identity.conversationId,eventName:t,pageviewId:this.identity.pageviewId??"unknown",screenWidth:window.screen.width,screenHeight:window.screen.height,screenSize:window.screen.width<=480?"mobile":"large",url:window.location.href,userAgent:window.navigator.userAgent};return this.endpoint.frontend.POST("/api/tracking/user/v2",{body:o})}getIdentity(){return this.identity}getIdentityToken(){return this.identity.token??null}async getConversation(t){if(!t)throw new r("Conversation ID not set");try{let{data:s}=await this.endpoint.conversation.GET("/api/conversation/{conversation_id}/v1",{params:{path:{conversation_id:t}}});if(this.identity.conversationId=t,!s)throw new r("No data received from conversation history API");return A(s)}catch(s){throw new r("Failed to get conversation history",{cause:s})}}};0&&(module.exports={Client,SDKError,authMiddleware,errorMiddleware,headerMiddleware});
1
+ "use strict";var R=Object.create;var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var U=(e,t)=>{for(var s in t)d(e,s,{get:t[s],enumerable:!0})},x=(e,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of O(t))!k.call(e,n)&&n!==s&&d(e,n,{get:()=>t[n],enumerable:!(o=P(t,n))||o.enumerable});return e};var N=(e,t,s)=>(s=e!=null?R(_(e)):{},x(t||!e||!e.__esModule?d(s,"default",{value:e,enumerable:!0}):s,e)),b=e=>x(d({},"__esModule",{value:!0}),e);var se={};U(se,{Client:()=>E,SDKError:()=>r,authMiddleware:()=>p,errorMiddleware:()=>g,headerMiddleware:()=>u});module.exports=b(se);var M=N(require("openapi-fetch"));var V=e=>{let t=localStorage.getItem(e);if(!t)return null;let s=JSON.parse(t);return Date.now()>s.expires?(localStorage.removeItem(e),null):s.value},y=V;var L=(e,t,s)=>{let o={expires:Date.now()+s,value:t};localStorage.setItem(e,JSON.stringify(o))},m=L;var D=1e3*60*60*24,G=D*30,f="__15gifts_conversation_id",S="__15gifts_session_id",h="__15gifts_identity_token",T="__15gifts_user_id",j=()=>sessionStorage.removeItem(f),q=()=>sessionStorage.getItem(f),K=e=>sessionStorage.setItem(f,e),W=()=>sessionStorage.getItem(S),H=e=>sessionStorage.setItem(S,e),X=e=>{try{let[,t]=e.split(".");if(!t)throw new Error("Invalid token payload");let s=JSON.parse(atob(t));return s.exp&&Date.now()/1e3>s.exp}catch(t){return console.error("Invalid token format",t),!0}},B=()=>{let e=localStorage.getItem(h);return!e||X(e)?(localStorage.removeItem(h),null):e},$=e=>localStorage.setItem(h,e),F=()=>{let e=y(T);return e&&C(e),e},C=e=>m(T,e,G),c=(e,t,s)=>({enumerable:!0,configurable:!0,get:()=>e()??void 0,set:o=>{if(o){t(o);return}s?.()}}),w=e=>{let t={customerId:e},s={conversationId:c(q,K,j),sessionId:c(W,H),token:c(B,$),userId:c(F,C)};return Object.defineProperties(t,s),t};var J=e=>({onRequest:async({request:t})=>{if(t.url.includes("/identity/"))return t;if(!e)throw new Error("Access token is required for authentication.");return t.headers.set("Authorization",`Bearer ${e}`),t}}),p=J;var z={onResponse:async({response:e})=>{if(!e.ok){let t=await e.json();throw new Error(t.message)}return e}},g=z;var Q=(e,t)=>({onRequest:async({request:s})=>(e.pageviewId&&s.headers.set("X-PAGEVIEW-ID",e.pageviewId),t&&s.headers.set("X-PAGE-URL",t),s)}),u=Q;var I=e=>{let{conversationId:t,...s}=e;return s},Y=(e,t)=>t?.assistantMessages.find(n=>n.type==="SINGLE_SELECT")?.options.find(n=>n.value===e.option)?.label||"",Z=(e,t)=>{let{userMessage:s}=e;switch(s.type){case"SINGLE_SELECT":return{...I(s),userMessage:Y(s,t)};case"START_CONVERSATION":return{type:"MESSAGE",userMessage:s.openingUserMessage?.option||""};case"MESSAGE":return I(s);case"MULTI_SELECT":return I(s)}},ee=(e,t)=>{let s=!!t;return e.assistantMessages.filter(o=>o.type!=="CONVERSATION_ID"&&!(s&&o.type==="SINGLE_SELECT"))},A=e=>e.map((t,s)=>{let o=s>0?e[s-1]:void 0,n=s<e.length-1?e[s+1]:void 0;return{id:`restored-turn-${s}`,userMessage:Z(t,o),assistantReply:ee(t,n)}});var l="0.24.0";var r=class e extends Error{sdkVersion;cause;constructor(t,{cause:s}={}){super(t),this.name="SDKError",this.cause=s,this.sdkVersion=l,Object.setPrototypeOf(this,e.prototype)}};var E=class{endpoint;identity;constructor(t){let{conversationUrl:s,customerId:o,fetch:n,frontendUrl:i,headers:v}=t,a={...v,"X-SDK-VERSION":l};this.endpoint={conversation:(0,M.default)({baseUrl:s,fetch:n,headers:a,credentials:"include"}),frontend:(0,M.default)({baseUrl:i,fetch:n,headers:a})},this.identity=w(o),this.endpoint.conversation.use(g),this.endpoint.conversation.use(u(this.identity,window.location.href))}async createIdentity(){let{customerId:t,sessionId:s,userId:o}=this.identity;try{let{data:n}=await this.endpoint.frontend.POST("/api/tracking/identity/v2",{body:{customerId:t,sessionId:s,userId:o,url:window.location.href,userAgent:window.navigator.userAgent}});if(!n)throw new r("No data received from identity API");this.identity.pageviewId=n.pageviewId,s||(this.identity.sessionId=n.sessionId),o||(this.identity.userId=n.userId),this.identity.token=n.token,Object.values(this.endpoint).forEach(i=>{i.use(p(n.token))})}catch(n){throw Object.values(this.endpoint).forEach(i=>{i.use(p())}),new r("Failed to create identity",{cause:n})}}endConversation(){this.identity.conversationId=void 0}async startConversation(t,s){this.endConversation();let o={...t},{data:n}=await this.endpoint.conversation.POST("/api/conversation/v3",{body:{type:"START_CONVERSATION",conversationContext:o,openingUserMessage:s}});if(!n)throw new r("No data received from Conversation API");let[i,...v]=n,a=i.conversationId;if(!a)throw new r("Conversation ID not received in API response");return this.identity.conversationId=a,v}async sendMessage(t){let s=this.identity.conversationId;if(!s)throw new r("Conversation ID not set");let{data:o}=await this.endpoint.conversation.POST("/api/conversation/v3",{body:{conversationId:s,...t}});if(!o)throw new r("No data received from conversation API");return o.filter(n=>n.type!=="CONVERSATION_ID")}async trackEvent(t,s){let o={additionalProperties:s,conversationId:this.identity.conversationId,eventName:t,pageviewId:this.identity.pageviewId??"unknown",screenWidth:window.screen.width,screenHeight:window.screen.height,screenSize:window.screen.width<=480?"mobile":"large",url:window.location.href,userAgent:window.navigator.userAgent};return this.endpoint.frontend.POST("/api/tracking/user/v2",{body:o})}getIdentity(){return this.identity}getIdentityToken(){return this.identity.token??null}async getConversation(t){if(!t)throw new r("Conversation ID not set");try{let{data:s}=await this.endpoint.conversation.GET("/api/conversation/{conversation_id}/v1",{params:{path:{conversation_id:t}}});if(this.identity.conversationId=t,!s)throw new r("No data received from conversation history API");return A(s)}catch(s){throw new r("Failed to get conversation history",{cause:s})}}};0&&(module.exports={Client,SDKError,authMiddleware,errorMiddleware,headerMiddleware});
2
2
  //# sourceMappingURL=index.js.map