@amplitude/analytics-core 1.2.4 → 1.2.6

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.
@@ -38,7 +38,7 @@ export declare const createServerConfig: (serverUrl?: string, serverZone?: keyof
38
38
  serverUrl: string;
39
39
  serverZone: undefined;
40
40
  } | {
41
- serverZone: ServerZone | "US" | "EU";
41
+ serverZone: ServerZone | "US" | "EU" | "STAGING";
42
42
  serverUrl: string;
43
43
  };
44
44
  //# sourceMappingURL=config.d.ts.map
@@ -4,6 +4,7 @@ export declare class Revenue implements IRevenue {
4
4
  private quantity;
5
5
  private price;
6
6
  private revenueType?;
7
+ private currency?;
7
8
  private properties?;
8
9
  private revenue?;
9
10
  constructor();
@@ -11,6 +12,7 @@ export declare class Revenue implements IRevenue {
11
12
  setQuantity(quantity: number): this;
12
13
  setPrice(price: number): this;
13
14
  setRevenueType(revenueType: string): this;
15
+ setCurrency(currency: string): this;
14
16
  setRevenue(revenue: number): this;
15
17
  setEventProperties(properties: {
16
18
  [key: string]: ValidPropertyType;
@@ -1 +1 @@
1
- {"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../../src/revenue.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,OAAO,IAAI,QAAQ,EACnB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAGpC,qBAAa,OAAQ,YAAW,QAAQ;IACtC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,OAAO,CAAC,CAAS;;IAQzB,YAAY,CAAC,SAAS,EAAE,MAAM;IAK9B,WAAW,CAAC,QAAQ,EAAE,MAAM;IAO5B,QAAQ,CAAC,KAAK,EAAE,MAAM;IAKtB,cAAc,CAAC,WAAW,EAAE,MAAM;IAKlC,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,kBAAkB,CAAC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE;IAOnE,kBAAkB,IAAI,sBAAsB;CAS7C"}
1
+ {"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../../src/revenue.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,OAAO,IAAI,QAAQ,EACnB,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAGpC,qBAAa,OAAQ,YAAW,QAAQ;IACtC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,OAAO,CAAC,CAAS;;IAQzB,YAAY,CAAC,SAAS,EAAE,MAAM;IAK9B,WAAW,CAAC,QAAQ,EAAE,MAAM;IAO5B,QAAQ,CAAC,KAAK,EAAE,MAAM;IAKtB,cAAc,CAAC,WAAW,EAAE,MAAM;IAKlC,WAAW,CAAC,QAAQ,EAAE,MAAM;IAK5B,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,kBAAkB,CAAC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE;IAOnE,kBAAkB,IAAI,sBAAsB;CAU7C"}
@@ -27,6 +27,10 @@ var Revenue = /** @class */ (function () {
27
27
  this.revenueType = revenueType;
28
28
  return this;
29
29
  };
30
+ Revenue.prototype.setCurrency = function (currency) {
31
+ this.currency = currency;
32
+ return this;
33
+ };
30
34
  Revenue.prototype.setRevenue = function (revenue) {
31
35
  this.revenue = revenue;
32
36
  return this;
@@ -43,6 +47,7 @@ var Revenue = /** @class */ (function () {
43
47
  eventProperties[analytics_types_1.RevenueProperty.REVENUE_QUANTITY] = this.quantity;
44
48
  eventProperties[analytics_types_1.RevenueProperty.REVENUE_PRICE] = this.price;
45
49
  eventProperties[analytics_types_1.RevenueProperty.REVENUE_TYPE] = this.revenueType;
50
+ eventProperties[analytics_types_1.RevenueProperty.REVENUE_CURRENCY] = this.currency;
46
51
  eventProperties[analytics_types_1.RevenueProperty.REVENUE] = this.revenue;
47
52
  return eventProperties;
48
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"revenue.js","sourceRoot":"","sources":["../../src/revenue.ts"],"names":[],"mappings":";;;AAAA,8DAKoC;AACpC,6DAAyD;AAEzD;IAQE;QACE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,8BAAY,GAAZ,UAAa,SAAiB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6BAAW,GAAX,UAAY,QAAgB;QAC1B,IAAI,QAAQ,GAAG,CAAC,EAAE;YAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAAQ,GAAR,UAAS,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gCAAc,GAAd,UAAe,WAAmB;QAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4BAAU,GAAV,UAAW,OAAe;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oCAAkB,GAAlB,UAAmB,UAAgD;QACjE,IAAI,IAAA,gCAAa,EAAC,UAAU,CAAC,EAAE;YAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oCAAkB,GAAlB;QACE,IAAM,eAAe,GAA2B,IAAI,CAAC,UAAU,CAAC,CAAC,sBAAM,IAAI,CAAC,UAAU,EAAG,CAAC,CAAC,EAAE,CAAC;QAC9F,eAAe,CAAC,iCAAe,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QACrE,eAAe,CAAC,iCAAe,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAClE,eAAe,CAAC,iCAAe,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5D,eAAe,CAAC,iCAAe,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;QACjE,eAAe,CAAC,iCAAe,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACxD,OAAO,eAAe,CAAC;IACzB,CAAC;IACH,cAAC;AAAD,CAAC,AAzDD,IAyDC;AAzDY,0BAAO","sourcesContent":["import {\n RevenueProperty,\n RevenueEventProperties,\n Revenue as IRevenue,\n ValidPropertyType,\n} from '@amplitude/analytics-types';\nimport { isValidObject } from './utils/valid-properties';\n\nexport class Revenue implements IRevenue {\n private productId: string;\n private quantity: number;\n private price: number;\n private revenueType?: string;\n private properties?: { [key: string]: any };\n private revenue?: number;\n\n constructor() {\n this.productId = '';\n this.quantity = 1;\n this.price = 0.0;\n }\n\n setProductId(productId: string) {\n this.productId = productId;\n return this;\n }\n\n setQuantity(quantity: number) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n }\n\n setPrice(price: number) {\n this.price = price;\n return this;\n }\n\n setRevenueType(revenueType: string) {\n this.revenueType = revenueType;\n return this;\n }\n\n setRevenue(revenue: number) {\n this.revenue = revenue;\n return this;\n }\n\n setEventProperties(properties: { [key: string]: ValidPropertyType }) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n }\n\n getEventProperties(): RevenueEventProperties {\n const eventProperties: RevenueEventProperties = this.properties ? { ...this.properties } : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n }\n}\n"]}
1
+ {"version":3,"file":"revenue.js","sourceRoot":"","sources":["../../src/revenue.ts"],"names":[],"mappings":";;;AAAA,8DAKoC;AACpC,6DAAyD;AAEzD;IASE;QACE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,8BAAY,GAAZ,UAAa,SAAiB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6BAAW,GAAX,UAAY,QAAgB;QAC1B,IAAI,QAAQ,GAAG,CAAC,EAAE;YAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0BAAQ,GAAR,UAAS,KAAa;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,gCAAc,GAAd,UAAe,WAAmB;QAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6BAAW,GAAX,UAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4BAAU,GAAV,UAAW,OAAe;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oCAAkB,GAAlB,UAAmB,UAAgD;QACjE,IAAI,IAAA,gCAAa,EAAC,UAAU,CAAC,EAAE;YAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;SAC9B;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oCAAkB,GAAlB;QACE,IAAM,eAAe,GAA2B,IAAI,CAAC,UAAU,CAAC,CAAC,sBAAM,IAAI,CAAC,UAAU,EAAG,CAAC,CAAC,EAAE,CAAC;QAC9F,eAAe,CAAC,iCAAe,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QACrE,eAAe,CAAC,iCAAe,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAClE,eAAe,CAAC,iCAAe,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC;QAC5D,eAAe,CAAC,iCAAe,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC;QACjE,eAAe,CAAC,iCAAe,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QAClE,eAAe,CAAC,iCAAe,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACxD,OAAO,eAAe,CAAC;IACzB,CAAC;IACH,cAAC;AAAD,CAAC,AAhED,IAgEC;AAhEY,0BAAO","sourcesContent":["import {\n RevenueProperty,\n RevenueEventProperties,\n Revenue as IRevenue,\n ValidPropertyType,\n} from '@amplitude/analytics-types';\nimport { isValidObject } from './utils/valid-properties';\n\nexport class Revenue implements IRevenue {\n private productId: string;\n private quantity: number;\n private price: number;\n private revenueType?: string;\n private currency?: string;\n private properties?: { [key: string]: any };\n private revenue?: number;\n\n constructor() {\n this.productId = '';\n this.quantity = 1;\n this.price = 0.0;\n }\n\n setProductId(productId: string) {\n this.productId = productId;\n return this;\n }\n\n setQuantity(quantity: number) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n }\n\n setPrice(price: number) {\n this.price = price;\n return this;\n }\n\n setRevenueType(revenueType: string) {\n this.revenueType = revenueType;\n return this;\n }\n\n setCurrency(currency: string) {\n this.currency = currency;\n return this;\n }\n\n setRevenue(revenue: number) {\n this.revenue = revenue;\n return this;\n }\n\n setEventProperties(properties: { [key: string]: ValidPropertyType }) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n }\n\n getEventProperties(): RevenueEventProperties {\n const eventProperties: RevenueEventProperties = this.properties ? { ...this.properties } : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n }\n}\n"]}
@@ -38,7 +38,7 @@ export declare const createServerConfig: (serverUrl?: string, serverZone?: keyof
38
38
  serverUrl: string;
39
39
  serverZone: undefined;
40
40
  } | {
41
- serverZone: ServerZone | "US" | "EU";
41
+ serverZone: ServerZone | "US" | "EU" | "STAGING";
42
42
  serverUrl: string;
43
43
  };
44
44
  //# sourceMappingURL=config.d.ts.map
@@ -4,6 +4,7 @@ export declare class Revenue implements IRevenue {
4
4
  private quantity;
5
5
  private price;
6
6
  private revenueType?;
7
+ private currency?;
7
8
  private properties?;
8
9
  private revenue?;
9
10
  constructor();
@@ -11,6 +12,7 @@ export declare class Revenue implements IRevenue {
11
12
  setQuantity(quantity: number): this;
12
13
  setPrice(price: number): this;
13
14
  setRevenueType(revenueType: string): this;
15
+ setCurrency(currency: string): this;
14
16
  setRevenue(revenue: number): this;
15
17
  setEventProperties(properties: {
16
18
  [key: string]: ValidPropertyType;
@@ -1 +1 @@
1
- {"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../../src/revenue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tB,cAAc,CAAC,WAAW,EAAE,MAAM;IAKlC,WAAW,CAAC,QAAQ,EAAE,MAAM;IAK5B,UAAU,CAAC,OAAO,EAAE,MAAM;IAK1B,kBAAkB,CAAC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAAA;KAAE;IAOnE,kBAAkB,IAAI,sBAAsB;CAU7C"}
@@ -25,6 +25,10 @@ var Revenue = /** @class */ (function () {
25
25
  this.revenueType = revenueType;
26
26
  return this;
27
27
  };
28
+ Revenue.prototype.setCurrency = function (currency) {
29
+ this.currency = currency;
30
+ return this;
31
+ };
28
32
  Revenue.prototype.setRevenue = function (revenue) {
29
33
  this.revenue = revenue;
30
34
  return this;
@@ -41,6 +45,7 @@ var Revenue = /** @class */ (function () {
41
45
  eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;
42
46
  eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;
43
47
  eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;
48
+ eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;
44
49
  eventProperties[RevenueProperty.REVENUE] = this.revenue;
45
50
  return eventProperties;
46
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"revenue.js","sourceRoot":"","sources":["../../src/revenue.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,GAIhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;IAQE;QACE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,8BAAY,GAAZ,UAAa,SAAiB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6BAAW,GAAX,UAAY,QAAgB;QAC1B,IAAI,QAAQ,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from '@amplitude/analytics-types';\nimport { isValidObject } from './utils/valid-properties';\n\nexport class Revenue implements IRevenue {\n private productId: string;\n private quantity: number;\n private price: number;\n private revenueType?: string;\n private properties?: { [key: string]: any };\n private revenue?: number;\n\n constructor() {\n this.productId = '';\n this.quantity = 1;\n this.price = 0.0;\n }\n\n setProductId(productId: string) {\n this.productId = productId;\n return this;\n }\n\n setQuantity(quantity: number) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n }\n\n setPrice(price: number) {\n this.price = price;\n return this;\n }\n\n setRevenueType(revenueType: string) {\n this.revenueType = revenueType;\n return this;\n }\n\n setRevenue(revenue: number) {\n this.revenue = revenue;\n return this;\n }\n\n setEventProperties(properties: { [key: string]: ValidPropertyType }) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n }\n\n getEventProperties(): RevenueEventProperties {\n const eventProperties: RevenueEventProperties = this.properties ? { ...this.properties } : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n }\n}\n"]}
1
+ {"version":3,"file":"revenue.js","sourceRoot":"","sources":["../../src/revenue.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,GAIhB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;IASE;QACE,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;IACnB,CAAC;IAED,8BAAY,GAAZ,UAAa,SAAiB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CA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,IAAI,CAAC,QAAQ,CAAC;QAClE,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACxD,OAAO,eAAe,CAAC;IACzB,CAAC;IACH,cAAC;AAAD,CAAC,AAhED,IAgEC","sourcesContent":["import {\n RevenueProperty,\n RevenueEventProperties,\n Revenue as IRevenue,\n ValidPropertyType,\n} from '@amplitude/analytics-types';\nimport { isValidObject } from './utils/valid-properties';\n\nexport class Revenue implements IRevenue {\n private productId: string;\n private quantity: number;\n private price: number;\n private revenueType?: string;\n private currency?: string;\n private properties?: { [key: string]: any };\n private revenue?: number;\n\n constructor() {\n this.productId = '';\n this.quantity = 1;\n this.price = 0.0;\n }\n\n setProductId(productId: string) {\n this.productId = productId;\n return this;\n }\n\n setQuantity(quantity: number) {\n if (quantity > 0) {\n this.quantity = quantity;\n }\n return this;\n }\n\n setPrice(price: number) {\n this.price = price;\n return this;\n }\n\n setRevenueType(revenueType: string) {\n this.revenueType = revenueType;\n return this;\n }\n\n setCurrency(currency: string) {\n this.currency = currency;\n return this;\n }\n\n setRevenue(revenue: number) {\n this.revenue = revenue;\n return this;\n }\n\n setEventProperties(properties: { [key: string]: ValidPropertyType }) {\n if (isValidObject(properties)) {\n this.properties = properties;\n }\n return this;\n }\n\n getEventProperties(): RevenueEventProperties {\n const eventProperties: RevenueEventProperties = this.properties ? { ...this.properties } : {};\n eventProperties[RevenueProperty.REVENUE_PRODUCT_ID] = this.productId;\n eventProperties[RevenueProperty.REVENUE_QUANTITY] = this.quantity;\n eventProperties[RevenueProperty.REVENUE_PRICE] = this.price;\n eventProperties[RevenueProperty.REVENUE_TYPE] = this.revenueType;\n eventProperties[RevenueProperty.REVENUE_CURRENCY] = this.currency;\n eventProperties[RevenueProperty.REVENUE] = this.revenue;\n return eventProperties;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amplitude/analytics-core",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "",
5
5
  "author": "Amplitude Inc",
6
6
  "homepage": "https://github.com/amplitude/Amplitude-TypeScript",
@@ -35,11 +35,11 @@
35
35
  "url": "https://github.com/amplitude/Amplitude-TypeScript/issues"
36
36
  },
37
37
  "dependencies": {
38
- "@amplitude/analytics-types": "^1.3.3",
38
+ "@amplitude/analytics-types": "^1.3.5",
39
39
  "tslib": "^2.4.1"
40
40
  },
41
41
  "files": [
42
42
  "lib"
43
43
  ],
44
- "gitHead": "eb9f8181979aad12e5a1ba1f1afba0e04dc2bc01"
44
+ "gitHead": "4a9346e99f3208f0815c36c6bf8966bf3a07b243"
45
45
  }