Skip to content

Commit

Permalink
FPA M0.5 (#3543)
Browse files Browse the repository at this point in the history
* save point

* save point

* save point

* add comments

* move autoprompttype to shared flow

* update basic test

* fix test

* add test for duration

* remove unused import

* add survey eligibility tests

* add unspecified unit

* add secondsDuration to freqcap proto, remove client side duration processing

* cleanup imports

* add eligibility tests

* refactor ga test util func

* add test for no audience actions

* add test

* add more test

* fix set size reference

* more tests save point

* add tests for dismissibility

* remove console statements

* fix nanos

* add dismissibility, onsite preview tests

* add more tests for closed contenttype

* dmmy commit

* revert dummy commit to trigger codecov

* dummy

* revert

---------

Co-authored-by: justinchou-google <[email protected]>
  • Loading branch information
justinchou-google and justinchou-google authored Aug 27, 2024
1 parent 5a1f075 commit f0deefb
Show file tree
Hide file tree
Showing 9 changed files with 2,338 additions and 310 deletions.
72 changes: 72 additions & 0 deletions src/api/action-orchestration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Copyright 2024 The Subscribe with Google Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {Duration} from '../model/auto-prompt-config';
import {InterventionType} from './intervention-type';

export interface ActionOrchestration {
interventionFunnel: InterventionFunnel;
}

export interface InterventionFunnel {
id: string;
globalFrequencyCap: FrequencyCapConfig;
prompts: Array<InterventionOrchestration>;
}

export interface InterventionOrchestration {
configId: string;
type: InterventionType;
promptFrequencyCap: FrequencyCapConfig;
closability: Closability;
repeatability: {
type: RepeatabilityType;
count: number;
};
}

export enum Closability {
UNSPECIFIED = 'UNSPECIFIED',
DISMISSIBLE = 'DISMISSIBLE',
BLOCKING = 'BLOCKING',
}

enum RepeatabilityType {
UNSPECIFIED = 'UNSPECIFIED',
FINITE = 'FINITE',
INFINITE = 'INFINITE',
}

interface FrequencyCapConfig {
duration?: SwgDuration;
secondsDuration?: Duration;
}

export interface SwgDuration {
unit: SwgDurationUnit;
count: number;
}

export enum SwgDurationUnit {
UNSPECIFIED_UNIT = 'UNSPECIFIED_UNIT',
SECOND = 'SECOND',
MINUTE = 'MINUTE',
HOUR = 'HOUR',
DAY = 'DAY',
WEEK = 'WEEK',
MONTH = 'MONTH',
YEAR = 'YEAR',
}
9 changes: 9 additions & 0 deletions src/api/basic-subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ export enum AutoPromptType {
SUBSCRIPTION_LARGE = 'subscription_large',
}

/**
* The types of supported publication content type. Should be maintained with:
* google3/java/com/google/subscribewithgoogle/audienceactions/proto/audience_member_flow_service.proto.
*/
export enum ContentType {
OPEN = 'OPEN',
CLOSED = 'CLOSED',
}

/**
* Options for configuring all client UI.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/model/auto-prompt-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,6 @@ export class AnyPromptFrequencyCap {
export class Duration {
constructor(
public readonly seconds?: number,
public readonly nano?: number
public readonly nanos?: number
) {}
}
Loading

0 comments on commit f0deefb

Please sign in to comment.