@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
@@ -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 {};
|
@@ -31,6 +31,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
31
|
exports.arrangePlans = exports.archivePlan = exports.clearPrimary = exports.makePlanPrimary = exports.setPlanVisibility = exports.updatePlan = exports.createPlan = exports.getPlanStats = exports.listPlans = exports.getPlan = exports.queryPublicPlans = exports.listPublicPlans = exports.PublicFilter = exports.ArchivedFilter = exports.SortOrder = exports.PeriodUnit = exports.__debug = void 0;
|
32
32
|
const velo_1 = require("@wix/metro-runtime/velo");
|
33
33
|
const ambassadorWixPricingPlansV2Plan = __importStar(require("./pricing-plans-v2-plan.http"));
|
34
|
+
// @ts-ignore
|
35
|
+
const motion_edm_autogen_query_wrapper_1 = require("@wix/motion-edm-autogen-query-wrapper");
|
34
36
|
let __verbose = false;
|
35
37
|
function __log(...args) {
|
36
38
|
__verbose && console.log(...args);
|
@@ -180,50 +182,57 @@ exports.listPublicPlans = listPublicPlans;
|
|
180
182
|
* 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).
|
181
183
|
* @public
|
182
184
|
* @documentationMaturity preview
|
183
|
-
* @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.
|
184
185
|
*/
|
185
|
-
function queryPublicPlans(
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
const { fromJSON } = (0, velo_1.serializer)({
|
202
|
-
rootSchema: _queryPublicPlansResponse,
|
203
|
-
depSchemas: {},
|
204
|
-
fqdnTransformation: {
|
205
|
-
paths: [],
|
206
|
-
transformation: _toVeloEntity,
|
207
|
-
},
|
208
|
-
customTransformation: responseTransformation,
|
209
|
-
});
|
210
|
-
const payload = toAmbassadorRequest([options]);
|
211
|
-
const reqOpts = ambassadorWixPricingPlansV2Plan.queryPublicPlans(payload);
|
212
|
-
__log(`"QueryPublicPlans" sending request with: ${__inspect(reqOpts)}`);
|
213
|
-
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
214
|
-
try {
|
215
|
-
const result = yield httpClient.request(reqOpts);
|
216
|
-
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
217
|
-
return fromJSON(result.data);
|
218
|
-
}
|
219
|
-
catch (err) {
|
220
|
-
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
221
|
-
'options',
|
222
|
-
]);
|
223
|
-
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
224
|
-
throw transformedError;
|
225
|
-
}
|
186
|
+
function queryPublicPlans() {
|
187
|
+
const requestTransformation = { '*': '$[1]', query: '$[0]' };
|
188
|
+
const responseTransformation = {
|
189
|
+
items: '$.plans',
|
190
|
+
pagingMetadata: '$.pagingMetadata',
|
191
|
+
};
|
192
|
+
// @ts-ignore
|
193
|
+
const { httpClient, sideEffects } = arguments[0];
|
194
|
+
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
195
|
+
rootSchema: _queryPublicPlansRequest,
|
196
|
+
depSchemas: {},
|
197
|
+
fqdnTransformation: {
|
198
|
+
paths: [],
|
199
|
+
transformation: _fromVeloEntity,
|
200
|
+
},
|
201
|
+
customTransformation: requestTransformation,
|
226
202
|
});
|
203
|
+
const { fromJSON } = (0, velo_1.serializer)({
|
204
|
+
rootSchema: _queryPublicPlansResponse,
|
205
|
+
depSchemas: {},
|
206
|
+
fqdnTransformation: {
|
207
|
+
paths: [],
|
208
|
+
transformation: _toVeloEntity,
|
209
|
+
},
|
210
|
+
customTransformation: responseTransformation,
|
211
|
+
});
|
212
|
+
return (0, motion_edm_autogen_query_wrapper_1.wrapWithQueryBuilder)({
|
213
|
+
func: (payload) => __awaiter(this, void 0, void 0, function* () {
|
214
|
+
var _a, _b, _c;
|
215
|
+
const reqOpts = ambassadorWixPricingPlansV2Plan.queryPublicPlans(payload);
|
216
|
+
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
217
|
+
try {
|
218
|
+
const result = yield httpClient.request(reqOpts);
|
219
|
+
(_b = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSuccess) === null || _b === void 0 ? void 0 : _b.call(sideEffects, result);
|
220
|
+
return result;
|
221
|
+
}
|
222
|
+
catch (err) {
|
223
|
+
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
224
|
+
throw err;
|
225
|
+
}
|
226
|
+
}),
|
227
|
+
requestTransformer: (...args) => toAmbassadorRequest(args),
|
228
|
+
responseTransformer: ({ data }) => fromJSON(data),
|
229
|
+
errorTransformer: (err) => {
|
230
|
+
const transformedError = (0, velo_1.transformError)(err, requestTransformation);
|
231
|
+
throw transformedError;
|
232
|
+
},
|
233
|
+
pagingMethod: 'OFFSET',
|
234
|
+
transformationPaths: (0, velo_1.resolveQueryFieldsTransformationPaths)(_toVeloEntity),
|
235
|
+
})({ cursorWithEmptyFilterAndSort: true });
|
227
236
|
}
|
228
237
|
exports.queryPublicPlans = queryPublicPlans;
|
229
238
|
/**
|
@@ -242,7 +251,7 @@ function getPlan(_id) {
|
|
242
251
|
var _a, _b, _c;
|
243
252
|
return __awaiter(this, arguments, void 0, function* () {
|
244
253
|
const requestTransformation = { id: '$[0]' };
|
245
|
-
const responseTransformation = '
|
254
|
+
const responseTransformation = '$.plan';
|
246
255
|
// @ts-ignore
|
247
256
|
const { httpClient, sideEffects } = arguments[1];
|
248
257
|
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
@@ -430,7 +439,7 @@ function createPlan(plan) {
|
|
430
439
|
var _a, _b, _c;
|
431
440
|
return __awaiter(this, arguments, void 0, function* () {
|
432
441
|
const requestTransformation = { plan: '$[0]' };
|
433
|
-
const responseTransformation = '
|
442
|
+
const responseTransformation = '$.plan';
|
434
443
|
// @ts-ignore
|
435
444
|
const { httpClient, sideEffects } = arguments[1];
|
436
445
|
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
@@ -482,22 +491,23 @@ exports.createPlan = createPlan;
|
|
482
491
|
* @public
|
483
492
|
* @documentationMaturity preview
|
484
493
|
* @requiredField _id
|
494
|
+
* @requiredField plan
|
485
495
|
* @param _id - ID of the plan to update.
|
486
496
|
* @param options - Options for updating the plan.
|
487
497
|
* @returns Fulfilled - The updated plan.
|
488
498
|
*
|
489
499
|
* Rejected - Error message.
|
490
500
|
*/
|
491
|
-
function updatePlan(_id, options) {
|
501
|
+
function updatePlan(_id, plan, options) {
|
492
502
|
var _a, _b, _c;
|
493
503
|
return __awaiter(this, arguments, void 0, function* () {
|
494
504
|
const requestTransformation = {
|
495
|
-
plan: { '*': '$[1]
|
496
|
-
fieldMask: '$[
|
505
|
+
plan: { '*': '$[1]', id: '$[0]' },
|
506
|
+
fieldMask: '$[2].fieldMask',
|
497
507
|
};
|
498
|
-
const responseTransformation = '
|
508
|
+
const responseTransformation = '$.plan';
|
499
509
|
// @ts-ignore
|
500
|
-
const { httpClient, sideEffects } = arguments[
|
510
|
+
const { httpClient, sideEffects } = arguments[3];
|
501
511
|
const { toAmbassadorRequest } = (0, velo_1.serializer)({
|
502
512
|
rootSchema: _updatePlanRequest,
|
503
513
|
depSchemas: {},
|
@@ -516,7 +526,7 @@ function updatePlan(_id, options) {
|
|
516
526
|
},
|
517
527
|
customTransformation: responseTransformation,
|
518
528
|
});
|
519
|
-
const payload = toAmbassadorRequest([_id, options]);
|
529
|
+
const payload = toAmbassadorRequest([_id, plan, options]);
|
520
530
|
const reqOpts = ambassadorWixPricingPlansV2Plan.updatePlan(payload);
|
521
531
|
__log(`"UpdatePlan" sending request with: ${__inspect(reqOpts)}`);
|
522
532
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
@@ -528,6 +538,7 @@ function updatePlan(_id, options) {
|
|
528
538
|
catch (err) {
|
529
539
|
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
530
540
|
'_id',
|
541
|
+
'plan',
|
531
542
|
'options',
|
532
543
|
]);
|
533
544
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
@@ -550,19 +561,21 @@ exports.updatePlan = updatePlan;
|
|
550
561
|
* 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.
|
551
562
|
*
|
552
563
|
* Only users with "Manage Pricing Plans" [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can change a plans visibility.
|
564
|
+
* @param visible - Whether to set the plan as visible.
|
553
565
|
* @public
|
554
566
|
* @documentationMaturity preview
|
555
567
|
* @requiredField _id
|
568
|
+
* @requiredField visible
|
556
569
|
* @param _id - The ID of the plan to either display or hide on the site page.
|
557
570
|
* @param options - Plan visibility options.
|
558
571
|
* @returns Fulfilled - The plan's information.
|
559
572
|
*
|
560
573
|
* Rejected - Error message.
|
561
574
|
*/
|
562
|
-
function setPlanVisibility(_id,
|
575
|
+
function setPlanVisibility(_id, visible) {
|
563
576
|
var _a, _b, _c;
|
564
577
|
return __awaiter(this, arguments, void 0, function* () {
|
565
|
-
const requestTransformation = { id: '$[0]', visible: '$[1]
|
578
|
+
const requestTransformation = { id: '$[0]', visible: '$[1]' };
|
566
579
|
const responseTransformation = '$';
|
567
580
|
// @ts-ignore
|
568
581
|
const { httpClient, sideEffects } = arguments[2];
|
@@ -584,7 +597,7 @@ function setPlanVisibility(_id, options) {
|
|
584
597
|
},
|
585
598
|
customTransformation: responseTransformation,
|
586
599
|
});
|
587
|
-
const payload = toAmbassadorRequest([_id,
|
600
|
+
const payload = toAmbassadorRequest([_id, visible]);
|
588
601
|
const reqOpts = ambassadorWixPricingPlansV2Plan.setPlanVisibility(payload);
|
589
602
|
__log(`"SetPlanVisibility" sending request with: ${__inspect(reqOpts)}`);
|
590
603
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
@@ -596,7 +609,7 @@ function setPlanVisibility(_id, options) {
|
|
596
609
|
catch (err) {
|
597
610
|
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
598
611
|
'_id',
|
599
|
-
'
|
612
|
+
'visible',
|
600
613
|
]);
|
601
614
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
602
615
|
throw transformedError;
|
@@ -799,13 +812,15 @@ exports.archivePlan = archivePlan;
|
|
799
812
|
* Only users with "Managing Pricing Plans" [permissions](https://support.wix.com/en/article/roles-permissions-accessing-roles-permissions) can arrange plans.
|
800
813
|
*
|
801
814
|
* >**Note:** Make sure to provide *all* non-archived plan IDs to avoid unpredictable results.
|
815
|
+
* @param ids - IDs of all non-archived plans in the order you want them arranged.
|
802
816
|
* @public
|
803
817
|
* @documentationMaturity preview
|
818
|
+
* @requiredField ids
|
804
819
|
*/
|
805
|
-
function arrangePlans(
|
820
|
+
function arrangePlans(ids) {
|
806
821
|
var _a, _b, _c;
|
807
822
|
return __awaiter(this, arguments, void 0, function* () {
|
808
|
-
const requestTransformation = { ids: '$[0]
|
823
|
+
const requestTransformation = { ids: '$[0]' };
|
809
824
|
const responseTransformation = '$';
|
810
825
|
// @ts-ignore
|
811
826
|
const { httpClient, sideEffects } = arguments[1];
|
@@ -827,7 +842,7 @@ function arrangePlans(options) {
|
|
827
842
|
},
|
828
843
|
customTransformation: responseTransformation,
|
829
844
|
});
|
830
|
-
const payload = toAmbassadorRequest([
|
845
|
+
const payload = toAmbassadorRequest([ids]);
|
831
846
|
const reqOpts = ambassadorWixPricingPlansV2Plan.arrangePlans(payload);
|
832
847
|
__log(`"ArrangePlans" sending request with: ${__inspect(reqOpts)}`);
|
833
848
|
(_a = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onSiteCall) === null || _a === void 0 ? void 0 : _a.call(sideEffects);
|
@@ -838,7 +853,7 @@ function arrangePlans(options) {
|
|
838
853
|
}
|
839
854
|
catch (err) {
|
840
855
|
const transformedError = (0, velo_1.transformError)(err, requestTransformation, [
|
841
|
-
'
|
856
|
+
'ids',
|
842
857
|
]);
|
843
858
|
(_c = sideEffects === null || sideEffects === void 0 ? void 0 : sideEffects.onError) === null || _c === void 0 ? void 0 : _c.call(sideEffects, err);
|
844
859
|
throw transformedError;
|