/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@wix/auto_sdk_gift-vouchers_gift-voucher-products@1.0.31/build/cjs/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,r)=>{for(var e in r)__defProp(t,e,{get:r[e],enumerable:!0})},__copyProps=(t,r,e,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let o of __getOwnPropNames(r))__hasOwnProp.call(t,o)||o===e||__defProp(t,o,{get:()=>r[o],enumerable:!(a=__getOwnPropDesc(r,o))||a.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),index_exports={};__export(index_exports,{ExpirationType:()=>ExpirationType,SortOrder:()=>SortOrder,TimePeriod:()=>TimePeriod,WebhookIdentityType:()=>WebhookIdentityType,createGiftCardProduct:()=>createGiftCardProduct4,deleteGiftCardProduct:()=>deleteGiftCardProduct4,getGiftCardProduct:()=>getGiftCardProduct4,onGiftCardProductCreated:()=>onGiftCardProductCreated2,onGiftCardProductDeleted:()=>onGiftCardProductDeleted2,onGiftCardProductUpdated:()=>onGiftCardProductUpdated2,queryGiftCardProducts:()=>queryGiftCardProducts4,updateGiftCardProduct:()=>updateGiftCardProduct4,utils:()=>utils}),module.exports=__toCommonJS(index_exports);var import_rename_all_nested_keys2=require("@wix/sdk-runtime/rename-all-nested-keys"),import_image3=require("@wix/sdk-runtime/transformations/image"),import_timestamp3=require("@wix/sdk-runtime/transformations/timestamp"),import_transform_paths3=require("@wix/sdk-runtime/transformations/transform-paths"),import_sdk_types=require("@wix/sdk-types"),import_transform_error=require("@wix/sdk-runtime/transform-error"),import_query_builder=require("@wix/sdk-runtime/query-builder"),import_rename_all_nested_keys=require("@wix/sdk-runtime/rename-all-nested-keys"),import_rest_modules=require("@wix/sdk-runtime/rest-modules"),import_timestamp=require("@wix/sdk-runtime/transformations/timestamp"),import_timestamp2=require("@wix/sdk-runtime/transformations/timestamp"),import_field_mask=require("@wix/sdk-runtime/transformations/field-mask"),import_transform_paths=require("@wix/sdk-runtime/transformations/transform-paths"),import_rest_modules2=require("@wix/sdk-runtime/rest-modules");function resolveWixGiftCardsGiftCardProductV1GiftCardProductServiceUrl(t){return(0,import_rest_modules2.resolveUrl)(Object.assign(t,{domainToMappings:{"api._api_base_domain_":[{srcPath:"/gift-card-product",destPath:""}],"editor._base_domain_":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"blocks._base_domain_":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"create.editorx":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],_:[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"manage._base_domain_":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"www.wixapis.com":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"www._base_domain_":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"bo._base_domain_":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"wixbo.ai":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"wix-bo.com":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"editor.wixapps.net":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}],"*.dev.wix-code.com":[{srcPath:"/gift-cards/v1/gift-card-products",destPath:"/v1/gift-card-products"}]}}))}var PACKAGE_NAME="@wix/auto_sdk_gift-vouchers_gift-voucher-products";function createGiftCardProduct(t){return function({host:r}){const e=(0,import_transform_paths.transformPaths)(t,[{transformFn:import_timestamp.transformSDKTimestampToRESTTimestamp,paths:[{path:"giftCardProduct.fixedExpirationDate"},{path:"giftCardProduct.createdDate"},{path:"giftCardProduct.updatedDate"}]}]);return{entityFqdn:"wix.gift_cards.v1.gift_card_product",method:"POST",methodFqn:"wix.gift_cards.gift_card_product.v1.GiftCardProductService.CreateGiftCardProduct",packageName:PACKAGE_NAME,migrationOptions:{optInTransformResponse:!0},url:resolveWixGiftCardsGiftCardProductV1GiftCardProductServiceUrl({protoPath:"/v1/gift-card-products",data:e,host:r}),data:e,transformResponse:t=>(0,import_transform_paths.transformPaths)(t,[{transformFn:import_timestamp2.transformRESTTimestampToSDKTimestamp,paths:[{path:"giftCardProduct.fixedExpirationDate"},{path:"giftCardProduct.createdDate"},{path:"giftCardProduct.updatedDate"}]}])}}}function getGiftCardProduct(t){return function({host:r}){return{entityFqdn:"wix.gift_cards.v1.gift_card_product",method:"GET",methodFqn:"wix.gift_cards.gift_card_product.v1.GiftCardProductService.GetGiftCardProduct",packageName:PACKAGE_NAME,migrationOptions:{optInTransformResponse:!0},url:resolveWixGiftCardsGiftCardProductV1GiftCardProductServiceUrl({protoPath:"/v1/gift-card-products/{giftCardProductId}",data:t,host:r}),params:(0,import_rest_modules.toURLSearchParams)(t),transformResponse:t=>(0,import_transform_paths.transformPaths)(t,[{transformFn:import_timestamp2.transformRESTTimestampToSDKTimestamp,paths:[{path:"giftCardProduct.fixedExpirationDate"},{path:"giftCardProduct.createdDate"},{path:"giftCardProduct.updatedDate"}]}])}}}function updateGiftCardProduct(t){return function({host:r}){const e=(0,import_transform_paths.transformPaths)(t,[{transformFn:import_field_mask.transformSDKFieldMaskToRESTFieldMask,paths:[{path:"fieldMask"}]},{transformFn:import_timestamp.transformSDKTimestampToRESTTimestamp,paths:[{path:"giftCardProduct.fixedExpirationDate"},{path:"giftCardProduct.createdDate"},{path:"giftCardProduct.updatedDate"}]}]);return{entityFqdn:"wix.gift_cards.v1.gift_card_product",method:"PATCH",methodFqn:"wix.gift_cards.gift_card_product.v1.GiftCardProductService.UpdateGiftCardProduct",packageName:PACKAGE_NAME,migrationOptions:{optInTransformResponse:!0},url:resolveWixGiftCardsGiftCardProductV1GiftCardProductServiceUrl({protoPath:"/v1/gift-card-products/{giftCardProduct.id}",data:e,host:r}),data:e,transformResponse:t=>(0,import_transform_paths.transformPaths)(t,[{transformFn:import_timestamp2.transformRESTTimestampToSDKTimestamp,paths:[{path:"giftCardProduct.fixedExpirationDate"},{path:"giftCardProduct.createdDate"},{path:"giftCardProduct.updatedDate"}]}])}}}function deleteGiftCardProduct(t){return function({host:r}){return{entityFqdn:"wix.gift_cards.v1.gift_card_product",method:"DELETE",methodFqn:"wix.gift_cards.gift_card_product.v1.GiftCardProductService.DeleteGiftCardProduct",packageName:PACKAGE_NAME,migrationOptions:{optInTransformResponse:!0},url:resolveWixGiftCardsGiftCardProductV1GiftCardProductServiceUrl({protoPath:"/v1/gift-card-products/{giftCardProductId}",data:t,host:r}),params:(0,import_rest_modules.toURLSearchParams)(t)}}}function queryGiftCardProducts(t){return function({host:r}){return{entityFqdn:"wix.gift_cards.v1.gift_card_product",method:"GET",methodFqn:"wix.gift_cards.gift_card_product.v1.GiftCardProductService.QueryGiftCardProducts",packageName:PACKAGE_NAME,migrationOptions:{optInTransformResponse:!0},url:resolveWixGiftCardsGiftCardProductV1GiftCardProductServiceUrl({protoPath:"/v1/gift-card-products/query",data:t,host:r}),params:(0,import_rest_modules.toURLSearchParams)(t,!0),transformResponse:t=>(0,import_transform_paths.transformPaths)(t,[{transformFn:import_timestamp2.transformRESTTimestampToSDKTimestamp,paths:[{path:"giftCardProducts.fixedExpirationDate"},{path:"giftCardProducts.createdDate"},{path:"giftCardProducts.updatedDate"}]}]),fallback:[{method:"POST",url:resolveWixGiftCardsGiftCardProductV1GiftCardProductServiceUrl({protoPath:"/v1/gift-card-products/query",data:t,host:r}),data:t}]}}}var import_image=require("@wix/sdk-runtime/transformations/image"),import_image2=require("@wix/sdk-runtime/transformations/image"),import_transform_paths2=require("@wix/sdk-runtime/transformations/transform-paths"),import_query_builder_utils=require("@wix/sdk-runtime/query-builder-utils"),ExpirationType=(t=>(t.NONE="NONE",t.FIXED="FIXED",t.RELATIVE="RELATIVE",t))(ExpirationType||{}),TimePeriod=(t=>(t.DAYS="DAYS",t.WEEKS="WEEKS",t.MONTHS="MONTHS",t.YEARS="YEARS",t))(TimePeriod||{}),SortOrder=(t=>(t.ASC="ASC",t.DESC="DESC",t))(SortOrder||{}),WebhookIdentityType=(t=>(t.UNKNOWN="UNKNOWN",t.ANONYMOUS_VISITOR="ANONYMOUS_VISITOR",t.MEMBER="MEMBER",t.WIX_USER="WIX_USER",t.APP="APP",t))(WebhookIdentityType||{});async function createGiftCardProduct2(t){const{httpClient:r,sideEffects:e}=arguments[1],a=createGiftCardProduct((0,import_transform_paths2.transformPaths)((0,import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({giftCardProduct:t}),[{transformFn:import_image.transformSDKImageToRESTImage,paths:[{path:"giftCardProduct.image"},{path:"giftCardProduct.presetVariants.image"},{path:"giftCardProduct.customVariant.image"}]}]));e?.onSiteCall?.();try{const t=await r.request(a);return e?.onSuccess?.(t),(0,import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths2.transformPaths)(t.data,[{transformFn:import_image2.transformRESTImageToSDKImage,paths:[{path:"giftCardProduct.image"},{path:"giftCardProduct.presetVariants.image"},{path:"giftCardProduct.customVariant.image"}]}]))?.giftCardProduct}catch(t){const r=(0,import_transform_error.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{giftCardProduct:"$[0]"},singleArgumentUnchanged:!1},["giftCardProduct"]);throw e?.onError?.(t),r}}async function getGiftCardProduct2(t){const{httpClient:r,sideEffects:e}=arguments[1],a=getGiftCardProduct((0,import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({giftCardProductId:t}));e?.onSiteCall?.();try{const t=await r.request(a);return e?.onSuccess?.(t),(0,import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths2.transformPaths)(t.data,[{transformFn:import_image2.transformRESTImageToSDKImage,paths:[{path:"giftCardProduct.image"},{path:"giftCardProduct.presetVariants.image"},{path:"giftCardProduct.customVariant.image"}]}]))?.giftCardProduct}catch(t){const r=(0,import_transform_error.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{giftCardProductId:"$[0]"},singleArgumentUnchanged:!1},["giftCardProductId"]);throw e?.onError?.(t),r}}async function updateGiftCardProduct2(t,r){const{httpClient:e,sideEffects:a}=arguments[2],o=updateGiftCardProduct((0,import_transform_paths2.transformPaths)((0,import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({giftCardProduct:{...r,id:t}}),[{transformFn:import_image.transformSDKImageToRESTImage,paths:[{path:"giftCardProduct.image"},{path:"giftCardProduct.presetVariants.image"},{path:"giftCardProduct.customVariant.image"}]}]));a?.onSiteCall?.();try{const t=await e.request(o);return a?.onSuccess?.(t),(0,import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths2.transformPaths)(t.data,[{transformFn:import_image2.transformRESTImageToSDKImage,paths:[{path:"giftCardProduct.image"},{path:"giftCardProduct.presetVariants.image"},{path:"giftCardProduct.customVariant.image"}]}]))?.giftCardProduct}catch(t){const r=(0,import_transform_error.transformError)(t,{spreadPathsToArguments:{giftCardProduct:"$[1]"},explicitPathsToArguments:{"giftCardProduct.id":"$[0]"},singleArgumentUnchanged:!1},["_id","giftCardProduct"]);throw a?.onError?.(t),r}}async function deleteGiftCardProduct2(t){const{httpClient:r,sideEffects:e}=arguments[1],a=deleteGiftCardProduct((0,import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({giftCardProductId:t}));e?.onSiteCall?.();try{const t=await r.request(a);e?.onSuccess?.(t)}catch(t){const r=(0,import_transform_error.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{giftCardProductId:"$[0]"},singleArgumentUnchanged:!1},["giftCardProductId"]);throw e?.onError?.(t),r}}function queryGiftCardProducts2(){const{httpClient:t,sideEffects:r}=arguments[0];return(0,import_query_builder.queryBuilder)({func:async e=>{const a=queryGiftCardProducts(e);r?.onSiteCall?.();try{const e=await t.request(a);return r?.onSuccess?.(e),e}catch(t){throw r?.onError?.(t),t}},requestTransformer:t=>{const r=[t,{}];return(0,import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({...r?.[1],query:r?.[0]})},responseTransformer:({data:t})=>{const r=(0,import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths2.transformPaths)(t,[{transformFn:import_image2.transformRESTImageToSDKImage,paths:[{path:"giftCardProducts.image"},{path:"giftCardProducts.presetVariants.image"},{path:"giftCardProducts.customVariant.image"}]}]));return{items:r?.giftCardProducts,pagingMetadata:r?.pagingMetadata}},errorTransformer:t=>{throw(0,import_transform_error.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{query:"$[0]"},singleArgumentUnchanged:!1})},pagingMethod:"CURSOR",transformationPaths:{}})}async function typedQueryGiftCardProducts(t){const{httpClient:r,sideEffects:e}=arguments[1],a=queryGiftCardProducts((0,import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({query:t}));e?.onSiteCall?.();try{const t=await r.request(a);return e?.onSuccess?.(t),(0,import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths2.transformPaths)(t.data,[{transformFn:import_image2.transformRESTImageToSDKImage,paths:[{path:"giftCardProducts.image"},{path:"giftCardProducts.presetVariants.image"},{path:"giftCardProducts.customVariant.image"}]}]))}catch(t){const r=(0,import_transform_error.transformError)(t,{spreadPathsToArguments:{},explicitPathsToArguments:{query:"$[0]"},singleArgumentUnchanged:!1},["query"]);throw e?.onError?.(t),r}}var utils={query:{...(0,import_query_builder_utils.createQueryUtils)()}};function createGiftCardProduct3(t){return r=>createGiftCardProduct2(r,{httpClient:t})}function getGiftCardProduct3(t){return r=>getGiftCardProduct2(r,{httpClient:t})}function updateGiftCardProduct3(t){return(r,e)=>updateGiftCardProduct2(r,e,{httpClient:t})}function deleteGiftCardProduct3(t){return r=>deleteGiftCardProduct2(r,{httpClient:t})}function queryGiftCardProducts3(t){return()=>queryGiftCardProducts2({httpClient:t})}function typedQueryGiftCardProducts2(t){return r=>typedQueryGiftCardProducts(r,{httpClient:t})}var onGiftCardProductCreated=(0,import_sdk_types.EventDefinition)("wix.gift_cards.v1.gift_card_product_created",!0,(t=>(0,import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths3.transformPaths)(t,[{transformFn:import_timestamp3.transformRESTTimestampToSDKTimestamp,paths:[{path:"entity.fixedExpirationDate"},{path:"entity.createdDate"},{path:"entity.updatedDate"},{path:"metadata.eventTime"}]},{transformFn:import_image3.transformRESTImageToSDKImage,paths:[{path:"entity.image"},{path:"entity.presetVariants.image"},{path:"entity.customVariant.image"}]}]))))(),onGiftCardProductDeleted=(0,import_sdk_types.EventDefinition)("wix.gift_cards.v1.gift_card_product_deleted",!0,(t=>(0,import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths3.transformPaths)(t,[{transformFn:import_timestamp3.transformRESTTimestampToSDKTimestamp,paths:[{path:"entity.fixedExpirationDate"},{path:"entity.createdDate"},{path:"entity.updatedDate"},{path:"metadata.eventTime"}]},{transformFn:import_image3.transformRESTImageToSDKImage,paths:[{path:"entity.image"},{path:"entity.presetVariants.image"},{path:"entity.customVariant.image"}]}]))))(),onGiftCardProductUpdated=(0,import_sdk_types.EventDefinition)("wix.gift_cards.v1.gift_card_product_updated",!0,(t=>(0,import_rename_all_nested_keys2.renameKeysFromRESTResponseToSDKResponse)((0,import_transform_paths3.transformPaths)(t,[{transformFn:import_timestamp3.transformRESTTimestampToSDKTimestamp,paths:[{path:"entity.fixedExpirationDate"},{path:"entity.createdDate"},{path:"entity.updatedDate"},{path:"metadata.eventTime"}]},{transformFn:import_image3.transformRESTImageToSDKImage,paths:[{path:"entity.image"},{path:"entity.presetVariants.image"},{path:"entity.customVariant.image"}]}]))))(),import_rest_modules3=require("@wix/sdk-runtime/rest-modules"),import_event_definition_modules=require("@wix/sdk-runtime/event-definition-modules"),import_query_method_router=require("@wix/sdk-runtime/query-method-router");function customQueryGiftCardProducts(t){const r=(0,import_query_method_router.createQueryOverloadRouter)({builderQueryFunction:()=>queryGiftCardProducts3(t)(),typedQueryFunction:r=>typedQueryGiftCardProducts2(t)(r),hasOptionsParameter:!1});return function(t){return r(...arguments)}}var createGiftCardProduct4=(0,import_rest_modules3.createRESTModule)(createGiftCardProduct3),getGiftCardProduct4=(0,import_rest_modules3.createRESTModule)(getGiftCardProduct3),updateGiftCardProduct4=(0,import_rest_modules3.createRESTModule)(updateGiftCardProduct3),deleteGiftCardProduct4=(0,import_rest_modules3.createRESTModule)(deleteGiftCardProduct3),queryGiftCardProducts4=(0,import_rest_modules3.createRESTModule)(customQueryGiftCardProducts),onGiftCardProductCreated2=(0,import_event_definition_modules.createEventModule)(onGiftCardProductCreated),onGiftCardProductDeleted2=(0,import_event_definition_modules.createEventModule)(onGiftCardProductDeleted),onGiftCardProductUpdated2=(0,import_event_definition_modules.createEventModule)(onGiftCardProductUpdated);
//# sourceMappingURL=/sm/7b34b9e2b96c883de0945324abc6ba1202a496f41cb0f40fd165672d1ff668c9.map