webcake-storefront-mcp 1.15.1 → 1.16.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.
- package/dist/api.js +465 -0
- package/dist/changelog.json +7 -7
- package/dist/http.js +2 -1
- package/dist/server.js +7 -44
- package/dist/tools/affiliate.js +27 -0
- package/dist/tools/appointment.js +74 -0
- package/dist/tools/apps-extra.js +44 -0
- package/dist/tools/apps.js +18 -0
- package/dist/tools/catalog-extras.js +88 -0
- package/dist/tools/marketing.js +74 -0
- package/dist/tools/media.js +39 -0
- package/dist/tools/multilingual.js +70 -0
- package/dist/tools/registry.js +251 -0
- package/dist/tools/reviews.js +58 -0
- package/dist/tools/sale-channels.js +48 -0
- package/dist/tools/site-config.js +98 -0
- package/package.json +5 -3
package/dist/api.js
CHANGED
|
@@ -520,4 +520,469 @@ export class WebcakeCmsApi {
|
|
|
520
520
|
sendMail(params) {
|
|
521
521
|
return this.request("POST", `/api/v1/cms_function/${this.siteId}/application/automation/send_mail`, { body: params });
|
|
522
522
|
}
|
|
523
|
+
// ── App lifecycle (applications/subcriptions) ──
|
|
524
|
+
/** Uninstall an app by its subscription id (the `id` from list_apps / get_app). */
|
|
525
|
+
uninstallApp(id) {
|
|
526
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/subcriptions/uninstall_app`, { body: { id } });
|
|
527
|
+
}
|
|
528
|
+
/** Update an installed app's settings. `attrs` is merged onto the subscription (e.g. { settings: {...}, status }). */
|
|
529
|
+
updateApp(id, attrs) {
|
|
530
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/subcriptions/update_app`, { body: { id, attrs } });
|
|
531
|
+
}
|
|
532
|
+
/** Update the product-review app's settings (shop_info, display options…). */
|
|
533
|
+
updateAppReview(id, settings) {
|
|
534
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/subcriptions/update_app_review`, { body: { id, settings } });
|
|
535
|
+
}
|
|
536
|
+
// ── Product reviews (product_review app) ──
|
|
537
|
+
listReviews(query) {
|
|
538
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/all_review_admin`, { query });
|
|
539
|
+
}
|
|
540
|
+
getReview(reviewId) {
|
|
541
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/${reviewId}`);
|
|
542
|
+
}
|
|
543
|
+
getReviewProducts(reviewId) {
|
|
544
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/products`, { query: { review_id: reviewId } });
|
|
545
|
+
}
|
|
546
|
+
/** Create or update a review/reply. `body` is the review payload (id, customer_info, rating, title,
|
|
547
|
+
* comment, images, parent_id, apply_to, categories, permission, is_shop, product_reviews…). */
|
|
548
|
+
createOrUpdateReview(body) {
|
|
549
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/create_or_update`, { body });
|
|
550
|
+
}
|
|
551
|
+
removeReviews(ids) {
|
|
552
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/remove`, { body: { ids } });
|
|
553
|
+
}
|
|
554
|
+
/** Approve/hide reviews. `payload` typically { ids, permission } (permission 0=approved, 1=pending…). */
|
|
555
|
+
updateReviewStatus(payload) {
|
|
556
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_reviews/update_status`, { body: payload });
|
|
557
|
+
}
|
|
558
|
+
// ── Appointment app ──
|
|
559
|
+
listAppointmentCalendars(query) {
|
|
560
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_calendars`, { query });
|
|
561
|
+
}
|
|
562
|
+
createAppointmentCalendar(appointment_calendar) {
|
|
563
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_calendar`, { body: { appointment_calendar } });
|
|
564
|
+
}
|
|
565
|
+
updateAppointmentCalendar(appointment_calendar) {
|
|
566
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_calendar`, { body: { appointment_calendar } });
|
|
567
|
+
}
|
|
568
|
+
deleteAppointmentCalendars(ids) {
|
|
569
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_calendars`, { body: { ids } });
|
|
570
|
+
}
|
|
571
|
+
duplicateAppointmentCalendars(ids) {
|
|
572
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/duplicate_appointment_calendars`, { body: { ids } });
|
|
573
|
+
}
|
|
574
|
+
listAppointments(query) {
|
|
575
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointments`, { query });
|
|
576
|
+
}
|
|
577
|
+
listAppointmentAddresses(query) {
|
|
578
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_addresses`, { query });
|
|
579
|
+
}
|
|
580
|
+
createAppointmentAddress(appointment_address) {
|
|
581
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_address`, { body: { appointment_address } });
|
|
582
|
+
}
|
|
583
|
+
updateAppointmentAddress(appointment_address) {
|
|
584
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_address`, { body: { appointment_address } });
|
|
585
|
+
}
|
|
586
|
+
deleteAppointmentAddresses(ids) {
|
|
587
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_addresses`, { body: { ids } });
|
|
588
|
+
}
|
|
589
|
+
listAppointmentClassifies(query) {
|
|
590
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_classifies`, { query });
|
|
591
|
+
}
|
|
592
|
+
createAppointmentClassify(appointment_classify) {
|
|
593
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_classify`, { body: { appointment_classify } });
|
|
594
|
+
}
|
|
595
|
+
updateAppointmentClassify(appointment_classify) {
|
|
596
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_classify`, { body: { appointment_classify } });
|
|
597
|
+
}
|
|
598
|
+
deleteAppointmentClassifies(ids) {
|
|
599
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_classifies`, { body: { ids } });
|
|
600
|
+
}
|
|
601
|
+
listAppointmentEmployees(query) {
|
|
602
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/appointment/appointment_employees`, { query });
|
|
603
|
+
}
|
|
604
|
+
createAppointmentEmployee(appointment_employee) {
|
|
605
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/create_appointment_employee`, { body: { appointment_employee } });
|
|
606
|
+
}
|
|
607
|
+
updateAppointmentEmployee(appointment_employee) {
|
|
608
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/update_appointment_employee`, { body: { appointment_employee } });
|
|
609
|
+
}
|
|
610
|
+
deleteAppointmentEmployees(ids) {
|
|
611
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/appointment/delete_appointment_employees`, { body: { ids } });
|
|
612
|
+
}
|
|
613
|
+
// ── Affiliate app ──
|
|
614
|
+
getProgramAffiliates() {
|
|
615
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/program_affiliates`);
|
|
616
|
+
}
|
|
617
|
+
getProductAffiliates(query) {
|
|
618
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/product_affiliates`, { query });
|
|
619
|
+
}
|
|
620
|
+
getOrderAffiliates(query) {
|
|
621
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/order_affiliates`, { query });
|
|
622
|
+
}
|
|
623
|
+
getAccountAffiliates(query) {
|
|
624
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/account_affiliates`, { query });
|
|
625
|
+
}
|
|
626
|
+
getPayoutAffiliates(query) {
|
|
627
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/payout_affiliates`, { query });
|
|
628
|
+
}
|
|
629
|
+
getAffiliateStatistic() {
|
|
630
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/affiliate/statistic`);
|
|
631
|
+
}
|
|
632
|
+
upsertOrderProgramAffiliate(payload) {
|
|
633
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/upsert_order_program_affiliate`, { body: payload });
|
|
634
|
+
}
|
|
635
|
+
upsertProductProgramAffiliate(payload) {
|
|
636
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/upsert_product_program_affiliate`, { body: payload });
|
|
637
|
+
}
|
|
638
|
+
upsertProductAffiliate(payload) {
|
|
639
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/upsert_product_affiliate`, { body: payload });
|
|
640
|
+
}
|
|
641
|
+
deleteProductAffiliates(payload) {
|
|
642
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/delete_product_affiliates`, { body: payload });
|
|
643
|
+
}
|
|
644
|
+
updatePayoutAffiliateStatus(payload) {
|
|
645
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/update_status_payout_affiliate`, { body: payload });
|
|
646
|
+
}
|
|
647
|
+
deleteAccountAffiliates(payload) {
|
|
648
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/delete_account_affiliates`, { body: payload });
|
|
649
|
+
}
|
|
650
|
+
updateAccountAffiliate(payload) {
|
|
651
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/affiliate/update_account_affiliate`, { body: payload });
|
|
652
|
+
}
|
|
653
|
+
// ── Catalog extras (brands / suppliers / tags / ribbons / materials / variations) ──
|
|
654
|
+
listProductBrands() {
|
|
655
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/product_brands/all`);
|
|
656
|
+
}
|
|
657
|
+
upsertProductBrand(body) {
|
|
658
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/product_brands/create_or_update`, { body });
|
|
659
|
+
}
|
|
660
|
+
listProductSuppliers() {
|
|
661
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/product_suppliers/all`);
|
|
662
|
+
}
|
|
663
|
+
upsertProductSupplier(body) {
|
|
664
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/product_suppliers/create_or_update`, { body });
|
|
665
|
+
}
|
|
666
|
+
listProductTags(query) {
|
|
667
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/product_tags/all`, { query });
|
|
668
|
+
}
|
|
669
|
+
upsertProductTag(body) {
|
|
670
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/product_tags/create_or_update`, { body });
|
|
671
|
+
}
|
|
672
|
+
listRibbons() {
|
|
673
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/ribbons/all`);
|
|
674
|
+
}
|
|
675
|
+
upsertRibbon(body) {
|
|
676
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/ribbons/create_or_update`, { body });
|
|
677
|
+
}
|
|
678
|
+
listMaterials() {
|
|
679
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/materials/all`);
|
|
680
|
+
}
|
|
681
|
+
upsertMaterial(body) {
|
|
682
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/products/materials/create_or_update`, { body });
|
|
683
|
+
}
|
|
684
|
+
getVariation(variationId) {
|
|
685
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/products/variation/${variationId}`);
|
|
686
|
+
}
|
|
687
|
+
getProductMeasurement() {
|
|
688
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/product_measurement`);
|
|
689
|
+
}
|
|
690
|
+
updateProductMeasurement(product_measurement) {
|
|
691
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/product_measurement/update`, { body: { product_measurement } });
|
|
692
|
+
}
|
|
693
|
+
listBlockPhoneNumbers(query) {
|
|
694
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/block_phone_number/all`, { query });
|
|
695
|
+
}
|
|
696
|
+
upsertBlockPhoneCustomers(phone_numbers) {
|
|
697
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/block_phone_number/upsert_block_phone_customers`, { body: { phone_numbers } });
|
|
698
|
+
}
|
|
699
|
+
removeAllBlockPhoneCustomers() {
|
|
700
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/block_phone_number/remove_all_block_phone_customers`, { body: {} });
|
|
701
|
+
}
|
|
702
|
+
getPriceContacts(type) {
|
|
703
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/price_contact/get`, { query: { type } });
|
|
704
|
+
}
|
|
705
|
+
updatePriceContact(body) {
|
|
706
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/price_contact/update`, { body });
|
|
707
|
+
}
|
|
708
|
+
getCategoryById(categoryId) {
|
|
709
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/categories/${categoryId}`);
|
|
710
|
+
}
|
|
711
|
+
// ── Site config (domains / redirects / shipping / utms / logs / filters / settings / fonts) ──
|
|
712
|
+
listDomains(query) {
|
|
713
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/domains/all`, { query });
|
|
714
|
+
}
|
|
715
|
+
createDomain(body) {
|
|
716
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/create`, { body });
|
|
717
|
+
}
|
|
718
|
+
updateDomain(body) {
|
|
719
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/update`, { body });
|
|
720
|
+
}
|
|
721
|
+
verifyDomain(domain_id) {
|
|
722
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/verify`, { body: { domain_id } });
|
|
723
|
+
}
|
|
724
|
+
deleteDomain(domain_id) {
|
|
725
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/delete`, { body: { domain_id } });
|
|
726
|
+
}
|
|
727
|
+
checkDomain(domain) {
|
|
728
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/domains/check_domain`, { body: { domain } });
|
|
729
|
+
}
|
|
730
|
+
listRedirectUrls(query) {
|
|
731
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/all`, { query });
|
|
732
|
+
}
|
|
733
|
+
createRedirectUrl(redirect_url) {
|
|
734
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/create`, { body: { redirect_url } });
|
|
735
|
+
}
|
|
736
|
+
updateRedirectUrl(redirect_url) {
|
|
737
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/update`, { body: { redirect_url } });
|
|
738
|
+
}
|
|
739
|
+
deleteRedirectUrls(redirect_url_ids) {
|
|
740
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/seos/redirect_urls/delete`, { body: { redirect_url_ids } });
|
|
741
|
+
}
|
|
742
|
+
getShipping() {
|
|
743
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/shipping`);
|
|
744
|
+
}
|
|
745
|
+
updateShipping(body) {
|
|
746
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/shipping/update`, { body });
|
|
747
|
+
}
|
|
748
|
+
listSiteUtms(query) {
|
|
749
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/site_utms/all`, { query });
|
|
750
|
+
}
|
|
751
|
+
createSiteUtm(site_utm) {
|
|
752
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/site_utms/create`, { body: { site_utm } });
|
|
753
|
+
}
|
|
754
|
+
updateSiteUtm(site_utm) {
|
|
755
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/site_utms/update`, { body: { site_utm } });
|
|
756
|
+
}
|
|
757
|
+
deleteSiteUtms(ids) {
|
|
758
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/site_utms/delete`, { body: { ids } });
|
|
759
|
+
}
|
|
760
|
+
listSystemLogs(query) {
|
|
761
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/system_logs/all`, { query });
|
|
762
|
+
}
|
|
763
|
+
listSavedFilters(table_key) {
|
|
764
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/saved_filters/`, { query: { table_key } });
|
|
765
|
+
}
|
|
766
|
+
createSavedFilter(saved_filter) {
|
|
767
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/saved_filters/create`, { body: { saved_filter } });
|
|
768
|
+
}
|
|
769
|
+
updateSavedFilter(id, saved_filter) {
|
|
770
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/saved_filters/${id}/update`, { body: { saved_filter } });
|
|
771
|
+
}
|
|
772
|
+
deleteSavedFilter(id) {
|
|
773
|
+
return this.request("DELETE", `/api/v1/dashboard/site/${this.siteId}/saved_filters/${id}`);
|
|
774
|
+
}
|
|
775
|
+
/** Raw /update_site call. `body` top-level keys replace; a nested `settings` key is merged server-side. */
|
|
776
|
+
updateSiteRaw(body) {
|
|
777
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/update_site`, { body });
|
|
778
|
+
}
|
|
779
|
+
updateSiteName(name) {
|
|
780
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/update_site_name`, { body: { name } });
|
|
781
|
+
}
|
|
782
|
+
updateSiteSlug(slug) {
|
|
783
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/update_slug_name`, { body: { slug } });
|
|
784
|
+
}
|
|
785
|
+
loadFonts() {
|
|
786
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/load_fonts`);
|
|
787
|
+
}
|
|
788
|
+
removeFont(id) {
|
|
789
|
+
return this.request("DELETE", `/api/v1/site/${this.siteId}/remove_font`, { body: { id } });
|
|
790
|
+
}
|
|
791
|
+
loadFontGroups() {
|
|
792
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/load_font_groups`);
|
|
793
|
+
}
|
|
794
|
+
createFontGroup(body) {
|
|
795
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/create_font_group`, { body: { ...body, site_id: this.siteId } });
|
|
796
|
+
}
|
|
797
|
+
removeFontGroup(id) {
|
|
798
|
+
return this.request("DELETE", `/api/v1/site/${this.siteId}/remove_font_groups`, { body: { id, site_id: this.siteId } });
|
|
799
|
+
}
|
|
800
|
+
listApiKeys(query) {
|
|
801
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/api_keys/all`, { query });
|
|
802
|
+
}
|
|
803
|
+
listPublishHistories(query) {
|
|
804
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/publish_histories`, { query });
|
|
805
|
+
}
|
|
806
|
+
// ── Marketing / CRM / team ──
|
|
807
|
+
getSendEmail() {
|
|
808
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/send_email/all`);
|
|
809
|
+
}
|
|
810
|
+
saveSendEmail(body) {
|
|
811
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/send_email/save`, { body });
|
|
812
|
+
}
|
|
813
|
+
listContacts(query) {
|
|
814
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/contact/all`, { query });
|
|
815
|
+
}
|
|
816
|
+
createContact(body) {
|
|
817
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/contact/create`, { body: { ...body, site_id: this.siteId } });
|
|
818
|
+
}
|
|
819
|
+
deleteContacts(ids) {
|
|
820
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/contact/delete`, { body: { ids } });
|
|
821
|
+
}
|
|
822
|
+
listSubscribers(query) {
|
|
823
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/subscriber/all`, { query });
|
|
824
|
+
}
|
|
825
|
+
createSubscriber(body) {
|
|
826
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/subscriber/create`, { body });
|
|
827
|
+
}
|
|
828
|
+
deleteSubscribers(ids) {
|
|
829
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/subscriber/delete`, { body: { ids } });
|
|
830
|
+
}
|
|
831
|
+
listEmployees() {
|
|
832
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/settings/employee/all`);
|
|
833
|
+
}
|
|
834
|
+
inviteEmployee(email) {
|
|
835
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/employee/invite`, { body: { email } });
|
|
836
|
+
}
|
|
837
|
+
updateEmployeePermissions(site_permission) {
|
|
838
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/employee/change_permissions`, { body: { site_permission } });
|
|
839
|
+
}
|
|
840
|
+
deleteEmployees(site_permission_ids) {
|
|
841
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/settings/employee/delete_employees`, { body: { site_permission_ids } });
|
|
842
|
+
}
|
|
843
|
+
listInvitations() {
|
|
844
|
+
return this.request("GET", `/api/v1/dashboard/site/invitations/all`);
|
|
845
|
+
}
|
|
846
|
+
acceptInvitation(invitation_id) {
|
|
847
|
+
return this.request("POST", `/api/v1/dashboard/site/invitations/accept`, { body: { invitation_id } });
|
|
848
|
+
}
|
|
849
|
+
refuseInvitation(invitation_id) {
|
|
850
|
+
return this.request("POST", `/api/v1/dashboard/site/invitations/refuse`, { body: { invitation_id } });
|
|
851
|
+
}
|
|
852
|
+
listCustomerTags() {
|
|
853
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/customer/customer_tags`);
|
|
854
|
+
}
|
|
855
|
+
upsertCustomerTag(body) {
|
|
856
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/customer/upsert_customer_tag`, { body: { ...body, site_id: this.siteId } });
|
|
857
|
+
}
|
|
858
|
+
assignCustomerTags(body) {
|
|
859
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/customer/update_tags_for_multiple_customers`, { body: { ...body, site_id: this.siteId } });
|
|
860
|
+
}
|
|
861
|
+
getInsightToday() {
|
|
862
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/insight/today`);
|
|
863
|
+
}
|
|
864
|
+
getInsight(query) {
|
|
865
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/insight/all`, { query });
|
|
866
|
+
}
|
|
867
|
+
listNotifications() {
|
|
868
|
+
return this.request("GET", `/api/v1/dashboard/site/notifications/all`);
|
|
869
|
+
}
|
|
870
|
+
markNotificationRead(notification_id) {
|
|
871
|
+
return this.request("POST", `/api/v1/dashboard/site/notifications/mark_as_read`, { body: { notification_id } });
|
|
872
|
+
}
|
|
873
|
+
// ── Multilingual / translations ──
|
|
874
|
+
mlAddLanguages(languages) {
|
|
875
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/add_multiple_language`, { body: { languages } });
|
|
876
|
+
}
|
|
877
|
+
mlChangeDefault(language_code) {
|
|
878
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/change_language_default`, { body: { language_code } });
|
|
879
|
+
}
|
|
880
|
+
mlGetTranslations(resource, query) {
|
|
881
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/multilingual/${resource}`, { query });
|
|
882
|
+
}
|
|
883
|
+
mlSaveTranslations(action, body) {
|
|
884
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/${action}`, { body });
|
|
885
|
+
}
|
|
886
|
+
mlTranslateJson(body) {
|
|
887
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/multilingual/translate_json`, { body });
|
|
888
|
+
}
|
|
889
|
+
// ── Media library + PWA ──
|
|
890
|
+
listMediaFolders(query) {
|
|
891
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/media/folder`, { query });
|
|
892
|
+
}
|
|
893
|
+
listMediaContent(query) {
|
|
894
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/media/content`, { query });
|
|
895
|
+
}
|
|
896
|
+
listMediaAll(query) {
|
|
897
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/media/all`, { query });
|
|
898
|
+
}
|
|
899
|
+
getMediaCapacity() {
|
|
900
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/media/capacity`);
|
|
901
|
+
}
|
|
902
|
+
emptyMediaTrash() {
|
|
903
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/media/empty_trash`, { body: {} });
|
|
904
|
+
}
|
|
905
|
+
uploadBase64Media(base64) {
|
|
906
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/media/content/b64`, { body: { base64 }, timeout: 60000 });
|
|
907
|
+
}
|
|
908
|
+
updateMediaFolder(body) {
|
|
909
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/media/folder/update`, { body });
|
|
910
|
+
}
|
|
911
|
+
updateMediaContent(body) {
|
|
912
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/media/content/update`, { body });
|
|
913
|
+
}
|
|
914
|
+
getPwa() {
|
|
915
|
+
return this.request("GET", `/api/v1/site/${this.siteId}/pwa`);
|
|
916
|
+
}
|
|
917
|
+
upsertPwa(body) {
|
|
918
|
+
return this.request("POST", `/api/v1/site/${this.siteId}/pwa/upsert`, { body });
|
|
919
|
+
}
|
|
920
|
+
// ── Apps: product design / personal product design / course ──
|
|
921
|
+
getDeviceTemplates() {
|
|
922
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/product_design/get_group_device_tempalte`);
|
|
923
|
+
}
|
|
924
|
+
createProductsByDeviceTemplate(groups) {
|
|
925
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/product_design/create_product_by_device_template`, { body: { groups, site_id: this.siteId } });
|
|
926
|
+
}
|
|
927
|
+
getAllPpd(query) {
|
|
928
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/get_all_ppd`, { query });
|
|
929
|
+
}
|
|
930
|
+
upsertPpd(ppds) {
|
|
931
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/upsert_ppd`, { body: { ppds, site_id: this.siteId } });
|
|
932
|
+
}
|
|
933
|
+
removePpd(ids) {
|
|
934
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/remove_ppd`, { body: { ids, site_id: this.siteId } });
|
|
935
|
+
}
|
|
936
|
+
getProductVariationTemplate(product_id) {
|
|
937
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/applications/personal_product_design/get_product_variation_template`, { query: { product_id } });
|
|
938
|
+
}
|
|
939
|
+
listCourses(query) {
|
|
940
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/course-app`, { query });
|
|
941
|
+
}
|
|
942
|
+
getCourse(id) {
|
|
943
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/course-app/${id}`);
|
|
944
|
+
}
|
|
945
|
+
createCourse(body) {
|
|
946
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/course-app`, { body: { ...body, site_id: this.siteId } });
|
|
947
|
+
}
|
|
948
|
+
updateCourse(id, body) {
|
|
949
|
+
return this.request("PATCH", `/api/v1/dashboard/site/${this.siteId}/course-app/${id}`, { body });
|
|
950
|
+
}
|
|
951
|
+
deleteCourse(id) {
|
|
952
|
+
return this.request("DELETE", `/api/v1/dashboard/site/${this.siteId}/course-app/${id}`);
|
|
953
|
+
}
|
|
954
|
+
deleteManyCourses(ids) {
|
|
955
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/course-app/delete_many`, { body: { ids, site_id: this.siteId } });
|
|
956
|
+
}
|
|
957
|
+
getCourseMembers(query) {
|
|
958
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/course-app/members`, { query });
|
|
959
|
+
}
|
|
960
|
+
// ── Sale channels: sitemap + partner feeds + catalogs ──
|
|
961
|
+
sitemapSync(kind) {
|
|
962
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/sitemap/sync_${kind}`, { body: {} });
|
|
963
|
+
}
|
|
964
|
+
sitemapRebuild(type) {
|
|
965
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/sitemap/rebuild`, { body: { type } });
|
|
966
|
+
}
|
|
967
|
+
listPartnerFeeds(query) {
|
|
968
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/all`, { query });
|
|
969
|
+
}
|
|
970
|
+
createPartnerFeed(body) {
|
|
971
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/create`, { body });
|
|
972
|
+
}
|
|
973
|
+
updatePartnerFeed(partnerFeedId, body) {
|
|
974
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/${partnerFeedId}/update`, { body });
|
|
975
|
+
}
|
|
976
|
+
deletePartnerFeeds(partner_feed_ids) {
|
|
977
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/delete`, { body: { partner_feed_ids } });
|
|
978
|
+
}
|
|
979
|
+
listPartnerFeedProducts(partnerFeedId, query) {
|
|
980
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/${partnerFeedId}/products/all`, { query });
|
|
981
|
+
}
|
|
982
|
+
syncPartnerFeed(partnerFeedId) {
|
|
983
|
+
return this.request("POST", `/api/v1/dashboard/site/${this.siteId}/sale_channels/partner_feeds/${partnerFeedId}/products/sync`, { body: { partner_feed_id: partnerFeedId } });
|
|
984
|
+
}
|
|
985
|
+
listGoogleMerchants(query) {
|
|
986
|
+
return this.request("GET", `/api/v1/dashboard/site/${this.siteId}/sale_channels/google/merchants`, { query });
|
|
987
|
+
}
|
|
523
988
|
}
|
package/dist/changelog.json
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "1.16.0",
|
|
4
|
+
"d": "24/06/2026",
|
|
5
|
+
"type": "Added",
|
|
6
|
+
"en": "New uninstall_app, update_app, and update_app_review tools complete the app lifecycle: uninstall an installed app by subscription id, patch an app's…",
|
|
7
|
+
"vi": "Tool mới uninstall_app, update_app và update_app_review hoàn thiện vòng đời ứng dụng: gỡ cài đặt theo subscription id, cập nhật config/status của…"
|
|
8
|
+
},
|
|
2
9
|
{
|
|
3
10
|
"v": "1.15.1",
|
|
4
11
|
"d": "24/06/2026",
|
|
@@ -33,12 +40,5 @@
|
|
|
33
40
|
"type": "Fixed",
|
|
34
41
|
"en": "save_file_version and get_file_versions both sent the parameter as cms_file_id, but the backend reads file_id; versions were saved unlinked to any…",
|
|
35
42
|
"vi": "save_file_version và get_file_versions đều gửi tham số dưới key cms_file_id, trong khi backend đọc file_id; các phiên bản được lưu mà không liên kết…"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"v": "1.12.0",
|
|
39
|
-
"d": "24/06/2026",
|
|
40
|
-
"type": "Added",
|
|
41
|
-
"en": "New update_product tool updates an existing product's name, description, images, category_ids, is_published flag, or variations (price/stock/SKU per…",
|
|
42
|
-
"vi": "Tool mới update_product cập nhật name, description, images, category_ids, cờ is_published hoặc variations (giá/tồn kho/SKU theo từng biến thể) của…"
|
|
43
43
|
}
|
|
44
44
|
]
|
package/dist/http.js
CHANGED
|
@@ -36,6 +36,7 @@ const QUERY_TO_HEADER = {
|
|
|
36
36
|
api_url: "x-webcake-api-url",
|
|
37
37
|
session_id: "x-webcake-session-id",
|
|
38
38
|
env: "x-webcake-env",
|
|
39
|
+
tools: "x-webcake-tools",
|
|
39
40
|
};
|
|
40
41
|
function header(req, name) {
|
|
41
42
|
const v = req.headers[name];
|
|
@@ -385,7 +386,7 @@ export async function startHttpServer(port) {
|
|
|
385
386
|
transports.delete(transport.sessionId);
|
|
386
387
|
};
|
|
387
388
|
const api = apiFromRequest(req);
|
|
388
|
-
const server = createServer(api, { allowLocalFiles: false }); // remote: never read server-side files
|
|
389
|
+
const server = createServer(api, { allowLocalFiles: false, tools: header(req, "x-webcake-tools") }); // remote: never read server-side files
|
|
389
390
|
await server.connect(transport);
|
|
390
391
|
await transport.handleRequest(req, res, body);
|
|
391
392
|
return;
|
package/dist/server.js
CHANGED
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import {
|
|
3
|
-
import { registerCmsFileTools } from "./tools/cms-files.js";
|
|
4
|
-
import { registerPageTools } from "./tools/pages.js";
|
|
5
|
-
import { registerCollectionTools } from "./tools/collections.js";
|
|
6
|
-
import { registerArticleTools } from "./tools/articles.js";
|
|
7
|
-
import { registerCustomerTools } from "./tools/customers.js";
|
|
8
|
-
import { registerAutomationTools } from "./tools/automation.js";
|
|
9
|
-
import { registerProductTools } from "./tools/products.js";
|
|
10
|
-
import { registerCatalogWriteTools } from "./tools/catalog-write.js";
|
|
11
|
-
import { registerOrderTools } from "./tools/orders.js";
|
|
12
|
-
import { registerSiteStyleTools } from "./tools/site-style.js";
|
|
13
|
-
import { registerAppTools } from "./tools/apps.js";
|
|
14
|
-
import { registerPromotionTools } from "./tools/promotions.js";
|
|
15
|
-
import { registerComboTools } from "./tools/combos.js";
|
|
16
|
-
import { registerGlobalSourceTools } from "./tools/global-sources.js";
|
|
17
|
-
import { registerGlobalSectionTools } from "./tools/global-sections.js";
|
|
18
|
-
import { registerGlobalSectionWriteTools } from "./tools/global-section-write.js";
|
|
19
|
-
import { registerResultCacheTools } from "./tools/result-cache.js";
|
|
20
|
-
import { registerImageTools } from "./tools/images.js";
|
|
21
|
-
import { registerBuilderTools } from "./tools/builder.js";
|
|
22
|
-
import { registerBuilderExtraTools } from "./tools/builder-extras.js";
|
|
2
|
+
import { installTools, buildToolGroupIndex } from "./tools/registry.js";
|
|
23
3
|
const INSTRUCTIONS = `You are an AI assistant connected to the WebCake/StoreCake storefront platform via MCP tools.
|
|
24
4
|
|
|
25
5
|
IMPORTANT: When the user asks ANY question about their website, store, products, orders, pages, or code — you MUST use the available tools to look up real data before answering. Never guess.
|
|
26
6
|
|
|
7
|
+
Tool discovery: the common tools (pages, builder, products, orders, blog, customers, apps, publishing) are loaded directly. MANY more capabilities are available on demand — marketing/CRM (email, contacts, subscribers, employees), translations, media library, appointments, affiliate, product reviews, custom domains / SEO redirects / shipping, brands / tags / ribbons / materials, courses, sale channels, automation, and more. If you don't see a directly-loaded tool for the task, call search_tools("keywords") to find it, then run it with invoke_tool(name, arguments). Use list_tool_groups to see everything available.
|
|
8
|
+
|
|
27
9
|
You can also BUILD pages: use get_build_guide, list_elements, get_element to learn the BuilderX component model, new_section/new_element to compose, validate_page to check, then build_page (dry_run first) to create. Publishing is site-level via publish_site.
|
|
28
10
|
|
|
29
11
|
To make a generated site look real, also CREATE DATA so dataset bindings resolve: create_product_category + create_product (storefront), create_blog_category + create_article (blog). Get image URLs from search_images / upload_images first, then reference them. A good flow for a fresh site: create_site → create a few categories → create products in them → build_page (home + store/blog pages) → publish_site.
|
|
30
12
|
|
|
31
13
|
Workflow:
|
|
32
14
|
1. On first interaction, call get_current_context. The site is NOT set from env — if no site is selected yet, call list_my_sites and ask the user which site to work on, then switch_site (the choice is saved and reused next session). To start from scratch, create_site makes a new site and switches to it; then build a homepage with build_page (type:'main', is_homepage:true).
|
|
33
|
-
2. Before answering a site-specific question, query the relevant tool.
|
|
15
|
+
2. Before answering a site-specific question, query the relevant tool (use search_tools if it isn't loaded directly).
|
|
34
16
|
3. When building a page, read get_build_guide first and validate before saving.
|
|
35
17
|
4. Always reply in the user's language; keep Vietnamese with full diacritics.`;
|
|
36
18
|
function makeResult(data) {
|
|
@@ -38,7 +20,8 @@ function makeResult(data) {
|
|
|
38
20
|
}
|
|
39
21
|
/** Build a fully-wired MCP server bound to the given API client. */
|
|
40
22
|
export function createServer(api, opts = {}) {
|
|
41
|
-
const
|
|
23
|
+
const toolsSpec = opts.tools ?? process.env.WEBCAKE_TOOLS;
|
|
24
|
+
const server = new McpServer({ name: "webcake-storefront", version: "1.0.0" }, { instructions: `${INSTRUCTIONS}\n\n${buildToolGroupIndex(toolsSpec)}` });
|
|
42
25
|
const handle = async (fn) => {
|
|
43
26
|
try {
|
|
44
27
|
return makeResult(await fn());
|
|
@@ -48,26 +31,6 @@ export function createServer(api, opts = {}) {
|
|
|
48
31
|
return { content: [{ type: "text", text: `Error: ${msg}` }], isError: true };
|
|
49
32
|
}
|
|
50
33
|
};
|
|
51
|
-
|
|
52
|
-
registerCmsFileTools(server, api, handle);
|
|
53
|
-
registerPageTools(server, api, handle);
|
|
54
|
-
registerCollectionTools(server, api, handle);
|
|
55
|
-
registerArticleTools(server, api, handle);
|
|
56
|
-
registerCustomerTools(server, api, handle);
|
|
57
|
-
registerAutomationTools(server, api, handle);
|
|
58
|
-
registerProductTools(server, api, handle);
|
|
59
|
-
registerCatalogWriteTools(server, api, handle);
|
|
60
|
-
registerOrderTools(server, api, handle);
|
|
61
|
-
registerSiteStyleTools(server, api, handle);
|
|
62
|
-
registerAppTools(server, api, handle);
|
|
63
|
-
registerPromotionTools(server, api, handle);
|
|
64
|
-
registerComboTools(server, api, handle);
|
|
65
|
-
registerGlobalSourceTools(server, api, handle);
|
|
66
|
-
registerGlobalSectionTools(server, api, handle);
|
|
67
|
-
registerGlobalSectionWriteTools(server, api, handle);
|
|
68
|
-
registerResultCacheTools(server, api, handle);
|
|
69
|
-
registerImageTools(server, api, handle);
|
|
70
|
-
registerBuilderTools(server, api, handle);
|
|
71
|
-
registerBuilderExtraTools(server, api, handle, { allowLocalFiles: opts.allowLocalFiles === true });
|
|
34
|
+
installTools(server, api, handle, { allowLocalFiles: opts.allowLocalFiles === true, tools: toolsSpec });
|
|
72
35
|
return server;
|
|
73
36
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// Affiliate / referral app (Enum.Application affiliates = 4).
|
|
3
|
+
// Install first via install_app({ app: "affiliates" }). Endpoints under /affiliate/*.
|
|
4
|
+
// Programs define commission rules; products opt in; accounts are affiliates; payouts settle commissions.
|
|
5
|
+
export function registerAffiliateTools(server, api, handle) {
|
|
6
|
+
const listShape = {
|
|
7
|
+
page: z.number().optional().describe("Page number (default 1)"),
|
|
8
|
+
limit: z.number().optional().describe("Items per page"),
|
|
9
|
+
term: z.string().optional().describe("Search term"),
|
|
10
|
+
};
|
|
11
|
+
const unwrap = (res, key) => res?.data?.[key] ?? res?.[key] ?? res?.data ?? res;
|
|
12
|
+
server.tool("get_affiliate_programs", "Get the affiliate commission programs (order-level and product-level) configured for the site.", {}, () => handle(async () => unwrap(await api.getProgramAffiliates(), "program_affiliates")));
|
|
13
|
+
server.tool("get_affiliate_statistic", "Get aggregate affiliate statistics (clicks, orders, commission, payouts) for the site.", {}, () => handle(async () => unwrap(await api.getAffiliateStatistic(), "statistic")));
|
|
14
|
+
server.tool("list_affiliate_products", "List products enrolled in the affiliate program (with their commission settings).", listShape, (query) => handle(async () => unwrap(await api.getProductAffiliates(query), "product_affiliates")));
|
|
15
|
+
server.tool("list_affiliate_orders", "List affiliate-attributed orders (referrals that converted).", { ...listShape, status: z.number().optional().describe("Filter by order status code") }, (query) => handle(async () => unwrap(await api.getOrderAffiliates(query), "order_affiliates")));
|
|
16
|
+
server.tool("list_affiliate_accounts", "List affiliate accounts (registered affiliates / referrers).", listShape, (query) => handle(async () => unwrap(await api.getAccountAffiliates(query), "account_affiliates")));
|
|
17
|
+
server.tool("list_affiliate_payouts", "List affiliate payout requests/records.", { ...listShape, status: z.number().optional().describe("Filter by payout status code") }, (query) => handle(async () => unwrap(await api.getPayoutAffiliates(query), "payout_affiliates")));
|
|
18
|
+
server.tool("update_affiliate_order_program", `Create/update the order-level affiliate commission program. \`payload\` is the program object
|
|
19
|
+
(e.g. { "is_activated": true, "commission_type": ..., "commission_value": ... }).`, { payload: z.record(z.any()).describe("Order program settings object") }, ({ payload }) => handle(() => api.upsertOrderProgramAffiliate(payload)));
|
|
20
|
+
server.tool("update_affiliate_product_program", "Create/update the product-level affiliate commission program. `payload` is the program object.", { payload: z.record(z.any()).describe("Product program settings object") }, ({ payload }) => handle(() => api.upsertProductProgramAffiliate(payload)));
|
|
21
|
+
server.tool("upsert_affiliate_product", `Enroll/update a product in the affiliate program with its own commission. \`payload\` includes the
|
|
22
|
+
product id and commission fields (e.g. { "product_id": "...", "commission_type": ..., "commission_value": ... }).`, { payload: z.record(z.any()).describe("Affiliate-product settings object") }, ({ payload }) => handle(() => api.upsertProductAffiliate(payload)));
|
|
23
|
+
server.tool("delete_affiliate_products", "Remove products from the affiliate program. `payload` typically { ids: [...] }.", { payload: z.record(z.any()).describe('e.g. { "ids": ["..."] }') }, ({ payload }) => handle(() => api.deleteProductAffiliates(payload)));
|
|
24
|
+
server.tool("update_affiliate_payout_status", `Update the status of affiliate payout(s). \`payload\` typically { ids: [...], status: <code> }.`, { payload: z.record(z.any()).describe('e.g. { "ids": ["..."], "status": 1 }') }, ({ payload }) => handle(() => api.updatePayoutAffiliateStatus(payload)));
|
|
25
|
+
server.tool("delete_affiliate_accounts", "Remove affiliate accounts. `payload` typically { ids: [...] }.", { payload: z.record(z.any()).describe('e.g. { "ids": ["..."] }') }, ({ payload }) => handle(() => api.deleteAccountAffiliates(payload)));
|
|
26
|
+
server.tool("update_affiliate_account", "Update an affiliate account (e.g. commission rate, status). `payload` is the account object incl. its id.", { payload: z.record(z.any()).describe("Affiliate account object incl. id") }, ({ payload }) => handle(() => api.updateAccountAffiliate(payload)));
|
|
27
|
+
}
|