@shophost/rest-api 2.0.67 → 2.0.69

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.
Files changed (141) hide show
  1. package/package.json +1 -1
  2. package/schema.prisma +1 -0
  3. package/scripts/shophost-rest-api.mjs +198 -1
  4. package/src/bootstrap.js +1 -1
  5. package/src/container.js +1 -1
  6. package/src/core/auth/auth.schema.js +1 -1
  7. package/src/core/auth/auth.util.js +1 -1
  8. package/src/core/auth/better-auth.lib.js +1 -1
  9. package/src/core/auth/generate-password-hash.util.js +1 -1
  10. package/src/core/auth/headers.schema.js +1 -1
  11. package/src/core/auth/user.schema.js +1 -1
  12. package/src/core/db/__generated__/client/browser.js +1 -1
  13. package/src/core/db/__generated__/client/client.js +1 -1
  14. package/src/core/db/__generated__/client/enums.js +1 -1
  15. package/src/core/db/__generated__/client/internal/class.js +789 -1
  16. package/src/core/db/__generated__/client/internal/prismaNamespace.d.ts +1 -0
  17. package/src/core/db/__generated__/client/internal/prismaNamespace.js +1 -1
  18. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.d.ts +1 -0
  19. package/src/core/db/__generated__/client/internal/prismaNamespaceBrowser.js +1 -1
  20. package/src/core/db/__generated__/client/models/OrganizationConfiguration.d.ts +41 -1
  21. package/src/core/db/index.js +1 -1
  22. package/src/core/email/components.js +1 -1
  23. package/src/core/exceptions/http-exception.js +1 -1
  24. package/src/core/hono/hono.js +1 -1
  25. package/src/core/lib/prisma.js +1 -1
  26. package/src/core/logging/pino.js +1 -1
  27. package/src/core/notifications/email.service.js +1 -1
  28. package/src/core/openapi/openapi.lib.js +1 -1
  29. package/src/core/utils/currency.util.js +1 -1
  30. package/src/core/utils/env.util.js +1 -1
  31. package/src/core/utils/object.util.js +1 -1
  32. package/src/core/utils/translations.util.js +1 -1
  33. package/src/core/utils/zod.util.js +1 -1
  34. package/src/db.js +1 -1
  35. package/src/features/access/access.handler.js +1 -1
  36. package/src/features/access/access.route.js +1 -1
  37. package/src/features/access/access.schema.js +1 -1
  38. package/src/features/access/access.service.js +1 -1
  39. package/src/features/analytics/analytics.handler.js +1 -1
  40. package/src/features/analytics/analytics.route.js +1 -1
  41. package/src/features/analytics/analytics.schema.js +1 -1
  42. package/src/features/analytics/analytics.service.js +1 -1
  43. package/src/features/cart/cart.handler.js +1 -1
  44. package/src/features/cart/cart.route.js +1 -1
  45. package/src/features/cart/cart.schema.js +1 -1
  46. package/src/features/cart/cart.service.js +1 -1
  47. package/src/features/cart/cart.util.js +1 -1
  48. package/src/features/customer/customer.handler.js +1 -1
  49. package/src/features/customer/customer.route.js +1 -1
  50. package/src/features/customer/customer.schema.js +1 -1
  51. package/src/features/customer/customer.service.js +1 -1
  52. package/src/features/file/file.handler.js +1 -1
  53. package/src/features/file/file.route.js +1 -1
  54. package/src/features/file/file.schema.js +1 -1
  55. package/src/features/file/file.service.js +1 -1
  56. package/src/features/health/health.handler.js +1 -1
  57. package/src/features/health/health.route.js +1 -1
  58. package/src/features/index.js +1 -1
  59. package/src/features/integration/integration-config.js +1 -1
  60. package/src/features/integration/integration-registry.js +1 -1
  61. package/src/features/integration/integration.handler.js +1 -1
  62. package/src/features/integration/integration.route.js +1 -1
  63. package/src/features/integration/integration.schema.js +1 -1
  64. package/src/features/integration/integration.service.js +1 -1
  65. package/src/features/inventory/inventory.service.js +1 -1
  66. package/src/features/location/location.handler.js +1 -1
  67. package/src/features/location/location.route.js +1 -1
  68. package/src/features/location/location.schema.js +1 -1
  69. package/src/features/location/location.service.js +1 -1
  70. package/src/features/manufacturer/manufacturer.handler.js +1 -1
  71. package/src/features/manufacturer/manufacturer.route.js +1 -1
  72. package/src/features/manufacturer/manufacturer.schema.js +1 -1
  73. package/src/features/manufacturer/manufacturer.service.js +1 -1
  74. package/src/features/order/emails/order-confirmation.email.js +1 -1
  75. package/src/features/order/emails/order-notification.email.js +1 -1
  76. package/src/features/order/fulfilment.schema.js +1 -1
  77. package/src/features/order/order-fulfillment.service.js +1 -1
  78. package/src/features/order/order.handler.js +1 -1
  79. package/src/features/order/order.route.js +1 -1
  80. package/src/features/order/order.schema.js +1 -1
  81. package/src/features/order/order.service.js +1 -1
  82. package/src/features/order/recipient.schema.js +1 -1
  83. package/src/features/organization/legal-entity.schema.js +1 -1
  84. package/src/features/organization/organization-configuration.schema.d.ts +2 -0
  85. package/src/features/organization/organization-configuration.schema.js +1 -1
  86. package/src/features/organization/organization.handler.js +1 -1
  87. package/src/features/organization/organization.route.d.ts +5 -0
  88. package/src/features/organization/organization.route.js +1 -1
  89. package/src/features/organization/organization.schema.d.ts +2 -0
  90. package/src/features/organization/organization.schema.js +1 -1
  91. package/src/features/organization/organization.service.d.ts +4 -0
  92. package/src/features/organization/organization.service.js +1 -1
  93. package/src/features/payment/payment-webhook.service.js +1 -1
  94. package/src/features/payment/payment.handler.js +1 -1
  95. package/src/features/payment/payment.route.js +1 -1
  96. package/src/features/payment/payment.schema.js +1 -1
  97. package/src/features/payment/payment.service.js +1 -1
  98. package/src/features/payment/stripe.service.js +1 -1
  99. package/src/features/product/product-modifier.schema.js +1 -1
  100. package/src/features/product/product.handler.js +1 -1
  101. package/src/features/product/product.route.js +1 -1
  102. package/src/features/product/product.schema.js +1 -1
  103. package/src/features/product/product.service.js +1 -1
  104. package/src/features/product-category/product-category.handler.js +1 -1
  105. package/src/features/product-category/product-category.route.js +1 -1
  106. package/src/features/product-category/product-category.schema.js +1 -1
  107. package/src/features/product-category/product-category.service.js +1 -1
  108. package/src/features/reservation/emails/reservation-cancellation.email.js +1 -1
  109. package/src/features/reservation/emails/reservation-confirmation.email.js +1 -1
  110. package/src/features/reservation/emails/reservation-email-date.d.ts +2 -0
  111. package/src/features/reservation/emails/reservation-email-date.js +1 -0
  112. package/src/features/reservation/emails/reservation-notification.email.js +1 -1
  113. package/src/features/reservation/emails/reservation-updated.email.js +1 -1
  114. package/src/features/reservation/reservation.handler.js +1 -1
  115. package/src/features/reservation/reservation.route.js +1 -1
  116. package/src/features/reservation/reservation.schema.js +1 -1
  117. package/src/features/reservation/reservation.service.js +1 -1
  118. package/src/features/shipping/shipping.handler.js +1 -1
  119. package/src/features/shipping/shipping.route.js +1 -1
  120. package/src/features/shipping/shipping.service.js +1 -1
  121. package/src/features/shipping-method/shipping-method.handler.js +1 -1
  122. package/src/features/shipping-method/shipping-method.route.js +1 -1
  123. package/src/features/shipping-method/shipping-method.schema.js +1 -1
  124. package/src/features/shipping-method/shipping-method.service.js +1 -1
  125. package/src/features/shipping-method/shipping-zone.schema.js +1 -1
  126. package/src/features/webhook/webhook.handler.js +1 -1
  127. package/src/features/webhook/webhook.route.js +1 -1
  128. package/src/index.js +1 -1
  129. package/src/integrations/next.js +1 -1
  130. package/src/schemas/address.schema.js +1 -1
  131. package/src/schemas/currency.schema.js +1 -1
  132. package/src/schemas/error.schema.js +1 -1
  133. package/src/schemas/index.d.ts +1 -0
  134. package/src/schemas/index.js +1 -1
  135. package/src/schemas/locales.schema.js +1 -1
  136. package/src/schemas/number.schema.js +1 -1
  137. package/src/schemas/pagination.schema.js +1 -1
  138. package/src/schemas/params.schema.js +1 -1
  139. package/src/schemas/queries.schema.js +1 -1
  140. package/src/schemas/time-zone.schema.d.ts +9 -0
  141. package/src/schemas/time-zone.schema.js +1 -0
@@ -1 +1 @@
1
- const _0x4a808a=_0x4988,_0x1d77d5=_0x4988;function _0x4988(_0x3fab23,_0x2d65ab){_0x3fab23=_0x3fab23-0x16f;const _0x4381ac=_0x4381();let _0x4988b9=_0x4381ac[_0x3fab23];if(_0x4988['GCHPyQ']===undefined){var _0x219e43=function(_0x145adc){const _0x46982f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x23aec6='',_0x1a2dc9='';for(let _0x1b1bc1=0x0,_0x14b5c7,_0x19cdc8,_0x2f4d55=0x0;_0x19cdc8=_0x145adc['charAt'](_0x2f4d55++);~_0x19cdc8&&(_0x14b5c7=_0x1b1bc1%0x4?_0x14b5c7*0x40+_0x19cdc8:_0x19cdc8,_0x1b1bc1++%0x4)?_0x23aec6+=String['fromCharCode'](0xff&_0x14b5c7>>(-0x2*_0x1b1bc1&0x6)):0x0){_0x19cdc8=_0x46982f['indexOf'](_0x19cdc8);}for(let _0x82444b=0x0,_0x5e1ce0=_0x23aec6['length'];_0x82444b<_0x5e1ce0;_0x82444b++){_0x1a2dc9+='%'+('00'+_0x23aec6['charCodeAt'](_0x82444b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1a2dc9);};_0x4988['AUIttn']=_0x219e43,_0x4988['kaMekF']={},_0x4988['GCHPyQ']=!![];}const _0x2139c6=_0x4381ac[0x0],_0x2bd381=_0x3fab23+_0x2139c6,_0x1cbf3b=_0x4988['kaMekF'][_0x2bd381];return!_0x1cbf3b?(_0x4988b9=_0x4988['AUIttn'](_0x4988b9),_0x4988['kaMekF'][_0x2bd381]=_0x4988b9):_0x4988b9=_0x1cbf3b,_0x4988b9;}(function(_0x1da139,_0x44489e){const _0x2948e9=_0x4988,_0xec2455=_0x4988,_0x26d879=_0x1da139();while(!![]){try{const _0x4da787=parseInt(_0x2948e9(0x17f))/0x1+-parseInt(_0xec2455(0x171))/0x2*(-parseInt(_0x2948e9(0x196))/0x3)+parseInt(_0xec2455(0x18e))/0x4+parseInt(_0xec2455(0x18d))/0x5+-parseInt(_0x2948e9(0x176))/0x6*(-parseInt(_0xec2455(0x183))/0x7)+parseInt(_0x2948e9(0x19a))/0x8+-parseInt(_0xec2455(0x195))/0x9*(parseInt(_0xec2455(0x170))/0xa);if(_0x4da787===_0x44489e)break;else _0x26d879['push'](_0x26d879['shift']());}catch(_0x2b7061){_0x26d879['push'](_0x26d879['shift']());}}}(_0x4381,0x7a4d3));import{__awaiter as _0x4d4e86}from'tslib';import{flattenTranslationData as _0x38dadf}from'../../core/utils/zod.util';import{CartDataSchema as _0x1a2c64,LocalizedProductSchema as _0x1526fd}from'../../schemas';class I{constructor(_0x280448,_0x2dd61a){const _0x49be00=_0x4988,_0x5561a3=_0x4988;this[_0x49be00(0x189)]=_0x280448,this[_0x5561a3(0x178)+_0x49be00(0x17c)]=_0x2dd61a;}[_0x4a808a(0x180)+_0x4a808a(0x175)+_0x4a808a(0x197)](_0x3d3926,_0x58f968,_0x5e7a58){return _0x4d4e86(this,void 0x0,void 0x0,function*(){const _0x6d80d2=_0x4988,_0x34882b=_0x4988,_0x5cd751={'nByOm':function(_0x4c36a1,_0x4c43be){return _0x4c36a1!==_0x4c43be;}};var _0x27505c,_0x2bad4c;const _0x248c8a=_0x5e7a58?yield this[_0x6d80d2(0x189)][_0x34882b(0x17a)+_0x6d80d2(0x184)]['findUniq'+'ue']({'where':{'id':_0x5e7a58},'include':{'shippingZones':!0x0}}):null,_0x165afb=_0x3d3926[_0x6d80d2(0x192)]((_0x5a9554,_0xa7774f)=>{const _0x2240a1=_0x6d80d2,_0x315f6f=_0x6d80d2;var _0x326a61,_0x12373b;const _0x3091d1=_0x58f968[_0x2240a1(0x173)](_0x16b92e=>_0x16b92e['id']===_0xa7774f['productI'+'d']);if(!_0x3091d1)return _0x5a9554;const _0xb539dd=(_0x12373b=_0x5cd751['nByOm'](_0x326a61=_0x3091d1[_0x2240a1(0x199)+'edBasePr'+_0x2240a1(0x17b)],null)&&_0x326a61!==void 0x0?_0x326a61:_0x3091d1[_0x315f6f(0x18c)+'e'])!==null&&_0x12373b!==void 0x0?_0x12373b:0x0;return _0x5a9554+_0xb539dd*(_0xa7774f[_0x315f6f(0x177)]||0x1);},0x0),_0x2ae10a=(_0x27505c=_0x248c8a?.[_0x6d80d2(0x17a)+_0x34882b(0x16f)][0x0])===null||_0x27505c===void 0x0?void 0x0:_0x27505c[_0x6d80d2(0x188)];return{'total':_0x165afb+(_0x2ae10a??0x0),'subtotal':_0x165afb,'shipping':(_0x2bad4c=_0x248c8a?.[_0x6d80d2(0x17a)+_0x34882b(0x16f)][0x0])===null||_0x2bad4c===void 0x0?void 0x0:_0x2bad4c[_0x34882b(0x188)]};});}[_0x4a808a(0x187)+_0x1d77d5(0x174)](_0x2420db,_0x116a24,_0x19f023){return _0x4d4e86(this,void 0x0,void 0x0,function*(){const _0x5a7252=_0x4988,_0x3e1174=_0x4988,{locale:_0x3883ba}=_0x19f023,_0x4d63e1=new Set(_0x116a24[_0x5a7252(0x190)][_0x3e1174(0x181)](_0x889cd7=>_0x889cd7[_0x3e1174(0x179)+'d'])),_0x53deda=yield this['prisma'][_0x5a7252(0x191)][_0x3e1174(0x18f)]({'where':{'id':{'in':Array[_0x3e1174(0x172)](_0x4d63e1)},'organizationId':_0x2420db,'deletedAt':null,'publishedAt':{'not':null}},'include':{'translations':_0x3883ba?{'where':{'locale':_0x3883ba}}:!0x0,'images':!0x0,'categories':{'include':{'translations':{'where':{'locale':_0x3883ba}}}},'modifierGroups':{'include':{'translations':{'where':{'locale':_0x3883ba}},'modifiers':!0x0}}}}),_0x3f1dca=this[_0x3e1174(0x178)+'yService'][_0x5a7252(0x17e)+_0x5a7252(0x18a)+'ms'](_0x116a24[_0x5a7252(0x190)],_0x53deda[_0x5a7252(0x181)](_0x45922e=>({'id':_0x45922e['id'],'availableQuantity':_0x45922e[_0x3e1174(0x186)+_0x3e1174(0x185)+'y']}))),_0x3ba83b=yield this[_0x3e1174(0x180)+_0x5a7252(0x175)+_0x3e1174(0x197)](_0x3f1dca['normaliz'+_0x3e1174(0x193)],_0x53deda,_0x116a24[_0x3e1174(0x17a)+'MethodId']);return _0x1a2c64[_0x3e1174(0x194)](Object[_0x3e1174(0x18b)](Object[_0x3e1174(0x18b)]({},_0x3ba83b),{'adjustments':_0x3f1dca[_0x5a7252(0x198)+_0x5a7252(0x19b)],'invalidProductIds':_0x3f1dca[_0x5a7252(0x17d)+_0x5a7252(0x182)+'s'],'normalizedItems':_0x3f1dca[_0x3e1174(0x17e)+_0x5a7252(0x193)],'products':_0x53deda['reduce']((_0x47a133,_0x1dbda5)=>(_0x47a133[_0x1dbda5['id']]=_0x1526fd[_0x3e1174(0x194)](_0x38dadf(_0x1dbda5)),_0x47a133),{})}));});}}export{I as CartService};function _0x4381(){const _0x4c6550=['ChjVzhvJDa','CMvKDwnL','zwrjDgvTCW','CgfYC2u','oxDIu1rcDW','mti2ue1OuerI','zwfRzg93BG','ywrQDxn0Bwu','zgLZy291BNq','mZeWmtKZnKXTz2Xdzq','BNrZ','wM9Uzxm','mJiWmZy3mZbJDuzmD0O','mty4ntrquwrWwwS','zNjVBq','zMLUza','yxrH','zvbYAwnLqNi','odKWmdrmu2LItLa','CxvHBNrPDhK','Aw52zw50B3i','ChjVzhvJDeK','C2HPChbPBMC','AwnL','EvnLCNzPy2u','Aw52ywXPzfa','BM9YBwfSAxO','mJy5nZm1B0f2AML0','y2fSy3vSyxq','BwfW','CM9KDwn0swq','mZCXuvL4AvPp','twv0Ag9K','zvf1yw50Axq','yxzHAwXHyMW','z2v0q2fYDeq','ChjPy2u','ChjPC21H','zunHCNrjDgu','yxnZAwDU','yMfZzvbYAwm','mZq2ndGYnuntBhjRzG','odu2mty4t0X3vLHS','zMLUze1HBNK','AxrLBxm'];_0x4381=function(){return _0x4c6550;};return _0x4381();}
1
+ import{__awaiter as v}from"tslib";import{flattenTranslationData as g}from"../../core/utils/zod.util";import{CartDataSchema as w,LocalizedProductSchema as y}from"../../schemas";class I{constructor(o,n){this.prisma=o,this.inventoryService=n}calculatePriceBreakdown(o,n,l){return v(this,void 0,void 0,function*(){var t,a;const i=l?yield this.prisma.shippingMethod.findUnique({where:{id:l},include:{shippingZones:!0}}):null,r=o.reduce((d,m)=>{var c,u;const p=n.find(f=>f.id===m.productId);if(!p)return d;const h=(u=(c=p.discountedBasePrice)!==null&&c!==void 0?c:p.basePrice)!==null&&u!==void 0?u:0;return d+h*(m.quantity||1)},0),s=(t=i?.shippingZones[0])===null||t===void 0?void 0:t.price;return{total:r+(s??0),subtotal:r,shipping:(a=i?.shippingZones[0])===null||a===void 0?void 0:a.price}})}getCartData(o,n,l){return v(this,void 0,void 0,function*(){const{locale:t}=l,a=new Set(n.items.map(e=>e.productId)),i=yield this.prisma.product.findMany({where:{id:{in:Array.from(a)},organizationId:o,deletedAt:null,publishedAt:{not:null}},include:{translations:t?{where:{locale:t}}:!0,images:!0,categories:{include:{translations:{where:{locale:t}}}},modifierGroups:{include:{translations:{where:{locale:t}},modifiers:!0}}}}),r=this.inventoryService.normalizeCartItems(n.items,i.map(e=>({id:e.id,availableQuantity:e.availableQuantity}))),s=yield this.calculatePriceBreakdown(r.normalizedItems,i,n.shippingMethodId);return w.parse(Object.assign(Object.assign({},s),{adjustments:r.adjustments,invalidProductIds:r.invalidProductIds,normalizedItems:r.normalizedItems,products:i.reduce((e,d)=>(e[d.id]=y.parse(g(d)),e),{})}))})}}export{I as CartService};
@@ -1 +1 @@
1
- (function(_0x46f4e1,_0x5ecdfe){const _0x9c2f92=_0x524a,_0x1222d2=_0x524a,_0x2ebd75=_0x46f4e1();while(!![]){try{const _0x3ce92d=-parseInt(_0x9c2f92(0x122))/0x1+-parseInt(_0x9c2f92(0x116))/0x2+-parseInt(_0x1222d2(0x11c))/0x3+-parseInt(_0x1222d2(0x123))/0x4+parseInt(_0x9c2f92(0x129))/0x5+-parseInt(_0x1222d2(0x12b))/0x6*(parseInt(_0x9c2f92(0x10f))/0x7)+-parseInt(_0x1222d2(0x113))/0x8*(-parseInt(_0x9c2f92(0x115))/0x9);if(_0x3ce92d===_0x5ecdfe)break;else _0x2ebd75['push'](_0x2ebd75['shift']());}catch(_0xc3b222){_0x2ebd75['push'](_0x2ebd75['shift']());}}}(_0x3bae,0x1fd7d));function _0x524a(_0x60f4ec,_0x327623){_0x60f4ec=_0x60f4ec-0x10f;const _0x3baefd=_0x3bae();let _0x524ad8=_0x3baefd[_0x60f4ec];if(_0x524a['WmEaJV']===undefined){var _0x2d4c72=function(_0x4c63e0){const _0x555a85='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5bf8ba='',_0x48638c='';for(let _0x3f6379=0x0,_0x2a193a,_0x5566b4,_0x6d8042=0x0;_0x5566b4=_0x4c63e0['charAt'](_0x6d8042++);~_0x5566b4&&(_0x2a193a=_0x3f6379%0x4?_0x2a193a*0x40+_0x5566b4:_0x5566b4,_0x3f6379++%0x4)?_0x5bf8ba+=String['fromCharCode'](0xff&_0x2a193a>>(-0x2*_0x3f6379&0x6)):0x0){_0x5566b4=_0x555a85['indexOf'](_0x5566b4);}for(let _0x2e1f02=0x0,_0x1be761=_0x5bf8ba['length'];_0x2e1f02<_0x1be761;_0x2e1f02++){_0x48638c+='%'+('00'+_0x5bf8ba['charCodeAt'](_0x2e1f02)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x48638c);};_0x524a['gUpmYF']=_0x2d4c72,_0x524a['OMpzrJ']={},_0x524a['WmEaJV']=!![];}const _0x2fc55f=_0x3baefd[0x0],_0x4a468e=_0x60f4ec+_0x2fc55f,_0x2bc8da=_0x524a['OMpzrJ'][_0x4a468e];return!_0x2bc8da?(_0x524ad8=_0x524a['gUpmYF'](_0x524ad8),_0x524a['OMpzrJ'][_0x4a468e]=_0x524ad8):_0x524ad8=_0x2bc8da,_0x524ad8;}function _0x3bae(){const _0x32fb6b=['mty4mtG2veTvr1vf','ntaZmJy4DgrVuKft','yxbZAg90swq','Bw9KAwzPzxi','DgL0Bgu','r3jVDxbZ','AM9PBG','mZK2mZqWAeD4Du9g','BgvUz3rO','mtaYC0rts2vI','zM9YrwfJAa','ChjPy2u','nJG3mtLsChP5ywC','uhjVzhvJDca','ChjVzhvJDa','DhjHBNnSyxq','nZyZnJbVBevwwvy','D2L0Acbjrca','ode5seDUBvjo','ndy5ndiYuvvbrfPU','zMLUzfvUAxe','ig5VDcbMB3u','Aw9UCW','yMfZzvbYAwm','zMLUza','mZy1ndKZBu9kzhzk','ChjVzhvJDeK','Bg9JywXL','ChvZAa','BwfW','CxvHBNrPDhK'];_0x3bae=function(){return _0x32fb6b;};return _0x3bae();}import{__awaiter as _0x5b2a2d}from'tslib';export const transformCartItemToOrderItem=_0x20cc93=>_0x39cfff=>_0x5b2a2d(void 0x0,void 0x0,void 0x0,function*(){const _0x5e6f1e=_0x524a,_0x22fc3a=_0x524a,_0x16e8b6=yield _0x20cc93[_0x5e6f1e(0x111)][_0x22fc3a(0x117)+'ue']({'where':{'id':_0x39cfff[_0x5e6f1e(0x11d)+'d']},'include':{'translations':!0x0,'modifierGroups':{'include':{'translations':!0x0,'modifiers':!0x0}},'images':!0x0}});if(!_0x16e8b6)throw new Error(_0x5e6f1e(0x110)+_0x22fc3a(0x114)+_0x39cfff[_0x22fc3a(0x11d)+'d']+(_0x5e6f1e(0x118)+'nd'));const _0x3d51ee=_0x16e8b6['images'][0x0];let _0x5af8c5=_0x16e8b6[_0x22fc3a(0x11a)+'e'];const _0x30c108=_0x16e8b6[_0x5e6f1e(0x112)+_0x22fc3a(0x119)][_0x22fc3a(0x120)](_0x2fd247=>{const _0x2af287=_0x5e6f1e,_0x4815d3=_0x5e6f1e,_0x228197=[];_0x39cfff[_0x2af287(0x125)+_0x2af287(0x127)][_0x2af287(0x12c)](_0x2e3802=>{const _0x4866ca=_0x2af287,_0x29b860=_0x2af287;var _0x57d2dc;const _0x5bf322=_0x16e8b6[_0x4866ca(0x125)+'Groups'][_0x4866ca(0x11b)](_0xedcfe6=>_0xedcfe6['id']===_0x2e3802['id']);if(_0x5bf322){const _0x1c4654=_0x5bf322['translat'+_0x4866ca(0x119)]['find'](_0x15dabd=>_0x15dabd[_0x29b860(0x11e)]===_0x2fd247[_0x4866ca(0x11e)]),_0x4d95e6=[];_0x2e3802[_0x29b860(0x125)+'s'][_0x29b860(0x12c)](_0x356b2e=>{const _0x32d049=_0x29b860,_0x4fb58d=_0x29b860,_0x2586e3=_0x5bf322[_0x32d049(0x125)+'s']['find'](_0x1e783a=>_0x1e783a['id']===_0x356b2e['id']);_0x2586e3&&(_0x5af8c5+=_0x2586e3[_0x4fb58d(0x12d)]*_0x356b2e['quantity'],_0x4d95e6[_0x4fb58d(0x11f)](''+_0x2586e3[_0x32d049(0x126)]+(_0x356b2e['quantity']>0x1?'\x20('+_0x356b2e[_0x32d049(0x121)]+'x)':'')));}),_0x4d95e6[_0x4866ca(0x12a)]>0x0&&_0x228197['push']((_0x1c4654?.[_0x4866ca(0x126)]||((_0x57d2dc=_0x5bf322['translat'+_0x29b860(0x119)][0x0])===null||_0x57d2dc===void 0x0?void 0x0:_0x57d2dc[_0x4866ca(0x126)])||'')+':\x20'+_0x4d95e6[_0x4866ca(0x128)](',\x20'));}});const _0x31cf57=_0x228197[_0x2af287(0x128)](',\x20');return{'locale':_0x2fd247[_0x4815d3(0x11e)],'title':_0x2fd247[_0x4815d3(0x126)]||'','subtitle':_0x31cf57||''};}),_0x180f80=_0x39cfff[_0x22fc3a(0x121)]||0x1,_0x485bd2=_0x5af8c5*_0x180f80;return{'translations':{'create':_0x30c108},'unitPrice':_0x5af8c5,'totalPrice':_0x485bd2,'quantity':_0x180f80,'rawData':_0x39cfff,'imageId':_0x3d51ee?.['id'],'productSnapshotId':_0x16e8b6['latestSn'+_0x22fc3a(0x124)]};});
1
+ import{__awaiter as q}from"tslib";export const transformCartItemToOrderItem=m=>o=>q(void 0,void 0,void 0,function*(){const t=yield m.product.findUnique({where:{id:o.productId},include:{translations:!0,modifierGroups:{include:{translations:!0,modifiers:!0}},images:!0}});if(!t)throw new Error(`Product with ID ${o.productId} not found`);const e=t.images[0];let s=t.basePrice;const h=t.translations.map(d=>{const f=[];o.modifierGroups.forEach(p=>{var a;const r=t.modifierGroups.find(n=>n.id===p.id);if(r){const n=r.translations.find(i=>i.locale===d.locale),u=[];p.modifiers.forEach(i=>{const l=r.modifiers.find(g=>g.id===i.id);l&&(s+=l.price*i.quantity,u.push(`${l.title}${i.quantity>1?` (${i.quantity}x)`:""}`))}),u.length>0&&f.push(`${n?.title||((a=r.translations[0])===null||a===void 0?void 0:a.title)||""}: ${u.join(", ")}`)}});const I=f.join(", ");return{locale:d.locale,title:d.title||"",subtitle:I||""}}),c=o.quantity||1,v=s*c;return{translations:{create:h},unitPrice:s,totalPrice:v,quantity:c,rawData:o,imageId:e?.id,productSnapshotId:t.latestSnapshotId}});
@@ -1 +1 @@
1
- (function(_0x1aade3,_0x539b30){const _0x4a17ae=_0x2231,_0x6f64a2=_0x2231,_0x10eaae=_0x1aade3();while(!![]){try{const _0x27b1ac=parseInt(_0x4a17ae(0x1a0))/0x1+parseInt(_0x4a17ae(0x1a4))/0x2+parseInt(_0x4a17ae(0x1ad))/0x3+parseInt(_0x4a17ae(0x1ac))/0x4+parseInt(_0x6f64a2(0x1a7))/0x5*(-parseInt(_0x4a17ae(0x1af))/0x6)+-parseInt(_0x4a17ae(0x19f))/0x7+parseInt(_0x6f64a2(0x199))/0x8*(-parseInt(_0x4a17ae(0x1a1))/0x9);if(_0x27b1ac===_0x539b30)break;else _0x10eaae['push'](_0x10eaae['shift']());}catch(_0x1dfbfd){_0x10eaae['push'](_0x10eaae['shift']());}}}(_0x4108,0x6ed13));import{__awaiter as _0x491e2e}from'tslib';import{createApiRouter as _0x5bf091}from'../../core/hono/hono';import{customerRoute as _0xa6e38d}from'./customer.route';function _0x4108(){const _0xb88542=['CMvX','mtGXnJy2oezdsfvxwa','nZqWnZKXt29Pu2jr','ntrfB0XbEMu','DMfSAwq','B3jNyw5PEMe','mti1nZaXofHTvMTkDG','z2v0q3vZDg8','ANnVBG','ndb6z3Pqv2S','B3bLBMfWAq','yxv0Aa','BwvYCW','BwvY','mtm0otGXmM9JCK9fuq','mJyXmZy3mMX1BNvNzG','CMvHza','mZC4mJq2uxfqqwXi','mtGXmZyYnenqyNPWAa','CgfYyw0','z2v0','CxvLCNK','DgLVBKLK'];_0x4108=function(){return _0xb88542;};return _0x4108();}function _0x2231(_0x479f3f,_0x3e7ea8){_0x479f3f=_0x479f3f-0x199;const _0x4108f4=_0x4108();let _0x2231ab=_0x4108f4[_0x479f3f];if(_0x2231['yAfCIj']===undefined){var _0x27c5ee=function(_0xac1ceb){const _0x1502b3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x6be963='',_0x2dce0e='';for(let _0x319632=0x0,_0x1b96dc,_0x44f405,_0x4152a9=0x0;_0x44f405=_0xac1ceb['charAt'](_0x4152a9++);~_0x44f405&&(_0x1b96dc=_0x319632%0x4?_0x1b96dc*0x40+_0x44f405:_0x44f405,_0x319632++%0x4)?_0x6be963+=String['fromCharCode'](0xff&_0x1b96dc>>(-0x2*_0x319632&0x6)):0x0){_0x44f405=_0x1502b3['indexOf'](_0x44f405);}for(let _0x5859a1=0x0,_0x23dddf=_0x6be963['length'];_0x5859a1<_0x23dddf;_0x5859a1++){_0x2dce0e+='%'+('00'+_0x6be963['charCodeAt'](_0x5859a1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2dce0e);};_0x2231['yZCVSO']=_0x27c5ee,_0x2231['kOeIwb']={},_0x2231['yAfCIj']=!![];}const _0x3633f4=_0x4108f4[0x0],_0x1bf3e1=_0x479f3f+_0x3633f4,_0x41167e=_0x2231['kOeIwb'][_0x1bf3e1];return!_0x41167e?(_0x2231ab=_0x2231['yZCVSO'](_0x2231ab),_0x2231['kOeIwb'][_0x1bf3e1]=_0x2231ab):_0x2231ab=_0x41167e,_0x2231ab;}export const registerCustomerHandlers=_0x31729b=>{const _0x355510=_0x2231,_0x179282=_0x2231,_0x9b89eb={'nvMpN':_0x355510(0x1ae)},_0xcc483f=_0x5bf091();return _0xcc483f[_0x355510(0x1a8)](_0xa6e38d[_0x355510(0x1a5)+_0x179282(0x1aa)],_0x5c2fb1=>_0x491e2e(void 0x0,void 0x0,void 0x0,function*(){const _0x57d7dc=_0x355510,_0x2433fb=_0x355510,_0x3daf43=_0x5c2fb1[_0x57d7dc(0x19b)](_0x2433fb(0x1a9)),_0x2d67a7=_0x5c2fb1[_0x2433fb(0x19e)][_0x57d7dc(0x1a2)](_0x2433fb(0x19a)),_0x940c56=_0x5c2fb1[_0x2433fb(0x19e)][_0x57d7dc(0x1a2)](_0x2433fb(0x19c));yield _0x3daf43['isGrante'+'d'](_0x9b89eb['nvMpN']);const _0x1ec3ef=yield _0x31729b['getCusto'+_0x2433fb(0x1aa)](_0x2d67a7[_0x57d7dc(0x1a3)+'tionId'],_0x940c56);return _0x5c2fb1[_0x2433fb(0x1a6)](_0x1ec3ef,0xc8);})),_0xcc483f[_0x179282(0x1a8)](_0xa6e38d[_0x179282(0x1a5)+_0x355510(0x1ab)],_0x13396d=>_0x491e2e(void 0x0,void 0x0,void 0x0,function*(){const _0x5833a9=_0x355510,_0x368b55=_0x355510,_0x14c650=_0x13396d[_0x5833a9(0x19b)](_0x368b55(0x1a9)),_0x3dd76f=_0x13396d['req'][_0x368b55(0x1a2)]('param');yield _0x14c650['isGrante'+'d'](_0x368b55(0x1ae));const _0x277ef4=yield _0x31729b[_0x5833a9(0x1a5)+_0x368b55(0x1ab)](_0x3dd76f['organiza'+_0x5833a9(0x19d)],_0x3dd76f['id']);return _0x13396d[_0x368b55(0x1a6)](_0x277ef4,0xc8);})),_0xcc483f;};
1
+ import{__awaiter as n}from"tslib";import{createApiRouter as u}from"../../core/hono/hono";import{customerRoute as s}from"./customer.route";export const registerCustomerHandlers=i=>{const r=u();return r.openapi(s.getCustomers,t=>n(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param"),a=t.req.valid("query");yield e.isGranted("read");const d=yield i.getCustomers(o.organizationId,a);return t.json(d,200)})),r.openapi(s.getCustomer,t=>n(void 0,void 0,void 0,function*(){const e=t.get("auth"),o=t.req.valid("param");yield e.isGranted("read");const a=yield i.getCustomer(o.organizationId,o.id);return t.json(a,200)})),r};
@@ -1 +1 @@
1
- const _0x43c8c7=_0x3726,_0x40a322=_0x3726;(function(_0xccfb4f,_0x1d9918){const _0x51eb22=_0x3726,_0x51d8f2=_0x3726,_0x3291dc=_0xccfb4f();while(!![]){try{const _0x3b78c9=-parseInt(_0x51eb22(0x15c))/0x1+-parseInt(_0x51eb22(0x161))/0x2*(parseInt(_0x51eb22(0x17f))/0x3)+parseInt(_0x51eb22(0x17c))/0x4+parseInt(_0x51eb22(0x176))/0x5+parseInt(_0x51eb22(0x17e))/0x6*(parseInt(_0x51eb22(0x184))/0x7)+-parseInt(_0x51eb22(0x160))/0x8*(parseInt(_0x51d8f2(0x17a))/0x9)+parseInt(_0x51eb22(0x179))/0xa*(parseInt(_0x51d8f2(0x181))/0xb);if(_0x3b78c9===_0x1d9918)break;else _0x3291dc['push'](_0x3291dc['shift']());}catch(_0x24b353){_0x3291dc['push'](_0x3291dc['shift']());}}}(_0x2375,0x5032c));function _0x2375(){const _0x46e0df=['r2v0ien1C3q','ndC4mhHrCNnRAq','mJa5n2PsuvPPyG','ihbSywnLzca','mtu4ndK0ogXkq290DG','D2HVigHHDMu','mJq3mJCWogLowxb0CW','mty0otCZm3LyBfbmBa','q3vZDg9Tzxi','mtGWntf0wKPntNK','yxjYyxK','r0vu','n2LPu2zdyq','zxnLCNzHDgK','DxnLCL8XmJm','zxiGChjVzMK','rMv0y2HLCYa','yxrPB24','BIbPBIb0Agu','nJi5mZi2BxDXrKXc','ndu2nZG5','ysbJDxn0B20','z2v0q3vZDg8','ody3mKDqreHpDG','mKntse14Cq','CgfNAw5HDgu','vgHLihvZzxi','BwvYCW','B25ZigzVCIa','B21LCNm','ieLe','zxiGB3iGCMu','CxvPCMvK','BML6yxrPB24','C2vYDMf0Aw8','C3rYAw5N','EMf0Aw9Uswq','l2n1C3rVBwu','DgHLig9Yz2e','lZPVCMDHBMK','ig9Yz2fUAxO','B3bLBMfWAq','AwqGAxmGCMu','ywXSig9Yzgu','ig9UzsbVCMq','odm3nZqWqwv5v3zN','CNmGyw5Kihi'];_0x2375=function(){return _0x46e0df;};return _0x2375();}import{z as _0x34bbc7}from'@hono/zod-openapi';import{createApiRoute as _0x2428e8}from'../../core/hono/hono';import{AdminCustomerDetailSchema as _0x8666b7,AdminCustomerSchema as _0x12aac3,CustomerListQuerySchema as _0x484442,ErrorSchema as _0xfc9b86,HeaderSchema as _0x1cfdd8,OrganizationParams as _0x13d375,PaginationMetaSchema as _0x58bf51}from'../../schemas';const u=_0x13d375['extend']({'id':_0x34bbc7[_0x43c8c7(0x16c)]()['min'](0x1,_0x40a322(0x173)+_0x40a322(0x169))[_0x43c8c7(0x172)]({'example':_0x43c8c7(0x186)+_0x40a322(0x15d),'description':_0x43c8c7(0x163)+_0x43c8c7(0x167)})}),d=_0x2428e8({'description':_0x43c8c7(0x159)+_0x43c8c7(0x162)+'d\x20users\x20'+_0x40a322(0x17d)+_0x40a322(0x17b)+'at\x20least'+_0x40a322(0x175)+_0x40a322(0x168)+_0x43c8c7(0x16b)+_0x40a322(0x15b)+_0x43c8c7(0x171)+_0x40a322(0x15a),'headers':_0x1cfdd8,'method':_0x40a322(0x183),'operationId':_0x40a322(0x15f)+_0x43c8c7(0x164),'path':_0x43c8c7(0x170)+_0x43c8c7(0x16d)+_0x40a322(0x16e)+'rs','pathParams':_0x13d375,'query':_0x484442,'responses':{0xc8:_0x34bbc7['object']({'list':_0x34bbc7[_0x43c8c7(0x182)](_0x12aac3),'meta':_0x58bf51}),0x190:_0xfc9b86,0x191:_0xfc9b86,0x194:_0xfc9b86},'summary':_0x43c8c7(0x178)+_0x43c8c7(0x166),'tags':[_0x40a322(0x180)]}),c=_0x2428e8({'description':_0x40a322(0x159)+_0x40a322(0x15e)+_0x40a322(0x158)+'le\x20with\x20'+_0x43c8c7(0x174)+_0x43c8c7(0x177)+_0x40a322(0x185)+_0x40a322(0x165)+_0x43c8c7(0x16f)+_0x40a322(0x16a),'headers':_0x1cfdd8,'method':_0x43c8c7(0x183),'operationId':_0x43c8c7(0x15f)+'mer','path':_0x43c8c7(0x170)+_0x43c8c7(0x16d)+_0x43c8c7(0x16e)+'rs/:id','pathParams':u,'responses':{0xc8:_0x8666b7,0x190:_0xfc9b86,0x191:_0xfc9b86,0x194:_0xfc9b86},'summary':_0x40a322(0x178)+'omer','tags':[_0x43c8c7(0x180)]});function _0x3726(_0x5545c7,_0x349990){_0x5545c7=_0x5545c7-0x158;const _0x2375cb=_0x2375();let _0x3726c6=_0x2375cb[_0x5545c7];if(_0x3726['wFIRrb']===undefined){var _0x376b35=function(_0x4d169f){const _0x5835ab='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x34bbc7='',_0x2428e8='';for(let _0x8666b7=0x0,_0x12aac3,_0x484442,_0xfc9b86=0x0;_0x484442=_0x4d169f['charAt'](_0xfc9b86++);~_0x484442&&(_0x12aac3=_0x8666b7%0x4?_0x12aac3*0x40+_0x484442:_0x484442,_0x8666b7++%0x4)?_0x34bbc7+=String['fromCharCode'](0xff&_0x12aac3>>(-0x2*_0x8666b7&0x6)):0x0){_0x484442=_0x5835ab['indexOf'](_0x484442);}for(let _0x1cfdd8=0x0,_0x13d375=_0x34bbc7['length'];_0x1cfdd8<_0x13d375;_0x1cfdd8++){_0x2428e8+='%'+('00'+_0x34bbc7['charCodeAt'](_0x1cfdd8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2428e8);};_0x3726['KaMTOU']=_0x376b35,_0x3726['JSWFEN']={},_0x3726['wFIRrb']=!![];}const _0x3e398b=_0x2375cb[0x0],_0x19558f=_0x5545c7+_0x3e398b,_0x3fd301=_0x3726['JSWFEN'][_0x19558f];return!_0x3fd301?(_0x3726c6=_0x3726['KaMTOU'](_0x3726c6),_0x3726['JSWFEN'][_0x19558f]=_0x3726c6):_0x3726c6=_0x3fd301,_0x3726c6;}export const customerRoute={'getCustomer':c,'getCustomers':d};
1
+ import{z as t}from"@hono/zod-openapi";import{createApiRoute as r}from"../../core/hono/hono";import{AdminCustomerDetailSchema as a,AdminCustomerSchema as m,CustomerListQuerySchema as i,ErrorSchema as e,HeaderSchema as o,OrganizationParams as s,PaginationMetaSchema as n}from"../../schemas";const u=s.extend({id:t.string().min(1,"id is required").openapi({example:"user_123456789",description:"The user ID"})}),d=r({description:"Fetches paginated users who have placed at least one order or reservation in the organization",headers:o,method:"GET",operationId:"getCustomers",path:"/:organizationId/customers",pathParams:s,query:i,responses:{200:t.object({list:t.array(m),meta:n}),400:e,401:e,404:e},summary:"Get Customers",tags:["Customer"]}),c=r({description:"Fetches a customer profile with all orders and reservations for the organization",headers:o,method:"GET",operationId:"getCustomer",path:"/:organizationId/customers/:id",pathParams:u,responses:{200:a,400:e,401:e,404:e},summary:"Get Customer",tags:["Customer"]});export const customerRoute={getCustomer:c,getCustomers:d};
@@ -1 +1 @@
1
- const _0x3f02dd=_0x568a,_0x102541=_0x568a;(function(_0x191fde,_0x2d04d4){const _0x45b526=_0x568a,_0xa48cd0=_0x568a,_0x1ba95d=_0x191fde();while(!![]){try{const _0x63753e=parseInt(_0x45b526(0xad))/0x1+-parseInt(_0x45b526(0xbf))/0x2+-parseInt(_0xa48cd0(0xb7))/0x3*(-parseInt(_0xa48cd0(0xa1))/0x4)+parseInt(_0x45b526(0x9e))/0x5+parseInt(_0xa48cd0(0xa0))/0x6*(parseInt(_0xa48cd0(0xa5))/0x7)+parseInt(_0x45b526(0xb1))/0x8+-parseInt(_0x45b526(0xa3))/0x9;if(_0x63753e===_0x2d04d4)break;else _0x1ba95d['push'](_0x1ba95d['shift']());}catch(_0xa64d4a){_0x1ba95d['push'](_0x1ba95d['shift']());}}}(_0x4104,0xa1a95));function _0x4104(){const _0x2dada5=['ywLS','BNvTyMvY','zgf0zq','Aw50','odC3mdG2ALjTA1bS','BwLU','CMvHDgvKigi','BIb0AgLZig8','odC0mtaWmfHfsvfACa','y2nVDw50ihC','yNKGDgHLigm','zIbYzxnLCNy','zIbVCMrLCNm','Dg9TzxjmAxm','odCWouvNCeTWBG','qwrTAw5dDxm','tNvTyMvYig8','DgLVBG','yxrPB25Zigm','C3rVBwvYigK','Dff1zxj5','oJaWlJaWmfO','mJa3mdK4nLvPsxf0sW','mJaYnI0WmY0','B2jQzwn0','Dg9Tzxjezxq','CMDHBML6yxq','Aw4GDgHPCYa','Esb0AguGy3u','yxmGy3jLyxq','ndK0odC2nw15AeTXEG','yxjYyxK','mtm4BMPyyNjK','mte1nMLstenLsW','Dxn0B21LCIa','mJyXnJG5mZfYALDfwuC','rgf0zsb3Agu','mJq1ntC0u3DVtMv6','B3bLBMfWAq','BIb0AguGy3u','ihbSywnLzca'];_0x4104=function(){return _0x2dada5;};return _0x4104();}import{z as _0x1dcabd}from'@hono/zod-openapi';function _0x568a(_0x39239f,_0x3a499f){_0x39239f=_0x39239f-0x9c;const _0x410444=_0x4104();let _0x568a8d=_0x410444[_0x39239f];if(_0x568a['pBWWgE']===undefined){var _0x59cb2e=function(_0x501121){const _0x37db8f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1dcabd='',_0x194d1f='';for(let _0x2f39d6=0x0,_0x3d92be,_0x1f6b8c,_0x3b929b=0x0;_0x1f6b8c=_0x501121['charAt'](_0x3b929b++);~_0x1f6b8c&&(_0x3d92be=_0x2f39d6%0x4?_0x3d92be*0x40+_0x1f6b8c:_0x1f6b8c,_0x2f39d6++%0x4)?_0x1dcabd+=String['fromCharCode'](0xff&_0x3d92be>>(-0x2*_0x2f39d6&0x6)):0x0){_0x1f6b8c=_0x37db8f['indexOf'](_0x1f6b8c);}for(let _0x4f43fd=0x0,_0xa688ab=_0x1dcabd['length'];_0x4f43fd<_0xa688ab;_0x4f43fd++){_0x194d1f+='%'+('00'+_0x1dcabd['charCodeAt'](_0x4f43fd)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x194d1f);};_0x568a['TkjVAL']=_0x59cb2e,_0x568a['jWxpnG']={},_0x568a['pBWWgE']=!![];}const _0x2f98a3=_0x410444[0x0],_0x11d0cd=_0x39239f+_0x2f98a3,_0x105fc6=_0x568a['jWxpnG'][_0x11d0cd];return!_0x105fc6?(_0x568a8d=_0x568a['TkjVAL'](_0x568a8d),_0x568a['jWxpnG'][_0x11d0cd]=_0x568a8d):_0x568a8d=_0x105fc6,_0x568a8d;}import{UserSchema as _0x194d1f}from'../../core/auth/user.schema';import{PaginationQuerySchema as _0x2f39d6}from'../../schemas/pagination.schema';import{OrderSchema as _0x3d92be}from'../order/order.schema';import{ReservationSchema as _0x1f6b8c}from'../reservation/reservation.schema';export const CustomerListQuerySchema=_0x2f39d6['pick']({'page':!0x0,'limit':!0x0,'search':!0x0})[_0x3f02dd(0xa6)](_0x102541(0xb8)+_0x3f02dd(0xb6)+_0x102541(0xbd)),AdminCustomerSchema=_0x194d1f['extend']({'createdAt':_0x1dcabd[_0x102541(0xab)]()[_0x3f02dd(0xa6)]({'description':_0x102541(0xa4)+_0x102541(0xa7)+'stomer\x20a'+_0x102541(0xb2)+_0x102541(0x9d)+'ed','example':_0x3f02dd(0xc0)+'29T12:00'+_0x3f02dd(0xbe)}),'orderCount':_0x1dcabd[_0x102541(0xaa)]()['int']()[_0x102541(0xae)](0x0)['openapi']({'description':_0x102541(0xb9)+_0x3f02dd(0xb5)+_0x102541(0xa8)+_0x102541(0xb3)+_0x3f02dd(0xa2)+_0x102541(0xc4)+'organiza'+_0x102541(0xba),'example':0x3}),'reservationCount':_0x1dcabd[_0x3f02dd(0xaa)]()[_0x3f02dd(0xac)]()[_0x3f02dd(0xae)](0x0)[_0x3f02dd(0xa6)]({'description':_0x102541(0xb9)+_0x102541(0xb4)+_0x102541(0xbb)+_0x102541(0xaf)+_0x102541(0x9c)+_0x102541(0xbc)+_0x102541(0xb0)+_0x3f02dd(0xc3)+'ion','example':0x2})})[_0x102541(0xa6)](_0x102541(0xb8)+'tomer'),AdminCustomerDetailSchema=_0x1dcabd[_0x3f02dd(0xc1)]({'customer':AdminCustomerSchema,'orders':_0x1dcabd[_0x102541(0x9f)](_0x3d92be),'reservations':_0x1dcabd[_0x3f02dd(0x9f)](_0x1f6b8c)})[_0x3f02dd(0xa6)](_0x3f02dd(0xb8)+_0x102541(0xc2)+_0x3f02dd(0xa9));
1
+ import{z as e}from"@hono/zod-openapi";import{UserSchema as r}from"../../core/auth/user.schema";import{PaginationQuerySchema as t}from"../../schemas/pagination.schema";import{OrderSchema as o}from"../order/order.schema";import{ReservationSchema as i}from"../reservation/reservation.schema";export const CustomerListQuerySchema=t.pick({page:!0,limit:!0,search:!0}).openapi("AdminCustomerListQuery"),AdminCustomerSchema=r.extend({createdAt:e.date().openapi({description:"Date when the customer account was created",example:"2026-03-29T12:00:00.000Z"}),orderCount:e.number().int().min(0).openapi({description:"Number of orders placed by the customer in this organization",example:3}),reservationCount:e.number().int().min(0).openapi({description:"Number of reservations created by the customer in this organization",example:2})}).openapi("AdminCustomer"),AdminCustomerDetailSchema=e.object({customer:AdminCustomerSchema,orders:e.array(o),reservations:e.array(i)}).openapi("AdminCustomerDetail");
@@ -1 +1 @@
1
- const _0x501ce2=_0x33c3,_0x3659d5=_0x33c3;(function(_0x10f9d0,_0x441ad2){const _0x2710c1=_0x33c3,_0x3b05a1=_0x33c3,_0x579c4a=_0x10f9d0();while(!![]){try{const _0x4cea5a=parseInt(_0x2710c1(0x1e3))/0x1*(parseInt(_0x2710c1(0x1de))/0x2)+parseInt(_0x2710c1(0x1df))/0x3+parseInt(_0x3b05a1(0x1c6))/0x4+parseInt(_0x3b05a1(0x1e5))/0x5+-parseInt(_0x3b05a1(0x1d8))/0x6*(-parseInt(_0x2710c1(0x1c3))/0x7)+-parseInt(_0x2710c1(0x1d4))/0x8*(parseInt(_0x3b05a1(0x1d7))/0x9)+-parseInt(_0x2710c1(0x1c0))/0xa*(parseInt(_0x2710c1(0x1bf))/0xb);if(_0x4cea5a===_0x441ad2)break;else _0x579c4a['push'](_0x579c4a['shift']());}catch(_0x1fcafb){_0x579c4a['push'](_0x579c4a['shift']());}}}(_0x431d,0xa8e50));function _0x431d(){const _0x7c59cd=['CgfNAw5HDgu','mZu1nJm2oe9Lru9TzW','BwfW','zMLUze1HBNK','Aw5Zzw5ZAxq','BwvY','Dg9dDxn0B20','BwvYqwn0Axy','jhrYyw5Zywm','CgfYC2u','BwvYu2vHCMm','BwvYq291BNq','q3vZDg9Tzxi','DhjPBq','C2vHCMnO','nZC5mZC1mLjuu01AuW','D2L0AfbHz2u','CMvZzxj2yxq','oxbetLniAG','mZeXneLvuMv4wG','Axr5rMLSDgu','ig5VDcbMB3u','zxjtDw1Tyxi','DxnLCG','ywXS','mJuXnJK2nMzqBgHisW','nZy4ota2De1hAezk','zMLUzezPCNm','AezPBhrLCG','AxzL','mwPvuKvsyq','yxjYyxK','nte2mtm1nuvKAuzWsG','Aw9U','y291BNq','z2v0q3vZDg8','ChjPC21H','mJu0odG3otnzsvLMA1u','mtbLr2rLEuO','zgvZyW','yxnZAwDU','nZm3oe1isxn3za','B3jKzxi'];_0x431d=function(){return _0x7c59cd;};return _0x431d();}function _0x33c3(_0x16dd3f,_0x4c3758){_0x16dd3f=_0x16dd3f-0x1bf;const _0x431da7=_0x431d();let _0x33c367=_0x431da7[_0x16dd3f];if(_0x33c3['jONLOe']===undefined){var _0x208dc7=function(_0x3df684){const _0x18092b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4ee11a='',_0x598d81='';for(let _0x393b9f=0x0,_0x31e06b,_0x23bbab,_0xbbc8f8=0x0;_0x23bbab=_0x3df684['charAt'](_0xbbc8f8++);~_0x23bbab&&(_0x31e06b=_0x393b9f%0x4?_0x31e06b*0x40+_0x23bbab:_0x23bbab,_0x393b9f++%0x4)?_0x4ee11a+=String['fromCharCode'](0xff&_0x31e06b>>(-0x2*_0x393b9f&0x6)):0x0){_0x23bbab=_0x18092b['indexOf'](_0x23bbab);}for(let _0x36f784=0x0,_0x45146d=_0x4ee11a['length'];_0x36f784<_0x45146d;_0x36f784++){_0x598d81+='%'+('00'+_0x4ee11a['charCodeAt'](_0x36f784)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x598d81);};_0x33c3['gitAKW']=_0x208dc7,_0x33c3['saoUDJ']={},_0x33c3['jONLOe']=!![];}const _0x3f161e=_0x431da7[0x0],_0x2bb97a=_0x16dd3f+_0x3f161e,_0x2f1d7f=_0x33c3['saoUDJ'][_0x2bb97a];return!_0x2f1d7f?(_0x33c367=_0x33c3['gitAKW'](_0x33c367),_0x33c3['saoUDJ'][_0x2bb97a]=_0x33c367):_0x33c367=_0x2f1d7f,_0x33c367;}import{__awaiter as _0x599422}from'tslib';import{z as _0x31d78f}from'@hono/zod-openapi';import{HttpException as _0x3fa46c}from'../../core/exceptions/http-exception';import{AdminCustomerDetailSchema as _0xc0adf0,AdminCustomerSchema as _0x62b294,OrderSchema as _0x159c4a,PaginationMetaSchema as _0x5b473c,ReservationSchema as _0x33766c}from'../../schemas';const S={'items':{'include':{'translations':!0x0,'image':!0x0}},'payment':!0x0,'shippingAddress':!0x0,'shippingMethod':{'include':{'shippingZones':!0x0}}};class w{constructor(_0x1289f9){this['prisma']=_0x1289f9;}['getCusto'+'merActiv'+_0x501ce2(0x1d9)+'r'](_0xe08290){return{'OR':[{'orders':{'some':{'organizationId':_0xe08290,'deletedAt':null}}},{'reservations':{'some':{'organizationId':_0xe08290}}}]};}[_0x3659d5(0x1e8)+_0x501ce2(0x1cf)+_0x3659d5(0x1e1)](_0x506ec0){const _0x54c75d=_0x501ce2,_0x1a8d1d=_0x501ce2,_0xd05edb={'JwYov':_0x54c75d(0x1c9)+_0x54c75d(0x1e2)};return{'OR':[{'firstname':{'contains':_0x506ec0,'mode':_0xd05edb['JwYov']}},{'lastname':{'contains':_0x506ec0,'mode':_0x1a8d1d(0x1c9)+'ive'}},{'name':{'contains':_0x506ec0,'mode':_0x54c75d(0x1c9)+'ive'}},{'email':{'contains':_0x506ec0,'mode':_0x1a8d1d(0x1c9)+_0x1a8d1d(0x1e2)}}]};}[_0x501ce2(0x1e8)+'merCount'+'s'](_0x4af9d1,_0x59ebf4){return _0x599422(this,void 0x0,void 0x0,function*(){const _0x35637f=_0x33c3,_0x43dda5=_0x33c3,[_0x228ee1,_0x17d2ae]=yield this[_0x35637f(0x1e9)][_0x35637f(0x1cd)+'tion']([this['prisma'][_0x35637f(0x1c4)][_0x43dda5(0x1e7)]({'where':{'organizationId':_0x4af9d1,'userId':_0x59ebf4,'deletedAt':null}}),this[_0x43dda5(0x1e9)][_0x43dda5(0x1d6)+_0x35637f(0x1e6)]['count']({'where':{'organizationId':_0x4af9d1,'userId':_0x59ebf4}})]);return{'orderCount':_0x228ee1,'reservationCount':_0x17d2ae};});}[_0x501ce2(0x1cb)+_0x501ce2(0x1db)+'y'](_0x5875aa,_0x5683ed){const _0x309bf9=_0x3659d5,_0xc43635=_0x3659d5;return _0x62b294[_0x309bf9(0x1ce)](Object[_0xc43635(0x1c2)](Object[_0xc43635(0x1c2)]({},_0x5875aa),_0x5683ed));}[_0x3659d5(0x1e8)+'mers'](_0x3938d1,_0x4fceae){return _0x599422(this,void 0x0,void 0x0,function*(){const _0x17adb8=_0x33c3,_0x479f09=_0x33c3;var _0x4d67ff;const {page:_0x570b91=0x1,limit:_0x596247=0xa}=_0x4fceae,_0x35b8f7=(_0x4d67ff=_0x4fceae[_0x17adb8(0x1d3)])===null||_0x4d67ff===void 0x0?void 0x0:_0x4d67ff[_0x479f09(0x1d2)](),_0x14bfc1=this[_0x479f09(0x1e8)+'merActiv'+_0x17adb8(0x1d9)+'r'](_0x3938d1),_0x266372=_0x35b8f7?{'AND':[_0x14bfc1,this[_0x17adb8(0x1e8)+_0x479f09(0x1cf)+_0x17adb8(0x1e1)](_0x35b8f7)]}:_0x14bfc1,[_0x404ae5,_0x3094c7]=yield this[_0x479f09(0x1e9)][_0x17adb8(0x1dc)][_0x479f09(0x1c5)]({'where':_0x266372,'orderBy':{'createdAt':'desc'}})[_0x479f09(0x1d5)+'s']({'page':_0x570b91,'limit':_0x596247}),_0x424c3f=yield Promise[_0x17adb8(0x1dd)](_0x404ae5[_0x479f09(0x1c7)](_0x4d42e7=>_0x599422(this,void 0x0,void 0x0,function*(){const _0x2faa21=_0x479f09,_0x4901ea=_0x479f09,_0x2b3c6c=yield this[_0x2faa21(0x1e8)+_0x4901ea(0x1d0)+'s'](_0x3938d1,_0x4d42e7['id']);return this['toCustom'+'erSummar'+'y'](_0x4d42e7,_0x2b3c6c);})));return _0x31d78f['object']({'meta':_0x5b473c,'list':_0x31d78f[_0x17adb8(0x1e4)](_0x62b294)})[_0x17adb8(0x1ce)]({'meta':_0x3094c7,'list':_0x424c3f});});}[_0x501ce2(0x1e8)+_0x501ce2(0x1ca)](_0x561f16,_0x29ee15){return _0x599422(this,void 0x0,void 0x0,function*(){const _0x2b1a9a=_0x33c3,_0x1ce819=_0x33c3,_0x5a7cee=yield this[_0x2b1a9a(0x1e9)][_0x1ce819(0x1dc)][_0x2b1a9a(0x1e0)+'t']({'where':{'AND':[{'id':_0x29ee15},this[_0x2b1a9a(0x1e8)+_0x2b1a9a(0x1cc)+'ityFilte'+'r'](_0x561f16)]}});if(!_0x5a7cee)throw new _0x3fa46c(0x194,_0x1ce819(0x1d1)+_0x1ce819(0x1da)+'nd');const [_0x57aaee,_0x3a1024,_0x2bc1a4]=yield Promise[_0x2b1a9a(0x1dd)]([this[_0x1ce819(0x1e9)][_0x1ce819(0x1c4)][_0x1ce819(0x1c8)]({'where':{'organizationId':_0x561f16,'userId':_0x29ee15,'deletedAt':null},'include':S,'orderBy':{'createdAt':_0x1ce819(0x1c1)}}),this['prisma']['reservat'+'ion'][_0x1ce819(0x1c8)]({'where':{'organizationId':_0x561f16,'userId':_0x29ee15},'orderBy':{'createdAt':'desc'}}),this['getCusto'+_0x1ce819(0x1d0)+'s'](_0x561f16,_0x29ee15)]);return _0xc0adf0[_0x2b1a9a(0x1ce)]({'customer':this[_0x1ce819(0x1cb)+_0x2b1a9a(0x1db)+'y'](_0x5a7cee,_0x2bc1a4),'orders':_0x31d78f[_0x2b1a9a(0x1e4)](_0x159c4a)[_0x2b1a9a(0x1ce)](_0x57aaee),'reservations':_0x31d78f[_0x1ce819(0x1e4)](_0x33766c)['parse'](_0x3a1024)});});}}export{w as CustomerService};
1
+ import{__awaiter as o}from"tslib";import{z as n}from"@hono/zod-openapi";import{HttpException as C}from"../../core/exceptions/http-exception";import{AdminCustomerDetailSchema as y,AdminCustomerSchema as c,OrderSchema as f,PaginationMetaSchema as g,ReservationSchema as A}from"../../schemas";const S={items:{include:{translations:!0,image:!0}},payment:!0,shippingAddress:!0,shippingMethod:{include:{shippingZones:!0}}};class w{constructor(e){this.prisma=e}getCustomerActivityFilter(e){return{OR:[{orders:{some:{organizationId:e,deletedAt:null}}},{reservations:{some:{organizationId:e}}}]}}getCustomerSearchFilter(e){return{OR:[{firstname:{contains:e,mode:"insensitive"}},{lastname:{contains:e,mode:"insensitive"}},{name:{contains:e,mode:"insensitive"}},{email:{contains:e,mode:"insensitive"}}]}}getCustomerCounts(e,t){return o(this,void 0,void 0,function*(){const[r,s]=yield this.prisma.$transaction([this.prisma.order.count({where:{organizationId:e,userId:t,deletedAt:null}}),this.prisma.reservation.count({where:{organizationId:e,userId:t}})]);return{orderCount:r,reservationCount:s}})}toCustomerSummary(e,t){return c.parse(Object.assign(Object.assign({},e),t))}getCustomers(e,t){return o(this,void 0,void 0,function*(){var r;const{page:s=1,limit:m=10}=t,i=(r=t.search)===null||r===void 0?void 0:r.trim(),a=this.getCustomerActivityFilter(e),d=i?{AND:[a,this.getCustomerSearchFilter(i)]}:a,[l,h]=yield this.prisma.user.paginate({where:d,orderBy:{createdAt:"desc"}}).withPages({page:s,limit:m}),p=yield Promise.all(l.map(u=>o(this,void 0,void 0,function*(){const v=yield this.getCustomerCounts(e,u.id);return this.toCustomerSummary(u,v)})));return n.object({meta:g,list:n.array(c)}).parse({meta:h,list:p})})}getCustomer(e,t){return o(this,void 0,void 0,function*(){const r=yield this.prisma.user.findFirst({where:{AND:[{id:t},this.getCustomerActivityFilter(e)]}});if(!r)throw new C(404,"Customer not found");const[s,m,i]=yield Promise.all([this.prisma.order.findMany({where:{organizationId:e,userId:t,deletedAt:null},include:S,orderBy:{createdAt:"desc"}}),this.prisma.reservation.findMany({where:{organizationId:e,userId:t},orderBy:{createdAt:"desc"}}),this.getCustomerCounts(e,t)]);return y.parse({customer:this.toCustomerSummary(r,i),orders:n.array(f).parse(s),reservations:n.array(A).parse(m)})})}}export{w as CustomerService};
@@ -1 +1 @@
1
- function _0x84b7(_0x55dd9a,_0x27a6fb){_0x55dd9a=_0x55dd9a-0x9b;const _0x4124bc=_0x4124();let _0x84b74f=_0x4124bc[_0x55dd9a];if(_0x84b7['jKKzMr']===undefined){var _0x3e06c1=function(_0x390dd3){const _0x2ee1ad='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4c993d='',_0x414794='';for(let _0x4d046c=0x0,_0x36597e,_0x524845,_0x371a36=0x0;_0x524845=_0x390dd3['charAt'](_0x371a36++);~_0x524845&&(_0x36597e=_0x4d046c%0x4?_0x36597e*0x40+_0x524845:_0x524845,_0x4d046c++%0x4)?_0x4c993d+=String['fromCharCode'](0xff&_0x36597e>>(-0x2*_0x4d046c&0x6)):0x0){_0x524845=_0x2ee1ad['indexOf'](_0x524845);}for(let _0x2b0e2f=0x0,_0x4e3ca6=_0x4c993d['length'];_0x2b0e2f<_0x4e3ca6;_0x2b0e2f++){_0x414794+='%'+('00'+_0x4c993d['charCodeAt'](_0x2b0e2f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x414794);};_0x84b7['yUciII']=_0x3e06c1,_0x84b7['PfLheM']={},_0x84b7['jKKzMr']=!![];}const _0x4f766c=_0x4124bc[0x0],_0x1319cb=_0x55dd9a+_0x4f766c,_0x24f3fa=_0x84b7['PfLheM'][_0x1319cb];return!_0x24f3fa?(_0x84b74f=_0x84b7['yUciII'](_0x84b74f),_0x84b7['PfLheM'][_0x1319cb]=_0x84b74f):_0x84b74f=_0x24f3fa,_0x84b74f;}(function(_0x26875c,_0x49bc17){const _0x392232=_0x84b7,_0x32ff89=_0x84b7,_0x4a88f8=_0x26875c();while(!![]){try{const _0x7956f0=-parseInt(_0x392232(0xa6))/0x1*(-parseInt(_0x392232(0xae))/0x2)+-parseInt(_0x32ff89(0xa1))/0x3+parseInt(_0x32ff89(0x9c))/0x4*(-parseInt(_0x392232(0x9f))/0x5)+parseInt(_0x392232(0xa7))/0x6*(parseInt(_0x32ff89(0xa2))/0x7)+-parseInt(_0x392232(0xa4))/0x8+parseInt(_0x32ff89(0xb1))/0x9+parseInt(_0x392232(0xb0))/0xa;if(_0x7956f0===_0x49bc17)break;else _0x4a88f8['push'](_0x4a88f8['shift']());}catch(_0x50c751){_0x4a88f8['push'](_0x4a88f8['shift']());}}}(_0x4124,0x9cfe5));import{__awaiter as _0x12d1ce}from'tslib';import{createApiRouter as _0x1733cc}from'../../core/hono/hono';function _0x4124(){const _0xdb78c3=['mJvMvLHszeS','BxbVCMfYEuy','mZaWntm4nw1hBNDdAG','mZa4mZm2q1nStMDI','BfrVA2vU','ntiYmZq2nejfDLrpqq','CMf3','nfDiwe5xyG','odrUA0H5AfC','BNrvC2vY','B3bLBMfWAq','DMfSAwq','BvfvuNO','CMvX','z2v0','ndaWmdrKDfHfre8','z2v0q3vYCMu','mtyXmdeYnJbRDhn3sey','nZC5mtK5m2DuvKDZuG','ANnVBG','yxv0Aa','z2v0vMvYy2u','nJK5odq4rxr2qNbJ','AwXL','y3jLyxrLvgu'];_0x4124=function(){return _0xdb78c3;};return _0x4124();}import{fileRoute as _0x31c8e1}from'./file.route';export const registerFileHandlers=_0x7d7ba9=>{const _0x1bb4cf=_0x84b7,_0x5065db=_0x84b7,_0x1c20f9={'mQURz':_0x1bb4cf(0xb2)},_0x149caf=_0x1733cc();return _0x149caf[_0x1bb4cf(0xa9)](_0x31c8e1[_0x1bb4cf(0x9b)+_0x5065db(0xa3)],_0x508ac0=>_0x12d1ce(void 0x0,void 0x0,void 0x0,function*(){const _0x54b222=_0x1bb4cf,_0x1470fc=_0x1bb4cf,_0xfcc301=_0x508ac0[_0x54b222(0xac)][_0x54b222(0xaa)](_0x1470fc(0xb2)),_0x5b45d3=yield _0x7d7ba9[_0x1470fc(0x9b)+_0x54b222(0xa3)](_0xfcc301,_0x508ac0[_0x54b222(0xac)][_0x1470fc(0xa5)]);return _0x508ac0['json'](_0x5b45d3,0xc8);})),_0x149caf[_0x5065db(0xa9)](_0x31c8e1[_0x5065db(0x9e)+'mporaryF'+_0x5065db(0x9d)],_0x20cc04=>_0x12d1ce(void 0x0,void 0x0,void 0x0,function*(){const _0x191fd8=_0x5065db,_0x496c6d=_0x5065db,_0x26f506=_0x20cc04[_0x191fd8(0xac)][_0x191fd8(0xaa)](_0x1c20f9[_0x191fd8(0xab)]),_0x187364=yield _0x20cc04[_0x191fd8(0xad)](_0x191fd8(0xb3))[_0x191fd8(0xaf)+_0x496c6d(0xa8)](),_0x479589=yield _0x7d7ba9[_0x496c6d(0x9e)+_0x191fd8(0xa0)+_0x191fd8(0x9d)](_0x187364['id'],_0x26f506);return _0x20cc04['json'](_0x479589,0xc9);})),_0x149caf;};
1
+ import{__awaiter as i}from"tslib";import{createApiRouter as p}from"../../core/hono/hono";import{fileRoute as a}from"./file.route";export const registerFileHandlers=t=>{const o=p();return o.openapi(a.getVercelToken,e=>i(void 0,void 0,void 0,function*(){const r=e.req.valid("json"),n=yield t.getVercelToken(r,e.req.raw);return e.json(n,200)})),o.openapi(a.createTemporaryFile,e=>i(void 0,void 0,void 0,function*(){const r=e.req.valid("json"),s=yield e.get("auth").getCurrentUser(),d=yield t.createTemporaryFile(s.id,r);return e.json(d,201)})),o};
@@ -1 +1 @@
1
- function _0x42b6(_0x5920e8,_0x33c696){_0x5920e8=_0x5920e8-0xd3;const _0x30362a=_0x3036();let _0x42b695=_0x30362a[_0x5920e8];if(_0x42b6['RzIKgF']===undefined){var _0x35479f=function(_0x4a8e0d){const _0x4bb385='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x570d54='',_0x28bc8f='';for(let _0x967c40=0x0,_0x22257a,_0x57540d,_0x317605=0x0;_0x57540d=_0x4a8e0d['charAt'](_0x317605++);~_0x57540d&&(_0x22257a=_0x967c40%0x4?_0x22257a*0x40+_0x57540d:_0x57540d,_0x967c40++%0x4)?_0x570d54+=String['fromCharCode'](0xff&_0x22257a>>(-0x2*_0x967c40&0x6)):0x0){_0x57540d=_0x4bb385['indexOf'](_0x57540d);}for(let _0x4e56c2=0x0,_0x363fc4=_0x570d54['length'];_0x4e56c2<_0x363fc4;_0x4e56c2++){_0x28bc8f+='%'+('00'+_0x570d54['charCodeAt'](_0x4e56c2)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x28bc8f);};_0x42b6['xPgULL']=_0x35479f,_0x42b6['tNJMUI']={},_0x42b6['RzIKgF']=!![];}const _0xa54958=_0x30362a[0x0],_0x4559ea=_0x5920e8+_0xa54958,_0xafff05=_0x42b6['tNJMUI'][_0x4559ea];return!_0xafff05?(_0x42b695=_0x42b6['xPgULL'](_0x42b695),_0x42b6['tNJMUI'][_0x4559ea]=_0x42b695):_0x42b695=_0xafff05,_0x42b695;}const _0xbf30e5=_0x42b6,_0x321d69=_0x42b6;(function(_0x414a52,_0x5d1177){const _0x2de31a=_0x42b6,_0x6851ea=_0x42b6,_0x4cc6bd=_0x414a52();while(!![]){try{const _0x2863c5=parseInt(_0x2de31a(0xdb))/0x1+-parseInt(_0x2de31a(0xd4))/0x2*(parseInt(_0x2de31a(0xe6))/0x3)+parseInt(_0x2de31a(0xed))/0x4*(-parseInt(_0x2de31a(0xd6))/0x5)+-parseInt(_0x6851ea(0xf1))/0x6+-parseInt(_0x6851ea(0xec))/0x7*(parseInt(_0x6851ea(0xda))/0x8)+parseInt(_0x2de31a(0xee))/0x9*(parseInt(_0x2de31a(0xe8))/0xa)+parseInt(_0x6851ea(0xe3))/0xb;if(_0x2863c5===_0x5d1177)break;else _0x4cc6bd['push'](_0x4cc6bd['shift']());}catch(_0x2fd7f4){_0x4cc6bd['push'](_0x4cc6bd['shift']());}}}(_0x3036,0xcce73));import{createApiRoute as _0x570d54}from'../../core/hono/hono';import{CreateTemporaryFileSchema as _0x28bc8f,FileSchema as _0x967c40,GetVercelTokenBody as _0x22257a,GetVercelTokenResponse as _0x57540d,HeaderSchema as _0x317605}from'../../schemas';function _0x3036(){const _0x101c6=['zw1WB3jHCNK','BxbVCMfYEuy','q3jLyxrLCYa','BfrVA2vU','nta5nJe4ntzKAhrPrgm','uMv0DxjUCYa','CM5ZigL0CYa','mJaWmtbIsw5LAfO','ue9tva','mtmWqwXTzwLh','rMLSzq','l2zPBgvZ','z2v0vMvYy2u','mtrLueDbyKC','mZmYsNvrvuTu','odq3nda0tvHeDwLH','q3jLyxrLifq','y2vS','mZq2ntuWnhneB1vmra','r2v0ifzLCMm','ndu0vgPhANvw','ihjLy29Yzca','otuXodvcqNzYEvK','zwWGvg9Rzw4','AwXL','yxj5igzPBgu','nJmWnZq2nePbwMf4Ca','mJmWotCWzKP2z1zf','iezPBgu','y3jLyxrLvgu','ysb0zw1WB3i'];_0x3036=function(){return _0x101c6;};return _0x3036();}const i=_0x570d54({'body':_0x28bc8f,'description':_0xbf30e5(0xe1)+_0x321d69(0xde)+_0xbf30e5(0xd9)+_0x321d69(0xd5)+'and\x20retu'+_0xbf30e5(0xe5)+'ID','headers':_0x317605,'method':_0x321d69(0xe7),'operationId':_0xbf30e5(0xdd)+_0x321d69(0xe0)+_0x321d69(0xd8),'path':_0x321d69(0xea),'responses':{0xc9:_0x967c40},'summary':_0xbf30e5(0xef)+_0xbf30e5(0xdf)+_0xbf30e5(0xdc),'tags':[_0x321d69(0xe9)]}),l=_0x570d54({'body':_0x22257a,'description':_0x321d69(0xe4)+'a\x20Vercel'+'\x20token','headers':_0x317605,'method':_0xbf30e5(0xe7),'operationId':_0x321d69(0xeb)+_0x321d69(0xe2),'path':'/files/t'+'oken/ver'+_0x321d69(0xf0),'responses':{0xc8:_0x57540d,0xcc:null},'summary':_0xbf30e5(0xd3)+_0x321d69(0xd7),'tags':[_0x321d69(0xe9)]});export const fileRoute={'createTemporaryFile':i,'getVercelToken':l};
1
+ import{createApiRoute as e}from"../../core/hono/hono";import{CreateTemporaryFileSchema as o,FileSchema as t,GetVercelTokenBody as a,GetVercelTokenResponse as s,HeaderSchema as r}from"../../schemas";const i=e({body:o,description:"Creates a temporary file record and returns its ID",headers:r,method:"POST",operationId:"createTemporaryFile",path:"/files",responses:{201:t},summary:"Create Temporary File",tags:["File"]}),l=e({body:a,description:"Returns a Vercel token",headers:r,method:"POST",operationId:"getVercelToken",path:"/files/token/vercel",responses:{200:s,204:null},summary:"Get Vercel Token",tags:["File"]});export const fileRoute={createTemporaryFile:i,getVercelToken:l};
@@ -1 +1 @@
1
- const _0x367060=_0x37e3,_0x4eabce=_0x37e3;(function(_0x2a6aea,_0x2db296){const _0x3a08a0=_0x37e3,_0x517387=_0x37e3,_0x9ec103=_0x2a6aea();while(!![]){try{const _0x108905=parseInt(_0x3a08a0(0x72))/0x1*(parseInt(_0x3a08a0(0xa5))/0x2)+-parseInt(_0x3a08a0(0x8f))/0x3*(parseInt(_0x3a08a0(0x9f))/0x4)+-parseInt(_0x3a08a0(0x7a))/0x5*(-parseInt(_0x517387(0x8d))/0x6)+parseInt(_0x517387(0x77))/0x7*(parseInt(_0x3a08a0(0xa2))/0x8)+parseInt(_0x517387(0x87))/0x9*(-parseInt(_0x3a08a0(0x9b))/0xa)+parseInt(_0x517387(0xa4))/0xb*(-parseInt(_0x3a08a0(0x84))/0xc)+-parseInt(_0x517387(0x7b))/0xd*(-parseInt(_0x3a08a0(0x80))/0xe);if(_0x108905===_0x2db296)break;else _0x9ec103['push'](_0x9ec103['shift']());}catch(_0x4693a2){_0x9ec103['push'](_0x9ec103['shift']());}}}(_0x2671,0xe52f6));import{z as _0x525e58}from'@hono/zod-openapi';function _0x2671(){const _0x3ad6fb=['odmXnZqZoxPJwvbgDa','zsbVzIb0Agu','ndmYmtbHyMm','DhLWzq','B2jQzwn0','mtr0DhnztLC','EMf0Aw9U','zsbVCMDHBMK','C3rYAw5N','mZzQA3fqEwe','zgLZy3jPBwK','AwvUDc10B2S','odi5odLtzfLowuy','BNvTyMvY','u2L6zsbVzIa','rMLSzw5HBwu','BMf0zwrvBMK','y2XTmtiZndu','mtu2y2H4BhL3','B3b0Aw9UywW','m0jIwhv4sq','tMfTzsbVzIa','yMXVyI5Nzw4','l2zPBgu','BwLU','CMvXDwLYzwq','BNvSBgfIBgu','l3bHDgGVDg8','B2fKlwnVBxa','vxbSB2fKzwq','rMLSzq','igLUigj5Dgu','mtC1me9wzunsuq','B3bLBMfWAq','ugf0AcbVzIa','suqGB2yGDgG','odC0mZzUEwvPy2O','DgHLigzPBgu','Aw1Hz2uVCg4','ndGWodaXnMDvsgTXrq','BgL0zxjHBa','mZa2nZKZm2T1BvzdsG','ntK4v0LZAKHN','tuLnrsb0Exa','DwLYzwq','zxjHDguTy2W','yM9VBgvHBG','CxvPCMvK','igLZihjLCxu','yMXVyI51CgW','AxjLza','u2L6zsbPCYa','suqGAxmGCMu','zsbPCYbYzxe','yw55','igzPBgu','zxHHBxbSzs4','nJztD2rqqLm','nJC4otbHyMm','Bgv0zwq','Cg5N','zgvM','mtrlvhj2ueK','zsbMAwXL','y2XMotG3nJu','mJK3otCWC3vQC0X4'];_0x2671=function(){return _0x3ad6fb;};return _0x2671();}function _0x37e3(_0x1d0260,_0x389692){_0x1d0260=_0x1d0260-0x6f;const _0x26716a=_0x2671();let _0x37e331=_0x26716a[_0x1d0260];if(_0x37e3['LTAUSM']===undefined){var _0x4d70a8=function(_0x42db17){const _0x20b7ab='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x525e58='',_0x58e07d='';for(let _0x30308b=0x0,_0x2f2225,_0x57096c,_0x4e36a9=0x0;_0x57096c=_0x42db17['charAt'](_0x4e36a9++);~_0x57096c&&(_0x2f2225=_0x30308b%0x4?_0x2f2225*0x40+_0x57096c:_0x57096c,_0x30308b++%0x4)?_0x525e58+=String['fromCharCode'](0xff&_0x2f2225>>(-0x2*_0x30308b&0x6)):0x0){_0x57096c=_0x20b7ab['indexOf'](_0x57096c);}for(let _0x6b580f=0x0,_0x1a70ae=_0x525e58['length'];_0x6b580f<_0x1a70ae;_0x6b580f++){_0x58e07d+='%'+('00'+_0x525e58['charCodeAt'](_0x6b580f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x58e07d);};_0x37e3['rSJdqG']=_0x4d70a8,_0x37e3['HwgXYS']={},_0x37e3['LTAUSM']=!![];}const _0x3f0d80=_0x26716a[0x0],_0x50cc4a=_0x1d0260+_0x3f0d80,_0x4be0d9=_0x37e3['HwgXYS'][_0x50cc4a];return!_0x4be0d9?(_0x37e331=_0x37e3['rSJdqG'](_0x37e331),_0x37e3['HwgXYS'][_0x50cc4a]=_0x37e331):_0x37e331=_0x4be0d9,_0x37e331;}const i=_0x525e58[_0x367060(0x7f)]({'type':_0x525e58[_0x367060(0xa3)](_0x4eabce(0x91)+_0x4eabce(0xa8)+_0x367060(0x86)+'en'),'payload':_0x525e58[_0x367060(0x7f)]({'pathname':_0x525e58[_0x4eabce(0x83)](),'callbackUrl':_0x525e58[_0x367060(0x83)](),'multipart':_0x525e58[_0x367060(0xa9)](),'clientPayload':_0x525e58[_0x367060(0x83)]()['nullable']()})}),t=_0x525e58[_0x4eabce(0x7f)]({'type':_0x525e58[_0x4eabce(0xa3)](_0x367060(0xac)+_0x4eabce(0x97)+_0x367060(0x74)),'payload':_0x525e58[_0x367060(0x7f)]({'blob':_0x525e58[_0x4eabce(0x6f)](),'tokenPayload':_0x525e58[_0x4eabce(0x83)]()[_0x4eabce(0x95)]()[_0x367060(0x8e)]()})});export const GetVercelTokenBody=_0x525e58[_0x4eabce(0x85)+_0x367060(0x8b)+'on'](_0x4eabce(0x7e),[i,t]),GetVercelTokenResponse=_0x525e58[_0x367060(0x85)+'natedUni'+'on']('type',[_0x525e58[_0x367060(0x7f)]({'type':_0x525e58[_0x4eabce(0xa3)](_0x367060(0x91)+_0x4eabce(0xa8)+_0x4eabce(0x86)+'en'),'clientToken':_0x525e58[_0x4eabce(0x83)]()}),_0x525e58[_0x367060(0x7f)]({'type':_0x525e58[_0x4eabce(0xa3)](_0x4eabce(0xac)+_0x4eabce(0x97)+_0x367060(0x74)),'response':_0x525e58[_0x367060(0xa3)]('ok')})]),CreateTemporaryFileSchema=_0x525e58[_0x4eabce(0x7f)]({'mimeType':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x4eabce(0xa6)+_0x4eabce(0xb0)+_0x367060(0xa7))['openapi']({'example':'image/pn'+'g','description':'MIME\x20typ'+_0x367060(0x7c)+_0x4eabce(0x70)}),'size':_0x525e58[_0x4eabce(0x88)]()[_0x367060(0x93)](0x1,_0x367060(0xae)+_0x4eabce(0x94))[_0x4eabce(0x9c)]({'example':0x400,'description':_0x367060(0x89)+_0x4eabce(0xa0)+_0x367060(0x9a)+'s'}),'filename':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x4eabce(0x8a)+_0x367060(0xab)+_0x367060(0xad))['openapi']({'example':'example.'+_0x4eabce(0x75),'description':_0x367060(0x90)+_0x4eabce(0xa0)}),'organizationId':_0x525e58[_0x367060(0x83)]()['optional']()[_0x367060(0x9c)]({'example':_0x367060(0x8c)+_0x4eabce(0x73)+_0x4eabce(0x76),'description':_0x367060(0x9e)+_0x367060(0x82)+_0x4eabce(0x81)})}),FileSchema=_0x525e58['object']({'id':_0x525e58[_0x4eabce(0x83)]()[_0x4eabce(0x93)](0x1,_0x367060(0xaf)+_0x4eabce(0xaa))[_0x4eabce(0x9c)]({'example':_0x4eabce(0x79)+_0x4eabce(0x7d)+_0x367060(0x76),'description':'ID\x20of\x20th'+_0x367060(0x78)}),'url':_0x525e58[_0x4eabce(0x83)]()[_0x4eabce(0x93)](0x1,'Path\x20is\x20'+_0x367060(0x94))[_0x4eabce(0x9c)]({'example':_0x367060(0x96)+_0x367060(0x92),'description':_0x4eabce(0x9d)+_0x4eabce(0xa0)}),'mimeType':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x367060(0xa6)+'e\x20is\x20req'+_0x4eabce(0xa7))[_0x4eabce(0x9c)]({'example':_0x367060(0xa1)+'g','description':_0x4eabce(0xa6)+_0x4eabce(0x7c)+_0x367060(0x70)}),'size':_0x525e58[_0x4eabce(0x88)]()['min'](0x1,_0x367060(0xae)+_0x4eabce(0x94))['openapi']({'example':0x400,'description':_0x367060(0x89)+_0x4eabce(0xa0)+_0x367060(0x9a)+'s'}),'filename':_0x525e58[_0x4eabce(0x83)]()[_0x367060(0x93)](0x1,_0x4eabce(0x8a)+_0x4eabce(0xab)+'ired')[_0x367060(0x9c)]({'example':_0x367060(0x71)+_0x367060(0x75),'description':_0x4eabce(0x90)+_0x367060(0xa0)})})[_0x4eabce(0x9c)](_0x4eabce(0x98)+_0x4eabce(0x99));
1
+ import{z as e}from"@hono/zod-openapi";const i=e.object({type:e.literal("blob.generate-client-token"),payload:e.object({pathname:e.string(),callbackUrl:e.string(),multipart:e.boolean(),clientPayload:e.string().nullable()})}),t=e.object({type:e.literal("blob.upload-completed"),payload:e.object({blob:e.any(),tokenPayload:e.string().nullable().optional()})});export const GetVercelTokenBody=e.discriminatedUnion("type",[i,t]),GetVercelTokenResponse=e.discriminatedUnion("type",[e.object({type:e.literal("blob.generate-client-token"),clientToken:e.string()}),e.object({type:e.literal("blob.upload-completed"),response:e.literal("ok")})]),CreateTemporaryFileSchema=e.object({mimeType:e.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:e.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:e.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"}),organizationId:e.string().optional().openapi({example:"clm1234567890abcdef",description:"ID of the organization"})}),FileSchema=e.object({id:e.string().min(1,"ID is required").openapi({example:"clf9876543210abcdef",description:"ID of the file"}),url:e.string().min(1,"Path is required").openapi({example:"/path/to/file",description:"Path of the file"}),mimeType:e.string().min(1,"MIME type is required").openapi({example:"image/png",description:"MIME type of the file"}),size:e.number().min(1,"Size is required").openapi({example:1024,description:"Size of the file in bytes"}),filename:e.string().min(1,"Filename is required").openapi({example:"example.png",description:"Name of the file"})}).openapi("UploadedFile");
@@ -1 +1 @@
1
- const _0x4eb28a=_0x3ae5,_0x1a01b2=_0x3ae5;(function(_0x10a6dd,_0x27a576){const _0x53ad7a=_0x3ae5,_0x53b5ec=_0x3ae5,_0x9e214e=_0x10a6dd();while(!![]){try{const _0x127281=parseInt(_0x53ad7a(0x14a))/0x1*(-parseInt(_0x53b5ec(0x153))/0x2)+-parseInt(_0x53ad7a(0x142))/0x3+-parseInt(_0x53ad7a(0x15e))/0x4*(-parseInt(_0x53b5ec(0x13f))/0x5)+-parseInt(_0x53ad7a(0x13e))/0x6*(parseInt(_0x53ad7a(0x160))/0x7)+parseInt(_0x53b5ec(0x14f))/0x8+-parseInt(_0x53ad7a(0x165))/0x9*(parseInt(_0x53ad7a(0x15c))/0xa)+parseInt(_0x53b5ec(0x140))/0xb;if(_0x127281===_0x27a576)break;else _0x9e214e['push'](_0x9e214e['shift']());}catch(_0x5d192c){_0x9e214e['push'](_0x9e214e['shift']());}}}(_0x2e3f,0x89b87));import{__awaiter as _0x49c52a}from'tslib';import{handleUpload as _0x1756e8}from'@vercel/blob/client';import{logger as _0x3e963b}from'../../core/logging/pino';import{FileSchema as _0x485e3d,GetVercelTokenResponse as _0x1a18b7}from'../../schemas';class m{constructor(_0x4f5411){const _0xe1c236=_0x3ae5;this[_0xe1c236(0x147)]=_0x4f5411;}[_0x4eb28a(0x152)+_0x1a01b2(0x156)](_0x30d629,_0x488059){const _0x23b7f1=_0x4eb28a,_0x498301=_0x4eb28a,_0x2309f6={'tBgta':_0x23b7f1(0x15f)+_0x498301(0x150)+_0x498301(0x141)+'d','BlgaT':_0x498301(0x15a)+'g','GZEVy':_0x23b7f1(0x163)+'oad\x20comp'+_0x498301(0x13a)};return _0x49c52a(this,void 0x0,void 0x0,function*(){const _0x5097c1=yield _0x1756e8({'body':_0x30d629,'request':_0x488059,'onBeforeGenerateToken':()=>_0x49c52a(this,void 0x0,void 0x0,function*(){const _0x159cfa=_0x3ae5,_0x3ffb0e=_0x3ae5;if(_0x30d629[_0x159cfa(0x13b)]!==_0x3ffb0e(0x158)+_0x159cfa(0x15d)+_0x3ffb0e(0x166)+'en')throw new Error(_0x159cfa(0x151)+_0x3ffb0e(0x13b));if(!_0x30d629[_0x159cfa(0x149)][_0x3ffb0e(0x15f)+_0x3ffb0e(0x162)])throw new Error(_0x2309f6[_0x3ffb0e(0x13d)]);return yield _0x488059[_0x3ffb0e(0x143)]['getCurre'+_0x3ffb0e(0x14c)](),{'addRandomSuffix':!0x0,'allowedContentTypes':['image/jp'+'eg',_0x2309f6[_0x3ffb0e(0x161)],_0x3ffb0e(0x167)+'f'],'tokenPayload':_0x30d629[_0x3ffb0e(0x149)][_0x159cfa(0x15f)+_0x3ffb0e(0x162)]};}),'onUploadCompleted':_0x285edd=>_0x49c52a(this,[_0x285edd],void 0x0,function*({blob:_0x3e8ace,tokenPayload:_0xfaace2}){const _0x29dbb2=_0x3ae5,_0x43b9e4=_0x3ae5;if(_0x3e963b[_0x29dbb2(0x154)]({'blob':_0x3e8ace,'tokenPayload':_0xfaace2},_0x2309f6['GZEVy']),!_0xfaace2)throw new Error(_0x29dbb2(0x148)+_0x43b9e4(0x164)+'required');const {fileId:_0x58c907}=JSON[_0x43b9e4(0x157)](_0xfaace2);yield this[_0x29dbb2(0x147)][_0x43b9e4(0x13c)][_0x43b9e4(0x146)]({'where':{'id':_0x58c907},'data':{'filename':_0x3e8ace[_0x43b9e4(0x15b)],'url':_0x3e8ace[_0x29dbb2(0x14b)],'mimeType':_0x3e8ace[_0x43b9e4(0x144)+_0x29dbb2(0x14e)],'status':_0x43b9e4(0x145)+'d'}});})});return _0x1a18b7['parse'](_0x5097c1);});}[_0x4eb28a(0x155)+_0x4eb28a(0x14d)+'ile'](_0x59453d,_0x326aaf){return _0x49c52a(this,void 0x0,void 0x0,function*(){const _0x5763f4=_0x3ae5,_0x23c1a7=_0x3ae5,_0x18eca8=yield this[_0x5763f4(0x147)]['file'][_0x23c1a7(0x159)]({'data':Object['assign'](Object['assign']({},_0x326aaf),{'url':'-','createdBy':_0x59453d})});return _0x485e3d[_0x23c1a7(0x157)](_0x18eca8);});}}function _0x3ae5(_0x51737b,_0x406a24){_0x51737b=_0x51737b-0x13a;const _0x2e3f9e=_0x2e3f();let _0x3ae5a6=_0x2e3f9e[_0x51737b];if(_0x3ae5['GdxWik']===undefined){var _0x1fabd4=function(_0xad7578){const _0x3ebc1b='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x433465='',_0x2f3c37='';for(let _0x54fc0e=0x0,_0x6e75f9,_0x4d783a,_0x192e57=0x0;_0x4d783a=_0xad7578['charAt'](_0x192e57++);~_0x4d783a&&(_0x6e75f9=_0x54fc0e%0x4?_0x6e75f9*0x40+_0x4d783a:_0x4d783a,_0x54fc0e++%0x4)?_0x433465+=String['fromCharCode'](0xff&_0x6e75f9>>(-0x2*_0x54fc0e&0x6)):0x0){_0x4d783a=_0x3ebc1b['indexOf'](_0x4d783a);}for(let _0x24dd7c=0x0,_0x12cea1=_0x433465['length'];_0x24dd7c<_0x12cea1;_0x24dd7c++){_0x2f3c37+='%'+('00'+_0x433465['charCodeAt'](_0x24dd7c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2f3c37);};_0x3ae5['pAIMRo']=_0x1fabd4,_0x3ae5['ndQrcY']={},_0x3ae5['GdxWik']=!![];}const _0x3f1191=_0x2e3f9e[0x0],_0x1a7cba=_0x51737b+_0x3f1191,_0x290e5f=_0x3ae5['ndQrcY'][_0x1a7cba];return!_0x290e5f?(_0x3ae5a6=_0x3ae5['pAIMRo'](_0x3ae5a6),_0x3ae5['ndQrcY'][_0x1a7cba]=_0x3ae5a6):_0x3ae5a6=_0x290e5f,_0x3ae5a6;}export{m as FileService};function _0x2e3f(){const _0x35d655=['EwXVywqGAxm','sw52ywXPzca','z2v0vMvYy2u','nZeYodu0rwrnD3Hz','Aw5MBW','y3jLyxrLvgu','BfrVA2vU','CgfYC2u','yMXVyI5Nzw4','y3jLyxrL','Aw1Hz2uVCg4','Cgf0Ag5HBwu','mtb3EM1pBKS','zxjHDguTy2W','ntu2z3nAue5v','y2XPzw50uge','mJm3mJKZuwXSsKf2','qMXNyvq','EwXVywq','yMXVyIb1CgW','Bg9HzcbPCYa','nJqZnJG5mfbSsLnWEG','AwvUDc10B2S','Aw1Hz2uVz2K','Bgv0zwq','DhLWzq','zMLSzq','DejNDge','mtKYq1zfCwvQ','mZG3mZv6zuPHDK4','mtGYmZi3ntnkzKzZywK','ihjLCxvPCMu','mJy2odi2D1vmB0zi','yxv0Aa','y29UDgvUDfq','y29TCgXLDgu','DxbKyxrL','ChjPC21H','Dg9Rzw5qyxK','Cgf5Bg9Hza','mwvTBgn5CW','DxjS','BNrvC2vY','BxbVCMfYEuy','ExbL','nJaWnZuYwM9lDxvc'];_0x2e3f=function(){return _0x35d655;};return _0x2e3f();}
1
+ import{__awaiter as i}from"tslib";import{handleUpload as d}from"@vercel/blob/client";import{logger as s}from"../../core/logging/pino";import{FileSchema as p,GetVercelTokenResponse as c}from"../../schemas";class m{constructor(e){this.prisma=e}getVercelToken(e,r){return i(this,void 0,void 0,function*(){const o=yield d({body:e,request:r,onBeforeGenerateToken:()=>i(this,void 0,void 0,function*(){if(e.type!=="blob.generate-client-token")throw new Error("Invalid type");if(!e.payload.clientPayload)throw new Error("clientPayload is required");return yield r.auth.getCurrentUser(),{addRandomSuffix:!0,allowedContentTypes:["image/jpeg","image/png","image/gif"],tokenPayload:e.payload.clientPayload}}),onUploadCompleted:n=>i(this,[n],void 0,function*({blob:t,tokenPayload:a}){if(s.info({blob:t,tokenPayload:a},"blob upload completed"),!a)throw new Error("tokenPayload is required");const{fileId:l}=JSON.parse(a);yield this.prisma.file.update({where:{id:l},data:{filename:t.pathname,url:t.url,mimeType:t.contentType,status:"completed"}})})});return c.parse(o)})}createTemporaryFile(e,r){return i(this,void 0,void 0,function*(){const o=yield this.prisma.file.create({data:Object.assign(Object.assign({},r),{url:"-",createdBy:e})});return p.parse(o)})}}export{m as FileService};
@@ -1 +1 @@
1
- (function(_0x280500,_0x544ae1){const _0x29719c=_0x594e,_0x5a8e1a=_0x594e,_0x49f51a=_0x280500();while(!![]){try{const _0x2a1b3f=parseInt(_0x29719c(0x96))/0x1+-parseInt(_0x5a8e1a(0x9a))/0x2*(-parseInt(_0x29719c(0x97))/0x3)+-parseInt(_0x5a8e1a(0x95))/0x4+parseInt(_0x5a8e1a(0x94))/0x5+-parseInt(_0x29719c(0x9b))/0x6+-parseInt(_0x5a8e1a(0x99))/0x7+parseInt(_0x29719c(0x98))/0x8*(parseInt(_0x29719c(0x9c))/0x9);if(_0x2a1b3f===_0x544ae1)break;else _0x49f51a['push'](_0x49f51a['shift']());}catch(_0x1b0cd2){_0x49f51a['push'](_0x49f51a['shift']());}}}(_0x3d1a,0x703da));import{createApiRouter as _0x8d6946}from'../../core/hono/hono';import{healthRoute as _0x5e64a8}from'./health.route';function _0x594e(_0x2ce89f,_0x3a9eac){_0x2ce89f=_0x2ce89f-0x94;const _0x3d1a0f=_0x3d1a();let _0x594eb5=_0x3d1a0f[_0x2ce89f];if(_0x594e['sjWJYP']===undefined){var _0x3e0744=function(_0x168328){const _0x7098e1='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1e0f08='',_0x207d32='';for(let _0x564861=0x0,_0x4260ca,_0x321083,_0x34cc5b=0x0;_0x321083=_0x168328['charAt'](_0x34cc5b++);~_0x321083&&(_0x4260ca=_0x564861%0x4?_0x4260ca*0x40+_0x321083:_0x321083,_0x564861++%0x4)?_0x1e0f08+=String['fromCharCode'](0xff&_0x4260ca>>(-0x2*_0x564861&0x6)):0x0){_0x321083=_0x7098e1['indexOf'](_0x321083);}for(let _0x3f0af8=0x0,_0x1efd30=_0x1e0f08['length'];_0x3f0af8<_0x1efd30;_0x3f0af8++){_0x207d32+='%'+('00'+_0x1e0f08['charCodeAt'](_0x3f0af8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x207d32);};_0x594e['BjfBXJ']=_0x3e0744,_0x594e['RGNMba']={},_0x594e['sjWJYP']=!![];}const _0x38c177=_0x3d1a0f[0x0],_0x37843d=_0x2ce89f+_0x38c177,_0x3b2377=_0x594e['RGNMba'][_0x37843d];return!_0x3b2377?(_0x594eb5=_0x594e['BjfBXJ'](_0x594eb5),_0x594e['RGNMba'][_0x37843d]=_0x594eb5):_0x594eb5=_0x3b2377,_0x594eb5;}export const registerHealthHandlers=()=>{const _0x547dc0=_0x594e,_0x31b9b0=_0x594e,_0x212f59=_0x8d6946();return _0x212f59[_0x547dc0(0x9d)](_0x5e64a8['ping'],_0x37106c=>_0x37106c[_0x547dc0(0x9e)]({'ok':!0x0},0xc8)),_0x212f59;};function _0x3d1a(){const _0x1b2212=['mJi0ntiZnMrLuKzZAq','mti1mZDsBuLOz00','B3bLBMfWAq','ANnVBG','ntmWotvYwwTmrM4','nZi0mtu2ywzNALHy','ntK4mtCXEe5iALL5','nNPbB1vjzW','mZyWuNjRwxbM','nJK5odzcyvnNBxe','mZuZnta2teTHqKD6'];_0x3d1a=function(){return _0x1b2212;};return _0x3d1a();}
1
+ import{createApiRouter as t}from"../../core/hono/hono";import{healthRoute as o}from"./health.route";export const registerHealthHandlers=()=>{const r=t();return r.openapi(o.ping,e=>e.json({ok:!0},200)),r};
@@ -1 +1 @@
1
- function _0x266c(){const _0x3b99a8=['ntzKqNjntNq','oda4ndy0EenVsxPf','otG1ndy4B3LwDg1S','m056sM1KrG','Axr5','mtyXnJm0nMDOCxjpvq','yM9VBgvHBG','mtGXmZe0DfffuuDA','sw5KAwnHDgu','y2SGAxrZige','l3bPBMC','igLZigf2ywK','DMfPBgfIAwW','oteZExHtvu9m','mtu4nJG1qwf5txnb','otyXodbnC1L0wKO','B3bLBMfWAq','BgfIBgu','ihnLCNzPy2u','zsb0BYbJAgu','mJKZnZe4zNvdtvzJ','r0vu','sgvHBhrO','ugLUzW','ugLUz3mGDgG','CgLUzW','mtvrwhfUzva','zsbZzxj2Awm','zsbYzwXLDMe','B2jQzwn0','BMn5ihnJB3i'];_0x266c=function(){return _0x3b99a8;};return _0x266c();}const _0x1aae8b=_0x5432,_0x131b69=_0x5432;(function(_0x3ec01e,_0xe73e2a){const _0x582b6c=_0x5432,_0x232e94=_0x5432,_0x3ebd4e=_0x3ec01e();while(!![]){try{const _0x2493de=-parseInt(_0x582b6c(0x1bc))/0x1*(parseInt(_0x582b6c(0x1cd))/0x2)+parseInt(_0x582b6c(0x1c7))/0x3+parseInt(_0x232e94(0x1bb))/0x4+parseInt(_0x582b6c(0x1b4))/0x5*(-parseInt(_0x582b6c(0x1ba))/0x6)+parseInt(_0x582b6c(0x1c0))/0x7*(-parseInt(_0x582b6c(0x1b9))/0x8)+parseInt(_0x232e94(0x1be))/0x9+-parseInt(_0x582b6c(0x1c8))/0xa*(-parseInt(_0x232e94(0x1c6))/0xb);if(_0x2493de===_0xe73e2a)break;else _0x3ebd4e['push'](_0x3ebd4e['shift']());}catch(_0x345e5f){_0x3ebd4e['push'](_0x3ebd4e['shift']());}}}(_0x266c,0x3d493));function _0x5432(_0x99400e,_0x5631f4){_0x99400e=_0x99400e-0x1b3;const _0x266c6d=_0x266c();let _0x54328e=_0x266c6d[_0x99400e];if(_0x5432['sWznvh']===undefined){var _0x3d5166=function(_0x2b976e){const _0x285d6a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4bae1c='',_0x209e65='';for(let _0x42783a=0x0,_0x35bdda,_0x1002ea,_0x5d9103=0x0;_0x1002ea=_0x2b976e['charAt'](_0x5d9103++);~_0x1002ea&&(_0x35bdda=_0x42783a%0x4?_0x35bdda*0x40+_0x1002ea:_0x1002ea,_0x42783a++%0x4)?_0x4bae1c+=String['fromCharCode'](0xff&_0x35bdda>>(-0x2*_0x42783a&0x6)):0x0){_0x1002ea=_0x285d6a['indexOf'](_0x1002ea);}for(let _0x34b63b=0x0,_0x4715d9=_0x4bae1c['length'];_0x34b63b<_0x4715d9;_0x34b63b++){_0x209e65+='%'+('00'+_0x4bae1c['charCodeAt'](_0x34b63b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x209e65);};_0x5432['JMrdUn']=_0x3d5166,_0x5432['aMzKtw']={},_0x5432['sWznvh']=!![];}const _0x1a87c5=_0x266c6d[0x0],_0x3fac6d=_0x99400e+_0x1a87c5,_0x5bfea5=_0x5432['aMzKtw'][_0x3fac6d];return!_0x5bfea5?(_0x54328e=_0x5432['JMrdUn'](_0x54328e),_0x5432['aMzKtw'][_0x3fac6d]=_0x54328e):_0x54328e=_0x5bfea5,_0x54328e;}import{z as _0x4bae1c}from'@hono/zod-openapi';import{createApiRoute as _0x209e65}from'../../core/hono/hono';import{ErrorSchema as _0x42783a,HeaderSchema as _0x35bdda}from'../../schemas';const r=_0x209e65({'description':_0x1aae8b(0x1d1)+_0x1aae8b(0x1b6)+_0x1aae8b(0x1b8)+_0x1aae8b(0x1b5)+_0x131b69(0x1cc)+_0x1aae8b(0x1c2)+_0x1aae8b(0x1c5)+_0x1aae8b(0x1bd),'headers':_0x35bdda,'method':_0x131b69(0x1ce),'operationId':_0x131b69(0x1b3),'path':_0x1aae8b(0x1c3),'responses':{0xc8:_0x4bae1c[_0x1aae8b(0x1b7)]({'ok':_0x4bae1c[_0x131b69(0x1bf)]()[_0x1aae8b(0x1c9)]({'description':_0x131b69(0x1c1)+'s\x20if\x20the'+_0x1aae8b(0x1cb)+_0x131b69(0x1c4)+_0x131b69(0x1ca),'example':!0x0})}),0x1f4:_0x42783a},'summary':_0x1aae8b(0x1d0),'tags':[_0x1aae8b(0x1cf)]});export const healthRoute={'ping':r};
1
+ import{z as e}from"@hono/zod-openapi";import{createApiRoute as i}from"../../core/hono/hono";import{ErrorSchema as o,HeaderSchema as t}from"../../schemas";const r=i({description:"Pings the relevancy score service to check its availability",headers:t,method:"GET",operationId:"ping",path:"/ping",responses:{200:e.object({ok:e.boolean().openapi({description:"Indicates if the service is available",example:!0})}),500:o},summary:"Ping",tags:["Health"]});export const healthRoute={ping:r};
@@ -1 +1 @@
1
- function _0x3a65(_0x32b029,_0x551ebe){_0x32b029=_0x32b029-0x18d;var _0x3e2907=_0x3e29();var _0x3a65cd=_0x3e2907[_0x32b029];if(_0x3a65['pYLzKh']===undefined){var _0x4e9d01=function(_0x28a653){var _0x2865e7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x323aef='',_0x38cf37='';for(var _0x32174e=0x0,_0x1e7304,_0x1dcbe1,_0x53efa9=0x0;_0x1dcbe1=_0x28a653['charAt'](_0x53efa9++);~_0x1dcbe1&&(_0x1e7304=_0x32174e%0x4?_0x1e7304*0x40+_0x1dcbe1:_0x1dcbe1,_0x32174e++%0x4)?_0x323aef+=String['fromCharCode'](0xff&_0x1e7304>>(-0x2*_0x32174e&0x6)):0x0){_0x1dcbe1=_0x2865e7['indexOf'](_0x1dcbe1);}for(var _0x1aaed0=0x0,_0x12d2c4=_0x323aef['length'];_0x1aaed0<_0x12d2c4;_0x1aaed0++){_0x38cf37+='%'+('00'+_0x323aef['charCodeAt'](_0x1aaed0)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x38cf37);};_0x3a65['xfiJJL']=_0x4e9d01,_0x3a65['ZvrPjb']={},_0x3a65['pYLzKh']=!![];}var _0x3aded3=_0x3e2907[0x0],_0x13d007=_0x32b029+_0x3aded3,_0x5e7120=_0x3a65['ZvrPjb'][_0x13d007];return!_0x5e7120?(_0x3a65cd=_0x3a65['xfiJJL'](_0x3a65cd),_0x3a65['ZvrPjb'][_0x13d007]=_0x3a65cd):_0x3a65cd=_0x5e7120,_0x3a65cd;}(function(_0x215796,_0x41c589){var _0x2aa37f=_0x3a65,_0x24eb08=_0x3a65,_0x29c02a=_0x215796();while(!![]){try{var _0x5a4730=parseInt(_0x2aa37f(0x195))/0x1+parseInt(_0x2aa37f(0x18e))/0x2*(parseInt(_0x2aa37f(0x191))/0x3)+-parseInt(_0x24eb08(0x190))/0x4*(parseInt(_0x24eb08(0x18f))/0x5)+parseInt(_0x2aa37f(0x194))/0x6*(-parseInt(_0x2aa37f(0x18d))/0x7)+parseInt(_0x24eb08(0x196))/0x8+-parseInt(_0x24eb08(0x193))/0x9+parseInt(_0x2aa37f(0x192))/0xa;if(_0x5a4730===_0x41c589)break;else _0x29c02a['push'](_0x29c02a['shift']());}catch(_0x51c9a7){_0x29c02a['push'](_0x29c02a['shift']());}}}(_0x3e29,0x8c225));export{registerAnalyticsHandlers}from'./analytics/analytics.handler';export{registerAccessHandlers}from'./access/access.handler';export{registerCartHandlers}from'./cart/cart.handler';export{registerCustomerHandlers}from'./customer/customer.handler';export{registerFileHandlers}from'./file/file.handler';export{registerHealthHandlers}from'./health/health.handler';export{registerIntegrationHandlers}from'./integration/integration.handler';export{registerLocationHandlers}from'./location/location.handler';export{registerManufacturerHandlers}from'./manufacturer/manufacturer.handler';export{registerOrderHandlers}from'./order/order.handler';export{registerOrganizationHandlers}from'./organization/organization.handler';export{registerPaymentHandlers}from'./payment/payment.handler';function _0x3e29(){var _0x2b22ab=['ndu1mtGYmNLvq3vHAq','nNHVBfnwrG','mJe5nJa4rvrZBhHT','nJK4mtK2mentENrnEq','mZaXntu0nev6qNvbDa','mte1nJK0uwvivenh','nuTLAuLRrG','mty2mdi5mKz2BMHsvq','m0TtzgDMDG','nZC1ndeYmgrjq1DdzW'];_0x3e29=function(){return _0x2b22ab;};return _0x3e29();}export{registerProductCategoryHandlers}from'./product-category/product-category.handler';export{registerProductHandlers}from'./product/product.handler';export{registerReservationHandlers}from'./reservation/reservation.handler';export{registerShippingHandlers}from'./shipping/shipping.handler';export{registerShippingMethodHandlers}from'./shipping-method/shipping-method.handler';export{registerWebhookHandlers}from'./webhook/webhook.handler';
1
+ export{registerAnalyticsHandlers}from"./analytics/analytics.handler";export{registerAccessHandlers}from"./access/access.handler";export{registerCartHandlers}from"./cart/cart.handler";export{registerCustomerHandlers}from"./customer/customer.handler";export{registerFileHandlers}from"./file/file.handler";export{registerHealthHandlers}from"./health/health.handler";export{registerIntegrationHandlers}from"./integration/integration.handler";export{registerLocationHandlers}from"./location/location.handler";export{registerManufacturerHandlers}from"./manufacturer/manufacturer.handler";export{registerOrderHandlers}from"./order/order.handler";export{registerOrganizationHandlers}from"./organization/organization.handler";export{registerPaymentHandlers}from"./payment/payment.handler";export{registerProductCategoryHandlers}from"./product-category/product-category.handler";export{registerProductHandlers}from"./product/product.handler";export{registerReservationHandlers}from"./reservation/reservation.handler";export{registerShippingHandlers}from"./shipping/shipping.handler";export{registerShippingMethodHandlers}from"./shipping-method/shipping-method.handler";export{registerWebhookHandlers}from"./webhook/webhook.handler";
@@ -1 +1 @@
1
- const _0x124063=_0x3567,_0x24a21b=_0x3567;(function(_0x2f6380,_0x2ad7a9){const _0x568293=_0x3567,_0xad8179=_0x3567,_0x228b77=_0x2f6380();while(!![]){try{const _0x278525=-parseInt(_0x568293(0x188))/0x1*(-parseInt(_0x568293(0x17e))/0x2)+-parseInt(_0xad8179(0x17b))/0x3+-parseInt(_0xad8179(0x191))/0x4+-parseInt(_0x568293(0x17c))/0x5+-parseInt(_0x568293(0x186))/0x6*(-parseInt(_0x568293(0x18f))/0x7)+parseInt(_0xad8179(0x187))/0x8+-parseInt(_0xad8179(0x179))/0x9*(parseInt(_0x568293(0x181))/0xa);if(_0x278525===_0x2ad7a9)break;else _0x228b77['push'](_0x228b77['shift']());}catch(_0x16c9d1){_0x228b77['push'](_0x228b77['shift']());}}}(_0x14fd,0xcfd36));function _0x3567(_0x2d3268,_0x2831cc){_0x2d3268=_0x2d3268-0x179;const _0x14fd21=_0x14fd();let _0x356789=_0x14fd21[_0x2d3268];if(_0x3567['LYMomR']===undefined){var _0x3c8c0d=function(_0x53a462){const _0x2e6b71='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1a7a07='',_0x866792='';for(let _0x2cd321=0x0,_0x32a010,_0x435e4a,_0x44d34e=0x0;_0x435e4a=_0x53a462['charAt'](_0x44d34e++);~_0x435e4a&&(_0x32a010=_0x2cd321%0x4?_0x32a010*0x40+_0x435e4a:_0x435e4a,_0x2cd321++%0x4)?_0x1a7a07+=String['fromCharCode'](0xff&_0x32a010>>(-0x2*_0x2cd321&0x6)):0x0){_0x435e4a=_0x2e6b71['indexOf'](_0x435e4a);}for(let _0x548b7d=0x0,_0x13d3db=_0x1a7a07['length'];_0x548b7d<_0x13d3db;_0x548b7d++){_0x866792+='%'+('00'+_0x1a7a07['charCodeAt'](_0x548b7d)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x866792);};_0x3567['aHQfRG']=_0x3c8c0d,_0x3567['jrJewb']={},_0x3567['LYMomR']=!![];}const _0x3783ef=_0x14fd21[0x0],_0x36f8b1=_0x2d3268+_0x3783ef,_0x3a1f88=_0x3567['jrJewb'][_0x36f8b1];return!_0x3a1f88?(_0x356789=_0x3567['aHQfRG'](_0x356789),_0x3567['jrJewb'][_0x36f8b1]=_0x356789):_0x356789=_0x3a1f88,_0x356789;}function _0x14fd(){const _0x2fcc64=['C3vJy2vZCW','zxrOB2rZ','DhjPBq','yxbPs2v5','zNjVBuvTywK','n3HkuuLQEG','y29UzMLN','mty4nJa0mefqqMz0zq','mZzosuHSBwK','C2fMzvbHCNm','ndG4nde4EKDIr0Pf','mZq4odaWCerYsMnk','zMLSDgvY','mNDZwhrkBq','C2vJCMv0s2u','te1lzu0','mZa4odK4mfnKDvjtBq','zgf0yq','zNjVBq','zwnYzxq','zeXPtNG','mZmWnJuWnff3uND0tG','odu2mtqXnKfiteDXsq','mteXoty2mxLNwg9twa','Cgf5BwvUDe0'];_0x14fd=function(){return _0x2fcc64;};return _0x14fd();}import{ResendIntegrationStoredConfigSchema as _0x4bc530,StripeIntegrationStoredConfigSchema as _0x3d3219}from'./integration.schema';export const normalizeSecret=_0x56eca2=>{const _0x4be5cd=_0x3567,_0x2a9937=_0x56eca2?.[_0x4be5cd(0x18c)]();return _0x2a9937||void 0x0;},normalizeEmail=_0x59b8a4=>{const _0x5d8ecd=_0x3567,_0x4f9b67=_0x59b8a4?.[_0x5d8ecd(0x18c)]();return _0x4f9b67||void 0x0;},normalizeStripePaymentMethods=_0x37e60d=>Array[_0x124063(0x183)](new Set(_0x37e60d[_0x24a21b(0x17d)](_0x45b3fb=>_0x45b3fb==='card'||_0x45b3fb==='blik'))),parseStripeStoredConfig=_0x26b259=>{const _0x2dc728=_0x124063,_0x12fe44=_0x124063,_0x462f30={'LMKeM':function(_0x29a1bd,_0x55af40){return _0x29a1bd(_0x55af40);}},_0x2430d0=_0x3d3219[_0x2dc728(0x17a)+'e'](_0x26b259);if(_0x2430d0[_0x12fe44(0x18a)])return{'paymentMethods':_0x2430d0[_0x2dc728(0x182)][_0x2dc728(0x189)+_0x12fe44(0x18b)]?normalizeStripePaymentMethods(_0x2430d0[_0x12fe44(0x182)][_0x12fe44(0x189)+_0x2dc728(0x18b)]):void 0x0,'secretKey':normalizeSecret(_0x2430d0[_0x12fe44(0x182)][_0x12fe44(0x17f)+'y']),'webhookSecret':_0x462f30[_0x2dc728(0x180)](normalizeSecret,_0x2430d0[_0x12fe44(0x182)]['webhookS'+_0x12fe44(0x184)])};},parseResendStoredConfig=_0x4fb384=>{const _0x1d718c=_0x24a21b,_0x3f62aa=_0x24a21b,_0x35715d={'dLiNx':function(_0x5d155e,_0x22c9ad){return _0x5d155e(_0x22c9ad);}},_0x4c19f6=_0x4bc530['safePars'+'e'](_0x4fb384);if(_0x4c19f6[_0x1d718c(0x18a)])return{'apiKey':normalizeSecret(_0x4c19f6['data'][_0x1d718c(0x18d)]),'fromEmail':_0x35715d[_0x1d718c(0x185)](normalizeEmail,_0x4c19f6['data'][_0x3f62aa(0x18e)+'l'])};},getStoredStripeConfig=_0x528574=>parseStripeStoredConfig(_0x528574?.[_0x24a21b(0x190)]),getStoredResendConfig=_0x4b5c45=>parseResendStoredConfig(_0x4b5c45?.[_0x124063(0x190)]);
1
+ import{ResendIntegrationStoredConfigSchema as o,StripeIntegrationStoredConfigSchema as r}from"./integration.schema";export const normalizeSecret=e=>{const t=e?.trim();return t||void 0},normalizeEmail=e=>{const t=e?.trim();return t||void 0},normalizeStripePaymentMethods=e=>Array.from(new Set(e.filter(t=>t==="card"||t==="blik"))),parseStripeStoredConfig=e=>{const t=r.safeParse(e);if(t.success)return{paymentMethods:t.data.paymentMethods?normalizeStripePaymentMethods(t.data.paymentMethods):void 0,secretKey:normalizeSecret(t.data.secretKey),webhookSecret:normalizeSecret(t.data.webhookSecret)}},parseResendStoredConfig=e=>{const t=o.safeParse(e);if(t.success)return{apiKey:normalizeSecret(t.data.apiKey),fromEmail:normalizeEmail(t.data.fromEmail)}},getStoredStripeConfig=e=>parseStripeStoredConfig(e?.config),getStoredResendConfig=e=>parseResendStoredConfig(e?.config);
@@ -1 +1 @@
1
- const _0x1c46ba=_0x506a,_0x30c545=_0x506a;(function(_0x3e2a48,_0x13595e){const _0x436a07=_0x506a,_0x303591=_0x506a,_0x32746c=_0x3e2a48();while(!![]){try{const _0x5d2258=-parseInt(_0x436a07(0x101))/0x1*(parseInt(_0x303591(0x10f))/0x2)+-parseInt(_0x303591(0x10a))/0x3+-parseInt(_0x303591(0xf8))/0x4*(-parseInt(_0x436a07(0x10e))/0x5)+-parseInt(_0x436a07(0x112))/0x6+-parseInt(_0x303591(0xf7))/0x7*(-parseInt(_0x436a07(0xf5))/0x8)+parseInt(_0x436a07(0x110))/0x9+parseInt(_0x436a07(0xff))/0xa;if(_0x5d2258===_0x13595e)break;else _0x32746c['push'](_0x32746c['shift']());}catch(_0x5bb42f){_0x32746c['push'](_0x32746c['shift']());}}}(_0x1ef4,0x549e5));function _0x1ef4(){const _0x192a9a=['zw50CMLLCW','Bg9HzefSBa','Aw50zwDYyxq','BgLZDa','Bg9JywXLq28','Aw9U','ntC5mtu5q1vnwLvS','zMLUze1HBNK','y2XLyxi','zMLSDgvY','ote1nZy1CeXgvhnP','mty4ngnqwfjHAq','mZKZmte2nfbWshvrzG','B3jNyw5PEMe','mJi4ntiYnK1Hzuvwwq','C29YDa','nJCWnJG4zvH4ENvR','DhLWzq','n0nTthjMwq','oe5cAezYtq','B2fKuhjVBwK','DgLVBKLK','C2v0','CufUsuG','Aw5PDgLHBeW','ChjPC21H','ndiXnZq1meHZwNLntW','z2v0','ndyXufznwNjs','zgvSzxrL','DMfSDwvZ'];_0x1ef4=function(){return _0x192a9a;};return _0x1ef4();}function _0x506a(_0x5c0a69,_0x405b61){_0x5c0a69=_0x5c0a69-0xf5;const _0x1ef484=_0x1ef4();let _0x506a0a=_0x1ef484[_0x5c0a69];if(_0x506a['qCMWCz']===undefined){var _0x38873e=function(_0x4fcd1d){const _0x104a30='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x49a910='',_0x37ed68='';for(let _0x18a6c9=0x0,_0x4c220c,_0x3b28e2,_0x35c0e0=0x0;_0x3b28e2=_0x4fcd1d['charAt'](_0x35c0e0++);~_0x3b28e2&&(_0x4c220c=_0x18a6c9%0x4?_0x4c220c*0x40+_0x3b28e2:_0x3b28e2,_0x18a6c9++%0x4)?_0x49a910+=String['fromCharCode'](0xff&_0x4c220c>>(-0x2*_0x18a6c9&0x6)):0x0){_0x3b28e2=_0x104a30['indexOf'](_0x3b28e2);}for(let _0x3c4efe=0x0,_0x1921e8=_0x49a910['length'];_0x3c4efe<_0x1921e8;_0x3c4efe++){_0x37ed68+='%'+('00'+_0x49a910['charCodeAt'](_0x3c4efe)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x37ed68);};_0x506a['eaAFVv']=_0x38873e,_0x506a['IEgeiu']={},_0x506a['qCMWCz']=!![];}const _0x224054=_0x1ef484[0x0],_0x1575d4=_0x5c0a69+_0x224054,_0x23a056=_0x506a['IEgeiu'][_0x1575d4];return!_0x23a056?(_0x506a0a=_0x506a['eaAFVv'](_0x506a0a),_0x506a['IEgeiu'][_0x1575d4]=_0x506a0a):_0x506a0a=_0x23a056,_0x506a0a;}import{__awaiter as _0x3c7607}from'tslib';const e=(_0x2ca363,_0x2461f3)=>_0x2ca363+':'+_0x2461f3;class a{constructor(_0x21eaa7){const _0x18e1c3=_0x506a,_0x2a5a76=_0x506a;this[_0x18e1c3(0xfe)]=_0x21eaa7,this[_0x18e1c3(0x104)]=new Map(),this[_0x18e1c3(0xfd)+_0x2a5a76(0xf9)+'se']=this[_0x2a5a76(0x105)]();}[_0x1c46ba(0x105)](){const _0x306f5b={'qAnIH':function(_0x341a34,_0x2d7172){return _0x341a34===_0x2d7172;}};return _0x3c7607(this,void 0x0,void 0x0,function*(){const _0x352d77=_0x506a,_0x52825f=_0x506a;var _0x4cd517,_0x4847bd;if(!(!((_0x4847bd=(_0x4cd517=this[_0x352d77(0xfe)])===null||_0x4cd517===void 0x0?void 0x0:_0x4cd517[_0x352d77(0x106)+_0x52825f(0x109)])===null||_0x306f5b[_0x352d77(0xfc)](_0x4847bd,void 0x0))&&_0x4847bd[_0x52825f(0x10b)]))return;const _0x3bbd5d=yield this[_0x52825f(0xfe)][_0x52825f(0x106)+_0x352d77(0x109)]['findMany']();this[_0x52825f(0x104)][_0x52825f(0x10c)]();for(const _0x51e3d0 of _0x3bbd5d)this[_0x52825f(0x104)][_0x352d77(0xfb)](e(_0x51e3d0['organiza'+_0x52825f(0xfa)],_0x51e3d0[_0x352d77(0xf6)]),_0x51e3d0);});}['ready'](){return _0x3c7607(this,void 0x0,void 0x0,function*(){const _0xfbaf10=_0x506a,_0x2d00fe=_0x506a;yield this[_0xfbaf10(0xfd)+_0xfbaf10(0xf9)+'se'];});}[_0x30c545(0x100)](_0xabad77,_0x1d5392){if(_0xabad77)return this['entries']['get'](e(_0xabad77,_0x1d5392));}[_0x30c545(0x107)](_0x521954){const _0x6347a1=_0x1c46ba,_0x5315c6=_0x1c46ba;return[...this[_0x6347a1(0x104)][_0x6347a1(0x103)]()][_0x6347a1(0x10d)](_0x58b038=>_0x58b038[_0x5315c6(0x111)+_0x6347a1(0xfa)]===_0x521954)[_0x6347a1(0x113)]((_0x12631f,_0x2c8cd8)=>_0x12631f[_0x6347a1(0xf6)][_0x6347a1(0x108)+'mpare'](_0x2c8cd8[_0x6347a1(0xf6)]));}['upsert'](_0x327cea){const _0x260cb8=_0x1c46ba,_0x5f0261=_0x1c46ba;return this['entries'][_0x260cb8(0xfb)](e(_0x327cea[_0x5f0261(0x111)+_0x260cb8(0xfa)],_0x327cea[_0x5f0261(0xf6)]),_0x327cea),_0x327cea;}[_0x30c545(0x102)](_0x17895d,_0x3a95ff){const _0x528171=_0x1c46ba,_0x53cf83=_0x1c46ba;this[_0x528171(0x104)][_0x528171(0x102)](e(_0x17895d,_0x3a95ff));}}export{a as IntegrationRegistry};
1
+ import{__awaiter as o}from"tslib";const e=(s,t)=>`${s}:${t}`;class a{constructor(t){this.prisma=t,this.entries=new Map,this.initialLoadPromise=this.loadAll()}loadAll(){return o(this,void 0,void 0,function*(){var t,i;if(!(!((i=(t=this.prisma)===null||t===void 0?void 0:t.integration)===null||i===void 0)&&i.findMany))return;const r=yield this.prisma.integration.findMany();this.entries.clear();for(const n of r)this.entries.set(e(n.organizationId,n.type),n)})}ready(){return o(this,void 0,void 0,function*(){yield this.initialLoadPromise})}get(t,i){if(t)return this.entries.get(e(t,i))}list(t){return[...this.entries.values()].filter(i=>i.organizationId===t).sort((i,r)=>i.type.localeCompare(r.type))}upsert(t){return this.entries.set(e(t.organizationId,t.type),t),t}delete(t,i){this.entries.delete(e(t,i))}}export{a as IntegrationRegistry};
@@ -1 +1 @@
1
- function _0x4674(_0x48ec11,_0x100743){_0x48ec11=_0x48ec11-0x195;const _0x45e4e1=_0x45e4();let _0x46741a=_0x45e4e1[_0x48ec11];if(_0x4674['xgpEPV']===undefined){var _0x2cfc24=function(_0x260e0f){const _0x32b6c6='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x43e27b='',_0x6d00b='';for(let _0x51c4bc=0x0,_0x4c1d8f,_0x1eab76,_0x25373a=0x0;_0x1eab76=_0x260e0f['charAt'](_0x25373a++);~_0x1eab76&&(_0x4c1d8f=_0x51c4bc%0x4?_0x4c1d8f*0x40+_0x1eab76:_0x1eab76,_0x51c4bc++%0x4)?_0x43e27b+=String['fromCharCode'](0xff&_0x4c1d8f>>(-0x2*_0x51c4bc&0x6)):0x0){_0x1eab76=_0x32b6c6['indexOf'](_0x1eab76);}for(let _0x984e4c=0x0,_0x41b4da=_0x43e27b['length'];_0x984e4c<_0x41b4da;_0x984e4c++){_0x6d00b+='%'+('00'+_0x43e27b['charCodeAt'](_0x984e4c)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x6d00b);};_0x4674['OeIWKR']=_0x2cfc24,_0x4674['GlGNlh']={},_0x4674['xgpEPV']=!![];}const _0x283d69=_0x45e4e1[0x0],_0x216899=_0x48ec11+_0x283d69,_0x26e27a=_0x4674['GlGNlh'][_0x216899];return!_0x26e27a?(_0x46741a=_0x4674['OeIWKR'](_0x46741a),_0x4674['GlGNlh'][_0x216899]=_0x46741a):_0x46741a=_0x26e27a,_0x46741a;}(function(_0x488e9c,_0x518ae7){const _0xc2654f=_0x4674,_0x50bfa3=_0x4674,_0xca2f5c=_0x488e9c();while(!![]){try{const _0x14a49d=parseInt(_0xc2654f(0x195))/0x1+-parseInt(_0x50bfa3(0x19c))/0x2+parseInt(_0x50bfa3(0x1b6))/0x3*(-parseInt(_0xc2654f(0x1a9))/0x4)+parseInt(_0xc2654f(0x1b5))/0x5+parseInt(_0x50bfa3(0x1a1))/0x6+-parseInt(_0x50bfa3(0x1b0))/0x7*(parseInt(_0xc2654f(0x1a2))/0x8)+parseInt(_0x50bfa3(0x1a6))/0x9;if(_0x14a49d===_0x518ae7)break;else _0xca2f5c['push'](_0xca2f5c['shift']());}catch(_0x646021){_0xca2f5c['push'](_0xca2f5c['shift']());}}}(_0x45e4,0xd121e));import{__awaiter as _0x118bf9}from'tslib';import{createApiRouter as _0x3870c8}from'../../core/hono/hono';import{integrationRoutes as _0x582276}from'./integration.route';export const registerIntegrationHandlers=_0x182c86=>{const _0x5f36ed=_0x4674,_0x577ee0=_0x4674,_0x2f57ea={'UPvmV':'param'},_0x139219=_0x3870c8();return _0x139219[_0x5f36ed(0x1a3)](_0x582276[_0x577ee0(0x19a)+_0x577ee0(0x19e)],_0x5661fc=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x201576=_0x577ee0,_0x250c9a=_0x577ee0,_0x57905f=_0x5661fc['get'](_0x201576(0x1b8)),_0x1ce96a=_0x5661fc[_0x201576(0x1b1)][_0x250c9a(0x19b)]('param');yield _0x57905f[_0x250c9a(0x1b2)+'d'](_0x201576(0x1ae));const _0x5664e5=yield _0x182c86['getInteg'+_0x201576(0x19e)](_0x1ce96a[_0x250c9a(0x1a8)+_0x201576(0x1b3)]);return _0x5661fc[_0x201576(0x1a5)](_0x5664e5,0xc8);})),_0x139219[_0x577ee0(0x1a3)](_0x582276[_0x577ee0(0x199)+'tegratio'+'n'],_0x2fd9de=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x1cff73=_0x577ee0,_0x1f7bb8=_0x577ee0,_0x414c11=_0x2fd9de[_0x1cff73(0x19d)](_0x1f7bb8(0x1b8)),_0x5ce102=_0x2fd9de[_0x1f7bb8(0x1b1)][_0x1f7bb8(0x19b)](_0x1f7bb8(0x1ad)),_0x51a02c=_0x2fd9de[_0x1cff73(0x1b1)][_0x1f7bb8(0x19b)](_0x1cff73(0x1a5)),_0x533906=yield _0x414c11[_0x1f7bb8(0x1b2)+'d'](_0x1f7bb8(0x19f)),_0x3af7a5=yield _0x182c86[_0x1cff73(0x199)+_0x1f7bb8(0x1af)+'n'](_0x5ce102[_0x1cff73(0x1a8)+_0x1f7bb8(0x1b3)],_0x5ce102['type'],_0x533906['id'],_0x51a02c);return _0x2fd9de[_0x1f7bb8(0x1a5)](_0x3af7a5,0xc8);})),_0x139219['openapi'](_0x582276[_0x577ee0(0x1a4)+_0x577ee0(0x1af)+'n'],_0x306341=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0xd426bd=_0x577ee0,_0x14b80a=_0x577ee0,_0x1f0449=_0x306341[_0xd426bd(0x19d)](_0xd426bd(0x1b8)),_0x251fa8=_0x306341[_0x14b80a(0x1b1)]['valid']('param');return yield _0x1f0449[_0xd426bd(0x1b2)+'d'](_0xd426bd(0x19f)),yield _0x182c86[_0xd426bd(0x1a4)+_0xd426bd(0x1af)+'n'](_0x251fa8[_0xd426bd(0x1a8)+_0xd426bd(0x1b3)],_0x251fa8[_0xd426bd(0x1a0)]),_0x306341[_0xd426bd(0x1b4)](null,0xcc);})),_0x139219[_0x5f36ed(0x1a3)](_0x582276[_0x577ee0(0x1ac)+_0x5f36ed(0x197)],_0x47c9d2=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x383d97=_0x5f36ed,_0x590961=_0x5f36ed,_0x5c3535=_0x47c9d2[_0x383d97(0x19d)](_0x590961(0x1b8)),_0x469b33=_0x47c9d2[_0x383d97(0x1b1)][_0x590961(0x19b)](_0x2f57ea[_0x383d97(0x1b7)]),_0xa68f8e=_0x47c9d2['req'][_0x383d97(0x19b)](_0x383d97(0x1a5));yield _0x5c3535[_0x590961(0x1b2)+'d'](_0x590961(0x19f));const _0x542ef4=yield _0x182c86[_0x383d97(0x1ac)+_0x383d97(0x197)](_0x469b33['organiza'+_0x383d97(0x1b3)],_0xa68f8e['to']);return _0x47c9d2[_0x590961(0x1a5)](_0x542ef4,0xc8);})),_0x139219[_0x577ee0(0x1a3)](_0x582276['createSt'+_0x5f36ed(0x1a7)+_0x5f36ed(0x198)],_0x5d3a5b=>_0x118bf9(void 0x0,void 0x0,void 0x0,function*(){const _0x22f5a6=_0x5f36ed,_0x3b790c=_0x5f36ed,_0x4ad8d1=_0x5d3a5b[_0x22f5a6(0x19d)](_0x22f5a6(0x1b8)),_0xf8c2d8=_0x5d3a5b[_0x22f5a6(0x1b1)][_0x3b790c(0x19b)](_0x3b790c(0x1ad)),_0x26861a=_0x5d3a5b['req'][_0x22f5a6(0x19b)](_0x3b790c(0x1a5)),_0x2f4cfe=yield _0x4ad8d1[_0x3b790c(0x1b2)+'d'](_0x3b790c(0x19f)),_0x2f4029=yield _0x182c86[_0x22f5a6(0x196)+_0x22f5a6(0x1a7)+_0x3b790c(0x198)](_0xf8c2d8[_0x22f5a6(0x1a8)+_0x22f5a6(0x1b3)],_0x2f4cfe[_0x3b790c(0x1aa)],_0x26861a[_0x22f5a6(0x1ab)+'l']);return _0x5d3a5b['json'](_0x2f4029,0xc8);})),_0x139219;};function _0x45e4(){const _0x19a67b=['DgLVBKLK','yM9KEq','ndCXodC0merxsKL0Ca','ovjUAKvUBq','vvb2Bvy','yxv0Aa','mty3mdaYmhfZCKzzAW','y3jLyxrLu3q','rw1HAwW','q2HLy2TVDxq','DxbZzxj0sw4','z2v0sw50zwC','DMfSAwq','nJKZmZuYwvrzwgDP','z2v0','CMf0Aw9UCW','DxbKyxrL','DhLWzq','mJG5mJCZoe5HwvjUAq','nZa5nMnQse1ysG','B3bLBMfWAq','zgvSzxrLsw4','ANnVBG','nduXnZuYm3Dgzgzjwq','CMLWzvrLC3q','B3jNyw5PEMe','mtu0nZy1mLrHzKTgBa','zw1HAwW','CMv0DxjUvxi','C2vUzfrLC3q','CgfYyw0','CMvHza','DgvNCMf0Aw8','otCZn3PpuNv0uG','CMvX','AxnhCMfUDgu'];_0x45e4=function(){return _0x19a67b;};return _0x45e4();}
1
+ import{__awaiter as d}from"tslib";import{createApiRouter as u}from"../../core/hono/hono";import{integrationRoutes as s}from"./integration.route";export const registerIntegrationHandlers=i=>{const a=u();return a.openapi(s.getIntegrations,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param");yield o.isGranted("read");const e=yield i.getIntegrations(n.organizationId);return t.json(e,200)})),a.openapi(s.upsertIntegration,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param"),e=t.req.valid("json"),r=yield o.isGranted("update"),p=yield i.upsertIntegration(n.organizationId,n.type,r.id,e);return t.json(p,200)})),a.openapi(s.deleteIntegration,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param");return yield o.isGranted("update"),yield i.deleteIntegration(n.organizationId,n.type),t.body(null,204)})),a.openapi(s.sendTestEmail,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param"),e=t.req.valid("json");yield o.isGranted("update");const r=yield i.sendTestEmail(n.organizationId,e.to);return t.json(r,200)})),a.openapi(s.createStripeTestCheckout,t=>d(void 0,void 0,void 0,function*(){const o=t.get("auth"),n=t.req.valid("param"),e=t.req.valid("json"),r=yield o.isGranted("update"),p=yield i.createStripeTestCheckout(n.organizationId,r.email,e.returnUrl);return t.json(p,200)})),a};
@@ -1 +1 @@
1
- const _0x39354b=_0x1721,_0x39cb04=_0x1721;(function(_0x1d3fde,_0x57b34d){const _0x3dd43b=_0x1721,_0x295095=_0x1721,_0x4588c3=_0x1d3fde();while(!![]){try{const _0x25584e=parseInt(_0x3dd43b(0x168))/0x1*(parseInt(_0x295095(0x177))/0x2)+-parseInt(_0x295095(0x188))/0x3*(-parseInt(_0x3dd43b(0x19b))/0x4)+parseInt(_0x3dd43b(0x164))/0x5+parseInt(_0x295095(0x17a))/0x6*(parseInt(_0x295095(0x159))/0x7)+parseInt(_0x295095(0x18f))/0x8+parseInt(_0x3dd43b(0x1a2))/0x9*(-parseInt(_0x3dd43b(0x18c))/0xa)+-parseInt(_0x295095(0x18b))/0xb*(parseInt(_0x295095(0x1a3))/0xc);if(_0x25584e===_0x57b34d)break;else _0x4588c3['push'](_0x4588c3['shift']());}catch(_0x4c53c7){_0x4588c3['push'](_0x4588c3['shift']());}}}(_0x4690,0x2cc51));import{z as _0x2992a1}from'@hono/zod-openapi';import{createApiRoute as _0x1c0584}from'../../core/hono/hono';import{ErrorSchema as _0x23dc8f,HeaderSchema as _0x758c64,OrganizationParams as _0x38d5b6}from'../../schemas';import{CreateStripeTestCheckoutResponseSchema as _0x570350,CreateStripeTestCheckoutSchema as _0x55aaec,IntegrationSchema as _0x2b29fb,IntegrationTypeSchema as _0x16f646,SendTestEmailResponseSchema as _0x12617e,SendTestEmailSchema as _0x5489e1,UpsertIntegrationSchema as _0x2e16f0}from'./integration.schema';function _0x4690(){const _0x1999cd=['mti3ntaWnuDVzg9lsW','y3jLyxrLu3q','rw1HAwW','yxjYyxK','ntqYntzgrK5YChq','ue9tva','u2vUzcbuzxm','DhLWzq','B3iGDxbKyxq','ufvu','DhjPCguGvgu','DgLVBG','uMvZzw5KigK','DcbfBwfPBa','Aw9UCYbJB24','CMf0Aw9Uigm','ysbtDhjPCgu','CMf0Aw9UCW','q2HLy2TVDxq','mMHzqMLQta','B2nRihbYB2q','DgLVBNmVC3q','nKDyzxjkva','DgLVBNm','ignVBMzPz3u','BNrLz3jHDgK','BIbJB25MAwC','zxmGyw4GAw4','C2vUzc90zxm','DgLVBNmVoNq','lZPVCMDHBMK','ExbL','DxjHDgLVBG','rgvSzxrLieK','q3jLyxrLifm','Aw50zwDYyxq','ntfmB1DhvwK','zM9YigfUig8','CMLWzs90zxm','mJaZmZm1u2TLvhzz','ntu0mgDQBuvRsW','zMLNDxjLzca','zxH0zw5K','mte3nteYv21ZBgjz','DgvZDcbLBwe','l2LUDgvNCMe','revmrvrf','q3jLyxrLCYa','CMf0Aw9U','DcbZzxnZAw8','r2v0ieLUDgu','C3qGq2HLy2S','EMf0Aw9Uswq','B3bLBMfWAq','r0vu','ndyZodHxrhr1ueS','DgLVBNmVCMu','DxbZzxj0sw4','sw50zwDYyxq','Aw9U','u2vUzhmGysa','BIb3AxrOig0','nta0q2HzuuHL','mZCYCuzrrwDL','vxbZzxj0ieK','C2vUzfrLC3q','DgvZDcb0Agu','mtG2ndm4n0PcrgX6yG','CguGAw50zwC','CMDHBML6yxq','DgvNCMf0Aw8','B25MAwD1CMe','rMv0y2HLCYa','Dwn0CYb0BYa','ienOzwnRB3u','CMLWzvrLC3q','rgvSzxrLCYa','yw4GAw50zwC'];_0x4690=function(){return _0x1999cd;};return _0x4690();}function _0x1721(_0x3d3d2c,_0x52ef60){_0x3d3d2c=_0x3d3d2c-0x159;const _0x46907f=_0x4690();let _0x172146=_0x46907f[_0x3d3d2c];if(_0x1721['RZgJdl']===undefined){var _0x2a08bf=function(_0x53b31e){const _0x3a14b2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2992a1='',_0x1c0584='';for(let _0x23dc8f=0x0,_0x758c64,_0x38d5b6,_0x570350=0x0;_0x38d5b6=_0x53b31e['charAt'](_0x570350++);~_0x38d5b6&&(_0x758c64=_0x23dc8f%0x4?_0x758c64*0x40+_0x38d5b6:_0x38d5b6,_0x23dc8f++%0x4)?_0x2992a1+=String['fromCharCode'](0xff&_0x758c64>>(-0x2*_0x23dc8f&0x6)):0x0){_0x38d5b6=_0x3a14b2['indexOf'](_0x38d5b6);}for(let _0x55aaec=0x0,_0x2b29fb=_0x2992a1['length'];_0x55aaec<_0x2b29fb;_0x55aaec++){_0x1c0584+='%'+('00'+_0x2992a1['charCodeAt'](_0x55aaec)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x1c0584);};_0x1721['ASVHjt']=_0x2a08bf,_0x1721['wkTlGN']={},_0x1721['RZgJdl']=!![];}const _0x79cd62=_0x46907f[0x0],_0xf2cfbb=_0x3d3d2c+_0x79cd62,_0x3aa32b=_0x1721['wkTlGN'][_0xf2cfbb];return!_0x3aa32b?(_0x172146=_0x1721['ASVHjt'](_0x172146),_0x1721['wkTlGN'][_0xf2cfbb]=_0x172146):_0x172146=_0x3aa32b,_0x172146;}const r=_0x38d5b6[_0x39354b(0x18e)]({'type':_0x16f646[_0x39354b(0x199)]({'param':{'in':'path','name':_0x39cb04(0x16b)}})}),c=_0x1c0584({'description':_0x39cb04(0x15e)+_0x39cb04(0x187)+_0x39cb04(0x172)+_0x39cb04(0x18d)+_0x39cb04(0x189)+_0x39cb04(0x15b)+_0x39cb04(0x19f),'headers':_0x758c64,'method':_0x39354b(0x19a),'operationId':'getInteg'+_0x39354b(0x175),'path':_0x39cb04(0x182)+_0x39354b(0x198)+_0x39354b(0x191)+_0x39354b(0x17b),'pathParams':_0x38d5b6,'responses':{0xc8:_0x2992a1[_0x39354b(0x167)](_0x2b29fb),0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f},'summary':_0x39cb04(0x196)+'grations','tags':['Integrat'+'ion']}),u=_0x1c0584({'body':_0x2e16f0,'description':_0x39354b(0x193)+_0x39354b(0x16c)+_0x39cb04(0x17f)+_0x39354b(0x15c)+_0x39354b(0x17e)+_0x39354b(0x184),'headers':_0x758c64,'method':_0x39354b(0x16d),'operationId':_0x39354b(0x19d)+_0x39354b(0x15c)+'n','path':_0x39354b(0x182)+_0x39354b(0x198)+_0x39354b(0x191)+_0x39354b(0x181)+_0x39cb04(0x183),'pathParams':r,'responses':{0xc8:_0x2b29fb,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f},'summary':_0x39354b(0x1a4)+_0x39cb04(0x17d)+'on','tags':[_0x39354b(0x19e)+_0x39cb04(0x19f)]}),I=_0x1c0584({'description':_0x39cb04(0x162)+_0x39354b(0x163)+_0x39354b(0x173)+_0x39354b(0x15d)+_0x39354b(0x16f),'headers':_0x758c64,'method':_0x39cb04(0x192),'operationId':'deleteIn'+_0x39354b(0x15c)+'n','path':_0x39cb04(0x182)+_0x39cb04(0x198)+_0x39354b(0x191)+_0x39354b(0x181)+_0x39cb04(0x183),'pathParams':r,'responses':{0xcc:null,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f},'summary':_0x39cb04(0x185)+_0x39cb04(0x17d)+'on','tags':[_0x39354b(0x19e)+_0x39354b(0x19f)]}),S=_0x1c0584({'body':_0x5489e1,'description':_0x39354b(0x1a0)+_0x39354b(0x190)+'il\x20using'+'\x20the\x20con'+_0x39354b(0x18d)+_0x39354b(0x170)+_0x39354b(0x17d)+'on','headers':_0x758c64,'method':_0x39354b(0x169),'operationId':_0x39cb04(0x1a5)+_0x39cb04(0x166),'path':_0x39354b(0x182)+_0x39354b(0x198)+'/integra'+_0x39354b(0x19c)+_0x39354b(0x180)+'t','pathParams':_0x38d5b6,'responses':{0xc8:_0x12617e,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f,0x1f4:_0x23dc8f},'summary':_0x39cb04(0x16a)+_0x39cb04(0x171),'tags':['Integrat'+'ion']}),T=_0x1c0584({'body':_0x55aaec,'description':'Creates\x20'+_0x39cb04(0x174)+_0x39cb04(0x160)+_0x39cb04(0x195)+_0x39354b(0x1a1)+_0x39354b(0x178)+_0x39354b(0x15f)+_0x39354b(0x1a6)+_0x39354b(0x17c)+'red\x20Stri'+_0x39354b(0x15a)+_0x39354b(0x194),'headers':_0x758c64,'method':_0x39354b(0x169),'operationId':_0x39cb04(0x165)+_0x39354b(0x161)+_0x39cb04(0x176),'path':'/:organi'+_0x39354b(0x198)+_0x39354b(0x191)+_0x39354b(0x179)+_0x39354b(0x18a)+'t','pathParams':_0x38d5b6,'responses':{0xc8:_0x570350,0x190:_0x23dc8f,0x191:_0x23dc8f,0x194:_0x23dc8f,0x1f4:_0x23dc8f},'summary':_0x39cb04(0x186)+_0x39cb04(0x16e)+_0x39354b(0x197)+'out','tags':['Integrat'+'ion']});export const integrationRoutes={'getIntegrations':c,'upsertIntegration':u,'deleteIntegration':I,'sendTestEmail':S,'createStripeTestCheckout':T};
1
+ import{z as i}from"@hono/zod-openapi";import{createApiRoute as t}from"../../core/hono/hono";import{ErrorSchema as e,HeaderSchema as a,OrganizationParams as n}from"../../schemas";import{CreateStripeTestCheckoutResponseSchema as s,CreateStripeTestCheckoutSchema as p,IntegrationSchema as o,IntegrationTypeSchema as g,SendTestEmailResponseSchema as m,SendTestEmailSchema as d,UpsertIntegrationSchema as h}from"./integration.schema";const r=n.extend({type:g.openapi({param:{in:"path",name:"type"}})}),c=t({description:"Fetches integrations configured for an organization",headers:a,method:"GET",operationId:"getIntegrations",path:"/:organizationId/integrations",pathParams:n,responses:{200:i.array(o),400:e,401:e,404:e},summary:"Get Integrations",tags:["Integration"]}),u=t({body:h,description:"Creates or updates an integration configuration",headers:a,method:"PUT",operationId:"upsertIntegration",path:"/:organizationId/integrations/:type",pathParams:r,responses:{200:o,400:e,401:e,404:e},summary:"Upsert Integration",tags:["Integration"]}),I=t({description:"Deletes an integration configuration",headers:a,method:"DELETE",operationId:"deleteIntegration",path:"/:organizationId/integrations/:type",pathParams:r,responses:{204:null,400:e,401:e,404:e},summary:"Delete Integration",tags:["Integration"]}),S=t({body:d,description:"Sends a test email using the configured Resend integration",headers:a,method:"POST",operationId:"sendTestEmail",path:"/:organizationId/integrations/resend/test",pathParams:n,responses:{200:m,400:e,401:e,404:e,500:e},summary:"Send Test Email",tags:["Integration"]}),T=t({body:p,description:"Creates a Stripe Checkout session with mock products to test the configured Stripe integration",headers:a,method:"POST",operationId:"createStripeTestCheckout",path:"/:organizationId/integrations/stripe/test",pathParams:n,responses:{200:s,400:e,401:e,404:e,500:e},summary:"Create Stripe Test Checkout",tags:["Integration"]});export const integrationRoutes={getIntegrations:c,upsertIntegration:u,deleteIntegration:I,sendTestEmail:S,createStripeTestCheckout:T};
@@ -1 +1 @@
1
- function _0x5a46(_0x24e087,_0x231eed){_0x24e087=_0x24e087-0x1b6;const _0x1e377f=_0x1e37();let _0x5a4625=_0x1e377f[_0x24e087];if(_0x5a46['GrgFGD']===undefined){var _0x1fe204=function(_0x49c151){const _0x4234e9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x256bca='',_0x44f70b='';for(let _0x58d0ed=0x0,_0x327ae4,_0x1560c9,_0x1f9e09=0x0;_0x1560c9=_0x49c151['charAt'](_0x1f9e09++);~_0x1560c9&&(_0x327ae4=_0x58d0ed%0x4?_0x327ae4*0x40+_0x1560c9:_0x1560c9,_0x58d0ed++%0x4)?_0x256bca+=String['fromCharCode'](0xff&_0x327ae4>>(-0x2*_0x58d0ed&0x6)):0x0){_0x1560c9=_0x4234e9['indexOf'](_0x1560c9);}for(let _0x26e069=0x0,_0x4be85b=_0x256bca['length'];_0x26e069<_0x4be85b;_0x26e069++){_0x44f70b+='%'+('00'+_0x256bca['charCodeAt'](_0x26e069)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x44f70b);};_0x5a46['hUFRpu']=_0x1fe204,_0x5a46['UZqLyo']={},_0x5a46['GrgFGD']=!![];}const _0x5089da=_0x1e377f[0x0],_0x18ee43=_0x24e087+_0x5089da,_0x3f3433=_0x5a46['UZqLyo'][_0x18ee43];return!_0x3f3433?(_0x5a4625=_0x5a46['hUFRpu'](_0x5a4625),_0x5a46['UZqLyo'][_0x18ee43]=_0x5a4625):_0x5a4625=_0x3f3433,_0x5a4625;}const _0x4782f2=_0x5a46,_0x3cf677=_0x5a46;(function(_0x1674bc,_0x40446f){const _0xda5f7a=_0x5a46,_0x14e0df=_0x5a46,_0x131be0=_0x1674bc();while(!![]){try{const _0xa8e0f3=parseInt(_0xda5f7a(0x21c))/0x1+parseInt(_0xda5f7a(0x1e7))/0x2+-parseInt(_0x14e0df(0x21f))/0x3*(parseInt(_0xda5f7a(0x20a))/0x4)+parseInt(_0x14e0df(0x241))/0x5*(-parseInt(_0x14e0df(0x1cc))/0x6)+parseInt(_0xda5f7a(0x1cb))/0x7*(-parseInt(_0xda5f7a(0x1cd))/0x8)+parseInt(_0x14e0df(0x23f))/0x9+parseInt(_0xda5f7a(0x1d0))/0xa*(parseInt(_0xda5f7a(0x1ed))/0xb);if(_0xa8e0f3===_0x40446f)break;else _0x131be0['push'](_0x131be0['shift']());}catch(_0x2065e3){_0x131be0['push'](_0x131be0['shift']());}}}(_0x1e37,0xb74db));import{z as _0x256bca}from'@hono/zod-openapi';export const IntegrationTypeSchema=_0x256bca[_0x4782f2(0x1bb)]()['min'](0x1)[_0x3cf677(0x214)]({'example':'stripe','description':_0x3cf677(0x1ba)+'ion\x20type'+_0x4782f2(0x203)}),StripePaymentMethodSchema=_0x256bca['enum']([_0x3cf677(0x222),_0x4782f2(0x231)])['openapi']({'example':_0x3cf677(0x222),'description':_0x4782f2(0x1d2)+_0x4782f2(0x21b)+_0x3cf677(0x1f5)}),StripeIntegrationStoredConfigSchema=_0x256bca[_0x3cf677(0x217)]({'paymentMethods':_0x256bca[_0x4782f2(0x244)](StripePaymentMethodSchema)['max'](0x2)['optional'](),'secretKey':_0x256bca['string']()['trim']()[_0x4782f2(0x20e)](0x1)[_0x3cf677(0x20b)](),'webhookSecret':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1d9)]()['min'](0x1)[_0x4782f2(0x20b)]()})['strict'](),ResendIntegrationStoredConfigSchema=_0x256bca['object']({'apiKey':_0x256bca['string']()['trim']()[_0x3cf677(0x20e)](0x1)['optional'](),'fromEmail':_0x256bca[_0x4782f2(0x1bb)]()['trim']()[_0x4782f2(0x1de)]()[_0x4782f2(0x20b)]()})['strict'](),StripeIntegrationConfigSchema=_0x256bca[_0x4782f2(0x217)]({'paymentMethods':_0x256bca[_0x3cf677(0x244)](StripePaymentMethodSchema)[_0x4782f2(0x229)](0x2)[_0x3cf677(0x214)]({'example':[_0x4782f2(0x222),_0x3cf677(0x231)],'description':'Enabled\x20'+_0x4782f2(0x1d2)+'ayment\x20m'+_0x4782f2(0x250)+'or\x20the\x20o'+'rganizat'+'ion'}),'hasSecretKey':_0x256bca[_0x3cf677(0x1dd)]()['openapi']({'example':!0x0,'description':_0x3cf677(0x1d5)+_0x3cf677(0x24e)+_0x4782f2(0x1d3)+_0x4782f2(0x242)+_0x3cf677(0x23c)+_0x3cf677(0x1d8)}),'hasWebhookSecret':_0x256bca[_0x3cf677(0x1dd)]()['openapi']({'example':!0x0,'description':_0x4782f2(0x1d5)+'the\x20Stri'+_0x3cf677(0x1fc)+'ok\x20signi'+_0x4782f2(0x1c3)+'t\x20has\x20be'+_0x4782f2(0x200)+_0x4782f2(0x1c9)})})[_0x3cf677(0x24b)]()[_0x4782f2(0x214)](_0x4782f2(0x208)+_0x4782f2(0x221)+'nConfig'),UpsertStripeIntegrationConfigSchema=_0x256bca[_0x3cf677(0x217)]({'paymentMethods':_0x256bca['array'](StripePaymentMethodSchema)['max'](0x2)[_0x4782f2(0x214)]({'example':[_0x3cf677(0x222),_0x4782f2(0x231)],'description':_0x3cf677(0x1ef)+'Stripe\x20p'+_0x4782f2(0x21b)+'ethods\x20f'+_0x3cf677(0x1e5)+_0x3cf677(0x24f)+_0x4782f2(0x207)}),'secretKey':_0x256bca[_0x4782f2(0x1bb)]()['trim']()['min'](0x1)[_0x4782f2(0x20b)]()['openapi']({'example':_0x3cf677(0x215)+_0x3cf677(0x205)+'9','description':_0x3cf677(0x1e1)+_0x4782f2(0x247)+_0x3cf677(0x213)+_0x4782f2(0x1e3)+_0x4782f2(0x22c)+'on'}),'webhookSecret':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1d9)]()[_0x3cf677(0x20e)](0x1)[_0x3cf677(0x20b)]()['openapi']({'example':_0x3cf677(0x216)+_0x4782f2(0x1fd),'description':_0x4782f2(0x1c8)+_0x4782f2(0x1f2)+_0x3cf677(0x253)+_0x3cf677(0x1d1)+_0x4782f2(0x1e3)+'ganizati'+'on'})})[_0x4782f2(0x24b)]()[_0x3cf677(0x214)](_0x3cf677(0x1fa)+_0x4782f2(0x226)+_0x4782f2(0x235)+_0x4782f2(0x20f)),ResendIntegrationConfigSchema=_0x256bca[_0x4782f2(0x217)]({'hasApiKey':_0x256bca[_0x3cf677(0x1dd)]()[_0x4782f2(0x214)]({'example':!0x0,'description':'Whether\x20'+_0x3cf677(0x1fe)+_0x3cf677(0x1f7)+'ey\x20has\x20b'+_0x4782f2(0x23c)+_0x3cf677(0x1d8)}),'fromEmail':_0x256bca[_0x4782f2(0x1bb)]()[_0x4782f2(0x1d9)]()['email']()[_0x3cf677(0x20b)]()[_0x4782f2(0x214)]({'example':_0x4782f2(0x228)+'xample.c'+'om','description':_0x4782f2(0x246)+_0x3cf677(0x24a)+_0x4782f2(0x22f)+'ed\x20for\x20t'+_0x4782f2(0x206)+'onal\x20mes'+_0x4782f2(0x23a)})})[_0x4782f2(0x24b)]()[_0x3cf677(0x214)]('ResendIn'+'tegratio'+_0x3cf677(0x22b)),UpsertResendIntegrationConfigSchema=_0x256bca[_0x3cf677(0x217)]({'apiKey':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1d9)]()[_0x4782f2(0x20e)](0x1)[_0x3cf677(0x20b)]()[_0x3cf677(0x214)]({'example':_0x3cf677(0x20d)+_0x3cf677(0x1df),'description':_0x3cf677(0x1cf)+_0x3cf677(0x1e9)+_0x3cf677(0x1e5)+_0x3cf677(0x24f)+'ion'}),'fromEmail':_0x256bca[_0x3cf677(0x1bb)]()[_0x3cf677(0x1d9)]()[_0x4782f2(0x1de)]()[_0x3cf677(0x20b)]()[_0x4782f2(0x214)]({'example':_0x4782f2(0x228)+'xample.c'+'om','description':_0x3cf677(0x246)+_0x4782f2(0x24a)+_0x4782f2(0x22f)+_0x4782f2(0x219)+_0x4782f2(0x206)+_0x4782f2(0x23b)+_0x3cf677(0x23a)})})['strict']()['openapi']('UpsertRe'+_0x4782f2(0x23d)+_0x3cf677(0x235)+'onfig'),IntegrationConfigSchema=_0x256bca[_0x3cf677(0x251)](_0x256bca[_0x3cf677(0x1bb)](),_0x256bca[_0x3cf677(0x1c5)]())[_0x3cf677(0x214)](_0x3cf677(0x1ba)+_0x3cf677(0x249)+'g'),IntegrationSchema=_0x256bca[_0x4782f2(0x217)]({'organizationId':_0x256bca[_0x4782f2(0x1bb)]()[_0x4782f2(0x214)]({'example':_0x3cf677(0x1c2)+'67890abc'+_0x3cf677(0x238),'description':_0x3cf677(0x1d7)+_0x3cf677(0x1f8)}),'type':IntegrationTypeSchema,'config':IntegrationConfigSchema[_0x3cf677(0x214)]({'description':_0x3cf677(0x1c6)+_0x3cf677(0x1eb)+_0x4782f2(0x1b6)+_0x3cf677(0x1da)+_0x3cf677(0x21e)}),'createdAt':_0x256bca[_0x3cf677(0x1ce)]()[_0x3cf677(0x214)]({'description':_0x4782f2(0x1c1)+_0x4782f2(0x218)+_0x4782f2(0x1dc)+_0x3cf677(0x204)+_0x4782f2(0x234)+'ed'}),'updatedAt':_0x256bca[_0x4782f2(0x1ce)]()[_0x3cf677(0x214)]({'description':_0x3cf677(0x1c1)+_0x3cf677(0x218)+_0x4782f2(0x1dc)+_0x4782f2(0x204)+_0x3cf677(0x1e8)+'updated'})})[_0x4782f2(0x214)](_0x4782f2(0x1ba)+_0x4782f2(0x207)),UpsertIntegrationSchema=_0x256bca['object']({'config':_0x256bca[_0x3cf677(0x1c5)]()[_0x4782f2(0x214)]({'example':{'paymentMethods':[_0x3cf677(0x222),_0x3cf677(0x231)],'secretKey':_0x4782f2(0x215)+'12345678'+'9','webhookSecret':_0x3cf677(0x216)+_0x4782f2(0x1fd)},'description':_0x3cf677(0x1ba)+_0x4782f2(0x220)+_0x4782f2(0x1db)+_0x4782f2(0x1d4)+_0x4782f2(0x1c4)+_0x4782f2(0x1c7)+'pends\x20on'+_0x3cf677(0x21a)+_0x3cf677(0x240)+_0x4782f2(0x1f4)})})[_0x4782f2(0x214)](_0x3cf677(0x21d)+_0x3cf677(0x221)+'n'),SendTestEmailSchema=_0x256bca[_0x4782f2(0x217)]({'to':_0x256bca[_0x3cf677(0x1bb)]()['trim']()[_0x3cf677(0x1de)](_0x3cf677(0x243)+_0x3cf677(0x255)+_0x4782f2(0x210)+_0x3cf677(0x1b8))[_0x4782f2(0x214)]({'example':_0x3cf677(0x20c)+_0x3cf677(0x1fb),'description':_0x4782f2(0x233)+_0x3cf677(0x248)+_0x3cf677(0x236)+_0x4782f2(0x212)+_0x4782f2(0x1e4)})})[_0x4782f2(0x24b)]()[_0x4782f2(0x214)](_0x3cf677(0x239)+_0x3cf677(0x1f0)),SendTestEmailResponseSchema=_0x256bca[_0x3cf677(0x217)]({'success':_0x256bca[_0x4782f2(0x1dd)]()['openapi']({'example':!0x0,'description':_0x4782f2(0x1d5)+_0x4782f2(0x1e6)+_0x3cf677(0x232)+_0x3cf677(0x1b7)+_0x4782f2(0x1d6)+_0x4782f2(0x1ea)}),'message':_0x256bca[_0x3cf677(0x1bb)]()[_0x3cf677(0x214)]({'example':_0x4782f2(0x201)+_0x4782f2(0x1ca)+_0x4782f2(0x22d)+'example.'+_0x4782f2(0x22e),'description':_0x3cf677(0x1ec)+_0x4782f2(0x1f1)})})[_0x4782f2(0x214)](_0x4782f2(0x239)+_0x4782f2(0x209)+_0x3cf677(0x1be)),CreateStripeTestCheckoutSchema=_0x256bca[_0x4782f2(0x217)]({'returnUrl':_0x256bca[_0x3cf677(0x1bb)]()[_0x3cf677(0x1f6)]()[_0x4782f2(0x214)]({'example':'https://'+_0x4782f2(0x24c)+_0x4782f2(0x252)+_0x4782f2(0x1f9)+'settings'+_0x4782f2(0x1f3)+'tions/st'+_0x3cf677(0x1bf),'description':'URL\x20to\x20r'+_0x4782f2(0x22a)+_0x4782f2(0x1bc)+_0x3cf677(0x1b9)+_0x4782f2(0x1bd)+_0x3cf677(0x1c0)+_0x4782f2(0x1e2)+_0x3cf677(0x202)+_0x3cf677(0x225)+'d'})})[_0x3cf677(0x24b)]()[_0x4782f2(0x214)](_0x4782f2(0x223)+_0x3cf677(0x237)+_0x3cf677(0x1ee)),CreateStripeTestCheckoutResponseSchema=_0x256bca[_0x3cf677(0x217)]({'redirectUrl':_0x256bca[_0x3cf677(0x1bb)]()[_0x4782f2(0x1f6)]()[_0x4782f2(0x214)]({'example':_0x3cf677(0x211)+'checkout'+_0x4782f2(0x254)+_0x4782f2(0x230)+_0x4782f2(0x245)+_0x4782f2(0x1ff),'description':_0x3cf677(0x23e)+_0x3cf677(0x1c0)+_0x4782f2(0x24d)+'the\x20mock'+_0x4782f2(0x1e0)+_0x3cf677(0x227)})})['openapi'](_0x3cf677(0x223)+_0x4782f2(0x237)+_0x3cf677(0x1ee)+_0x3cf677(0x224));function _0x1e37(){const _0x58cb06=['AxmGy29TCgW','CIb0AguGB3i','C2fNzq','B3iGDgHLig8','DgHLihrLC3q','mtC1odm4uxLNDK1q','yxmGBgfZDca','ueKGA2v5igy','DwXSEq','BNrLz3jHDgK','uMvZDwX0ig0','mJyZodLZAfHjyM0','q2HLy2TVDxq','rw5HyMXLzca','rw1HAwW','zxnZywDL','zwjOB29Rihm','l2LUDgvNCMe','ihr5CguU','zxrOB2q','DxjS','BMqGqvbjigS','DgLVBIbjra','Dc9Hzg1PBI8','vxbZzxj0u3q','BxbSzs5JB20','CguGD2vIAg8','mZq1nJC4oq','DgHLifjLC2u','Df8XmJm','zw4Gy29UzMK','vgvZDcbLBwe','zxrLzcbVCIa','igTLEq','CMf0Aw9UihC','mtiZndu2nZG','CMfUC2fJDgK','Aw9U','u3rYAxbLsw4','rw1HAwXszxm','nde0mZe2s0jfvhnW','B3b0Aw9UywW','DgvZDebLEge','CMvFmtiZndu','BwLU','B25MAwC','y2LWAwvUDca','Ahr0Chm6lY8','DgvZDcbTzxm','ssbRzxKGzM8','B3bLBMfWAq','C2TFBgL2zv8','D2HZzwnFmti','B2jQzwn0','Ccb3AgvUihq','zwqGzM9Yihq','ihrOzsbPBNq','yxLTzw50ig0','mti5nti5mNfQExr5yq','vxbZzxj0sw4','iePtt04','mJrMALDHyue','Aw9UignVBMy','DgvNCMf0Aw8','y2fYza','q3jLyxrLu3q','uMvZCg9UC2u','y2fUy2vSBgu','CMLWzuLUDgu','C3nPB24','B3jKzxjZqgu','Bwf4','zxr1CM4GDg8','BKnVBMzPzW','z2fUAxPHDgK','Dg8GDgvZDea','y29T','zw1HAwWGDxm','y29Tl2mVCge','yMXPAW','igvTywLSihC','uMvJAxbPzw4','yxmGy3jLyxq','z3jHDgLVBKm','zM9YihrOzsa','CMLWzvrLC3q','zgvM','u2vUzfrLC3q','C2fNzxm','B25HBcbTzxm','zwvUignVBMy','C2vUzeLUDgu','u3rYAxbLiem','nZK5odCYm0jSAgLJsW','zwDYyxrPB24','mtuXmgHgtgj6Ca','zxKGAgfZigi','rw50zxiGysa','yxjYyxK','Es9JC190zxm','vMvYAwzPzwq','zwnYzxqGqva','DcbLBwfPBca','Aw9Uq29UzMK','ihnLBMrLCIa','C3rYAwn0','yxbWlNnOB3a','vvjmigzVCIa','DgHLifn0CMK','CMDHBML6yxq','zxrOB2rZigy','CMvJB3jK','Ag9ZDc50zxm','AwDUAw5Nihm','lNn0CMLWzs4','DMfSAwqGCMu','B24Gy29UzMK','yxmGC2vUDca','zw1HAwWU','AguGu3rYAxa','sw50zwDYyxq','C3rYAw5N','igfMDgvYihq','zsb0zxn0igm','Cg9UC2u','CMLWzq','AgvJA291Dca','vgLTzxn0yw0','y2XTmtiZndu','BMCGC2vJCMu','zc4GvMfSAwq','Dw5RBM93BG','u3rVCMvKigK','yxrPB24Gzgu','u3rYAxbLihC','z3vYzwq','AwWGC2vUDca','n2P3s1PMBa','mtaWntzesff5DvG','mJiYmdiWmhDltw91CG','zgf0zq','uMvZzw5Kiee','mZGWrMTHq0HZ','zwnYzxqGzM8','u3rYAxbLiha','CguGqvbjigS','BIbWyxLSB2e','v2HLDgHLCIa','C3vJy2vZC2y','t3jNyw5PEMe','AwD1CMvK','DhjPBq','z3vYyxrPB24','AwD1CMf0Aw8','AguGAw50zwC','yM9VBgvHBG','zw1HAwW','nJC4oq','ihrLC3qGC2u','u3rYAxbLihm'];_0x1e37=function(){return _0x58cb06;};return _0x1e37();}
1
+ import{z as e}from"@hono/zod-openapi";export const IntegrationTypeSchema=e.string().min(1).openapi({example:"stripe",description:"Integration type key"}),StripePaymentMethodSchema=e.enum(["card","blik"]).openapi({example:"card",description:"Stripe payment method"}),StripeIntegrationStoredConfigSchema=e.object({paymentMethods:e.array(StripePaymentMethodSchema).max(2).optional(),secretKey:e.string().trim().min(1).optional(),webhookSecret:e.string().trim().min(1).optional()}).strict(),ResendIntegrationStoredConfigSchema=e.object({apiKey:e.string().trim().min(1).optional(),fromEmail:e.string().trim().email().optional()}).strict(),StripeIntegrationConfigSchema=e.object({paymentMethods:e.array(StripePaymentMethodSchema).max(2).openapi({example:["card","blik"],description:"Enabled Stripe payment methods for the organization"}),hasSecretKey:e.boolean().openapi({example:!0,description:"Whether the Stripe API key has been configured"}),hasWebhookSecret:e.boolean().openapi({example:!0,description:"Whether the Stripe webhook signing secret has been configured"})}).strict().openapi("StripeIntegrationConfig"),UpsertStripeIntegrationConfigSchema=e.object({paymentMethods:e.array(StripePaymentMethodSchema).max(2).openapi({example:["card","blik"],description:"Enabled Stripe payment methods for the organization"}),secretKey:e.string().trim().min(1).optional().openapi({example:"sk_live_123456789",description:"Stripe secret API key for the organization"}),webhookSecret:e.string().trim().min(1).optional().openapi({example:"whsec_123456789",description:"Stripe webhook signing secret for the organization"})}).strict().openapi("UpsertStripeIntegrationConfig"),ResendIntegrationConfigSchema=e.object({hasApiKey:e.boolean().openapi({example:!0,description:"Whether the Resend API key has been configured"}),fromEmail:e.string().trim().email().optional().openapi({example:"orders@example.com",description:"Verified sender email used for transactional messages"})}).strict().openapi("ResendIntegrationConfig"),UpsertResendIntegrationConfigSchema=e.object({apiKey:e.string().trim().min(1).optional().openapi({example:"re_123456789",description:"Resend API key for the organization"}),fromEmail:e.string().trim().email().optional().openapi({example:"orders@example.com",description:"Verified sender email used for transactional messages"})}).strict().openapi("UpsertResendIntegrationConfig"),IntegrationConfigSchema=e.record(e.string(),e.unknown()).openapi("IntegrationConfig"),IntegrationSchema=e.object({organizationId:e.string().openapi({example:"clm1234567890abcdef",description:"Organization ID"}),type:IntegrationTypeSchema,config:IntegrationConfigSchema.openapi({description:"Stored integration configuration JSON"}),createdAt:e.date().openapi({description:"Timestamp when the integration was created"}),updatedAt:e.date().openapi({description:"Timestamp when the integration was last updated"})}).openapi("Integration"),UpsertIntegrationSchema=e.object({config:e.unknown().openapi({example:{paymentMethods:["card","blik"],secretKey:"sk_live_123456789",webhookSecret:"whsec_123456789"},description:"Integration configuration payload. Validation depends on the integration type."})}).openapi("UpsertIntegration"),SendTestEmailSchema=e.object({to:e.string().trim().email("Enter a valid recipient email.").openapi({example:"test@example.com",description:"Recipient email for the test message"})}).strict().openapi("SendTestEmail"),SendTestEmailResponseSchema=e.object({success:e.boolean().openapi({example:!0,description:"Whether the test email was sent successfully"}),message:e.string().openapi({example:"Test email sent to test@example.com",description:"Result message"})}).openapi("SendTestEmailResponse"),CreateStripeTestCheckoutSchema=e.object({returnUrl:e.string().url().openapi({example:"https://app.shophost.test/admin/settings/integrations/stripe",description:"URL to return to after the Stripe test checkout is completed or cancelled"})}).strict().openapi("CreateStripeTestCheckout"),CreateStripeTestCheckoutResponseSchema=e.object({redirectUrl:e.string().url().openapi({example:"https://checkout.stripe.com/c/pay/cs_test_123",description:"Stripe Checkout URL for the mock test session"})}).openapi("CreateStripeTestCheckoutResponse");
@@ -1 +1 @@
1
- const _0x2077b2=_0x1f23,_0x5a279a=_0x1f23;(function(_0x404b2b,_0xcec321){const _0x13a0cd=_0x1f23,_0xbd2c79=_0x1f23,_0x39e7b3=_0x404b2b();while(!![]){try{const _0x28fca0=-parseInt(_0x13a0cd(0x1be))/0x1+parseInt(_0x13a0cd(0x1bb))/0x2+-parseInt(_0xbd2c79(0x18b))/0x3*(-parseInt(_0xbd2c79(0x233))/0x4)+-parseInt(_0xbd2c79(0x205))/0x5*(parseInt(_0x13a0cd(0x1ce))/0x6)+parseInt(_0xbd2c79(0x1df))/0x7+-parseInt(_0xbd2c79(0x21d))/0x8+parseInt(_0xbd2c79(0x207))/0x9*(parseInt(_0xbd2c79(0x223))/0xa);if(_0x28fca0===_0xcec321)break;else _0x39e7b3['push'](_0x39e7b3['shift']());}catch(_0x2e8a34){_0x39e7b3['push'](_0x39e7b3['shift']());}}}(_0x4b7d,0x536bb));import{__awaiter as _0x5583d6}from'tslib';import{HttpException as _0x2e9fac}from'../../core/exceptions/http-exception';import{getStoredResendConfig as _0x424423,normalizeEmail as _0x47c099,normalizeSecret as _0x106957,normalizeStripePaymentMethods as _0x9ebcf0,parseResendStoredConfig as _0x49bb6c,parseStripeStoredConfig as _0x114a97}from'./integration-config';import{IntegrationSchema as _0x433663,ResendIntegrationConfigSchema as _0x51fbf3,StripeIntegrationConfigSchema as _0x5ad53a,UpsertResendIntegrationConfigSchema as _0x446d20,UpsertStripeIntegrationConfigSchema as _0x4e5e67}from'./integration.schema';function _0x1f23(_0x4f8ee0,_0x2f30b2){_0x4f8ee0=_0x4f8ee0-0x17c;const _0x4b7d39=_0x4b7d();let _0x1f23a4=_0x4b7d39[_0x4f8ee0];if(_0x1f23['caeMjs']===undefined){var _0x4f6538=function(_0x32f101){const _0x1b4110='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x7abde9='',_0x5b8279='';for(let _0x296026=0x0,_0x170da2,_0x2ba740,_0x458020=0x0;_0x2ba740=_0x32f101['charAt'](_0x458020++);~_0x2ba740&&(_0x170da2=_0x296026%0x4?_0x170da2*0x40+_0x2ba740:_0x2ba740,_0x296026++%0x4)?_0x7abde9+=String['fromCharCode'](0xff&_0x170da2>>(-0x2*_0x296026&0x6)):0x0){_0x2ba740=_0x1b4110['indexOf'](_0x2ba740);}for(let _0xb87fa=0x0,_0x2ff1ad=_0x7abde9['length'];_0xb87fa<_0x2ff1ad;_0xb87fa++){_0x5b8279+='%'+('00'+_0x7abde9['charCodeAt'](_0xb87fa)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5b8279);};_0x1f23['fSMwaU']=_0x4f6538,_0x1f23['hiymMD']={},_0x1f23['caeMjs']=!![];}const _0x19cb27=_0x4b7d39[0x0],_0x8a5a05=_0x4f8ee0+_0x19cb27,_0x50372a=_0x1f23['hiymMD'][_0x8a5a05];return!_0x50372a?(_0x1f23a4=_0x1f23['fSMwaU'](_0x1f23a4),_0x1f23['hiymMD'][_0x8a5a05]=_0x1f23a4):_0x1f23a4=_0x50372a,_0x1f23a4;}class U{constructor(_0x189307,_0x378d93,_0x5af0c1,_0x587eff){const _0x285a5b=_0x1f23,_0x1b5ab5=_0x1f23;this[_0x285a5b(0x234)]=_0x189307,this['integrat'+_0x285a5b(0x1ea)+_0x1b5ab5(0x187)]=_0x378d93,this[_0x1b5ab5(0x1ff)+'vice']=_0x5af0c1,this[_0x285a5b(0x1af)+_0x285a5b(0x211)]=_0x587eff;}[_0x2077b2(0x1b6)+'Config'](_0x316a8e,_0x3ca2e2){const _0x5699af=_0x2077b2,_0x22c1ff=_0x2077b2;var _0x1f2dd8;switch(_0x316a8e){case'stripe':{const _0x3ca230=_0x114a97(_0x3ca2e2);return _0x5ad53a[_0x5699af(0x199)]({'paymentMethods':(_0x1f2dd8=_0x3ca230?.[_0x22c1ff(0x201)+_0x22c1ff(0x1d8)])!==null&&_0x1f2dd8!==void 0x0?_0x1f2dd8:[],'hasSecretKey':!!_0x3ca230?.[_0x22c1ff(0x217)+'y'],'hasWebhookSecret':!!_0x3ca230?.[_0x22c1ff(0x231)+'ecret']});}case _0x22c1ff(0x1b9):{const _0x40713f=_0x49bb6c(_0x3ca2e2);return _0x51fbf3[_0x5699af(0x199)]({'hasApiKey':!!_0x40713f?.['apiKey'],'fromEmail':_0x40713f?.['fromEmai'+'l']});}default:return _0x3ca2e2&&typeof _0x3ca2e2==_0x22c1ff(0x22c)&&!Array[_0x22c1ff(0x21c)](_0x3ca2e2)?_0x3ca2e2:{};}}[_0x5a279a(0x1b6)+'Integrat'+_0x5a279a(0x1c9)](_0x254459){const _0x29327e=_0x2077b2,_0x43c7ef=_0x2077b2;return _0x433663[_0x29327e(0x199)](Object[_0x29327e(0x21a)](Object[_0x29327e(0x21a)]({},_0x254459),{'config':this[_0x43c7ef(0x1b6)+_0x29327e(0x17c)](_0x254459[_0x43c7ef(0x1c1)],_0x254459[_0x29327e(0x1a5)])}));}[_0x5a279a(0x222)+_0x5a279a(0x1da)+_0x5a279a(0x1c8)](_0x223876){return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x568ce0=_0x1f23,_0xd0c6c1=_0x1f23;if(!(yield this[_0x568ce0(0x234)]['organiza'+_0xd0c6c1(0x22d)][_0xd0c6c1(0x1dd)+'ue']({'where':{'id':_0x223876,'deletedAt':null},'select':{'id':!0x0}})))throw new _0x2e9fac(0x194,_0x568ce0(0x1a3)+_0xd0c6c1(0x1b5)+_0x568ce0(0x1d2));});}[_0x2077b2(0x1e0)+_0x2077b2(0x17c)](_0x18ff68,_0x11877e,_0x339167){const _0x162520=_0x2077b2,_0x2094fc=_0x2077b2,_0x39d66a={'kxCCl':function(_0x4bdac8,_0x51f822){return _0x4bdac8===_0x51f822;}};var _0x7d619b,_0x31fac4,_0x458b86,_0x5406f4,_0x415c8c,_0x5bf965,_0x2bb901,_0x2fa545;switch(_0x18ff68){case _0x162520(0x1cb):{const _0x55f762=_0x4e5e67[_0x162520(0x1ae)+'e'](_0x11877e);if(!_0x55f762['success'])throw new _0x2e9fac(0x190,(_0x31fac4=(_0x7d619b=_0x55f762[_0x2094fc(0x230)][_0x162520(0x1fd)][0x0])===null||_0x7d619b===void 0x0?void 0x0:_0x7d619b['message'])!==null&&_0x31fac4!==void 0x0?_0x31fac4:_0x2094fc(0x1b8)+_0x2094fc(0x237)+_0x162520(0x1e5)+_0x162520(0x22d));const _0x35e253=_0x114a97(_0x339167),_0x4760cc=(_0x458b86=_0x106957(_0x55f762['data'][_0x162520(0x217)+'y']))!==null&&_0x458b86!==void 0x0?_0x458b86:_0x35e253?.[_0x162520(0x217)+'y'],_0x564cf4=(_0x5406f4=_0x106957(_0x55f762['data'][_0x2094fc(0x231)+_0x162520(0x200)]))!==null&&_0x5406f4!==void 0x0?_0x5406f4:_0x35e253?.['webhookS'+_0x2094fc(0x200)];if(!_0x4760cc)throw new _0x2e9fac(0x190,'Stripe\x20A'+_0x162520(0x1a8)+_0x162520(0x17f)+'ed');if(!_0x564cf4)throw new _0x2e9fac(0x190,'Stripe\x20w'+'ebhook\x20s'+_0x162520(0x21e)+_0x2094fc(0x1c4)+'d');return{'paymentMethods':_0x9ebcf0(_0x55f762[_0x2094fc(0x228)][_0x2094fc(0x201)+_0x2094fc(0x1d8)]),'secretKey':_0x4760cc,'webhookSecret':_0x564cf4};}case'resend':{const _0x287072=_0x446d20[_0x162520(0x1ae)+'e'](_0x11877e);if(!_0x287072['success'])throw new _0x2e9fac(0x190,(_0x5bf965=_0x39d66a[_0x2094fc(0x1ec)](_0x415c8c=_0x287072[_0x162520(0x230)]['issues'][0x0],null)||_0x415c8c===void 0x0?void 0x0:_0x415c8c[_0x2094fc(0x20a)])!==null&&_0x5bf965!==void 0x0?_0x5bf965:_0x2094fc(0x1b8)+_0x162520(0x1e4)+_0x162520(0x1e5)+_0x2094fc(0x22d));const _0x59ad48=_0x49bb6c(_0x339167),_0x372ecc=(_0x2bb901=_0x106957(_0x287072[_0x2094fc(0x228)][_0x162520(0x1ab)]))!==null&&_0x2bb901!==void 0x0?_0x2bb901:_0x59ad48?.[_0x2094fc(0x1ab)],_0x4dca84=(_0x2fa545=_0x47c099(_0x287072[_0x162520(0x228)]['fromEmai'+'l']))!==null&&_0x2fa545!==void 0x0?_0x2fa545:_0x59ad48?.[_0x162520(0x215)+'l'];if(!_0x372ecc)throw new _0x2e9fac(0x190,_0x162520(0x220)+_0x2094fc(0x1a8)+'s\x20requir'+'ed');if(!_0x4dca84)throw new _0x2e9fac(0x190,_0x2094fc(0x1b3)+'ender\x20em'+_0x162520(0x1ee)+_0x2094fc(0x1b4));return{'apiKey':_0x372ecc,'fromEmail':_0x4dca84};}default:throw new _0x2e9fac(0x190,_0x162520(0x1b2)+_0x162520(0x1f7)+_0x162520(0x1f6)+_0x162520(0x1a7)+_0x18ff68);}}['getInteg'+_0x2077b2(0x229)](_0x5ebe42){const _0xcdcd0f=_0x5a279a,_0x38f5dc={'bCwNc':function(_0x17afca,_0x1172c8,_0x3fd574,_0x986bc4,_0x4f4c75){return _0x17afca(_0x1172c8,_0x3fd574,_0x986bc4,_0x4f4c75);}};return _0x38f5dc[_0xcdcd0f(0x226)](_0x5583d6,this,void 0x0,void 0x0,function*(){const _0x54ceff=_0xcdcd0f,_0x30fb64=_0xcdcd0f;return yield this['ensureOr'+_0x54ceff(0x1da)+_0x30fb64(0x1c8)](_0x5ebe42),this[_0x30fb64(0x20c)+_0x30fb64(0x1ea)+_0x54ceff(0x187)][_0x30fb64(0x21b)](_0x5ebe42)['map'](_0x1b2282=>this[_0x30fb64(0x1b6)+'Integrat'+_0x54ceff(0x1c9)](_0x1b2282));});}[_0x5a279a(0x203)+_0x2077b2(0x192)+'n'](_0x336850,_0x438f51,_0x4eac27,_0x45437f){return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x48b4f2=_0x1f23,_0x1438ee=_0x1f23;yield this[_0x48b4f2(0x222)+'ganizati'+'onExists'](_0x336850);const _0xe27007=this[_0x1438ee(0x20c)+_0x48b4f2(0x1ea)+_0x1438ee(0x187)][_0x1438ee(0x1eb)](_0x336850,_0x438f51),_0x4c42c8=this[_0x1438ee(0x1e0)+'Config'](_0x438f51,_0x45437f[_0x48b4f2(0x1a5)],_0xe27007?.[_0x1438ee(0x1a5)]),_0x354903=yield this[_0x1438ee(0x234)][_0x1438ee(0x20c)+_0x1438ee(0x1c9)][_0x48b4f2(0x1e7)]({'where':{'organizationId_type':{'organizationId':_0x336850,'type':_0x438f51}},'update':{'config':_0x4c42c8,'updatedBy':_0x4eac27},'create':{'organization':{'connect':{'id':_0x336850}},'type':_0x438f51,'config':_0x4c42c8,'createdBy':_0x4eac27,'updatedBy':_0x4eac27}});return this['integrat'+_0x48b4f2(0x1ea)+_0x48b4f2(0x187)][_0x48b4f2(0x1e7)](_0x354903),this[_0x1438ee(0x1b6)+'Integrat'+_0x48b4f2(0x1c9)](_0x354903);});}[_0x2077b2(0x22e)+_0x2077b2(0x192)+'n'](_0x4c0eed,_0x4598c4){const _0x386c5f={'dnlGX':function(_0x5935b6,_0x4c831b){return _0x5935b6===_0x4c831b;}};return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x363d8d=_0x1f23,_0x47eab5=_0x1f23;if(yield this[_0x363d8d(0x222)+_0x47eab5(0x1da)+_0x47eab5(0x1c8)](_0x4c0eed),_0x386c5f[_0x47eab5(0x1cf)]((yield this['prisma']['integrat'+_0x363d8d(0x1c9)][_0x47eab5(0x208)+'ny']({'where':{'organizationId':_0x4c0eed,'type':_0x4598c4}}))[_0x47eab5(0x194)],0x0))throw new _0x2e9fac(0x194,_0x363d8d(0x1f8)+_0x47eab5(0x1f4)+_0x363d8d(0x1a6));this[_0x363d8d(0x20c)+_0x47eab5(0x1ea)+_0x47eab5(0x187)][_0x47eab5(0x1c7)](_0x4c0eed,_0x4598c4);});}[_0x2077b2(0x17d)+_0x5a279a(0x20d)](_0xbee430,_0x24972f){const _0xa533fb=_0x5a279a,_0x4e11bf=_0x5a279a,_0x165026={'EtMKp':'</p>','yVYmM':_0xa533fb(0x185)+_0xa533fb(0x230)};return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0x223e05=_0x4e11bf,_0x1a4d2a=_0x4e11bf,_0x56db85=yield this[_0x223e05(0x234)][_0x223e05(0x190)+_0x223e05(0x22d)][_0x1a4d2a(0x1dd)+'ue']({'where':{'id':_0xbee430,'deletedAt':null},'select':{'id':!0x0,'name':!0x0,'email':!0x0}});if(!_0x56db85)throw new _0x2e9fac(0x194,'Organiza'+_0x223e05(0x1b5)+_0x1a4d2a(0x1d2));const _0x19f0ec=this[_0x1a4d2a(0x20c)+_0x1a4d2a(0x1ea)+_0x1a4d2a(0x187)]['get'](_0xbee430,'resend'),_0x233000=_0x424423(_0x19f0ec);if(!_0x233000?.[_0x1a4d2a(0x1ab)])throw new _0x2e9fac(0x190,_0x223e05(0x220)+'PI\x20key\x20i'+_0x1a4d2a(0x18a)+'nfigured'+_0x1a4d2a(0x1e9)+_0x223e05(0x236)+_0x223e05(0x202)+_0x1a4d2a(0x232));if(!_0x233000[_0x223e05(0x215)+'l'])throw new _0x2e9fac(0x190,'Sender\x20e'+_0x223e05(0x1e1)+_0x223e05(0x1e8)+'igured.\x20'+_0x223e05(0x1c6)+_0x223e05(0x1f9)+_0x223e05(0x213)+'st.');try{return yield this[_0x1a4d2a(0x1ff)+_0x1a4d2a(0x1a0)][_0x223e05(0x20b)+'l'](_0xbee430,{'from':_0x56db85[_0x223e05(0x1d9)]+'\x20<'+_0x233000[_0x223e05(0x215)+'l']+'>','to':[_0x24972f],'subject':_0x223e05(0x1bc)+_0x223e05(0x206)+_0x56db85[_0x223e05(0x1d9)],'html':[_0x223e05(0x18e)+_0x1a4d2a(0x1b7)+_0x223e05(0x1de)+_0x223e05(0x1f2)+_0x1a4d2a(0x188)+'BlinkMac'+_0x1a4d2a(0x1a1)+_0x223e05(0x1d5)+_0x223e05(0x1a9)+'Roboto,\x20'+_0x223e05(0x210)+_0x223e05(0x1fe)+'width:\x205'+'60px;\x20ma'+_0x1a4d2a(0x191)+_0x223e05(0x1dc)+_0x223e05(0x189)+_0x223e05(0x1ad)+_0x223e05(0x181),_0x223e05(0x219)+'e=\x22font-'+_0x1a4d2a(0x1ed)+_0x1a4d2a(0x1d0)+'-weight:'+'\x20600;\x20co'+_0x223e05(0x1ac)+_0x1a4d2a(0x239)+'rgin:\x200\x20'+_0x223e05(0x182)+_0x1a4d2a(0x227)+_0x1a4d2a(0x204)+_0x1a4d2a(0x1d3)+_0x223e05(0x1e2)+'1>','<p\x20style'+_0x223e05(0x1bf)+'ize:\x2014p'+_0x1a4d2a(0x224)+_0x223e05(0x22f)+'1.6;\x20col'+'or:\x20#6b7'+'280;\x20mar'+_0x223e05(0x183)+_0x1a4d2a(0x1c3),_0x223e05(0x19c)+_0x223e05(0x221)+'mail\x20sen'+_0x1a4d2a(0x18f)+_0x223e05(0x23a)+_0x1a4d2a(0x1cd)+'lor:\x20#11'+_0x223e05(0x19d)+_0x56db85[_0x1a4d2a(0x1d9)]+(_0x1a4d2a(0x19b)+_0x1a4d2a(0x1c2)+_0x1a4d2a(0x193)+_0x1a4d2a(0x1fb)+_0x223e05(0x1bd)+_0x223e05(0x1a2)+_0x223e05(0x195)+_0x223e05(0x1ba)+_0x1a4d2a(0x18d)+'.'),_0x1a4d2a(0x1cc),'<hr\x20styl'+_0x1a4d2a(0x22b)+'r:\x20none;'+_0x223e05(0x18c)+_0x1a4d2a(0x1f3)+_0x223e05(0x1ca)+_0x223e05(0x196)+_0x223e05(0x1ef)+_0x223e05(0x1f0)+_0x223e05(0x1f1),_0x1a4d2a(0x19e)+_0x223e05(0x1bf)+_0x1a4d2a(0x19f)+'x;\x20color'+_0x223e05(0x1c0)+_0x1a4d2a(0x1a4)+_0x223e05(0x214),_0x1a4d2a(0x1e3)+_0x1a4d2a(0x218)+_0x1a4d2a(0x197)+_0x223e05(0x184)+_0x1a4d2a(0x180)+_0x233000[_0x223e05(0x215)+'l'],_0x165026[_0x223e05(0x235)],'</div>'][_0x1a4d2a(0x225)]('')}),{'success':!0x0,'message':_0x223e05(0x1d6)+_0x223e05(0x1d7)+_0x223e05(0x1c5)+_0x24972f};}catch(_0x590afe){const _0x814edc=_0x590afe instanceof Error?_0x590afe['message']:_0x165026[_0x1a4d2a(0x19a)];throw new _0x2e9fac(0x1f4,_0x223e05(0x1e6)+_0x1a4d2a(0x209)+_0x1a4d2a(0x1fa)+_0x223e05(0x238)+_0x814edc);}});}[_0x2077b2(0x1db)+_0x5a279a(0x20e)+_0x5a279a(0x1f5)](_0xee4fa3,_0x392456,_0x2db58e){return _0x5583d6(this,void 0x0,void 0x0,function*(){const _0xb09bff=_0x1f23,_0x5755c7=_0x1f23,_0x3e0065=yield this[_0xb09bff(0x234)][_0xb09bff(0x190)+_0xb09bff(0x22d)][_0x5755c7(0x1dd)+'ue']({'where':{'id':_0xee4fa3,'deletedAt':null},'select':{'id':!0x0,'name':!0x0,'configuration':{'select':{'defaultCurrency':!0x0}}}});if(!_0x3e0065)throw new _0x2e9fac(0x194,_0xb09bff(0x1a3)+'tion\x20not'+_0x5755c7(0x1d2));try{const _0x1cd57b=yield this[_0x5755c7(0x1af)+_0xb09bff(0x211)][_0x5755c7(0x1b1)+_0x5755c7(0x20f)+_0x5755c7(0x212)+'n'](_0xee4fa3,{'cancelUrl':_0x2db58e,'customerEmail':_0x392456,'defaultCurrency':_0x3e0065[_0xb09bff(0x22a)+'ation'][_0x5755c7(0x1b0)+'urrency'],'organizationName':_0x3e0065[_0x5755c7(0x1d9)],'successUrl':_0x2db58e});if(!_0x1cd57b[_0x5755c7(0x1fc)])throw new _0x2e9fac(0x1f4,_0xb09bff(0x17e)+'id\x20not\x20r'+_0xb09bff(0x198)+_0xb09bff(0x1aa)+_0x5755c7(0x21f)+'\x20the\x20tes'+'t\x20sessio'+'n.');return{'redirectUrl':_0x1cd57b[_0xb09bff(0x1fc)]};}catch(_0x43d02c){if(_0x43d02c instanceof _0x2e9fac)throw _0x43d02c;const _0x4f558d=_0x43d02c instanceof Error?_0x43d02c['message']:_0x5755c7(0x185)+_0xb09bff(0x230);throw new _0x2e9fac(0x1f4,_0x5755c7(0x1e6)+_0xb09bff(0x186)+_0xb09bff(0x216)+_0x5755c7(0x1d4)+_0xb09bff(0x1d1)+_0x4f558d);}});}}function _0x4b7d(){const _0x18ced3=['EvzzBu0','pc9ZDhjVBMC','vgHPCYbPCYa','mtGYnZSIpG','phaGC3r5Bgu','AxPLoIaXmNa','DMLJzq','u3LZDgvTrM8','zwDYyxrPB24','t3jNyw5PEMe','zJSGBwfYz2K','y29UzMLN','zM91BMq','DhLWztOG','ueKGA2v5igK','B2uGvuKNlca','y2HLy2TVDxq','yxbPs2v5','Bg9YoIaJmte','mhb4idiWChG','C2fMzvbHCNm','C3rYAxbLu2u','zgvMyxvSDem','y3jLyxrLvgu','vw5ZDxbWB3i','uMvZzw5Kihm','zxf1AxjLza','DgLVBIbUB3q','C2fUAxrPEMu','Bgu9iMzVBNq','sw52ywXPzca','CMvZzw5K','AwD1CMvKigm','nZq0mdqYt2vbwgPY','vgvZDcbfBwe','C2vUzcbPBNq','nJeZodK0svvvsNfv','psjMB250lxm','oIaJownHm2e','DhLWzq','pIb0BYb2zxi','idi0ChG7iJ4','ihjLCxvPCMu','Dg8G','u2f2zsb0Agu','zgvSzxrL','B25fEgLZDhm','Aw9U','ihnVBgLKicm','C3rYAxbL','pc9WpG','DhLSzt0Iy28','mtC4otmZmLHzDMDKuG','zg5Sr1G','ChG7igzVBNq','y2TVDxq6ia','igzVDw5K','B24GAxmGD28','DgvZDcbJAgu','BNqSicDtzwC','vgvZDcbLBwe','AwWGC2vUDca','zxrOB2rZ','BMfTzq','z2fUAxPHDgK','y3jLyxrLu3q','yxv0BZSGCge','zMLUzfvUAxe','lwzHBwLSEtO','mJyXmdKZn0HWBNbRyW','DMfSAwrHDgu','BwfPBcbPCYa','CMTPBMC8l2G','u2vUDcb2Awe','uMvZzw5Kigm','B25MAwD1CMe','rMfPBgvKihq','DxbZzxj0','BM90ignVBMy','lIbtyxzLihq','Aw9UuMvNAxm','z2v0','A3Hdq2W','C2L6ztOGmJa','ywLSigLZihi','BwfYz2LUoIa','mJrWEcaWoYi','ic8+','ic1HChbSzs0','Dg9WoIaXChG','Aw9Uig5VDca','q2HLy2TVDxq','z3jHDgLVBIa','DgvKigLUDgu','sw50zwDYyxq','igLUDgvNCMe','zxn0igvTywK','ihLVDxiGuMu','DxjS','AxnZDwvZ','Awy7ig1HEc0','zw1HAwXtzxi','zwnYzxq','Cgf5BwvUDe0','CMf0Aw9Uigy','DxbZzxj0sw4','BNrLz3jHDgK','nw96EwLuta','AwWGzNjVBsa','ou5fEgTqvW','zgvSzxrLtwe','BYbZzw5Kihq','BwvZC2fNzq','C2vUzevTywK','Aw50zwDYyxq','rw1HAwW','CMLWzvrLC3q','C3rdAgvJA28','C2fUCY1Zzxi','CNzPy2u','DxrtzxnZAw8','DgLVBIbMAxi','BJOGmdSIpG','zNjVBuvTywK','ifn0CMLWzsa','C2vJCMv0s2u','ifnOB3bOB3m','pgGXihn0EwW','yxnZAwDU','BgLZDa','AxnbCNjHEq','mJuZoduZnLbJvvn4BW','zwnYzxqGAxm','ifvstcbMB3i','uMvZzw5Kiee','ysb0zxn0igu','zw5ZDxjLt3i','ndyXodGYmhn4D2fWDG','EdSGBgLUzs0','AM9PBG','yKn3tMm','pKvTywLSigK','zgf0yq','CMf0Aw9UCW','y29UzMLNDxi','zt0IyM9Yzgu','B2jQzwn0','DgLVBG','zgvSzxrLsw4','AgvPz2H0oIa','zxjYB3i','D2vIAg9VA1m','AxjZDc4','ndi2mgTUvw1HzW','ChjPC21H','rxrns3a','AguGAw50zwC','u3rYAxbLigm','BdOG','mtGYnZSGBwe','C3rYB25Nihm','q29UzMLN','C2vUzfrLC3q','u3rYAxbLigq','CYbYzxf1Axi','CJOG','oYi+','mcaXnNb4oYi','z2LUoIaWida','DdSGu2vUzgu','vw5RBM93BIa','BYbJCMvHDgu','Dhj5','C3LZDgvTlca','zgrPBMC6idq','CYbUB3qGy28','mtaYnKPZBLreqW','igjVCMrLCI0','B3jYzwn0BhK','pgrPDIbZDhK','DcbMCM9TidW','B3jNyw5PEMe','CMDPBJOGmca','DgvNCMf0Aw8','Awz5ihrOyxq','y291BNq','igLZignVBMy','ztvLn2vIoYa','DcaMBwLKzg8','zxr1CM4Gysa','CgfYC2u'];_0x4b7d=function(){return _0x18ced3;};return _0x4b7d();}export{U as IntegrationService};
1
+ import{__awaiter as c}from"tslib";import{HttpException as o}from"../../core/exceptions/http-exception";import{getStoredResendConfig as S,normalizeEmail as E,normalizeSecret as v,normalizeStripePaymentMethods as x,parseResendStoredConfig as y,parseStripeStoredConfig as w}from"./integration-config";import{IntegrationSchema as z,ResendIntegrationConfigSchema as k,StripeIntegrationConfigSchema as R,UpsertResendIntegrationConfigSchema as b,UpsertStripeIntegrationConfigSchema as C}from"./integration.schema";class U{constructor(e,i,n,t){this.prisma=e,this.integrationRegistry=i,this.emailService=n,this.stripeService=t}sanitizeConfig(e,i){var n;switch(e){case"stripe":{const t=w(i);return R.parse({paymentMethods:(n=t?.paymentMethods)!==null&&n!==void 0?n:[],hasSecretKey:!!t?.secretKey,hasWebhookSecret:!!t?.webhookSecret})}case"resend":{const t=y(i);return k.parse({hasApiKey:!!t?.apiKey,fromEmail:t?.fromEmail})}default:return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}}sanitizeIntegration(e){return z.parse(Object.assign(Object.assign({},e),{config:this.sanitizeConfig(e.type,e.config)}))}ensureOrganizationExists(e){return c(this,void 0,void 0,function*(){if(!(yield this.prisma.organization.findUnique({where:{id:e,deletedAt:null},select:{id:!0}})))throw new o(404,"Organization not found")})}validateConfig(e,i,n){var t,r,a,l,g,f,m,p;switch(e){case"stripe":{const d=C.safeParse(i);if(!d.success)throw new o(400,(r=(t=d.error.issues[0])===null||t===void 0?void 0:t.message)!==null&&r!==void 0?r:"Invalid Stripe configuration");const s=w(n),u=(a=v(d.data.secretKey))!==null&&a!==void 0?a:s?.secretKey,h=(l=v(d.data.webhookSecret))!==null&&l!==void 0?l:s?.webhookSecret;if(!u)throw new o(400,"Stripe API key is required");if(!h)throw new o(400,"Stripe webhook secret is required");return{paymentMethods:x(d.data.paymentMethods),secretKey:u,webhookSecret:h}}case"resend":{const d=b.safeParse(i);if(!d.success)throw new o(400,(f=(g=d.error.issues[0])===null||g===void 0?void 0:g.message)!==null&&f!==void 0?f:"Invalid Resend configuration");const s=y(n),u=(m=v(d.data.apiKey))!==null&&m!==void 0?m:s?.apiKey,h=(p=E(d.data.fromEmail))!==null&&p!==void 0?p:s?.fromEmail;if(!u)throw new o(400,"Resend API key is required");if(!h)throw new o(400,"Resend sender email is required");return{apiKey:u,fromEmail:h}}default:throw new o(400,`Unsupported integration type: ${e}`)}}getIntegrations(e){return c(this,void 0,void 0,function*(){return yield this.ensureOrganizationExists(e),this.integrationRegistry.list(e).map(n=>this.sanitizeIntegration(n))})}upsertIntegration(e,i,n,t){return c(this,void 0,void 0,function*(){yield this.ensureOrganizationExists(e);const r=this.integrationRegistry.get(e,i),a=this.validateConfig(i,t.config,r?.config),l=yield this.prisma.integration.upsert({where:{organizationId_type:{organizationId:e,type:i}},update:{config:a,updatedBy:n},create:{organization:{connect:{id:e}},type:i,config:a,createdBy:n,updatedBy:n}});return this.integrationRegistry.upsert(l),this.sanitizeIntegration(l)})}deleteIntegration(e,i){return c(this,void 0,void 0,function*(){if(yield this.ensureOrganizationExists(e),(yield this.prisma.integration.deleteMany({where:{organizationId:e,type:i}})).count===0)throw new o(404,"Integration not found");this.integrationRegistry.delete(e,i)})}sendTestEmail(e,i){return c(this,void 0,void 0,function*(){const n=yield this.prisma.organization.findUnique({where:{id:e,deletedAt:null},select:{id:!0,name:!0,email:!0}});if(!n)throw new o(404,"Organization not found");const t=this.integrationRegistry.get(e,"resend"),r=S(t);if(!r?.apiKey)throw new o(400,"Resend API key is not configured. Save the integration first.");if(!r.fromEmail)throw new o(400,"Sender email is not configured. Save the integration first.");try{return yield this.emailService.sendEmail(e,{from:`${n.name} <${r.fromEmail}>`,to:[i],subject:`Test Email from ${n.name}`,html:[`<div style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 560px; margin: 0 auto; padding: 40px 20px;">`,'<h1 style="font-size: 20px; font-weight: 600; color: #111827; margin: 0 0 16px;">Email integration is working</h1>','<p style="font-size: 14px; line-height: 1.6; color: #6b7280; margin: 0 0 24px;">',`This is a test email sent from <strong style="color: #111827;">${n.name}</strong> to verify that your Resend integration is configured correctly.`,"</p>",'<hr style="border: none; border-top: 1px solid #e5e7eb; margin: 24px 0;" />','<p style="font-size: 12px; color: #9ca3af; margin: 0;">',`Sent via Shophost &middot; Sender: ${r.fromEmail}`,"</p>","</div>"].join("")}),{success:!0,message:`Test email sent to ${i}`}}catch(a){const l=a instanceof Error?a.message:"Unknown error";throw new o(500,`Failed to send test email: ${l}`)}})}createStripeTestCheckout(e,i,n){return c(this,void 0,void 0,function*(){const t=yield this.prisma.organization.findUnique({where:{id:e,deletedAt:null},select:{id:!0,name:!0,configuration:{select:{defaultCurrency:!0}}}});if(!t)throw new o(404,"Organization not found");try{const r=yield this.stripeService.createTestCheckoutSession(e,{cancelUrl:n,customerEmail:i,defaultCurrency:t.configuration.defaultCurrency,organizationName:t.name,successUrl:n});if(!r.url)throw new o(500,"Stripe did not return a checkout URL for the test session.");return{redirectUrl:r.url}}catch(r){if(r instanceof o)throw r;const a=r instanceof Error?r.message:"Unknown error";throw new o(500,`Failed to create Stripe test checkout: ${a}`)}})}}export{U as IntegrationService};
@@ -1 +1 @@
1
- const _0xdfc160=_0x2122,_0x3098e2=_0x2122;(function(_0x547dad,_0x4a7c48){const _0x33ab56=_0x2122,_0xa1ff5d=_0x2122,_0x141c1b=_0x547dad();while(!![]){try{const _0x180d2a=-parseInt(_0x33ab56(0xb3))/0x1*(parseInt(_0xa1ff5d(0xee))/0x2)+-parseInt(_0x33ab56(0xbf))/0x3*(parseInt(_0x33ab56(0xd7))/0x4)+-parseInt(_0x33ab56(0xde))/0x5+-parseInt(_0x33ab56(0xd1))/0x6*(-parseInt(_0x33ab56(0xc1))/0x7)+parseInt(_0xa1ff5d(0xeb))/0x8*(-parseInt(_0x33ab56(0xc3))/0x9)+parseInt(_0xa1ff5d(0xaf))/0xa+parseInt(_0xa1ff5d(0xe5))/0xb*(parseInt(_0x33ab56(0xd3))/0xc);if(_0x180d2a===_0x4a7c48)break;else _0x141c1b['push'](_0x141c1b['shift']());}catch(_0x53cc88){_0x141c1b['push'](_0x141c1b['shift']());}}}(_0x50c1,0x5f49f));import{__awaiter as _0x43dec3}from'tslib';function _0x2122(_0x3c6397,_0x181ce8){_0x3c6397=_0x3c6397-0xa1;const _0x50c1d0=_0x50c1();let _0x21225c=_0x50c1d0[_0x3c6397];if(_0x2122['ZPSnto']===undefined){var _0x1d6b50=function(_0x499280){const _0x49e457='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x294c98='',_0x49f615='';for(let _0x20979f=0x0,_0x8b8076,_0x1f3282,_0x4ef56e=0x0;_0x1f3282=_0x499280['charAt'](_0x4ef56e++);~_0x1f3282&&(_0x8b8076=_0x20979f%0x4?_0x8b8076*0x40+_0x1f3282:_0x1f3282,_0x20979f++%0x4)?_0x294c98+=String['fromCharCode'](0xff&_0x8b8076>>(-0x2*_0x20979f&0x6)):0x0){_0x1f3282=_0x49e457['indexOf'](_0x1f3282);}for(let _0x156821=0x0,_0x4243fc=_0x294c98['length'];_0x156821<_0x4243fc;_0x156821++){_0x49f615+='%'+('00'+_0x294c98['charCodeAt'](_0x156821)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x49f615);};_0x2122['uEZKhG']=_0x1d6b50,_0x2122['WDjVCT']={},_0x2122['ZPSnto']=!![];}const _0x271f77=_0x50c1d0[0x0],_0x182969=_0x3c6397+_0x271f77,_0x4c6fd7=_0x2122['WDjVCT'][_0x182969];return!_0x4c6fd7?(_0x21225c=_0x2122['uEZKhG'](_0x21225c),_0x2122['WDjVCT'][_0x182969]=_0x21225c):_0x21225c=_0x4c6fd7,_0x21225c;}import{Prisma as _0x40ab00}from'../../core/db';import{CartItemSchema as _0x10418d}from'../cart/cart.schema';function _0x50c1(){const _0x10e67b=['Aw9UCW','zvf1yw50Axq','r3jVDxbZ','BM9YBwfSAxO','DgL0Bgu','zw0GCMf3igq','CxvHBNrPDhK','zNjVBq','DcbMB3vUza','C3rYAw5NAwy','rgjoDwXS','uhjVzhvJDa','Bwf4','thbeuxq','mJy0mZa2mejSy0P6Cq','EunVBMzSAwm','ChjVy2vZC2u','yxrHigLZigK','ntiXotq1AunntwHo','z2v0','y291BNq','DhjHBNnSyxq','ChjPC21H','yxzHAwXHyMW','CMf3rgf0yq','C2v0','Aw52ywXPzf8','DxbKyxrLtwe','B3jKzxi','zMXPy3rjDgu','mtG5otK2owflyMfQwa','BwfW','mJKWmdy2CfLABMrm','B25MBgLJDa','ovrZvvrSEq','zgvKDwn0zwq','sw52zw50B3i','zMLUzfvUAxe','DgLVBKLK','DMfSDwvZ','DgLVBG','ywXYzwfKEv8','zunHCNrjDgu','DxbKyxrL','EurLzhvJDgu','t3jKzxiGBM8','C3vJy2vZCW','DeL0zw1Z','ntrvz3LMDMu','ChjVzhvJDeK','mJq3ntK2Dvr0tujn','zMLSDgvY','zu9YzgvYsxq','ChjVy2vZC1a','ngnlAejrqG','ywLKt3jKzxi','zff1yw50Axq','A2v5CW','B3jNyw5PEMe','qKfrtNe','Bw9KAwzPzxi','mJy4otq5nxPgD2DYBG','ywrK','zMXHDe1HCa','ANDzqMu','DfzIvuS','zgf0yq','Def0','odi1sfLxvNv2','zMLUze1HBNK','jhrYyw5Zywm','yvfPugK','ChvZAa','BwLU','odeWmdi0q0XUvxfI','yNvPBgrdB24','uMPjseW','mLLxyMLoCa','ywDNCMvNyxq','y29UzMXPy3q','ChjVzhvJDa','AgfZq2fYDem','Aw5ZDwzMAwm','B3v0x29Mx3m','yxnZAwDU','Aw52zw50B3i','AwvUDf9ZDg8','CMvXDwvZDgu'];_0x50c1=function(){return _0x10e67b;};return _0x50c1();}class I extends Error{}class w{constructor(_0x91b9e){const _0x20b166=_0x2122;this[_0x20b166(0xb7)]=_0x91b9e;}[_0xdfc160(0xa4)+_0xdfc160(0xcb)+'ms'](_0x2c66dc,_0x3483a8){const _0x216f74=_0x3098e2,_0x2d1a3e=_0x3098e2,_0x589529={'BAQNq':function(_0x6923e9,_0x16bc75){return _0x6923e9!==_0x16bc75;}};var _0x215c55,_0x3059db,_0x3dc04b;const _0x89b6ec=new Map(_0x3483a8[_0x216f74(0xc0)](_0x187c9a=>[_0x187c9a['id'],_0x187c9a])),_0x2d6abe=new Set(),_0x4285bf=[],_0x233d0a=[],_0x3fa6a8=new Map();for(const _0x9f3978 of _0x2c66dc){const _0x313bfb=_0x89b6ec['get'](_0x9f3978[_0x216f74(0xd2)+'d']),_0x35ae7a=_0x9f3978[_0x2d1a3e(0xa7)]||0x1;if(!_0x313bfb){_0x2d6abe[_0x216f74(0xdf)](_0x9f3978[_0x2d1a3e(0xd2)+'d']),_0x233d0a[_0x2d1a3e(0xe9)]({'productId':_0x9f3978['productI'+'d'],'modifierGroups':_0x9f3978[_0x2d1a3e(0xdd)+_0x216f74(0xa3)],'reason':_0x216f74(0xbb)+'product','requestedQuantity':_0x35ae7a,'resolvedQuantity':0x0});continue;}if(_0x313bfb[_0x2d1a3e(0xb8)+_0x216f74(0xa2)+'y']===null||_0x313bfb[_0x2d1a3e(0xb8)+_0x216f74(0xa2)+'y']===void 0x0){_0x4285bf[_0x216f74(0xe9)](Object['assign'](Object[_0x2d1a3e(0xf5)]({},_0x9f3978),{'modifierGroups':_0x589529[_0x2d1a3e(0xdc)](_0x215c55=_0x9f3978[_0x2d1a3e(0xdd)+_0x2d1a3e(0xa3)],null)&&_0x215c55!==void 0x0?_0x215c55:[],'quantity':_0x35ae7a}));continue;}const _0x2d9872=(_0x3059db=_0x3fa6a8[_0x2d1a3e(0xb4)](_0x313bfb['id']))!==null&&_0x3059db!==void 0x0?_0x3059db:_0x313bfb[_0x216f74(0xb8)+_0x216f74(0xa2)+'y'],_0x15aabe=Math[_0x2d1a3e(0xea)](_0x35ae7a,_0x2d9872);if(_0x3fa6a8[_0x2d1a3e(0xba)](_0x313bfb['id'],Math[_0x216f74(0xad)](_0x2d9872-_0x15aabe,0x0)),_0x15aabe<=0x0){_0x233d0a[_0x2d1a3e(0xe9)]({'productId':_0x9f3978[_0x216f74(0xd2)+'d'],'modifierGroups':_0x9f3978[_0x216f74(0xdd)+_0x216f74(0xa3)],'reason':_0x2d1a3e(0xf4)+'tock','requestedQuantity':_0x35ae7a,'resolvedQuantity':0x0});continue;}_0x15aabe!==_0x35ae7a&&_0x233d0a[_0x2d1a3e(0xe9)]({'productId':_0x9f3978[_0x2d1a3e(0xd2)+'d'],'modifierGroups':_0x9f3978[_0x216f74(0xdd)+_0x2d1a3e(0xa3)],'reason':_0x2d1a3e(0xf3)+_0x216f74(0xf7)+'ck','requestedQuantity':_0x35ae7a,'resolvedQuantity':_0x15aabe}),_0x4285bf[_0x216f74(0xe9)](Object[_0x2d1a3e(0xf5)](Object[_0x216f74(0xf5)]({},_0x9f3978),{'modifierGroups':(_0x3dc04b=_0x9f3978[_0x2d1a3e(0xdd)+_0x2d1a3e(0xa3)])!==null&&_0x3dc04b!==void 0x0?_0x3dc04b:[],'quantity':_0x15aabe}));}return{'adjustments':_0x233d0a,'invalidProductIds':Array[_0x216f74(0xa8)](_0x2d6abe),'normalizedItems':_0x4285bf};}[_0xdfc160(0xf2)+_0xdfc160(0xc2)](_0x4c87ff,_0x1816f7){const _0xa914be=_0x3098e2,_0x1ca1d6=_0x3098e2;return JSON[_0xa914be(0xaa)+'y'](_0x4c87ff)!==JSON[_0x1ca1d6(0xaa)+'y'](_0x1816f7);}[_0x3098e2(0xef)+_0x3098e2(0xd5)+'ems'](_0x3ad1d7){const _0x4e622e=_0xdfc160,_0x32382b=_0xdfc160,_0x4f92de={'tVbUK':'Order\x20it'+_0x4e622e(0xa6)+_0x4e622e(0xb2)+'nvalid'};var _0x1a3971;const _0x8ad78b=new Map();for(const _0x10fe2 of _0x3ad1d7){const _0x406093=_0x10418d['safePars'+'e'](_0x10fe2[_0x32382b(0xb9)]);if(!_0x406093[_0x4e622e(0xcf)])throw new Error(_0x4f92de[_0x4e622e(0xe2)]);const _0x57ef30=_0x406093[_0x32382b(0xe3)],_0xfeb757=_0x8ad78b['get'](_0x57ef30[_0x4e622e(0xd2)+'d']),_0x4aa70d=((_0x1a3971=_0x10fe2[_0x4e622e(0xb6)+_0x4e622e(0xa1)][0x0])===null||_0x1a3971===void 0x0?void 0x0:_0x1a3971[_0x4e622e(0xa5)])||_0x4e622e(0xac);if(_0xfeb757){_0xfeb757[_0x32382b(0xf8)+_0x4e622e(0xd9)+'y']+=_0x57ef30[_0x32382b(0xa7)]||0x1;continue;}_0x8ad78b[_0x4e622e(0xba)](_0x57ef30['productI'+'d'],{'productId':_0x57ef30['productI'+'d'],'requestedQuantity':_0x57ef30[_0x32382b(0xa7)]||0x1,'title':_0x4aa70d});}return _0x8ad78b;}[_0xdfc160(0xec)+_0x3098e2(0xbe)+'ms'](_0x4c6146,_0x753440){const _0x2a3053=_0xdfc160,_0x12b71f=_0xdfc160,_0x9fc880={'jwYBe':function(_0x255951,_0x2cdd83){return _0x255951===_0x2cdd83;},'DjbTP':function(_0x2fbfb6,_0x30b373){return _0x2fbfb6!==_0x30b373;}},_0x18aaf3=new Map(_0x753440[_0x2a3053(0xc0)](_0x5a4b5a=>[_0x5a4b5a['id'],_0x5a4b5a]));return Array[_0x12b71f(0xa8)](_0x4c6146[_0x2a3053(0xc8)]())[_0x2a3053(0xe0)](_0x45c904=>{const _0x59519c=_0x12b71f,_0x2365c6=_0x12b71f;var _0x7dd1d3;const _0x4cc701=_0x18aaf3[_0x59519c(0xb4)](_0x45c904[_0x2365c6(0xd2)+'d']);if(_0x9fc880[_0x2365c6(0xe1)](_0x4cc701?.[_0x2365c6(0xb8)+_0x59519c(0xa2)+'y'],null))return[];const _0xb4b17f=Math['max'](_0x9fc880['DjbTP'](_0x7dd1d3=_0x4cc701?.[_0x2365c6(0xb8)+'eQuantit'+'y'],null)&&_0x7dd1d3!==void 0x0?_0x7dd1d3:0x0,0x0);return _0xb4b17f>=_0x45c904[_0x2365c6(0xf8)+_0x59519c(0xd9)+'y']?[]:[{'productId':_0x45c904[_0x2365c6(0xd2)+'d'],'title':_0x45c904[_0x59519c(0xa5)],'requestedQuantity':_0x45c904[_0x2365c6(0xf8)+_0x59519c(0xd9)+'y'],'availableQuantity':_0xb4b17f}];});}[_0xdfc160(0xd6)+_0xdfc160(0xd8)+_0x3098e2(0xc5)+'y'](_0x30f9c2){const _0x6c5b26=_0x3098e2,_0x285f91=_0x3098e2,_0x441507={'LpDQt':function(_0x202d9e,_0xe00f0f){return _0x202d9e!==_0xe00f0f;},'RjIHL':_0x6c5b26(0xc4),'aQiPi':_0x6c5b26(0xf0)};return _0x43dec3(this,void 0x0,void 0x0,function*(){const _0x1dd94b=_0x6c5b26,_0x3eb431=_0x6c5b26;var _0x3e2fd8;const _0x57648c=yield this[_0x1dd94b(0xb7)][_0x1dd94b(0xbd)]['findUniq'+'ue']({'where':{'id':_0x30f9c2},'include':{'items':{'include':{'translations':!0x0}}}});if(!_0x57648c)throw new Error(_0x3eb431(0xce)+_0x3eb431(0xa9));if(_0x57648c[_0x3eb431(0xf6)+'yDeducte'+'dAt'])return{'status':'already_'+_0x1dd94b(0xb1)+'d'};if(_0x57648c['inventor'+_0x1dd94b(0xb0)+_0x3eb431(0xe4)])return{'conflictItems':(_0x3e2fd8=_0x57648c[_0x1dd94b(0xf6)+'yConflic'+_0x3eb431(0xd0)])!==null&&_0x3e2fd8!==void 0x0?_0x3e2fd8:[],'status':_0x441507[_0x1dd94b(0xe8)]};const _0x4351fe=this[_0x3eb431(0xef)+_0x3eb431(0xd5)+'ems'](_0x57648c['items']);if(_0x4351fe['size']===0x0)return yield this[_0x3eb431(0xb7)]['order'][_0x1dd94b(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':null,'inventoryConflictItems':_0x40ab00[_0x3eb431(0xab)],'inventoryDeductedAt':new Date()}}),{'status':'deducted'};try{return yield this['prisma'][_0x3eb431(0xe7)+_0x1dd94b(0xc9)](_0x495994=>_0x43dec3(this,void 0x0,void 0x0,function*(){const _0x5d6557=_0x3eb431,_0x235f38=_0x3eb431;var _0x39e5c4,_0x2a0c88;const _0x524642=yield _0x495994[_0x5d6557(0xbd)][_0x235f38(0xc6)+'ue']({'where':{'id':_0x30f9c2},'select':{'id':!0x0,'inventoryConflictAt':!0x0,'inventoryConflictItems':!0x0,'inventoryDeductedAt':!0x0,'organizationId':!0x0}});if(!_0x524642)throw new Error(_0x5d6557(0xce)+'t\x20found');if(_0x524642[_0x235f38(0xf6)+_0x5d6557(0xcd)+'dAt'])return{'status':_0x5d6557(0xca)+_0x5d6557(0xb1)+'d'};if(_0x524642[_0x235f38(0xf6)+_0x5d6557(0xb0)+_0x235f38(0xe4)])return{'conflictItems':_0x441507[_0x5d6557(0xae)](_0x39e5c4=_0x524642[_0x235f38(0xf6)+'yConflic'+_0x5d6557(0xd0)],null)&&_0x441507[_0x235f38(0xae)](_0x39e5c4,void 0x0)?_0x39e5c4:[],'status':_0x5d6557(0xf0)};const _0x2763bb=yield _0x495994[_0x5d6557(0xf1)][_0x235f38(0xe6)]({'where':{'id':{'in':Array[_0x235f38(0xa8)](_0x4351fe[_0x5d6557(0xda)]())},'organizationId':_0x524642[_0x5d6557(0xdb)+'tionId']},'select':{'availableQuantity':!0x0,'id':!0x0}}),_0x594c6c=_0x2763bb[_0x5d6557(0xd4)](_0x5dcf2b=>_0x5dcf2b[_0x5d6557(0xb8)+_0x235f38(0xa2)+'y']!==null),_0x5ba993=this[_0x235f38(0xec)+_0x235f38(0xbe)+'ms'](_0x4351fe,_0x2763bb);if(_0x5ba993['length']>0x0)return yield _0x495994[_0x5d6557(0xbd)][_0x235f38(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':new Date(),'inventoryConflictItems':_0x5ba993}}),{'conflictItems':_0x5ba993,'status':_0x5d6557(0xf0)};for(const _0x402b0b of _0x594c6c){const _0xe76952=(_0x2a0c88=_0x4351fe[_0x5d6557(0xb4)](_0x402b0b['id']))===null||_0x2a0c88===void 0x0?void 0x0:_0x2a0c88[_0x5d6557(0xf8)+_0x235f38(0xd9)+'y'];if(!_0xe76952)continue;if((yield _0x495994[_0x235f38(0xf1)][_0x235f38(0xbc)+'ny']({'where':{'id':_0x402b0b['id'],'organizationId':_0x524642['organiza'+_0x235f38(0xc7)],'availableQuantity':{'gte':_0xe76952}},'data':{'availableQuantity':{'decrement':_0xe76952}}}))[_0x235f38(0xb5)]!==0x1)throw new I();}return yield _0x495994[_0x235f38(0xbd)][_0x235f38(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':null,'inventoryConflictItems':_0x40ab00[_0x235f38(0xab)],'inventoryDeductedAt':new Date()}}),{'status':_0x441507[_0x5d6557(0xed)]};}));}catch(_0x50a221){if(!(_0x50a221 instanceof I))throw _0x50a221;const _0x5f76b5=yield this[_0x3eb431(0xb7)][_0x3eb431(0xf1)]['findMany']({'where':{'id':{'in':Array[_0x1dd94b(0xa8)](_0x4351fe[_0x1dd94b(0xda)]())},'organizationId':_0x57648c[_0x3eb431(0xdb)+_0x3eb431(0xc7)]},'select':{'availableQuantity':!0x0,'id':!0x0}}),_0x5bdd50=this[_0x3eb431(0xec)+_0x1dd94b(0xbe)+'ms'](_0x4351fe,_0x5f76b5);return yield this[_0x3eb431(0xb7)][_0x1dd94b(0xbd)][_0x1dd94b(0xcc)]({'where':{'id':_0x30f9c2},'data':{'inventoryConflictAt':new Date(),'inventoryConflictItems':_0x5bdd50}}),{'conflictItems':_0x5bdd50,'status':_0x441507[_0x1dd94b(0xe8)]};}});}}export{w as InventoryService};
1
+ import{__awaiter as v}from"tslib";import{Prisma as m}from"../../core/db";import{CartItemSchema as g}from"../cart/cart.schema";class I extends Error{}class w{constructor(r){this.prisma=r}normalizeCartItems(r,d){var o,t,n;const e=new Map(d.map(i=>[i.id,i])),a=new Set,s=[],l=[],y=new Map;for(const i of r){const u=e.get(i.productId),c=i.quantity||1;if(!u){a.add(i.productId),l.push({productId:i.productId,modifierGroups:i.modifierGroups,reason:"invalid_product",requestedQuantity:c,resolvedQuantity:0});continue}if(u.availableQuantity===null||u.availableQuantity===void 0){s.push(Object.assign(Object.assign({},i),{modifierGroups:(o=i.modifierGroups)!==null&&o!==void 0?o:[],quantity:c}));continue}const p=(t=y.get(u.id))!==null&&t!==void 0?t:u.availableQuantity,f=Math.min(c,p);if(y.set(u.id,Math.max(p-f,0)),f<=0){l.push({productId:i.productId,modifierGroups:i.modifierGroups,reason:"out_of_stock",requestedQuantity:c,resolvedQuantity:0});continue}f!==c&&l.push({productId:i.productId,modifierGroups:i.modifierGroups,reason:"insufficient_stock",requestedQuantity:c,resolvedQuantity:f}),s.push(Object.assign(Object.assign({},i),{modifierGroups:(n=i.modifierGroups)!==null&&n!==void 0?n:[],quantity:f}))}return{adjustments:l,invalidProductIds:Array.from(a),normalizedItems:s}}hasCartConflict(r,d){return JSON.stringify(r)!==JSON.stringify(d)}aggregateOrderItems(r){var d;const o=new Map;for(const t of r){const n=g.safeParse(t.rawData);if(!n.success)throw new Error("Order item raw data is invalid");const e=n.data,a=o.get(e.productId),s=((d=t.translations[0])===null||d===void 0?void 0:d.title)||"Product";if(a){a.requestedQuantity+=e.quantity||1;continue}o.set(e.productId,{productId:e.productId,requestedQuantity:e.quantity||1,title:s})}return o}buildConflictItems(r,d){const o=new Map(d.map(t=>[t.id,t]));return Array.from(r.values()).flatMap(t=>{var n;const e=o.get(t.productId);if(e?.availableQuantity===null)return[];const a=Math.max((n=e?.availableQuantity)!==null&&n!==void 0?n:0,0);return a>=t.requestedQuantity?[]:[{productId:t.productId,title:t.title,requestedQuantity:t.requestedQuantity,availableQuantity:a}]})}processPaidOrderInventory(r){return v(this,void 0,void 0,function*(){var d;const o=yield this.prisma.order.findUnique({where:{id:r},include:{items:{include:{translations:!0}}}});if(!o)throw new Error("Order not found");if(o.inventoryDeductedAt)return{status:"already_processed"};if(o.inventoryConflictAt)return{conflictItems:(d=o.inventoryConflictItems)!==null&&d!==void 0?d:[],status:"conflict"};const t=this.aggregateOrderItems(o.items);if(t.size===0)return yield this.prisma.order.update({where:{id:r},data:{inventoryConflictAt:null,inventoryConflictItems:m.DbNull,inventoryDeductedAt:new Date}}),{status:"deducted"};try{return yield this.prisma.$transaction(n=>v(this,void 0,void 0,function*(){var e,a;const s=yield n.order.findUnique({where:{id:r},select:{id:!0,inventoryConflictAt:!0,inventoryConflictItems:!0,inventoryDeductedAt:!0,organizationId:!0}});if(!s)throw new Error("Order not found");if(s.inventoryDeductedAt)return{status:"already_processed"};if(s.inventoryConflictAt)return{conflictItems:(e=s.inventoryConflictItems)!==null&&e!==void 0?e:[],status:"conflict"};const l=yield n.product.findMany({where:{id:{in:Array.from(t.keys())},organizationId:s.organizationId},select:{availableQuantity:!0,id:!0}}),y=l.filter(u=>u.availableQuantity!==null),i=this.buildConflictItems(t,l);if(i.length>0)return yield n.order.update({where:{id:r},data:{inventoryConflictAt:new Date,inventoryConflictItems:i}}),{conflictItems:i,status:"conflict"};for(const u of y){const c=(a=t.get(u.id))===null||a===void 0?void 0:a.requestedQuantity;if(!c)continue;if((yield n.product.updateMany({where:{id:u.id,organizationId:s.organizationId,availableQuantity:{gte:c}},data:{availableQuantity:{decrement:c}}})).count!==1)throw new I}return yield n.order.update({where:{id:r},data:{inventoryConflictAt:null,inventoryConflictItems:m.DbNull,inventoryDeductedAt:new Date}}),{status:"deducted"}}))}catch(n){if(!(n instanceof I))throw n;const e=yield this.prisma.product.findMany({where:{id:{in:Array.from(t.keys())},organizationId:o.organizationId},select:{availableQuantity:!0,id:!0}}),a=this.buildConflictItems(t,e);return yield this.prisma.order.update({where:{id:r},data:{inventoryConflictAt:new Date,inventoryConflictItems:a}}),{conflictItems:a,status:"conflict"}}})}}export{w as InventoryService};