import Taro from '@tarojs/taro'
import { savePoint } from '@/services/common'
import addNum from './addNum'

export function shareTracking(options) {
  const page = Taro.getStorageSync('page')
  if (!page) return;

  const { name: propertyName, type: eventType } = page
  const {
    event = 'share',
    // eventType = '',
    // propertyName = '',
    consultantId = '',
    sharePersonId = '',
    targetId = '',
    buildingId = '',
  } = options

  addNum({ eventType, targetId })
  savePoint({
    event,
    eventType,
    propertyName,
    consultantId,
    sharePersonId,
    targetId,
    buildingId,
    data: '{}',
  })
}
