Notwithstanding any other provision of law, for the purpose of establishing the elements of the crime in order to admit as evidence the confession of a person accused of violating Section 261, 264.1, 285, 286, 287, 288, 289, or 647a of, or former Section 288a of, the Penal Code, a court, in its discretion, may determine that a statement of the complaining witness is not made inadmissible by the hearsay rule if it finds all of the following:
If the prosecution intends to offer a statement of the complaining witness pursuant to this section, the prosecution shall serve a written notice upon the defendant at least 10 days prior to the hearing or trial at which the prosecution intends to offer the statement.
If the statement is offered during trial, the court's determination shall be made out of the presence of the jury. If the statement is found to be admissible pursuant to this section, it shall be admitted out of the presence of the jury and solely for the purpose of determining the admissibility of the confession of the defendant.
Ca. Evid. Code § 1228