@delopay/sdk 0.512.0 → 0.513.0

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.
@@ -1,4 +1,4 @@
1
- import { SurchargeRuleRequest, SurchargeRuleResponse, CheckoutThemeProgramRequest, CheckoutThemeProgramResponse, CheckoutThemeConversionQuery, CheckoutThemeConversionResponse, RoutingConfigCreateRequest, RoutingDictionaryRecord, MerchantRoutingAlgorithm, RoutingActivatePayload, RoutingDeactivateRequest, RoutingConfigUpdateRequest, RoutingConfigDeleteResponse, RoutingHistoryParams, RoutingConfigHistoryResponse, RoutingConnectorCaps, RoutingConnectorCapSchedule, RoutingConnectorCapScheduleShuffle, RoutingTimePlanDocument, RoutingVolumeCounters, RoutingConnectorCapResetRequest, RoutingConnectorCapReset, ConnectorCapOverrideList, ConnectorCapOverrides, ConnectorCapOverrideLevel, ConnectorCapOverrideRequest, ConnectorCapOverride, RoutingDictionary, ProfileDeniedConnectorsResponse, LinkedRoutingConfigRetrieveResponse, RoutableConnectorChoice, ProfileDefaultRoutingConfig, DefaultRoutingConfigUpdate, RoutingRuleKeys, ProgramConnectorSelection, RoutingProgramAnalysis } from '../types.cjs';
1
+ import { SurchargeRuleRequest, SurchargeRuleResponse, CheckoutThemeProgramRequest, CheckoutThemeProgramResponse, ThemeProgramDeactivateResponse, CheckoutThemeConversionQuery, CheckoutThemeConversionResponse, ExperimentScopeQuery, ExperimentListResponse, ExperimentCreateRequest, ExperimentChangeResponse, ExperimentResponse, ExperimentUpdateRequest, ExperimentReorderRequest, ExperimentPreviewRequest, ExperimentPreviewResponse, ExperimentTransitionRequest, ExperimentEndRequest, ExperimentRestartRequest, ExperimentEventsResponse, ExperimentResultsQuery, ExperimentResultsResponse, ExperimentResultsSummaryQuery, ExperimentResultsSummaryResponse, TargetingSimulateRequest, TargetingSimulateResponse, TargetingCapabilitiesResponse, RoutingConfigCreateRequest, RoutingDictionaryRecord, MerchantRoutingAlgorithm, RoutingActivatePayload, RoutingDeactivateRequest, RoutingConfigUpdateRequest, RoutingConfigDeleteResponse, RoutingHistoryParams, RoutingConfigHistoryResponse, RoutingConnectorCaps, RoutingConnectorCapSchedule, RoutingConnectorCapScheduleShuffle, RoutingTimePlanDocument, RoutingVolumeCounters, RoutingConnectorCapResetRequest, RoutingConnectorCapReset, ConnectorCapOverrideList, ConnectorCapOverrides, ConnectorCapOverrideLevel, ConnectorCapOverrideRequest, ConnectorCapOverride, RoutingDictionary, ProfileDeniedConnectorsResponse, LinkedRoutingConfigRetrieveResponse, RoutableConnectorChoice, ProfileDefaultRoutingConfig, DefaultRoutingConfigUpdate, RoutingRuleKeys, ProgramConnectorSelection, RoutingProgramAnalysis } from '../types.cjs';
2
2
  import { RequestFn, RequestExtras } from '../core.cjs';
3
3
  import '../currencies.cjs';
4
4
  import '../eventStream.cjs';
@@ -19,6 +19,10 @@ declare class Routing {
19
19
  readonly checkoutThemeRules: CheckoutThemeRules;
20
20
  /** Rendered-to-paid conversion per appearance variant and segment. */
21
21
  readonly checkoutThemeConversion: CheckoutThemeConversion;
22
+ /** Look tests: two or more looks shown to one audience at random, by shares, with results. */
23
+ readonly checkoutExperiments: CheckoutExperiments;
24
+ /** What a described buyer would see, and what this deployment can do for a scope. */
25
+ readonly checkoutTargeting: CheckoutTargeting;
22
26
  constructor(request: RequestFn);
23
27
  /**
24
28
  * Create a new routing algorithm.
@@ -431,6 +435,11 @@ declare class CheckoutThemeRules {
431
435
  * that is where a program drafted against a variant you have not built yet
432
436
  * belongs.
433
437
  *
438
+ * Send the `revision` the last read answered (`"0:0"` when it answered
439
+ * `null`): the save is then refused with `IR_16` when the scope's rules
440
+ * changed since, instead of overwriting someone else's edit. Without it the
441
+ * save replaces whatever is stored.
442
+ *
434
443
  * @example A phone in Germany gets the compact look; everyone else the house style.
435
444
  * ```typescript
436
445
  * await delopay.routing.checkoutThemeRules.upsert({
@@ -469,7 +478,9 @@ declare class CheckoutThemeRules {
469
478
  */
470
479
  upsert(params: CheckoutThemeProgramRequest): Promise<CheckoutThemeProgramResponse>;
471
480
  /**
472
- * Retrieve the active theme program for a scope, or `null` when none is set.
481
+ * Retrieve the theme program of a scope: the one in force, else the newest
482
+ * one (switched off or saved as a draft, `is_active: false`), or `null` when
483
+ * the scope never had one. Its `revision` goes back on the next save.
473
484
  *
474
485
  * `GET /routing/checkout-theme/rules?profile_id={profileId}`
475
486
  *
@@ -478,17 +489,22 @@ declare class CheckoutThemeRules {
478
489
  */
479
490
  retrieve(profileId?: string): Promise<CheckoutThemeProgramResponse | null>;
480
491
  /**
481
- * Deactivate the active theme program for a scope. Idempotent.
492
+ * Deactivate the active theme program for a scope. Idempotent without
493
+ * `revision`. The program stays readable, switched off. Answers the scope's
494
+ * new `revision`, to send with the next save or switch-off.
482
495
  *
483
- * `DELETE /routing/checkout-theme/rules?profile_id={profileId}`
496
+ * `DELETE /routing/checkout-theme/rules?profile_id={profileId}&revision={revision}`
484
497
  *
485
498
  * Deactivation, not deletion — the stored row is what says which look was
486
499
  * live when, and that history cannot be reconstructed after the fact. Shops
487
500
  * go back to their default appearance immediately.
488
501
  *
489
502
  * @param profileId - Shop scope. Omit for the merchant-wide program.
503
+ * @param revision - The `revision` the last read answered. Switching off is
504
+ * then refused with `IR_16` when the rules changed since. Omit it to switch
505
+ * off whatever is in force.
490
506
  */
491
- delete(profileId?: string): Promise<void>;
507
+ delete(profileId?: string, revision?: string): Promise<ThemeProgramDeactivateResponse>;
492
508
  }
493
509
  /**
494
510
  * Rendered-to-paid conversion, per appearance variant and segment.
@@ -541,5 +557,222 @@ declare class CheckoutThemeConversion {
541
557
  */
542
558
  retrieve(params: CheckoutThemeConversionQuery): Promise<CheckoutThemeConversionResponse>;
543
559
  }
560
+ /**
561
+ * Look tests: show the buyers of one audience one of two or more looks at
562
+ * random, by shares you set, and read which converts better.
563
+ *
564
+ * A test belongs to a shop, or to a checkout template and then runs in every
565
+ * shop on that template. Each buyer stays on the look first drawn for them:
566
+ * per browser by default, or per payment. A buyer whose link names a look
567
+ * (`?theme=`, a checkout entry's look) sees that look and is counted as drawn
568
+ * but not shown. Within a scope, the first running test whose audience takes
569
+ * a buyer decides; a shop's own tests come before its template's.
570
+ *
571
+ * Every change sends the `revision` the test was read at, and a test changed
572
+ * since is refused with `IR_16`, so a stale page never overwrites a newer
573
+ * edit. Each change answers with an {@link ExperimentChangeResponse}: the test
574
+ * as it now stands, whether a new version began, and the share of returning
575
+ * buyers whose look moved.
576
+ *
577
+ * Reads need checkout-branding read access; creating, editing, reordering and
578
+ * deleting a draft need edit access; starting, pausing, resuming, ending,
579
+ * restarting and archiving need write access.
580
+ */
581
+ declare class CheckoutExperiments {
582
+ private readonly request;
583
+ constructor(request: RequestFn);
584
+ /**
585
+ * The tests of a shop or template, in their order, with what an arm may name.
586
+ *
587
+ * `GET /routing/checkout-theme/experiments`
588
+ *
589
+ * For a shop on a template, the template's tests come back in `inherited`:
590
+ * they run in the shop after the shop's own, and are changed on the template.
591
+ */
592
+ list(params?: ExperimentScopeQuery): Promise<ExperimentListResponse>;
593
+ /**
594
+ * Create a test as a draft. Nothing is shown to buyers until it is started.
595
+ *
596
+ * `POST /routing/checkout-theme/experiments`
597
+ *
598
+ * A definition that cannot be stored (fewer than two arms, shares that do not
599
+ * add up to 10 000, an unknown control arm) is refused with a 400 naming why;
600
+ * a scope that holds the most tests it may is refused with `IR_16`.
601
+ *
602
+ * @example Half the phones in Germany see the compact look, half what they see today.
603
+ * ```typescript
604
+ * const { experiment } = await delopay.routing.checkoutExperiments.create({
605
+ * profile_id: 'pro_...',
606
+ * name: 'Compact on German phones',
607
+ * audience: { devices: ['phone'], countries: { countries: ['DE'] } },
608
+ * arms: [
609
+ * { key: 'current', look: null, share_bp: 5000 },
610
+ * { key: 'compact', look: 'compact', share_bp: 5000 },
611
+ * ],
612
+ * control_arm: 'current',
613
+ * });
614
+ * await delopay.routing.checkoutExperiments.start(experiment.id, {
615
+ * revision: experiment.revision,
616
+ * });
617
+ * ```
618
+ */
619
+ create(params: ExperimentCreateRequest): Promise<ExperimentChangeResponse>;
620
+ /**
621
+ * Retrieve one test.
622
+ *
623
+ * `GET /routing/checkout-theme/experiments/{experiment_id}`
624
+ */
625
+ retrieve(experimentId: string): Promise<ExperimentResponse>;
626
+ /**
627
+ * Change a test. Fields left out stay as they are.
628
+ *
629
+ * `PATCH /routing/checkout-theme/experiments/{experiment_id}`
630
+ *
631
+ * Once a test has started, a change to the audience, the arms, the control or
632
+ * the unit begins a new version and needs `new_version: true`; the results of
633
+ * each version stay apart. Use {@link CheckoutExperiments.preview} first to
634
+ * see what the change would do.
635
+ */
636
+ update(experimentId: string, params: ExperimentUpdateRequest): Promise<ExperimentChangeResponse>;
637
+ /**
638
+ * Delete a draft that never started. Anything else is refused with `IR_16`:
639
+ * archive it instead.
640
+ *
641
+ * `DELETE /routing/checkout-theme/experiments/{experiment_id}?revision={revision}`
642
+ *
643
+ * @param revision - The `revision` the test was read at.
644
+ */
645
+ delete(experimentId: string, revision: number): Promise<void>;
646
+ /**
647
+ * Set the order of a scope's tests: the first whose audience takes a buyer
648
+ * decides. Names every test of the scope that is not archived.
649
+ *
650
+ * `POST /routing/checkout-theme/experiments/reorder`
651
+ *
652
+ * Send the list's `order_token`: a reorder made on an order someone else
653
+ * changed since is then refused with `IR_16` instead of replacing theirs.
654
+ */
655
+ reorder(params: ExperimentReorderRequest): Promise<ExperimentListResponse>;
656
+ /**
657
+ * What a create or a change would do, without saving it: why it would be
658
+ * refused, the warnings the test would carry and, for a started test,
659
+ * whether it begins a new version and how many returning buyers it moves.
660
+ *
661
+ * `POST /routing/checkout-theme/experiments/preview`
662
+ */
663
+ preview(params: ExperimentPreviewRequest): Promise<ExperimentPreviewResponse>;
664
+ /**
665
+ * Start a draft. It draws buyers from its `starts_at`, or at once without one.
666
+ *
667
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/start`
668
+ */
669
+ start(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
670
+ /**
671
+ * Pause a started test: its audience sees what it would without the test.
672
+ *
673
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/pause`
674
+ */
675
+ pause(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
676
+ /**
677
+ * Resume a paused test. Returning buyers keep the look drawn for them.
678
+ *
679
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/resume`
680
+ */
681
+ resume(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
682
+ /**
683
+ * End a test. With `keep_arm`, its audience keeps seeing that arm's look;
684
+ * without it, what it would see without the test.
685
+ *
686
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/end`
687
+ */
688
+ end(experimentId: string, params: ExperimentEndRequest): Promise<ExperimentChangeResponse>;
689
+ /**
690
+ * Start an ended test again, as a new version, optionally changing what it
691
+ * compares in the same step.
692
+ *
693
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/restart`
694
+ */
695
+ restart(experimentId: string, params: ExperimentRestartRequest): Promise<ExperimentChangeResponse>;
696
+ /**
697
+ * Put a draft or an ended test away. Its results stay readable. A test that
698
+ * is scheduled, running or paused is refused with `IR_16`: end it first.
699
+ *
700
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/archive`
701
+ */
702
+ archive(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
703
+ /**
704
+ * A test's history: who created, changed, started, paused, ended or moved it.
705
+ *
706
+ * `GET /routing/checkout-theme/experiments/{experiment_id}/events`
707
+ */
708
+ events(experimentId: string): Promise<ExperimentEventsResponse>;
709
+ /**
710
+ * A test's results for one version and one environment.
711
+ *
712
+ * `GET /routing/checkout-theme/experiments/{experiment_id}/results`
713
+ *
714
+ * Rates, intervals, verdicts and the sample-ratio check are computed
715
+ * server-side and shipped as values: show them as they are rather than
716
+ * recomputing them. A 404 means no such test or version, or a test that has
717
+ * not started.
718
+ *
719
+ * @example
720
+ * ```typescript
721
+ * const results = await delopay.routing.checkoutExperiments.results('cexp_...', {
722
+ * segment: 'device',
723
+ * });
724
+ * for (const c of results.comparisons) {
725
+ * if (c.verdict === 'better') console.log(`${c.arm} converts better than ${c.control_arm}`);
726
+ * }
727
+ * ```
728
+ */
729
+ results(experimentId: string, params?: ExperimentResultsQuery): Promise<ExperimentResultsResponse>;
730
+ /**
731
+ * Every started, not archived test of a shop or template, in brief: the
732
+ * version in force, its counts, and the arm clearly ahead, if any.
733
+ *
734
+ * `GET /routing/checkout-theme/experiments/results-summary`
735
+ */
736
+ resultsSummary(params?: ExperimentResultsSummaryQuery): Promise<ExperimentResultsSummaryResponse>;
737
+ }
738
+ /**
739
+ * Which look a buyer would see, and why, and what look targeting can do in
740
+ * this deployment.
741
+ */
742
+ declare class CheckoutTargeting {
743
+ private readonly request;
744
+ constructor(request: RequestFn);
745
+ /**
746
+ * What a described buyer would see in a shop or template, and why: the look
747
+ * the link names, the tests in their order, the look rules, the look for the
748
+ * kind of payment, the default. Reads what is stored now and writes nothing;
749
+ * a test answers with its arms rather than drawing one.
750
+ *
751
+ * `POST /routing/checkout-theme/simulate`
752
+ *
753
+ * Pass `program` to try look rules before saving them: they stand in for the
754
+ * stored rules of their scope for this dry run only.
755
+ *
756
+ * @example
757
+ * ```typescript
758
+ * const outcome = await delopay.routing.checkoutTargeting.simulate({
759
+ * profile_id: 'pro_...',
760
+ * device: 'phone',
761
+ * country: 'DE',
762
+ * });
763
+ * console.log(outcome.source, outcome.look ?? 'default look');
764
+ * ```
765
+ */
766
+ simulate(params: TargetingSimulateRequest): Promise<TargetingSimulateResponse>;
767
+ /**
768
+ * Whether looks are chosen at render, whether renders are measured, whether
769
+ * buyer signals and browser identity are available, and the test limits.
770
+ *
771
+ * `GET /routing/checkout-theme/capabilities?profile_id={profileId}`
772
+ *
773
+ * @param profileId - The shop or template. A shop-scoped caller may omit it.
774
+ */
775
+ capabilities(profileId?: string): Promise<TargetingCapabilitiesResponse>;
776
+ }
544
777
 
545
778
  export { Routing };
@@ -1,4 +1,4 @@
1
- import { SurchargeRuleRequest, SurchargeRuleResponse, CheckoutThemeProgramRequest, CheckoutThemeProgramResponse, CheckoutThemeConversionQuery, CheckoutThemeConversionResponse, RoutingConfigCreateRequest, RoutingDictionaryRecord, MerchantRoutingAlgorithm, RoutingActivatePayload, RoutingDeactivateRequest, RoutingConfigUpdateRequest, RoutingConfigDeleteResponse, RoutingHistoryParams, RoutingConfigHistoryResponse, RoutingConnectorCaps, RoutingConnectorCapSchedule, RoutingConnectorCapScheduleShuffle, RoutingTimePlanDocument, RoutingVolumeCounters, RoutingConnectorCapResetRequest, RoutingConnectorCapReset, ConnectorCapOverrideList, ConnectorCapOverrides, ConnectorCapOverrideLevel, ConnectorCapOverrideRequest, ConnectorCapOverride, RoutingDictionary, ProfileDeniedConnectorsResponse, LinkedRoutingConfigRetrieveResponse, RoutableConnectorChoice, ProfileDefaultRoutingConfig, DefaultRoutingConfigUpdate, RoutingRuleKeys, ProgramConnectorSelection, RoutingProgramAnalysis } from '../types.js';
1
+ import { SurchargeRuleRequest, SurchargeRuleResponse, CheckoutThemeProgramRequest, CheckoutThemeProgramResponse, ThemeProgramDeactivateResponse, CheckoutThemeConversionQuery, CheckoutThemeConversionResponse, ExperimentScopeQuery, ExperimentListResponse, ExperimentCreateRequest, ExperimentChangeResponse, ExperimentResponse, ExperimentUpdateRequest, ExperimentReorderRequest, ExperimentPreviewRequest, ExperimentPreviewResponse, ExperimentTransitionRequest, ExperimentEndRequest, ExperimentRestartRequest, ExperimentEventsResponse, ExperimentResultsQuery, ExperimentResultsResponse, ExperimentResultsSummaryQuery, ExperimentResultsSummaryResponse, TargetingSimulateRequest, TargetingSimulateResponse, TargetingCapabilitiesResponse, RoutingConfigCreateRequest, RoutingDictionaryRecord, MerchantRoutingAlgorithm, RoutingActivatePayload, RoutingDeactivateRequest, RoutingConfigUpdateRequest, RoutingConfigDeleteResponse, RoutingHistoryParams, RoutingConfigHistoryResponse, RoutingConnectorCaps, RoutingConnectorCapSchedule, RoutingConnectorCapScheduleShuffle, RoutingTimePlanDocument, RoutingVolumeCounters, RoutingConnectorCapResetRequest, RoutingConnectorCapReset, ConnectorCapOverrideList, ConnectorCapOverrides, ConnectorCapOverrideLevel, ConnectorCapOverrideRequest, ConnectorCapOverride, RoutingDictionary, ProfileDeniedConnectorsResponse, LinkedRoutingConfigRetrieveResponse, RoutableConnectorChoice, ProfileDefaultRoutingConfig, DefaultRoutingConfigUpdate, RoutingRuleKeys, ProgramConnectorSelection, RoutingProgramAnalysis } from '../types.js';
2
2
  import { RequestFn, RequestExtras } from '../core.js';
3
3
  import '../currencies.js';
4
4
  import '../eventStream.js';
@@ -19,6 +19,10 @@ declare class Routing {
19
19
  readonly checkoutThemeRules: CheckoutThemeRules;
20
20
  /** Rendered-to-paid conversion per appearance variant and segment. */
21
21
  readonly checkoutThemeConversion: CheckoutThemeConversion;
22
+ /** Look tests: two or more looks shown to one audience at random, by shares, with results. */
23
+ readonly checkoutExperiments: CheckoutExperiments;
24
+ /** What a described buyer would see, and what this deployment can do for a scope. */
25
+ readonly checkoutTargeting: CheckoutTargeting;
22
26
  constructor(request: RequestFn);
23
27
  /**
24
28
  * Create a new routing algorithm.
@@ -431,6 +435,11 @@ declare class CheckoutThemeRules {
431
435
  * that is where a program drafted against a variant you have not built yet
432
436
  * belongs.
433
437
  *
438
+ * Send the `revision` the last read answered (`"0:0"` when it answered
439
+ * `null`): the save is then refused with `IR_16` when the scope's rules
440
+ * changed since, instead of overwriting someone else's edit. Without it the
441
+ * save replaces whatever is stored.
442
+ *
434
443
  * @example A phone in Germany gets the compact look; everyone else the house style.
435
444
  * ```typescript
436
445
  * await delopay.routing.checkoutThemeRules.upsert({
@@ -469,7 +478,9 @@ declare class CheckoutThemeRules {
469
478
  */
470
479
  upsert(params: CheckoutThemeProgramRequest): Promise<CheckoutThemeProgramResponse>;
471
480
  /**
472
- * Retrieve the active theme program for a scope, or `null` when none is set.
481
+ * Retrieve the theme program of a scope: the one in force, else the newest
482
+ * one (switched off or saved as a draft, `is_active: false`), or `null` when
483
+ * the scope never had one. Its `revision` goes back on the next save.
473
484
  *
474
485
  * `GET /routing/checkout-theme/rules?profile_id={profileId}`
475
486
  *
@@ -478,17 +489,22 @@ declare class CheckoutThemeRules {
478
489
  */
479
490
  retrieve(profileId?: string): Promise<CheckoutThemeProgramResponse | null>;
480
491
  /**
481
- * Deactivate the active theme program for a scope. Idempotent.
492
+ * Deactivate the active theme program for a scope. Idempotent without
493
+ * `revision`. The program stays readable, switched off. Answers the scope's
494
+ * new `revision`, to send with the next save or switch-off.
482
495
  *
483
- * `DELETE /routing/checkout-theme/rules?profile_id={profileId}`
496
+ * `DELETE /routing/checkout-theme/rules?profile_id={profileId}&revision={revision}`
484
497
  *
485
498
  * Deactivation, not deletion — the stored row is what says which look was
486
499
  * live when, and that history cannot be reconstructed after the fact. Shops
487
500
  * go back to their default appearance immediately.
488
501
  *
489
502
  * @param profileId - Shop scope. Omit for the merchant-wide program.
503
+ * @param revision - The `revision` the last read answered. Switching off is
504
+ * then refused with `IR_16` when the rules changed since. Omit it to switch
505
+ * off whatever is in force.
490
506
  */
491
- delete(profileId?: string): Promise<void>;
507
+ delete(profileId?: string, revision?: string): Promise<ThemeProgramDeactivateResponse>;
492
508
  }
493
509
  /**
494
510
  * Rendered-to-paid conversion, per appearance variant and segment.
@@ -541,5 +557,222 @@ declare class CheckoutThemeConversion {
541
557
  */
542
558
  retrieve(params: CheckoutThemeConversionQuery): Promise<CheckoutThemeConversionResponse>;
543
559
  }
560
+ /**
561
+ * Look tests: show the buyers of one audience one of two or more looks at
562
+ * random, by shares you set, and read which converts better.
563
+ *
564
+ * A test belongs to a shop, or to a checkout template and then runs in every
565
+ * shop on that template. Each buyer stays on the look first drawn for them:
566
+ * per browser by default, or per payment. A buyer whose link names a look
567
+ * (`?theme=`, a checkout entry's look) sees that look and is counted as drawn
568
+ * but not shown. Within a scope, the first running test whose audience takes
569
+ * a buyer decides; a shop's own tests come before its template's.
570
+ *
571
+ * Every change sends the `revision` the test was read at, and a test changed
572
+ * since is refused with `IR_16`, so a stale page never overwrites a newer
573
+ * edit. Each change answers with an {@link ExperimentChangeResponse}: the test
574
+ * as it now stands, whether a new version began, and the share of returning
575
+ * buyers whose look moved.
576
+ *
577
+ * Reads need checkout-branding read access; creating, editing, reordering and
578
+ * deleting a draft need edit access; starting, pausing, resuming, ending,
579
+ * restarting and archiving need write access.
580
+ */
581
+ declare class CheckoutExperiments {
582
+ private readonly request;
583
+ constructor(request: RequestFn);
584
+ /**
585
+ * The tests of a shop or template, in their order, with what an arm may name.
586
+ *
587
+ * `GET /routing/checkout-theme/experiments`
588
+ *
589
+ * For a shop on a template, the template's tests come back in `inherited`:
590
+ * they run in the shop after the shop's own, and are changed on the template.
591
+ */
592
+ list(params?: ExperimentScopeQuery): Promise<ExperimentListResponse>;
593
+ /**
594
+ * Create a test as a draft. Nothing is shown to buyers until it is started.
595
+ *
596
+ * `POST /routing/checkout-theme/experiments`
597
+ *
598
+ * A definition that cannot be stored (fewer than two arms, shares that do not
599
+ * add up to 10 000, an unknown control arm) is refused with a 400 naming why;
600
+ * a scope that holds the most tests it may is refused with `IR_16`.
601
+ *
602
+ * @example Half the phones in Germany see the compact look, half what they see today.
603
+ * ```typescript
604
+ * const { experiment } = await delopay.routing.checkoutExperiments.create({
605
+ * profile_id: 'pro_...',
606
+ * name: 'Compact on German phones',
607
+ * audience: { devices: ['phone'], countries: { countries: ['DE'] } },
608
+ * arms: [
609
+ * { key: 'current', look: null, share_bp: 5000 },
610
+ * { key: 'compact', look: 'compact', share_bp: 5000 },
611
+ * ],
612
+ * control_arm: 'current',
613
+ * });
614
+ * await delopay.routing.checkoutExperiments.start(experiment.id, {
615
+ * revision: experiment.revision,
616
+ * });
617
+ * ```
618
+ */
619
+ create(params: ExperimentCreateRequest): Promise<ExperimentChangeResponse>;
620
+ /**
621
+ * Retrieve one test.
622
+ *
623
+ * `GET /routing/checkout-theme/experiments/{experiment_id}`
624
+ */
625
+ retrieve(experimentId: string): Promise<ExperimentResponse>;
626
+ /**
627
+ * Change a test. Fields left out stay as they are.
628
+ *
629
+ * `PATCH /routing/checkout-theme/experiments/{experiment_id}`
630
+ *
631
+ * Once a test has started, a change to the audience, the arms, the control or
632
+ * the unit begins a new version and needs `new_version: true`; the results of
633
+ * each version stay apart. Use {@link CheckoutExperiments.preview} first to
634
+ * see what the change would do.
635
+ */
636
+ update(experimentId: string, params: ExperimentUpdateRequest): Promise<ExperimentChangeResponse>;
637
+ /**
638
+ * Delete a draft that never started. Anything else is refused with `IR_16`:
639
+ * archive it instead.
640
+ *
641
+ * `DELETE /routing/checkout-theme/experiments/{experiment_id}?revision={revision}`
642
+ *
643
+ * @param revision - The `revision` the test was read at.
644
+ */
645
+ delete(experimentId: string, revision: number): Promise<void>;
646
+ /**
647
+ * Set the order of a scope's tests: the first whose audience takes a buyer
648
+ * decides. Names every test of the scope that is not archived.
649
+ *
650
+ * `POST /routing/checkout-theme/experiments/reorder`
651
+ *
652
+ * Send the list's `order_token`: a reorder made on an order someone else
653
+ * changed since is then refused with `IR_16` instead of replacing theirs.
654
+ */
655
+ reorder(params: ExperimentReorderRequest): Promise<ExperimentListResponse>;
656
+ /**
657
+ * What a create or a change would do, without saving it: why it would be
658
+ * refused, the warnings the test would carry and, for a started test,
659
+ * whether it begins a new version and how many returning buyers it moves.
660
+ *
661
+ * `POST /routing/checkout-theme/experiments/preview`
662
+ */
663
+ preview(params: ExperimentPreviewRequest): Promise<ExperimentPreviewResponse>;
664
+ /**
665
+ * Start a draft. It draws buyers from its `starts_at`, or at once without one.
666
+ *
667
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/start`
668
+ */
669
+ start(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
670
+ /**
671
+ * Pause a started test: its audience sees what it would without the test.
672
+ *
673
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/pause`
674
+ */
675
+ pause(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
676
+ /**
677
+ * Resume a paused test. Returning buyers keep the look drawn for them.
678
+ *
679
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/resume`
680
+ */
681
+ resume(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
682
+ /**
683
+ * End a test. With `keep_arm`, its audience keeps seeing that arm's look;
684
+ * without it, what it would see without the test.
685
+ *
686
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/end`
687
+ */
688
+ end(experimentId: string, params: ExperimentEndRequest): Promise<ExperimentChangeResponse>;
689
+ /**
690
+ * Start an ended test again, as a new version, optionally changing what it
691
+ * compares in the same step.
692
+ *
693
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/restart`
694
+ */
695
+ restart(experimentId: string, params: ExperimentRestartRequest): Promise<ExperimentChangeResponse>;
696
+ /**
697
+ * Put a draft or an ended test away. Its results stay readable. A test that
698
+ * is scheduled, running or paused is refused with `IR_16`: end it first.
699
+ *
700
+ * `POST /routing/checkout-theme/experiments/{experiment_id}/archive`
701
+ */
702
+ archive(experimentId: string, params: ExperimentTransitionRequest): Promise<ExperimentChangeResponse>;
703
+ /**
704
+ * A test's history: who created, changed, started, paused, ended or moved it.
705
+ *
706
+ * `GET /routing/checkout-theme/experiments/{experiment_id}/events`
707
+ */
708
+ events(experimentId: string): Promise<ExperimentEventsResponse>;
709
+ /**
710
+ * A test's results for one version and one environment.
711
+ *
712
+ * `GET /routing/checkout-theme/experiments/{experiment_id}/results`
713
+ *
714
+ * Rates, intervals, verdicts and the sample-ratio check are computed
715
+ * server-side and shipped as values: show them as they are rather than
716
+ * recomputing them. A 404 means no such test or version, or a test that has
717
+ * not started.
718
+ *
719
+ * @example
720
+ * ```typescript
721
+ * const results = await delopay.routing.checkoutExperiments.results('cexp_...', {
722
+ * segment: 'device',
723
+ * });
724
+ * for (const c of results.comparisons) {
725
+ * if (c.verdict === 'better') console.log(`${c.arm} converts better than ${c.control_arm}`);
726
+ * }
727
+ * ```
728
+ */
729
+ results(experimentId: string, params?: ExperimentResultsQuery): Promise<ExperimentResultsResponse>;
730
+ /**
731
+ * Every started, not archived test of a shop or template, in brief: the
732
+ * version in force, its counts, and the arm clearly ahead, if any.
733
+ *
734
+ * `GET /routing/checkout-theme/experiments/results-summary`
735
+ */
736
+ resultsSummary(params?: ExperimentResultsSummaryQuery): Promise<ExperimentResultsSummaryResponse>;
737
+ }
738
+ /**
739
+ * Which look a buyer would see, and why, and what look targeting can do in
740
+ * this deployment.
741
+ */
742
+ declare class CheckoutTargeting {
743
+ private readonly request;
744
+ constructor(request: RequestFn);
745
+ /**
746
+ * What a described buyer would see in a shop or template, and why: the look
747
+ * the link names, the tests in their order, the look rules, the look for the
748
+ * kind of payment, the default. Reads what is stored now and writes nothing;
749
+ * a test answers with its arms rather than drawing one.
750
+ *
751
+ * `POST /routing/checkout-theme/simulate`
752
+ *
753
+ * Pass `program` to try look rules before saving them: they stand in for the
754
+ * stored rules of their scope for this dry run only.
755
+ *
756
+ * @example
757
+ * ```typescript
758
+ * const outcome = await delopay.routing.checkoutTargeting.simulate({
759
+ * profile_id: 'pro_...',
760
+ * device: 'phone',
761
+ * country: 'DE',
762
+ * });
763
+ * console.log(outcome.source, outcome.look ?? 'default look');
764
+ * ```
765
+ */
766
+ simulate(params: TargetingSimulateRequest): Promise<TargetingSimulateResponse>;
767
+ /**
768
+ * Whether looks are chosen at render, whether renders are measured, whether
769
+ * buyer signals and browser identity are available, and the test limits.
770
+ *
771
+ * `GET /routing/checkout-theme/capabilities?profile_id={profileId}`
772
+ *
773
+ * @param profileId - The shop or template. A shop-scoped caller may omit it.
774
+ */
775
+ capabilities(profileId?: string): Promise<TargetingCapabilitiesResponse>;
776
+ }
544
777
 
545
778
  export { Routing };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Routing
3
- } from "../chunk-HGTNJXXY.js";
3
+ } from "../chunk-ZER47MOF.js";
4
4
  export {
5
5
  Routing
6
6
  };