@wix/pricing-plans 1.0.8 → 1.0.10
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/cjs/src/pricing-plans-v2-order.public.d.ts +6 -6
- package/build/cjs/src/pricing-plans-v2-order.public.js +3 -3
- package/build/cjs/src/pricing-plans-v2-order.public.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-order.types.d.ts +3 -3
- package/build/cjs/src/pricing-plans-v2-order.universal.d.ts +21 -36
- package/build/cjs/src/pricing-plans-v2-order.universal.js +27 -13
- package/build/cjs/src/pricing-plans-v2-order.universal.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-plan.public.d.ts +8 -8
- package/build/cjs/src/pricing-plans-v2-plan.public.js +4 -4
- package/build/cjs/src/pricing-plans-v2-plan.public.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-plan.types.d.ts +3 -6
- package/build/cjs/src/pricing-plans-v2-plan.types.js.map +1 -1
- package/build/cjs/src/pricing-plans-v2-plan.universal.d.ts +158 -97
- package/build/cjs/src/pricing-plans-v2-plan.universal.js +73 -58
- package/build/cjs/src/pricing-plans-v2-plan.universal.js.map +1 -1
- package/build/es/src/pricing-plans-v2-order.public.d.ts +6 -6
- package/build/es/src/pricing-plans-v2-order.public.js +3 -3
- package/build/es/src/pricing-plans-v2-order.public.js.map +1 -1
- package/build/es/src/pricing-plans-v2-order.types.d.ts +3 -3
- package/build/es/src/pricing-plans-v2-order.universal.d.ts +21 -36
- package/build/es/src/pricing-plans-v2-order.universal.js +27 -13
- package/build/es/src/pricing-plans-v2-order.universal.js.map +1 -1
- package/build/es/src/pricing-plans-v2-plan.public.d.ts +8 -8
- package/build/es/src/pricing-plans-v2-plan.public.js +4 -4
- package/build/es/src/pricing-plans-v2-plan.public.js.map +1 -1
- package/build/es/src/pricing-plans-v2-plan.types.d.ts +3 -6
- package/build/es/src/pricing-plans-v2-plan.types.js.map +1 -1
- package/build/es/src/pricing-plans-v2-plan.universal.d.ts +158 -97
- package/build/es/src/pricing-plans-v2-plan.universal.js +74 -59
- package/build/es/src/pricing-plans-v2-plan.universal.js.map +1 -1
- package/package.json +4 -4
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pricing-plans-v2-plan.public.js","sourceRoot":"","sources":["../../../src/pricing-plans-v2-plan.public.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,IAAI,wBAAwB,EAC3C,gBAAgB,IAAI,yBAAyB,EAC7C,OAAO,IAAI,gBAAgB,EAC3B,SAAS,IAAI,kBAAkB,EAC/B,YAAY,IAAI,qBAAqB,EACrC,UAAU,IAAI,mBAAmB,EACjC,UAAU,IAAI,mBAAmB,EACjC,iBAAiB,IAAI,0BAA0B,EAC/C,eAAe,IAAI,wBAAwB,EAC3C,YAAY,IAAI,qBAAqB,EACrC,WAAW,IAAI,oBAAoB,EACnC,YAAY,IAAI,qBAAqB,
|
1
|
+
{"version":3,"file":"pricing-plans-v2-plan.public.js","sourceRoot":"","sources":["../../../src/pricing-plans-v2-plan.public.ts"],"names":[],"mappings":"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"}
|
@@ -57,9 +57,6 @@ export interface Plan {
|
|
57
57
|
buyerCanCancel?: boolean | null;
|
58
58
|
/** Any terms and conditions that apply to the plan. This information will be displayed during checkout. */
|
59
59
|
termsAndConditions?: string | null;
|
60
|
-
clientData?: Record<string, string>;
|
61
|
-
/** Reference to a form which is shown in checkout to gather additional data */
|
62
|
-
formId?: string | null;
|
63
60
|
}
|
64
61
|
/** This wrapper type exist in order to distinguish an empty string list from no list at all in update requests. */
|
65
62
|
export interface StringList {
|
@@ -278,7 +275,7 @@ export interface CreatePlanResponse {
|
|
278
275
|
plan?: Plan;
|
279
276
|
}
|
280
277
|
export interface UpdatePlanRequest {
|
281
|
-
plan
|
278
|
+
plan: Plan;
|
282
279
|
fieldMask?: string[];
|
283
280
|
}
|
284
281
|
export interface UpdatePlanResponse {
|
@@ -286,7 +283,7 @@ export interface UpdatePlanResponse {
|
|
286
283
|
}
|
287
284
|
export interface SetPlanVisibilityRequest {
|
288
285
|
id: string;
|
289
|
-
visible
|
286
|
+
visible: boolean;
|
290
287
|
}
|
291
288
|
export interface SetPlanVisibilityResponse {
|
292
289
|
plan?: Plan;
|
@@ -351,7 +348,7 @@ export interface BulkActionMetadata {
|
|
351
348
|
undetailedFailures?: number;
|
352
349
|
}
|
353
350
|
export interface ArrangePlansRequest {
|
354
|
-
ids
|
351
|
+
ids: string[];
|
355
352
|
}
|
356
353
|
export interface ArrangePlansResponse {
|
357
354
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pricing-plans-v2-plan.types.js","sourceRoot":"","sources":["../../../src/pricing-plans-v2-plan.types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"pricing-plans-v2-plan.types.js","sourceRoot":"","sources":["../../../src/pricing-plans-v2-plan.types.ts"],"names":[],"mappings":"AAmHA,MAAM,CAAN,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,qCAAuB,CAAA;IACvB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,6BAAe,CAAA;IACf,2BAAa,CAAA;AACf,CAAC,EANW,UAAU,KAAV,UAAU,QAMrB;AAsGD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,0BAAa,CAAA;AACf,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAuCD,MAAM,CAAN,IAAY,cAOX;AAPD,WAAY,cAAc;IACxB,yCAAyC;IACzC,mCAAiB,CAAA;IACjB,2CAA2C;IAC3C,uCAAqB,CAAA;IACrB,sDAAsD;IACtD,6DAA2C,CAAA;AAC7C,CAAC,EAPW,cAAc,KAAd,cAAc,QAOzB;AAED,MAAM,CAAN,IAAY,YAOX;AAPD,WAAY,YAAY;IACtB,2CAA2C;IAC3C,uDAAuC,CAAA;IACvC,iCAAiC;IACjC,iCAAiB,CAAA;IACjB,iCAAiC;IACjC,iCAAiB,CAAA;AACnB,CAAC,EAPW,YAAY,KAAZ,YAAY,QAOvB"}
|
@@ -79,9 +79,6 @@ export interface Plan {
|
|
79
79
|
buyerCanCancel?: boolean | null;
|
80
80
|
/** Any terms and conditions that apply to the plan. This information will be displayed during checkout. */
|
81
81
|
termsAndConditions?: string | null;
|
82
|
-
clientData?: Record<string, string>;
|
83
|
-
/** Reference to a form which is shown in checkout to gather additional data */
|
84
|
-
formId?: string | null;
|
85
82
|
}
|
86
83
|
/** This wrapper type exist in order to distinguish an empty string list from no list at all in update requests. */
|
87
84
|
export interface StringList {
|
@@ -340,7 +337,7 @@ export interface CreatePlanResponse {
|
|
340
337
|
}
|
341
338
|
export interface UpdatePlanRequest {
|
342
339
|
/** Plan info to update. */
|
343
|
-
plan
|
340
|
+
plan: Plan;
|
344
341
|
fieldMask?: string[];
|
345
342
|
}
|
346
343
|
export interface UpdatePlanResponse {
|
@@ -351,7 +348,7 @@ export interface SetPlanVisibilityRequest {
|
|
351
348
|
/** The ID of the plan to either display or hide on the site page. */
|
352
349
|
_id: string;
|
353
350
|
/** Whether to set the plan as visible. */
|
354
|
-
visible
|
351
|
+
visible: boolean;
|
355
352
|
}
|
356
353
|
export interface SetPlanVisibilityResponse {
|
357
354
|
/** Plan info. */
|
@@ -421,7 +418,7 @@ export interface BulkActionMetadata {
|
|
421
418
|
}
|
422
419
|
export interface ArrangePlansRequest {
|
423
420
|
/** IDs of all non-archived plans in the order you want them arranged. */
|
424
|
-
ids
|
421
|
+
ids: string[];
|
425
422
|
}
|
426
423
|
export interface ArrangePlansResponse {
|
427
424
|
}
|
@@ -473,11 +470,76 @@ export interface ListPublicPlansOptions {
|
|
473
470
|
* The following `PublicPlansQueryBuilder` functions are supported for the `queryPublicPlans()` function. For a full description of the Plans object, see the object returned for the [`items`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/plans/publicplansqueryresult/items) property in [`PublicPlansQueryResult`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/plans/publicplansqueryresult).
|
474
471
|
* @public
|
475
472
|
* @documentationMaturity preview
|
476
|
-
* @returns Fulfilled - The query definition used to run the query using the [`find()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/plans/publicplansquerybuilder/find) function.
|
477
473
|
*/
|
478
|
-
export declare function queryPublicPlans(
|
479
|
-
|
480
|
-
|
474
|
+
export declare function queryPublicPlans(): PlansQueryBuilder;
|
475
|
+
interface QueryOffsetResult {
|
476
|
+
currentPage: number;
|
477
|
+
totalPages: number;
|
478
|
+
totalCount: number;
|
479
|
+
hasNext: () => boolean;
|
480
|
+
hasPrev: () => boolean;
|
481
|
+
length: number;
|
482
|
+
pageSize: number;
|
483
|
+
}
|
484
|
+
export interface PlansQueryResult extends QueryOffsetResult {
|
485
|
+
items: PublicPlan[];
|
486
|
+
query: PlansQueryBuilder;
|
487
|
+
next: () => Promise<PlansQueryResult>;
|
488
|
+
prev: () => Promise<PlansQueryResult>;
|
489
|
+
}
|
490
|
+
export interface PlansQueryBuilder {
|
491
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
492
|
+
* @param value - Value to compare against.
|
493
|
+
* @documentationMaturity preview
|
494
|
+
*/
|
495
|
+
eq: (propertyName: '_id' | 'primary' | '_createdDate' | '_updatedDate' | 'slug', value: any) => PlansQueryBuilder;
|
496
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
497
|
+
* @param value - Value to compare against.
|
498
|
+
* @documentationMaturity preview
|
499
|
+
*/
|
500
|
+
ne: (propertyName: '_id' | 'primary' | '_createdDate' | '_updatedDate' | 'slug', value: any) => PlansQueryBuilder;
|
501
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
502
|
+
* @param value - Value to compare against.
|
503
|
+
* @documentationMaturity preview
|
504
|
+
*/
|
505
|
+
gt: (propertyName: '_createdDate' | '_updatedDate', value: any) => PlansQueryBuilder;
|
506
|
+
/** @param propertyName - Property whose value is compared with `value`.
|
507
|
+
* @param value - Value to compare against.
|
508
|
+
* @documentationMaturity preview
|
509
|
+
*/
|
510
|
+
lt: (propertyName: '_createdDate' | '_updatedDate', value: any) => PlansQueryBuilder;
|
511
|
+
/** @param propertyName - Property whose value is compared with `string`.
|
512
|
+
* @param string - String to compare against. Case-insensitive.
|
513
|
+
* @documentationMaturity preview
|
514
|
+
*/
|
515
|
+
startsWith: (propertyName: '_id' | 'slug', value: string) => PlansQueryBuilder;
|
516
|
+
/** @param propertyName - Property whose value is compared with `values`.
|
517
|
+
* @param values - List of values to compare against.
|
518
|
+
* @documentationMaturity preview
|
519
|
+
*/
|
520
|
+
hasSome: (propertyName: '_id' | 'primary' | '_createdDate' | '_updatedDate' | 'slug', value: any[]) => PlansQueryBuilder;
|
521
|
+
/** @documentationMaturity preview */
|
522
|
+
in: (propertyName: '_id' | 'primary' | '_createdDate' | '_updatedDate' | 'slug', value: any) => PlansQueryBuilder;
|
523
|
+
/** @documentationMaturity preview */
|
524
|
+
exists: (propertyName: '_id' | 'primary' | '_createdDate' | '_updatedDate' | 'slug', value: boolean) => PlansQueryBuilder;
|
525
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
|
526
|
+
* @documentationMaturity preview
|
527
|
+
*/
|
528
|
+
ascending: (...propertyNames: Array<'_id' | 'primary' | '_createdDate' | '_updatedDate' | 'slug'>) => PlansQueryBuilder;
|
529
|
+
/** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
|
530
|
+
* @documentationMaturity preview
|
531
|
+
*/
|
532
|
+
descending: (...propertyNames: Array<'_id' | 'primary' | '_createdDate' | '_updatedDate' | 'slug'>) => PlansQueryBuilder;
|
533
|
+
/** @param limit - Number of items to return, which is also the `pageSize` of the results object.
|
534
|
+
* @documentationMaturity preview
|
535
|
+
*/
|
536
|
+
limit: (limit: number) => PlansQueryBuilder;
|
537
|
+
/** @param skip - Number of items to skip in the query results before returning the results.
|
538
|
+
* @documentationMaturity preview
|
539
|
+
*/
|
540
|
+
skip: (skip: number) => PlansQueryBuilder;
|
541
|
+
/** @documentationMaturity preview */
|
542
|
+
find: () => Promise<PlansQueryResult>;
|
481
543
|
}
|
482
544
|
/**
|
483
545
|
* Retrieves a pricing plan by the specified ID.
|
@@ -491,7 +553,7 @@ export interface QueryPublicPlansOptions {
|
|
491
553
|
* @requiredField _id
|
492
554
|
* @returns Fulfilled - The retrieved plan's information.
|
493
555
|
*/
|
494
|
-
export declare function getPlan(_id: string): Promise<
|
556
|
+
export declare function getPlan(_id: string): Promise<Plan>;
|
495
557
|
/**
|
496
558
|
* Retrieves a list of pricing plans.
|
497
559
|
*
|
@@ -579,7 +641,7 @@ export declare function getPlanStats(): Promise<GetPlanStatsResponse>;
|
|
579
641
|
*
|
580
642
|
* Rejected - Error message.
|
581
643
|
*/
|
582
|
-
export declare function createPlan(plan: Plan): Promise<
|
644
|
+
export declare function createPlan(plan: Plan): Promise<Plan>;
|
583
645
|
/**
|
584
646
|
* Updates a pricing plan.
|
585
647
|
*
|
@@ -592,88 +654,90 @@ export declare function createPlan(plan: Plan): Promise<CreatePlanResponse>;
|
|
592
654
|
* @public
|
593
655
|
* @documentationMaturity preview
|
594
656
|
* @requiredField _id
|
657
|
+
* @requiredField plan
|
595
658
|
* @param _id - ID of the plan to update.
|
596
659
|
* @param options - Options for updating the plan.
|
597
660
|
* @returns Fulfilled - The updated plan.
|
598
661
|
*
|
599
662
|
* Rejected - Error message.
|
600
663
|
*/
|
601
|
-
export declare function updatePlan(_id: string, options?: UpdatePlanOptions): Promise<
|
664
|
+
export declare function updatePlan(_id: string, plan: UpdatePlan, options?: UpdatePlanOptions): Promise<Plan>;
|
665
|
+
export interface UpdatePlan {
|
666
|
+
/**
|
667
|
+
* Plan ID.
|
668
|
+
* @readonly
|
669
|
+
*/
|
670
|
+
_id?: string;
|
671
|
+
/** Plan name. */
|
672
|
+
name?: string | null;
|
673
|
+
/** Plan description. */
|
674
|
+
description?: string | null;
|
675
|
+
/**
|
676
|
+
* List of text strings that promote what is included with this plan.
|
677
|
+
*
|
678
|
+
* For example, "Plenty of parking" or "Free gift on your birthday".
|
679
|
+
*/
|
680
|
+
perks?: StringList;
|
681
|
+
/** Plan price, payment schedule, and expiration. */
|
682
|
+
pricing?: Pricing;
|
683
|
+
/** Whether the plan is public (visible to site visitors and members). */
|
684
|
+
public?: boolean | null;
|
685
|
+
/**
|
686
|
+
* Whether the plan is archived. Archived plans are not visible and can't be purchased anymore, but existing purchases remain in effect.
|
687
|
+
* @readonly
|
688
|
+
*/
|
689
|
+
archived?: boolean;
|
690
|
+
/**
|
691
|
+
* Whether the plan is marked as primary. If `true`, the plan is highlighted on the site with a custom ribbon.
|
692
|
+
*
|
693
|
+
* Default: `false`.
|
694
|
+
* @readonly
|
695
|
+
*/
|
696
|
+
primary?: boolean;
|
697
|
+
/**
|
698
|
+
* Whether the plan has any orders (including pending and unpaid orders).
|
699
|
+
* @readonly
|
700
|
+
*/
|
701
|
+
hasOrders?: boolean;
|
702
|
+
/**
|
703
|
+
* Date plan was created.
|
704
|
+
* @readonly
|
705
|
+
*/
|
706
|
+
_createdDate?: Date;
|
707
|
+
/**
|
708
|
+
* Date plan was last updated.
|
709
|
+
* @readonly
|
710
|
+
*/
|
711
|
+
_updatedDate?: Date;
|
712
|
+
/**
|
713
|
+
* URL-friendly version of plan name. Unique across all plans in the same site.
|
714
|
+
* @readonly
|
715
|
+
*/
|
716
|
+
slug?: string | null;
|
717
|
+
/**
|
718
|
+
* Number of times the same buyer can purchase the plan. Currently limited to support:
|
719
|
+
* - Empty value or a value of `0`, meaning no limitation.
|
720
|
+
* - Value of `1`, meaning limited to one purchase per buyer.
|
721
|
+
*/
|
722
|
+
maxPurchasesPerBuyer?: number | null;
|
723
|
+
/**
|
724
|
+
* Whether the buyer can start the plan at a later date.
|
725
|
+
*
|
726
|
+
* Default: `false`.
|
727
|
+
*
|
728
|
+
*/
|
729
|
+
allowFutureStartDate?: boolean | null;
|
730
|
+
/**
|
731
|
+
* Whether the buyer is allowed to cancel their plan. If `false`, calling the `cancelOrder()` function returns an error.
|
732
|
+
*
|
733
|
+
* Default: `false`.
|
734
|
+
*
|
735
|
+
*/
|
736
|
+
buyerCanCancel?: boolean | null;
|
737
|
+
/** Any terms and conditions that apply to the plan. This information will be displayed during checkout. */
|
738
|
+
termsAndConditions?: string | null;
|
739
|
+
}
|
602
740
|
export interface UpdatePlanOptions {
|
603
|
-
/** Plan info to update. */
|
604
|
-
plan: {
|
605
|
-
/**
|
606
|
-
* ID of the plan to update.
|
607
|
-
* @readonly
|
608
|
-
*/
|
609
|
-
_id?: string;
|
610
|
-
/** Plan name. */
|
611
|
-
name?: string | null;
|
612
|
-
/** Plan description. */
|
613
|
-
description?: string | null;
|
614
|
-
/** List of text strings that promote the pricing plan. For example, "Plenty of parking" or "Free gift on your birthday". */
|
615
|
-
perks?: StringList;
|
616
|
-
/** Plan price, payment schedule, and expiration. */
|
617
|
-
pricing?: Pricing;
|
618
|
-
/** Whether the plan is public (visible to site visitors and members). */
|
619
|
-
public?: boolean | null;
|
620
|
-
/**
|
621
|
-
* Whether the plan is archived. Archived plans are not visible and can't be purchased anymore, but existing purchases remain in effect.
|
622
|
-
* @readonly
|
623
|
-
*/
|
624
|
-
archived?: boolean;
|
625
|
-
/**
|
626
|
-
* Whether the plan is marked as primary. If `true`, the plan is highlighted on the site with a custom ribbon.
|
627
|
-
*
|
628
|
-
* Default: `false`.
|
629
|
-
* @readonly
|
630
|
-
*/
|
631
|
-
primary?: boolean;
|
632
|
-
/**
|
633
|
-
* Whether the plan has any orders (including pending and unpaid orders).
|
634
|
-
* @readonly
|
635
|
-
*/
|
636
|
-
hasOrders?: boolean;
|
637
|
-
/**
|
638
|
-
* Date plan was created.
|
639
|
-
* @readonly
|
640
|
-
*/
|
641
|
-
_createdDate?: Date;
|
642
|
-
/**
|
643
|
-
* Date plan was last updated.
|
644
|
-
* @readonly
|
645
|
-
*/
|
646
|
-
_updatedDate?: Date;
|
647
|
-
/**
|
648
|
-
* URL-friendly version of plan name. Unique across all plans in the same site.
|
649
|
-
* @readonly
|
650
|
-
*/
|
651
|
-
slug?: string | null;
|
652
|
-
/**
|
653
|
-
* Number of times the same buyer can purchase the plan. Currently limited to support:
|
654
|
-
* - Empty value or a value of `0`, meaning no limitation.
|
655
|
-
* - Value of `1`, meaning limited to one purchase per buyer.
|
656
|
-
*/
|
657
|
-
maxPurchasesPerBuyer?: number | null;
|
658
|
-
/**
|
659
|
-
* Whether the buyer can start the plan at a later date.
|
660
|
-
*
|
661
|
-
* Default: `false`.
|
662
|
-
*/
|
663
|
-
allowFutureStartDate?: boolean | null;
|
664
|
-
/**
|
665
|
-
* Whether the buyer is allowed to cancel their plan.
|
666
|
-
*
|
667
|
-
* Default: `false`.
|
668
|
-
*
|
669
|
-
*/
|
670
|
-
buyerCanCancel?: boolean | null;
|
671
|
-
/** Any terms and conditions that apply to the plan. This information will be displayed during checkout. */
|
672
|
-
termsAndConditions?: string | null;
|
673
|
-
clientData?: Record<string, string>;
|
674
|
-
/** Reference to a form which is shown in checkout to gather additional data */
|
675
|
-
formId?: string | null;
|
676
|
-
};
|
677
741
|
fieldMask?: string[];
|
678
742
|
}
|
679
743
|
/**
|
@@ -690,20 +754,18 @@ export interface UpdatePlanOptions {
|
|
690
754
|
* Changing a plan's visibility does not impact existing orders for the plan. All orders for hidden plans are still active and keep their terms and payment options.
|
691
755
|
*
|
692
756
|
* Only users with "Manage Pricing Plans" [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can change a plans visibility.
|
757
|
+
* @param visible - Whether to set the plan as visible.
|
693
758
|
* @public
|
694
759
|
* @documentationMaturity preview
|
695
760
|
* @requiredField _id
|
761
|
+
* @requiredField visible
|
696
762
|
* @param _id - The ID of the plan to either display or hide on the site page.
|
697
763
|
* @param options - Plan visibility options.
|
698
764
|
* @returns Fulfilled - The plan's information.
|
699
765
|
*
|
700
766
|
* Rejected - Error message.
|
701
767
|
*/
|
702
|
-
export declare function setPlanVisibility(_id: string,
|
703
|
-
export interface SetPlanVisibilityOptions {
|
704
|
-
/** Whether to set the plan as visible. */
|
705
|
-
visible?: boolean;
|
706
|
-
}
|
768
|
+
export declare function setPlanVisibility(_id: string, visible: boolean): Promise<SetPlanVisibilityResponse>;
|
707
769
|
/**
|
708
770
|
* Marks a pricing plan as the primary pricing plan.
|
709
771
|
*
|
@@ -772,11 +834,10 @@ export declare function archivePlan(_id: string): Promise<ArchivePlanResponse>;
|
|
772
834
|
* Only users with "Managing Pricing Plans" [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can arrange plans.
|
773
835
|
*
|
774
836
|
* >**Note:** Make sure to provide *all* non-archived plan IDs to avoid unpredictable results.
|
837
|
+
* @param ids - IDs of all non-archived plans in the order you want them arranged.
|
775
838
|
* @public
|
776
839
|
* @documentationMaturity preview
|
840
|
+
* @requiredField ids
|
777
841
|
*/
|
778
|
-
export declare function arrangePlans(
|
779
|
-
export
|
780
|
-
/** IDs of all non-archived plans in the order you want them arranged. */
|
781
|
-
ids?: string[];
|
782
|
-
}
|
842
|
+
export declare function arrangePlans(ids: string[]): Promise<void>;
|
843
|
+
export {};
|
@@ -7,8 +7,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
8
|
});
|
9
9
|
};
|
10
|
-
import { serializer, transformError } from '@wix/metro-runtime/velo';
|
10
|
+
import { serializer, transformError, resolveQueryFieldsTransformationPaths, } from '@wix/metro-runtime/velo';
|
11
11
|
import * as ambassadorWixPricingPlansV2Plan from './pricing-plans-v2-plan.http';
|
12
|
+
// @ts-ignore
|
13
|
+
import { wrapWithQueryBuilder } from '@wix/motion-edm-autogen-query-wrapper';
|
12
14
|
let __verbose = false;
|
13
15
|
function __log(...args) {
|
14
16
|
__verbose && console.log(...args);
|
@@ -157,50 +159,57 @@ export function listPublicPlans(options) {
|
|
157
159
|
* The following `PublicPlansQueryBuilder` functions are supported for the `queryPublicPlans()` function. For a full description of the Plans object, see the object returned for the [`items`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/plans/publicplansqueryresult/items) property in [`PublicPlansQueryResult`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/plans/publicplansqueryresult).
|
158
160
|
* @public
|
159
161
|
* @documentationMaturity preview
|
160
|
-
* @returns Fulfilled - The query definition used to run the query using the [`find()`](https://www.wix.com/velo/reference/wix-pricing-plans-v2/plans/publicplansquerybuilder/find) function.
|
161
162
|
*/
|
162
|
-
export function queryPublicPlans(
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
const { fromJSON } = serializer({
|
179
|
-
rootSchema: _queryPublicPlansResponse,
|
180
|
-
depSchemas: {},
|
181
|
-
fqdnTransformation: {
|
182
|
-
paths: [],
|
183
|
-
transformation: _toVeloEntity,
|
184
|
-
},
|
185
|
-
customTransformation: responseTransformation,
|
186
|
-
});
|
187
|
-
const payload = toAmbassadorRequest([options]);
|
188
|
-
const reqOpts = ambassadorWixPricingPlansV2Plan.queryPublicPlans(payload);
|
189
|
-
__log(`"QueryPublicPlans" sending request with: ${__inspect(reqOpts)}`);
|
190
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
191
|
-
try {
|
192
|
-
const result = yield httpClient.request(reqOpts);
|
193
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
194
|
-
return fromJSON(result.data);
|
195
|
-
}
|
196
|
-
catch (err) {
|
197
|
-
const transformedError = transformError(err, requestTransformation, [
|
198
|
-
'options',
|
199
|
-
]);
|
200
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
201
|
-
throw transformedError;
|
202
|
-
}
|
163
|
+
export function queryPublicPlans() {
|
164
|
+
const requestTransformation = { '*': '$[1]', query: '$[0]' };
|
165
|
+
const responseTransformation = {
|
166
|
+
items: '$.plans',
|
167
|
+
pagingMetadata: '$.pagingMetadata',
|
168
|
+
};
|
169
|
+
// @ts-ignore
|
170
|
+
const { httpClient, sideEffects } = arguments[0];
|
171
|
+
const { toAmbassadorRequest } = serializer({
|
172
|
+
rootSchema: _queryPublicPlansRequest,
|
173
|
+
depSchemas: {},
|
174
|
+
fqdnTransformation: {
|
175
|
+
paths: [],
|
176
|
+
transformation: _fromVeloEntity,
|
177
|
+
},
|
178
|
+
customTransformation: requestTransformation,
|
203
179
|
});
|
180
|
+
const { fromJSON } = serializer({
|
181
|
+
rootSchema: _queryPublicPlansResponse,
|
182
|
+
depSchemas: {},
|
183
|
+
fqdnTransformation: {
|
184
|
+
paths: [],
|
185
|
+
transformation: _toVeloEntity,
|
186
|
+
},
|
187
|
+
customTransformation: responseTransformation,
|
188
|
+
});
|
189
|
+
return wrapWithQueryBuilder({
|
190
|
+
func: (payload) => __awaiter(this, void 0, void 0, function* () {
|
191
|
+
var _a, _b, _c;
|
192
|
+
const reqOpts = ambassadorWixPricingPlansV2Plan.queryPublicPlans(payload);
|
193
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
194
|
+
try {
|
195
|
+
const result = yield httpClient.request(reqOpts);
|
196
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
197
|
+
return result;
|
198
|
+
}
|
199
|
+
catch (err) {
|
200
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
201
|
+
throw err;
|
202
|
+
}
|
203
|
+
}),
|
204
|
+
requestTransformer: (...args) => toAmbassadorRequest(args),
|
205
|
+
responseTransformer: ({ data }) => fromJSON(data),
|
206
|
+
errorTransformer: (err) => {
|
207
|
+
const transformedError = transformError(err, requestTransformation);
|
208
|
+
throw transformedError;
|
209
|
+
},
|
210
|
+
pagingMethod: 'OFFSET',
|
211
|
+
transformationPaths: resolveQueryFieldsTransformationPaths(_toVeloEntity),
|
212
|
+
})({ cursorWithEmptyFilterAndSort: true });
|
204
213
|
}
|
205
214
|
/**
|
206
215
|
* Retrieves a pricing plan by the specified ID.
|
@@ -218,7 +227,7 @@ export function getPlan(_id) {
|
|
218
227
|
var _a, _b, _c;
|
219
228
|
return __awaiter(this, arguments, void 0, function* () {
|
220
229
|
const requestTransformation = { id: '$[0]' };
|
221
|
-
const responseTransformation = '
|
230
|
+
const responseTransformation = '$.plan';
|
222
231
|
// @ts-ignore
|
223
232
|
const { httpClient, sideEffects } = arguments[1];
|
224
233
|
const { toAmbassadorRequest } = serializer({
|
@@ -403,7 +412,7 @@ export function createPlan(plan) {
|
|
403
412
|
var _a, _b, _c;
|
404
413
|
return __awaiter(this, arguments, void 0, function* () {
|
405
414
|
const requestTransformation = { plan: '$[0]' };
|
406
|
-
const responseTransformation = '
|
415
|
+
const responseTransformation = '$.plan';
|
407
416
|
// @ts-ignore
|
408
417
|
const { httpClient, sideEffects } = arguments[1];
|
409
418
|
const { toAmbassadorRequest } = serializer({
|
@@ -454,22 +463,23 @@ export function createPlan(plan) {
|
|
454
463
|
* @public
|
455
464
|
* @documentationMaturity preview
|
456
465
|
* @requiredField _id
|
466
|
+
* @requiredField plan
|
457
467
|
* @param _id - ID of the plan to update.
|
458
468
|
* @param options - Options for updating the plan.
|
459
469
|
* @returns Fulfilled - The updated plan.
|
460
470
|
*
|
461
471
|
* Rejected - Error message.
|
462
472
|
*/
|
463
|
-
export function updatePlan(_id, options) {
|
473
|
+
export function updatePlan(_id, plan, options) {
|
464
474
|
var _a, _b, _c;
|
465
475
|
return __awaiter(this, arguments, void 0, function* () {
|
466
476
|
const requestTransformation = {
|
467
|
-
plan: { '*': '$[1]
|
468
|
-
fieldMask: '$[
|
477
|
+
plan: { '*': '$[1]', id: '$[0]' },
|
478
|
+
fieldMask: '$[2].fieldMask',
|
469
479
|
};
|
470
|
-
const responseTransformation = '
|
480
|
+
const responseTransformation = '$.plan';
|
471
481
|
// @ts-ignore
|
472
|
-
const { httpClient, sideEffects } = arguments[
|
482
|
+
const { httpClient, sideEffects } = arguments[3];
|
473
483
|
const { toAmbassadorRequest } = serializer({
|
474
484
|
rootSchema: _updatePlanRequest,
|
475
485
|
depSchemas: {},
|
@@ -488,7 +498,7 @@ export function updatePlan(_id, options) {
|
|
488
498
|
},
|
489
499
|
customTransformation: responseTransformation,
|
490
500
|
});
|
491
|
-
const payload = toAmbassadorRequest([_id, options]);
|
501
|
+
const payload = toAmbassadorRequest([_id, plan, options]);
|
492
502
|
const reqOpts = ambassadorWixPricingPlansV2Plan.updatePlan(payload);
|
493
503
|
__log(`"UpdatePlan" sending request with: ${__inspect(reqOpts)}`);
|
494
504
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
@@ -500,6 +510,7 @@ export function updatePlan(_id, options) {
|
|
500
510
|
catch (err) {
|
501
511
|
const transformedError = transformError(err, requestTransformation, [
|
502
512
|
'_id',
|
513
|
+
'plan',
|
503
514
|
'options',
|
504
515
|
]);
|
505
516
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
@@ -521,19 +532,21 @@ export function updatePlan(_id, options) {
|
|
521
532
|
* Changing a plan's visibility does not impact existing orders for the plan. All orders for hidden plans are still active and keep their terms and payment options.
|
522
533
|
*
|
523
534
|
* Only users with "Manage Pricing Plans" [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can change a plans visibility.
|
535
|
+
* @param visible - Whether to set the plan as visible.
|
524
536
|
* @public
|
525
537
|
* @documentationMaturity preview
|
526
538
|
* @requiredField _id
|
539
|
+
* @requiredField visible
|
527
540
|
* @param _id - The ID of the plan to either display or hide on the site page.
|
528
541
|
* @param options - Plan visibility options.
|
529
542
|
* @returns Fulfilled - The plan's information.
|
530
543
|
*
|
531
544
|
* Rejected - Error message.
|
532
545
|
*/
|
533
|
-
export function setPlanVisibility(_id,
|
546
|
+
export function setPlanVisibility(_id, visible) {
|
534
547
|
var _a, _b, _c;
|
535
548
|
return __awaiter(this, arguments, void 0, function* () {
|
536
|
-
const requestTransformation = { id: '$[0]', visible: '$[1]
|
549
|
+
const requestTransformation = { id: '$[0]', visible: '$[1]' };
|
537
550
|
const responseTransformation = '$';
|
538
551
|
// @ts-ignore
|
539
552
|
const { httpClient, sideEffects } = arguments[2];
|
@@ -555,7 +568,7 @@ export function setPlanVisibility(_id, options) {
|
|
555
568
|
},
|
556
569
|
customTransformation: responseTransformation,
|
557
570
|
});
|
558
|
-
const payload = toAmbassadorRequest([_id,
|
571
|
+
const payload = toAmbassadorRequest([_id, visible]);
|
559
572
|
const reqOpts = ambassadorWixPricingPlansV2Plan.setPlanVisibility(payload);
|
560
573
|
__log(`"SetPlanVisibility" sending request with: ${__inspect(reqOpts)}`);
|
561
574
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
@@ -567,7 +580,7 @@ export function setPlanVisibility(_id, options) {
|
|
567
580
|
catch (err) {
|
568
581
|
const transformedError = transformError(err, requestTransformation, [
|
569
582
|
'_id',
|
570
|
-
'
|
583
|
+
'visible',
|
571
584
|
]);
|
572
585
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
573
586
|
throw transformedError;
|
@@ -766,13 +779,15 @@ export function archivePlan(_id) {
|
|
766
779
|
* Only users with "Managing Pricing Plans" [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can arrange plans.
|
767
780
|
*
|
768
781
|
* >**Note:** Make sure to provide *all* non-archived plan IDs to avoid unpredictable results.
|
782
|
+
* @param ids - IDs of all non-archived plans in the order you want them arranged.
|
769
783
|
* @public
|
770
784
|
* @documentationMaturity preview
|
785
|
+
* @requiredField ids
|
771
786
|
*/
|
772
|
-
export function arrangePlans(
|
787
|
+
export function arrangePlans(ids) {
|
773
788
|
var _a, _b, _c;
|
774
789
|
return __awaiter(this, arguments, void 0, function* () {
|
775
|
-
const requestTransformation = { ids: '$[0]
|
790
|
+
const requestTransformation = { ids: '$[0]' };
|
776
791
|
const responseTransformation = '$';
|
777
792
|
// @ts-ignore
|
778
793
|
const { httpClient, sideEffects } = arguments[1];
|
@@ -794,7 +809,7 @@ export function arrangePlans(options) {
|
|
794
809
|
},
|
795
810
|
customTransformation: responseTransformation,
|
796
811
|
});
|
797
|
-
const payload = toAmbassadorRequest([
|
812
|
+
const payload = toAmbassadorRequest([ids]);
|
798
813
|
const reqOpts = ambassadorWixPricingPlansV2Plan.arrangePlans(payload);
|
799
814
|
__log(`"ArrangePlans" sending request with: ${__inspect(reqOpts)}`);
|
800
815
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
@@ -805,7 +820,7 @@ export function arrangePlans(options) {
|
|
805
820
|
}
|
806
821
|
catch (err) {
|
807
822
|
const transformedError = transformError(err, requestTransformation, [
|
808
|
-
'
|
823
|
+
'ids',
|
809
824
|
]);
|
810
825
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
811
826
|
throw transformedError;
|