@vrplatform/hyperline-client 1.0.9 → 1.0.11
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/build/main/_types.generated.d.ts +202 -80
- package/build/main/_types.generated.js.map +1 -1
- package/build/main/client.d.ts +7 -15
- package/build/main/client.js +2 -2
- package/build/main/client.js.map +1 -1
- package/build/main/const.d.ts +4 -0
- package/build/main/const.js +4 -0
- package/build/main/const.js.map +1 -1
- package/build/main/index.d.ts +1 -0
- package/build/main/index.js +1 -0
- package/build/main/index.js.map +1 -1
- package/build/main/tsconfig.main.tsbuildinfo +1 -1
- package/build/main/utils/getMrrDiffReasons.d.ts +20 -0
- package/build/main/utils/getMrrDiffReasons.js +214 -0
- package/build/main/utils/getMrrDiffReasons.js.map +1 -0
- package/build/main/utils/index.d.ts +1 -0
- package/build/main/utils/index.js +2 -0
- package/build/main/utils/index.js.map +1 -0
- package/build/module/_types.generated.d.ts +202 -80
- package/build/module/_types.generated.js.map +1 -1
- package/build/module/client.d.ts +7 -15
- package/build/module/client.js +2 -2
- package/build/module/client.js.map +1 -1
- package/build/module/const.d.ts +4 -0
- package/build/module/const.js +4 -0
- package/build/module/const.js.map +1 -1
- package/build/module/index.d.ts +1 -0
- package/build/module/index.js +1 -0
- package/build/module/index.js.map +1 -1
- package/build/module/tsconfig.esm.tsbuildinfo +1 -1
- package/build/module/utils/getMrrDiffReasons.d.ts +20 -0
- package/build/module/utils/getMrrDiffReasons.js +214 -0
- package/build/module/utils/getMrrDiffReasons.js.map +1 -0
- package/build/module/utils/index.d.ts +1 -0
- package/build/module/utils/index.js +2 -0
- package/build/module/utils/index.js.map +1 -0
- package/package.json +4 -1
- package/src/_types.generated.ts +202 -80
- package/src/client.ts +4 -2
- package/src/const.ts +5 -0
- package/src/index.ts +1 -0
- package/src/utils/getMrrDiffReasons.ts +305 -0
- package/src/utils/index.ts +1 -0
package/build/main/const.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|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IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;CACf,CAAC","sourcesContent":["import type { currency_enum } from '@finalytic/graphql';\nimport type { TrackingEvent } from '@vrplatform/log';\nimport { HyperlineEntities } from './types';\n\n// Tenants\nexport const VRP_TENANT_ID = '7bfec41f-aa3f-4602-95d2-f7996e4f0e59';\nexport const DEMO_TEST_PARTNER_TENANT_ID =\n '0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa';\nexport const XIMPLIFI_TENANT_ID = 'd6ab2bbe-e0fc-48d9-89a3-c3c05f4e79b5';\n\n// Customers\nexport const XIMPLIFI_CUSTOMER_ID = 'cus_HDUZawnaJbPa9p';\nexport const XIMPLIFI_DEV_CUSTOMER_ID = 'cus_dNUGCETGYVu3ZV';\n\n// Coupons\nexport const XIMPLIFI_COUPON_ID = 'cou_MXCaik3r19_Xkn';\nexport const XIMPLIFI_DEV_COUPON_ID = 'cou_MGtxHbT8IR1gK9';\n\nexport const ACCOUNTING_PARTNER_COUPON_ID = 'cou_PJQ328MBAD9kxY';\nexport const ACCOUNTING_PARTNER_DEV_COUPON_ID = 'cou_y6UfaI2X1m34Qg';\n\n// Plans\nexport const HYPERLINE_DEFAULT_PLAN_ID = 'plan_Dyb5P0ICZ6HsIT';\nexport const HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_UTCVXFQnKD0oMS';\nexport const HYPERLINE_DEFAULT_PLAN_NAME = 'All-in-One VRP Subscription';\nexport const HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_9NU7ffT14I4ris';\n\nexport const HYPERLINE_PARTNER_PLAN_ID = 'plan_vkYJcCz7z0XD0N';\nexport const HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_8qtj8T4j0W3oiS';\nexport const HYPERLINE_PARTNER_PLAN_NAME = 'VRP Subscription - Partners';\nexport const HYPERLINE_PARTNER_PRODUCT_ID = 'itm_AJBM0_jPsrqizl';\n\nexport const GL_HYPERLINE_DEFAULT_PLAN_ID = 'plan_JXviWSpU5yuokD';\nexport const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_Nnozk8_TfYqTkj';\nexport const GL_HYPERLINE_DEFAULT_PLAN_NAME = 'VRTrust Subscription';\nexport const GL_HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_NRTRBQ0fc8bFGW';\n\nexport const GL_HYPERLINE_PARTNER_PLAN_ID = 'plan_vyxckdvUi8X_mr';\nexport const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_CVXQ47ErOWANhJ';\nexport const GL_HYPERLINE_PARTNER_PLAN_NAME = 'VRTrust Subscription - Partners';\nexport const GL_HYPERLINE_PARTNER_PRODUCT_ID = 'itm_bE4y9lhrZ6Qtsf';\n\nexport const WEBHOOKS = {\n 'payment_method.created': 'hyperline_payment_method_created',\n 'payment_method.errored': 'hyperline_payment_method_errored',\n 'payment_method.deleted': 'hyperline_payment_method_deleted',\n 'subscription.activated': 'hyperline_subscription_status_changed',\n 'subscription.reactivated': 'hyperline_subscription_status_changed',\n 'subscription.cancellation_scheduled':\n 'hyperline_subscription_cancellation_scheduled',\n 'subscription.cancelled': 'hyperline_subscription_status_changed',\n 'subscription.reinstated': 'hyperline_subscription_status_changed',\n 'subscription.charged': 'hyperline_subscription_charged',\n 'subscription.errored': 'hyperline_subscription_status_changed',\n 'subscription.paused': 'hyperline_subscription_status_changed',\n 'subscription.trial_ended': 'hyperline_trial_ended',\n 'subscription.voided': 'hyperline_subscription_status_changed',\n 'customer.created': 'hyperline_customer_created',\n 'customer.updated': 'hyperline_customer_updated',\n 'customer.deleted': 'hyperline_customer_deleted',\n 'invoice.errored': 'hyperline_invoice_errored',\n 'invoice.ready': 'hyperline_invoice_ready',\n 'invoice.settled': 'hyperline_invoice_settled',\n 'invoice.voided': 'hyperline_invoice_voided',\n} satisfies Record<string, TrackingEvent>;\n\nexport const CURRENCY_MAP: Record<\n currency_enum,\n HyperlineEntities['Currency'] | undefined\n> = {\n aed: 'AED',\n afn: 'AFN',\n all: 'ALL',\n amd: 'AMD',\n ang: 'ANG',\n aoa: 'AOA',\n ars: 'ARS',\n aud: 'AUD',\n awg: 'AWG',\n azn: 'AZN',\n bam: 'BAM',\n bbd: 'BBD',\n bdt: 'BDT',\n bgn: 'BGN',\n bhd: 'BHD',\n bif: 'BIF',\n bmd: 'BMD',\n bnd: 'BND',\n bob: 'BOB',\n bov: 'BOB',\n brl: 'BRL',\n bsd: 'BSD',\n btn: 'BTN',\n bwp: 'BWP',\n byn: 'BYR',\n byr: 'BYR',\n bzd: 'BZD',\n cad: 'CAD',\n cdf: 'CDF',\n che: 'CHF',\n chf: 'CHF',\n chw: 'CHF',\n clf: 'CLP',\n clp: 'CLP',\n cny: 'CNY',\n cop: 'COP',\n cou: 'COP',\n crc: 'CRC',\n cuc: 'CUP',\n cup: 'CUP',\n cve: 'CVE',\n czk: 'CZK',\n djf: 'DJF',\n dkk: 'DKK',\n dop: 'DOP',\n dzd: 'DZD',\n egp: 'EGP',\n ern: 'ERN',\n etb: 'ETB',\n eur: 'EUR',\n fjd: 'FJD',\n fkp: 'FKP',\n gbp: 'GBP',\n gel: 'GEL',\n ghs: 'GHS',\n gip: 'GIP',\n gmd: 'GMD',\n gnf: 'GNF',\n gtq: 'GTQ',\n gyd: 'GYD',\n hkd: 'HKD',\n hnl: 'HNL',\n hrk: 'HRK',\n htg: 'HTG',\n huf: 'HUF',\n idr: 'IDR',\n ils: 'ILS',\n inr: 'INR',\n iqd: 'IQD',\n irr: 'IRR',\n isk: 'ISK',\n jmd: 'JMD',\n jod: 'JOD',\n jpy: 'JPY',\n kes: 'KES',\n kgs: 'KGS',\n khr: 'KHR',\n kmf: 'KMF',\n kpw: 'KPW',\n krw: 'KRW',\n kwd: 'KWD',\n kyd: 'KYD',\n kzt: 'KZT',\n lak: 'LAK',\n lbp: 'LBP',\n lkr: 'LKR',\n lrd: 'LRD',\n lsl: 'LSL',\n ltl: 'EUR',\n lvl: 'EUR',\n lyd: 'LYD',\n mad: 'MAD',\n mdl: 'MDL',\n mga: 'MGA',\n mkd: 'MKD',\n mmk: 'MMK',\n mnt: 'MNT',\n mop: 'MOP',\n mro: 'MRO',\n mur: 'MUR',\n mvr: 'MVR',\n mwk: 'MWK',\n mxn: 'MXN',\n mxv: 'MXN',\n myr: 'MYR',\n mzn: 'MZN',\n nad: 'NAD',\n ngn: 'NGN',\n nio: 'NIO',\n nok: 'NOK',\n npr: 'NPR',\n nzd: 'NZD',\n omr: 'OMR',\n pab: 'PAB',\n pen: 'PEN',\n pgk: 'PGK',\n php: 'PHP',\n pkr: 'PKR',\n pln: 'PLN',\n pyg: 'PYG',\n qar: 'QAR',\n ron: 'RON',\n rsd: 'RSD',\n rub: 'RUB',\n rwf: 'RWF',\n sar: 'SAR',\n sbd: 'SBD',\n scr: 'SCR',\n sdg: 'SDG',\n sek: 'SEK',\n sgd: 'SGD',\n shp: 'SHP',\n sll: 'SLL',\n sos: 'SOS',\n srd: 'SRD',\n ssp: 'SSP',\n std: 'STD',\n syp: 'SYP',\n szl: 'SZL',\n thb: 'THB',\n tjs: 'TJS',\n tmt: 'TMT',\n tnd: 'TND',\n top: 'TOP',\n try: 'TRY',\n ttd: 'TTD',\n twd: 'TWD',\n tzs: 'TZS',\n uah: 'UAH',\n ugx: 'UGX',\n usd: 'USD',\n uyu: 'UYU',\n uzs: 'UZS',\n vef: 'VEF',\n vnd: 'VND',\n vuv: 'VUV',\n wst: 'WST',\n xaf: 'XAF',\n xpf: 'XPF',\n yer: 'YER',\n zar: 'ZAR',\n zmw: 'ZMW',\n zwl: 'ZWL',\n usn: undefined,\n uss: undefined,\n uyi: undefined,\n xag: undefined,\n xau: undefined,\n xba: undefined,\n xbb: undefined,\n xbc: undefined,\n xbd: undefined,\n xcd: undefined,\n xdr: undefined,\n xfu: undefined,\n xof: undefined,\n xpd: undefined,\n xpt: undefined,\n xts: undefined,\n xxx: undefined,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"const.js","source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SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;CACf,CAAC","sourcesContent":["import type { currency_enum } from '@finalytic/graphql';\nimport type { TrackingEvent } from '@vrplatform/log';\nimport { HyperlineEntities } from './types';\n\n// Tenants\nexport const VRP_TENANT_ID = '7bfec41f-aa3f-4602-95d2-f7996e4f0e59';\nexport const DEMO_TEST_PARTNER_TENANT_ID =\n '0b6a7bd6-56cc-46b5-b2ab-1bd7d1e994fa';\nexport const XIMPLIFI_TENANT_ID = 'd6ab2bbe-e0fc-48d9-89a3-c3c05f4e79b5';\n\n// Customers\nexport const XIMPLIFI_CUSTOMER_ID = 'cus_HDUZawnaJbPa9p';\nexport const XIMPLIFI_DEV_CUSTOMER_ID = 'cus_dNUGCETGYVu3ZV';\n\n// Coupons\nexport const XIMPLIFI_COUPON_ID = 'cou_MXCaik3r19_Xkn';\nexport const XIMPLIFI_DEV_COUPON_ID = 'cou_MGtxHbT8IR1gK9';\n\nexport const ACCOUNTING_PARTNER_COUPON_ID = 'cou_PJQ328MBAD9kxY';\nexport const ACCOUNTING_PARTNER_DEV_COUPON_ID = 'cou_y6UfaI2X1m34Qg';\n\nexport const VRTRUST_HALF_PRICE_COUPON_ID = 'cou_CTOQqs0SOeSc-e'; // 50% off\nexport const VRTRUST_HALF_PRICE_DEV_COUPON_ID = 'cou_tHLiRdwQ6xGqKA'; // 50% off\nexport const VRTRUST_FREE_PRICE_COUPON_ID = 'cou_JGiLite8_nFtnX'; // 100% off\nexport const VRTRUST_FREE_PRICE_DEV_COUPON_ID = 'cou_N4GNqSSLEFscto'; // 100% off\n\n// Plans\nexport const HYPERLINE_DEFAULT_PLAN_ID = 'plan_Dyb5P0ICZ6HsIT';\nexport const HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_UTCVXFQnKD0oMS';\nexport const HYPERLINE_DEFAULT_PLAN_NAME = 'All-in-One VRP Subscription';\nexport const HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_9NU7ffT14I4ris';\n\nexport const HYPERLINE_PARTNER_PLAN_ID = 'plan_vkYJcCz7z0XD0N';\nexport const HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_8qtj8T4j0W3oiS';\nexport const HYPERLINE_PARTNER_PLAN_NAME = 'VRP Subscription - Partners';\nexport const HYPERLINE_PARTNER_PRODUCT_ID = 'itm_AJBM0_jPsrqizl';\n\nexport const GL_HYPERLINE_DEFAULT_PLAN_ID = 'plan_JXviWSpU5yuokD';\nexport const GL_HYPERLINE_DEFAULT_DEV_PLAN_ID = 'plan_Nnozk8_TfYqTkj';\nexport const GL_HYPERLINE_DEFAULT_PLAN_NAME = 'VRTrust Subscription';\nexport const GL_HYPERLINE_DEFAULT_PRODUCT_ID = 'itm_NRTRBQ0fc8bFGW';\n\nexport const GL_HYPERLINE_PARTNER_PLAN_ID = 'plan_vyxckdvUi8X_mr';\nexport const GL_HYPERLINE_PARTNER_DEV_PLAN_ID = 'plan_CVXQ47ErOWANhJ';\nexport const GL_HYPERLINE_PARTNER_PLAN_NAME = 'VRTrust Subscription - Partners';\nexport const GL_HYPERLINE_PARTNER_PRODUCT_ID = 'itm_bE4y9lhrZ6Qtsf';\n\nexport const WEBHOOKS = {\n 'payment_method.created': 'hyperline_payment_method_created',\n 'payment_method.errored': 'hyperline_payment_method_errored',\n 'payment_method.deleted': 'hyperline_payment_method_deleted',\n 'subscription.activated': 'hyperline_subscription_status_changed',\n 'subscription.reactivated': 'hyperline_subscription_status_changed',\n 'subscription.cancellation_scheduled':\n 'hyperline_subscription_cancellation_scheduled',\n 'subscription.cancelled': 'hyperline_subscription_status_changed',\n 'subscription.reinstated': 'hyperline_subscription_status_changed',\n 'subscription.charged': 'hyperline_subscription_charged',\n 'subscription.errored': 'hyperline_subscription_status_changed',\n 'subscription.paused': 'hyperline_subscription_status_changed',\n 'subscription.trial_ended': 'hyperline_trial_ended',\n 'subscription.voided': 'hyperline_subscription_status_changed',\n 'customer.created': 'hyperline_customer_created',\n 'customer.updated': 'hyperline_customer_updated',\n 'customer.deleted': 'hyperline_customer_deleted',\n 'invoice.errored': 'hyperline_invoice_errored',\n 'invoice.ready': 'hyperline_invoice_ready',\n 'invoice.settled': 'hyperline_invoice_settled',\n 'invoice.voided': 'hyperline_invoice_voided',\n} satisfies Record<string, TrackingEvent>;\n\nexport const CURRENCY_MAP: Record<\n currency_enum,\n HyperlineEntities['Currency'] | undefined\n> = {\n aed: 'AED',\n afn: 'AFN',\n all: 'ALL',\n amd: 'AMD',\n ang: 'ANG',\n aoa: 'AOA',\n ars: 'ARS',\n aud: 'AUD',\n awg: 'AWG',\n azn: 'AZN',\n bam: 'BAM',\n bbd: 'BBD',\n bdt: 'BDT',\n bgn: 'BGN',\n bhd: 'BHD',\n bif: 'BIF',\n bmd: 'BMD',\n bnd: 'BND',\n bob: 'BOB',\n bov: 'BOB',\n brl: 'BRL',\n bsd: 'BSD',\n btn: 'BTN',\n bwp: 'BWP',\n byn: 'BYR',\n byr: 'BYR',\n bzd: 'BZD',\n cad: 'CAD',\n cdf: 'CDF',\n che: 'CHF',\n chf: 'CHF',\n chw: 'CHF',\n clf: 'CLP',\n clp: 'CLP',\n cny: 'CNY',\n cop: 'COP',\n cou: 'COP',\n crc: 'CRC',\n cuc: 'CUP',\n cup: 'CUP',\n cve: 'CVE',\n czk: 'CZK',\n djf: 'DJF',\n dkk: 'DKK',\n dop: 'DOP',\n dzd: 'DZD',\n egp: 'EGP',\n ern: 'ERN',\n etb: 'ETB',\n eur: 'EUR',\n fjd: 'FJD',\n fkp: 'FKP',\n gbp: 'GBP',\n gel: 'GEL',\n ghs: 'GHS',\n gip: 'GIP',\n gmd: 'GMD',\n gnf: 'GNF',\n gtq: 'GTQ',\n gyd: 'GYD',\n hkd: 'HKD',\n hnl: 'HNL',\n hrk: 'HRK',\n htg: 'HTG',\n huf: 'HUF',\n idr: 'IDR',\n ils: 'ILS',\n inr: 'INR',\n iqd: 'IQD',\n irr: 'IRR',\n isk: 'ISK',\n jmd: 'JMD',\n jod: 'JOD',\n jpy: 'JPY',\n kes: 'KES',\n kgs: 'KGS',\n khr: 'KHR',\n kmf: 'KMF',\n kpw: 'KPW',\n krw: 'KRW',\n kwd: 'KWD',\n kyd: 'KYD',\n kzt: 'KZT',\n lak: 'LAK',\n lbp: 'LBP',\n lkr: 'LKR',\n lrd: 'LRD',\n lsl: 'LSL',\n ltl: 'EUR',\n lvl: 'EUR',\n lyd: 'LYD',\n mad: 'MAD',\n mdl: 'MDL',\n mga: 'MGA',\n mkd: 'MKD',\n mmk: 'MMK',\n mnt: 'MNT',\n mop: 'MOP',\n mro: 'MRO',\n mur: 'MUR',\n mvr: 'MVR',\n mwk: 'MWK',\n mxn: 'MXN',\n mxv: 'MXN',\n myr: 'MYR',\n mzn: 'MZN',\n nad: 'NAD',\n ngn: 'NGN',\n nio: 'NIO',\n nok: 'NOK',\n npr: 'NPR',\n nzd: 'NZD',\n omr: 'OMR',\n pab: 'PAB',\n pen: 'PEN',\n pgk: 'PGK',\n php: 'PHP',\n pkr: 'PKR',\n pln: 'PLN',\n pyg: 'PYG',\n qar: 'QAR',\n ron: 'RON',\n rsd: 'RSD',\n rub: 'RUB',\n rwf: 'RWF',\n sar: 'SAR',\n sbd: 'SBD',\n scr: 'SCR',\n sdg: 'SDG',\n sek: 'SEK',\n sgd: 'SGD',\n shp: 'SHP',\n sll: 'SLL',\n sos: 'SOS',\n srd: 'SRD',\n ssp: 'SSP',\n std: 'STD',\n syp: 'SYP',\n szl: 'SZL',\n thb: 'THB',\n tjs: 'TJS',\n tmt: 'TMT',\n tnd: 'TND',\n top: 'TOP',\n try: 'TRY',\n ttd: 'TTD',\n twd: 'TWD',\n tzs: 'TZS',\n uah: 'UAH',\n ugx: 'UGX',\n usd: 'USD',\n uyu: 'UYU',\n uzs: 'UZS',\n vef: 'VEF',\n vnd: 'VND',\n vuv: 'VUV',\n wst: 'WST',\n xaf: 'XAF',\n xpf: 'XPF',\n yer: 'YER',\n zar: 'ZAR',\n zmw: 'ZMW',\n zwl: 'ZWL',\n usn: undefined,\n uss: undefined,\n uyi: undefined,\n xag: undefined,\n xau: undefined,\n xba: undefined,\n xbb: undefined,\n xbc: undefined,\n xbd: undefined,\n xcd: undefined,\n xdr: undefined,\n xfu: undefined,\n xof: undefined,\n xpd: undefined,\n xpt: undefined,\n xts: undefined,\n xxx: undefined,\n};\n"]}
|
package/build/main/index.d.ts
CHANGED
package/build/main/index.js
CHANGED
package/build/main/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC","sourcesContent":["export * from './const';\nexport * from './types';\nexport * from './client';\nexport * from './hooks';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC","sourcesContent":["export * from './const';\nexport * from './types';\nexport * from './client';\nexport * from './hooks';\nexport * from './utils';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../src/_types.generated.ts","../../src/client.ts","../../src/const.ts","../../src/hooks.ts","../../src/index.ts","../../src/types.ts","../../src/utils.ts"],"version":"5.7.3"}
|
|
1
|
+
{"root":["../../src/_types.generated.ts","../../src/client.ts","../../src/const.ts","../../src/hooks.ts","../../src/index.ts","../../src/types.ts","../../src/utils.ts","../../src/utils/getmrrdiffreasons.ts","../../src/utils/index.ts"],"version":"5.7.3"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function getMrrDiffReasons(firstDate: string, lastDate: string, client?: {
|
|
2
|
+
readonly client: GQtyClient<import("@finalytic/graphql").GeneratedSchema>;
|
|
3
|
+
subscriptionsClient: import("gqty").SubscriptionsClient;
|
|
4
|
+
mutate<T = unknown>(resolved: (sub: import("@finalytic/graphql").Mutation) => T, options?: import("@finalytic/graphql").ResolveOptionsWithSession<T>): Promise<T>;
|
|
5
|
+
query<T = unknown>(resolved: (sub: import("@finalytic/graphql").Query) => T, options?: import("@finalytic/graphql").ResolveOptionsWithSession<T>): Promise<T>;
|
|
6
|
+
subscribe<T = unknown>(resolved: (sub: import("@finalytic/graphql").Subscription) => T, onData: (data: T, unsubscribeFn: () => Promise<void>) => void, onError?: (err: Error, unsubscribeFn: () => Promise<void>) => void): () => Promise<void>;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
messages: string[];
|
|
9
|
+
result: {
|
|
10
|
+
mrrDiff: number;
|
|
11
|
+
listingsDiff: number;
|
|
12
|
+
hasCancelled: boolean;
|
|
13
|
+
id: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
plan?: string;
|
|
16
|
+
activePartnerTeamsDiff: number;
|
|
17
|
+
createdAt: string;
|
|
18
|
+
isNew: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { useHasuraClient } from '@finalytic/graphql';
|
|
2
|
+
import { groupBy, utc } from '@finalytic/utils';
|
|
3
|
+
import { VRP_TENANT_ID, XIMPLIFI_TENANT_ID, } from '@vrplatform/hyperline-client';
|
|
4
|
+
function printFinancialNumber(number, showPlusMinus = true) {
|
|
5
|
+
return `${showPlusMinus ? (number >= 0 ? '+' : '-') : ''}$${Math.abs(number)
|
|
6
|
+
.toFixed(2)
|
|
7
|
+
.toString()
|
|
8
|
+
.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`;
|
|
9
|
+
}
|
|
10
|
+
function printPlusMinus(number) {
|
|
11
|
+
return `${number >= 0 ? '+' : '-'}${Math.abs(number)}`;
|
|
12
|
+
}
|
|
13
|
+
const hasura = useHasuraClient({
|
|
14
|
+
secret: process.env.HASURA_GRAPHQL_ADMIN_SECRET,
|
|
15
|
+
});
|
|
16
|
+
export async function getMrrDiffReasons(firstDate, lastDate, client = hasura) {
|
|
17
|
+
const messages = [];
|
|
18
|
+
messages.push(`MRR Diff Reasons from ${utc(firstDate).yyyymmdd()} to ${utc(lastDate).yyyymmdd()}`);
|
|
19
|
+
messages.push('--------------------------------');
|
|
20
|
+
const { mrrEvents, listingsEvents } = await client.query((q) => ({
|
|
21
|
+
mrrEvents: q
|
|
22
|
+
.tracking_event({
|
|
23
|
+
where: {
|
|
24
|
+
name: { _eq: 'mrr_reported' },
|
|
25
|
+
_or: [
|
|
26
|
+
{
|
|
27
|
+
createdAt: {
|
|
28
|
+
_gte: utc(firstDate).yyyymmdd(),
|
|
29
|
+
_lte: utc(firstDate).add(1, 'day').yyyymmdd(),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
createdAt: {
|
|
34
|
+
_gte: utc(lastDate).yyyymmdd(),
|
|
35
|
+
_lte: utc(lastDate).add(1, 'day').yyyymmdd(),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
.map((e) => ({
|
|
42
|
+
tenantId: e.tenant?.id,
|
|
43
|
+
tenantName: e.tenant?.name,
|
|
44
|
+
tenantCreatedAt: e.tenant?.createdAt,
|
|
45
|
+
tenantPlan: e.tenant?.billingPlan,
|
|
46
|
+
partnerTeamsCreatedFirstDate: e.tenant
|
|
47
|
+
?.clients({
|
|
48
|
+
where: {
|
|
49
|
+
createdAt: {
|
|
50
|
+
_lte: utc(firstDate).yyyymmdd(),
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
.map((c) => c.id).length,
|
|
55
|
+
partnerTeamsCreatedLastDate: e.tenant
|
|
56
|
+
?.clients({
|
|
57
|
+
where: {
|
|
58
|
+
createdAt: {
|
|
59
|
+
_lte: utc(lastDate).yyyymmdd(),
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
.map((c) => c.id).length,
|
|
64
|
+
partnerTeamsCancelledFirstDate: e.tenant
|
|
65
|
+
?.clients({
|
|
66
|
+
where: {
|
|
67
|
+
cancelledAt: {
|
|
68
|
+
_lte: utc(firstDate).yyyymmdd(),
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
})
|
|
72
|
+
.map((c) => c.id).length,
|
|
73
|
+
partnerTeamsCancelledLastDate: e.tenant
|
|
74
|
+
?.clients({
|
|
75
|
+
where: {
|
|
76
|
+
cancelledAt: {
|
|
77
|
+
_lte: utc(lastDate).yyyymmdd(),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
.map((c) => c.id).length,
|
|
82
|
+
mrr: e.props()?.mrr,
|
|
83
|
+
createdAt: utc(e.createdAt).yyyymmdd(),
|
|
84
|
+
})),
|
|
85
|
+
listingsEvents: q
|
|
86
|
+
.tracking_event({
|
|
87
|
+
where: {
|
|
88
|
+
name: { _eq: 'listings_reported' },
|
|
89
|
+
_or: [
|
|
90
|
+
{
|
|
91
|
+
createdAt: {
|
|
92
|
+
_gte: utc(firstDate).yyyymmdd(),
|
|
93
|
+
_lte: utc(firstDate).add(1, 'day').yyyymmdd(),
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
createdAt: {
|
|
98
|
+
_gte: utc(lastDate).yyyymmdd(),
|
|
99
|
+
_lte: utc(lastDate).add(1, 'day').yyyymmdd(),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
.map((e) => ({
|
|
106
|
+
tenantId: e.tenant?.id,
|
|
107
|
+
billingPartnerId: e.tenant?.calculatedBillingPartnerId,
|
|
108
|
+
listings: e.props()?.activeListings,
|
|
109
|
+
createdAt: utc(e.createdAt).yyyymmdd(),
|
|
110
|
+
})),
|
|
111
|
+
}));
|
|
112
|
+
messages.push(`Found ${mrrEvents.length} mrr events`);
|
|
113
|
+
// join mrr and listings events
|
|
114
|
+
const trackingEvents = mrrEvents.map((e) => {
|
|
115
|
+
const filteredEvents = listingsEvents.filter((l) => {
|
|
116
|
+
const tenantId = [VRP_TENANT_ID, XIMPLIFI_TENANT_ID].includes(l.billingPartnerId)
|
|
117
|
+
? l.tenantId
|
|
118
|
+
: l.billingPartnerId;
|
|
119
|
+
return tenantId === e.tenantId && l.createdAt === e.createdAt;
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
...e,
|
|
123
|
+
listings: filteredEvents.reduce((acc, l) => acc + (l.listings ?? 0), 0),
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
// get list of tenants
|
|
127
|
+
const tenants = {};
|
|
128
|
+
for (const event of trackingEvents) {
|
|
129
|
+
if (!tenants[event.tenantId]) {
|
|
130
|
+
const partnerTeamsCreatedDiff = (event.partnerTeamsCreatedLastDate || 0) -
|
|
131
|
+
(event.partnerTeamsCreatedFirstDate || 0);
|
|
132
|
+
const partnerTeamsCancelledDiff = (event.partnerTeamsCancelledLastDate || 0) -
|
|
133
|
+
(event.partnerTeamsCancelledFirstDate || 0);
|
|
134
|
+
tenants[event.tenantId] = {
|
|
135
|
+
id: event.tenantId,
|
|
136
|
+
name: event.tenantName,
|
|
137
|
+
plan: event.tenantPlan,
|
|
138
|
+
activePartnerTeamsDiff: partnerTeamsCreatedDiff - partnerTeamsCancelledDiff,
|
|
139
|
+
mrrFirstDate: undefined,
|
|
140
|
+
mrrLastDate: undefined,
|
|
141
|
+
mrrDiff: 0,
|
|
142
|
+
listingsFirstDate: undefined,
|
|
143
|
+
listingsLastDate: undefined,
|
|
144
|
+
listingsDiff: 0,
|
|
145
|
+
createdAt: utc(event.tenantCreatedAt).yyyymmdd(),
|
|
146
|
+
isNew: utc(event.tenantCreatedAt).isBetween(utc(firstDate), utc(lastDate)),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (event.createdAt === firstDate) {
|
|
150
|
+
tenants[event.tenantId].mrrFirstDate = event.mrr;
|
|
151
|
+
tenants[event.tenantId].listingsFirstDate = event.listings;
|
|
152
|
+
}
|
|
153
|
+
if (event.createdAt === lastDate) {
|
|
154
|
+
tenants[event.tenantId].mrrLastDate = event.mrr;
|
|
155
|
+
tenants[event.tenantId].listingsLastDate = event.listings;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const result = Object.values(tenants)
|
|
159
|
+
.map(({ mrrFirstDate, mrrLastDate, listingsFirstDate, listingsLastDate, ...t }) => ({
|
|
160
|
+
...t,
|
|
161
|
+
mrrDiff: (mrrLastDate ?? 0) - (mrrFirstDate ?? 0),
|
|
162
|
+
listingsDiff: (listingsLastDate ?? 0) - (listingsFirstDate ?? 0),
|
|
163
|
+
hasCancelled: mrrFirstDate !== undefined && mrrLastDate === undefined,
|
|
164
|
+
}))
|
|
165
|
+
.filter((t) => t.mrrDiff)
|
|
166
|
+
.sort((a, b) => b.mrrDiff - a.mrrDiff)
|
|
167
|
+
.reverse();
|
|
168
|
+
// calculate summ of mrr per day
|
|
169
|
+
const groupedEvents = groupBy(trackingEvents, (e) => e.createdAt);
|
|
170
|
+
const summedMrrPerDay = Object.entries(groupedEvents)
|
|
171
|
+
.map(([date, events]) => {
|
|
172
|
+
const mrr = events.reduce((acc, e) => acc + (e.mrr ?? 0), 0);
|
|
173
|
+
const listings = events.reduce((acc, e) => acc + (e.listings ?? 0), 0);
|
|
174
|
+
return {
|
|
175
|
+
date,
|
|
176
|
+
mrr,
|
|
177
|
+
count: events.length,
|
|
178
|
+
listings,
|
|
179
|
+
};
|
|
180
|
+
})
|
|
181
|
+
.sort((a, b) => utc(b.date).diff(utc(a.date)));
|
|
182
|
+
messages.push(`MRR sum changed from ${printFinancialNumber(summedMrrPerDay[1].mrr, false)} to ${printFinancialNumber(summedMrrPerDay[0].mrr, false)} (${printFinancialNumber(summedMrrPerDay[0].mrr - summedMrrPerDay[1].mrr)})`);
|
|
183
|
+
messages.push(`MRR Reports changed from ${summedMrrPerDay[1].count.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')} to ${summedMrrPerDay[0].count.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')} (${printPlusMinus(summedMrrPerDay[0].count - summedMrrPerDay[1].count)})`);
|
|
184
|
+
messages.push(`Active Listings changed from ${summedMrrPerDay[1].listings.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')} to ${summedMrrPerDay[0].listings.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')} (${printPlusMinus(summedMrrPerDay[0].listings - summedMrrPerDay[1].listings)})`);
|
|
185
|
+
messages.push(`Active Partner Teams changed by ${printPlusMinus(result.reduce((acc, t) => acc + t.activePartnerTeamsDiff, 0))}`);
|
|
186
|
+
messages.push();
|
|
187
|
+
const cancelledTenants = result.filter((t) => t.hasCancelled);
|
|
188
|
+
const legacyTenants = result.filter((t) => t.plan?.includes('Legacy') &&
|
|
189
|
+
!cancelledTenants.map((t) => t.id).includes(t.id));
|
|
190
|
+
const newTenants = result.filter((t) => t.isNew &&
|
|
191
|
+
!cancelledTenants.map((t) => t.id).includes(t.id) &&
|
|
192
|
+
!legacyTenants.map((t) => t.id).includes(t.id));
|
|
193
|
+
const activeListings = result.filter((t) => t.listingsDiff &&
|
|
194
|
+
!newTenants.map((t) => t.id).includes(t.id) &&
|
|
195
|
+
!cancelledTenants.map((t) => t.id).includes(t.id) &&
|
|
196
|
+
!legacyTenants.map((t) => t.id).includes(t.id));
|
|
197
|
+
const otherTenants = result.filter((t) => !newTenants.map((t) => t.id).includes(t.id) &&
|
|
198
|
+
!cancelledTenants.map((t) => t.id).includes(t.id) &&
|
|
199
|
+
!legacyTenants.map((t) => t.id).includes(t.id) &&
|
|
200
|
+
!activeListings.map((t) => t.id).includes(t.id));
|
|
201
|
+
const total = newTenants.reduce((acc, t) => acc + t.mrrDiff, 0) +
|
|
202
|
+
cancelledTenants.reduce((acc, t) => acc + t.mrrDiff, 0) +
|
|
203
|
+
legacyTenants.reduce((acc, t) => acc + t.mrrDiff, 0) +
|
|
204
|
+
activeListings.reduce((acc, t) => acc + t.mrrDiff, 0) +
|
|
205
|
+
otherTenants.reduce((acc, t) => acc + t.mrrDiff, 0);
|
|
206
|
+
messages.push(`MRR from ${newTenants.length} new tenants: ${printFinancialNumber(newTenants.reduce((acc, t) => acc + t.mrrDiff, 0))}`);
|
|
207
|
+
messages.push(`MRR from ${cancelledTenants.length} cancelled tenants: ${printFinancialNumber(cancelledTenants.reduce((acc, t) => acc + t.mrrDiff, 0))}`);
|
|
208
|
+
messages.push(`MRR from ${legacyTenants.length} tenants with Legacy plans: ${printFinancialNumber(legacyTenants.reduce((acc, t) => acc + t.mrrDiff, 0))}`);
|
|
209
|
+
messages.push(`MRR from ${activeListings.length} tenants with active listings changes: ${printFinancialNumber(activeListings.reduce((acc, t) => acc + t.mrrDiff, 0))}`);
|
|
210
|
+
messages.push(`MRR from ${otherTenants.length} other tenants: ${printFinancialNumber(otherTenants.reduce((acc, t) => acc + t.mrrDiff, 0))} (${otherTenants.map((t) => `${t.name} (${printFinancialNumber(t.mrrDiff)})`).join(', ')})`);
|
|
211
|
+
messages.push(`= ${printFinancialNumber(total)}`);
|
|
212
|
+
return { messages, result };
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=getMrrDiffReasons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMrrDiffReasons.js","sourceRoot":"src/","sources":["utils/getMrrDiffReasons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,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,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAC5I,CAAC;IACF,QAAQ,CAAC,IAAI,CACX,YAAY,cAAc,CAAC,MAAM,0CAA0C,oBAAoB,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CACzJ,CAAC;IACF,QAAQ,CAAC,IAAI,CACX,YAAY,YAAY,CAAC,MAAM,mBAAmB,oBAAoB,CACpE,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CACpD,KAAK,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC9F,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,KAAK,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import { useHasuraClient } from '@finalytic/graphql';\nimport { groupBy, utc } from '@finalytic/utils';\nimport {\n VRP_TENANT_ID,\n XIMPLIFI_TENANT_ID,\n} from '@vrplatform/hyperline-client';\n\nfunction printFinancialNumber(number: number, showPlusMinus = true) {\n return `${showPlusMinus ? (number >= 0 ? '+' : '-') : ''}$${Math.abs(number)\n .toFixed(2)\n .toString()\n .replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')}`;\n}\nfunction printPlusMinus(number: number) {\n return `${number >= 0 ? '+' : '-'}${Math.abs(number)}`;\n}\n\nconst hasura = useHasuraClient({\n secret: process.env.HASURA_GRAPHQL_ADMIN_SECRET,\n});\n\nexport async function getMrrDiffReasons(\n firstDate: string,\n lastDate: string,\n client = hasura\n) {\n const messages: string[] = [];\n messages.push(\n `MRR Diff Reasons from ${utc(firstDate).yyyymmdd()} to ${utc(lastDate).yyyymmdd()}`\n );\n messages.push('--------------------------------');\n\n const { mrrEvents, listingsEvents } = await client.query((q) => ({\n mrrEvents: q\n .tracking_event({\n where: {\n name: { _eq: 'mrr_reported' },\n _or: [\n {\n createdAt: {\n _gte: utc(firstDate).yyyymmdd(),\n _lte: utc(firstDate).add(1, 'day').yyyymmdd(),\n },\n },\n {\n createdAt: {\n _gte: utc(lastDate).yyyymmdd(),\n _lte: utc(lastDate).add(1, 'day').yyyymmdd(),\n },\n },\n ],\n },\n })\n .map((e) => ({\n tenantId: e.tenant?.id!,\n tenantName: e.tenant?.name,\n tenantCreatedAt: e.tenant?.createdAt,\n tenantPlan: e.tenant?.billingPlan,\n partnerTeamsCreatedFirstDate: e.tenant\n ?.clients({\n where: {\n createdAt: {\n _lte: utc(firstDate).yyyymmdd(),\n },\n },\n })\n .map((c) => c.id).length,\n partnerTeamsCreatedLastDate: e.tenant\n ?.clients({\n where: {\n createdAt: {\n _lte: utc(lastDate).yyyymmdd(),\n },\n },\n })\n .map((c) => c.id).length,\n partnerTeamsCancelledFirstDate: e.tenant\n ?.clients({\n where: {\n cancelledAt: {\n _lte: utc(firstDate).yyyymmdd(),\n },\n },\n })\n .map((c) => c.id).length,\n partnerTeamsCancelledLastDate: e.tenant\n ?.clients({\n where: {\n cancelledAt: {\n _lte: utc(lastDate).yyyymmdd(),\n },\n },\n })\n .map((c) => c.id).length,\n mrr: e.props()?.mrr,\n createdAt: utc(e.createdAt).yyyymmdd(),\n })),\n listingsEvents: q\n .tracking_event({\n where: {\n name: { _eq: 'listings_reported' },\n _or: [\n {\n createdAt: {\n _gte: utc(firstDate).yyyymmdd(),\n _lte: utc(firstDate).add(1, 'day').yyyymmdd(),\n },\n },\n {\n createdAt: {\n _gte: utc(lastDate).yyyymmdd(),\n _lte: utc(lastDate).add(1, 'day').yyyymmdd(),\n },\n },\n ],\n },\n })\n .map((e) => ({\n tenantId: e.tenant?.id!,\n billingPartnerId: e.tenant?.calculatedBillingPartnerId!,\n listings: e.props()?.activeListings,\n createdAt: utc(e.createdAt).yyyymmdd(),\n })),\n }));\n messages.push(`Found ${mrrEvents.length} mrr events`);\n\n // join mrr and listings events\n const trackingEvents = mrrEvents.map((e) => {\n const filteredEvents = listingsEvents.filter((l) => {\n const tenantId = [VRP_TENANT_ID, XIMPLIFI_TENANT_ID].includes(\n l.billingPartnerId!\n )\n ? l.tenantId!\n : l.billingPartnerId!;\n\n return tenantId === e.tenantId && l.createdAt === e.createdAt;\n });\n\n return {\n ...e,\n listings: filteredEvents.reduce((acc, l) => acc + (l.listings ?? 0), 0),\n };\n });\n\n // get list of tenants\n const tenants: Record<\n string,\n {\n id: string;\n name?: string;\n plan?: string;\n activePartnerTeamsDiff: number;\n mrrFirstDate?: number;\n mrrLastDate?: number;\n mrrDiff: number;\n listingsFirstDate?: number;\n listingsLastDate?: number;\n listingsDiff: number;\n createdAt: string;\n isNew: boolean;\n hasCancelled?: boolean;\n }\n > = {};\n for (const event of trackingEvents) {\n if (!tenants[event.tenantId]) {\n const partnerTeamsCreatedDiff =\n (event.partnerTeamsCreatedLastDate || 0) -\n (event.partnerTeamsCreatedFirstDate || 0);\n const partnerTeamsCancelledDiff =\n (event.partnerTeamsCancelledLastDate || 0) -\n (event.partnerTeamsCancelledFirstDate || 0);\n\n tenants[event.tenantId] = {\n id: event.tenantId,\n name: event.tenantName,\n plan: event.tenantPlan,\n activePartnerTeamsDiff:\n partnerTeamsCreatedDiff - partnerTeamsCancelledDiff,\n mrrFirstDate: undefined,\n mrrLastDate: undefined,\n mrrDiff: 0,\n listingsFirstDate: undefined,\n listingsLastDate: undefined,\n listingsDiff: 0,\n createdAt: utc(event.tenantCreatedAt).yyyymmdd(),\n isNew: utc(event.tenantCreatedAt).isBetween(\n utc(firstDate),\n utc(lastDate)\n ),\n };\n }\n\n if (event.createdAt === firstDate) {\n tenants[event.tenantId].mrrFirstDate = event.mrr;\n tenants[event.tenantId].listingsFirstDate = event.listings;\n }\n if (event.createdAt === lastDate) {\n tenants[event.tenantId].mrrLastDate = event.mrr;\n tenants[event.tenantId].listingsLastDate = event.listings;\n }\n }\n\n const result = Object.values(tenants)\n .map(\n ({\n mrrFirstDate,\n mrrLastDate,\n listingsFirstDate,\n listingsLastDate,\n ...t\n }) => ({\n ...t,\n mrrDiff: (mrrLastDate ?? 0) - (mrrFirstDate ?? 0),\n listingsDiff: (listingsLastDate ?? 0) - (listingsFirstDate ?? 0),\n hasCancelled: mrrFirstDate !== undefined && mrrLastDate === undefined,\n })\n )\n .filter((t) => t.mrrDiff)\n .sort((a, b) => b.mrrDiff - a.mrrDiff)\n .reverse();\n\n // calculate summ of mrr per day\n const groupedEvents = groupBy(trackingEvents, (e) => e.createdAt);\n const summedMrrPerDay = Object.entries(groupedEvents)\n .map(([date, events]) => {\n const mrr = events.reduce((acc, e) => acc + (e.mrr ?? 0), 0);\n const listings = events.reduce((acc, e) => acc + (e.listings ?? 0), 0);\n\n return {\n date,\n mrr,\n count: events.length,\n listings,\n };\n })\n .sort((a, b) => utc(b.date).diff(utc(a.date)));\n messages.push(\n `MRR sum changed from ${printFinancialNumber(summedMrrPerDay[1].mrr, false)} to ${printFinancialNumber(summedMrrPerDay[0].mrr, false)} (${printFinancialNumber(summedMrrPerDay[0].mrr - summedMrrPerDay[1].mrr)})`\n );\n messages.push(\n `MRR Reports changed from ${summedMrrPerDay[1].count.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')} to ${summedMrrPerDay[0].count.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')} (${printPlusMinus(summedMrrPerDay[0].count - summedMrrPerDay[1].count)})`\n );\n messages.push(\n `Active Listings changed from ${summedMrrPerDay[1].listings.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')} to ${summedMrrPerDay[0].listings.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')} (${printPlusMinus(summedMrrPerDay[0].listings - summedMrrPerDay[1].listings)})`\n );\n messages.push(\n `Active Partner Teams changed by ${printPlusMinus(\n result.reduce((acc, t) => acc + t.activePartnerTeamsDiff, 0)\n )}`\n );\n messages.push();\n\n const cancelledTenants = result.filter((t) => t.hasCancelled);\n const legacyTenants = result.filter(\n (t) =>\n t.plan?.includes('Legacy') &&\n !cancelledTenants.map((t) => t.id).includes(t.id)\n );\n const newTenants = result.filter(\n (t) =>\n t.isNew &&\n !cancelledTenants.map((t) => t.id).includes(t.id) &&\n !legacyTenants.map((t) => t.id).includes(t.id)\n );\n const activeListings = result.filter(\n (t) =>\n t.listingsDiff &&\n !newTenants.map((t) => t.id).includes(t.id) &&\n !cancelledTenants.map((t) => t.id).includes(t.id) &&\n !legacyTenants.map((t) => t.id).includes(t.id)\n );\n const otherTenants = result.filter(\n (t) =>\n !newTenants.map((t) => t.id).includes(t.id) &&\n !cancelledTenants.map((t) => t.id).includes(t.id) &&\n !legacyTenants.map((t) => t.id).includes(t.id) &&\n !activeListings.map((t) => t.id).includes(t.id)\n );\n const total =\n newTenants.reduce((acc, t) => acc + t.mrrDiff, 0) +\n cancelledTenants.reduce((acc, t) => acc + t.mrrDiff, 0) +\n legacyTenants.reduce((acc, t) => acc + t.mrrDiff, 0) +\n activeListings.reduce((acc, t) => acc + t.mrrDiff, 0) +\n otherTenants.reduce((acc, t) => acc + t.mrrDiff, 0);\n messages.push(\n `MRR from ${newTenants.length} new tenants: ${printFinancialNumber(newTenants.reduce((acc, t) => acc + t.mrrDiff, 0))}`\n );\n messages.push(\n `MRR from ${cancelledTenants.length} cancelled tenants: ${printFinancialNumber(cancelledTenants.reduce((acc, t) => acc + t.mrrDiff, 0))}`\n );\n messages.push(\n `MRR from ${legacyTenants.length} tenants with Legacy plans: ${printFinancialNumber(legacyTenants.reduce((acc, t) => acc + t.mrrDiff, 0))}`\n );\n messages.push(\n `MRR from ${activeListings.length} tenants with active listings changes: ${printFinancialNumber(activeListings.reduce((acc, t) => acc + t.mrrDiff, 0))}`\n );\n messages.push(\n `MRR from ${otherTenants.length} other tenants: ${printFinancialNumber(\n otherTenants.reduce((acc, t) => acc + t.mrrDiff, 0)\n )} (${otherTenants.map((t) => `${t.name} (${printFinancialNumber(t.mrrDiff)})`).join(', ')})`\n );\n messages.push(`= ${printFinancialNumber(total)}`);\n\n return { messages, result };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getMrrDiffReasons';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './getMrrDiffReasons';\n"]}
|